Base de conhecimentoCentro de Exames
PT · PTPortuguês (Portugal)
Escolher idioma13

CKTIS / Python

math.e

Fornece uma aproximação em vírgula flutuante do número de Euler, base do logaritmo natural.

Versão: Python 3.14; repository image, production runtime not attested

Sintaxe

math.e

Fornece uma aproximação em vírgula flutuante do número de Euler, base do logaritmo natural.

O arredondamento a seis casas decimais dá 2,718282. O seu logaritmo natural dá 1,0 à precisão do cálculo.

O float tem precisão finita.

import math
assert isinstance(math.e, float) and 2.71 < math.e < 2.72
assert math.isclose(math.log(math.e), 1.0)

Exemplos

import math
print(round(math.e, 6))
print(math.log(math.e))

Resultado

2.718282
1.0

O float tem precisão finita.

Fontes