mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2024-09-28 11:54:48 +00:00
Fix rounding issues introduced by SANE bug workarounds.
The lrint functions could give the wrong result for negative numbers in upward/downward rounding modes. Casts to comp could also have different rounding behavior.
This commit is contained in:
parent
b6690c4826
commit
b01800ff77
@ -81,6 +81,12 @@ fpextra private dummy segment
|
||||
****************************************************************
|
||||
*
|
||||
~CompPrecision start
|
||||
tsc round to integer
|
||||
clc
|
||||
adc #4
|
||||
pea 0
|
||||
pha
|
||||
FRINTX
|
||||
lda 4+8,s
|
||||
pha save original sign
|
||||
asl a force sign to positive
|
||||
|
@ -34,3 +34,9 @@
|
||||
LDX #$090A
|
||||
JSL $E10000
|
||||
MEND
|
||||
MACRO
|
||||
&LAB FRINTX
|
||||
&LAB PEA $0014
|
||||
LDX #$090A
|
||||
JSL $E10000
|
||||
MEND
|
||||
|
11
math2.asm
11
math2.asm
@ -1136,17 +1136,20 @@ lrintl entry
|
||||
csubroutine (10:x),0
|
||||
|
||||
pei x+8 save sign of x
|
||||
asl x+8 x = abs(x)
|
||||
lsr x+8
|
||||
|
||||
tdc convert to integer
|
||||
tdc
|
||||
clc
|
||||
adc #x
|
||||
pea 0
|
||||
pha
|
||||
pea 0
|
||||
pha
|
||||
FX2C
|
||||
pea 0
|
||||
pha
|
||||
FRINTX round x to integer
|
||||
asl x+8 x = abs(x)
|
||||
lsr x+8
|
||||
FX2C convert to comp
|
||||
|
||||
lda x+4 if x is out of range of long
|
||||
ora x+6
|
||||
|
Loading…
Reference in New Issue
Block a user