Prolog: [-float] C: double f(...) { double x; return x; } Pascal: function f(...): real; var x: real; begin f := x; end FORTRAN: real function f(...) real x f = x end

No argument is passed to the foreign function. The return value from the function is assumed to be a single-precision (FORTRAN) or double-precision (C and Pascal) floating point number. It is converted to a Prolog float and unified with the corresponding argument of the Prolog call. The argument can be of any type; if it cannot be unified with the returned float, the call fails.

Many C compilers will allow the function return value to be `float`

instead of `double`

because they always convert single-precision
floating-point arguments to double-precision. However, C compilers
conforming to the new ANSI standard will not do this, so it is recommended
that `double`

be used.

Prolog: [-single] ANSI C: float f(...) { float x; return x; } Pascal: function f(...): real; var x: real; begin f := x; end FORTRAN: real function f(...) real x f = x end

No argument is passed to the foreign function. The return value from the function is assumed to be a single-precision (FORTRAN) or double-precision (C and Pascal) floating point number. It is converted to a Prolog float and unified with the corresponding argument of the Prolog call. The argument can be of any type; if it cannot be unified with the returned float, the call fails.

Prolog: [-double] C: double f(...) { double x; return x; } Pascal: function f(...): real; var x: real; begin f := x; end FORTRAN: real function f(...) real x f = x end

No argument is passed to the foreign function. The return value from the function is assumed to be a single-precision (FORTRAN) or double-precision (C and Pascal) floating point number. It is converted to a Prolog float and unified with the corresponding argument of the Prolog call. The argument can be of any type; if it cannot be unified with the returned float, the call fails.