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 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */
*** 31,41 **** #include "libm.h" #include <float.h> /* DBL_MIN */ double ! nextafter(double x, double y) { int hx, hy, k; double ans; unsigned lx; volatile double dummy __unused; --- 33,44 ---- #include "libm.h" #include <float.h> /* DBL_MIN */ double ! nextafter(double x, double y) ! { int hx, hy, k; double ans; unsigned lx; volatile double dummy __unused;
*** 44,87 **** hy = ((int *)&y)[HIWORD]; k = (hx & ~0x80000000) | lx; if (x == y) return (y); /* C99 requirement */ if (x != x || y != y) return (x * y); if (k == 0) { /* x = 0 */ k = hy & 0x80000000; ((int *)&ans)[HIWORD] = k; ((int *)&ans)[LOWORD] = 1; } else if (hx >= 0) { if (x > y) { ((int *)&ans)[LOWORD] = lx - 1; ! k = (lx == 0)? hx - 1 : hx; ((int *)&ans)[HIWORD] = k; } else { ((int *)&ans)[LOWORD] = lx + 1; ! k = (lx == 0xffffffff)? hx + 1 : hx; ((int *)&ans)[HIWORD] = k; } } else { if (x < y) { ((int *)&ans)[LOWORD] = lx - 1; ! k = (lx == 0)? hx - 1 : hx; ((int *)&ans)[HIWORD] = k; } else { ((int *)&ans)[LOWORD] = lx + 1; ! k = (lx == 0xffffffff)? hx + 1 : hx; ((int *)&ans)[HIWORD] = k; } } k = (k >> 20) & 0x7ff; if (k == 0x7ff) { /* overflow */ return (_SVID_libm_err(x, y, 46)); #if !defined(__lint) } else if (k == 0) { /* underflow */ dummy = DBL_MIN * copysign(DBL_MIN, x); #endif } return (ans); } --- 47,95 ---- hy = ((int *)&y)[HIWORD]; k = (hx & ~0x80000000) | lx; if (x == y) return (y); /* C99 requirement */ + if (x != x || y != y) return (x * y); + if (k == 0) { /* x = 0 */ k = hy & 0x80000000; ((int *)&ans)[HIWORD] = k; ((int *)&ans)[LOWORD] = 1; } else if (hx >= 0) { if (x > y) { ((int *)&ans)[LOWORD] = lx - 1; ! k = (lx == 0) ? hx - 1 : hx; ((int *)&ans)[HIWORD] = k; } else { ((int *)&ans)[LOWORD] = lx + 1; ! k = (lx == 0xffffffff) ? hx + 1 : hx; ((int *)&ans)[HIWORD] = k; } } else { if (x < y) { ((int *)&ans)[LOWORD] = lx - 1; ! k = (lx == 0) ? hx - 1 : hx; ((int *)&ans)[HIWORD] = k; } else { ((int *)&ans)[LOWORD] = lx + 1; ! k = (lx == 0xffffffff) ? hx + 1 : hx; ((int *)&ans)[HIWORD] = k; } } + k = (k >> 20) & 0x7ff; + if (k == 0x7ff) { /* overflow */ return (_SVID_libm_err(x, y, 46)); #if !defined(__lint) } else if (k == 0) { /* underflow */ dummy = DBL_MIN * copysign(DBL_MIN, x); #endif } + return (ans); }