log10.c 487 B

123456789101112131415161718192021222324252627282930
  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$ */
  8. #include <math.h>
  9. #include <errno.h>
  10. #include "localmath.h"
  11. double
  12. log10(double x)
  13. {
  14. if (__IsNan(x)) {
  15. errno = EDOM;
  16. return x;
  17. }
  18. if (x < 0) {
  19. errno = EDOM;
  20. return -HUGE_VAL;
  21. }
  22. else if (x == 0) {
  23. errno = ERANGE;
  24. return -HUGE_VAL;
  25. }
  26. return log(x) / M_LN10;
  27. }