Bug #2483

String#to_f of small numbers hangs

Added by mikisvaz (Miguel Vazquez) over 2 years ago. Updated about 1 year ago.

[ruby-core:27175]
Status:Feedback Start date:12/15/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
ruby -v:ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]

Description

There is a problem in the String#to_f method. It hangs when the float is really small.


This works:
ruby-1.8 -e 'puts "1e-20".to_f'

This hangs:
ruby-1.8 -e 'puts "1e-100".to_f'

History

Updated by mikisvaz (Miguel Vazquez) over 2 years ago

I'm using archlinux. I've just tried several versions of the 1.8, the 174 and the 72 patches and both still hang. 1.9 works fine.

Updated by shyouhei (Shyouhei Urabe) over 1 year ago

  • Status changed from Open to Feedback
Can you see if it still happens?  I can't reproduce the situation on my machine now.

Updated by zimbatm (Jonas Pfenniger) over 1 year ago

Can't reproduce the bug on Mac OS X 10.6.5 with ruby-1.8.7-p302

Updated by sorah (Shota Fukumori) over 1 year ago

Can't reproduce on  OSX10.6.5 and Debian squeeze (amd64) with 1.8 trunk.

[sorah@lemonade]:~/git/ruby/core18/builds/master% ruby -ve 'puts "1e-100".to_f'   
ruby 1.8.8dev (2010-11-24) [i386-darwin10.5.0]
1.0e-100

[sorah@cleveland]:~/git/ruby/core18/builds/master% ruby -ve 'puts "1e-100".to_f'
ruby 1.8.8dev (2010-11-24) [x86_64-linux]
1.0e-100

Also available in: Atom PDF