* [ruby-core:43109] [ruby-trunk - Bug #6120][Open] Float and BigDecimal bug in remainder in corner cases
@ 2012-03-07 5:51 Marc-Andre Lafortune
2012-03-07 13:37 ` [ruby-core:43118] [ruby-trunk - Bug #6120] " Yui NARUSE
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Marc-Andre Lafortune @ 2012-03-07 5:51 UTC (permalink / raw
To: ruby-core
Issue #6120 has been reported by Marc-Andre Lafortune.
----------------------------------------
Bug #6120: Float and BigDecimal bug in remainder in corner cases
https://bugs.ruby-lang.org/issues/6120
Author: Marc-Andre Lafortune
Status: Open
Priority: Normal
Assignee: Marc-Andre Lafortune
Category: core
Target version: 2.0.0
ruby -v: r34927
Currently:
4.2.remainder(+Float::INFINITY) # => 4.2, ok
4.2.remainder(-Float::INFINITY) # => NaN, should be 4.2
# (same with all signs reversed)
Reasons the remainder should be 4.2 and not NaN:
1) foo.remainder(bar) == foo.remainder(-bar)
2) foo.remainder(bar) == foo when bar.abs > foo.abs
Similarly:
require 'bigdecimal'
bd = BigDecimal.new("4.2")
bd.remainder(BigDecimal.new("+Infinity")) # => NaN, should be bd
bd.remainder(BigDecimal.new("-Infinity")) # => NaN, should be bd
# (same with all signs reverse)
Reasons: same as float.
Finally:
bd = BigDecimal.new("4.2")
bd.modulo(BigDecimal.new("0")) # => ZeroDivisionError, probably ok?
bd.remainder(BigDecimal.new("0")) # => NaN, should be probably raise a ZeroDivisionError?
Like in #6044, this could be decided either way, as long as there is consistency. Anyone prefer NaN to raising a ZeroDivisionError?
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:43118] [ruby-trunk - Bug #6120] Float and BigDecimal bug in remainder in corner cases
2012-03-07 5:51 [ruby-core:43109] [ruby-trunk - Bug #6120][Open] Float and BigDecimal bug in remainder in corner cases Marc-Andre Lafortune
@ 2012-03-07 13:37 ` Yui NARUSE
2012-10-03 9:29 ` [ruby-core:47817] " fahmisetiawand (Fahmi Setiawan)
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yui NARUSE @ 2012-03-07 13:37 UTC (permalink / raw
To: ruby-core
Issue #6120 has been updated by Yui NARUSE.
Ruby's math should portably follow SuS. [ruby-core:28206]
You can fix it for Float/Math if it is obviously wrong and the right implementation is clear.
BigDecimal is little another world and it is up to mrkn.
----------------------------------------
Bug #6120: Float and BigDecimal bug in remainder in corner cases
https://bugs.ruby-lang.org/issues/6120
Author: Marc-Andre Lafortune
Status: Open
Priority: Normal
Assignee: Marc-Andre Lafortune
Category: core
Target version: 2.0.0
ruby -v: r34927
Currently:
4.2.remainder(+Float::INFINITY) # => 4.2, ok
4.2.remainder(-Float::INFINITY) # => NaN, should be 4.2
# (same with all signs reversed)
Reasons the remainder should be 4.2 and not NaN:
1) foo.remainder(bar) == foo.remainder(-bar)
2) foo.remainder(bar) == foo when bar.abs > foo.abs
Similarly:
require 'bigdecimal'
bd = BigDecimal.new("4.2")
bd.remainder(BigDecimal.new("+Infinity")) # => NaN, should be bd
bd.remainder(BigDecimal.new("-Infinity")) # => NaN, should be bd
# (same with all signs reverse)
Reasons: same as float.
Finally:
bd = BigDecimal.new("4.2")
bd.modulo(BigDecimal.new("0")) # => ZeroDivisionError, probably ok?
bd.remainder(BigDecimal.new("0")) # => NaN, should be probably raise a ZeroDivisionError?
Like in #6044, this could be decided either way, as long as there is consistency. Anyone prefer NaN to raising a ZeroDivisionError?
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:47817] [ruby-trunk - Bug #6120] Float and BigDecimal bug in remainder in corner cases
2012-03-07 5:51 [ruby-core:43109] [ruby-trunk - Bug #6120][Open] Float and BigDecimal bug in remainder in corner cases Marc-Andre Lafortune
2012-03-07 13:37 ` [ruby-core:43118] [ruby-trunk - Bug #6120] " Yui NARUSE
@ 2012-10-03 9:29 ` fahmisetiawand (Fahmi Setiawan)
2013-02-18 12:25 ` [ruby-core:52445] " mame (Yusuke Endoh)
2013-02-18 16:44 ` [ruby-core:52487] " marcandre (Marc-Andre Lafortune)
3 siblings, 0 replies; 5+ messages in thread
From: fahmisetiawand (Fahmi Setiawan) @ 2012-10-03 9:29 UTC (permalink / raw
To: ruby-core
Issue #6120 has been updated by fahmisetiawand (Fahmi Setiawan).
http://alkian.blogspot.com/2012/09/cara-menyembuhkan-asam-urat-dan-kolestrol-secara-alami.html
http://alkian.blogspot.com/2012/09/keretamini-keretamall-komediputar-ya-keretaminikucom.html
http://alkian.blogspot.com/2012/10/kata-kata-mutiara-motivasi-terbaru-2012.html
http://alkian.blogspot.com/2012/08/personil-coboy-junior.html
http://alkian.blogspot.com/2012/10/hasil-dan-klasemen-liga-champions.html
----------------------------------------
Bug #6120: Float and BigDecimal bug in remainder in corner cases
https://bugs.ruby-lang.org/issues/6120#change-29973
Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: core
Target version: 2.0.0
ruby -v: r34927
Currently:
4.2.remainder(+Float::INFINITY) # => 4.2, ok
4.2.remainder(-Float::INFINITY) # => NaN, should be 4.2
# (same with all signs reversed)
Reasons the remainder should be 4.2 and not NaN:
1) foo.remainder(bar) == foo.remainder(-bar)
2) foo.remainder(bar) == foo when bar.abs > foo.abs
Similarly:
require 'bigdecimal'
bd = BigDecimal.new("4.2")
bd.remainder(BigDecimal.new("+Infinity")) # => NaN, should be bd
bd.remainder(BigDecimal.new("-Infinity")) # => NaN, should be bd
# (same with all signs reverse)
Reasons: same as float.
Finally:
bd = BigDecimal.new("4.2")
bd.modulo(BigDecimal.new("0")) # => ZeroDivisionError, probably ok?
bd.remainder(BigDecimal.new("0")) # => NaN, should be probably raise a ZeroDivisionError?
Like in #6044, this could be decided either way, as long as there is consistency. Anyone prefer NaN to raising a ZeroDivisionError?
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:52445] [ruby-trunk - Bug #6120] Float and BigDecimal bug in remainder in corner cases
2012-03-07 5:51 [ruby-core:43109] [ruby-trunk - Bug #6120][Open] Float and BigDecimal bug in remainder in corner cases Marc-Andre Lafortune
2012-03-07 13:37 ` [ruby-core:43118] [ruby-trunk - Bug #6120] " Yui NARUSE
2012-10-03 9:29 ` [ruby-core:47817] " fahmisetiawand (Fahmi Setiawan)
@ 2013-02-18 12:25 ` mame (Yusuke Endoh)
2013-02-18 16:44 ` [ruby-core:52487] " marcandre (Marc-Andre Lafortune)
3 siblings, 0 replies; 5+ messages in thread
From: mame (Yusuke Endoh) @ 2013-02-18 12:25 UTC (permalink / raw
To: ruby-core
Issue #6120 has been updated by mame (Yusuke Endoh).
Target version changed from 2.0.0 to next minor
Should it be assigned to mrkn?
--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #6120: Float and BigDecimal bug in remainder in corner cases
https://bugs.ruby-lang.org/issues/6120#change-36511
Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: core
Target version: next minor
ruby -v: r34927
Currently:
4.2.remainder(+Float::INFINITY) # => 4.2, ok
4.2.remainder(-Float::INFINITY) # => NaN, should be 4.2
# (same with all signs reversed)
Reasons the remainder should be 4.2 and not NaN:
1) foo.remainder(bar) == foo.remainder(-bar)
2) foo.remainder(bar) == foo when bar.abs > foo.abs
Similarly:
require 'bigdecimal'
bd = BigDecimal.new("4.2")
bd.remainder(BigDecimal.new("+Infinity")) # => NaN, should be bd
bd.remainder(BigDecimal.new("-Infinity")) # => NaN, should be bd
# (same with all signs reverse)
Reasons: same as float.
Finally:
bd = BigDecimal.new("4.2")
bd.modulo(BigDecimal.new("0")) # => ZeroDivisionError, probably ok?
bd.remainder(BigDecimal.new("0")) # => NaN, should be probably raise a ZeroDivisionError?
Like in #6044, this could be decided either way, as long as there is consistency. Anyone prefer NaN to raising a ZeroDivisionError?
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:52487] [ruby-trunk - Bug #6120] Float and BigDecimal bug in remainder in corner cases
2012-03-07 5:51 [ruby-core:43109] [ruby-trunk - Bug #6120][Open] Float and BigDecimal bug in remainder in corner cases Marc-Andre Lafortune
` (2 preceding siblings ...)
2013-02-18 12:25 ` [ruby-core:52445] " mame (Yusuke Endoh)
@ 2013-02-18 16:44 ` marcandre (Marc-Andre Lafortune)
3 siblings, 0 replies; 5+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-02-18 16:44 UTC (permalink / raw
To: ruby-core
Issue #6120 has been updated by marcandre (Marc-Andre Lafortune).
Didn't get around fixing it for 2.0.0. Will fix and then assign to mrkn for BigDecimal.
----------------------------------------
Bug #6120: Float and BigDecimal bug in remainder in corner cases
https://bugs.ruby-lang.org/issues/6120#change-36562
Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: core
Target version: next minor
ruby -v: r34927
Currently:
4.2.remainder(+Float::INFINITY) # => 4.2, ok
4.2.remainder(-Float::INFINITY) # => NaN, should be 4.2
# (same with all signs reversed)
Reasons the remainder should be 4.2 and not NaN:
1) foo.remainder(bar) == foo.remainder(-bar)
2) foo.remainder(bar) == foo when bar.abs > foo.abs
Similarly:
require 'bigdecimal'
bd = BigDecimal.new("4.2")
bd.remainder(BigDecimal.new("+Infinity")) # => NaN, should be bd
bd.remainder(BigDecimal.new("-Infinity")) # => NaN, should be bd
# (same with all signs reverse)
Reasons: same as float.
Finally:
bd = BigDecimal.new("4.2")
bd.modulo(BigDecimal.new("0")) # => ZeroDivisionError, probably ok?
bd.remainder(BigDecimal.new("0")) # => NaN, should be probably raise a ZeroDivisionError?
Like in #6044, this could be decided either way, as long as there is consistency. Anyone prefer NaN to raising a ZeroDivisionError?
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-02-18 17:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-07 5:51 [ruby-core:43109] [ruby-trunk - Bug #6120][Open] Float and BigDecimal bug in remainder in corner cases Marc-Andre Lafortune
2012-03-07 13:37 ` [ruby-core:43118] [ruby-trunk - Bug #6120] " Yui NARUSE
2012-10-03 9:29 ` [ruby-core:47817] " fahmisetiawand (Fahmi Setiawan)
2013-02-18 12:25 ` [ruby-core:52445] " mame (Yusuke Endoh)
2013-02-18 16:44 ` [ruby-core:52487] " marcandre (Marc-Andre Lafortune)
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).