Re: [Ql-Users] Behaviour of DIV with negative numbers in SBASIC (QPC2)
John Alexander wrote: > I'm sure it was written in C, I've not seen a dump of that about > (is there one BTW??) Why guess, the source code is available on the web. And it is thousands upon thousands of lines of assembler code. Marcel ___ QL-Users Mailing List
Re: [Ql-Users] Behaviour of DIV with negative numbers in SBASIC (QPC2)
I'm sure it was written in C, I've not seen a dump of that about (is there one BTW??) As such an assembly dump of the ROM would be quite different to what was originally written. Could Tony enlighten us on that bit of history? Cheers John Alexander Sent from Yahoo Mail on Android On Wed, 11 Jan, 2017 at 12:51, Marcel Kilguswrote: Tony Tebby wrote: > If the divisor is negative, there is a problem. The "Euclidian division" > definition requires that the remainder be between 0 and |divisor|-1. > This would seem to be a rather less than rigorous definition as > |divisor| is not a continuous function. In SBASIC the MOD function gives > a remainder with the same sign as the divisor, which seemed, at the > time, to be more conventional, more logical and more useful. This forces > the use of the "floored division" approach (second graph in the Wiki > article Modulo Operation) as described by Tobias. Floored division for > DIV was not the choice, it was a consequence of the choice made for the > MOD operation. > > Tony Tebby Always good to hear the back-story to these things, thanks Tony! I've fixed a minor bug in SBasic a few days ago and I'm simply amazed by the amount of work that went into that code. Often I have a hard time understanding halve of it, but I guess after all this time you wouldn't fare much better? :-) Cheers, Marcel ___ QL-Users Mailing List ___ QL-Users Mailing List
Re: [Ql-Users] Behaviour of DIV with negative numbers in SBASIC (QPC2)
Tony Tebby wrote: > If the divisor is negative, there is a problem. The "Euclidian division" > definition requires that the remainder be between 0 and |divisor|-1. > This would seem to be a rather less than rigorous definition as > |divisor| is not a continuous function. In SBASIC the MOD function gives > a remainder with the same sign as the divisor, which seemed, at the > time, to be more conventional, more logical and more useful. This forces > the use of the "floored division" approach (second graph in the Wiki > article Modulo Operation) as described by Tobias. Floored division for > DIV was not the choice, it was a consequence of the choice made for the > MOD operation. > > Tony Tebby Always good to hear the back-story to these things, thanks Tony! I've fixed a minor bug in SBasic a few days ago and I'm simply amazed by the amount of work that went into that code. Often I have a hard time understanding halve of it, but I guess after all this time you wouldn't fare much better? :-) Cheers, Marcel ___ QL-Users Mailing List