Floating-point variables - standard rep?
Posted: Thu Nov 20, 2003 3:20 pm
Could someone please tell me whether or not QB represents floating-point variables according to the IEEE standard?
E.g. the single-precision standard (32 bit) says that values are represented as:
S / EEEEEEEE / FFFFFFFFFFFFFFFFFFFFFFF
and the lowest representable numbers have absolute value equal to 2^(-23) * 2^(-126) = 2^(-149) = 1.4012984643248170709237295832899 * 10^(-45)
I think QB probably does conform to the standard, since it accepts a single-precision value of 2^(-149) but reads 2^(-150) as 0.
However, the helpfile, under QBasic Environment Limits / Name, String, and Number Limits, says the lowest representable numbers (single-precision) have absolute value equal to 2.802597 * 10*(-45), which is
2^(-148 ), rather than 2^(-149).
I'd be grateful if this could be nailed down definitively, e.g. that QB either does or does not use the IEEE standards for representing numerical variables of all four types (INTEGER, LONG, SINGLE, DOUBLE).
The standards are described at:
http://www.psc.edu/general/software/pac ... /ieee.html
Many thanks!
Chris
E.g. the single-precision standard (32 bit) says that values are represented as:
S / EEEEEEEE / FFFFFFFFFFFFFFFFFFFFFFF
and the lowest representable numbers have absolute value equal to 2^(-23) * 2^(-126) = 2^(-149) = 1.4012984643248170709237295832899 * 10^(-45)
I think QB probably does conform to the standard, since it accepts a single-precision value of 2^(-149) but reads 2^(-150) as 0.
However, the helpfile, under QBasic Environment Limits / Name, String, and Number Limits, says the lowest representable numbers (single-precision) have absolute value equal to 2.802597 * 10*(-45), which is
2^(-148 ), rather than 2^(-149).
I'd be grateful if this could be nailed down definitively, e.g. that QB either does or does not use the IEEE standards for representing numerical variables of all four types (INTEGER, LONG, SINGLE, DOUBLE).
The standards are described at:
http://www.psc.edu/general/software/pac ... /ieee.html
Many thanks!
Chris