SidraM
SidraM

Reputation: 305

What does letter D represent in floating-point data

I have attached two pictures below in which I am stuck on one thing which is letter D. In floating-point why letter D is used? Letter E represents exponent but what letter D represents?

enter image description here

Please tell me the use of D Thanks

Upvotes: 1

Views: 672

Answers (3)

eoredson
eoredson

Reputation: 1165

Since single is 4-bytes and double is 8-bytes, the precision of each is such:

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

QB64 also has a 32-byte variable which is:

_FLOAT  1.18E-4932 to 1.18E+4932

Upvotes: 0

eoredson
eoredson

Reputation: 1165

Another way to convert a single precision string to the original value:

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

Upvotes: 0

meowmeow
meowmeow

Reputation: 60

It represents the precision of the data. Usually D means double precision

Upvotes: 3

Related Questions