From: chris@chrisseaton.com To: ruby-core@ruby-lang.org Subject: [ruby-core:99441] [Ruby master Bug#17098] Float#negative? reports negative zero as not negative Date: Sat, 01 Aug 2020 16:00:52 +0000 (UTC) Message-ID: <redmine.journal-86896.20200801160052.8671@ruby-lang.org> (raw) In-Reply-To: <redmine.issue-17098.20200801010523.8671@ruby-lang.org> Issue #17098 has been updated by chrisseaton (Chris Seaton). If people aren't keen on changing `Float#negative?` since it has existing semantics, then another option could be to add a new predicate `Float#negative_zero?` - that would allow people to differentiate as needed. ---------------------------------------- Bug #17098: Float#negative? reports negative zero as not negative https://bugs.ruby-lang.org/issues/17098#change-86896 * Author: chrisseaton (Chris Seaton) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Is this intended behaviour? ``` irb(main):001:0> neg_zero = -0.0 => -0.0 irb(main):002:0> neg_zero.negative? => false irb(main):003:0> neg_zero < 0 => false ``` It happens because `Numeric#negative?` uses `< 0`. My understanding of IEEE floating point is that negative zero is not less than zero, but I think it should still report as negative. -- https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2020-08-01 16:00 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-01 1:05 [ruby-core:99426] " chris 2020-08-01 2:18 ` [ruby-core:99427] " merch-redmine 2020-08-01 12:18 ` [ruby-core:99432] " chris 2020-08-01 12:38 ` [ruby-core:99433] " sawadatsuyoshi 2020-08-01 12:50 ` [ruby-core:99434] " chris 2020-08-01 16:00 ` chris [this message] 2020-08-01 18:02 ` [ruby-core:99442] " eregontp 2020-08-01 19:41 ` [ruby-core:99443] " marcandre-ruby-core 2020-08-02 12:21 ` [ruby-core:99444] " sawadatsuyoshi
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.journal-86896.20200801160052.8671@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
ruby-core@ruby-lang.org archive (unofficial mirror) This inbox may be cloned and mirrored by anyone: git clone --mirror https://public-inbox.org/ruby-core # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V1 ruby-core ruby-core/ https://public-inbox.org/ruby-core \ ruby-core@ruby-lang.org public-inbox-index ruby-core Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.lang.ruby.core nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.core nntp://news.gmane.io/gmane.comp.lang.ruby.core note: .onion URLs require Tor: https://www.torproject.org/ code repositories for the project(s) associated with this inbox: https://80x24.org/mirrors/ruby.git AGPL code for this site: git clone https://public-inbox.org/public-inbox.git