summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/complex.c b/complex.c
index 49ce51f905..180e7d23c9 100644
--- a/complex.c
+++ b/complex.c
@@ -894,8 +894,10 @@ f_signbit(VALUE x)
#else
{
char s[2];
+ double f = RFLOAT_VALUE(x);
- (void)snprintf(s, sizeof s, "%.0f", RFLOAT_VALUE(x));
+ if (isnan(f)) return Qfalse;
+ (void)snprintf(s, sizeof s, "%.0f", f);
return f_boolcast(s[0] == '-');
}
#endif