OSDN Git Service

test: Some more tests under conditionals
[uclinux-h8/uClibc.git] / libm / e_log10.c
index 5b25c0f..8775725 100644 (file)
@@ -1,4 +1,3 @@
-/* @(#)e_log10.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +9,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $";
-#endif
-
 /* __ieee754_log10(x)
  * Return the base 10 logarithm of x
  *
@@ -50,28 +45,15 @@ static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const double
-#else
-static double
-#endif
 two54      =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
 ivln10     =  4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */
 log10_2hi  =  3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
 log10_2lo  =  3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
 
-#ifdef __STDC__
-static const double zero   =  0.0;
-#else
-static double zero   =  0.0;
-#endif
+static const double zero = 0.0;
 
-#ifdef __STDC__
-       double attribute_hidden __ieee754_log10(double x)
-#else
-       double attribute_hidden __ieee754_log10(x)
-       double x;
-#endif
+double __ieee754_log10(double x)
 {
        double y,z;
        int32_t i,k,hx;
@@ -96,3 +78,24 @@ static double zero   =  0.0;
        z  = y*log10_2lo + ivln10*__ieee754_log(x);
        return  z+y*log10_2hi;
 }
+
+/*
+ * wrapper log10(X)
+ */
+#ifndef _IEEE_LIBM
+double log10(double x)
+{
+       double z = __ieee754_log10(x);
+       if (_LIB_VERSION == _IEEE_ || isnan(x))
+               return z;
+       if (x <= 0.0) {
+               if(x == 0.0)
+                       return __kernel_standard(x, x, 18); /* log10(0) */
+               return __kernel_standard(x, x, 19); /* log10(x<0) */
+       }
+       return z;
+}
+#else
+strong_alias(__ieee754_log10, log10)
+#endif
+libm_hidden_def(log10)