# \[Bug #2792\] String#to\_f on Ruby-1.8.6-p399

**URL:** <https://www.ruby-forum.com/t/bug-2792-string-to-f-on-ruby-1-8-6-p399/184131>\
**Category:** Development\
**Created:** [February 25, 2010, 3:49pm UTC](https://www.ruby-forum.com/t/bug-2792-string-to-f-on-ruby-1-8-6-p399/184131 "2010-02-25T15:49:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [February 25, 2010, 3:49pm UTC](https://www.ruby-forum.com/t/bug-2792-string-to-f-on-ruby-1-8-6-p399/184131/1 "2010-02-25T15:49:14Z")

</div>

Bug #2792: String#to\_f on Ruby-1.8.6-p399  
[http://redmine.ruby-lang.org/issues/show/2792](http://redmine.ruby-lang.org/issues/show/2792)

e$B5/I\<\<Te(B: Masao M.  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal  
ruby -v: ruby 1.8.6 (2010-02-05 patchlevel 399) [x86\_64-linux]

Ruby-1.8.6e$B$Ne(BString#to\_fe$B$G!"\>.?tE@$N07$$$,$\*$+$7$$$h$&$G$9!#e(B

% ruby -v -e ‘p “0.7”.to\_f’  
ruby 1.8.6 (2010-02-05 patchlevel 399) [x86\_64-linux]  
7.0

% ruby -v -e ‘p “0.7”.to\_f’  
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86\_64-linux]  
0.7

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [March 5, 2010, 5:30pm UTC](https://www.ruby-forum.com/t/bug-2792-string-to-f-on-ruby-1-8-6-p399/184131/2 "2010-03-05T17:30:37Z")

</div>

e$B%A%1%C%He(B #2792 e$B$,99?7$5$l$^$7$?!#e(B (by Run Paint Run R.)

I suspect I’m seeing a symptom of the same problem. Just installed “ruby  
1.8.6 (2010-03-05 patchlevel 400) [i686-linux]” from source, and found  
floats to be horribly broken.

> > 1.3.to\_int  
> > =\> 13  
> > irb(main):002:0\> 1.3.ceil  
> > =\> 13  
> > irb(main):003:0\> 2 + 0.5  
> > =\> 7.0

## Am I missing a dependency or is this a regression?

[http://redmine.ruby-lang.org/issues/show/2792](http://redmine.ruby-lang.org/issues/show/2792)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [March 5, 2010, 6:00pm UTC](https://www.ruby-forum.com/t/bug-2792-string-to-f-on-ruby-1-8-6-p399/184131/3 "2010-03-05T18:00:30Z")

</div>

e$B1sF#$G$9!#e(B

> Ruby-1.8.6e$B$Ne(BString#to\_fe$B$G!"\>.?tE@$N07$$$,$\*$+$7$$$h$&$G$9!#e(B
> 
> % ruby -v -e ‘p “0.7”.to\_f’  
> ruby 1.8.6 (2010-02-05 patchlevel 399) [x86\_64-linux]  
> 7.0

gcc 4.4.1 e$B$r;H$C$F$$$^$;$s$+!)e(B  
[ruby-core:26937] [ruby-core:28037] e$B$GF1MM$NJs9p$,$"$j!"e(B  
gcc 4.4.1 e$B$N%P%0$N$;$$$G$O$J$$$+$H$$$&$3$H$G$9!#e(B

gcc 4.3 e$B$+e(B gcc 4.4.2 e$B$J$iBg\>fIW$@$=$&$G$9!#e(B

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [March 5, 2010, 7:21pm UTC](https://www.ruby-forum.com/t/bug-2792-string-to-f-on-ruby-1-8-6-p399/184131/4 "2010-03-05T19:21:17Z")

</div>

e$B%A%1%C%He(B #2792 e$B$,99?7$5$l$^$7$?!#e(B (by Run Paint Run R.)

## Bah. I’d missed that thread. Thanks, Yusuke.

[http://redmine.ruby-lang.org/issues/show/2792](http://redmine.ruby-lang.org/issues/show/2792)
