summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libm/noieee_src/n_exp__E.c4
-rw-r--r--lib/libm/noieee_src/n_expm1.c6
-rw-r--r--lib/libm/noieee_src/n_lgamma.c18
-rw-r--r--lib/libm/noieee_src/n_support.c6
4 files changed, 19 insertions, 15 deletions
diff --git a/lib/libm/noieee_src/n_exp__E.c b/lib/libm/noieee_src/n_exp__E.c
index 9fd13ada83a..5f7e799bff7 100644
--- a/lib/libm/noieee_src/n_exp__E.c
+++ b/lib/libm/noieee_src/n_exp__E.c
@@ -1,4 +1,4 @@
-/* $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
@@ -136,4 +136,6 @@ __exp__E(double x, double c)
else
return(copysign(zero,x));
}
+
+ /* NOTREACHED */
}
diff --git a/lib/libm/noieee_src/n_expm1.c b/lib/libm/noieee_src/n_expm1.c
index 082aa608541..1448bb00961 100644
--- a/lib/libm/noieee_src/n_expm1.c
+++ b/lib/libm/noieee_src/n_expm1.c
@@ -1,4 +1,4 @@
-/* $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
@@ -107,7 +107,7 @@ ic(invln2, 1.4426950408889633870E0, 0, 1.71547652B82FE)
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__)
@@ -152,7 +152,7 @@ expm1(double x)
else
/* expm1(-big#) rounded to -1 (inexact) */
if(finite(x))
- { ln2hi+ln2lo; return(-one);}
+ return(tiny-one);
/* expm1(-INF) is -1 */
else return(-one);
diff --git a/lib/libm/noieee_src/n_lgamma.c b/lib/libm/noieee_src/n_lgamma.c
index 1cf10a7c0d2..1fe70c44cc2 100644
--- a/lib/libm/noieee_src/n_lgamma.c
+++ b/lib/libm/noieee_src/n_lgamma.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -243,15 +243,15 @@ CONTINUE:
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);
@@ -268,10 +268,10 @@ CONTINUE:
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);
diff --git a/lib/libm/noieee_src/n_support.c b/lib/libm/noieee_src/n_support.c
index 84b2547cd20..c0aa3dc6573 100644
--- a/lib/libm/noieee_src/n_support.c
+++ b/lib/libm/noieee_src/n_support.c
@@ -1,4 +1,4 @@
-/* $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
@@ -324,7 +324,8 @@ sqrt(double x)
/* 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;
@@ -337,6 +338,7 @@ sqrt(double x)
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));
}