[fpc-devel] Math.DivMod results should be signed

Peter Vreman peter at freepascal.org
Thu Nov 9 13:21:56 CET 2006


> Peter Vreman wrote:
>> oldval:=value
>> divval:=value div divider
>> modval:=oldval-divval
>
> I don't see how this is correct ? And why you need oldval, you don't
> modify value ?
>
> oldval=5
> divval=5 div 2=2
> modval=5-2=3

Mistake... it should have been:

modval=oldval-(divval*divider)

oldval=5
divval=5 div 2=2
modval=5-(2*2)=1







More information about the fpc-devel mailing list