0

I think if I'd know the math behind it I might have figured it out by myself.

When I call math.log10(0.0000000000001) I get -13. But how do I convert this back into 0.0000000000001? and how i'd handle it when using math.log(0.0000000000001)?

Both ways, the fundamental, arithmetic one and the one using a built-in python function would interest me.

bngschmnd
  • 111
  • 1
  • 10

2 Answers2

2
a = math.log10(0.0000000000001)
b = 10 ** a
Daniel
  • 42,087
  • 4
  • 55
  • 81
0

math.log() takes two parameter, a number and a base. Default value is e (mathematical constant), a special constant which tends to 2.71828.

You can get the number by evaluating base to the power log_value

>>> a = math.log(10)
>>> a
2.302585092994046
>>> 2.71828**a
9.999984511610785

If I would take e's value with higher precision, I can get the result close to 10.

Or, you can use math.exp()

>>>math.exp(a)
10.000000000000002

You can also use math.pow()

>>> math.pow(2.71828,a)
9.999984511610785
Ahsanul Haque
  • 10,676
  • 4
  • 41
  • 57