[pbrannan@zaphod uilib]$ irb
Rirb(main):001:0> RUBY_VERSION
"1.6.7"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
(irb):3: warning: Float 1.2345 out of range
1.2345
[pbrannan@zaphod uilib]$ ruby-1.7 which irb
irb(main):001:0> RUBY_VERSION
"1.7.3"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
1.2345
irb(main):004:0> Math.log(0); 1.2345
1.2345
irb(main):005:0> Math.log(0); 1.2345
1.2345
Any ideas why this is happening?
I found [ruby-talk:36449], where the author said he saw something
similar happen under 1.7.2 but not under 1.6.7. There were no
responses, though.
Paul
[pbrannan@zaphod uilib]$ irb
Rirb(main):001:0> RUBY_VERSION
"1.6.7"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
(irb):3: warning: Float 1.2345 out of range
1.2345
???
batsman@tux-chan:~$ irb
irb(main):001:0> RUBY_VERSION
"1.6.7"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
1.2345
irb(main):004:0> Math.log(0); 1.2345
1.2345
batsman@tux-chan:~$ irb1.7
irb(main):001:0> RUBY_VERSION
"1.7.2"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
1.2345
irb(main):004:0> Math.log(0); 1.2345
1.2345
irb(main):005:0> Math.log(0); 1.2345
1.2345
irb(main):006:0> Math.log(0); 1.2345
1.2345
···
On Thu, Nov 14, 2002 at 02:43:30AM +0900, Paul Brannan wrote:
[pbrannan@zaphod uilib]$ ruby-1.7 which irb
irb(main):001:0> RUBY_VERSION
"1.7.3"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
1.2345
irb(main):004:0> Math.log(0); 1.2345
1.2345
irb(main):005:0> Math.log(0); 1.2345
1.2345
Any ideas why this is happening?
I found [ruby-talk:36449], where the author said he saw something
similar happen under 1.7.2 but not under 1.6.7. There were no
responses, though.
Paul
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
’_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
*** Rince is wagner@schizo.DAINet.de (We have Joey, we have Fun, we have Linux on a Sun)
– Seen on #Debian
Mauricio Fernández batsman.geo@yahoo.com writes:
[pbrannan@zaphod uilib]$ irb
Rirb(main):001:0> RUBY_VERSION
"1.6.7"
irb(main):002:0> Math.log(0); 1.2345
1.2345
irb(main):003:0> Math.log(0); 1.2345
(irb):3: warning: Float 1.2345 out of range
1.2345
???
[Mauricio Fernández code shows that it works ok in his 1.6.7 and
1.7]
In #ruby-lang we discussed this. We couldn’t zero in on the problem
but what’s happening is this:
Math.log(0) calls log(0) which set errno to ERANGE
And then 1.2345 invokes rb_float(“1.2345”) which calls strtod on
"1.2345". Afterwards, there is a code that check for errno:
if (errno != 0) {
…
raise (“Float: … out of range”)
}
Apparently the errno from calling log(0) in his 1.6.7 still lingers
and causes the exception. We couldn’t explain this since it only
happens in his code. It seems in everyone else’s 1.6.7, errno is
implicitly reset before the errno check.
In 1.7.2, he observed that the errno is explicitly reset within
rb_strtod which encapsulate strtod call.
So, we suspect that his glibc (2.2.4) is somehow different than my
glibc (2.2.5). But doing a diff on strtod.c between 2.2.4 and 2.2.5
yields no clue.
So, we have no idea what’s happening.
YS.
···
On Thu, Nov 14, 2002 at 02:43:30AM +0900, Paul Brannan wrote: