Difference between revisions of "Manuals/calci/DEC2BIN"

From ZCubes Wiki
Jump to navigation Jump to search
Line 16: Line 16:
  
 
*The 'number' should be in the range -512 to 511.
 
*The 'number' should be in the range -512 to 511.
 +
 +
*'padding' argument is used to return the output with leading zeros. If 'padding' argument is not used, 'Calci' uses the minimum number of characters required to display the binary output.
  
 
*DEC2BIN returns the NAN(error) value, whenever the 'padding' is nonnumeric, zero or negative.
 
*DEC2BIN returns the NAN(error) value, whenever the 'padding' is nonnumeric, zero or negative.
 +
 +
*If 'padding' contains decimal value, Calci truncates the decimal point and uses the integer value as input.
  
 
Lets see an example,
 
Lets see an example,

Revision as of 07:59, 14 November 2013

DEC2BIN(number, padding)

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


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


Description

DEC2BIN(number, padding)

  • DEC2BIN returns the NAN(error) value, when the 'number' is negative or nonnumeric.
  • The 'number' should be in the range -512 to 511.
  • 'padding' argument is used to return the output with leading zeros. If 'padding' argument is not used, 'Calci' uses the minimum number of characters required to display the binary output.
  • DEC2BIN returns the NAN(error) value, whenever the 'padding' is nonnumeric, zero or negative.
  • If 'padding' contains decimal value, Calci truncates the decimal point and uses the integer value as input.

Lets see an example,

DEC2BIN(10, 5) is 1010

DEC2BIN(100) is 100100

Examples

Decimal Input Binary Output
10 1010
100 1100100