Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/lib/libm/noieee_src Pull up revision 1.6 (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/cfae9f7ad276
branches:  netbsd-1-6
changeset: 527946:cfae9f7ad276
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jun 18 13:38:26 2002 +0000

description:
Pull up revision 1.6 (requested by matt in ticket #286):
Ansify libm noieeesrc (for VAX).  Also make const data really const.
libm for VAX can compiles with WARNS=2

diffstat:

 lib/libm/noieee_src/n_cosh.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (50 lines):

diff -r 0262a70af567 -r cfae9f7ad276 lib/libm/noieee_src/n_cosh.c
--- a/lib/libm/noieee_src/n_cosh.c      Tue Jun 18 13:38:08 2002 +0000
+++ b/lib/libm/noieee_src/n_cosh.c      Tue Jun 18 13:38:26 2002 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: n_cosh.c,v 1.5 1999/07/02 15:37:36 simonb Exp $ */
+/*      $NetBSD: n_cosh.c,v 1.5.10.1 2002/06/18 13:38:26 lukem Exp $ */
 /*
  * Copyright (c) 1985, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -85,6 +85,7 @@
  * shown.
  */
 
+#define _LIBM_STATIC
 #include "mathimpl.h"
 
 vc(mln2hi, 8.8029691931113054792E1   ,0f33,43b0,2bdb,c7e2,   7, .B00F33C7E22BDB)
@@ -102,13 +103,13 @@
 #endif
 
 #if defined(__vax__)||defined(tahoe)
-static int max = 126;
-#else  /* defined(__vax__)||defined(tahoe) */
-static int max = 1023;
+#define EXPMAX 126
+#else
+#define EXPMAX 1023
 #endif /* defined(__vax__)||defined(tahoe) */
 
-double cosh(x)
-double x;
+double
+cosh(double x)
 {
        static const double half=1.0/2.0,
                one=1.0, small=1.0E-18; /* fl(1+small)==1 */
@@ -127,10 +128,10 @@
        }
 
        if( lnovfl <= x && x <= (lnovfl+0.7))
-        /* for x lies in [lnovfl, lnovfl+ln2], decrease x by ln(2^(max+1))
-         * and return 2^max*exp(x) to avoid unnecessary overflow
+        /* for x lies in [lnovfl, lnovfl+ln2], decrease x by ln(2^(EXPMAX+1))
+         * and return 2^EXPMAX*exp(x) to avoid unnecessary overflow
          */
-           return(scalb(exp((x-mln2hi)-mln2lo), max));
+           return(scalb(exp((x-mln2hi)-mln2lo), EXPMAX));
 
        else
            return(exp(x)*half);        /* for large x,  cosh(x)=exp(x)/2 */



Home | Main Index | Thread Index | Old Index