Question I:
"DIV" is an INTEGER divide. Will only work on INTEGERs in the range -32768 to +32767 (while I seem to recall that -32768 DIV x doesn't work on some ROM versions)

Cheers,
Tobias

I don't see an FP version of DIV. Is there one?

Dave

DIV and MOD work on 16-bit values in SuperBASIC, 32 bit in SBASIC.

Umm, not sure what you mean by FP version of DIV - by definition it works on integer values.

Nearest equivalent to x DIV y would be INT(x/y) but this would also be limited to a 32 bit value on both SuperBASIC and SBASIC.

Might be possible to use the TK2 functions FDEC$, IDEC$ and CDEC$ (section 13.2 of TK2 manual) to work around these limits, but I don't know if they are limited to any particular length of number or integer value.

QDOS has problems with the extreme negative values of integers when using INPUT.
This text is quoted from Simon Goodwin's ROM bugs articles in QL World:

"INTEGER INPUT BUG
A sometimes annoying bug in all QL ROMs: Integers - whole
number values, stored in variables with a per cent sign at the end of their names - can have values between -32768 and 32767. The statement X%=-32768 works fine, but
X%=-32769 gives an error, as you might expect.
However you can't INPUT a value of -32768. If you try you get an 'error in
expression' report, because the QL works out the value of the digits before it sorts out the sign, plus or minus - and +32768 is not a valid integer. QDOS uses the same code to convert values from all devices, so the bug is present whether
you're INPUT comes from the keyboard or a file.
This is really just sloppy coding on the part of the ROM authors, who seem to have a lot of trouble with the value -32768. Last year I pointed out the weird results
you can get using that value with the integer DIV and MOD operators."

Dilwyn Jones
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to