Template:Oom
Usage
editThis template determines the log to the base 10, rounded down to an integer (Order Of Magnitude), of a given positive number. In other words, it determines the log to the base 10 of the result of rounding down to a power of 10. For numbers ≥ 1 this is one less than the number of digits before the decimal point.
The result applies to the number after the system's rounding to one that is internally representable, i.e., no string operations are performed to distinguish between numbers rounded to the same representable one, or to treat mathematically equivalent numbers the same even when the system rounds them to different representable ones:
{{oom|99999999999999990000000}}
→ 22{{#expr:99999999999999990000000=1e23}}
→ 1{{oom|9.999999999999999e-4}}
→ -4{{#expr:9.999999999999999e-4=1e-3}}
→ 0{{oom|99.99999999999999e-5}}
→ -3{{#expr:99.99999999999999e-5=1e-3}}
→ 1
See also Manual:Representation of numbers in expr parser function.
Examples
edit{{oom|.5e-323}}
→ -324{{hex|.5e-323}}
→1.hex*2^-1074
{{oom|.7e-323}}
→ -324{{hex|.7e-323}}
→1.hex*2^-1074
{{oom|.8e-323}}
→ -324{{oom|1e-308}}
→ -308{{oom|1e-100*(1-1e-15)}}
→ -101{{oom|1e-100}}
→ -100{{oom|1e-10*(1-1e-15)}}
→ -11{{oom|1e-10}}
→ -10{{oom|1-1e-15}}
→ -1{{oom|1}}
→ 0{{oom|10*(1-1e-15)}}
→ 0{{oom|10-1e-14}}
→ 0{{oom|9.99999999999999}}
→ 0{{oom|10}}
→ 1{{oom|20241102203025}}
→ 13 ({{CURRENTTIMESTAMP}
}){{oom|1e14*(1-1e-15)}}
→ 13{{oom|1e14}}
→ 14{{oom|1e15*(1-1e-15)}}
→ 14{{oom|1e15}}
→ 14{{oom|1e16-2}}
→ 15{{oom|trunc1e16-trunc1}}
→ 16{{oom|1e16}}
→ 16{{oom|1e17-16}}
→ 16{{oom|trunc1e17-trunc1}}
→ 17{{oom|1e17}}
→ 17{{oom|trunc1e18-trunc1}}
→ 17{{oom|1e18}}
→ 17{{oom|1e17*(1-1e-15)}}
→ 16{{oom|1e17}}
→ 17{{oom|1e308*(1-1e-15)}}
→ 307{{oom|1e308}}
→ 308{{oom|1-5.1e-16}}
→ -1{{oom|0.99999999999999949}}
→ -1{{oom|1-4.9e-16}}
→ -1{{oom|0.99999999999999951}}
→ -1{{oom|10-6e-15}}
→ 0{{oom|10-5.1e-15}}
→ 0{{oom|10-5e-15}}
→ 0{{oom|10-4.9e-15}}
→ 0{{oom|10*(1-4.9e-16)}}
→ 0{{oom|9.9999999999999951}}
→ 0{{oom|10-4e-15}}
→ 0{{oom|10*(1-4e-16)}}
→ 0{{oom|9.999999999999996}}
→ 0{{#expr:10*(1-4.9e-16)}}
→ 10{{#expr:10*(1-4.9e-16)<10}}
→ 1