Difference between revisions of "User:Trang Oul/Sandbox/Template:Range/Signed"

From Basin Wiki
Jump to navigation Jump to search
(Created page with "<noinclude> Usage: <code><nowiki>{{Range/Signed|min|max}}</nowiki></code> Examples: * ++: {{User:Trang Oul/Sandbox/Template:Range/Signed|1|2}} * 0+: {{User:Trang Oul/Sandbox/T...")
 
Line 7: Line 7:
 
* -0: {{User:Trang Oul/Sandbox/Template:Range/Signed|-1|0}}
 
* -0: {{User:Trang Oul/Sandbox/Template:Range/Signed|-1|0}}
 
* --: {{User:Trang Oul/Sandbox/Template:Range/Signed|-2|-1}}
 
* --: {{User:Trang Oul/Sandbox/Template:Range/Signed|-2|-1}}
−
</noinclude><includeonly>({{#ifexpr: {{{1}}} < 0 | ({{{1}}}) | {{{1}}} }}-{{#ifexpr: {{{2}}} < 0 | ({{{2}}}) | {{{2}}} }})</includeonly>
+
</noinclude><includeonly>{{#ifexpr: {{{1}}} >= 0
 +
  | +({{{1}}}-{{{2}}})
 +
  | {{#ifexpr: {{{2}}} <= 0
 +
      | -({{#expr: abs({{{1}}}) }}-{{#expr: abs({{{2}}}) }})
 +
      | (({{{1}}})-(+{{{2}}}))
 +
    }}
 +
}}</includeonly>

Revision as of 20:00, 2 November 2026

Usage: {{Range/Signed|min|max}} Examples:

  • ++: +(1-2)
  • 0+: +(0-2)
  • -+: ((-1)-(+2))
  • -0: -(1-0)
  • --: -(2-1)