Float & Double

Discussion in 'General Electronics Chat' started by aamirali, Jul 6, 2012.

  1. aamirali

    Thread Starter Member

    Feb 2, 2012
    415
    1
    How floats & double are stored in a system.

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

    Senior Member

    Jul 3, 2008
    2,433
    469
    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.
     
Loading...