[Coco] was: [...] Japanese?!?, Reply of Hirotsugu

Robert Gault robert.gault at worldnet.att.net
Sat Jan 8 16:17:51 EST 2005


Oops, sorry about that! First my response deals with DIVD not DIVQ. 
Second, the KD message was in the link of the previous message.

Here is better example which shows how divq goes wrong.

start	ldq	#$20000
	divq	#2
	swi
	end

regA=00 regB=02 regE=0 regF=0 they should be regD=0 regW=$8000

The smallest number that does work would be $1FFFE=$FFFF*2
Run as above, the result is regD=0 regW=$FFFF
Another type of failure is

start	ldq	$14B7EF8
	divq	#$1235
	swi
	end

regD=$1234 regW=1234 but this is almost right as the answer should be
21724920/4661=4660.999785 and 4660=$1234 and .999785*4661=4659.999982 
should be 4660 which is $1234. Even my calculator has truncation errors.

So divq can be massively wrong or almost right with rounding/truncation 
errors but you can't tell which is which without doing the math.



More information about the Coco mailing list