Project

General

Profile

This project is closed and read-only.

Actions

Bug #4023

closed

to_i pathological case in 1.8.7, 1.9.2

Bug #4023: to_i pathological case in 1.8.7, 1.9.2

Added by crosebrugh (Chris Rosebrugh) almost 16 years ago. Updated over 15 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 - Bug #4022: Mistake in this cocient of logs followed by %1RejectedActions
Related to Ruby - Bug #3746: Incorrect Float subtractionRejectedActions

Updated by runpaint (Run Paint Run Run) almost 16 years ago Actions #1

=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

Updated by naruse (Yui NARUSE) almost 16 years ago Actions #2

  • Status changed from Open to Rejected
Actions

Also available in: PDF Atom