develooper Front page | perl.perl5.porters | Postings from April 2008

[perl #45383] RE: missing tests for sprintf %f with Nan/+Inf/-Inf? (was: sprintf %f panics with NaN)

Thread Next
From:
Bram via RT
Date:
April 28, 2008 00:10
Subject:
[perl #45383] RE: missing tests for sprintf %f with Nan/+Inf/-Inf? (was: sprintf %f panics with NaN)
Message ID:
rt-3.6.HEAD-23612-1209326619-131.45383-15-0@perl.org
Small history of the ticket:


$ perl -we 'printf "%f\n", Inf/-Inf/Nan'
resulted in
panic: frexp at -e line 1.
(on NetBSD)

(This was fixed by changes: 31855, 31856)

On Wed Sep 12 13:59:27 2007, zefram@fysh.org wrote:
> Nicholas Clark wrote:
> >I'm not sure how (or where) to write good regression tests for this,
> that don't
> >end up sucking in chunks of Data::Float.
> 
> You don't need to know whether NaNs and infinities actually exist.
> You just need to use formulae that will generate them if they do
> exist,
> and make sure that sprintf doesn't choke on them.  How about:
> 
> 	use Test::More;
> 	foreach(2**1e100, -2**1e100, 2**1e100/2**1e100) {
> 		eval { sprintf("%f", $_); };
> 		is $@, "";
> 	}
> 
> -zefram
> 

I checked t/op/sprintf.t <http://public.activestate.com/cgi-bin/
perlbrowse/l/t/op/sprintf.t> and t/op/sprintf2.t <http://
public.activestate.com/cgi-bin/perlbrowse/l/t/op/sprintf2.t> to see if 
tests for this were added but it appears not.

Were they added elsewhere? Or were there any problems with the test 
idea?
Or weren't tests added because of a lack of time/patch?
(If it's the later then I can write a patch)


Kind regards,

Bram


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About