Update sysdeps/x86_64/fpu/libm-test-ulps
[glibc.git] / math / gen-libm-test.pl
blob395bb655132302882d9adbfecab74a60f3248b71
1 #!/usr/bin/perl -w
2 # Copyright (C) 1999-2012 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}{"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 "OVERFLOW_EXCEPTION" => "overflow exception",
82 "INVALID_EXCEPTION_OK" => "invalid exception allowed",
83 "DIVIDE_BY_ZERO_EXCEPTION_OK" => "division by zero exception allowed",
84 "OVERFLOW_EXCEPTION_OK" => "overflow exception allowed",
85 "EXCEPTIONS_OK" => "exceptions allowed",
86 "IGNORE_ZERO_INF_SIGN" => "sign of zero/inf not specified",
87 "INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN" => "invalid exception and sign of zero/inf not specified"
91 # get Options
92 # Options:
93 # u: ulps-file
94 # h: help
95 # o: output-directory
96 # n: generate new ulps file
97 use vars qw($opt_u $opt_h $opt_o $opt_n);
98 getopts('u:o:nh');
100 $ulps_file = 'libm-test-ulps';
101 $output_dir = '';
103 if ($opt_h) {
104 print "Usage: gen-libm-test.pl [OPTIONS]\n";
105 print " -h print this help, then exit\n";
106 print " -o DIR directory where generated files will be placed\n";
107 print " -n only generate sorted file NewUlps from libm-test-ulps\n";
108 print " -u FILE input file with ulps\n";
109 exit 0;
112 $ulps_file = $opt_u if ($opt_u);
113 $output_dir = $opt_o if ($opt_o);
115 $input = "libm-test.inc";
116 $output = "${output_dir}libm-test.c";
118 $count = 0;
120 &parse_ulps ($ulps_file);
121 &generate_testfile ($input, $output) unless ($opt_n);
122 &output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
123 &print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
125 # Return a nicer representation
126 sub beautify {
127 my ($arg) = @_;
128 my ($tmp);
130 if (exists $beautify{$arg}) {
131 return $beautify{$arg};
133 if ($arg =~ /^-/) {
134 $tmp = $arg;
135 $tmp =~ s/^-//;
136 if (exists $beautify{$tmp}) {
137 return '-' . $beautify{$tmp};
140 if ($arg =~ /[0-9]L$/) {
141 $arg =~ s/L$//;
143 return $arg;
146 # Return a nicer representation of a complex number
147 sub build_complex_beautify {
148 my ($r, $i) = @_;
149 my ($str1, $str2);
151 $str1 = &beautify ($r);
152 $str2 = &beautify ($i);
153 if ($str2 =~ /^-/) {
154 $str2 =~ s/^-//;
155 $str1 .= ' - ' . $str2;
156 } else {
157 $str1 .= ' + ' . $str2;
159 $str1 .= ' i';
160 return $str1;
163 # Return name of a variable
164 sub get_variable {
165 my ($number) = @_;
167 return "x" if ($number == 1);
168 return "y" if ($number == 2);
169 return "z" if ($number == 3);
170 # return x1,x2,...
171 $number =-3;
172 return "x$number";
175 # Add a new test to internal data structures and fill in the
176 # ulps, failures and exception information for the C line.
177 sub new_test {
178 my ($test, $exception) = @_;
179 my $rest;
181 # Add ulp, xfail
182 if (exists $results{$test}{'has_ulps'}) {
183 $rest = ", DELTA$count";
184 } else {
185 $rest = ', 0';
187 if (exists $results{$test}{'has_fails'}) {
188 $rest .= ", FAIL$count";
189 } else {
190 $rest .= ', 0';
192 if (defined $exception) {
193 $rest .= ", $exception";
194 } else {
195 $rest .= ', 0';
197 $rest .= ");\n";
198 # We must increment here to keep @tests and count in sync
199 push @tests, $test;
200 ++$count;
201 return $rest;
204 # Treat some functions especially.
205 # Currently only sincos needs extra treatment.
206 sub special_functions {
207 my ($file, $args) = @_;
208 my (@args, $str, $test, $cline);
210 @args = split /,\s*/, $args;
212 unless ($args[0] =~ /sincos/) {
213 die ("Don't know how to handle $args[0] extra.");
215 print $file " FUNC (sincos) ($args[1], &sin_res, &cos_res);\n";
217 $str = 'sincos (' . &beautify ($args[1]) . ', &sin_res, &cos_res)';
218 # handle sin
219 $test = $str . ' puts ' . &beautify ($args[2]) . ' in sin_res';
220 if ($#args == 4) {
221 $test .= " plus " . &beautify ($args[4]);
224 $cline = " check_float (\"$test\", sin_res, $args[2]";
225 $cline .= &new_test ($test, $args[4]);
226 print $file $cline;
228 # handle cos
229 $test = $str . ' puts ' . &beautify ($args[3]) . ' in cos_res';
230 $cline = " check_float (\"$test\", cos_res, $args[3]";
231 # only tests once for exception
232 $cline .= &new_test ($test, undef);
233 print $file $cline;
236 # Parse the arguments to TEST_x_y
237 sub parse_args {
238 my ($file, $descr, $fct, $args) = @_;
239 my (@args, $str, $descr_args, $descr_res, @descr);
240 my ($current_arg, $cline, $i);
241 my ($pre, $post, @special);
242 my ($extra_var, $call, $c_call);
244 if ($descr eq 'extra') {
245 &special_functions ($file, $args);
246 return;
248 ($descr_args, $descr_res) = split /_/,$descr, 2;
250 @args = split /,\s*/, $args;
252 $call = "$fct (";
254 # Generate first the string that's shown to the user
255 $current_arg = 1;
256 $extra_var = 0;
257 @descr = split //,$descr_args;
258 for ($i = 0; $i <= $#descr; $i++) {
259 if ($i >= 1) {
260 $call .= ', ';
262 # FLOAT, int, long int, long long int
263 if ($descr[$i] =~ /f|i|l|L/) {
264 $call .= &beautify ($args[$current_arg]);
265 ++$current_arg;
266 next;
268 # &FLOAT, &int - argument is added here
269 if ($descr[$i] =~ /F|I/) {
270 ++$extra_var;
271 $call .= '&' . &get_variable ($extra_var);
272 next;
274 # complex
275 if ($descr[$i] eq 'c') {
276 $call .= &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
277 $current_arg += 2;
278 next;
281 die ("$descr[$i] is unknown");
283 $call .= ')';
284 $str = "$call == ";
286 # Result
287 @descr = split //,$descr_res;
288 foreach (@descr) {
289 if ($_ =~ /f|i|l|L/) {
290 $str .= &beautify ($args[$current_arg]);
291 ++$current_arg;
292 } elsif ($_ eq 'c') {
293 $str .= &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
294 $current_arg += 2;
295 } elsif ($_ eq 'b') {
296 # boolean
297 $str .= ($args[$current_arg] == 0) ? "false" : "true";
298 ++$current_arg;
299 } elsif ($_ eq '1') {
300 ++$current_arg;
301 } else {
302 die ("$_ is unknown");
305 # consistency check
306 if ($current_arg == $#args) {
307 die ("wrong number of arguments")
308 unless ($args[$current_arg] =~ /EXCEPTION|IGNORE_ZERO_INF_SIGN/);
309 } elsif ($current_arg < $#args) {
310 die ("wrong number of arguments");
311 } elsif ($current_arg > ($#args+1)) {
312 die ("wrong number of arguments");
316 # check for exceptions
317 if ($current_arg <= $#args) {
318 $str .= " plus " . &beautify ($args[$current_arg]);
321 # Put the C program line together
322 # Reset some variables to start again
323 $current_arg = 1;
324 $extra_var = 0;
325 if (substr($descr_res,0,1) eq 'f') {
326 $cline = 'check_float'
327 } elsif (substr($descr_res,0,1) eq 'b') {
328 $cline = 'check_bool';
329 } elsif (substr($descr_res,0,1) eq 'c') {
330 $cline = 'check_complex';
331 } elsif (substr($descr_res,0,1) eq 'i') {
332 $cline = 'check_int';
333 } elsif (substr($descr_res,0,1) eq 'l') {
334 $cline = 'check_long';
335 } elsif (substr($descr_res,0,1) eq 'L') {
336 $cline = 'check_longlong';
338 # Special handling for some macros:
339 $cline .= " (\"$str\", ";
340 if ($args[0] =~ /fpclassify|isnormal|isfinite|signbit/) {
341 $c_call = "$args[0] (";
342 } else {
343 $c_call = " FUNC($args[0]) (";
345 @descr = split //,$descr_args;
346 for ($i=0; $i <= $#descr; $i++) {
347 if ($i >= 1) {
348 $c_call .= ', ';
350 # FLOAT, int, long int, long long int
351 if ($descr[$i] =~ /f|i|l|L/) {
352 $c_call .= $args[$current_arg];
353 $current_arg++;
354 next;
356 # &FLOAT, &int
357 if ($descr[$i] =~ /F|I/) {
358 ++$extra_var;
359 $c_call .= '&' . &get_variable ($extra_var);
360 next;
362 # complex
363 if ($descr[$i] eq 'c') {
364 $c_call .= "BUILD_COMPLEX ($args[$current_arg], $args[$current_arg+1])";
365 $current_arg += 2;
366 next;
369 $c_call .= ')';
370 $cline .= "$c_call, ";
372 @descr = split //,$descr_res;
373 foreach (@descr) {
374 if ($_ =~ /b|f|i|l|L/ ) {
375 $cline .= $args[$current_arg];
376 $current_arg++;
377 } elsif ($_ eq 'c') {
378 $cline .= "BUILD_COMPLEX ($args[$current_arg], $args[$current_arg+1])";
379 $current_arg += 2;
380 } elsif ($_ eq '1') {
381 push @special, $args[$current_arg];
382 ++$current_arg;
385 # Add ulp, xfail
386 $cline .= &new_test ($str, ($current_arg <= $#args) ? $args[$current_arg] : undef);
388 # special treatment for some functions
389 if ($args[0] eq 'frexp') {
390 if (defined $special[0] && $special[0] ne "IGNORE") {
391 my ($str) = "$call sets x to $special[0]";
392 $post = " check_int (\"$str\", x, $special[0]";
393 $post .= &new_test ($str, undef);
395 } elsif ($args[0] eq 'gamma' || $args[0] eq 'lgamma') {
396 $pre = " signgam = 0;\n";
397 if (defined $special[0] && $special[0] ne "IGNORE") {
398 my ($str) = "$call sets signgam to $special[0]";
399 $post = " check_int (\"$str\", signgam, $special[0]";
400 $post .= &new_test ($str, undef);
402 } elsif ($args[0] eq 'modf') {
403 if (defined $special[0] && $special[0] ne "IGNORE") {
404 my ($str) = "$call sets x to $special[0]";
405 $post = " check_float (\"$str\", x, $special[0]";
406 $post .= &new_test ($str, undef);
408 } elsif ($args[0] eq 'remquo') {
409 if (defined $special[0] && $special[0] ne "IGNORE") {
410 my ($str) = "$call sets x to $special[0]";
411 $post = " check_int (\"$str\", x, $special[0]";
412 $post .= &new_test ($str, undef);
416 print $file $pre if (defined $pre);
418 print $file " $cline";
420 print $file $post if (defined $post);
423 # Generate libm-test.c
424 sub generate_testfile {
425 my ($input, $output) = @_;
426 my ($lasttext);
427 my (@args, $i, $str, $thisfct);
429 open INPUT, $input or die ("Can't open $input: $!");
430 open OUTPUT, ">$output" or die ("Can't open $output: $!");
432 # Replace the special macros
433 while (<INPUT>) {
435 # TEST_...
436 if (/^\s*TEST_/) {
437 my ($descr, $args);
438 chop;
439 ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
440 &parse_args (\*OUTPUT, $descr, $thisfct, $args);
441 next;
443 # START (function)
444 if (/START/) {
445 ($thisfct) = ($_ =~ /START\s*\((.*)\)/);
446 print OUTPUT " init_max_error ();\n";
447 next;
449 # END (function)
450 if (/END/) {
451 my ($fct, $line, $type);
452 if (/complex/) {
453 s/,\s*complex\s*//;
454 $type = 'complex';
455 } else {
456 $type = 'normal';
458 ($fct) = ($_ =~ /END\s*\((.*)\)/);
459 if ($type eq 'complex') {
460 $line = " print_complex_max_error (\"$fct\", ";
461 } else {
462 $line = " print_max_error (\"$fct\", ";
464 if (exists $results{$fct}{'has_ulps'}) {
465 $line .= "DELTA$fct";
466 } else {
467 $line .= '0';
469 if (exists $results{$fct}{'has_fails'}) {
470 $line .= ", FAIL$fct";
471 } else {
472 $line .= ', 0';
474 $line .= ");\n";
475 print OUTPUT $line;
476 push @functions, $fct;
477 next;
479 print OUTPUT;
481 close INPUT;
482 close OUTPUT;
487 # Parse ulps file
488 sub parse_ulps {
489 my ($file) = @_;
490 my ($test, $type, $float, $eps, $kind);
492 # $type has the following values:
493 # "normal": No complex variable
494 # "real": Real part of complex result
495 # "imag": Imaginary part of complex result
496 open ULP, $file or die ("Can't open $file: $!");
497 while (<ULP>) {
498 chop;
499 # ignore comments and empty lines
500 next if /^#/;
501 next if /^\s*$/;
502 if (/^Test/) {
503 if (/Real part of:/) {
504 s/Real part of: //;
505 $type = 'real';
506 } elsif (/Imaginary part of:/) {
507 s/Imaginary part of: //;
508 $type = 'imag';
509 } else {
510 $type = 'normal';
512 s/^.+\"(.*)\".*$/$1/;
513 $test = $_;
514 $kind = 'test';
515 next;
517 if (/^Function: /) {
518 if (/Real part of/) {
519 s/Real part of //;
520 $type = 'real';
521 } elsif (/Imaginary part of/) {
522 s/Imaginary part of //;
523 $type = 'imag';
524 } else {
525 $type = 'normal';
527 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
528 $kind = 'fct';
529 next;
531 if (/^i?(float|double|ldouble):/) {
532 ($float, $eps) = split /\s*:\s*/,$_,2;
534 if ($eps eq 'fail') {
535 $results{$test}{$type}{'fail'}{$float} = 1;
536 $results{$test}{'has_fails'} = 1;
537 } elsif ($eps eq "0") {
538 # ignore
539 next;
540 } else {
541 $results{$test}{$type}{'ulp'}{$float} = $eps;
542 $results{$test}{'has_ulps'} = 1;
544 if ($type =~ /^real|imag$/) {
545 $results{$test}{'type'} = 'complex';
546 } elsif ($type eq 'normal') {
547 $results{$test}{'type'} = 'normal';
549 $results{$test}{'kind'} = $kind;
550 next;
552 print "Skipping unknown entry: `$_'\n";
554 close ULP;
558 # Clean up a floating point number
559 sub clean_up_number {
560 my ($number) = @_;
562 # Remove trailing zeros after the decimal point
563 if ($number =~ /\./) {
564 $number =~ s/0+$//;
565 $number =~ s/\.$//;
567 return $number;
570 # Output a file which can be read in as ulps file.
571 sub print_ulps_file {
572 my ($file) = @_;
573 my ($test, $type, $float, $eps, $fct, $last_fct);
575 $last_fct = '';
576 open NEWULP, ">$file" or die ("Can't open $file: $!");
577 print NEWULP "# Begin of automatic generation\n";
578 # first the function calls
579 foreach $test (sort keys %results) {
580 next if ($results{$test}{'kind'} ne 'test');
581 foreach $type ('real', 'imag', 'normal') {
582 if (exists $results{$test}{$type}) {
583 if (defined $results{$test}) {
584 ($fct) = ($test =~ /^(\w+)\s/);
585 if ($fct ne $last_fct) {
586 $last_fct = $fct;
587 print NEWULP "\n# $fct\n";
590 if ($type eq 'normal') {
591 print NEWULP "Test \"$test\":\n";
592 } elsif ($type eq 'real') {
593 print NEWULP "Test \"Real part of: $test\":\n";
594 } elsif ($type eq 'imag') {
595 print NEWULP "Test \"Imaginary part of: $test\":\n";
597 foreach $float (@all_floats) {
598 if (exists $results{$test}{$type}{'ulp'}{$float}) {
599 print NEWULP "$float: ",
600 &clean_up_number ($results{$test}{$type}{'ulp'}{$float}),
601 "\n";
603 if (exists $results{$test}{$type}{'fail'}{$float}) {
604 print NEWULP "$float: fail\n";
610 print NEWULP "\n# Maximal error of functions:\n";
612 foreach $fct (sort keys %results) {
613 next if ($results{$fct}{'kind'} ne 'fct');
614 foreach $type ('real', 'imag', 'normal') {
615 if (exists $results{$fct}{$type}) {
616 if ($type eq 'normal') {
617 print NEWULP "Function: \"$fct\":\n";
618 } elsif ($type eq 'real') {
619 print NEWULP "Function: Real part of \"$fct\":\n";
620 } elsif ($type eq 'imag') {
621 print NEWULP "Function: Imaginary part of \"$fct\":\n";
623 foreach $float (@all_floats) {
624 if (exists $results{$fct}{$type}{'ulp'}{$float}) {
625 print NEWULP "$float: ",
626 &clean_up_number ($results{$fct}{$type}{'ulp'}{$float}),
627 "\n";
629 if (exists $results{$fct}{$type}{'fail'}{$float}) {
630 print NEWULP "$float: fail\n";
633 print NEWULP "\n";
637 print NEWULP "# end of automatic generation\n";
638 close NEWULP;
641 sub get_ulps {
642 my ($test, $type, $float) = @_;
644 if ($type eq 'complex') {
645 my ($res);
646 # Return 0 instead of BUILD_COMPLEX (0,0)
647 if (!exists $results{$test}{'real'}{'ulp'}{$float} &&
648 !exists $results{$test}{'imag'}{'ulp'}{$float}) {
649 return "0";
651 $res = 'BUILD_COMPLEX (';
652 $res .= (exists $results{$test}{'real'}{'ulp'}{$float}
653 ? $results{$test}{'real'}{'ulp'}{$float} : "0");
654 $res .= ', ';
655 $res .= (exists $results{$test}{'imag'}{'ulp'}{$float}
656 ? $results{$test}{'imag'}{'ulp'}{$float} : "0");
657 $res .= ')';
658 return $res;
660 return (exists $results{$test}{'normal'}{'ulp'}{$float}
661 ? $results{$test}{'normal'}{'ulp'}{$float} : "0");
664 sub get_failure {
665 my ($test, $type, $float) = @_;
666 if ($type eq 'complex') {
667 # return x,y
668 my ($res);
669 # Return 0 instead of BUILD_COMPLEX_INT (0,0)
670 if (!exists $results{$test}{'real'}{'ulp'}{$float} &&
671 !exists $results{$test}{'imag'}{'ulp'}{$float}) {
672 return "0";
674 $res = 'BUILD_COMPLEX_INT (';
675 $res .= (exists $results{$test}{'real'}{'fail'}{$float}
676 ? $results{$test}{'real'}{'fail'}{$float} : "0");
677 $res .= ', ';
678 $res .= (exists $results{$test}{'imag'}{'fail'}{$float}
679 ? $results{$test}{'imag'}{'fail'}{$float} : "0");
680 $res .= ')';
681 return $res;
683 return (exists $results{$test}{'normal'}{'fail'}{$float}
684 ? $results{$test}{'normal'}{'fail'}{$float} : "0");
688 # Output the defines for a single test
689 sub output_test {
690 my ($file, $test, $name) = @_;
691 my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
692 my ($type);
694 # Do we have ulps/failures?
695 if (!exists $results{$test}{'type'}) {
696 return;
698 $type = $results{$test}{'type'};
699 if (exists $results{$test}{'has_ulps'}) {
700 # XXX use all_floats (change order!)
701 $ldouble = &get_ulps ($test, $type, "ldouble");
702 $double = &get_ulps ($test, $type, "double");
703 $float = &get_ulps ($test, $type, "float");
704 $ildouble = &get_ulps ($test, $type, "ildouble");
705 $idouble = &get_ulps ($test, $type, "idouble");
706 $ifloat = &get_ulps ($test, $type, "ifloat");
707 print $file "#define DELTA$name CHOOSE($ldouble, $double, $float, $ildouble, $idouble, $ifloat)\t/* $test */\n";
710 if (exists $results{$test}{'has_fails'}) {
711 $ldouble = &get_failure ($test, "ldouble");
712 $double = &get_failure ($test, "double");
713 $float = &get_failure ($test, "float");
714 $ildouble = &get_failure ($test, "ildouble");
715 $idouble = &get_failure ($test, "idouble");
716 $ifloat = &get_failure ($test, "ifloat");
717 print $file "#define FAIL$name CHOOSE($ldouble, $double, $float $ildouble, $idouble, $ifloat)\t/* $test */\n";
721 # Print include file
722 sub output_ulps {
723 my ($file, $ulps_filename) = @_;
724 my ($i, $fct);
726 open ULP, ">$file" or die ("Can't open $file: $!");
728 print ULP "/* This file is automatically generated\n";
729 print ULP " from $ulps_filename with gen-libm-test.pl.\n";
730 print ULP " Don't change it - change instead the master files. */\n\n";
732 print ULP "\n/* Maximal error of functions. */\n";
733 foreach $fct (@functions) {
734 output_test (\*ULP, $fct, $fct);
737 print ULP "\n/* Error of single function calls. */\n";
738 for ($i = 0; $i < $count; $i++) {
739 output_test (\*ULP, $tests[$i], $i);
741 close ULP;