What do the Prolog implementations mean under "float"?

I was looking at the description of the SICStus syntax, and there is a definition of "float". However, there is no indication that the implementation of "float" is actually. single or double precision IEEE ? Maybe even BigDecimal?

In the SWI Prolog (or at least SWISH ), the "float" seems to be IEEE double precision, which can be determined by

planck_float(P) :-
   planck_float_descent(1.0,P).

planck_float_descent(X,P) :-
   Xhalf is X / 2.0, Xtest is 1.0 + Xhalf, Xtest =\= 1.0, !,
   write(Xhalf),writeln(Xtest),
   planck_float_descent(Xhalf,P).
planck_float_descent(P,P) :-
   Xhalf is P / 2.0, Xtest is 1.0 + Xhalf, Xtest == 1.0,
   writeln(P).

?- planck_float(P).
P = 2.220446049250313e-16

2.22e-16, which is the last value added to 1.0, still gives something more than what 1.0sounds correct for IEEE 64-bit floating point arithmetic.

What implementation do other Prologs do?

+4
1

SICStus 4.3.1 :

- , C double [4.9e-324, 1.8e+308] ( ). , . 64 IEEE 754.

ISO . , " IEEE 754" , , . , .

ISO Prolog , Prolog ( "" IEEE). , NaN, + ∞ .. , ISO Prolog. 5.5 . , , , .

5.5.10

(9) . .

. - , , , (,/2, 8.6.1), (5.1 e).

: , . , . @jschimpf , . , IEEE- ( ), NaN . . (, 2009 Cor.2: 2012.)

ISO Prolog (. / 13211-1:1995 7.1.3 ), , , (radix). 1980- (, C-Prolog) , IEEE. 32 ​​ Prolog, float ( ), , , , C. , . ISO Prolog 6 . , , - , IEEE.

ISO Prolog ISO LIA ( " " ) ISO/IEC 10967-1:1995, ISO/IEC 10967-1: 2012, ISO/IEC/IEEE 60559: 2011, IEEE 754-2008.

, IEEE LIA : IEEE - , LIA , .

, Prolog,

X is 0** -1, write_canonical(X).

evaluation_error(undefined). (IF, SICStus, Prolog IV), , .

0, (+inf), Infinity.0, inf.0, 0.Inf, inf, inf

SWI, YAP, Minerva, XSB, Ciao, B, GNU

Prolog ( .), , Prolog.

+6

Source: https://habr.com/ru/post/1568961/


All Articles