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
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ 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] 9+ messages in thread

end of thread, other threads:[~2020-08-02 12:21 UTC | newest]

Thread overview: 9+ 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

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