Difference between revisions of "Manuals/calci/DEC2HEX"

From ZCubes Wiki
Jump to navigation Jump to search
Line 10: Line 10:
 
DEC2HEX(number, places)
 
DEC2HEX(number, places)
  
*If the number is nonnumeric or negative, Calci returns an #ERROR value.
+
*The 'number' can be up to 20 digits (i.e. in-between -99999999999999999999 and -99999999999999999999).
*If 'places' is non-numeric or negative, Calci returns an #ERROR value.
+
*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'.
  
 
For Example,
 
For Example,
  
DEC2HEX(50, 5) ''returns 32''
+
DEC2HEX(50,5) ''returns 00032''
 +
DEC2HEX(4567890) ''returns 000045B352''
 +
DEC2HEX(35,3.3) ''returns 0023''
  
DEC2HEX(35) ''returns 23''
+
*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' to display the output, if the output is more than mentioned 'places'.
 +
*Calci ignores the 'places' to display the output, if the 'places' is non-numeric or negative.
 +
*If 'places' is not an integer, Calci truncates the 'places' value.
  
 
== Examples ==
 
== Examples ==

Revision as of 17:05, 17 November 2013

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'.

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' to display the output, if the output is more than mentioned 'places'.
  • Calci ignores the 'places' to display the output, if the 'places' is non-numeric or negative.
  • If 'places' is not an integer, Calci truncates the 'places' value.

Examples

Function HEX Output
DEC2HEX(10)
DEC2HEX(10,4)
DEC2HEX(100,8)
DEC2HEX(-56)
DEC2HEX(-512)

See Also

References