Are there any situations where it would make more sense to use a single datatype instead of a double? From my searching, the disadvantage to a double is that it requires more space, which isn't a problem for most applications. In that case, should all floating point numbers be doubles?
A little background info: I'm working with an application that deals with a lot of data about coordinates and chemicals. A few customers have noticed that when importing spreadsheets of data, some values with high precision are rounded down the precision of a single.
From this .net article
Data Type Width
The most efficient data types are those that use the native data width of the run-time platform. On current platforms, the data width is 32 bits, for both the computer and the operating system.
Consequently, Integer is currently the most efficient data type in Visual Basic .NET. Next best are Long, Short, and Byte, in that order of efficiency. You can improve the performance of Short and Byte by turning off integer overflow checking, for example by setting the RemoveIntegerChecks property, but this incurs the risk of incorrect calculations due to undetected overflows. You cannot toggle this checking on and off during run time; you can only set its value for the next build of your application.
If you need fractional values, the best choice is Double, because the floating-point processors of current platforms perform all operations in double precision. Next best are Single and Decimal, in that order of efficiency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With