Template talk:Sqr

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search
  • {{subst:#if:1|{{subst:sqr|5}}}} gives 2.2360679775 in one edit.

Maximum value of argument:

  • {{subst:#if:1|{{subst:sqr|1999999999997}}}} gives 1414213.56237.
  • {{subst:#if:1|{{subst:sqr|1999999999998}}}} gives "Expression error: Unrecognised word "e"".

Minimum value of argument:

  • {{subst:#if:1|{{subst:sqr|.00000001000000000000001}}}} gives 0.000100000000001.
  • {{subst:#if:1|{{subst:sqr|.000000010000000000000001}}}} gives "Expression error: Unrecognised word "e"".

Golden ratio: {{subst:#expr:({{subst:#if:1|{{subst:sqr|5}}}}+1)/2}} gives 1.61803398875.

The template content on substitution is of the form

{{subst:#ifexpr:boolean_for_"not_finished"|{{subst:sqr|argument_of_square_root|new_approximation}}|old_approximation}}</nowiki>

{{subst:sqr|5}} gives the wikitext

{{subst:#ifexpr:1|{{subst:sqr|5|1}}|{{{2}}}}}

{{subst:sqr|5|2}} gives:

{{subst:#ifexpr:1|{{subst:sqr|5|2.25}}|2}}

{{subst:sqr|5|2.2360679775}} gives:

{{subst:#ifexpr:0|{{subst:sqr|5|2.2360679775}}|2.2360679775}}

Thus the edit history records the number for which the square root is computed and the starting value, if any, with the next approximation (otherwise it gives {{{2}}} as starting value and 1 as the next approximation); in all cases the next edit/save gives 2.2360679775.

[edit] Square root templates

See also: