# ifdef I_SUNMATH
# include <sunmath.h>
# endif
-# if defined(USE_QUADMATH) && defined(I_QUADMATH)
-# include <quadmath.h>
-# endif
-# ifdef FLT128_DIG
-# define NV_DIG FLT128_DIG
-# define NV_MANT_DIG FLT128_MANT_DIG
-# define NV_MIN FLT128_MIN
-# define NV_MAX FLT128_MAX
-# define NV_MIN_EXP FLT128_MIN_EXP
-# define NV_MAX_EXP FLT128_MAX_EXP
-# define NV_EPSILON FLT128_EPSILON
-# define NV_MIN_10_EXP FLT128_MIN_10_EXP
-# define NV_MAX_10_EXP FLT128_MAX_10_EXP
-# define NV_INF HUGE_VALQ
-# define NV_NAN nanq("0")
-# elif defined(LDBL_DIG)
+# if defined(LDBL_DIG)
# define NV_DIG LDBL_DIG
# ifdef LDBL_MANT_DIG
# define NV_MANT_DIG LDBL_MANT_DIG
# endif
# endif
# endif
-# if defined(USE_QUADMATH) && defined(I_QUADMATH)
-# define Perl_acos acosq
-# define Perl_asin asinq
-# define Perl_atan atanq
-# define Perl_atan2 atan2q
-# define Perl_ceil ceilq
-# define Perl_cos cosq
-# define Perl_cosh coshq
-# define Perl_exp expq
-/* no Perl_fabs, but there's PERL_ABS */
-# define Perl_floor floorq
-# define Perl_fmod fmodq
-# define Perl_log logq
-# define Perl_log10 log10q
-# define Perl_pow powq
-# define Perl_sin sinq
-# define Perl_sinh sinhq
-# define Perl_sqrt sqrtq
-# define Perl_tan tanq
-# define Perl_tanh tanhq
-# define Perl_modf(x,y) modfq(x,y)
-# define Perl_frexp(x,y) frexpq(x,y)
-# define Perl_ldexp(x, y) ldexpq(x,y)
-# define Perl_isinf(x) isinfq(x)
-# define Perl_isnan(x) isnanq(x)
-# define Perl_isfinite(x) !(isnanq(x) || isinfq(x))
-# elif defined(HAS_SQRTL)
+# if defined(HAS_SQRTL)
# define Perl_acos acosl
# define Perl_asin asinl
# define Perl_atan atanl
# ifndef Perl_isfinite
# define Perl_isfinite(x) Perl_isfinitel(x)
# endif
+#elif defined(USE_QUADMATH) && defined(I_QUADMATH)
+# include <quadmath.h>
+# define NV_DIG FLT128_DIG
+# define NV_MANT_DIG FLT128_MANT_DIG
+# define NV_MIN FLT128_MIN
+# define NV_MAX FLT128_MAX
+# define NV_MIN_EXP FLT128_MIN_EXP
+# define NV_MAX_EXP FLT128_MAX_EXP
+# define NV_EPSILON FLT128_EPSILON
+# define NV_MIN_10_EXP FLT128_MIN_10_EXP
+# define NV_MAX_10_EXP FLT128_MAX_10_EXP
+# define NV_INF HUGE_VALQ
+# define NV_NAN nanq("0")
+# define Perl_acos acosq
+# define Perl_asin asinq
+# define Perl_atan atanq
+# define Perl_atan2 atan2q
+# define Perl_ceil ceilq
+# define Perl_cos cosq
+# define Perl_cosh coshq
+# define Perl_exp expq
+/* no Perl_fabs, but there's PERL_ABS */
+# define Perl_floor floorq
+# define Perl_fmod fmodq
+# define Perl_log logq
+# define Perl_log10 log10q
+# define Perl_pow powq
+# define Perl_sin sinq
+# define Perl_sinh sinhq
+# define Perl_sqrt sqrtq
+# define Perl_tan tanq
+# define Perl_tanh tanhq
+# define Perl_modf(x,y) modfq(x,y)
+# define Perl_frexp(x,y) frexpq(x,y)
+# define Perl_ldexp(x, y) ldexpq(x,y)
+# define Perl_isinf(x) isinfq(x)
+# define Perl_isnan(x) isnanq(x)
+# define Perl_isfinite(x) !(isnanq(x) || isinfq(x))
#else
# define NV_DIG DBL_DIG
# ifdef DBL_MANT_DIG
return;
}
-#ifndef USE_LONG_DOUBLE
+#if !defined(USE_LONG_DOUBLE) && !defined(USE_QUADMATH)
/* special-case "%.<number>[gf]" */
if ( !args && patlen <= 5 && pat[0] == '%' && pat[1] == '.'
&& (pat[patlen-1] == 'g' || pat[patlen-1] == 'f') ) {
*/
switch (intsize) {
case 'V':
-#if defined(USE_LONG_DOUBLE)
+#if defined(USE_LONG_DOUBLE) || defined(USE_QUADMATH)
intsize = 'q';
#endif
break;
case 'l':
/* FALLTHROUGH */
default:
-#if defined(USE_LONG_DOUBLE)
+#if defined(USE_LONG_DOUBLE) || defined(USE_QUADMATH)
intsize = args ? 0 : 'q';
#endif
break;
char *ptr = ebuf + sizeof ebuf;
*--ptr = '\0';
*--ptr = c;
+#if defined(USE_QUADMATH)
+ if (intsize == 'q') {
+ /* "g" -> "Qg" */
+ *--ptr = 'Q';
+ }
/* FIXME: what to do if HAS_LONG_DOUBLE but not PERL_PRIfldbl? */
-#if defined(HAS_LONG_DOUBLE) && defined(PERL_PRIfldbl)
+#elif defined(HAS_LONG_DOUBLE) && defined(PERL_PRIfldbl)
/* Note that this is HAS_LONG_DOUBLE and PERL_PRIfldbl,
* not USE_LONG_DOUBLE and NVff. In other words,
* this needs to work without USE_LONG_DOUBLE. */
/* Copy the one or more characters in a long double
* format before the 'base' ([efgEFG]) character to
* the format string. */
-#ifdef USE_QUADMATH
- *--ptr = 'Q';
-#else
static char const ldblf[] = PERL_PRIfldbl;
char const *p = ldblf + sizeof(ldblf) - 3;
while (p >= ldblf) { *--ptr = *p--; }
-#endif
}
#endif
if (has_precis) {