From 2a28526819683e957df2cc32bf9614bbe4b50c04 Mon Sep 17 00:00:00 2001 From: "Andreas J. Koenig" Date: Sun, 12 Apr 2009 11:06:39 +0200 Subject: [PATCH] must remove the speedier versions due to (machine dependent) bigfloat bugs in native perl math --- Todo | 5 +++++ lib/File/Rsync/Mirror/Recentfile/FakeBigFloat.pm | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Todo b/Todo index 5fd5d35..a2ac737 100644 --- a/Todo +++ b/Todo @@ -1,3 +1,8 @@ +2009-04-12 Andreas J. Koenig + + * Todo: try if we can be faster with a native float package. I'm really + glad to have a machine exposing perl floating point bugs:-( + 2009-04-11 Andreas J. Koenig * Bug: when the dirtymark changes upstream, then the downstream server diff --git a/lib/File/Rsync/Mirror/Recentfile/FakeBigFloat.pm b/lib/File/Rsync/Mirror/Recentfile/FakeBigFloat.pm index ad951eb..ff61429 100644 --- a/lib/File/Rsync/Mirror/Recentfile/FakeBigFloat.pm +++ b/lib/File/Rsync/Mirror/Recentfile/FakeBigFloat.pm @@ -76,9 +76,7 @@ sub _bigfloatcmp ($$) { } Carp::confess("_bigfloatcmp called with l[$_[0]]r[$_[1]]: but both must be defined"); } - # unequal is much more frequent than equal - return 1 if $_[0] - $_[1] > 0.001; - return -1 if $_[0] - $_[1] < -0.001; + # unequal is much more frequent than equal but let's get rid of these return 0 if $_[0] eq $_[1]; my $can_rely_on_native = 0; if ($_[0] =~ /\./ || $_[1] =~ /\./) { @@ -86,6 +84,8 @@ sub _bigfloatcmp ($$) { for ($_[0], $_[1]){ $_ .= ".0" unless /\./; } + return 1 if $_[0] - $_[1] > 1; + return -1 if $_[0] - $_[1] < -1; } else { $can_rely_on_native = 1; # can we? } -- 2.11.4.GIT