Difference between revisions of "Template:DEC/workpage"

From blackwiki
Jump to navigation Jump to search
imported>JJMC89
(Remove {{bots}} being used as a blunt instrument contrary to the documentation)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{nobots}}{{workpage}}
+
<noinclude>{{workpage}}{{purgebox}}
  
 
Try to extract fractional part
 
Try to extract fractional part
Line 16: Line 16:
 
</pre>
 
</pre>
 
{{#explode:{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|.|1}}
 
{{#explode:{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|.|1}}
 
<pre>
 
{{explode:{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|.|1}}
 
</pre>
 
{{explode:{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|.|1}}
 
  
 
<pre>
 
<pre>
Line 56: Line 51:
 
;complete
 
;complete
 
<pre>
 
<pre>
{{#if: {{#expr: -13.26 < 0 }} | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc -13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -13.26))}}|2|0}} | {{#expr: (abs (trunc -13.26))}} }}"{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}
+
{{#ifexpr: -13.26 < 0 | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc -13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -13.26))}}|2|0}} | {{#expr: (abs (trunc -13.26))}} }}"{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}
 +
</pre>
 +
{{#ifexpr: -13.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc -13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -13.26))}}|2|0}} | {{#expr: (abs (trunc -13.26))}} }}"{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}
 +
 
 +
<pre>
 +
{{#ifexpr: -3.26 < 0 | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc -3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -3.26))}}|2|0}} | {{#expr: (abs (trunc -3.26))}} }}"{{#if: {{#expr: (abs -3.26) - (abs (trunc -3.26)) }} > 0 | {{str right|{{#expr: (abs -3.26) - (abs (trunc -3.26)) }}|1}} }}
 +
</pre>
 +
{{#ifexpr: -3.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc -3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -3.26))}}|2|0}} | {{#expr: (abs (trunc -3.26))}} }}"{{#if: {{#expr: (abs -3.26) - (abs (trunc -3.26)) }} > 0 | {{str right|{{#expr: (abs -3.26) - (abs (trunc -3.26)) }}|1}} }}
 +
 
 +
<pre>
 +
{{#ifexpr: 13.26 < 0 | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc 13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc 13.26))}}|2|0}} | {{#expr: (abs (trunc 13.26))}} }}"{{#if: {{#expr: (abs 13.26) - (abs (trunc 13.26)) }} > 0 | {{str right|{{#expr: (abs 13.26) - (abs (trunc 13.26)) }}|1}} }}
 
</pre>
 
</pre>
{{#if: {{#expr: -13.26 < 0 }} | &minus; | + }}{{#if: {{#expr: (abs (trunc -13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -13.26))}}|2|0}} | {{#expr: (abs (trunc -13.26))}} }}"{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}
+
{{#ifexpr: 13.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc 13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc 13.26))}}|2|0}} | {{#expr: (abs (trunc 13.26))}} }}"{{#if: {{#expr: (abs 13.26) - (abs (trunc 13.26)) }} > 0 | {{str right|{{#expr: (abs 13.26) - (abs (trunc 13.26)) }}|1}} }}
  
 
<pre>
 
<pre>
{{#if: {{#expr: -3.26 < 0 }} | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc -3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -3.26))}}|2|0}} | {{#expr: (abs (trunc -3.26))}} }}"{{#if: {{#expr: (abs -3.26) - (abs (trunc -3.26)) }} > 0 | {{str right|{{#expr: (abs -3.26) - (abs (trunc -3.26)) }}|1}} }}
+
{{#ifexpr: +3.26 < 0 | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc +3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc +3.26))}}|2|0}} | {{#expr: (abs (trunc +3.26))}} }}"{{#if: {{#expr: (abs +3.26) - (abs (trunc +3.26)) }} > 0 | {{str right|{{#expr: (abs +3.26) - (abs (trunc +3.26)) }}|1}} }}
 
</pre>
 
</pre>
{{#if: {{#expr: -3.26 < 0 }} | &minus; | + }}{{#if: {{#expr: (abs (trunc -3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -3.26))}}|2|0}} | {{#expr: (abs (trunc -3.26))}} }}"{{#if: {{#expr: (abs -3.26) - (abs (trunc -3.26)) }} > 0 | {{str right|{{#expr: (abs -3.26) - (abs (trunc -3.26)) }}|1}} }}
+
{{#ifexpr: +3.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc +3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc +3.26))}}|2|0}} | {{#expr: (abs (trunc +3.26))}} }}"{{#if: {{#expr: (abs +3.26) - (abs (trunc +3.26)) }} > 0 | {{str right|{{#expr: (abs +3.26) - (abs (trunc +3.26)) }}|1}} }}
 +
 
 +
 
 +
templatize
  
 
<pre>
 
<pre>
{{#if: {{#expr: 13.26 < 0 }} | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc 13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc 13.26))}}|2|0}} | {{#expr: (abs (trunc 13.26))}} }}"{{#if: {{#expr: (abs 13.26) - (abs (trunc 13.26)) }} > 0 | {{str right|{{#expr: (abs 13.26) - (abs (trunc 13.26)) }}|1}} }}
+
{{#ifexpr: {{{A}}} < 0 | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc {{{A}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A}}} ))}} }}"{{#if: {{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }}|1}} }}
 
</pre>
 
</pre>
{{#if: {{#expr: 13.26 < 0 }} | &minus; | + }}{{#if: {{#expr: (abs (trunc 13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc 13.26))}}|2|0}} | {{#expr: (abs (trunc 13.26))}} }}"{{#if: {{#expr: (abs 13.26) - (abs (trunc 13.26)) }} > 0 | {{str right|{{#expr: (abs 13.26) - (abs (trunc 13.26)) }}|1}} }}
+
{{#ifexpr: {{{A|0}}} < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc {{{A|0}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A|0}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A|0}}} ))}} }}"{{#if: {{#expr: (abs {{{A|0}}} ) - (abs (trunc {{{A|0}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A|0}}} ) - (abs (trunc {{{A|0}}} )) }}|1}} }}
 +
 
  
 
<pre>
 
<pre>
{{#if: {{#expr: +3.26 < 0 }} | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc +3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc +3.26))}}|2|0}} | {{#expr: (abs (trunc +3.26))}} }}"{{#if: {{#expr: (abs +3.26) - (abs (trunc +3.26)) }} > 0 | {{str right|{{#expr: (abs +3.26) - (abs (trunc +3.26)) }}|1}} }}
+
{{#if: {{{A|}}} |
 +
{{#ifexpr: {{{A}}} < 0 | &amp;minus; | + }}{{#if: {{#expr: (abs (trunc {{{A}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A}}} ))}} }}"{{#if: {{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }}|1}} }}
 +
| 00" }}
 
</pre>
 
</pre>
{{#if: {{#expr: +3.26 < 0 }} | &minus; | + }}{{#if: {{#expr: (abs (trunc +3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc +3.26))}}|2|0}} | {{#expr: (abs (trunc +3.26))}} }}"{{#if: {{#expr: (abs +3.26) - (abs (trunc +3.26)) }} > 0 | {{str right|{{#expr: (abs +3.26) - (abs (trunc +3.26)) }}|1}} }}
+
{{#if: {{{A|}}} |
 +
{{#ifexpr: {{{A}}} < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc {{{A}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A}}} ))}} }}"{{#if: {{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }}|1}} }}
 +
| 00" }}
 +
 
 +
; TEST
 +
<onlyinclude>
 +
{{#if: {{{A|}}} |
 +
{{#ifexpr: {{{A}}} < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc {{{A}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A}}} ))}} }}"{{#if: {{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }}|1}} }}
 +
| 00" }}
 +
</onlyinclude>
 +
 
 +
{{DEC/workpage|A=}}
 +
{{DEC/workpage|A=-13.26}}
 +
{{DEC/workpage|A=+3.26}}
 +
{{DEC/workpage|A=0.26}}

Latest revision as of 04:19, 3 April 2018

Template:WorkpageTemplate:Purgebox

Try to extract fractional part

{{#expr: {{#expr: abs -13.26 }} mod {{#expr: abs {{#expr: trunc -13.26}} }} }}

0

{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}

0.26

{{#explode:{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|.|1}}

{{#explode:0.26|.|1}}

{{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}}

.26

{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}

.26

check negative
{{#ifexpr: -13.26 < 0  | &minus; | + }}

{{#ifexpr: +3.26 < 0  | &minus; | + }}

+

{{#ifexpr: 0.26 < 0  | &minus; | + }}

+

pull together
{{#if: {{#expr: -13.26 < 0 }} | &minus; }}{{#expr: abs (trunc -13.26)}}"{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}

−13".26

complete
{{#ifexpr: -13.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc -13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -13.26))}}|2|0}} | {{#expr: (abs (trunc -13.26))}} }}"{{#if: {{#expr: (abs -13.26) - (abs (trunc -13.26)) }} > 0 | {{str right|{{#expr: (abs -13.26) - (abs (trunc -13.26)) }}|1}} }}

−13".26

{{#ifexpr: -3.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc -3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc -3.26))}}|2|0}} | {{#expr: (abs (trunc -3.26))}} }}"{{#if: {{#expr: (abs -3.26) - (abs (trunc -3.26)) }} > 0 | {{str right|{{#expr: (abs -3.26) - (abs (trunc -3.26)) }}|1}} }}

−03".26

{{#ifexpr: 13.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc 13.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc 13.26))}}|2|0}} | {{#expr: (abs (trunc 13.26))}} }}"{{#if: {{#expr: (abs 13.26) - (abs (trunc 13.26)) }} > 0 | {{str right|{{#expr: (abs 13.26) - (abs (trunc 13.26)) }}|1}} }}

+13".26

{{#ifexpr: +3.26 < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc +3.26)) < 10 }} | {{padleft:{{#expr: (abs (trunc +3.26))}}|2|0}} | {{#expr: (abs (trunc +3.26))}} }}"{{#if: {{#expr: (abs +3.26) - (abs (trunc +3.26)) }} > 0 | {{str right|{{#expr: (abs +3.26) - (abs (trunc +3.26)) }}|1}} }}

+03".26


templatize

{{#ifexpr: {{{A}}} < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc {{{A}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A}}} ))}} }}"{{#if: {{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }}|1}} }}

+00"


{{#if: {{{A|}}} |
{{#ifexpr: {{{A}}} < 0 | &minus; | + }}{{#if: {{#expr: (abs (trunc {{{A}}} )) < 10 }} | {{padleft:{{#expr: (abs (trunc {{{A}}} ))}}|2|0}} | {{#expr: (abs (trunc {{{A}}} ))}} }}"{{#if: {{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }} > 0 | {{str right|{{#expr: (abs {{{A}}} ) - (abs (trunc {{{A}}} )) }}|1}} }}
| 00" }}

00"

TEST

00"


00"


−13".26


+03".26


+00".26