diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-05-26 16:59:47 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-05-26 16:59:47 +0000 |
commit | 0a5d42def7ee0486de169c41396c08608b7fa4b1 (patch) | |
tree | 000dbdda490d593aaee393bd27a255ff6a533ef0 | |
parent | 4d3a95a6b6380606adccf3d0d5338ea83c29beb0 (diff) |
(__erand48_r): Don't generate numbers in [0.5,1.0) but really in [0.0, 1.0).
-rw-r--r-- | stdlib/erand48_r.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/erand48_r.c b/stdlib/erand48_r.c index 958c2e2799..b7deb4a1ff 100644 --- a/stdlib/erand48_r.c +++ b/stdlib/erand48_r.c @@ -39,11 +39,11 @@ erand48_r (xsubi, buffer, result) #if USHRT_MAX == 65535 temp.ieee.negative = 0; - temp.ieee.exponent = IEEE754_DOUBLE_BIAS - 1; + temp.ieee.exponent = IEEE754_DOUBLE_BIAS; temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12); temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4); /* Please note the lower 4 bits of mantissa1 are always 0. */ - *result = temp.d; + *result = temp.d - 1.0; #else # error Unsupported size of short int #endif |