[multiple changes]
Fri May 28 22:20:03 1999 Anthony Green <green@cygnus.com> * java/lang/fdlibm.h: Don't use __uint32_t. Include mprec.h. * java/lang/e_log.c: Don't use __uint32_t. 1999-05-27 Eric Christopher <echristo@cygnus.com> * configure: Rebuilt * configure.in: Fixed ISO C9X and namespace collision with __uint32_t * acconfig.h: Rebuilt * include/config.h.in: Rebuilt * java/lang/mprec.h, java/lang/e_acos.c, java/lang/e_asin.c, java/lang/e_atan2.c, java/lang/e_exp.c, java/lang/e_fmod.c, e_log.c, java/lang/e_pow.c, java/lang/e_rem_pio2.c, java/lang/e_remainder.c, java/lang/e_sqrt.c, java/lang/fdlibm.h, k_tan.c, java/lang/mprec.h, java/lang/s_atan.c, java/lang/s_ceil.c, java/lang/s_copysign.c, java/lang/s_fabs.c, s_floor.c, java/lang/s_rint.c, java/lang/sf_rint.c: Fixed ISO C9X and namespace collision with __uint32_t From-SVN: r27729
This commit is contained in:
parent
fe574d5d92
commit
0d16618c58
31 changed files with 614 additions and 526 deletions
|
@ -1,3 +1,24 @@
|
||||||
|
Fri May 28 22:20:03 1999 Anthony Green <green@cygnus.com>
|
||||||
|
|
||||||
|
* java/lang/fdlibm.h: Don't use __uint32_t. Include mprec.h.
|
||||||
|
* java/lang/e_log.c: Don't use __uint32_t.
|
||||||
|
|
||||||
|
1999-05-27 Eric Christopher <echristo@cygnus.com>
|
||||||
|
|
||||||
|
* configure: Rebuilt
|
||||||
|
* configure.in: Fixed ISO C9X and namespace collision with __uint32_t
|
||||||
|
* acconfig.h: Rebuilt
|
||||||
|
* include/config.h.in: Rebuilt
|
||||||
|
|
||||||
|
* java/lang/mprec.h, java/lang/e_acos.c, java/lang/e_asin.c,
|
||||||
|
java/lang/e_atan2.c, java/lang/e_exp.c, java/lang/e_fmod.c,
|
||||||
|
e_log.c, java/lang/e_pow.c, java/lang/e_rem_pio2.c,
|
||||||
|
java/lang/e_remainder.c, java/lang/e_sqrt.c, java/lang/fdlibm.h,
|
||||||
|
k_tan.c, java/lang/mprec.h, java/lang/s_atan.c,
|
||||||
|
java/lang/s_ceil.c, java/lang/s_copysign.c, java/lang/s_fabs.c,
|
||||||
|
s_floor.c, java/lang/s_rint.c, java/lang/sf_rint.c: Fixed ISO C9X
|
||||||
|
and namespace collision with __uint32_t
|
||||||
|
|
||||||
1999-06-23 Tom Tromey <tromey@cygnus.com>
|
1999-06-23 Tom Tromey <tromey@cygnus.com>
|
||||||
|
|
||||||
* java/util/zip/InflaterInputStream.java (read): Throw
|
* java/util/zip/InflaterInputStream.java (read): Throw
|
||||||
|
|
|
@ -28,9 +28,12 @@
|
||||||
/* Define if you have sleep. */
|
/* Define if you have sleep. */
|
||||||
#undef HAVE_SLEEP
|
#undef HAVE_SLEEP
|
||||||
|
|
||||||
/* Define if you have __int32_t and __uint32_t. */
|
/* Define if you have int32_t and uint32_t. */
|
||||||
#undef HAVE_INT32_DEFINED
|
#undef HAVE_INT32_DEFINED
|
||||||
|
|
||||||
|
/* Define if you have u_int32_t */
|
||||||
|
#undef HAVE_BSD_INT32_DEFINED
|
||||||
|
|
||||||
/* Define if you're running eCos. */
|
/* Define if you're running eCos. */
|
||||||
#undef ECOS
|
#undef ECOS
|
||||||
|
|
||||||
|
|
255
libjava/configure
vendored
255
libjava/configure
vendored
|
@ -2707,10 +2707,10 @@ echo "$ac_t""$CPP" 1>&6
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 2709 "configure"
|
#line 2709 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <sys/types.h>
|
#include <stdint.h>
|
||||||
EOF
|
EOF
|
||||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||||
egrep "__uint32_t" >/dev/null 2>&1; then
|
egrep "uint32_t" >/dev/null 2>&1; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define HAVE_INT32_DEFINED 1
|
#define HAVE_INT32_DEFINED 1
|
||||||
|
@ -2722,10 +2722,10 @@ rm -f conftest*
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 2724 "configure"
|
#line 2724 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <sys/config.h>
|
#include <inttypes.h>
|
||||||
EOF
|
EOF
|
||||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||||
egrep "__uint32_t" >/dev/null 2>&1; then
|
egrep "uint32_t" >/dev/null 2>&1; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define HAVE_INT32_DEFINED 1
|
#define HAVE_INT32_DEFINED 1
|
||||||
|
@ -2734,9 +2734,40 @@ EOF
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 2739 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
EOF
|
||||||
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||||
|
egrep "u_int32_t" >/dev/null 2>&1; then
|
||||||
|
rm -rf conftest*
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_BSD_INT32_DEFINED 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 2740 "configure"
|
#line 2754 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/config.h>
|
||||||
|
EOF
|
||||||
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||||
|
egrep "u_int32_t" >/dev/null 2>&1; then
|
||||||
|
rm -rf conftest*
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_BSD_INT32_DEFINED 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 2771 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -2751,7 +2782,7 @@ fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 2755 "configure"
|
#line 2786 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -2789,7 +2820,7 @@ ZLIBSPEC=
|
||||||
libsubdir=.libs
|
libsubdir=.libs
|
||||||
|
|
||||||
echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
|
echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
|
||||||
echo "configure:2793: checking for garbage collector to use" >&5
|
echo "configure:2824: checking for garbage collector to use" >&5
|
||||||
# Check whether --enable-java-gc or --disable-java-gc was given.
|
# Check whether --enable-java-gc or --disable-java-gc was given.
|
||||||
if test "${enable_java_gc+set}" = set; then
|
if test "${enable_java_gc+set}" = set; then
|
||||||
enableval="$enable_java_gc"
|
enableval="$enable_java_gc"
|
||||||
|
@ -2839,7 +2870,7 @@ esac
|
||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
|
echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
|
||||||
echo "configure:2843: checking for threads package to use" >&5
|
echo "configure:2874: checking for threads package to use" >&5
|
||||||
# Check whether --enable-threads or --disable-threads was given.
|
# Check whether --enable-threads or --disable-threads was given.
|
||||||
if test "${enable_threads+set}" = set; then
|
if test "${enable_threads+set}" = set; then
|
||||||
enableval="$enable_threads"
|
enableval="$enable_threads"
|
||||||
|
@ -3031,12 +3062,12 @@ else
|
||||||
for ac_func in strerror ioctl select open fsync sleep
|
for ac_func in strerror ioctl select open fsync sleep
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3035: checking for $ac_func" >&5
|
echo "configure:3066: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3040 "configure"
|
#line 3071 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3059,7 +3090,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3086,12 +3117,12 @@ done
|
||||||
for ac_func in ctime_r ctime
|
for ac_func in ctime_r ctime
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3090: checking for $ac_func" >&5
|
echo "configure:3121: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3095 "configure"
|
#line 3126 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3114,7 +3145,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3141,12 +3172,12 @@ done
|
||||||
for ac_func in gmtime_r localtime_r readdir_r getpwuid_r
|
for ac_func in gmtime_r localtime_r readdir_r getpwuid_r
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3145: checking for $ac_func" >&5
|
echo "configure:3176: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3150 "configure"
|
#line 3181 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3169,7 +3200,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3196,12 +3227,12 @@ done
|
||||||
for ac_func in access stat mkdir rename rmdir unlink realpath
|
for ac_func in access stat mkdir rename rmdir unlink realpath
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3200: checking for $ac_func" >&5
|
echo "configure:3231: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3205 "configure"
|
#line 3236 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3224,7 +3255,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3251,12 +3282,12 @@ done
|
||||||
for ac_func in inet_aton inet_addr
|
for ac_func in inet_aton inet_addr
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3255: checking for $ac_func" >&5
|
echo "configure:3286: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3260 "configure"
|
#line 3291 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3279,7 +3310,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3306,12 +3337,12 @@ done
|
||||||
for ac_func in inet_pton uname
|
for ac_func in inet_pton uname
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3310: checking for $ac_func" >&5
|
echo "configure:3341: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3315 "configure"
|
#line 3346 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3334,7 +3365,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3362,12 +3393,12 @@ done
|
||||||
for ac_func in gethostbyname_r
|
for ac_func in gethostbyname_r
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3366: checking for $ac_func" >&5
|
echo "configure:3397: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3371 "configure"
|
#line 3402 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3390,7 +3421,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3417,7 +3448,7 @@ EOF
|
||||||
# We look for the one that returns `int'.
|
# We look for the one that returns `int'.
|
||||||
# Hopefully this check is robust enough.
|
# Hopefully this check is robust enough.
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3421 "configure"
|
#line 3452 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -3441,12 +3472,12 @@ done
|
||||||
for ac_func in gethostbyaddr_r
|
for ac_func in gethostbyaddr_r
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3445: checking for $ac_func" >&5
|
echo "configure:3476: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3450 "configure"
|
#line 3481 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3469,7 +3500,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3496,7 +3527,7 @@ EOF
|
||||||
# We look for the one that returns `int'.
|
# We look for the one that returns `int'.
|
||||||
# Hopefully this check is robust enough.
|
# Hopefully this check is robust enough.
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3500 "configure"
|
#line 3531 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -3520,12 +3551,12 @@ done
|
||||||
for ac_func in gethostname
|
for ac_func in gethostname
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3524: checking for $ac_func" >&5
|
echo "configure:3555: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3529 "configure"
|
#line 3560 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3548,7 +3579,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3572,7 +3603,7 @@ EOF
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3576 "configure"
|
#line 3607 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -3599,12 +3630,12 @@ done
|
||||||
for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np sched_yield
|
for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np sched_yield
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3603: checking for $ac_func" >&5
|
echo "configure:3634: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3608 "configure"
|
#line 3639 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3627,7 +3658,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3655,12 +3686,12 @@ done
|
||||||
for ac_func in sched_yield
|
for ac_func in sched_yield
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3659: checking for $ac_func" >&5
|
echo "configure:3690: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3664 "configure"
|
#line 3695 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3683,7 +3714,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3705,7 +3736,7 @@ EOF
|
||||||
else
|
else
|
||||||
echo "$ac_t""no" 1>&6
|
echo "$ac_t""no" 1>&6
|
||||||
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
|
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
|
||||||
echo "configure:3709: checking for sched_yield in -lposix4" >&5
|
echo "configure:3740: checking for sched_yield in -lposix4" >&5
|
||||||
ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
@ -3713,7 +3744,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lposix4 $LIBS"
|
LIBS="-lposix4 $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3717 "configure"
|
#line 3748 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* Override any gcc2 internal prototype to avoid an error. */
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
@ -3724,7 +3755,7 @@ int main() {
|
||||||
sched_yield()
|
sched_yield()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
|
@ -3759,12 +3790,12 @@ done
|
||||||
for ac_func in gettimeofday time ftime
|
for ac_func in gettimeofday time ftime
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3763: checking for $ac_func" >&5
|
echo "configure:3794: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3768 "configure"
|
#line 3799 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3787,7 +3818,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3820,12 +3851,12 @@ done
|
||||||
for ac_func in memmove
|
for ac_func in memmove
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3824: checking for $ac_func" >&5
|
echo "configure:3855: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3829 "configure"
|
#line 3860 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3848,7 +3879,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3881,12 +3912,12 @@ done
|
||||||
for ac_func in memcpy
|
for ac_func in memcpy
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:3885: checking for $ac_func" >&5
|
echo "configure:3916: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3890 "configure"
|
#line 3921 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -3909,7 +3940,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:3944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -3957,7 +3988,7 @@ done
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
|
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
|
||||||
echo "configure:3961: checking for socket libraries" >&5
|
echo "configure:3992: checking for socket libraries" >&5
|
||||||
if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
|
@ -3965,12 +3996,12 @@ else
|
||||||
gcj_checkBoth=0
|
gcj_checkBoth=0
|
||||||
unset ac_cv_func_connect
|
unset ac_cv_func_connect
|
||||||
echo $ac_n "checking for connect""... $ac_c" 1>&6
|
echo $ac_n "checking for connect""... $ac_c" 1>&6
|
||||||
echo "configure:3969: checking for connect" >&5
|
echo "configure:4000: checking for connect" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3974 "configure"
|
#line 4005 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char connect(); below. */
|
which can conflict with char connect(); below. */
|
||||||
|
@ -3993,7 +4024,7 @@ connect();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:3997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_connect=yes"
|
eval "ac_cv_func_connect=yes"
|
||||||
else
|
else
|
||||||
|
@ -4016,7 +4047,7 @@ fi
|
||||||
if test "$gcj_checkSocket" = 1; then
|
if test "$gcj_checkSocket" = 1; then
|
||||||
unset ac_cv_func_connect
|
unset ac_cv_func_connect
|
||||||
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
|
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
|
||||||
echo "configure:4020: checking for main in -lsocket" >&5
|
echo "configure:4051: checking for main in -lsocket" >&5
|
||||||
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
@ -4024,14 +4055,14 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lsocket $LIBS"
|
LIBS="-lsocket $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4028 "configure"
|
#line 4059 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
main()
|
main()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
|
@ -4058,12 +4089,12 @@ fi
|
||||||
LIBS="$LIBS -lsocket -lnsl"
|
LIBS="$LIBS -lsocket -lnsl"
|
||||||
unset ac_cv_func_accept
|
unset ac_cv_func_accept
|
||||||
echo $ac_n "checking for accept""... $ac_c" 1>&6
|
echo $ac_n "checking for accept""... $ac_c" 1>&6
|
||||||
echo "configure:4062: checking for accept" >&5
|
echo "configure:4093: checking for accept" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4067 "configure"
|
#line 4098 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char accept(); below. */
|
which can conflict with char accept(); below. */
|
||||||
|
@ -4086,7 +4117,7 @@ accept();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_accept=yes"
|
eval "ac_cv_func_accept=yes"
|
||||||
else
|
else
|
||||||
|
@ -4113,12 +4144,12 @@ fi
|
||||||
gcj_oldLibs=$LIBS
|
gcj_oldLibs=$LIBS
|
||||||
LIBS="$LIBS $gcj_cv_lib_sockets"
|
LIBS="$LIBS $gcj_cv_lib_sockets"
|
||||||
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
|
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
|
||||||
echo "configure:4117: checking for gethostbyname" >&5
|
echo "configure:4148: checking for gethostbyname" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4122 "configure"
|
#line 4153 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char gethostbyname(); below. */
|
which can conflict with char gethostbyname(); below. */
|
||||||
|
@ -4141,7 +4172,7 @@ gethostbyname();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_gethostbyname=yes"
|
eval "ac_cv_func_gethostbyname=yes"
|
||||||
else
|
else
|
||||||
|
@ -4159,7 +4190,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
|
||||||
else
|
else
|
||||||
echo "$ac_t""no" 1>&6
|
echo "$ac_t""no" 1>&6
|
||||||
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
|
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
|
||||||
echo "configure:4163: checking for main in -lnsl" >&5
|
echo "configure:4194: checking for main in -lnsl" >&5
|
||||||
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
@ -4167,14 +4198,14 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lnsl $LIBS"
|
LIBS="-lnsl $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4171 "configure"
|
#line 4202 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
main()
|
main()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
|
@ -4206,7 +4237,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
|
||||||
|
|
||||||
if test "$with_system_zlib" = yes; then
|
if test "$with_system_zlib" = yes; then
|
||||||
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
|
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
|
||||||
echo "configure:4210: checking for deflate in -lz" >&5
|
echo "configure:4241: checking for deflate in -lz" >&5
|
||||||
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
@ -4214,7 +4245,7 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lz $LIBS"
|
LIBS="-lz $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4218 "configure"
|
#line 4249 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* Override any gcc2 internal prototype to avoid an error. */
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
@ -4225,7 +4256,7 @@ int main() {
|
||||||
deflate()
|
deflate()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
|
@ -4254,7 +4285,7 @@ fi
|
||||||
# requires -ldl.
|
# requires -ldl.
|
||||||
if test "$GC" = boehm; then
|
if test "$GC" = boehm; then
|
||||||
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
|
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
|
||||||
echo "configure:4258: checking for main in -ldl" >&5
|
echo "configure:4289: checking for main in -ldl" >&5
|
||||||
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
@ -4262,14 +4293,14 @@ else
|
||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-ldl $LIBS"
|
LIBS="-ldl $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4266 "configure"
|
#line 4297 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
main()
|
main()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
|
@ -4374,21 +4405,21 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_hdr in unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h
|
for ac_hdr in unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h
|
||||||
do
|
do
|
||||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||||
echo "configure:4382: checking for $ac_hdr" >&5
|
echo "configure:4413: checking for $ac_hdr" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4387 "configure"
|
#line 4418 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <$ac_hdr>
|
#include <$ac_hdr>
|
||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:4392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:4423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||||
if test -z "$ac_err"; then
|
if test -z "$ac_err"; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
|
@ -4418,17 +4449,17 @@ for ac_hdr in dirent.h
|
||||||
do
|
do
|
||||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||||
echo "configure:4422: checking for $ac_hdr" >&5
|
echo "configure:4453: checking for $ac_hdr" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4427 "configure"
|
#line 4458 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <$ac_hdr>
|
#include <$ac_hdr>
|
||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:4432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:4463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||||
if test -z "$ac_err"; then
|
if test -z "$ac_err"; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
|
@ -4456,16 +4487,16 @@ done
|
||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
|
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
|
||||||
echo "configure:4460: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
|
echo "configure:4491: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4462 "configure"
|
#line 4493 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
int main() {
|
int main() {
|
||||||
struct sockaddr_in6 addr6;
|
struct sockaddr_in6 addr6;
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
if { (eval echo configure:4500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define HAVE_INET6 1
|
#define HAVE_INET6 1
|
||||||
|
@ -4481,16 +4512,16 @@ fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
|
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
|
||||||
echo "configure:4485: checking for socklen_t in sys/socket.h" >&5
|
echo "configure:4516: checking for socklen_t in sys/socket.h" >&5
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4487 "configure"
|
#line 4518 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
int main() {
|
int main() {
|
||||||
socklen_t x = 5;
|
socklen_t x = 5;
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
if { (eval echo configure:4525: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define HAVE_SOCKLEN_T 1
|
#define HAVE_SOCKLEN_T 1
|
||||||
|
@ -4506,16 +4537,16 @@ fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
|
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
|
||||||
echo "configure:4510: checking for tm_gmtoff in struct tm" >&5
|
echo "configure:4541: checking for tm_gmtoff in struct tm" >&5
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4512 "configure"
|
#line 4543 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
int main() {
|
int main() {
|
||||||
struct tm tim; tim.tm_gmtoff = 0;
|
struct tm tim; tim.tm_gmtoff = 0;
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
if { (eval echo configure:4550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define STRUCT_TM_HAS_GMTOFF 1
|
#define STRUCT_TM_HAS_GMTOFF 1
|
||||||
|
@ -4528,16 +4559,16 @@ else
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
echo "$ac_t""no" 1>&6
|
echo "$ac_t""no" 1>&6
|
||||||
echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
|
echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
|
||||||
echo "configure:4532: checking for global timezone variable" >&5
|
echo "configure:4563: checking for global timezone variable" >&5
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4534 "configure"
|
#line 4565 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
int main() {
|
int main() {
|
||||||
long z2 = timezone;
|
long z2 = timezone;
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
if { (eval echo configure:4572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define HAVE_TIMEZONE 1
|
#define HAVE_TIMEZONE 1
|
||||||
|
@ -4557,19 +4588,19 @@ rm -f conftest*
|
||||||
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
||||||
# for constant arguments. Useless!
|
# for constant arguments. Useless!
|
||||||
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
|
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
|
||||||
echo "configure:4561: checking for working alloca.h" >&5
|
echo "configure:4592: checking for working alloca.h" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4566 "configure"
|
#line 4597 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
int main() {
|
int main() {
|
||||||
char *p = alloca(2 * sizeof(int));
|
char *p = alloca(2 * sizeof(int));
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
ac_cv_header_alloca_h=yes
|
ac_cv_header_alloca_h=yes
|
||||||
else
|
else
|
||||||
|
@ -4590,12 +4621,12 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $ac_n "checking for alloca""... $ac_c" 1>&6
|
echo $ac_n "checking for alloca""... $ac_c" 1>&6
|
||||||
echo "configure:4594: checking for alloca" >&5
|
echo "configure:4625: checking for alloca" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4599 "configure"
|
#line 4630 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
@ -4623,7 +4654,7 @@ int main() {
|
||||||
char *p = (char *) alloca(1);
|
char *p = (char *) alloca(1);
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
ac_cv_func_alloca_works=yes
|
ac_cv_func_alloca_works=yes
|
||||||
else
|
else
|
||||||
|
@ -4655,12 +4686,12 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
|
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
|
||||||
echo "configure:4659: checking whether alloca needs Cray hooks" >&5
|
echo "configure:4690: checking whether alloca needs Cray hooks" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4664 "configure"
|
#line 4695 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#if defined(CRAY) && ! defined(CRAY2)
|
#if defined(CRAY) && ! defined(CRAY2)
|
||||||
webecray
|
webecray
|
||||||
|
@ -4685,12 +4716,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
|
||||||
if test $ac_cv_os_cray = yes; then
|
if test $ac_cv_os_cray = yes; then
|
||||||
for ac_func in _getb67 GETB67 getb67; do
|
for ac_func in _getb67 GETB67 getb67; do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:4689: checking for $ac_func" >&5
|
echo "configure:4720: checking for $ac_func" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4694 "configure"
|
#line 4725 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
which can conflict with char $ac_func(); below. */
|
which can conflict with char $ac_func(); below. */
|
||||||
|
@ -4713,7 +4744,7 @@ $ac_func();
|
||||||
|
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
if { (eval echo configure:4748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
else
|
else
|
||||||
|
@ -4740,7 +4771,7 @@ done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
|
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
|
||||||
echo "configure:4744: checking stack direction for C alloca" >&5
|
echo "configure:4775: checking stack direction for C alloca" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
|
@ -4748,7 +4779,7 @@ else
|
||||||
ac_cv_c_stack_direction=0
|
ac_cv_c_stack_direction=0
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 4752 "configure"
|
#line 4783 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
find_stack_direction ()
|
find_stack_direction ()
|
||||||
{
|
{
|
||||||
|
@ -4767,7 +4798,7 @@ main ()
|
||||||
exit (find_stack_direction() < 0);
|
exit (find_stack_direction() < 0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:4771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
if { (eval echo configure:4802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||||
then
|
then
|
||||||
ac_cv_c_stack_direction=1
|
ac_cv_c_stack_direction=1
|
||||||
else
|
else
|
||||||
|
@ -4794,7 +4825,7 @@ do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
set dummy $ac_prog; ac_word=$2
|
set dummy $ac_prog; ac_word=$2
|
||||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||||
echo "configure:4798: checking for $ac_word" >&5
|
echo "configure:4829: checking for $ac_word" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
dnl Process this with autoconf to create configure
|
dnl Process this with autoconf to create configure
|
||||||
AC_INIT(java/lang/System.java)
|
AC_INIT(java/lang/System.java)
|
||||||
|
|
||||||
dnl Can't be done in LIBGCJ_CONFIGURE because that confuses automake.
|
dnl Can't be done in LIBGCJ_CONFIGURE because that confuses automake.
|
||||||
AC_CONFIG_AUX_DIR(..)
|
AC_CONFIG_AUX_DIR(..)
|
||||||
|
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
|
@ -64,8 +64,11 @@ case "$TARGET_ECOS" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_EGREP_HEADER(__uint32_t, sys/types.h, AC_DEFINE(HAVE_INT32_DEFINED))
|
AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED))
|
||||||
AC_EGREP_HEADER(__uint32_t, sys/config.h, AC_DEFINE(HAVE_INT32_DEFINED))
|
AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED))
|
||||||
|
AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
|
||||||
|
AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
|
||||||
|
|
||||||
|
|
||||||
dnl These may not be defined in a non-ANS conformant embedded system.
|
dnl These may not be defined in a non-ANS conformant embedded system.
|
||||||
dnl FIXME: Should these case a runtime exception in that case?
|
dnl FIXME: Should these case a runtime exception in that case?
|
||||||
|
@ -466,7 +469,7 @@ AC_SUBST(AM_RUNTESTFLAGS)
|
||||||
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
|
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
|
||||||
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
|
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
|
||||||
dnl BSD_COMP is defined; just including sys/filio.h is simpler.
|
dnl BSD_COMP is defined; just including sys/filio.h is simpler.
|
||||||
AC_CHECK_HEADERS(unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h)
|
AC_CHECK_HEADERS(unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h)
|
||||||
dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
|
dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
|
||||||
dnl for now. If you change this, you also must update natFile.cc.
|
dnl for now. If you change this, you also must update natFile.cc.
|
||||||
AC_CHECK_HEADERS(dirent.h)
|
AC_CHECK_HEADERS(dirent.h)
|
||||||
|
|
|
@ -40,9 +40,12 @@
|
||||||
/* Define if you have strerror. */
|
/* Define if you have strerror. */
|
||||||
#undef HAVE_STRERROR
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
/* Define if you have __int32_t and __uint32_t. */
|
/* Define if you have int32_t and uint32_t. */
|
||||||
#undef HAVE_INT32_DEFINED
|
#undef HAVE_INT32_DEFINED
|
||||||
|
|
||||||
|
/* Define if you have u_int32_t */
|
||||||
|
#undef HAVE_BSD_INT32_DEFINED
|
||||||
|
|
||||||
/* Define if you're running eCos. */
|
/* Define if you're running eCos. */
|
||||||
#undef ECOS
|
#undef ECOS
|
||||||
|
|
||||||
|
@ -214,6 +217,9 @@
|
||||||
/* Define if you have the <fcntl.h> header file. */
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
#undef HAVE_FCNTL_H
|
#undef HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
/* Define if you have the <netdb.h> header file. */
|
/* Define if you have the <netdb.h> header file. */
|
||||||
#undef HAVE_NETDB_H
|
#undef HAVE_NETDB_H
|
||||||
|
|
||||||
|
@ -223,6 +229,12 @@
|
||||||
/* Define if you have the <pwd.h> header file. */
|
/* Define if you have the <pwd.h> header file. */
|
||||||
#undef HAVE_PWD_H
|
#undef HAVE_PWD_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/config.h> header file. */
|
||||||
|
#undef HAVE_SYS_CONFIG_H
|
||||||
|
|
||||||
/* Define if you have the <sys/filio.h> header file. */
|
/* Define if you have the <sys/filio.h> header file. */
|
||||||
#undef HAVE_SYS_FILIO_H
|
#undef HAVE_SYS_FILIO_H
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ _DEFUN (_dtoa_r,
|
||||||
char **rve _AND
|
char **rve _AND
|
||||||
int float_type)
|
int float_type)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
float_type == 0 for double precision, 1 for float.
|
float_type == 0 for double precision, 1 for float.
|
||||||
|
|
||||||
Arguments ndigits, decpt, sign are similar to those
|
Arguments ndigits, decpt, sign are similar to those
|
||||||
|
@ -679,7 +679,7 @@ _DEFUN (_dtoa_r,
|
||||||
{
|
{
|
||||||
if (!word1 (d) && !(word0 (d) & Bndry_mask)
|
if (!word1 (d) && !(word0 (d) & Bndry_mask)
|
||||||
#ifndef Sudden_Underflow
|
#ifndef Sudden_Underflow
|
||||||
&& word0 (d) & Exp_mask
|
&& word0(d) & Exp_mask
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -893,7 +893,7 @@ _DEFUN (_dtoa,
|
||||||
char *buf _AND
|
char *buf _AND
|
||||||
int float_type)
|
int float_type)
|
||||||
{
|
{
|
||||||
struct _Jv_reent reent;
|
struct _Jv_reent reent;
|
||||||
char *p;
|
char *p;
|
||||||
memset (&reent, 0, sizeof reent);
|
memset (&reent, 0, sizeof reent);
|
||||||
|
|
||||||
|
@ -902,5 +902,3 @@ _DEFUN (_dtoa,
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,20 +6,20 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* __ieee754_acos(x)
|
/* __ieee754_acos(x)
|
||||||
* Method :
|
* Method :
|
||||||
* acos(x) = pi/2 - asin(x)
|
* acos(x) = pi/2 - asin(x)
|
||||||
* acos(-x) = pi/2 + asin(x)
|
* acos(-x) = pi/2 + asin(x)
|
||||||
* For |x|<=0.5
|
* For |x|<=0.5
|
||||||
* acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c)
|
* acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c)
|
||||||
* For x>0.5
|
* For x>0.5
|
||||||
* acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2)))
|
* acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2)))
|
||||||
* = 2asin(sqrt((1-x)/2))
|
* = 2asin(sqrt((1-x)/2))
|
||||||
* = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z)
|
* = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z)
|
||||||
* = 2f + (2c + 2s*z*R(z))
|
* = 2f + (2c + 2s*z*R(z))
|
||||||
* where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term
|
* where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term
|
||||||
|
@ -40,9 +40,9 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
|
one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
|
||||||
pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
|
pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
|
||||||
|
@ -67,11 +67,11 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double z,p,q,r,w,s,c,df;
|
double z,p,q,r,w,s,c,df;
|
||||||
__int32_t hx,ix;
|
int32_t hx,ix;
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
ix = hx&0x7fffffff;
|
ix = hx&0x7fffffff;
|
||||||
if(ix>=0x3ff00000) { /* |x| >= 1 */
|
if(ix>=0x3ff00000) { /* |x| >= 1 */
|
||||||
__uint32_t lx;
|
uint32_t lx;
|
||||||
GET_LOW_WORD(lx,x);
|
GET_LOW_WORD(lx,x);
|
||||||
if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */
|
if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */
|
||||||
if(hx>0) return 0.0; /* acos(1) = 0 */
|
if(hx>0) return 0.0; /* acos(1) = 0 */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*
|
*
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
/* __ieee754_atan2(y,x)
|
/* __ieee754_atan2(y,x)
|
||||||
* Method :
|
* Method :
|
||||||
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
|
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
|
||||||
* 2. Reduce x to positive by (if x and y are unexceptional):
|
* 2. Reduce x to positive by (if x and y are unexceptional):
|
||||||
* ARG (x+iy) = arctan(y/x) ... if x > 0,
|
* ARG (x+iy) = arctan(y/x) ... if x > 0,
|
||||||
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
|
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
|
||||||
*
|
*
|
||||||
|
@ -33,9 +33,9 @@
|
||||||
* ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
|
* ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
|
||||||
*
|
*
|
||||||
* Constants:
|
* Constants:
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
tiny = 1.0e-300,
|
tiny = 1.0e-300,
|
||||||
zero = 0.0,
|
zero = 0.0,
|
||||||
|
@ -61,10 +61,10 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
||||||
double __ieee754_atan2(y,x)
|
double __ieee754_atan2(y,x)
|
||||||
double y,x;
|
double y,x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double z;
|
double z;
|
||||||
__int32_t k,m,hx,hy,ix,iy;
|
int32_t k,m,hx,hy,ix,iy;
|
||||||
__uint32_t lx,ly;
|
uint32_t lx,ly;
|
||||||
|
|
||||||
EXTRACT_WORDS(hx,lx,x);
|
EXTRACT_WORDS(hx,lx,x);
|
||||||
ix = hx&0x7fffffff;
|
ix = hx&0x7fffffff;
|
||||||
|
@ -79,7 +79,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
||||||
/* when y = 0 */
|
/* when y = 0 */
|
||||||
if((iy|ly)==0) {
|
if((iy|ly)==0) {
|
||||||
switch(m) {
|
switch(m) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1: return y; /* atan(+-0,+anything)=+-0 */
|
case 1: return y; /* atan(+-0,+anything)=+-0 */
|
||||||
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
|
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
|
||||||
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
|
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
|
||||||
|
@ -87,7 +87,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
||||||
}
|
}
|
||||||
/* when x = 0 */
|
/* when x = 0 */
|
||||||
if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
|
if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
|
||||||
|
|
||||||
/* when x is INF */
|
/* when x is INF */
|
||||||
if(ix==0x7ff00000) {
|
if(ix==0x7ff00000) {
|
||||||
if(iy==0x7ff00000) {
|
if(iy==0x7ff00000) {
|
||||||
|
@ -117,7 +117,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
||||||
switch (m) {
|
switch (m) {
|
||||||
case 0: return z ; /* atan(+,+) */
|
case 0: return z ; /* atan(+,+) */
|
||||||
case 1: {
|
case 1: {
|
||||||
__uint32_t zh;
|
uint32_t zh;
|
||||||
GET_HIGH_WORD(zh,z);
|
GET_HIGH_WORD(zh,z);
|
||||||
SET_HIGH_WORD(z,zh ^ 0x80000000);
|
SET_HIGH_WORD(z,zh ^ 0x80000000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -19,36 +19,36 @@
|
||||||
* Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
|
* Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
|
||||||
* Given x, find r and integer k such that
|
* Given x, find r and integer k such that
|
||||||
*
|
*
|
||||||
* x = k*ln2 + r, |r| <= 0.5*ln2.
|
* x = k*ln2 + r, |r| <= 0.5*ln2.
|
||||||
*
|
*
|
||||||
* Here r will be represented as r = hi-lo for better
|
* Here r will be represented as r = hi-lo for better
|
||||||
* accuracy.
|
* accuracy.
|
||||||
*
|
*
|
||||||
* 2. Approximation of exp(r) by a special rational function on
|
* 2. Approximation of exp(r) by a special rational function on
|
||||||
* the interval [0,0.34658]:
|
* the interval [0,0.34658]:
|
||||||
* Write
|
* Write
|
||||||
* R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ...
|
* R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ...
|
||||||
* We use a special Reme algorithm on [0,0.34658] to generate
|
* We use a special Reme algorithm on [0,0.34658] to generate
|
||||||
* a polynomial of degree 5 to approximate R. The maximum error
|
* a polynomial of degree 5 to approximate R. The maximum error
|
||||||
* of this polynomial approximation is bounded by 2**-59. In
|
* of this polynomial approximation is bounded by 2**-59. In
|
||||||
* other words,
|
* other words,
|
||||||
* R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5
|
* R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5
|
||||||
* (where z=r*r, and the values of P1 to P5 are listed below)
|
* (where z=r*r, and the values of P1 to P5 are listed below)
|
||||||
* and
|
* and
|
||||||
* | 5 | -59
|
* | 5 | -59
|
||||||
* | 2.0+P1*z+...+P5*z - R(z) | <= 2
|
* | 2.0+P1*z+...+P5*z - R(z) | <= 2
|
||||||
* | |
|
* | |
|
||||||
* The computation of exp(r) thus becomes
|
* The computation of exp(r) thus becomes
|
||||||
* 2*r
|
* 2*r
|
||||||
* exp(r) = 1 + -------
|
* exp(r) = 1 + -------
|
||||||
* R - r
|
* R - r
|
||||||
* r*R1(r)
|
* r*R1(r)
|
||||||
* = 1 + r + ----------- (for better accuracy)
|
* = 1 + r + ----------- (for better accuracy)
|
||||||
* 2 - R1(r)
|
* 2 - R1(r)
|
||||||
* where
|
* where
|
||||||
* 2 4 10
|
* 2 4 10
|
||||||
* R1(r) = r - (P1*r + P2*r + ... + P5*r ).
|
* R1(r) = r - (P1*r + P2*r + ... + P5*r ).
|
||||||
*
|
*
|
||||||
* 3. Scale back to obtain exp(x):
|
* 3. Scale back to obtain exp(x):
|
||||||
* From step 1, we have
|
* From step 1, we have
|
||||||
* exp(x) = 2^k * exp(r)
|
* exp(x) = 2^k * exp(r)
|
||||||
|
@ -63,13 +63,13 @@
|
||||||
* 1 ulp (unit in the last place).
|
* 1 ulp (unit in the last place).
|
||||||
*
|
*
|
||||||
* Misc. info.
|
* Misc. info.
|
||||||
* For IEEE double
|
* For IEEE double
|
||||||
* if x > 7.09782712893383973096e+02 then exp(x) overflow
|
* if x > 7.09782712893383973096e+02 then exp(x) overflow
|
||||||
* if x < -7.45133219101941108420e+02 then exp(x) underflow
|
* if x < -7.45133219101941108420e+02 then exp(x) underflow
|
||||||
*
|
*
|
||||||
* Constants:
|
* Constants:
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
@ -109,8 +109,8 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double y,hi,lo,c,t;
|
double y,hi,lo,c,t;
|
||||||
__int32_t k,xsb;
|
int32_t k,xsb;
|
||||||
__uint32_t hx;
|
uint32_t hx;
|
||||||
|
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
xsb = (hx>>31)&1; /* sign bit of x */
|
xsb = (hx>>31)&1; /* sign bit of x */
|
||||||
|
@ -119,9 +119,9 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
||||||
/* filter out non-finite argument */
|
/* filter out non-finite argument */
|
||||||
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
|
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
|
||||||
if(hx>=0x7ff00000) {
|
if(hx>=0x7ff00000) {
|
||||||
__uint32_t lx;
|
uint32_t lx;
|
||||||
GET_LOW_WORD(lx,x);
|
GET_LOW_WORD(lx,x);
|
||||||
if(((hx&0xfffff)|lx)!=0)
|
if(((hx&0xfffff)|lx)!=0)
|
||||||
return x+x; /* NaN */
|
return x+x; /* NaN */
|
||||||
else return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */
|
else return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* argument reduction */
|
/* argument reduction */
|
||||||
if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
|
if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
|
||||||
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
|
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
|
||||||
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
|
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
|
||||||
} else {
|
} else {
|
||||||
|
@ -140,7 +140,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
||||||
lo = t*ln2LO[0];
|
lo = t*ln2LO[0];
|
||||||
}
|
}
|
||||||
x = hi - lo;
|
x = hi - lo;
|
||||||
}
|
}
|
||||||
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
|
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
|
||||||
if(huge+x>one) return one+x;/* trigger inexact */
|
if(huge+x>one) return one+x;/* trigger inexact */
|
||||||
}
|
}
|
||||||
|
@ -149,15 +149,15 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
||||||
/* x is now in primary range */
|
/* x is now in primary range */
|
||||||
t = x*x;
|
t = x*x;
|
||||||
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
|
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
|
||||||
if(k==0) return one-((x*c)/(c-2.0)-x);
|
if(k==0) return one-((x*c)/(c-2.0)-x);
|
||||||
else y = one-((lo-(x*c)/(2.0-c))-hi);
|
else y = one-((lo-(x*c)/(2.0-c))-hi);
|
||||||
if(k >= -1021) {
|
if(k >= -1021) {
|
||||||
__uint32_t hy;
|
uint32_t hy;
|
||||||
GET_HIGH_WORD(hy,y);
|
GET_HIGH_WORD(hy,y);
|
||||||
SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */
|
SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */
|
||||||
return y;
|
return y;
|
||||||
} else {
|
} else {
|
||||||
__uint32_t hy;
|
uint32_t hy;
|
||||||
GET_HIGH_WORD(hy,y);
|
GET_HIGH_WORD(hy,y);
|
||||||
SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */
|
SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */
|
||||||
return y*twom1000;
|
return y*twom1000;
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __ieee754_fmod(x,y)
|
* __ieee754_fmod(x,y)
|
||||||
* Return x mod y in exact arithmetic
|
* Return x mod y in exact arithmetic
|
||||||
* Method: shift and subtract
|
* Method: shift and subtract
|
||||||
|
@ -34,8 +34,8 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
double x,y ;
|
double x,y ;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t n,hx,hy,hz,ix,iy,sx,i;
|
int32_t n,hx,hy,hz,ix,iy,sx,i;
|
||||||
__uint32_t lx,ly,lz;
|
uint32_t lx,ly,lz;
|
||||||
|
|
||||||
EXTRACT_WORDS(hx,lx,x);
|
EXTRACT_WORDS(hx,lx,x);
|
||||||
EXTRACT_WORDS(hy,ly,y);
|
EXTRACT_WORDS(hy,ly,y);
|
||||||
|
@ -49,8 +49,8 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
return (x*y)/(x*y);
|
return (x*y)/(x*y);
|
||||||
if(hx<=hy) {
|
if(hx<=hy) {
|
||||||
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
|
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
|
||||||
if(lx==ly)
|
if(lx==ly)
|
||||||
return Zero[(__uint32_t)sx>>31]; /* |x|=|y| return x*0*/
|
return Zero[(uint32_t)sx>>31]; /* |x|=|y| return x*0*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* determine ix = ilogb(x) */
|
/* determine ix = ilogb(x) */
|
||||||
|
@ -72,7 +72,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
} else iy = (hy>>20)-1023;
|
} else iy = (hy>>20)-1023;
|
||||||
|
|
||||||
/* set up {hx,lx}, {hy,ly} and align y to x */
|
/* set up {hx,lx}, {hy,ly} and align y to x */
|
||||||
if(ix >= -1022)
|
if(ix >= -1022)
|
||||||
hx = 0x00100000|(0x000fffff&hx);
|
hx = 0x00100000|(0x000fffff&hx);
|
||||||
else { /* subnormal x, shift x to normal */
|
else { /* subnormal x, shift x to normal */
|
||||||
n = -1022-ix;
|
n = -1022-ix;
|
||||||
|
@ -84,7 +84,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
lx = 0;
|
lx = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(iy >= -1022)
|
if(iy >= -1022)
|
||||||
hy = 0x00100000|(0x000fffff&hy);
|
hy = 0x00100000|(0x000fffff&hy);
|
||||||
else { /* subnormal y, shift y to normal */
|
else { /* subnormal y, shift y to normal */
|
||||||
n = -1022-iy;
|
n = -1022-iy;
|
||||||
|
@ -104,7 +104,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
|
if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
|
||||||
else {
|
else {
|
||||||
if((hz|lz)==0) /* return sign(x)*0 */
|
if((hz|lz)==0) /* return sign(x)*0 */
|
||||||
return Zero[(__uint32_t)sx>>31];
|
return Zero[(uint32_t)sx>>31];
|
||||||
hx = hz+hz+(lz>>31); lx = lz+lz;
|
hx = hz+hz+(lz>>31); lx = lz+lz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
|
|
||||||
/* convert back to floating value and restore the sign */
|
/* convert back to floating value and restore the sign */
|
||||||
if((hx|lx)==0) /* return sign(x)*0 */
|
if((hx|lx)==0) /* return sign(x)*0 */
|
||||||
return Zero[(__uint32_t)sx>>31];
|
return Zero[(uint32_t)sx>>31];
|
||||||
while(hx<0x00100000) { /* normalize x */
|
while(hx<0x00100000) { /* normalize x */
|
||||||
hx = hx+hx+(lx>>31); lx = lx+lx;
|
hx = hx+hx+(lx>>31); lx = lx+lx;
|
||||||
iy -= 1;
|
iy -= 1;
|
||||||
|
@ -124,7 +124,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
||||||
} else { /* subnormal output */
|
} else { /* subnormal output */
|
||||||
n = -1022 - iy;
|
n = -1022 - iy;
|
||||||
if(n<=20) {
|
if(n<=20) {
|
||||||
lx = (lx>>n)|((__uint32_t)hx<<(32-n));
|
lx = (lx>>n)|((uint32_t)hx<<(32-n));
|
||||||
hx >>= n;
|
hx >>= n;
|
||||||
} else if (n<=31) {
|
} else if (n<=31) {
|
||||||
lx = (hx<<(32-n))|(lx>>n); hx = sx;
|
lx = (hx<<(32-n))|(lx>>n); hx = sx;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -14,17 +14,17 @@
|
||||||
/* __ieee754_log(x)
|
/* __ieee754_log(x)
|
||||||
* Return the logrithm of x
|
* Return the logrithm of x
|
||||||
*
|
*
|
||||||
* Method :
|
* Method :
|
||||||
* 1. Argument Reduction: find k and f such that
|
* 1. Argument Reduction: find k and f such that
|
||||||
* x = 2^k * (1+f),
|
* x = 2^k * (1+f),
|
||||||
* where sqrt(2)/2 < 1+f < sqrt(2) .
|
* where sqrt(2)/2 < 1+f < sqrt(2) .
|
||||||
*
|
*
|
||||||
* 2. Approximation of log(1+f).
|
* 2. Approximation of log(1+f).
|
||||||
* Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
|
* Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
|
||||||
* = 2s + 2/3 s**3 + 2/5 s**5 + .....,
|
* = 2s + 2/3 s**3 + 2/5 s**5 + .....,
|
||||||
* = 2s + s*R
|
* = 2s + s*R
|
||||||
* We use a special Reme algorithm on [0,0.1716] to generate
|
* We use a special Reme algorithm on [0,0.1716] to generate
|
||||||
* a polynomial of degree 14 to approximate R The maximum error
|
* a polynomial of degree 14 to approximate R The maximum error
|
||||||
* of this polynomial approximation is bounded by 2**-58.45. In
|
* of this polynomial approximation is bounded by 2**-58.45. In
|
||||||
* other words,
|
* other words,
|
||||||
* 2 4 6 8 10 12 14
|
* 2 4 6 8 10 12 14
|
||||||
|
@ -32,22 +32,22 @@
|
||||||
* (the values of Lg1 to Lg7 are listed in the program)
|
* (the values of Lg1 to Lg7 are listed in the program)
|
||||||
* and
|
* and
|
||||||
* | 2 14 | -58.45
|
* | 2 14 | -58.45
|
||||||
* | Lg1*s +...+Lg7*s - R(z) | <= 2
|
* | Lg1*s +...+Lg7*s - R(z) | <= 2
|
||||||
* | |
|
* | |
|
||||||
* Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
|
* Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
|
||||||
* In order to guarantee error in log below 1ulp, we compute log
|
* In order to guarantee error in log below 1ulp, we compute log
|
||||||
* by
|
* by
|
||||||
* log(1+f) = f - s*(f - R) (if f is not too large)
|
* log(1+f) = f - s*(f - R) (if f is not too large)
|
||||||
* log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy)
|
* log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy)
|
||||||
*
|
*
|
||||||
* 3. Finally, log(x) = k*ln2 + log(1+f).
|
* 3. Finally, log(x) = k*ln2 + log(1+f).
|
||||||
* = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
|
* = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
|
||||||
* Here ln2 is split into two floating point number:
|
* Here ln2 is split into two floating point number:
|
||||||
* ln2_hi + ln2_lo,
|
* ln2_hi + ln2_lo,
|
||||||
* where n*ln2_hi is always exact for |n| < 2000.
|
* where n*ln2_hi is always exact for |n| < 2000.
|
||||||
*
|
*
|
||||||
* Special cases:
|
* Special cases:
|
||||||
* log(x) is NaN with signal if x < 0 (including -INF) ;
|
* log(x) is NaN with signal if x < 0 (including -INF) ;
|
||||||
* log(+INF) is +INF; log(0) is -INF with signal;
|
* log(+INF) is +INF; log(0) is -INF with signal;
|
||||||
* log(NaN) is that NaN with no signal.
|
* log(NaN) is that NaN with no signal.
|
||||||
*
|
*
|
||||||
|
@ -56,9 +56,9 @@
|
||||||
* 1 ulp (unit in the last place).
|
* 1 ulp (unit in the last place).
|
||||||
*
|
*
|
||||||
* Constants:
|
* Constants:
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -96,19 +96,19 @@ static double zero = 0.0;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double hfsq,f,s,z,R,w,t1,t2,dk;
|
double hfsq,f,s,z,R,w,t1,t2,dk;
|
||||||
__int32_t k,hx,i,j;
|
int32_t k,hx,i,j;
|
||||||
__uint32_t lx;
|
uint32_t lx;
|
||||||
|
|
||||||
EXTRACT_WORDS(hx,lx,x);
|
EXTRACT_WORDS(hx,lx,x);
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
if (hx < 0x00100000) { /* x < 2**-1022 */
|
if (hx < 0x00100000) { /* x < 2**-1022 */
|
||||||
if (((hx&0x7fffffff)|lx)==0)
|
if (((hx&0x7fffffff)|lx)==0)
|
||||||
return -two54/zero; /* log(+-0)=-inf */
|
return -two54/zero; /* log(+-0)=-inf */
|
||||||
if (hx<0) return (x-x)/zero; /* log(-#) = NaN */
|
if (hx<0) return (x-x)/zero; /* log(-#) = NaN */
|
||||||
k -= 54; x *= two54; /* subnormal number, scale up x */
|
k -= 54; x *= two54; /* subnormal number, scale up x */
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
}
|
}
|
||||||
if (hx >= 0x7ff00000) return x+x;
|
if (hx >= 0x7ff00000) return x+x;
|
||||||
k += (hx>>20)-1023;
|
k += (hx>>20)-1023;
|
||||||
hx &= 0x000fffff;
|
hx &= 0x000fffff;
|
||||||
|
@ -129,14 +129,14 @@ static double zero = 0.0;
|
||||||
if(k==0) return f-R; else {dk=(double)k;
|
if(k==0) return f-R; else {dk=(double)k;
|
||||||
return dk*ln2_hi-((R-dk*ln2_lo)-f);}
|
return dk*ln2_hi-((R-dk*ln2_lo)-f);}
|
||||||
}
|
}
|
||||||
s = f/(2.0+f);
|
s = f/(2.0+f);
|
||||||
dk = (double)k;
|
dk = (double)k;
|
||||||
z = s*s;
|
z = s*s;
|
||||||
i = hx-0x6147a;
|
i = hx-0x6147a;
|
||||||
w = z*z;
|
w = z*z;
|
||||||
j = 0x6b851-hx;
|
j = 0x6b851-hx;
|
||||||
t1= w*(Lg2+w*(Lg4+w*Lg6));
|
t1= w*(Lg2+w*(Lg4+w*Lg6));
|
||||||
t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
|
t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
|
||||||
i |= j;
|
i |= j;
|
||||||
R = t2+t1;
|
R = t2+t1;
|
||||||
if(i>0) {
|
if(i>0) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
* 1. Compute and return log2(x) in two pieces:
|
* 1. Compute and return log2(x) in two pieces:
|
||||||
* log2(x) = w1 + w2,
|
* log2(x) = w1 + w2,
|
||||||
* where w1 has 53-24 = 29 bit trailing zeros.
|
* where w1 has 53-24 = 29 bit trailing zeros.
|
||||||
* 2. Perform y*log2(x) = n+y' by simulating muti-precision
|
* 2. Perform y*log2(x) = n+y' by simulating muti-precision
|
||||||
* arithmetic, where |y'|<=0.5.
|
* arithmetic, where |y'|<=0.5.
|
||||||
* 3. Return x**y = 2**n*exp(y'*log2)
|
* 3. Return x**y = 2**n*exp(y'*log2)
|
||||||
*
|
*
|
||||||
|
@ -46,13 +46,13 @@
|
||||||
* Accuracy:
|
* Accuracy:
|
||||||
* pow(x,y) returns x**y nearly rounded. In particular
|
* pow(x,y) returns x**y nearly rounded. In particular
|
||||||
* pow(integer,integer)
|
* pow(integer,integer)
|
||||||
* always returns the correct integer provided it is
|
* always returns the correct integer provided it is
|
||||||
* representable.
|
* representable.
|
||||||
*
|
*
|
||||||
* Constants :
|
* Constants :
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
bp[] = {1.0, 1.5,},
|
bp[] = {1.0, 1.5,},
|
||||||
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
|
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
|
||||||
|
@ -106,21 +106,21 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
{
|
{
|
||||||
double z,ax,z_h,z_l,p_h,p_l;
|
double z,ax,z_h,z_l,p_h,p_l;
|
||||||
double y1,t1,t2,r,s,t,u,v,w;
|
double y1,t1,t2,r,s,t,u,v,w;
|
||||||
__int32_t i,j,k,yisint,n;
|
int32_t i,j,k,yisint,n;
|
||||||
__int32_t hx,hy,ix,iy;
|
int32_t hx,hy,ix,iy;
|
||||||
__uint32_t lx,ly;
|
uint32_t lx,ly;
|
||||||
|
|
||||||
EXTRACT_WORDS(hx,lx,x);
|
EXTRACT_WORDS(hx,lx,x);
|
||||||
EXTRACT_WORDS(hy,ly,y);
|
EXTRACT_WORDS(hy,ly,y);
|
||||||
ix = hx&0x7fffffff; iy = hy&0x7fffffff;
|
ix = hx&0x7fffffff; iy = hy&0x7fffffff;
|
||||||
|
|
||||||
/* y==zero: x**0 = 1 */
|
/* y==zero: x**0 = 1 */
|
||||||
if((iy|ly)==0) return one;
|
if((iy|ly)==0) return one;
|
||||||
|
|
||||||
/* +-NaN return x+y */
|
/* +-NaN return x+y */
|
||||||
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
|
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
|
||||||
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
|
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
|
||||||
return x+y;
|
return x+y;
|
||||||
|
|
||||||
/* determine if y is an odd int when x < 0
|
/* determine if y is an odd int when x < 0
|
||||||
* yisint = 0 ... y is not an integer
|
* yisint = 0 ... y is not an integer
|
||||||
|
@ -128,22 +128,22 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
* yisint = 2 ... y is an even int
|
* yisint = 2 ... y is an even int
|
||||||
*/
|
*/
|
||||||
yisint = 0;
|
yisint = 0;
|
||||||
if(hx<0) {
|
if(hx<0) {
|
||||||
if(iy>=0x43400000) yisint = 2; /* even integer y */
|
if(iy>=0x43400000) yisint = 2; /* even integer y */
|
||||||
else if(iy>=0x3ff00000) {
|
else if(iy>=0x3ff00000) {
|
||||||
k = (iy>>20)-0x3ff; /* exponent */
|
k = (iy>>20)-0x3ff; /* exponent */
|
||||||
if(k>20) {
|
if(k>20) {
|
||||||
j = ly>>(52-k);
|
j = ly>>(52-k);
|
||||||
if((__uint32_t)(j<<(52-k))==ly) yisint = 2-(j&1);
|
if((uint32_t)(j<<(52-k))==ly) yisint = 2-(j&1);
|
||||||
} else if(ly==0) {
|
} else if(ly==0) {
|
||||||
j = iy>>(20-k);
|
j = iy>>(20-k);
|
||||||
if((j<<(20-k))==iy) yisint = 2-(j&1);
|
if((j<<(20-k))==iy) yisint = 2-(j&1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special value of y */
|
/* special value of y */
|
||||||
if(ly==0) {
|
if(ly==0) {
|
||||||
if (iy==0x7ff00000) { /* y is +-inf */
|
if (iy==0x7ff00000) { /* y is +-inf */
|
||||||
if(((ix-0x3ff00000)|lx)==0)
|
if(((ix-0x3ff00000)|lx)==0)
|
||||||
return y - y; /* inf**+-1 is NaN */
|
return y - y; /* inf**+-1 is NaN */
|
||||||
|
@ -151,14 +151,14 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
return (hy>=0)? y: zero;
|
return (hy>=0)? y: zero;
|
||||||
else /* (|x|<1)**-,+inf = inf,0 */
|
else /* (|x|<1)**-,+inf = inf,0 */
|
||||||
return (hy<0)?-y: zero;
|
return (hy<0)?-y: zero;
|
||||||
}
|
}
|
||||||
if(iy==0x3ff00000) { /* y is +-1 */
|
if(iy==0x3ff00000) { /* y is +-1 */
|
||||||
if(hy<0) return one/x; else return x;
|
if(hy<0) return one/x; else return x;
|
||||||
}
|
}
|
||||||
if(hy==0x40000000) return x*x; /* y is 2 */
|
if(hy==0x40000000) return x*x; /* y is 2 */
|
||||||
if(hy==0x3fe00000) { /* y is 0.5 */
|
if(hy==0x3fe00000) { /* y is 0.5 */
|
||||||
if(hx>=0) /* x >= +0 */
|
if(hx>=0) /* x >= +0 */
|
||||||
return __ieee754_sqrt(x);
|
return __ieee754_sqrt(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,19 +171,19 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
if(hx<0) {
|
if(hx<0) {
|
||||||
if(((ix-0x3ff00000)|yisint)==0) {
|
if(((ix-0x3ff00000)|yisint)==0) {
|
||||||
z = (z-z)/(z-z); /* (-1)**non-int is NaN */
|
z = (z-z)/(z-z); /* (-1)**non-int is NaN */
|
||||||
} else if(yisint==1)
|
} else if(yisint==1)
|
||||||
z = -z; /* (x<0)**odd = -(|x|**odd) */
|
z = -z; /* (x<0)**odd = -(|x|**odd) */
|
||||||
}
|
}
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (x<0)**(non-int) is NaN */
|
/* (x<0)**(non-int) is NaN */
|
||||||
/* CYGNUS LOCAL: This used to be
|
/* CYGNUS LOCAL: This used to be
|
||||||
if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x);
|
if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x);
|
||||||
but ANSI C says a right shift of a signed negative quantity is
|
but ANSI C says a right shift of a signed negative quantity is
|
||||||
implementation defined. */
|
implementation defined. */
|
||||||
if(((((__uint32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
|
if(((((uint32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
|
||||||
|
|
||||||
/* |y| is huge */
|
/* |y| is huge */
|
||||||
if(iy>0x41e00000) { /* if |y| > 2**31 */
|
if(iy>0x41e00000) { /* if |y| > 2**31 */
|
||||||
|
@ -194,7 +194,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
/* over/underflow if x is not close to one */
|
/* over/underflow if x is not close to one */
|
||||||
if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
|
if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
|
||||||
if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
|
if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
|
||||||
/* now |1-x| is tiny <= 2**-20, suffice to compute
|
/* now |1-x| is tiny <= 2**-20, suffice to compute
|
||||||
log(x) by x-x^2/2+x^3/3-x^4/4 */
|
log(x) by x-x^2/2+x^3/3-x^4/4 */
|
||||||
t = x-1; /* t has 20 trailing zeros */
|
t = x-1; /* t has 20 trailing zeros */
|
||||||
w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
|
w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
|
||||||
|
@ -254,7 +254,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
}
|
}
|
||||||
|
|
||||||
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
|
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
|
||||||
if(((((__uint32_t)hx>>31)-1)|(yisint-1))==0)
|
if(((((uint32_t)hx>>31)-1)|(yisint-1))==0)
|
||||||
s = -one;/* (-ve)**(odd int) */
|
s = -one;/* (-ve)**(odd int) */
|
||||||
|
|
||||||
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
|
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
|
||||||
|
@ -291,7 +291,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
||||||
n = ((n&0x000fffff)|0x00100000)>>(20-k);
|
n = ((n&0x000fffff)|0x00100000)>>(20-k);
|
||||||
if(j<0) n = -n;
|
if(j<0) n = -n;
|
||||||
p_h -= t;
|
p_h -= t;
|
||||||
}
|
}
|
||||||
t = p_l+p_h;
|
t = p_l+p_h;
|
||||||
SET_LOW_WORD(t,0);
|
SET_LOW_WORD(t,0);
|
||||||
u = t*lg2_h;
|
u = t*lg2_h;
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* __ieee754_rem_pio2(x,y)
|
/* __ieee754_rem_pio2(x,y)
|
||||||
*
|
*
|
||||||
* return the remainder of x rem pi/2 in y[0]+y[1]
|
* return the remainder of x rem pi/2 in y[0]+y[1]
|
||||||
* use __kernel_rem_pio2()
|
* use __kernel_rem_pio2()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -23,30 +23,30 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
|
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
|
||||||
*/
|
*/
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const __int32_t two_over_pi[] = {
|
static const int32_t two_over_pi[] = {
|
||||||
#else
|
#else
|
||||||
static __int32_t two_over_pi[] = {
|
static int32_t two_over_pi[] = {
|
||||||
#endif
|
#endif
|
||||||
0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
|
0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
|
||||||
0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
|
0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
|
||||||
0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,
|
0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,
|
||||||
0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41,
|
0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41,
|
||||||
0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8,
|
0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8,
|
||||||
0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,
|
0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,
|
||||||
0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
|
0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
|
||||||
0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08,
|
0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08,
|
||||||
0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,
|
0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,
|
||||||
0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880,
|
0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880,
|
||||||
0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
|
0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const __int32_t npio2_hw[] = {
|
static const int32_t npio2_hw[] = {
|
||||||
#else
|
#else
|
||||||
static __int32_t npio2_hw[] = {
|
static int32_t npio2_hw[] = {
|
||||||
#endif
|
#endif
|
||||||
0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
|
0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
|
||||||
0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
|
0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
|
||||||
|
@ -67,9 +67,9 @@ static __int32_t npio2_hw[] = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
|
zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
|
||||||
half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
|
half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
|
||||||
|
@ -83,24 +83,24 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
|
||||||
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
__int32_t __ieee754_rem_pio2(double x, double *y)
|
int32_t __ieee754_rem_pio2(double x, double *y)
|
||||||
#else
|
#else
|
||||||
__int32_t __ieee754_rem_pio2(x,y)
|
int32_t __ieee754_rem_pio2(x,y)
|
||||||
double x,y[];
|
double x,y[];
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double z,w,t,r,fn;
|
double z,w,t,r,fn;
|
||||||
double tx[3];
|
double tx[3];
|
||||||
__int32_t i,j,n,ix,hx;
|
int32_t i,j,n,ix,hx;
|
||||||
int e0,nx;
|
int e0,nx;
|
||||||
__uint32_t low;
|
uint32_t low;
|
||||||
|
|
||||||
GET_HIGH_WORD(hx,x); /* high word of x */
|
GET_HIGH_WORD(hx,x); /* high word of x */
|
||||||
ix = hx&0x7fffffff;
|
ix = hx&0x7fffffff;
|
||||||
if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
|
if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
|
||||||
{y[0] = x; y[1] = 0; return 0;}
|
{y[0] = x; y[1] = 0; return 0;}
|
||||||
if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */
|
if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */
|
||||||
if(hx>0) {
|
if(hx>0) {
|
||||||
z = x - pio2_1;
|
z = x - pio2_1;
|
||||||
if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
|
if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
|
||||||
y[0] = z - pio2_1t;
|
y[0] = z - pio2_1t;
|
||||||
|
@ -126,31 +126,31 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
||||||
}
|
}
|
||||||
if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
|
if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
|
||||||
t = fabs(x);
|
t = fabs(x);
|
||||||
n = (__int32_t) (t*invpio2+half);
|
n = (int32_t) (t*invpio2+half);
|
||||||
fn = (double)n;
|
fn = (double)n;
|
||||||
r = t-fn*pio2_1;
|
r = t-fn*pio2_1;
|
||||||
w = fn*pio2_1t; /* 1st round good to 85 bit */
|
w = fn*pio2_1t; /* 1st round good to 85 bit */
|
||||||
if(n<32&&ix!=npio2_hw[n-1]) {
|
if(n<32&&ix!=npio2_hw[n-1]) {
|
||||||
y[0] = r-w; /* quick check no cancellation */
|
y[0] = r-w; /* quick check no cancellation */
|
||||||
} else {
|
} else {
|
||||||
__uint32_t high;
|
uint32_t high;
|
||||||
j = ix>>20;
|
j = ix>>20;
|
||||||
y[0] = r-w;
|
y[0] = r-w;
|
||||||
GET_HIGH_WORD(high,y[0]);
|
GET_HIGH_WORD(high,y[0]);
|
||||||
i = j-((high>>20)&0x7ff);
|
i = j-((high>>20)&0x7ff);
|
||||||
if(i>16) { /* 2nd iteration needed, good to 118 */
|
if(i>16) { /* 2nd iteration needed, good to 118 */
|
||||||
t = r;
|
t = r;
|
||||||
w = fn*pio2_2;
|
w = fn*pio2_2;
|
||||||
r = t-w;
|
r = t-w;
|
||||||
w = fn*pio2_2t-((t-r)-w);
|
w = fn*pio2_2t-((t-r)-w);
|
||||||
y[0] = r-w;
|
y[0] = r-w;
|
||||||
GET_HIGH_WORD(high,y[0]);
|
GET_HIGH_WORD(high,y[0]);
|
||||||
i = j-((high>>20)&0x7ff);
|
i = j-((high>>20)&0x7ff);
|
||||||
if(i>49) { /* 3rd iteration need, 151 bits acc */
|
if(i>49) { /* 3rd iteration need, 151 bits acc */
|
||||||
t = r; /* will cover all possible cases */
|
t = r; /* will cover all possible cases */
|
||||||
w = fn*pio2_3;
|
w = fn*pio2_3;
|
||||||
r = t-w;
|
r = t-w;
|
||||||
w = fn*pio2_3t-((t-r)-w);
|
w = fn*pio2_3t-((t-r)-w);
|
||||||
y[0] = r-w;
|
y[0] = r-w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
||||||
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
|
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
|
||||||
else return n;
|
else return n;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* all other (large) arguments
|
* all other (large) arguments
|
||||||
*/
|
*/
|
||||||
if(ix>=0x7ff00000) { /* x is inf or NaN */
|
if(ix>=0x7ff00000) { /* x is inf or NaN */
|
||||||
|
@ -169,9 +169,9 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
||||||
GET_LOW_WORD(low,x);
|
GET_LOW_WORD(low,x);
|
||||||
SET_LOW_WORD(z,low);
|
SET_LOW_WORD(z,low);
|
||||||
e0 = (int)((ix>>20)-1046); /* e0 = ilogb(z)-23; */
|
e0 = (int)((ix>>20)-1046); /* e0 = ilogb(z)-23; */
|
||||||
SET_HIGH_WORD(z, ix - ((__int32_t)e0<<20));
|
SET_HIGH_WORD(z, ix - ((int32_t)e0<<20));
|
||||||
for(i=0;i<2;i++) {
|
for(i=0;i<2;i++) {
|
||||||
tx[i] = (double)((__int32_t)(z));
|
tx[i] = (double)((int32_t)(z));
|
||||||
z = (z-tx[i])*two24;
|
z = (z-tx[i])*two24;
|
||||||
}
|
}
|
||||||
tx[2] = z;
|
tx[2] = z;
|
||||||
|
|
|
@ -6,17 +6,17 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* __ieee754_remainder(x,p)
|
/* __ieee754_remainder(x,p)
|
||||||
* Return :
|
* Return :
|
||||||
* returns x REM p = x - [x/p]*p as if in infinite
|
* returns x REM p = x - [x/p]*p as if in infinite
|
||||||
* precise arithmetic, where [x/p] is the (infinite bit)
|
* precise arithmetic, where [x/p] is the (infinite bit)
|
||||||
* integer nearest x/p (in half way case choose the even one).
|
* integer nearest x/p (in half way case choose the even one).
|
||||||
* Method :
|
* Method :
|
||||||
* Based on fmod() return x-[x/p]chopped*p exactlp.
|
* Based on fmod() return x-[x/p]chopped*p exactlp.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ static double zero = 0.0;
|
||||||
double x,p;
|
double x,p;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t hx,hp;
|
int32_t hx,hp;
|
||||||
__uint32_t sx,lx,lp;
|
uint32_t sx,lx,lp;
|
||||||
double p_half;
|
double p_half;
|
||||||
|
|
||||||
EXTRACT_WORDS(hx,lx,x);
|
EXTRACT_WORDS(hx,lx,x);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -16,10 +16,10 @@
|
||||||
* ------------------------------------------
|
* ------------------------------------------
|
||||||
* | Use the hardware sqrt if you have one |
|
* | Use the hardware sqrt if you have one |
|
||||||
* ------------------------------------------
|
* ------------------------------------------
|
||||||
* Method:
|
* Method:
|
||||||
* Bit by bit method using integer arithmetic. (Slow, but portable)
|
* Bit by bit method using integer arithmetic. (Slow, but portable)
|
||||||
* 1. Normalization
|
* 1. Normalization
|
||||||
* Scale x to y in [1,4) with even powers of 2:
|
* Scale x to y in [1,4) with even powers of 2:
|
||||||
* find an integer k such that 1 <= (y=x*2^(2k)) < 4, then
|
* find an integer k such that 1 <= (y=x*2^(2k)) < 4, then
|
||||||
* sqrt(x) = 2^k * sqrt(y)
|
* sqrt(x) = 2^k * sqrt(y)
|
||||||
* 2. Bit by bit computation
|
* 2. Bit by bit computation
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
* i+1 2
|
* i+1 2
|
||||||
* s = 2*q , and y = 2 * ( y - q ). (1)
|
* s = 2*q , and y = 2 * ( y - q ). (1)
|
||||||
* i i i i
|
* i i i i
|
||||||
*
|
*
|
||||||
* To compute q from q , one checks whether
|
* To compute q from q , one checks whether
|
||||||
* i+1 i
|
* i+1 i
|
||||||
*
|
*
|
||||||
* -(i+1) 2
|
* -(i+1) 2
|
||||||
* (q + 2 ) <= y. (2)
|
* (q + 2 ) <= y. (2)
|
||||||
|
@ -40,12 +40,12 @@
|
||||||
* i+1 i i+1 i
|
* i+1 i i+1 i
|
||||||
*
|
*
|
||||||
* With some algebric manipulation, it is not difficult to see
|
* With some algebric manipulation, it is not difficult to see
|
||||||
* that (2) is equivalent to
|
* that (2) is equivalent to
|
||||||
* -(i+1)
|
* -(i+1)
|
||||||
* s + 2 <= y (3)
|
* s + 2 <= y (3)
|
||||||
* i i
|
* i i
|
||||||
*
|
*
|
||||||
* The advantage of (3) is that s and y can be computed by
|
* The advantage of (3) is that s and y can be computed by
|
||||||
* i i
|
* i i
|
||||||
* the following recurrence formula:
|
* the following recurrence formula:
|
||||||
* if (3) is false
|
* if (3) is false
|
||||||
|
@ -57,10 +57,10 @@
|
||||||
* -i -(i+1)
|
* -i -(i+1)
|
||||||
* s = s + 2 , y = y - s - 2 (5)
|
* s = s + 2 , y = y - s - 2 (5)
|
||||||
* i+1 i i+1 i i
|
* i+1 i i+1 i i
|
||||||
*
|
*
|
||||||
* One may easily use induction to prove (4) and (5).
|
* One may easily use induction to prove (4) and (5).
|
||||||
* Note. Since the left hand side of (3) contain only i+2 bits,
|
* Note. Since the left hand side of (3) contain only i+2 bits,
|
||||||
* it does not necessary to do a full (53-bit) comparison
|
* it does not necessary to do a full (53-bit) comparison
|
||||||
* in (3).
|
* in (3).
|
||||||
* 3. Final rounding
|
* 3. Final rounding
|
||||||
* After generating the 53 bits result, we compute one more bit.
|
* After generating the 53 bits result, we compute one more bit.
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
* The rounding mode can be detected by checking whether
|
* The rounding mode can be detected by checking whether
|
||||||
* huge + tiny is equal to huge, and whether huge - tiny is
|
* huge + tiny is equal to huge, and whether huge - tiny is
|
||||||
* equal to huge for some floating point number "huge" and "tiny".
|
* equal to huge for some floating point number "huge" and "tiny".
|
||||||
*
|
*
|
||||||
* Special cases:
|
* Special cases:
|
||||||
* sqrt(+-0) = +-0 ... exact
|
* sqrt(+-0) = +-0 ... exact
|
||||||
* sqrt(inf) = inf
|
* sqrt(inf) = inf
|
||||||
|
@ -99,17 +99,17 @@ static double one = 1.0, tiny=1.0e-300;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double z;
|
double z;
|
||||||
__int32_t sign = (int)0x80000000;
|
int32_t sign = (int)0x80000000;
|
||||||
__uint32_t r,t1,s1,ix1,q1;
|
uint32_t r,t1,s1,ix1,q1;
|
||||||
__int32_t ix0,s0,q,m,t,i;
|
int32_t ix0,s0,q,m,t,i;
|
||||||
|
|
||||||
EXTRACT_WORDS(ix0,ix1,x);
|
EXTRACT_WORDS(ix0,ix1,x);
|
||||||
|
|
||||||
/* take care of Inf and NaN */
|
/* take care of Inf and NaN */
|
||||||
if((ix0&0x7ff00000)==0x7ff00000) {
|
if((ix0&0x7ff00000)==0x7ff00000) {
|
||||||
return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
|
return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
|
||||||
sqrt(-inf)=sNaN */
|
sqrt(-inf)=sNaN */
|
||||||
}
|
}
|
||||||
/* take care of zero */
|
/* take care of zero */
|
||||||
if(ix0<=0) {
|
if(ix0<=0) {
|
||||||
if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */
|
if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */
|
||||||
|
@ -143,12 +143,12 @@ static double one = 1.0, tiny=1.0e-300;
|
||||||
r = 0x00200000; /* r = moving bit from right to left */
|
r = 0x00200000; /* r = moving bit from right to left */
|
||||||
|
|
||||||
while(r!=0) {
|
while(r!=0) {
|
||||||
t = s0+r;
|
t = s0+r;
|
||||||
if(t<=ix0) {
|
if(t<=ix0) {
|
||||||
s0 = t+r;
|
s0 = t+r;
|
||||||
ix0 -= t;
|
ix0 -= t;
|
||||||
q += r;
|
q += r;
|
||||||
}
|
}
|
||||||
ix0 += ix0 + ((ix1&sign)>>31);
|
ix0 += ix0 + ((ix1&sign)>>31);
|
||||||
ix1 += ix1;
|
ix1 += ix1;
|
||||||
r>>=1;
|
r>>=1;
|
||||||
|
@ -156,11 +156,11 @@ static double one = 1.0, tiny=1.0e-300;
|
||||||
|
|
||||||
r = sign;
|
r = sign;
|
||||||
while(r!=0) {
|
while(r!=0) {
|
||||||
t1 = s1+r;
|
t1 = s1+r;
|
||||||
t = s0;
|
t = s0;
|
||||||
if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
|
if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
|
||||||
s1 = t1+r;
|
s1 = t1+r;
|
||||||
if(((t1&sign)==(__uint32_t)sign)&&(s1&sign)==0) s0 += 1;
|
if(((t1&sign)==(uint32_t)sign)&&(s1&sign)==0) s0 += 1;
|
||||||
ix0 -= t;
|
ix0 -= t;
|
||||||
if (ix1 < t1) ix0 -= 1;
|
if (ix1 < t1) ix0 -= 1;
|
||||||
ix1 -= t1;
|
ix1 -= t1;
|
||||||
|
@ -176,10 +176,10 @@ static double one = 1.0, tiny=1.0e-300;
|
||||||
z = one-tiny; /* trigger inexact flag */
|
z = one-tiny; /* trigger inexact flag */
|
||||||
if (z>=one) {
|
if (z>=one) {
|
||||||
z = one+tiny;
|
z = one+tiny;
|
||||||
if (q1==(__uint32_t)0xffffffff) { q1=0; q += 1;}
|
if (q1==(uint32_t)0xffffffff) { q1=0; q += 1;}
|
||||||
else if (z>one) {
|
else if (z>one) {
|
||||||
if (q1==(__uint32_t)0xfffffffe) q+=1;
|
if (q1==(uint32_t)0xfffffffe) q+=1;
|
||||||
q1+=2;
|
q1+=2;
|
||||||
} else
|
} else
|
||||||
q1 += (q1&1);
|
q1 += (q1&1);
|
||||||
}
|
}
|
||||||
|
@ -191,24 +191,24 @@ static double one = 1.0, tiny=1.0e-300;
|
||||||
INSERT_WORDS(z,ix0,ix1);
|
INSERT_WORDS(z,ix0,ix1);
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(_DOUBLE_IS_32BITS) */
|
#endif /* defined(_DOUBLE_IS_32BITS) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Other methods (use floating-point arithmetic)
|
Other methods (use floating-point arithmetic)
|
||||||
-------------
|
-------------
|
||||||
(This is a copy of a drafted paper by Prof W. Kahan
|
(This is a copy of a drafted paper by Prof W. Kahan
|
||||||
and K.C. Ng, written in May, 1986)
|
and K.C. Ng, written in May, 1986)
|
||||||
|
|
||||||
Two algorithms are given here to implement sqrt(x)
|
Two algorithms are given here to implement sqrt(x)
|
||||||
(IEEE double precision arithmetic) in software.
|
(IEEE double precision arithmetic) in software.
|
||||||
Both supply sqrt(x) correctly rounded. The first algorithm (in
|
Both supply sqrt(x) correctly rounded. The first algorithm (in
|
||||||
Section A) uses newton iterations and involves four divisions.
|
Section A) uses newton iterations and involves four divisions.
|
||||||
The second one uses reciproot iterations to avoid division, but
|
The second one uses reciproot iterations to avoid division, but
|
||||||
requires more multiplications. Both algorithms need the ability
|
requires more multiplications. Both algorithms need the ability
|
||||||
to chop results of arithmetic operations instead of round them,
|
to chop results of arithmetic operations instead of round them,
|
||||||
and the INEXACT flag to indicate when an arithmetic operation
|
and the INEXACT flag to indicate when an arithmetic operation
|
||||||
is executed exactly with no roundoff error, all part of the
|
is executed exactly with no roundoff error, all part of the
|
||||||
standard (IEEE 754-1985). The ability to perform shift, add,
|
standard (IEEE 754-1985). The ability to perform shift, add,
|
||||||
subtract and logical AND operations upon 32-bit words is needed
|
subtract and logical AND operations upon 32-bit words is needed
|
||||||
too, though not part of the standard.
|
too, though not part of the standard.
|
||||||
|
@ -218,7 +218,7 @@ A. sqrt(x) by Newton Iteration
|
||||||
(1) Initial approximation
|
(1) Initial approximation
|
||||||
|
|
||||||
Let x0 and x1 be the leading and the trailing 32-bit words of
|
Let x0 and x1 be the leading and the trailing 32-bit words of
|
||||||
a floating point number x (in IEEE double format) respectively
|
a floating point number x (in IEEE double format) respectively
|
||||||
|
|
||||||
1 11 52 ...widths
|
1 11 52 ...widths
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
@ -226,7 +226,7 @@ A. sqrt(x) by Newton Iteration
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
msb lsb msb lsb ...order
|
msb lsb msb lsb ...order
|
||||||
|
|
||||||
|
|
||||||
------------------------ ------------------------
|
------------------------ ------------------------
|
||||||
x0: |s| e | f1 | x1: | f2 |
|
x0: |s| e | f1 | x1: | f2 |
|
||||||
------------------------ ------------------------
|
------------------------ ------------------------
|
||||||
|
@ -251,7 +251,7 @@ A. sqrt(x) by Newton Iteration
|
||||||
|
|
||||||
(2) Iterative refinement
|
(2) Iterative refinement
|
||||||
|
|
||||||
Apply Heron's rule three times to y, we have y approximates
|
Apply Heron's rule three times to y, we have y approximates
|
||||||
sqrt(x) to within 1 ulp (Unit in the Last Place):
|
sqrt(x) to within 1 ulp (Unit in the Last Place):
|
||||||
|
|
||||||
y := (y+x/y)/2 ... almost 17 sig. bits
|
y := (y+x/y)/2 ... almost 17 sig. bits
|
||||||
|
@ -276,12 +276,12 @@ A. sqrt(x) by Newton Iteration
|
||||||
it requires more multiplications and additions. Also x must be
|
it requires more multiplications and additions. Also x must be
|
||||||
scaled in advance to avoid spurious overflow in evaluating the
|
scaled in advance to avoid spurious overflow in evaluating the
|
||||||
expression 3y*y+x. Hence it is not recommended uless division
|
expression 3y*y+x. Hence it is not recommended uless division
|
||||||
is slow. If division is very slow, then one should use the
|
is slow. If division is very slow, then one should use the
|
||||||
reciproot algorithm given in section B.
|
reciproot algorithm given in section B.
|
||||||
|
|
||||||
(3) Final adjustment
|
(3) Final adjustment
|
||||||
|
|
||||||
By twiddling y's last bit it is possible to force y to be
|
By twiddling y's last bit it is possible to force y to be
|
||||||
correctly rounded according to the prevailing rounding mode
|
correctly rounded according to the prevailing rounding mode
|
||||||
as follows. Let r and i be copies of the rounding mode and
|
as follows. Let r and i be copies of the rounding mode and
|
||||||
inexact flag before entering the square root program. Also we
|
inexact flag before entering the square root program. Also we
|
||||||
|
@ -312,7 +312,7 @@ A. sqrt(x) by Newton Iteration
|
||||||
I := i; ... restore inexact flag
|
I := i; ... restore inexact flag
|
||||||
R := r; ... restore rounded mode
|
R := r; ... restore rounded mode
|
||||||
return sqrt(x):=y.
|
return sqrt(x):=y.
|
||||||
|
|
||||||
(4) Special cases
|
(4) Special cases
|
||||||
|
|
||||||
Square root of +inf, +-0, or NaN is itself;
|
Square root of +inf, +-0, or NaN is itself;
|
||||||
|
@ -331,7 +331,7 @@ B. sqrt(x) by Reciproot Iteration
|
||||||
k := 0x5fe80000 - (x0>>1);
|
k := 0x5fe80000 - (x0>>1);
|
||||||
y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits
|
y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits
|
||||||
|
|
||||||
Here k is a 32-bit integer and T2[] is an integer array
|
Here k is a 32-bit integer and T2[] is an integer array
|
||||||
containing correction terms. Now magically the floating
|
containing correction terms. Now magically the floating
|
||||||
value of y (y's leading 32-bit word is y0, the value of
|
value of y (y's leading 32-bit word is y0, the value of
|
||||||
its trailing word y1 is set to zero) approximates 1/sqrt(x)
|
its trailing word y1 is set to zero) approximates 1/sqrt(x)
|
||||||
|
@ -352,9 +352,9 @@ B. sqrt(x) by Reciproot Iteration
|
||||||
|
|
||||||
Apply Reciproot iteration three times to y and multiply the
|
Apply Reciproot iteration three times to y and multiply the
|
||||||
result by x to get an approximation z that matches sqrt(x)
|
result by x to get an approximation z that matches sqrt(x)
|
||||||
to about 1 ulp. To be exact, we will have
|
to about 1 ulp. To be exact, we will have
|
||||||
-1ulp < sqrt(x)-z<1.0625ulp.
|
-1ulp < sqrt(x)-z<1.0625ulp.
|
||||||
|
|
||||||
... set rounding mode to Round-to-nearest
|
... set rounding mode to Round-to-nearest
|
||||||
y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x)
|
y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x)
|
||||||
y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x)
|
y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x)
|
||||||
|
@ -363,14 +363,14 @@ B. sqrt(x) by Reciproot Iteration
|
||||||
z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x)
|
z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x)
|
||||||
|
|
||||||
Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that
|
Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that
|
||||||
(a) the term z*y in the final iteration is always less than 1;
|
(a) the term z*y in the final iteration is always less than 1;
|
||||||
(b) the error in the final result is biased upward so that
|
(b) the error in the final result is biased upward so that
|
||||||
-1 ulp < sqrt(x) - z < 1.0625 ulp
|
-1 ulp < sqrt(x) - z < 1.0625 ulp
|
||||||
instead of |sqrt(x)-z|<1.03125ulp.
|
instead of |sqrt(x)-z|<1.03125ulp.
|
||||||
|
|
||||||
(3) Final adjustment
|
(3) Final adjustment
|
||||||
|
|
||||||
By twiddling y's last bit it is possible to force y to be
|
By twiddling y's last bit it is possible to force y to be
|
||||||
correctly rounded according to the prevailing rounding mode
|
correctly rounded according to the prevailing rounding mode
|
||||||
as follows. Let r and i be copies of the rounding mode and
|
as follows. Let r and i be copies of the rounding mode and
|
||||||
inexact flag before entering the square root program. Also we
|
inexact flag before entering the square root program. Also we
|
||||||
|
@ -410,27 +410,27 @@ B. sqrt(x) by Reciproot Iteration
|
||||||
I := 1; ... Raise Inexact flag: z is not exact
|
I := 1; ... Raise Inexact flag: z is not exact
|
||||||
else {
|
else {
|
||||||
j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2
|
j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2
|
||||||
k := z1 >> 26; ... get z's 25-th and 26-th
|
k := z1 >> 26; ... get z's 25-th and 26-th
|
||||||
fraction bits
|
fraction bits
|
||||||
I := i or (k&j) or ((k&(j+j+1))!=(x1&3));
|
I := i or (k&j) or ((k&(j+j+1))!=(x1&3));
|
||||||
}
|
}
|
||||||
R:= r ... restore rounded mode
|
R:= r ... restore rounded mode
|
||||||
return sqrt(x):=z.
|
return sqrt(x):=z.
|
||||||
|
|
||||||
If multiplication is cheaper then the foregoing red tape, the
|
If multiplication is cheaper then the foregoing red tape, the
|
||||||
Inexact flag can be evaluated by
|
Inexact flag can be evaluated by
|
||||||
|
|
||||||
I := i;
|
I := i;
|
||||||
I := (z*z!=x) or I.
|
I := (z*z!=x) or I.
|
||||||
|
|
||||||
Note that z*z can overwrite I; this value must be sensed if it is
|
Note that z*z can overwrite I; this value must be sensed if it is
|
||||||
True.
|
True.
|
||||||
|
|
||||||
Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be
|
Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be
|
||||||
zero.
|
zero.
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
z1: | f2 |
|
z1: | f2 |
|
||||||
--------------------
|
--------------------
|
||||||
bit 31 bit 0
|
bit 31 bit 0
|
||||||
|
|
||||||
|
@ -447,6 +447,6 @@ B. sqrt(x) by Reciproot Iteration
|
||||||
11 01 even
|
11 01 even
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
(4) Special cases (see (4) of Section A).
|
(4) Special cases (see (4) of Section A).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
* __kernel_cos( x, y )
|
* __kernel_cos( x, y )
|
||||||
* kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
|
* kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
|
||||||
* Input x is assumed to be bounded by ~pi/4 in magnitude.
|
* Input x is assumed to be bounded by ~pi/4 in magnitude.
|
||||||
* Input y is the tail of x.
|
* Input y is the tail of x.
|
||||||
*
|
*
|
||||||
* Algorithm
|
* Algorithm
|
||||||
* 1. Since cos(-x) = cos(x), we need only to consider positive x.
|
* 1. Since cos(-x) = cos(x), we need only to consider positive x.
|
||||||
|
@ -25,15 +25,15 @@
|
||||||
* 4 14
|
* 4 14
|
||||||
* cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x
|
* cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x
|
||||||
* where the remez error is
|
* where the remez error is
|
||||||
*
|
*
|
||||||
* | 2 4 6 8 10 12 14 | -58
|
* | 2 4 6 8 10 12 14 | -58
|
||||||
* |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2
|
* |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2
|
||||||
* | |
|
* | |
|
||||||
*
|
*
|
||||||
* 4 6 8 10 12 14
|
* 4 6 8 10 12 14
|
||||||
* 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then
|
* 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then
|
||||||
* cos(x) = 1 - x*x/2 + r
|
* cos(x) = 1 - x*x/2 + r
|
||||||
* since cos(x+y) ~ cos(x) - sin(x)*y
|
* since cos(x+y) ~ cos(x) - sin(x)*y
|
||||||
* ~ cos(x) - x*y,
|
* ~ cos(x) - x*y,
|
||||||
* a correction term is necessary in cos(x) and hence
|
* a correction term is necessary in cos(x) and hence
|
||||||
* cos(x+y) = 1 - (x*x/2 - (r - x*y))
|
* cos(x+y) = 1 - (x*x/2 - (r - x*y))
|
||||||
|
@ -51,9 +51,9 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
|
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
|
||||||
C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */
|
C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */
|
||||||
|
@ -71,7 +71,7 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double a,hz,z,r,qx;
|
double a,hz,z,r,qx;
|
||||||
__int32_t ix;
|
int32_t ix;
|
||||||
GET_HIGH_WORD(ix,x);
|
GET_HIGH_WORD(ix,x);
|
||||||
ix &= 0x7fffffff; /* ix = |x|'s high word*/
|
ix &= 0x7fffffff; /* ix = |x|'s high word*/
|
||||||
if(ix<0x3e400000) { /* if x < 2**27 */
|
if(ix<0x3e400000) { /* if x < 2**27 */
|
||||||
|
@ -79,7 +79,7 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
|
||||||
}
|
}
|
||||||
z = x*x;
|
z = x*x;
|
||||||
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
|
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
|
||||||
if(ix < 0x3FD33333) /* if |x| < 0.3 */
|
if(ix < 0x3FD33333) /* if |x| < 0.3 */
|
||||||
return one - (0.5*z - (z*r - x*y));
|
return one - (0.5*z - (z*r - x*y));
|
||||||
else {
|
else {
|
||||||
if(ix > 0x3fe90000) { /* x > 0.78125 */
|
if(ix > 0x3fe90000) { /* x > 0.78125 */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -14,12 +14,12 @@
|
||||||
/*
|
/*
|
||||||
* __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
|
* __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
|
||||||
* double x[],y[]; int e0,nx,prec; int ipio2[];
|
* double x[],y[]; int e0,nx,prec; int ipio2[];
|
||||||
*
|
*
|
||||||
* __kernel_rem_pio2 return the last three digits of N with
|
* __kernel_rem_pio2 return the last three digits of N with
|
||||||
* y = x - N*pi/2
|
* y = x - N*pi/2
|
||||||
* so that |y| < pi/2.
|
* so that |y| < pi/2.
|
||||||
*
|
*
|
||||||
* The method is to compute the integer (mod 8) and fraction parts of
|
* The method is to compute the integer (mod 8) and fraction parts of
|
||||||
* (2/pi)*x without doing the full multiplication. In general we
|
* (2/pi)*x without doing the full multiplication. In general we
|
||||||
* skip the part of the product that are known to be a huge integer (
|
* skip the part of the product that are known to be a huge integer (
|
||||||
* more accurately, = 0 mod 8 ). Thus the number of operations are
|
* more accurately, = 0 mod 8 ). Thus the number of operations are
|
||||||
|
@ -28,10 +28,10 @@
|
||||||
* (2/pi) is represented by an array of 24-bit integers in ipio2[].
|
* (2/pi) is represented by an array of 24-bit integers in ipio2[].
|
||||||
*
|
*
|
||||||
* Input parameters:
|
* Input parameters:
|
||||||
* x[] The input value (must be positive) is broken into nx
|
* x[] The input value (must be positive) is broken into nx
|
||||||
* pieces of 24-bit integers in double precision format.
|
* pieces of 24-bit integers in double precision format.
|
||||||
* x[i] will be the i-th 24 bit of x. The scaled exponent
|
* x[i] will be the i-th 24 bit of x. The scaled exponent
|
||||||
* of x[0] is given in input parameter e0 (i.e., x[0]*2^e0
|
* of x[0] is given in input parameter e0 (i.e., x[0]*2^e0
|
||||||
* match x's up to 24 bits.
|
* match x's up to 24 bits.
|
||||||
*
|
*
|
||||||
* Example of breaking a double positive z into x[0]+x[1]+x[2]:
|
* Example of breaking a double positive z into x[0]+x[1]+x[2]:
|
||||||
|
@ -68,8 +68,8 @@
|
||||||
* 3 113 bits (quad)
|
* 3 113 bits (quad)
|
||||||
*
|
*
|
||||||
* ipio2[]
|
* ipio2[]
|
||||||
* integer array, contains the (24*i)-th to (24*i+23)-th
|
* integer array, contains the (24*i)-th to (24*i+23)-th
|
||||||
* bit of 2/pi after binary point. The corresponding
|
* bit of 2/pi after binary point. The corresponding
|
||||||
* floating value is
|
* floating value is
|
||||||
*
|
*
|
||||||
* ipio2[i] * 2^(-24(i+1)).
|
* ipio2[i] * 2^(-24(i+1)).
|
||||||
|
@ -84,8 +84,8 @@
|
||||||
* in the computation. The recommended value is 2,3,4,
|
* in the computation. The recommended value is 2,3,4,
|
||||||
* 6 for single, double, extended,and quad.
|
* 6 for single, double, extended,and quad.
|
||||||
*
|
*
|
||||||
* jz local integer variable indicating the number of
|
* jz local integer variable indicating the number of
|
||||||
* terms of ipio2[] used.
|
* terms of ipio2[] used.
|
||||||
*
|
*
|
||||||
* jx nx - 1
|
* jx nx - 1
|
||||||
*
|
*
|
||||||
|
@ -105,9 +105,9 @@
|
||||||
* exponent for q[i] would be q0-24*i.
|
* exponent for q[i] would be q0-24*i.
|
||||||
*
|
*
|
||||||
* PIo2[] double precision array, obtained by cutting pi/2
|
* PIo2[] double precision array, obtained by cutting pi/2
|
||||||
* into 24 bits chunks.
|
* into 24 bits chunks.
|
||||||
*
|
*
|
||||||
* f[] ipio2[] in floating point
|
* f[] ipio2[] in floating point
|
||||||
*
|
*
|
||||||
* iq[] integer array by breaking up q[] in 24-bits chunk.
|
* iq[] integer array by breaking up q[] in 24-bits chunk.
|
||||||
*
|
*
|
||||||
|
@ -121,9 +121,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants:
|
* Constants:
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const int init_jk[] = {2,3,4,6}; /* initial value for jk */
|
static const int init_jk[] = {2,3,4,6}; /* initial value for jk */
|
||||||
#else
|
#else
|
||||||
static int init_jk[] = {2,3,4,6};
|
static int init_jk[] = {2,3,4,6};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
|
@ -153,9 +153,9 @@ static double PIo2[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
zero = 0.0,
|
zero = 0.0,
|
||||||
one = 1.0,
|
one = 1.0,
|
||||||
|
@ -163,13 +163,13 @@ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
|
||||||
twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
|
twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const __int32_t *ipio2)
|
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
|
||||||
#else
|
#else
|
||||||
int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
|
int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
|
||||||
double x[], y[]; int e0,nx,prec; __int32_t ipio2[];
|
double x[], y[]; int e0,nx,prec; int32_t ipio2[];
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
|
int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
|
||||||
double z,fw,f[20],fq[20],q[20];
|
double z,fw,f[20],fq[20],q[20];
|
||||||
|
|
||||||
/* initialize jk*/
|
/* initialize jk*/
|
||||||
|
@ -194,22 +194,22 @@ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
|
||||||
recompute:
|
recompute:
|
||||||
/* distill q[] into iq[] reversingly */
|
/* distill q[] into iq[] reversingly */
|
||||||
for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
|
for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
|
||||||
fw = (double)((__int32_t)(twon24* z));
|
fw = (double)((int32_t)(twon24* z));
|
||||||
iq[i] = (__int32_t)(z-two24*fw);
|
iq[i] = (int32_t)(z-two24*fw);
|
||||||
z = q[j-1]+fw;
|
z = q[j-1]+fw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute n */
|
/* compute n */
|
||||||
z = scalbn(z,(int)q0); /* actual value of z */
|
z = scalbn(z,(int)q0); /* actual value of z */
|
||||||
z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */
|
z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */
|
||||||
n = (__int32_t) z;
|
n = (int32_t) z;
|
||||||
z -= (double)n;
|
z -= (double)n;
|
||||||
ih = 0;
|
ih = 0;
|
||||||
if(q0>0) { /* need iq[jz-1] to determine n */
|
if(q0>0) { /* need iq[jz-1] to determine n */
|
||||||
i = (iq[jz-1]>>(24-q0)); n += i;
|
i = (iq[jz-1]>>(24-q0)); n += i;
|
||||||
iq[jz-1] -= i<<(24-q0);
|
iq[jz-1] -= i<<(24-q0);
|
||||||
ih = iq[jz-1]>>(23-q0);
|
ih = iq[jz-1]>>(23-q0);
|
||||||
}
|
}
|
||||||
else if(q0==0) ih = iq[jz-1]>>23;
|
else if(q0==0) ih = iq[jz-1]>>23;
|
||||||
else if(z>=0.5) ih=2;
|
else if(z>=0.5) ih=2;
|
||||||
|
|
||||||
|
@ -260,12 +260,12 @@ recompute:
|
||||||
while(iq[jz]==0) { jz--; q0-=24;}
|
while(iq[jz]==0) { jz--; q0-=24;}
|
||||||
} else { /* break z into 24-bit if necessary */
|
} else { /* break z into 24-bit if necessary */
|
||||||
z = scalbn(z,-(int)q0);
|
z = scalbn(z,-(int)q0);
|
||||||
if(z>=two24) {
|
if(z>=two24) {
|
||||||
fw = (double)((__int32_t)(twon24*z));
|
fw = (double)((int32_t)(twon24*z));
|
||||||
iq[jz] = (__int32_t)(z-two24*fw);
|
iq[jz] = (int32_t)(z-two24*fw);
|
||||||
jz += 1; q0 += 24;
|
jz += 1; q0 += 24;
|
||||||
iq[jz] = (__int32_t) fw;
|
iq[jz] = (int32_t) fw;
|
||||||
} else iq[jz] = (__int32_t) z ;
|
} else iq[jz] = (int32_t) z ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert integer "bit" chunk to floating-point value */
|
/* convert integer "bit" chunk to floating-point value */
|
||||||
|
@ -285,29 +285,29 @@ recompute:
|
||||||
case 0:
|
case 0:
|
||||||
fw = 0.0;
|
fw = 0.0;
|
||||||
for (i=jz;i>=0;i--) fw += fq[i];
|
for (i=jz;i>=0;i--) fw += fq[i];
|
||||||
y[0] = (ih==0)? fw: -fw;
|
y[0] = (ih==0)? fw: -fw;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
fw = 0.0;
|
fw = 0.0;
|
||||||
for (i=jz;i>=0;i--) fw += fq[i];
|
for (i=jz;i>=0;i--) fw += fq[i];
|
||||||
y[0] = (ih==0)? fw: -fw;
|
y[0] = (ih==0)? fw: -fw;
|
||||||
fw = fq[0]-fw;
|
fw = fq[0]-fw;
|
||||||
for (i=1;i<=jz;i++) fw += fq[i];
|
for (i=1;i<=jz;i++) fw += fq[i];
|
||||||
y[1] = (ih==0)? fw: -fw;
|
y[1] = (ih==0)? fw: -fw;
|
||||||
break;
|
break;
|
||||||
case 3: /* painful */
|
case 3: /* painful */
|
||||||
for (i=jz;i>0;i--) {
|
for (i=jz;i>0;i--) {
|
||||||
fw = fq[i-1]+fq[i];
|
fw = fq[i-1]+fq[i];
|
||||||
fq[i] += fq[i-1]-fw;
|
fq[i] += fq[i-1]-fw;
|
||||||
fq[i-1] = fw;
|
fq[i-1] = fw;
|
||||||
}
|
}
|
||||||
for (i=jz;i>1;i--) {
|
for (i=jz;i>1;i--) {
|
||||||
fw = fq[i-1]+fq[i];
|
fw = fq[i-1]+fq[i];
|
||||||
fq[i] += fq[i-1]-fw;
|
fq[i] += fq[i-1]-fw;
|
||||||
fq[i-1] = fw;
|
fq[i-1] = fw;
|
||||||
}
|
}
|
||||||
for (fw=0.0,i=jz;i>=2;i--) fw += fq[i];
|
for (fw=0.0,i=jz;i>=2;i--) fw += fq[i];
|
||||||
if(ih==0) {
|
if(ih==0) {
|
||||||
y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
|
y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -15,24 +15,24 @@
|
||||||
* kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854
|
* kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854
|
||||||
* Input x is assumed to be bounded by ~pi/4 in magnitude.
|
* Input x is assumed to be bounded by ~pi/4 in magnitude.
|
||||||
* Input y is the tail of x.
|
* Input y is the tail of x.
|
||||||
* Input iy indicates whether y is 0. (if iy=0, y assume to be 0).
|
* Input iy indicates whether y is 0. (if iy=0, y assume to be 0).
|
||||||
*
|
*
|
||||||
* Algorithm
|
* Algorithm
|
||||||
* 1. Since sin(-x) = -sin(x), we need only to consider positive x.
|
* 1. Since sin(-x) = -sin(x), we need only to consider positive x.
|
||||||
* 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0.
|
* 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0.
|
||||||
* 3. sin(x) is approximated by a polynomial of degree 13 on
|
* 3. sin(x) is approximated by a polynomial of degree 13 on
|
||||||
* [0,pi/4]
|
* [0,pi/4]
|
||||||
* 3 13
|
* 3 13
|
||||||
* sin(x) ~ x + S1*x + ... + S6*x
|
* sin(x) ~ x + S1*x + ... + S6*x
|
||||||
* where
|
* where
|
||||||
*
|
*
|
||||||
* |sin(x) 2 4 6 8 10 12 | -58
|
* |sin(x) 2 4 6 8 10 12 | -58
|
||||||
* |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2
|
* |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2
|
||||||
* | x |
|
* | x |
|
||||||
*
|
*
|
||||||
* 4. sin(x+y) = sin(x) + sin'(x')*y
|
* 4. sin(x+y) = sin(x) + sin'(x')*y
|
||||||
* ~ sin(x) + (1-x*x/2)*y
|
* ~ sin(x) + (1-x*x/2)*y
|
||||||
* For better accuracy, let
|
* For better accuracy, let
|
||||||
* 3 2 2 2 2
|
* 3 2 2 2 2
|
||||||
* r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))
|
* r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))
|
||||||
* then 3 2
|
* then 3 2
|
||||||
|
@ -44,9 +44,9 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
|
half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
|
||||||
S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */
|
S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */
|
||||||
|
@ -64,7 +64,7 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double z,r,v;
|
double z,r,v;
|
||||||
__int32_t ix;
|
int32_t ix;
|
||||||
GET_HIGH_WORD(ix,x);
|
GET_HIGH_WORD(ix,x);
|
||||||
ix &= 0x7fffffff; /* high word of x */
|
ix &= 0x7fffffff; /* high word of x */
|
||||||
if(ix<0x3e400000) /* |x| < 2**-27 */
|
if(ix<0x3e400000) /* |x| < 2**-27 */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -15,25 +15,25 @@
|
||||||
* kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
|
* kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
|
||||||
* Input x is assumed to be bounded by ~pi/4 in magnitude.
|
* Input x is assumed to be bounded by ~pi/4 in magnitude.
|
||||||
* Input y is the tail of x.
|
* Input y is the tail of x.
|
||||||
* Input k indicates whether tan (if k=1) or
|
* Input k indicates whether tan (if k=1) or
|
||||||
* -1/tan (if k= -1) is returned.
|
* -1/tan (if k= -1) is returned.
|
||||||
*
|
*
|
||||||
* Algorithm
|
* Algorithm
|
||||||
* 1. Since tan(-x) = -tan(x), we need only to consider positive x.
|
* 1. Since tan(-x) = -tan(x), we need only to consider positive x.
|
||||||
* 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0.
|
* 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0.
|
||||||
* 3. tan(x) is approximated by a odd polynomial of degree 27 on
|
* 3. tan(x) is approximated by a odd polynomial of degree 27 on
|
||||||
* [0,0.67434]
|
* [0,0.67434]
|
||||||
* 3 27
|
* 3 27
|
||||||
* tan(x) ~ x + T1*x + ... + T13*x
|
* tan(x) ~ x + T1*x + ... + T13*x
|
||||||
* where
|
* where
|
||||||
*
|
*
|
||||||
* |tan(x) 2 4 26 | -59.2
|
* |tan(x) 2 4 26 | -59.2
|
||||||
* |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2
|
* |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2
|
||||||
* | x |
|
* | x |
|
||||||
*
|
*
|
||||||
* Note: tan(x+y) = tan(x) + tan'(x)*y
|
* Note: tan(x+y) = tan(x) + tan'(x)*y
|
||||||
* ~ tan(x) + (1+x*x)*y
|
* ~ tan(x) + (1+x*x)*y
|
||||||
* Therefore, for better accuracy in computing tan(x+y), let
|
* Therefore, for better accuracy in computing tan(x+y), let
|
||||||
* 3 2 2 2 2
|
* 3 2 2 2 2
|
||||||
* r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))
|
* r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))
|
||||||
* then
|
* then
|
||||||
|
@ -50,9 +50,9 @@
|
||||||
#ifndef _DOUBLE_IS_32BITS
|
#ifndef _DOUBLE_IS_32BITS
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
|
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
|
||||||
pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */
|
pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */
|
||||||
|
@ -81,12 +81,12 @@ T[] = {
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double z,r,v,w,s;
|
double z,r,v,w,s;
|
||||||
__int32_t ix,hx;
|
int32_t ix,hx;
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
ix = hx&0x7fffffff; /* high word of |x| */
|
ix = hx&0x7fffffff; /* high word of |x| */
|
||||||
if(ix<0x3e300000) /* x < 2**-28 */
|
if(ix<0x3e300000) /* x < 2**-28 */
|
||||||
{if((int)x==0) { /* generate inexact */
|
{if((int)x==0) { /* generate inexact */
|
||||||
__uint32_t low;
|
uint32_t low;
|
||||||
GET_LOW_WORD(low,x);
|
GET_LOW_WORD(low,x);
|
||||||
if(((ix|low)|(iy+1))==0) return one/fabs(x);
|
if(((ix|low)|(iy+1))==0) return one/fabs(x);
|
||||||
else return (iy==1)? x: -one/x;
|
else return (iy==1)? x: -one/x;
|
||||||
|
@ -115,7 +115,7 @@ T[] = {
|
||||||
return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r)));
|
return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r)));
|
||||||
}
|
}
|
||||||
if(iy==1) return w;
|
if(iy==1) return w;
|
||||||
else { /* if allow error up to 2 ulp,
|
else { /* if allow error up to 2 ulp,
|
||||||
simply return -1.0/(x+r) here */
|
simply return -1.0/(x+r) here */
|
||||||
/* compute -1.0/(x+r) accurately */
|
/* compute -1.0/(x+r) accurately */
|
||||||
double a,t;
|
double a,t;
|
||||||
|
|
|
@ -37,13 +37,35 @@ extern "C" {
|
||||||
// #include <float.h>
|
// #include <float.h>
|
||||||
// #include <errno.h>
|
// #include <errno.h>
|
||||||
|
|
||||||
/* These typedefs are true for the targets running Java. */
|
#if defined HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
#ifndef HAVE_INT32_DEFINED
|
#elif defined HAVE_INTTYPES_H
|
||||||
typedef int __int32_t;
|
#include <inttypes.h>
|
||||||
typedef unsigned int __uint32_t;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined HAVE_SYS_CONFIG_H
|
||||||
|
#include <sys/config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ISO C9X int type declarations */
|
||||||
|
|
||||||
|
#if !defined HAVE_INT32_DEFINED && defined HAVE_BSD_INT32_DEFINED
|
||||||
|
typedef u_int32_t uint32_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined HAVE_BSD_INT32_DEFINED && !defined HAVE_INT32_DEFINED
|
||||||
|
// FIXME -- this could have problems with systems that don't define SI to be 4
|
||||||
|
typedef int int32_t __attribute__((mode(SI)));
|
||||||
|
typedef unsigned int uint32_t __attribute__((mode(SI)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These typedefs are true for the targets running Java. */
|
||||||
|
|
||||||
#ifdef __IEEE_LITTLE_ENDIAN
|
#ifdef __IEEE_LITTLE_ENDIAN
|
||||||
#define IEEE_8087
|
#define IEEE_8087
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +85,7 @@ typedef unsigned int __uint32_t;
|
||||||
|
|
||||||
|
|
||||||
#ifdef Unsigned_Shifts
|
#ifdef Unsigned_Shifts
|
||||||
#define Sign_Extend(a,b) if (b < 0) a |= (__uint32_t)0xffff0000;
|
#define Sign_Extend(a,b) if (b < 0) a |= (uint32_t)0xffff0000;
|
||||||
#else
|
#else
|
||||||
#define Sign_Extend(a,b) /*no-op*/
|
#define Sign_Extend(a,b) /*no-op*/
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,8 +101,7 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
|
||||||
union double_union
|
union double_union
|
||||||
{
|
{
|
||||||
double d;
|
double d;
|
||||||
// FIXME: This should be some well-defined 32 bit type.
|
uint32_t i[2];
|
||||||
__uint32_t i[2];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef IEEE_8087
|
#ifdef IEEE_8087
|
||||||
|
@ -110,37 +131,37 @@ union double_union
|
||||||
/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
|
/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
|
||||||
|
|
||||||
#if defined(IEEE_8087) + defined(IEEE_MC68k)
|
#if defined(IEEE_8087) + defined(IEEE_MC68k)
|
||||||
#if defined (_DOUBLE_IS_32BITS)
|
#if defined (_DOUBLE_IS_32BITS)
|
||||||
#define Exp_shift 23
|
#define Exp_shift 23
|
||||||
#define Exp_shift1 23
|
#define Exp_shift1 23
|
||||||
#define Exp_msk1 ((__uint32_t)0x00800000L)
|
#define Exp_msk1 ((uint32_t)0x00800000L)
|
||||||
#define Exp_msk11 ((__uint32_t)0x00800000L)
|
#define Exp_msk11 ((uint32_t)0x00800000L)
|
||||||
#define Exp_mask ((__uint32_t)0x7f800000L)
|
#define Exp_mask ((uint32_t)0x7f800000L)
|
||||||
#define P 24
|
#define P 24
|
||||||
#define Bias 127
|
#define Bias 127
|
||||||
#if 0
|
#if 0
|
||||||
#define IEEE_Arith /* it is, but the code doesn't handle IEEE singles yet */
|
#define IEEE_Arith /* it is, but the code doesn't handle IEEE singles yet */
|
||||||
#endif
|
#endif
|
||||||
#define Emin (-126)
|
#define Emin (-126)
|
||||||
#define Exp_1 ((__uint32_t)0x3f800000L)
|
#define Exp_1 ((uint32_t)0x3f800000L)
|
||||||
#define Exp_11 ((__uint32_t)0x3f800000L)
|
#define Exp_11 ((uint32_t)0x3f800000L)
|
||||||
#define Ebits 8
|
#define Ebits 8
|
||||||
#define Frac_mask ((__uint32_t)0x007fffffL)
|
#define Frac_mask ((uint32_t)0x007fffffL)
|
||||||
#define Frac_mask1 ((__uint32_t)0x007fffffL)
|
#define Frac_mask1 ((uint32_t)0x007fffffL)
|
||||||
#define Ten_pmax 10
|
#define Ten_pmax 10
|
||||||
#define Sign_bit ((__uint32_t)0x80000000L)
|
#define Sign_bit ((uint32_t)0x80000000L)
|
||||||
#define Ten_pmax 10
|
#define Ten_pmax 10
|
||||||
#define Bletch 2
|
#define Bletch 2
|
||||||
#define Bndry_mask ((__uint32_t)0x007fffffL)
|
#define Bndry_mask ((uint32_t)0x007fffffL)
|
||||||
#define Bndry_mask1 ((__uint32_t)0x007fffffL)
|
#define Bndry_mask1 ((uint32_t)0x007fffffL)
|
||||||
#define LSB 1
|
#define LSB 1
|
||||||
#define Sign_bit ((__uint32_t)0x80000000L)
|
#define Sign_bit ((uint32_t)0x80000000L)
|
||||||
#define Log2P 1
|
#define Log2P 1
|
||||||
#define Tiny0 0
|
#define Tiny0 0
|
||||||
#define Tiny1 1
|
#define Tiny1 1
|
||||||
#define Quick_max 5
|
#define Quick_max 5
|
||||||
#define Int_max 6
|
#define Int_max 6
|
||||||
#define Infinite(x) (word0(x) == ((__uint32_t)0x7f800000L))
|
#define Infinite(x) (word0(x) == ((uint32_t)0x7f800000L))
|
||||||
#undef word0
|
#undef word0
|
||||||
#undef word1
|
#undef word1
|
||||||
|
|
||||||
|
@ -150,30 +171,30 @@ union double_union
|
||||||
|
|
||||||
#define Exp_shift 20
|
#define Exp_shift 20
|
||||||
#define Exp_shift1 20
|
#define Exp_shift1 20
|
||||||
#define Exp_msk1 ((__uint32_t)0x100000L)
|
#define Exp_msk1 ((uint32_t)0x100000L)
|
||||||
#define Exp_msk11 ((__uint32_t)0x100000L)
|
#define Exp_msk11 ((uint32_t)0x100000L)
|
||||||
#define Exp_mask ((__uint32_t)0x7ff00000L)
|
#define Exp_mask ((uint32_t)0x7ff00000L)
|
||||||
#define P 53
|
#define P 53
|
||||||
#define Bias 1023
|
#define Bias 1023
|
||||||
#define IEEE_Arith
|
#define IEEE_Arith
|
||||||
#define Emin (-1022)
|
#define Emin (-1022)
|
||||||
#define Exp_1 ((__uint32_t)0x3ff00000L)
|
#define Exp_1 ((uint32_t)0x3ff00000L)
|
||||||
#define Exp_11 ((__uint32_t)0x3ff00000L)
|
#define Exp_11 ((uint32_t)0x3ff00000L)
|
||||||
#define Ebits 11
|
#define Ebits 11
|
||||||
#define Frac_mask ((__uint32_t)0xfffffL)
|
#define Frac_mask ((uint32_t)0xfffffL)
|
||||||
#define Frac_mask1 ((__uint32_t)0xfffffL)
|
#define Frac_mask1 ((uint32_t)0xfffffL)
|
||||||
#define Ten_pmax 22
|
#define Ten_pmax 22
|
||||||
#define Bletch 0x10
|
#define Bletch 0x10
|
||||||
#define Bndry_mask ((__uint32_t)0xfffffL)
|
#define Bndry_mask ((uint32_t)0xfffffL)
|
||||||
#define Bndry_mask1 ((__uint32_t)0xfffffL)
|
#define Bndry_mask1 ((uint32_t)0xfffffL)
|
||||||
#define LSB 1
|
#define LSB 1
|
||||||
#define Sign_bit ((__uint32_t)0x80000000L)
|
#define Sign_bit ((uint32_t)0x80000000L)
|
||||||
#define Log2P 1
|
#define Log2P 1
|
||||||
#define Tiny0 0
|
#define Tiny0 0
|
||||||
#define Tiny1 1
|
#define Tiny1 1
|
||||||
#define Quick_max 14
|
#define Quick_max 14
|
||||||
#define Int_max 14
|
#define Int_max 14
|
||||||
#define Infinite(x) (word0(x) == ((__uint32_t)0x7ff00000L)) /* sufficient test for here */
|
#define Infinite(x) (word0(x) == ((uint32_t)0x7ff00000L)) /* sufficient test for here */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -182,24 +203,24 @@ union double_union
|
||||||
#ifdef IBM
|
#ifdef IBM
|
||||||
#define Exp_shift 24
|
#define Exp_shift 24
|
||||||
#define Exp_shift1 24
|
#define Exp_shift1 24
|
||||||
#define Exp_msk1 ((__uint32_t)0x1000000L)
|
#define Exp_msk1 ((uint32_t)0x1000000L)
|
||||||
#define Exp_msk11 ((__uint32_t)0x1000000L)
|
#define Exp_msk11 ((uint32_t)0x1000000L)
|
||||||
#define Exp_mask ((__uint32_t)0x7f000000L)
|
#define Exp_mask ((uint32_t)0x7f000000L)
|
||||||
#define P 14
|
#define P 14
|
||||||
#define Bias 65
|
#define Bias 65
|
||||||
#define Exp_1 ((__uint32_t)0x41000000L)
|
#define Exp_1 ((uint32_t)0x41000000L)
|
||||||
#define Exp_11 ((__uint32_t)0x41000000L)
|
#define Exp_11 ((uint32_t)0x41000000L)
|
||||||
#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */
|
#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */
|
||||||
#define Frac_mask ((__uint32_t)0xffffffL)
|
#define Frac_mask ((uint32_t)0xffffffL)
|
||||||
#define Frac_mask1 ((__uint32_t)0xffffffL)
|
#define Frac_mask1 ((uint32_t)0xffffffL)
|
||||||
#define Bletch 4
|
#define Bletch 4
|
||||||
#define Ten_pmax 22
|
#define Ten_pmax 22
|
||||||
#define Bndry_mask ((__uint32_t)0xefffffL)
|
#define Bndry_mask ((uint32_t)0xefffffL)
|
||||||
#define Bndry_mask1 ((__uint32_t)0xffffffL)
|
#define Bndry_mask1 ((uint32_t)0xffffffL)
|
||||||
#define LSB 1
|
#define LSB 1
|
||||||
#define Sign_bit ((__uint32_t)0x80000000L)
|
#define Sign_bit ((uint32_t)0x80000000L)
|
||||||
#define Log2P 4
|
#define Log2P 4
|
||||||
#define Tiny0 ((__uint32_t)0x100000L)
|
#define Tiny0 ((uint32_t)0x100000L)
|
||||||
#define Tiny1 0
|
#define Tiny1 0
|
||||||
#define Quick_max 14
|
#define Quick_max 14
|
||||||
#define Int_max 15
|
#define Int_max 15
|
||||||
|
@ -207,21 +228,21 @@ union double_union
|
||||||
#define Exp_shift 23
|
#define Exp_shift 23
|
||||||
#define Exp_shift1 7
|
#define Exp_shift1 7
|
||||||
#define Exp_msk1 0x80
|
#define Exp_msk1 0x80
|
||||||
#define Exp_msk11 ((__uint32_t)0x800000L)
|
#define Exp_msk11 ((uint32_t)0x800000L)
|
||||||
#define Exp_mask ((__uint32_t)0x7f80L)
|
#define Exp_mask ((uint32_t)0x7f80L)
|
||||||
#define P 56
|
#define P 56
|
||||||
#define Bias 129
|
#define Bias 129
|
||||||
#define Exp_1 ((__uint32_t)0x40800000L)
|
#define Exp_1 ((uint32_t)0x40800000L)
|
||||||
#define Exp_11 ((__uint32_t)0x4080L)
|
#define Exp_11 ((uint32_t)0x4080L)
|
||||||
#define Ebits 8
|
#define Ebits 8
|
||||||
#define Frac_mask ((__uint32_t)0x7fffffL)
|
#define Frac_mask ((uint32_t)0x7fffffL)
|
||||||
#define Frac_mask1 ((__uint32_t)0xffff007fL)
|
#define Frac_mask1 ((uint32_t)0xffff007fL)
|
||||||
#define Ten_pmax 24
|
#define Ten_pmax 24
|
||||||
#define Bletch 2
|
#define Bletch 2
|
||||||
#define Bndry_mask ((__uint32_t)0xffff007fL)
|
#define Bndry_mask ((uint32_t)0xffff007fL)
|
||||||
#define Bndry_mask1 ((__uint32_t)0xffff007fL)
|
#define Bndry_mask1 ((uint32_t)0xffff007fL)
|
||||||
#define LSB ((__uint32_t)0x10000L)
|
#define LSB ((uint32_t)0x10000L)
|
||||||
#define Sign_bit ((__uint32_t)0x8000L)
|
#define Sign_bit ((uint32_t)0x8000L)
|
||||||
#define Log2P 1
|
#define Log2P 1
|
||||||
#define Tiny0 0x80
|
#define Tiny0 0x80
|
||||||
#define Tiny1 0
|
#define Tiny1 0
|
||||||
|
@ -248,7 +269,7 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
|
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
|
||||||
#define Big1 ((__uint32_t)0xffffffffL)
|
#define Big1 ((uint32_t)0xffffffffL)
|
||||||
|
|
||||||
#ifndef Just_16
|
#ifndef Just_16
|
||||||
/* When Pack_32 is not defined, we store 16 bits per 32-bit long.
|
/* When Pack_32 is not defined, we store 16 bits per 32-bit long.
|
||||||
|
@ -266,7 +287,7 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
|
||||||
#define MAX_BIGNUMS 16
|
#define MAX_BIGNUMS 16
|
||||||
#define MAX_BIGNUM_WDS 32
|
#define MAX_BIGNUM_WDS 32
|
||||||
|
|
||||||
struct _Jv_Bigint
|
struct _Jv_Bigint
|
||||||
{
|
{
|
||||||
struct _Jv_Bigint *_next;
|
struct _Jv_Bigint *_next;
|
||||||
int _k, _maxwds, _sign, _wds;
|
int _k, _maxwds, _sign, _wds;
|
||||||
|
@ -333,10 +354,10 @@ typedef struct _Jv_Bigint _Jv_Bigint;
|
||||||
#define _strtod_r _Jv_strtod_r
|
#define _strtod_r _Jv_strtod_r
|
||||||
|
|
||||||
extern double _EXFUN(_strtod_r, (struct _Jv_reent *ptr, const char *s00, char **se));
|
extern double _EXFUN(_strtod_r, (struct _Jv_reent *ptr, const char *s00, char **se));
|
||||||
extern char* _EXFUN(_dtoa_r, (struct _Jv_reent *ptr, double d,
|
extern char* _EXFUN(_dtoa_r, (struct _Jv_reent *ptr, double d,
|
||||||
int mode, int ndigits, int *decpt, int *sign,
|
int mode, int ndigits, int *decpt, int *sign,
|
||||||
char **rve, int float_type));
|
char **rve, int float_type));
|
||||||
void _EXFUN(_dtoa, (double d, int mode, int ndigits, int *decpt, int *sign,
|
void _EXFUN(_dtoa, (double d, int mode, int ndigits, int *decpt, int *sign,
|
||||||
char **rve, char *buf, int float_type));
|
char **rve, char *buf, int float_type));
|
||||||
|
|
||||||
double _EXFUN(ulp,(double x));
|
double _EXFUN(ulp,(double x));
|
||||||
|
@ -371,4 +392,3 @@ extern _CONST double tens[];
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*
|
*
|
||||||
|
@ -67,9 +67,9 @@ PORTABILITY
|
||||||
* [39/16,INF] atan(x) = atan(INF) + atan( -1/t )
|
* [39/16,INF] atan(x) = atan(INF) + atan( -1/t )
|
||||||
*
|
*
|
||||||
* Constants:
|
* Constants:
|
||||||
* The hexadecimal values are the intended ones for the following
|
* The hexadecimal values are the intended ones for the following
|
||||||
* constants. The decimal values may be used, provided that the
|
* constants. The decimal values may be used, provided that the
|
||||||
* compiler will convert from decimal to binary accurately enough
|
* compiler will convert from decimal to binary accurately enough
|
||||||
* to produce the hexadecimal values shown.
|
* to produce the hexadecimal values shown.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -118,9 +118,9 @@ static double aT[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
one = 1.0,
|
one = 1.0,
|
||||||
huge = 1.0e300;
|
huge = 1.0e300;
|
||||||
|
@ -133,12 +133,12 @@ huge = 1.0e300;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double w,s1,s2,z;
|
double w,s1,s2,z;
|
||||||
__int32_t ix,hx,id;
|
int32_t ix,hx,id;
|
||||||
|
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
ix = hx&0x7fffffff;
|
ix = hx&0x7fffffff;
|
||||||
if(ix>=0x44100000) { /* if |x| >= 2^66 */
|
if(ix>=0x44100000) { /* if |x| >= 2^66 */
|
||||||
__uint32_t low;
|
uint32_t low;
|
||||||
GET_LOW_WORD(low,x);
|
GET_LOW_WORD(low,x);
|
||||||
if(ix>0x7ff00000||
|
if(ix>0x7ff00000||
|
||||||
(ix==0x7ff00000&&(low!=0)))
|
(ix==0x7ff00000&&(low!=0)))
|
||||||
|
@ -154,9 +154,9 @@ huge = 1.0e300;
|
||||||
x = fabs(x);
|
x = fabs(x);
|
||||||
if (ix < 0x3ff30000) { /* |x| < 1.1875 */
|
if (ix < 0x3ff30000) { /* |x| < 1.1875 */
|
||||||
if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */
|
if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */
|
||||||
id = 0; x = (2.0*x-one)/(2.0+x);
|
id = 0; x = (2.0*x-one)/(2.0+x);
|
||||||
} else { /* 11/16<=|x|< 19/16 */
|
} else { /* 11/16<=|x|< 19/16 */
|
||||||
id = 1; x = (x-one)/(x+one);
|
id = 1; x = (x-one)/(x+one);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ix < 0x40038000) { /* |x| < 2.4375 */
|
if (ix < 0x40038000) { /* |x| < 2.4375 */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -37,14 +37,14 @@ static double huge = 1.0e300;
|
||||||
double x;
|
double x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t i0,i1,j0;
|
int32_t i0,i1,j0;
|
||||||
__uint32_t i,j;
|
uint32_t i,j;
|
||||||
EXTRACT_WORDS(i0,i1,x);
|
EXTRACT_WORDS(i0,i1,x);
|
||||||
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
||||||
if(j0<20) {
|
if(j0<20) {
|
||||||
if(j0<0) { /* raise inexact if x != 0 */
|
if(j0<0) { /* raise inexact if x != 0 */
|
||||||
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
||||||
if(i0<0) {i0=0x80000000;i1=0;}
|
if(i0<0) {i0=0x80000000;i1=0;}
|
||||||
else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;}
|
else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,14 +59,14 @@ static double huge = 1.0e300;
|
||||||
if(j0==0x400) return x+x; /* inf or NaN */
|
if(j0==0x400) return x+x; /* inf or NaN */
|
||||||
else return x; /* x is integral */
|
else return x; /* x is integral */
|
||||||
} else {
|
} else {
|
||||||
i = ((__uint32_t)(0xffffffff))>>(j0-20);
|
i = ((uint32_t)(0xffffffff))>>(j0-20);
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
if((i1&i)==0) return x; /* x is integral */
|
||||||
if(huge+x>0.0) { /* raise inexact flag */
|
if(huge+x>0.0) { /* raise inexact flag */
|
||||||
if(i0>0) {
|
if(i0>0) {
|
||||||
if(j0==20) i0+=1;
|
if(j0==20) i0+=1;
|
||||||
else {
|
else {
|
||||||
j = i1 + (1<<(52-j0));
|
j = i1 + (1<<(52-j0));
|
||||||
if(j<(__uint32_t)i1) i0+=1; /* got a carry */
|
if(j<(uint32_t)i1) i0+=1; /* got a carry */
|
||||||
i1 = j;
|
i1 = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -72,7 +72,7 @@ Definition (Issue 2).
|
||||||
double x,y;
|
double x,y;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__uint32_t hx,hy;
|
uint32_t hx,hy;
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
GET_HIGH_WORD(hy,y);
|
GET_HIGH_WORD(hy,y);
|
||||||
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
|
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
* __ieee754_rem_pio2 ... argument reduction routine
|
* __ieee754_rem_pio2 ... argument reduction routine
|
||||||
*
|
*
|
||||||
* Method.
|
* Method.
|
||||||
* Let S,C and T denote the sin, cos and tan respectively on
|
* Let S,C and T denote the sin, cos and tan respectively on
|
||||||
* [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
|
* [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
|
||||||
* in [-pi/4 , +pi/4], and let n = k mod 4.
|
* in [-pi/4 , +pi/4], and let n = k mod 4.
|
||||||
* We have
|
* We have
|
||||||
*
|
*
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
* trig(NaN) is that NaN;
|
* trig(NaN) is that NaN;
|
||||||
*
|
*
|
||||||
* Accuracy:
|
* Accuracy:
|
||||||
* TRIG(x) returns trig(x) nearly rounded
|
* TRIG(x) returns trig(x) nearly rounded
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fdlibm.h"
|
#include "fdlibm.h"
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double y[2],z=0.0;
|
double y[2],z=0.0;
|
||||||
__int32_t n,ix;
|
int32_t n,ix;
|
||||||
|
|
||||||
/* High word of x. */
|
/* High word of x. */
|
||||||
GET_HIGH_WORD(ix,x);
|
GET_HIGH_WORD(ix,x);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -26,16 +26,16 @@ ANSI_SYNOPSIS
|
||||||
|
|
||||||
TRAD_SYNOPSIS
|
TRAD_SYNOPSIS
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
double fabs(<[x]>)
|
double fabs(<[x]>)
|
||||||
double <[x]>;
|
double <[x]>;
|
||||||
|
|
||||||
float fabsf(<[x]>)
|
float fabsf(<[x]>)
|
||||||
float <[x]>;
|
float <[x]>;
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
<<fabs>> and <<fabsf>> calculate
|
<<fabs>> and <<fabsf>> calculate
|
||||||
@tex
|
@tex
|
||||||
$|x|$,
|
$|x|$,
|
||||||
@end tex
|
@end tex
|
||||||
the absolute value (magnitude) of the argument <[x]>, by direct
|
the absolute value (magnitude) of the argument <[x]>, by direct
|
||||||
manipulation of the bit representation of <[x]>.
|
manipulation of the bit representation of <[x]>.
|
||||||
|
@ -64,7 +64,7 @@ PORTABILITY
|
||||||
double x;
|
double x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__uint32_t high;
|
uint32_t high;
|
||||||
GET_HIGH_WORD(high,x);
|
GET_HIGH_WORD(high,x);
|
||||||
SET_HIGH_WORD(x,high&0x7fffffff);
|
SET_HIGH_WORD(x,high&0x7fffffff);
|
||||||
return x;
|
return x;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -34,20 +34,20 @@ TRAD_SYNOPSIS
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
double floor(<[x]>)
|
double floor(<[x]>)
|
||||||
double <[x]>;
|
double <[x]>;
|
||||||
float floorf(<[x]>)
|
float floorf(<[x]>)
|
||||||
float <[x]>;
|
float <[x]>;
|
||||||
double ceil(<[x]>)
|
double ceil(<[x]>)
|
||||||
double <[x]>;
|
double <[x]>;
|
||||||
float ceilf(<[x]>)
|
float ceilf(<[x]>)
|
||||||
float <[x]>;
|
float <[x]>;
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
<<floor>> and <<floorf>> find
|
<<floor>> and <<floorf>> find
|
||||||
@tex
|
@tex
|
||||||
$\lfloor x \rfloor$,
|
$\lfloor x \rfloor$,
|
||||||
@end tex
|
@end tex
|
||||||
the nearest integer less than or equal to <[x]>.
|
the nearest integer less than or equal to <[x]>.
|
||||||
<<ceil>> and <<ceilf>> find
|
<<ceil>> and <<ceilf>> find
|
||||||
@tex
|
@tex
|
||||||
$\lceil x\rceil$,
|
$\lceil x\rceil$,
|
||||||
@end tex
|
@end tex
|
||||||
|
@ -90,14 +90,14 @@ static double huge = 1.0e300;
|
||||||
double x;
|
double x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t i0,i1,j0;
|
int32_t i0,i1,j0;
|
||||||
__uint32_t i,j;
|
uint32_t i,j;
|
||||||
EXTRACT_WORDS(i0,i1,x);
|
EXTRACT_WORDS(i0,i1,x);
|
||||||
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
||||||
if(j0<20) {
|
if(j0<20) {
|
||||||
if(j0<0) { /* raise inexact if x != 0 */
|
if(j0<0) { /* raise inexact if x != 0 */
|
||||||
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
||||||
if(i0>=0) {i0=i1=0;}
|
if(i0>=0) {i0=i1=0;}
|
||||||
else if(((i0&0x7fffffff)|i1)!=0)
|
else if(((i0&0x7fffffff)|i1)!=0)
|
||||||
{ i0=0xbff00000;i1=0;}
|
{ i0=0xbff00000;i1=0;}
|
||||||
}
|
}
|
||||||
|
@ -113,14 +113,14 @@ static double huge = 1.0e300;
|
||||||
if(j0==0x400) return x+x; /* inf or NaN */
|
if(j0==0x400) return x+x; /* inf or NaN */
|
||||||
else return x; /* x is integral */
|
else return x; /* x is integral */
|
||||||
} else {
|
} else {
|
||||||
i = ((__uint32_t)(0xffffffff))>>(j0-20);
|
i = ((uint32_t)(0xffffffff))>>(j0-20);
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
if((i1&i)==0) return x; /* x is integral */
|
||||||
if(huge+x>0.0) { /* raise inexact flag */
|
if(huge+x>0.0) { /* raise inexact flag */
|
||||||
if(i0<0) {
|
if(i0<0) {
|
||||||
if(j0==20) i0+=1;
|
if(j0==20) i0+=1;
|
||||||
else {
|
else {
|
||||||
j = i1+(1<<(52-j0));
|
j = i1+(1<<(52-j0));
|
||||||
if(j<(__uint32_t)i1) i0 +=1 ; /* got a carry */
|
if(j<(uint32_t)i1) i0 +=1 ; /* got a carry */
|
||||||
i1=j;
|
i1=j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const double
|
static const double
|
||||||
#else
|
#else
|
||||||
static double
|
static double
|
||||||
#endif
|
#endif
|
||||||
TWO52[2]={
|
TWO52[2]={
|
||||||
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
|
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
|
||||||
|
@ -42,15 +42,15 @@ TWO52[2]={
|
||||||
double x;
|
double x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t i0,j0,sx;
|
int32_t i0,j0,sx;
|
||||||
__uint32_t i,i1;
|
uint32_t i,i1;
|
||||||
double t;
|
double t;
|
||||||
volatile double w;
|
volatile double w;
|
||||||
EXTRACT_WORDS(i0,i1,x);
|
EXTRACT_WORDS(i0,i1,x);
|
||||||
sx = (i0>>31)&1;
|
sx = (i0>>31)&1;
|
||||||
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
||||||
if(j0<20) {
|
if(j0<20) {
|
||||||
if(j0<0) {
|
if(j0<0) {
|
||||||
if(((i0&0x7fffffff)|i1)==0) return x;
|
if(((i0&0x7fffffff)|i1)==0) return x;
|
||||||
i1 |= (i0&0x0fffff);
|
i1 |= (i0&0x0fffff);
|
||||||
i0 &= 0xfffe0000;
|
i0 &= 0xfffe0000;
|
||||||
|
@ -74,7 +74,7 @@ TWO52[2]={
|
||||||
if(j0==0x400) return x+x; /* inf or NaN */
|
if(j0==0x400) return x+x; /* inf or NaN */
|
||||||
else return x; /* x is integral */
|
else return x; /* x is integral */
|
||||||
} else {
|
} else {
|
||||||
i = ((__uint32_t)(0xffffffff))>>(j0-20);
|
i = ((uint32_t)(0xffffffff))>>(j0-20);
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
if((i1&i)==0) return x; /* x is integral */
|
||||||
i>>=1;
|
i>>=1;
|
||||||
if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
|
if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -48,10 +48,10 @@ Interface Definition (Issue 2).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scalbn (double x, int n)
|
* scalbn (double x, int n)
|
||||||
* scalbn(x,n) returns x* 2**n computed by exponent
|
* scalbn(x,n) returns x* 2**n computed by exponent
|
||||||
* manipulation rather than by actually performing an
|
* manipulation rather than by actually performing an
|
||||||
* exponentiation or a multiplication.
|
* exponentiation or a multiplication.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -76,18 +76,18 @@ tiny = 1.0e-300;
|
||||||
double x; int n;
|
double x; int n;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t k,hx,lx;
|
int32_t k,hx,lx;
|
||||||
EXTRACT_WORDS(hx,lx,x);
|
EXTRACT_WORDS(hx,lx,x);
|
||||||
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
||||||
if (k==0) { /* 0 or subnormal x */
|
if (k==0) { /* 0 or subnormal x */
|
||||||
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
||||||
x *= two54;
|
x *= two54;
|
||||||
GET_HIGH_WORD(hx,x);
|
GET_HIGH_WORD(hx,x);
|
||||||
k = ((hx&0x7ff00000)>>20) - 54;
|
k = ((hx&0x7ff00000)>>20) - 54;
|
||||||
if (n< -50000) return tiny*x; /*underflow*/
|
if (n< -50000) return tiny*x; /*underflow*/
|
||||||
}
|
}
|
||||||
if (k==0x7ff) return x+x; /* NaN or Inf */
|
if (k==0x7ff) return x+x; /* NaN or Inf */
|
||||||
k = k+n;
|
k = k+n;
|
||||||
if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */
|
if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */
|
||||||
if (k > 0) /* normal result */
|
if (k > 0) /* normal result */
|
||||||
{SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
|
{SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -43,17 +43,17 @@ TRAD_SYNOPSIS
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
<<sin>> and <<cos>> compute (respectively) the sine and cosine
|
<<sin>> and <<cos>> compute (respectively) the sine and cosine
|
||||||
of the argument <[x]>. Angles are specified in radians.
|
of the argument <[x]>. Angles are specified in radians.
|
||||||
|
|
||||||
<<sinf>> and <<cosf>> are identical, save that they take and
|
<<sinf>> and <<cosf>> are identical, save that they take and
|
||||||
return <<float>> values.
|
return <<float>> values.
|
||||||
|
|
||||||
|
|
||||||
RETURNS
|
RETURNS
|
||||||
The sine or cosine of <[x]> is returned.
|
The sine or cosine of <[x]> is returned.
|
||||||
|
|
||||||
PORTABILITY
|
PORTABILITY
|
||||||
<<sin>> and <<cos>> are ANSI C.
|
<<sin>> and <<cos>> are ANSI C.
|
||||||
<<sinf>> and <<cosf>> are extensions.
|
<<sinf>> and <<cosf>> are extensions.
|
||||||
|
|
||||||
QUICKREF
|
QUICKREF
|
||||||
|
@ -70,8 +70,8 @@ QUICKREF
|
||||||
* __ieee754_rem_pio2 ... argument reduction routine
|
* __ieee754_rem_pio2 ... argument reduction routine
|
||||||
*
|
*
|
||||||
* Method.
|
* Method.
|
||||||
* Let S,C and T denote the sin, cos and tan respectively on
|
* Let S,C and T denote the sin, cos and tan respectively on
|
||||||
* [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
|
* [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
|
||||||
* in [-pi/4 , +pi/4], and let n = k mod 4.
|
* in [-pi/4 , +pi/4], and let n = k mod 4.
|
||||||
* We have
|
* We have
|
||||||
*
|
*
|
||||||
|
@ -89,7 +89,7 @@ QUICKREF
|
||||||
* trig(NaN) is that NaN;
|
* trig(NaN) is that NaN;
|
||||||
*
|
*
|
||||||
* Accuracy:
|
* Accuracy:
|
||||||
* TRIG(x) returns trig(x) nearly rounded
|
* TRIG(x) returns trig(x) nearly rounded
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fdlibm.h"
|
#include "fdlibm.h"
|
||||||
|
@ -104,7 +104,7 @@ QUICKREF
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double y[2],z=0.0;
|
double y[2],z=0.0;
|
||||||
__int32_t n,ix;
|
int32_t n,ix;
|
||||||
|
|
||||||
/* High word of x. */
|
/* High word of x. */
|
||||||
GET_HIGH_WORD(ix,x);
|
GET_HIGH_WORD(ix,x);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -37,13 +37,13 @@ TRAD_SYNOPSIS
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
<<tan>> computes the tangent of the argument <[x]>.
|
<<tan>> computes the tangent of the argument <[x]>.
|
||||||
Angles are specified in radians.
|
Angles are specified in radians.
|
||||||
|
|
||||||
<<tanf>> is identical, save that it takes and returns <<float>> values.
|
<<tanf>> is identical, save that it takes and returns <<float>> values.
|
||||||
|
|
||||||
RETURNS
|
RETURNS
|
||||||
The tangent of <[x]> is returned.
|
The tangent of <[x]> is returned.
|
||||||
|
|
||||||
PORTABILITY
|
PORTABILITY
|
||||||
<<tan>> is ANSI. <<tanf>> is an extension.
|
<<tan>> is ANSI. <<tanf>> is an extension.
|
||||||
|
@ -57,8 +57,8 @@ PORTABILITY
|
||||||
* __ieee754_rem_pio2 ... argument reduction routine
|
* __ieee754_rem_pio2 ... argument reduction routine
|
||||||
*
|
*
|
||||||
* Method.
|
* Method.
|
||||||
* Let S,C and T denote the sin, cos and tan respectively on
|
* Let S,C and T denote the sin, cos and tan respectively on
|
||||||
* [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
|
* [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
|
||||||
* in [-pi/4 , +pi/4], and let n = k mod 4.
|
* in [-pi/4 , +pi/4], and let n = k mod 4.
|
||||||
* We have
|
* We have
|
||||||
*
|
*
|
||||||
|
@ -76,7 +76,7 @@ PORTABILITY
|
||||||
* trig(NaN) is that NaN;
|
* trig(NaN) is that NaN;
|
||||||
*
|
*
|
||||||
* Accuracy:
|
* Accuracy:
|
||||||
* TRIG(x) returns trig(x) nearly rounded
|
* TRIG(x) returns trig(x) nearly rounded
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fdlibm.h"
|
#include "fdlibm.h"
|
||||||
|
@ -91,7 +91,7 @@ PORTABILITY
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
double y[2],z=0.0;
|
double y[2],z=0.0;
|
||||||
__int32_t n,ix;
|
int32_t n,ix;
|
||||||
|
|
||||||
/* High word of x. */
|
/* High word of x. */
|
||||||
GET_HIGH_WORD(ix,x);
|
GET_HIGH_WORD(ix,x);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
static const float
|
static const float
|
||||||
#else
|
#else
|
||||||
static float
|
static float
|
||||||
#endif
|
#endif
|
||||||
TWO23[2]={
|
TWO23[2]={
|
||||||
8.3886080000e+06, /* 0x4b000000 */
|
8.3886080000e+06, /* 0x4b000000 */
|
||||||
|
@ -32,14 +32,14 @@ TWO23[2]={
|
||||||
float x;
|
float x;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__int32_t i0,j0,sx;
|
int32_t i0,j0,sx;
|
||||||
__uint32_t i,i1;
|
uint32_t i,i1;
|
||||||
float w,t;
|
float w,t;
|
||||||
GET_FLOAT_WORD(i0,x);
|
GET_FLOAT_WORD(i0,x);
|
||||||
sx = (i0>>31)&1;
|
sx = (i0>>31)&1;
|
||||||
j0 = ((i0>>23)&0xff)-0x7f;
|
j0 = ((i0>>23)&0xff)-0x7f;
|
||||||
if(j0<23) {
|
if(j0<23) {
|
||||||
if(j0<0) {
|
if(j0<0) {
|
||||||
if((i0&0x7fffffff)==0) return x;
|
if((i0&0x7fffffff)==0) return x;
|
||||||
i1 = (i0&0x07fffff);
|
i1 = (i0&0x07fffff);
|
||||||
i0 &= 0xfff00000;
|
i0 &= 0xfff00000;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue