add ffi tests using f64
This commit is contained in:
committed by
Bennet Bleßmann
parent
f91aedcc2f
commit
9d8906da30
16
tests-pl/ffi_f64_minus_zero.pl
Normal file
16
tests-pl/ffi_f64_minus_zero.pl
Normal file
@@ -0,0 +1,16 @@
|
||||
:- use_module(library(os)).
|
||||
:- use_module(library(ffi)).
|
||||
|
||||
test :-
|
||||
getenv("ffi_f64_minus_zero_LIB", LIB),
|
||||
use_foreign_module(LIB, ['ffi_f64_minus_zero'([], f64), 'signum'([f64], f64)]),
|
||||
ffi:'ffi_f64_minus_zero'(N),
|
||||
A is max(0.0, N),
|
||||
B is max(N, 0.0),
|
||||
ffi:'signum'(A, SA),
|
||||
ffi:'signum'(B, SB),
|
||||
write((SA, SB)),
|
||||
-1.0 is SA, % incorrect, based on https://www.swi-prolog.org/pldoc/man?function=max/2 -0.0 is less than 0.0 so A and B should be 0.0 for which signum should be 1
|
||||
1.0 is SB.
|
||||
|
||||
:- initialization(test).
|
||||
Reference in New Issue
Block a user