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

*** 20,29 **** --- 20,30 ---- */ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */
*** 62,96 **** extern enum fp_direction_type __swap87RD(enum fp_direction_type); #define k 0x7fff long double ! hypotl(long double x, long double y) { long double t1, t2, y1, y2, w; ! int *px = (int *) &x, *py = (int *) &y; ! int *pt1 = (int *) &t1, *py1 = (int *) &y1; enum fp_direction_type rd; int j, nx, ny, nz; px[2] &= 0x7fff; /* clear sign bit and padding bits of x and y */ py[2] &= 0x7fff; nx = px[2]; /* biased exponent of x and y */ ny = py[2]; if (ny > nx) { w = x; x = y; y = w; nz = ny; ny = nx; nx = nz; } /* force nx >= ny */ if (nx - ny >= 66) return (x + y); /* x / y >= 2**65 */ if (nx < 0x5ff3 && ny > 0x205b) { /* medium x,y */ /* save and set RD to Rounding to nearest */ rd = __swap87RD(fp_nearest); w = x - y; if (w > y) { pt1[2] = px[2]; pt1[1] = px[1]; pt1[0] = 0; t2 = x - t1; --- 63,102 ---- extern enum fp_direction_type __swap87RD(enum fp_direction_type); #define k 0x7fff long double ! hypotl(long double x, long double y) ! { long double t1, t2, y1, y2, w; ! int *px = (int *)&x, *py = (int *)&y; ! int *pt1 = (int *)&t1, *py1 = (int *)&y1; enum fp_direction_type rd; int j, nx, ny, nz; px[2] &= 0x7fff; /* clear sign bit and padding bits of x and y */ py[2] &= 0x7fff; nx = px[2]; /* biased exponent of x and y */ ny = py[2]; + if (ny > nx) { w = x; x = y; y = w; nz = ny; ny = nx; nx = nz; } /* force nx >= ny */ + if (nx - ny >= 66) return (x + y); /* x / y >= 2**65 */ + if (nx < 0x5ff3 && ny > 0x205b) { /* medium x,y */ /* save and set RD to Rounding to nearest */ rd = __swap87RD(fp_nearest); w = x - y; + if (w > y) { pt1[2] = px[2]; pt1[1] = px[1]; pt1[0] = 0; t2 = x - t1;
*** 105,116 **** --- 111,124 ---- pt1[1] = px[1]; pt1[0] = 0; t2 = x - t1; x = sqrtl(t1 * y1 - (w * (-w) - (t2 * y1 + y2 * x))); } + if (rd != fp_nearest) __swap87RD(rd); /* restore rounding mode */ + return (x); } else { if (nx == k || ny == k) { /* x or y is INF or NaN */ /* since nx >= ny; nx is always k within this block */ if (px[1] == 0x80000000 && px[0] == 0)
*** 118,140 **** --- 126,151 ---- else if (ny == k && py[1] == 0x80000000 && py[0] == 0) return (y); else return (x + y); } + if (ny == 0) { if (y == 0.L || x == 0.L) return (x + y); + pt1[2] = 0x3fff + 16381; pt1[1] = 0x80000000; pt1[0] = 0; py1[2] = 0x3fff - 16381; py1[1] = 0x80000000; py1[0] = 0; x *= t1; y *= t1; return (y1 * hypotl(x, y)); } + j = nx - 0x3fff; px[2] -= j; py[2] -= j; pt1[2] = nx; pt1[1] = 0x80000000;