Cygwin: SetThreadName: avoid spurious debug message
[newlib-cygwin.git] / newlib / libm / math / w_log10.c
bloba9112f86fde5bf650fcbc42b19251ce817d2e839
2 /* @(#)w_log10.c 5.1 93/09/24 */
3 /*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
15 FUNCTION
16 <<log10>>, <<log10f>>---base 10 logarithms
18 INDEX
19 log10
20 INDEX
21 log10f
23 SYNOPSIS
24 #include <math.h>
25 double log10(double <[x]>);
26 float log10f(float <[x]>);
28 DESCRIPTION
29 <<log10>> returns the base 10 logarithm of <[x]>.
30 It is implemented as <<log(<[x]>) / log(10)>>.
32 <<log10f>> is identical, save that it takes and returns <<float>> values.
34 RETURNS
35 <<log10>> and <<log10f>> return the calculated value.
37 See the description of <<log>> for information on errors.
39 PORTABILITY
40 <<log10>> is ANSI C. <<log10f>> is an extension.
44 /*
45 * wrapper log10(X)
48 #include "fdlibm.h"
49 #include <errno.h>
51 #ifndef _DOUBLE_IS_32BITS
53 #ifdef __STDC__
54 double log10(double x) /* wrapper log10 */
55 #else
56 double log10(x) /* wrapper log10 */
57 double x;
58 #endif
60 #ifdef _IEEE_LIBM
61 return __ieee754_log10(x);
62 #else
63 double z;
64 z = __ieee754_log10(x);
65 if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
66 if(x<=0.0) {
67 if(x==0.0) {
68 /* log10(0) */
69 errno = ERANGE;
70 return -HUGE_VAL;
71 } else {
72 /* log10(x<0) */
73 errno = EDOM;
74 return nan("");
76 } else
77 return z;
78 #endif
81 #endif /* defined(_DOUBLE_IS_32BITS) */