From: Nicholas Clark Date: Wed, 12 Sep 2007 18:38:54 +0000 (+0000) Subject: Don't call frexp() on +Inf or -Inf either. (It's not just NaN it might X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3952c29af3f3c84465fe5840218071974ce033e4;p=p5sagit%2Fp5-mst-13.2.git Don't call frexp() on +Inf or -Inf either. (It's not just NaN it might choke on.) p4raw-id: //depot/perl@31856 --- diff --git a/sv.c b/sv.c index 1933945..106a580 100644 --- a/sv.c +++ b/sv.c @@ -9194,12 +9194,9 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV : SvNV(argsv); need = 0; -#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) - if (c != 'e' && c != 'E' && !Perl_isnan(nv)) -#else - if (c != 'e' && c != 'E' && nv == nv) -#endif - { + /* 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) { i = PERL_INT_MIN; /* FIXME: if HAS_LONG_DOUBLE but not USE_LONG_DOUBLE this will cast our (long double) to (double) */