re PR fortran/32049 (Support on x86_64 also kind=16)

/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * Makefile.def: Add libquadmath; build it with language=fortran.
        * configure.ac: Add libquadmath.
        * Makefile.tpl: Handle multiple libs in check-[+language+].
        * Makefile.in: Regenerate.
        * configure: Regenerate.

libquadmath/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        Initial implementation and checkin.

gcc/fortran/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * gfortranspec.c (find_spec_file): New function.
        (lang_specific_driver): Try to find .spec file and use it.
        * trans-io.c (iocall): Define
        * IOCALL_X_REAL128/COMPLEX128(,write).
        (gfc_build_io_library_fndecls): Build decl for __float128 I/O.
        (transfer_expr): Call __float128 I/O functions.
        * trans-types.c (gfc_init_kinds): Allow kind-16 belonging
        to __float128.

gcc/testsuite/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * gfortran.dg/quad_1.f90: New.
        * lib/gcc-defs.exp (gcc-set-multilib-library-path): Use also
        compiler arguments.
        * lib/gfortran.exp (gfortran_link_flags): Add libquadmath to
        library search path; call gcc-set-multilib-library-path with
        arguments such that libgfortran.spec is found.
        (gfortran_init): Add path for libgfortran.spec to
GFORTRAN_UNDER_TEST.

libgomp/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * configure.ac: 
        * configure: Regenerate.

libgfortran/
2010-11-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/32049
        * Makefile.am: Add missing pow_r16_i4.c, add transfer128.c,
        link libquadmath, if used.
        * acinclude.m4 (LIBGFOR_CHECK_FLOAT128): Add.
        * configure.ac: Use it, touch spec file.
        * gfortran.map: Add pow_r16_i4 and
        transfer_(real,complex)128(,write) functions.
        * intrinsics/cshift0.c (cshift0): Handle __float128 type.
        * intrinsics/erfc_scaled_inc.c: Ditto.
        * intrinsics/pack_generic.c (pack): Ditto
        * intrinsics/spread_generic.c (spread): Ditto.
        * intrinsics/unpack_generic.c (unpack1): Ditto.
        * io/read.c (convert_real): Ditto.
        * io/transfer.c: Update comments.
        * io/transfer128.c: New file.
        * io/write_float.def (write_float): Handle __float128 type.
        * libgfortran.h: #include quadmath_weak.h, define __builtin_infq
        and nanq.
        * m4/mtype.m4: Handle __float128 type.
        * runtime/in_pack_generic.c (internal_pack): Ditto.
        * runtime/in_unpack_generic.c (internal_unpack): Ditto.
        * kinds-override.h: New file.
        * libgfortran.spec.in: Ditto.
        * generated/pow_r16_i4.c: Generated.
        * Makefile.in: Regenerate.
        * configure: Regenerate.
        * config.h: Regenerate.
        * bessel_r10.c: Regenerate.
        * bessel_r16.c: Regenerate.
        * bessel_r4.c: Regenerate.
        * bessel_r8.c: Regenerate.
        * exponent_r16.c: Regenerate.
        * fraction_r16.c: Regenerate.
        * nearest_r16.c: Regenerate.
        * norm2_r10.c: Regenerate.
        * norm2_r16.c: Regenerate.
        * norm2_r4.c: Regenerate.
        * norm2_r8.c: Regenerate.
        * rrspacing_r16.c: Regenerate.
        * set_exponent_r16.c: Regenerate.
        * spacing_r16.c: Regenerate.


Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r166825
This commit is contained in:
Francois-Xavier Coudert 2010-11-16 21:23:19 +00:00 committed by Tobias Burnus
parent 07078664fd
commit 1ec601bf9f
150 changed files with 35829 additions and 123 deletions

View File

@ -1,3 +1,13 @@
2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
* Makefile.def: Add libquadmath; build it with language=fortran.
* configure.ac: Add libquadmath.
* Makefile.tpl: Handle multiple libs in check-[+language+].
* Makefile.in: Regenerate.
* configure: Regenerate.
2010-11-16 Tom Tromey <tromey@redhat.com>
* MAINTAINERS: Moved myself to reviewers section.

View File

@ -155,6 +155,7 @@ target_modules = { module= libmudflap; lib_path=.libs; };
target_modules = { module= libssp; lib_path=.libs; };
target_modules = { module= newlib; };
target_modules = { module= libgcc; bootstrap=true; no_check=true; };
target_modules = { module= libquadmath; };
target_modules = { module= libgfortran; };
target_modules = { module= libobjc; };
target_modules = { module= libtermcap; no_check=true;
@ -571,11 +572,13 @@ dependencies = { module=configure-target-libiberty; on=all-binutils; };
dependencies = { module=configure-target-libiberty; on=all-ld; };
dependencies = { module=configure-target-newlib; on=all-binutils; };
dependencies = { module=configure-target-newlib; on=all-ld; };
dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; };
languages = { language=c; gcc-check-target=check-gcc; };
languages = { language=c++; gcc-check-target=check-c++;
lib-check-target=check-target-libstdc++-v3; };
languages = { language=fortran; gcc-check-target=check-fortran;
lib-check-target=check-target-libquadmath;
lib-check-target=check-target-libgfortran; };
languages = { language=java; gcc-check-target=check-java;
lib-check-target=check-target-libjava; };

View File

@ -926,6 +926,7 @@ configure-target: \
maybe-configure-target-libssp \
maybe-configure-target-newlib \
maybe-configure-target-libgcc \
maybe-configure-target-libquadmath \
maybe-configure-target-libgfortran \
maybe-configure-target-libobjc \
maybe-configure-target-libtermcap \
@ -1108,6 +1109,7 @@ all-target: maybe-all-target-newlib
@if target-libgcc-no-bootstrap
all-target: maybe-all-target-libgcc
@endif target-libgcc-no-bootstrap
all-target: maybe-all-target-libquadmath
all-target: maybe-all-target-libgfortran
all-target: maybe-all-target-libobjc
all-target: maybe-all-target-libtermcap
@ -1229,6 +1231,7 @@ info-target: maybe-info-target-libmudflap
info-target: maybe-info-target-libssp
info-target: maybe-info-target-newlib
info-target: maybe-info-target-libgcc
info-target: maybe-info-target-libquadmath
info-target: maybe-info-target-libgfortran
info-target: maybe-info-target-libobjc
info-target: maybe-info-target-libtermcap
@ -1343,6 +1346,7 @@ dvi-target: maybe-dvi-target-libmudflap
dvi-target: maybe-dvi-target-libssp
dvi-target: maybe-dvi-target-newlib
dvi-target: maybe-dvi-target-libgcc
dvi-target: maybe-dvi-target-libquadmath
dvi-target: maybe-dvi-target-libgfortran
dvi-target: maybe-dvi-target-libobjc
dvi-target: maybe-dvi-target-libtermcap
@ -1457,6 +1461,7 @@ pdf-target: maybe-pdf-target-libmudflap
pdf-target: maybe-pdf-target-libssp
pdf-target: maybe-pdf-target-newlib
pdf-target: maybe-pdf-target-libgcc
pdf-target: maybe-pdf-target-libquadmath
pdf-target: maybe-pdf-target-libgfortran
pdf-target: maybe-pdf-target-libobjc
pdf-target: maybe-pdf-target-libtermcap
@ -1571,6 +1576,7 @@ html-target: maybe-html-target-libmudflap
html-target: maybe-html-target-libssp
html-target: maybe-html-target-newlib
html-target: maybe-html-target-libgcc
html-target: maybe-html-target-libquadmath
html-target: maybe-html-target-libgfortran
html-target: maybe-html-target-libobjc
html-target: maybe-html-target-libtermcap
@ -1685,6 +1691,7 @@ TAGS-target: maybe-TAGS-target-libmudflap
TAGS-target: maybe-TAGS-target-libssp
TAGS-target: maybe-TAGS-target-newlib
TAGS-target: maybe-TAGS-target-libgcc
TAGS-target: maybe-TAGS-target-libquadmath
TAGS-target: maybe-TAGS-target-libgfortran
TAGS-target: maybe-TAGS-target-libobjc
TAGS-target: maybe-TAGS-target-libtermcap
@ -1799,6 +1806,7 @@ install-info-target: maybe-install-info-target-libmudflap
install-info-target: maybe-install-info-target-libssp
install-info-target: maybe-install-info-target-newlib
install-info-target: maybe-install-info-target-libgcc
install-info-target: maybe-install-info-target-libquadmath
install-info-target: maybe-install-info-target-libgfortran
install-info-target: maybe-install-info-target-libobjc
install-info-target: maybe-install-info-target-libtermcap
@ -1913,6 +1921,7 @@ install-pdf-target: maybe-install-pdf-target-libmudflap
install-pdf-target: maybe-install-pdf-target-libssp
install-pdf-target: maybe-install-pdf-target-newlib
install-pdf-target: maybe-install-pdf-target-libgcc
install-pdf-target: maybe-install-pdf-target-libquadmath
install-pdf-target: maybe-install-pdf-target-libgfortran
install-pdf-target: maybe-install-pdf-target-libobjc
install-pdf-target: maybe-install-pdf-target-libtermcap
@ -2027,6 +2036,7 @@ install-html-target: maybe-install-html-target-libmudflap
install-html-target: maybe-install-html-target-libssp
install-html-target: maybe-install-html-target-newlib
install-html-target: maybe-install-html-target-libgcc
install-html-target: maybe-install-html-target-libquadmath
install-html-target: maybe-install-html-target-libgfortran
install-html-target: maybe-install-html-target-libobjc
install-html-target: maybe-install-html-target-libtermcap
@ -2141,6 +2151,7 @@ installcheck-target: maybe-installcheck-target-libmudflap
installcheck-target: maybe-installcheck-target-libssp
installcheck-target: maybe-installcheck-target-newlib
installcheck-target: maybe-installcheck-target-libgcc
installcheck-target: maybe-installcheck-target-libquadmath
installcheck-target: maybe-installcheck-target-libgfortran
installcheck-target: maybe-installcheck-target-libobjc
installcheck-target: maybe-installcheck-target-libtermcap
@ -2255,6 +2266,7 @@ mostlyclean-target: maybe-mostlyclean-target-libmudflap
mostlyclean-target: maybe-mostlyclean-target-libssp
mostlyclean-target: maybe-mostlyclean-target-newlib
mostlyclean-target: maybe-mostlyclean-target-libgcc
mostlyclean-target: maybe-mostlyclean-target-libquadmath
mostlyclean-target: maybe-mostlyclean-target-libgfortran
mostlyclean-target: maybe-mostlyclean-target-libobjc
mostlyclean-target: maybe-mostlyclean-target-libtermcap
@ -2369,6 +2381,7 @@ clean-target: maybe-clean-target-libmudflap
clean-target: maybe-clean-target-libssp
clean-target: maybe-clean-target-newlib
clean-target: maybe-clean-target-libgcc
clean-target: maybe-clean-target-libquadmath
clean-target: maybe-clean-target-libgfortran
clean-target: maybe-clean-target-libobjc
clean-target: maybe-clean-target-libtermcap
@ -2483,6 +2496,7 @@ distclean-target: maybe-distclean-target-libmudflap
distclean-target: maybe-distclean-target-libssp
distclean-target: maybe-distclean-target-newlib
distclean-target: maybe-distclean-target-libgcc
distclean-target: maybe-distclean-target-libquadmath
distclean-target: maybe-distclean-target-libgfortran
distclean-target: maybe-distclean-target-libobjc
distclean-target: maybe-distclean-target-libtermcap
@ -2597,6 +2611,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libmudflap
maintainer-clean-target: maybe-maintainer-clean-target-libssp
maintainer-clean-target: maybe-maintainer-clean-target-newlib
maintainer-clean-target: maybe-maintainer-clean-target-libgcc
maintainer-clean-target: maybe-maintainer-clean-target-libquadmath
maintainer-clean-target: maybe-maintainer-clean-target-libgfortran
maintainer-clean-target: maybe-maintainer-clean-target-libobjc
maintainer-clean-target: maybe-maintainer-clean-target-libtermcap
@ -2766,6 +2781,7 @@ check-target: \
maybe-check-target-libssp \
maybe-check-target-newlib \
maybe-check-target-libgcc \
maybe-check-target-libquadmath \
maybe-check-target-libgfortran \
maybe-check-target-libobjc \
maybe-check-target-libtermcap \
@ -2987,6 +3003,7 @@ install-target: \
maybe-install-target-libssp \
maybe-install-target-newlib \
maybe-install-target-libgcc \
maybe-install-target-libquadmath \
maybe-install-target-libgfortran \
maybe-install-target-libobjc \
maybe-install-target-libtermcap \
@ -48077,6 +48094,448 @@ maintainer-clean-target-libgcc:
.PHONY: configure-target-libquadmath maybe-configure-target-libquadmath
maybe-configure-target-libquadmath:
@if gcc-bootstrap
configure-target-libquadmath: stage_current
@endif gcc-bootstrap
@if target-libquadmath
maybe-configure-target-libquadmath: configure-target-libquadmath
configure-target-libquadmath:
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
echo "Checking multilib configuration for libquadmath..."; \
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libquadmath ; \
$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libquadmath/multilib.tmp 2> /dev/null ; \
if test -r $(TARGET_SUBDIR)/libquadmath/multilib.out; then \
if cmp -s $(TARGET_SUBDIR)/libquadmath/multilib.tmp $(TARGET_SUBDIR)/libquadmath/multilib.out; then \
rm -f $(TARGET_SUBDIR)/libquadmath/multilib.tmp; \
else \
rm -f $(TARGET_SUBDIR)/libquadmath/Makefile; \
mv $(TARGET_SUBDIR)/libquadmath/multilib.tmp $(TARGET_SUBDIR)/libquadmath/multilib.out; \
fi; \
else \
mv $(TARGET_SUBDIR)/libquadmath/multilib.tmp $(TARGET_SUBDIR)/libquadmath/multilib.out; \
fi; \
test ! -f $(TARGET_SUBDIR)/libquadmath/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libquadmath ; \
$(NORMAL_TARGET_EXPORTS) \
echo Configuring in $(TARGET_SUBDIR)/libquadmath; \
cd "$(TARGET_SUBDIR)/libquadmath" || exit 1; \
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(TARGET_SUBDIR)/libquadmath/ | \
sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/libquadmath"; \
libsrcdir="$$s/libquadmath"; \
rm -f no-such-file || : ; \
CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--target=${target_alias} $${srcdiroption} \
|| exit 1
@endif target-libquadmath
.PHONY: all-target-libquadmath maybe-all-target-libquadmath
maybe-all-target-libquadmath:
@if gcc-bootstrap
all-target-libquadmath: stage_current
@endif gcc-bootstrap
@if target-libquadmath
TARGET-target-libquadmath=all
maybe-all-target-libquadmath: all-target-libquadmath
all-target-libquadmath: configure-target-libquadmath
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \
$(TARGET-target-libquadmath))
@endif target-libquadmath
.PHONY: check-target-libquadmath maybe-check-target-libquadmath
maybe-check-target-libquadmath:
@if target-libquadmath
maybe-check-target-libquadmath: check-target-libquadmath
check-target-libquadmath:
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) check)
@endif target-libquadmath
.PHONY: install-target-libquadmath maybe-install-target-libquadmath
maybe-install-target-libquadmath:
@if target-libquadmath
maybe-install-target-libquadmath: install-target-libquadmath
install-target-libquadmath: installdirs
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) install)
@endif target-libquadmath
# Other targets (info, dvi, pdf, etc.)
.PHONY: maybe-info-target-libquadmath info-target-libquadmath
maybe-info-target-libquadmath:
@if target-libquadmath
maybe-info-target-libquadmath: info-target-libquadmath
info-target-libquadmath: \
configure-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing info in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
info) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-dvi-target-libquadmath dvi-target-libquadmath
maybe-dvi-target-libquadmath:
@if target-libquadmath
maybe-dvi-target-libquadmath: dvi-target-libquadmath
dvi-target-libquadmath: \
configure-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing dvi in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
dvi) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-pdf-target-libquadmath pdf-target-libquadmath
maybe-pdf-target-libquadmath:
@if target-libquadmath
maybe-pdf-target-libquadmath: pdf-target-libquadmath
pdf-target-libquadmath: \
configure-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing pdf in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
pdf) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-html-target-libquadmath html-target-libquadmath
maybe-html-target-libquadmath:
@if target-libquadmath
maybe-html-target-libquadmath: html-target-libquadmath
html-target-libquadmath: \
configure-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing html in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
html) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-TAGS-target-libquadmath TAGS-target-libquadmath
maybe-TAGS-target-libquadmath:
@if target-libquadmath
maybe-TAGS-target-libquadmath: TAGS-target-libquadmath
TAGS-target-libquadmath: \
configure-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing TAGS in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
TAGS) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-install-info-target-libquadmath install-info-target-libquadmath
maybe-install-info-target-libquadmath:
@if target-libquadmath
maybe-install-info-target-libquadmath: install-info-target-libquadmath
install-info-target-libquadmath: \
configure-target-libquadmath \
info-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-info in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-info) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-install-pdf-target-libquadmath install-pdf-target-libquadmath
maybe-install-pdf-target-libquadmath:
@if target-libquadmath
maybe-install-pdf-target-libquadmath: install-pdf-target-libquadmath
install-pdf-target-libquadmath: \
configure-target-libquadmath \
pdf-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-pdf in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-pdf) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-install-html-target-libquadmath install-html-target-libquadmath
maybe-install-html-target-libquadmath:
@if target-libquadmath
maybe-install-html-target-libquadmath: install-html-target-libquadmath
install-html-target-libquadmath: \
configure-target-libquadmath \
html-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-html in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-html) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-installcheck-target-libquadmath installcheck-target-libquadmath
maybe-installcheck-target-libquadmath:
@if target-libquadmath
maybe-installcheck-target-libquadmath: installcheck-target-libquadmath
installcheck-target-libquadmath: \
configure-target-libquadmath
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing installcheck in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
installcheck) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-mostlyclean-target-libquadmath mostlyclean-target-libquadmath
maybe-mostlyclean-target-libquadmath:
@if target-libquadmath
maybe-mostlyclean-target-libquadmath: mostlyclean-target-libquadmath
mostlyclean-target-libquadmath:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing mostlyclean in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
mostlyclean) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-clean-target-libquadmath clean-target-libquadmath
maybe-clean-target-libquadmath:
@if target-libquadmath
maybe-clean-target-libquadmath: clean-target-libquadmath
clean-target-libquadmath:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing clean in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
clean) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-distclean-target-libquadmath distclean-target-libquadmath
maybe-distclean-target-libquadmath:
@if target-libquadmath
maybe-distclean-target-libquadmath: distclean-target-libquadmath
distclean-target-libquadmath:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing distclean in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
distclean) \
|| exit 1
@endif target-libquadmath
.PHONY: maybe-maintainer-clean-target-libquadmath maintainer-clean-target-libquadmath
maybe-maintainer-clean-target-libquadmath:
@if target-libquadmath
maybe-maintainer-clean-target-libquadmath: maintainer-clean-target-libquadmath
maintainer-clean-target-libquadmath:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libquadmath/Makefile ] || exit 0 ; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libquadmath" ; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libquadmath && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
maintainer-clean) \
|| exit 1
@endif target-libquadmath
.PHONY: configure-target-libgfortran maybe-configure-target-libgfortran
maybe-configure-target-libgfortran:
@if gcc-bootstrap
@ -55635,7 +56094,7 @@ check-gcc-fortran:
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-fortran);
check-fortran: check-gcc-fortran check-target-libgfortran
check-fortran: check-gcc-fortran check-target-libquadmath check-target-libgfortran
.PHONY: check-gcc-java check-java
check-gcc-java:
@ -57650,6 +58109,7 @@ configure-stage3-target-libgcc: maybe-all-stage3-gcc
configure-stage4-target-libgcc: maybe-all-stage4-gcc
configure-stageprofile-target-libgcc: maybe-all-stageprofile-gcc
configure-stagefeedback-target-libgcc: maybe-all-stagefeedback-gcc
configure-target-libquadmath: stage_last
configure-target-libgfortran: stage_last
configure-target-libobjc: stage_last
configure-target-libtermcap: stage_last
@ -57679,6 +58139,7 @@ configure-target-libmudflap: maybe-all-gcc
configure-target-libssp: maybe-all-gcc
configure-target-newlib: maybe-all-gcc
configure-target-libgcc: maybe-all-gcc
configure-target-libquadmath: maybe-all-gcc
configure-target-libgfortran: maybe-all-gcc
configure-target-libobjc: maybe-all-gcc
configure-target-libtermcap: maybe-all-gcc
@ -58466,6 +58927,7 @@ configure-target-libiberty: maybe-all-binutils
configure-target-libiberty: maybe-all-ld
configure-target-newlib: maybe-all-binutils
configure-target-newlib: maybe-all-ld
configure-target-libgfortran: maybe-all-target-libquadmath
# Dependencies for target modules on other target modules are
@ -58493,6 +58955,7 @@ configure-target-libstdc++-v3: maybe-all-target-libgcc
configure-target-libmudflap: maybe-all-target-libgcc
configure-target-libssp: maybe-all-target-libgcc
configure-target-newlib: maybe-all-target-libgcc
configure-target-libquadmath: maybe-all-target-libgcc
configure-target-libgfortran: maybe-all-target-libgcc
configure-target-libobjc: maybe-all-target-libgcc
configure-target-libtermcap: maybe-all-target-libgcc
@ -58520,6 +58983,8 @@ configure-target-libssp: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libquadmath: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libgfortran: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libobjc: maybe-all-target-newlib maybe-all-target-libgloss

View File

@ -1340,7 +1340,7 @@ check-gcc-[+language+]:
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
[+ ENDFOR languages +]
# Install the gcc headers files, but not the fixed include files,

1
configure vendored
View File

@ -2696,6 +2696,7 @@ target_libraries="target-libgcc \
target-libstdc++-v3 \
target-libmudflap \
target-libssp \
target-libquadmath \
target-libgfortran \
target-boehm-gc \
${libgcj} \

View File

@ -195,6 +195,7 @@ target_libraries="target-libgcc \
target-libstdc++-v3 \
target-libmudflap \
target-libssp \
target-libquadmath \
target-libgfortran \
target-boehm-gc \
${libgcj} \

View File

@ -1,3 +1,15 @@
2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
* gfortranspec.c (find_spec_file): New function.
(lang_specific_driver): Try to find .spec file and use it.
* trans-io.c (iocall): Define IOCALL_X_REAL128/COMPLEX128(,write).
(gfc_build_io_library_fndecls): Build decl for __float128 I/O.
(transfer_expr): Call __float128 I/O functions.
* trans-types.c (gfc_init_kinds): Allow kind-16 belonging
to __float128.
2010-11-15 Tobias Burnus <burnus@net.b.de>
PR fortran/46484

View File

@ -63,6 +63,9 @@ along with GCC; see the file COPYING3. If not see
#define FORTRAN_LIBRARY "gfortran"
#endif
/* Name of the spec file. */
#define SPEC_FILE "libgfortran.spec"
/* The original argument list and related info is copied here. */
static unsigned int g77_xargc;
static const struct cl_decoded_option *g77_x_decoded_options;
@ -72,6 +75,27 @@ static void append_arg (const struct cl_decoded_option *);
static unsigned int g77_newargc;
static struct cl_decoded_option *g77_new_decoded_options;
/* Return full path name of spec file if it is in DIR, or NULL if
not. */
static char *
find_spec_file (const char *dir)
{
const char dirsep_string[] = { DIR_SEPARATOR, '\0' };
char *spec;
struct stat sb;
spec = XNEWVEC (char, strlen (dir) + sizeof (SPEC_FILE) + 4);
strcpy (spec, dir);
strcat (spec, dirsep_string);
strcat (spec, SPEC_FILE);
if (!stat (spec, &sb))
return spec;
free (spec);
return NULL;
}
/* Return whether strings S1 and S2 are both NULL or both the same
string. */
@ -199,6 +223,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
/* Whether we should link a static libgfortran. */
int static_lib = 0;
/* The path to the spec file. */
char *spec_file = NULL;
/* Whether we need to link statically. */
int static_linking = 0;
@ -283,6 +310,12 @@ For more information about these matters, see the file named COPYING\n\n"));
cool facility for handling --help and --verbose --help. */
return;
case OPT_L:
if (!spec_file)
spec_file = find_spec_file (decoded_options[i].arg);
break;
default:
break;
}
@ -413,6 +446,11 @@ For more information about these matters, see the file named COPYING\n\n"));
#endif
/* Read the specs file corresponding to libgfortran.
If we didn't find the spec file on the -L path, then we hope it
is somewhere in the standard install areas. */
append_option (OPT_specs_, spec_file == NULL ? SPEC_FILE : spec_file, 1);
if (verbose && g77_new_decoded_options != g77_x_decoded_options)
{
fprintf (stderr, _("Driving:"));

View File

@ -126,6 +126,10 @@ enum iocall
IOCALL_X_REAL_WRITE,
IOCALL_X_COMPLEX,
IOCALL_X_COMPLEX_WRITE,
IOCALL_X_REAL128,
IOCALL_X_REAL128_WRITE,
IOCALL_X_COMPLEX128,
IOCALL_X_COMPLEX128_WRITE,
IOCALL_X_ARRAY,
IOCALL_X_ARRAY_WRITE,
IOCALL_OPEN,
@ -365,6 +369,23 @@ gfc_build_io_library_fndecls (void)
get_identifier (PREFIX("transfer_complex_write")), ".wR",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
/* Version for __float128. */
iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("transfer_real128")), ".wW",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_REAL128_WRITE] = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("transfer_real128_write")), ".wR",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("transfer_complex128")), ".wW",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_COMPLEX128_WRITE] = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("transfer_complex128_write")), ".wR",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("transfer_array")), ".ww",
void_type_node, 4, dt_parm_type, pvoid_type_node,
@ -2057,18 +2078,38 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
case BT_REAL:
arg2 = build_int_cst (NULL_TREE, kind);
if (last_dt == READ)
function = iocall[IOCALL_X_REAL];
{
if (gfc_real16_is_float128 && ts->kind == 16)
function = iocall[IOCALL_X_REAL128];
else
function = iocall[IOCALL_X_REAL];
}
else
function = iocall[IOCALL_X_REAL_WRITE];
{
if (gfc_real16_is_float128 && ts->kind == 16)
function = iocall[IOCALL_X_REAL128_WRITE];
else
function = iocall[IOCALL_X_REAL_WRITE];
}
break;
case BT_COMPLEX:
arg2 = build_int_cst (NULL_TREE, kind);
if (last_dt == READ)
function = iocall[IOCALL_X_COMPLEX];
{
if (gfc_real16_is_float128 && ts->kind == 16)
function = iocall[IOCALL_X_COMPLEX128];
else
function = iocall[IOCALL_X_COMPLEX];
}
else
function = iocall[IOCALL_X_COMPLEX_WRITE];
{
if (gfc_real16_is_float128 && ts->kind == 16)
function = iocall[IOCALL_X_COMPLEX128_WRITE];
else
function = iocall[IOCALL_X_COMPLEX_WRITE];
}
break;

View File

@ -418,8 +418,12 @@ gfc_init_kinds (void)
useless. TODO: TFmode support should be enabled once libgfortran
support is done. */
if (mode != TYPE_MODE (float_type_node)
&& (mode != TYPE_MODE (double_type_node))
&& (mode != TYPE_MODE (long_double_type_node)))
&& (mode != TYPE_MODE (double_type_node))
&& (mode != TYPE_MODE (long_double_type_node))
#ifdef LIBGCC2_HAS_TF_MODE
&& (mode != TFmode)
#endif
)
continue;
/* Let the kind equal the precision divided by 8, rounding up. Again,

View File

@ -1,3 +1,15 @@
2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
* gfortran.dg/quad_1.f90: New.
* lib/gcc-defs.exp (gcc-set-multilib-library-path): Use also
compiler arguments.
* lib/gfortran.exp (gfortran_link_flags): Add libquadmath to
library search path; call gcc-set-multilib-library-path with
arguments such that libgfortran.spec is found.
(gfortran_init): Add path for libgfortran.spec to GFORTRAN_UNDER_TEST.
2010-11-16 Jakub Jelinek <jakub@redhat.com>
PR c++/46401

View File

@ -0,0 +1,35 @@
! { dg-do link }
!
! This test checks whether the largest possible
! floating-point number works. That's usually
! REAL(16) -- either because the hardware supports it or
! because of libquadmath. However, it can also be
! REAL(10) or REAL(8)
!
program test_qp
use iso_fortran_env, only: real_kinds
implicit none
integer, parameter :: QP = real_kinds(ubound(real_kinds,dim=1))
real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
real(QP) :: x = 0.124_QP
complex(QP) :: z = 0.124_QP
print *, 'kind = ', qp
print *, x
print *, PI
print *, 16*atan(0.2_QP)-4*atan(Z1/239)
print *, sin(PI)
print *, cos(HALF_PI)
print *, asinh(PI)
print *, erfc(Z1)
print *, epsilon(x)
print *, precision(x)
print *, digits(x)
print *, z
print *, PI*cmplx(0.0_qp, 1.0_qp)
print *, 16*atan(0.2_QP)-4*atan(Z1/239)
print *, sin(z)
print *, cos(z)
print *, sinh(z) ! asinh not implemented, cf. PR 46416
print *, precision(z)
end program test_qp

View File

@ -250,9 +250,10 @@ proc gcc-set-multilib-library-path { compiler } {
}
set libpath ":${rootme}"
set options [lrange $compiler 1 end]
set compiler [lindex $compiler 0]
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
foreach i "[exec $compiler $options --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]

View File

@ -103,11 +103,22 @@ proc gfortran_link_flags { paths } {
if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
append flags "-L${gccpath}/libgfortran "
}
if [file exists "${gccpath}/libquadmath/.libs/libquadmath.a"] {
# Some targets use libquadmath.a%s in their specs, so they need a -B option
# for uninstalled testing.
append flags "-B${gccpath}/libquadmath/.libs "
append flags "-L${gccpath}/libquadmath/.libs "
append ld_library_path ":${gccpath}/libquadmath/.libs"
}
if [file exists "${gccpath}/libquadmath/.libs/libquadmath.${shlib_ext}"] {
append flags "-L${gccpath}/libquadmath/.libs "
append ld_library_path ":${gccpath}/libquadmath/.libs"
}
if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty "
}
append ld_library_path \
[gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
[gcc-set-multilib-library-path { $GFORTRAN_UNDER_TEST } ]
}
set_ld_library_path_env_vars
@ -150,7 +161,12 @@ proc gfortran_init { args } {
if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
set GFORTRAN_UNDER_TEST [transform gfortran]
} else {
set GFORTRAN_UNDER_TEST [findfile $base_dir/../../gfortran "$base_dir/../../gfortran -B$base_dir/../../" [findfile $base_dir/gfortran "$base_dir/gfortran -B$base_dir/" [transform gfortran]]]
if [info exists TOOL_OPTIONS] {
set specpath [get_multilibs ${TOOL_OPTIONS}]
} else {
set specpath [get_multilibs]
}
set GFORTRAN_UNDER_TEST [findfile $base_dir/../../gfortran "$base_dir/../../gfortran -B$base_dir/../../ -L$specpath/libgfortran" [findfile $base_dir/gfortran "$base_dir/gfortran -B$base_dir/" [transform gfortran]]]
}
}
}

View File

@ -1,3 +1,48 @@
2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
* Makefile.am: Add missing pow_r16_i4.c, add transfer128.c,
link libquadmath, if used.
* acinclude.m4 (LIBGFOR_CHECK_FLOAT128): Add.
* configure.ac: Use it, touch spec file.
* gfortran.map: Add pow_r16_i4 and
transfer_(real,complex)128(,write) functions.
* intrinsics/cshift0.c (cshift0): Handle __float128 type.
* intrinsics/erfc_scaled_inc.c: Ditto.
* intrinsics/pack_generic.c (pack): Ditto
* intrinsics/spread_generic.c (spread): Ditto.
* intrinsics/unpack_generic.c (unpack1): Ditto.
* io/read.c (convert_real): Ditto.
* io/transfer.c: Update comments.
* io/transfer128.c: New file.
* io/write_float.def (write_float): Handle __float128 type.
* libgfortran.h: #include quadmath_weak.h, define __builtin_infq
and nanq.
* m4/mtype.m4: Handle __float128 type.
* runtime/in_pack_generic.c (internal_pack): Ditto.
* runtime/in_unpack_generic.c (internal_unpack): Ditto.
* kinds-override.h: New file.
* libgfortran.spec.in: Ditto.
* generated/pow_r16_i4.c: Generated.
* Makefile.in: Regenerate.
* configure: Regenerate.
* config.h: Regenerate.
* bessel_r10.c: Regenerate.
* bessel_r16.c: Regenerate.
* bessel_r4.c: Regenerate.
* bessel_r8.c: Regenerate.
* exponent_r16.c: Regenerate.
* fraction_r16.c: Regenerate.
* nearest_r16.c: Regenerate.
* norm2_r10.c: Regenerate.
* norm2_r16.c: Regenerate.
* norm2_r4.c: Regenerate.
* norm2_r8.c: Regenerate.
* rrspacing_r16.c: Regenerate.
* set_exponent_r16.c: Regenerate.
* spacing_r16.c: Regenerate.
2010-11-09 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.c (struct unix_stream): Add st_dev and st_ino members.

View File

@ -34,9 +34,10 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
-no-undefined -bindir "$(bindir)"
toolexeclib_LTLIBRARIES = libgfortran.la
toolexeclib_DATA = libgfortran.spec
libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -lm $(extra_ldflags_libgfortran) $(version_arg)
libgfortran_la_DEPENDENCIES = $(version_dep)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(LIBQUADLIB) -lm $(extra_ldflags_libgfortran) $(version_arg)
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
myexeclib_LTLIBRARIES = libgfortranbegin.la
myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
@ -47,7 +48,7 @@ libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS)
## io.h conflicts with a system header on some platforms, so
## use -iquote
AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config $(LIBQUADINCLUDE) \
-I$(MULTIBUILDTOP)../../$(host_subdir)/gcc -D_GNU_SOURCE
# Fortran rules for complex multiplication and division
@ -71,6 +72,7 @@ io/open.c \
io/read.c \
io/size_from_kind.c \
io/transfer.c \
io/transfer128.c \
io/unit.c \
io/unix.c \
io/write.c \
@ -543,6 +545,7 @@ i_pow_c = \
$(srcdir)/generated/pow_i4_i4.c \
$(srcdir)/generated/pow_i8_i4.c \
$(srcdir)/generated/pow_i16_i4.c \
$(srcdir)/generated/pow_r16_i4.c \
$(srcdir)/generated/pow_c4_i4.c \
$(srcdir)/generated/pow_c8_i4.c \
$(srcdir)/generated/pow_c10_i4.c \

View File

@ -15,6 +15,7 @@
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -42,7 +43,7 @@ subdir = .
DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in $(srcdir)/../mkinstalldirs \
$(srcdir)/../depcomp
$(srcdir)/libgfortran.spec.in $(srcdir)/../depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
@ -60,7 +61,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = libgfortran.spec
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@ -84,7 +85,7 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(myexeclibdir)" \
"$(DESTDIR)$(toolexeclibdir)"
"$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"
LTLIBRARIES = $(myexeclib_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
libgfortran_la_LIBADD =
am__objects_1 = backtrace.lo bounds.lo compile_options.lo \
@ -186,14 +187,14 @@ am__objects_31 = nearest_r4.lo nearest_r8.lo nearest_r10.lo \
nearest_r16.lo
am__objects_32 = set_exponent_r4.lo set_exponent_r8.lo \
set_exponent_r10.lo set_exponent_r16.lo
am__objects_33 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_c4_i4.lo \
pow_c8_i4.lo pow_c10_i4.lo pow_c16_i4.lo pow_i4_i8.lo \
pow_i8_i8.lo pow_i16_i8.lo pow_r4_i8.lo pow_r8_i8.lo \
pow_r10_i8.lo pow_r16_i8.lo pow_c4_i8.lo pow_c8_i8.lo \
pow_c10_i8.lo pow_c16_i8.lo pow_i4_i16.lo pow_i8_i16.lo \
pow_i16_i16.lo pow_r4_i16.lo pow_r8_i16.lo pow_r10_i16.lo \
pow_r16_i16.lo pow_c4_i16.lo pow_c8_i16.lo pow_c10_i16.lo \
pow_c16_i16.lo
am__objects_33 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r16_i4.lo \
pow_c4_i4.lo pow_c8_i4.lo pow_c10_i4.lo pow_c16_i4.lo \
pow_i4_i8.lo pow_i8_i8.lo pow_i16_i8.lo pow_r4_i8.lo \
pow_r8_i8.lo pow_r10_i8.lo pow_r16_i8.lo pow_c4_i8.lo \
pow_c8_i8.lo pow_c10_i8.lo pow_c16_i8.lo pow_i4_i16.lo \
pow_i8_i16.lo pow_i16_i16.lo pow_r4_i16.lo pow_r8_i16.lo \
pow_r10_i16.lo pow_r16_i16.lo pow_c4_i16.lo pow_c8_i16.lo \
pow_c10_i16.lo pow_c16_i16.lo
am__objects_34 = rrspacing_r4.lo rrspacing_r8.lo rrspacing_r10.lo \
rrspacing_r16.lo
am__objects_35 = spacing_r4.lo spacing_r8.lo spacing_r10.lo \
@ -228,7 +229,8 @@ am__objects_40 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_38) $(am__objects_39)
am__objects_41 = close.lo file_pos.lo format.lo inquire.lo \
intrinsics.lo list_read.lo lock.lo open.lo read.lo \
size_from_kind.lo transfer.lo unit.lo unix.lo write.lo fbuf.lo
size_from_kind.lo transfer.lo transfer128.lo unit.lo unix.lo \
write.lo fbuf.lo
am__objects_42 = associated.lo abort.lo access.lo args.lo \
bit_intrinsics.lo c99_functions.lo chdir.lo chmod.lo clock.lo \
cpu_time.lo cshift0.lo ctime.lo date_and_time.lo dtime.lo \
@ -318,6 +320,7 @@ MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
DATA = $(toolexeclib_DATA)
ETAGS = etags
CTAGS = ctags
ACLOCAL = @ACLOCAL@
@ -366,6 +369,10 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBQUADINCLUDE = @LIBQUADINCLUDE@
LIBQUADLIB = @LIBQUADLIB@
LIBQUADLIB_DEP = @LIBQUADLIB_DEP@
LIBQUADSPEC = @LIBQUADSPEC@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
@ -474,16 +481,17 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
-no-undefined -bindir "$(bindir)"
toolexeclib_LTLIBRARIES = libgfortran.la
toolexeclib_DATA = libgfortran.spec
libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -lm $(extra_ldflags_libgfortran) $(version_arg)
libgfortran_la_DEPENDENCIES = $(version_dep)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(LIBQUADLIB) -lm $(extra_ldflags_libgfortran) $(version_arg)
libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
myexeclib_LTLIBRARIES = libgfortranbegin.la
myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
libgfortranbegin_la_SOURCES = fmain.c
libgfortranbegin_la_LDFLAGS = -static
libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS)
AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config $(LIBQUADINCLUDE) \
-I$(MULTIBUILDTOP)../../$(host_subdir)/gcc -D_GNU_SOURCE
gfor_io_src = \
@ -498,6 +506,7 @@ io/open.c \
io/read.c \
io/size_from_kind.c \
io/transfer.c \
io/transfer128.c \
io/unit.c \
io/unix.c \
io/write.c \
@ -969,6 +978,7 @@ i_pow_c = \
$(srcdir)/generated/pow_i4_i4.c \
$(srcdir)/generated/pow_i8_i4.c \
$(srcdir)/generated/pow_i16_i4.c \
$(srcdir)/generated/pow_r16_i4.c \
$(srcdir)/generated/pow_c4_i4.c \
$(srcdir)/generated/pow_c8_i4.c \
$(srcdir)/generated/pow_c10_i4.c \
@ -1295,6 +1305,8 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
libgfortran.spec: $(top_builddir)/config.status $(srcdir)/libgfortran.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-myexeclibLTLIBRARIES: $(myexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(myexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(myexeclibdir)"
@ -1712,6 +1724,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r10_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r10_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r16_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r16_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r16_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r4_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r4_i8.Plo@am__quote@
@ -1804,6 +1817,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system_clock.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transfer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transfer128.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transpose_c10.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transpose_c16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transpose_c4.Plo@am__quote@
@ -4401,6 +4415,13 @@ pow_i16_i4.lo: $(srcdir)/generated/pow_i16_i4.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i16_i4.lo `test -f '$(srcdir)/generated/pow_i16_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_i16_i4.c
pow_r16_i4.lo: $(srcdir)/generated/pow_r16_i4.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_r16_i4.lo -MD -MP -MF $(DEPDIR)/pow_r16_i4.Tpo -c -o pow_r16_i4.lo `test -f '$(srcdir)/generated/pow_r16_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r16_i4.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pow_r16_i4.Tpo $(DEPDIR)/pow_r16_i4.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/pow_r16_i4.c' object='pow_r16_i4.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r16_i4.lo `test -f '$(srcdir)/generated/pow_r16_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r16_i4.c
pow_c4_i4.lo: $(srcdir)/generated/pow_c4_i4.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_c4_i4.lo -MD -MP -MF $(DEPDIR)/pow_c4_i4.Tpo -c -o pow_c4_i4.lo `test -f '$(srcdir)/generated/pow_c4_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_c4_i4.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pow_c4_i4.Tpo $(DEPDIR)/pow_c4_i4.Plo
@ -5080,6 +5101,13 @@ transfer.lo: io/transfer.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transfer.lo `test -f 'io/transfer.c' || echo '$(srcdir)/'`io/transfer.c
transfer128.lo: io/transfer128.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT transfer128.lo -MD -MP -MF $(DEPDIR)/transfer128.Tpo -c -o transfer128.lo `test -f 'io/transfer128.c' || echo '$(srcdir)/'`io/transfer128.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/transfer128.Tpo $(DEPDIR)/transfer128.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='io/transfer128.c' object='transfer128.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transfer128.lo `test -f 'io/transfer128.c' || echo '$(srcdir)/'`io/transfer128.c
unit.lo: io/unit.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unit.lo -MD -MP -MF $(DEPDIR)/unit.Tpo -c -o unit.lo `test -f 'io/unit.c' || echo '$(srcdir)/'`io/unit.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unit.Tpo $(DEPDIR)/unit.Plo
@ -5578,6 +5606,26 @@ distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
install-toolexeclibDATA: $(toolexeclib_DATA)
@$(NORMAL_INSTALL)
test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
done
uninstall-toolexeclibDATA:
@$(NORMAL_UNINSTALL)
@list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(toolexeclibdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(toolexeclibdir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@ -5633,9 +5681,9 @@ distclean-tags:
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) all-multi config.h
all-am: Makefile $(LTLIBRARIES) all-multi $(DATA) config.h
installdirs:
for dir in "$(DESTDIR)$(myexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
for dir in "$(DESTDIR)$(myexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@ -5696,7 +5744,7 @@ install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-multi install-myexeclibLTLIBRARIES \
install-toolexeclibLTLIBRARIES
install-toolexeclibDATA install-toolexeclibLTLIBRARIES
install-html: install-html-am
@ -5738,7 +5786,7 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-myexeclibLTLIBRARIES \
uninstall-am: uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
uninstall-toolexeclibLTLIBRARIES
.MAKE: all all-multi check clean-multi distclean-multi install \
@ -5755,13 +5803,13 @@ uninstall-am: uninstall-myexeclibLTLIBRARIES \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-multi \
install-myexeclibLTLIBRARIES install-pdf install-pdf-am \
install-ps install-ps-am install-strip \
install-ps install-ps-am install-strip install-toolexeclibDATA \
install-toolexeclibLTLIBRARIES installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
maintainer-clean-multi mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-multi pdf \
pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-myexeclibLTLIBRARIES \
uninstall-myexeclibLTLIBRARIES uninstall-toolexeclibDATA \
uninstall-toolexeclibLTLIBRARIES
@LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@gfortran.map-sun : $(srcdir)/gfortran.map \

View File

@ -275,3 +275,79 @@ esac])
AC_DEFINE(HAVE_BROKEN_POWF, 1, [Define if powf is broken.])
fi
])
dnl Check whether we have a __float128 type
AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
LIBQUADSPEC=
AC_CACHE_CHECK([whether we have a usable __float128 type],
libgfor_cv_have_float128, [
AC_TRY_LINK([
/* no header */
],[
typedef _Complex float __attribute__((mode(TC))) __complex128;
__float128 x;
x = __builtin_huge_valq() - 2.e1000Q;
__complex128 z1, z2;
z1 = x;
z2 = 2.Q;
z1 /= z2;
z1 /= 7.Q;
],
libgfor_cv_have_float128=yes,
libgfor_cv_have_float128=no)
])
if test "x$libgfor_cv_have_float128" = xyes; then
AC_DEFINE(HAVE_FLOAT128, 1, [Define if have a usable __float128 type.])
dnl Check whether -Wl,--as-needed is supported
dnl
dnl Turn warnings into error to avoid testsuite breakage. So enable
dnl AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to turn
dnl it off again. As a workaround, save and restore werror flag like
dnl AC_PATH_XTRA.
dnl Cf. http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html
ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
AC_CACHE_CHECK([whether --as-needed works],
[libgfor_cv_have_as_needed],
[
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--as-needed -lm -Wl,--no-as-needed"
libgfor_cv_have_as_needed=no
AC_LANG_WERROR
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
[libgfor_cv_have_as_needed=yes],
[libgfor_cv_have_as_needed=no])
LDFLAGS="$save_LDFLAGS"
ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag
])
dnl For static libgfortran linkage, depend on libquadmath only if needed.
if test "x$libgfor_cv_have_as_needed" = xyes; then
LIBQUADSPEC="%{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed}"
else
LIBQUADSPEC="-lquadmath"
fi
if test -f ../libquadmath/libquadmath.la; then
LIBQUADLIB=../libquadmath/libquadmath.la
LIBQUADLIB_DEP=../libquadmath/libquadmath.la
LIBQUADINCLUDE='-I$(srcdir)/../libquadmath'
else
LIBQUADLIB="-lquadmath"
LIBQUADLIB_DEP=
LIBQUADINCLUDE=
fi
fi
dnl For the spec file
AC_SUBST(LIBQUADSPEC)
AC_SUBST(LIBQUADLIB)
AC_SUBST(LIBQUADLIB_DEP)
AC_SUBST(LIBQUADINCLUDE)
dnl We need a conditional for the Makefile
AM_CONDITIONAL(LIBGFOR_BUILD_QUAD, [test "x$libgfor_cv_have_float128" = xyes])
])

View File

@ -381,6 +381,9 @@
/* Define to 1 if you have the <fenv.h> header file. */
#undef HAVE_FENV_H
/* Define if have a usable __float128 type. */
#undef HAVE_FLOAT128
/* Define to 1 if you have the <floatingpoint.h> header file. */
#undef HAVE_FLOATINGPOINT_H

148
libgfortran/configure vendored
View File

@ -597,12 +597,19 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_c_werror_flag=
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
IEEE_FLAGS
FPU_HOST_HEADER
LIBGFOR_BUILD_QUAD_FALSE
LIBGFOR_BUILD_QUAD_TRUE
LIBQUADINCLUDE
LIBQUADLIB_DEP
LIBQUADLIB
LIBQUADSPEC
extra_ldflags_libgfortran
ac_ct_FC
FCFLAGS
@ -3408,6 +3415,9 @@ esac
# Create a spec file, so that compile/link tests don't fail
test -f libgfortran.spec || touch libgfortran.spec
# Check the compiler.
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
# We must force CC to /not/ be precious variables; otherwise
@ -11362,7 +11372,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11365 "configure"
#line 11375 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11468,7 +11478,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11471 "configure"
#line 11481 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -24286,6 +24296,131 @@ $as_echo "#define HAVE_BROKEN_POWF 1" >>confdefs.h
fi
# Check whether we have a __float128 type
LIBQUADSPEC=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a usable __float128 type" >&5
$as_echo_n "checking whether we have a usable __float128 type... " >&6; }
if test "${libgfor_cv_have_float128+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test x$gcc_no_link = xyes; then
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* no header */
int
main ()
{
typedef _Complex float __attribute__((mode(TC))) __complex128;
__float128 x;
x = __builtin_huge_valq() - 2.e1000Q;
__complex128 z1, z2;
z1 = x;
z2 = 2.Q;
z1 /= z2;
z1 /= 7.Q;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
libgfor_cv_have_float128=yes
else
libgfor_cv_have_float128=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_float128" >&5
$as_echo "$libgfor_cv_have_float128" >&6; }
if test "x$libgfor_cv_have_float128" = xyes; then
$as_echo "#define HAVE_FLOAT128 1" >>confdefs.h
ac_xsave_c_werror_flag=$ac_c_werror_flag
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether --as-needed works" >&5
$as_echo_n "checking whether --as-needed works... " >&6; }
if test "${libgfor_cv_have_as_needed+set}" = set; then :
$as_echo_n "(cached) " >&6
else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--as-needed -lm -Wl,--no-as-needed"
libgfor_cv_have_as_needed=no
ac_c_werror_flag=yes
if test x$gcc_no_link = xyes; then
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
libgfor_cv_have_as_needed=yes
else
libgfor_cv_have_as_needed=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
ac_c_werror_flag=$ac_xsave_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_as_needed" >&5
$as_echo "$libgfor_cv_have_as_needed" >&6; }
if test "x$libgfor_cv_have_as_needed" = xyes; then
LIBQUADSPEC="%{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed}"
else
LIBQUADSPEC="-lquadmath"
fi
if test -f ../libquadmath/libquadmath.la; then
LIBQUADLIB=../libquadmath/libquadmath.la
LIBQUADLIB_DEP=../libquadmath/libquadmath.la
LIBQUADINCLUDE='-I$(srcdir)/../libquadmath'
else
LIBQUADLIB="-lquadmath"
LIBQUADLIB_DEP=
LIBQUADINCLUDE=
fi
fi
if test "x$libgfor_cv_have_float128" = xyes; then
LIBGFOR_BUILD_QUAD_TRUE=
LIBGFOR_BUILD_QUAD_FALSE='#'
else
LIBGFOR_BUILD_QUAD_TRUE='#'
LIBGFOR_BUILD_QUAD_FALSE=
fi
# Check for GNU libc feenableexcept
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for feenableexcept in -lm" >&5
$as_echo_n "checking for feenableexcept in -lm... " >&6; }
@ -24832,8 +24967,8 @@ else
multilib_arg=
fi
# Write our Makefile.
ac_config_files="$ac_config_files Makefile"
# Write our Makefile and spec file.
ac_config_files="$ac_config_files Makefile libgfortran.spec"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -24968,6 +25103,10 @@ if test -z "${LIBGFOR_USE_SYMVER_SUN_TRUE}" && test -z "${LIBGFOR_USE_SYMVER_SUN
as_fn_error "conditional \"LIBGFOR_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGFOR_BUILD_QUAD_TRUE}" && test -z "${LIBGFOR_BUILD_QUAD_FALSE}"; then
as_fn_error "conditional \"LIBGFOR_BUILD_QUAD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@ -25961,6 +26100,7 @@ do
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"libgfortran.spec") CONFIG_FILES="$CONFIG_FILES libgfortran.spec" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@ -111,6 +111,9 @@ esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
# Create a spec file, so that compile/link tests don't fail
test -f libgfortran.spec || touch libgfortran.spec
# Check the compiler.
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
# We must force CC to /not/ be precious variables; otherwise
@ -459,6 +462,9 @@ LIBGFOR_CHECK_MINGW_SNPRINTF
# Check for a broken powf implementation
LIBGFOR_CHECK_FOR_BROKEN_POWF
# Check whether we have a __float128 type
LIBGFOR_CHECK_FLOAT128
# Check for GNU libc feenableexcept
AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
@ -509,6 +515,9 @@ else
multilib_arg=
fi
# Write our Makefile.
AC_CONFIG_FILES(Makefile)
# Write our Makefile and spec file.
AC_CONFIG_FILES([
Makefile
libgfortran.spec
])
AC_OUTPUT

View File

@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname)
#if defined (HAVE_GFC_REAL_10)

View File

@ -35,12 +35,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#else
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined(GFC_REAL_16_IS_FLOAT128)
#define BUILTINMATHFUNC(funcname) funcname ## q
#else
#define BUILTINMATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16)
#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_JNL))
#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_JNL))
extern void bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1,
int n2, GFC_REAL_16 x);
export_proto(bessel_jn_r16);
@ -107,7 +112,7 @@ bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x
#endif
#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_YNL))
#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_YNL))
extern void bessel_yn_r16 (gfc_array_r16 * const restrict ret,
int n1, int n2, GFC_REAL_16 x);
export_proto(bessel_yn_r16);

View File

@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## f
#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname)
#if defined (HAVE_GFC_REAL_4)

View File

@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname
#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname)
#if defined (HAVE_GFC_REAL_8)

View File

@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL))
extern GFC_INTEGER_4 exponent_r16 (GFC_REAL_16 s);
export_proto(exponent_r16);

View File

@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL))
extern GFC_REAL_16 fraction_r16 (GFC_REAL_16 s);
export_proto(fraction_r16);

View File

@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_COPYSIGNL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_NEXTAFTERL))
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_COPYSIGNL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_NEXTAFTERL))
extern GFC_REAL_16 nearest_r16 (GFC_REAL_16 s, GFC_REAL_16 dir);
export_proto(nearest_r16);

View File

@ -33,6 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10) && defined (HAVE_SQRTL) && defined (HAVE_FABSL)
#define MATHFUNC(funcname) funcname ## l
#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname)
extern void norm2_r10 (gfc_array_r10 * const restrict,

View File

@ -30,13 +30,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_SQRTL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FABSL))
#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_SQRTL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FABSL))
#if defined(GFC_REAL_16_IS_FLOAT128)
#define MATHFUNC(funcname) funcname ## q
#else
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined(GFC_REAL_16_IS_FLOAT128)
#define BUILTINMATHFUNC(funcname) funcname ## q
#else
#define BUILTINMATHFUNC(funcname) funcname ## l
#endif
extern void norm2_r16 (gfc_array_r16 * const restrict,

View File

@ -33,6 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4) && defined (HAVE_SQRTF) && defined (HAVE_FABSF)
#define MATHFUNC(funcname) funcname ## f
#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname)
extern void norm2_r4 (gfc_array_r4 * const restrict,

View File

@ -33,6 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8) && defined (HAVE_SQRT) && defined (HAVE_FABS)
#define MATHFUNC(funcname) funcname
#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname)
extern void norm2_r8 (gfc_array_r8 * const restrict,

View File

@ -0,0 +1,75 @@
/* Support routines for the intrinsic power (**) operator.
Copyright 2004, 2007, 2009 Free Software Foundation, Inc.
Contributed by Paul Brook
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
Libgfortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
/* Use Binary Method to calculate the powi. This is not an optimal but
a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
of Computer Programming", 3rd Edition, 1998. */
#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4)
GFC_REAL_16 pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b);
export_proto(pow_r16_i4);
GFC_REAL_16
pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b)
{
GFC_REAL_16 pow, x;
GFC_INTEGER_4 n;
GFC_UINTEGER_4 u;
n = b;
x = a;
pow = 1;
if (n != 0)
{
if (n < 0)
{
u = -n;
x = pow / x;
}
else
{
u = n;
}
for (;;)
{
if (u & 1)
pow *= x;
u >>= 1;
if (u)
x *= x;
else
break;
}
}
return pow;
}
#endif

View File

@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FABSL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FABSL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL))
extern GFC_REAL_16 rrspacing_r16 (GFC_REAL_16 s, int p);
export_proto(rrspacing_r16);
@ -47,7 +47,7 @@ rrspacing_r16 (GFC_REAL_16 s, int p)
if (x == 0.)
return 0.;
MATHFUNC(frexp) (s, &e);
#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_LDEXPL))
#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_LDEXPL))
return MATHFUNC(ldexp) (x, p - e);
#else
return MATHFUNC(scalbn) (x, p - e);

View File

@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_SCALBNL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_SCALBNL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL))
extern GFC_REAL_16 set_exponent_r16 (GFC_REAL_16 s, GFC_INTEGER_4 i);
export_proto(set_exponent_r16);

View File

@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MATHFUNC(funcname) funcname ## l
#endif
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL))
#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL))
extern GFC_REAL_16 spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny);
export_proto(spacing_r16);
@ -47,7 +47,7 @@ spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny)
MATHFUNC(frexp) (s, &e);
e = e - p;
e = e > emin ? e : emin;
#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_LDEXPL))
#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_LDEXPL))
return MATHFUNC(ldexp) (1., e);
#else
return MATHFUNC(scalbn) (1., e);

View File

@ -528,6 +528,7 @@ GFORTRAN_1.0 {
_gfortran_pow_r10_i16;
_gfortran_pow_r10_i8;
_gfortran_pow_r16_i16;
_gfortran_pow_r16_i4;
_gfortran_pow_r16_i8;
_gfortran_pow_r4_i16;
_gfortran_pow_r4_i8;
@ -1146,9 +1147,13 @@ GFORTRAN_1.4 {
_gfortran_transfer_character_write;
_gfortran_transfer_character_wide_write;
_gfortran_transfer_complex_write;
_gfortran_transfer_complex128;
_gfortran_transfer_complex128_write;
_gfortran_transfer_integer_write;
_gfortran_transfer_logical_write;
_gfortran_transfer_real_write;
_gfortran_transfer_real128;
_gfortran_transfer_real128_write;
} GFORTRAN_1.3;
F2C_1.0 {

View File

@ -134,18 +134,26 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
cshift0_r8 ((gfc_array_r8 *)ret, (gfc_array_r8 *) array, shift, which);
return;
#ifdef HAVE_GFC_REAL_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_REAL_10
case GFC_DTYPE_REAL_10:
cshift0_r10 ((gfc_array_r10 *)ret, (gfc_array_r10 *) array, shift,
which);
return;
#endif
# endif
#ifdef HAVE_GFC_REAL_16
# ifdef HAVE_GFC_REAL_16
case GFC_DTYPE_REAL_16:
cshift0_r16 ((gfc_array_r16 *)ret, (gfc_array_r16 *) array, shift,
which);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
@ -156,18 +164,26 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
cshift0_c8 ((gfc_array_c8 *)ret, (gfc_array_c8 *) array, shift, which);
return;
#ifdef HAVE_GFC_COMPLEX_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_COMPLEX_10
case GFC_DTYPE_COMPLEX_10:
cshift0_c10 ((gfc_array_c10 *)ret, (gfc_array_c10 *) array, shift,
which);
return;
#endif
# endif
#ifdef HAVE_GFC_COMPLEX_16
# ifdef HAVE_GFC_COMPLEX_16
case GFC_DTYPE_COMPLEX_16:
cshift0_c16 ((gfc_array_c16 *)ret, (gfc_array_c16 *) array, shift,
which);
return;
# endif
#endif
default:

View File

@ -39,7 +39,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define EXP(x) exp(x)
# define TRUNC(x) trunc(x)
#else
#elif (KIND == 10) || (KIND == 16 && defined(GFC_REAL_16_IS_LONG_DOUBLE))
# ifdef HAVE_EXPL
# define EXP(x) expl(x)
@ -48,6 +48,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define TRUNC(x) truncl(x)
# endif
#elif (KIND == 16 && defined(GFC_REAL_16_IS_FLOAT128))
# define EXP(x) expq(x)
# define TRUNC(x) truncq(x)
#else
# error "What exactly is it that you want me to do?"
#endif
#if defined(EXP) && defined(TRUNC)

View File

@ -301,18 +301,26 @@ pack (gfc_array_char *ret, const gfc_array_char *array,
(gfc_array_l1 *) mask, (gfc_array_r8 *) vector);
return;
#ifdef HAVE_GFC_REAL_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_REAL_10
case GFC_DTYPE_REAL_10:
pack_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) array,
(gfc_array_l1 *) mask, (gfc_array_r10 *) vector);
return;
#endif
# endif
#ifdef HAVE_GFC_REAL_16
# ifdef HAVE_GFC_REAL_16
case GFC_DTYPE_REAL_16:
pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array,
(gfc_array_l1 *) mask, (gfc_array_r16 *) vector);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
@ -325,18 +333,26 @@ pack (gfc_array_char *ret, const gfc_array_char *array,
(gfc_array_l1 *) mask, (gfc_array_c8 *) vector);
return;
#ifdef HAVE_GFC_COMPLEX_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_COMPLEX_10
case GFC_DTYPE_COMPLEX_10:
pack_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) array,
(gfc_array_l1 *) mask, (gfc_array_c10 *) vector);
return;
#endif
# endif
#ifdef HAVE_GFC_COMPLEX_16
# ifdef HAVE_GFC_COMPLEX_16
case GFC_DTYPE_COMPLEX_16:
pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array,
(gfc_array_l1 *) mask, (gfc_array_c16 *) vector);
return;
# endif
#endif
/* For derived types, let's check the actual alignment of the

View File

@ -322,18 +322,26 @@ spread (gfc_array_char *ret, const gfc_array_char *source,
*along, *pncopies);
return;
#ifdef GFC_HAVE_REAL_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef GFC_HAVE_REAL_10
case GFC_DTYPE_REAL_10:
spread_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) source,
*along, *pncopies);
return;
#endif
# endif
#ifdef GFC_HAVE_REAL_16
# ifdef GFC_HAVE_REAL_16
case GFC_DTYPE_REAL_16:
spread_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) source,
*along, *pncopies);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
@ -346,18 +354,26 @@ spread (gfc_array_char *ret, const gfc_array_char *source,
*along, *pncopies);
return;
#ifdef GFC_HAVE_COMPLEX_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef GFC_HAVE_COMPLEX_10
case GFC_DTYPE_COMPLEX_10:
spread_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) source,
*along, *pncopies);
return;
#endif
# endif
#ifdef GFC_HAVE_COMPLEX_16
# ifdef GFC_HAVE_COMPLEX_16
case GFC_DTYPE_COMPLEX_16:
spread_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) source,
*along, *pncopies);
return;
# endif
#endif
case GFC_DTYPE_DERIVED_2:
@ -501,18 +517,26 @@ spread_scalar (gfc_array_char *ret, const char *source,
*along, *pncopies);
return;
#ifdef HAVE_GFC_REAL_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_REAL_10
case GFC_DTYPE_REAL_10:
spread_scalar_r10 ((gfc_array_r10 *) ret, (GFC_REAL_10 *) source,
*along, *pncopies);
return;
#endif
# endif
#ifdef HAVE_GFC_REAL_16
# ifdef HAVE_GFC_REAL_16
case GFC_DTYPE_REAL_16:
spread_scalar_r16 ((gfc_array_r16 *) ret, (GFC_REAL_16 *) source,
*along, *pncopies);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
@ -525,18 +549,26 @@ spread_scalar (gfc_array_char *ret, const char *source,
*along, *pncopies);
return;
#ifdef HAVE_GFC_COMPLEX_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_COMPLEX_10
case GFC_DTYPE_COMPLEX_10:
spread_scalar_c10 ((gfc_array_c10 *) ret, (GFC_COMPLEX_10 *) source,
*along, *pncopies);
return;
#endif
# endif
#ifdef HAVE_GFC_COMPLEX_16
# ifdef HAVE_GFC_COMPLEX_16
case GFC_DTYPE_COMPLEX_16:
spread_scalar_c16 ((gfc_array_c16 *) ret, (GFC_COMPLEX_16 *) source,
*along, *pncopies);
return;
# endif
#endif
case GFC_DTYPE_DERIVED_2:

View File

@ -261,18 +261,26 @@ unpack1 (gfc_array_char *ret, const gfc_array_char *vector,
mask, (gfc_array_r8 *) field);
return;
#ifdef HAVE_GFC_REAL_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_REAL_10
case GFC_DTYPE_REAL_10:
unpack1_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector,
mask, (gfc_array_r10 *) field);
return;
#endif
# endif
#ifdef HAVE_GFC_REAL_16
# ifdef HAVE_GFC_REAL_16
case GFC_DTYPE_REAL_16:
unpack1_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector,
mask, (gfc_array_r16 *) field);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
@ -285,18 +293,26 @@ unpack1 (gfc_array_char *ret, const gfc_array_char *vector,
mask, (gfc_array_c8 *) field);
return;
#ifdef HAVE_GFC_COMPLEX_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_COMPLEX_10
case GFC_DTYPE_COMPLEX_10:
unpack1_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector,
mask, (gfc_array_c10 *) field);
return;
#endif
# endif
#ifdef HAVE_GFC_COMPLEX_16
# ifdef HAVE_GFC_COMPLEX_16
case GFC_DTYPE_COMPLEX_16:
unpack1_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector,
mask, (gfc_array_c16 *) field);
return;
# endif
#endif
case GFC_DTYPE_DERIVED_2:
@ -455,18 +471,26 @@ unpack0 (gfc_array_char *ret, const gfc_array_char *vector,
mask, (GFC_REAL_8 *) field);
return;
#ifdef HAVE_GFC_REAL_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_REAL_10
case GFC_DTYPE_REAL_10:
unpack0_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector,
mask, (GFC_REAL_10 *) field);
return;
#endif
# endif
#ifdef HAVE_GFC_REAL_16
# ifdef HAVE_GFC_REAL_16
case GFC_DTYPE_REAL_16:
unpack0_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector,
mask, (GFC_REAL_16 *) field);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
@ -479,18 +503,26 @@ unpack0 (gfc_array_char *ret, const gfc_array_char *vector,
mask, (GFC_COMPLEX_8 *) field);
return;
#ifdef HAVE_GFC_COMPLEX_10
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# ifdef HAVE_GFC_COMPLEX_10
case GFC_DTYPE_COMPLEX_10:
unpack0_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector,
mask, (GFC_COMPLEX_10 *) field);
return;
#endif
# endif
#ifdef HAVE_GFC_COMPLEX_16
# ifdef HAVE_GFC_COMPLEX_16
case GFC_DTYPE_COMPLEX_16:
unpack0_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector,
mask, (GFC_COMPLEX_16 *) field);
return;
# endif
#endif
case GFC_DTYPE_DERIVED_2:

View File

@ -162,10 +162,16 @@ convert_real (st_parameter_dt *dtp, void *dest, const char *buffer, int length)
break;
#endif
#if defined(HAVE_GFC_REAL_16) && defined (HAVE_STRTOLD)
#if defined(HAVE_GFC_REAL_16)
# if defined(GFC_REAL_16_IS_FLOAT128)
case 16:
__qmath_(quadmath_strtopQ) (buffer, NULL, dest);
break;
# elif defined(HAVE_STRTOLD)
case 16:
*((GFC_REAL_16*) dest) = gfc_strtold (buffer, NULL);
break;
# endif
#endif
default:

View File

@ -48,7 +48,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
For other sorts of data transfer, there are zero or more data
transfer statement that depend on the format of the data transfer
statement.
statement. For READ (and for backwards compatibily: for WRITE), one has
transfer_integer
transfer_logical
@ -56,8 +56,22 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
transfer_character_wide
transfer_real
transfer_complex
transfer_real128
transfer_complex128
and for WRITE
These subroutines do not return status.
transfer_integer_write
transfer_logical_write
transfer_character_write
transfer_character_wide_write
transfer_real_write
transfer_complex_write
transfer_real128_write
transfer_complex128_write
These subroutines do not return status. The *128 functions
are in the file transfer128.c.
The last call is a call to st_[read|write]_done(). While
something can easily go wrong with the initial st_read() or

View File

@ -0,0 +1,108 @@
/* Copyright (C) 2010
Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
Libgfortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Note: This file needs to be a separate translation unit (.o file)
to make sure that for static linkage, the libquad dependence only
occurs if needed. */
#include "io.h"
#if defined(GFC_REAL_16_IS_FLOAT128)
/* The prototypes for the called procedures in transfer.c. */
extern void transfer_real (st_parameter_dt *, void *, int);
export_proto(transfer_real);
extern void transfer_real_write (st_parameter_dt *, void *, int);
export_proto(transfer_real_write);
extern void transfer_complex (st_parameter_dt *, void *, int);
export_proto(transfer_complex);
extern void transfer_complex_write (st_parameter_dt *, void *, int);
export_proto(transfer_complex_write);
/* The prototypes for the procedures in this file. */
extern void transfer_real128 (st_parameter_dt *, void *, int);
export_proto(transfer_real128);
extern void transfer_real128_write (st_parameter_dt *, void *, int);
export_proto(transfer_real128_write);
extern void transfer_complex128 (st_parameter_dt *, void *, int);
export_proto(transfer_complex128);
extern void transfer_complex128_write (st_parameter_dt *, void *, int);
export_proto(transfer_complex128_write);
/* Make sure that libquadmath is pulled in. The functions quadmath_strtopQ
and quadmath_dtoaq are weakly referrenced in convert_real and write_float;
the pointer assignment with USED attribute make sure that there is a
non-weakref dependence if the quadmath functions are used. That avoids
segfault when libquad is statically linked. */
void
transfer_real128 (st_parameter_dt *dtp, void *p, int kind)
{
static void __attribute__((used)) *tmp1 = quadmath_strtopQ;
static void __attribute__((used)) *tmp2 = quadmath_dtoaq;
transfer_real (dtp, p, kind);
}
void
transfer_real128_write (st_parameter_dt *dtp, void *p, int kind)
{
static void __attribute__((used)) *tmp1 = quadmath_strtopQ;
static void __attribute__((used)) *tmp2 = quadmath_dtoaq;
transfer_real (dtp, p, kind);
}
void
transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
{
static void __attribute__((used)) *tmp1 = quadmath_strtopQ;
static void __attribute__((used)) *tmp2 = quadmath_dtoaq;
transfer_complex (dtp, p, kind);
}
void
transfer_complex128_write (st_parameter_dt *dtp, void *p, int kind)
{
/* static void __attribute__((used)) *tmp1 = quadmath_strtopQ;
static void __attribute__((used)) *tmp2 = quadmath_dtoaq;*/
transfer_complex_write (dtp, p, kind);
}
#endif

View File

@ -1459,6 +1459,7 @@ set_fnode_default (st_parameter_dt *dtp, fnode *f, int length)
/* Output a real number with default format.
This is 1PG14.7E2 for REAL(4), 1PG23.15E3 for REAL(8),
1PG28.19E4 for REAL(10) and 1PG43.34E4 for REAL(16). */
// FX -- FIXME: should we change the default format for __float128-real(16)?
void
write_real (st_parameter_dt *dtp, const char *source, int length)

View File

@ -973,6 +973,11 @@ sprintf (buffer, "%+-#" STR(MIN_FIELD_WIDTH) ".*" \
#endif
#if defined(GFC_REAL_16_IS_FLOAT128)
#define DTOAQ \
__qmath_(quadmath_dtoaq) (buffer, size, ndigits - 1, tmp);
#endif
#define WRITE_FLOAT(x,y)\
{\
GFC_REAL_ ## x tmp;\
@ -1002,7 +1007,7 @@ static void
write_float (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
{
#if defined(HAVE_GFC_REAL_16) && __LDBL_DIG__ > 18
#if defined(HAVE_GFC_REAL_16) || __LDBL_DIG__ > 18
# define MIN_FIELD_WIDTH 46
#else
# define MIN_FIELD_WIDTH 31
@ -1057,7 +1062,11 @@ write_float (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
#endif
#ifdef HAVE_GFC_REAL_16
case 16:
# ifdef GFC_REAL_16_IS_FLOAT128
WRITE_FLOAT(16,Q)
# else
WRITE_FLOAT(16,L)
# endif
break;
#endif
default:

View File

@ -0,0 +1,46 @@
/* Header used to override things detected by the mk-kinds-h.sh script.
Copyright (C) 2010 Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
Libgfortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* What are the C types corresponding to the real(kind=10) and
real(kind=16) types? We currently rely on the following assumptions:
-- if real(kind=10) exists, i.e. if HAVE_GFC_REAL_10 is defined,
then it is necessarily the "long double" type
-- if real(kind=16) exists, then:
* if HAVE_GFC_REAL_10, real(kind=16) is "__float128"
* otherwise, real(kind=16) is "long double"
To allow to change this in the future, we create the
GFC_REAL_16_IS_FLOAT128 macro that is used throughout libgfortran. */
#if defined(HAVE_GFC_REAL_16)
# if defined(HAVE_GFC_REAL_10)
# define GFC_REAL_16_IS_FLOAT128
# if !defined(HAVE_FLOAT128)
# error "Where has __float128 gone?"
# endif
# else
# define GFC_REAL_16_IS_LONG_DOUBLE
# endif
#endif

View File

@ -46,6 +46,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <float.h>
#include <stdarg.h>
/* If we're support quad-precision floating-point type, include the
header to our support library. */
#ifdef HAVE_FLOAT128
# include "quadmath_weak.h"
#endif
#ifdef __MINGW32__
extern float __strtof (const char *, char **);
#define gfc_strtof __strtof
@ -309,7 +315,11 @@ internal_proto(big_endian);
# define GFC_REAL_10_INFINITY __builtin_infl ()
# endif
# ifdef HAVE_GFC_REAL_16
# define GFC_REAL_16_INFINITY __builtin_infl ()
# ifdef GFC_REAL_16_IS_LONG_DOUBLE
# define GFC_REAL_16_INFINITY __builtin_infl ()
# else
# define GFC_REAL_16_INFINITY __builtin_infq ()
# endif
# endif
#endif
#ifdef __FLT_HAS_QUIET_NAN__
@ -323,7 +333,11 @@ internal_proto(big_endian);
# define GFC_REAL_10_QUIET_NAN __builtin_nanl ("")
# endif
# ifdef HAVE_GFC_REAL_16
# define GFC_REAL_16_QUIET_NAN __builtin_nanl ("")
# ifdef GFC_REAL_16_IS_LONG_DOUBLE
# define GFC_REAL_16_QUIET_NAN __builtin_nanl ("")
# else
# define GFC_REAL_16_QUIET_NAN nanq ("")
# endif
# endif
#endif

View File

@ -0,0 +1,8 @@
#
# This spec file is read by gfortran when linking.
# It is used to specify the libraries we need to link in, in the right
# order.
#
%rename lib liborig
*lib: @LIBQUADSPEC@ -lm %(libgcc) %(liborig)

View File

@ -5,7 +5,7 @@ define(real_type, `GFC_REAL_'kind)dnl
define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl
define(q,ifelse(kind,4,f,ifelse(kind,8,`',ifelse(kind,10,l,ifelse(kind,16,l,`_'kind)))))dnl
define(Q,translit(q,`a-z',`A-Z'))dnl
define(hasmathfunc,`ifelse(kind,4,`defined (HAVE_'upcase($1)`F)',ifelse(kind,8,`defined (HAVE_'upcase($1)`)',ifelse(kind,10,`defined (HAVE_'upcase($1)`L)',ifelse(kind,16,`(defined(GFC_WITH_QUAD_LIB) || defined(HAVE_'upcase($1)`L))',`error out'))))')
define(hasmathfunc,`ifelse(kind,4,`defined (HAVE_'upcase($1)`F)',ifelse(kind,8,`defined (HAVE_'upcase($1)`)',ifelse(kind,10,`defined (HAVE_'upcase($1)`L)',ifelse(kind,16,`(defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_'upcase($1)`L))',`error out'))))')
define(mathfunc_macro,`ifelse(kind,16,`#if defined(GFC_REAL_16_IS_FLOAT128)
#define MATHFUNC(funcname) funcname ## q
#else

View File

@ -44,7 +44,14 @@ echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
echo "#define GFC_DEFAULT_CHAR ${smallest}"
echo ""
REAL_10_FOUND=
# Get the kind value for long double, so we may disambiguate it
# from __float128.
echo "use iso_c_binding; print *, c_long_double ; end" > tmq$$.f90
long_double_kind=`$compile -S -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
| sed 's/ *TRANSFER *//'`
rm -f tmq$$.*
for k in $possible_real_kinds; do
echo " real (kind=$k) :: x" > tmp$$.f90
@ -52,17 +59,18 @@ for k in $possible_real_kinds; do
echo " end" >> tmp$$.f90
if $compile -S tmp$$.f90 > /dev/null 2>&1; then
case $k in
4) ctype="float" ; suffix="f" ;;
8) ctype="double" ; suffix="" ;;
10) ctype="long double" ; suffix="l" ; REAL_10_FOUND=1 ;;
16) ctype="long double"
suffix="l"
# Disable REAL(16) if it is just __float128
# until the library is fixed
if [ -n "$REAL_10_FOUND" ]; then
continue
fi
;;
4) ctype="float" ; cplxtype="complex float" ; suffix="f" ;;
8) ctype="double" ; cplxtype="complex double" ; suffix="" ;;
10) ctype="long double" ; cplxtype="complex long double" ; suffix="l" ;;
16) if [ $long_double_kind -eq 10 ]; then
ctype="__float128"
cplxtype="_Complex float __attribute__((mode(TC)))"
suffix="q"
else
ctype="long double"
cplxtype="complex long double"
suffix="l"
fi ;;
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
esac
@ -86,7 +94,7 @@ for k in $possible_real_kinds; do
# Output the information we've gathered
echo "typedef ${ctype} GFC_REAL_${k};"
echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
echo "typedef ${cplxtype} GFC_COMPLEX_${k};"
echo "#define HAVE_GFC_REAL_${k}"
echo "#define HAVE_GFC_COMPLEX_${k}"
echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
@ -103,4 +111,9 @@ for k in $possible_real_kinds; do
rm -f tmp$$.*
done
# After this, we include a header that can override some of the
# autodetected settings.
echo '#include "kinds-override.h"'
exit 0

View File

@ -80,29 +80,46 @@ internal_pack (gfc_array_char * source)
case GFC_DTYPE_REAL_8:
return internal_pack_r8 ((gfc_array_r8 *) source);
#if defined (HAVE_GFC_REAL_10)
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# if defined (HAVE_GFC_REAL_10)
case GFC_DTYPE_REAL_10:
return internal_pack_r10 ((gfc_array_r10 *) source);
#endif
# endif
#if defined (HAVE_GFC_REAL_16)
# if defined (HAVE_GFC_REAL_16)
case GFC_DTYPE_REAL_16:
return internal_pack_r16 ((gfc_array_r16 *) source);
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
return internal_pack_c4 ((gfc_array_c4 *) source);
case GFC_DTYPE_COMPLEX_8:
return internal_pack_c8 ((gfc_array_c8 *) source);
#if defined (HAVE_GFC_COMPLEX_10)
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# if defined (HAVE_GFC_COMPLEX_10)
case GFC_DTYPE_COMPLEX_10:
return internal_pack_c10 ((gfc_array_c10 *) source);
#endif
# endif
#if defined (HAVE_GFC_COMPLEX_16)
# if defined (HAVE_GFC_COMPLEX_16)
case GFC_DTYPE_COMPLEX_16:
return internal_pack_c16 ((gfc_array_c16 *) source);
# endif
#endif
case GFC_DTYPE_DERIVED_2:

View File

@ -81,6 +81,7 @@ internal_unpack (gfc_array_char * d, const void * s)
internal_unpack_16 ((gfc_array_i16 *) d, (const GFC_INTEGER_16 *) s);
return;
#endif
case GFC_DTYPE_REAL_4:
internal_unpack_r4 ((gfc_array_r4 *) d, (const GFC_REAL_4 *) s);
return;
@ -89,17 +90,26 @@ internal_unpack (gfc_array_char * d, const void * s)
internal_unpack_r8 ((gfc_array_r8 *) d, (const GFC_REAL_8 *) s);
return;
#if defined(HAVE_GFC_REAL_10)
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# if defined(HAVE_GFC_REAL_10)
case GFC_DTYPE_REAL_10:
internal_unpack_r10 ((gfc_array_r10 *) d, (const GFC_REAL_10 *) s);
return;
#endif
# endif
#if defined(HAVE_GFC_REAL_16)
# if defined(HAVE_GFC_REAL_16)
case GFC_DTYPE_REAL_16:
internal_unpack_r16 ((gfc_array_r16 *) d, (const GFC_REAL_16 *) s);
return;
# endif
#endif
case GFC_DTYPE_COMPLEX_4:
internal_unpack_c4 ((gfc_array_c4 *)d, (const GFC_COMPLEX_4 *)s);
return;
@ -108,17 +118,26 @@ internal_unpack (gfc_array_char * d, const void * s)
internal_unpack_c8 ((gfc_array_c8 *)d, (const GFC_COMPLEX_8 *)s);
return;
#if defined(HAVE_GFC_COMPLEX_10)
/* FIXME: This here is a hack, which will have to be removed when
the array descriptor is reworked. Currently, we don't store the
kind value for the type, but only the size. Because on targets with
__float128, we have sizeof(logn double) == sizeof(__float128),
we cannot discriminate here and have to fall back to the generic
handling (which is suboptimal). */
#if !defined(GFC_REAL_16_IS_FLOAT128)
# if defined(HAVE_GFC_COMPLEX_10)
case GFC_DTYPE_COMPLEX_10:
internal_unpack_c10 ((gfc_array_c10 *) d, (const GFC_COMPLEX_10 *) s);
return;
#endif
# endif
#if defined(HAVE_GFC_COMPLEX_16)
# if defined(HAVE_GFC_COMPLEX_16)
case GFC_DTYPE_COMPLEX_16:
internal_unpack_c16 ((gfc_array_c16 *) d, (const GFC_COMPLEX_16 *) s);
return;
# endif
#endif
case GFC_DTYPE_DERIVED_2:
if (GFC_UNALIGNED_2(d->data) || GFC_UNALIGNED_2(s))
break;

View File

@ -1,3 +1,10 @@
2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
* configure.ac:
* configure: Regenerate.
2010-10-06 Marcus Shawcroft <marcus.shawcroft@arm.com>
* config/linux/futex.h: New.

6
libgomp/configure vendored
View File

@ -11459,6 +11459,10 @@ fi
# Create a spec file, so that compile/link tests don't fail
test -f libgfortran.spec || touch libgfortran.spec
FCFLAGS="$FCFLAGS -L."
# We need gfortran to compile parts of the library
# We can't use AC_PROG_FC because it expects a fully working gfortran.
#AC_PROG_FC(gfortran)
@ -14377,7 +14381,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
FCFLAGS="$FCFLAGS -Wall"
FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0

View File

@ -140,6 +140,10 @@ AC_SUBST(enable_static)
AM_MAINTAINER_MODE
# Create a spec file, so that compile/link tests don't fail
test -f libgfortran.spec || touch libgfortran.spec
FCFLAGS="$FCFLAGS -L."
# We need gfortran to compile parts of the library
# We can't use AC_PROG_FC because it expects a fully working gfortran.
#AC_PROG_FC(gfortran)
@ -155,7 +159,7 @@ case `echo $GFORTRAN` in
fi ;;
esac
AC_PROG_FC(gfortran)
FCFLAGS="$FCFLAGS -Wall"
FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0

504
libquadmath/COPYING.LIB Normal file
View File

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

5
libquadmath/ChangeLog Normal file
View File

@ -0,0 +1,5 @@
2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
Initial implementation and checkin.

70
libquadmath/Makefile.am Normal file
View File

@ -0,0 +1,70 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = 1.8 foreign
## Skip over everything if the quadlib is not available:
if BUILD_LIBQUADMATH
ACLOCAL_AMFLAGS = -I .. -I ../config
## May be used by toolexeclibdir.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
## Symbol versioning (copied from libssp).
if LIBQUAD_USE_SYMVER
if LIBQUAD_USE_SYMVER_GNU
version_arg = -Wl,--version-script=$(srcdir)/quadmath.map
version_dep = $(srcdir)/quadmath.map
endif
if LIBQUAD_USE_SYMVER_SUN
version_arg = -Wl,-M,quadmath.map-sun
version_dep = quadmath.map-sun
quadmath.map-sun : $(srcdir)/quadmath.map \
$(top_srcdir)/../contrib/make_sunver.pl \
$(libquadmath_la_OBJECTS) $(libquadmath_la_LIBADD)
perl $(top_srcdir)/../contrib/make_sunver.pl \
$(srcdir)/quadmath.map \
$(libquadmath_la_OBJECTS:%.lo=.libs/%.o) \
`echo $(libquadmath_la_LIBADD) | \
sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
> $@ || (rm -f $@ ; exit 1)
endif
else
version_arg =
version_dep =
endif
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
-no-undefined
toolexeclib_LTLIBRARIES = libquadmath.la
libquadmath_la_LIBADD = -lm
libquadmath_la_LDFLAGS = $(LTLDFLAGS) -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(version_arg)
libquadmath_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
libquadmath_la_DEPENDENCIES = $(version_dep)
include_HEADERS = quadmath.h quadmath_weak.h
libquadmath_la_SOURCES = \
gdtoa/arith.h gdtoa/gdtoa_fltrnds.h gdtoa/gd_qnan.h gdtoa/gdtoaimp.h \
gdtoa/gdtoa.h quadmath-imp.h \
gdtoa/dmisc.c gdtoa/gdtoa.c gdtoa/hd_init.c gdtoa/smisc.c gdtoa/sum.c \
gdtoa/g_Qfmt.c gdtoa/gethex.c gdtoa/hexnan.c gdtoa/strtodg.c \
gdtoa/ulp.c gdtoa/g__fmt.c gdtoa/gmisc.c gdtoa/misc.c gdtoa/strtopQ.c \
quadmath_io.c \
math/acoshq.c math/fmodq.c math/acosq.c math/frexpq.c \
math/rem_pio2q.c math/asinhq.c math/hypotq.c math/remainderq.c \
math/asinq.c math/rintq.c math/atan2q.c math/isinfq.c \
math/roundq.c math/atanhq.c math/isnanq.c math/scalblnq.c math/atanq.c \
math/j0q.c math/scalbnq.c math/cbrtq.c math/j1q.c math/signbitq.c \
math/ceilq.c math/jnq.c math/sincos_table.c math/complex.c math/ldexpq.c \
math/sincosq.c math/copysignq.c math/lgammaq.c math/sincosq_kernel.c \
math/coshq.c math/llroundq.c math/sinhq.c math/cosq.c math/log10q.c \
math/sinq.c math/cosq_kernel.c math/log1pq.c math/sinq_kernel.c \
math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
math/truncq.c math/floorq.c math/powq.c
endif

981
libquadmath/Makefile.in Normal file
View File

@ -0,0 +1,981 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@BUILD_LIBQUADMATH_FALSE@libquadmath_la_DEPENDENCIES =
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in $(srcdir)/../mkinstalldirs \
$(srcdir)/../depcomp $(am__include_HEADERS_DIST)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(includedir)"
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
am__dirstamp = $(am__leading_dot)dirstamp
@BUILD_LIBQUADMATH_TRUE@am_libquadmath_la_OBJECTS = gdtoa/dmisc.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/gdtoa.lo gdtoa/hd_init.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/smisc.lo gdtoa/sum.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/g_Qfmt.lo gdtoa/gethex.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/hexnan.lo gdtoa/strtodg.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/ulp.lo gdtoa/g__fmt.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/gmisc.lo gdtoa/misc.lo \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/strtopQ.lo quadmath_io.lo \
@BUILD_LIBQUADMATH_TRUE@ math/acoshq.lo math/fmodq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/acosq.lo math/frexpq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/rem_pio2q.lo math/asinhq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/hypotq.lo math/remainderq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/asinq.lo math/rintq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/atan2q.lo math/isinfq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/roundq.lo math/atanhq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/isnanq.lo math/scalblnq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/atanq.lo math/j0q.lo \
@BUILD_LIBQUADMATH_TRUE@ math/scalbnq.lo math/cbrtq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/j1q.lo math/signbitq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/ceilq.lo math/jnq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/sincos_table.lo math/complex.lo \
@BUILD_LIBQUADMATH_TRUE@ math/ldexpq.lo math/sincosq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/copysignq.lo math/lgammaq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/sincosq_kernel.lo math/coshq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/llroundq.lo math/sinhq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/cosq.lo math/log10q.lo \
@BUILD_LIBQUADMATH_TRUE@ math/sinq.lo math/cosq_kernel.lo \
@BUILD_LIBQUADMATH_TRUE@ math/log1pq.lo math/sinq_kernel.lo \
@BUILD_LIBQUADMATH_TRUE@ math/erfq.lo math/logq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/sqrtq.lo math/expm1q.lo \
@BUILD_LIBQUADMATH_TRUE@ math/lroundq.lo math/tanhq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/expq.lo math/modfq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/tanq.lo math/fabsq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/nanq.lo math/tgammaq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/finiteq.lo math/nextafterq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/truncq.lo math/floorq.lo \
@BUILD_LIBQUADMATH_TRUE@ math/powq.lo
libquadmath_la_OBJECTS = $(am_libquadmath_la_OBJECTS)
@BUILD_LIBQUADMATH_TRUE@am_libquadmath_la_rpath = -rpath \
@BUILD_LIBQUADMATH_TRUE@ $(toolexeclibdir)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libquadmath_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
am__include_HEADERS_DIST = quadmath.h quadmath_weak.h
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
enable_shared = @enable_shared@
enable_static = @enable_static@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
toolexecdir = @toolexecdir@
toolexeclibdir = @toolexeclibdir@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = 1.8 foreign
@BUILD_LIBQUADMATH_TRUE@ACLOCAL_AMFLAGS = -I .. -I ../config
@BUILD_LIBQUADMATH_TRUE@gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_FALSE@version_arg =
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_GNU_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/quadmath.map
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_arg = -Wl,-M,quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_FALSE@version_dep =
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_GNU_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = $(srcdir)/quadmath.map
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_dep = quadmath.map-sun
@BUILD_LIBQUADMATH_TRUE@LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
@BUILD_LIBQUADMATH_TRUE@ -no-undefined
@BUILD_LIBQUADMATH_TRUE@toolexeclib_LTLIBRARIES = libquadmath.la
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LIBADD = -lm
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LDFLAGS = $(LTLDFLAGS) -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(version_arg)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep)
@BUILD_LIBQUADMATH_TRUE@include_HEADERS = quadmath.h quadmath_weak.h
@BUILD_LIBQUADMATH_TRUE@libquadmath_la_SOURCES = \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/arith.h gdtoa/gdtoa_fltrnds.h gdtoa/gd_qnan.h gdtoa/gdtoaimp.h \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/gdtoa.h quadmath-imp.h \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/dmisc.c gdtoa/gdtoa.c gdtoa/hd_init.c gdtoa/smisc.c gdtoa/sum.c \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/g_Qfmt.c gdtoa/gethex.c gdtoa/hexnan.c gdtoa/strtodg.c \
@BUILD_LIBQUADMATH_TRUE@ gdtoa/ulp.c gdtoa/g__fmt.c gdtoa/gmisc.c gdtoa/misc.c gdtoa/strtopQ.c \
@BUILD_LIBQUADMATH_TRUE@ quadmath_io.c \
@BUILD_LIBQUADMATH_TRUE@ math/acoshq.c math/fmodq.c math/acosq.c math/frexpq.c \
@BUILD_LIBQUADMATH_TRUE@ math/rem_pio2q.c math/asinhq.c math/hypotq.c math/remainderq.c \
@BUILD_LIBQUADMATH_TRUE@ math/asinq.c math/rintq.c math/atan2q.c math/isinfq.c \
@BUILD_LIBQUADMATH_TRUE@ math/roundq.c math/atanhq.c math/isnanq.c math/scalblnq.c math/atanq.c \
@BUILD_LIBQUADMATH_TRUE@ math/j0q.c math/scalbnq.c math/cbrtq.c math/j1q.c math/signbitq.c \
@BUILD_LIBQUADMATH_TRUE@ math/ceilq.c math/jnq.c math/sincos_table.c math/complex.c math/ldexpq.c \
@BUILD_LIBQUADMATH_TRUE@ math/sincosq.c math/copysignq.c math/lgammaq.c math/sincosq_kernel.c \
@BUILD_LIBQUADMATH_TRUE@ math/coshq.c math/llroundq.c math/sinhq.c math/cosq.c math/log10q.c \
@BUILD_LIBQUADMATH_TRUE@ math/sinq.c math/cosq_kernel.c math/log1pq.c math/sinq_kernel.c \
@BUILD_LIBQUADMATH_TRUE@ math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
@BUILD_LIBQUADMATH_TRUE@ math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
@BUILD_LIBQUADMATH_TRUE@ math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
@BUILD_LIBQUADMATH_TRUE@ math/truncq.c math/floorq.c math/powq.c
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
}
uninstall-toolexeclibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
done
clean-toolexeclibLTLIBRARIES:
-test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
@list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
gdtoa/$(am__dirstamp):
@$(MKDIR_P) gdtoa
@: > gdtoa/$(am__dirstamp)
gdtoa/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) gdtoa/$(DEPDIR)
@: > gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/dmisc.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/gdtoa.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/hd_init.lo: gdtoa/$(am__dirstamp) \
gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/smisc.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/sum.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/g_Qfmt.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/gethex.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/hexnan.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/strtodg.lo: gdtoa/$(am__dirstamp) \
gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/ulp.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/g__fmt.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/gmisc.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/misc.lo: gdtoa/$(am__dirstamp) gdtoa/$(DEPDIR)/$(am__dirstamp)
gdtoa/strtopQ.lo: gdtoa/$(am__dirstamp) \
gdtoa/$(DEPDIR)/$(am__dirstamp)
math/$(am__dirstamp):
@$(MKDIR_P) math
@: > math/$(am__dirstamp)
math/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) math/$(DEPDIR)
@: > math/$(DEPDIR)/$(am__dirstamp)
math/acoshq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/fmodq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/acosq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/frexpq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/rem_pio2q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/asinhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/hypotq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/remainderq.lo: math/$(am__dirstamp) \
math/$(DEPDIR)/$(am__dirstamp)
math/asinq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/rintq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/atan2q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/isinfq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/roundq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/atanhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/isnanq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/scalblnq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/atanq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/j0q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/scalbnq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/cbrtq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/j1q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/signbitq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/ceilq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/jnq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sincos_table.lo: math/$(am__dirstamp) \
math/$(DEPDIR)/$(am__dirstamp)
math/complex.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/ldexpq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sincosq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/copysignq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/lgammaq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sincosq_kernel.lo: math/$(am__dirstamp) \
math/$(DEPDIR)/$(am__dirstamp)
math/coshq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/llroundq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sinhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/cosq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/log10q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sinq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/cosq_kernel.lo: math/$(am__dirstamp) \
math/$(DEPDIR)/$(am__dirstamp)
math/log1pq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sinq_kernel.lo: math/$(am__dirstamp) \
math/$(DEPDIR)/$(am__dirstamp)
math/erfq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/logq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/sqrtq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/expm1q.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/lroundq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/tanhq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/expq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/modfq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/tanq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/fabsq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/nanq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/tgammaq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/finiteq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/nextafterq.lo: math/$(am__dirstamp) \
math/$(DEPDIR)/$(am__dirstamp)
math/truncq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/floorq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
math/powq.lo: math/$(am__dirstamp) math/$(DEPDIR)/$(am__dirstamp)
libquadmath.la: $(libquadmath_la_OBJECTS) $(libquadmath_la_DEPENDENCIES)
$(libquadmath_la_LINK) $(am_libquadmath_la_rpath) $(libquadmath_la_OBJECTS) $(libquadmath_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
-rm -f gdtoa/dmisc.$(OBJEXT)
-rm -f gdtoa/dmisc.lo
-rm -f gdtoa/g_Qfmt.$(OBJEXT)
-rm -f gdtoa/g_Qfmt.lo
-rm -f gdtoa/g__fmt.$(OBJEXT)
-rm -f gdtoa/g__fmt.lo
-rm -f gdtoa/gdtoa.$(OBJEXT)
-rm -f gdtoa/gdtoa.lo
-rm -f gdtoa/gethex.$(OBJEXT)
-rm -f gdtoa/gethex.lo
-rm -f gdtoa/gmisc.$(OBJEXT)
-rm -f gdtoa/gmisc.lo
-rm -f gdtoa/hd_init.$(OBJEXT)
-rm -f gdtoa/hd_init.lo
-rm -f gdtoa/hexnan.$(OBJEXT)
-rm -f gdtoa/hexnan.lo
-rm -f gdtoa/misc.$(OBJEXT)
-rm -f gdtoa/misc.lo
-rm -f gdtoa/smisc.$(OBJEXT)
-rm -f gdtoa/smisc.lo
-rm -f gdtoa/strtodg.$(OBJEXT)
-rm -f gdtoa/strtodg.lo
-rm -f gdtoa/strtopQ.$(OBJEXT)
-rm -f gdtoa/strtopQ.lo
-rm -f gdtoa/sum.$(OBJEXT)
-rm -f gdtoa/sum.lo
-rm -f gdtoa/ulp.$(OBJEXT)
-rm -f gdtoa/ulp.lo
-rm -f math/acoshq.$(OBJEXT)
-rm -f math/acoshq.lo
-rm -f math/acosq.$(OBJEXT)
-rm -f math/acosq.lo
-rm -f math/asinhq.$(OBJEXT)
-rm -f math/asinhq.lo
-rm -f math/asinq.$(OBJEXT)
-rm -f math/asinq.lo
-rm -f math/atan2q.$(OBJEXT)
-rm -f math/atan2q.lo
-rm -f math/atanhq.$(OBJEXT)
-rm -f math/atanhq.lo
-rm -f math/atanq.$(OBJEXT)
-rm -f math/atanq.lo
-rm -f math/cbrtq.$(OBJEXT)
-rm -f math/cbrtq.lo
-rm -f math/ceilq.$(OBJEXT)
-rm -f math/ceilq.lo
-rm -f math/complex.$(OBJEXT)
-rm -f math/complex.lo
-rm -f math/copysignq.$(OBJEXT)
-rm -f math/copysignq.lo
-rm -f math/coshq.$(OBJEXT)
-rm -f math/coshq.lo
-rm -f math/cosq.$(OBJEXT)
-rm -f math/cosq.lo
-rm -f math/cosq_kernel.$(OBJEXT)
-rm -f math/cosq_kernel.lo
-rm -f math/erfq.$(OBJEXT)
-rm -f math/erfq.lo
-rm -f math/expm1q.$(OBJEXT)
-rm -f math/expm1q.lo
-rm -f math/expq.$(OBJEXT)
-rm -f math/expq.lo
-rm -f math/fabsq.$(OBJEXT)
-rm -f math/fabsq.lo
-rm -f math/finiteq.$(OBJEXT)
-rm -f math/finiteq.lo
-rm -f math/floorq.$(OBJEXT)
-rm -f math/floorq.lo
-rm -f math/fmodq.$(OBJEXT)
-rm -f math/fmodq.lo
-rm -f math/frexpq.$(OBJEXT)
-rm -f math/frexpq.lo
-rm -f math/hypotq.$(OBJEXT)
-rm -f math/hypotq.lo
-rm -f math/isinfq.$(OBJEXT)
-rm -f math/isinfq.lo
-rm -f math/isnanq.$(OBJEXT)
-rm -f math/isnanq.lo
-rm -f math/j0q.$(OBJEXT)
-rm -f math/j0q.lo
-rm -f math/j1q.$(OBJEXT)
-rm -f math/j1q.lo
-rm -f math/jnq.$(OBJEXT)
-rm -f math/jnq.lo
-rm -f math/ldexpq.$(OBJEXT)
-rm -f math/ldexpq.lo
-rm -f math/lgammaq.$(OBJEXT)
-rm -f math/lgammaq.lo
-rm -f math/llroundq.$(OBJEXT)
-rm -f math/llroundq.lo
-rm -f math/log10q.$(OBJEXT)
-rm -f math/log10q.lo
-rm -f math/log1pq.$(OBJEXT)
-rm -f math/log1pq.lo
-rm -f math/logq.$(OBJEXT)
-rm -f math/logq.lo
-rm -f math/lroundq.$(OBJEXT)
-rm -f math/lroundq.lo
-rm -f math/modfq.$(OBJEXT)
-rm -f math/modfq.lo
-rm -f math/nanq.$(OBJEXT)
-rm -f math/nanq.lo
-rm -f math/nextafterq.$(OBJEXT)
-rm -f math/nextafterq.lo
-rm -f math/powq.$(OBJEXT)
-rm -f math/powq.lo
-rm -f math/rem_pio2q.$(OBJEXT)
-rm -f math/rem_pio2q.lo
-rm -f math/remainderq.$(OBJEXT)
-rm -f math/remainderq.lo
-rm -f math/rintq.$(OBJEXT)
-rm -f math/rintq.lo
-rm -f math/roundq.$(OBJEXT)
-rm -f math/roundq.lo
-rm -f math/scalblnq.$(OBJEXT)
-rm -f math/scalblnq.lo
-rm -f math/scalbnq.$(OBJEXT)
-rm -f math/scalbnq.lo
-rm -f math/signbitq.$(OBJEXT)
-rm -f math/signbitq.lo
-rm -f math/sincos_table.$(OBJEXT)
-rm -f math/sincos_table.lo
-rm -f math/sincosq.$(OBJEXT)
-rm -f math/sincosq.lo
-rm -f math/sincosq_kernel.$(OBJEXT)
-rm -f math/sincosq_kernel.lo
-rm -f math/sinhq.$(OBJEXT)
-rm -f math/sinhq.lo
-rm -f math/sinq.$(OBJEXT)
-rm -f math/sinq.lo
-rm -f math/sinq_kernel.$(OBJEXT)
-rm -f math/sinq_kernel.lo
-rm -f math/sqrtq.$(OBJEXT)
-rm -f math/sqrtq.lo
-rm -f math/tanhq.$(OBJEXT)
-rm -f math/tanhq.lo
-rm -f math/tanq.$(OBJEXT)
-rm -f math/tanq.lo
-rm -f math/tgammaq.$(OBJEXT)
-rm -f math/tgammaq.lo
-rm -f math/truncq.$(OBJEXT)
-rm -f math/truncq.lo
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quadmath_io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/dmisc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/g_Qfmt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/g__fmt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/gdtoa.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/gethex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/gmisc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/hd_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/hexnan.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/smisc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/strtodg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/strtopQ.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/sum.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gdtoa/$(DEPDIR)/ulp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/acoshq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/acosq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/asinhq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/asinq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/atan2q.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/atanhq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/atanq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cbrtq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/ceilq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/complex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/copysignq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/coshq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cosq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/cosq_kernel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/erfq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/expm1q.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/expq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fabsq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/finiteq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/floorq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fmodq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/frexpq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/hypotq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/isinfq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/isnanq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/j0q.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/j1q.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/jnq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/ldexpq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lgammaq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/llroundq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log10q.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/log1pq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/logq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/lroundq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/modfq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/nanq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/nextafterq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/powq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/rem_pio2q.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/remainderq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/rintq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/roundq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/scalblnq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/scalbnq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/signbitq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sincos_table.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sincosq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sincosq_kernel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sinhq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sinq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sinq_kernel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/sqrtq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/tanhq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/tanq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/tgammaq.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/truncq.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
-rm -rf gdtoa/.libs gdtoa/_libs
-rm -rf math/.libs math/_libs
distclean-libtool:
-rm -f libtool config.lt
# GNU Make needs to see an explicit $(MAKE) variable in the command it
# runs to enable its job server during parallel builds. Hence the
# comments below.
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
mostlyclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS) config.h
installdirs:
for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-rm -f gdtoa/$(DEPDIR)/$(am__dirstamp)
-rm -f gdtoa/$(am__dirstamp)
-rm -f math/$(DEPDIR)/$(am__dirstamp)
-rm -f math/$(am__dirstamp)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean-multi
clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am distclean-multi
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR) gdtoa/$(DEPDIR) math/$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-multi install-toolexeclibLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean-multi
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR) gdtoa/$(DEPDIR) math/$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean-multi
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS \
uninstall-toolexeclibLTLIBRARIES
.MAKE: all all-multi clean-multi distclean-multi install-am \
install-multi install-strip maintainer-clean-multi \
mostlyclean-multi
.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-am \
clean clean-generic clean-libtool clean-multi \
clean-toolexeclibLTLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-multi distclean-tags dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-includeHEADERS \
install-info install-info-am install-man install-multi \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip install-toolexeclibLTLIBRARIES installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic maintainer-clean-multi mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
mostlyclean-multi pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-includeHEADERS \
uninstall-toolexeclibLTLIBRARIES
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@quadmath.map-sun : $(srcdir)/quadmath.map \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ $(top_srcdir)/../contrib/make_sunver.pl \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ $(libquadmath_la_OBJECTS) $(libquadmath_la_LIBADD)
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ perl $(top_srcdir)/../contrib/make_sunver.pl \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ $(srcdir)/quadmath.map \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ $(libquadmath_la_OBJECTS:%.lo=.libs/%.o) \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ `echo $(libquadmath_la_LIBADD) | \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@ > $@ || (rm -f $@ ; exit 1)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

53
libquadmath/acinclude.m4 Normal file
View File

@ -0,0 +1,53 @@
dnl ----------------------------------------------------------------------
dnl This whole bit snagged from libgfortran.
dnl Check whether the target supports __sync_*_compare_and_swap.
AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
libgomp_cv_have_sync_builtins, [
AC_TRY_LINK([], [int foo; __sync_val_compare_and_swap(&foo, 0, 1);],
libgomp_cv_have_sync_builtins=yes, libgomp_cv_have_sync_builtins=no)])
if test $libgomp_cv_have_sync_builtins = yes; then
AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
[Define to 1 if the target supports __sync_*_compare_and_swap])
fi])
dnl Check whether the target supports hidden visibility.
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
libgomp_cv_have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
[], libgomp_cv_have_attribute_visibility=yes,
libgomp_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $libgomp_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
dnl Check whether the target supports dllexport
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
AC_CACHE_CHECK([whether the target supports dllexport],
libgomp_cv_have_attribute_dllexport, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
[], libgomp_cv_have_attribute_dllexport=yes,
libgomp_cv_have_attribute_dllexport=no)
CFLAGS="$save_CFLAGS"])
if test $libgomp_cv_have_attribute_dllexport = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
[Define to 1 if the target supports __attribute__((dllexport)).])
fi])
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
dnl add a definition of LIBTOOL to Makefile.in.
ifelse(,,,[AC_SUBST(LIBTOOL)
AC_DEFUN([AM_PROG_LIBTOOL])
AC_DEFUN([AC_LIBTOOL_DLOPEN])
AC_DEFUN([AC_PROG_LD])
])

1014
libquadmath/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

71
libquadmath/config.h.in Normal file
View File

@ -0,0 +1,71 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* libm includes cbrtl */
#undef HAVE_CBRTL
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* libm includes sqrtl */
#undef HAVE_SQRTL
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

13413
libquadmath/configure vendored Normal file

File diff suppressed because it is too large Load Diff

163
libquadmath/configure.ac Normal file
View File

@ -0,0 +1,163 @@
# Process this file with autoconf to produce a configure script, like so:
# aclocal && autoconf && autoheader && automake
AC_PREREQ(2.64)
AC_INIT([GCC Quad-precision Math Library], 0.1,,[libquadmath])
AC_CONFIG_HEADER(config.h)
# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
#
# You will slowly go insane if you do not grok the following fact: when
# building this library, the top-level /target/ becomes the library's /host/.
#
# configure then causes --target to default to --host, exactly like any
# other package using autoconf. Therefore, 'target' and 'host' will
# always be the same. This makes sense both for native and cross compilers
# just think about it for a little while. :-)
#
# Also, if this library is being configured as part of a cross compiler, the
# top-level configure script will pass the "real" host as $with_cross_host.
#
# Do not delete or change the following two lines. For why, see
# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
AC_CANONICAL_SYSTEM
target_alias=${target_alias-$host_alias}
AM_INIT_AUTOMAKE([1.9.0 foreign subdir-objects no-dist -Wall -Werror])
AC_PROG_CC
AM_PROG_CC_C_O
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE(version-specific-runtime-libs,
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
[case "$enableval" in
yes) version_specific_libs=yes ;;
no) version_specific_libs=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
esac],
[version_specific_libs=no])
AC_MSG_RESULT($version_specific_libs)
# Configure libtool
AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AM_MAINTAINER_MODE
AM_ENABLE_MULTILIB(, ..)
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
yes)
# Need the gcc compiler version to know where to install libraries
# and header files if --enable-version-specific-runtime-libs option
# is selected.
toolexecdir='$(libdir)/gcc/$(target_alias)'
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
;;
no)
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
# Install a library built with a cross compiler in tooldir, not libdir.
toolexecdir='$(exec_prefix)/$(target_alias)'
toolexeclibdir='$(toolexecdir)/lib'
else
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
toolexeclibdir='$(libdir)'
fi
multi_os_directory=`$CC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
esac
;;
esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
AC_CHECK_LIB([m],[cbrtl],[AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])])
# Check for symbol versioning (copied from libssp).
AC_MSG_CHECKING([whether symbol versioning is supported])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
cat > conftest.map <<EOF
FOO_1.0 {
global: *foo*; bar; local: *;
};
EOF
AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
if test x$quadmath_use_symver = xno; then
case "$target_os" in
solaris2*)
LDFLAGS="$save_LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
# Sun ld cannot handle wildcards and treats all entries as undefined.
cat > conftest.map <<EOF
FOO_1.0 {
global: foo; local: *;
};
EOF
AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
;;
esac
fi
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($quadmath_use_symver)
AM_CONDITIONAL(LIBQUAD_USE_SYMVER, [test "x$quadmath_use_symver" != xno])
AM_CONDITIONAL(LIBQUAD_USE_SYMVER_GNU, [test "x$quadmath_use_symver" = xgnu])
AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test "x$quadmath_use_symver" = xsun])
AC_MSG_CHECKING([whether __float128 is supported])
AC_TRY_LINK([
typedef _Complex float __attribute__((mode(TC))) __complex128;
__float128 foo (__float128 x)
{
__complex128 z1, z2;
z1 = x;
z2 = x / 7.Q;
z2 /= z1;
return (__float128) z2;
}
__float128 bar (__float128 x)
{
return x * __builtin_huge_valq ();
}
],[
foo (1.2Q);
bar (1.2Q);
],[
libquad_have_float128=yes
],[
libquad_have_float128=no
])
AC_MSG_RESULT([$libquad_have_float128])
dnl
dnl Enable the following for a stand-alone library:
dnl
dnl if test $libquad_have_float128 = no; then
dnl AC_MSG_ERROR([__float128 support is required to build this library.])
dnl fi
AM_CONDITIONAL(BUILD_LIBQUADMATH, [test "x$libquad_have_float128" = xyes])
AC_CACHE_SAVE
if test ${multilib} = yes; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

View File

@ -0,0 +1,369 @@
The content below is the README file of the gdtoa distribution, available
from http://www.netlib.org/fp/
----------------------------------------------------
This directory contains source for a library of binary -> decimal
and decimal -> binary conversion routines, for single-, double-,
and extended-precision IEEE binary floating-point arithmetic, and
other IEEE-like binary floating-point, including "double double",
as in
T. J. Dekker, "A Floating-Point Technique for Extending the
Available Precision", Numer. Math. 18 (1971), pp. 224-242
and
"Inside Macintosh: PowerPC Numerics", Addison-Wesley, 1994
The conversion routines use double-precision floating-point arithmetic
and, where necessary, high precision integer arithmetic. The routines
are generalizations of the strtod and dtoa routines described in
David M. Gay, "Correctly Rounded Binary-Decimal and
Decimal-Binary Conversions", Numerical Analysis Manuscript
No. 90-10, Bell Labs, Murray Hill, 1990;
http://cm.bell-labs.com/cm/cs/what/ampl/REFS/rounding.ps.gz
(based in part on papers by Clinger and Steele & White: see the
references in the above paper).
The present conversion routines should be able to use any of IEEE binary,
VAX, or IBM-mainframe double-precision arithmetic internally, but I (dmg)
have so far only had a chance to test them with IEEE double precision
arithmetic.
The core conversion routines are strtodg for decimal -> binary conversions
and gdtoa for binary -> decimal conversions. These routines operate
on arrays of unsigned 32-bit integers of type ULong, a signed 32-bit
exponent of type Long, and arithmetic characteristics described in
struct FPI; FPI, Long, and ULong are defined in gdtoa.h. File arith.h
is supposed to provide #defines that cause gdtoa.h to define its
types correctly. File arithchk.c is source for a program that
generates a suitable arith.h on all systems where I've been able to
test it.
The core conversion routines are meant to be called by helper routines
that know details of the particular binary arithmetic of interest and
convert. The present directory provides helper routines for 5 variants
of IEEE binary floating-point arithmetic, each indicated by one or
two letters:
f IEEE single precision
d IEEE double precision
x IEEE extended precision, as on Intel 80x87
and software emulations of Motorola 68xxx chips
that do not pad the way the 68xxx does, but
only store 80 bits
xL IEEE extended precision, as on Motorola 68xxx chips
Q quad precision, as on Sun Sparc chips
dd double double, pairs of IEEE double numbers
whose sum is the desired value
For decimal -> binary conversions, there are three families of
helper routines: one for round-nearest (or the current rounding
mode on IEEE-arithmetic systems that provide the C99 fegetround()
function, if compiled with -DHonor_FLT_ROUNDS):
strtof
strtod
strtodd
strtopd
strtopf
strtopx
strtopxL
strtopQ
one with rounding direction specified:
strtorf
strtord
strtordd
strtorx
strtorxL
strtorQ
and one for computing an interval (at most one bit wide) that contains
the decimal number:
strtoIf
strtoId
strtoIdd
strtoIx
strtoIxL
strtoIQ
The latter call strtoIg, which makes one call on strtodg and adjusts
the result to provide the desired interval. On systems where native
arithmetic can easily make one-ulp adjustments on values in the
desired floating-point format, it might be more efficient to use the
native arithmetic. Routine strtodI is a variant of strtoId that
illustrates one way to do this for IEEE binary double-precision
arithmetic -- but whether this is more efficient remains to be seen.
Functions strtod and strtof have "natural" return types, float and
double -- strtod is specified by the C standard, and strtof appears
in the stdlib.h of some systems, such as (at least some) Linux systems.
The other functions write their results to their final argument(s):
to the final two argument for the strtoI... (interval) functions,
and to the final argument for the others (strtop... and strtor...).
Where possible, these arguments have "natural" return types (double*
or float*), to permit at least some type checking. In reality, they
are viewed as arrays of ULong (or, for the "x" functions, UShort)
values. On systems where long double is the appropriate type, one can
pass long double* final argument(s) to these routines. The int value
that these routines return is the return value from the call they make
on strtodg; see the enum of possible return values in gdtoa.h.
Source files g_ddfmt.c, misc.c, smisc.c, strtod.c, strtodg.c, and ulp.c
should use true IEEE double arithmetic (not, e.g., double extended),
at least for storing (and viewing the bits of) the variables declared
"double" within them.
One detail indicated in struct FPI is whether the target binary
arithmetic departs from the IEEE standard by flushing denormalized
numbers to 0. On systems that do this, the helper routines for
conversion to double-double format (when compiled with
Sudden_Underflow #defined) penalize the bottom of the exponent
range so that they return a nonzero result only when the least
significant bit of the less significant member of the pair of
double values returned can be expressed as a normalized double
value. An alternative would be to drop to 53-bit precision near
the bottom of the exponent range. To get correct rounding, this
would (in general) require two calls on strtodg (one specifying
126-bit arithmetic, then, if necessary, one specifying 53-bit
arithmetic).
By default, the core routine strtodg and strtod set errno to ERANGE
if the result overflows to +Infinity or underflows to 0. Compile
these routines with NO_ERRNO #defined to inhibit errno assignments.
Routine strtod is based on netlib's "dtoa.c from fp", and
(f = strtod(s,se)) is more efficient for some conversions than, say,
strtord(s,se,1,&f). Parts of strtod require true IEEE double
arithmetic with the default rounding mode (round-to-nearest) and, on
systems with IEEE extended-precision registers, double-precision
(53-bit) rounding precision. If the machine uses (the equivalent of)
Intel 80x87 arithmetic, the call
_control87(PC_53, MCW_PC);
does this with many compilers. Whether this or another call is
appropriate depends on the compiler; for this to work, it may be
necessary to #include "float.h" or another system-dependent header
file.
Source file strtodnrp.c gives a strtod that does not require 53-bit
rounding precision on systems (such as Intel IA32 systems) that may
suffer double rounding due to use of extended-precision registers.
For some conversions this variant of strtod is less efficient than the
one in strtod.c when the latter is run with 53-bit rounding precision.
The values that the strto* routines return for NaNs are determined by
gd_qnan.h, which the makefile generates by running the program whose
source is qnan.c. Note that the rules for distinguishing signaling
from quiet NaNs are system-dependent. For cross-compilation, you need
to determine arith.h and gd_qnan.h suitably, e.g., using the
arithmetic of the target machine.
C99's hexadecimal floating-point constants are recognized by the
strto* routines (but this feature has not yet been heavily tested).
Compiling with NO_HEX_FP #defined disables this feature.
When compiled with -DINFNAN_CHECK, the strto* routines recognize C99's
NaN and Infinity syntax. Moreover, unless No_Hex_NaN is #defined, the
strto* routines also recognize C99's NaN(...) syntax: they accept
(case insensitively) strings of the form NaN(x), where x is a string
of hexadecimal digits and spaces; if there is only one string of
hexadecimal digits, it is taken for the fraction bits of the resulting
NaN; if there are two or more strings of hexadecimal digits, each
string is assigned to the next available sequence of 32-bit words of
fractions bits (starting with the most significant), right-aligned in
each sequence.
For binary -> decimal conversions, I've provided just one family
of helper routines:
g_ffmt
g_dfmt
g_ddfmt
g_xfmt
g_xLfmt
g_Qfmt
which do a "%g" style conversion either to a specified number of decimal
places (if their ndig argument is positive), or to the shortest
decimal string that rounds to the given binary floating-point value
(if ndig <= 0). They write into a buffer supplied as an argument
and return either a pointer to the end of the string (a null character)
in the buffer, if the buffer was long enough, or 0. Other forms of
conversion are easily done with the help of gdtoa(), such as %e or %f
style and conversions with direction of rounding specified (so that, if
desired, the decimal value is either >= or <= the binary value).
On IEEE-arithmetic systems that provide the C99 fegetround() function,
if compiled with -DHonor_FLT_ROUNDS, these routines honor the current
rounding mode.
For an example of more general conversions based on dtoa(), see
netlib's "printf.c from ampl/solvers".
For double-double -> decimal, g_ddfmt() assumes IEEE-like arithmetic
of precision max(126, #bits(input)) bits, where #bits(input) is the
number of mantissa bits needed to represent the sum of the two double
values in the input.
The makefile creates a library, gdtoa.a. To use the helper
routines, a program only needs to include gdtoa.h. All the
source files for gdtoa.a include a more extensive gdtoaimp.h;
among other things, gdtoaimp.h has #defines that make "internal"
names end in _D2A. To make a "system" library, one could modify
these #defines to make the names start with __.
Various comments about possible #defines appear in gdtoaimp.h,
but for most purposes, arith.h should set suitable #defines.
Systems with preemptive scheduling of multiple threads require some
manual intervention. On such systems, it's necessary to compile
dmisc.c, dtoa.c gdota.c, and misc.c with MULTIPLE_THREADS #defined,
and to provide (or suitably #define) two locks, acquired by
ACQUIRE_DTOA_LOCK(n) and freed by FREE_DTOA_LOCK(n) for n = 0 or 1.
(The second lock, accessed in pow5mult, ensures lazy evaluation of
only one copy of high powers of 5; omitting this lock would introduce
a small probability of wasting memory, but would otherwise be harmless.)
Routines that call dtoa or gdtoa directly must also invoke freedtoa(s)
to free the value s returned by dtoa or gdtoa. It's OK to do so whether
or not MULTIPLE_THREADS is #defined, and the helper g_*fmt routines
listed above all do this indirectly (in gfmt_D2A(), which they all call).
By default, there is a private pool of memory of length 2000 bytes
for intermediate quantities, and MALLOC (see gdtoaimp.h) is called only
if the private pool does not suffice. 2000 is large enough that MALLOC
is called only under very unusual circumstances (decimal -> binary
conversion of very long strings) for conversions to and from double
precision. For systems with preemptively scheduled multiple threads
or for conversions to extended or quad, it may be appropriate to
#define PRIVATE_MEM nnnn, where nnnn is a suitable value > 2000.
For extended and quad precisions, -DPRIVATE_MEM=20000 is probably
plenty even for many digits at the ends of the exponent range.
Use of the private pool avoids some overhead.
Directory test provides some test routines. See its README.
I've also tested this stuff (except double double conversions)
with Vern Paxson's testbase program: see
V. Paxson and W. Kahan, "A Program for Testing IEEE Binary-Decimal
Conversion", manuscript, May 1991,
ftp://ftp.ee.lbl.gov/testbase-report.ps.Z .
(The same ftp directory has source for testbase.)
Some system-dependent additions to CFLAGS in the makefile:
HU-UX: -Aa -Ae
OSF (DEC Unix): -ieee_with_no_inexact
SunOS 4.1x: -DKR_headers -DBad_float_h
If you want to put this stuff into a shared library and your
operating system requires export lists for shared libraries,
the following would be an appropriate export list:
dtoa
freedtoa
g_Qfmt
g_ddfmt
g_dfmt
g_ffmt
g_xLfmt
g_xfmt
gdtoa
strtoIQ
strtoId
strtoIdd
strtoIf
strtoIx
strtoIxL
strtod
strtodI
strtodg
strtof
strtopQ
strtopd
strtopdd
strtopf
strtopx
strtopxL
strtorQ
strtord
strtordd
strtorf
strtorx
strtorxL
When time permits, I (dmg) hope to write in more detail about the
present conversion routines; for now, this README file must suffice.
Meanwhile, if you wish to write helper functions for other kinds of
IEEE-like arithmetic, some explanation of struct FPI and the bits
array may be helpful. Both gdtoa and strtodg operate on a bits array
described by FPI *fpi. The bits array is of type ULong, a 32-bit
unsigned integer type. Floating-point numbers have fpi->nbits bits,
with the least significant 32 bits in bits[0], the next 32 bits in
bits[1], etc. These numbers are regarded as integers multiplied by
2^e (i.e., 2 to the power of the exponent e), where e is the second
argument (be) to gdtoa and is stored in *exp by strtodg. The minimum
and maximum exponent values fpi->emin and fpi->emax for normalized
floating-point numbers reflect this arrangement. For example, the
P754 standard for binary IEEE arithmetic specifies doubles as having
53 bits, with normalized values of the form 1.xxxxx... times 2^(b-1023),
with 52 bits (the x's) and the biased exponent b represented explicitly;
b is an unsigned integer in the range 1 <= b <= 2046 for normalized
finite doubles, b = 0 for denormals, and b = 2047 for Infinities and NaNs.
To turn an IEEE double into the representation used by strtodg and gdtoa,
we multiply 1.xxxx... by 2^52 (to make it an integer) and reduce the
exponent e = (b-1023) by 52:
fpi->emin = 1 - 1023 - 52
fpi->emax = 1046 - 1023 - 52
In various wrappers for IEEE double, we actually write -53 + 1 rather
than -52, to emphasize that there are 53 bits including one implicit bit.
Field fpi->rounding indicates the desired rounding direction, with
possible values
FPI_Round_zero = toward 0,
FPI_Round_near = unbiased rounding -- the IEEE default,
FPI_Round_up = toward +Infinity, and
FPI_Round_down = toward -Infinity
given in gdtoa.h.
Field fpi->sudden_underflow indicates whether strtodg should return
denormals or flush them to zero. Normal floating-point numbers have
bit fpi->nbits in the bits array on. Denormals have it off, with
exponent = fpi->emin. Strtodg provides distinct return values for normals
and denormals; see gdtoa.h.
Compiling g__fmt.c, strtod.c, and strtodg.c with -DUSE_LOCALE causes
the decimal-point character to be taken from the current locale; otherwise
it is '.'.
Source files dtoa.c and strtod.c in this directory are derived from
netlib's "dtoa.c from fp" and are meant to function equivalently.
When compiled with Honor_FLT_ROUNDS #defined (on systems that provide
FLT_ROUNDS and fegetround() as specified in the C99 standard), they
honor the current rounding mode. Because FLT_ROUNDS is buggy on some
(Linux) systems -- not reflecting calls on fesetround(), as the C99
standard says it should -- when Honor_FLT_ROUNDS is #defined, the
current rounding mode is obtained from fegetround() rather than from
FLT_ROUNDS, unless Trust_FLT_ROUNDS is also #defined.
Compile with -DUSE_LOCALE to use the current locale; otherwise
decimal points are assumed to be '.'. With -DUSE_LOCALE, unless
you also compile with -DNO_LOCALE_CACHE, the details about the
current "decimal point" character string are cached and assumed not
to change during the program's execution.
On machines with a 64-bit long double and perhaps a 113-bit "quad"
type, you can invoke "make Printf" to add Printf (and variants, such
as Fprintf) to gdtoa.a. These are analogs, declared in stdio1.h, of
printf and fprintf, etc. in which %La, %Le, %Lf, and %Lg are for long
double and (if appropriate) %Lqa, %Lqe, %Lqf, and %Lqg are for quad
precision printing.
Please send comments to David M. Gay (dmg at acm dot org, with " at "
changed at "@" and " dot " changed to ".").

14
libquadmath/gdtoa/arith.h Normal file
View File

@ -0,0 +1,14 @@
#include <stdint.h>
#if __LITTLE_ENDIAN__
# define IEEE_8087
#elif __BIG_ENDIAN__
# define IEEE_MC68k
#else
// Because quad math is typically performed on little-endian hardware
//# error "Unknown endianness"
# define IEEE_8087
#endif
// This should be 32 bit integer type
#define Long int

216
libquadmath/gdtoa/dmisc.c Normal file
View File

@ -0,0 +1,216 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
#ifndef MULTIPLE_THREADS
char *dtoa_result;
#endif
char *
#ifdef KR_headers
rv_alloc(i) int i;
#else
rv_alloc(int i)
#endif
{
int j, k, *r;
j = sizeof(ULong);
for(k = 0;
sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
j <<= 1)
k++;
r = (int*)Balloc(k);
*r = k;
return
#ifndef MULTIPLE_THREADS
dtoa_result =
#endif
(char *)(r+1);
}
char *
#ifdef KR_headers
nrv_alloc(s, rve, n) char *s, **rve; int n;
#else
nrv_alloc(char *s, char **rve, int n)
#endif
{
char *rv, *t;
t = rv = rv_alloc(n);
while((*t = *s++) !=0)
t++;
if (rve)
*rve = t;
return rv;
}
/* freedtoa(s) must be used to free values s returned by dtoa
* when MULTIPLE_THREADS is #defined. It should be used in all cases,
* but for consistency with earlier versions of dtoa, it is optional
* when MULTIPLE_THREADS is not defined.
*/
void
#ifdef KR_headers
freedtoa(s) char *s;
#else
freedtoa(char *s)
#endif
{
Bigint *b = (Bigint *)((int *)s - 1);
b->maxwds = 1 << (b->k = *(int*)b);
Bfree(b);
#ifndef MULTIPLE_THREADS
if (s == dtoa_result)
dtoa_result = 0;
#endif
}
int
quorem
#ifdef KR_headers
(b, S) Bigint *b, *S;
#else
(Bigint *b, Bigint *S)
#endif
{
int n;
ULong *bx, *bxe, q, *sx, *sxe;
#ifdef ULLong
ULLong borrow, carry, y, ys;
#else
ULong borrow, carry, y, ys;
#ifdef Pack_32
ULong si, z, zs;
#endif
#endif
n = S->wds;
#ifdef DEBUG
/*debug*/ if (b->wds > n)
/*debug*/ Bug("oversize b in quorem");
#endif
if (b->wds < n)
return 0;
sx = S->x;
sxe = sx + --n;
bx = b->x;
bxe = bx + n;
q = *bxe / (*sxe + 1); /* ensure q <= true quotient */
#ifdef DEBUG
/*debug*/ if (q > 9)
/*debug*/ Bug("oversized quotient in quorem");
#endif
if (q) {
borrow = 0;
carry = 0;
do {
#ifdef ULLong
ys = *sx++ * (ULLong)q + carry;
carry = ys >> 32;
y = *bx - (ys & 0xffffffffUL) - borrow;
borrow = y >> 32 & 1UL;
*bx++ = y & 0xffffffffUL;
#else
#ifdef Pack_32
si = *sx++;
ys = (si & 0xffff) * q + carry;
zs = (si >> 16) * q + (ys >> 16);
carry = zs >> 16;
y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
borrow = (y & 0x10000) >> 16;
z = (*bx >> 16) - (zs & 0xffff) - borrow;
borrow = (z & 0x10000) >> 16;
Storeinc(bx, z, y);
#else
ys = *sx++ * q + carry;
carry = ys >> 16;
y = *bx - (ys & 0xffff) - borrow;
borrow = (y & 0x10000) >> 16;
*bx++ = y & 0xffff;
#endif
#endif
}
while(sx <= sxe);
if (!*bxe) {
bx = b->x;
while(--bxe > bx && !*bxe)
--n;
b->wds = n;
}
}
if (cmp(b, S) >= 0) {
q++;
borrow = 0;
carry = 0;
bx = b->x;
sx = S->x;
do {
#ifdef ULLong
ys = *sx++ + carry;
carry = ys >> 32;
y = *bx - (ys & 0xffffffffUL) - borrow;
borrow = y >> 32 & 1UL;
*bx++ = y & 0xffffffffUL;
#else
#ifdef Pack_32
si = *sx++;
ys = (si & 0xffff) + carry;
zs = (si >> 16) + (ys >> 16);
carry = zs >> 16;
y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
borrow = (y & 0x10000) >> 16;
z = (*bx >> 16) - (zs & 0xffff) - borrow;
borrow = (z & 0x10000) >> 16;
Storeinc(bx, z, y);
#else
ys = *sx++ + carry;
carry = ys >> 16;
y = *bx - (ys & 0xffff) - borrow;
borrow = (y & 0x10000) >> 16;
*bx++ = y & 0xffff;
#endif
#endif
}
while(sx <= sxe);
bx = b->x;
bxe = bx + n;
if (!*bxe) {
while(--bxe > bx && !*bxe)
--n;
b->wds = n;
}
}
return q;
}

125
libquadmath/gdtoa/g_Qfmt.c Normal file
View File

@ -0,0 +1,125 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998, 2000 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
#undef _0
#undef _1
/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */
#ifdef IEEE_MC68k
#define _0 0
#define _1 1
#define _2 2
#define _3 3
#endif
#ifdef IEEE_8087
#define _0 3
#define _1 2
#define _2 1
#define _3 0
#endif
char*
#ifdef KR_headers
g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; size_t bufsize;
#else
g_Qfmt(char *buf, void *V, int ndig, size_t bufsize)
#endif
{
static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 };
char *b, *s, *se;
ULong bits[4], *L, sign;
int decpt, ex, i, mode;
#ifdef Honor_FLT_ROUNDS
#include "gdtoa_fltrnds.h"
#else
#define fpi &fpi0
#endif
if (ndig < 0)
ndig = 0;
if (bufsize < ndig + 10)
return 0;
L = (ULong*)V;
sign = L[_0] & 0x80000000L;
bits[3] = L[_0] & 0xffff;
bits[2] = L[_1];
bits[1] = L[_2];
bits[0] = L[_3];
b = buf;
if ( (ex = (L[_0] & 0x7fff0000L) >> 16) !=0) {
if (ex == 0x7fff) {
/* Infinity or NaN */
if (bits[0] | bits[1] | bits[2] | bits[3])
b = strcp(b, "NaN");
else {
b = buf;
if (sign)
*b++ = '-';
b = strcp(b, "Infinity");
}
return b;
}
i = STRTOG_Normal;
bits[3] |= 0x10000;
}
else if (bits[0] | bits[1] | bits[2] | bits[3]) {
i = STRTOG_Denormal;
ex = 1;
}
else {
#ifndef IGNORE_ZERO_SIGN
if (sign)
*b++ = '-';
#endif
*b++ = '0';
*b = 0;
return b;
}
ex -= 0x3fff + 112;
mode = 2;
if (ndig <= 0) {
if (bufsize < 48)
return 0;
mode = 0;
}
s = gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se);
// FXC -- modifications
return g__fmt(buf, s, se, decpt, sign, bufsize);
// FXC -- end of modifications
}

147
libquadmath/gdtoa/g__fmt.c Normal file
View File

@ -0,0 +1,147 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
#ifdef USE_LOCALE
#include "locale.h"
#endif
char *
#ifdef KR_headers
g__fmt(b, s, se, decpt, sign, blen) char *b; char *s; char *se; int decpt; ULong sign; size_t blen;
#else
g__fmt(char *b, char *s, char *se, int decpt, ULong sign, size_t blen)
#endif
{
int i, j, k;
char *be, *s0;
size_t len;
#ifdef USE_LOCALE
#ifdef NO_LOCALE_CACHE
char *decimalpoint = localeconv()->decimal_point;
size_t dlen = strlen(decimalpoint);
#else
char *decimalpoint;
static char *decimalpoint_cache;
static size_t dlen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
dlen = strlen(s0);
if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
strcpy(decimalpoint_cache, s0);
s0 = decimalpoint_cache;
}
}
decimalpoint = s0;
#endif
#else
#define dlen 0
#endif
s0 = s;
len = (se-s) + dlen + 6; /* 6 = sign + e+dd + trailing null */
if (blen < len)
goto ret0;
be = b + blen - 1;
if (sign)
*b++ = '-';
if (decpt <= -4 || decpt > se - s + 5) {
*b++ = *s++;
if (*s) {
#ifdef USE_LOCALE
while((*b = *decimalpoint++))
++b;
#else
*b++ = '.';
#endif
while((*b = *s++) !=0)
b++;
}
*b++ = 'e';
/* sprintf(b, "%+.2d", decpt - 1); */
if (--decpt < 0) {
*b++ = '-';
decpt = -decpt;
}
else
*b++ = '+';
for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10){}
for(;;) {
i = decpt / k;
if (b >= be)
goto ret0;
*b++ = i + '0';
if (--j <= 0)
break;
decpt -= i*k;
decpt *= 10;
}
*b = 0;
}
else if (decpt <= 0) {
#ifdef USE_LOCALE
while((*b = *decimalpoint++))
++b;
#else
*b++ = '.';
#endif
if (be < b - decpt + (se - s))
goto ret0;
for(; decpt < 0; decpt++)
*b++ = '0';
while((*b = *s++) != 0)
b++;
}
else {
while((*b = *s++) != 0) {
b++;
if (--decpt == 0 && *s) {
#ifdef USE_LOCALE
while(*b = *decimalpoint++)
++b;
#else
*b++ = '.';
#endif
}
}
if (b + decpt > be) {
ret0:
b = 0;
goto ret;
}
for(; decpt > 0; decpt--)
*b++ = '0';
*b = 0;
}
ret:
freedtoa(s0);
return b;
}

View File

@ -0,0 +1,12 @@
#define f_QNAN 0xffc00000
#define d_QNAN0 0x0
#define d_QNAN1 0xfff80000
#define ld_QNAN0 0x0
#define ld_QNAN1 0xc0000000
#define ld_QNAN2 0xffff
#define ld_QNAN3 0x0
#define ldus_QNAN0 0x0
#define ldus_QNAN1 0x0
#define ldus_QNAN2 0x0
#define ldus_QNAN3 0xc000
#define ldus_QNAN4 0xffff

745
libquadmath/gdtoa/gdtoa.c Normal file
View File

@ -0,0 +1,745 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998, 1999 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
static Bigint *
#ifdef KR_headers
bitstob(bits, nbits, bbits) ULong *bits; int nbits; int *bbits;
#else
bitstob(ULong *bits, int nbits, int *bbits)
#endif
{
int i, k;
Bigint *b;
ULong *be, *x, *x0;
i = ULbits;
k = 0;
while(i < nbits) {
i <<= 1;
k++;
}
#ifndef Pack_32
if (!k)
k = 1;
#endif
b = Balloc(k);
be = bits + ((nbits - 1) >> kshift);
x = x0 = b->x;
do {
*x++ = *bits & ALL_ON;
#ifdef Pack_16
*x++ = (*bits >> 16) & ALL_ON;
#endif
} while(++bits <= be);
i = x - x0;
while(!x0[--i])
if (!i) {
b->wds = 0;
*bbits = 0;
goto ret;
}
b->wds = i + 1;
*bbits = i*ULbits + 32 - hi0bits(b->x[i]);
ret:
return b;
}
/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
*
* Inspired by "How to Print Floating-Point Numbers Accurately" by
* Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126].
*
* Modifications:
* 1. Rather than iterating, we use a simple numeric overestimate
* to determine k = floor(log10(d)). We scale relevant
* quantities using O(log2(k)) rather than O(k) multiplications.
* 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't
* try to generate digits strictly left to right. Instead, we
* compute with fewer bits and propagate the carry if necessary
* when rounding the final digit up. This is often faster.
* 3. Under the assumption that input will be rounded nearest,
* mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22.
* That is, we allow equality in stopping tests when the
* round-nearest rule will give the same floating-point value
* as would satisfaction of the stopping test with strict
* inequality.
* 4. We remove common factors of powers of 2 from relevant
* quantities.
* 5. When converting floating-point integers less than 1e16,
* we use floating-point arithmetic rather than resorting
* to multiple-precision integers.
* 6. When asked to produce fewer than 15 digits, we first try
* to get by with floating-point arithmetic; we resort to
* multiple-precision integer arithmetic only if we cannot
* guarantee that the floating-point calculation has given
* the correctly rounded result. For k requested digits and
* "uniformly" distributed input, the probability is
* something like 10^(k-15) that we must resort to the Long
* calculation.
*/
char *
gdtoa
#ifdef KR_headers
(fpi, be, bits, kindp, mode, ndigits, decpt, rve)
FPI *fpi; int be; ULong *bits;
int *kindp, mode, ndigits, *decpt; char **rve;
#else
(FPI *fpi, int be, ULong *bits, int *kindp, int mode, int ndigits, int *decpt, char **rve)
#endif
{
/* Arguments ndigits and decpt are similar to the second and third
arguments of ecvt and fcvt; trailing zeros are suppressed from
the returned string. If not null, *rve is set to point
to the end of the return value. If d is +-Infinity or NaN,
then *decpt is set to 9999.
mode:
0 ==> shortest string that yields d when read in
and rounded to nearest.
1 ==> like 0, but with Steele & White stopping rule;
e.g. with IEEE P754 arithmetic , mode 0 gives
1e23 whereas mode 1 gives 9.999999999999999e22.
2 ==> max(1,ndigits) significant digits. This gives a
return value similar to that of ecvt, except
that trailing zeros are suppressed.
3 ==> through ndigits past the decimal point. This
gives a return value similar to that from fcvt,
except that trailing zeros are suppressed, and
ndigits can be negative.
4-9 should give the same return values as 2-3, i.e.,
4 <= mode <= 9 ==> same return as mode
2 + (mode & 1). These modes are mainly for
debugging; often they run slower but sometimes
faster than modes 2-3.
4,5,8,9 ==> left-to-right digit generation.
6-9 ==> don't try fast floating-point estimate
(if applicable).
Values of mode other than 0-9 are treated as mode 0.
Sufficient space is allocated to the return value
to hold the suppressed trailing zeros.
*/
int bbits, b2, b5, be0, dig, i, ieps, ilim, ilim0, ilim1, inex;
int j, j1, k, k0, k_check, kind, leftright, m2, m5, nbits;
int rdir, s2, s5, spec_case, try_quick;
Long L;
Bigint *b, *b1, *delta, *mlo, *mhi, *mhi1, *S;
double d2, ds;
char *s, *s0;
U d, eps;
#ifndef MULTIPLE_THREADS
if (dtoa_result) {
freedtoa(dtoa_result);
dtoa_result = 0;
}
#endif
inex = 0;
kind = *kindp &= ~STRTOG_Inexact;
switch(kind & STRTOG_Retmask) {
case STRTOG_Zero:
goto ret_zero;
case STRTOG_Normal:
case STRTOG_Denormal:
break;
case STRTOG_Infinite:
*decpt = -32768;
return nrv_alloc("Infinity", rve, 8);
case STRTOG_NaN:
*decpt = -32768;
return nrv_alloc("NaN", rve, 3);
default:
return 0;
}
b = bitstob(bits, nbits = fpi->nbits, &bbits);
be0 = be;
if ( (i = trailz(b)) !=0) {
rshift(b, i);
be += i;
bbits -= i;
}
if (!b->wds) {
Bfree(b);
ret_zero:
*decpt = 1;
return nrv_alloc("0", rve, 1);
}
dval(&d) = b2d(b, &i);
i = be + bbits - 1;
word0(&d) &= Frac_mask1;
word0(&d) |= Exp_11;
#ifdef IBM
if ( (j = 11 - hi0bits(word0(&d) & Frac_mask)) !=0)
dval(&d) /= 1 << j;
#endif
/* log(x) ~=~ log(1.5) + (x-1.5)/1.5
* log10(x) = log(x) / log(10)
* ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10))
* log10(&d) = (i-Bias)*log(2)/log(10) + log10(d2)
*
* This suggests computing an approximation k to log10(&d) by
*
* k = (i - Bias)*0.301029995663981
* + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 );
*
* We want k to be too large rather than too small.
* The error in the first-order Taylor series approximation
* is in our favor, so we just round up the constant enough
* to compensate for any error in the multiplication of
* (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077,
* and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14,
* adding 1e-13 to the constant term more than suffices.
* Hence we adjust the constant term to 0.1760912590558.
* (We could get a more accurate k by invoking log10,
* but this is probably not worthwhile.)
*/
#ifdef IBM
i <<= 2;
i += j;
#endif
ds = (dval(&d)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981;
/* correct assumption about exponent range */
if ((j = i) < 0)
j = -j;
if ((j -= 1077) > 0)
ds += j * 7e-17;
k = (int)ds;
if (ds < 0. && ds != k)
k--; /* want k = floor(ds) */
k_check = 1;
#ifdef IBM
j = be + bbits - 1;
if ( (j1 = j & 3) !=0)
dval(&d) *= 1 << j1;
word0(&d) += j << Exp_shift - 2 & Exp_mask;
#else
word0(&d) += (be + bbits - 1) << Exp_shift;
#endif
if (k >= 0 && k <= Ten_pmax) {
if (dval(&d) < tens[k])
k--;
k_check = 0;
}
j = bbits - i - 1;
if (j >= 0) {
b2 = 0;
s2 = j;
}
else {
b2 = -j;
s2 = 0;
}
if (k >= 0) {
b5 = 0;
s5 = k;
s2 += k;
}
else {
b2 -= k;
b5 = -k;
s5 = 0;
}
if (mode < 0 || mode > 9)
mode = 0;
try_quick = 1;
if (mode > 5) {
mode -= 4;
try_quick = 0;
}
leftright = 1;
ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */
/* silence erroneous "gcc -Wall" warning. */
switch(mode) {
case 0:
case 1:
i = (int)(nbits * .30103) + 3;
ndigits = 0;
break;
case 2:
leftright = 0;
/* no break */
case 4:
if (ndigits <= 0)
ndigits = 1;
ilim = ilim1 = i = ndigits;
break;
case 3:
leftright = 0;
/* no break */
case 5:
i = ndigits + k + 1;
ilim = i;
ilim1 = i - 1;
if (i <= 0)
i = 1;
}
s = s0 = rv_alloc(i);
if ( (rdir = fpi->rounding - 1) !=0) {
if (rdir < 0)
rdir = 2;
if (kind & STRTOG_Neg)
rdir = 3 - rdir;
}
/* Now rdir = 0 ==> round near, 1 ==> round up, 2 ==> round down. */
if (ilim >= 0 && ilim <= Quick_max && try_quick && !rdir
#ifndef IMPRECISE_INEXACT
&& k == 0
#endif
) {
/* Try to get by with floating-point arithmetic. */
i = 0;
d2 = dval(&d);
#ifdef IBM
if ( (j = 11 - hi0bits(word0(&d) & Frac_mask)) !=0)
dval(&d) /= 1 << j;
#endif
k0 = k;
ilim0 = ilim;
ieps = 2; /* conservative */
if (k > 0) {
ds = tens[k&0xf];
j = k >> 4;
if (j & Bletch) {
/* prevent overflows */
j &= Bletch - 1;
dval(&d) /= bigtens[n_bigtens-1];
ieps++;
}
for(; j; j >>= 1, i++)
if (j & 1) {
ieps++;
ds *= bigtens[i];
}
}
else {
ds = 1.;
if ( (j1 = -k) !=0) {
dval(&d) *= tens[j1 & 0xf];
for(j = j1 >> 4; j; j >>= 1, i++)
if (j & 1) {
ieps++;
dval(&d) *= bigtens[i];
}
}
}
if (k_check && dval(&d) < 1. && ilim > 0) {
if (ilim1 <= 0)
goto fast_failed;
ilim = ilim1;
k--;
dval(&d) *= 10.;
ieps++;
}
dval(&eps) = ieps*dval(&d) + 7.;
word0(&eps) -= (P-1)*Exp_msk1;
if (ilim == 0) {
S = mhi = 0;
dval(&d) -= 5.;
if (dval(&d) > dval(&eps))
goto one_digit;
if (dval(&d) < -dval(&eps))
goto no_digits;
goto fast_failed;
}
#ifndef No_leftright
if (leftright) {
/* Use Steele & White method of only
* generating digits needed.
*/
dval(&eps) = ds*0.5/tens[ilim-1] - dval(&eps);
for(i = 0;;) {
L = (Long)(dval(&d)/ds);
dval(&d) -= L*ds;
*s++ = '0' + (int)L;
if (dval(&d) < dval(&eps)) {
if (dval(&d))
inex = STRTOG_Inexlo;
goto ret1;
}
if (ds - dval(&d) < dval(&eps))
goto bump_up;
if (++i >= ilim)
break;
dval(&eps) *= 10.;
dval(&d) *= 10.;
}
}
else {
#endif
/* Generate ilim digits, then fix them up. */
dval(&eps) *= tens[ilim-1];
for(i = 1;; i++, dval(&d) *= 10.) {
if ( (L = (Long)(dval(&d)/ds)) !=0)
dval(&d) -= L*ds;
*s++ = '0' + (int)L;
if (i == ilim) {
ds *= 0.5;
if (dval(&d) > ds + dval(&eps))
goto bump_up;
else if (dval(&d) < ds - dval(&eps)) {
if (dval(&d))
inex = STRTOG_Inexlo;
goto clear_trailing0;
}
break;
}
}
#ifndef No_leftright
}
#endif
fast_failed:
s = s0;
dval(&d) = d2;
k = k0;
ilim = ilim0;
}
/* Do we have a "small" integer? */
if (be >= 0 && k <= Int_max) {
/* Yes. */
ds = tens[k];
if (ndigits < 0 && ilim <= 0) {
S = mhi = 0;
if (ilim < 0 || dval(&d) <= 5*ds)
goto no_digits;
goto one_digit;
}
for(i = 1;; i++, dval(&d) *= 10.) {
L = dval(&d) / ds;
dval(&d) -= L*ds;
#ifdef Check_FLT_ROUNDS
/* If FLT_ROUNDS == 2, L will usually be high by 1 */
if (dval(&d) < 0) {
L--;
dval(&d) += ds;
}
#endif
*s++ = '0' + (int)L;
if (dval(&d) == 0.)
break;
if (i == ilim) {
if (rdir) {
if (rdir == 1)
goto bump_up;
inex = STRTOG_Inexlo;
goto ret1;
}
dval(&d) += dval(&d);
if (dval(&d) > ds || (dval(&d) == ds && L & 1)) {
bump_up:
inex = STRTOG_Inexhi;
while(*--s == '9')
if (s == s0) {
k++;
*s = '0';
break;
}
++*s++;
}
else {
inex = STRTOG_Inexlo;
clear_trailing0:
while(*--s == '0'){}
++s;
}
break;
}
}
goto ret1;
}
m2 = b2;
m5 = b5;
mhi = mlo = 0;
if (leftright) {
if (mode < 2) {
i = nbits - bbits;
if (be - i++ < fpi->emin)
/* denormal */
i = be - fpi->emin + 1;
}
else {
j = ilim - 1;
if (m5 >= j)
m5 -= j;
else {
s5 += j -= m5;
b5 += j;
m5 = 0;
}
if ((i = ilim) < 0) {
m2 -= i;
i = 0;
}
}
b2 += i;
s2 += i;
mhi = i2b(1);
}
if (m2 > 0 && s2 > 0) {
i = m2 < s2 ? m2 : s2;
b2 -= i;
m2 -= i;
s2 -= i;
}
if (b5 > 0) {
if (leftright) {
if (m5 > 0) {
mhi = pow5mult(mhi, m5);
b1 = mult(mhi, b);
Bfree(b);
b = b1;
}
if ( (j = b5 - m5) !=0)
b = pow5mult(b, j);
}
else
b = pow5mult(b, b5);
}
S = i2b(1);
if (s5 > 0)
S = pow5mult(S, s5);
/* Check for special case that d is a normalized power of 2. */
spec_case = 0;
if (mode < 2) {
if (bbits == 1 && be0 > fpi->emin + 1) {
/* The special case */
b2++;
s2++;
spec_case = 1;
}
}
/* Arrange for convenient computation of quotients:
* shift left if necessary so divisor has 4 leading 0 bits.
*
* Perhaps we should just compute leading 28 bits of S once
* and for all and pass them and a shift to quorem, so it
* can do shifts and ors to compute the numerator for q.
*/
i = ((s5 ? hi0bits(S->x[S->wds-1]) : ULbits - 1) - s2 - 4) & kmask;
m2 += i;
if ((b2 += i) > 0)
b = lshift(b, b2);
if ((s2 += i) > 0)
S = lshift(S, s2);
if (k_check) {
if (cmp(b,S) < 0) {
k--;
b = multadd(b, 10, 0); /* we botched the k estimate */
if (leftright)
mhi = multadd(mhi, 10, 0);
ilim = ilim1;
}
}
if (ilim <= 0 && mode > 2) {
if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) {
/* no digits, fcvt style */
no_digits:
k = -1 - ndigits;
inex = STRTOG_Inexlo;
goto ret;
}
one_digit:
inex = STRTOG_Inexhi;
*s++ = '1';
k++;
goto ret;
}
if (leftright) {
if (m2 > 0)
mhi = lshift(mhi, m2);
/* Compute mlo -- check for special case
* that d is a normalized power of 2.
*/
mlo = mhi;
if (spec_case) {
mhi = Balloc(mhi->k);
Bcopy(mhi, mlo);
mhi = lshift(mhi, 1);
}
for(i = 1;;i++) {
dig = quorem(b,S) + '0';
/* Do we yet have the shortest decimal string
* that will round to d?
*/
j = cmp(b, mlo);
delta = diff(S, mhi);
j1 = delta->sign ? 1 : cmp(b, delta);
Bfree(delta);
#ifndef ROUND_BIASED
if (j1 == 0 && !mode && !(bits[0] & 1) && !rdir) {
if (dig == '9')
goto round_9_up;
if (j <= 0) {
if (b->wds > 1 || b->x[0])
inex = STRTOG_Inexlo;
}
else {
dig++;
inex = STRTOG_Inexhi;
}
*s++ = dig;
goto ret;
}
#endif
if (j < 0 || (j == 0 && !mode
#ifndef ROUND_BIASED
&& !(bits[0] & 1)
#endif
)) {
if (rdir && (b->wds > 1 || b->x[0])) {
if (rdir == 2) {
inex = STRTOG_Inexlo;
goto accept;
}
while (cmp(S,mhi) > 0) {
*s++ = dig;
mhi1 = multadd(mhi, 10, 0);
if (mlo == mhi)
mlo = mhi1;
mhi = mhi1;
b = multadd(b, 10, 0);
dig = quorem(b,S) + '0';
}
if (dig++ == '9')
goto round_9_up;
inex = STRTOG_Inexhi;
goto accept;
}
if (j1 > 0) {
b = lshift(b, 1);
j1 = cmp(b, S);
if ((j1 > 0 || (j1 == 0 && dig & 1))
&& dig++ == '9')
goto round_9_up;
inex = STRTOG_Inexhi;
}
if (b->wds > 1 || b->x[0])
inex = STRTOG_Inexlo;
accept:
*s++ = dig;
goto ret;
}
if (j1 > 0 && rdir != 2) {
if (dig == '9') { /* possible if i == 1 */
round_9_up:
*s++ = '9';
inex = STRTOG_Inexhi;
goto roundoff;
}
inex = STRTOG_Inexhi;
*s++ = dig + 1;
goto ret;
}
*s++ = dig;
if (i == ilim)
break;
b = multadd(b, 10, 0);
if (mlo == mhi)
mlo = mhi = multadd(mhi, 10, 0);
else {
mlo = multadd(mlo, 10, 0);
mhi = multadd(mhi, 10, 0);
}
}
}
else
for(i = 1;; i++) {
*s++ = dig = quorem(b,S) + '0';
if (i >= ilim)
break;
b = multadd(b, 10, 0);
}
/* Round off last digit */
if (rdir) {
if (rdir == 2 || (b->wds <= 1 && !b->x[0]))
goto chopzeros;
goto roundoff;
}
b = lshift(b, 1);
j = cmp(b, S);
if (j > 0 || (j == 0 && dig & 1)) {
roundoff:
inex = STRTOG_Inexhi;
while(*--s == '9')
if (s == s0) {
k++;
*s++ = '1';
goto ret;
}
++*s++;
}
else {
chopzeros:
if (b->wds > 1 || b->x[0])
inex = STRTOG_Inexlo;
while(*--s == '0'){}
++s;
}
ret:
Bfree(S);
if (mhi) {
if (mlo && mlo != mhi)
Bfree(mlo);
Bfree(mhi);
}
ret1:
Bfree(b);
*s = 0;
*decpt = k + 1;
if (rve)
*rve = s;
*kindp |= inex;
return s0;
}

154
libquadmath/gdtoa/gdtoa.h Normal file
View File

@ -0,0 +1,154 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#ifndef GDTOA_H_INCLUDED
#define GDTOA_H_INCLUDED
#include "arith.h"
#include <stddef.h> /* for size_t */
#ifndef Long
#define Long long
#endif
#ifndef ULong
typedef unsigned Long ULong;
#endif
#ifndef UShort
typedef unsigned short UShort;
#endif
#ifndef ANSI
#ifdef KR_headers
#define ANSI(x) ()
#define Void /*nothing*/
#else
#define ANSI(x) x
#define Void void
#endif
#endif /* ANSI */
#ifndef CONST
#ifdef KR_headers
#define CONST /* blank */
#else
#define CONST const
#endif
#endif /* CONST */
enum { /* return values from strtodg */
STRTOG_Zero = 0,
STRTOG_Normal = 1,
STRTOG_Denormal = 2,
STRTOG_Infinite = 3,
STRTOG_NaN = 4,
STRTOG_NaNbits = 5,
STRTOG_NoNumber = 6,
STRTOG_Retmask = 7,
/* The following may be or-ed into one of the above values. */
STRTOG_Neg = 0x08, /* does not affect STRTOG_Inexlo or STRTOG_Inexhi */
STRTOG_Inexlo = 0x10, /* returned result rounded toward zero */
STRTOG_Inexhi = 0x20, /* returned result rounded away from zero */
STRTOG_Inexact = 0x30,
STRTOG_Underflow= 0x40,
STRTOG_Overflow = 0x80
};
typedef struct
FPI {
int nbits;
int emin;
int emax;
int rounding;
int sudden_underflow;
} FPI;
enum { /* FPI.rounding values: same as FLT_ROUNDS */
FPI_Round_zero = 0,
FPI_Round_near = 1,
FPI_Round_up = 2,
FPI_Round_down = 3
};
#ifdef __cplusplus
extern "C" {
#endif
extern char* dtoa ANSI((double d, int mode, int ndigits, int *decpt,
int *sign, char **rve));
extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
int mode, int ndigits, int *decpt, char **rve));
extern void freedtoa ANSI((char*));
extern float strtof ANSI((CONST char *, char **));
extern double strtod ANSI((CONST char *, char **));
extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
extern char* g_ddfmt ANSI((char*, double*, int, size_t));
extern char* g_dfmt ANSI((char*, double*, int, size_t));
extern char* g_ffmt ANSI((char*, float*, int, size_t));
extern char* g_Qfmt ANSI((char*, void*, int, size_t));
extern char* g_xfmt ANSI((char*, void*, int, size_t));
extern char* g_xLfmt ANSI((char*, void*, int, size_t));
extern int strtoId ANSI((CONST char*, char**, double*, double*));
extern int strtoIdd ANSI((CONST char*, char**, double*, double*));
extern int strtoIf ANSI((CONST char*, char**, float*, float*));
extern int strtoIQ ANSI((CONST char*, char**, void*, void*));
extern int strtoIx ANSI((CONST char*, char**, void*, void*));
extern int strtoIxL ANSI((CONST char*, char**, void*, void*));
extern int strtord ANSI((CONST char*, char**, int, double*));
extern int strtordd ANSI((CONST char*, char**, int, double*));
extern int strtorf ANSI((CONST char*, char**, int, float*));
extern int strtorQ ANSI((CONST char*, char**, int, void*));
extern int strtorx ANSI((CONST char*, char**, int, void*));
extern int strtorxL ANSI((CONST char*, char**, int, void*));
#if 1
extern int strtodI ANSI((CONST char*, char**, double*));
extern int strtopd ANSI((CONST char*, char**, double*));
extern int strtopdd ANSI((CONST char*, char**, double*));
extern int strtopf ANSI((CONST char*, char**, float*));
extern int quadmath_strtopQ ANSI((CONST char*, char**, void*));
extern int strtopx ANSI((CONST char*, char**, void*));
extern int strtopxL ANSI((CONST char*, char**, void*));
#else
#define strtopd(s,se,x) strtord(s,se,1,x)
#define strtopdd(s,se,x) strtordd(s,se,1,x)
#define strtopf(s,se,x) strtorf(s,se,1,x)
#define strtopQ(s,se,x) strtorQ(s,se,1,x)
#define strtopx(s,se,x) strtorx(s,se,1,x)
#define strtopxL(s,se,x) strtorxL(s,se,1,x)
#endif
#ifdef __cplusplus
}
#endif
#endif /* GDTOA_H_INCLUDED */

View File

@ -0,0 +1,18 @@
FPI *fpi, fpi1;
int Rounding;
#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
Rounding = Flt_Rounds;
#else /*}{*/
Rounding = 1;
switch(fegetround()) {
case FE_TOWARDZERO: Rounding = 0; break;
case FE_UPWARD: Rounding = 2; break;
case FE_DOWNWARD: Rounding = 3;
}
#endif /*}}*/
fpi = &fpi0;
if (Rounding != 1) {
fpi1 = fpi0;
fpi = &fpi1;
fpi1.rounding = Rounding;
}

View File

@ -0,0 +1,616 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998-2000 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* This is a variation on dtoa.c that converts arbitary binary
floating-point formats to and from decimal notation. It uses
double-precision arithmetic internally, so there are still
various #ifdefs that adapt the calculations to the native
double-precision arithmetic (any of IEEE, VAX D_floating,
or IBM mainframe arithmetic).
Please send bug reports to David M. Gay (dmg at acm dot org,
with " at " changed at "@" and " dot " changed to ".").
*/
/* On a machine with IEEE extended-precision registers, it is
* necessary to specify double-precision (53-bit) rounding precision
* before invoking strtod or dtoa. If the machine uses (the equivalent
* of) Intel 80x87 arithmetic, the call
* _control87(PC_53, MCW_PC);
* does this with many compilers. Whether this or another call is
* appropriate depends on the compiler; for this to work, it may be
* necessary to #include "float.h" or another system-dependent header
* file.
*/
/* strtod for IEEE-, VAX-, and IBM-arithmetic machines.
*
* This strtod returns a nearest machine number to the input decimal
* string (or sets errno to ERANGE). With IEEE arithmetic, ties are
* broken by the IEEE round-even rule. Otherwise ties are broken by
* biased rounding (add half and chop).
*
* Inspired loosely by William D. Clinger's paper "How to Read Floating
* Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 112-126].
*
* Modifications:
*
* 1. We only require IEEE, IBM, or VAX double-precision
* arithmetic (not IEEE double-extended).
* 2. We get by with floating-point arithmetic in a case that
* Clinger missed -- when we're computing d * 10^n
* for a small integer d and the integer n is not too
* much larger than 22 (the maximum integer k for which
* we can represent 10^k exactly), we may be able to
* compute (d*10^k) * 10^(e-k) with just one roundoff.
* 3. Rather than a bit-at-a-time adjustment of the binary
* result in the hard case, we use floating-point
* arithmetic to determine the adjustment to within
* one bit; only in really hard cases do we need to
* compute a second residual.
* 4. Because of 3., we don't need a large table of powers of 10
* for ten-to-e (just some small tables, e.g. of 10^k
* for 0 <= k <= 22).
*/
/*
* #define IEEE_8087 for IEEE-arithmetic machines where the least
* significant byte has the lowest address.
* #define IEEE_MC68k for IEEE-arithmetic machines where the most
* significant byte has the lowest address.
* #define Long int on machines with 32-bit ints and 64-bit longs.
* #define Sudden_Underflow for IEEE-format machines without gradual
* underflow (i.e., that flush to zero on underflow).
* #define IBM for IBM mainframe-style floating-point arithmetic.
* #define VAX for VAX-style floating-point arithmetic (D_floating).
* #define No_leftright to omit left-right logic in fast floating-point
* computation of dtoa.
* #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3.
* #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
* that use extended-precision instructions to compute rounded
* products and quotients) with IBM.
* #define ROUND_BIASED for IEEE-format with biased rounding.
* #define Inaccurate_Divide for IEEE-format with correctly rounded
* products but inaccurate quotients, e.g., for Intel i860.
* #define NO_LONG_LONG on machines that do not have a "long long"
* integer type (of >= 64 bits). On such machines, you can
* #define Just_16 to store 16 bits per 32-bit Long when doing
* high-precision integer arithmetic. Whether this speeds things
* up or slows things down depends on the machine and the number
* being converted. If long long is available and the name is
* something other than "long long", #define Llong to be the name,
* and if "unsigned Llong" does not work as an unsigned version of
* Llong, #define #ULLong to be the corresponding unsigned type.
* #define KR_headers for old-style C function headers.
* #define Bad_float_h if your system lacks a float.h or if it does not
* define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
* FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
* #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n)
* if memory is available and otherwise does something you deem
* appropriate. If MALLOC is undefined, malloc will be invoked
* directly -- and assumed always to succeed. Similarly, if you
* want something other than the system's free() to be called to
* recycle memory acquired from MALLOC, #define FREE to be the
* name of the alternate routine. (FREE or free is only called in
* pathological cases, e.g., in a gdtoa call after a gdtoa return in
* mode 3 with thousands of digits requested.)
* #define Omit_Private_Memory to omit logic (added Jan. 1998) for making
* memory allocations from a private pool of memory when possible.
* When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes,
* unless #defined to be a different length. This default length
* suffices to get rid of MALLOC calls except for unusual cases,
* such as decimal-to-binary conversion of a very long string of
* digits. When converting IEEE double precision values, the
* longest string gdtoa can return is about 751 bytes long. For
* conversions by strtod of strings of 800 digits and all gdtoa
* conversions of IEEE doubles in single-threaded executions with
* 8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with
* 4-byte pointers, PRIVATE_MEM >= 7112 appears adequate.
* #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK
* #defined automatically on IEEE systems. On such systems,
* when INFNAN_CHECK is #defined, strtod checks
* for Infinity and NaN (case insensitively).
* When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
* strtodg also accepts (case insensitively) strings of the form
* NaN(x), where x is a string of hexadecimal digits (optionally
* preceded by 0x or 0X) and spaces; if there is only one string
* of hexadecimal digits, it is taken for the fraction bits of the
* resulting NaN; if there are two or more strings of hexadecimal
* digits, each string is assigned to the next available sequence
* of 32-bit words of fractions bits (starting with the most
* significant), right-aligned in each sequence.
* Unless GDTOA_NON_PEDANTIC_NANCHECK is #defined, input "NaN(...)"
* is consumed even when ... has the wrong form (in which case the
* "(...)" is consumed but ignored).
* #define MULTIPLE_THREADS if the system offers preemptively scheduled
* multiple threads. In this case, you must provide (or suitably
* #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
* by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed
* in pow5mult, ensures lazy evaluation of only one copy of high
* powers of 5; omitting this lock would introduce a small
* probability of wasting memory, but would otherwise be harmless.)
* You must also invoke freedtoa(s) to free the value s returned by
* dtoa. You may do so whether or not MULTIPLE_THREADS is #defined.
* #define IMPRECISE_INEXACT if you do not care about the setting of
* the STRTOG_Inexact bits in the special case of doing IEEE double
* precision conversions (which could also be done by the strtod in
* dtoa.c).
* #define NO_HEX_FP to disable recognition of C9x's hexadecimal
* floating-point constants.
* #define -DNO_ERRNO to suppress setting errno (in strtod.c and
* strtodg.c).
* #define NO_STRING_H to use private versions of memcpy.
* On some K&R systems, it may also be necessary to
* #define DECLARE_SIZE_T in this case.
* #define USE_LOCALE to use the current locale's decimal_point value.
*/
#ifndef GDTOAIMP_H_INCLUDED
#define GDTOAIMP_H_INCLUDED
#include "gdtoa.h"
#include "gd_qnan.h"
#ifdef Honor_FLT_ROUNDS
#include <fenv.h>
#endif
#ifdef DEBUG
#include "stdio.h"
#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
#endif
#include "stdlib.h"
#include "string.h"
#ifdef KR_headers
#define Char char
#else
#define Char void
#endif
#ifdef MALLOC
extern Char *MALLOC ANSI((size_t));
#else
#define MALLOC malloc
#endif
#undef IEEE_Arith
#undef Avoid_Underflow
#ifdef IEEE_MC68k
#define IEEE_Arith
#endif
#ifdef IEEE_8087
#define IEEE_Arith
#endif
#include "errno.h"
#ifdef Bad_float_h
#ifdef IEEE_Arith
#define DBL_DIG 15
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define FLT_RADIX 2
#define DBL_MAX 1.7976931348623157e+308
#endif
#ifdef IBM
#define DBL_DIG 16
#define DBL_MAX_10_EXP 75
#define DBL_MAX_EXP 63
#define FLT_RADIX 16
#define DBL_MAX 7.2370055773322621e+75
#endif
#ifdef VAX
#define DBL_DIG 16
#define DBL_MAX_10_EXP 38
#define DBL_MAX_EXP 127
#define FLT_RADIX 2
#define DBL_MAX 1.7014118346046923e+38
#define n_bigtens 2
#endif
#ifndef LONG_MAX
#define LONG_MAX 2147483647
#endif
#else /* ifndef Bad_float_h */
#include "float.h"
#endif /* Bad_float_h */
#ifdef IEEE_Arith
#define Scale_Bit 0x10
#define n_bigtens 5
#endif
#ifdef IBM
#define n_bigtens 3
#endif
#ifdef VAX
#define n_bigtens 2
#endif
#ifndef __MATH_H__
#include "math.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
#endif
typedef union { double d; ULong L[2]; } U;
#ifdef IEEE_8087
#define word0(x) (x)->L[1]
#define word1(x) (x)->L[0]
#else
#define word0(x) (x)->L[0]
#define word1(x) (x)->L[1]
#endif
#define dval(x) (x)->d
/* The following definition of Storeinc is appropriate for MIPS processors.
* An alternative that might be better on some machines is
* #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
*/
#if defined(IEEE_8087) + defined(VAX)
#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
((unsigned short *)a)[0] = (unsigned short)c, a++)
#else
#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
((unsigned short *)a)[1] = (unsigned short)c, a++)
#endif
/* #define P DBL_MANT_DIG */
/* Ten_pmax = floor(P*log(2)/log(5)) */
/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */
/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */
/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
#ifdef IEEE_Arith
#define Exp_shift 20
#define Exp_shift1 20
#define Exp_msk1 0x100000
#define Exp_msk11 0x100000
#define Exp_mask 0x7ff00000
#define P 53
#define Bias 1023
#define Emin (-1022)
#define Exp_1 0x3ff00000
#define Exp_11 0x3ff00000
#define Ebits 11
#define Frac_mask 0xfffff
#define Frac_mask1 0xfffff
#define Ten_pmax 22
#define Bletch 0x10
#define Bndry_mask 0xfffff
#define Bndry_mask1 0xfffff
#define LSB 1
#define Sign_bit 0x80000000
#define Log2P 1
#define Tiny0 0
#define Tiny1 1
#define Quick_max 14
#define Int_max 14
#ifndef Flt_Rounds
#ifdef FLT_ROUNDS
#define Flt_Rounds FLT_ROUNDS
#else
#define Flt_Rounds 1
#endif
#endif /*Flt_Rounds*/
#else /* ifndef IEEE_Arith */
#undef Sudden_Underflow
#define Sudden_Underflow
#ifdef IBM
#undef Flt_Rounds
#define Flt_Rounds 0
#define Exp_shift 24
#define Exp_shift1 24
#define Exp_msk1 0x1000000
#define Exp_msk11 0x1000000
#define Exp_mask 0x7f000000
#define P 14
#define Bias 65
#define Exp_1 0x41000000
#define Exp_11 0x41000000
#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */
#define Frac_mask 0xffffff
#define Frac_mask1 0xffffff
#define Bletch 4
#define Ten_pmax 22
#define Bndry_mask 0xefffff
#define Bndry_mask1 0xffffff
#define LSB 1
#define Sign_bit 0x80000000
#define Log2P 4
#define Tiny0 0x100000
#define Tiny1 0
#define Quick_max 14
#define Int_max 15
#else /* VAX */
#undef Flt_Rounds
#define Flt_Rounds 1
#define Exp_shift 23
#define Exp_shift1 7
#define Exp_msk1 0x80
#define Exp_msk11 0x800000
#define Exp_mask 0x7f80
#define P 56
#define Bias 129
#define Exp_1 0x40800000
#define Exp_11 0x4080
#define Ebits 8
#define Frac_mask 0x7fffff
#define Frac_mask1 0xffff007f
#define Ten_pmax 24
#define Bletch 2
#define Bndry_mask 0xffff007f
#define Bndry_mask1 0xffff007f
#define LSB 0x10000
#define Sign_bit 0x8000
#define Log2P 1
#define Tiny0 0x80
#define Tiny1 0
#define Quick_max 15
#define Int_max 15
#endif /* IBM, VAX */
#endif /* IEEE_Arith */
#ifndef IEEE_Arith
#define ROUND_BIASED
#endif
#ifdef RND_PRODQUOT
#define rounded_product(a,b) a = rnd_prod(a, b)
#define rounded_quotient(a,b) a = rnd_quot(a, b)
#ifdef KR_headers
extern double rnd_prod(), rnd_quot();
#else
extern double rnd_prod(double, double), rnd_quot(double, double);
#endif
#else
#define rounded_product(a,b) a *= b
#define rounded_quotient(a,b) a /= b
#endif
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
#define Big1 0xffffffff
#undef Pack_16
#ifndef Pack_32
#define Pack_32
#endif
#ifdef NO_LONG_LONG
#undef ULLong
#ifdef Just_16
#undef Pack_32
#define Pack_16
/* When Pack_32 is not defined, we store 16 bits per 32-bit Long.
* This makes some inner loops simpler and sometimes saves work
* during multiplications, but it often seems to make things slightly
* slower. Hence the default is now to store 32 bits per Long.
*/
#endif
#else /* long long available */
#ifndef Llong
#define Llong long long
#endif
#ifndef ULLong
#define ULLong unsigned Llong
#endif
#endif /* NO_LONG_LONG */
#ifdef Pack_32
#define ULbits 32
#define kshift 5
#define kmask 31
#define ALL_ON 0xffffffff
#else
#define ULbits 16
#define kshift 4
#define kmask 15
#define ALL_ON 0xffff
#endif
#ifndef MULTIPLE_THREADS
#define ACQUIRE_DTOA_LOCK(n) /*nothing*/
#define FREE_DTOA_LOCK(n) /*nothing*/
#endif
#define Kmax 9
struct
Bigint {
struct Bigint *next;
int k, maxwds, sign, wds;
ULong x[1];
};
typedef struct Bigint Bigint;
#ifdef NO_STRING_H
#ifdef DECLARE_SIZE_T
typedef unsigned int size_t;
#endif
extern void memcpy_D2A ANSI((void*, const void*, size_t));
#define Bcopy(x,y) memcpy_D2A(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
#else /* !NO_STRING_H */
#define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
#endif /* NO_STRING_H */
#define Balloc Balloc_D2A
#define Bfree Bfree_D2A
#define ULtoQ ULtoQ_D2A
#define ULtof ULtof_D2A
#define ULtod ULtod_D2A
#define ULtodd ULtodd_D2A
#define ULtox ULtox_D2A
#define ULtoxL ULtoxL_D2A
#define any_on any_on_D2A
#define b2d b2d_D2A
#define bigtens bigtens_D2A
#define cmp cmp_D2A
#define copybits copybits_D2A
#define d2b d2b_D2A
#define decrement decrement_D2A
#define diff diff_D2A
#define dtoa_result dtoa_result_D2A
#define g__fmt g__fmt_D2A
#define gethex gethex_D2A
#define hexdig hexdig_D2A
#define hexnan hexnan_D2A
#define hi0bits(x) hi0bits_D2A((ULong)(x))
#define i2b i2b_D2A
#define increment increment_D2A
#define lo0bits lo0bits_D2A
#define lshift lshift_D2A
#define match match_D2A
#define mult mult_D2A
#define multadd multadd_D2A
#define nrv_alloc nrv_alloc_D2A
#define pow5mult pow5mult_D2A
#define quorem quorem_D2A
#define ratio ratio_D2A
#define rshift rshift_D2A
#define rv_alloc rv_alloc_D2A
#define s2b s2b_D2A
#define set_ones set_ones_D2A
#define strcp strcp_D2A
#define strtoIg strtoIg_D2A
#define sum sum_D2A
#define tens tens_D2A
#define tinytens tinytens_D2A
#define tinytens tinytens_D2A
#define trailz trailz_D2A
#define ulp ulp_D2A
extern char *dtoa_result;
extern CONST double bigtens[], tens[], tinytens[];
extern unsigned char hexdig[];
extern Bigint *Balloc ANSI((int));
extern void Bfree ANSI((Bigint*));
extern void ULtof ANSI((ULong*, ULong*, Long, int));
extern void ULtod ANSI((ULong*, ULong*, Long, int));
extern void ULtodd ANSI((ULong*, ULong*, Long, int));
extern void ULtoQ ANSI((ULong*, ULong*, Long, int));
extern void ULtox ANSI((UShort*, ULong*, Long, int));
extern void ULtoxL ANSI((ULong*, ULong*, Long, int));
extern ULong any_on ANSI((Bigint*, int));
extern double b2d ANSI((Bigint*, int*));
extern int cmp ANSI((Bigint*, Bigint*));
extern void copybits ANSI((ULong*, int, Bigint*));
extern Bigint *d2b ANSI((double, int*, int*));
extern void decrement ANSI((Bigint*));
extern Bigint *diff ANSI((Bigint*, Bigint*));
extern char *dtoa ANSI((double d, int mode, int ndigits,
int *decpt, int *sign, char **rve));
extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
extern void hexdig_init_D2A(Void);
extern int hexnan ANSI((CONST char**, FPI*, ULong*));
extern int hi0bits_D2A ANSI((ULong));
extern Bigint *i2b ANSI((int));
extern Bigint *increment ANSI((Bigint*));
extern int lo0bits ANSI((ULong*));
extern Bigint *lshift ANSI((Bigint*, int));
extern int match ANSI((CONST char**, char*));
extern Bigint *mult ANSI((Bigint*, Bigint*));
extern Bigint *multadd ANSI((Bigint*, int, int));
extern char *nrv_alloc ANSI((char*, char **, int));
extern Bigint *pow5mult ANSI((Bigint*, int));
extern int quorem ANSI((Bigint*, Bigint*));
extern double ratio ANSI((Bigint*, Bigint*));
extern void rshift ANSI((Bigint*, int));
extern char *rv_alloc ANSI((int));
extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
extern Bigint *set_ones ANSI((Bigint*, int));
extern char *strcp ANSI((char*, const char*));
extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
extern double strtod ANSI((const char *s00, char **se));
extern Bigint *sum ANSI((Bigint*, Bigint*));
extern int trailz ANSI((Bigint*));
extern double ulp ANSI((U*));
#ifdef __cplusplus
}
#endif
/*
* NAN_WORD0 and NAN_WORD1 are only referenced in strtod.c. Prior to
* 20050115, they used to be hard-wired here (to 0x7ff80000 and 0,
* respectively), but now are determined by compiling and running
* qnan.c to generate gd_qnan.h, which specifies d_QNAN0 and d_QNAN1.
* Formerly gdtoaimp.h recommended supplying suitable -DNAN_WORD0=...
* and -DNAN_WORD1=... values if necessary. This should still work.
* (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
*/
#ifdef IEEE_Arith
#ifndef NO_INFNAN_CHECK
#undef INFNAN_CHECK
#define INFNAN_CHECK
#endif
#ifdef IEEE_MC68k
#define _0 0
#define _1 1
#ifndef NAN_WORD0
#define NAN_WORD0 d_QNAN0
#endif
#ifndef NAN_WORD1
#define NAN_WORD1 d_QNAN1
#endif
#else
#define _0 1
#define _1 0
#ifndef NAN_WORD0
#define NAN_WORD0 d_QNAN1
#endif
#ifndef NAN_WORD1
#define NAN_WORD1 d_QNAN0
#endif
#endif
#else
#undef INFNAN_CHECK
#endif
#undef SI
#ifdef Sudden_Underflow
#define SI 1
#else
#define SI 0
#endif
#endif /* GDTOAIMP_H_INCLUDED */

350
libquadmath/gdtoa/gethex.c Normal file
View File

@ -0,0 +1,350 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
#ifdef USE_LOCALE
#include "locale.h"
#endif
int
#ifdef KR_headers
gethex(sp, fpi, exp, bp, sign)
CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign;
#else
gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
#endif
{
Bigint *b;
CONST unsigned char *decpt, *s0, *s, *s1;
int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret;
ULong L, lostbits, *x;
Long e, e1;
#ifdef USE_LOCALE
int i;
#ifdef NO_LOCALE_CACHE
const unsigned char *decimalpoint = (unsigned char*)localeconv()->decimal_point;
#else
const unsigned char *decimalpoint;
static unsigned char *decimalpoint_cache;
if (!(s0 = decimalpoint_cache)) {
s0 = (unsigned char*)localeconv()->decimal_point;
if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
strcpy(decimalpoint_cache, s0);
s0 = decimalpoint_cache;
}
}
decimalpoint = s0;
#endif
#endif
if (!hexdig['0'])
hexdig_init_D2A();
*bp = 0;
havedig = 0;
s0 = *(CONST unsigned char **)sp + 2;
while(s0[havedig] == '0')
havedig++;
s0 += havedig;
s = s0;
decpt = 0;
zret = 0;
e = 0;
if (hexdig[*s])
havedig++;
else {
zret = 1;
#ifdef USE_LOCALE
for(i = 0; decimalpoint[i]; ++i) {
if (s[i] != decimalpoint[i])
goto pcheck;
}
decpt = s += i;
#else
if (*s != '.')
goto pcheck;
decpt = ++s;
#endif
if (!hexdig[*s])
goto pcheck;
while(*s == '0')
s++;
if (hexdig[*s])
zret = 0;
havedig = 1;
s0 = s;
}
while(hexdig[*s])
s++;
#ifdef USE_LOCALE
if (*s == *decimalpoint && !decpt) {
for(i = 1; decimalpoint[i]; ++i) {
if (s[i] != decimalpoint[i])
goto pcheck;
}
decpt = s += i;
#else
if (*s == '.' && !decpt) {
decpt = ++s;
#endif
while(hexdig[*s])
s++;
}/*}*/
if (decpt)
e = -(((Long)(s-decpt)) << 2);
pcheck:
s1 = s;
big = esign = 0;
switch(*s) {
case 'p':
case 'P':
switch(*++s) {
case '-':
esign = 1;
/* no break */
case '+':
s++;
}
if ((n = hexdig[*s]) == 0 || n > 0x19) {
s = s1;
break;
}
e1 = n - 0x10;
while((n = hexdig[*++s]) !=0 && n <= 0x19) {
if (e1 & 0xf8000000)
big = 1;
e1 = 10*e1 + n - 0x10;
}
if (esign)
e1 = -e1;
e += e1;
}
*sp = (char*)s;
if (!havedig)
*sp = (char*)s0 - 1;
if (zret)
return STRTOG_Zero;
if (big) {
if (esign) {
switch(fpi->rounding) {
case FPI_Round_up:
if (sign)
break;
goto ret_tiny;
case FPI_Round_down:
if (!sign)
break;
goto ret_tiny;
}
goto retz;
ret_tiny:
b = Balloc(0);
b->wds = 1;
b->x[0] = 1;
goto dret;
}
switch(fpi->rounding) {
case FPI_Round_near:
goto ovfl1;
case FPI_Round_up:
if (!sign)
goto ovfl1;
goto ret_big;
case FPI_Round_down:
if (sign)
goto ovfl1;
goto ret_big;
}
ret_big:
nbits = fpi->nbits;
n0 = n = nbits >> kshift;
if (nbits & kmask)
++n;
for(j = n, k = 0; j >>= 1; ++k);
*bp = b = Balloc(k);
b->wds = n;
for(j = 0; j < n0; ++j)
b->x[j] = ALL_ON;
if (n > n0)
b->x[j] = ULbits >> (ULbits - (nbits & kmask));
*exp = fpi->emin;
return STRTOG_Normal | STRTOG_Inexlo;
}
n = s1 - s0 - 1;
for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1)
k++;
b = Balloc(k);
x = b->x;
n = 0;
L = 0;
#ifdef USE_LOCALE
for(i = 0; decimalpoint[i+1]; ++i);
#endif
while(s1 > s0) {
#ifdef USE_LOCALE
if (*--s1 == decimalpoint[i]) {
s1 -= i;
continue;
}
#else
if (*--s1 == '.')
continue;
#endif
if (n == ULbits) {
*x++ = L;
L = 0;
n = 0;
}
L |= (hexdig[*s1] & 0x0f) << n;
n += 4;
}
*x++ = L;
b->wds = n = x - b->x;
n = ULbits*n - hi0bits(L);
nbits = fpi->nbits;
lostbits = 0;
x = b->x;
if (n > nbits) {
n -= nbits;
if (any_on(b,n)) {
lostbits = 1;
k = n - 1;
if (x[k>>kshift] & 1 << (k & kmask)) {
lostbits = 2;
if (k > 0 && any_on(b,k))
lostbits = 3;
}
}
rshift(b, n);
e += n;
}
else if (n < nbits) {
n = nbits - n;
b = lshift(b, n);
e -= n;
x = b->x;
}
if (e > fpi->emax) {
ovfl:
Bfree(b);
ovfl1:
#ifndef NO_ERRNO
errno = ERANGE;
#endif
return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
}
irv = STRTOG_Normal;
if (e < fpi->emin) {
irv = STRTOG_Denormal;
n = fpi->emin - e;
if (n >= nbits) {
switch (fpi->rounding) {
case FPI_Round_near:
if (n == nbits && (n < 2 || any_on(b,n-1)))
goto one_bit;
break;
case FPI_Round_up:
if (!sign)
goto one_bit;
break;
case FPI_Round_down:
if (sign) {
one_bit:
x[0] = b->wds = 1;
dret:
*bp = b;
*exp = fpi->emin;
#ifndef NO_ERRNO
errno = ERANGE;
#endif
return STRTOG_Denormal | STRTOG_Inexhi
| STRTOG_Underflow;
}
}
Bfree(b);
retz:
#ifndef NO_ERRNO
errno = ERANGE;
#endif
return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow;
}
k = n - 1;
if (lostbits)
lostbits = 1;
else if (k > 0)
lostbits = any_on(b,k);
if (x[k>>kshift] & 1 << (k & kmask))
lostbits |= 2;
nbits -= n;
rshift(b,n);
e = fpi->emin;
}
if (lostbits) {
up = 0;
switch(fpi->rounding) {
case FPI_Round_zero:
break;
case FPI_Round_near:
if (lostbits & 2
&& (lostbits | x[0]) & 1)
up = 1;
break;
case FPI_Round_up:
up = 1 - sign;
break;
case FPI_Round_down:
up = sign;
}
if (up) {
k = b->wds;
b = increment(b);
x = b->x;
if (irv == STRTOG_Denormal) {
if (nbits == fpi->nbits - 1
&& x[nbits >> kshift] & 1 << (nbits & kmask))
irv = STRTOG_Normal;
}
else if (b->wds > k
|| ((n = nbits & kmask) !=0
&& hi0bits(x[k-1]) < 32-n)) {
rshift(b,1);
if (++e > fpi->emax)
goto ovfl;
}
irv |= STRTOG_Inexhi;
}
else
irv |= STRTOG_Inexlo;
}
*bp = b;
*exp = e;
return irv;
}

86
libquadmath/gdtoa/gmisc.c Normal file
View File

@ -0,0 +1,86 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
void
#ifdef KR_headers
rshift(b, k) Bigint *b; int k;
#else
rshift(Bigint *b, int k)
#endif
{
ULong *x, *x1, *xe, y;
int n;
x = x1 = b->x;
n = k >> kshift;
if (n < b->wds) {
xe = x + b->wds;
x += n;
if (k &= kmask) {
n = ULbits - k;
y = *x++ >> k;
while(x < xe) {
*x1++ = (y | (*x << n)) & ALL_ON;
y = *x++ >> k;
}
if ((*x1 = y) !=0)
x1++;
}
else
while(x < xe)
*x1++ = *x++;
}
if ((b->wds = x1 - b->x) == 0)
b->x[0] = 0;
}
int
#ifdef KR_headers
trailz(b) Bigint *b;
#else
trailz(Bigint *b)
#endif
{
ULong L, *x, *xe;
int n = 0;
x = b->x;
xe = x + b->wds;
for(n = 0; x < xe && !*x; x++)
n += ULbits;
if (x < xe) {
L = *x;
n += lo0bits(&L);
}
return n;
}

View File

@ -0,0 +1,55 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 2000 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
unsigned char hexdig[256];
static void
#ifdef KR_headers
htinit(h, s, inc) unsigned char *h; unsigned char *s; int inc;
#else
htinit(unsigned char *h, unsigned char *s, int inc)
#endif
{
int i, j;
for(i = 0; (j = s[i]) !=0; i++)
h[j] = i + inc;
}
void
hexdig_init_D2A(Void)
{
#define USC (unsigned char *)
htinit(hexdig, USC "0123456789", 0x10);
htinit(hexdig, USC "abcdef", 0x10 + 10);
htinit(hexdig, USC "ABCDEF", 0x10 + 10);
}

150
libquadmath/gdtoa/hexnan.c Normal file
View File

@ -0,0 +1,150 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 2000 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
static void
#ifdef KR_headers
L_shift(x, x1, i) ULong *x; ULong *x1; int i;
#else
L_shift(ULong *x, ULong *x1, int i)
#endif
{
int j;
i = 8 - i;
i <<= 2;
j = ULbits - i;
do {
*x |= x[1] << j;
x[1] >>= i;
} while(++x < x1);
}
int
#ifdef KR_headers
hexnan(sp, fpi, x0)
CONST char **sp; FPI *fpi; ULong *x0;
#else
hexnan( CONST char **sp, FPI *fpi, ULong *x0)
#endif
{
ULong c, h, *x, *x1, *xe;
CONST char *s;
int havedig, hd0, i, nbits;
if (!hexdig['0'])
hexdig_init_D2A();
nbits = fpi->nbits;
x = x0 + (nbits >> kshift);
if (nbits & kmask)
x++;
*--x = 0;
x1 = xe = x;
havedig = hd0 = i = 0;
s = *sp;
/* allow optional initial 0x or 0X */
while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
++s;
if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')
&& *(CONST unsigned char*)(s+3) > ' ')
s += 2;
while((c = *(CONST unsigned char*)++s)) {
if (!(h = hexdig[c])) {
if (c <= ' ') {
if (hd0 < havedig) {
if (x < x1 && i < 8)
L_shift(x, x1, i);
if (x <= x0) {
i = 8;
continue;
}
hd0 = havedig;
*--x = 0;
x1 = x;
i = 0;
}
while(*(CONST unsigned char*)(s+1) <= ' ')
++s;
if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')
&& *(CONST unsigned char*)(s+3) > ' ')
s += 2;
continue;
}
if (/*(*/ c == ')' && havedig) {
*sp = s + 1;
break;
}
#ifndef GDTOA_NON_PEDANTIC_NANCHECK
do {
if (/*(*/ c == ')') {
*sp = s + 1;
break;
}
} while((c = *++s));
#endif
return STRTOG_NaN;
}
havedig++;
if (++i > 8) {
if (x <= x0)
continue;
i = 1;
*--x = 0;
}
*x = (*x << 4) | (h & 0xf);
}
if (!havedig)
return STRTOG_NaN;
if (x < x1 && i < 8)
L_shift(x, x1, i);
if (x > x0) {
x1 = x0;
do *x1++ = *x++;
while(x <= xe);
do *x1++ = 0;
while(x1 <= xe);
}
else {
/* truncate high-order word if necessary */
if ( (i = nbits & (ULbits-1)) !=0)
*xe &= ((ULong)0xffffffff) >> (ULbits - i);
}
for(x1 = xe;; --x1) {
if (*x1 != 0)
break;
if (x1 == x0) {
*x1 = 1;
break;
}
}
return STRTOG_NaNbits;
}

View File

@ -0,0 +1,42 @@
# /****************************************************************
# Copyright (C) 1998 by Lucent Technologies
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that the copyright notice and this
# permission notice and warranty disclaimer appear in supporting
# documentation, and that the name of Lucent or any of its entities
# not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
# THIS SOFTWARE.
#
# ****************************************************************/
.SUFFIXES: .c .o
CC = cc
CFLAGS = -g
.c.o:
$(CC) -c $(CFLAGS) $*.c
all: gdtoa.a
gdtoa.a: dmisc.c g_Qfmt.c g__fmt.c gdtoa.c gethex.c gmisc.c hd_init.c\
hexnan.c misc.c smisc.c strtopQ.c strtodg.c sum.c ulp.c
$(CC) -c $(CFLAGS) $?
x=`echo $? | sed 's/\.c/.o/g'` && ar ruv gdtoa.a $$x && rm $$x
ranlib gdtoa.a || true
clean:
rm -f *.[ao]

875
libquadmath/gdtoa/misc.c Normal file
View File

@ -0,0 +1,875 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998, 1999 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
static Bigint *freelist[Kmax+1];
#ifndef Omit_Private_Memory
#ifndef PRIVATE_MEM
#define PRIVATE_MEM 2304
#endif
#define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
#endif
Bigint *
Balloc
#ifdef KR_headers
(k) int k;
#else
(int k)
#endif
{
int x;
Bigint *rv;
#ifndef Omit_Private_Memory
unsigned int len;
#endif
ACQUIRE_DTOA_LOCK(0);
/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
/* but this case seems very unlikely. */
if (k <= Kmax && (rv = freelist[k]) !=0) {
freelist[k] = rv->next;
}
else {
x = 1 << k;
#ifdef Omit_Private_Memory
rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
#else
len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
/sizeof(double);
if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
rv = (Bigint*)pmem_next;
pmem_next += len;
}
else
rv = (Bigint*)MALLOC(len*sizeof(double));
#endif
rv->k = k;
rv->maxwds = x;
}
FREE_DTOA_LOCK(0);
rv->sign = rv->wds = 0;
return rv;
}
void
Bfree
#ifdef KR_headers
(v) Bigint *v;
#else
(Bigint *v)
#endif
{
if (v) {
if (v->k > Kmax)
#ifdef FREE
FREE((void*)v);
#else
free((void*)v);
#endif
else {
ACQUIRE_DTOA_LOCK(0);
v->next = freelist[v->k];
freelist[v->k] = v;
FREE_DTOA_LOCK(0);
}
}
}
int
lo0bits
#ifdef KR_headers
(y) ULong *y;
#else
(ULong *y)
#endif
{
int k;
ULong x = *y;
if (x & 7) {
if (x & 1)
return 0;
if (x & 2) {
*y = x >> 1;
return 1;
}
*y = x >> 2;
return 2;
}
k = 0;
if (!(x & 0xffff)) {
k = 16;
x >>= 16;
}
if (!(x & 0xff)) {
k += 8;
x >>= 8;
}
if (!(x & 0xf)) {
k += 4;
x >>= 4;
}
if (!(x & 0x3)) {
k += 2;
x >>= 2;
}
if (!(x & 1)) {
k++;
x >>= 1;
if (!x)
return 32;
}
*y = x;
return k;
}
Bigint *
multadd
#ifdef KR_headers
(b, m, a) Bigint *b; int m, a;
#else
(Bigint *b, int m, int a) /* multiply by m and add a */
#endif
{
int i, wds;
#ifdef ULLong
ULong *x;
ULLong carry, y;
#else
ULong carry, *x, y;
#ifdef Pack_32
ULong xi, z;
#endif
#endif
Bigint *b1;
wds = b->wds;
x = b->x;
i = 0;
carry = a;
do {
#ifdef ULLong
y = *x * (ULLong)m + carry;
carry = y >> 32;
*x++ = y & 0xffffffffUL;
#else
#ifdef Pack_32
xi = *x;
y = (xi & 0xffff) * m + carry;
z = (xi >> 16) * m + (y >> 16);
carry = z >> 16;
*x++ = (z << 16) + (y & 0xffff);
#else
y = *x * m + carry;
carry = y >> 16;
*x++ = y & 0xffff;
#endif
#endif
}
while(++i < wds);
if (carry) {
if (wds >= b->maxwds) {
b1 = Balloc(b->k+1);
Bcopy(b1, b);
Bfree(b);
b = b1;
}
b->x[wds++] = carry;
b->wds = wds;
}
return b;
}
int
hi0bits_D2A
#ifdef KR_headers
(x) ULong x;
#else
(ULong x)
#endif
{
int k = 0;
if (!(x & 0xffff0000)) {
k = 16;
x <<= 16;
}
if (!(x & 0xff000000)) {
k += 8;
x <<= 8;
}
if (!(x & 0xf0000000)) {
k += 4;
x <<= 4;
}
if (!(x & 0xc0000000)) {
k += 2;
x <<= 2;
}
if (!(x & 0x80000000)) {
k++;
if (!(x & 0x40000000))
return 32;
}
return k;
}
Bigint *
i2b
#ifdef KR_headers
(i) int i;
#else
(int i)
#endif
{
Bigint *b;
b = Balloc(1);
b->x[0] = i;
b->wds = 1;
return b;
}
Bigint *
mult
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
{
Bigint *c;
int k, wa, wb, wc;
ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
ULong y;
#ifdef ULLong
ULLong carry, z;
#else
ULong carry, z;
#ifdef Pack_32
ULong z2;
#endif
#endif
if (a->wds < b->wds) {
c = a;
a = b;
b = c;
}
k = a->k;
wa = a->wds;
wb = b->wds;
wc = wa + wb;
if (wc > a->maxwds)
k++;
c = Balloc(k);
for(x = c->x, xa = x + wc; x < xa; x++)
*x = 0;
xa = a->x;
xae = xa + wa;
xb = b->x;
xbe = xb + wb;
xc0 = c->x;
#ifdef ULLong
for(; xb < xbe; xc0++) {
if ( (y = *xb++) !=0) {
x = xa;
xc = xc0;
carry = 0;
do {
z = *x++ * (ULLong)y + *xc + carry;
carry = z >> 32;
*xc++ = z & 0xffffffffUL;
}
while(x < xae);
*xc = carry;
}
}
#else
#ifdef Pack_32
for(; xb < xbe; xb++, xc0++) {
if ( (y = *xb & 0xffff) !=0) {
x = xa;
xc = xc0;
carry = 0;
do {
z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
carry = z >> 16;
z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
carry = z2 >> 16;
Storeinc(xc, z2, z);
}
while(x < xae);
*xc = carry;
}
if ( (y = *xb >> 16) !=0) {
x = xa;
xc = xc0;
carry = 0;
z2 = *xc;
do {
z = (*x & 0xffff) * y + (*xc >> 16) + carry;
carry = z >> 16;
Storeinc(xc, z, z2);
z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
carry = z2 >> 16;
}
while(x < xae);
*xc = z2;
}
}
#else
for(; xb < xbe; xc0++) {
if ( (y = *xb++) !=0) {
x = xa;
xc = xc0;
carry = 0;
do {
z = *x++ * y + *xc + carry;
carry = z >> 16;
*xc++ = z & 0xffff;
}
while(x < xae);
*xc = carry;
}
}
#endif
#endif
for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ;
c->wds = wc;
return c;
}
static Bigint *p5s;
Bigint *
pow5mult
#ifdef KR_headers
(b, k) Bigint *b; int k;
#else
(Bigint *b, int k)
#endif
{
Bigint *b1, *p5, *p51;
int i;
static int p05[3] = { 5, 25, 125 };
if ( (i = k & 3) !=0)
b = multadd(b, p05[i-1], 0);
if (!(k >>= 2))
return b;
if ((p5 = p5s) == 0) {
/* first time */
#ifdef MULTIPLE_THREADS
ACQUIRE_DTOA_LOCK(1);
if (!(p5 = p5s)) {
p5 = p5s = i2b(625);
p5->next = 0;
}
FREE_DTOA_LOCK(1);
#else
p5 = p5s = i2b(625);
p5->next = 0;
#endif
}
for(;;) {
if (k & 1) {
b1 = mult(b, p5);
Bfree(b);
b = b1;
}
if (!(k >>= 1))
break;
if ((p51 = p5->next) == 0) {
#ifdef MULTIPLE_THREADS
ACQUIRE_DTOA_LOCK(1);
if (!(p51 = p5->next)) {
p51 = p5->next = mult(p5,p5);
p51->next = 0;
}
FREE_DTOA_LOCK(1);
#else
p51 = p5->next = mult(p5,p5);
p51->next = 0;
#endif
}
p5 = p51;
}
return b;
}
Bigint *
lshift
#ifdef KR_headers
(b, k) Bigint *b; int k;
#else
(Bigint *b, int k)
#endif
{
int i, k1, n, n1;
Bigint *b1;
ULong *x, *x1, *xe, z;
n = k >> kshift;
k1 = b->k;
n1 = n + b->wds + 1;
for(i = b->maxwds; n1 > i; i <<= 1)
k1++;
b1 = Balloc(k1);
x1 = b1->x;
for(i = 0; i < n; i++)
*x1++ = 0;
x = b->x;
xe = x + b->wds;
if (k &= kmask) {
#ifdef Pack_32
k1 = 32 - k;
z = 0;
do {
*x1++ = *x << k | z;
z = *x++ >> k1;
}
while(x < xe);
if ((*x1 = z) !=0)
++n1;
#else
k1 = 16 - k;
z = 0;
do {
*x1++ = *x << k & 0xffff | z;
z = *x++ >> k1;
}
while(x < xe);
if (*x1 = z)
++n1;
#endif
}
else do
*x1++ = *x++;
while(x < xe);
b1->wds = n1 - 1;
Bfree(b);
return b1;
}
int
cmp
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
{
ULong *xa, *xa0, *xb, *xb0;
int i, j;
i = a->wds;
j = b->wds;
#ifdef DEBUG
if (i > 1 && !a->x[i-1])
Bug("cmp called with a->x[a->wds-1] == 0");
if (j > 1 && !b->x[j-1])
Bug("cmp called with b->x[b->wds-1] == 0");
#endif
if (i -= j)
return i;
xa0 = a->x;
xa = xa0 + j;
xb0 = b->x;
xb = xb0 + j;
for(;;) {
if (*--xa != *--xb)
return *xa < *xb ? -1 : 1;
if (xa <= xa0)
break;
}
return 0;
}
Bigint *
diff
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
{
Bigint *c;
int i, wa, wb;
ULong *xa, *xae, *xb, *xbe, *xc;
#ifdef ULLong
ULLong borrow, y;
#else
ULong borrow, y;
#ifdef Pack_32
ULong z;
#endif
#endif
i = cmp(a,b);
if (!i) {
c = Balloc(0);
c->wds = 1;
c->x[0] = 0;
return c;
}
if (i < 0) {
c = a;
a = b;
b = c;
i = 1;
}
else
i = 0;
c = Balloc(a->k);
c->sign = i;
wa = a->wds;
xa = a->x;
xae = xa + wa;
wb = b->wds;
xb = b->x;
xbe = xb + wb;
xc = c->x;
borrow = 0;
#ifdef ULLong
do {
y = (ULLong)*xa++ - *xb++ - borrow;
borrow = y >> 32 & 1UL;
*xc++ = y & 0xffffffffUL;
}
while(xb < xbe);
while(xa < xae) {
y = *xa++ - borrow;
borrow = y >> 32 & 1UL;
*xc++ = y & 0xffffffffUL;
}
#else
#ifdef Pack_32
do {
y = (*xa & 0xffff) - (*xb & 0xffff) - borrow;
borrow = (y & 0x10000) >> 16;
z = (*xa++ >> 16) - (*xb++ >> 16) - borrow;
borrow = (z & 0x10000) >> 16;
Storeinc(xc, z, y);
}
while(xb < xbe);
while(xa < xae) {
y = (*xa & 0xffff) - borrow;
borrow = (y & 0x10000) >> 16;
z = (*xa++ >> 16) - borrow;
borrow = (z & 0x10000) >> 16;
Storeinc(xc, z, y);
}
#else
do {
y = *xa++ - *xb++ - borrow;
borrow = (y & 0x10000) >> 16;
*xc++ = y & 0xffff;
}
while(xb < xbe);
while(xa < xae) {
y = *xa++ - borrow;
borrow = (y & 0x10000) >> 16;
*xc++ = y & 0xffff;
}
#endif
#endif
while(!*--xc)
wa--;
c->wds = wa;
return c;
}
double
b2d
#ifdef KR_headers
(a, e) Bigint *a; int *e;
#else
(Bigint *a, int *e)
#endif
{
ULong *xa, *xa0, w, y, z;
int k;
U d;
#ifdef VAX
ULong d0, d1;
#else
#define d0 word0(&d)
#define d1 word1(&d)
#endif
xa0 = a->x;
xa = xa0 + a->wds;
y = *--xa;
#ifdef DEBUG
if (!y) Bug("zero y in b2d");
#endif
k = hi0bits(y);
*e = 32 - k;
#ifdef Pack_32
if (k < Ebits) {
d0 = Exp_1 | y >> (Ebits - k);
w = xa > xa0 ? *--xa : 0;
d1 = y << ((32-Ebits) + k) | w >> (Ebits - k);
goto ret_d;
}
z = xa > xa0 ? *--xa : 0;
if (k -= Ebits) {
d0 = Exp_1 | y << k | z >> (32 - k);
y = xa > xa0 ? *--xa : 0;
d1 = z << k | y >> (32 - k);
}
else {
d0 = Exp_1 | y;
d1 = z;
}
#else
if (k < Ebits + 16) {
z = xa > xa0 ? *--xa : 0;
d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k;
w = xa > xa0 ? *--xa : 0;
y = xa > xa0 ? *--xa : 0;
d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k;
goto ret_d;
}
z = xa > xa0 ? *--xa : 0;
w = xa > xa0 ? *--xa : 0;
k -= Ebits + 16;
d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k;
y = xa > xa0 ? *--xa : 0;
d1 = w << k + 16 | y << k;
#endif
ret_d:
#ifdef VAX
word0(&d) = d0 >> 16 | d0 << 16;
word1(&d) = d1 >> 16 | d1 << 16;
#endif
return dval(&d);
}
#undef d0
#undef d1
Bigint *
d2b
#ifdef KR_headers
(dd, e, bits) double dd; int *e, *bits;
#else
(double dd, int *e, int *bits)
#endif
{
Bigint *b;
U d;
#ifndef Sudden_Underflow
int i;
#endif
int de, k;
ULong *x, y, z;
#ifdef VAX
ULong d0, d1;
#else
#define d0 word0(&d)
#define d1 word1(&d)
#endif
d.d = dd;
#ifdef VAX
d0 = word0(&d) >> 16 | word0(&d) << 16;
d1 = word1(&d) >> 16 | word1(&d) << 16;
#endif
#ifdef Pack_32
b = Balloc(1);
#else
b = Balloc(2);
#endif
x = b->x;
z = d0 & Frac_mask;
d0 &= 0x7fffffff; /* clear sign bit, which we ignore */
#ifdef Sudden_Underflow
de = (int)(d0 >> Exp_shift);
#ifndef IBM
z |= Exp_msk11;
#endif
#else
if ( (de = (int)(d0 >> Exp_shift)) !=0)
z |= Exp_msk1;
#endif
#ifdef Pack_32
if ( (y = d1) !=0) {
if ( (k = lo0bits(&y)) !=0) {
x[0] = y | z << (32 - k);
z >>= k;
}
else
x[0] = y;
#ifndef Sudden_Underflow
i =
#endif
b->wds = (x[1] = z) !=0 ? 2 : 1;
}
else {
k = lo0bits(&z);
x[0] = z;
#ifndef Sudden_Underflow
i =
#endif
b->wds = 1;
k += 32;
}
#else
if ( (y = d1) !=0) {
if ( (k = lo0bits(&y)) !=0)
if (k >= 16) {
x[0] = y | z << 32 - k & 0xffff;
x[1] = z >> k - 16 & 0xffff;
x[2] = z >> k;
i = 2;
}
else {
x[0] = y & 0xffff;
x[1] = y >> 16 | z << 16 - k & 0xffff;
x[2] = z >> k & 0xffff;
x[3] = z >> k+16;
i = 3;
}
else {
x[0] = y & 0xffff;
x[1] = y >> 16;
x[2] = z & 0xffff;
x[3] = z >> 16;
i = 3;
}
}
else {
#ifdef DEBUG
if (!z)
Bug("Zero passed to d2b");
#endif
k = lo0bits(&z);
if (k >= 16) {
x[0] = z;
i = 0;
}
else {
x[0] = z & 0xffff;
x[1] = z >> 16;
i = 1;
}
k += 32;
}
while(!x[i])
--i;
b->wds = i + 1;
#endif
#ifndef Sudden_Underflow
if (de) {
#endif
#ifdef IBM
*e = (de - Bias - (P-1) << 2) + k;
*bits = 4*P + 8 - k - hi0bits(word0(&d) & Frac_mask);
#else
*e = de - Bias - (P-1) + k;
*bits = P - k;
#endif
#ifndef Sudden_Underflow
}
else {
*e = de - Bias - (P-1) + 1 + k;
#ifdef Pack_32
*bits = 32*i - hi0bits(x[i-1]);
#else
*bits = (i+2)*16 - hi0bits(x[i]);
#endif
}
#endif
return b;
}
#undef d0
#undef d1
CONST double
#ifdef IEEE_Arith
bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256
};
#else
#ifdef IBM
bigtens[] = { 1e16, 1e32, 1e64 };
CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 };
#else
bigtens[] = { 1e16, 1e32 };
CONST double tinytens[] = { 1e-16, 1e-32 };
#endif
#endif
CONST double
tens[] = {
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
1e20, 1e21, 1e22
#ifdef VAX
, 1e23, 1e24
#endif
};
char *
#ifdef KR_headers
strcp_D2A(a, b) char *a; char *b;
#else
strcp_D2A(char *a, CONST char *b)
#endif
{
while((*a = *b++))
a++;
return a;
}
#ifdef NO_STRING_H
Char *
#ifdef KR_headers
memcpy_D2A(a, b, len) Char *a; Char *b; size_t len;
#else
memcpy_D2A(void *a1, void *b1, size_t len)
#endif
{
char *a = (char*)a1, *ae = a + len;
char *b = (char*)b1, *a0 = a;
while(a < ae)
*a++ = *b++;
return a0;
}
#endif /* NO_STRING_H */

191
libquadmath/gdtoa/smisc.c Normal file
View File

@ -0,0 +1,191 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998, 1999 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
Bigint *
s2b
#ifdef KR_headers
(s, nd0, nd, y9, dplen) CONST char *s; int dplen, nd0, nd; ULong y9;
#else
(CONST char *s, int nd0, int nd, ULong y9, int dplen)
#endif
{
Bigint *b;
int i, k;
Long x, y;
x = (nd + 8) / 9;
for(k = 0, y = 1; x > y; y <<= 1, k++) ;
#ifdef Pack_32
b = Balloc(k);
b->x[0] = y9;
b->wds = 1;
#else
b = Balloc(k+1);
b->x[0] = y9 & 0xffff;
b->wds = (b->x[1] = y9 >> 16) ? 2 : 1;
#endif
i = 9;
if (9 < nd0) {
s += 9;
do b = multadd(b, 10, *s++ - '0');
while(++i < nd0);
s += dplen;
}
else
s += dplen + 9;
for(; i < nd; i++)
b = multadd(b, 10, *s++ - '0');
return b;
}
double
ratio
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
{
U da, db;
int k, ka, kb;
dval(&da) = b2d(a, &ka);
dval(&db) = b2d(b, &kb);
k = ka - kb + ULbits*(a->wds - b->wds);
#ifdef IBM
if (k > 0) {
word0(&da) += (k >> 2)*Exp_msk1;
if (k &= 3)
dval(&da) *= 1 << k;
}
else {
k = -k;
word0(&db) += (k >> 2)*Exp_msk1;
if (k &= 3)
dval(&db) *= 1 << k;
}
#else
if (k > 0)
word0(&da) += k*Exp_msk1;
else {
k = -k;
word0(&db) += k*Exp_msk1;
}
#endif
return dval(&da) / dval(&db);
}
#ifdef INFNAN_CHECK
int
match
#ifdef KR_headers
(sp, t) char **sp, *t;
#else
(CONST char **sp, char *t)
#endif
{
int c, d;
CONST char *s = *sp;
while( (d = *t++) !=0) {
if ((c = *++s) >= 'A' && c <= 'Z')
c += 'a' - 'A';
if (c != d)
return 0;
}
*sp = s + 1;
return 1;
}
#endif /* INFNAN_CHECK */
void
#ifdef KR_headers
copybits(c, n, b) ULong *c; int n; Bigint *b;
#else
copybits(ULong *c, int n, Bigint *b)
#endif
{
ULong *ce, *x, *xe;
#ifdef Pack_16
int nw, nw1;
#endif
ce = c + ((n-1) >> kshift) + 1;
x = b->x;
#ifdef Pack_32
xe = x + b->wds;
while(x < xe)
*c++ = *x++;
#else
nw = b->wds;
nw1 = nw & 1;
for(xe = x + (nw - nw1); x < xe; x += 2)
Storeinc(c, x[1], x[0]);
if (nw1)
*c++ = *x;
#endif
while(c < ce)
*c++ = 0;
}
ULong
#ifdef KR_headers
any_on(b, k) Bigint *b; int k;
#else
any_on(Bigint *b, int k)
#endif
{
int n, nwds;
ULong *x, *x0, x1, x2;
x = b->x;
nwds = b->wds;
n = k >> kshift;
if (n > nwds)
n = nwds;
else if (n < nwds && (k &= kmask)) {
x1 = x2 = x[n];
x1 >>= k;
x1 <<= k;
if (x1 != x2)
return 1;
}
x0 = x;
x += n;
while(x > x0)
if (*--x)
return 1;
return 0;
}

1065
libquadmath/gdtoa/strtodg.c Normal file

File diff suppressed because it is too large Load Diff

106
libquadmath/gdtoa/strtopQ.c Normal file
View File

@ -0,0 +1,106 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998, 2000 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
#undef _0
#undef _1
/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */
#ifdef IEEE_MC68k
#define _0 0
#define _1 1
#define _2 2
#define _3 3
#endif
#ifdef IEEE_8087
#define _0 3
#define _1 2
#define _2 1
#define _3 0
#endif
int
#ifdef KR_headers
quadmath_strtopQ(s, sp, V) CONST char *s; char **sp; void *V;
#else
quadmath_strtopQ(CONST char *s, char **sp, void *V)
#endif
{
static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, SI };
ULong bits[4];
Long exp;
int k;
ULong *L = (ULong*)V;
#ifdef Honor_FLT_ROUNDS
#include "gdtoa_fltrnds.h"
#else
#define fpi &fpi0
#endif
k = strtodg(s, sp, fpi, &exp, bits);
switch(k & STRTOG_Retmask) {
case STRTOG_NoNumber:
case STRTOG_Zero:
L[0] = L[1] = L[2] = L[3] = 0;
break;
case STRTOG_Normal:
case STRTOG_NaNbits:
L[_3] = bits[0];
L[_2] = bits[1];
L[_1] = bits[2];
L[_0] = (bits[3] & ~0x10000) | ((exp + 0x3fff + 112) << 16);
break;
case STRTOG_Denormal:
L[_3] = bits[0];
L[_2] = bits[1];
L[_1] = bits[2];
L[_0] = bits[3];
break;
case STRTOG_Infinite:
L[_0] = 0x7fff0000;
L[_1] = L[_2] = L[_3] = 0;
break;
case STRTOG_NaN:
L[0] = ld_QNAN0;
L[1] = ld_QNAN1;
L[2] = ld_QNAN2;
L[3] = ld_QNAN3;
}
if (k & STRTOG_Neg)
L[_0] |= 0x80000000L;
return k;
}

98
libquadmath/gdtoa/sum.c Normal file
View File

@ -0,0 +1,98 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
Bigint *
#ifdef KR_headers
sum(a, b) Bigint *a; Bigint *b;
#else
sum(Bigint *a, Bigint *b)
#endif
{
Bigint *c;
ULong carry, *xc, *xa, *xb, *xe, y;
#ifdef Pack_32
ULong z;
#endif
if (a->wds < b->wds) {
c = b; b = a; a = c;
}
c = Balloc(a->k);
c->wds = a->wds;
carry = 0;
xa = a->x;
xb = b->x;
xc = c->x;
xe = xc + b->wds;
#ifdef Pack_32
do {
y = (*xa & 0xffff) + (*xb & 0xffff) + carry;
carry = (y & 0x10000) >> 16;
z = (*xa++ >> 16) + (*xb++ >> 16) + carry;
carry = (z & 0x10000) >> 16;
Storeinc(xc, z, y);
}
while(xc < xe);
xe += a->wds - b->wds;
while(xc < xe) {
y = (*xa & 0xffff) + carry;
carry = (y & 0x10000) >> 16;
z = (*xa++ >> 16) + carry;
carry = (z & 0x10000) >> 16;
Storeinc(xc, z, y);
}
#else
do {
y = *xa++ + *xb++ + carry;
carry = (y & 0x10000) >> 16;
*xc++ = y & 0xffff;
}
while(xc < xe);
xe += a->wds - b->wds;
while(xc < xe) {
y = *xa++ + carry;
carry = (y & 0x10000) >> 16;
*xc++ = y & 0xffff;
}
#endif
if (carry) {
if (c->wds == c->maxwds) {
b = Balloc(c->k + 1);
Bcopy(b, c);
Bfree(c);
c = b;
}
c->x[c->wds++] = 1;
}
return c;
}

70
libquadmath/gdtoa/ulp.c Normal file
View File

@ -0,0 +1,70 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998, 1999 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
double
ulp
#ifdef KR_headers
(x) U *x;
#else
(U *x)
#endif
{
Long L;
U a;
L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
#ifndef Sudden_Underflow
if (L > 0) {
#endif
#ifdef IBM
L |= Exp_msk1 >> 4;
#endif
word0(&a) = L;
word1(&a) = 0;
#ifndef Sudden_Underflow
}
else {
L = -L >> Exp_shift;
if (L < Exp_shift) {
word0(&a) = 0x80000 >> L;
word1(&a) = 0;
}
else {
word0(&a) = 0;
L -= Exp_shift;
word1(&a) = L >= 31 ? 1 : 1 << (31 - L);
}
}
#endif
return dval(&a);
}

View File

@ -0,0 +1,6 @@
# This file is used to maintain libtool version info for libgfortran.
# See the libtool manual to understand the meaning of the fields.
# This is a separate file so that version updates don't involve re-running
# automake.
# CURRENT:REVISION:AGE
0:0:0

59
libquadmath/math/acoshq.c Normal file
View File

@ -0,0 +1,59 @@
/* e_acoshl.c -- long double version of e_acosh.c.
* Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* __ieee754_acoshl(x)
* Method :
* Based on
* acoshl(x) = logl [ x + sqrtl(x*x-1) ]
* we have
* acoshl(x) := logl(x)+ln2, if x is large; else
* acoshl(x) := logl(2x-1/(sqrtl(x*x-1)+x)) if x>2; else
* acoshl(x) := log1pl(t+sqrtl(2.0*t+t*t)); where t=x-1.
*
* Special cases:
* acoshl(x) is NaN with signal if x<1.
* acoshl(NaN) is NaN without signal.
*/
#include "quadmath-imp.h"
static const __float128
one = 1.0Q,
ln2 = 0.6931471805599453094172321214581766Q;
__float128
acoshq (__float128 x)
{
__float128 t;
uint64_t lx;
int64_t hx;
GET_FLT128_WORDS64(hx,lx,x);
if(hx<0x3fff000000000000LL) { /* x < 1 */
return (x-x)/(x-x);
} else if(hx >=0x4035000000000000LL) { /* x > 2**54 */
if(hx >=0x7fff000000000000LL) { /* x is inf of NaN */
return x+x;
} else
return logq(x)+ln2; /* acoshl(huge)=logl(2x) */
} else if(((hx-0x3fff000000000000LL)|lx)==0) {
return 0.0Q; /* acosh(1) = 0 */
} else if (hx > 0x4000000000000000LL) { /* 2**28 > x > 2 */
t=x*x;
return logq(2.0Q*x-one/(x+sqrtq(t-one)));
} else { /* 1<x<2 */
t = x-one;
return log1pq(t+sqrtq(2.0Q*t+t*t));
}
}

317
libquadmath/math/acosq.c Normal file
View File

@ -0,0 +1,317 @@
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
__float128 expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* __ieee754_acosl(x)
* Method :
* acos(x) = pi/2 - asin(x)
* acos(-x) = pi/2 + asin(x)
* For |x| <= 0.375
* acos(x) = pi/2 - asin(x)
* Between .375 and .5 the approximation is
* acos(0.4375 + x) = acos(0.4375) + x P(x) / Q(x)
* Between .5 and .625 the approximation is
* acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
* For x > 0.625,
* acos(x) = 2 asin(sqrt((1-x)/2))
* computed with an extended precision square root in the leading term.
* For x < -0.625
* acos(x) = pi - 2 asin(sqrt((1-|x|)/2))
*
* Special cases:
* if x is NaN, return x itself;
* if |x|>1, return NaN with invalid signal.
*
* Functions needed: __ieee754_sqrtl.
*/
#include "quadmath-imp.h"
static const __float128
one = 1.0Q,
pio2_hi = 1.5707963267948966192313216916397514420986Q,
pio2_lo = 4.3359050650618905123985220130216759843812E-35Q,
/* acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
-0.0625 <= x <= 0.0625
peak relative error 3.3e-35 */
rS0 = 5.619049346208901520945464704848780243887E0Q,
rS1 = -4.460504162777731472539175700169871920352E1Q,
rS2 = 1.317669505315409261479577040530751477488E2Q,
rS3 = -1.626532582423661989632442410808596009227E2Q,
rS4 = 3.144806644195158614904369445440583873264E1Q,
rS5 = 9.806674443470740708765165604769099559553E1Q,
rS6 = -5.708468492052010816555762842394927806920E1Q,
rS7 = -1.396540499232262112248553357962639431922E1Q,
rS8 = 1.126243289311910363001762058295832610344E1Q,
rS9 = 4.956179821329901954211277873774472383512E-1Q,
rS10 = -3.313227657082367169241333738391762525780E-1Q,
sS0 = -4.645814742084009935700221277307007679325E0Q,
sS1 = 3.879074822457694323970438316317961918430E1Q,
sS2 = -1.221986588013474694623973554726201001066E2Q,
sS3 = 1.658821150347718105012079876756201905822E2Q,
sS4 = -4.804379630977558197953176474426239748977E1Q,
sS5 = -1.004296417397316948114344573811562952793E2Q,
sS6 = 7.530281592861320234941101403870010111138E1Q,
sS7 = 1.270735595411673647119592092304357226607E1Q,
sS8 = -1.815144839646376500705105967064792930282E1Q,
sS9 = -7.821597334910963922204235247786840828217E-2Q,
/* 1.000000000000000000000000000000000000000E0 */
acosr5625 = 9.7338991014954640492751132535550279812151E-1Q,
pimacosr5625 = 2.1682027434402468335351320579240000860757E0Q,
/* acos(0.4375 + x) = acos(0.4375) + x rS(x) / sS(x)
-0.0625 <= x <= 0.0625
peak relative error 2.1e-35 */
P0 = 2.177690192235413635229046633751390484892E0Q,
P1 = -2.848698225706605746657192566166142909573E1Q,
P2 = 1.040076477655245590871244795403659880304E2Q,
P3 = -1.400087608918906358323551402881238180553E2Q,
P4 = 2.221047917671449176051896400503615543757E1Q,
P5 = 9.643714856395587663736110523917499638702E1Q,
P6 = -5.158406639829833829027457284942389079196E1Q,
P7 = -1.578651828337585944715290382181219741813E1Q,
P8 = 1.093632715903802870546857764647931045906E1Q,
P9 = 5.448925479898460003048760932274085300103E-1Q,
P10 = -3.315886001095605268470690485170092986337E-1Q,
Q0 = -1.958219113487162405143608843774587557016E0Q,
Q1 = 2.614577866876185080678907676023269360520E1Q,
Q2 = -9.990858606464150981009763389881793660938E1Q,
Q3 = 1.443958741356995763628660823395334281596E2Q,
Q4 = -3.206441012484232867657763518369723873129E1Q,
Q5 = -1.048560885341833443564920145642588991492E2Q,
Q6 = 6.745883931909770880159915641984874746358E1Q,
Q7 = 1.806809656342804436118449982647641392951E1Q,
Q8 = -1.770150690652438294290020775359580915464E1Q,
Q9 = -5.659156469628629327045433069052560211164E-1Q,
/* 1.000000000000000000000000000000000000000E0 */
acosr4375 = 1.1179797320499710475919903296900511518755E0Q,
pimacosr4375 = 2.0236129215398221908706530535894517323217E0Q,
/* asin(x) = x + x^3 pS(x^2) / qS(x^2)
0 <= x <= 0.5
peak relative error 1.9e-35 */
pS0 = -8.358099012470680544198472400254596543711E2Q,
pS1 = 3.674973957689619490312782828051860366493E3Q,
pS2 = -6.730729094812979665807581609853656623219E3Q,
pS3 = 6.643843795209060298375552684423454077633E3Q,
pS4 = -3.817341990928606692235481812252049415993E3Q,
pS5 = 1.284635388402653715636722822195716476156E3Q,
pS6 = -2.410736125231549204856567737329112037867E2Q,
pS7 = 2.219191969382402856557594215833622156220E1Q,
pS8 = -7.249056260830627156600112195061001036533E-1Q,
pS9 = 1.055923570937755300061509030361395604448E-3Q,
qS0 = -5.014859407482408326519083440151745519205E3Q,
qS1 = 2.430653047950480068881028451580393430537E4Q,
qS2 = -4.997904737193653607449250593976069726962E4Q,
qS3 = 5.675712336110456923807959930107347511086E4Q,
qS4 = -3.881523118339661268482937768522572588022E4Q,
qS5 = 1.634202194895541569749717032234510811216E4Q,
qS6 = -4.151452662440709301601820849901296953752E3Q,
qS7 = 5.956050864057192019085175976175695342168E2Q,
qS8 = -4.175375777334867025769346564600396877176E1Q;
/* 1.000000000000000000000000000000000000000E0 */
__float128
acosq (__float128 x)
{
__float128 z, r, w, p, q, s, t, f2;
int32_t ix, sign;
ieee854_float128 u;
u.value = x;
sign = u.words32.w0;
ix = sign & 0x7fffffff;
u.words32.w0 = ix; /* |x| */
if (ix >= 0x3fff0000) /* |x| >= 1 */
{
if (ix == 0x3fff0000
&& (u.words32.w1 | u.words32.w2 | u.words32.w3) == 0)
{ /* |x| == 1 */
if ((sign & 0x80000000) == 0)
return 0.0; /* acos(1) = 0 */
else
return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */
}
return (x - x) / (x - x); /* acos(|x| > 1) is NaN */
}
else if (ix < 0x3ffe0000) /* |x| < 0.5 */
{
if (ix < 0x3fc60000) /* |x| < 2**-57 */
return pio2_hi + pio2_lo;
if (ix < 0x3ffde000) /* |x| < .4375 */
{
/* Arcsine of x. */
z = x * x;
p = (((((((((pS9 * z
+ pS8) * z
+ pS7) * z
+ pS6) * z
+ pS5) * z
+ pS4) * z
+ pS3) * z
+ pS2) * z
+ pS1) * z
+ pS0) * z;
q = (((((((( z
+ qS8) * z
+ qS7) * z
+ qS6) * z
+ qS5) * z
+ qS4) * z
+ qS3) * z
+ qS2) * z
+ qS1) * z
+ qS0;
r = x + x * p / q;
z = pio2_hi - (r - pio2_lo);
return z;
}
/* .4375 <= |x| < .5 */
t = u.value - 0.4375Q;
p = ((((((((((P10 * t
+ P9) * t
+ P8) * t
+ P7) * t
+ P6) * t
+ P5) * t
+ P4) * t
+ P3) * t
+ P2) * t
+ P1) * t
+ P0) * t;
q = (((((((((t
+ Q9) * t
+ Q8) * t
+ Q7) * t
+ Q6) * t
+ Q5) * t
+ Q4) * t
+ Q3) * t
+ Q2) * t
+ Q1) * t
+ Q0;
r = p / q;
if (sign & 0x80000000)
r = pimacosr4375 - r;
else
r = acosr4375 + r;
return r;
}
else if (ix < 0x3ffe4000) /* |x| < 0.625 */
{
t = u.value - 0.5625Q;
p = ((((((((((rS10 * t
+ rS9) * t
+ rS8) * t
+ rS7) * t
+ rS6) * t
+ rS5) * t
+ rS4) * t
+ rS3) * t
+ rS2) * t
+ rS1) * t
+ rS0) * t;
q = (((((((((t
+ sS9) * t
+ sS8) * t
+ sS7) * t
+ sS6) * t
+ sS5) * t
+ sS4) * t
+ sS3) * t
+ sS2) * t
+ sS1) * t
+ sS0;
if (sign & 0x80000000)
r = pimacosr5625 - p / q;
else
r = acosr5625 + p / q;
return r;
}
else
{ /* |x| >= .625 */
z = (one - u.value) * 0.5;
s = sqrtq (z);
/* Compute an extended precision square root from
the Newton iteration s -> 0.5 * (s + z / s).
The change w from s to the improved value is
w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s.
Express s = f1 + f2 where f1 * f1 is exactly representable.
w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
s + w has extended precision. */
u.value = s;
u.words32.w2 = 0;
u.words32.w3 = 0;
f2 = s - u.value;
w = z - u.value * u.value;
w = w - 2.0 * u.value * f2;
w = w - f2 * f2;
w = w / (2.0 * s);
/* Arcsine of s. */
p = (((((((((pS9 * z
+ pS8) * z
+ pS7) * z
+ pS6) * z
+ pS5) * z
+ pS4) * z
+ pS3) * z
+ pS2) * z
+ pS1) * z
+ pS0) * z;
q = (((((((( z
+ qS8) * z
+ qS7) * z
+ qS6) * z
+ qS5) * z
+ qS4) * z
+ qS3) * z
+ qS2) * z
+ qS1) * z
+ qS0;
r = s + (w + s * p / q);
if (sign & 0x80000000)
w = pio2_hi + (pio2_lo - r);
else
w = r;
return 2.0 * w;
}
}

71
libquadmath/math/asinhq.c Normal file
View File

@ -0,0 +1,71 @@
/* s_asinhl.c -- long double version of s_asinh.c.
* Conversion to long double by Ulrich Drepper,
* Cygnus Support, drepper@cygnus.com.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* asinhl(x)
* Method :
* Based on
* asinhl(x) = signl(x) * logl [ |x| + sqrtl(x*x+1) ]
* we have
* asinhl(x) := x if 1+x*x=1,
* := signl(x)*(logl(x)+ln2)) for large |x|, else
* := signl(x)*logl(2|x|+1/(|x|+sqrtl(x*x+1))) if|x|>2, else
* := signl(x)*log1pl(|x| + x^2/(1 + sqrtl(1+x^2)))
*/
#include "quadmath-imp.h"
static const __float128
one = 1.0Q,
ln2 = 6.931471805599453094172321214581765681e-1Q,
huge = 1.0e+4900Q;
__float128
asinhq (__float128 x)
{
__float128 t, w;
int32_t ix, sign;
ieee854_float128 u;
u.value = x;
sign = u.words32.w0;
ix = sign & 0x7fffffff;
if (ix == 0x7fff0000)
return x + x; /* x is inf or NaN */
if (ix < 0x3fc70000)
{ /* |x| < 2^ -56 */
if (huge + x > one)
return x; /* return x inexact except 0 */
}
u.words32.w0 = ix;
if (ix > 0x40350000)
{ /* |x| > 2 ^ 54 */
w = logq (u.value) + ln2;
}
else if (ix >0x40000000)
{ /* 2^ 54 > |x| > 2.0 */
t = u.value;
w = logq (2.0 * t + one / (sqrtq (x * x + one) + t));
}
else
{ /* 2.0 > |x| > 2 ^ -56 */
t = x * x;
w = log1pq (u.value + t / (one + sqrtq (one + t)));
}
if (sign & 0x80000000)
return -w;
else
return w;
}

254
libquadmath/math/asinq.c Normal file
View File

@ -0,0 +1,254 @@
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
__float128 expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
copying permissions. These modifications are distributed here under the
following terms:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* __ieee754_asin(x)
* Method :
* Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
* we approximate asin(x) on [0,0.5] by
* asin(x) = x + x*x^2*R(x^2)
* Between .5 and .625 the approximation is
* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
* For x in [0.625,1]
* asin(x) = pi/2-2*asin(sqrt((1-x)/2))
* Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
* then for x>0.98
* asin(x) = pi/2 - 2*(s+s*z*R(z))
* = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
* For x<=0.98, let pio4_hi = pio2_hi/2, then
* f = hi part of s;
* c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
* and
* asin(x) = pi/2 - 2*(s+s*z*R(z))
* = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
* = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))
*
* Special cases:
* if x is NaN, return x itself;
* if |x|>1, return NaN with invalid signal.
*
*/
#include "quadmath-imp.h"
static const __float128
one = 1.0Q,
huge = 1.0e+4932Q,
pio2_hi = 1.5707963267948966192313216916397514420986Q,
pio2_lo = 4.3359050650618905123985220130216759843812E-35Q,
pio4_hi = 7.8539816339744830961566084581987569936977E-1Q,
/* coefficient for R(x^2) */
/* asin(x) = x + x^3 pS(x^2) / qS(x^2)
0 <= x <= 0.5
peak relative error 1.9e-35 */
pS0 = -8.358099012470680544198472400254596543711E2Q,
pS1 = 3.674973957689619490312782828051860366493E3Q,
pS2 = -6.730729094812979665807581609853656623219E3Q,
pS3 = 6.643843795209060298375552684423454077633E3Q,
pS4 = -3.817341990928606692235481812252049415993E3Q,
pS5 = 1.284635388402653715636722822195716476156E3Q,
pS6 = -2.410736125231549204856567737329112037867E2Q,
pS7 = 2.219191969382402856557594215833622156220E1Q,
pS8 = -7.249056260830627156600112195061001036533E-1Q,
pS9 = 1.055923570937755300061509030361395604448E-3Q,
qS0 = -5.014859407482408326519083440151745519205E3Q,
qS1 = 2.430653047950480068881028451580393430537E4Q,
qS2 = -4.997904737193653607449250593976069726962E4Q,
qS3 = 5.675712336110456923807959930107347511086E4Q,
qS4 = -3.881523118339661268482937768522572588022E4Q,
qS5 = 1.634202194895541569749717032234510811216E4Q,
qS6 = -4.151452662440709301601820849901296953752E3Q,
qS7 = 5.956050864057192019085175976175695342168E2Q,
qS8 = -4.175375777334867025769346564600396877176E1Q,
/* 1.000000000000000000000000000000000000000E0 */
/* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
-0.0625 <= x <= 0.0625
peak relative error 3.3e-35 */
rS0 = -5.619049346208901520945464704848780243887E0Q,
rS1 = 4.460504162777731472539175700169871920352E1Q,
rS2 = -1.317669505315409261479577040530751477488E2Q,
rS3 = 1.626532582423661989632442410808596009227E2Q,
rS4 = -3.144806644195158614904369445440583873264E1Q,
rS5 = -9.806674443470740708765165604769099559553E1Q,
rS6 = 5.708468492052010816555762842394927806920E1Q,
rS7 = 1.396540499232262112248553357962639431922E1Q,
rS8 = -1.126243289311910363001762058295832610344E1Q,
rS9 = -4.956179821329901954211277873774472383512E-1Q,
rS10 = 3.313227657082367169241333738391762525780E-1Q,
sS0 = -4.645814742084009935700221277307007679325E0Q,
sS1 = 3.879074822457694323970438316317961918430E1Q,
sS2 = -1.221986588013474694623973554726201001066E2Q,
sS3 = 1.658821150347718105012079876756201905822E2Q,
sS4 = -4.804379630977558197953176474426239748977E1Q,
sS5 = -1.004296417397316948114344573811562952793E2Q,
sS6 = 7.530281592861320234941101403870010111138E1Q,
sS7 = 1.270735595411673647119592092304357226607E1Q,
sS8 = -1.815144839646376500705105967064792930282E1Q,
sS9 = -7.821597334910963922204235247786840828217E-2Q,
/* 1.000000000000000000000000000000000000000E0 */
asinr5625 = 5.9740641664535021430381036628424864397707E-1Q;
__float128
asinq (__float128 x)
{
__float128 t = 0;
__float128 w, p, q, c, r, s;
int32_t ix, sign, flag;
ieee854_float128 u;
flag = 0;
u.value = x;
sign = u.words32.w0;
ix = sign & 0x7fffffff;
u.words32.w0 = ix; /* |x| */
if (ix >= 0x3fff0000) /* |x|>= 1 */
{
if (ix == 0x3fff0000
&& (u.words32.w1 | u.words32.w2 | u.words32.w3) == 0)
/* asin(1)=+-pi/2 with inexact */
return x * pio2_hi + x * pio2_lo;
return (x - x) / (x - x); /* asin(|x|>1) is NaN */
}
else if (ix < 0x3ffe0000) /* |x| < 0.5 */
{
if (ix < 0x3fc60000) /* |x| < 2**-57 */
{
if (huge + x > one)
return x; /* return x with inexact if x!=0 */
}
else
{
t = x * x;
/* Mark to use pS, qS later on. */
flag = 1;
}
}
else if (ix < 0x3ffe4000) /* 0.625 */
{
t = u.value - 0.5625;
p = ((((((((((rS10 * t
+ rS9) * t
+ rS8) * t
+ rS7) * t
+ rS6) * t
+ rS5) * t
+ rS4) * t
+ rS3) * t
+ rS2) * t
+ rS1) * t
+ rS0) * t;
q = ((((((((( t
+ sS9) * t
+ sS8) * t
+ sS7) * t
+ sS6) * t
+ sS5) * t
+ sS4) * t
+ sS3) * t
+ sS2) * t
+ sS1) * t
+ sS0;
t = asinr5625 + p / q;
if ((sign & 0x80000000) == 0)
return t;
else
return -t;
}
else
{
/* 1 > |x| >= 0.625 */
w = one - u.value;
t = w * 0.5;
}
p = (((((((((pS9 * t
+ pS8) * t
+ pS7) * t
+ pS6) * t
+ pS5) * t
+ pS4) * t
+ pS3) * t
+ pS2) * t
+ pS1) * t
+ pS0) * t;
q = (((((((( t
+ qS8) * t
+ qS7) * t
+ qS6) * t
+ qS5) * t
+ qS4) * t
+ qS3) * t
+ qS2) * t
+ qS1) * t
+ qS0;
if (flag) /* 2^-57 < |x| < 0.5 */
{
w = p / q;
return x + x * w;
}
s = sqrtq (t);
if (ix >= 0x3ffef333) /* |x| > 0.975 */
{
w = p / q;
t = pio2_hi - (2.0 * (s + s * w) - pio2_lo);
}
else
{
u.value = s;
u.words32.w3 = 0;
u.words32.w2 = 0;
w = u.value;
c = (t - w * w) / (s + w);
r = p / q;
p = 2.0 * s * r - (pio2_lo - 2.0 * c);
q = pio4_hi - 2.0 * w;
t = pio4_hi - (p - q);
}
if ((sign & 0x80000000) == 0)
return t;
else
return -t;
}

120
libquadmath/math/atan2q.c Normal file
View File

@ -0,0 +1,120 @@
/* e_atan2l.c -- long double version of e_atan2.c.
* Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* atan2q(y,x)
* Method :
* 1. Reduce y to positive by atan2q(y,x)=-atan2q(-y,x).
* 2. Reduce x to positive by (if x and y are unexceptional):
* ARG (x+iy) = arctan(y/x) ... if x > 0,
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
*
* Special cases:
*
* ATAN2((anything), NaN ) is NaN;
* ATAN2(NAN , (anything) ) is NaN;
* ATAN2(+-0, +(anything but NaN)) is +-0 ;
* ATAN2(+-0, -(anything but NaN)) is +-pi ;
* ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
* ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
* ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
* ATAN2(+-INF,+INF ) is +-pi/4 ;
* ATAN2(+-INF,-INF ) is +-3pi/4;
* ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
*
* Constants:
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
#include "quadmath-imp.h"
static const __float128
tiny = 1.0e-4900L,
zero = 0.0,
pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */
pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898cc51701b8 */
pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */
pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */
__float128
atan2q (__float128 y, __float128 x)
{
__float128 z;
int64_t k,m,hx,hy,ix,iy;
uint64_t lx,ly;
GET_FLT128_WORDS64(hx,lx,x);
ix = hx&0x7fffffffffffffffLL;
GET_FLT128_WORDS64(hy,ly,y);
iy = hy&0x7fffffffffffffffLL;
if(((ix|((lx|-lx)>>63))>0x7fff000000000000LL)||
((iy|((ly|-ly)>>63))>0x7fff000000000000LL)) /* x or y is NaN */
return x+y;
if(((hx-0x3fff000000000000LL)|lx)==0) return atanq(y); /* x=1.0L */
m = ((hy>>63)&1)|((hx>>62)&2); /* 2*sign(x)+sign(y) */
/* when y = 0 */
if((iy|ly)==0) {
switch(m) {
case 0:
case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
}
/* when x = 0 */
if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
/* when x is INF */
if(ix==0x7fff000000000000LL) {
if(iy==0x7fff000000000000LL) {
switch(m) {
case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
case 2: return 3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/
case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/
}
} else {
switch(m) {
case 0: return zero ; /* atan(+...,+INF) */
case 1: return -zero ; /* atan(-...,+INF) */
case 2: return pi+tiny ; /* atan(+...,-INF) */
case 3: return -pi-tiny ; /* atan(-...,-INF) */
}
}
}
/* when y is INF */
if(iy==0x7fff000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
/* compute y/x */
k = (iy-ix)>>48;
if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
else z=atanq(fabsq(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: {
uint64_t zh;
GET_FLT128_MSW64(zh,z);
SET_FLT128_MSW64(z,zh ^ 0x8000000000000000ULL);
}
return z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
return (z-pi_lo)-pi;/* atan(-,-) */
}
}

66
libquadmath/math/atanhq.c Normal file
View File

@ -0,0 +1,66 @@
/* s_atanhl.c -- __float128 version of s_atan.c.
* Conversion to __float128 by Ulrich Drepper,
* Cygnus Support, drepper@cygnus.com.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* __ieee754_atanhl(x)
* Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
* 2.For x>=0.5
* 1 2x x
* atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
* 2 1 - x 1 - x
*
* For x<0.5
* atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x))
*
* Special cases:
* atanhl(x) is NaN if |x| > 1 with signal;
* atanhl(NaN) is that NaN with no signal;
* atanhl(+-1) is +-INF with signal.
*
*/
#include "quadmath-imp.h"
static const __float128 one = 1.0Q, huge = 1e4900Q;
static const __float128 zero = 0.0Q;
__float128
atanhq (__float128 x)
{
__float128 t;
uint32_t jx, ix;
ieee854_float128 u;
u.value = x;
jx = u.words32.w0;
ix = jx & 0x7fffffff;
u.words32.w0 = ix;
if (ix >= 0x3fff0000) /* |x| >= 1.0 or infinity or NaN */
{
if (u.value == one)
return x/zero;
else
return (x-x)/(x-x);
}
if(ix<0x3fc60000 && (huge+x)>zero) return x; /* x < 2^-57 */
if(ix<0x3ffe0000) { /* x < 0.5 */
t = u.value+u.value;
t = 0.5*log1pq(t+t*u.value/(one-u.value));
} else
t = 0.5*log1pq((u.value+u.value)/(one-u.value));
if(jx & 0x80000000) return -t; else return t;
}

231
libquadmath/math/atanq.c Normal file
View File

@ -0,0 +1,231 @@
/* s_atanl.c
*
* Inverse circular tangent for 128-bit __float128 precision
* (arctangent)
*
*
*
* SYNOPSIS:
*
* __float128 x, y, atanl();
*
* y = atanl( x );
*
*
*
* DESCRIPTION:
*
* Returns radian angle between -pi/2 and +pi/2 whose tangent is x.
*
* The function uses a rational approximation of the form
* t + t^3 P(t^2)/Q(t^2), optimized for |t| < 0.09375.
*
* The argument is reduced using the identity
* arctan x - arctan u = arctan ((x-u)/(1 + ux))
* and an 83-entry lookup table for arctan u, with u = 0, 1/8, ..., 10.25.
* Use of the table improves the execution speed of the routine.
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -19, 19 4e5 1.7e-34 5.4e-35
*
*
* WARNING:
*
* This program uses integer operations on bit fields of floating-point
* numbers. It does not work with data structures other than the
* structure assumed.
*
*/
/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "quadmath-imp.h"
/* arctan(k/8), k = 0, ..., 82 */
static const __float128 atantbl[84] = {
0.0000000000000000000000000000000000000000E0Q,
1.2435499454676143503135484916387102557317E-1Q, /* arctan(0.125) */
2.4497866312686415417208248121127581091414E-1Q,
3.5877067027057222039592006392646049977698E-1Q,
4.6364760900080611621425623146121440202854E-1Q,
5.5859931534356243597150821640166127034645E-1Q,
6.4350110879328438680280922871732263804151E-1Q,
7.1882999962162450541701415152590465395142E-1Q,
7.8539816339744830961566084581987572104929E-1Q,
8.4415398611317100251784414827164750652594E-1Q,
8.9605538457134395617480071802993782702458E-1Q,
9.4200004037946366473793717053459358607166E-1Q,
9.8279372324732906798571061101466601449688E-1Q,
1.0191413442663497346383429170230636487744E0Q,
1.0516502125483736674598673120862998296302E0Q,
1.0808390005411683108871567292171998202703E0Q,
1.1071487177940905030170654601785370400700E0Q,
1.1309537439791604464709335155363278047493E0Q,
1.1525719972156675180401498626127513797495E0Q,
1.1722738811284763866005949441337046149712E0Q,
1.1902899496825317329277337748293183376012E0Q,
1.2068173702852525303955115800565576303133E0Q,
1.2220253232109896370417417439225704908830E0Q,
1.2360594894780819419094519711090786987027E0Q,
1.2490457723982544258299170772810901230778E0Q,
1.2610933822524404193139408812473357720101E0Q,
1.2722973952087173412961937498224804940684E0Q,
1.2827408797442707473628852511364955306249E0Q,
1.2924966677897852679030914214070816845853E0Q,
1.3016288340091961438047858503666855921414E0Q,
1.3101939350475556342564376891719053122733E0Q,
1.3182420510168370498593302023271362531155E0Q,
1.3258176636680324650592392104284756311844E0Q,
1.3329603993374458675538498697331558093700E0Q,
1.3397056595989995393283037525895557411039E0Q,
1.3460851583802539310489409282517796256512E0Q,
1.3521273809209546571891479413898128509842E0Q,
1.3578579772154994751124898859640585287459E0Q,
1.3633001003596939542892985278250991189943E0Q,
1.3684746984165928776366381936948529556191E0Q,
1.3734007669450158608612719264449611486510E0Q,
1.3780955681325110444536609641291551522494E0Q,
1.3825748214901258580599674177685685125566E0Q,
1.3868528702577214543289381097042486034883E0Q,
1.3909428270024183486427686943836432060856E0Q,
1.3948567013423687823948122092044222644895E0Q,
1.3986055122719575950126700816114282335732E0Q,
1.4021993871854670105330304794336492676944E0Q,
1.4056476493802697809521934019958079881002E0Q,
1.4089588955564736949699075250792569287156E0Q,
1.4121410646084952153676136718584891599630E0Q,
1.4152014988178669079462550975833894394929E0Q,
1.4181469983996314594038603039700989523716E0Q,
1.4209838702219992566633046424614466661176E0Q,
1.4237179714064941189018190466107297503086E0Q,
1.4263547484202526397918060597281265695725E0Q,
1.4288992721907326964184700745371983590908E0Q,
1.4313562697035588982240194668401779312122E0Q,
1.4337301524847089866404719096698873648610E0Q,
1.4360250423171655234964275337155008780675E0Q,
1.4382447944982225979614042479354815855386E0Q,
1.4403930189057632173997301031392126865694E0Q,
1.4424730991091018200252920599377292525125E0Q,
1.4444882097316563655148453598508037025938E0Q,
1.4464413322481351841999668424758804165254E0Q,
1.4483352693775551917970437843145232637695E0Q,
1.4501726582147939000905940595923466567576E0Q,
1.4519559822271314199339700039142990228105E0Q,
1.4536875822280323362423034480994649820285E0Q,
1.4553696664279718992423082296859928222270E0Q,
1.4570043196511885530074841089245667532358E0Q,
1.4585935117976422128825857356750737658039E0Q,
1.4601391056210009726721818194296893361233E0Q,
1.4616428638860188872060496086383008594310E0Q,
1.4631064559620759326975975316301202111560E0Q,
1.4645314639038178118428450961503371619177E0Q,
1.4659193880646627234129855241049975398470E0Q,
1.4672716522843522691530527207287398276197E0Q,
1.4685896086876430842559640450619880951144E0Q,
1.4698745421276027686510391411132998919794E0Q,
1.4711276743037345918528755717617308518553E0Q,
1.4723501675822635384916444186631899205983E0Q,
1.4735431285433308455179928682541563973416E0Q, /* arctan(10.25) */
1.5707963267948966192313216916397514420986E0Q /* pi/2 */
};
/* arctan t = t + t^3 p(t^2) / q(t^2)
|t| <= 0.09375
peak relative error 5.3e-37 */
static const __float128
p0 = -4.283708356338736809269381409828726405572E1Q,
p1 = -8.636132499244548540964557273544599863825E1Q,
p2 = -5.713554848244551350855604111031839613216E1Q,
p3 = -1.371405711877433266573835355036413750118E1Q,
p4 = -8.638214309119210906997318946650189640184E-1Q,
q0 = 1.285112506901621042780814422948906537959E2Q,
q1 = 3.361907253914337187957855834229672347089E2Q,
q2 = 3.180448303864130128268191635189365331680E2Q,
q3 = 1.307244136980865800160844625025280344686E2Q,
q4 = 2.173623741810414221251136181221172551416E1Q;
/* q5 = 1.000000000000000000000000000000000000000E0 */
__float128
atanq (__float128 x)
{
int k, sign;
__float128 t, u, p, q;
ieee854_float128 s;
s.value = x;
k = s.words32.w0;
if (k & 0x80000000)
sign = 1;
else
sign = 0;
/* Check for IEEE special cases. */
k &= 0x7fffffff;
if (k >= 0x7fff0000)
{
/* NaN. */
if ((k & 0xffff) | s.words32.w1 | s.words32.w2 | s.words32.w3)
return (x + x);
/* Infinity. */
if (sign)
return -atantbl[83];
else
return atantbl[83];
}
if (sign)
x = -x;
if (k >= 0x40024800) /* 10.25 */
{
k = 83;
t = -1.0/x;
}
else
{
/* Index of nearest table element.
Roundoff to integer is asymmetrical to avoid cancellation when t < 0
(cf. fdlibm). */
k = 8.0Q * x + 0.25Q;
u = 0.125Q * k;
/* Small arctan argument. */
t = (x - u) / (1.0 + x * u);
}
/* Arctan of small argument t. */
u = t * t;
p = ((((p4 * u) + p3) * u + p2) * u + p1) * u + p0;
q = ((((u + q4) * u + q3) * u + q2) * u + q1) * u + q0;
u = t * u * p / q + t;
/* arctan x = arctan u + arctan t */
u = atantbl[k] + u;
if (sign)
return (-u);
else
return u;
}

64
libquadmath/math/cbrtq.c Normal file
View File

@ -0,0 +1,64 @@
#include "quadmath-imp.h"
#include <math.h>
#include <float.h>
__float128
cbrtq (const __float128 x)
{
__float128 y;
int exp, i;
if (x == 0)
return x;
if (isnanq (x))
return x;
if (x <= DBL_MAX && x >= DBL_MIN)
{
/* Use double result as starting point. */
y = cbrt ((double) x);
/* Two Newton iterations. */
y -= 0.333333333333333333333333333333333333333333333333333Q
* (y - x / (y * y));
y -= 0.333333333333333333333333333333333333333333333333333Q
* (y - x / (y * y));
return y;
}
#ifdef HAVE_CBRTL
if (x <= LDBL_MAX && x >= LDBL_MIN)
{
/* Use long double result as starting point. */
y = cbrtl ((long double) x);
/* One Newton iteration. */
y -= 0.333333333333333333333333333333333333333333333333333Q
* (y - x / (y * y));
return y;
}
#endif
/* If we're outside of the range of C types, we have to compute
the initial guess the hard way. */
y = frexpq (x, &exp);
i = exp % 3;
y = (i >= 0 ? i : -i);
if (i == 1)
y *= 2, exp--;
else if (i == 2)
y *= 4, exp -= 2;
y = cbrt (y);
y = scalbnq (y, exp / 3);
/* Two Newton iterations. */
y -= 0.333333333333333333333333333333333333333333333333333Q
* (y - x / (y * y));
y -= 0.333333333333333333333333333333333333333333333333333Q
* (y - x / (y * y));
return y;
}

61
libquadmath/math/ceilq.c Normal file
View File

@ -0,0 +1,61 @@
/* s_ceill.c -- long double version of s_ceil.c.
* Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include "quadmath-imp.h"
static const __float128 huge = 1.0e4930Q;
__float128
ceilq (__float128 x)
{
int64_t i0,i1,j0;
uint64_t i,j;
GET_FLT128_WORDS64(i0,i1,x);
j0 = ((i0>>48)&0x7fff)-0x3fff;
if(j0<48) {
if(j0<0) { /* raise inexact if x != 0 */
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
if(i0<0) {i0=0x8000000000000000ULL;i1=0;}
else if((i0|i1)!=0) { i0=0x3fff000000000000ULL;i1=0;}
}
} else {
i = (0x0000ffffffffffffULL)>>j0;
if(((i0&i)|i1)==0) return x; /* x is integral */
if(huge+x>0.0) { /* raise inexact flag */
if(i0>0) i0 += (0x0001000000000000LL)>>j0;
i0 &= (~i); i1=0;
}
}
} else if (j0>111) {
if(j0==0x4000) return x+x; /* inf or NaN */
else return x; /* x is integral */
} else {
i = -1ULL>>(j0-48);
if((i1&i)==0) return x; /* x is integral */
if(huge+x>0.0) { /* raise inexact flag */
if(i0>0) {
if(j0==48) i0+=1;
else {
j = i1+(1LL<<(112-j0));
if(j<i1) i0 +=1 ; /* got a carry */
i1=j;
}
}
i1 &= (~i);
}
}
SET_FLT128_WORDS64(x,i0,i1);
return x;
}

210
libquadmath/math/complex.c Normal file
View File

@ -0,0 +1,210 @@
#include "quadmath-imp.h"
#define REALPART(z) (__real__(z))
#define IMAGPART(z) (__imag__(z))
#define COMPLEX_ASSIGN(z_, r_, i_) {__real__(z_) = (r_); __imag__(z_) = (i_);}
// Horrible... GCC doesn't know how to multiply or divide these
// __complex128 things. We have to do it on our own.
// Protect it around macros so, some day, we can switch it on
#if 0
# define C128_MULT(x,y) ((x)*(y))
# define C128_DIV(x,y) ((x)/(y))
#else
#define C128_MULT(x,y) mult_c128(x,y)
#define C128_DIV(x,y) div_c128(x,y)
static inline __complex128 mult_c128 (__complex128 x, __complex128 y)
{
__float128 r1 = REALPART(x), i1 = IMAGPART(x);
__float128 r2 = REALPART(y), i2 = IMAGPART(y);
__complex128 res;
COMPLEX_ASSIGN(res, r1*r2 - i1*i2, i2*r1 + i1*r2);
return res;
}
// Careful: the algorithm for the division sucks. A lot.
static inline __complex128 div_c128 (__complex128 x, __complex128 y)
{
__float128 n = hypotq (REALPART (y), IMAGPART (y));
__float128 r1 = REALPART(x), i1 = IMAGPART(x);
__float128 r2 = REALPART(y), i2 = IMAGPART(y);
__complex128 res;
COMPLEX_ASSIGN(res, r1*r2 + i1*i2, i1*r2 - i2*r1);
return res / n;
}
#endif
__float128
cabsq (__complex128 z)
{
return hypotq (REALPART (z), IMAGPART (z));
}
__complex128
cexpq (__complex128 z)
{
__float128 a, b;
__complex128 v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cosq (b), sinq (b));
return expq (a) * v;
}
__complex128
cexpiq (__float128 x)
{
__complex128 v;
COMPLEX_ASSIGN (v, cosq (x), sinq (x));
return v;
}
__float128
cargq (__complex128 z)
{
return atan2q (IMAGPART (z), REALPART (z));
}
__complex128
clogq (__complex128 z)
{
__complex128 v;
COMPLEX_ASSIGN (v, logq (cabsq (z)), cargq (z));
return v;
}
__complex128
clog10q (__complex128 z)
{
__complex128 v;
COMPLEX_ASSIGN (v, log10q (cabsq (z)), cargq (z));
return v;
}
__complex128
cpowq (__complex128 base, __complex128 power)
{
return cexpq (C128_MULT(power, clogq (base)));
}
__complex128
csinq (__complex128 a)
{
__float128 r = REALPART (a), i = IMAGPART (a);
__complex128 v;
COMPLEX_ASSIGN (v, sinq (r) * coshq (i), cosq (r) * sinhq (i));
return v;
}
__complex128
csinhq (__complex128 a)
{
__float128 r = REALPART (a), i = IMAGPART (a);
__complex128 v;
COMPLEX_ASSIGN (v, sinhq (r) * cosq (i), coshq (r) * sinq (i));
return v;
}
__complex128
ccosq (__complex128 a)
{
__float128 r = REALPART (a), i = IMAGPART (a);
__complex128 v;
COMPLEX_ASSIGN (v, cosq (r) * coshq (i), - (sinq (r) * sinhq (i)));
return v;
}
__complex128
ccoshq (__complex128 a)
{
__float128 r = REALPART (a), i = IMAGPART (a);
__complex128 v;
COMPLEX_ASSIGN (v, coshq (r) * cosq (i), sinhq (r) * sinq (i));
return v;
}
__complex128
ctanq (__complex128 a)
{
__float128 rt = tanq (REALPART (a)), it = tanhq (IMAGPART (a));
__complex128 n, d;
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d, 1, - (rt * it));
return C128_DIV(n,d);
}
__complex128
ctanhq (__complex128 a)
{
__float128 rt = tanhq (REALPART (a)), it = tanq (IMAGPART (a));
__complex128 n, d;
COMPLEX_ASSIGN (n, rt, it);
COMPLEX_ASSIGN (d, 1, rt * it);
return C128_DIV(n,d);
}
/* Square root algorithm from glibc. */
__complex128
csqrtq (__complex128 z)
{
__float128 re = REALPART(z), im = IMAGPART(z);
__complex128 v;
if (im == 0)
{
if (re < 0)
{
COMPLEX_ASSIGN (v, 0, copysignq (sqrtq (-re), im));
}
else
{
COMPLEX_ASSIGN (v, fabsq (sqrtq (re)), copysignq (0, im));
}
}
else if (re == 0)
{
__float128 r = sqrtq (0.5 * fabsq (im));
COMPLEX_ASSIGN (v, r, copysignq (r, im));
}
else
{
__float128 d = hypotq (re, im);
__float128 r, s;
/* Use the identity 2 Re res Im res = Im x
to avoid cancellation error in d +/- Re x. */
if (re > 0)
r = sqrtq (0.5 * d + 0.5 * re), s = (0.5 * im) / r;
else
s = sqrtq (0.5 * d - 0.5 * re), r = fabsq ((0.5 * im) / s);
COMPLEX_ASSIGN (v, r, copysignq (s, im));
}
return v;
}

View File

@ -0,0 +1,26 @@
/* s_copysignl.c -- long double version of s_copysign.c.
* Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include "quadmath-imp.h"
__float128
copysignq (__float128 x, __float128 y)
{
uint64_t hx,hy;
GET_FLT128_MSW64(hx,x);
GET_FLT128_MSW64(hy,y);
SET_FLT128_MSW64(x,(hx&0x7fffffffffffffffULL)|(hy&0x8000000000000000ULL));
return x;
}

108
libquadmath/math/coshq.c Normal file
View File

@ -0,0 +1,108 @@
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* Changes for 128-bit __float128 are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* __ieee754_coshl(x)
* Method :
* mathematically coshl(x) if defined to be (exp(x)+exp(-x))/2
* 1. Replace x by |x| (coshl(x) = coshl(-x)).
* 2.
* [ exp(x) - 1 ]^2
* 0 <= x <= ln2/2 : coshl(x) := 1 + -------------------
* 2*exp(x)
*
* exp(x) + 1/exp(x)
* ln2/2 <= x <= 22 : coshl(x) := -------------------
* 2
* 22 <= x <= lnovft : coshl(x) := expl(x)/2
* lnovft <= x <= ln2ovft: coshl(x) := expl(x/2)/2 * expl(x/2)
* ln2ovft < x : coshl(x) := huge*huge (overflow)
*
* Special cases:
* coshl(x) is |x| if x is +INF, -INF, or NaN.
* only coshl(0)=1 is exact for finite x.
*/
#include "quadmath-imp.h"
static const __float128 one = 1.0Q, half = 0.5Q, huge = 1.0e4900Q,
ovf_thresh = 1.1357216553474703894801348310092223067821E4Q;
__float128
coshq (__float128 x)
{
__float128 t, w;
int32_t ex;
ieee854_float128 u;
u.value = x;
ex = u.words32.w0 & 0x7fffffff;
/* Absolute value of x. */
u.words32.w0 = ex;
/* x is INF or NaN */
if (ex >= 0x7fff0000)
return x * x;
/* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */
if (ex < 0x3ffd62e4) /* 0.3465728759765625 */
{
t = expm1q (u.value);
w = one + t;
if (ex < 0x3fb80000) /* |x| < 2^-116 */
return w; /* cosh(tiny) = 1 */
return one + (t * t) / (w + w);
}
/* |x| in [0.5*ln2,40], return (exp(|x|)+1/exp(|x|)/2; */
if (ex < 0x40044000)
{
t = expq (u.value);
return half * t + half / t;
}
/* |x| in [22, ln(maxdouble)] return half*exp(|x|) */
if (ex <= 0x400c62e3) /* 11356.375 */
return half * expq (u.value);
/* |x| in [log(maxdouble), overflowthresold] */
if (u.value <= ovf_thresh)
{
w = expq (half * u.value);
t = half * w;
return t * w;
}
/* |x| > overflowthresold, cosh(x) overflow */
return huge * huge;
}

Some files were not shown because too many files have changed in this diff Show More