biggest integer that can be stored in a double

前端 未结 7 2171
清歌不尽
清歌不尽 2020-11-22 01:09

What is the biggest \"no-floating\" integer that can be stored in an IEEE 754 double type without losing precision ?

7条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 01:29

    DECIMAL_DIG from should give at least a reasonable approximation of that. Since that deals with decimal digits, and it's really stored in binary, you can probably store something a little larger without losing precision, but exactly how much is hard to say. I suppose you should be able to figure it out from FLT_RADIX and DBL_MANT_DIG, but I'm not sure I'd completely trust the result.

提交回复
热议问题