Difference between revisions of "Manuals/calci/HEX2DEC"

From ZCubes Wiki
Jump to navigation Jump to search
Line 11: Line 11:
 
HEX2DEC(number)
 
HEX2DEC(number)
  
For example, HEX2DEC() ''returns 5'' as a result.
+
For example, HEX2DEC("F") ''returns 15'' as a result.
  
             HEX2DEC() ''returns 30'' as a result.  
+
             HEX2DEC("01D") ''returns 29'' as a result.  
  
 
*This function is used to convert a hexadecimal number to a decimal number.
 
*This function is used to convert a hexadecimal number to a decimal number.
*Hexadecimal number uses digits from 0 to 9 and characters from A to F.is represented using digits 1 or 0 only. The number can also be entered in text format (e.g "101").
+
*Hexadecimal number uses digits from 0 to 9 and characters from A to F. The number can also be entered in text format (e.g "1F").
*The conversion can be obtained for a binary number upto 17 bits for positive numbers and 10 bits for negative numbers.
+
*A number preceding with '0' (e.g 013) should be written in text format ("013") to avoid confusion with octal numbers.   
*The most significant bit represents the 'sign' of the number (0=positive, 1=negative). Negative numbers are represented using 2's complement notation.
+
*A number can be up to 10 characters (40 bits). The most significant bit is the sign bit and remaining are magnitude bits.
 
 
*Positive numbers may be from 0 (000000000) to 130046 (11111111111111110) and negative numbers from -1 (1111111111) to -512 (1000000000).
 
 
 
*A number preceding with '0' (e.g 01111111111) should be written in text format ("01111111111") to avoid confusion with octal numbers.   
 
 
 
*A binary number (e.g '101') is converted to decimal number (base 2) as -
 
(1*2^2)+(0*2^1)+(1*2^0)=4+0+1= ''5''
 
 
 
 
*If the number is not a valid number, 'Calci' returns an #ERROR message.
 
*If the number is not a valid number, 'Calci' returns an #ERROR message.
  
 
Below are few examples that show the use of combination of functions and get the result in decimal -
 
Below are few examples that show the use of combination of functions and get the result in decimal -
  
1)SUM(BIN2DEC(100) + BIN2DEC(101)) ''returns 9'' as a result.  
+
1)SUM(HEX2DEC("FF") + HEX2DEC("57")) ''returns 342'' as a result.  
 
 
2)AVERAGE(BIN2DEC(100) + BIN2DEC(101)) ''returns 4.5'' as a result.
 
 
 
3)BIN2DEC(110)+BIN2DEC(101)-BIN2DEC(100) ''returns 7'' as a result.
 
 
 
 
 
 
 
 
 
 
 
 
 
<div id="6SpaceContent" class="zcontent" align="left">
 
 
 
<font color="#000000"><font face="Arial, sans-serif"><font size="2">'''HEX2DEC'''</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">)</font></font></font>
 
 
 
<font color="#000000"><font face="Arial, sans-serif"><font size="2">Where 'num' is the hexadecimal number.</font></font></font>
 
 
 
</div>
 
----
 
<div id="1SpaceContent" class="zcontent" align="left">
 
 
 
<font color="#000000"><font face="Arial, sans-serif"><font size="2">This function ronverts a hexadecimal number to decimal.</font></font></font>
 
 
 
</div>
 
----
 
<div id="12SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="left">
 
  
HEX2DEC
+
2)HEX2DEC("65")- HEX2DEC("42") ''returns 35'' as a result.
  
</div></div>
+
== Examples ==
----
 
<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>
 
  
<font color="#000000"><font face="Arial, sans-serif"><font size="2">HEX2DEC(num)</font></font></font>
 
 
<font color="#000000"><font face="Arial, sans-serif"><font size="2"><nowiki>=HEX2DEC("55") is 85</nowiki></font></font></font>
 
 
<font color="#000000"><font face="Arial, sans-serif"><font size="2"><nowiki>=HEX2DEC("3DA408B") is 64635019</nowiki></font></font></font>
 
 
</div>
 
----
 
<div id="10SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Syntax </div><div class="ZEditBox"><center></center></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="2SpaceContent" class="zcontent" align="left">
 
<div id="2SpaceContent" class="zcontent" align="left">
  
 
{| id="TABLE3" class="SpreadSheet blue"
 
{| id="TABLE3" class="SpreadSheet blue"
 
|- class="even"
 
|- class="even"
| class=" " |
+
| class=" " | '''HEX Input'''
| Column1
+
| class="  " | '''Decimal Output'''
| class="  " | Column2
+
 
| Column3
 
| Column4
 
 
|- class="odd"
 
|- class="odd"
| class=" " | Row1
 
 
| class="sshl_f" | 85
 
| class="sshl_f" | 85
| class="sshl_f" |
+
| class="sshl_f" | 133
|
+
 
| class="                                                            sshl_f  " |
 
 
|- class="even"
 
|- class="even"
| class=" " | Row2
+
| class="ssh1_f" | 110
| class="sshl_f" | 64635019
+
| class="sshl_f" | 272
| class="SelectTD SelectTD " |
+
 
<div id="2Space_Handle" title="Click and Drag to resize CALCI Column/Row/Cell. It is EZ!"></div><div id="2Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
|
 
|
 
 
|- class="odd"
 
|- class="odd"
| Row3
+
| class="ssh1_f" | FFAFFAFFA
| class="                                       sshl_f      " |
+
| class="sshl_f" | 68635570170
|
+
 
|
 
|
 
|- class="even"
 
| Row4
 
|
 
|
 
|
 
| class="  " |
 
|- class="odd"
 
| class=" " | Row5
 
|
 
|
 
|
 
|
 
 
|- class="even"
 
|- class="even"
| Row6
+
| class="ssh1_f" | FFFFFFFFFF
|
+
| class="sshl_f" | -1
|
 
|
 
|
 
 
|}
 
|}
 
<div align="left">[[Image:calci1.gif]]</div></div>
 
----
 

Revision as of 16:42, 4 December 2013

HEX2DEC(number, places)

places argument to be included in upcoming version

  • Where 'number' is the hexadecimal number to be converted to decimal number.

HEX2DEC() converts a hexadecimal number to a decimal number.

Description

HEX2DEC(number)

For example, HEX2DEC("F") returns 15 as a result.

            HEX2DEC("01D") returns 29 as a result. 
  • This function is used to convert a hexadecimal number to a decimal number.
  • Hexadecimal number uses digits from 0 to 9 and characters from A to F. The number can also be entered in text format (e.g "1F").
  • A number preceding with '0' (e.g 013) should be written in text format ("013") to avoid confusion with octal numbers.
  • A number can be up to 10 characters (40 bits). The most significant bit is the sign bit and remaining are magnitude bits.
  • If the number is not a valid number, 'Calci' returns an #ERROR message.

Below are few examples that show the use of combination of functions and get the result in decimal -

1)SUM(HEX2DEC("FF") + HEX2DEC("57")) returns 342 as a result.

2)HEX2DEC("65")- HEX2DEC("42") returns 35 as a result.

Examples

HEX Input Decimal Output
85 133
110 272
FFAFFAFFA 68635570170
FFFFFFFFFF -1