"math" --- Mathematical functions
*********************************

======================================================================

This module provides access to common mathematical functions and
constants, including those defined by the C standard.

Ces fonctions ne peuvent pas être utilisées avec les nombres complexes
; si vous avez besoin de la prise en charge des nombres complexes,
utilisez les fonctions du même nom du module "cmath". La séparation
entre les fonctions qui gèrent les nombres complexes et les autres
vient du constat que tous les utilisateurs ne souhaitent pas acquérir
le niveau mathématique nécessaire à la compréhension des nombres
complexes. Recevoir une exception plutôt qu'un nombre complexe en
retour d'une fonction permet au programmeur de déterminer
immédiatement comment et pourquoi ce nombre a été généré, avant que
celui-ci ne soit passé involontairement en paramètre d'une autre
fonction.

Les fonctions suivantes sont fournies dans ce module. Sauf mention
contraire explicite, toutes les valeurs de retour sont des flottants.

+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Floating point arithmetic**                                                                                                                                                 |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "ceil(x)"                                            | Ceiling of *x*, the smallest integer greater than or equal to *x*                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "fabs(x)"                                            | Absolute value of *x*                                                                                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "floor(x)"                                           | Floor of *x*, the largest integer less than or equal to *x*                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "fma(x, y, z)"                                       | Fused multiply-add operation: "(x * y) + z"                                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "fmax(x, y)"                                         | Maximum of two floating-point values                                                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "fmin(x, y)"                                         | Minimum of two floating-point values                                                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "fmod(x, y)"                                         | Remainder of division "x / y"                                                                                          |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "modf(x)"                                            | Fractional and integer parts of *x*                                                                                    |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "remainder(x, y)"                                    | Remainder of *x* with respect to *y*                                                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "trunc(x)"                                           | Integer part of *x*                                                                                                    |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Floating point manipulation functions**                                                                                                                                     |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "copysign(x, y)"                                     | Magnitude (absolute value) of *x* with the sign of *y*                                                                 |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "frexp(x)"                                           | Mantissa and exponent of *x*                                                                                           |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "isclose(a, b, rel_tol, abs_tol)"                    | Check if the values *a* and *b* are close to each other                                                                |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "isfinite(x)"                                        | Check if *x* is neither an infinity nor a NaN                                                                          |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "isnormal(x)"                                        | Check if *x* is a normal number                                                                                        |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "issubnormal(x)"                                     | Check if *x* is a subnormal number                                                                                     |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "isinf(x)"                                           | Check if *x* is a positive or negative infinity                                                                        |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "isnan(x)"                                           | Check if *x* is a NaN  (not a number)                                                                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "ldexp(x, i)"                                        | "x * (2**i)", inverse of function "frexp()"                                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "nextafter(x, y, steps)"                             | Floating-point value *steps* steps after *x* towards *y*                                                               |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "signbit(x)"                                         | Check if *x* is a negative number                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "ulp(x)"                                             | Value of the least significant bit of *x*                                                                              |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Power, exponential and logarithmic functions**                                                                                                                              |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "cbrt(x)"                                            | Cube root of *x*                                                                                                       |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "exp(x)"                                             | *e* raised to the power *x*                                                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "exp2(x)"                                            | *2* raised to the power *x*                                                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "expm1(x)"                                           | *e* raised to the power *x*, minus 1                                                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "log(x, base)"                                       | Logarithm of *x* to the given base (*e* by default)                                                                    |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "log1p(x)"                                           | Natural logarithm of *1+x* (base *e*)                                                                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "log2(x)"                                            | Base-2 logarithm of *x*                                                                                                |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "log10(x)"                                           | Base-10 logarithm of *x*                                                                                               |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "pow(x, y)"                                          | *x* raised to the power *y*                                                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "sqrt(x)"                                            | Square root of *x*                                                                                                     |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Summation and product functions**                                                                                                                                           |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "dist(p, q)"                                         | Euclidean distance between two points *p* and *q* given as an iterable of coordinates                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "fsum(iterable)"                                     | Sum of values in the input *iterable*                                                                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "hypot(*coordinates)"                                | Euclidean norm of an iterable of coordinates                                                                           |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "prod(iterable, start)"                              | Product of elements in the input *iterable* with a *start* value                                                       |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "sumprod(p, q)"                                      | Sum of products from two iterables *p* and *q*                                                                         |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Angular conversion**                                                                                                                                                        |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "degrees(x)"                                         | Convert angle *x* from radians to degrees                                                                              |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "radians(x)"                                         | Convert angle *x* from degrees to radians                                                                              |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Trigonometric functions**                                                                                                                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "acos(x)"                                            | Arc cosine of *x*                                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "asin(x)"                                            | Arc sine of *x*                                                                                                        |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "atan(x)"                                            | Arc tangent of *x*                                                                                                     |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "atan2(y, x)"                                        | "atan(y / x)"                                                                                                          |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "cos(x)"                                             | Cosine of *x*                                                                                                          |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "sin(x)"                                             | Sine of *x*                                                                                                            |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "tan(x)"                                             | Tangent of *x*                                                                                                         |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Hyperbolic functions**                                                                                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "acosh(x)"                                           | Inverse hyperbolic cosine of *x*                                                                                       |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "asinh(x)"                                           | Inverse hyperbolic sine of *x*                                                                                         |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "atanh(x)"                                           | Inverse hyperbolic tangent of *x*                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "cosh(x)"                                            | Hyperbolic cosine of *x*                                                                                               |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "sinh(x)"                                            | Hyperbolic sine of *x*                                                                                                 |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "tanh(x)"                                            | Hyperbolic tangent of *x*                                                                                              |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Special functions**                                                                                                                                                         |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "erf(x)"                                             | Error function at *x*                                                                                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "erfc(x)"                                            | Complementary error function at *x*                                                                                    |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "gamma(x)"                                           | Gamma function at *x*                                                                                                  |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "lgamma(x)"                                          | Natural logarithm of the absolute value of the Gamma function at *x*                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| **Constants**                                                                                                                                                                 |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "pi"                                                 | *π* = 3.141592...                                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "e"                                                  | *e* = 2.718281...                                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "tau"                                                | *τ* = 2*π* = 6.283185...                                                                                               |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "inf"                                                | Positive infinity                                                                                                      |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
| "nan"                                                | "Not a number" (NaN)                                                                                                   |
+------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+


Floating point arithmetic
=========================

math.ceil(x)

   Return the ceiling of *x*, the smallest integer greater than or
   equal to *x*. If *x* is not a float, delegates to "x.__ceil__",
   which should return an "Integral" value.

math.fabs(x)

   Renvoie la valeur absolue de *x*.

math.floor(x)

   Return the floor of *x*, the largest integer less than or equal to
   *x*.  If *x* is not a float, delegates to "x.__floor__", which
   should return an "Integral" value.

math.fma(x, y, z)

   Fused multiply-add operation. Return "(x * y) + z", computed as
   though with infinite precision and range followed by a single round
   to the "float" format. This operation often provides better
   accuracy than the direct expression "(x * y) + z".

   This function follows the specification of the fusedMultiplyAdd
   operation described in the IEEE 754 standard. The standard leaves
   one case implementation-defined, namely the result of "fma(0, inf,
   nan)" and "fma(inf, 0, nan)". In these cases, "math.fma" returns a
   NaN, and does not raise any exception.

   Ajouté dans la version 3.13.

math.fmax(x, y)

   Get the larger of two floating-point values, treating NaNs as
   missing data.

   When both operands are (signed) NaNs or zeroes, return "nan" and
   "0" respectively and the sign of the result is implementation-
   defined, that is, "fmax()" is not required to be sensitive to the
   sign of such operands (see Annex F of the C11 standard, §F.10.0.3
   and §F.10.9.2).

   Ajouté dans la version 3.15.

math.fmin(x, y)

   Get the smaller of two floating-point values, treating NaNs as
   missing data.

   When both operands are (signed) NaNs or zeroes, return "nan" and
   "0" respectively and the sign of the result is implementation-
   defined, that is, "fmin()" is not required to be sensitive to the
   sign of such operands (see Annex F of the C11 standard, §F.10.0.3
   and §F.10.9.3).

   Ajouté dans la version 3.15.

math.fmod(x, y)

   Return the floating-point remainder of "x / y", as defined by the
   platform C library function "fmod(x, y)". Note that the Python
   expression "x % y" may not return the same result.  The intent of
   the C standard is that "fmod(x, y)" be exactly (mathematically; to
   infinite precision) equal to "x - n*y" for some integer *n* such
   that the result has the same sign as *x* and magnitude less than
   "abs(y)".  Python's "x % y" returns a result with the sign of *y*
   instead, and may not be exactly computable for float arguments. For
   example, "fmod(-1e-100, 1e100)" is "-1e-100", but the result of
   Python's "-1e-100 % 1e100" is "1e100-1e-100", which cannot be
   represented exactly as a float, and rounds to the surprising
   "1e100".  For this reason, function "fmod()" is generally preferred
   when working with floats, while Python's "x % y" is preferred when
   working with integers.

math.modf(x)

   Renvoie les parties entière et fractionnelle de *x*. Les deux
   résultats ont le signe de *x* et sont flottants.

   Note that "modf()" has a different call/return pattern than its C
   equivalents: it takes a single argument and return a pair of
   values, rather than returning its second return value through an
   'output parameter' (there is no such thing in Python).

math.remainder(x, y)

   Renvoie le reste selon la norme IEEE 754 de *x* par rapport à *y*.
   Pour *x* fini et *y* fini non nul, il s'agit de la différence "x -
   n*y", où "n" est l'entier le plus proche de la valeur exacte du
   quotient "x / y". Si "x / y" est exactement à mi-chemin de deux
   entiers consécutifs, le plus proche entier *pair* est utilisé pour
   "n". Ainsi, le reste "r = remainder(x, y)" vérifie toujours "abs(r)
   <= 0.5 * abs(y)".

   Les cas spéciaux suivent la norme IEEE 754 : en particulier,
   "remainder(x, math.inf)" vaut *x* pour tout *x* fini,  et
   "remainder(x, 0)" et "remainder(math.inf, x)" lèvent "ValueError"
   pour tout *x* *non-NaN*. Si le résultat de l'opération *remainder*
   est zéro, alors  ce zéro aura le même signe que *x*.

   On platforms using IEEE 754 binary floating point, the result of
   this operation is always exactly representable: no rounding error
   is introduced.

   Ajouté dans la version 3.7.

math.trunc(x)

   Return *x* with the fractional part removed, leaving the integer
   part.  This rounds toward 0: "trunc()" is equivalent to "floor()"
   for positive *x*, and equivalent to "ceil()" for negative *x*. If
   *x* is not a float, delegates to "x.__trunc__", which should return
   an "Integral" value.

Pour les fonctions "ceil()", "floor()", et "modf()", notez que *tous*
les nombres flottants de magnitude suffisamment grande sont des
entiers exacts. Les flottants de Python n'ont généralement pas plus de
53 *bits* de précision (tels que le type C "double" de la plate-
forme), en quel cas tout flottant *x* tel que "abs(x) >= 2**52" n'a
aucun *bit* fractionnel.


Floating point manipulation functions
=====================================

math.copysign(x, y)

   Renvoie un flottant contenant la magnitude (valeur absolue) de *x*
   mais avec le signe de *y*. Sur les plates-formes prenant en charge
   les zéros signés, "copysign(1.0, -0.0)" renvoie "-1.0".

math.frexp(x)

   Renvoie la mantisse et l'exposant de *x* dans un couple "(m, e)".
   *m* est un flottant et *e* est un entier tels que "x == m * 2**e"
   exactement. Si *x* vaut zéro, renvoie "(0, 0)", sinon "0.5 <=
   abs(m) < 1". Ceci est utilisé pour « extraire » la représentation
   interne d'un flottant de manière portable.

   Note that "frexp()" has a different call/return pattern than its C
   equivalents: it takes a single argument and return a pair of
   values, rather than returning its second return value through an
   'output parameter' (there is no such thing in Python).

math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)

   Renvoie "True" si les valeurs *a* et *b* sont proches l'une de
   l'autre, et "False" sinon.

   Whether or not two values are considered close is determined
   according to given absolute and relative tolerances.  If no errors
   occur, the result will be: "abs(a-b) <= max(rel_tol * max(abs(a),
   abs(b)), abs_tol)".

   *rel_tol* is the relative tolerance -- it is the maximum allowed
   difference between *a* and *b*, relative to the larger absolute
   value of *a* or *b*. For example, to set a tolerance of 5%, pass
   "rel_tol=0.05".  The default tolerance is "1e-09", which assures
   that the two values are the same within about 9 decimal digits.
   *rel_tol* must be nonnegative and less than "1.0".

   *abs_tol* is the absolute tolerance; it defaults to "0.0" and it
   must be nonnegative.  When comparing "x" to "0.0", "isclose(x, 0)"
   is computed as "abs(x) <= rel_tol  * abs(x)", which is "False" for
   any nonzero "x" and *rel_tol* less than "1.0".  So add an
   appropriate positive *abs_tol* argument to the call.

   Les valeurs spécifiques suivantes : "NaN", "inf", et "-inf"
   définies dans la norme IEEE 754  seront manipulées selon les règles
   du standard IEEE. En particulier, "NaN" n'est considéré proche
   d'aucune autre valeur, "NaN" inclus. "inf" et "-inf" ne sont
   considérées proches que d'elles-mêmes.

   Ajouté dans la version 3.5.

   Voir aussi:

     **PEP 485** — Une fonction pour tester des quasi-égalités

math.isfinite(x)

   Renvoie "True" si *n* n'est ni infini, ni NaN, et "False" sinon.
   (Notez que "0.0" *est* considéré comme fini.)

   Ajouté dans la version 3.2.

math.isnormal(x)

   Return "True" if *x* is a normal number, that is a finite nonzero
   number that is not a subnormal (see "issubnormal()"). Return
   "False" otherwise.

   Ajouté dans la version 3.15.

math.issubnormal(x)

   Return "True" if *x* is a subnormal number, that is a finite
   nonzero number with a magnitude smaller than "sys.float_info.min".
   Return "False" otherwise.

   Ajouté dans la version 3.15.

math.isinf(x)

   Renvoie "True" si *x* vaut l'infini positif ou négatif, et "False"
   sinon.

math.isnan(x)

   Renvoie "True" si *x* est NaN (*Not a Number*, ou *Pas un Nombre*
   en français), et "False" sinon.

math.ldexp(x, i)

   Renvoie "x * (2**i)". C'est essentiellement l'inverse de la
   fonction "frexp()".

math.nextafter(x, y, steps=1)

   Return the floating-point value *steps* steps after *x* towards
   *y*.

   If *x* is equal to *y*, return *y*, unless *steps* is zero.

   Exemples :

   * "math.nextafter(x, math.inf)" augmente de valeur : vers l'infini
     positif.

   * "math.nextafter(x, -math.inf)" baisse de valeur : vers l'infini
     négatif.

   * "math.nextafter(x, 0.0)" augmente ou baisse de valeur, vers zéro.

   * "math.nextafter(x, math.copysign(math.inf, x))" augmente ou
     baisse de valeur, en s'éloignant de zéro.

   Voir aussi : "math.ulp()".

   Ajouté dans la version 3.9.

   Modifié dans la version 3.12: Added the *steps* argument.

math.signbit(x)

   Return "True" if the sign of *x* is negative and "False" otherwise.

   This is useful to detect the sign bit of zeroes, infinities and
   NaNs.

   Ajouté dans la version 3.15.

math.ulp(x)

   Return the value of the least significant bit of the float *x*:

   * If *x* is a NaN (not a number), return *x*.

   * If *x* is negative, return "ulp(-x)".

   * If *x* is a positive infinity, return *x*.

   * If *x* is equal to zero, return the smallest positive
     *denormalized* representable float (smaller than the minimum
     positive *normalized* float, "sys.float_info.min").

   * If *x* is equal to the largest positive representable float,
     return the value of the least significant bit of *x*, such that
     the first float smaller than *x* is "x - ulp(x)".

   * Otherwise (*x* is a positive finite number), return the value of
     the least significant bit of *x*, such that the first float
     bigger than *x* is "x + ulp(x)".

   ULP stands for "Unit in the Last Place".

   See also "math.nextafter()" and "sys.float_info.epsilon".

   Ajouté dans la version 3.9.


Power, exponential and logarithmic functions
============================================

math.cbrt(x)

   Return the cube root of *x*.

   Ajouté dans la version 3.11.

math.exp(x)

   Renvoie *e* à la puissance *x*, où *e* = 2.718281… est la base des
   logarithmes naturels. Cela est en général plus précis que "math.e
   ** x" ou "pow(math.e, x)".

math.exp2(x)

   Return *2* raised to the power *x*.

   Ajouté dans la version 3.11.

math.expm1(x)

   Return *e* raised to the power *x*, minus 1.  Here *e* is the base
   of natural logarithms.  For small floats *x*, the subtraction in
   "exp(x) - 1" can result in a significant loss of precision; the
   "expm1()" function provides a way to compute this quantity to full
   precision:

   >>> from math import exp, expm1
   >>> exp(1e-5) - 1  # gives result accurate to 11 places
   1.0000050000069649e-05
   >>> expm1(1e-5)    # result accurate to full precision
   1.0000050000166668e-05

   Ajouté dans la version 3.2.

math.log(x[, base])

   Avec un argument, renvoie le logarithme naturel de *x* (en base
   *e*).

   Avec deux arguments, renvoie le logarithme de *x* en la *base*
   donnée, calculé par "log(x)/log(base)".

math.log1p(x)

   Renvoie le logarithme naturel de *1+x* (en base *e*). Le résultat
   est calculé par un moyen qui reste exact pour *x* proche de zéro.

math.log2(x)

   Renvoie le logarithme en base 2 de *x*. C'est en général plus
   précis que "log(x, 2)".

   Ajouté dans la version 3.3.

   Voir aussi:

     "int.bit_length()" renvoie le nombre de bits nécessaires pour
     représenter un entier en binaire, en excluant le signe et les
     zéros de début.

math.log10(x)

   Renvoie le logarithme de *x* en base 10. C'est habituellement plus
   exact que "log(x, 10)".

math.pow(x, y)

   Return *x* raised to the power *y*.  Exceptional cases follow the
   IEEE 754 standard as far as possible.  In particular, "pow(1.0, x)"
   and "pow(x, 0.0)" always return "1.0", even when *x* is a zero or a
   NaN.  If both *x* and *y* are finite, *x* is negative, and *y* is
   not an integer then "pow(x, y)" is undefined, and raises
   "ValueError".

   À l'inverse de l'opérateur interne "**", la fonction "math.pow()"
   convertit ses deux arguments en "float". Utilisez "**" ou la
   primitive "pow()" pour calculer des puissances exactes d'entiers.

   Modifié dans la version 3.11: The special cases "pow(0.0, -inf)"
   and "pow(-0.0, -inf)" were changed to return "inf" instead of
   raising "ValueError", for consistency with IEEE 754.

math.sqrt(x)

   Renvoie la racine carrée de *x*.


Summation and product functions
===============================

math.dist(p, q)

   Renvoie la distance Euclienne entre deux points *p* et *q*, passés
   comme des séquences (ou des itérables) de coordonnées. Les deux
   points doivent avoir la même dimension.

   À peu près équivalent à :

      sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q, strict=True)))

   Ajouté dans la version 3.8.

math.fsum(iterable)

   Return an accurate floating-point sum of values in the iterable.
   Avoids loss of precision by tracking multiple intermediate partial
   sums.

   La précision de cet algorithme dépend des garanties arithmétiques
   de IEEE-754 et des cas standards où le mode d'arrondi est *half-
   even*. Sur certaines versions non Windows, la bibliothèque C sous-
   jacente utilise une addition par précision étendue et peut
   occasionnellement effectuer un double-arrondi sur une somme
   intermédiaire causant la prise d'une mauvaise valeur du bit de
   poids faible.

   For further discussion and two alternative approaches, see the ASPN
   cookbook recipes for accurate floating-point summation.

math.hypot(*coordinates)

   Renvoie la norme Euclidienne, "sqrt(sum(x**2 for x in
   coordinates))". C'est la norme du vecteur entre l'origine et le
   point donné par les coordonnées.

   Pour un point bi-dimensionnel "(x, y)", c'est équivalent à calculer
   la valeur de l’hypoténuse d'un triangle rectangle en utilisant le
   théorème de Pythagore, "sqrt(x*x + y*y)".

   Modifié dans la version 3.8: Ajout de la gestion des points à
   n-dimensions. Auparavant seuls les points bi-dimensionnels étaient
   gérés.

   Modifié dans la version 3.10: Improved the algorithm's accuracy so
   that the maximum error is under 1 ulp (unit in the last place).
   More typically, the result is almost always correctly rounded to
   within 1/2 ulp.

math.prod(iterable, *, start=1)

   Calcule le produit de tous les éléments passés dans l'entrée
   *iterable*. La valeur de *départ* par défaut du produit vaut "1".

   Quand l'itérable est vide, renvoie la valeur de départ. Cette
   fonction ne doit être utilisée qu'avec des valeurs numériques et
   peut rejeter les types non-numériques.

   Ajouté dans la version 3.8.

math.sumprod(p, q)

   Return the sum of products of values from two iterables *p* and
   *q*.

   Raises "ValueError" if the inputs do not have the same length.

   À peu près équivalent à :

      sum(map(operator.mul, p, q, strict=True))

   For float and mixed int/float inputs, the intermediate products and
   sums are computed with extended precision.

   Ajouté dans la version 3.12.


Conversion angulaire
====================

math.degrees(x)

   Convertit l'angle *x* de radians en degrés.

math.radians(x)

   Convertit l'ange *x* de degrés en radians.


Fonctions trigonométriques
==========================

math.acos(x)

   Return the arc cosine of *x*, in radians. The result is between "0"
   and "pi".

math.asin(x)

   Return the arc sine of *x*, in radians. The result is between
   "-pi/2" and "pi/2".

math.atan(x)

   Return the arc tangent of *x*, in radians. The result is between
   "-pi/2" and "pi/2".

math.atan2(y, x)

   Renvoie "atan(y / x)", en radians. Le résultat est entre "-pi" et
   "pi". Le vecteur du plan allant de l'origine vers le point "(x, y)"
   forme cet angle avec l'axe X positif. L'intérêt de "atan2()" est
   que le signe des deux entrées est connu. Donc elle peut calculer le
   bon quadrant pour l'angle. par exemple "atan(1)" et "atan2(1, 1)"
   donnent tous deux "pi/4", mais "atan2(-1, -1)" donne "-3*pi/4".

math.cos(x)

   Renvoie le cosinus de *x* radians.

math.sin(x)

   Renvoie le sinus de *x* radians.

math.tan(x)

   Renvoie la tangente de *x* radians.


Fonctions hyperboliques
=======================

Hyperbolic functions are analogs of trigonometric functions that are
based on hyperbolas instead of circles.

math.acosh(x)

   Renvoie l'arc cosinus hyperbolique de *x*.

math.asinh(x)

   Renvoie l'arc sinus hyperbolique de *x*.

math.atanh(x)

   Renvoie l'arc tangente hyperbolique de *x*.

math.cosh(x)

   Renvoie le cosinus hyperbolique de *x*.

math.sinh(x)

   Renvoie le sinus hyperbolique de *x*.

math.tanh(x)

   Renvoie la tangente hyperbolique de *x*.


Fonctions spéciales
===================

math.erf(x)

   Renvoie la fonction d'erreur en *x*.

   The "erf()" function can be used to compute traditional statistical
   functions such as the cumulative standard normal distribution:

      def phi(x):
          'Cumulative distribution function for the standard normal distribution'
          return (1.0 + erf(x / sqrt(2.0))) / 2.0

   Ajouté dans la version 3.2.

math.erfc(x)

   Renvoie la fonction d'erreur complémentaire en *x*. La fonction
   d'erreur complémentaire est définie par "1.0 - erf(x)". Elle est
   utilisée pour les grandes valeurs de *x*, où la soustraction en
   partant de 1,0 entraînerait une perte de précision.

   Ajouté dans la version 3.2.

math.gamma(x)

   Renvoie la fonction Gamma en *x*.

   Ajouté dans la version 3.2.

math.lgamma(x)

   Renvoie le logarithme naturel de la valeur absolue de la fonction
   gamma en *x*.

   Ajouté dans la version 3.2.


Number-theoretic functions
==========================

For backward compatibility, the "math" module provides also aliases of
the following functions from the "math.integer" module:

+----------------------------------------------------+----------------------------------------------------+
| "comb(n, k)"                                       | Number of ways to choose *k* items from *n* items  |
|                                                    | without repetition and without order               |
+----------------------------------------------------+----------------------------------------------------+
| "factorial(n)"                                     | *n* factorial                                      |
+----------------------------------------------------+----------------------------------------------------+
| "gcd(*integers)"                                   | Greatest common divisor of the integer arguments   |
+----------------------------------------------------+----------------------------------------------------+
| "isqrt(n)"                                         | Integer square root of a nonnegative integer *n*   |
+----------------------------------------------------+----------------------------------------------------+
| "lcm(*integers)"                                   | Least common multiple of the integer arguments     |
+----------------------------------------------------+----------------------------------------------------+
| "perm(n, k)"                                       | Number of ways to choose *k* items from *n* items  |
|                                                    | without repetition and with order                  |
+----------------------------------------------------+----------------------------------------------------+

Ajouté dans la version 3.5: The "gcd()" function.

Ajouté dans la version 3.8: The "comb()", "perm()" and "isqrt()"
functions.

Ajouté dans la version 3.9: The "lcm()" function.

Modifié dans la version 3.9: Added support for an arbitrary number of
arguments in the "gcd()" function. Formerly, only two arguments were
supported.

Modifié dans la version 3.10: Floats with integral values (like "5.0")
are no longer accepted in the "factorial()" function.

Soft deprecated since version 3.15: Use the "math.integer" functions
instead of these aliases.


Constantes
==========

math.pi

   La constante mathématique *π* = 3.141592…, à la précision
   disponible.

math.e

   La constante mathématique *e* = 2.718281…, à la précision
   disponible.

math.tau

   The mathematical constant *τ* = 6.283185..., to available
   precision. Tau is a circle constant equal to 2*π*, the ratio of a
   circle's circumference to its radius. To learn more about Tau,
   check out Vi Hart's video Pi is (still) Wrong, and start
   celebrating Tau day by eating twice as much pie!

   Ajouté dans la version 3.6.

math.inf

   Un flottant positif infini. (Pour un infini négatif, utilisez
   "-math.inf".) Équivalent au résultat de "float('inf')".

   Ajouté dans la version 3.5.

math.nan

   A floating-point "not a number" (NaN) value. Equivalent to the
   output of "float('nan')". Due to the requirements of the IEEE-754
   standard, "math.nan" and "float('nan')" are not considered to equal
   to any other numeric value, including themselves. To check whether
   a number is a NaN, use the "isnan()" function to test for NaNs
   instead of "is" or "==". Example:

   >>> import math
   >>> math.nan == math.nan
   False
   >>> float('nan') == float('nan')
   False
   >>> math.isnan(math.nan)
   True
   >>> math.isnan(float('nan'))
   True

   Ajouté dans la version 3.5.

   Modifié dans la version 3.11: It is now always available.

**Particularité de l'implémentation CPython :** The "math" module
consists mostly of thin wrappers around the platform C math library
functions.  Behavior in exceptional cases follows Annex F of the C99
standard where appropriate.  The current implementation will raise
"ValueError" for invalid operations like "sqrt(-1.0)" or "log(0.0)"
(where C99 Annex F recommends signaling invalid operation or divide-
by-zero), and "OverflowError" for results that overflow (for example,
"exp(1000.0)").  A NaN will not be returned from any of the functions
above unless one or more of the input arguments was a NaN; in that
case, most functions will return a NaN, but (again following C99 Annex
F) there are some exceptions to this rule, for example
"pow(float('nan'), 0.0)" or "hypot(float('nan'), float('inf'))".

Notez que Python ne fait aucun effort pour distinguer les NaNs
signalétiques des NaNs silencieux, et le comportement de signalement
des NaNs reste non-spécifié. Le comportement standard est de traiter
tous les NaNs comme s'ils étaient silencieux.

Voir aussi:

  Module "cmath"
     Version complexe de beaucoup de ces fonctions.

  Module "math.integer"
     Integer-specific mathematics functions.
