root/maint/gnulib/lib/log10l.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. log10l
  2. log10l
  3. log10l

   1 /* Base 10 logarithmic function.
   2    Copyright (C) 2012-2021 Free Software Foundation, Inc.
   3 
   4    This file is free software: you can redistribute it and/or modify
   5    it under the terms of the GNU Lesser General Public License as
   6    published by the Free Software Foundation; either version 3 of the
   7    License, or (at your option) any later version.
   8 
   9    This file is distributed in the hope that it will be useful,
  10    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12    GNU Lesser General Public License for more details.
  13 
  14    You should have received a copy of the GNU Lesser General Public License
  15    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  16 
  17 #include <config.h>
  18 
  19 /* Specification.  */
  20 #include <math.h>
  21 
  22 #if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
  23 
  24 long double
  25 log10l (long double x)
     /* [previous][next][first][last][top][bottom][index][help] */
  26 {
  27   return log10 (x);
  28 }
  29 
  30 #elif 0 /* was: HAVE_LOG10L */
  31 
  32 # include <float.h>
  33 
  34 long double
  35 log10l (long double x)
     /* [previous][next][first][last][top][bottom][index][help] */
  36 # undef log10l
  37 {
  38   /* Work around the OSF/1 5.1 bug.  */
  39   if (x == 0.0L)
  40     /* Return -Infinity.  */
  41     return -1.0L / 0.0L;
  42   {
  43     long double y = log10l (x);
  44 # ifdef __sgi
  45     /* Normalize the +Infinity value.  */
  46     if (y > LDBL_MAX)
  47       y = 1.0L / 0.0L;
  48 # endif
  49     return y;
  50   }
  51 }
  52 
  53 #else
  54 
  55 /* 1 / log(10) */
  56 static const long double inv_log10 =
  57   0.43429448190325182765112891891660508229439700580366656611445378316586464920887L;
  58 
  59 long double
  60 log10l (long double x)
     /* [previous][next][first][last][top][bottom][index][help] */
  61 {
  62   return logl (x) * inv_log10;
  63 }
  64 
  65 #endif

/* [previous][next][first][last][top][bottom][index][help] */