BSD 4_3_Tahoe release
[unix-history] / usr / src / usr.lib / libm / log10.c
index 7525096..0331cf2 100644 (file)
@@ -1,19 +1,28 @@
-/* 
+/*
  * 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 the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not 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 MERCHANTIBILITY 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[] = "@(#)log10.c    1.2 (Berkeley) 8/21/85";
-#endif not lint
+static char sccsid[] = "@(#)log10.c    5.3 (Berkeley) 6/30/88";
+#endif /* not lint */
 
 /* LOG10(X)
  * RETURN THE BASE 10 LOGARITHM OF x
 
 /* LOG10(X)
  * RETURN THE BASE 10 LOGARITHM OF x
@@ -53,24 +62,29 @@ static char sccsid[] = "@(#)log10.c 1.2 (Berkeley) 8/21/85";
  * shown.
  */
 
  * shown.
  */
 
-#ifdef VAX     /* VAX D format (56 bits) */
+#if defined(vax)||defined(tahoe)       /* VAX D format (56 bits) */
+#ifdef vax
+#define _0x(A,B)       0x/**/A/**/B
+#else  /* vax */
+#define _0x(A,B)       0x/**/B/**/A
+#endif /* vax */
 /* static double */
 /* ln10hi =  2.3025850929940456790E0     ; Hex   2^  2   *  .935D8DDDAAA8AC */
 /* static double */
 /* ln10hi =  2.3025850929940456790E0     ; Hex   2^  2   *  .935D8DDDAAA8AC */
-static long    ln10hix[] = { 0x5d8d4113, 0xa8acddaa};
+static long    ln10hix[] = { _0x(5d8d,4113), _0x(a8ac,ddaa)};
 #define   ln10hi    (*(double*)ln10hix)
 #define   ln10hi    (*(double*)ln10hix)
-#else  /* IEEE double */
+#else  /* defined(vax)||defined(tahoe) */
 static double
 ivln10 =  4.3429448190325181667E-1    ; /*Hex   2^ -2   *  1.BCB7B1526E50E */
 static double
 ivln10 =  4.3429448190325181667E-1    ; /*Hex   2^ -2   *  1.BCB7B1526E50E */
-#endif
+#endif /* defined(vax)||defined(tahoe) */
 
 double log10(x)
 double x;
 {
        double log();
 
 
 double log10(x)
 double x;
 {
        double log();
 
-#ifdef VAX
+#if defined(vax)||defined(tahoe)
        return(log(x)/ln10hi);
        return(log(x)/ln10hi);
-#else  /* IEEE double */
+#else  /* defined(vax)||defined(tahoe) */
        return(ivln10*log(x));
        return(ivln10*log(x));
-#endif
+#endif /* defined(vax)||defined(tahoe) */
 }
 }