Mathf.log rounding issue

log of e, ln(1.0001) should = 0.000099995

https://www.google.com/search?q=ln(1.0001)

however, using Unity’s Math.f , which uses a float, I get

Mathf.Log(1.0001f) = 0.0001000116

using System.Math, which uses a double

System.Math.Log(1.0001) 9.99950003332973E-05

is there anyway to stop Math.f from rounding this value?

or is there some variable type that will get me the exact values that google calc spits out.

The only option I see is converting my ToString(“0.0000000000”) or however many zeros are in a float, truncating it, then turning the double into a float.

Unity does use Math.Log inside the Mathf.Log function, however a float (single precision) can’t represent the value that accurate. Even a double doesn’t represent the value accurate. It’s more accurate as a float, but still not right. There is no way to get a better result with a float. The only way is to use a double and cast the final result to float.

I guess Mathf has some approximation optimizations. Use System.Math if you need that much precision. You seldom do though.