Difference between revisions of "Template:Octal"

From Traveller Wiki - Science-Fiction Adventure in the Far future
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#ifexpr: {{{1}}} < 0|-|}}
+
{{#ifexpr: {{{1}}} < 0|-|}}{{#ifexpr: {{Abs|{{{1}}}}} < 512||{{#expr:({{Abs|{{{1}}}}} / 512) mod 8}}}}{{#ifexpr: {{Abs|{{{1}}}}} < 65||{{#expr:({{Abs|{{{1}}}}} / 64) mod 8}}}}{{#ifexpr: {{Abs|{{{1}}}}} < 8||{{#expr:({{Abs|{{{1}}}}} / 8) mod 8}}}}{{#expr:({{Abs|{{{1}}}}} / 1) mod 8}}<noinclude>
{{#ifexpr: {{Abs|{{{1}}}}} < 512||{{#expr:({{Abs|{{{1}}}}} / 512) mod 8}}}}
 
{{#ifexpr: {{Abs|{{{1}}}}} < 65||{{#expr:({{Abs|{{{1}}}}} / 64) mod 8}}}}
 
{{#ifexpr: {{Abs|{{{1}}}}} < 8||{{#expr:({{Abs|{{{1}}}}} / 8) mod 8}}}}
 
{{#expr:({{Abs|{{{1}}}}} / 1) mod 8}}<noinclude>
 
  
This template converts numbers to Octal notatation. use is <nowiki>{{Octal|Number}}</nowiki>
+
This template converts numbers to Octal notatation.  
 +
 
 +
Use is <nowiki>{{Octal|Number}}</nowiki>
  
 
The template correctly handles negative numbers.  
 
The template correctly handles negative numbers.  
  
 
The Template handles values of up to 4095 correctly. (larger values are truncated on the high end.
 
The Template handles values of up to 4095 correctly. (larger values are truncated on the high end.
 
+
[[Category: Math Templates|Octal]]
 
</noinclude>
 
</noinclude>

Latest revision as of 17:16, 11 April 2020

Expression error: Unrecognized punctuation character "{".Expression error: Unexpected < operator.Expression error: Unexpected < operator.Expression error: Unexpected < operator.Expression error: Unexpected < operator.

This template converts numbers to Octal notatation.

Use is {{Octal|Number}}

The template correctly handles negative numbers.

The Template handles values of up to 4095 correctly. (larger values are truncated on the high end.