Bug #1712: Complex#% Raises NoMethodError for #floor
http://redmine.ruby-lang.org/issues/show/1712
Author: Run Paint Run Run
Status: Open, Priority: Normal
Category: core
ruby -v: ruby 1.9.2dev (2009-07-01 trunk 23924) [i686-linux]
1.8's Complex had a modulus operator (%); 1.9's doesn't, and attempts to
use it raise a NoMethodError for #floor because it falls back to
Numeric#% which needs #floor. Is this omission intentional? If so, could
an appropriate NoMethodError be raised instead? If not, I'd appreciate
knowing so I can write the specifications.
>> Complex(13, 44) % Complex(5, 20)
NoMethodError: undefined method `floor' for
((189/85)-(8/85)*i):Complex
from (irb):3:in `div'
from (irb):3:in `%'
from (irb):3
from /usr/local/bin/irb:12:in `<main>'
on 2009-07-02 00:07
on 2009-07-03 09:12
Hi,
In message "Re: [ruby-core:24110] [Bug #1712] Complex#% Raises
NoMethodError for #floor"
on Thu, 2 Jul 2009 07:06:32 +0900, Run Paint Run Run
<redmine@ruby-lang.org> writes:
|1.8's Complex had a modulus operator (%); 1.9's doesn't, and attempts to use it raise a NoMethodError for #floor because it falls back to Numeric#% which needs #floor. Is this omission intentional? If so, could an appropriate NoMethodError be raised instead? If not, I'd appreciate knowing so I can write the specifications.
I don't think there's natural definition of modulo on complex numbers,
so that we should undefine % method. We might need to do something
for compatibility's sake. Opinion?
matz.
on 2009-07-03 12:57
Issue #1712 has been updated by tadayoshi funaba. Status changed from Open to Closed % Done changed from 0 to 100 Applied in changeset r23946. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1712
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.