None! Here is a testbed:

I was afraid you said that

I´m rebuilding the FPU functions for disassembler and debugger, and will have to make they work differently. I´ll need to update the debugger to it avoid those rounding anyway

The disassembler, i made a couple of fixes too, but allowing the rounding mode due to errors produced by some compilers throwing things like: 07ED 7FFFFFFF 00000000, or 07ED 13900F00 00000000 whenm the correct should be 07ED 80000000 00000000

Tks, JJ !

Thanks a lot Raymond.

i´ll be forced to make the function works without rounding or truncating (at least, for the debugger). Btw...do you know where i can find a scheme for Real10 values similar as this ?

https://en.wikipedia.org/wiki/Extended_precision I didn´t fully understood how to correctly categorize the error modes. Wiki said about 80 bit values, but the documentation seems to be related to 64 ?

I´m trying to redesign an old function in RosAsm, but i´m not sure about some values. On the FPU to string, it is converting values such as:

[Value1: D$ 0, 0FFFFFFFF W$ 0] ; This number exceeds the limit for FPU. It is converted to 6.724206...e-4932 Does it exceeds the limit ?

[Value2: B$ 0FE, 07F, 0, 0, 0C0, 07F, 0, 0, 0, 0] ; This number exceeds the limit for FPU. It is converted to 5.1201424......e-4937 Does it exceeds the limit ?

But i´m not sure, if those values are correct. Aren´t they exceeding the limit ? If so, how to force them to be handled according to the error mode/category ? Are they QNAN, indefinite etc ? If so, what are the bits related to settled QNAN etc for those 2 numbers in particular ?

[SpecialFPU_QNAN 1] ; QNAN

[SpecialFPU_SNAN 2] ; SNAN

[SpecialFPU_NegInf 3] ; Negative Infinite

[SpecialFPU_PosInf 4] ; Positive Infinite

[SpecialFPU_Indefinite 5] ; Indefinite

[SpecialFPU_SpecialIndefQNan 6] ; Special INDEFINITE QNAN

[SpecialFPU_SpecialIndefSNan 7] ; Special INDEFINITE SNAN

[SpecialFPU_SpecialIndefInfinite 8] ; Special INDEFINITE Infinite

Proc RealTenFPUNumberCategory:

Arguments @Float80Pointer

Local @FPUErrorMode

Uses edi, ebx

mov ebx D@Float80Pointer

mov D@FPUErrorMode &FALSE

...If_And W$ebx+8 = 0, D$ebx+4 = 0 ; This is denormalized, but it is possible.

; 0000 00000000 00000000

; 0000 00000000 FFFFFFFF

...Else_If_And W$ebx+8 = 0, D$ebx+4 > 0 ; This is Ok.

; 0000 00000001 00000000

; 0000 FFFFFFFF FFFFFFFF

...Else_If_And W$ebx+8 > 0, W$ebx+8 < 07FFF; This is ok only if the fraction Dword is bigger or equal to 080000000

.If D$ebx+4 < 080000000

.Test_If D$ebx+4 040000000

; QNAN 40000000

mov D@FPUErrorMode SpecialFPU_QNAN

.Test_Else

If_And D$ebx+4 > 0, D$ebx > 0

; SNAN only if at least 1 bit is set

mov D@FPUErrorMode SpecialFPU_SNAN

Else ; All fraction Bits are 0

; Bit 15 is never reached. The bit is 0 from W$ebx+8

; -INFINITE ; Bit15 = 0

mov D@FPUErrorMode SpecialFPU_NegInf

End_If

.Test_End

.End_If

...Else_If W$ebx+8 = 07FFF; This is ok only if the fraction Dword is bigger or equal to 080000000

.Test_If D$ebx+4 040000000

; QNAN 40000000

mov D@FPUErrorMode SpecialFPU_QNAN

.Test_Else

If_And D$ebx+4 > 0, D$ebx > 0

; SNAN only if at least 1 bit is set

mov D@FPUErrorMode SpecialFPU_SNAN

Else ; All fraction Bits are 0

; Bit 15 is never reached. The bit is 0 from W$ebx+8

; -INFINITE ; Bit15 = 0

; Test_If W$ebx+8 = 0FFFF ; we need to see if Bit 15 is set

; ; -INFINITE ; Bit15 = 0

; Test_Else

; ; +INFINITE ; Bit15 = 1

; Test_End

;mov D$edi '-INF', B$edi+4 0

mov D@FPUErrorMode SpecialFPU_NegInf

End_If

.Test_End

; Below is similar to W$ebx+8 = 0

...Else_If_And W$ebx+8 = 08000, D$ebx+4 = 0 ; This is denormalized, but possible.

; 8000 00000000 00000000 (0)

; 8000 00000000 FFFFFFFF (-0.0000000156560127730E-4933)

...Else_If_And W$ebx+8 = 08000, D$ebx+4 > 0 ; This is Ok.

; 8000 01000000 00000000 (-0.2626643080556322880E-4933)

; 8000 FFFFFFFF 00000001 (-6.7242062846585856000E-4932)

...Else_If_And W$ebx+8 > 08000, W$ebx+8 < 0FFFF; This is ok only if the fraction Dword is bigger or equal to 080000000

.If D$ebx+4 < 080000000

.Test_If D$ebx+4 040000000

; QNAN 40000000

mov D@FPUErrorMode SpecialFPU_QNAN

.Test_Else

If_And D$ebx+4 > 0, D$ebx > 0

; SNAN only if at least 1 bit is set

;mov D$edi 'SNaN', B$edi+4 0

mov D@FPUErrorMode SpecialFPU_SNAN

Else ; All fraction Bits are 0

; Bit 15 is always reached. The bit is 1 from W$ebx+8

; +INFINITE ; Bit15 = 1

;mov D$edi '+INF', B$edi+4 0

mov D@FPUErrorMode SpecialFPU_PosInf

End_If

.Test_End

.End_If

...Else_If W$ebx+8 = 0FFFF; This is to we identify indefined or other NAN values

.If_And D$ebx+4 >= 040000000, D$ebx = 0

; INDEFINITE

mov D@FPUErrorMode SpecialFPU_Indefinite

.Else

.Test_If D$ebx+4 040000000

; Special INDEFINITE QNAN 40000000

mov D@FPUErrorMode SpecialFPU_SpecialIndefQNan

.Test_Else

If_And D$ebx+4 > 0, D$ebx > 0

; Special INDEFINITE SNAN only if at least 1 bit is set

mov D@FPUErrorMode SpecialFPU_SpecialIndefSNan

Else ; All fraction Bits are 0

; Bit 15 is always reached. The bit is 1 from W$ebx+8

; Special INDEFINITE +INFINITE ; Bit15 = 1

mov D@FPUErrorMode SpecialFPU_SpecialIndefInfinite

End_If

.Test_End

.End_If

...End_If

..If D@FPUErrorMode <> 0

On B$edi-1 = '-', dec edi

.If D@FPUErrorMode = SpecialFPU_QNAN

push esi | zcopy {"QNAN ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_SNAN

push esi | zcopy {"SNAN ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_NegInf

push esi | zcopy {"-INFINITE ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_PosInf

push esi | zcopy {"+INFINITE ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_Indefinite

push esi | zcopy {"INDEFINITE ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_SpecialIndefQNan

push esi | zcopy {"Special INDEFINITE QNAN ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_SpecialIndefSNan

push esi | zcopy {"Special INDEFINITE SNAN ", 0} | pop esi

mov B$edi 0

.Else_If D@FPUErrorMode = SpecialFPU_SpecialIndefInfinite

push esi | zcopy {"Special INDEFINITE +INFINITE ", 0} | pop esi

mov B$edi 0

.End_If

..End_If

mov eax D@FPUErrorMode

EndP

Raistlin

Pps guga: the ladies in your avatar are too distracting, perhaps stars in certain places are appropriate ? 😈

Considering the time i made the avatar, those ladies must be kind old right now (or dead)

(They are not naked, you know...Only wearing a bikini)