DoubleComparator
extends NumericComparator
in package
Compares doubles for equality.
since v3.0.5 and v4.0.8
Table of Contents
Constants
- EPSILON = 1.0E-10
- Smallest value available in PHP.
Properties
Methods
- __construct() : mixed
- accepts() : bool
- Returns whether the comparator can compare two values.
- assertEquals() : mixed
- Asserts that two values are equal.
- setFactory() : mixed
- isInfinite() : bool
- isNan() : bool
Constants
EPSILON
Smallest value available in PHP.
public
float
EPSILON
= 1.0E-10
Properties
$exporter
protected
Exporter
$exporter
$factory
protected
Factory
$factory
Methods
__construct()
public
__construct() : mixed
accepts()
Returns whether the comparator can compare two values.
public
accepts(mixed $expected, mixed $actual) : bool
Parameters
- $expected : mixed
-
The first value to compare
- $actual : mixed
-
The second value to compare
Return values
boolassertEquals()
Asserts that two values are equal.
public
assertEquals(mixed $expected, mixed $actual[, float $delta = 0.0 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
- $expected : mixed
-
First value to compare
- $actual : mixed
-
Second value to compare
- $delta : float = 0.0
-
Allowed numerical distance between two values to consider them equal
- $canonicalize : bool = false
-
Arrays are sorted before comparison when set to true
- $ignoreCase : bool = false
-
Case is ignored when set to true
Tags
setFactory()
public
setFactory(Factory $factory) : mixed
Parameters
- $factory : Factory
isInfinite()
private
isInfinite(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolisNan()
private
isNan(mixed $value) : bool
Parameters
- $value : mixed