Floating point calculations using floats or doubles are performed on equipment that can produce different results for different architectures or optimization settings, as discussed here .
One thing that was briefly mentioned in this thread but didnβt fully answer is the System.Decimal case. It was noted that System.Decimal can be used as a consistent floating point type, that it will be very slow, and that the mathematical functions offered by .NET (System.Math) were not implemented for System.Decimal.
The only other bit of information I could find about this type is Mark Gravell, who says it is implemented in software that strongly hints that it is really consistent.
My question is this: can System.Decimal be used to get consistent results on all hardware platforms, or is it subject to the same problems as System.Single and System.Double?
If System.Decimal is consistent, is there a free library that implements transcendental functions for it (cos, sin, tan, sqrt, log, etc.)?
source share