Walt Mankowski on Fri, 20 Jun 2003 11:38:09 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Floating point roundoff in cpan test scripts


I just put up my first module on CPAN the other day[1], and this
morning I got an email from cpan-testers saying that it some of the
tests failed on Solaris.

I'm using Test::More to do the tests.  The line that fails is

  is_deeply( [decimal2dms(  0.25416666666666667 )], [ 0, 15, 15]);

The error it's returning is

#     Structures begin differing at:
#          $got->[2] = '15.0000000000001'
#     $expected->[2] = '15'

Is there any easy way I can tell it that if it's within a given delta
of the value I'm looking for, it's close enough?

Walt

1. http://search.cpan.org/author/WALTMAN/Geo-Coordinates-DecimalDegrees-0.02/DecimalDegrees.pm

-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**