forked from KolibriOS/kolibrios
fixed ftoa procedure in calculator (fixed bug reported by Albom)
git-svn-id: svn://kolibrios.org@822 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3dac4b35a4
commit
7079b013bb
@ -468,14 +468,14 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
|
|
||||||
no_neg:
|
no_neg:
|
||||||
fld [tmp2]
|
fld [tmp2]
|
||||||
fist [integer]
|
|
||||||
fisub [integer]
|
|
||||||
fldcw [controlWord]
|
|
||||||
cmp byte [sign], 0 ; change fraction to positive
|
cmp byte [sign], 0 ; change fraction to positive
|
||||||
je no_neg2
|
je no_neg2
|
||||||
fchs
|
fchs
|
||||||
|
|
||||||
no_neg2:
|
no_neg2:
|
||||||
|
fadd [smallValueForRounding]
|
||||||
|
fist [integer]
|
||||||
|
fisub [integer]
|
||||||
mov [res],0 ; convert 6 decimal numbers
|
mov [res],0 ; convert 6 decimal numbers
|
||||||
mov edi,6
|
mov edi,6
|
||||||
|
|
||||||
@ -499,6 +499,7 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
jmp newd
|
jmp newd
|
||||||
|
|
||||||
real_done:
|
real_done:
|
||||||
|
fldcw [controlWord]
|
||||||
mov eax,[res]
|
mov eax,[res]
|
||||||
mov [decimal],eax
|
mov [decimal],eax
|
||||||
cmp [integer],0x80000000
|
cmp [integer],0x80000000
|
||||||
@ -510,10 +511,10 @@ ftoa: ; fpu st0 -> [integer],[decimal]
|
|||||||
mov [dsign],byte '+'
|
mov [dsign],byte '+'
|
||||||
cmp [sign],byte 0 ; convert negative result
|
cmp [sign],byte 0 ; convert negative result
|
||||||
je no_negative
|
je no_negative
|
||||||
mov eax,[integer]
|
; mov eax,[integer]
|
||||||
not eax
|
; not eax
|
||||||
inc eax
|
; inc eax
|
||||||
mov [integer],eax
|
; mov [integer],eax
|
||||||
mov [dsign],byte '-'
|
mov [dsign],byte '-'
|
||||||
|
|
||||||
no_negative:
|
no_negative:
|
||||||
@ -866,6 +867,7 @@ res dd 0
|
|||||||
trans1 dq 0
|
trans1 dq 0
|
||||||
trans2 dq 0
|
trans2 dq 0
|
||||||
controlWord dw 1
|
controlWord dw 1
|
||||||
|
smallValueForRounding dq 0.0000005 ; 1/2 from last significant digit
|
||||||
multipl: dd 10,16,2
|
multipl: dd 10,16,2
|
||||||
|
|
||||||
dsign:
|
dsign:
|
||||||
|
Loading…
Reference in New Issue
Block a user