Difference between revisions of "Template:Binary/doc"

From blackwiki
Jump to navigation Jump to search
imported>Mr. Stradivarius
(add {{lua}} template and remove Category:Lua-based templates, as it is added by the template as well - see Wikipedia talk:Lua#Lua talk template)
imported>Vanisaac
m (→‎See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(5 intermediate revisions by 5 users 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 ===
*[[Template:Roman]]
+
{{Math templates|numeral systems}}<includeonly>{{Sandbox other||
*[[Template:Octal]]
 
*[[Template:Duodecimal]]
 
*[[Template:Hexadecimal]]
 
<includeonly>
 
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:Numerical conversion templates|{{PAGENAME}}]]
 
[[Category:Numerical conversion templates|{{PAGENAME}}]]
[[Category:Lua-based templates|{{PAGENAME}}]]
 
  
[[fa:الگو:Binary]]
+
}}</includeonly>
[[id:Templat:Binary]]
 
[[es:Plantilla:Binario]]
 
</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