File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
test/floating_point/float32_ldexp/src Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,11 @@ _scalbn:
4747 bit 7, (iy + 11) ; scale sign
4848 jr z, .scale_up
4949.scale_down:
50- ; test signbit
50+ ; HL is not INT_MIN here
51+ dec hl
5152 add hl, hl
52- jr nc, .finish
53+ jr nc, .finish ; expon > 0
54+ ; expon <= 0 or subnormal
5355.underflow_to_zero:
5456 ld hl, ___fe_cur_env
5557 set 5, (hl) ; FE_INEXACT
@@ -99,7 +101,6 @@ end if
99101 ld e, (iy + 6)
100102 ret
101103
102-
103104else
104105
105106; normal inputs are handled correctly, unless the output is subnormal
@@ -132,9 +133,12 @@ _scalbn:
132133.scale_down:
133134 ; test signbit
134135 push hl
136+ ; HL is not INT_MIN here
137+ dec hl
135138 add hl, hl
136139 pop hl
137- jr nc, .finish
140+ jr nc, .finish ; expon > 0
141+ ; expon <= 0 or subnormal
138142; jr .underflow_to_zero
139143.underflow_to_zero:
140144 ld hl, ___fe_cur_env
Original file line number Diff line number Diff line change @@ -29,20 +29,16 @@ size_t run_test(void) {
2929 for (size_t i = 0 ; i < length ; i ++ ) {
3030 F32_pun result ;
3131 result .flt = ldexpf (input [i ].value , input [i ].expon );
32- // ignoring subnormal inputs for now
33- if (issubnormal (input [i ].value ) || issubnormal (output [i ].flt )) {
34- continue ;
35- }
3632 if (result .bin != output [i ].bin ) {
3733 // ignore NaN's with differing payloads
3834 // treat signed zeros as equal for now
3935 if (
4036 (!(isnan (result .flt ) && isnan (output [i ].flt ))) &&
41- (!(iszero ( result .flt ) && iszero (output [i ].flt )))
37+ (!(result .bin == 0 && iszero (output [i ].flt )))
4238 ) {
4339 /* Float multiplication does not handle subnormals yet */
44- if (!(iszero (result .flt ) && issubnormal (output [i ].flt ))) {
45- #if 0
40+ if (!(iszero (result .flt ) && ( issubnormal (output [i ].flt ) || issubnormal ( input [ i ]. value ) ))) {
41+ #if 1
4642 printf (
4743 "%zu:\nI: %08lX %+d\nG: %08lX\nT: %08lX\n" ,
4844 i , * (uint32_t * )(void * )& (input [i ].value ), input [i ].expon ,
You can’t perform that action at this time.
0 commit comments