
strange behavior of qbasic
Welcome to the wonderful world of 'Merlin and Friends'. We're sooooo happy you
joined us and would like to know that all stakes, {*filter*}s, and torches are,
and have been, forever banned from our little kingdom. :D
Quote:
>i'm using qbasic 1.1 to write a simulation program where the time
>step is very small, so i have to use double precision variables.
>if i enter a line like
> Capacity# = 93.4# ,
>qbasic automatically changes it into
> Capacity# = 93.40000000000001# .
>the 1 at the 12th decimal does not really bother me, but i find it
>a little strange that qbasic changes some numbers one way, other
>numbers another way, and some numbers stay the way i wrote
>them.
Nope, this is quite normal. It is a physical impossibility to hold EVERY
number between +4B and -4B if you carry the precison of the decimal steps
between each number out to 16 places. For this reason things are 'rounded off'
in some cases because they just don't exist in the world of bits and bytes.
You may now take out the ole Model 97 and unload both barrels into the CPU for
better number crunching power....
C'ya,
____ _ ____ ____ _____
| _ \ / \ / ___) __ | ___)(_ _)
| |_) / _ \ \____\/ \| _) | |
|____//_/ \_\(____/\__/|_| |_|
www.basicguru.com/schullian