How to manually parse a floating point number from a string

前端 未结 11 1508
攒了一身酷
攒了一身酷 2020-12-02 15:35

Of course most languages have library functions for this, but suppose I want to do it myself.

Suppose that the float is given like in a C or Java program (except for

11条回答
  •  感情败类
    2020-12-02 16:22

    For that you have to understand the standard IEEE 754 in order for proper binary representation. After that you can use Float.intBitsToFloat or Double.longBitsToDouble.

    http://en.wikipedia.org/wiki/IEEE_754

提交回复
热议问题