2 Purpose: Check return value float.
5 Originator: From the original ffitest.c */
11 static int floating(int a, float b, double c, long double d)
15 i = (int) ((float)a/b + ((float)c/(float)d));
23 ffi_type *args[MAX_ARGS];
24 void *values[MAX_ARGS];
32 args[0] = &ffi_type_sint;
34 args[1] = &ffi_type_float;
36 args[2] = &ffi_type_double;
38 args[3] = &ffi_type_longdouble;
41 /* Initialize the cif */
42 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
43 &ffi_type_sint, args) == FFI_OK);
47 d = (double)1.0/(double)3.0;
50 floating (si1, f, d, ld);
52 ffi_call(&cif, FFI_FN(floating), &rint, values);
54 printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld));
56 CHECK((int)rint == floating(si1, f, d, ld));