ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:99426] [Ruby master Bug#17098] Float#negative? reports negative zero as not negative
@ 2020-08-01  1:05 chris
  2020-08-01  2:18 ` [ruby-core:99427] " merch-redmine
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: chris @ 2020-08-01  1:05 UTC (permalink / raw)
  To: ruby-core

Issue #17098 has been reported by chrisseaton (Chris Seaton).

----------------------------------------
Bug #17098: Float#negative? reports negative zero as not negative
https://bugs.ruby-lang.org/issues/17098

* 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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-06-17  5:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  1:05 [ruby-core:99426] [Ruby master Bug#17098] Float#negative? reports negative zero as not negative 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 ` [ruby-core:99441] " chris
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
2021-06-15  4:58 ` [ruby-core:104267] " muraken
2021-06-15  5:05 ` [ruby-core:104268] " muraken
2021-06-17  5:47 ` [ruby-core:104332] " matz

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).