summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-03-24 09:52:15 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-03-24 09:52:15 +0900
commitdc5d74dda8432bcc1e9dfce73c722f6259aeb08a (patch)
tree83c686ee149b49197ece98da5d45c3201834c2e3
parent6e1a13360fd356469b2531f944f541cd64d66f05 (diff)
downloadmruby-dc5d74dda8432bcc1e9dfce73c722f6259aeb08a.tar.gz
mruby-dc5d74dda8432bcc1e9dfce73c722f6259aeb08a.zip
rational.rb: avoid 'NaNi` representation.
Use `NaN*i` as CRuby does.
-rw-r--r--mrbgems/mruby-complex/mrblib/complex.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-complex/mrblib/complex.rb b/mrbgems/mruby-complex/mrblib/complex.rb
index 1484ff394..6372d36f6 100644
--- a/mrbgems/mruby-complex/mrblib/complex.rb
+++ b/mrbgems/mruby-complex/mrblib/complex.rb
@@ -8,7 +8,7 @@ class Complex < Numeric
end
def to_s
- "#{real}#{'+' unless imaginary < 0}#{imaginary}i"
+ "#{real}#{'+' unless imaginary < 0}#{imaginary}#{'*' unless imaginary.finite?}i"
end
def +@