Page 1 of 1
Bug?
Posted: Sat Nov 27, 2021 1:19 am
by pjw
Can anyone tell me whats going on here:
Code: Select all
a = 2^32: b = -2^32: PRINT a = b, a, b
a = 2^32: b = -(2^32): PRINT a = b, a, b
?!
To me it seems like the first result is wrong. The second line produces the result Id expect from line one.
Latest SMSQ/E and Qdos JS both display the same behaviour.
Re: Bug?
Posted: Sat Nov 27, 2021 1:49 am
by Andrew
pjw wrote:Can anyone tell me whats going on here:
Code: Select all
a = 2^32: b = -2^32: PRINT a = b, a, b
a = 2^32: b = -(2^32): PRINT a = b, a, b
?!
To me it seems like the first result is wrong. The second line produces the result Id expect from line one.
Latest SMSQ/E and Qdos JS both display the same behaviour.
The results are both correct.
-2 raised to any even power will be positive.
QL interprets -2^N as (-2)^N (as a single operation with 2 operands), while -(2^32) is actually 2 operations - first the raise to power and then the sign change
try
Also notice the difference
In first case the minus is not the sign of the number 2, but the substraction operation
In second case the minus is the sign of the number
Re: Bug?
Posted: Sat Nov 27, 2021 11:19 am
by pjw
Whoops! A bit of late Friday night brain fog!
Thanks, Andrew, for your patience
There were reasons why I stumbled down this particular rabbit hole. But since no actual rabbits were found I shant waste any more time with excuses or explanations.
Re: Bug?
Posted: Tue Feb 01, 2022 1:27 pm
by pjw
I was testing a program that worked fine on my QPC2 and SMSQmulator
setups, but crashed on Q-Emulator both with Qdos and Minerva with
TK2-2.32. To boil it down to basics this is what I found:
Code: Select all
ch = fopen('win1_test_bin')
get#ch\ 322: print fpos(#ch)
On JS it printed 382, and on Minerva 352; the correct answer should,
of course, be 322!
Is this a QL, TK2, or a Q-Emulator issue? I dont have any real QL
hardware to test on, so could someone please oblige and tell me where
the problem is?
Re: Bug?
Posted: Tue Feb 01, 2022 1:53 pm
by mk79
pjw wrote:Is this a QL, TK2, or a Q-Emulator issue? I dont have any real QL hardware to test on, so could someone please oblige and tell me where the problem is?
As far as I can see this is a QemuLator bug that only happens when the drive is mapped to a Windows directory and the file is one with a QemuLator header attached.
Re: Bug?
Posted: Tue Feb 01, 2022 2:39 pm
by XorA
mk79 wrote:pjw wrote:Is this a QL, TK2, or a Q-Emulator issue? I dont have any real QL hardware to test on, so could someone please oblige and tell me where the problem is?
As far as I can see this is a QemuLator bug that only happens when the drive is mapped to a Windows directory and the file is one with a QemuLator header attached.
Gah another corner case I now need to check!
Re: Bug?
Posted: Tue Feb 01, 2022 4:14 pm
by pjw
mk79 wrote:pjw wrote:Is this a QL, TK2, or a Q-Emulator issue? I dont have any real QL hardware to test on, so could someone please oblige and tell me where the problem is?
As far as I can see this is a QemuLator bug that only happens when the drive is mapped to a Windows directory and the file is one with a QemuLator header attached.
Thanks for checking, Marcel. I guess I shouldve done that myself before asking questions, but I was in the middle of something and then got stomped by this so moved on to something else hoping to have a solution by the time I returned..
Re: Bug?
Posted: Tue Feb 01, 2022 4:21 pm
by Derek_Stewart
Or maybe this is a feature, it seems Windows is packed with features...
Re: Bug?
Posted: Tue Feb 01, 2022 4:56 pm
by pjw
XorA wrote:mk79 wrote:pjw wrote:Is this a QL, TK2, or a Q-Emulator issue? I dont have any real QL hardware to test on, so could someone please oblige and tell me where the problem is?
As far as I can see this is a QemuLator bug that only happens when the drive is mapped to a Windows directory and the file is one with a QemuLator header attached.
Gah another corner case I now need to check!
Its vital that systems work the same way across the board so pleeease fix if needed and possible!
To my mind there should also be a common command across the board that can be queried to see which platform one is on. Eg PRINT PLATFORM$: 0001101001100101 (or whatever) with a dummy toolkit for QLs, with parameters set by users who know whether they have a (S)GC, SuperHermes, or whatever. Another is EMU_VER$ (or whatever). I know that a lot can be gleaned from the sysvars, but some platforms pride themselves on QL emulation, while in reality they sport important differences.
A case in point is my attempt to make a game that adapts itself to run on all platforms (WQRDLI). Its almost impossible! My "Bug?" query above arose from (the failure of) that attempt.
I cringe at the thought of newcomers or returnees trying to make sense out of this whole mess! Nice and valiant as, for example, QL/E is, a lot of programs just dont work "out of the box", and even I, a long-serving old-timer, dont know how (or cant be bothered) to try to fix them! Of course, most old programs have to be left to their fate, but at least new ones should be given a chance..
Re: Bug?
Posted: Fri Feb 04, 2022 9:17 pm
by XorA
Its vital that systems work the same way across the board so pleeease fix if needed and possible!
sQLux doesnt currently seem to suffer!