Print this page
11210 libm should be cstyle(1ONBLD) clean

*** 16,28 **** --- 16,30 ---- * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ + /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */
*** 43,87 **** #include "libm.h" static const double zero = 0.0, half = 0.5; double ! remainder(double x, double p) { double halfp; int ix, hx, hp; ix = ((int *)&x)[HIWORD]; hx = ix & ~0x80000000; hp = ((int *)&p)[HIWORD] & ~0x80000000; if (hp > 0x7ff00000 || (hp == 0x7ff00000 && ((int *)&p)[LOWORD] != 0)) return (x * p); if (hx > 0x7ff00000 || (hx == 0x7ff00000 && ((int *)&x)[LOWORD] != 0)) return (x * p); if ((hp | ((int *)&p)[LOWORD]) == 0 || hx == 0x7ff00000) return (_SVID_libm_err(x, p, 28)); p = fabs(p); if (hp < 0x7fe00000) x = fmod(x, p + p); x = fabs(x); if (hp < 0x00200000) { if (x + x > p) { if (x == p) /* avoid x-x=-0 in RM mode */ ! return ((ix < 0)? -zero : zero); x -= p; if (x + x >= p) x -= p; } } else { halfp = half * p; if (x > halfp) { if (x == p) /* avoid x-x=-0 in RM mode */ ! return ((ix < 0)? -zero : zero); x -= p; if (x >= halfp) x -= p; } } ! return ((ix < 0)? -x : x); } --- 45,100 ---- #include "libm.h" static const double zero = 0.0, half = 0.5; double ! remainder(double x, double p) ! { double halfp; int ix, hx, hp; ix = ((int *)&x)[HIWORD]; hx = ix & ~0x80000000; hp = ((int *)&p)[HIWORD] & ~0x80000000; if (hp > 0x7ff00000 || (hp == 0x7ff00000 && ((int *)&p)[LOWORD] != 0)) return (x * p); + if (hx > 0x7ff00000 || (hx == 0x7ff00000 && ((int *)&x)[LOWORD] != 0)) return (x * p); if ((hp | ((int *)&p)[LOWORD]) == 0 || hx == 0x7ff00000) return (_SVID_libm_err(x, p, 28)); p = fabs(p); + if (hp < 0x7fe00000) x = fmod(x, p + p); + x = fabs(x); + if (hp < 0x00200000) { if (x + x > p) { if (x == p) /* avoid x-x=-0 in RM mode */ ! return ((ix < 0) ? -zero : zero); ! x -= p; + if (x + x >= p) x -= p; } } else { halfp = half * p; + if (x > halfp) { if (x == p) /* avoid x-x=-0 in RM mode */ ! return ((ix < 0) ? -zero : zero); ! x -= p; + if (x >= halfp) x -= p; } } ! ! return ((ix < 0) ? -x : x); }