BSD 4_3_Reno release
[unix-history] / usr / src / lib / libm / common_source / sinh.c
index 8168049..ec47e27 100644 (file)
@@ -1,20 +1,30 @@
-/* 
+/*
  * Copyright (c) 1985 Regents of the University of California.
  * Copyright (c) 1985 Regents of the University of California.
- * 
- * Use and reproduction of this software are granted  in  accordance  with
- * the terms and conditions specified in  the  Berkeley  Software  License
- * Agreement (in particular, this entails acknowledgement of the programs'
- * source, and inclusion of this notice) with the additional understanding
- * that  all  recipients  should regard themselves as participants  in  an
- * ongoing  research  project and hence should  feel  obligated  to report
- * their  experiences (good or bad) with these elementary function  codes,
- * using "sendbug 4bsd-bugs@BERKELEY", to the authors.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that: (1) source distributions retain this entire copyright
+ * notice and comment, and (2) distributions including binaries display
+ * the following acknowledgement:  ``This product includes software
+ * developed by the University of California, Berkeley and its contributors''
+ * in the documentation or other materials provided with the distribution
+ * and in all advertising materials mentioning features or use of this
+ * software. Neither the name of the University nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * All recipients should regard themselves as participants in an ongoing
+ * research project and hence should feel obligated to report their
+ * experiences (good or bad) with these elementary function codes, using
+ * the sendbug(8) program, to the authors.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] =
-"@(#)sinh.c    4.3 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
-#endif /* not lint */
+static char sccsid[] = "@(#)sinh.c     5.5 (Berkeley) 6/1/90";
+#endif /* not lint */
 
 /* SINH(X)
  * RETURN THE HYPERBOLIC SINE OF X
 
 /* SINH(X)
  * RETURN THE HYPERBOLIC SINE OF X
@@ -55,28 +65,22 @@ static char sccsid[] =
  * from decimal to binary accurately enough to produce the hexadecimal values
  * shown.
  */
  * from decimal to binary accurately enough to produce the hexadecimal values
  * shown.
  */
-#if defined(vax)||defined(tahoe)
-#ifdef vax
-#define _0x(A,B)       0x/**/A/**/B
-#else  /* vax */
-#define _0x(A,B)       0x/**/B/**/A
-#endif /* vax */
-/* static double */
-/* mln2hi =  8.8029691931113054792E1     , Hex  2^  7   *  .B00F33C7E22BDB */
-/* mln2lo = -4.9650192275318476525E-16   , Hex  2^-50   * -.8F1B60279E582A */
-/* lnovfl =  8.8029691931113053016E1     ; Hex  2^  7   *  .B00F33C7E22BDA */
-static long    mln2hix[] = { _0x(0f33,43b0), _0x(2bdb,c7e2)};
-static long    mln2lox[] = { _0x(1b60,a70f), _0x(582a,279e)};
-static long    lnovflx[] = { _0x(0f33,43b0), _0x(2bda,c7e2)};
-#define   mln2hi    (*(double*)mln2hix)
-#define   mln2lo    (*(double*)mln2lox)
-#define   lnovfl    (*(double*)lnovflx)
-#else  /* defined(vax)||defined(tahoe) */
-static double 
-mln2hi =  7.0978271289338397310E2     , /*Hex  2^ 10   *  1.62E42FEFA39EF */
-mln2lo =  2.3747039373786107478E-14   , /*Hex  2^-45   *  1.ABC9E3B39803F */
-lnovfl =  7.0978271289338397310E2     ; /*Hex  2^  9   *  1.62E42FEFA39EF */
-#endif /* defined(vax)||defined(tahoe) */
+
+#include "mathimpl.h"
+
+vc(mln2hi, 8.8029691931113054792E1   ,0f33,43b0,2bdb,c7e2,   7, .B00F33C7E22BDB)
+vc(mln2lo,-4.9650192275318476525E-16 ,1b60,a70f,582a,279e, -50,-.8F1B60279E582A)
+vc(lnovfl, 8.8029691931113053016E1   ,0f33,43b0,2bda,c7e2,   7, .B00F33C7E22BDA)
+
+ic(mln2hi, 7.0978271289338397310E2,    10, 1.62E42FEFA39EF)
+ic(mln2lo, 2.3747039373786107478E-14, -45, 1.ABC9E3B39803F)
+ic(lnovfl, 7.0978271289338397310E2,     9, 1.62E42FEFA39EF)
+
+#ifdef vccast
+#define        mln2hi  vccast(mln2hi)
+#define        mln2lo  vccast(mln2lo)
+#define        lnovfl  vccast(lnovfl)
+#endif
 
 #if defined(vax)||defined(tahoe)
 static max = 126                      ;
 
 #if defined(vax)||defined(tahoe)
 static max = 126                      ;
@@ -88,8 +92,8 @@ static max = 1023                     ;
 double sinh(x)
 double x;
 {
 double sinh(x)
 double x;
 {
-       static double  one=1.0, half=1.0/2.0 ;
-       double expm1(), t, scalb(), copysign(), sign;
+       static const double  one=1.0, half=1.0/2.0 ;
+       double t, sign;
 #if !defined(vax)&&!defined(tahoe)
        if(x!=x) return(x);     /* x is NaN */
 #endif /* !defined(vax)&&!defined(tahoe) */
 #if !defined(vax)&&!defined(tahoe)
        if(x!=x) return(x);     /* x is NaN */
 #endif /* !defined(vax)&&!defined(tahoe) */