Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / libcc.ansi / math / log10.c
1 /*
2  * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  *
5  * Author: Ceriel J.H. Jacobs
6  */
7 /* $Id: log10.c,v 1.4 1994/06/24 11:44:02 ceriel Exp $ */
8
9 #include        <math.h>
10 #include        <errno.h>
11 #include        "localmath.h"
12
13 double
14 log10(double x)
15 {
16         if (__IsNan(x)) {
17                 errno = EDOM;
18                 return x;
19         }
20         if (x < 0) {
21                 errno = EDOM;
22                 return -HUGE_VAL;
23         }
24         else if (x == 0) {
25                 errno = ERANGE;
26                 return -HUGE_VAL;
27         }
28
29         return log(x) / M_LN10;
30 }