cris: remove call to HIDDEN_JUMPTARGET
[uclibc-ng.git] / test / math / gen-libm-test.pl
blob0bb2b46a0463efdddb03415914537c2242f78b91
1 #!/usr/bin/perl -w
2 # Copyright (C) 1999 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; see the file COPYING.LIB. If
18 # not, see <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}{"kind"} is either "fct" or "test" and flags whether this
25 # is a maximal error of a function or a single test.
26 # $results{$test}{"type"} is the result type, e.g. normal or complex.
27 # $results{$test}{"has_ulps"} is set if deltas exist.
28 # $results{$test}{"has_fails"} is set if exptected failures exist.
29 # In the following description $type and $float are:
30 # - $type is either "normal", "real" (for the real part of a complex number)
31 # or "imag" (for the imaginary part # of a complex number).
32 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
33 # It represents the underlying floating point type (float, double or long
34 # double) and if inline functions (the leading i stands for inline)
35 # are used.
36 # $results{$test}{$type}{"fail"}{$float} is defined and has a 1 if
37 # the test is expected to fail
38 # $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
41 use Getopt::Std;
43 use strict;
45 use vars qw ($input $output);
46 use vars qw (%results);
47 use vars qw (@tests @functions);
48 use vars qw ($count);
49 use vars qw (%beautify @all_floats);
50 use vars qw ($output_dir $ulps_file);
52 # all_floats is sorted and contains all recognised float types
53 @all_floats = ('double', 'float', 'idouble',
54 'ifloat', 'ildouble', 'ldouble');
56 %beautify =
57 ( "minus_zero" => "-0",
58 "plus_zero" => "+0",
59 "minus_infty" => "-inf",
60 "plus_infty" => "inf",
61 "nan_value" => "NaN",
62 "M_El" => "e",
63 "M_E2l" => "e^2",
64 "M_E3l" => "e^3",
65 "M_LOG10El", "log10(e)",
66 "M_PIl" => "pi",
67 "M_PI_34l" => "3/4 pi",
68 "M_PI_2l" => "pi/2",
69 "M_PI_4l" => "pi/4",
70 "M_PI_6l" => "pi/6",
71 "M_PI_34_LOG10El" => "3/4 pi*log10(e)",
72 "M_PI_LOG10El" => "pi*log10(e)",
73 "M_PI2_LOG10El" => "pi/2*log10(e)",
74 "M_PI4_LOG10El" => "pi/4*log10(e)",
75 "M_LOG_SQRT_PIl" => "log(sqrt(pi))",
76 "M_LOG_2_SQRT_PIl" => "log(2*sqrt(pi))",
77 "M_2_SQRT_PIl" => "2 sqrt (pi)",
78 "M_SQRT_PIl" => "sqrt (pi)",
79 "INVALID_EXCEPTION" => "invalid exception",
80 "DIVIDE_BY_ZERO_EXCEPTION" => "division by zero exception",
81 "INVALID_EXCEPTION_OK" => "invalid exception allowed",
82 "DIVIDE_BY_ZERO_EXCEPTION_OK" => "division by zero exception allowed",
83 "EXCEPTIONS_OK" => "exceptions allowed",
84 "IGNORE_ZERO_INF_SIGN" => "sign of zero/inf not specified",
85 "INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN" => "invalid exception and sign of zero/inf not specified"
89 # get Options
90 # Options:
91 # u: ulps-file
92 # h: help
93 # o: output-directory
94 # n: generate new ulps file
95 use vars qw($opt_u $opt_h $opt_o $opt_n);
96 getopts('u:o:nh');
98 $ulps_file = 'libm-test-ulps';
99 $output_dir = '';
101 if ($opt_h) {
102 print "Usage: gen-libm-test.pl [OPTIONS]\n";
103 print " -h print this help, then exit\n";
104 print " -o DIR directory where generated files will be placed\n";
105 print " -n only generate sorted file NewUlps from libm-test-ulps\n";
106 print " -u FILE input file with ulps\n";
107 exit 0;
110 $ulps_file = $opt_u if ($opt_u);
111 $output_dir = $opt_o if ($opt_o);
113 $input = "libm-test.inc";
114 $output = "${output_dir}libm-test.c";
116 $count = 0;
118 &parse_ulps ($ulps_file);
119 &generate_testfile ($input, $output) unless ($opt_n);
120 &output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
121 &print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
123 # Return a nicer representation
124 sub beautify {
125 my ($arg) = @_;
126 my ($tmp);
128 if (exists $beautify{$arg}) {
129 return $beautify{$arg};
131 if ($arg =~ /^-/) {
132 $tmp = $arg;
133 $tmp =~ s/^-//;
134 if (exists $beautify{$tmp}) {
135 return '-' . $beautify{$tmp};
138 if ($arg =~ /[0-9]L$/) {
139 $arg =~ s/L$//;
141 return $arg;
144 # Return a nicer representation of a complex number
145 sub build_complex_beautify {
146 my ($r, $i) = @_;
147 my ($str1, $str2);
149 $str1 = &beautify ($r);
150 $str2 = &beautify ($i);
151 if ($str2 =~ /^-/) {
152 $str2 =~ s/^-//;
153 $str1 .= ' - ' . $str2;
154 } else {
155 $str1 .= ' + ' . $str2;
157 $str1 .= ' i';
158 return $str1;
161 # Return name of a variable
162 sub get_variable {
163 my ($number) = @_;
165 return "x" if ($number == 1);
166 return "y" if ($number == 2);
167 return "z" if ($number == 3);
168 # return x1,x2,...
169 $number =-3;
170 return "x$number";
173 # Add a new test to internal data structures and fill in the
174 # ulps, failures and exception information for the C line.
175 sub new_test {
176 my ($test, $exception) = @_;
177 my $rest;
179 # Add ulp, xfail
180 if (exists $results{$test}{'has_ulps'}) {
181 $rest = ", DELTA$count";
182 } else {
183 $rest = ', 0';
185 if (exists $results{$test}{'has_fails'}) {
186 $rest .= ", FAIL$count";
187 } else {
188 $rest .= ', 0';
190 if (defined $exception) {
191 $rest .= ", $exception";
192 } else {
193 $rest .= ', 0';
195 $rest .= ");\n";
196 # We must increment here to keep @tests and count in sync
197 push @tests, $test;
198 ++$count;
199 return $rest;
202 # Treat some functions especially.
203 # Currently only sincos needs extra treatment.
204 sub special_functions {
205 my ($file, $args) = @_;
206 my (@args, $str, $test, $cline);
208 @args = split /,\s*/, $args;
210 unless ($args[0] =~ /sincos/) {
211 die ("Don't know how to handle $args[0] extra.");
213 print $file " FUNC (sincos) ($args[1], &sin_res, &cos_res);\n";
215 $str = 'sincos (' . &beautify ($args[1]) . ', &sin_res, &cos_res)';
216 # handle sin
217 $test = $str . ' puts ' . &beautify ($args[2]) . ' in sin_res';
218 if ($#args == 4) {
219 $test .= " plus " . &beautify ($args[4]);
222 $cline = " check_float (\"$test\", sin_res, $args[2]";
223 $cline .= &new_test ($test, $args[4]);
224 print $file $cline;
226 # handle cos
227 $test = $str . ' puts ' . &beautify ($args[3]) . ' in cos_res';
228 $cline = " check_float (\"$test\", cos_res, $args[3]";
229 # only tests once for exception
230 $cline .= &new_test ($test, undef);
231 print $file $cline;
234 # Parse the arguments to TEST_x_y
235 sub parse_args {
236 my ($file, $descr, $args) = @_;
237 my (@args, $str, $descr_args, $descr_res, @descr);
238 my ($current_arg, $cline, $i);
239 my ($pre, $post, @special);
240 my ($extra_var, $call, $c_call);
242 if ($descr eq 'extra') {
243 &special_functions ($file, $args);
244 return;
246 ($descr_args, $descr_res) = split /_/,$descr, 2;
248 @args = split /,\s*/, $args;
250 $call = "$args[0] (";
252 # Generate first the string that's shown to the user
253 $current_arg = 1;
254 $extra_var = 0;
255 @descr = split //,$descr_args;
256 for ($i = 0; $i <= $#descr; $i++) {
257 if ($i >= 1) {
258 $call .= ', ';
260 # FLOAT, int, long int, long long int
261 if ($descr[$i] =~ /f|i|l|L/) {
262 $call .= &beautify ($args[$current_arg]);
263 ++$current_arg;
264 next;
266 # &FLOAT, &int - argument is added here
267 if ($descr[$i] =~ /F|I/) {
268 ++$extra_var;
269 $call .= '&' . &get_variable ($extra_var);
270 next;
272 # complex
273 if ($descr[$i] eq 'c') {
274 $call .= &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
275 $current_arg += 2;
276 next;
279 die ("$descr[$i] is unknown");
281 $call .= ')';
282 $str = "$call == ";
284 # Result
285 @descr = split //,$descr_res;
286 foreach (@descr) {
287 if ($_ =~ /f|i|l|L/) {
288 $str .= &beautify ($args[$current_arg]);
289 ++$current_arg;
290 } elsif ($_ eq 'c') {
291 $str .= &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
292 $current_arg += 2;
293 } elsif ($_ eq 'b') {
294 # boolean
295 $str .= ($args[$current_arg] == 0) ? "false" : "true";
296 ++$current_arg;
297 } elsif ($_ eq '1') {
298 ++$current_arg;
299 } else {
300 die ("$_ is unknown");
303 # consistency check
304 if ($current_arg == $#args) {
305 die ("wrong number of arguments")
306 unless ($args[$current_arg] =~ /EXCEPTION|IGNORE_ZERO_INF_SIGN/);
307 } elsif ($current_arg < $#args) {
308 die ("wrong number of arguments");
309 } elsif ($current_arg > ($#args+1)) {
310 die ("wrong number of arguments");
314 # check for exceptions
315 if ($current_arg <= $#args) {
316 $str .= " plus " . &beautify ($args[$current_arg]);
319 # Put the C program line together
320 # Reset some variables to start again
321 $current_arg = 1;
322 $extra_var = 0;
323 if (substr($descr_res,0,1) eq 'f') {
324 $cline = 'check_float'
325 } elsif (substr($descr_res,0,1) eq 'b') {
326 $cline = 'check_bool';
327 } elsif (substr($descr_res,0,1) eq 'c') {
328 $cline = 'check_complex';
329 } elsif (substr($descr_res,0,1) eq 'i') {
330 $cline = 'check_int';
331 } elsif (substr($descr_res,0,1) eq 'l') {
332 $cline = 'check_long';
333 } elsif (substr($descr_res,0,1) eq 'L') {
334 $cline = 'check_longlong';
336 # Special handling for some macros:
337 $cline .= " (\"$str\", ";
338 if ($args[0] =~ /fpclassify|isnormal|isfinite|signbit/) {
339 $c_call = "$args[0] (";
340 } else {
341 $c_call = " FUNC($args[0]) (";
343 @descr = split //,$descr_args;
344 for ($i=0; $i <= $#descr; $i++) {
345 if ($i >= 1) {
346 $c_call .= ', ';
348 # FLOAT, int, long int, long long int
349 if ($descr[$i] =~ /f|i|l|L/) {
350 $c_call .= $args[$current_arg];
351 $current_arg++;
352 next;
354 # &FLOAT, &int
355 if ($descr[$i] =~ /F|I/) {
356 ++$extra_var;
357 $c_call .= '&' . &get_variable ($extra_var);
358 next;
360 # complex
361 if ($descr[$i] eq 'c') {
362 $c_call .= "BUILD_COMPLEX ($args[$current_arg], $args[$current_arg+1])";
363 $current_arg += 2;
364 next;
367 $c_call .= ')';
368 $cline .= "$c_call, ";
370 @descr = split //,$descr_res;
371 foreach (@descr) {
372 if ($_ =~ /b|f|i|l|L/ ) {
373 $cline .= $args[$current_arg];
374 $current_arg++;
375 } elsif ($_ eq 'c') {
376 $cline .= "BUILD_COMPLEX ($args[$current_arg], $args[$current_arg+1])";
377 $current_arg += 2;
378 } elsif ($_ eq '1') {
379 push @special, $args[$current_arg];
380 ++$current_arg;
383 # Add ulp, xfail
384 $cline .= &new_test ($str, ($current_arg <= $#args) ? $args[$current_arg] : undef);
386 # special treatment for some functions
387 if ($args[0] eq 'frexp') {
388 if (defined $special[0] && $special[0] ne "IGNORE") {
389 my ($str) = "$call sets x to $special[0]";
390 $post = " check_int (\"$str\", x, $special[0]";
391 $post .= &new_test ($str, undef);
393 } elsif ($args[0] eq 'gamma' || $args[0] eq 'lgamma') {
394 $pre = " signgam = 0;\n";
395 if (defined $special[0] && $special[0] ne "IGNORE") {
396 my ($str) = "$call sets signgam to $special[0]";
397 $post = " check_int (\"$str\", signgam, $special[0]";
398 $post .= &new_test ($str, undef);
400 } elsif ($args[0] eq 'modf') {
401 if (defined $special[0] && $special[0] ne "IGNORE") {
402 my ($str) = "$call sets x to $special[0]";
403 $post = " check_float (\"$str\", x, $special[0]";
404 $post .= &new_test ($str, undef);
406 } elsif ($args[0] eq 'remquo') {
407 if (defined $special[0] && $special[0] ne "IGNORE") {
408 my ($str) = "$call sets x to $special[0]";
409 $post = " check_int (\"$str\", x, $special[0]";
410 $post .= &new_test ($str, undef);
414 print $file $pre if (defined $pre);
416 print $file " $cline";
418 print $file $post if (defined $post);
421 # Generate libm-test.c
422 sub generate_testfile {
423 my ($input, $output) = @_;
424 my ($lasttext);
425 my (@args, $i, $str);
427 open INPUT, $input or die ("Can't open $input: $!");
428 open OUTPUT, ">$output" or die ("Can't open $output: $!");
430 # Replace the special macros
431 while (<INPUT>) {
433 # TEST_...
434 if (/^\s*TEST_/) {
435 my ($descr, $args);
436 chop;
437 ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
438 &parse_args (\*OUTPUT, $descr, $args);
439 next;
441 # START (function)
442 if (/START/) {
443 print OUTPUT " init_max_error ();\n";
444 next;
446 # END (function)
447 if (/END/) {
448 my ($fct, $line, $type);
449 if (/complex/) {
450 s/,\s*complex\s*//;
451 $type = 'complex';
452 } else {
453 $type = 'normal';
455 ($fct) = ($_ =~ /END\s*\((.*)\)/);
456 if ($type eq 'complex') {
457 $line = " print_complex_max_error (\"$fct\", ";
458 } else {
459 $line = " print_max_error (\"$fct\", ";
461 if (exists $results{$fct}{'has_ulps'}) {
462 $line .= "DELTA$fct";
463 } else {
464 $line .= '0';
466 if (exists $results{$fct}{'has_fails'}) {
467 $line .= ", FAIL$fct";
468 } else {
469 $line .= ', 0';
471 $line .= ");\n";
472 print OUTPUT $line;
473 push @functions, $fct;
474 next;
476 print OUTPUT;
478 close INPUT;
479 close OUTPUT;
484 # Parse ulps file
485 sub parse_ulps {
486 my ($file) = @_;
487 my ($test, $type, $float, $eps, $kind);
489 # $type has the following values:
490 # "normal": No complex variable
491 # "real": Real part of complex result
492 # "imag": Imaginary part of complex result
493 open ULP, $file or die ("Can't open $file: $!");
494 while (<ULP>) {
495 chop;
496 # ignore comments and empty lines
497 next if /^#/;
498 next if /^\s*$/;
499 if (/^Test/) {
500 if (/Real part of:/) {
501 s/Real part of: //;
502 $type = 'real';
503 } elsif (/Imaginary part of:/) {
504 s/Imaginary part of: //;
505 $type = 'imag';
506 } else {
507 $type = 'normal';
509 s/^.+\"(.*)\".*$/$1/;
510 $test = $_;
511 $kind = 'test';
512 next;
514 if (/^Function: /) {
515 if (/Real part of/) {
516 s/Real part of //;
517 $type = 'real';
518 } elsif (/Imaginary part of/) {
519 s/Imaginary part of //;
520 $type = 'imag';
521 } else {
522 $type = 'normal';
524 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
525 $kind = 'fct';
526 next;
528 if (/^i?(float|double|ldouble):/) {
529 ($float, $eps) = split /\s*:\s*/,$_,2;
531 if ($eps eq 'fail') {
532 $results{$test}{$type}{'fail'}{$float} = 1;
533 $results{$test}{'has_fails'} = 1;
534 } elsif ($eps eq "0") {
535 # ignore
536 next;
537 } else {
538 $results{$test}{$type}{'ulp'}{$float} = $eps;
539 $results{$test}{'has_ulps'} = 1;
541 if ($type =~ /^real|imag$/) {
542 $results{$test}{'type'} = 'complex';
543 } elsif ($type eq 'normal') {
544 $results{$test}{'type'} = 'normal';
546 $results{$test}{'kind'} = $kind;
547 next;
549 print "Skipping unknown entry: `$_'\n";
551 close ULP;
555 # Clean up a floating point number
556 sub clean_up_number {
557 my ($number) = @_;
559 # Remove trailing zeros
560 $number =~ s/0+$//;
561 $number =~ s/\.$//;
562 return $number;
565 # Output a file which can be read in as ulps file.
566 sub print_ulps_file {
567 my ($file) = @_;
568 my ($test, $type, $float, $eps, $fct, $last_fct);
570 $last_fct = '';
571 open NEWULP, ">$file" or die ("Can't open $file: $!");
572 print NEWULP "# Begin of automatic generation\n";
573 # first the function calls
574 foreach $test (sort keys %results) {
575 next if ($results{$test}{'kind'} ne 'test');
576 foreach $type ('real', 'imag', 'normal') {
577 if (exists $results{$test}{$type}) {
578 if (defined $results{$test}) {
579 ($fct) = ($test =~ /^(\w+)\s/);
580 if ($fct ne $last_fct) {
581 $last_fct = $fct;
582 print NEWULP "\n# $fct\n";
585 if ($type eq 'normal') {
586 print NEWULP "Test \"$test\":\n";
587 } elsif ($type eq 'real') {
588 print NEWULP "Test \"Real part of: $test\":\n";
589 } elsif ($type eq 'imag') {
590 print NEWULP "Test \"Imaginary part of: $test\":\n";
592 foreach $float (@all_floats) {
593 if (exists $results{$test}{$type}{'ulp'}{$float}) {
594 print NEWULP "$float: ",
595 &clean_up_number ($results{$test}{$type}{'ulp'}{$float}),
596 "\n";
598 if (exists $results{$test}{$type}{'fail'}{$float}) {
599 print NEWULP "$float: fail\n";
605 print NEWULP "\n# Maximal error of functions:\n";
607 foreach $fct (sort keys %results) {
608 next if ($results{$fct}{'kind'} ne 'fct');
609 foreach $type ('real', 'imag', 'normal') {
610 if (exists $results{$fct}{$type}) {
611 if ($type eq 'normal') {
612 print NEWULP "Function: \"$fct\":\n";
613 } elsif ($type eq 'real') {
614 print NEWULP "Function: Real part of \"$fct\":\n";
615 } elsif ($type eq 'imag') {
616 print NEWULP "Function: Imaginary part of \"$fct\":\n";
618 foreach $float (@all_floats) {
619 if (exists $results{$fct}{$type}{'ulp'}{$float}) {
620 print NEWULP "$float: ",
621 &clean_up_number ($results{$fct}{$type}{'ulp'}{$float}),
622 "\n";
624 if (exists $results{$fct}{$type}{'fail'}{$float}) {
625 print NEWULP "$float: fail\n";
628 print NEWULP "\n";
632 print NEWULP "# end of automatic generation\n";
633 close NEWULP;
636 sub get_ulps {
637 my ($test, $type, $float) = @_;
639 if ($type eq 'complex') {
640 my ($res);
641 # Return 0 instead of BUILD_COMPLEX (0,0)
642 if (!exists $results{$test}{'real'}{'ulp'}{$float} &&
643 !exists $results{$test}{'imag'}{'ulp'}{$float}) {
644 return "0";
646 $res = 'BUILD_COMPLEX (';
647 $res .= (exists $results{$test}{'real'}{'ulp'}{$float}
648 ? $results{$test}{'real'}{'ulp'}{$float} : "0");
649 $res .= ', ';
650 $res .= (exists $results{$test}{'imag'}{'ulp'}{$float}
651 ? $results{$test}{'imag'}{'ulp'}{$float} : "0");
652 $res .= ')';
653 return $res;
655 return (exists $results{$test}{'normal'}{'ulp'}{$float}
656 ? $results{$test}{'normal'}{'ulp'}{$float} : "0");
659 sub get_failure {
660 my ($test, $type, $float) = @_;
661 if ($type eq 'complex') {
662 # return x,y
663 my ($res);
664 # Return 0 instead of BUILD_COMPLEX_INT (0,0)
665 if (!exists $results{$test}{'real'}{'ulp'}{$float} &&
666 !exists $results{$test}{'imag'}{'ulp'}{$float}) {
667 return "0";
669 $res = 'BUILD_COMPLEX_INT (';
670 $res .= (exists $results{$test}{'real'}{'fail'}{$float}
671 ? $results{$test}{'real'}{'fail'}{$float} : "0");
672 $res .= ', ';
673 $res .= (exists $results{$test}{'imag'}{'fail'}{$float}
674 ? $results{$test}{'imag'}{'fail'}{$float} : "0");
675 $res .= ')';
676 return $res;
678 return (exists $results{$test}{'normal'}{'fail'}{$float}
679 ? $results{$test}{'normal'}{'fail'}{$float} : "0");
683 # Output the defines for a single test
684 sub output_test {
685 my ($file, $test, $name) = @_;
686 my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
687 my ($type);
689 # Do we have ulps/failures?
690 if (!exists $results{$test}{'type'}) {
691 return;
693 $type = $results{$test}{'type'};
694 if (exists $results{$test}{'has_ulps'}) {
695 # XXX use all_floats (change order!)
696 $ldouble = &get_ulps ($test, $type, "ldouble");
697 $double = &get_ulps ($test, $type, "double");
698 $float = &get_ulps ($test, $type, "float");
699 $ildouble = &get_ulps ($test, $type, "ildouble");
700 $idouble = &get_ulps ($test, $type, "idouble");
701 $ifloat = &get_ulps ($test, $type, "ifloat");
702 print $file "#define DELTA$name CHOOSE($ldouble, $double, $float, $ildouble, $idouble, $ifloat)\t/* $test */\n";
705 if (exists $results{$test}{'has_fails'}) {
706 $ldouble = &get_failure ($test, "ldouble");
707 $double = &get_failure ($test, "double");
708 $float = &get_failure ($test, "float");
709 $ildouble = &get_failure ($test, "ildouble");
710 $idouble = &get_failure ($test, "idouble");
711 $ifloat = &get_failure ($test, "ifloat");
712 print $file "#define FAIL$name CHOOSE($ldouble, $double, $float $ildouble, $idouble, $ifloat)\t/* $test */\n";
716 # Print include file
717 sub output_ulps {
718 my ($file, $ulps_filename) = @_;
719 my ($i, $fct);
721 open ULP, ">$file" or die ("Can't open $file: $!");
723 print ULP "/* This file is automatically generated\n";
724 print ULP " from $ulps_filename with gen-libm-test.pl.\n";
725 print ULP " Don't change it - change instead the master files. */\n\n";
727 print ULP "\n/* Maximal error of functions. */\n";
728 foreach $fct (@functions) {
729 output_test (\*ULP, $fct, $fct);
732 print ULP "\n/* Error of single function calls. */\n";
733 for ($i = 0; $i < $count; $i++) {
734 output_test (\*ULP, $tests[$i], $i);
736 close ULP;