Comparing structures, ignoring floating point roundoff differences

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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?

Re: Comparing structures, ignoring floating point roundoff differences

Quoted text here. Click to load it

The module Test::Number::Delta allows you to compare two floating-point
values within a specified precision.

 Posted Via Premium Usenet Newsgroup Services

Site Timeline