]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__erand48_r): Don't generate numbers in [0.5,1.0) but really in [0.0, 1.0).
authorUlrich Drepper <drepper@redhat.com>
Mon, 26 May 1997 16:59:47 +0000 (16:59 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 26 May 1997 16:59:47 +0000 (16:59 +0000)
stdlib/erand48_r.c

index 958c2e2799a986e1ef492b1be8fdd4395ee56608..b7deb4a1ff365baeb337245bb4f3bdcc474512d0 100644 (file)
@@ -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