Exact textual representation of an IEEE “double”

后端 未结 4 1257
星月不相逢
星月不相逢 2021-01-12 14:35

I need to represent an IEEE 754-1985 double (64-bit) floating point number in a human-readable textual form, with the condition that the textual form can be parsed back into

4条回答
  •  孤城傲影
    2021-01-12 15:08

    Yes, it can be done, though the implementation depends on the language. The basic idea is simply to print it out with sufficient precision.

    Note that the reverse is not true though: some numbers that can be represented precisely in decimal simply cannot be represented in binary.

提交回复
热议问题