On Wed, 23 Nov 2005, Guest via RT wrote:
Show quoted text> 1) I wonder if the magic in Test::More isn't playing tricks with the
> overloading, which makes it unsuitable to use is() to compare the
> numbers. If 20infinite.t, line 61 uses cmp_ok with '==' instead, it
> seems to work better.
>
> cmp_ok( $deltas{$_}, '==', $nan, "infinity - infinity = nan ($_)" );
Ah, interesting. Someone reported that the tests used to pass for him and
failed after upgrading Test::More, so that might be it.
Show quoted text> 2) The second thing is the Windows specific fix mentioned on line 17
>
> # for some reason, Windows only gets NaN if abs() is used
>
> I'm not sure which Perl version/OS version etc that came from, but using
> winxp and Perl "v5.8.6 built for MSWin32-x86-multi-thread", it works
> correctly if I _don't_ use the abs() (so that comment was very helpful!)
>
> my $nan = $posinf - $posinf;
>
> This second thing of course needs to be tested on a few more
> combinations before anything can be said for certain, but for the
> original poster it was broken with w2k + 5.8.0.
I can certainly change it for the next release and see what happens. It's
not likely to get _more_ broken.
Show quoted text> So I guess the question is whether these two things actually work, like
> for real usage of the module outside of the test suite, or if the
> infinite stuff is still broken for real on win32. I don't feel competent
> enough to answer that question, not knowing the module well enough.
That's tough to say. Mostly it depends on this holding true:
my $inf = 100 ** 100 ** 100;
my $neg_inf = -1 * $inf;
$inf == $inf;
$neg_ing == $neg_inf;
If those last two are true, then DateTime::Infinite should work.
Show quoted text> There's a patch at the end. If it doesn't break anything else and you
> decide to apply it, that comment about Windows should perhaps be
> rephrased to mention the change, in case the previous approach worked
> for previous versions of something (OS/Perl).
Sounds like a good idea. I'll probably apply the patch since like I said,
it's unlikely to get worse, maybe just broken on different platforms.
Thanks,
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/