This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fdim NaN guard.
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 15 Nov 2014 00:42:21 +0000 (19:42 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 15 Nov 2014 01:07:22 +0000 (20:07 -0500)
ext/POSIX/POSIX.xs

index 923b3d3..a9c729a 100644 (file)
@@ -643,7 +643,7 @@ static NV my_expm1(NV x)
 #ifndef c99_fdim
 static NV my_fdim(NV x, NV y)
 {
-  return x > y ? x - y : 0;
+  return (Perl_isnan(x) || Perl_isnan(y)) ? NV_NAN : (x > y ? x - y : 0);
 }
 #  define c99_fdim my_fdim
 #endif