object
number
Number data type predicates.
logtalk_load(types(loader))
static, context_switching_calls
public
atomicPublic predicates
approximately_equal/2
Compares two numbers for approximate equality given the epsilon
arithmetic constant value using the de facto standard formula abs(Number1 - Number2) =< max(abs(Number1), abs(Number2)) * epsilon
. No type-checking.
static
approximately_equal(Number1,Number2)
approximately_equal(+number,+number)
- zero_or_one
approximately_equal/3
Compares two numbers for approximate equality given a user-defined epsilon value using the de facto standard formula abs(Number1 - Number2) =< max(abs(Number1), abs(Number2)) * Epsilon
. No type-checking.
static
approximately_equal(Number1,Number2,Epsilon)
approximately_equal(+number,+number,+number)
- zero_or_one
Epsilon range: Epsilon should be the
epsilon
arithmetic constant value or a small multiple of it. Only use a larger value if a greater error is expected.Comparison with essential equality: For the same epsilon value, approximate equality is weaker requirement than essential equality.
essentially_equal/3
Compares two numbers for essential equality given an epsilon value using the de facto standard formula abs(Number1 - Number2) =< min(abs(Number1), abs(Number2)) * Epsilon. No type-checking.
static
essentially_equal(Number1,Number2,Epsilon)
essentially_equal(+number,+number,+number)
- zero_or_one
Comparison with approximate equality: For the same epsilon value, essential equality is a stronger requirement than approximate equality.
tolerance_equal/4
Compares two numbers for close equality given relative and absolute tolerances using the de facto standard formula abs(Number1 - Number2) =< max(RelativeTolerance * max(abs(Number1), abs(Number2)), AbsoluteTolerance). No type-checking.
static
tolerance_equal(Number1,Number2,RelativeTolerance,AbsoluteTolerance)
tolerance_equal(+number,+number,+number,+number)
- zero_or_one
=~= / 2
Compares two floats (or lists of floats) for approximate equality using 100*epsilon for the absolute error and, if that fails, 99.999% accuracy for the relative error. Note that these precision values may not be adequate for all cases. No type-checking.
static
=~=(Float1,Float2)
=~=(+number,+number)
- zero_or_one
=~=(+list(number),+list(number))
- zero_or_one
Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
op(700,xfx,=~=)
public