#!/usr/bin/perl -w
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger <aj@suse.de>, 1999.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
# This file needs to be tidied up
# Note that functions and tests share the same namespace.
# Information about tests are stored in: %results
# $results{$test}{"kind"} is either "fct" or "test" and flags whether this
# is a maximal error of a function or a single test.
# $results{$test}{"type"} is the result type, e.g. normal or complex.
# $results{$test}{"has_ulps"} is set if deltas exist.
# $results{$test}{"has_fails"} is set if exptected failures exist.
# In the following description $type and $float are:
# - $type is either "normal", "real" (for the real part of a complex number)
# or "imag" (for the imaginary part # of a complex number).
# - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
# It represents the underlying floating point type (float, double or long
# double) and if inline functions (the leading i stands for inline)
# are used.
# $results{$test}{$type}{"fail"}{$float} is defined and has a 1 if
# the test is expected to fail
# $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
use Getopt::Std;
use strict;
use vars qw ($input $output);
use vars qw (%results);
use vars qw (@tests @functions);
use vars qw ($count);
use vars qw (%beautify @all_floats);
use vars qw ($output_dir $ulps_file);
# all_floats is sorted and contains all recognised float types
@all_floats = ('double', 'float', 'idouble',
'ifloat', 'ildouble', 'ldouble');
%beautify =
( "minus_zero" => "-0",
"plus_zero" => "+0",
"minus_infty" => "-inf",
"plus_infty" => "inf",
"nan_value" => "NaN",
"M_El" => "e",
"M_E2l" => "e^2",
"M_E3l" => "e^3",
"M_LOG10El", "log10(e)",
"M_PIl" => "pi",
"M_PI_34l" => "3/4 pi",
"M_PI_2l" => "pi/2",
"M_PI_4l" => "pi/4",
"M_PI_6l" => "pi/6",
"M_PI_34_LOG10El" => "3/4 pi*log10(e)",
"M_PI_LOG10El" => "pi*log10(e)",
"M_PI2_LOG10El" => "pi/2*log10(e)",
"M_PI4_LOG10El" => "pi/4*log10(e)",
"M_LOG_SQRT_PIl" => "log(sqrt(pi))",
"M_LOG_2_SQRT_PIl" => "log(2*sqrt(pi))",
"M_2_SQRT_PIl" => "2 sqrt (pi)",
"M_SQRT_PIl" => "sqrt (pi)",
"INVALID_EXCEPTION" => "invalid exception",
"DIVIDE_BY_ZERO_EXCEPTION" => "division by zero exception",
"OVERFLOW_EXCEPTION" => "overflow exception",
"INVALID_EXCEPTION_OK" => "invalid exception allowed",
"DIVIDE_BY_ZERO_EXCEPTION_OK" => "division by zero exception allowed",
"OVERFLOW_EXCEPTION_OK" => "overflow exception allowed",
"EXCEPTIONS_OK" => "exceptions allowed",
"IGNORE_ZERO_INF_SIGN" => "sign of zero/inf not specified",
"INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN" => "invalid exception and sign of zero/inf not specified"
);
# get Options
# Options:
# u: ulps-file
# h: help
# o: output-directory
# n: generate new ulps file
use