Difference between revisions of "Manuals/calci/DEC2BIN"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div id="6SpaceContent" class="zcontent" align="left"> <font color="#000000"><font face="Arial, sans-serif"><font size="2">DEC2BIN(num, p)</font></font></font> <font col...")
 
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div id="6SpaceContent" class="zcontent" align="left">
+
=DEC2BIN(number, places)=
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">DEC2BIN(num, p)</font></font></font>
+
*Where 'number' is the decimal integer to be converted and
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">Where 'num' is the decimal integer to convert and 'p' is the number of characters to use. </font></font></font>
+
*'places' is the number of characters to display the output.
  
</div>
+
DEC2BIN() function converts a decimal number to its binary equivalent.
----
 
<div id="7SpaceContent" class="zcontent" align="left">
 
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">DEC2BIN returns the NAN(error) value, when number is negative or nonnumeric.</font></font></font>
+
== Description ==
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">DEC2BIN returns the NAN(error) value, whenever the places are nonnumeric, zero or negative.</font></font></font>
+
DEC2BIN(number, places)
  
</div>
+
*The 'number' should be in the range -512 to 511. If it exceeds the limit, Calci gives a #NUM! error.
----
 
<div id="12SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="left">
 
  
DEC2BIN
+
*DEC2BIN returns an #ERROR, when the 'number' is nonnumeric.
  
</div></div>
+
*'places' argument is used to return the output with leading zeros. If 'places' argument is not used, 'Calci' uses the minimum number of characters required to display the binary output.
----
 
<div id="8SpaceContent" class="zcontent" align="left"> 
 
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">Lets see an example,</font></font></font>
+
*If 'places' is negative, Calci ignores the places and displays a 10 bit binary output. Most significant bit is the sign bit and remaining are magnitude bits.
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">DEC2BIN(num, p)</font></font></font>
+
*If 'places' is not an integer, Calci truncates the value and uses the integer part as input.
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2"><nowiki>=DEC2BIN(10, 5) is 1010</nowiki></font></font></font>
+
*A number preceding with '0' (e.g. 0377) should be written in text format ("0377") to avoid confusion with octal numbers.
  
<font color="#000000"><nowiki>=DEC2BIN(100) is </nowiki><font face="Arial, sans-serif"><font size="2">1100100</font></font></font>
+
For example,
  
</div>
+
DEC2BIN(10, 4) ''returns 1010''
----
 
<div id="10SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Syntax </div><div class="ZEditBox"><center></center></div></div>
 
----
 
<div id="4SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Remarks </div></div>
 
----
 
<div id="3SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Examples </div></div>
 
----
 
<div id="11SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Description </div></div>
 
----
 
<div id="5SpaceContent" class="zcontent" align="left">
 
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">This function converts a decimal number to binary number.</font></font></font>
+
DEC2BIN(100) ''returns 0001100100''
  
</div>
+
DEC2BIN(30,5.5) ''returns 011110''
----
+
 
 +
== Examples ==
 
<div id="1SpaceContent" class="zcontent" align="left">
 
<div id="1SpaceContent" class="zcontent" align="left">
  
 
{| id="TABLE1" class="SpreadSheet blue"
 
{| id="TABLE1" class="SpreadSheet blue"
 
|- class="even"
 
|- class="even"
| class="  " |
+
| class="  " | '''Function'''
<div id="1Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
+
| class="  " | '''Binary Output'''
| Column1
+
 
| class="  " | Column2
 
| class="  " | Column3
 
| class="  " | Column4
 
 
|- class="odd"
 
|- class="odd"
| class=" " | Row1
+
| class="sshl_f" | DEC2BIN(10)
 +
| class="sshl_f" | 0000001010
 +
 
 +
|- class="even"
 +
| class="sshl_f" | DEC2BIN(10,4)
 
| class="sshl_f" | 1010
 
| class="sshl_f" | 1010
| class="sshl_f" | 1100100
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| class="  " | Row2
 
| class="sshl_f" |
 
| class="sshl_f SelectTD SelectTD" |
 
<div id="1Space_Handle" title="Click and Drag to resize CALCI Column/Row/Cell. It is EZ!"></div><div id="1Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="odd"
 
|- class="odd"
| Row3
+
| class="sshl_f" | DEC2BIN(100,8)
| class="sshl_f" |
+
| class="sshl_f" | 01100100
| class="sshl_f" |
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="even"
 
|- class="even"
| Row4
+
| class="sshl_f" | DEC2BIN(-56)
| class="sshl_f" |
+
| class="sshl_f" | 1111001000
| class="sshl_f" |
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="odd"
 
|- class="odd"
| class=" " | Row5
+
| class="sshl_f" | DEC2BIN(-512)
| class="sshl_f" |
+
| class="sshl_f" | 1000000000
| class="sshl_f" |
+
|}
| class="sshl_f" |
+
 
| class="sshl_f" |
+
===ZOS Examples===
|- class="even"
+
DEC2BIN(0..10)
| Row6
+
 
| class="sshl_f" |
+
{| class="wikitable"
| class="sshl_f" |
+
|-
| class="sshl_f" |
+
! number !! DEC2BIN
| class="sshl_f" |
+
|-
 +
| 0 || 0000000000
 +
|-
 +
| 1 || 0000000001
 +
|-
 +
| 2 || 0000000010
 +
|-
 +
| 3 || 0000000011
 +
|-
 +
| 4 || 0000000100
 +
|-
 +
| 5 || 0000000101
 +
|-
 +
| 6 || 0000000110
 +
|-
 +
| 7 || 0000000111
 +
|-
 +
| 8 || 0000001000
 +
|-
 +
| 9 || 0000001001
 +
|-
 +
| 10 || 0000001010
 
|}
 
|}
  
<div align="left">[[Image:calci1.gif]]</div></div>
+
==Related Videos==
----
+
 
 +
{{#ev:youtube|H4BstqvgBow|280|center|DEC2BIN}}
 +
 
 +
== See Also ==
 +
 
 +
*[[Manuals/calci/DEC2HEX| DEC2HEX]]
 +
 
 +
*[[Manuals/calci/DEC2OCT| DEC2OCT]]
 +
 
 +
*[[Manuals/calci/BIN2DEC| BIN2DEC]]
 +
 
 +
==References==
 +
 
 +
*[http://en.wikipedia.org/wiki/Decimal Decimal Numbers]

Latest revision as of 12:45, 22 April 2015

DEC2BIN(number, places)

  • Where 'number' is the decimal integer to be converted and
  • 'places' is the number of characters to display the output.

DEC2BIN() function converts a decimal number to its binary equivalent.

Description

DEC2BIN(number, places)

  • The 'number' should be in the range -512 to 511. If it exceeds the limit, Calci gives a #NUM! error.
  • DEC2BIN returns an #ERROR, when the 'number' is nonnumeric.
  • 'places' argument is used to return the output with leading zeros. If 'places' argument is not used, 'Calci' uses the minimum number of characters required to display the binary output.
  • If 'places' is negative, Calci ignores the places and displays a 10 bit binary output. Most significant bit is the sign bit and remaining are magnitude bits.
  • If 'places' is not an integer, Calci truncates the value and uses the integer part as input.
  • A number preceding with '0' (e.g. 0377) should be written in text format ("0377") to avoid confusion with octal numbers.

For example,

DEC2BIN(10, 4) returns 1010

DEC2BIN(100) returns 0001100100

DEC2BIN(30,5.5) returns 011110

Examples

Function Binary Output
DEC2BIN(10) 0000001010
DEC2BIN(10,4) 1010
DEC2BIN(100,8) 01100100
DEC2BIN(-56) 1111001000
DEC2BIN(-512) 1000000000

ZOS Examples

DEC2BIN(0..10)

number DEC2BIN
0 0000000000
1 0000000001
2 0000000010
3 0000000011
4 0000000100
5 0000000101
6 0000000110
7 0000000111
8 0000001000
9 0000001001
10 0000001010

Related Videos

DEC2BIN

See Also

References