-/* $OpenBSD: n_exp__E.c,v 1.7 2008/07/17 15:36:28 martynas Exp $ */
+/* $OpenBSD: n_exp__E.c,v 1.8 2008/07/18 13:08:58 martynas Exp $ */
/* $NetBSD: n_exp__E.c,v 1.1 1995/10/10 23:36:45 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
else
return(copysign(zero,x));
}
+
+ /* NOTREACHED */
}
-/* $OpenBSD: n_expm1.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */
+/* $OpenBSD: n_expm1.c,v 1.9 2008/07/18 13:08:58 martynas Exp $ */
/* $NetBSD: n_expm1.c,v 1.1 1995/10/10 23:36:46 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
double
expm1(double x)
{
- const static double one=1.0, half=1.0/2.0;
+ const static double one=1.0, half=1.0/2.0, tiny=1e-300;
double z,hi,lo,c;
int k;
#if defined(__vax__)
else
/* expm1(-big#) rounded to -1 (inexact) */
if(finite(x))
- { ln2hi+ln2lo; return(-one);}
+ return(tiny-one);
/* expm1(-INF) is -1 */
else return(-one);
-/* $OpenBSD: n_lgamma.c,v 1.7 2008/07/16 15:25:51 martynas Exp $ */
+/* $OpenBSD: n_lgamma.c,v 1.8 2008/07/18 13:08:58 martynas Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
t = .5*t*t;
z = 1.0;
switch (x_int) {
- case 6: z = (y + 5);
- case 5: z *= (y + 4);
- case 4: z *= (y + 3);
+ case 6: z = (y + 5); /* FALLTHROUGH */
+ case 5: z *= (y + 4); /* FALLTHROUGH */
+ case 4: z *= (y + 3); /* FALLTHROUGH */
case 3: z *= (y + 2);
rr = __log__D(z);
rr.b += a0_lo; rr.a += a0_hi;
return(((r+rr.b)+t+rr.a));
case 2: return(((r+a0_lo)+t)+a0_hi);
- case 0: r -= log1p(x);
+ case 0: r -= log1p(x); /* FALLTHROUGH */
default: rr = __log__D(x);
rr.a -= a0_hi; rr.b -= a0_lo;
return(((r - rr.b) + t) - rr.a);
q = hi*t;
z = 1.0;
switch (x_int) {
- case 6: z = (y + 5);
- case 5: z *= (y + 4);
- case 4: z *= (y + 3);
- case 3: z *= (y + 2);
+ case 6: z = (y + 5); /* FALLTHROUGH */
+ case 5: z *= (y + 4); /* FALLTHROUGH */
+ case 4: z *= (y + 3); /* FALLTHROUGH */
+ case 3: z *= (y + 2); /* FALLTHROUGH */
rr = __log__D(z);
r += rr.b; r += q;
return(rr.a + r);
-/* $OpenBSD: n_support.c,v 1.13 2008/07/17 15:36:28 martynas Exp $ */
+/* $OpenBSD: n_support.c,v 1.14 2008/07/18 13:08:58 martynas Exp $ */
/* $NetBSD: n_support.c,v 1.1 1995/10/10 23:37:06 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
/* generate the last bit and determine the final rounding */
r/=2; x *= 4;
- if(x==zero) goto end; 100+r; /* trigger inexact flag */
+ if(x==zero) goto end;
+ if (100+r >= 100) { /* trigger inexact flag */
if(s<x) {
q+=r; x -=s; s += 2; s *= 2; x *= 4;
t = (x-s)-5;
b=1.0+3*r/4; if(b==1.0) goto end;
b=1.0+r/4; if(b>1.0) t=1;
if(t>=0) q+=r; }
+ }
end: return(scalbn(q,n));
}