Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the .NET framework, why are there PointF (float) and no "PointD" (double)?

Can anyone explain why, in the .NET framework, there are PointF structures (using the single-precision float type) and no "PointD" (using the double-precision double type)?

Did they establish that such precision would never make sense in the System.Drawing namespace? Is there any other reason?

like image 390
Fueled Avatar asked Jul 07 '10 06:07

Fueled


1 Answers

At the time when GDI+ (the technology which System.Drawing is based on) was developed, hardware was nowhere near the performance and capability of today, and a Double-based coordinate system would have imposed a heavy burden on the hardware for very little benefit on the display-end, with displays having the size and resolution that they did. Even with today's monster video cards, we are only this year seeing the ability to do double-precision floating point operations that have acceptable performance, and these are still 1/2 the speed of single-precision ops. So it was a choice of practicality to use Single types to model the graphics operations.

Today, with WPF, we have a platform which began with an eye toward the next decade or two, and so using Double to model the coordinate system made sense.

like image 190
codekaizen Avatar answered Nov 15 '22 23:11

codekaizen