diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-06 22:01:01 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-07 22:08:33 -0400 |
commit | d67dac15a1bac6947d501164aa494adf160ff668 (patch) | |
tree | c1bce5828d6d384eff8ba48d286029cf588cf357 /numeric.c | |
parent | 4842dad7c256d1564348893cff3bfed08dadcbe4 (diff) | |
download | perl-d67dac15a1bac6947d501164aa494adf160ff668.tar.gz |
modfl emulation via truncl (C99) and copysignl.
(We've had emulation for broken modfl before,
but it used aintl, which is not that common.)
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1347,13 +1347,23 @@ Perl_isinfnan(NV nv) return FALSE; } -#if ! defined(HAS_MODFL) && defined(HAS_AINTL) && defined(HAS_COPYSIGNL) +#ifndef HAS_MODFL +/* C99 has truncl, pre-C99 Solaris had aintl */ +# if defined(HAS_TRUNCL) && defined(HAS_COPYSIGNL) +long double +Perl_my_modfl(long double x, long double *ip) +{ + *ip = truncl(x); + return (x == *ip ? copysignl(0.0L, x) : x - *ip); +} +# elif defined(HAS_AINTL) && defined(HAS_COPYSIGNL) long double Perl_my_modfl(long double x, long double *ip) { *ip = aintl(x); return (x == *ip ? copysignl(0.0L, x) : x - *ip); } +# endif #endif #if ! defined(HAS_FREXPL) && defined(HAS_ILOGBL) && defined(HAS_SCALBNL) |