Skip to content

Commit

Permalink
[config] Extend auto::infnan probe to other --floatval #1146
Browse files Browse the repository at this point in the history
also check the real output for isnan and isinf.
maybe we should also check for NAN != NAN
  • Loading branch information
Reini Urban committed Nov 22, 2014
1 parent d4cc5c2 commit df855de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -8,6 +8,7 @@
+ Fix bignum.i_substract and i_multiply #1144
+ Optimize printing of single numbers #828
- Build
+ Extend auto::infnan probe to other --floatval #1146
- Documentation
- Tests
+ Fix t/steps/auto/arch-01.t darwin regression #1142
Expand Down
16 changes: 7 additions & 9 deletions config/auto/infnan.pm
@@ -1,5 +1,4 @@
# Copyright (C) 2010, Parrot Foundation.
# $Id$
# Copyright (C) 2010-2014, Parrot Foundation.

=head1 NAME
Expand Down Expand Up @@ -30,21 +29,20 @@ sub _init {

sub runstep {
my ( $self, $conf ) = @_;

my $infnan = 0;

$conf->cc_gen('config/auto/infnan/test_c.in');
eval { $conf->cc_build(); };
my $floatval = $conf->data->get('nv');
my $test = 'config/auto/infnan/test_c.in';
$conf->cc_gen($test);
eval { $conf->cc_build("-DFLOATVAL='$floatval'"); };
if (!$@) {
my $output = eval { $conf->cc_run() };
if (!$@ && $output =~ /OK/) {
if (!$@ && $output =~ /OK: 1 1/) {
$infnan = 1;
}
}
$conf->cc_clean();

#$conf->cc_clean();
$self->_handle_infnan($conf, $infnan);

return 1;
}

Expand Down
9 changes: 4 additions & 5 deletions config/auto/infnan/test_c.in
@@ -1,8 +1,7 @@
/*
Copyright (C) 2010, Parrot Foundation.
$Id$
Copyright (C) 2010-2014, Parrot Foundation.

seeing if INFINITY and NAN are defined
Check if INFINITY and NAN are defined and correct for our FLOATVAL

*/

Expand All @@ -12,8 +11,8 @@ seeing if INFINITY and NAN are defined

int
main(int argc, char **argv) {
double inf = INFINITY;
double nan = NAN;
FLOATVAL inf = INFINITY;
FLOATVAL nan = NAN;
printf("OK: %d %d\n", isinf(inf), isnan(nan));
return EXIT_SUCCESS;
}
Expand Down

0 comments on commit df855de

Please sign in to comment.