mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (v2w): Normalize a rational value to an integer if possible.
[ruby-core:58070] [Bug #9059] reported by Isaac Schwabacher. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
adcab6c1bb
commit
caa3c88040
2 changed files with 10 additions and 0 deletions
|
|
@ -1,3 +1,8 @@
|
|||
Wed Oct 30 12:20:32 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* time.c (v2w): Normalize a rational value to an integer if possible.
|
||||
[ruby-core:58070] [Bug #9059] reported by Isaac Schwabacher.
|
||||
|
||||
Wed Oct 30 12:08:41 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* array.c (rb_ary_uniq_bang): use rb_ary_modify_check() instead of
|
||||
|
|
|
|||
5
time.c
5
time.c
|
|
@ -320,6 +320,11 @@ v2w_bignum(VALUE v)
|
|||
static inline wideval_t
|
||||
v2w(VALUE v)
|
||||
{
|
||||
if (RB_TYPE_P(v, T_RATIONAL)) {
|
||||
if (RRATIONAL(v)->den != LONG2FIX(1))
|
||||
return v;
|
||||
v = RRATIONAL(v)->num;
|
||||
}
|
||||
#if WIDEVALUE_IS_WIDER
|
||||
if (FIXNUM_P(v)) {
|
||||
return WIDEVAL_WRAP((WIDEVALUE)(SIGNED_WIDEVALUE)(long)v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue