mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-13 15:27:18 +00:00
Bump exponent when needed.
This commit is contained in:
parent
3ef63b592e
commit
c559f1b65f
12
parse.c
12
parse.c
@ -491,12 +491,6 @@ int parse_float(
|
||||
DF(("msb_chopped_off = %16lx\n", msb_chopped_off));
|
||||
ufrac += msb_chopped_off;
|
||||
DF(("ufrac: %016lx after rounding\n", ufrac));
|
||||
|
||||
if ((ufrac >> 56) > 0) { /* Overflow? */
|
||||
ufrac >>= 1; /* Normalize */
|
||||
uexp++;
|
||||
DF(("ufrac: %016lx uexp: %02x\n", ufrac, uexp));
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Round to 56-bit approximation.
|
||||
@ -507,6 +501,12 @@ int parse_float(
|
||||
ufrac += round;
|
||||
}
|
||||
|
||||
if ((ufrac >> 56) > 0) { /* Overflow? */
|
||||
ufrac >>= 1; /* Normalize */
|
||||
uexp++;
|
||||
DF(("ufrac: %016lx uexp: %02x\n", ufrac, uexp));
|
||||
}
|
||||
|
||||
flt[0] = (unsigned) (sign | (uexp << 7) | ((ufrac >> 48) & 0x7F));
|
||||
if (size > 1) {
|
||||
flt[1] = (unsigned) ((ufrac >> 32) & 0xffff);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user