Switch Attoparsec parser from double to rational
authorIustin Pop <iustin@google.com>
Thu, 28 Feb 2013 10:05:45 +0000 (11:05 +0100)
committerIustin Pop <iustin@google.com>
Mon, 4 Mar 2013 16:39:37 +0000 (17:39 +0100)
commitd58d44f30b8a39a40716903df645767b12445b09
tree4dc12c6310517e668fc76cb5c71448546a4d83b2
parent1fe0e999e3d389d8daab79fa228e86dd6d2ea866
Switch Attoparsec parser from double to rational

According to the documentation, “This function is almost ten times
faster than rational, but is slightly less accurate. For 94.2% of
numbers, this function and rational give identical results, but for
the remaining 5.8%, this function loses precision around the 15th
decimal place. For 0.001% of numbers, this function will lose
precision at the 13th or 14th decimal place.”. What happens is that
for our tests, it can happen that “Attoparsec.double (show a_double)”
is quite different from “a_double”, such that we have much more than
1e-12 absolute difference.

Since our xm lists should not be too big, I think switching to
rational is better. Next patch also changes the way we compare
doubles, so maybe this patch is not really needed…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
src/Ganeti/Hypervisor/Xen/XmParser.hs