File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
test/floating_point/float32_frexp/src Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1515_frexp:
1616_frexpf:
1717 ld iy, 0
18+ lea de, iy - 127 ; bias ; $FFFF81
1819 add iy, sp
1920 ld hl, (iy + 3)
2021 add hl, hl
@@ -29,7 +30,7 @@ _frexpf:
2930 rr b
3031 sbc hl, hl
3132 ld l, a
32- ld de, -127 ; bias
33+ ; ld de, -127 ; bias
3334 add hl, de
3435.ret_subnormal:
3536 res 7, (iy + 5)
@@ -47,22 +48,22 @@ _frexpf:
4748 jr .ret_self
4849
4950.maybe_subnormal:
50- add hl, bc
51- or a, a
52- sbc hl, bc
53- jr z , .ret_zero
51+ ld e, d ; ld de, -1
52+ add hl, de
53+ inc hl ; restore HL
54+ jr nc , .ret_zero
5455 ; input: HL output: A
5556 call __ictlz
5657 ld c, a
5758 call __ishl
5859 ld (iy + 3), hl
59- scf
60- sbc hl, hl
60+ sub a, 131 ; (127 + 3) + 1? idk where this magic number comes from
6161 cpl
62- add a, 131 ; 127 + 3 + 1? idk where this magic number comes from
62+ sbc hl, hl ; Carry is set here
6363 ld l, a
64- ld a, b ; exponent
65- xor a, $3F
64+ ; copy exponent of 0.5f
65+ ld a, b
66+ xor a, $3F
6667 ld b, a
6768 jr .ret_subnormal
6869
Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ size_t run_test(void) {
3131 result .flt = frexpf (input [i ], & expon );
3232 if (result .bin != output [i ].frac .bin || expon != output [i ].expon ) {
3333 if (!(isnan (result .flt ) && isnan (output [i ].frac .flt ))) {
34- // printf("G: %08lX %d\n", result.bin, expon);
35- // printf("T: %08lX %d\n", output[i].frac.bin, output[i].expon);
34+ #if 0
35+ printf ("G: %08lX %d\n" , result .bin , expon );
36+ printf ("T: %08lX %d\n" , output [i ].frac .bin , output [i ].expon );
37+ #endif
3638 return i ;
3739 }
3840 }
You can’t perform that action at this time.
0 commit comments