Шаблон:Binary — разлика између измена

Садржај обрисан Садржај додат
Нова страница: <!--Integer part - everything acts on #expr: trunc{{{1}}}. All values are calculated as octal digits, displayed as binary. --><includeonly>{{#ifeq:{{#expr: trunc{{{1}}…
 
Замењен садржај странице са „<includeonly>{{#invoke: BaseConvert | convert | n={{{1}}} | base=2 | precision={{{2}}} | suffix=<sub>2</sub> }}</incl…“
Ред 1:
<includeonly>{{#invoke: BaseConvert
<!--Integer part - everything acts on #expr: trunc{{{1}}}.
| convert
All values are calculated as octal digits, displayed as binary.
| n={{{1}}}
 
| base=2
--><includeonly>{{#ifeq:{{#expr: trunc{{{1}}} > 134217727}} | 1 |N/A|{{#ifeq:{{#expr: trunc{{{1}}} < 0}} | 1 |N/A|<!--
| precision={{{2}}}
-->{{#switch:{{#expr: (trunc{{{1}}} div 16777216) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >134217727}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >134217727}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >134217727}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >134217727}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
| suffix=<sub>2</sub>
-->{{#switch:{{#expr: (trunc{{{1}}} div 2097152) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >16777215}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >16777215}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >16777215}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >16777215}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->}}<sub>2</sub></includeonly><noinclude>
-->{{#switch:{{#expr: (trunc{{{1}}} div 262144) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >2097151}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >2097151}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >2097151}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >2097151}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->{{#switch:{{#expr: (trunc{{{1}}} div 32768) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >262143}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >262143}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >262143}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >262143}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->{{#switch:{{#expr: (trunc{{{1}}} div 4096) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >32767}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >32767}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >32767}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >32767}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->{{#switch:{{#expr: (trunc{{{1}}} div 512) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >4095}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >4095}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >4095}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >4095}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->{{#switch:{{#expr: (trunc{{{1}}} div 64) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >511}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >511}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >511}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >511}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->{{#switch:{{#expr: (trunc{{{1}}} div 8) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >63}} | 1 |000}}|1={{#ifeq:{{#expr: trunc{{{1}}} >63}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >63}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >63}} | 1 |011|11}}|4=100|5=101|6=110|7=111}}<!--
-->{{#switch:{{#expr: (trunc{{{1}}} div 1) mod 8}}|0={{#ifeq:{{#expr: trunc{{{1}}} >7}} | 1 |000|0}}|1={{#ifeq:{{#expr: trunc{{{1}}} >7}} | 1 |001|1}}|2={{#ifeq:{{#expr: trunc{{{1}}} >7}} | 1 |010|10}}|3={{#ifeq:{{#expr: trunc{{{1}}} >7}} | 1 |011|11}}|4=100|5=101|6=110|7=111}} }} }}<!--
Decimal part - everything acts on #expr: ({{{1}}}-trunc{{{1}}})
All values calculated as individual binary digits. Automatically truncates at last significant digit, unless template call specifies 0 padding.
 
-->{{#ifeq: {{{1|}}} | {{#expr:trunc{{{1|}}}}} | {{#if:{{{2|}}}|.{{padleft:0|{{{2}}}|0}}|}} |<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 0}} | 1 | .{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^1 mod 2}} | }}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 1}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^1}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^1)}}| {{#ifeq: {{#expr: {{{2|}}} > 1}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^2 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 2}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^2}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^2)}}| {{#ifeq: {{#expr: {{{2|}}} > 2}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^3 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 3}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^3}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^3)}}| {{#ifeq: {{#expr: {{{2|}}} > 3}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^4 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 4}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^4}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^4)}}| {{#ifeq: {{#expr: {{{2|}}} > 4}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^5 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 5}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^5}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^5)}}| {{#ifeq: {{#expr: {{{2|}}} > 5}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^6 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 6}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^6}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^6)}}| {{#ifeq: {{#expr: {{{2|}}} > 6}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^7 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 7}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^7}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^7)}}| {{#ifeq: {{#expr: {{{2|}}} > 7}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^8 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 8}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^8}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^8)}}| {{#ifeq: {{#expr: {{{2|}}} > 8}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^9 mod 2}} | }}}}<!--
-->{{#ifeq: {{#expr: {{{2|10}}} > 9}} | 1 | {{#ifeq: {{#expr: ({{{1}}}-trunc{{{1}}})*2^9}} |{{#expr: trunc(({{{1}}}-trunc{{{1}}})*2^9)}}| {{#ifeq: {{#expr: {{{2|}}} > 9}} | 1 | 0 }} |{{#expr: ({{{1}}}-trunc{{{1}}}) * 2^10 mod 2}} | }}}}<!--
-->}}<sub>2</sub></includeonly><noinclude>
{{documentation}}
[[Категорија:Нумерички шаблони|{{PAGENAME}}]]
</noinclude>