intervals 0.3.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.txt +1 -0
- data/ext/crlibm/AUTHORS +2 -0
- data/ext/crlibm/COPYING +504 -0
- data/ext/crlibm/ChangeLog +80 -0
- data/ext/crlibm/INSTALL +182 -0
- data/ext/crlibm/Makefile.am +84 -0
- data/ext/crlibm/Makefile.in +530 -0
- data/ext/crlibm/NEWS +0 -0
- data/ext/crlibm/README +31 -0
- data/ext/crlibm/TODO +47 -0
- data/ext/crlibm/VERSION +1 -0
- data/ext/crlibm/aclocal.m4 +989 -0
- data/ext/crlibm/atan-itanium.c +846 -0
- data/ext/crlibm/atan-pentium.c +261 -0
- data/ext/crlibm/atan_accurate.c +244 -0
- data/ext/crlibm/atan_accurate.h +191 -0
- data/ext/crlibm/atan_fast.c +324 -0
- data/ext/crlibm/atan_fast.h +678 -0
- data/ext/crlibm/config.guess +1461 -0
- data/ext/crlibm/config.sub +1566 -0
- data/ext/crlibm/configure +7517 -0
- data/ext/crlibm/configure.ac +364 -0
- data/ext/crlibm/crlibm.h +125 -0
- data/ext/crlibm/crlibm_config.h +149 -0
- data/ext/crlibm/crlibm_config.h.in +148 -0
- data/ext/crlibm/crlibm_private.c +293 -0
- data/ext/crlibm/crlibm_private.h +658 -0
- data/ext/crlibm/csh_fast.c +631 -0
- data/ext/crlibm/csh_fast.h +771 -0
- data/ext/crlibm/double-extended.h +496 -0
- data/ext/crlibm/exp-td.c +962 -0
- data/ext/crlibm/exp-td.h +685 -0
- data/ext/crlibm/exp_accurate.c +197 -0
- data/ext/crlibm/exp_accurate.h +85 -0
- data/ext/crlibm/gappa/log-de-E0-logir0.gappa +106 -0
- data/ext/crlibm/gappa/log-de-E0.gappa +79 -0
- data/ext/crlibm/gappa/log-de.gappa +81 -0
- data/ext/crlibm/gappa/log-td-E0-logir0.gappa +126 -0
- data/ext/crlibm/gappa/log-td-E0.gappa +143 -0
- data/ext/crlibm/gappa/log-td-accurate-E0-logir0.gappa +230 -0
- data/ext/crlibm/gappa/log-td-accurate-E0.gappa +213 -0
- data/ext/crlibm/gappa/log-td-accurate.gappa +217 -0
- data/ext/crlibm/gappa/log-td.gappa +156 -0
- data/ext/crlibm/gappa/trigoSinCosCase3.gappa +204 -0
- data/ext/crlibm/gappa/trigoTanCase2.gappa +73 -0
- data/ext/crlibm/install-sh +269 -0
- data/ext/crlibm/log-de.c +431 -0
- data/ext/crlibm/log-de.h +732 -0
- data/ext/crlibm/log-td.c +852 -0
- data/ext/crlibm/log-td.h +819 -0
- data/ext/crlibm/log10-td.c +906 -0
- data/ext/crlibm/log10-td.h +823 -0
- data/ext/crlibm/log2-td.c +935 -0
- data/ext/crlibm/log2-td.h +821 -0
- data/ext/crlibm/maple/atan.mpl +359 -0
- data/ext/crlibm/maple/common-procedures.mpl +997 -0
- data/ext/crlibm/maple/csh.mpl +446 -0
- data/ext/crlibm/maple/double-extended.mpl +151 -0
- data/ext/crlibm/maple/exp-td.mpl +195 -0
- data/ext/crlibm/maple/log-de.mpl +243 -0
- data/ext/crlibm/maple/log-td.mpl +316 -0
- data/ext/crlibm/maple/log10-td.mpl +345 -0
- data/ext/crlibm/maple/log2-td.mpl +334 -0
- data/ext/crlibm/maple/trigo.mpl +728 -0
- data/ext/crlibm/maple/triple-double.mpl +58 -0
- data/ext/crlibm/missing +198 -0
- data/ext/crlibm/mkinstalldirs +40 -0
- data/ext/crlibm/rem_pio2_accurate.c +219 -0
- data/ext/crlibm/rem_pio2_accurate.h +53 -0
- data/ext/crlibm/scs_lib/AUTHORS +3 -0
- data/ext/crlibm/scs_lib/COPYING +504 -0
- data/ext/crlibm/scs_lib/ChangeLog +16 -0
- data/ext/crlibm/scs_lib/INSTALL +215 -0
- data/ext/crlibm/scs_lib/Makefile.am +18 -0
- data/ext/crlibm/scs_lib/Makefile.in +328 -0
- data/ext/crlibm/scs_lib/NEWS +0 -0
- data/ext/crlibm/scs_lib/README +9 -0
- data/ext/crlibm/scs_lib/TODO +4 -0
- data/ext/crlibm/scs_lib/addition_scs.c +623 -0
- data/ext/crlibm/scs_lib/config.guess +1461 -0
- data/ext/crlibm/scs_lib/config.sub +1566 -0
- data/ext/crlibm/scs_lib/configure +6226 -0
- data/ext/crlibm/scs_lib/division_scs.c +110 -0
- data/ext/crlibm/scs_lib/double2scs.c +174 -0
- data/ext/crlibm/scs_lib/install-sh +269 -0
- data/ext/crlibm/scs_lib/missing +198 -0
- data/ext/crlibm/scs_lib/mkinstalldirs +40 -0
- data/ext/crlibm/scs_lib/multiplication_scs.c +456 -0
- data/ext/crlibm/scs_lib/poly_fct.c +112 -0
- data/ext/crlibm/scs_lib/print_scs.c +73 -0
- data/ext/crlibm/scs_lib/rand_scs.c +63 -0
- data/ext/crlibm/scs_lib/scs.h +353 -0
- data/ext/crlibm/scs_lib/scs2double.c +391 -0
- data/ext/crlibm/scs_lib/scs2mpf.c +58 -0
- data/ext/crlibm/scs_lib/scs2mpfr.c +61 -0
- data/ext/crlibm/scs_lib/scs_private.c +23 -0
- data/ext/crlibm/scs_lib/scs_private.h +133 -0
- data/ext/crlibm/scs_lib/tests/tbx_timing.h +102 -0
- data/ext/crlibm/scs_lib/wrapper_scs.h +486 -0
- data/ext/crlibm/scs_lib/zero_scs.c +52 -0
- data/ext/crlibm/stamp-h.in +1 -0
- data/ext/crlibm/tests/Makefile.am +43 -0
- data/ext/crlibm/tests/Makefile.in +396 -0
- data/ext/crlibm/tests/blind_test.c +148 -0
- data/ext/crlibm/tests/generate_test_vectors.c +258 -0
- data/ext/crlibm/tests/soak_test.c +334 -0
- data/ext/crlibm/tests/test_common.c +627 -0
- data/ext/crlibm/tests/test_common.h +28 -0
- data/ext/crlibm/tests/test_perf.c +570 -0
- data/ext/crlibm/tests/test_val.c +249 -0
- data/ext/crlibm/trigo_accurate.c +500 -0
- data/ext/crlibm/trigo_accurate.h +331 -0
- data/ext/crlibm/trigo_fast.c +1219 -0
- data/ext/crlibm/trigo_fast.h +639 -0
- data/ext/crlibm/triple-double.h +878 -0
- data/ext/extconf.rb +31 -0
- data/ext/fpu.c +107 -0
- data/ext/jamis-mod.rb +591 -0
- data/lib/fpu.rb +287 -0
- data/lib/interval.rb +1170 -0
- data/lib/intervals.rb +212 -0
- data/lib/struct_float.rb +133 -0
- data/test/data_atan.txt +360 -0
- data/test/data_cos.txt +346 -0
- data/test/data_cosh.txt +3322 -0
- data/test/data_exp.txt +3322 -0
- data/test/data_log.txt +141 -0
- data/test/data_sin.txt +140 -0
- data/test/data_sinh.txt +3322 -0
- data/test/data_tan.txt +342 -0
- metadata +186 -0
@@ -0,0 +1,148 @@
|
|
1
|
+
/* crlibm_config.h.in. Generated from configure.ac by autoheader. */
|
2
|
+
|
3
|
+
/* Processor type */
|
4
|
+
#undef CRLIBM_TYPECPU_ALPHA
|
5
|
+
|
6
|
+
/* Processor type */
|
7
|
+
#undef CRLIBM_TYPECPU_AMD64
|
8
|
+
|
9
|
+
/* Processor type */
|
10
|
+
#undef CRLIBM_TYPECPU_ITANIUM
|
11
|
+
|
12
|
+
/* Processor type */
|
13
|
+
#undef CRLIBM_TYPECPU_POWERPC
|
14
|
+
|
15
|
+
/* Processor type */
|
16
|
+
#undef CRLIBM_TYPECPU_SPARC
|
17
|
+
|
18
|
+
/* Processor type */
|
19
|
+
#undef CRLIBM_TYPECPU_X86
|
20
|
+
|
21
|
+
/* OS type */
|
22
|
+
#undef CRLIBM_TYPEOS_BSD
|
23
|
+
|
24
|
+
/* OS type */
|
25
|
+
#undef CRLIBM_TYPEOS_CYGWIN
|
26
|
+
|
27
|
+
/* OS type */
|
28
|
+
#undef CRLIBM_TYPEOS_HPUX
|
29
|
+
|
30
|
+
/* Define to 1 if you have the <fenv.h> header file. */
|
31
|
+
#undef HAVE_FENV_H
|
32
|
+
|
33
|
+
/* Define to 1 if you have the <float.h> header file. */
|
34
|
+
#undef HAVE_FLOAT_H
|
35
|
+
|
36
|
+
/* Define to 1 if you have the <gmp.h> header file. */
|
37
|
+
#undef HAVE_GMP_H
|
38
|
+
|
39
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
40
|
+
#undef HAVE_INTTYPES_H
|
41
|
+
|
42
|
+
/* Define to 1 if you have the `gmp' library (-lgmp). */
|
43
|
+
#undef HAVE_LIBGMP
|
44
|
+
|
45
|
+
/* Define to 1 if you have the `m' library (-lm). */
|
46
|
+
#undef HAVE_LIBM
|
47
|
+
|
48
|
+
/* Define to 1 if you have the `mcr' library (-lmcr). */
|
49
|
+
#undef HAVE_LIBMCR
|
50
|
+
|
51
|
+
/* Define to 1 if you have the <libmcr.h> header file. */
|
52
|
+
#undef HAVE_LIBMCR_H
|
53
|
+
|
54
|
+
/* Define to 1 if you have the `mpfr' library (-lmpfr). */
|
55
|
+
#undef HAVE_LIBMPFR
|
56
|
+
|
57
|
+
/* Define to 1 if you have the `ultim' library (-lultim). */
|
58
|
+
#undef HAVE_LIBULTIM
|
59
|
+
|
60
|
+
/* Define to 1 if long double works and has more range or precision than
|
61
|
+
double. */
|
62
|
+
#undef HAVE_LONG_DOUBLE
|
63
|
+
|
64
|
+
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
65
|
+
to 0 otherwise. */
|
66
|
+
#undef HAVE_MALLOC
|
67
|
+
|
68
|
+
/* Define to 1 if you have the <MathLib.h> header file. */
|
69
|
+
#undef HAVE_MATHLIB_H
|
70
|
+
|
71
|
+
/* Define to 1 if you have the <memory.h> header file. */
|
72
|
+
#undef HAVE_MEMORY_H
|
73
|
+
|
74
|
+
/* Define to 1 if you have the <mpfr.h> header file. */
|
75
|
+
#undef HAVE_MPFR_H
|
76
|
+
|
77
|
+
/* Define to 1 if you have the `sqrt' function. */
|
78
|
+
#undef HAVE_SQRT
|
79
|
+
|
80
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
81
|
+
#undef HAVE_STDINT_H
|
82
|
+
|
83
|
+
/* Define to 1 if you have the <stdlib.h> header file. */
|
84
|
+
#undef HAVE_STDLIB_H
|
85
|
+
|
86
|
+
/* Define to 1 if you have the <strings.h> header file. */
|
87
|
+
#undef HAVE_STRINGS_H
|
88
|
+
|
89
|
+
/* Define to 1 if you have the <string.h> header file. */
|
90
|
+
#undef HAVE_STRING_H
|
91
|
+
|
92
|
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
93
|
+
#undef HAVE_SYS_STAT_H
|
94
|
+
|
95
|
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
96
|
+
#undef HAVE_SYS_TYPES_H
|
97
|
+
|
98
|
+
/* Define to 1 if you have the <unistd.h> header file. */
|
99
|
+
#undef HAVE_UNISTD_H
|
100
|
+
|
101
|
+
/* Name of package */
|
102
|
+
#undef PACKAGE
|
103
|
+
|
104
|
+
/* Define to the address where bug reports for this package should be sent. */
|
105
|
+
#undef PACKAGE_BUGREPORT
|
106
|
+
|
107
|
+
/* Define to the full name of this package. */
|
108
|
+
#undef PACKAGE_NAME
|
109
|
+
|
110
|
+
/* Define to the full name and version of this package. */
|
111
|
+
#undef PACKAGE_STRING
|
112
|
+
|
113
|
+
/* Define to the one symbol short name of this package. */
|
114
|
+
#undef PACKAGE_TARNAME
|
115
|
+
|
116
|
+
/* Define to the version of this package. */
|
117
|
+
#undef PACKAGE_VERSION
|
118
|
+
|
119
|
+
/* Size of an SCS digit */
|
120
|
+
#undef SCS_NB_BITS
|
121
|
+
|
122
|
+
/* Number of digits in the SCS structure */
|
123
|
+
#undef SCS_NB_WORDS
|
124
|
+
|
125
|
+
/* The size of a `int', as computed by sizeof. */
|
126
|
+
#undef SIZEOF_INT
|
127
|
+
|
128
|
+
/* Define to 1 if you have the ANSI C header files. */
|
129
|
+
#undef STDC_HEADERS
|
130
|
+
|
131
|
+
/* Version number of package */
|
132
|
+
#undef VERSION
|
133
|
+
|
134
|
+
/* Define to 1 if your processor stores words with the most significant byte
|
135
|
+
first (like Motorola and SPARC, unlike Intel and VAX). */
|
136
|
+
#undef WORDS_BIGENDIAN
|
137
|
+
|
138
|
+
/* Define to empty if `const' does not conform to ANSI C. */
|
139
|
+
#undef const
|
140
|
+
|
141
|
+
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
142
|
+
calls it, or to nothing if 'inline' is not supported under any name. */
|
143
|
+
#ifndef __cplusplus
|
144
|
+
#undef inline
|
145
|
+
#endif
|
146
|
+
|
147
|
+
/* Define to rpl_malloc if the replacement function should be used. */
|
148
|
+
#undef malloc
|
@@ -0,0 +1,293 @@
|
|
1
|
+
/**
|
2
|
+
* Variables and common functions shared by many functions
|
3
|
+
*
|
4
|
+
* This file is part of the crlibm library developed by the Arenaire
|
5
|
+
* project at Ecole Normale Superieure de Lyon
|
6
|
+
*
|
7
|
+
* This program is free software; you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation; either version 2 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with this program; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
20
|
+
*/
|
21
|
+
#include <stdio.h>
|
22
|
+
#include <stdlib.h>
|
23
|
+
#include "crlibm.h"
|
24
|
+
#include "crlibm_private.h"
|
25
|
+
|
26
|
+
/* I wish I could use C99 fenv.h, but as of 2004 it doesn't specify
|
27
|
+
anything about precision, only rounding direction. */
|
28
|
+
|
29
|
+
#ifdef HAVE_FENV_H
|
30
|
+
#include <fenv.h>
|
31
|
+
#endif
|
32
|
+
|
33
|
+
/* Tell the compiler that we're going to mess with FP status register */
|
34
|
+
#ifdef FENV_H
|
35
|
+
#pragma STDC FENV_ACCESS ON
|
36
|
+
#endif
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
/* TODO proper init and exit functions
|
43
|
+
|
44
|
+
- for Itanium (set sf2 and/or sf3, one should be kept for saving the
|
45
|
+
fpsr when speculating, study operating systems)
|
46
|
+
|
47
|
+
- for PowerPC: nothing to do usually, however if for some reason the
|
48
|
+
CPU was not in the default state then crlibm won't work
|
49
|
+
|
50
|
+
*/
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
/* An init function which sets FPU flags when needed */
|
55
|
+
unsigned long long crlibm_init() {
|
56
|
+
#ifndef CRLIBM_TYPEOS_BSD
|
57
|
+
#if (defined(CRLIBM_TYPECPU_X86) || defined(CRLIBM_TYPECPU_AMD64))
|
58
|
+
unsigned short oldcw, cw;
|
59
|
+
/* save old state */
|
60
|
+
_FPU_GETCW(oldcw);
|
61
|
+
/* Set FPU flags to use double, not double extended,
|
62
|
+
with rounding to nearest */
|
63
|
+
cw = (_FPU_DEFAULT & ~_FPU_EXTENDED)|_FPU_DOUBLE;
|
64
|
+
_FPU_SETCW(cw);
|
65
|
+
return (unsigned long long) oldcw;
|
66
|
+
|
67
|
+
#elif defined(CRLIBM_TYPECPU_ITANIUM)
|
68
|
+
/* On Itanium we assume that SF2 is used fo speculation, and use only SF3 */
|
69
|
+
|
70
|
+
unsigned long long int old_fpsr;
|
71
|
+
|
72
|
+
#if defined(__INTEL_COMPILER)
|
73
|
+
_Asm_fsetc( 0x00, 0x28, 3 /*_SF3*/ ); /* sf3 = round up, double-precision */
|
74
|
+
|
75
|
+
// _Asm_mov_to_ar(40,
|
76
|
+
// (old_fpsr & 0xfd000000FFFFFFFFULL) || ((0x18ULL<<32) + (0x28ULL<<45)) );
|
77
|
+
#elif defined(__GNUC__)
|
78
|
+
__asm__ ("fsetc.s3 0, 40\n");
|
79
|
+
#endif /* defined(__INTEL_COMPILER) */
|
80
|
+
old_fpsr = 0 ; /* TODO */
|
81
|
+
return old_fpsr;
|
82
|
+
|
83
|
+
#else
|
84
|
+
return 0;
|
85
|
+
#endif /* CRLIBM_TYPECPU_X86 || CRLIBM_TYPECPU_AMD64 */
|
86
|
+
#else
|
87
|
+
return 0;
|
88
|
+
#endif
|
89
|
+
}
|
90
|
+
|
91
|
+
/* An exit function which sets FPU flags to initial value */
|
92
|
+
void crlibm_exit(unsigned long long int oldcw) {
|
93
|
+
#ifndef CRLIBM_TYPEOS_BSD
|
94
|
+
#if (defined(CRLIBM_TYPECPU_X86) || defined(CRLIBM_TYPECPU_AMD64))
|
95
|
+
/* Set FPU flags to use double, not double extended,
|
96
|
+
with rounding to nearest */
|
97
|
+
unsigned short t = (unsigned short)oldcw;
|
98
|
+
_FPU_SETCW(t);
|
99
|
+
#endif
|
100
|
+
#endif
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
#if ADD22_AS_FUNCTIONS
|
107
|
+
/*
|
108
|
+
* computes double-double addition: zh+zl = xh+xl + yh+yl
|
109
|
+
* relative error is smaller than 2^-103
|
110
|
+
*/
|
111
|
+
|
112
|
+
void Add22Cond(double *zh, double *zl,
|
113
|
+
double xh, double xl, double yh, double yl)
|
114
|
+
{
|
115
|
+
double r,s;
|
116
|
+
r = xh+yh;
|
117
|
+
if ((ABS(xh)) > (ABS(yh)))
|
118
|
+
{s= ((((xh-r)+yh)+yl)+xl); }
|
119
|
+
else {s=((((yh-r)+xh)+xl)+yl);}
|
120
|
+
*zh = r+s;
|
121
|
+
*zl = r - (*zh) + s;
|
122
|
+
}
|
123
|
+
|
124
|
+
/*
|
125
|
+
* computes double-double addition: zh+zl = xh+xl + yh+yl
|
126
|
+
* knowing that xh>yh
|
127
|
+
* relative error is smaller than 2^-103
|
128
|
+
*/
|
129
|
+
|
130
|
+
void Add22(double *zh, double *zl, double xh, double xl, double yh, double yl)
|
131
|
+
{
|
132
|
+
double r,s;
|
133
|
+
|
134
|
+
r = xh+yh;
|
135
|
+
s = xh-r+yh+yl+xl;
|
136
|
+
*zh = r+s;
|
137
|
+
*zl = r - (*zh) + s;
|
138
|
+
}
|
139
|
+
|
140
|
+
#endif /*ADD22_AS_FUNCTIONS*/
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
#if DEKKER_AS_FUNCTIONS && (!defined PROCESSOR_HAS_FMA)
|
145
|
+
/* else it is defined in crlibm_private.h */
|
146
|
+
|
147
|
+
/*
|
148
|
+
* computes rh and rl such that rh + rl = a * b with rh = a @* b exactly
|
149
|
+
* under the conditions : a < 2^970 et b < 2^970
|
150
|
+
*/
|
151
|
+
void Mul12(double *rh, double *rl, double u, double v){
|
152
|
+
const double c = 134217729.; /* 1+2^27 */
|
153
|
+
double up, u1, u2, vp, v1, v2;
|
154
|
+
|
155
|
+
up = u*c; vp = v*c;
|
156
|
+
u1 = (u-up)+up; v1 = (v-vp)+vp;
|
157
|
+
u2 = u-u1; v2 = v-v1;
|
158
|
+
|
159
|
+
*rh = u*v;
|
160
|
+
*rl = (((u1*v1-*rh)+(u1*v2))+(u2*v1))+(u2*v2);
|
161
|
+
}
|
162
|
+
|
163
|
+
/*
|
164
|
+
* Computes rh and rl such that rh + rl = a * b and rh = a @* b exactly
|
165
|
+
*/
|
166
|
+
void Mul12Cond(double *rh, double *rl, double a, double b){
|
167
|
+
const double two_970 = 0.997920154767359905828186356518419283e292;
|
168
|
+
const double two_em53 = 0.11102230246251565404236316680908203125e-15;
|
169
|
+
const double two_e53 = 9007199254740992.;
|
170
|
+
double u, v;
|
171
|
+
|
172
|
+
if (a>two_970) u = a*two_em53;
|
173
|
+
else u = a;
|
174
|
+
if (b>two_970) v = b*two_em53;
|
175
|
+
else v = b;
|
176
|
+
|
177
|
+
Mul12(rh, rl, u, v);
|
178
|
+
|
179
|
+
if (a>two_970) {*rh *= two_e53; *rl *= two_e53;}
|
180
|
+
if (b>two_970) {*rh *= two_e53; *rl *= two_e53;}
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
/*
|
185
|
+
* computes double-double multiplication: zh+zl = (xh+xl) * (yh+yl)
|
186
|
+
* under the conditions : xh < 2^970 et xl < 2^970
|
187
|
+
* relative error is smaller than 2^-102
|
188
|
+
*/
|
189
|
+
|
190
|
+
void Mul22(double *zh, double *zl, double xh, double xl, double yh, double yl)
|
191
|
+
{
|
192
|
+
double mh, ml;
|
193
|
+
|
194
|
+
const double c = 134217729.; /* 0x41A00000, 0x02000000 */
|
195
|
+
double up, u1, u2, vp, v1, v2;
|
196
|
+
|
197
|
+
up = xh*c; vp = yh*c;
|
198
|
+
u1 = (xh-up)+up; v1 = (yh-vp)+vp;
|
199
|
+
u2 = xh-u1; v2 = yh-v1;
|
200
|
+
|
201
|
+
mh = xh*yh;
|
202
|
+
ml = (((u1*v1-mh)+(u1*v2))+(u2*v1))+(u2*v2);
|
203
|
+
|
204
|
+
ml += xh*yl + xl*yh;
|
205
|
+
*zh = mh+ml;
|
206
|
+
*zl = mh - (*zh) + ml;
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
/*
|
211
|
+
* computes double-double division: pzh+pzl = (xh+xl) / (yh+yl)
|
212
|
+
* relative error is smaller than 2^-104
|
213
|
+
*/
|
214
|
+
|
215
|
+
void Div22(double* pzh, double* pzl, double xh, double xl, double yh, double yl){
|
216
|
+
double _ch,_cl,_uh,_ul;
|
217
|
+
_ch=(xh)/(yh); Mul12(&_uh,&_ul,_ch,(yh));
|
218
|
+
_cl=(((((xh)-_uh)-_ul)+(xl))-_ch*(yl))/(yh);
|
219
|
+
*pzh=_ch+_cl; *pzl=(_ch-(*pzh))+_cl;
|
220
|
+
}
|
221
|
+
|
222
|
+
#endif /* DEKKER_AS_FUNCTIONS && (!defined PROCESSOR_HAS_FMA) */
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
#if EVAL_PERF==1
|
229
|
+
/* counter of calls to the second step (accurate step) */
|
230
|
+
int crlibm_second_step_taken;
|
231
|
+
#endif
|
232
|
+
|
233
|
+
/* A debug functions */
|
234
|
+
|
235
|
+
void printHexa(char* s, double x) {
|
236
|
+
db_number xdb;
|
237
|
+
|
238
|
+
xdb.d = x;
|
239
|
+
printf("%s = %08x%08x (%1.8e) exponent = %d exponent of ulp = %d\n",
|
240
|
+
s,
|
241
|
+
xdb.i[HI],
|
242
|
+
xdb.i[LO],
|
243
|
+
x,
|
244
|
+
((xdb.i[HI] & 0x7ff00000) >> 20) - 1023,
|
245
|
+
((xdb.i[HI] & 0x7ff00000) >> 20) - 1023 - 52);
|
246
|
+
}
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
#ifdef SCS_TYPECPU_SPARC
|
252
|
+
const scs
|
253
|
+
/* 0 */
|
254
|
+
scs_zer ={{0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
255
|
+
{{0, 0}}, 0, 1 },
|
256
|
+
/* 1/2 */
|
257
|
+
scs_half={{0x02000000, 0x00000000, 0x00000000, 0x00000000},
|
258
|
+
DB_ONE, -1, 1 },
|
259
|
+
/* 1 */
|
260
|
+
scs_one ={{0x00000001, 0x00000000, 0x00000000, 0x00000000},
|
261
|
+
DB_ONE, 0, 1 },
|
262
|
+
/* 2 */
|
263
|
+
scs_two ={{0x00000002, 0x00000000, 0x00000000, 0x00000000},
|
264
|
+
DB_ONE, 0, 1 },
|
265
|
+
|
266
|
+
/* ~1.666667e-01 */
|
267
|
+
scs_sixinv ={{0x0aaaaaaa, 0x2aaaaaaa, 0x2aaaaaaa, 0x2aaaaaaa},
|
268
|
+
DB_ONE, -1, 1 };
|
269
|
+
|
270
|
+
#else
|
271
|
+
const struct scs
|
272
|
+
/* 0 */
|
273
|
+
scs_zer ={{0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
274
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
275
|
+
{{0, 0}}, 0, 1 },
|
276
|
+
/* 1/2 */
|
277
|
+
scs_half={{0x20000000, 0x00000000, 0x00000000, 0x00000000,
|
278
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
279
|
+
DB_ONE, -1, 1 },
|
280
|
+
/* 1 */
|
281
|
+
scs_one ={{0x00000001, 0x00000000, 0x00000000, 0x00000000,
|
282
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
283
|
+
DB_ONE, 0, 1 },
|
284
|
+
/* 2 */
|
285
|
+
scs_two ={{0x00000002, 0x00000000, 0x00000000, 0x00000000,
|
286
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000},
|
287
|
+
DB_ONE, 0, 1 },
|
288
|
+
/* 0.166666*/
|
289
|
+
scs_sixinv ={{0x0aaaaaaa, 0x2aaaaaaa, 0x2aaaaaaa, 0x2aaaaaaa,
|
290
|
+
0x2aaaaaaa, 0x2aaaaaaa, 0x2aaaaaaa, 0x2aaaaaaa},
|
291
|
+
DB_ONE, -1, 1 };
|
292
|
+
|
293
|
+
#endif
|