2 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4 # Contributed by Andreas Jaeger <aj@suse.de>, 1999.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
20 # This file needs to be tidied up
21 # Note that functions and tests share the same namespace.
23 # Information about tests are stored in: %results
24 # $results{$test}{"type"} is the result type, e.g. normal or complex.
25 # $results{$test}{"has_ulps"} is set if deltas exist.
26 # In the following description $type and $float are:
27 # - $type is either "normal", "real" (for the real part of a complex number)
28 # or "imag" (for the imaginary part # of a complex number).
29 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
30 # It represents the underlying floating point type (float, double or long
31 # double) and if inline functions (the leading i stands for inline)
33 # $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
40 use vars qw
($input $output $auto_input);
41 use vars qw
(%results);
42 use vars qw
(%beautify @all_floats %all_floats_pfx);
43 use vars qw
($ulps_file);
44 use vars qw
(%auto_tests);
46 # all_floats is sorted and contains all recognised float types
47 @all_floats = ('double', 'float', 'idouble',
48 'ifloat', 'ildouble', 'ldouble');
50 # all_floats_pfx maps C types to their C like prefix for macros.
58 ( "minus_zero" => "-0",
66 "minus_infty" => "-inf",
67 "plus_infty" => "inf",
68 "qnan_value" => "qNaN",
69 "snan_value" => "sNaN",
70 "snan_value_ld" => "sNaN",
76 # a: auto-libm-test-out input file
80 # C: libm-test.c output file
81 # H: libm-test-ulps.h output file
83 use vars
qw($opt_a $opt_c $opt_u $opt_n $opt_C $opt_H $opt_h);
84 getopts('a:c:u:n:C:H:h');
86 $ulps_file = 'libm-test-ulps';
89 print "Usage: gen-libm-test.pl [OPTIONS]\n";
90 print " -h print this help, then exit\n";
91 print " -a FILE input file with automatically generated tests\n";
92 print " -c FILE input file .inc file with tests\n";
93 print " -u FILE input file with ulps\n";
94 print " -n FILE generate sorted file FILE from libm-test-ulps\n";
95 print " -C FILE generate output C file FILE from libm-test.inc\n";
96 print " -H FILE generate output ulps header FILE from libm-test-ulps\n";
100 $ulps_file = $opt_u if ($opt_u);
102 $input = $opt_c if ($opt_c);
103 $auto_input = $opt_a if ($opt_a);
104 $output = $opt_C if ($opt_C);
106 &parse_ulps ($ulps_file) if ($opt_H || $opt_n);
107 &parse_auto_input ($auto_input) if ($opt_C);
108 &generate_testfile ($input, $output) if ($opt_C);
109 &output_ulps ($opt_H, $ulps_file) if ($opt_H);
110 &print_ulps_file ($opt_n) if ($opt_n);
112 # Return a nicer representation
117 if (exists $beautify{$arg}) {
118 return $beautify{$arg};
123 if (exists $beautify{$tmp}) {
124 return '-' . $beautify{$tmp};
127 if ($arg =~ /^-?0x[0-9a-f.]*p[-+][0-9]+f$/) {
130 if ($arg =~ /[0-9]L$/) {
136 # Return a nicer representation of a complex number
137 sub build_complex_beautify {
141 $str1 = &beautify ($r);
142 $str2 = &beautify ($i);
145 $str1 .= ' - ' . $str2;
147 $str1 .= ' + ' . $str2;
153 # Return the text to put in an initializer for a test's exception
155 sub show_exceptions {
156 my ($ignore_result, $non_finite, $test_snan, $exception) = @_;
157 $ignore_result = ($ignore_result ? "IGNORE_RESULT|" : "");
158 $non_finite = ($non_finite ? "NON_FINITE|" : "");
159 $test_snan = ($test_snan ? "TEST_SNAN|" : "");
160 if (defined $exception) {
161 return ", ${ignore_result}${non_finite}${test_snan}$exception";
163 return ", ${ignore_result}${non_finite}${test_snan}0";
167 # Apply the LIT(x) macro to a literal floating point constant
168 # and strip any existing suffix.
171 my $exp_re = "([+-])?[[:digit:]]+";
172 # Don't wrap something that does not look like a:
173 # * Hexadecimal FP value
174 # * Decimal FP value without a decimal point
175 # * Decimal value with a fraction
176 return $lit if $lit !~ /([+-])?0x[[:xdigit:]\.]+[pP]$exp_re/
177 and $lit !~ /[[:digit:]]+[eE]$exp_re/
178 and $lit !~ /[[:digit:]]*\.[[:digit:]]*([eE]$exp_re)?/;
180 # Strip any existing literal suffix.
183 return "LIT (${lit})";
186 # Apply LIT macro to individual tokens within an expression.
188 # This function assumes the C expression follows GNU coding
189 # standards. Specifically, a space separates each lexical
190 # token. Otherwise, this post-processing may apply LIT
191 # incorrectly, or around an entire expression.
194 my @toks = split (/ /, $lit);
196 $_ = _apply_lit ($_);
198 return join (' ', @toks);
201 # Parse the arguments to TEST_x_y
203 my ($file, $descr, $args) = @_;
204 my (@args, $descr_args, $descr_res, @descr);
205 my ($current_arg, $cline, $cline_res, $i);
208 my ($ignore_result_any, $ignore_result_all);
209 my ($num_res, @args_res, @start_rm, $rm);
210 my (@plus_oflow, @minus_oflow, @plus_uflow, @minus_uflow);
211 my (@errno_plus_oflow, @errno_minus_oflow);
212 my (@errno_plus_uflow, @errno_minus_uflow);
213 my (@xfail_rounding_ibm128_libgcc);
214 my ($non_finite, $test_snan);
216 ($descr_args, $descr_res) = split /_/,$descr, 2;
218 @args = split /,\s*/, $args;
222 # Generate first the string that's shown to the user
224 @descr = split //,$descr_args;
225 for ($i = 0; $i <= $#descr; $i++) {
227 if ($current_arg > 1) {
230 # FLOAT, long double, int, unsigned int, long int, long long int
231 if ($descr[$i] =~ /f|j|i|u|l|L/) {
232 $call_args .= $comma . &beautify ($args[$current_arg]);
236 # Argument passed via pointer.
237 if ($descr[$i] =~ /p/) {
240 # &FLOAT, &int - simplify call by not showing argument.
241 if ($descr[$i] =~ /F|I/) {
245 if ($descr[$i] eq 'c') {
246 $call_args .= $comma . &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
251 die ("$descr[$i] is unknown");
255 @args_res = @args[$current_arg .. $#args];
257 @descr = split //,$descr_res;
259 if ($_ =~ /f|i|l|L|M|U/) {
261 } elsif ($_ eq 'c') {
263 } elsif ($_ eq 'b') {
266 } elsif ($_ eq '1') {
269 die ("$_ is unknown");
273 if ($#args_res == $num_res - 1) {
274 # One set of results for all rounding modes, no flags.
275 @start_rm = ( 0, 0, 0, 0 );
276 } elsif ($#args_res == $num_res) {
277 # One set of results for all rounding modes, with flags.
278 die ("wrong number of arguments")
279 unless ($args_res[$#args_res] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL/);
280 @start_rm = ( 0, 0, 0, 0 );
281 } elsif ($#args_res == 4 * $num_res + 3) {
282 # One set of results per rounding mode, with flags.
283 @start_rm = ( 0, $num_res + 1, 2 * $num_res + 2, 3 * $num_res + 3 );
285 die ("wrong number of arguments");
288 # Put the C program line together
289 # Reset some variables to start again
291 $call_args =~ s/\"/\\\"/g;
292 $cline = "{ \"$call_args\"";
293 @descr = split //,$descr_args;
294 for ($i=0; $i <= $#descr; $i++) {
295 # FLOAT, int, long int, long long int
296 if ($descr[$i] =~ /f|j|i|u|l|L/) {
297 if ($descr[$i] eq "f") {
298 $cline .= ", " . &apply_lit ($args[$current_arg]);
300 $cline .= ", $args[$current_arg]";
305 # &FLOAT, &int, argument passed via pointer
306 if ($descr[$i] =~ /F|I|p/) {
310 if ($descr[$i] eq 'c') {
311 $cline .= ", " . &apply_lit ($args[$current_arg]);
312 $cline .= ", " . &apply_lit ($args[$current_arg+1]);
318 @descr = split //,$descr_res;
319 @plus_oflow = qw(max_value plus_infty max_value plus_infty);
320 @minus_oflow = qw(minus_infty minus_infty -max_value -max_value);
321 @plus_uflow = qw(plus_zero plus_zero plus_zero min_subnorm_value);
322 @minus_uflow = qw(-min_subnorm_value minus_zero minus_zero minus_zero);
323 @errno_plus_oflow = qw(0 ERRNO_ERANGE 0 ERRNO_ERANGE);
324 @errno_minus_oflow = qw(ERRNO_ERANGE ERRNO_ERANGE 0 0);
325 @errno_plus_uflow = qw(ERRNO_ERANGE ERRNO_ERANGE ERRNO_ERANGE 0);
326 @errno_minus_uflow = qw(0 ERRNO_ERANGE ERRNO_ERANGE ERRNO_ERANGE);
327 @xfail_rounding_ibm128_libgcc = qw(XFAIL_IBM128_LIBGCC 0
328 XFAIL_IBM128_LIBGCC XFAIL_IBM128_LIBGCC);
329 for ($rm = 0; $rm <= 3; $rm++) {
330 $current_arg = $start_rm[$rm];
331 $ignore_result_any = 0;
332 $ignore_result_all = 1;
336 if ($_ =~ /b|f|j|i|l|L|M|U/ ) {
337 my ($result) = $args_res[$current_arg];
338 if ($result eq "IGNORE") {
339 $ignore_result_any = 1;
342 $ignore_result_all = 0;
345 $result = apply_lit
($result);
347 $cline_res .= ", $result";
349 } elsif ($_ eq 'c') {
350 my ($result1) = $args_res[$current_arg];
351 if ($result1 eq "IGNORE") {
352 $ignore_result_any = 1;
355 $ignore_result_all = 0;
357 my ($result2) = $args_res[$current_arg + 1];
358 if ($result2 eq "IGNORE") {
359 $ignore_result_any = 1;
362 $ignore_result_all = 0;
364 $result1 = apply_lit
($result1);
365 $result2 = apply_lit
($result2);
366 $cline_res .= ", $result1, $result2";
368 } elsif ($_ eq '1') {
369 push @special, $args_res[$current_arg];
373 if ($ignore_result_any && !$ignore_result_all) {
374 die ("some but not all function results ignored\n");
376 # Determine whether any arguments or results, for any rounding
377 # mode, are non-finite.
378 $non_finite = ($args =~ /qnan_value|snan_value|plus_infty|minus_infty/);
379 $test_snan = ($args =~ /snan_value/);
381 $cline_res .= show_exceptions
($ignore_result_any,
384 ($current_arg <= $#args_res)
385 ?
$args_res[$current_arg]
388 # special treatment for some functions
392 my ($extra_expected) = $_;
393 my ($run_extra) = ($extra_expected ne "IGNORE" ?
1 : 0);
395 $extra_expected = "0";
397 $extra_expected = apply_lit
($extra_expected);
399 $cline_res .= ", $run_extra, $extra_expected";
401 $cline_res =~ s/^, //;
402 $cline_res =~ s/plus_oflow/$plus_oflow[$rm]/g;
403 $cline_res =~ s/minus_oflow/$minus_oflow[$rm]/g;
404 $cline_res =~ s/plus_uflow/$plus_uflow[$rm]/g;
405 $cline_res =~ s/minus_uflow/$minus_uflow[$rm]/g;
406 $cline_res =~ s/ERRNO_PLUS_OFLOW/$errno_plus_oflow[$rm]/g;
407 $cline_res =~ s/ERRNO_MINUS_OFLOW/$errno_minus_oflow[$rm]/g;
408 $cline_res =~ s/ERRNO_PLUS_UFLOW/$errno_plus_uflow[$rm]/g;
409 $cline_res =~ s/ERRNO_MINUS_UFLOW/$errno_minus_uflow[$rm]/g;
410 $cline_res =~ s/XFAIL_ROUNDING_IBM128_LIBGCC/$xfail_rounding_ibm128_libgcc[$rm]/g;
411 $cline .= ", { $cline_res }";
413 print $file " $cline },\n";
416 # Convert a condition from auto-libm-test-out to C form.
417 sub convert_condition
{
420 @conds = split /:/, $cond;
425 $ret = join " && ", @conds;
429 # Return text to OR a value into an accumulated flags string.
439 # Return a conditional expression between two values.
441 my ($cond, $if, $else) = @_;
444 } elsif ($cond eq "0") {
447 return "($cond ? $if : $else)";
451 # Return text to OR a conditional expression between two values into
452 # an accumulated flags string.
454 my ($cond, $if, $else) = @_;
455 return or_value
(cond_value
($cond, $if, $else));
458 # Generate libm-test.c
459 sub generate_testfile
{
460 my ($input, $output) = @_;
462 open INPUT
, $input or die ("Can't open $input: $!");
463 open OUTPUT
, ">$output" or die ("Can't open $output: $!");
465 # Replace the special macros
467 # AUTO_TESTS (function),
468 if (/^\s*AUTO_TESTS_/) {
469 my ($descr, $func, @modes, $auto_test, $num_auto_tests);
470 my (@rm_tests, $rm, $i);
471 @modes = qw(downward tonearest towardzero upward);
472 ($descr, $func) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+)\)/);
473 for ($rm = 0; $rm <= 3; $rm++) {
474 $rm_tests[$rm] = [sort keys %{$auto_tests{$func}{$modes[$rm]}}];
476 $num_auto_tests = scalar @
{$rm_tests[0]};
477 for ($rm = 1; $rm <= 3; $rm++) {
478 if ($num_auto_tests != scalar @
{$rm_tests[$rm]}) {
479 die ("inconsistent numbers of tests for $func\n");
481 for ($i = 0; $i < $num_auto_tests; $i++) {
482 if ($rm_tests[0][$i] ne $rm_tests[$rm][$i]) {
483 die ("inconsistent list of tests of $func\n");
487 if ($num_auto_tests == 0) {
488 die ("no automatic tests for $func\n");
490 foreach $auto_test (@
{$rm_tests[0]}) {
491 my ($format, $inputs, $format_conv, $args_str);
492 ($format, $inputs) = split / /, $auto_test, 2;
494 $format_conv = convert_condition
($format);
495 print OUTPUT
"#if $format_conv\n";
496 $args_str = "$func, $inputs";
497 for ($rm = 0; $rm <= 3; $rm++) {
498 my ($auto_test_out, $outputs, $flags);
499 my ($flags_conv, @flags, %flag_cond);
500 $auto_test_out = $auto_tests{$func}{$modes[$rm]}{$auto_test};
501 ($outputs, $flags) = split / : */, $auto_test_out;
502 $outputs =~ s/ /, /g;
503 @flags = split / /, $flags;
505 if (/^([^:]*):(.*)$/) {
508 $cond = convert_condition
($2);
509 if (defined ($flag_cond{$flag})) {
510 if ($flag_cond{$flag} ne "1") {
511 $flag_cond{$flag} .= " || $cond";
514 $flag_cond{$flag} = $cond;
517 $flag_cond{$_} = "1";
521 if (defined ($flag_cond{"ignore-zero-inf-sign"})) {
522 $flags_conv .= or_cond_value
($flag_cond{"ignore-zero-inf-sign"},
523 "IGNORE_ZERO_INF_SIGN", "0");
525 if (defined ($flag_cond{"no-test-inline"})) {
526 $flags_conv .= or_cond_value
($flag_cond{"no-test-inline"},
527 "NO_TEST_INLINE", "0");
529 if (defined ($flag_cond{"xfail"})) {
530 $flags_conv .= or_cond_value
($flag_cond{"xfail"},
533 my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
535 foreach $exc (@exc_list) {
536 my ($exc_expected, $exc_ok, $no_exc, $exc_cond, $exc_ok_cond);
537 $exc_expected = "\U$exc\E_EXCEPTION";
538 $exc_ok = "\U$exc\E_EXCEPTION_OK";
540 if ($exc eq "inexact") {
542 $no_exc = "NO_INEXACT_EXCEPTION";
544 if (defined ($flag_cond{$exc})) {
545 $exc_cond = $flag_cond{$exc};
549 if (defined ($flag_cond{"$exc-ok"})) {
550 $exc_ok_cond = $flag_cond{"$exc-ok"};
554 $flags_conv .= or_cond_value
($exc_cond,
555 cond_value
($exc_ok_cond,
556 $exc_ok, $exc_expected),
557 cond_value
($exc_ok_cond,
560 my ($errno_expected, $errno_unknown_cond);
561 if (defined ($flag_cond{"errno-edom"})) {
562 if ($flag_cond{"errno-edom"} ne "1") {
563 die ("unexpected condition for errno-edom");
565 if (defined ($flag_cond{"errno-erange"})) {
566 die ("multiple errno values expected");
568 $errno_expected = "ERRNO_EDOM";
569 } elsif (defined ($flag_cond{"errno-erange"})) {
570 if ($flag_cond{"errno-erange"} ne "1") {
571 die ("unexpected condition for errno-erange");
573 $errno_expected = "ERRNO_ERANGE";
575 $errno_expected = "ERRNO_UNCHANGED";
577 if (defined ($flag_cond{"errno-edom-ok"})) {
578 if (defined ($flag_cond{"errno-erange-ok"})
579 && ($flag_cond{"errno-erange-ok"}
580 ne $flag_cond{"errno-edom-ok"})) {
581 $errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
583 $errno_unknown_cond = $flag_cond{"errno-edom-ok"};
585 } elsif (defined ($flag_cond{"errno-erange-ok"})) {
586 $errno_unknown_cond = $flag_cond{"errno-erange-ok"};
588 $errno_unknown_cond = "0";
590 $flags_conv .= or_cond_value
($errno_unknown_cond,
591 "0", $errno_expected);
592 if ($flags_conv eq "") {
593 $flags_conv = ", NO_EXCEPTION";
595 $flags_conv =~ s/^ \|/,/;
597 $args_str .= ", $outputs$flags_conv";
599 &parse_args
(\
*OUTPUT
, $descr, $args_str);
600 print OUTPUT
"#endif\n";
609 ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
610 &parse_args
(\
*OUTPUT
, $descr, $args);
624 my ($test, $type, $float, $eps, $float_regex);
626 # Build a basic regex to match type entries in the
627 # generated ULPS file.
628 foreach my $ftype (@all_floats) {
629 $float_regex .= "|" . $ftype;
631 $float_regex = "^" . substr ($float_regex, 1) . ":";
633 # $type has the following values:
634 # "normal": No complex variable
635 # "real": Real part of complex result
636 # "imag": Imaginary part of complex result
637 open ULP
, $file or die ("Can't open $file: $!");
640 # ignore comments and empty lines
644 if (/Real part of/) {
647 } elsif (/Imaginary part of/) {
648 s/Imaginary part of //;
653 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
656 if (/$float_regex/) {
657 ($float, $eps) = split /\s*:\s*/,$_,2;
663 if (!defined ($results{$test}{$type}{'ulp'}{$float})
664 || $results{$test}{$type}{'ulp'}{$float} < $eps) {
665 $results{$test}{$type}{'ulp'}{$float} = $eps;
666 $results{$test}{'has_ulps'} = 1;
669 if ($type =~ /^real|imag$/) {
670 $results{$test}{'type'} = 'complex';
671 } elsif ($type eq 'normal') {
672 $results{$test}{'type'} = 'normal';
676 print "Skipping unknown entry: `$_'\n";
682 # Clean up a floating point number
683 sub clean_up_number
{
686 # Remove trailing zeros after the decimal point
687 if ($number =~ /\./) {
694 # Output a file which can be read in as ulps file.
695 sub print_ulps_file
{
697 my ($test, $type, $float, $eps, $fct, $last_fct);
700 open NEWULP
, ">$file" or die ("Can't open $file: $!");
701 print NEWULP
"# Begin of automatic generation\n";
702 print NEWULP
"\n# Maximal error of functions:\n";
704 foreach $fct (sort keys %results) {
705 foreach $type ('real', 'imag', 'normal') {
706 if (exists $results{$fct}{$type}) {
707 if ($type eq 'normal') {
708 print NEWULP
"Function: \"$fct\":\n";
709 } elsif ($type eq 'real') {
710 print NEWULP
"Function: Real part of \"$fct\":\n";
711 } elsif ($type eq 'imag') {
712 print NEWULP
"Function: Imaginary part of \"$fct\":\n";
714 foreach $float (@all_floats) {
715 if (exists $results{$fct}{$type}{'ulp'}{$float}) {
716 print NEWULP
"$float: ",
717 &clean_up_number
($results{$fct}{$type}{'ulp'}{$float}),
725 print NEWULP
"# end of automatic generation\n";
730 my ($test, $type, $float) = @_;
732 return (exists $results{$test}{$type}{'ulp'}{$float}
733 ?
$results{$test}{$type}{'ulp'}{$float} : "0");
736 # Return the ulps value for a single test.
737 sub get_all_ulps_for_test
{
738 my ($test, $type) = @_;
739 my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
742 if (exists $results{$test}{'has_ulps'}) {
743 foreach $float (@all_floats) {
744 $ulps_str .= &get_ulps
($test, $type, $float) . ", ";
746 return "{" . substr ($ulps_str, 0, -2) . "}";
748 die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
754 my ($file, $ulps_filename) = @_;
755 my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag);
756 my (%func_ulps, %func_real_ulps, %func_imag_ulps);
758 open ULP
, ">$file" or die ("Can't open $file: $!");
760 print ULP
"/* This file is automatically generated\n";
761 print ULP
" from $ulps_filename with gen-libm-test.pl.\n";
762 print ULP
" Don't change it - change instead the master files. */\n\n";
764 print ULP
"struct ulp_data\n";
766 print ULP
" const char *name;\n";
767 print ULP
" FLOAT max_ulp[" . @all_floats . "];\n";
770 for ($i = 0; $i <= $#all_floats; $i++) {
771 $type = $all_floats[$i];
772 print ULP
"#define ULP_";
775 $type = substr $type, 1;
777 print ULP
"$all_floats_pfx{$type} $i\n";
780 foreach $fct (keys %results) {
781 $type = $results{$fct}{'type'};
782 if ($type eq 'normal') {
783 $ulp = get_all_ulps_for_test
($fct, 'normal');
784 } elsif ($type eq 'complex') {
785 $ulp_real = get_all_ulps_for_test
($fct, 'real');
786 $ulp_imag = get_all_ulps_for_test
($fct, 'imag');
788 die "unknown results ($fct) type $type\n";
790 if ($type eq 'normal') {
791 $func_ulps{$fct} = $ulp;
793 $func_real_ulps{$fct} = $ulp_real;
794 $func_imag_ulps{$fct} = $ulp_imag;
797 print ULP
"\n/* Maximal error of functions. */\n";
798 print ULP
"static const struct ulp_data func_ulps[] =\n {\n";
799 foreach $fct (sort keys %func_ulps) {
800 print ULP
" { \"$fct\", $func_ulps{$fct} },\n";
803 print ULP
"static const struct ulp_data func_real_ulps[] =\n {\n";
804 foreach $fct (sort keys %func_real_ulps) {
805 print ULP
" { \"$fct\", $func_real_ulps{$fct} },\n";
808 print ULP
"static const struct ulp_data func_imag_ulps[] =\n {\n";
809 foreach $fct (sort keys %func_imag_ulps) {
810 print ULP
" { \"$fct\", $func_imag_ulps{$fct} },\n";
816 # Parse auto-libm-test-out.
817 sub parse_auto_input
{
819 open AUTO
, $file or die ("Can't open $file: $!");
824 if (/^(\S+) (\S+) ([^:]*) : (.*)$/) {
825 $auto_tests{$1}{$2}{$3} = $4;
827 die ("bad automatic test line: $_\n");