A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/cmath/log10/ below:

function

<cmath> <ctgmath>

log10
     double log10  (double x);      float log10f (float x);long double log10l (long double x);
     double log10 (double x);      float log10 (float x);long double log10 (long double x);
     double log10 (double x);      float log10 (float x);long double log10 (long double x);     double log10 (T x);           // additional overloads for integral types

Compute common logarithm

Returns the common (base-10) logarithm of x.

Header

<tgmath.h>

provides a type-generic macro version of this function.



Parameters
x
Value whose logarithm is calculated.
If the argument is negative, a domain error occurs.

Return Value Common logarithm of x.
If x is negative, it causes a domain error.
If x is zero, it may cause a pole error (depending on the library implementation).

If a

domain error

occurs, the global variable

errno

is set to

EDOM

.

If a

pole error

occurs, the global variable

errno

is set

ERANGE

.



Example
1
2
3
4
5
6
7
8
9
10
11
12
/* log10 example */
#include <stdio.h>      /* printf */
#include <math.h>       /* log10 */

int main ()
{
  double param, result;
  param = 1000.0;
  result = log10 (param);
  printf ("log10(%f) = %f\n", param, result );
  return 0;
}

Output:
log10(1000.000000) = 3.000000


See also
log
Compute natural logarithm (function)
exp
Compute exponential function (function)
pow
Raise to power (function)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4