From: Marc-Andre Lafortune <ruby-core@marc-andre.ca>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:38886] [Ruby 1.9 - Bug #5179][Open] Complex#rationalize and to_r with approximate zeros
Date: Wed, 10 Aug 2011 10:41:16 +0900 [thread overview]
Message-ID: <redmine.issue-5179.20110810104115@ruby-lang.org> (raw)
Issue #5179 has been reported by Marc-Andre Lafortune.
----------------------------------------
Bug #5179: Complex#rationalize and to_r with approximate zeros
http://redmine.ruby-lang.org/issues/5179
Author: Marc-Andre Lafortune
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: r32354
Currently, Complex#rationalize and Complex#to_r raise a RangeError if the imaginary part is nonzero *or is a Float*. Note that a BigDecimal(0) is accepted, though:
Complex(1, 0).to_r # => Rational(1,1)
Complex(1, BigDecimal("0.0")).to_r # => Rational(1,1)
Complex(1, 0.0).to_r # => RangeError
This is inconsistent. I recommend not raising an error for 0.0 (Float or BigDecimal). Any objection?
--
http://redmine.ruby-lang.org
next reply other threads:[~2011-08-10 1:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 1:41 Marc-Andre Lafortune [this message]
2011-08-10 10:20 ` [ruby-core:38891] [Ruby 1.9 - Bug #5179] Complex#rationalize and to_r with approximate zeros Kenta Murata
2020-01-17 1:18 ` [ruby-core:96919] [Ruby master Bug#5179] " merch-redmine
2020-01-17 3:00 ` [ruby-core:96920] " mame
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-5179.20110810104115@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).