class Floats

Floats compare tools library.

Traits

Static class.

Constants

EPSILON

Methods

static bool
isZero(float $value)

No description

static bool
isInteger(float $value)

No description

static int
compare(float $a, float $b)

Compare two floats. If $a < $b it returns -1, if they are equal it returns 0 and if $a > $b it returns 1

static bool
areEqual(float $a, float $b)

Returns true if $a = $b

static bool
isLessThan(float $a, float $b)

Returns true if $a < $b

static bool
isLessThanOrEqualTo(float $a, float $b)

Returns true if $a <= $b

static bool
isGreaterThan(float $a, float $b)

Returns true if $a > $b

static bool
isGreaterThanOrEqualTo(float $a, float $b)

Returns true if $a >= $b

Details

at line 26
static bool isZero(float $value)

Parameters

float $value

Return Value

bool

at line 32
static bool isInteger(float $value)

Parameters

float $value

Return Value

bool

at line 42
static int compare(float $a, float $b)

Compare two floats. If $a < $b it returns -1, if they are equal it returns 0 and if $a > $b it returns 1

Parameters

float $a
float $b

Return Value

int

Exceptions

LogicException if one of parameters is NAN

at line 65
static bool areEqual(float $a, float $b)

Returns true if $a = $b

Parameters

float $a
float $b

Return Value

bool

Exceptions

LogicException if one or both parameters are NAN

at line 75
static bool isLessThan(float $a, float $b)

Returns true if $a < $b

Parameters

float $a
float $b

Return Value

bool

Exceptions

LogicException if one or both parameters are NAN

at line 85
static bool isLessThanOrEqualTo(float $a, float $b)

Returns true if $a <= $b

Parameters

float $a
float $b

Return Value

bool

Exceptions

LogicException if one or both parameters are NAN

at line 95
static bool isGreaterThan(float $a, float $b)

Returns true if $a > $b

Parameters

float $a
float $b

Return Value

bool

Exceptions

LogicException if one or both parameters are NAN

at line 105
static bool isGreaterThanOrEqualTo(float $a, float $b)

Returns true if $a >= $b

Parameters

float $a
float $b

Return Value

bool

Exceptions

LogicException if one or both parameters are NAN