diff options
Diffstat (limited to 'math/gen-libm-test.pl')
-rwxr-xr-x | math/gen-libm-test.pl | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl index f7bd323252..275ba7beaa 100755 --- a/math/gen-libm-test.pl +++ b/math/gen-libm-test.pl @@ -33,7 +33,7 @@ use vars qw (%ulps %failures); use vars qw (%beautify); use vars qw ($output_dir $ulps_file); -%beautify = +%beautify = ( "minus_zero" => "-0", "plus_zero" => "+0", "minus_infty" => "-inf", @@ -97,7 +97,7 @@ $count = 0; &parse_ulps ($ulps_file); &generate_testfile ($input, $output); -&output_ulps ("${output_dir}libm-test-ulps.h"); +&output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file); &print_ulps_file ("${output_dir}NewUlps") if ($opt_n); # Return a nicer representation @@ -142,8 +142,8 @@ sub build_complex_beautify { sub get_variable { my ($number) = @_; - return "x" if ($number == 1); - return "y" if ($number == 2); + return "x" if ($number == 1); + return "y" if ($number == 2); return "z" if ($number == 3); # return x1,x2,... $number =-3; @@ -186,7 +186,7 @@ sub special_functions { my (@args, $str, $test, $cline); @args = split /,\s*/, $args; - + unless ($args[0] =~ /sincos/) { die ("Don't know how to handle $args[0] extra."); } @@ -202,7 +202,7 @@ sub special_functions { $cline = " check_float (\"$test\", sin_res, $args[2]"; $cline .= &new_test ($test, $args[4]); print $file $cline; - + # handle cos $test = $str . ' puts ' . &beautify ($args[3]) . ' in cos_res'; $cline = " check_float (\"$test\", cos_res, $args[3]"; @@ -261,7 +261,7 @@ sub parse_args { $call .= ')'; $str = "$call == "; - # Result + # Result @descr = split //,$descr_res; foreach (@descr) { if ($_ =~ /f|i|l|L/) { @@ -382,7 +382,7 @@ sub parse_args { my ($str) = "$call sets x to $special[0]"; $post = " check_float (\"$str\", x, $special[0]"; $post .= &new_test ($str, undef); - } + } } elsif ($args[0] eq 'remquo') { if (defined $special[0] && $special[0] ne "IGNORE") { my ($str) = "$call sets x to $special[0]"; @@ -390,7 +390,7 @@ sub parse_args { $post .= &new_test ($str, undef); } } - + print $file $pre if (defined $pre); print $file " $cline\n"; @@ -500,7 +500,7 @@ sub print_ulps { # Clean up a floating point number sub clean_up_number { my ($number) = @_; - + # Remove trailing zeros $number =~ s/0+$//; $number =~ s/\.$//; @@ -586,21 +586,23 @@ sub output_test { # Print include file sub output_ulps { - my ($file) = @_; + my ($file, $ulps_filename) = @_; my ($i, $fct); open ULP, ">$file" or die ("Can't open $file: $!"); - print ULP "/* This file is automatically generated.\n"; + print ULP "/* This file is automatically generated\n"; + print ULP " from $ulps_filename with gen-libm-test.pl.\n"; print ULP " Don't change it - change instead the master files. */\n\n"; + print ULP "\n/* Maximal error of functions. */\n"; foreach $fct (@functions) { output_test (\*ULP, $fct, $fct); } + print ULP "\n/* Error of single function calls. */\n"; for ($i = 0; $i < $count; $i++) { output_test (\*ULP, $tests[$i], $i); } close ULP; } - |