]> granicus.if.org Git - yasm/commitdiff
Fix mantissa rounding overflow issue: 0xff -> 0x100, and shift right -> 0x80 is
authorPeter Johnson <peter@tortall.net>
Wed, 3 Oct 2001 07:41:11 +0000 (07:41 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 3 Oct 2001 07:41:11 +0000 (07:41 -0000)
not correct except when the 1 bit is explicit.

svn path=/trunk/yasm/; revision=257

libyasm/floatnum.c
src/floatnum.c

index a0488c9831c26b19841012b04c0deae3422e906d..6461f34134dbfad0baa95dd838d1b01c9e3243b3 100644 (file)
@@ -524,8 +524,9 @@ floatnum_get_common(unsigned char *ptr, const floatnum *flt, int byte_size,
        BitVector_increment(output);
 
     if (BitVector_bit_test(output, mant_bits)) {
-       /* overflowed, so divide mantissa by 2 (shift right) */
-       BitVector_shift_right(output, 0);
+       /* overflowed, so zero mantissa (and set explicit bit if necessary) */
+       BitVector_Empty(output);
+       BitVector_Bit_Copy(output, mant_bits-1, !implicit1);
        /* and up the exponent (checking for overflow) */
        if (exponent+1 >= EXP_INF)
            overflow = 1;
index a0488c9831c26b19841012b04c0deae3422e906d..6461f34134dbfad0baa95dd838d1b01c9e3243b3 100644 (file)
@@ -524,8 +524,9 @@ floatnum_get_common(unsigned char *ptr, const floatnum *flt, int byte_size,
        BitVector_increment(output);
 
     if (BitVector_bit_test(output, mant_bits)) {
-       /* overflowed, so divide mantissa by 2 (shift right) */
-       BitVector_shift_right(output, 0);
+       /* overflowed, so zero mantissa (and set explicit bit if necessary) */
+       BitVector_Empty(output);
+       BitVector_Bit_Copy(output, mant_bits-1, !implicit1);
        /* and up the exponent (checking for overflow) */
        if (exponent+1 >= EXP_INF)
            overflow = 1;