[Bioperl-l] evalues/floating point tests

Mark A. Jensen maj at fortinbras.us
Sun Jan 18 02:44:59 UTC 2009


how bout is_asfloat() ?
----- Original Message ----- 
From: "Chris Fields" <cjfields at illinois.edu>
To: "Sendu Bala" <bix at sendu.me.uk>
Cc: "BioPerl List" <bioperl-l at lists.open-bio.org>
Sent: Saturday, January 17, 2009 9:24 PM
Subject: Re: [Bioperl-l] evalues/floating point tests


> On Jan 17, 2009, at 5:45 PM, Sendu Bala wrote:
> 
>> Chris Fields wrote:
>>> I've noticed an odd issue when testing BioPerl on WinXP yesterday  
>>> which doesn't appear to be popping up anywhere else.  When  
>>> comparing floating point numbers, several tests fail like the  
>>> following:
>>> #   Failed test at t\SearchIO\blast_pull.t line 40.
>>> #          got: '1e-23'
>>> #     expected: '1e-023'
>>> #   Failed test at t\SearchIO\blast_pull.t line 67.
>>> #          got: '6e-59'
>>> #     expected: '6e-059'
>>> These are generally in lines like (for the example above)
>>> is $result->get_parameter('expect'), 1e-23;
>>> I'm adding a method to Bio::Root::Test for comparing two floating  
>>> point numbers based on equality:
>>> float_eq $float1, $float2, $message;
>>> This basically wraps is() but runs both values through  
>>> 'sprintf("%g", $foo)' prior to the comparison; it has a prototype  
>>> requiring two values to be passed and an optional message.  Any  
>>> objections to the method name or adding this in?
>>
>> is_float() seems more consistent? Other than that, great idea.
> 
> I thought the same thing at first, but (at least to me) is_float  
> sounds more like a boolean test on whether the scalar value passed is  
> a float rather than a comparison checking whether two floats are equal.
> 
> I'll go ahead and commit this, but it would be very easy to switch the  
> method name over.
> 
> chris
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
>



More information about the Bioperl-l mailing list