字母D在浮点数据中代表什么

时间:2018-08-10 11:25:21

标签: floating-point

我在下面附加了两张图片,其中我被粘在字母D上。为什么在字母D中使用字母D?字母E代表指数,但字母D代表什么?

enter image description here

请告诉我使用D 谢谢

3 个答案:

答案 0 :(得分:2)

它表示数据的精度。通常D表示双精度

答案 1 :(得分:0)

由于单字节是4个字节,双字节是8个字节,因此每个的精度是这样的:

SINGLE  2.802597E-45 to 3.402823E+38
DOUBLE  4.490656458412465D-324 to 1.797693134862310D+308

QB64还有一个32字节的变量,即:

_FLOAT  1.18E-4932 to 1.18E+4932

答案 2 :(得分:0)

将单个精度字符串转换为原始值的另一种方法:

REM Convert 4-byte IEEE string to single variable
S! = -3.1415
S$ = MKS$(S!)
Byte0 = ASC(MID$(S$, 1, 1))
Byte1 = ASC(MID$(S$, 2, 1))
Byte2 = ASC(MID$(S$, 3, 1))
Byte3 = ASC(MID$(S$, 4, 1))
Exponent = Byte3 AND &H7F
Exponent = Exponent * 2 + Byte2 \ 128 - &H7F
Mantissa! = Byte2 AND &H7F
Mantissa! = Mantissa! * &H10000 + Byte1 * &H100 + Byte0
Mantissa! = 1 + Mantissa! / (&H1000000 / 2)
Mantissa! = Mantissa! * 2 ^ Exponent
IF (Byte3 AND &H80) = &H80 THEN
    Mantissa! = -Mantissa!
END IF
PRINT Mantissa!
END