diff --git a/libs/libm/libm/lib_truncl.c b/libs/libm/libm/lib_truncl.c index 8dc245e3eea37..2c5511b4fbc12 100644 --- a/libs/libm/libm/lib_truncl.c +++ b/libs/libm/libm/lib_truncl.c @@ -44,9 +44,20 @@ ****************************************************************************/ #ifdef CONFIG_HAVE_LONG_DOUBLE +#if LDBL_MANT_DIG == DBL_MANT_DIG + +/* Cover case when double is the same as long double (64 bit ieee754). */ + +long double truncl(long double x) +{ + return trunc(x); +} + +#else + static const long double toint = 1 / LDBL_EPSILON; -/* FIXME This will only work if long double is 64 bit and little endian */ +/* FIXME This will only work if long double is 80 bit and little endian */ union ldshape { @@ -101,3 +112,4 @@ long double truncl(long double x) return s ? -x : x; } #endif +#endif