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
Floating-point variables - standard rep?
Moderators:Administrator, Global Moderator
Re: Floating-point variables - standard rep?
It's been almost a year since you posted, but I just joined this forum, and saw your old post.chrisn wrote: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
While I do not claim of having knowledge of the numerical basis for any of the BASIC-based languages, I do recall that a bit is reserved for the sign. This, possibly, would explain the 2^-148 "smallest" number, rather than the IEEE 2^-149. Does this make sense to you?
QuickBASIC and IEEE
Sorry about that "Guest" post. I hadn't logged in, and didn't notice, until after I posted!
Ralph
Ralph
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.