## Doc needs help

The regular expression `[+-]?\sd+[.]\sd+Inf`

just can't be correct.

It should probably be (Perl regex; it is always good to specify which regex is being used as we of the IT guild have an embarrassment of riches in this domain):

[+-]?\d+\.\d+Inf

...no mandatory spaces `\s`

, in fact spaces aren't even allowed.

In particular, `-Inf`

is just a `-`

with a variable:

?- write(-Inf). -_1630 true.

## Infinity is a signed float

Good!

?- A is -1.0Inf, float(A), A < 0. A = -1.0Inf. ?- A is +1.0Inf, float(A), A > 0. A = 1.0Inf.

## Edge cases

An interesting edge case:

?- write(-0.0Inf). -1.0Inf true.

That doesn't look quite correct.

## NaN is a float and also a number, but is not on the real line

Note that NaN is a float:

?- X is nan, float(X). X = 1.5NaN.

and a number:

?- X is nan, number(X). X = 1.5NaN.

But it incomparable, i.e. not anywhere on the (IEEE 754) real line:

?- X is nan, float(X), \+ (X < 0), \+ (X > 0), \+ (X =:= 0). X = 1.5NaN.

## Arithmetic comparison between NaN also fails, but unification succeeds

?- X is nan, Y is nan, X = Y. X = Y, Y = 1.5NaN.

?- X is nan, Y is nan, X =:= Y. false.

## What about "negative zero"

https://en.wikipedia.org/wiki/Signed_zero

Seems to exist. 0.0 is the same as +0.0, but -0.0 is slightly different.

Arithemtical equality:

?- X1 is +0.0, X2 is -0.0, float(X1), float(X2), X1 =:= 0, X2 =:= 0, X1 =:= X2. X1 = 0.0, X2 = -0.0.

They don't unify:

?- X1 is +0.0, X2 is -0.0, X1 = X2. false.

They aren't equal either:

?- X1 is +0.0, X2 is -0.0, X1 == X2. false.

0.0 and +0.0 are exactly the same:

?- X1 is +0.0, X3 is 0.0, X1=X3, X1==X3, X1=:=X3. X1 = X3, X3 = 0.0.

## Some printing

?- X is -0.0, format("~f~n",[X]). -0.000000 X = -0.0. ?- X is +0.0, format("~f~n",[X]). 0.000000 X = 0.0. ?- X is nan, format("~f~n",[X]). nan X = 1.5NaN. ?- X is +1.0Inf, format("~f~n",[X]). inf X = 1.0Inf. ?- X is -1.0Inf, format("~f~n",[X]). -inf X = -1.0Inf.