From: Aristarkh A Zagorodnikov Date: 2001-09-08T18:38:55+09:00 Subject: [ruby-talk:20994] Bug in latest snapshot, regarding Float#to_s Hello! Recently I installed the latest snapshot (ruby 1.7.1 (2001-09-03) [i686-linux]), and after some time of work found that it has a bug. After 2 hours of tracing the bug (all started from random Apache hangs), I traced it down to Float#to_s and discovered that "ruby -e 'p 0.0'" puts computer in and endless loop. The following patch to numeric.c (by no means said to be 100% correct or extensively tested) fixed the situation for me. xm@is:~/build/ruby$ diff numeric.c numeric.c.orig 226,229c226 < if ((d1 = modf(value, &d2)) == 0) { < fmt = "%.1f"; < } < else if (value < 1.0e-3) { --- > if (value < 1.0e-3) { 240a238,240 > else if ((d1 = modf(value, &d2)) == 0) { > fmt = "%.1f"; > } Aristarkh A Zagorodnikov, Lead Programmer, W3D Group http://www.w3d.ru /// xm@w3d.ru /// ICQ UIN 36987938