github twitter email rss
Programming languages basic types
0001 Jun 1
One minute read

Programming languages basic types


Float ( Single )

Radix: Base 2 representation
Size: 32bit
Hardware supported
7 digits


Radix: Base 2 representation
Size: 64bit
Hardware supported
15-16 digits
Scientific calculations 10^(+/-300)
Fast calc, Infinity, NAN, -0 support, large/small numbers


Radix: Base 10 representation
Size: 128bit
Not hardware supported
28-29 significant digits    
base 10 accuracy
when you work with values in the range of 10^(+/-28) and where you have expectations about the behaviour based on base 10 representations.
Always use for money.
Support specific rounding modes.

.Net rounding

To nearest even number
Math.Round(3.5) == Math.Round(4.5)
5 == Math.Round(4.5, MidpointRounding.AwayFromZero)


  • Rounding, then comparision
  • Fixed precision comparasion (epsilon)
  • Relative precision comparasion

Back to posts

comments powered by Disqus