object

# `number`

Number data type predicates.

Author: Paulo Moura
Version: 1:9:0
Date: 2020-12-18
Compilation flags:
`static, context_switching_calls`
Extends:
`public` atomic
Remarks:
(none)
Inherited public predicates:
check/1 depth/2 ground/1 new/1 numbervars/1 numbervars/3 occurs/2 singletons/2 subsumes/2 subterm/2 valid/1 variables/2 variant/2 varnumbers/2 varnumbers/3

- Public predicates

  - `approximately_equal/3`

  - `essentially_equal/3`

  - `tolerance_equal/4`

  - `=~= / 2`

- Protected predicates

- Private predicates

- Operators

  - `op(700,xfx,=~=)`

## Public predicates

### `approximately_equal/3`

Compares two numbers for approximate equality given an epsilon value using the de facto standard formula abs(Number1 - Number2) =< max(abs(Number1), abs(Number2)) * Epsilon. No type-checking.

Compilation flags:
`static`
Template:
`approximately_equal(Number1,Number2,Epsilon)`
Mode and number of proofs:
`approximately_equal(+number,+number,+number)` - `zero_or_one`

### `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.

Compilation flags:
`static`
Template:
`essentially_equal(Number1,Number2,Epsilon)`
Mode and number of proofs:
`essentially_equal(+number,+number,+number)` - `zero_or_one`

### `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.

Compilation flags:
`static`
Template:
`tolerance_equal(Number1,Number2,RelativeTolerance,AbsoluteTolerance)`
Mode and number of proofs:
`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.

Compilation flags:
`static`
Template:
`=~=(Float1,Float2)`
Mode and number of proofs:
`=~=(+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,=~=)`

Scope:
`public`