Mercurial > hg > index.cgi
comparison src/fps.s @ 109:1a5da3594a9e
Fix exponent calculation in floating point multplication
When comparing signed values, use a signed branch. Otherwise things
don't work as expected for some reason....
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 24 Dec 2023 23:08:20 -0700 |
parents | 1f2f6c2a1fde |
children | 00c8df0b61f5 |
comparison
equal
deleted
inserted
replaced
108:b1958992a66a | 109:1a5da3594a9e |
---|---|
472 suba #64 ; remove bias | 472 suba #64 ; remove bias |
473 adda fpa0+fpa.exp ; add exponents | 473 adda fpa0+fpa.exp ; add exponents |
474 cmpa #63 ; did we overflow upward? | 474 cmpa #63 ; did we overflow upward? |
475 bgt OVERROR ; brif so | 475 bgt OVERROR ; brif so |
476 cmpa #-63 ; did we underflow? | 476 cmpa #-63 ; did we underflow? |
477 bhs fps_mul3 ; brif not | 477 bge fps_mul3 ; brif not |
478 fps_mul2 clr fpa0+fpa.exp ; return zero if we underflow | 478 fps_mul2 clr fpa0+fpa.exp ; return zero if we underflow |
479 leax ,y | 479 leax ,y |
480 jmp fps_pack0 | 480 jmp fps_pack0 |
481 fps_mul3 adda #64 ; add bias to resulting exponent | 481 fps_mul3 adda #64 ; add bias to resulting exponent |
482 sta fpa0+fpa.exp ; save result exponent | 482 sta fpa0+fpa.exp ; save result exponent |