Also kill obsolete/wrong comment: Perl_frexp is not casting its
argument to NV, and if USE_LONG_DOUBLE Perl_frexp is frexpl.
And if we do have long double and don't have frexpl, it is unclear
what should we do? (in this particular case, casting to double might
be the best possible thing to do anyway.)
: SvNV(argsv);
need = 0;
- /* nv * 0 will be NaN for NaN, +Inf and -Inf, and 0 for anything
- else. frexp() has some unspecified behaviour for those three */
- if (c != 'e' && c != 'E' && (nv * 0) == 0) {
+ /* frexp() has some unspecified behaviour for nan/inf,
+ * so let's avoid calling that. */
+ if (c != 'e' && c != 'E' && Perl_isfinite(nv)) {
i = PERL_INT_MIN;
- /* FIXME: if HAS_LONG_DOUBLE but not USE_LONG_DOUBLE this
- will cast our (long double) to (double) */
(void)Perl_frexp(nv, &i);
if (i == PERL_INT_MIN)
Perl_die(aTHX_ "panic: frexp");