[sf-perl] Comparing structures, ignoring floating point roundoff differences
doom at kzsu.stanford.edu
Mon Nov 21 11:35:45 PST 2005
I've got a problem where I need to compare structures that have
floating point numbers stashed in them. I want to test the
structures for identity (ala is_deeply from Test::More), but
ignore tiny differences in the floating point numbers.
This seems like something that ought to be a solved problem by
now, but I'm having trouble finding it. I had some hopes for
Test::Deep, which at least has a "num" comparison operation where
you can set a tolerance to ignore, but it looks to me like that's
only for comparing a computed value to an expected constant
value: I need to compare computed values that are expected to
match each other.
Does that ring any bells with anyone?
More information about the SanFrancisco-pm