Template:Oom

From SacredWiki
Revision as of 22:03, 10 October 2013 by Schot (talk | contribs) (1 revision: Updating our Help Pages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This 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}} → 23
  • {{#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 Help:Calculation accuracy.

Examples

  • {{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}} → -323
    • {{hex|.8e-323}}1.0hex*2^-1073
    • {{hex|1e-323}}1.0hex*2^-1073
    • {{#expr:1074*ln2/ln10}} → 323.30621534312
  • {{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|20241123104419}} → 13 ({{CURRENTTIMESTAMP}})
  • {{oom|1e14*(1-1e-15)}} → 13
  • {{oom|1e14}} → 14
  • {{oom|1e15*(1-1e-15)}} → 14
  • {{oom|1e15}} → 15
  • {{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}} → 18
  • {{oom|1e18}} → 18
  • {{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