Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal Class Reference
Inheritance diagram for PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal:
PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertBase

Static Public Member Functions

static hex32bit (float $value, string $hexstr, bool $force=false)
 
static toBinary ($value, $places=null)
 
static toHex ($value, $places=null)
 toHex.
 
static toOctal ($value, $places=null)
 toOctal.
 

Public Attributes

const LARGEST_BINARY_IN_DECIMAL = 511
 
const LARGEST_HEX_IN_DECIMAL = 549755813887
 
const LARGEST_OCTAL_IN_DECIMAL = 536870911
 
const SMALLEST_BINARY_IN_DECIMAL = -512
 
const SMALLEST_HEX_IN_DECIMAL = -549755813888
 
const SMALLEST_OCTAL_IN_DECIMAL = -536870912
 

Static Protected Member Functions

static nbrConversionFormat (string $value, ?int $places)
 
static validateDecimal (string $value)
 
static validatePlaces (mixed $places=null)
 
static validateValue (mixed $value)
 

Member Function Documentation

◆ toHex()

static PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal::toHex ( $value,
$places = null )
static

toHex.

Return a decimal value as hex.

Excel Function: DEC2HEX(x[,places])

Parameters
array | bool | float | int | string$valueThe 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. Or can be an array of values
null | array | float | int | string$placesThe 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. Or can be an array of values
Return values
array|stringResult, or an error If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

◆ toOctal()

static PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertDecimal::toOctal ( $value,
$places = null )
static

toOctal.

Return an decimal value as octal.

Excel Function: DEC2OCT(x[,places])

Parameters
array | bool | float | int | string$valueThe 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. Or can be an array of values
array | int$placesThe 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. Or can be an array of values
Return values
array|stringResult, or an error If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions

The documentation for this class was generated from the following file: