1 $NetBSD: patch-ac,v 1.1.1.1 2005/07/27 17:06:53 drochner Exp $
3 --- zerandom.c.orig 1998-11-24 05:08:12.000000000 +0000
6 As a special restriction the file must not be used in this or a modified
7 form on Microsoft and Be systems. */
12 +#include <machine/ieee.h>
17 @@ -15,15 +19,28 @@ zerandom (double low, double high)
18 /* Get two 31 bit random numbers for the initial mantissa. */
19 unsigned int r1 = random ();
20 unsigned int r2 = random ();
22 union ieee754_double u;
24 + union ieee_double_u u;
30 u.ieee.exponent = IEEE754_DOUBLE_BIAS - 1;
31 u.ieee.mantissa0 = r1 >> 1;
32 u.ieee.mantissa1 = r2 | r1 << 31;
34 res = low + 2 * (u.d - 0.5) * (high - low);
36 + u.dblu_dbl.dbl_sign = 0;
37 + u.dblu_dbl.dbl_exp = DBL_EXP_BIAS - 1;
38 + u.dblu_dbl.dbl_frach = r1 >> 1;
39 + u.dblu_dbl.dbl_fracl = r2 | r1 << 31;
41 + res = low + 2 * (u.dblu_d - 0.5) * (high - low);