qdiv neg,pos
rjo__
Posts: 2,114
If I use qdiv to divide a negative number by a positive number, the upper two bits from getqx are being cleared.
?
Example: if I use 25 as my y coordinate and then rotate by 90 degrees ... fine. But if I use 100 and then divide the result by 4, rather than FF FF FF E7, I get 3F FF FF E7.
to see this, substitute #100 for number #25 and uncomment the two lines qdiv and getqx
?
Example: if I use 25 as my y coordinate and then rotate by 90 degrees ... fine. But if I use 100 and then divide the result by 4, rather than FF FF FF E7, I get 3F FF FF E7.
get_op mov yy,#25 mov xx,##0 qfrac ##90,#360 'convert to degrees getqx mytheta 'angle = ? wrlut mytheta,#2 setq yy qrotate xx,mytheta getqx new_x 'new_x = result x getqy new_y 'new_y = result y ' qdiv new_x,#4 ' getqx new_x ' doesn't work wrlut new_x,#3 wrlut new_y,#4 call #point2screen ret
to see this, substitute #100 for number #25 and uncomment the two lines qdiv and getqx