Jump to content

Template:Sgn/doc

From Simple English Wikipedia, the free encyclopedia
Revision as of 07:44, 5 July 2012 by imported>Auntof6 (identify as doc subpage; rem sort keys)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template evaluates its numeric parameter and returns its mathematical sign. If the parameter is empty or missing, it returns an empty string. Otherwise, the return value is 1 if the parameter is positive, 0 if it is null, -1 if negative.

Syntax:
{{Sgn|value}}
Examples:
  • "{{Sgn|100}}" = "1".
  • "{{Sgn|0.1}}" = "1".
  • "{{Sgn|1-1}}" = "0".
  • "{{Sgn|-0.1}}" = "-1".
  • "{{Sgn|-100}}" = "-1".