This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch siddhesh/benchmarks created. glibc-2.18-842-g8cdb805
- From: siddhesh at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 31 Jan 2014 05:59:39 -0000
- Subject: GNU C Library master sources branch siddhesh/benchmarks created. glibc-2.18-842-g8cdb805
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, siddhesh/benchmarks has been created
at 8cdb80506da842b5188ef8137c1a4e14179a883e (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8cdb80506da842b5188ef8137c1a4e14179a883e
commit 8cdb80506da842b5188ef8137c1a4e14179a883e
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Fri Jan 17 18:14:57 2014 +0530
Add machine info
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 9e6c58e..7f7145a 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -115,7 +115,8 @@ bench-set: $(binaries-benchset)
done
bench-func: $(binaries-bench)
- { for run in $^; do \
+ { ./machine-info.sh; \
+ for run in $^; do \
echo "Running $${run}" >&2; \
$(run-bench) $(DETAILED_OPT); \
done; } > $(objpfx)bench.out-tmp; \
diff --git a/benchtests/machine-info.sh b/benchtests/machine-info.sh
new file mode 100755
index 0000000..aa09da5
--- /dev/null
+++ b/benchtests/machine-info.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Simple script to get some basic machine information
+
+{ sed -n -e 's/\(vendor_id\)[ \t]\+:/1. \1:/p' \
+ -e 's/\(cpu family\)[ \t]\+:/2. \1:/p' \
+ -e 's/\(model\)[ \t]\+:/3. \1:/p' \
+ -e 's/\(cpu cores\)[ \t]\+:/4. \1:/p' \
+ -e 's/\(cache size\)[ \t]\+:/6. \1:/p' \
+ -e 's/MemTotal:[ \t]\+\(.*\)/7. memory: \1/p' \
+ -e 's/SwapTotal:[ \t]\+\(.*\)/8. swap: \1/p' \
+ /proc/cpuinfo /proc/meminfo; \
+ echo 5. processors: $(grep -c 'processor' /proc/cpuinfo); } |
+ sort -u
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4e58e3fc53623b90b5a8d52d18c7c64327c0dd17
commit 4e58e3fc53623b90b5a8d52d18c7c64327c0dd17
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jan 16 15:09:10 2014 +0530
Remove bench-modf.c
diff --git a/benchtests/bench-modf.c b/benchtests/bench-modf.c
deleted file mode 100644
index 407360c..0000000
--- a/benchtests/bench-modf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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/>. */
-
-extern double modf (double, double *);
-
-#define CALL_BENCH_FUNC(j, i) modf (in[j].arg0, &i);
-
-struct args
-{
- volatile double arg0;
-} in[] =
-{
- { 42.42 },
- { -42.42 }
-};
-
-#define NUM_VARIANTS 1
-#define NUM_SAMPLES(v) (sizeof (in) / sizeof (struct args))
-
-static volatile double ret = 0.0;
-#define BENCH_FUNC(v, j) \
-({ \
- double iptr; \
- ret = CALL_BENCH_FUNC (j, iptr); \
-})
-
-#define FUNCNAME "modf"
-#define VARIANT(v) FUNCNAME "()"
-
-#include "bench-skeleton.c"
diff --git a/benchtests/modf-inputs b/benchtests/modf-inputs
new file mode 100644
index 0000000..4fcc99b
--- /dev/null
+++ b/benchtests/modf-inputs
@@ -0,0 +1,4 @@
+## includes: math.h
+## args: double:<double *>
+42.0
+-42.0
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0ba13678c848a15a3e400b524fd77c044a2375ad
commit 0ba13678c848a15a3e400b524fd77c044a2375ad
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Wed Jan 15 12:48:09 2014 +0530
Detailed benchmark numbers
Store timings per input.
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 792f61f..9e6c58e 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -84,6 +84,12 @@ ifdef USE_CLOCK_GETTIME
CPPFLAGS-nonlib += -DUSE_CLOCK_GETTIME
endif
+DETAILED_OPT :=
+
+ifdef DETAILED
+DETAILED_OPT := -d
+endif
+
# This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed
# for all these modules.
cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c)
@@ -111,7 +117,7 @@ bench-set: $(binaries-benchset)
bench-func: $(binaries-bench)
{ for run in $^; do \
echo "Running $${run}" >&2; \
- $(run-bench); \
+ $(run-bench) $(DETAILED_OPT); \
done; } > $(objpfx)bench.out-tmp; \
if [ -f $(objpfx)bench.out ]; then \
mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
diff --git a/benchtests/bench-skeleton.c b/benchtests/bench-skeleton.c
index 4290e76..1a124a2 100644
--- a/benchtests/bench-skeleton.c
+++ b/benchtests/bench-skeleton.c
@@ -18,6 +18,7 @@
#include <string.h>
#include <stdint.h>
+#include <stdbool.h>
#include <stdio.h>
#include <time.h>
#include <inttypes.h>
@@ -48,6 +49,10 @@ main (int argc, char **argv)
unsigned long i, k;
struct timespec runtime;
timing_t start, end;
+ bool detailed = false;
+
+ if (argc == 2 && !strcmp (argv[1], "-d"))
+ detailed = true;
startup();
@@ -59,6 +64,9 @@ main (int argc, char **argv)
iters = 1000 * res;
+ if (detailed)
+ printf ("%s\n", FUNCNAME);
+
for (int v = 0; v < NUM_VARIANTS; v++)
{
/* Run for approximately DURATION seconds. */
@@ -67,6 +75,7 @@ main (int argc, char **argv)
double d_total_i = 0;
timing_t total = 0, max = 0, min = 0x7fffffffffffffff;
+ int64_t c = 0;
while (1)
{
for (i = 0; i < NUM_SAMPLES (v); i++)
@@ -86,9 +95,13 @@ main (int argc, char **argv)
min = cur;
TIMING_ACCUM (total, cur);
+ /* Accumulate timings for the value. In the end we will divide
+ by the total iterations. */
+ RESULT_ACCUM (cur, v, i, c * iters, (c + 1) * iters);
d_total_i += iters;
}
+ c++;
struct timespec curtime;
memset (&curtime, 0, sizeof (curtime));
@@ -104,8 +117,17 @@ main (int argc, char **argv)
d_total_s = total;
d_iters = iters;
- TIMING_PRINT_STATS (VARIANT (v), d_total_s, d_iters, d_total_i, max,
- min);
+ if (!detailed)
+ {
+ TIMING_PRINT_STATS (VARIANT (v), d_total_s, d_iters, d_total_i, max,
+ min);
+ }
+ else
+ {
+ printf ("\t%s\n", VARIANT (v));
+ for (int i = 0; i < NUM_SAMPLES (v); i++)
+ printf ("\t\t%g\n", RESULT (v, i));
+ }
}
return 0;
diff --git a/scripts/bench.py b/scripts/bench.py
index 81ffc15..11f616f 100755
--- a/scripts/bench.py
+++ b/scripts/bench.py
@@ -50,6 +50,7 @@ STRUCT_TEMPLATE = '''
struct args
{
%(args)s
+ double timing;
};
struct _variants
@@ -80,6 +81,9 @@ struct _variants variants[%(num_variants)d] = {
# Epilogue for the generated source file.
EPILOGUE = '''
+#define RESULT(__v, __i) (variants[(__v)].in[(__i)].timing)
+#define RESULT_ACCUM(r, v, i, old, new) \\
+ ((RESULT ((v), (i))) = (RESULT ((v), (i)) * (old) + (r)) / ((new) + 1))
#define BENCH_FUNC(i, j) ({%(getret)s CALL_BENCH_FUNC (i, j);})
#define FUNCNAME "%(func)s"
#include "bench-skeleton.c"'''
@@ -168,7 +172,7 @@ def _print_arg_data(func, directives, all_vals):
# Now print the values.
variants = []
for (k, vals), i in zip(all_vals.items(), itertools.count()):
- out = [' {%s},' % v for v in vals]
+ out = [' {%s, 0},' % v for v in vals]
# Members for the variants structure list that we will
# print later.
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e31dc6b0a6029f275ab5364f6eddb471755d65e7
commit e31dc6b0a6029f275ab5364f6eddb471755d65e7
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Fri Dec 6 13:51:09 2013 +0530
Implement benchmarking script in python
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 8bfb039..792f61f 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -127,5 +127,5 @@ $(objpfx)bench-%.c: %-inputs $(bench-deps)
{ if [ -n "$($*-INCLUDE)" ]; then \
cat $($*-INCLUDE); \
fi; \
- $(..)scripts/bench.pl $(patsubst %-inputs,%,$<); } > $@-tmp
+ $(..)scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp
mv -f $@-tmp $@
diff --git a/benchtests/README b/benchtests/README
index a5fd8da..2a940fa 100644
--- a/benchtests/README
+++ b/benchtests/README
@@ -8,7 +8,9 @@ basic performance properties of the function.
Running the benchmark:
=====================
-The benchmark can be executed by invoking make as follows:
+The benchmark needs python 2.7 or later in addition to the
+dependencies required to build the GNU C Library. One may run the
+benchmark by invoking make as follows:
$ make bench
diff --git a/scripts/bench.pl b/scripts/bench.pl
deleted file mode 100755
index 569cd51..0000000
--- a/scripts/bench.pl
+++ /dev/null
@@ -1,205 +0,0 @@
-#! /usr/bin/perl -w
-# Copyright (C) 2013-2014 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-
-# 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/>.
-
-
-use strict;
-use warnings;
-# Generate a benchmark source file for a given input.
-
-if (@ARGV < 1) {
- die "Usage: bench.pl <function>"
-}
-
-my $func = $ARGV[0];
-my @args;
-my $ret = "void";
-my $getret = "";
-
-# We create a hash of inputs for each variant of the test.
-my $variant = "";
-my @curvals;
-my %vals;
-my @include_headers;
-my @include_sources;
-my $incl;
-
-open INPUTS, "<$func-inputs" or die $!;
-
-LINE:while (<INPUTS>) {
- chomp;
-
- # Directives.
- if (/^## ([\w-]+): (.*)/) {
- # Function argument types.
- if ($1 eq "args") {
- @args = split(":", $2);
- }
-
- # Function return type.
- elsif ($1 eq "ret") {
- $ret = $2;
- }
-
- elsif ($1 eq "includes") {
- @include_headers = split (",", $2);
- }
-
- elsif ($1 eq "include-sources") {
- @include_sources = split (",", $2);
- }
-
- # New variant. This is the only directive allowed in the body of the
- # inputs to separate inputs into variants. All others should be at the
- # top or else all hell will break loose.
- elsif ($1 eq "name") {
-
- # Save values in the previous variant.
- my @copy = @curvals;
- $vals{$variant} = \@copy;
-
- # Prepare for the next.
- $variant=$2;
- undef @curvals;
- next LINE;
- }
-
- else {
- die "Unknown directive: ".$1;
- }
- }
-
- # Skip over comments and blank lines.
- if (/^#/ || /^$/) {
- next LINE;
- }
- push (@curvals, $_);
-}
-
-
-my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
-
-# Output variables. These include the return value as well as any pointers
-# that may get passed into the function, denoted by the <> around the type.
-my $outvars = "";
-
-if ($ret ne "void") {
- $outvars = "static $ret volatile ret;\n";
-}
-
-# Print the definitions and macros.
-foreach $incl (@include_headers) {
- print "#include <" . $incl . ">\n";
-}
-
-# Print the source files.
-foreach $incl (@include_sources) {
- print "#include \"" . $incl . "\"\n";
-}
-
-if (@args > 0) {
- # Save values in the last variant.
- $vals{$variant} = \@curvals;
- my $struct =
- "struct _variants
- {
- const char *name;
- int count;
- struct args *in;
- };\n";
-
- my $arg_struct = "struct args {";
-
- my $num = 0;
- my $arg;
- foreach $arg (@args) {
- if ($num > 0) {
- $bench_func = "$bench_func,";
- }
-
- $_ = $arg;
- if (/<(.*)\*>/) {
- # Output variables. These have to be pointers, so dereference once by
- # dropping one *.
- $outvars = $outvars . "static $1 out$num;\n";
- $bench_func = "$bench_func &out$num";
- }
- else {
- $arg_struct = "$arg_struct $arg volatile arg$num;";
- $bench_func = "$bench_func variants[v].in[i].arg$num";
- }
-
- $num = $num + 1;
- }
-
- $arg_struct = $arg_struct . "};\n";
- $bench_func = $bench_func . ");\n";
-
- print $bench_func;
- print $arg_struct;
- print $struct;
-
- my $c = 0;
- my $key;
-
- # Print the input arrays.
- foreach $key (keys %vals) {
- my @arr = @{$vals{$key}};
-
- print "struct args in" . $c . "[" . @arr . "] = {\n";
- foreach (@arr) {
- print "{$_},\n";
- }
- print "};\n\n";
- $c += 1;
- }
-
- # The variants. Each variant then points to the appropriate input array we
- # defined above.
- print "struct _variants variants[" . (keys %vals) . "] = {\n";
- $c = 0;
- foreach $key (keys %vals) {
- print "{\"$func($key)\", " . @{$vals{$key}} . ", in$c},\n";
- $c += 1;
- }
- print "};\n\n";
- # Finally, print the last set of macros.
- print "#define NUM_VARIANTS $c\n";
- print "#define NUM_SAMPLES(i) (variants[i].count)\n";
- print "#define VARIANT(i) (variants[i].name)\n";
-}
-else {
- print $bench_func . ");\n";
- print "#define NUM_VARIANTS (1)\n";
- print "#define NUM_SAMPLES(v) (1)\n";
- print "#define VARIANT(v) FUNCNAME \"()\"\n"
-}
-
-# Print the output variable definitions.
-print "$outvars\n";
-
-# In some cases not storing a return value seems to result in the function call
-# being optimized out.
-if ($ret ne "void") {
- $getret = "ret = ";
-}
-
-# And we're done.
-print "#define BENCH_FUNC(i, j) ({$getret CALL_BENCH_FUNC (i, j);})\n";
-
-print "#define FUNCNAME \"$func\"\n";
-print "#include \"bench-skeleton.c\"\n";
diff --git a/scripts/bench.py b/scripts/bench.py
new file mode 100755
index 0000000..81ffc15
--- /dev/null
+++ b/scripts/bench.py
@@ -0,0 +1,299 @@
+#!/usr/bin/python
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# 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/>.
+
+"""Benchmark program generator script
+
+This script takes a function name as input and generates a program using
+an input file located in the benchtests directory. The name of the
+input file should be of the form foo-inputs where 'foo' is the name of
+the function.
+"""
+
+from __future__ import print_function
+import sys
+import os
+import itertools
+
+# Macro definitions for functions that take no arguments. For functions
+# that take arguments, the STRUCT_TEMPLATE, ARGS_TEMPLATE and
+# VARIANTS_TEMPLATE are used instead.
+DEFINES_TEMPLATE = '''
+#define CALL_BENCH_FUNC(v, i) %(func)s ()
+#define NUM_VARIANTS (1)
+#define NUM_SAMPLES(v) (1)
+#define VARIANT(v) FUNCNAME "()"
+'''
+
+# Structures to store arguments for the function call. A function may
+# have its inputs partitioned to represent distinct performance
+# characteristics or distinct flavors of the function. Each such
+# variant is represented by the _VARIANT structure. The ARGS structure
+# represents a single set of arguments.
+STRUCT_TEMPLATE = '''
+#define CALL_BENCH_FUNC(v, i) %(func)s (%(func_args)s)
+
+struct args
+{
+%(args)s
+};
+
+struct _variants
+{
+ const char *name;
+ int count;
+ struct args *in;
+};
+'''
+
+# The actual input arguments.
+ARGS_TEMPLATE = '''
+struct args in%(argnum)d[%(num_args)d] = {
+%(args)s
+};
+'''
+
+# The actual variants, along with macros defined to access the variants.
+VARIANTS_TEMPLATE = '''
+struct _variants variants[%(num_variants)d] = {
+%(variants)s
+};
+
+#define NUM_VARIANTS %(num_variants)d
+#define NUM_SAMPLES(i) (variants[i].count)
+#define VARIANT(i) (variants[i].name)
+'''
+
+# Epilogue for the generated source file.
+EPILOGUE = '''
+#define BENCH_FUNC(i, j) ({%(getret)s CALL_BENCH_FUNC (i, j);})
+#define FUNCNAME "%(func)s"
+#include "bench-skeleton.c"'''
+
+
+def gen_source(func, directives, all_vals):
+ """Generate source for the function
+
+ Generate the C source for the function from the values and
+ directives.
+
+ Args:
+ func: The function name
+ directives: A dictionary of directives applicable to this function
+ all_vals: A dictionary input values
+ """
+ # The includes go in first.
+ for header in directives['includes']:
+ print('#include <%s>' % header)
+
+ for header in directives['include-sources']:
+ print('#include "%s"' % header)
+
+ # Print macros. This branches out to a separate routine if
+ # the function takes arguments.
+ if not directives['args']:
+ print(DEFINES_TEMPLATE % {'func': func})
+ outargs = []
+ else:
+ outargs = _print_arg_data(func, directives, all_vals)
+
+ # Print the output variable definitions if necessary.
+ for out in outargs:
+ print(out)
+
+ # If we have a return value from the function, make sure it is
+ # assigned to prevent the compiler from optimizing out the
+ # call.
+ if directives['ret']:
+ print('static %s volatile ret;' % directives['ret'])
+ getret = 'ret = '
+ else:
+ getret = ''
+
+ print(EPILOGUE % {'getret': getret, 'func': func})
+
+
+def _print_arg_data(func, directives, all_vals):
+ """Print argument data
+
+ This is a helper function for gen_source that prints structure and
+ values for arguments and their variants and returns output arguments
+ if any are found.
+
+ Args:
+ func: Function name
+ directives: A dictionary of directives applicable to this function
+ all_vals: A dictionary input values
+
+ Returns:
+ Returns a list of definitions for function arguments that act as
+ output parameters.
+ """
+ # First, all of the definitions. We process writing of
+ # CALL_BENCH_FUNC, struct args and also the output arguments
+ # together in a single traversal of the arguments list.
+ func_args = []
+ arg_struct = []
+ outargs = []
+
+ for arg, i in zip(directives['args'], itertools.count()):
+ if arg[0] == '<' and arg[-1] == '>':
+ pos = arg.rfind('*')
+ if pos == -1:
+ die('Output argument must be a pointer type')
+
+ outargs.append('static %s out%d;' % (arg[1:pos], i))
+ func_args.append(' &out%d' % i)
+ else:
+ arg_struct.append(' %s volatile arg%d;' % (arg, i))
+ func_args.append('variants[v].in[i].arg%d' % i)
+
+ print(STRUCT_TEMPLATE % {'args' : '\n'.join(arg_struct), 'func': func,
+ 'func_args': ', '.join(func_args)})
+
+ # Now print the values.
+ variants = []
+ for (k, vals), i in zip(all_vals.items(), itertools.count()):
+ out = [' {%s},' % v for v in vals]
+
+ # Members for the variants structure list that we will
+ # print later.
+ variants.append(' {"%s(%s)", %d, in%d},' % (func, k, len(vals), i))
+ print(ARGS_TEMPLATE % {'argnum': i, 'num_args': len(vals),
+ 'args': '\n'.join(out)})
+
+ # Print the variants and the last set of macros.
+ print(VARIANTS_TEMPLATE % {'num_variants': len(all_vals),
+ 'variants': '\n'.join(variants)})
+ return outargs
+
+
+def _process_directive(d_name, d_val):
+ """Process a directive.
+
+ Evaluate the directive name and value passed and return the
+ processed value. This is a helper function for parse_file.
+
+ Args:
+ d_name: Name of the directive
+ d_value: The string value to process
+
+ Returns:
+ The processed value, which may be the string as it is or an object
+ that describes the directive.
+ """
+ # Process the directive values if necessary. name and ret don't
+ # need any processing.
+ if d_name.startswith('include'):
+ d_val = d_val.split(',')
+ elif d_name == 'args':
+ d_val = d_val.split(':')
+
+ # Return the values.
+ return d_val
+
+
+def parse_file(func):
+ """Parse an input file
+
+ Given a function name, open and parse an input file for the function
+ and get the necessary parameters for the generated code and the list
+ of inputs.
+
+ Args:
+ func: The function name
+
+ Returns:
+ A tuple of two elements, one a dictionary of directives and the
+ other a dictionary of all input values.
+ """
+ all_vals = {}
+ # Valid directives.
+ directives = {
+ 'name': '',
+ 'args': [],
+ 'includes': [],
+ 'include-sources': [],
+ 'ret': ''
+ }
+
+ try:
+ with open('%s-inputs' % func) as f:
+ for line in f:
+ # Look for directives and parse it if found.
+ if line.startswith('##'):
+ try:
+ d_name, d_val = line[2:].split(':', 1)
+ d_name = d_name.strip()
+ d_val = d_val.strip()
+ directives[d_name] = _process_directive(d_name, d_val)
+ except (IndexError, KeyError):
+ die('Invalid directive: %s' % line[2:])
+
+ # Skip blank lines and comments.
+ line = line.split('#', 1)[0].rstrip()
+ if not line:
+ continue
+
+ # Otherwise, we're an input. Add to the appropriate
+ # input set.
+ cur_name = directives['name']
+ all_vals.setdefault(cur_name, [])
+ all_vals[cur_name].append(line)
+ except IOError as ex:
+ die("Failed to open input file (%s): %s" % (ex.filename, ex.strerror))
+
+ return directives, all_vals
+
+
+def die(msg):
+ """Exit with an error
+
+ Prints an error message to the standard error stream and exits with
+ a non-zero status.
+
+ Args:
+ msg: The error message to print to standard error.
+ """
+ print('%s\n' % msg, file=sys.stderr)
+ sys.exit(os.EX_DATAERR)
+
+
+def main(args):
+ """Main function
+
+ Use the first command line argument as function name and parse its
+ input file to generate C source that calls the function repeatedly
+ for the input.
+
+ Args:
+ args: The command line arguments with the program name dropped.
+
+ Returns:
+ os.EX_USAGE on error and os.EX_OK on success.
+ """
+ if len(args) != 1:
+ print('Usage: %s <function>' % sys.argv[0])
+ return os.EX_USAGE
+
+ directives, all_vals = parse_file(args[0])
+ gen_source(args[0], directives, all_vals)
+ return os.EX_OK
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/scripts/pylint b/scripts/pylint
new file mode 100755
index 0000000..49a775e
--- /dev/null
+++ b/scripts/pylint
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Simple wrapper around the pylint program that uses the pylintrc file to
+# validate the source code in files passed on command line.
+
+exec pylint --rcfile "${0%/*}/pylintrc" "$@"
diff --git a/scripts/pylintrc b/scripts/pylintrc
new file mode 100644
index 0000000..a05ddfd
--- /dev/null
+++ b/scripts/pylintrc
@@ -0,0 +1,274 @@
+[MASTER]
+
+# Specify a configuration file.
+#rcfile=
+
+# Python code to execute, usually for sys.path manipulation such as
+# pygtk.require().
+#init-hook=
+
+# Profiled execution.
+profile=no
+
+# Add files or directories to the blacklist. They should be base names, not
+# paths.
+ignore=CVS
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# List of plugins (as comma separated values of python modules names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+
+[MESSAGES CONTROL]
+
+# Enable the message, report, category or checker with the given id(s). You can
+# either give multiple identifier separated by comma (,) or put this option
+# multiple time. See also the "--disable" option for examples.
+#enable=
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once).You can also use "--disable=all" to
+# disable everything first and then reenable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use"--disable=all --enable=classes
+# --disable=W"
+#disable=
+
+
+[REPORTS]
+
+# Set the output format. Available formats are text, parseable, colorized, msvs
+# (visual studio) and html. You can also give a reporter class, eg
+# mypackage.mymodule.MyReporterClass.
+output-format=text
+
+# Put messages in a separate file for each module / package specified on the
+# command line instead of printing them on stdout. Reports (if any) will be
+# written in a file name "pylint_global.[txt|html]".
+files-output=no
+
+# Tells whether to display a full report or only the messages
+reports=yes
+
+# Python expression which should return a note less than 10 (10 is the highest
+# note). You have access to the variables errors warning, statement which
+# respectively contain the number of errors / warnings messages and the total
+# number of statements analyzed. This is used by the global evaluation report
+# (RP0004).
+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
+
+# Add a comment according to your evaluation note. This is used by the global
+# evaluation report (RP0004).
+comment=no
+
+# Template used to display messages. This is a python new-style format string
+# used to format the massage information. See doc for all details
+#msg-template=
+
+
+[MISCELLANEOUS]
+
+# List of note tags to take in consideration, separated by a comma.
+notes=FIXME,XXX,TODO
+
+
+[SIMILARITIES]
+
+# Minimum lines number of a similarity.
+min-similarity-lines=4
+
+# Ignore comments when computing similarities.
+ignore-comments=yes
+
+# Ignore docstrings when computing similarities.
+ignore-docstrings=yes
+
+# Ignore imports when computing similarities.
+ignore-imports=no
+
+
+[BASIC]
+
+# Required attributes for module, separated by a comma
+required-attributes=
+
+# List of builtins function names that should not be used, separated by a comma
+bad-functions=map,filter,apply,input
+
+# Regular expression which should only match correct module names
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
+
+# Regular expression which should only match correct module level names
+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
+
+# Regular expression which should only match correct class names
+class-rgx=[A-Z_][a-zA-Z0-9]+$
+
+# Regular expression which should only match correct function names
+function-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct method names
+method-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct instance attribute names
+attr-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct argument names
+argument-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct variable names
+variable-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct attribute names in class
+# bodies
+class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
+
+# Regular expression which should only match correct list comprehension /
+# generator expression variable names
+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
+
+# Good variable names which should always be accepted, separated by a comma
+# f is a useful name for a file descriptor
+good-names=f,i,j,k,ex,Run,_
+
+# Bad variable names which should always be refused, separated by a comma
+bad-names=foo,bar,baz,toto,tutu,tata
+
+# Regular expression which should only match function or class names that do
+# not require a docstring.
+no-docstring-rgx=__.*__
+
+# Minimum line length for functions/classes that require docstrings, shorter
+# ones are exempt.
+docstring-min-length=-1
+
+
+[VARIABLES]
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# A regular expression matching the beginning of the name of dummy variables
+# (i.e. not used).
+dummy-variables-rgx=_$|dummy
+
+# List of additional names supposed to be defined in builtins. Remember that
+# you should avoid to define new builtins when possible.
+additional-builtins=
+
+
+[FORMAT]
+
+# Maximum number of characters on a single line.
+max-line-length=79
+
+# Regexp for a line that is allowed to be longer than the limit.
+ignore-long-lines=^\s*(# )?<?https?://\S+>?$
+
+# Maximum number of lines in a module
+max-module-lines=1000
+
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+# tab).
+indent-string=' '
+
+
+[TYPECHECK]
+
+# Tells whether missing members accessed in mixin class should be ignored. A
+# mixin class is detected if its name ends with "mixin" (case insensitive).
+ignore-mixin-members=yes
+
+# List of classes names for which member attributes should not be checked
+# (useful for classes with attributes dynamically set).
+ignored-classes=SQLObject
+
+# When zope mode is activated, add a predefined set of Zope acquired attributes
+# to generated-members.
+zope=no
+
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E0201 when accessed. Python regular
+# expressions are accepted.
+generated-members=REQUEST,acl_users,aq_parent
+
+
+[CLASSES]
+
+# List of interface methods to ignore, separated by a comma. This is used for
+# instance to not check methods defines in Zope's Interface base class.
+ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,__new__,setUp
+
+# List of valid names for the first argument in a class method.
+valid-classmethod-first-arg=cls
+
+# List of valid names for the first argument in a metaclass class method.
+valid-metaclass-classmethod-first-arg=mcs
+
+
+[IMPORTS]
+
+# Deprecated modules which should not be used, separated by a comma
+deprecated-modules=regsub,TERMIOS,Bastion,rexec
+
+# Create a graph of every (i.e. internal and external) dependencies in the
+# given file (report RP0402 must not be disabled)
+import-graph=
+
+# Create a graph of external dependencies in the given file (report RP0402 must
+# not be disabled)
+ext-import-graph=
+
+# Create a graph of internal dependencies in the given file (report RP0402 must
+# not be disabled)
+int-import-graph=
+
+
+[DESIGN]
+
+# Maximum number of arguments for function / method
+max-args=5
+
+# Argument names that match this expression will be ignored. Default to name
+# with leading underscore
+ignored-argument-names=_.*
+
+# Maximum number of locals for function / method body
+max-locals=15
+
+# Maximum number of return / yield for function / method body
+max-returns=6
+
+# Maximum number of branch for function / method body
+max-branches=12
+
+# Maximum number of statements in function / method body
+max-statements=50
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+
+[EXCEPTIONS]
+
+# Exceptions that will emit a warning when being caught. Defaults to
+# "Exception"
+overgeneral-exceptions=Exception
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=05f9dfd8430ae9008f4561bed226046506fa5be9
commit 05f9dfd8430ae9008f4561bed226046506fa5be9
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Tue Oct 8 16:36:19 2013 +0530
TMP: probes for math functions
Temporary probes at various branch points in the functions.
diff --git a/sysdeps/ieee754/dbl-64/e_asin.c b/sysdeps/ieee754/dbl-64/e_asin.c
index 5bb5aeb..d425fd7 100644
--- a/sysdeps/ieee754/dbl-64/e_asin.c
+++ b/sysdeps/ieee754/dbl-64/e_asin.c
@@ -40,17 +40,18 @@
#include "MathLib.h"
#include "uasncs.h"
#include <math_private.h>
+#include <stap-probe.h>
#ifndef SECTION
# define SECTION
#endif
-void __doasin(double x, double dx, double w[]);
-void __dubsin(double x, double dx, double v[]);
-void __dubcos(double x, double dx, double v[]);
-void __docos(double x, double dx, double v[]);
-double __sin32(double x, double res, double res1);
-double __cos32(double x, double res, double res1);
+void __doasin (double x, double dx, double w[]);
+void __dubsin (double x, double dx, double v[]);
+void __dubcos (double x, double dx, double v[]);
+void __docos (double x, double dx, double v[]);
+double __sin32 (double x, double res, double res1);
+double __cos32 (double x, double res, double res1);
/***************************************************************************/
/* An ultimate asin routine. Given an IEEE double machine number x */
@@ -58,584 +59,1044 @@ double __cos32(double x, double res, double res1);
/***************************************************************************/
double
SECTION
-__ieee754_asin(double x){
- double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2];
- mynumber u,v;
- int4 k,m,n;
+__ieee754_asin (double x)
+{
+ double x1, x2, xx, s1, s2, res1, p, t, res, r, cor, cc, y, c, z, w[2];
+ mynumber u, v;
+ int4 k, m, n;
u.x = x;
m = u.i[HIGH_HALF];
- k = 0x7fffffff&m; /* no sign */
+ k = 0x7fffffff & m; /* no sign */
- if (k < 0x3e500000) return x; /* for x->0 => sin(x)=x */
+ if (k < 0x3e500000)
+ return x; /* for x->0 => sin(x)=x */
/*----------------------2^-26 <= |x| < 2^ -3 -----------------*/
- else
- if (k < 0x3fc00000) {
- x2 = x*x;
- t = (((((f6*x2 + f5)*x2 + f4)*x2 + f3)*x2 + f2)*x2 + f1)*(x2*x);
- res = x+t; /* res=arcsin(x) according to Taylor series */
- cor = (x-res)+t;
- if (res == res+1.025*cor) return res;
- else {
- x1 = x+big;
- xx = x*x;
- x1 -= big;
- x2 = x - x1;
- p = x1*x1*x1;
- s1 = a1.x*p;
- s2 = ((((((c7*xx + c6)*xx + c5)*xx + c4)*xx + c3)*xx + c2)*xx*xx*x +
- ((a1.x+a2.x)*x2*x2+ 0.5*x1*x)*x2) + a2.x*p;
- res1 = x+s1;
- s2 = ((x-res1)+s1)+s2;
- res = res1+s2;
- cor = (res1-res)+s2;
- if (res == res+1.00014*cor) return res;
- else {
- __doasin(x,0,w);
- if (w[0]==(w[0]+1.00000001*w[1])) return w[0];
- else {
- y=ABS(x);
- res=ABS(w[0]);
- res1=ABS(w[0]+1.1*w[1]);
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
+ else if (k < 0x3fc00000)
+ {
+ x2 = x * x;
+ t =
+ (((((f6 * x2 + f5) * x2 + f4) * x2 + f3) * x2 + f2) * x2 +
+ f1) * (x2 * x);
+ res = x + t; /* res=arcsin(x) according to Taylor series */
+ cor = (x - res) + t;
+ if (res == res + 1.025 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 1, &x);
+ return res;
+ }
+ else
+ {
+ x1 = x + big;
+ xx = x * x;
+ x1 -= big;
+ x2 = x - x1;
+ p = x1 * x1 * x1;
+ s1 = a1.x * p;
+ s2 =
+ ((((((c7 * xx + c6) * xx + c5) * xx + c4) * xx + c3) * xx +
+ c2) * xx * xx * x + ((a1.x + a2.x) * x2 * x2 +
+ 0.5 * x1 * x) * x2) + a2.x * p;
+ res1 = x + s1;
+ s2 = ((x - res1) + s1) + s2;
+ res = res1 + s2;
+ cor = (res1 - res) + s2;
+ if (res == res + 1.00014 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 2, &x);
+ return res;
+ }
+ else
+ {
+ __doasin (x, 0, w);
+ if (w[0] == (w[0] + 1.00000001 * w[1]))
+ {
+ LIBC_PROBE (asin_probe, 2, 3, &x);
+ return w[0];
+ }
+ else
+ {
+ y = ABS (x);
+ res = ABS (w[0]);
+ res1 = ABS (w[0] + 1.1 * w[1]);
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ }
}
- }
/*---------------------0.125 <= |x| < 0.5 -----------------------------*/
- else if (k < 0x3fe00000) {
- if (k<0x3fd00000) n = 11*((k&0x000fffff)>>15);
- else n = 11*((k&0x000fffff)>>14)+352;
- if (m>0) xx = x - asncs.x[n];
- else xx = -x - asncs.x[n];
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+xx*(asncs.x[n+5]
- +xx*asncs.x[n+6]))))+asncs.x[n+7];
- t+=p;
- res =asncs.x[n+8] +t;
- cor = (asncs.x[n+8]-res)+t;
- if (res == res+1.05*cor) return (m>0)?res:-res;
- else {
- r=asncs.x[n+8]+xx*asncs.x[n+9];
- t=((asncs.x[n+8]-r)+xx*asncs.x[n+9])+(p+xx*asncs.x[n+10]);
- res = r+t;
- cor = (r-res)+t;
- if (res == res+1.0005*cor) return (m>0)?res:-res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __dubsin(res,z,w);
- z=(w[0]-ABS(x))+w[1];
- if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
- else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
- else {
- y=ABS(x);
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
- }
- } /* else if (k < 0x3fe00000) */
+ else if (k < 0x3fe00000)
+ {
+ if (k < 0x3fd00000)
+ n = 11 * ((k & 0x000fffff) >> 15);
+ else
+ n = 11 * ((k & 0x000fffff) >> 14) + 352;
+ if (m > 0)
+ xx = x - asncs.x[n];
+ else
+ xx = -x - asncs.x[n];
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * asncs.x[n + 6])))) + asncs.x[n + 7];
+ t += p;
+ res = asncs.x[n + 8] + t;
+ cor = (asncs.x[n + 8] - res) + t;
+ if (res == res + 1.05 * cor)
+{
+ LIBC_PROBE (asin_probe, 2, 4, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ r = asncs.x[n + 8] + xx * asncs.x[n + 9];
+ t =
+ ((asncs.x[n + 8] - r) + xx * asncs.x[n + 9]) + (p +
+ xx * asncs.x[n +
+ 10]);
+ res = r + t;
+ cor = (r - res) + t;
+ if (res == res + 1.0005 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 5, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __dubsin (res, z, w);
+ z = (w[0] - ABS (x)) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 6, &x);
+ return (m > 0) ? min (res, res1) : -min (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 7, &x);
+ return (m > 0) ? max (res, res1) : -max (res, res1);
+ }
+ else
+ {
+ y = ABS (x);
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3fe00000) */
/*-------------------- 0.5 <= |x| < 0.75 -----------------------------*/
- else
- if (k < 0x3fe80000) {
- n = 1056+((k&0x000fe000)>>11)*3;
- if (m>0) xx = x - asncs.x[n];
- else xx = -x - asncs.x[n];
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+xx*(asncs.x[n+5]
- +xx*(asncs.x[n+6]+xx*asncs.x[n+7])))))+asncs.x[n+8];
- t+=p;
- res =asncs.x[n+9] +t;
- cor = (asncs.x[n+9]-res)+t;
- if (res == res+1.01*cor) return (m>0)?res:-res;
- else {
- r=asncs.x[n+9]+xx*asncs.x[n+10];
- t=((asncs.x[n+9]-r)+xx*asncs.x[n+10])+(p+xx*asncs.x[n+11]);
- res = r+t;
- cor = (r-res)+t;
- if (res == res+1.0005*cor) return (m>0)?res:-res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __dubsin(res,z,w);
- z=(w[0]-ABS(x))+w[1];
- if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
- else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
- else {
- y=ABS(x);
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
- }
- } /* else if (k < 0x3fe80000) */
+ else if (k < 0x3fe80000)
+ {
+ n = 1056 + ((k & 0x000fe000) >> 11) * 3;
+ if (m > 0)
+ xx = x - asncs.x[n];
+ else
+ xx = -x - asncs.x[n];
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * asncs.x[n + 7]))))) +
+ asncs.x[n + 8];
+ t += p;
+ res = asncs.x[n + 9] + t;
+ cor = (asncs.x[n + 9] - res) + t;
+ if (res == res + 1.01 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 8, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ r = asncs.x[n + 9] + xx * asncs.x[n + 10];
+ t =
+ ((asncs.x[n + 9] - r) + xx * asncs.x[n + 10]) + (p +
+ xx * asncs.x[n +
+ 11]);
+ res = r + t;
+ cor = (r - res) + t;
+ if (res == res + 1.0005 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 9, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __dubsin (res, z, w);
+ z = (w[0] - ABS (x)) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 10, &x);
+ return (m > 0) ? min (res, res1) : -min (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 11, &x);
+ return (m > 0) ? max (res, res1) : -max (res, res1);
+ }
+ else
+ {
+ y = ABS (x);
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3fe80000) */
/*--------------------- 0.75 <= |x|< 0.921875 ----------------------*/
- else
- if (k < 0x3fed8000) {
- n = 992+((k&0x000fe000)>>13)*13;
- if (m>0) xx = x - asncs.x[n];
- else xx = -x - asncs.x[n];
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+xx*(asncs.x[n+5]
- +xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+xx*asncs.x[n+8]))))))+asncs.x[n+9];
- t+=p;
- res =asncs.x[n+10] +t;
- cor = (asncs.x[n+10]-res)+t;
- if (res == res+1.01*cor) return (m>0)?res:-res;
- else {
- r=asncs.x[n+10]+xx*asncs.x[n+11];
- t=((asncs.x[n+10]-r)+xx*asncs.x[n+11])+(p+xx*asncs.x[n+12]);
- res = r+t;
- cor = (r-res)+t;
- if (res == res+1.0008*cor) return (m>0)?res:-res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- y=hp0.x-res;
- z=((hp0.x-y)-res)+(hp1.x-z);
- __dubcos(y,z,w);
- z=(w[0]-ABS(x))+w[1];
- if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
- else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
- else {
- y=ABS(x);
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
- }
- } /* else if (k < 0x3fed8000) */
+ else if (k < 0x3fed8000)
+ {
+ n = 992 + ((k & 0x000fe000) >> 13) * 13;
+ if (m > 0)
+ xx = x - asncs.x[n];
+ else
+ xx = -x - asncs.x[n];
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * (asncs.x[n + 7] +
+ xx * asncs.x[n + 8])))))) +
+ asncs.x[n + 9];
+ t += p;
+ res = asncs.x[n + 10] + t;
+ cor = (asncs.x[n + 10] - res) + t;
+ if (res == res + 1.01 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 12, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ r = asncs.x[n + 10] + xx * asncs.x[n + 11];
+ t =
+ ((asncs.x[n + 10] - r) + xx * asncs.x[n + 11]) + (p +
+ xx * asncs.x[n +
+ 12]);
+ res = r + t;
+ cor = (r - res) + t;
+ if (res == res + 1.0008 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 13, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ y = hp0.x - res;
+ z = ((hp0.x - y) - res) + (hp1.x - z);
+ __dubcos (y, z, w);
+ z = (w[0] - ABS (x)) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 14, &x);
+ return (m > 0) ? min (res, res1) : -min (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 15, &x);
+ return (m > 0) ? max (res, res1) : -max (res, res1);
+ }
+ else
+ {
+ y = ABS (x);
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3fed8000) */
/*-------------------0.921875 <= |x| < 0.953125 ------------------------*/
- else
- if (k < 0x3fee8000) {
- n = 884+((k&0x000fe000)>>13)*14;
- if (m>0) xx = x - asncs.x[n];
- else xx = -x - asncs.x[n];
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
- +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+
- xx*asncs.x[n+9])))))))+asncs.x[n+10];
- t+=p;
- res =asncs.x[n+11] +t;
- cor = (asncs.x[n+11]-res)+t;
- if (res == res+1.01*cor) return (m>0)?res:-res;
- else {
- r=asncs.x[n+11]+xx*asncs.x[n+12];
- t=((asncs.x[n+11]-r)+xx*asncs.x[n+12])+(p+xx*asncs.x[n+13]);
- res = r+t;
- cor = (r-res)+t;
- if (res == res+1.0007*cor) return (m>0)?res:-res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- y=(hp0.x-res)-z;
- z=y+hp1.x;
- y=(y-z)+hp1.x;
- __dubcos(z,y,w);
- z=(w[0]-ABS(x))+w[1];
- if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
- else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
- else {
- y=ABS(x);
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
- }
- } /* else if (k < 0x3fee8000) */
+ else if (k < 0x3fee8000)
+ {
+ n = 884 + ((k & 0x000fe000) >> 13) * 14;
+ if (m > 0)
+ xx = x - asncs.x[n];
+ else
+ xx = -x - asncs.x[n];
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * (asncs.x[n + 7] +
+ xx * (asncs.x[n + 8] +
+ xx * asncs.x[n +
+ 9])))))))
+ + asncs.x[n + 10];
+ t += p;
+ res = asncs.x[n + 11] + t;
+ cor = (asncs.x[n + 11] - res) + t;
+ if (res == res + 1.01 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 16, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ r = asncs.x[n + 11] + xx * asncs.x[n + 12];
+ t =
+ ((asncs.x[n + 11] - r) + xx * asncs.x[n + 12]) + (p +
+ xx * asncs.x[n +
+ 13]);
+ res = r + t;
+ cor = (r - res) + t;
+ if (res == res + 1.0007 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 17, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ y = (hp0.x - res) - z;
+ z = y + hp1.x;
+ y = (y - z) + hp1.x;
+ __dubcos (z, y, w);
+ z = (w[0] - ABS (x)) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 18, &x);
+ return (m > 0) ? min (res, res1) : -min (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 19, &x);
+ return (m > 0) ? max (res, res1) : -max (res, res1);
+ }
+ else
+ {
+ y = ABS (x);
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3fee8000) */
/*--------------------0.953125 <= |x| < 0.96875 ------------------------*/
- else
- if (k < 0x3fef0000) {
- n = 768+((k&0x000fe000)>>13)*15;
- if (m>0) xx = x - asncs.x[n];
- else xx = -x - asncs.x[n];
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
- +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+
- xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11];
- t+=p;
- res =asncs.x[n+12] +t;
- cor = (asncs.x[n+12]-res)+t;
- if (res == res+1.01*cor) return (m>0)?res:-res;
- else {
- r=asncs.x[n+12]+xx*asncs.x[n+13];
- t=((asncs.x[n+12]-r)+xx*asncs.x[n+13])+(p+xx*asncs.x[n+14]);
- res = r+t;
- cor = (r-res)+t;
- if (res == res+1.0007*cor) return (m>0)?res:-res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- y=(hp0.x-res)-z;
- z=y+hp1.x;
- y=(y-z)+hp1.x;
- __dubcos(z,y,w);
- z=(w[0]-ABS(x))+w[1];
- if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
- else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
- else {
- y=ABS(x);
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
- }
- } /* else if (k < 0x3fef0000) */
+ else if (k < 0x3fef0000)
+ {
+ n = 768 + ((k & 0x000fe000) >> 13) * 15;
+ if (m > 0)
+ xx = x - asncs.x[n];
+ else
+ xx = -x - asncs.x[n];
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * (asncs.x[n + 7] +
+ xx * (asncs.x[n + 8] +
+ xx * (asncs.x[n + 9] +
+ xx * asncs.x[n +
+ 10]))))))))
+ + asncs.x[n + 11];
+ t += p;
+ res = asncs.x[n + 12] + t;
+ cor = (asncs.x[n + 12] - res) + t;
+ if (res == res + 1.01 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 20, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ r = asncs.x[n + 12] + xx * asncs.x[n + 13];
+ t =
+ ((asncs.x[n + 12] - r) + xx * asncs.x[n + 13]) + (p +
+ xx * asncs.x[n +
+ 14]);
+ res = r + t;
+ cor = (r - res) + t;
+ if (res == res + 1.0007 * cor)
+ {
+ LIBC_PROBE (asin_probe, 2, 21, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ y = (hp0.x - res) - z;
+ z = y + hp1.x;
+ y = (y - z) + hp1.x;
+ __dubcos (z, y, w);
+ z = (w[0] - ABS (x)) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 22, &x);
+ return (m > 0) ? min (res, res1) : -min (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (asin_probe, 2, 23, &x);
+ return (m > 0) ? max (res, res1) : -max (res, res1);
+ }
+ else
+ {
+ y = ABS (x);
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3fef0000) */
/*--------------------0.96875 <= |x| < 1 --------------------------------*/
- else
- if (k<0x3ff00000) {
- z = 0.5*((m>0)?(1.0-x):(1.0+x));
- v.x=z;
- k=v.i[HIGH_HALF];
- t=inroot[(k&0x001fffff)>>14]*powtwo[511-(k>>21)];
- r=1.0-t*t*z;
- t = t*(rt0+r*(rt1+r*(rt2+r*rt3)));
- c=t*z;
- t=c*(1.5-0.5*t*c);
- y=(c+t24)-t24;
- cc = (z-y*y)/(t+y);
- p=(((((f6*z+f5)*z+f4)*z+f3)*z+f2)*z+f1)*z;
- cor = (hp1.x - 2.0*cc)-2.0*(y+cc)*p;
- res1 = hp0.x - 2.0*y;
- res =res1 + cor;
- if (res == res+1.003*((res1-res)+cor)) return (m>0)?res:-res;
- else {
- c=y+cc;
- cc=(y-c)+cc;
- __doasin(c,cc,w);
- res1=hp0.x-2.0*w[0];
- cor=((hp0.x-res1)-2.0*w[0])+(hp1.x-2.0*w[1]);
- res = res1+cor;
- cor = (res1-res)+cor;
- if (res==(res+1.0000001*cor)) return (m>0)?res:-res;
- else {
- y=ABS(x);
- res1=res+1.1*cor;
- return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
- }
- }
- } /* else if (k < 0x3ff00000) */
+ else if (k < 0x3ff00000)
+ {
+ z = 0.5 * ((m > 0) ? (1.0 - x) : (1.0 + x));
+ v.x = z;
+ k = v.i[HIGH_HALF];
+ t = inroot[(k & 0x001fffff) >> 14] * powtwo[511 - (k >> 21)];
+ r = 1.0 - t * t * z;
+ t = t * (rt0 + r * (rt1 + r * (rt2 + r * rt3)));
+ c = t * z;
+ t = c * (1.5 - 0.5 * t * c);
+ y = (c + t24) - t24;
+ cc = (z - y * y) / (t + y);
+ p = (((((f6 * z + f5) * z + f4) * z + f3) * z + f2) * z + f1) * z;
+ cor = (hp1.x - 2.0 * cc) - 2.0 * (y + cc) * p;
+ res1 = hp0.x - 2.0 * y;
+ res = res1 + cor;
+ if (res == res + 1.003 * ((res1 - res) + cor))
+ {
+ LIBC_PROBE (asin_probe, 2, 24, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ c = y + cc;
+ cc = (y - c) + cc;
+ __doasin (c, cc, w);
+ res1 = hp0.x - 2.0 * w[0];
+ cor = ((hp0.x - res1) - 2.0 * w[0]) + (hp1.x - 2.0 * w[1]);
+ res = res1 + cor;
+ cor = (res1 - res) + cor;
+ if (res == (res + 1.0000001 * cor))
+ {
+ LIBC_PROBE (asin_probe, 2, 25, &x);
+ return (m > 0) ? res : -res;
+ }
+ else
+ {
+ y = ABS (x);
+ res1 = res + 1.1 * cor;
+ return (m > 0) ? __sin32 (y, res, res1) : -__sin32 (y, res,
+ res1);
+ }
+ }
+ } /* else if (k < 0x3ff00000) */
/*---------------------------- |x|>=1 -------------------------------*/
- else if (k==0x3ff00000 && u.i[LOW_HALF]==0) return (m>0)?hp0.x:-hp0.x;
+ else if (k == 0x3ff00000 && u.i[LOW_HALF] == 0)
+ return (m > 0) ? hp0.x : -hp0.x;
+ else if (k > 0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0))
+ return x;
else
- if (k>0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0)) return x;
- else {
- u.i[HIGH_HALF]=0x7ff00000;
- v.i[HIGH_HALF]=0x7ff00000;
- u.i[LOW_HALF]=0;
- v.i[LOW_HALF]=0;
- return u.x/v.x; /* NaN */
- }
+ {
+ u.i[HIGH_HALF] = 0x7ff00000;
+ v.i[HIGH_HALF] = 0x7ff00000;
+ u.i[LOW_HALF] = 0;
+ v.i[LOW_HALF] = 0;
+ return u.x / v.x; /* NaN */
+ }
}
+
#ifndef __ieee754_asin
strong_alias (__ieee754_asin, __asin_finite)
#endif
-
/*******************************************************************/
/* */
/* End of arcsine, below is arccosine */
/* */
/*******************************************************************/
-
double
SECTION
-__ieee754_acos(double x)
+__ieee754_acos (double x)
{
- double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2],eps;
- mynumber u,v;
- int4 k,m,n;
+ double x1, x2, xx, s1, s2, res1, p, t, res, r, cor, cc, y, c, z, w[2], eps;
+ mynumber u, v;
+ int4 k, m, n;
u.x = x;
m = u.i[HIGH_HALF];
- k = 0x7fffffff&m;
+ k = 0x7fffffff & m;
/*------------------- |x|<2.77556*10^-17 ----------------------*/
- if (k < 0x3c880000) return hp0.x;
+ if (k < 0x3c880000)
+ return hp0.x;
/*----------------- 2.77556*10^-17 <= |x| < 2^-3 --------------*/
- else
- if (k < 0x3fc00000) {
- x2 = x*x;
- t = (((((f6*x2 + f5)*x2 + f4)*x2 + f3)*x2 + f2)*x2 + f1)*(x2*x);
- r=hp0.x-x;
- cor=(((hp0.x-r)-x)+hp1.x)-t;
- res = r+cor;
- cor = (r-res)+cor;
- if (res == res+1.004*cor) return res;
- else {
- x1 = x+big;
- xx = x*x;
- x1 -= big;
- x2 = x - x1;
- p = x1*x1*x1;
- s1 = a1.x*p;
- s2 = ((((((c7*xx + c6)*xx + c5)*xx + c4)*xx + c3)*xx + c2)*xx*xx*x +
- ((a1.x+a2.x)*x2*x2+ 0.5*x1*x)*x2) + a2.x*p;
- res1 = x+s1;
- s2 = ((x-res1)+s1)+s2;
- r=hp0.x-res1;
- cor=(((hp0.x-r)-res1)+hp1.x)-s2;
- res = r+cor;
- cor = (r-res)+cor;
- if (res == res+1.00004*cor) return res;
- else {
- __doasin(x,0,w);
- r=hp0.x-w[0];
- cor=((hp0.x-r)-w[0])+(hp1.x-w[1]);
- res=r+cor;
- cor=(r-res)+cor;
- if (res ==(res +1.00000001*cor)) return res;
- else {
- res1=res+1.1*cor;
- return __cos32(x,res,res1);
- }
- }
- }
- } /* else if (k < 0x3fc00000) */
+ else if (k < 0x3fc00000)
+ {
+ x2 = x * x;
+ t =
+ (((((f6 * x2 + f5) * x2 + f4) * x2 + f3) * x2 + f2) * x2 +
+ f1) * (x2 * x);
+ r = hp0.x - x;
+ cor = (((hp0.x - r) - x) + hp1.x) - t;
+ res = r + cor;
+ cor = (r - res) + cor;
+ if (res == res + 1.004 * cor)
+ {
+ LIBC_PROBE (acos_probe, 2, 1, &x);
+ return res;
+ }
+ else
+ {
+ x1 = x + big;
+ xx = x * x;
+ x1 -= big;
+ x2 = x - x1;
+ p = x1 * x1 * x1;
+ s1 = a1.x * p;
+ s2 =
+ ((((((c7 * xx + c6) * xx + c5) * xx + c4) * xx + c3) * xx +
+ c2) * xx * xx * x + ((a1.x + a2.x) * x2 * x2 +
+ 0.5 * x1 * x) * x2) + a2.x * p;
+ res1 = x + s1;
+ s2 = ((x - res1) + s1) + s2;
+ r = hp0.x - res1;
+ cor = (((hp0.x - r) - res1) + hp1.x) - s2;
+ res = r + cor;
+ cor = (r - res) + cor;
+ if (res == res + 1.00004 * cor)
+ {
+ LIBC_PROBE (acos_probe, 2, 2, &x);
+ return res;
+ }
+ else
+ {
+ __doasin (x, 0, w);
+ r = hp0.x - w[0];
+ cor = ((hp0.x - r) - w[0]) + (hp1.x - w[1]);
+ res = r + cor;
+ cor = (r - res) + cor;
+ if (res == (res + 1.00000001 * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 3, &x);
+ return res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ return __cos32 (x, res, res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3fc00000) */
/*---------------------- 0.125 <= |x| < 0.5 --------------------*/
- else
- if (k < 0x3fe00000) {
- if (k<0x3fd00000) n = 11*((k&0x000fffff)>>15);
- else n = 11*((k&0x000fffff)>>14)+352;
- if (m>0) xx = x - asncs.x[n];
- else xx = -x - asncs.x[n];
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*asncs.x[n+6]))))+asncs.x[n+7];
- t+=p;
- y = (m>0)?(hp0.x-asncs.x[n+8]):(hp0.x+asncs.x[n+8]);
- t = (m>0)?(hp1.x-t):(hp1.x+t);
- res = y+t;
- if (res == res+1.02*((y-res)+t)) return res;
- else {
- r=asncs.x[n+8]+xx*asncs.x[n+9];
- t=((asncs.x[n+8]-r)+xx*asncs.x[n+9])+(p+xx*asncs.x[n+10]);
- if (m>0)
- {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; }
+ else if (k < 0x3fe00000)
+ {
+ if (k < 0x3fd00000)
+ n = 11 * ((k & 0x000fffff) >> 15);
else
- {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); }
- res = p+t;
- cor = (p-res)+t;
- if (res == (res+1.0002*cor)) return res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __docos(res,z,w);
- z=(w[0]-x)+w[1];
- if (z>1.0e-27) return max(res,res1);
- else if (z<-1.0e-27) return min(res,res1);
- else return __cos32(x,res,res1);
- }
- }
- } /* else if (k < 0x3fe00000) */
+ n = 11 * ((k & 0x000fffff) >> 14) + 352;
+ if (m > 0)
+ xx = x - asncs.x[n];
+ else
+ xx = -x - asncs.x[n];
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * asncs.x[n + 6])))) + asncs.x[n + 7];
+ t += p;
+ y = (m > 0) ? (hp0.x - asncs.x[n + 8]) : (hp0.x + asncs.x[n + 8]);
+ t = (m > 0) ? (hp1.x - t) : (hp1.x + t);
+ res = y + t;
+ if (res == res + 1.02 * ((y - res) + t))
+ {
+ LIBC_PROBE (acos_probe, 2, 4, &x);
+ return res;
+ }
+ else
+ {
+ r = asncs.x[n + 8] + xx * asncs.x[n + 9];
+ t =
+ ((asncs.x[n + 8] - r) + xx * asncs.x[n + 9]) + (p +
+ xx * asncs.x[n +
+ 10]);
+ if (m > 0)
+ {
+ p = hp0.x - r;
+ t = (((hp0.x - p) - r) - t) + hp1.x;
+ }
+ else
+ {
+ p = hp0.x + r;
+ t = ((hp0.x - p) + r) + (hp1.x + t);
+ }
+ res = p + t;
+ cor = (p - res) + t;
+ if (res == (res + 1.0002 * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 5, &x);
+ return res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __docos (res, z, w);
+ z = (w[0] - x) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 6, &x);
+ return max (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 7, &x);
+ return min (res, res1);
+ }
+ else
+ return __cos32 (x, res, res1);
+ }
+ }
+ } /* else if (k < 0x3fe00000) */
/*--------------------------- 0.5 <= |x| < 0.75 ---------------------*/
- else
- if (k < 0x3fe80000) {
- n = 1056+((k&0x000fe000)>>11)*3;
- if (m>0) {xx = x - asncs.x[n]; eps=1.04; }
- else {xx = -x - asncs.x[n]; eps=1.02; }
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+
- xx*asncs.x[n+7])))))+asncs.x[n+8];
- t+=p;
- y = (m>0)?(hp0.x-asncs.x[n+9]):(hp0.x+asncs.x[n+9]);
- t = (m>0)?(hp1.x-t):(hp1.x+t);
- res = y+t;
- if (res == res+eps*((y-res)+t)) return res;
- else {
- r=asncs.x[n+9]+xx*asncs.x[n+10];
- t=((asncs.x[n+9]-r)+xx*asncs.x[n+10])+(p+xx*asncs.x[n+11]);
- if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0004; }
- else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0002; }
- res = p+t;
- cor = (p-res)+t;
- if (res == (res+eps*cor)) return res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __docos(res,z,w);
- z=(w[0]-x)+w[1];
- if (z>1.0e-27) return max(res,res1);
- else if (z<-1.0e-27) return min(res,res1);
- else return __cos32(x,res,res1);
- }
- }
- } /* else if (k < 0x3fe80000) */
+ else if (k < 0x3fe80000)
+ {
+ n = 1056 + ((k & 0x000fe000) >> 11) * 3;
+ if (m > 0)
+ {
+ xx = x - asncs.x[n];
+ eps = 1.04;
+ }
+ else
+ {
+ xx = -x - asncs.x[n];
+ eps = 1.02;
+ }
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * asncs.x[n + 7]))))) +
+ asncs.x[n + 8];
+ t += p;
+ y = (m > 0) ? (hp0.x - asncs.x[n + 9]) : (hp0.x + asncs.x[n + 9]);
+ t = (m > 0) ? (hp1.x - t) : (hp1.x + t);
+ res = y + t;
+ if (res == res + eps * ((y - res) + t))
+ {
+ LIBC_PROBE (acos_probe, 2, 8, &x);
+ return res;
+ }
+ else
+ {
+ r = asncs.x[n + 9] + xx * asncs.x[n + 10];
+ t =
+ ((asncs.x[n + 9] - r) + xx * asncs.x[n + 10]) + (p +
+ xx * asncs.x[n +
+ 11]);
+ if (m > 0)
+ {
+ p = hp0.x - r;
+ t = (((hp0.x - p) - r) - t) + hp1.x;
+ eps = 1.0004;
+ }
+ else
+ {
+ p = hp0.x + r;
+ t = ((hp0.x - p) + r) + (hp1.x + t);
+ eps = 1.0002;
+ }
+ res = p + t;
+ cor = (p - res) + t;
+ if (res == (res + eps * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 9, &x);
+ return res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __docos (res, z, w);
+ z = (w[0] - x) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 10, &x);
+ return max (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 11, &x);
+ return min (res, res1);
+ }
+ else
+ return __cos32 (x, res, res1);
+ }
+ }
+ } /* else if (k < 0x3fe80000) */
/*------------------------- 0.75 <= |x| < 0.921875 -------------*/
- else
- if (k < 0x3fed8000) {
- n = 992+((k&0x000fe000)>>13)*13;
- if (m>0) {xx = x - asncs.x[n]; eps = 1.04; }
- else {xx = -x - asncs.x[n]; eps = 1.01; }
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+
- xx*asncs.x[n+8]))))))+asncs.x[n+9];
- t+=p;
- y = (m>0)?(hp0.x-asncs.x[n+10]):(hp0.x+asncs.x[n+10]);
- t = (m>0)?(hp1.x-t):(hp1.x+t);
- res = y+t;
- if (res == res+eps*((y-res)+t)) return res;
- else {
- r=asncs.x[n+10]+xx*asncs.x[n+11];
- t=((asncs.x[n+10]-r)+xx*asncs.x[n+11])+(p+xx*asncs.x[n+12]);
- if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0032; }
- else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0008; }
- res = p+t;
- cor = (p-res)+t;
- if (res == (res+eps*cor)) return res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __docos(res,z,w);
- z=(w[0]-x)+w[1];
- if (z>1.0e-27) return max(res,res1);
- else if (z<-1.0e-27) return min(res,res1);
- else return __cos32(x,res,res1);
- }
- }
- } /* else if (k < 0x3fed8000) */
+ else if (k < 0x3fed8000)
+ {
+ n = 992 + ((k & 0x000fe000) >> 13) * 13;
+ if (m > 0)
+ {
+ xx = x - asncs.x[n];
+ eps = 1.04;
+ }
+ else
+ {
+ xx = -x - asncs.x[n];
+ eps = 1.01;
+ }
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * (asncs.x[n + 7] +
+ xx * asncs.x[n + 8])))))) +
+ asncs.x[n + 9];
+ t += p;
+ y = (m > 0) ? (hp0.x - asncs.x[n + 10]) : (hp0.x + asncs.x[n + 10]);
+ t = (m > 0) ? (hp1.x - t) : (hp1.x + t);
+ res = y + t;
+ if (res == res + eps * ((y - res) + t))
+ {
+ LIBC_PROBE (acos_probe, 2, 12, &x);
+ return res;
+ }
+ else
+ {
+ r = asncs.x[n + 10] + xx * asncs.x[n + 11];
+ t =
+ ((asncs.x[n + 10] - r) + xx * asncs.x[n + 11]) + (p +
+ xx * asncs.x[n +
+ 12]);
+ if (m > 0)
+ {
+ p = hp0.x - r;
+ t = (((hp0.x - p) - r) - t) + hp1.x;
+ eps = 1.0032;
+ }
+ else
+ {
+ p = hp0.x + r;
+ t = ((hp0.x - p) + r) + (hp1.x + t);
+ eps = 1.0008;
+ }
+ res = p + t;
+ cor = (p - res) + t;
+ if (res == (res + eps * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 13, &x);
+ return res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __docos (res, z, w);
+ z = (w[0] - x) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 14, &x);
+ return max (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 15, &x);
+ return min (res, res1);
+ }
+ else
+ return __cos32 (x, res, res1);
+ }
+ }
+ } /* else if (k < 0x3fed8000) */
/*-------------------0.921875 <= |x| < 0.953125 ------------------*/
- else
- if (k < 0x3fee8000) {
- n = 884+((k&0x000fe000)>>13)*14;
- if (m>0) {xx = x - asncs.x[n]; eps=1.04; }
- else {xx = -x - asncs.x[n]; eps =1.005; }
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
- +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+
- xx*asncs.x[n+9])))))))+asncs.x[n+10];
- t+=p;
- y = (m>0)?(hp0.x-asncs.x[n+11]):(hp0.x+asncs.x[n+11]);
- t = (m>0)?(hp1.x-t):(hp1.x+t);
- res = y+t;
- if (res == res+eps*((y-res)+t)) return res;
- else {
- r=asncs.x[n+11]+xx*asncs.x[n+12];
- t=((asncs.x[n+11]-r)+xx*asncs.x[n+12])+(p+xx*asncs.x[n+13]);
- if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0030; }
- else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0005; }
- res = p+t;
- cor = (p-res)+t;
- if (res == (res+eps*cor)) return res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __docos(res,z,w);
- z=(w[0]-x)+w[1];
- if (z>1.0e-27) return max(res,res1);
- else if (z<-1.0e-27) return min(res,res1);
- else return __cos32(x,res,res1);
- }
- }
- } /* else if (k < 0x3fee8000) */
+ else if (k < 0x3fee8000)
+ {
+ n = 884 + ((k & 0x000fe000) >> 13) * 14;
+ if (m > 0)
+ {
+ xx = x - asncs.x[n];
+ eps = 1.04;
+ }
+ else
+ {
+ xx = -x - asncs.x[n];
+ eps = 1.005;
+ }
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * (asncs.x[n + 7] +
+ xx * (asncs.x[n + 8] +
+ xx * asncs.x[n +
+ 9])))))))
+ + asncs.x[n + 10];
+ t += p;
+ y = (m > 0) ? (hp0.x - asncs.x[n + 11]) : (hp0.x + asncs.x[n + 11]);
+ t = (m > 0) ? (hp1.x - t) : (hp1.x + t);
+ res = y + t;
+ if (res == res + eps * ((y - res) + t))
+ {
+ LIBC_PROBE (acos_probe, 2, 16, &x);
+ return res;
+ }
+ else
+ {
+ r = asncs.x[n + 11] + xx * asncs.x[n + 12];
+ t =
+ ((asncs.x[n + 11] - r) + xx * asncs.x[n + 12]) + (p +
+ xx * asncs.x[n +
+ 13]);
+ if (m > 0)
+ {
+ p = hp0.x - r;
+ t = (((hp0.x - p) - r) - t) + hp1.x;
+ eps = 1.0030;
+ }
+ else
+ {
+ p = hp0.x + r;
+ t = ((hp0.x - p) + r) + (hp1.x + t);
+ eps = 1.0005;
+ }
+ res = p + t;
+ cor = (p - res) + t;
+ if (res == (res + eps * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 17, &x);
+ return res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __docos (res, z, w);
+ z = (w[0] - x) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 18, &x);
+ return max (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 19, &x);
+ return min (res, res1);
+ }
+ else
+ return __cos32 (x, res, res1);
+ }
+ }
+ } /* else if (k < 0x3fee8000) */
/*--------------------0.953125 <= |x| < 0.96875 ----------------*/
- else
- if (k < 0x3fef0000) {
- n = 768+((k&0x000fe000)>>13)*15;
- if (m>0) {xx = x - asncs.x[n]; eps=1.04; }
- else {xx = -x - asncs.x[n]; eps=1.005;}
- t = asncs.x[n+1]*xx;
- p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
- +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+xx*(asncs.x[n+9]+
- xx*asncs.x[n+10]))))))))+asncs.x[n+11];
- t+=p;
- y = (m>0)?(hp0.x-asncs.x[n+12]):(hp0.x+asncs.x[n+12]);
- t = (m>0)?(hp1.x-t):(hp1.x+t);
- res = y+t;
- if (res == res+eps*((y-res)+t)) return res;
- else {
- r=asncs.x[n+12]+xx*asncs.x[n+13];
- t=((asncs.x[n+12]-r)+xx*asncs.x[n+13])+(p+xx*asncs.x[n+14]);
- if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0030; }
- else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0005; }
- res = p+t;
- cor = (p-res)+t;
- if (res == (res+eps*cor)) return res;
- else {
- res1=res+1.1*cor;
- z=0.5*(res1-res);
- __docos(res,z,w);
- z=(w[0]-x)+w[1];
- if (z>1.0e-27) return max(res,res1);
- else if (z<-1.0e-27) return min(res,res1);
- else return __cos32(x,res,res1);
- }
- }
- } /* else if (k < 0x3fef0000) */
+ else if (k < 0x3fef0000)
+ {
+ n = 768 + ((k & 0x000fe000) >> 13) * 15;
+ if (m > 0)
+ {
+ xx = x - asncs.x[n];
+ eps = 1.04;
+ }
+ else
+ {
+ xx = -x - asncs.x[n];
+ eps = 1.005;
+ }
+ t = asncs.x[n + 1] * xx;
+ p =
+ xx * xx * (asncs.x[n + 2] +
+ xx * (asncs.x[n + 3] +
+ xx * (asncs.x[n + 4] +
+ xx * (asncs.x[n + 5] +
+ xx * (asncs.x[n + 6] +
+ xx * (asncs.x[n + 7] +
+ xx * (asncs.x[n + 8] +
+ xx * (asncs.x[n + 9] +
+ xx * asncs.x[n +
+ 10]))))))))
+ + asncs.x[n + 11];
+ t += p;
+ y = (m > 0) ? (hp0.x - asncs.x[n + 12]) : (hp0.x + asncs.x[n + 12]);
+ t = (m > 0) ? (hp1.x - t) : (hp1.x + t);
+ res = y + t;
+ if (res == res + eps * ((y - res) + t))
+ {
+ LIBC_PROBE (acos_probe, 2, 20, &x);
+ return res;
+ }
+ else
+ {
+ r = asncs.x[n + 12] + xx * asncs.x[n + 13];
+ t =
+ ((asncs.x[n + 12] - r) + xx * asncs.x[n + 13]) + (p +
+ xx * asncs.x[n +
+ 14]);
+ if (m > 0)
+ {
+ p = hp0.x - r;
+ t = (((hp0.x - p) - r) - t) + hp1.x;
+ eps = 1.0030;
+ }
+ else
+ {
+ p = hp0.x + r;
+ t = ((hp0.x - p) + r) + (hp1.x + t);
+ eps = 1.0005;
+ }
+ res = p + t;
+ cor = (p - res) + t;
+ if (res == (res + eps * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 21, &x);
+ return res;
+ }
+ else
+ {
+ res1 = res + 1.1 * cor;
+ z = 0.5 * (res1 - res);
+ __docos (res, z, w);
+ z = (w[0] - x) + w[1];
+ if (z > 1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 22, &x);
+ return max (res, res1);
+ }
+ else if (z < -1.0e-27)
+ {
+ LIBC_PROBE (acos_probe, 2, 23, &x);
+ return min (res, res1);
+ }
+ else
+ return __cos32 (x, res, res1);
+ }
+ }
+ } /* else if (k < 0x3fef0000) */
/*-----------------0.96875 <= |x| < 1 ---------------------------*/
- else
- if (k<0x3ff00000) {
- z = 0.5*((m>0)?(1.0-x):(1.0+x));
- v.x=z;
- k=v.i[HIGH_HALF];
- t=inroot[(k&0x001fffff)>>14]*powtwo[511-(k>>21)];
- r=1.0-t*t*z;
- t = t*(rt0+r*(rt1+r*(rt2+r*rt3)));
- c=t*z;
- t=c*(1.5-0.5*t*c);
- y = (t27*c+c)-t27*c;
- cc = (z-y*y)/(t+y);
- p=(((((f6*z+f5)*z+f4)*z+f3)*z+f2)*z+f1)*z;
- if (m<0) {
- cor = (hp1.x - cc)-(y+cc)*p;
- res1 = hp0.x - y;
- res =res1 + cor;
- if (res == res+1.002*((res1-res)+cor)) return (res+res);
- else {
- c=y+cc;
- cc=(y-c)+cc;
- __doasin(c,cc,w);
- res1=hp0.x-w[0];
- cor=((hp0.x-res1)-w[0])+(hp1.x-w[1]);
- res = res1+cor;
- cor = (res1-res)+cor;
- if (res==(res+1.000001*cor)) return (res+res);
- else {
- res=res+res;
- res1=res+1.2*cor;
- return __cos32(x,res,res1);
- }
- }
- }
- else {
- cor = cc+p*(y+cc);
- res = y + cor;
- if (res == res+1.03*((y-res)+cor)) return (res+res);
- else {
- c=y+cc;
- cc=(y-c)+cc;
- __doasin(c,cc,w);
- res = w[0];
- cor=w[1];
- if (res==(res+1.000001*cor)) return (res+res);
- else {
- res=res+res;
- res1=res+1.2*cor;
- return __cos32(x,res,res1);
- }
- }
- }
- } /* else if (k < 0x3ff00000) */
+ else if (k < 0x3ff00000)
+ {
+ z = 0.5 * ((m > 0) ? (1.0 - x) : (1.0 + x));
+ v.x = z;
+ k = v.i[HIGH_HALF];
+ t = inroot[(k & 0x001fffff) >> 14] * powtwo[511 - (k >> 21)];
+ r = 1.0 - t * t * z;
+ t = t * (rt0 + r * (rt1 + r * (rt2 + r * rt3)));
+ c = t * z;
+ t = c * (1.5 - 0.5 * t * c);
+ y = (t27 * c + c) - t27 * c;
+ cc = (z - y * y) / (t + y);
+ p = (((((f6 * z + f5) * z + f4) * z + f3) * z + f2) * z + f1) * z;
+ if (m < 0)
+ {
+ cor = (hp1.x - cc) - (y + cc) * p;
+ res1 = hp0.x - y;
+ res = res1 + cor;
+ if (res == res + 1.002 * ((res1 - res) + cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 24, &x);
+ return (res + res);
+ }
+ else
+ {
+ c = y + cc;
+ cc = (y - c) + cc;
+ __doasin (c, cc, w);
+ res1 = hp0.x - w[0];
+ cor = ((hp0.x - res1) - w[0]) + (hp1.x - w[1]);
+ res = res1 + cor;
+ cor = (res1 - res) + cor;
+ if (res == (res + 1.000001 * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 25, &x);
+ return (res + res);
+ }
+ else
+ {
+ res = res + res;
+ res1 = res + 1.2 * cor;
+ return __cos32 (x, res, res1);
+ }
+ }
+ }
+ else
+ {
+ cor = cc + p * (y + cc);
+ res = y + cor;
+ if (res == res + 1.03 * ((y - res) + cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 26, &x);
+ return (res + res);
+ }
+ else
+ {
+ c = y + cc;
+ cc = (y - c) + cc;
+ __doasin (c, cc, w);
+ res = w[0];
+ cor = w[1];
+ if (res == (res + 1.000001 * cor))
+ {
+ LIBC_PROBE (acos_probe, 2, 27, &x);
+ return (res + res);
+ }
+ else
+ {
+ res = res + res;
+ res1 = res + 1.2 * cor;
+ return __cos32 (x, res, res1);
+ }
+ }
+ }
+ } /* else if (k < 0x3ff00000) */
/*---------------------------- |x|>=1 -----------------------*/
+ else if (k == 0x3ff00000 && u.i[LOW_HALF] == 0)
+ return (m > 0) ? 0 : 2.0 * hp0.x;
+ else if (k > 0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0))
+ return x;
else
- if (k==0x3ff00000 && u.i[LOW_HALF]==0) return (m>0)?0:2.0*hp0.x;
- else
- if (k>0x7ff00000 || (k == 0x7ff00000 && u.i[LOW_HALF] != 0)) return x;
- else {
- u.i[HIGH_HALF]=0x7ff00000;
- v.i[HIGH_HALF]=0x7ff00000;
- u.i[LOW_HALF]=0;
- v.i[LOW_HALF]=0;
- return u.x/v.x;
- }
+ {
+ u.i[HIGH_HALF] = 0x7ff00000;
+ v.i[HIGH_HALF] = 0x7ff00000;
+ u.i[LOW_HALF] = 0;
+ v.i[LOW_HALF] = 0;
+ return u.x / v.x;
+ }
}
+
#ifndef __ieee754_acos
strong_alias (__ieee754_acos, __acos_finite)
#endif
diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c
index 21bb990..c12473f 100644
--- a/sysdeps/ieee754/dbl-64/e_atanh.c
+++ b/sysdeps/ieee754/dbl-64/e_atanh.c
@@ -38,6 +38,7 @@
#include <inttypes.h>
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double huge = 1e300;
@@ -56,9 +57,13 @@ __ieee754_atanh (double x)
t = xa + xa;
t = 0.5 * __log1p (t + t * xa / (1.0 - xa));
+ LIBC_PROBE (atanh_probe, 2, 1, &x);
}
else if (__builtin_expect (isless (xa, 1.0), 1))
+ {
+ LIBC_PROBE (atanh_probe, 2, 2, &x);
t = 0.5 * __log1p ((xa + xa) / (1.0 - xa));
+ }
else
{
if (isgreater (xa, 1.0))
diff --git a/sysdeps/ieee754/dbl-64/e_cosh.c b/sysdeps/ieee754/dbl-64/e_cosh.c
index 6caf943..798591d 100644
--- a/sysdeps/ieee754/dbl-64/e_cosh.c
+++ b/sysdeps/ieee754/dbl-64/e_cosh.c
@@ -33,6 +33,7 @@
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double one = 1.0, half = 0.5, huge = 1.0e300;
@@ -55,11 +56,13 @@ __ieee754_cosh (double x)
{
t = __expm1 (fabs (x));
w = one + t;
+ LIBC_PROBE (cosh_probe, 2, 1, &x);
if (ix < 0x3c800000)
return w; /* cosh(tiny) = 1 */
return one + (t * t) / (w + w);
}
+ LIBC_PROBE (cosh_probe, 2, 2, &x);
/* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
t = __ieee754_exp (fabs (x));
return half * t + half / t;
@@ -67,7 +70,10 @@ __ieee754_cosh (double x)
/* |x| in [22, log(maxdouble)] return half*exp(|x|) */
if (ix < 0x40862e42)
+ {
+ LIBC_PROBE (cosh_probe, 2, 3, &x);
return half * __ieee754_exp (fabs (x));
+ }
/* |x| in [log(maxdouble), overflowthresold] */
GET_LOW_WORD (lx, x);
@@ -75,6 +81,7 @@ __ieee754_cosh (double x)
{
w = __ieee754_exp (half * fabs (x));
t = half * w;
+ LIBC_PROBE (cosh_probe, 2, 4, &x);
return t * w;
}
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 1c5f4b3..4664f7d 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -42,6 +42,7 @@
#include "upow.tbl"
#include <math_private.h>
#include <fenv.h>
+#include <stap-probe.h>
#ifndef SECTION
# define SECTION
@@ -65,6 +66,7 @@ __ieee754_pow (double x, double y)
double z, a, aa, error, t, a1, a2, y1, y2;
mynumber u, v;
int k;
+ int retcode = -1;
int4 qx, qy;
v.x = y;
u.x = x;
@@ -110,7 +112,16 @@ __ieee754_pow (double x, double y)
a2 = (a - a1) + aa;
error = error * ABS (y);
t = __exp1 (a1, a2, 1.9e16 * error); /* return -10 or 0 if wasn't computed exactly */
- retval = (t > 0) ? t : power1 (x, y);
+ if (t > 0)
+ {
+ retval = t;
+ retcode = 1;
+ LIBC_PROBE (pow_probe, 3, &x, &y, &retcode);
+ }
+ else
+ {
+ retval = power1 (x, y);
+ }
return retval;
}
@@ -140,6 +151,8 @@ __ieee754_pow (double x, double y)
/* if x<0 */
if (u.i[HIGH_HALF] < 0)
{
+ retcode = 2;
+ LIBC_PROBE (pow_probe, 3, &x, &y, &retcode);
k = checkint (y);
if (k == 0)
{
@@ -199,6 +212,7 @@ static double
SECTION
power1 (double x, double y)
{
+ int retcode = 3;
double z, a, aa, error, t, a1, a2, y1, y2;
z = my_log2 (x, &aa, &error);
t = y * CN;
@@ -213,7 +227,13 @@ power1 (double x, double y)
a2 = (a - a1) + aa;
error = error * ABS (y);
t = __exp1 (a1, a2, 1.9e16 * error);
- return (t >= 0) ? t : __slowpow (x, y, z);
+ if (t >= 0)
+ {
+ LIBC_PROBE (pow_probe, 3, &x, &y, &retcode);
+ return t;
+ }
+ else
+ return __slowpow (x, y, z);
}
/* Compute log(x) (x is left argument). The result is the returned double + the
diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c
index 851b510..f3e1a8f 100644
--- a/sysdeps/ieee754/dbl-64/e_sinh.c
+++ b/sysdeps/ieee754/dbl-64/e_sinh.c
@@ -34,6 +34,7 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double one = 1.0, shuge = 1.0e307;
@@ -63,6 +64,7 @@ __ieee754_sinh (double x)
return x;
/* sinh(tiny) = tiny with inexact */
t = __expm1 (fabs (x));
+ LIBC_PROBE (sinh_probe, 2, 1, &x);
if (ix < 0x3ff00000)
return h * (2.0 * t - t * t / (t + one));
return h * (t + t / (t + one));
@@ -70,12 +72,16 @@ __ieee754_sinh (double x)
/* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
if (ix < 0x40862e42)
+ {
+ LIBC_PROBE (sinh_probe, 2, 2, &x);
return h * __ieee754_exp (fabs (x));
+ }
/* |x| in [log(maxdouble), overflowthresold] */
GET_LOW_WORD (lx, x);
if (ix < 0x408633ce || ((ix == 0x408633ce) && (lx <= (u_int32_t) 0x8fb9f87d)))
{
+ LIBC_PROBE (sinh_probe, 2, 3, &x);
w = __ieee754_exp (0.5 * fabs (x));
t = h * w;
return t * w;
diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c
index 5500746..143122b 100644
--- a/sysdeps/ieee754/dbl-64/s_asinh.c
+++ b/sysdeps/ieee754/dbl-64/s_asinh.c
@@ -23,6 +23,7 @@
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
@@ -46,6 +47,7 @@ __asinh (double x)
if (ix >= 0x7ff00000)
return x + x; /* x is inf or NaN */
w = __ieee754_log (fabs (x)) + ln2;
+ LIBC_PROBE (asinh_probe, 2, 1, &x);
}
else
{
@@ -54,11 +56,13 @@ __asinh (double x)
{
w = __ieee754_log (2.0 * xa + one / (__ieee754_sqrt (xa * xa + one) +
xa));
+ LIBC_PROBE (asinh_probe, 2, 2, &x);
}
else /* 2.0 > |x| > 2**-28 */
{
double t = xa * xa;
w = __log1p (xa + t / (one + __ieee754_sqrt (one + t)));
+ LIBC_PROBE (asinh_probe, 2, 3, &x);
}
}
return __copysign (w, x);
diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c
index 0aa145c..456ffea 100644
--- a/sysdeps/ieee754/dbl-64/s_atan.c
+++ b/sysdeps/ieee754/dbl-64/s_atan.c
@@ -97,7 +97,10 @@ atan (double x)
yy *= x * v;
if ((y = x + (yy - U1 * x)) == x + (yy + U1 * x))
+ {
+ LIBC_PROBE (atan_probe, 2, 1, &x);
return y;
+ }
EMULV (x, x, v, vv, t1, t2, t3, t4, t5); /* v+vv=x^2 */
@@ -119,7 +122,10 @@ atan (double x)
t8);
ADD2 (x, 0, s2, ss2, s1, ss1, t1, t2);
if ((y = s1 + (ss1 - U5 * s1)) == s1 + (ss1 + U5 * s1))
+ {
+ LIBC_PROBE (atan_probe, 2, 2, &x);
return y;
+ }
return atanMp (x, pr);
}
@@ -151,7 +157,10 @@ atan (double x)
u2 = U24;
} /* 3/4 <= u <= 1 */
if ((y = t1 + (yy - u2 * t1)) == t1 + (yy + u2 * t1))
+ {
+ LIBC_PROBE (atan_probe, 2, 3, &x);
return __signArctan (x, y);
+ }
z = u - hij[i][0].d;
@@ -171,7 +180,10 @@ atan (double x)
MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2, t3, t4, t5, t6, t7, t8);
ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2);
if ((y = s2 + (ss2 - U6 * s2)) == s2 + (ss2 + U6 * s2))
+ {
+ LIBC_PROBE (atan_probe, 2, 4, &x);
return __signArctan (x, y);
+ }
return atanMp (x, pr);
}
@@ -199,7 +211,10 @@ atan (double x)
else
u3 = U32; /* w >= 1/2 */
if ((y = t1 + (yy - u3)) == t1 + (yy + u3))
+ {
+ LIBC_PROBE (atan_probe, 2, 5, &x);
return __signArctan (x, y);
+ }
DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8, t9,
t10);
@@ -223,7 +238,10 @@ atan (double x)
ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2);
SUB2 (HPI, HPI1, s2, ss2, s1, ss1, t1, t2);
if ((y = s1 + (ss1 - U7)) == s1 + (ss1 + U7))
+ {
+ LIBC_PROBE (atan_probe, 2, 6, &x);
return __signArctan (x, y);
+ }
return atanMp (x, pr);
}
@@ -246,7 +264,10 @@ atan (double x)
ESUB (HPI, w, t3, cor);
yy = ((HPI1 + cor) - ww) - yy;
if ((y = t3 + (yy - U4)) == t3 + (yy + U4))
+ {
+ LIBC_PROBE (atan_probe, 2, 7, &x);
return __signArctan (x, y);
+ }
DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8,
t9, t10);
@@ -271,7 +292,10 @@ atan (double x)
SUB2 (HPI, HPI1, s1, ss1, s2, ss2, t1, t2);
if ((y = s2 + (ss2 - U8)) == s2 + (ss2 + U8))
+ {
+ LIBC_PROBE (atan_probe, 2, 8, &x);
return __signArctan (x, y);
+ }
return atanMp (x, pr);
}
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 6105e9f..7210daf 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -303,7 +303,7 @@ __sin (double x)
t = POLYNOMIAL (xx) * (xx * x);
res = x + t;
cor = (x - res) + t;
- retval = (res == res + 1.07 * cor) ? res : slow (x);
+ if (res == res + 1.07 * cor) { LIBC_PROBE (sin_probe, 2, 1, &x); retval = res; } else retval = slow (x);
} /* else if (k < 0x3fd00000) */
/*---------------------------- 0.25<|x|< 0.855469---------------------- */
else if (k < 0x3feb6000)
@@ -322,7 +322,7 @@ __sin (double x)
cor = (ssn + s * ccs - sn * c) + cs * s;
res = sn + cor;
cor = (sn - res) + cor;
- retval = (res == res + 1.096 * cor) ? res : slow1 (x);
+ if (res == res + 1.096 * cor) { LIBC_PROBE (sin_probe, 2, 2, &x); retval = res; } else retval = slow1 (x);
} /* else if (k < 0x3feb6000) */
/*----------------------- 0.855469 <|x|<2.426265 ----------------------*/
@@ -341,7 +341,7 @@ __sin (double x)
y = (-hp1) - (y + (u.x - big));
}
res = do_cos (u, y, &cor);
- retval = (res == res + 1.020 * cor) ? ((m > 0) ? res : -res) : slow2 (x);
+ if (res == res + 1.020 * cor) { LIBC_PROBE (sin_probe, 2, 3, &x); retval = ((m > 0) ? res : -res); } else retval = slow2 (x);
} /* else if (k < 0x400368fd) */
/*-------------------------- 2.426265<|x|< 105414350 ----------------------*/
@@ -372,7 +372,7 @@ __sin (double x)
/* Taylor series. */
res = TAYLOR_SIN (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
- retval = (res == res + cor) ? res : sloww (a, da, x);
+ if (res == res + cor) { LIBC_PROBE (sin_probe, 2, 4, &x); retval = res; } else retval = sloww (a, da, x);
}
else
{
@@ -388,8 +388,7 @@ __sin (double x)
y = a - (u.x - big);
res = do_sin (u, y, da, &cor);
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- retval = ((res == res + cor) ? ((m) ? res : -res)
- : sloww1 (a, da, x, m));
+ if (res == res + cor) { LIBC_PROBE (sin_probe, 2, 5, &x); retval = ((m) ? res : -res); } else retval = sloww1 (a, da, x, m);
}
break;
@@ -404,8 +403,7 @@ __sin (double x)
y = a - (u.x - big) + da;
res = do_cos (u, y, &cor);
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
- retval = ((res == res + cor) ? ((n & 2) ? -res : res)
- : sloww2 (a, da, x, n));
+ if (res == res + cor) { LIBC_PROBE (sin_probe, 2, 6, &x); retval = ((n & 2) ? -res : res); } else retval = sloww2 (a, da, x, n);
break;
}
} /* else if (k < 0x419921FB ) */
@@ -443,7 +441,7 @@ __sin (double x)
/* Taylor series. */
res = TAYLOR_SIN (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
- retval = (res == res + cor) ? res : bsloww (a, da, x, n);
+ if (res == res + cor) { LIBC_PROBE (sin_probe, 2, 7, &x); retval = res; } else retval = bsloww (a, da, x, n);
}
else
{
@@ -462,8 +460,7 @@ __sin (double x)
y = a - (u.x - big);
res = do_sin (u, y, db, &cor);
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- retval = ((res == res + cor) ? ((m) ? res : -res)
- : bsloww1 (a, da, x, n));
+ if (res == res + cor) { LIBC_PROBE (sin_probe, 2, 8, &x); retval = ((m) ? res : -res); } else retval = bsloww1 (a, da, x, n);
}
break;
@@ -478,8 +475,7 @@ __sin (double x)
y = a - (u.x - big) + da;
res = do_cos (u, y, &cor);
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
- retval = ((res == res + cor) ? ((n & 2) ? -res : res)
- : bsloww2 (a, da, x, n));
+ if (res == res + cor) { LIBC_PROBE (sin_probe, 2, 9, &x); retval = ((n & 2) ? -res : res); } else retval = bsloww2 (a, da, x, n);
break;
}
} /* else if (k < 0x42F00000 ) */
@@ -532,7 +528,7 @@ __cos (double x)
u.x = big + y;
y = y - (u.x - big);
res = do_cos (u, y, &cor);
- retval = (res == res + 1.020 * cor) ? res : cslow2 (x);
+ if (res == res + 1.020 * cor) { LIBC_PROBE (cos_probe, 2, 1, &x); retval = res; } else retval = cslow2 (x);
} /* else if (k < 0x3feb6000) */
else if (k < 0x400368fd)
@@ -545,7 +541,7 @@ __cos (double x)
{
res = TAYLOR_SIN (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + 1.0e-31 : 1.02 * cor - 1.0e-31;
- retval = (res == res + cor) ? res : csloww (a, da, x);
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 2, &x); retval = res; } else retval = csloww (a, da, x);
}
else
{
@@ -563,8 +559,7 @@ __cos (double x)
y = a - (u.x - big);
res = do_sin (u, y, da, &cor);
cor = (cor > 0) ? 1.035 * cor + 1.0e-31 : 1.035 * cor - 1.0e-31;
- retval = ((res == res + cor) ? ((m) ? res : -res)
- : csloww1 (a, da, x, m));
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 3, &x); retval = ((m) ? res : -res); } else retval = csloww1 (a, da, x, m);
}
} /* else if (k < 0x400368fd) */
@@ -596,7 +591,7 @@ __cos (double x)
{
res = TAYLOR_SIN (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
- retval = (res == res + cor) ? res : csloww (a, da, x);
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 4, &x); retval = res; } else retval = csloww (a, da, x);
}
else
{
@@ -614,8 +609,7 @@ __cos (double x)
y = a - (u.x - big);
res = do_sin (u, y, da, &cor);
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- retval = ((res == res + cor) ? ((m) ? res : -res)
- : csloww1 (a, da, x, m));
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 5, &x); retval = ((m) ? res : -res); } else retval = csloww1 (a, da, x, m);
}
break;
@@ -630,8 +624,7 @@ __cos (double x)
y = a - (u.x - big) + da;
res = do_cos (u, y, &cor);
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
- retval = ((res == res + cor) ? ((n) ? -res : res)
- : csloww2 (a, da, x, n));
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 6, &x); retval = ((n) ? -res : res); } else retval = csloww2 (a, da, x, n);
break;
}
} /* else if (k < 0x419921FB ) */
@@ -667,7 +660,7 @@ __cos (double x)
{
res = TAYLOR_SIN (xx, a, da, cor);
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
- retval = (res == res + cor) ? res : bsloww (a, da, x, n);
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 7, &x); retval = res; } else retval = bsloww (a, da, x, n);
}
else
{
@@ -686,8 +679,7 @@ __cos (double x)
y = a - (u.x - big);
res = do_sin (u, y, db, &cor);
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- retval = ((res == res + cor) ? ((m) ? res : -res)
- : bsloww1 (a, da, x, n));
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 8, &x); retval = ((m) ? res : -res); } else retval = bsloww1 (a, da, x, n);
}
break;
@@ -702,8 +694,7 @@ __cos (double x)
y = a - (u.x - big) + da;
res = do_cos (u, y, &cor);
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
- retval = ((res == res + cor) ? ((n) ? -res : res)
- : bsloww2 (a, da, x, n));
+ if (res == res + cor) { LIBC_PROBE (cos_probe, 2, 9, &x); retval = ((n) ? -res : res); } else retval = bsloww2 (a, da, x, n);
break;
}
} /* else if (k < 0x42F00000 ) */
@@ -734,12 +725,18 @@ slow (double x)
double res, cor, w[2];
res = TAYLOR_SLOW (x, 0, cor);
if (res == res + 1.0007 * cor)
- return res;
+ {
+ LIBC_PROBE (sin_probe, 2, 10, &x);
+ return res;
+ }
else
{
__dubsin (ABS (x), 0, w);
if (w[0] == w[0] + 1.000000001 * w[1])
+ {
+ LIBC_PROBE (sin_probe, 2, 11, &x);
return (x > 0) ? w[0] : -w[0];
+ }
else
return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
}
@@ -761,12 +758,18 @@ slow1 (double x)
y = y - (u.x - big);
res = do_sin_slow (u, y, 0, 0, &cor);
if (res == res + cor)
+ {
+ LIBC_PROBE (sin_probe, 2, 12, &x);
return (x > 0) ? res : -res;
+ }
else
{
__dubsin (ABS (x), 0, w);
if (w[0] == w[0] + 1.000000005 * w[1])
+ {
+ LIBC_PROBE (sin_probe, 2, 13, &x);
return (x > 0) ? w[0] : -w[0];
+ }
else
return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
}
@@ -799,7 +802,8 @@ slow2 (double x)
}
res = do_cos_slow (u, y, del, 0, &cor);
if (res == res + cor)
- return (x > 0) ? res : -res;
+ { LIBC_PROBE (sin_probe, 2, 14, &x);
+ return (x > 0) ? res : -res; }
else
{
y = ABS (x) - hp0;
@@ -807,7 +811,8 @@ slow2 (double x)
y2 = (y - y1) - hp1;
__docos (y1, y2, w);
if (w[0] == w[0] + 1.000000005 * w[1])
- return (x > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (sin_probe, 2, 15, &x);
+ return (x > 0) ? w[0] : -w[0]; }
else
return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
}
@@ -835,7 +840,8 @@ sloww (double x, double dx, double orig)
cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
if (res == res + cor)
- return res;
+ { LIBC_PROBE (sin_probe, 2, 16, &orig);
+ return res;}
else
{
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
@@ -845,7 +851,8 @@ sloww (double x, double dx, double orig)
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-30;
if (w[0] == w[0] + cor)
- return (x > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (sin_probe, 2, 17, &orig);
+ return (x > 0) ? w[0] : -w[0]; }
else
{
t = (orig * hpinv + toint);
@@ -871,7 +878,8 @@ sloww (double x, double dx, double orig)
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-40;
if (w[0] == w[0] + cor)
- return (a > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (sin_probe, 2, 18, &orig);
+ return (a > 0) ? w[0] : -w[0]; }
else
return __mpsin (orig, 0, true);
}
@@ -897,7 +905,8 @@ sloww1 (double x, double dx, double orig, int m)
res = do_sin_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
if (res == res + cor)
- return (m > 0) ? res : -res;
+ { LIBC_PROBE (sin_probe, 2, 19, &orig);
+ return (m > 0) ? res : -res; }
else
{
__dubsin (x, dx, w);
@@ -908,7 +917,8 @@ sloww1 (double x, double dx, double orig, int m)
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
if (w[0] == w[0] + cor)
- return (m > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (sin_probe, 2, 20, &orig);
+ return (m > 0) ? w[0] : -w[0]; }
else
return __mpsin (orig, 0, true);
}
@@ -933,7 +943,8 @@ sloww2 (double x, double dx, double orig, int n)
res = do_cos_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
if (res == res + cor)
- return (n & 2) ? -res : res;
+ { LIBC_PROBE (sin_probe, 2, 21, &orig);
+ return (n & 2) ? -res : res; }
else
{
__docos (x, dx, w);
@@ -944,7 +955,8 @@ sloww2 (double x, double dx, double orig, int n)
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
if (w[0] == w[0] + cor)
- return (n & 2) ? -w[0] : w[0];
+ { LIBC_PROBE (sin_probe, 2, 22, &orig);
+ return (n & 2) ? -w[0] : w[0]; }
else
return __mpsin (orig, 0, true);
}
@@ -967,7 +979,8 @@ bsloww (double x, double dx, double orig, int n)
res = TAYLOR_SLOW (x, dx, cor);
cor = (cor > 0) ? 1.0005 * cor + 1.1e-24 : 1.0005 * cor - 1.1e-24;
if (res == res + cor)
- return res;
+ { LIBC_PROBE (sincos_probe, 2, 1, &orig);
+ return res; }
else
{
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
@@ -976,7 +989,8 @@ bsloww (double x, double dx, double orig, int n)
else
cor = 1.000000001 * w[1] - 1.1e-24;
if (w[0] == w[0] + cor)
- return (x > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (sincos_probe, 2, 2, &orig);
+ return (x > 0) ? w[0] : -w[0]; }
else
return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
}
@@ -1002,7 +1016,8 @@ bsloww1 (double x, double dx, double orig, int n)
dx = (x > 0) ? dx : -dx;
res = do_sin_slow (u, y, dx, 1.1e-24, &cor);
if (res == res + cor)
- return (x > 0) ? res : -res;
+ { LIBC_PROBE (sincos_probe, 2, 3, &orig);
+ return (x > 0) ? res : -res; }
else
{
__dubsin (ABS (x), dx, w);
@@ -1013,7 +1028,8 @@ bsloww1 (double x, double dx, double orig, int n)
cor = 1.000000005 * w[1] - 1.1e-24;
if (w[0] == w[0] + cor)
- return (x > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (sincos_probe, 2, 4, &orig);
+ return (x > 0) ? w[0] : -w[0]; }
else
return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
}
@@ -1039,7 +1055,8 @@ bsloww2 (double x, double dx, double orig, int n)
dx = (x > 0) ? dx : -dx;
res = do_cos_slow (u, y, dx, 1.1e-24, &cor);
if (res == res + cor)
- return (n & 2) ? -res : res;
+ { LIBC_PROBE (sincos_probe, 2, 5, &orig);
+ return (n & 2) ? -res : res; }
else
{
__docos (ABS (x), dx, w);
@@ -1050,7 +1067,8 @@ bsloww2 (double x, double dx, double orig, int n)
cor = 1.000000005 * w[1] - 1.1e-24;
if (w[0] == w[0] + cor)
- return (n & 2) ? -w[0] : w[0];
+ { LIBC_PROBE (sincos_probe, 2, 6, &orig);
+ return (n & 2) ? -w[0] : w[0]; }
else
return (n & 1) ? __mpsin (orig, 0, true) : __mpcos (orig, 0, true);
}
@@ -1073,13 +1091,15 @@ cslow2 (double x)
y = y - (u.x - big);
res = do_cos_slow (u, y, 0, 0, &cor);
if (res == res + cor)
- return res;
+ { LIBC_PROBE (cos_probe, 2, 10, &x);
+ return res; }
else
{
y = ABS (x);
__docos (y, 0, w);
if (w[0] == w[0] + 1.000000005 * w[1])
- return w[0];
+ { LIBC_PROBE (cos_probe, 2, 11, &x);
+ return w[0]; }
else
return __mpcos (x, 0, false);
}
@@ -1110,7 +1130,8 @@ csloww (double x, double dx, double orig)
cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
if (res == res + cor)
- return res;
+ { LIBC_PROBE (cos_probe, 2, 12, &orig);
+ return res; }
else
{
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
@@ -1121,7 +1142,8 @@ csloww (double x, double dx, double orig)
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-30;
if (w[0] == w[0] + cor)
- return (x > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (cos_probe, 2, 13, &orig);
+ return (x > 0) ? w[0] : -w[0]; }
else
{
t = (orig * hpinv + toint);
@@ -1148,7 +1170,8 @@ csloww (double x, double dx, double orig)
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-40;
if (w[0] == w[0] + cor)
- return (a > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (cos_probe, 2, 14, &orig);
+ return (a > 0) ? w[0] : -w[0]; }
else
return __mpcos (orig, 0, true);
}
@@ -1174,7 +1197,8 @@ csloww1 (double x, double dx, double orig, int m)
res = do_sin_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
if (res == res + cor)
- return (m > 0) ? res : -res;
+ { LIBC_PROBE (cos_probe, 2, 15, &orig);
+ return (m > 0) ? res : -res; }
else
{
__dubsin (x, dx, w);
@@ -1183,7 +1207,8 @@ csloww1 (double x, double dx, double orig, int m)
else
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
if (w[0] == w[0] + cor)
- return (m > 0) ? w[0] : -w[0];
+ { LIBC_PROBE (cos_probe, 2, 16, &orig);
+ return (m > 0) ? w[0] : -w[0]; }
else
return __mpcos (orig, 0, true);
}
@@ -1209,7 +1234,8 @@ csloww2 (double x, double dx, double orig, int n)
res = do_cos_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
if (res == res + cor)
- return (n) ? -res : res;
+ { LIBC_PROBE (cos_probe, 2, 17, &orig);
+ return (n) ? -res : res; }
else
{
__docos (x, dx, w);
@@ -1218,7 +1244,8 @@ csloww2 (double x, double dx, double orig, int n)
else
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
if (w[0] == w[0] + cor)
- return (n) ? -w[0] : w[0];
+ { LIBC_PROBE (cos_probe, 2, 18, &orig);
+ return (n) ? -w[0] : w[0]; }
else
return __mpcos (orig, 0, true);
}
diff --git a/sysdeps/ieee754/dbl-64/s_tanh.c b/sysdeps/ieee754/dbl-64/s_tanh.c
index 23cfcde..4286a71 100644
--- a/sysdeps/ieee754/dbl-64/s_tanh.c
+++ b/sysdeps/ieee754/dbl-64/s_tanh.c
@@ -40,6 +40,7 @@ static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $";
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double one = 1.0, two = 2.0, tiny = 1.0e-300;
@@ -73,11 +74,13 @@ __tanh (double x)
{
t = __expm1 (two * fabs (x));
z = one - two / (t + two);
+ LIBC_PROBE (tanh_probe, 2, 1, &x);
}
else
{
t = __expm1 (-two * fabs (x));
z = -t / (t + two);
+ LIBC_PROBE (tanh_probe, 2, 2, &x);
}
/* |x| > 22, return +-1 */
}
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
index 26268f2..8cb4702 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
@@ -26,6 +26,7 @@
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double
one = 1.0,
@@ -46,17 +47,22 @@ __ieee754_acosh (double x)
/* x is inf of NaN */
return x + x;
else
+ {
+ LIBC_PROBE (acosh_probe, 2, 1, &x);
return __ieee754_log (x) + ln2;/* acosh(huge)=log(2x) */
+ }
}
/* 2**28 > x > 2 */
double t = x * x;
+ LIBC_PROBE (acosh_probe, 2, 2, &x);
return __ieee754_log (2.0 * x - one / (x + __ieee754_sqrt (t - one)));
}
else if (__builtin_expect (hx > INT64_C (0x3ff0000000000000), 1))
{
/* 1<x<2 */
double t = x - one;
+ LIBC_PROBE (acosh_probe, 2, 3, &x);
return __log1p (t + __ieee754_sqrt (2.0 * t + t * t));
}
else if (__builtin_expect (hx == INT64_C (0x3ff0000000000000), 1))
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
index 8459352..ecf8210 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
@@ -33,6 +33,7 @@
#include <math.h>
#include <math_private.h>
+#include <stap-probe.h>
static const double one = 1.0, half=0.5, huge = 1.0e300;
@@ -52,17 +53,23 @@ __ieee754_cosh (double x)
if(ix<0x3fd62e43) {
t = __expm1(fabs(x));
w = one+t;
+ LIBC_PROBE (cosh_probe, 2, 1, &x);
if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */
return one+(t*t)/(w+w);
}
+ LIBC_PROBE (cosh_probe, 2, 2, &x);
/* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
t = __ieee754_exp(fabs(x));
return half*t+half/t;
}
/* |x| in [22, log(maxdouble)] return half*exp(|x|) */
- if (ix < 0x40862e42) return half*__ieee754_exp(fabs(x));
+ if (ix < 0x40862e42)
+ {
+ LIBC_PROBE (cosh_probe, 2, 3, &x);
+ return half*__ieee754_exp(fabs(x));
+ }
/* |x| in [log(maxdouble), overflowthresold] */
int64_t fix;
@@ -71,6 +78,7 @@ __ieee754_cosh (double x)
if (fix <= UINT64_C(0x408633ce8fb9f87d)) {
w = __ieee754_exp(half*fabs(x));
t = half*w;
+ LIBC_PROBE (cosh_probe, 2, 4, &x);
return t*w;
}
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources