Difference between revisions of "Manuals/calci/DEC2HEX"

From ZCubes Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
DEC2HEX() converts a decimal number to its hexadecimal equivalent.
 
DEC2HEX() converts a decimal number to its hexadecimal equivalent.
  
*If the number is nonnumeric or negative, Calci returns an #ERROR value.
+
== Description ==
*If 'places' is non-numeric or negative, Calci returns an #ERROR value.
 
  
</div>
+
DEC2HEX(number, places)
----
 
<div id="12SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="left">
 
  
 +
*The 'number' can be up to 20 digits (i.e. in-between -99999999999999999999 and -99999999999999999999).
 +
*Output is a 40 bit number. The most significant bit is the sign bit and remaining bits are magnitude bits.
 +
*If 'number' is negative, Calci ignores the places and returns a 10 character (40 bit) hexadecimal number.
 +
*'places' argument can be omitted. Calci displays the hexadecimal output with minimum number of characters necessary.
 +
*'places' is used for padding the output with leading '0's'.
 +
*A number preceding with '0' (e.g. 0377) should be written in text format ("0377") to avoid confusion with octal numbers.
  
 +
For Example,
  
</div></div>
+
DEC2HEX(50,5) ''returns 00032''
----
 
<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>
+
DEC2HEX(4567890) ''returns 000045B352''
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">DEC2HEX(num, p)</font></font></font>
+
DEC2HEX(35,3.3) ''returns 0023''
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2"><nowiki>=DEC2HEX(50, 5) is 32</nowiki></font></font></font>
+
*Calci displays an error message, if the 'number' is an invalid decimal number.
 +
*If the 'number' is not an integer, Calci considers the integer part, and displays the output.
 +
*Calci ignores the 'places', if the output is more than mentioned 'places'.
 +
*Calci ignores the 'places', if the 'places' is non-numeric or negative.
 +
*If 'places' is not an integer, Calci truncates the 'places' value.
  
<font color="#000000"><nowiki>=DEC2HEX(35) is 23</nowiki></font>
+
== Examples ==
  
</div>
 
----
 
<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">'''DEC2HEX'''</font></font><font face="Arial, sans-serif"><font size="2">(</font></font><font face="Arial, sans-serif"><font size="2">'''num'''</font></font><font face="Arial, sans-serif"><font size="2">, p)</font></font></font>
 
 
<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>
 
 
</div>
 
----
 
 
<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="  SelectTD SelectTD" |
+
| class="  " | '''Function'''
<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="  " | '''HEX Output'''
| Column1
+
 
| class="  " | Column2
 
| class="  " | Column3
 
| class="  " | Column4
 
 
|- class="odd"
 
|- class="odd"
| class=" " | Row1
+
| class="sshl_f" | DEC2HEX(512)
| class="sshl_f" | 32
+
| class="sshl_f" | 0000000200
| class="sshl_f" | 23
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="even"
 
|- class="even"
| class="  " | Row2
+
| class="sshl_f" | DEC2HEX(512,3)
| class="sshl_f" |
+
| class="sshl_f" | 200
| class="sshl_f" |
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="odd"
 
|- class="odd"
| Row3
+
| class="sshl_f" | DEC2HEX(2378,-4)
| class="sshl_f" |
+
| class="sshl_f" | 94A
| class="sshl_f" |
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="even"
 
|- class="even"
| Row4
+
| class="sshl_f" | DEC2HEX(7878.78)
| class="sshl_f" |
+
| class="sshl_f" | 0000001EC6
| class="sshl_f" |
+
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|- class="odd"
 
|- class="odd"
| class=" " | Row5
+
| class="sshl_f" | DEC2HEX("-364")
| class="sshl_f" |
+
| class="sshl_f" | FFFFFFFE94
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| Row6
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
 
|}
 
|}
  
<div align="left">[[Image:calci1.gif]]</div></div>
+
==Related Videos==
----
+
 
 +
{{#ev:youtube|NFmDz1dQyPU|280|center|DEC2HEX}}
 +
 
 +
== See Also ==
 +
 
 +
*[[Manuals/calci/DEC2BIN| DEC2BIN]]
 +
 
 +
*[[Manuals/calci/DEC2OCT| DEC2OCT]]
 +
 
 +
*[[Manuals/calci/HEX2DEC| HEX2DEC]]
 +
 
 +
==References==
 +
 
 +
*[http://en.wikipedia.org/wiki/Hexadecimal Hexadecimal Numbers]

Latest revision as of 13:21, 17 April 2015

DEC2HEX(number, places)

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

DEC2HEX() converts a decimal number to its hexadecimal equivalent.

Description

DEC2HEX(number, places)

  • The 'number' can be up to 20 digits (i.e. in-between -99999999999999999999 and -99999999999999999999).
  • Output is a 40 bit number. The most significant bit is the sign bit and remaining bits are magnitude bits.
  • If 'number' is negative, Calci ignores the places and returns a 10 character (40 bit) hexadecimal number.
  • 'places' argument can be omitted. Calci displays the hexadecimal output with minimum number of characters necessary.
  • 'places' is used for padding the output with leading '0's'.
  • A number preceding with '0' (e.g. 0377) should be written in text format ("0377") to avoid confusion with octal numbers.

For Example,

DEC2HEX(50,5) returns 00032

DEC2HEX(4567890) returns 000045B352

DEC2HEX(35,3.3) returns 0023

  • Calci displays an error message, if the 'number' is an invalid decimal number.
  • If the 'number' is not an integer, Calci considers the integer part, and displays the output.
  • Calci ignores the 'places', if the output is more than mentioned 'places'.
  • Calci ignores the 'places', if the 'places' is non-numeric or negative.
  • If 'places' is not an integer, Calci truncates the 'places' value.

Examples

Function HEX Output
DEC2HEX(512) 0000000200
DEC2HEX(512,3) 200
DEC2HEX(2378,-4) 94A
DEC2HEX(7878.78) 0000001EC6
DEC2HEX("-364") FFFFFFFE94

Related Videos

DEC2HEX

See Also

References