Project

General

Profile

Actions

Bug #4023

closed

to_i pathological case in 1.8.7, 1.9.2

Added by crosebrugh (Chris Rosebrugh) about 14 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
[ruby-core:33045]

Description

=begin
% /usr/bin/ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
% /usr/bin/ruby -e "puts (4.55100).to_i"
455
% /usr/bin/ruby -e "puts (4.56
100).to_i"
455
% /usr/bin/ruby -e "puts (4.57*100).to_i"
457

Also happens in 1.9.2 (2010-08-18) [i686-linux] (via http://tryruby.org/)

Should I really not expect (4.56*100).to_i to return 456?
=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #4022: Mistake in this cocient of logs followed by %1Rejected11/04/2010Actions
Related to Ruby master - Bug #3746: Incorrect Float subtractionRejected08/26/2010Actions
Actions #1

Updated by runpaint (Run Paint Run Run) about 14 years ago

=begin
Float#to_i is documented as truncating its receiver. Specifically, if the receiver is positive, it is floored. On trunk, 4.56*100 == 455.99999999999994, which when floored is 455.

=end

Actions #2

Updated by naruse (Yui NARUSE) about 14 years ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0