Template:Sqrt
Jump to navigation
Jump to search
Borrowed from KoL wiki, this template gives an approximation to the square root of a number. Created as a work-around to the current shortcomings of the wiki's parsers.
This uses the Babylonian algorithm for computing a square root. The result is the fifth iterate obtained by this method, using the value 1+floor(input/20)
as the seed value. This value is only an approximation, as the examples below should demonstrate, but the inaccuracies will not show up until after the 6th decimal digit for values likely to be passed to the template. Rounding the value, as indicated in the last example, is suggested.
Examples
- {{sqrt|537.5818355}}
- 23.185811081349
- {{sqrt|4}}
- 2.0000000929223
- {{sqrt|121}}
- 11.000000000778
- {{#expr: {{sqrt|121}} round 2}}
- 11