\PhpOffice\PhpSpreadsheet\Calculation\EngineeringConvertDecimal

Summary

Methods
Properties
Constants
toBinary()
toHex()
toOctal()
No public properties found
No constants found
validateValue()
validatePlaces()
nbrConversionFormat()
validateDecimal()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

toBinary()

toBinary(string  $value, int  $places = null) : string

toBinary.

Return a decimal value as binary.

Excel Function: DEC2BIN(x[,places])

Parameters

string $value

The decimal integer you want to convert. If number is negative, valid place values are ignored and DEC2BIN returns a 10-character (10-bit) binary number in which the most significant bit is the sign bit. The remaining 9 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number < -512 or if number > 511, DEC2BIN returns the #NUM! error value. If number is nonnumeric, DEC2BIN returns the #VALUE! error value. If DEC2BIN requires more than places characters, it returns the #NUM! error value.

int $places

The number of characters to use. If places is omitted, DEC2BIN uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros). If places is not an integer, it is truncated. If places is nonnumeric, DEC2BIN returns the #VALUE! error value. If places is zero or negative, DEC2BIN returns the #NUM! error value.

Returns

string —

toHex()

toHex(string  $value, int  $places = null) : string

toHex.

Return a decimal value as hex.

Excel Function: DEC2HEX(x[,places])

Parameters

string $value

The decimal integer you want to convert. If number is negative, places is ignored and DEC2HEX returns a 10-character (40-bit) hexadecimal number in which the most significant bit is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number < -549,755,813,888 or if number > 549,755,813,887, DEC2HEX returns the #NUM! error value. If number is nonnumeric, DEC2HEX returns the #VALUE! error value. If DEC2HEX requires more than places characters, it returns the #NUM! error value.

int $places

The number of characters to use. If places is omitted, DEC2HEX uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros). If places is not an integer, it is truncated. If places is nonnumeric, DEC2HEX returns the #VALUE! error value. If places is zero or negative, DEC2HEX returns the #NUM! error value.

Returns

string —

toOctal()

toOctal(string  $value, int  $places = null) : string

toOctal.

Return an decimal value as octal.

Excel Function: DEC2OCT(x[,places])

Parameters

string $value

The decimal integer you want to convert. If number is negative, places is ignored and DEC2OCT returns a 10-character (30-bit) octal number in which the most significant bit is the sign bit. The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation. If number < -536,870,912 or if number > 536,870,911, DEC2OCT returns the #NUM! error value. If number is nonnumeric, DEC2OCT returns the #VALUE! error value. If DEC2OCT requires more than places characters, it returns the #NUM! error value.

int $places

The number of characters to use. If places is omitted, DEC2OCT uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros). If places is not an integer, it is truncated. If places is nonnumeric, DEC2OCT returns the #VALUE! error value. If places is zero or negative, DEC2OCT returns the #NUM! error value.

Returns

string —

validateValue()

validateValue(mixed  $value, bool  $gnumericCheck = false) : string

Parameters

mixed $value
bool $gnumericCheck

Returns

string —

validatePlaces()

validatePlaces(mixed  $places = null) : ?int

Parameters

mixed $places

Returns

?int —

nbrConversionFormat()

nbrConversionFormat(string  $value, ?int  $places) : string

Formats a number base string value with leading zeroes.

Parameters

string $value

The "number" to pad

?int $places

The length that we want to pad this value

Returns

string —

The padded "number"

validateDecimal()

validateDecimal(string  $value) : string

Parameters

string $value

Returns

string —