In message "[ruby-talk:12217] Re: NaN, Infinity (Bug?)"
on 01/03/07, Tammo Freese <tammo.freese / offis.de> writes:
>Perhaps this bug is only based on a misconfiguration of my system?
>I use the windows installer from RubyCentral, version 1.6.2 (-03)
>on Windows NT4. Anybody out there with the same configuration?
>Which results do you get?
This problem is caused by Cygwin's C library libc (newlib).
The behavior of Cygwin's log() is commented as follows:
newlib/libm/math/w_log.c:
>RETURNS
>Normally, returns the calculated value. When <[x]> is zero, the
>returned value is <<-HUGE_VAL>> and <<errno>> is set to <<ERANGE>>.
>When <[x]> is negative, the returned value is <<-HUGE_VAL>> and
><<errno>> is set to <<EDOM>>. You can control the error behavior via
><<matherr>>.
# Based on eban's report [ruby-dev:12385]
For Cygwin, eban added a macro to the current version of Ruby:
#if defined __CYGWIN__
#define log(x) ((x) < 0.0 ? ((x) - (x)) / 0.0 : log(x))
#endif
-- Gotoken