VOGONS


First post, by nagi

User metadata

Hi everybody,

dont know if this is the right area, but I just wanted to let you know of a bug in DosBox 0.63 which I discovered using QuickBasic:

the following line will produce incorrect results:

AT# = VAL( AT$)

eg: if AT$="05", VAL will convert it to 4.999999999999999

whereas it should be 5.000...

Hope you can fix this soon

and by the way, excellent job DosBox is cool

Reply 1 of 5, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

an attached exe/com file showing it would be handy.
4.99999999999 =5 in computer stuff. especially if it makes use of the fpu.
But maybe there is some rounding method going wrong

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 5, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Hmm... I can not confirm that bug. I tried this with a QBASIC from Win95OSR2:

10 AT$ = "05"
20 AT# = VAL(AT$)
30 PRINT AT#

Both DOSBox 0.63 and WinXP returned the same result: 5.

Edit: Ahh 😊 I did not know that QuickBasic != QBasic.

Last edited by MiniMax on 2005-01-11, 21:45. Edited 1 time in total.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 3 of 5, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

9642394: FPU:ESC 6:handled group 1 subfunction 1
fpumul 300000000000000000.000000 0.100000
output= 29999999999999996.000000

this is the problem.
due to huge order difference rounding errors apear (as we use less precission as a real fpu (64 vs 80 bits).
Will see if I can do some order and rescaling before multiplication
(or put the numbers in a 80 bit value before multiplication)

the dosbox code doing the fpumul:

a*=b;
LOG("output=%f",a);

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 5, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Up to then you could
a) use qbx which works (or qbasic)
b) use PRINT USING "#.###"; AT# or similar

Seems that QuickBasic has a different output
precision (dynamic?) than qbx and qbasic.

wd

Reply 5 of 5, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

problem is that a 80 bit 0.1 is read in as
0.0999999999....
as they multiply with a very large
30000000000000000000
it get's slightly off.
they do this operation 2 times. that gives the small difference.
I don't exaclty see at the moment why 4 gives correct answers then.

hmmm. will be tricky. Let's just hope load80 bits has a bug 😀

Water flows down the stream
How to ask questions the smart way!