What exactly does '3.4E +/- 38 (7 digits)' mean? [closed]

偶尔善良 提交于 2019-12-08 18:04:49

问题


I'm trying to understand the range of data types. For non-floating point numbers it's easy enough, but then for float and double the ranges are listed as:

float: 3.4E +/- 38 (7 digits)

double: 1.7E +/- 308 (15 digits)

But in layman, what exactly does that mean, and how can I make use of that information?


回答1:


The

3.4E +/- 38

means that:

  • the largest positive value that a float can represent is about 3.4e38;
  • the smallest positive value is about 3.4e-38.

Similarly, the range of negative values is from -3.4e38 to about -3.4e-38.

Here, MeE denotes M multiplied by 10 to the E'th power.

The

(7 digits)

means that a float can represent approximately seven significant decimal digits.

The reason of these values are approximate is that they are exact in binary, and there's a fractional number of decimal digits for each binary digits.




回答2:


float: Range is from 3.4E-38 to 3.4E38 (positive or negative), with 7 significant digits of precision.

double: Range is from 1.7E-308 to 1.7E308 (positive or negative), with 15 significant digits of precision.

They also include 0.

mEe is computer notation for m times 10 to the e power.



来源:https://stackoverflow.com/questions/16029570/what-exactly-does-3-4e-38-7-digits-mean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!