Find the approximate power of 10 for any number
a × 10^n
, where 1 ≤ a < 10
, its order of magnitude is 10^n
. This calculator formalizes this by finding the power of 10 that the number is closest to.log₁₀(900) ≈ 2.95
. Taking the floor gives an order of magnitude of 10². However, 900 is clearly much closer to 1000 (10³) than it is to 100 (10²).log₁₀(900) ≈ 2.95
gives 3, leading to an order of magnitude of 10³, which is a better representation of its scale.n
such that 10^n
is 'closest' to our number N
. We can define closeness by the ratio. We want to minimize how far N / 10^n
is from 1. This is equivalent to minimizing the absolute difference between their logarithms.n
that minimizes |log₁₀(N) - log₁₀(10^n)|
, which simplifies to |log₁₀(N) - n|
. By the definition of rounding, the integer n
that is closest to the value log₁₀(N)
is simply round(log₁₀(N))
.