[#66126] Creation/Conversion methods/functions table for Ruby types — SASADA Koichi <ko1@...>
Hi,
5 messages
2014/11/07
[#66248] [ruby-trunk - Feature #10423] [PATCH] opt_str_lit*: avoid literal string allocations — normalperson@...
Issue #10423 has been updated by Eric Wong.
3 messages
2014/11/13
[#66595] [ruby-trunk - Bug #10557] [Open] Block not given when the argument is a string — bartosz@...
Issue #10557 has been reported by Bartosz Kopinski.
3 messages
2014/11/30
[ruby-core:66290] [ruby-trunk - Bug #10512] [Rejected] Time.at produces imprecise nsec values
From:
akr@...
Date:
2014-11-14 23:34:10 UTC
List:
ruby-core #66290
Issue #10512 has been updated by Akira Tanaka.
Status changed from Open to Rejected
It is because the float value 0.0000002 is less than 0.0000002.
```
% ruby -e 'p((Rational(0.0000002) * 1000000000).floor)'
199
```
Time records 0.0000002 as Rational(0.0000002).
It is the most precious record according to the given argument.
```
% ruby -e 'p Rational(0.0000002), Time.at(0.0000002).subsec == Rational(0.0000002)'
(944473296573929/4722366482869645213696)
true
```
----------------------------------------
Bug #10512: Time.at produces imprecise nsec values
https://bugs.ruby-lang.org/issues/10512#change-49959
* Author: Chris Heald
* Status: Rejected
* Priority: Normal
* Assignee:
* Category: core
* Target version:
* ruby -v: ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
I'm working on improving JRuby parity with MRI, and I've found what I think is a bug in MRI and its test suite. test_time.rb, in test_at asserts:
assert_equal(199, Time.at(0.0000002).nsec)
This passes under MRI, but fails under JRuby, which produces (the correct) value of 200.
It looks like there is a precision issue in MRI which is causing this behavior:
2.2.0-preview1 :008 > Time.at(0.000000197).nsec
=> 197
2.2.0-preview1 :009 > Time.at(0.000000198).nsec
=> 197
2.2.0-preview1 :010 > Time.at(0.000000199).nsec
=> 198
2.2.0-preview1 :011 > Time.at(0.000000200).nsec
=> 199
2.2.0-preview1 :012 > Time.at(0.000000201).nsec
=> 201
First and foremost, why does MRI assert that Time.at(0.0000002).nsec == 199, rather than 200? Second, if this is not a bug, why not (so that I can make sure JRuby performs equivalently)?
--
https://bugs.ruby-lang.org/