Difference between revisions of "Template:Binary/doc"

From blackwiki
Jump to navigation Jump to search
imported>Dexbot
m (Bot: Cleaning up old interwiki links)
imported>Vanisaac
m (→‎See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
 
=== Usage ===
 
=== Usage ===
  
Use <code><nowiki>{{Binary|x|y}}</nowiki></code> where x is the decimal number and y is the decimal precision (positive numbers, defaults displays up to 10 digits following the binary point).  
+
Use {{tlc|Binary|x|y}} where x is the decimal number and y is the decimal precision (positive numbers, defaults displays up to 10 digits following the binary point).  
  
 
Examples:  
 
Examples:  
  
{|
+
{|class="wikitable"
 
! Code !! Result !! Notes
 
! Code !! Result !! Notes
 
|-
 
|-
|<nowiki>{{Binary|128892}}</nowiki>||{{Binary|128892}} || Regular integer
+
|{{tlc|Binary|128892}}||{{Binary|128892}} || Regular integer
 
|-
 
|-
|<nowiki>{{Binary|73.3333333|5}}</nowiki>||{{Binary|73.3333333|5}} || Truncated decimal
+
|{{tlc|Binary|73.3333333|5}}||{{Binary|73.3333333|5}} || Truncated decimal
 
|-
 
|-
|<nowiki>{{Binary|73.3333333|0}}</nowiki>||{{Binary|73.3333333|0}} || Truncated at decimal point
+
|{{tlc|Binary|73.3333333|0}}||{{Binary|73.3333333|0}} || Truncated at decimal point
 
|-
 
|-
|<nowiki>{{Binary|73|5}}</nowiki>||{{Binary|73|5}} || Decimals padded to integer
+
|{{tlc|Binary|73|5}}||{{Binary|73|5}} || Decimals padded to integer
 
|-
 
|-
|<nowiki>{{Binary|73.25}}</nowiki>||{{Binary|73.25}} || Auto truncation
+
|{{tlc|Binary|73.25}}||{{Binary|73.25}} || Auto truncation
 
|-
 
|-
|<nowiki>{{Binary|73.25|4}}</nowiki>||{{Binary|73.25|4}} || Decimals padded
+
|{{tlc|Binary|73.25|4}}||{{Binary|73.25|4}} || Decimals padded
 
|-
 
|-
|<nowiki>{{Binary|{{#expr:1+3/8}}}}</nowiki>||{{Binary|{{#expr:1+3/8}}}} || Expression support
+
|{{tlc|Binary|{{((}}#expr:1+3/8{{))}}}}||{{Binary|{{#expr:1+3/8}}}} || Expression support
 
|}
 
|}
  
 
=== See also ===
 
=== See also ===
{{Math templates|numeral systems}}<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox| |
+
{{Math templates|numeral systems}}<includeonly>{{Sandbox other||
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:Numerical conversion templates|{{PAGENAME}}]]
 
[[Category:Numerical conversion templates|{{PAGENAME}}]]
  
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 23:58, 23 April 2020

This template is for quickly converting a decimal number to binary.

Usage

Use {{Binary|x|y}} where x is the decimal number and y is the decimal precision (positive numbers, defaults displays up to 10 digits following the binary point).

Examples:

Code Result Notes
{{Binary|128892}} 111110111011111002 Regular integer
{{Binary|73.3333333|5}} 1001001.010102 Truncated decimal
{{Binary|73.3333333|0}} 10010012 Truncated at decimal point
{{Binary|73|5}} 1001001.000002 Decimals padded to integer
{{Binary|73.25}} 1001001.012 Auto truncation
{{Binary|73.25|4}} 1001001.01002 Decimals padded
{{Binary|{{#expr:1+3/8}}}} 1.0112 Expression support

See also