-/* $OpenBSD: n_atan2.c,v 1.8 2008/06/21 08:26:19 martynas Exp $ */
+/* $OpenBSD: n_atan2.c,v 1.9 2008/07/17 15:36:28 martynas Exp $ */
/* $NetBSD: n_atan2.c,v 1.1 1995/10/10 23:36:37 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
/* t is in [0,7/16] */
case 0:
case 1:
- if (t < small)
- { big + small ; /* raise inexact flag */
- return (copysign((signx>zero)?t:PI-t,signy)); }
+ if (t < small) {
+ if (big + small > 0.0) /* raise inexact flag */
+ return (copysign((signx>zero)?t:PI-t,signy));
+ }
hi = zero; lo = zero; break;
if (t <= big) t = - x / y;
/* t is in [big, INF] */
- else
- { big+small; /* raise inexact flag */
- t = zero; }
+ else {
+ if (big + small > 0.0) /* raise inexact flag */
+ t = zero;
+ }
}
/* end of argument reduction */
-/* $OpenBSD: n_cabs.c,v 1.9 2008/06/25 17:49:31 martynas Exp $ */
+/* $OpenBSD: n_cabs.c,v 1.10 2008/07/17 15:36:28 martynas Exp $ */
/* $NetBSD: n_cabs.c,v 1.1 1995/10/10 23:36:39 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
if(x == zero) return(zero);
if(y == zero) return(x);
exp= logb(x);
- if(exp-(int)logb(y) > ibig )
- /* raise inexact flag and return |x| */
- { one+small; return(x); }
+ if (exp - (int)logb(y) > ibig) {
+ if (one + small >= 1.0) /* raise inexact flag */
+ return(x); /* return |x| */
+ }
/* start computing sqrt(x^2 + y^2) */
r=x-y;
if(y == zero) return(x);
exp= logb(x);
x=scalbn(x,-exp);
- if(exp-(int)logb(y) > ibig )
- /* raise inexact flag and return |x| */
- { one+small; return(scalbn(x,exp)); }
+ if (exp - (int)logb(y) > ibig) {
+ if (one + small >= 1.0) /* raise inexact flag */
+ return(scalbn(x,exp)); /* return |x| */
+ }
else y=scalbn(y,-exp);
return(scalbn(sqrt(x*x+y*y),exp));
}
-/* $OpenBSD: n_exp__E.c,v 1.6 2008/06/21 08:26:19 martynas Exp $ */
+/* $OpenBSD: n_exp__E.c,v 1.7 2008/07/17 15:36:28 martynas Exp $ */
/* $NetBSD: n_exp__E.c,v 1.1 1995/10/10 23:36:45 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
/* end of |x| > small */
else {
- if(x!=zero) one+small; /* raise the inexact flag */
- return(copysign(zero,x));
+ if(x != zero) {
+ if (one + small >= 1.0) /* raise the inexact flag */
+ return(copysign(zero,x));
+ }
+ else
+ return(copysign(zero,x));
}
}
-/* $OpenBSD: n_support.c,v 1.12 2008/07/16 15:25:51 martynas Exp $ */
+/* $OpenBSD: n_support.c,v 1.13 2008/07/17 15:36:28 martynas Exp $ */
/* $NetBSD: n_support.c,v 1.1 1995/10/10 23:37:06 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
t=x/y; /* ...chopped quotient, possibly inexact */
j=swapINX(i); /* ...read and restore inexact flag */
if(j==0) { if(t==y) goto end; else t=subc(t); } /* ...t=t-ulp */
- b54+0.1; /* ..trigger inexact flag, sqrt(x) is inexact */
+ x=b54+0.1; /* ..trigger inexact flag, sqrt(x) is inexact */
if(r==RN) t=addc(t); /* ...t=t+ulp */
else if(r==RP) { t=addc(t);y=addc(y);}/* ...t=t+ulp;y=y+ulp; */
y=y+t; /* ...chopped sum */
-/* $OpenBSD: n_tanh.c,v 1.7 2008/06/21 08:26:19 martynas Exp $ */
+/* $OpenBSD: n_tanh.c,v 1.8 2008/07/17 15:36:28 martynas Exp $ */
/* $NetBSD: n_tanh.c,v 1.1 1995/10/10 23:37:08 ragge Exp $ */
/*
* Copyright (c) 1985, 1993
return(copysign(one-two/(expm1(x+x)+two),sign));
else if ( x > small )
{t= -expm1(-(x+x)); return(copysign(t/(two-t),sign));}
- else /* raise the INEXACT flag for non-zero x */
- {big+x; return(copysign(x,sign));}
+ else { /* raise the INEXACT flag for non-zero x */
+ t = big + x;
+ return(copysign(x,sign) - (t-(big+x)));
+ }
else if(finite(x))
return (sign+1.0E-37); /* raise the INEXACT flag */
else