Float & Double

Thread Starter

aamirali

Joined Feb 2, 2012
412
How floats & double are stored in a system.

How many decimal places (after decimal), does float & double support
 

steveb

Joined Jul 3, 2008
2,436
How floats & double are stored in a system.

How many decimal places (after decimal), does float & double support
You can google the IEEE standard. Most machines use that format.

http://en.wikipedia.org/wiki/Single-precision_floating-point_format

http://en.wikipedia.org/wiki/Double-precision_floating-point_format

It is very straight forward to figure out from the binary representation. The floats have 23 bits (and the implied most significant bit is 1), while doubles have 52 bits (and the implied most significant bit is 1). It is something like 7 and 15 decimal places, approximately.

Keep in mind that round off errors can accumulate with complex and multiple calculations. In the end, you may not have this accuracy, despite the precision of the representation.
 
Top