e_fmodl.c (71da0e146bade24dab085b2dc3c9f95940c4cf8a) e_fmodl.c (f2dc0faad005f11a43f79171d07fe98c31e75311)
1/* @(#)e_fmod.c 1.3 95/01/18 */
2/*-
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunSoft, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice

--- 118 unchanged lines hidden (view full) ---

127 }
128 }
129 hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
130 if(hz>=0) {hx=hz;lx=lz;}
131
132 /* convert back to floating value and restore the sign */
133 if((hx|lx)==0) /* return sign(x)*0 */
134 return Zero[sx];
1/* @(#)e_fmod.c 1.3 95/01/18 */
2/*-
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunSoft, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice

--- 118 unchanged lines hidden (view full) ---

127 }
128 }
129 hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
130 if(hz>=0) {hx=hz;lx=lz;}
131
132 /* convert back to floating value and restore the sign */
133 if((hx|lx)==0) /* return sign(x)*0 */
134 return Zero[sx];
135 while(hx<(1ULL<<HFRAC_BITS)) { /* normalize x */
135 while(hx<(1U<<HFRAC_BITS)) { /* normalize x */
136 hx = hx+hx+(lx>>MANL_SHIFT); lx = lx+lx;
137 iy -= 1;
138 }
139 ux.bits.manh = hx; /* The mantissa is truncated here if needed. */
140 ux.bits.manl = lx;
141 if (iy < LDBL_MIN_EXP) {
142 ux.bits.exp = iy + (BIAS + 512);
143 ux.e *= 0x1p-512;
144 } else {
145 ux.bits.exp = iy + BIAS;
146 }
147 x = ux.e * one; /* create necessary signal */
148 return x; /* exact output */
149}
136 hx = hx+hx+(lx>>MANL_SHIFT); lx = lx+lx;
137 iy -= 1;
138 }
139 ux.bits.manh = hx; /* The mantissa is truncated here if needed. */
140 ux.bits.manl = lx;
141 if (iy < LDBL_MIN_EXP) {
142 ux.bits.exp = iy + (BIAS + 512);
143 ux.e *= 0x1p-512;
144 } else {
145 ux.bits.exp = iy + BIAS;
146 }
147 x = ux.e * one; /* create necessary signal */
148 return x; /* exact output */
149}