-/* $OpenBSD: n_lgamma.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */
+/* $OpenBSD: n_lgamma.c,v 1.7 2008/07/16 15:25:51 martynas Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
} else if (x > 1e-16)
return (small_lgam(x));
else if (x > -1e-16) {
- if (x < 0)
- signgam = -1, x = -x;
+ if (x < 0) {
+ signgam = -1;
+ x = -x;
+ }
return (-log(x));
} else
return (neg_lgam(x));
else
return(infnan(ERANGE));
y = tgamma(x);
- if (y < 0)
- y = -y, signgam = -1;
+ if (y < 0) {
+ y = -y;
+ signgam = -1;
+ }
return (log(y));
}
z = floor(x + .5);
-/* $OpenBSD: n_log.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */
+/* $OpenBSD: n_log.c,v 1.7 2008/07/16 15:25:51 martynas Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
m = logb(x);
g = ldexp(x, -m);
if (_IEEE && m == -1022) {
- j = logb(g), m += j;
+ j = logb(g);
+ m += j;
g = ldexp(g, -j);
}
j = N*(g-1) + .5;
* u1 has at most 35 bits, and F*u1 is exact, as F has < 8 bits.
* It also adds exactly to |m*log2_hi + log_F_head[j] | < 750
*/
- if (m | j)
- u1 = u + 513, u1 -= 513;
+ if (m | j) {
+ u1 = u + 513;
+ u1 -= 513;
+ }
/* case 2: |1-x| < 1/256. The m- and j- dependent terms are zero;
* u1 = u to 24 bits.
m = logb(x);
g = ldexp(x, -m);
if (_IEEE && m == -1022) {
- j = logb(g), m += j;
+ j = logb(g);
+ m += j;
g = ldexp(g, -j);
}
j = N*(g-1) + .5;
u = 2*f*g;
v = u*u;
q = u*v*(A1 + v*(A2 + v*(A3 + v*A4)));
- if (m | j)
- u1 = u + 513, u1 -= 513;
+ if (m | j) {
+ u1 = u + 513;
+ u1 -= 513;
+ }
else {
u1 = u;
TRUNC(u1);
-/* $OpenBSD: n_support.c,v 1.11 2008/06/25 17:49:31 martynas Exp $ */
+/* $OpenBSD: n_support.c,v 1.12 2008/07/16 15:25:51 martynas Exp $ */
/* $NetBSD: n_support.c,v 1.1 1995/10/10 23:37:06 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
for(i=1;i<=k;i++) {
t=s+1; x *= 4; r /= 2;
if(t<=x) {
- s=t+t+2, x -= t; q += r;}
+ s = t+t+2;
+ x -= t;
+ q += r;
+ }
else
s *= 2;
}
/* subnormal number */
nx=0;
- if(yexp==0) {t=1.0,pt[n0]+=m57; y*=t; nx=m57;}
+ if (yexp == 0) {
+ t = 1.0;
+ pt[n0] += m57;
+ y *= t;
+ nx = m57;
+ }
/* if y is tiny (biased exponent <= 57), scale up y to y*2**57 */
if( yexp <= m57 ) {py[n0]+=m57; nx+=m57; yexp+=m57;}
-/* $OpenBSD: b_log__D.c,v 1.2 2008/06/12 22:15:36 martynas Exp $ */
+/* $OpenBSD: b_log__D.c,v 1.3 2008/07/16 15:25:51 martynas Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
m = logb(x);
g = ldexp(x, -m);
if (m == -1022) {
- j = logb(g), m += j;
+ j = logb(g);
+ m += j;
g = ldexp(g, -j);
}
j = N*(g-1) + .5;
u = 2*f*g;
v = u*u;
q = u*v*(A1 + v*(A2 + v*(A3 + v*A4)));
- if (m | j)
- u1 = u + 513, u1 -= 513;
+ if (m | j) {
+ u1 = u + 513;
+ u1 -= 513;
+ }
else {
u1 = u;
TRUNC(u1);