]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libffi/testsuite/libffi.call/float2.c
2 Purpose: Check return value long double.
5 Originator: From the original ffitest.c */
13 static long double ldblit(float f
)
15 return (long double) (((long double) f
)/ (long double) 3.0);
21 ffi_type
*args
[MAX_ARGS
];
22 void *values
[MAX_ARGS
];
27 args
[0] = &ffi_type_float
;
30 /* Initialize the cif */
31 CHECK(ffi_prep_cif(&cif
, FFI_DEFAULT_ABI
, 1,
32 &ffi_type_longdouble
, args
) == FFI_OK
);
36 #if defined(__sun) && defined(__GNUC__)
37 /* long double support under SunOS/gcc is pretty much non-existent.
38 You'll get the odd bus error in library routines like printf() */
40 printf ("%Lf\n", ldblit(f
));
44 ffi_call(&cif
, FFI_FN(ldblit
), &ld
, values
);
46 #if defined(__sun) && defined(__GNUC__)
47 /* long double support under SunOS/gcc is pretty much non-existent.
48 You'll get the odd bus error in library routines like printf() */
50 printf ("%Lf, %Lf, %Lf, %Lf\n", ld
, ldblit(f
), ld
- ldblit(f
), LDBL_EPSILON
);
53 /* These are not always the same!! Check for a reasonable delta */
55 if (((ld
> original
) ? (ld
- original
) : (original
- ld
)) < LDBL_EPSILON
)
56 puts("long double return value tests ok!");