简体   繁体   English

最大十进制指数IEEE 754

[英]Maximum Decimal Exponent IEEE 754

The Wikipedia page on the IEEE 754 standard contains a table that summarizes different floating point representation formats. IEEE 754标准的Wikipedia页面包含一个表格,该表格汇总了不同的浮点表示格式。 Here is an excerpt. 这是节选。

游戏

The meaning of the Decimal digits column is the number of digits the represented number its mantissa has if you convert it to decimal. Decimal digits列的含义是如果将其转换为小数,则表示其尾数具有的位数。 The page states that it is computed by (Significand bits)*log_10(2). 该页面指出它是通过(有效位数)* log_10(2)计算的。 I can see how that makes sense. 我知道这有什么意义。

However, I don't see what the meaning is of the Decimal E max column. 但是,我看不出Decimal E max列的含义是什么。 It is computed by (E max)*log_10(2) and is supposed to be "the maximum exponent in decimal". 它由(E max)* log_10(2)计算得出,并假定为“十进制的最大指数”。 But isn't E max the maximum exponent in decimal? 但是E max不是十进制的最大指数吗?

I'm asking because these 'decimal' values are the values (I think) that can be passed to selected_real_kind in Fortran. 我问是因为这些“十进制”值是可以传递给Fortran中的selected_real_kind的值(我认为)。 If you define a real with kind selected_real_kind(6, 37) it will be single precision. 如果您定义的实数类型为selected_real_kind(6, 37) ,它将是单精度的。 There will be (at least) 6 significand digits in your decimal number. 您的十进制数字中将至少有6个有效数字。 So a similar question is, what is the meaning of the 37? 因此,类似的问题是37的含义是什么? This is also the value returned by Fortran's range . 这也是Fortran的range返回的range The GNU Fortran docs state that "RANGE(X) returns the decimal exponent range in the model of the type of X", but it doesn't help me understand what it means. GNU Fortran文档指出“ RANGE(X)在X类型的模型中返回十进制指数范围”,但这无助于我理解其含义。

I always come up with an answer myself minutes after I've posted it on StackExchange even though I've been thinking about it all day... 即使我整天都在考虑它,但在将它发布到StackExchange上几分钟后,我总是会自己想出一个答案...

The number in binary is represented by m*2^(e) with m the mantissa and e the exponent in binary. 二进制数用m * 2 ^(e)表示,其中m尾数,e表示二进制数。 The maximum value of e for single precision is 127. 单精度的e最大值为127。

The number converted to decimal can be represented by m*10^(e) with m the mantissa and e the exponent in decimal. 转换为十进制的数字可以用m * 10 ^(e)表示,其中尾数m和e以十进制表示的指数。 To have the same (single) precision here, e has a maximum value of 127*log_10(2) = 38.23. 为了在此处具有相同(单个)精度,e的最大值为127 * log_10(2)= 38.23。 You can also see this by noticing m*10^(127*log_10(2)) = m*2^(127). 您还可以通过注意m * 10 ^(127 * log_10(2))= m * 2 ^(127)来查看此信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM