aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>2013-03-14 01:01:10 +0100
committerBernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>2013-03-14 01:01:10 +0100
commitdac735288de12c0d7ddcf58ea40c559be33cf726 (patch)
tree903bedf549be20f8e807e47b320f90412bc1139f
downloadmpfr-current-master.tar.gz
mpfr-current: Import mpfr 3.1.2HEADmaster
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
-rw-r--r--AUTHORS23
-rw-r--r--BUGS73
-rw-r--r--COPYING674
-rw-r--r--COPYING.LESSER165
-rw-r--r--ChangeLog65716
-rw-r--r--INSTALL651
-rw-r--r--Makefile.am32
-rw-r--r--Makefile.in844
-rw-r--r--NEWS314
-rw-r--r--PATCHES0
-rw-r--r--README84
-rw-r--r--TODO434
-rw-r--r--VERSION1
-rw-r--r--acinclude.m4918
-rw-r--r--aclocal.m41053
-rwxr-xr-xcompile343
-rwxr-xr-xconfig.guess1530
-rwxr-xr-xconfig.sub1782
-rwxr-xr-xconfigure17228
-rw-r--r--configure.ac561
-rwxr-xr-xdepcomp708
-rw-r--r--doc/FAQ.html389
-rw-r--r--doc/Makefile.am18
-rw-r--r--doc/Makefile.in716
-rw-r--r--doc/fdl.texi454
-rw-r--r--doc/mpfr.info4266
-rw-r--r--doc/mpfr.texi3658
-rw-r--r--doc/texinfo.tex9977
-rw-r--r--examples/ReadMe1
-rw-r--r--examples/divworst.c97
-rw-r--r--examples/rndo-add.c91
-rw-r--r--examples/sample.c56
-rw-r--r--examples/version.c111
-rwxr-xr-xinstall-sh527
-rw-r--r--ltmain.sh9661
-rw-r--r--m4/libtool.m47999
-rw-r--r--m4/ltoptions.m4384
-rw-r--r--m4/ltsugar.m4123
-rw-r--r--m4/ltversion.m423
-rw-r--r--m4/lt~obsolete.m498
-rw-r--r--m4/size_max.m472
-rwxr-xr-xmissing331
-rw-r--r--src/Makefile.am93
-rw-r--r--src/Makefile.in935
-rw-r--r--src/abort_prec_max.c32
-rw-r--r--src/acos.c146
-rw-r--r--src/acosh.c158
-rw-r--r--src/add.c111
-rw-r--r--src/add1.c538
-rw-r--r--src/add1sp.c387
-rw-r--r--src/add_d.c52
-rw-r--r--src/add_ui.c58
-rw-r--r--src/agm.c319
-rw-r--r--src/ai.c664
-rw-r--r--src/amd/amdfam10/mparam.h236
-rw-r--r--src/amd/athlon/mparam.h90
-rw-r--r--src/amd/k8/mparam.h236
-rw-r--r--src/arm/mparam.h232
-rw-r--r--src/asin.c125
-rw-r--r--src/asinh.c119
-rw-r--r--src/atan.c437
-rw-r--r--src/atan2.c281
-rw-r--r--src/atanh.c130
-rw-r--r--src/bernoulli.c80
-rw-r--r--src/buildopt.c63
-rw-r--r--src/cache.c145
-rw-r--r--src/cbrt.c153
-rw-r--r--src/check.c80
-rw-r--r--src/clear.c31
-rw-r--r--src/clears.c61
-rw-r--r--src/cmp.c104
-rw-r--r--src/cmp2.c243
-rw-r--r--src/cmp_abs.c94
-rw-r--r--src/cmp_d.c38
-rw-r--r--src/cmp_ld.c38
-rw-r--r--src/cmp_si.c101
-rw-r--r--src/cmp_ui.c101
-rw-r--r--src/comparisons.c78
-rw-r--r--src/const_catalan.c153
-rw-r--r--src/const_euler.c221
-rw-r--r--src/const_log2.c200
-rw-r--r--src/const_pi.c128
-rw-r--r--src/constant.c28
-rw-r--r--src/copysign.c38
-rw-r--r--src/cos.c298
-rw-r--r--src/cosh.c128
-rw-r--r--src/cot.c96
-rw-r--r--src/coth.c93
-rw-r--r--src/csc.c76
-rw-r--r--src/csch.c79
-rw-r--r--src/d_div.c50
-rw-r--r--src/d_sub.c50
-rw-r--r--src/digamma.c378
-rw-r--r--src/dim.c48
-rw-r--r--src/div.c790
-rw-r--r--src/div_2exp.c33
-rw-r--r--src/div_2si.c60
-rw-r--r--src/div_2ui.c61
-rw-r--r--src/div_d.c51
-rw-r--r--src/div_ui.c281
-rw-r--r--src/dump.c30
-rw-r--r--src/eint.c319
-rw-r--r--src/eq.c141
-rw-r--r--src/erf.c262
-rw-r--r--src/erfc.c277
-rw-r--r--src/exceptions.c360
-rw-r--r--src/exp.c164
-rw-r--r--src/exp10.c29
-rw-r--r--src/exp2.c151
-rw-r--r--src/exp3.c335
-rw-r--r--src/exp_2.c421
-rw-r--r--src/expm1.c179
-rw-r--r--src/extract.c55
-rw-r--r--src/factorial.c113
-rw-r--r--src/fits_intmax.c107
-rw-r--r--src/fits_s.h89
-rw-r--r--src/fits_sint.c28
-rw-r--r--src/fits_slong.c28
-rw-r--r--src/fits_sshort.c28
-rw-r--r--src/fits_u.h67
-rw-r--r--src/fits_uint.c27
-rw-r--r--src/fits_uintmax.c77
-rw-r--r--src/fits_ulong.c27
-rw-r--r--src/fits_ushort.c27
-rw-r--r--src/fma.c302
-rw-r--r--src/fms.c304
-rw-r--r--src/frac.c144
-rw-r--r--src/free_cache.c59
-rw-r--r--src/frexp.c56
-rw-r--r--src/gamma.c439
-rw-r--r--src/gammaonethird.c191
-rw-r--r--src/gen_inverse.h106
-rw-r--r--src/generic/mparam.h69
-rw-r--r--src/get_d.c183
-rw-r--r--src/get_d64.c400
-rw-r--r--src/get_exp.c31
-rw-r--r--src/get_f.c148
-rw-r--r--src/get_flt.c123
-rw-r--r--src/get_ld.c222
-rw-r--r--src/get_patches.c29
-rw-r--r--src/get_si.c69
-rw-r--r--src/get_sj.c123
-rw-r--r--src/get_str.c2555
-rw-r--r--src/get_ui.c65
-rw-r--r--src/get_uj.c82
-rw-r--r--src/get_z.c61
-rw-r--r--src/get_z_exp.c79
-rw-r--r--src/gmp_op.c489
-rw-r--r--src/grandom.c198
-rw-r--r--src/hppa/mparam.h233
-rw-r--r--src/hypot.c194
-rw-r--r--src/ia64/mparam.h233
-rw-r--r--src/ieee_floats.h80
-rw-r--r--src/init.c29
-rw-r--r--src/init2.c69
-rw-r--r--src/inits.c62
-rw-r--r--src/inits2.c66
-rw-r--r--src/inp_str.c89
-rw-r--r--src/int_ceil_log2.c42
-rw-r--r--src/isinf.c29
-rw-r--r--src/isinteger.c59
-rw-r--r--src/isnan.c29
-rw-r--r--src/isnum.c29
-rw-r--r--src/isqrt.c84
-rw-r--r--src/isregular.c29
-rw-r--r--src/iszero.c29
-rw-r--r--src/jn.c329
-rw-r--r--src/jyn_asympt.c269
-rw-r--r--src/li2.c634
-rw-r--r--src/lngamma.c738
-rw-r--r--src/log.c171
-rw-r--r--src/log10.c150
-rw-r--r--src/log1p.c158
-rw-r--r--src/log2.c142
-rw-r--r--src/logging.c124
-rw-r--r--src/min_prec.c33
-rw-r--r--src/minmax.c92
-rw-r--r--src/modf.c102
-rw-r--r--src/mp_clz_tab.c38
-rw-r--r--src/mparam_h.in92
-rw-r--r--src/mpf2mpfr.h175
-rw-r--r--src/mpfr-gmp.c386
-rw-r--r--src/mpfr-gmp.h411
-rw-r--r--src/mpfr-impl.h1924
-rw-r--r--src/mpfr-intmax.h40
-rw-r--r--src/mpfr-longlong.h1943
-rw-r--r--src/mpfr-thread.h48
-rw-r--r--src/mpfr.h1059
-rw-r--r--src/mpn_exp.c174
-rw-r--r--src/mul.c547
-rw-r--r--src/mul_2exp.c33
-rw-r--r--src/mul_2si.c59
-rw-r--r--src/mul_2ui.c66
-rw-r--r--src/mul_d.c52
-rw-r--r--src/mul_ui.c133
-rw-r--r--src/mulders.c495
-rw-r--r--src/neg.c39
-rw-r--r--src/next.c150
-rw-r--r--src/out_str.c98
-rw-r--r--src/pow.c715
-rw-r--r--src/pow_si.c250
-rw-r--r--src/pow_ui.c164
-rw-r--r--src/pow_z.c373
-rw-r--r--src/powerof2.c49
-rw-r--r--src/powerpc32/mparam.h232
-rw-r--r--src/powerpc64/mparam.h233
-rw-r--r--src/print_raw.c129
-rw-r--r--src/print_rnd_mode.c46
-rw-r--r--src/printf.c215
-rw-r--r--src/rec_sqrt.c556
-rw-r--r--src/reldiff.c73
-rw-r--r--src/rem1.c229
-rw-r--r--src/rint.c437
-rw-r--r--src/root.c205
-rw-r--r--src/round_near_x.c233
-rw-r--r--src/round_p.c123
-rw-r--r--src/round_prec.c240
-rw-r--r--src/round_raw_generic.c259
-rw-r--r--src/scale2.c91
-rw-r--r--src/sec.c34
-rw-r--r--src/sech.c40
-rw-r--r--src/set.c80
-rw-r--r--src/set_d.c255
-rw-r--r--src/set_d64.c224
-rw-r--r--src/set_dfl_prec.c41
-rw-r--r--src/set_exp.c37
-rw-r--r--src/set_f.c99
-rw-r--r--src/set_flt.c34
-rw-r--r--src/set_inf.c33
-rw-r--r--src/set_ld.c331
-rw-r--r--src/set_nan.c31
-rw-r--r--src/set_prc_raw.c31
-rw-r--r--src/set_prec.c55
-rw-r--r--src/set_q.c133
-rw-r--r--src/set_rnd.c40
-rw-r--r--src/set_si.c30
-rw-r--r--src/set_si_2exp.c73
-rw-r--r--src/set_sj.c52
-rw-r--r--src/set_str.c42
-rw-r--r--src/set_str_raw.c55
-rw-r--r--src/set_ui.c30
-rw-r--r--src/set_ui_2exp.c72
-rw-r--r--src/set_uj.c123
-rw-r--r--src/set_z.c30
-rw-r--r--src/set_z_exp.c180
-rw-r--r--src/set_zero.c31
-rw-r--r--src/setmax.c41
-rw-r--r--src/setmin.c38
-rw-r--r--src/setsign.c30
-rw-r--r--src/sgn.c40
-rw-r--r--src/si_op.c57
-rw-r--r--src/signbit.c30
-rw-r--r--src/sin.c183
-rw-r--r--src/sin_cos.c662
-rw-r--r--src/sinh.c184
-rw-r--r--src/sinh_cosh.c161
-rw-r--r--src/sparc64/mparam.h233
-rw-r--r--src/sqr.c112
-rw-r--r--src/sqrt.c231
-rw-r--r--src/sqrt_ui.c54
-rw-r--r--src/stack_interface.c104
-rw-r--r--src/strtofr.c851
-rw-r--r--src/sub.c116
-rw-r--r--src/sub1.c657
-rw-r--r--src/sub1sp.c810
-rw-r--r--src/sub_d.c51
-rw-r--r--src/sub_ui.c60
-rw-r--r--src/subnormal.c163
-rw-r--r--src/sum.c316
-rw-r--r--src/swap.c54
-rw-r--r--src/tan.c89
-rw-r--r--src/tanh.c153
-rw-r--r--src/uceil_exp2.c65
-rw-r--r--src/uceil_log2.c63
-rw-r--r--src/ufloor_log2.c53
-rw-r--r--src/ui_div.c103
-rw-r--r--src/ui_pow.c41
-rw-r--r--src/ui_pow_ui.c95
-rw-r--r--src/ui_sub.c68
-rw-r--r--src/urandom.c147
-rw-r--r--src/urandomb.c108
-rw-r--r--src/vasprintf.c2086
-rw-r--r--src/version.c29
-rw-r--r--src/volatile.c36
-rw-r--r--src/x86/core2/mparam.h234
-rw-r--r--src/x86/mparam.h233
-rw-r--r--src/x86_64/core2/mparam.h236
-rw-r--r--src/x86_64/pentium4/mparam.h160
-rw-r--r--src/yn.c426
-rw-r--r--src/zeta.c466
-rw-r--r--src/zeta_ui.c230
-rw-r--r--tests/Makefile.am90
-rw-r--r--tests/Makefile.in2208
-rw-r--r--tests/cmp_str.c37
-rw-r--r--tests/inp_str.data64
-rw-r--r--tests/memory.c193
-rw-r--r--tests/mpf_compat.c25
-rw-r--r--tests/mpf_compat.h236
-rw-r--r--tests/mpfr-test.h173
-rw-r--r--tests/mpfr_compat.c25
-rw-r--r--tests/random2.c144
-rw-r--r--tests/reuse.c685
-rw-r--r--tests/rnd_mode.c70
-rw-r--r--tests/tabs.c176
-rw-r--r--tests/tacos.c187
-rw-r--r--tests/tacosh.c219
-rw-r--r--tests/tadd.c1120
-rw-r--r--tests/tadd1sp.c189
-rw-r--r--tests/tadd_d.c161
-rw-r--r--tests/tadd_ui.c116
-rw-r--r--tests/tagm.c277
-rw-r--r--tests/tai.c109
-rw-r--r--tests/tasin.c285
-rw-r--r--tests/tasinh.c161
-rw-r--r--tests/tatan.c643
-rw-r--r--tests/tatanh.c189
-rw-r--r--tests/taway.c497
-rw-r--r--tests/tbuildopt.c89
-rw-r--r--tests/tcan_round.c127
-rw-r--r--tests/tcbrt.c219
-rw-r--r--tests/tcheck.c125
-rw-r--r--tests/tcmp.c220
-rw-r--r--tests/tcmp2.c348
-rw-r--r--tests/tcmp_d.c104
-rw-r--r--tests/tcmp_ld.c105
-rw-r--r--tests/tcmp_ui.c346
-rw-r--r--tests/tcmpabs.c149
-rw-r--r--tests/tcomparisons.c131
-rw-r--r--tests/tconst_catalan.c59
-rw-r--r--tests/tconst_euler.c116
-rw-r--r--tests/tconst_log2.c201
-rw-r--r--tests/tconst_pi.c186
-rw-r--r--tests/tcopysign.c116
-rw-r--r--tests/tcos.c383
-rw-r--r--tests/tcosh.c204
-rw-r--r--tests/tcot.c144
-rw-r--r--tests/tcoth.c213
-rw-r--r--tests/tcsc.c95
-rw-r--r--tests/tcsch.c110
-rw-r--r--tests/td_div.c209
-rw-r--r--tests/td_sub.c129
-rw-r--r--tests/tdigamma.c68
-rw-r--r--tests/tdim.c114
-rw-r--r--tests/tdiv.c1136
-rw-r--r--tests/tdiv_d.c155
-rw-r--r--tests/tdiv_ui.c237
-rw-r--r--tests/teint.c216
-rw-r--r--tests/teq.c208
-rw-r--r--tests/terf.c662
-rw-r--r--tests/tests.c958
-rw-r--r--tests/texceptions.c446
-rw-r--r--tests/texp.c1022
-rw-r--r--tests/texp10.c318
-rw-r--r--tests/texp2.c379
-rw-r--r--tests/texpm1.c173
-rw-r--r--tests/tfactorial.c287
-rw-r--r--tests/tfits.c273
-rw-r--r--tests/tfma.c731
-rw-r--r--tests/tfmod.c384
-rw-r--r--tests/tfms.c644
-rw-r--r--tests/tfprintf.c445
-rw-r--r--tests/tfrac.c301
-rw-r--r--tests/tfrexp.c141
-rw-r--r--tests/tgamma.c1069
-rw-r--r--tests/tgeneric.c506
-rw-r--r--tests/tgeneric_ui.c130
-rw-r--r--tests/tget_d.c294
-rw-r--r--tests/tget_d_2exp.c121
-rw-r--r--tests/tget_f.c390
-rw-r--r--tests/tget_flt.c385
-rw-r--r--tests/tget_ld_2exp.c145
-rw-r--r--tests/tget_set_d64.c349
-rw-r--r--tests/tget_sj.c281
-rw-r--r--tests/tget_str.c1268
-rw-r--r--tests/tget_z.c201
-rw-r--r--tests/tgmpop.c1265
-rw-r--r--tests/tgrandom.c140
-rw-r--r--tests/thyperbolic.c385
-rw-r--r--tests/thypot.c326
-rw-r--r--tests/tinits.c62
-rw-r--r--tests/tinp_str.c94
-rw-r--r--tests/tinternals.c161
-rw-r--r--tests/tisnan.c212
-rw-r--r--tests/tisqrt.c94
-rw-r--r--tests/tj0.c135
-rw-r--r--tests/tj1.c88
-rw-r--r--tests/tjn.c307
-rw-r--r--tests/tl2b.c174
-rw-r--r--tests/tlgamma.c403
-rw-r--r--tests/tli2.c208
-rw-r--r--tests/tlngamma.c238
-rw-r--r--tests/tlog.c361
-rw-r--r--tests/tlog10.c122
-rw-r--r--tests/tlog1p.c150
-rw-r--r--tests/tlog2.c84
-rw-r--r--tests/tmin_prec.c102
-rw-r--r--tests/tminmax.c171
-rw-r--r--tests/tmodf.c236
-rw-r--r--tests/tmul.c697
-rw-r--r--tests/tmul.dat3
-rw-r--r--tests/tmul_2exp.c339
-rw-r--r--tests/tmul_d.c136
-rw-r--r--tests/tmul_ui.c282
-rw-r--r--tests/tnext.c168
-rw-r--r--tests/tout_str.c171
-rw-r--r--tests/toutimpl.c122
-rw-r--r--tests/tpow.c1588
-rw-r--r--tests/tpow3.c126
-rw-r--r--tests/tpow_all.c778
-rw-r--r--tests/tpow_z.c379
-rw-r--r--tests/tprintf.c505
-rw-r--r--tests/trandom.c184
-rw-r--r--tests/trec_sqrt.c210
-rw-r--r--tests/tremquo.c291
-rw-r--r--tests/trint.c448
-rw-r--r--tests/troot.c334
-rw-r--r--tests/tround_prec.c124
-rw-r--r--tests/tsec.c172
-rw-r--r--tests/tsech.c190
-rw-r--r--tests/tset.c209
-rw-r--r--tests/tset_d.c225
-rw-r--r--tests/tset_exp.c67
-rw-r--r--tests/tset_f.c207
-rw-r--r--tests/tset_ld.c312
-rw-r--r--tests/tset_q.c170
-rw-r--r--tests/tset_si.c464
-rw-r--r--tests/tset_sj.c195
-rw-r--r--tests/tset_str.c870
-rw-r--r--tests/tset_z.c142
-rw-r--r--tests/tset_z_exp.c132
-rw-r--r--tests/tsgn.c131
-rw-r--r--tests/tsi_op.c146
-rw-r--r--tests/tsin.c377
-rw-r--r--tests/tsin_cos.c725
-rw-r--r--tests/tsinh.c109
-rw-r--r--tests/tsinh_cosh.c143
-rw-r--r--tests/tsprintf.c1239
-rw-r--r--tests/tsqr.c178
-rw-r--r--tests/tsqrt.c709
-rw-r--r--tests/tsqrt_ui.c56
-rw-r--r--tests/tstckintc.c228
-rw-r--r--tests/tstdint.c63
-rw-r--r--tests/tstrtofr.c1211
-rw-r--r--tests/tsub.c658
-rw-r--r--tests/tsub1sp.c515
-rw-r--r--tests/tsub_d.c128
-rw-r--r--tests/tsub_ui.c144
-rw-r--r--tests/tsubnormal.c222
-rw-r--r--tests/tsum.c320
-rw-r--r--tests/tswap.c51
-rw-r--r--tests/ttan.c163
-rw-r--r--tests/ttanh.c138
-rw-r--r--tests/ttrunc.c133
-rw-r--r--tests/tui_div.c206
-rw-r--r--tests/tui_pow.c262
-rw-r--r--tests/tui_sub.c301
-rw-r--r--tests/turandom.c249
-rw-r--r--tests/tvalist.c76
-rw-r--r--tests/tversion.c84
-rw-r--r--tests/ty0.c98
-rw-r--r--tests/ty1.c98
-rw-r--r--tests/tyn.c192
-rw-r--r--tests/tzeta.c406
-rw-r--r--tests/tzeta_ui.c122
-rwxr-xr-xtools/ck-copyright-notice54
-rwxr-xr-xtools/ck-version-info67
-rwxr-xr-xtools/get_patches.sh34
-rw-r--r--tune/Makefile.am38
-rw-r--r--tune/Makefile.in553
-rw-r--r--tune/bidimensional_sample.c468
-rw-r--r--tune/speed.c283
-rw-r--r--tune/tuneup.c1187
472 files changed, 237066 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..5cd6c87
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,23 @@
+Authors of MPFR (in chronological order of initial contribution):
+
+Guillaume Hanrot Main author
+Fabrice Rouillier Original version of mul_ui.c, gmp_op.c
+Paul Zimmermann Main author
+Sylvie Boldo Original version of agm.c and log.c
+Jean-Luc Rémy Original version of zeta.c
+Emmanuel Jeandel Original version of exp3.c, const_pi.c, sincos.c
+Mathieu Dutour acos.c, asin.c, atan.c and early gamma.c
+Vincent Lefèvre Main author
+David Daney Hyperbolic and inverse hyperbolic functions, base-2
+ and base-10 exponential and logarithm, factorial
+Alain Delplanque Rewritten get_str.c
+Ludovic Meunier Error function (erf.c)
+Patrick Pélissier Main author
+Laurent Fousse Original version of sum.c
+Damien Stehlé Function mpfr_get_ld_2exp
+Philippe Théveny Main author
+Sylvain Chevillard Original version of ai.c
+
+The main authors are included in the MPFR mailing-list <mpfr@inria.fr>.
+This is the preferred way to contact us. For further information, please
+look at the MPFR web page <http://www.mpfr.org/>.
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000..bfc3677
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,73 @@
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+##############################################################################
+
+Known bugs:
+
+* The overflow/underflow exceptions may be badly handled in some functions;
+ specially when the intermediary internal results have exponent which
+ exceeds the hardware limit (2^30 for a 32 bits CPU, and 2^62 for a 64 bits
+ CPU) or the exact result is close to an overflow/underflow threshold.
+
+* Under Linux/x86 with the traditional FPU, some functions do not work
+ if the FPU rounding precision has been changed to single (this is a
+ bad practice and should be useless, but one never knows what other
+ software will do).
+
+* Some functions do not use MPFR_SAVE_EXPO_* macros, thus do not behave
+ correctly in a reduced exponent range.
+
+* Function hypot gives incorrect result when on the one hand the difference
+ between parameters' exponents is near 2*MPFR_EMAX_MAX and on the other hand
+ the output precision or the precision of the parameter with greatest
+ absolute value is greater than 2*MPFR_EMAX_MAX-4.
+
+Potential bugs:
+
+* Possible incorrect results due to internal underflow, which can lead to
+ a huge loss of accuracy while the error analysis doesn't take that into
+ account. If the underflow occurs at the last function call (just before
+ the MPFR_CAN_ROUND), the result should be correct (or MPFR gets into an
+ infinite loop). TODO: check the code and the error analysis.
+
+* Possible integer overflows on some machines.
+
+* Possible bugs with huge precisions (> 2^30).
+
+* Possible bugs if the chosen exponent range does not allow to represent
+ the range [1/16, 16].
+
+* Possible infinite loop in some functions for particular cases: when
+ the exact result is an exactly representable number or the middle of
+ consecutive two such numbers. However for non-algebraic functions, it is
+ believed that no such case exists, except the well-known cases like cos(0)=1,
+ exp(0)=1, and so on, and the x^y function when y is an integer or y=1/2^k.
+
+* The mpfr_set_ld function may be quite slow if the long double type has an
+ exponent of more than 15 bits.
+
+* mpfr_set_d may give wrong results on some non-IEEE architectures.
+
+* Error analysis for some functions may be incorrect (out-of-date due
+ to modifications in the code?).
+
+* Possible use of non-portable feature (pre-C99) of the integer division
+ with negative result.
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, 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
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If 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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU 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
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state 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 program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program 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.
+
+ This program 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/COPYING.LESSER b/COPYING.LESSER
new file mode 100644
index 0000000..fc8a5de
--- /dev/null
+++ b/COPYING.LESSER
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ 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 that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU 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 as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..b4438c0
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,65716 @@
+------------------------------------------------------------------------
+r8482 | vlefevre | 2013-03-13 15:29:32 +0000 (Wed, 13 Mar 2013) | 1 line
+Changed paths:
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.2.
+------------------------------------------------------------------------
+r8480 | vlefevre | 2013-03-13 01:00:16 +0000 (Wed, 13 Mar 2013) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/configure.ac
+
+[configure.ac] Corrected comment on clock_gettime.
+(merged changeset r8446 from the trunk)
+------------------------------------------------------------------------
+r8479 | zimmerma | 2013-03-12 09:37:20 +0000 (Tue, 12 Mar 2013) | 4 lines
+Changed paths:
+ M /branches/3.1/configure.ac
+ M /branches/3.1/tune/Makefile.am
+
+(merged changeset 8443-8445 from the trunk)
+Tuning: reverted changeset r8444 and applied patch by Patrick Pélissier
+for GMP 5.1.0 to link against librt conditionally.
+
+------------------------------------------------------------------------
+r8478 | vlefevre | 2013-03-12 02:20:01 +0000 (Tue, 12 Mar 2013) | 2 lines
+Changed paths:
+ M /branches/3.1/INSTALL
+
+[INSTALL] Added a paragraph about Cygwin and threading.
+(merged changeset r8477 from the trunk)
+------------------------------------------------------------------------
+r8476 | vlefevre | 2013-03-12 00:11:18 +0000 (Tue, 12 Mar 2013) | 3 lines
+Changed paths:
+ M /branches/3.1/INSTALL
+
+[INSTALL] Improved information on patches.
+(merged changeset r8475 from the trunk, after temporarily reverted
+to 3.2.0-dev with tools/update-version for the merge)
+------------------------------------------------------------------------
+r8471 | vlefevre | 2013-03-08 12:06:54 +0000 (Fri, 08 Mar 2013) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r8470 | vlefevre | 2013-03-08 11:59:32 +0000 (Fri, 08 Mar 2013) | 2 lines
+Changed paths:
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/Makefile.am
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.2-rc1 and updated libmpfr_la_LDFLAGS in
+src/Makefile.am for the next release.
+------------------------------------------------------------------------
+r8468 | vlefevre | 2013-03-08 11:44:47 +0000 (Fri, 08 Mar 2013) | 1 line
+Changed paths:
+ M /branches/3.1/NEWS
+
+[NEWS] Update for GNU MPFR 3.1.2.
+------------------------------------------------------------------------
+r8466 | vlefevre | 2013-03-08 00:34:36 +0000 (Fri, 08 Mar 2013) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r8465 | vlefevre | 2013-03-08 00:33:22 +0000 (Fri, 08 Mar 2013) | 5 lines
+Changed paths:
+ M /branches/3.1/BUGS
+ M /branches/3.1/INSTALL
+ M /branches/3.1/Makefile.am
+ M /branches/3.1/NEWS
+ M /branches/3.1/README
+ M /branches/3.1/TODO
+ M /branches/3.1/acinclude.m4
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/FAQ.html
+ M /branches/3.1/doc/Makefile.am
+ M /branches/3.1/doc/README.dev
+ M /branches/3.1/doc/faq.xsl
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/examples/divworst.c
+ M /branches/3.1/examples/rndo-add.c
+ M /branches/3.1/examples/sample.c
+ M /branches/3.1/examples/version.c
+ M /branches/3.1/src/Makefile.am
+ M /branches/3.1/src/abort_prec_max.c
+ M /branches/3.1/src/acos.c
+ M /branches/3.1/src/acosh.c
+ M /branches/3.1/src/add.c
+ M /branches/3.1/src/add1.c
+ M /branches/3.1/src/add1sp.c
+ M /branches/3.1/src/add_d.c
+ M /branches/3.1/src/add_ui.c
+ M /branches/3.1/src/agm.c
+ M /branches/3.1/src/ai.c
+ M /branches/3.1/src/amd/amdfam10/mparam.h
+ M /branches/3.1/src/amd/athlon/mparam.h
+ M /branches/3.1/src/amd/k8/mparam.h
+ M /branches/3.1/src/arm/mparam.h
+ M /branches/3.1/src/asin.c
+ M /branches/3.1/src/asinh.c
+ M /branches/3.1/src/atan.c
+ M /branches/3.1/src/atan2.c
+ M /branches/3.1/src/atanh.c
+ M /branches/3.1/src/bernoulli.c
+ M /branches/3.1/src/buildopt.c
+ M /branches/3.1/src/cache.c
+ M /branches/3.1/src/cbrt.c
+ M /branches/3.1/src/check.c
+ M /branches/3.1/src/clear.c
+ M /branches/3.1/src/clears.c
+ M /branches/3.1/src/cmp.c
+ M /branches/3.1/src/cmp2.c
+ M /branches/3.1/src/cmp_abs.c
+ M /branches/3.1/src/cmp_d.c
+ M /branches/3.1/src/cmp_ld.c
+ M /branches/3.1/src/cmp_si.c
+ M /branches/3.1/src/cmp_ui.c
+ M /branches/3.1/src/comparisons.c
+ M /branches/3.1/src/const_catalan.c
+ M /branches/3.1/src/const_euler.c
+ M /branches/3.1/src/const_log2.c
+ M /branches/3.1/src/const_pi.c
+ M /branches/3.1/src/constant.c
+ M /branches/3.1/src/copysign.c
+ M /branches/3.1/src/cos.c
+ M /branches/3.1/src/cosh.c
+ M /branches/3.1/src/cot.c
+ M /branches/3.1/src/coth.c
+ M /branches/3.1/src/csc.c
+ M /branches/3.1/src/csch.c
+ M /branches/3.1/src/d_div.c
+ M /branches/3.1/src/d_sub.c
+ M /branches/3.1/src/digamma.c
+ M /branches/3.1/src/dim.c
+ M /branches/3.1/src/div.c
+ M /branches/3.1/src/div_2exp.c
+ M /branches/3.1/src/div_2si.c
+ M /branches/3.1/src/div_2ui.c
+ M /branches/3.1/src/div_d.c
+ M /branches/3.1/src/div_ui.c
+ M /branches/3.1/src/dump.c
+ M /branches/3.1/src/eint.c
+ M /branches/3.1/src/eq.c
+ M /branches/3.1/src/erf.c
+ M /branches/3.1/src/erfc.c
+ M /branches/3.1/src/exceptions.c
+ M /branches/3.1/src/exp.c
+ M /branches/3.1/src/exp10.c
+ M /branches/3.1/src/exp2.c
+ M /branches/3.1/src/exp3.c
+ M /branches/3.1/src/exp_2.c
+ M /branches/3.1/src/expm1.c
+ M /branches/3.1/src/extract.c
+ M /branches/3.1/src/factorial.c
+ M /branches/3.1/src/fits_intmax.c
+ M /branches/3.1/src/fits_s.h
+ M /branches/3.1/src/fits_sint.c
+ M /branches/3.1/src/fits_slong.c
+ M /branches/3.1/src/fits_sshort.c
+ M /branches/3.1/src/fits_u.h
+ M /branches/3.1/src/fits_uint.c
+ M /branches/3.1/src/fits_uintmax.c
+ M /branches/3.1/src/fits_ulong.c
+ M /branches/3.1/src/fits_ushort.c
+ M /branches/3.1/src/fma.c
+ M /branches/3.1/src/fms.c
+ M /branches/3.1/src/frac.c
+ M /branches/3.1/src/free_cache.c
+ M /branches/3.1/src/frexp.c
+ M /branches/3.1/src/gamma.c
+ M /branches/3.1/src/gammaonethird.c
+ M /branches/3.1/src/gen_inverse.h
+ M /branches/3.1/src/generic/mparam.h
+ M /branches/3.1/src/get_d.c
+ M /branches/3.1/src/get_d64.c
+ M /branches/3.1/src/get_exp.c
+ M /branches/3.1/src/get_f.c
+ M /branches/3.1/src/get_flt.c
+ M /branches/3.1/src/get_ld.c
+ M /branches/3.1/src/get_si.c
+ M /branches/3.1/src/get_sj.c
+ M /branches/3.1/src/get_str.c
+ M /branches/3.1/src/get_ui.c
+ M /branches/3.1/src/get_uj.c
+ M /branches/3.1/src/get_z.c
+ M /branches/3.1/src/get_z_exp.c
+ M /branches/3.1/src/gmp_op.c
+ M /branches/3.1/src/grandom.c
+ M /branches/3.1/src/hppa/mparam.h
+ M /branches/3.1/src/hypot.c
+ M /branches/3.1/src/ia64/mparam.h
+ M /branches/3.1/src/ieee_floats.h
+ M /branches/3.1/src/init.c
+ M /branches/3.1/src/init2.c
+ M /branches/3.1/src/inits.c
+ M /branches/3.1/src/inits2.c
+ M /branches/3.1/src/inp_str.c
+ M /branches/3.1/src/int_ceil_log2.c
+ M /branches/3.1/src/isinf.c
+ M /branches/3.1/src/isinteger.c
+ M /branches/3.1/src/isnan.c
+ M /branches/3.1/src/isnum.c
+ M /branches/3.1/src/isqrt.c
+ M /branches/3.1/src/isregular.c
+ M /branches/3.1/src/iszero.c
+ M /branches/3.1/src/jn.c
+ M /branches/3.1/src/jyn_asympt.c
+ M /branches/3.1/src/li2.c
+ M /branches/3.1/src/lngamma.c
+ M /branches/3.1/src/log.c
+ M /branches/3.1/src/log10.c
+ M /branches/3.1/src/log1p.c
+ M /branches/3.1/src/log2.c
+ M /branches/3.1/src/logging.c
+ M /branches/3.1/src/min_prec.c
+ M /branches/3.1/src/minmax.c
+ M /branches/3.1/src/modf.c
+ M /branches/3.1/src/mp_clz_tab.c
+ M /branches/3.1/src/mparam_h.in
+ M /branches/3.1/src/mpf2mpfr.h
+ M /branches/3.1/src/mpfr-gmp.c
+ M /branches/3.1/src/mpfr-gmp.h
+ M /branches/3.1/src/mpfr-impl.h
+ M /branches/3.1/src/mpfr-intmax.h
+ M /branches/3.1/src/mpfr-longlong.h
+ M /branches/3.1/src/mpfr-thread.h
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/mpn_exp.c
+ M /branches/3.1/src/mul.c
+ M /branches/3.1/src/mul_2exp.c
+ M /branches/3.1/src/mul_2si.c
+ M /branches/3.1/src/mul_2ui.c
+ M /branches/3.1/src/mul_d.c
+ M /branches/3.1/src/mul_ui.c
+ M /branches/3.1/src/mulders.c
+ M /branches/3.1/src/neg.c
+ M /branches/3.1/src/next.c
+ M /branches/3.1/src/out_raw.c
+ M /branches/3.1/src/out_str.c
+ M /branches/3.1/src/pow.c
+ M /branches/3.1/src/pow_si.c
+ M /branches/3.1/src/pow_ui.c
+ M /branches/3.1/src/pow_z.c
+ M /branches/3.1/src/powerof2.c
+ M /branches/3.1/src/powerpc32/mparam.h
+ M /branches/3.1/src/powerpc64/mparam.h
+ M /branches/3.1/src/print_raw.c
+ M /branches/3.1/src/print_rnd_mode.c
+ M /branches/3.1/src/printf.c
+ M /branches/3.1/src/rec_sqrt.c
+ M /branches/3.1/src/reldiff.c
+ M /branches/3.1/src/rem1.c
+ M /branches/3.1/src/rint.c
+ M /branches/3.1/src/root.c
+ M /branches/3.1/src/round_near_x.c
+ M /branches/3.1/src/round_p.c
+ M /branches/3.1/src/round_prec.c
+ M /branches/3.1/src/round_raw_generic.c
+ M /branches/3.1/src/scale2.c
+ M /branches/3.1/src/sec.c
+ M /branches/3.1/src/sech.c
+ M /branches/3.1/src/set.c
+ M /branches/3.1/src/set_d.c
+ M /branches/3.1/src/set_d64.c
+ M /branches/3.1/src/set_dfl_prec.c
+ M /branches/3.1/src/set_exp.c
+ M /branches/3.1/src/set_f.c
+ M /branches/3.1/src/set_flt.c
+ M /branches/3.1/src/set_inf.c
+ M /branches/3.1/src/set_ld.c
+ M /branches/3.1/src/set_nan.c
+ M /branches/3.1/src/set_prc_raw.c
+ M /branches/3.1/src/set_prec.c
+ M /branches/3.1/src/set_q.c
+ M /branches/3.1/src/set_rnd.c
+ M /branches/3.1/src/set_si.c
+ M /branches/3.1/src/set_si_2exp.c
+ M /branches/3.1/src/set_sj.c
+ M /branches/3.1/src/set_str.c
+ M /branches/3.1/src/set_str_raw.c
+ M /branches/3.1/src/set_ui.c
+ M /branches/3.1/src/set_ui_2exp.c
+ M /branches/3.1/src/set_uj.c
+ M /branches/3.1/src/set_z.c
+ M /branches/3.1/src/set_z_exp.c
+ M /branches/3.1/src/set_zero.c
+ M /branches/3.1/src/setmax.c
+ M /branches/3.1/src/setmin.c
+ M /branches/3.1/src/setsign.c
+ M /branches/3.1/src/sgn.c
+ M /branches/3.1/src/si_op.c
+ M /branches/3.1/src/signbit.c
+ M /branches/3.1/src/sin.c
+ M /branches/3.1/src/sin_cos.c
+ M /branches/3.1/src/sinh.c
+ M /branches/3.1/src/sinh_cosh.c
+ M /branches/3.1/src/sparc64/mparam.h
+ M /branches/3.1/src/sqr.c
+ M /branches/3.1/src/sqrt.c
+ M /branches/3.1/src/sqrt_ui.c
+ M /branches/3.1/src/stack_interface.c
+ M /branches/3.1/src/strtofr.c
+ M /branches/3.1/src/sub.c
+ M /branches/3.1/src/sub1.c
+ M /branches/3.1/src/sub1sp.c
+ M /branches/3.1/src/sub_d.c
+ M /branches/3.1/src/sub_ui.c
+ M /branches/3.1/src/subnormal.c
+ M /branches/3.1/src/sum.c
+ M /branches/3.1/src/swap.c
+ M /branches/3.1/src/tan.c
+ M /branches/3.1/src/tanh.c
+ M /branches/3.1/src/uceil_exp2.c
+ M /branches/3.1/src/uceil_log2.c
+ M /branches/3.1/src/ufloor_log2.c
+ M /branches/3.1/src/ui_div.c
+ M /branches/3.1/src/ui_pow.c
+ M /branches/3.1/src/ui_pow_ui.c
+ M /branches/3.1/src/ui_sub.c
+ M /branches/3.1/src/urandom.c
+ M /branches/3.1/src/urandomb.c
+ M /branches/3.1/src/vasprintf.c
+ M /branches/3.1/src/version.c
+ M /branches/3.1/src/volatile.c
+ M /branches/3.1/src/x86/core2/mparam.h
+ M /branches/3.1/src/x86/mparam.h
+ M /branches/3.1/src/x86_64/core2/mparam.h
+ M /branches/3.1/src/x86_64/pentium4/mparam.h
+ M /branches/3.1/src/yn.c
+ M /branches/3.1/src/zeta.c
+ M /branches/3.1/src/zeta_ui.c
+ M /branches/3.1/tests/Makefile.am
+ M /branches/3.1/tests/cmp_str.c
+ M /branches/3.1/tests/data/digamma
+ M /branches/3.1/tests/data/li2
+ M /branches/3.1/tests/memory.c
+ M /branches/3.1/tests/mpf_compat.c
+ M /branches/3.1/tests/mpf_compat.h
+ M /branches/3.1/tests/mpfr-test.h
+ M /branches/3.1/tests/mpfr_compat.c
+ M /branches/3.1/tests/random2.c
+ M /branches/3.1/tests/reuse.c
+ M /branches/3.1/tests/rnd_mode.c
+ M /branches/3.1/tests/tabs.c
+ M /branches/3.1/tests/tacos.c
+ M /branches/3.1/tests/tacosh.c
+ M /branches/3.1/tests/tadd.c
+ M /branches/3.1/tests/tadd1sp.c
+ M /branches/3.1/tests/tadd_d.c
+ M /branches/3.1/tests/tadd_ui.c
+ M /branches/3.1/tests/tagm.c
+ M /branches/3.1/tests/tai.c
+ M /branches/3.1/tests/tasin.c
+ M /branches/3.1/tests/tasinh.c
+ M /branches/3.1/tests/tatan.c
+ M /branches/3.1/tests/tatanh.c
+ M /branches/3.1/tests/taway.c
+ M /branches/3.1/tests/tbuildopt.c
+ M /branches/3.1/tests/tcan_round.c
+ M /branches/3.1/tests/tcbrt.c
+ M /branches/3.1/tests/tcheck.c
+ M /branches/3.1/tests/tcmp.c
+ M /branches/3.1/tests/tcmp2.c
+ M /branches/3.1/tests/tcmp_d.c
+ M /branches/3.1/tests/tcmp_ld.c
+ M /branches/3.1/tests/tcmp_ui.c
+ M /branches/3.1/tests/tcmpabs.c
+ M /branches/3.1/tests/tcomparisons.c
+ M /branches/3.1/tests/tconst_catalan.c
+ M /branches/3.1/tests/tconst_euler.c
+ M /branches/3.1/tests/tconst_log2.c
+ M /branches/3.1/tests/tconst_pi.c
+ M /branches/3.1/tests/tcopysign.c
+ M /branches/3.1/tests/tcos.c
+ M /branches/3.1/tests/tcosh.c
+ M /branches/3.1/tests/tcot.c
+ M /branches/3.1/tests/tcoth.c
+ M /branches/3.1/tests/tcsc.c
+ M /branches/3.1/tests/tcsch.c
+ M /branches/3.1/tests/td_div.c
+ M /branches/3.1/tests/td_sub.c
+ M /branches/3.1/tests/tdigamma.c
+ M /branches/3.1/tests/tdim.c
+ M /branches/3.1/tests/tdiv.c
+ M /branches/3.1/tests/tdiv_d.c
+ M /branches/3.1/tests/tdiv_ui.c
+ M /branches/3.1/tests/teint.c
+ M /branches/3.1/tests/teq.c
+ M /branches/3.1/tests/terf.c
+ M /branches/3.1/tests/tests.c
+ M /branches/3.1/tests/texceptions.c
+ M /branches/3.1/tests/texp.c
+ M /branches/3.1/tests/texp10.c
+ M /branches/3.1/tests/texp2.c
+ M /branches/3.1/tests/texpm1.c
+ M /branches/3.1/tests/tfactorial.c
+ M /branches/3.1/tests/tfits.c
+ M /branches/3.1/tests/tfma.c
+ M /branches/3.1/tests/tfmod.c
+ M /branches/3.1/tests/tfms.c
+ M /branches/3.1/tests/tfprintf.c
+ M /branches/3.1/tests/tfrac.c
+ M /branches/3.1/tests/tfrexp.c
+ M /branches/3.1/tests/tgamma.c
+ M /branches/3.1/tests/tgeneric.c
+ M /branches/3.1/tests/tgeneric_ui.c
+ M /branches/3.1/tests/tget_d.c
+ M /branches/3.1/tests/tget_d_2exp.c
+ M /branches/3.1/tests/tget_f.c
+ M /branches/3.1/tests/tget_flt.c
+ M /branches/3.1/tests/tget_ld_2exp.c
+ M /branches/3.1/tests/tget_set_d64.c
+ M /branches/3.1/tests/tget_sj.c
+ M /branches/3.1/tests/tget_str.c
+ M /branches/3.1/tests/tget_z.c
+ M /branches/3.1/tests/tgmpop.c
+ M /branches/3.1/tests/tgrandom.c
+ M /branches/3.1/tests/thyperbolic.c
+ M /branches/3.1/tests/thypot.c
+ M /branches/3.1/tests/tinits.c
+ M /branches/3.1/tests/tinp_str.c
+ M /branches/3.1/tests/tinternals.c
+ M /branches/3.1/tests/tisnan.c
+ M /branches/3.1/tests/tisqrt.c
+ M /branches/3.1/tests/tj0.c
+ M /branches/3.1/tests/tj1.c
+ M /branches/3.1/tests/tjn.c
+ M /branches/3.1/tests/tl2b.c
+ M /branches/3.1/tests/tlgamma.c
+ M /branches/3.1/tests/tli2.c
+ M /branches/3.1/tests/tlngamma.c
+ M /branches/3.1/tests/tlog.c
+ M /branches/3.1/tests/tlog10.c
+ M /branches/3.1/tests/tlog1p.c
+ M /branches/3.1/tests/tlog2.c
+ M /branches/3.1/tests/tmin_prec.c
+ M /branches/3.1/tests/tminmax.c
+ M /branches/3.1/tests/tmodf.c
+ M /branches/3.1/tests/tmul.c
+ M /branches/3.1/tests/tmul_2exp.c
+ M /branches/3.1/tests/tmul_d.c
+ M /branches/3.1/tests/tmul_ui.c
+ M /branches/3.1/tests/tnext.c
+ M /branches/3.1/tests/tout_str.c
+ M /branches/3.1/tests/toutimpl.c
+ M /branches/3.1/tests/tpow.c
+ M /branches/3.1/tests/tpow3.c
+ M /branches/3.1/tests/tpow_all.c
+ M /branches/3.1/tests/tpow_z.c
+ M /branches/3.1/tests/tprintf.c
+ M /branches/3.1/tests/trandom.c
+ M /branches/3.1/tests/trec_sqrt.c
+ M /branches/3.1/tests/tremquo.c
+ M /branches/3.1/tests/trint.c
+ M /branches/3.1/tests/troot.c
+ M /branches/3.1/tests/tround_prec.c
+ M /branches/3.1/tests/tsec.c
+ M /branches/3.1/tests/tsech.c
+ M /branches/3.1/tests/tset.c
+ M /branches/3.1/tests/tset_d.c
+ M /branches/3.1/tests/tset_exp.c
+ M /branches/3.1/tests/tset_f.c
+ M /branches/3.1/tests/tset_ld.c
+ M /branches/3.1/tests/tset_q.c
+ M /branches/3.1/tests/tset_si.c
+ M /branches/3.1/tests/tset_sj.c
+ M /branches/3.1/tests/tset_str.c
+ M /branches/3.1/tests/tset_z.c
+ M /branches/3.1/tests/tset_z_exp.c
+ M /branches/3.1/tests/tsgn.c
+ M /branches/3.1/tests/tsi_op.c
+ M /branches/3.1/tests/tsin.c
+ M /branches/3.1/tests/tsin_cos.c
+ M /branches/3.1/tests/tsinh.c
+ M /branches/3.1/tests/tsinh_cosh.c
+ M /branches/3.1/tests/tsprintf.c
+ M /branches/3.1/tests/tsqr.c
+ M /branches/3.1/tests/tsqrt.c
+ M /branches/3.1/tests/tsqrt_ui.c
+ M /branches/3.1/tests/tstckintc.c
+ M /branches/3.1/tests/tstdint.c
+ M /branches/3.1/tests/tstrtofr.c
+ M /branches/3.1/tests/tsub.c
+ M /branches/3.1/tests/tsub1sp.c
+ M /branches/3.1/tests/tsub_d.c
+ M /branches/3.1/tests/tsub_ui.c
+ M /branches/3.1/tests/tsubnormal.c
+ M /branches/3.1/tests/tsum.c
+ M /branches/3.1/tests/tswap.c
+ M /branches/3.1/tests/ttan.c
+ M /branches/3.1/tests/ttanh.c
+ M /branches/3.1/tests/ttrunc.c
+ M /branches/3.1/tests/tui_div.c
+ M /branches/3.1/tests/tui_pow.c
+ M /branches/3.1/tests/tui_sub.c
+ M /branches/3.1/tests/turandom.c
+ M /branches/3.1/tests/tvalist.c
+ M /branches/3.1/tests/tversion.c
+ M /branches/3.1/tests/ty0.c
+ M /branches/3.1/tests/ty1.c
+ M /branches/3.1/tests/tyn.c
+ M /branches/3.1/tests/tzeta.c
+ M /branches/3.1/tests/tzeta_ui.c
+ M /branches/3.1/tools/ck-copyright-notice
+ M /branches/3.1/tools/ck-mparam
+ M /branches/3.1/tools/ck-version-info
+ M /branches/3.1/tools/get_patches.sh
+ M /branches/3.1/tune/Makefile.am
+ M /branches/3.1/tune/bidimensional_sample.c
+ M /branches/3.1/tune/speed.c
+ M /branches/3.1/tune/tuneup.c
+
+Copyright notice update: added 2013 with
+ perl -pi -e 's/2012 Free Software/2012, 2013 Free Software/' **/*(^/)
+under zsh, reverting the ChangeLog file (the m4 and tools/mbench
+directories were not modified).
+Removed 2012 from the example in the doc/README.dev file.
+------------------------------------------------------------------------
+r8464 | vlefevre | 2013-03-08 00:28:01 +0000 (Fri, 08 Mar 2013) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/examples/ReadMe
+ M /branches/3.1/examples/divworst.c
+ M /branches/3.1/examples/rndo-add.c
+ M /branches/3.1/examples/sample.c
+ M /branches/3.1/examples/version.c
+
+[examples] Replaced the old rounding mode macros (GMP_RNDN, etc.) by the
+new ones (MPFR_RNDN, etc.) in the *.c files; updated ReadMe file.
+(merged changeset r8461 from the trunk)
+------------------------------------------------------------------------
+r8463 | vlefevre | 2013-03-08 00:26:52 +0000 (Fri, 08 Mar 2013) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/faq.xsl
+ M /branches/3.1/doc/update-faq
+
+[doc] Slightly modified faq.xsl to avoid libxslt bug 377440, and
+moved the addition of special CSS comments for XML compatibility
+from update-faq to faq.xsl file. Removed the now useless
+s/GMP_RND/MPFR_RND/ rewriting in update-faq.
+(merged changesets r8458,8460 from the trunk)
+------------------------------------------------------------------------
+r8454 | vlefevre | 2013-02-22 12:11:37 +0000 (Fri, 22 Feb 2013) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/get_f.c
+ M /branches/3.1/src/mpfr-gmp.h
+ M /branches/3.1/tests/tadd.c
+ M /branches/3.1/tests/tgeneric.c
+
+Compatibility with GMP 5.1.0 and later when gmp-impl.h is included,
+i.e. with --with-gmp-build (thanks to Rob for the fix); clean-up.
+(merged changeset r8439 from the trunk)
+------------------------------------------------------------------------
+r8399 | vlefevre | 2012-08-29 13:54:55 +0000 (Wed, 29 Aug 2012) | 8 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/strtofr.c
+ M /branches/3.1/tests/tstrtofr.c
+
+[src/strtofr.c] Fixed bug in mpfr_strtofr in case:
+ (1) the input string was used entirely
+ (2) the conversion was done by a division
+ (3) and the division was exact
+ In such a case the "reconstruction" of the ternary value was inexact.
+[tests/tstrtofr.c] Added various testcases (for this bug and for bugs
+ in intermediate revisions).
+(merged changesets r8371,8384,8389-8398 from the trunk)
+------------------------------------------------------------------------
+r8387 | vlefevre | 2012-08-28 15:06:27 +0000 (Tue, 28 Aug 2012) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/FAQ.html
+
+[doc] Updated FAQ.html (changeset r8386 from the trunk).
+------------------------------------------------------------------------
+r8380 | vlefevre | 2012-08-16 09:12:57 +0000 (Thu, 16 Aug 2012) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/get_d64.c
+ M /branches/3.1/tests/tget_set_d64.c
+
+[src/get_d64.c] mpfr_get_decimal64 was buggy in MPFR_RNDN on some
+ values x such that 0.5e-398 < |x| < 1e-398 (smallest subnormal):
+ it was returning 0 instead of +/- 1e-398.
+[tests/tget_set_d64.c] Added testcases.
+(merged changesets r8370,8379 from the trunk)
+------------------------------------------------------------------------
+r8378 | vlefevre | 2012-08-15 23:41:21 +0000 (Wed, 15 Aug 2012) | 7 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/get_d64.c
+ M /branches/3.1/tests/tget_set_d64.c
+
+[src/get_d64.c] Fixed get_decimal64_max by simplifying it completely,
+and changed get_decimal64_min in the same way.
+Thanks to Rob (Sisyphus) for the idea.
+[tests/tget_set_d64.c] Added some tests for large numbers and overflow
+tests (they cover the two bad tests fixed in r8373 and trigger the bug
+in get_decimal64_max fixed here).
+(merged changesets r8375-8377 from the trunk)
+------------------------------------------------------------------------
+r8373 | vlefevre | 2012-08-14 10:37:10 +0000 (Tue, 14 Aug 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/get_d64.c
+
+[src/get_d64.c] Fixed overflow cases.
+(merged changeset r8372 from the trunk)
+------------------------------------------------------------------------
+r8361 | vlefevre | 2012-07-26 14:21:40 +0000 (Thu, 26 Jul 2012) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/configure.ac
+
+[configure.ac] Replaced "sed" by "$SED" and "grep" by "$EGREP".
+------------------------------------------------------------------------
+r8330 | vlefevre | 2012-07-05 10:44:31 +0000 (Thu, 05 Jul 2012) | 2 lines
+Changed paths:
+ M /branches/3.1/tools/coverage
+
+[tools/coverage] Added a comment about the non-reproducibility of the
+coverage results.
+------------------------------------------------------------------------
+r8318 | vlefevre | 2012-07-04 09:30:08 +0000 (Wed, 04 Jul 2012) | 1 line
+Changed paths:
+ M /branches/3.1/INSTALL
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.2-dev.
+------------------------------------------------------------------------
+r8309 | vlefevre | 2012-07-03 14:23:23 +0000 (Tue, 03 Jul 2012) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r8307 | vlefevre | 2012-07-03 14:19:10 +0000 (Tue, 03 Jul 2012) | 1 line
+Changed paths:
+ M /branches/3.1/NEWS
+
+[NEWS] Added test coverage for MPFR 3.1.1.
+------------------------------------------------------------------------
+r8306 | vlefevre | 2012-07-03 14:17:16 +0000 (Tue, 03 Jul 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tools/coverage
+
+[tools/coverage] Some changes from the trunk (r8263,8275,8277,8305),
+in particular detailed coverage.
+------------------------------------------------------------------------
+r8303 | vlefevre | 2012-07-03 13:52:02 +0000 (Tue, 03 Jul 2012) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r8301 | vlefevre | 2012-07-03 13:49:45 +0000 (Tue, 03 Jul 2012) | 1 line
+Changed paths:
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.1.
+------------------------------------------------------------------------
+r8300 | vlefevre | 2012-07-03 13:47:34 +0000 (Tue, 03 Jul 2012) | 4 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/td_div.c
+ M /branches/3.1/tests/tests.c
+ M /branches/3.1/tests/tget_d.c
+
+[tests/tests.c] Improved an error message.
+[tests/{td_div.c,tget_d.c}] Disable tests with a division by 0 if
+ MPFR_ERRDIVZERO is defined.
+(merged changesets r8298-8299 from the trunk)
+------------------------------------------------------------------------
+r8290 | vlefevre | 2012-06-27 12:00:38 +0000 (Wed, 27 Jun 2012) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[mpfr.texi] added support by ERC grant of Andreas
+------------------------------------------------------------------------
+r8288 | vlefevre | 2012-06-27 09:15:26 +0000 (Wed, 27 Jun 2012) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Document MPFR_WANT_DECIMAL_FLOATS.
+------------------------------------------------------------------------
+r8284 | vlefevre | 2012-06-27 08:37:21 +0000 (Wed, 27 Jun 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tgrandom.c
+
+[tests/tgrandom.c] Replaced GMP_RNDN by MPFR_RNDN.
+(merged changeset r8283 from the trunk)
+------------------------------------------------------------------------
+r8282 | vlefevre | 2012-06-27 08:33:41 +0000 (Wed, 27 Jun 2012) | 1 line
+Changed paths:
+ M /branches/3.1/NEWS
+
+[NEWS] Update.
+------------------------------------------------------------------------
+r8281 | vlefevre | 2012-06-27 08:23:11 +0000 (Wed, 27 Jun 2012) | 4 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/tests/tgrandom.c
+
+[doc/mpfr.texi] Completed spec of mpfr_grandom.
+[tests/tgrandom.c] Improved a test and added a new one for
+ mpfr_grandom(x, NULL, ...).
+(merged changesets r8279-8280 from the trunk)
+------------------------------------------------------------------------
+r8278 | vlefevre | 2012-06-27 08:10:45 +0000 (Wed, 27 Jun 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/NEWS
+
+[NEWS] Update: test coverage.
+(merged changeset r8276 from the trunk)
+------------------------------------------------------------------------
+r8259 | vlefevre | 2012-06-26 15:02:18 +0000 (Tue, 26 Jun 2012) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r8257 | vlefevre | 2012-06-26 14:51:13 +0000 (Tue, 26 Jun 2012) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r8256 | vlefevre | 2012-06-26 14:50:17 +0000 (Tue, 26 Jun 2012) | 2 lines
+Changed paths:
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/Makefile.am
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.1-rc1 and updated libmpfr_la_LDFLAGS in
+src/Makefile.am for the next release.
+------------------------------------------------------------------------
+r8255 | vlefevre | 2012-06-26 14:41:27 +0000 (Tue, 26 Jun 2012) | 1 line
+Changed paths:
+ M /branches/3.1/NEWS
+
+[NEWS] Update for GNU MPFR 3.1.1.
+------------------------------------------------------------------------
+r8254 | vlefevre | 2012-06-26 14:03:44 +0000 (Tue, 26 Jun 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tinternals.c
+
+[tests/tinternals.c] mpfr_set_prec_raw missing tests (thanks to Patrick).
+(merged changeset r8253 from the trunk)
+------------------------------------------------------------------------
+r8252 | vlefevre | 2012-06-26 13:57:32 +0000 (Tue, 26 Jun 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tset_si.c
+
+[tests/tset_si.c] Also test the mpfr_set_ui function (instead of macro).
+(merged changeset r8251 from the trunk)
+------------------------------------------------------------------------
+r8220 | vlefevre | 2012-06-21 23:03:44 +0000 (Thu, 21 Jun 2012) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tset_ld.c
+
+[tests/tset_ld.c] For _GMP_IEEE_FLOATS, use #if instead of #ifdef
+since mpfr-impl.h defines it to 0 if it was undefined.
+(merged changeset r8219 from the trunk)
+------------------------------------------------------------------------
+r8205 | vlefevre | 2012-05-09 00:07:18 +0000 (Wed, 09 May 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/configure.ac
+ M /branches/3.1/tests/Makefile.am
+
+Patch from Nitin A Kamble for automake 1.12
+(merged changeset r8204 from the trunk)
+------------------------------------------------------------------------
+r8202 | vlefevre | 2012-05-07 18:13:13 +0000 (Mon, 07 May 2012) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/AUTHORS
+ M /branches/3.1/INSTALL
+ M /branches/3.1/doc/mpfr.texi
+
+[AUTHORS,INSTALL,doc/mpfr.texi] Updated the e-mail address of the
+MPFR mailing-list to match the List-* headers written by the new
+mailing-list server (the old one still works, but may lead to bad
+interaction with MUA's that attempt to honor the List-Post header
+when replying to the list(s)).
+------------------------------------------------------------------------
+r8200 | vlefevre | 2012-05-07 17:58:04 +0000 (Mon, 07 May 2012) | 6 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/gamma.c
+ M /branches/3.1/src/lngamma.c
+ M /branches/3.1/tests/tgamma.c
+
+[src/lngamma.c] Added mpfr_explgamma internal function to handle
+ overflows/underflows (intermediate or not) in mpfr_gamma. Added
+ general overflow detection.
+[src/gamma.c] Added general underflow detection.
+[tests/tgamma.c] Added testcases for 32-bit and 64-bit machines.
+(merged changesets r8174,8179,8182-8183,8185-8189,8191-8199 from the trunk)
+------------------------------------------------------------------------
+r8184 | vlefevre | 2012-05-03 14:44:57 +0000 (Thu, 03 May 2012) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/gamma.c
+
+[src/gamma.c] Reverted changeset r8180, which seems incorrect.
+------------------------------------------------------------------------
+r8180 | vlefevre | 2012-05-03 13:46:22 +0000 (Thu, 03 May 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/gamma.c
+
+[gamma.c] tentative fix for the underflow problem
+(merged changesets r8174,8179 from the trunk)
+------------------------------------------------------------------------
+r8178 | vlefevre | 2012-05-03 13:26:40 +0000 (Thu, 03 May 2012) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r8176 | vlefevre | 2012-05-03 13:08:51 +0000 (Thu, 03 May 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/TODO
+ M /branches/3.1/doc/README.dev
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr-impl.h
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/subnormal.c
+ M /branches/3.1/tests/Makefile.am
+ M /branches/3.1/tests/tatan.c
+ M /branches/3.1/tests/tsin_cos.c
+ M /branches/3.1/tests/tsqr.c
+
+Merged changesets r8172-8173,8175 from the trunk to update URL's of
+mailing-list archives/messages.
+------------------------------------------------------------------------
+r8165 | vlefevre | 2012-04-27 12:39:54 +0000 (Fri, 27 Apr 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tgamma.c
+
+[tests/tgamma.c] Improved testcase test20100709.
+(merged changeset r8164 from the trunk)
+------------------------------------------------------------------------
+r8163 | vlefevre | 2012-04-27 12:29:02 +0000 (Fri, 27 Apr 2012) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tgamma.c
+
+[tests/tgamma.c] Updated testcase test20100709 for 64-bit machines,
+as this bug reappeared in r8160 (r8159 from the trunk).
+(merged changeset r8162 from the trunk)
+------------------------------------------------------------------------
+r8160 | vlefevre | 2012-04-27 01:08:44 +0000 (Fri, 27 Apr 2012) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/gamma.c
+ M /branches/3.1/tests/tgamma.c
+
+[src/gamma.c] Fixed bug in the underflow detection code of mpfr_gamma,
+ found by Giridhar Tammana: some results may incorrectly be regarded
+ as underflow.
+[tests/tgamma.c] Added testcase.
+(merged changeset r8159 from the trunk)
+------------------------------------------------------------------------
+r8127 | vlefevre | 2012-03-26 12:25:58 +0000 (Mon, 26 Mar 2012) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/Makefile.am
+ M /branches/3.1/tests/tests.c
+
+[tests/{Makefile.am,tests.c}] Fixed src_fopen to be able to run test
+programs directly (without "make check") when objdir != srcdir.
+(merged changesets r8122,8126 from the trunk)
+------------------------------------------------------------------------
+r8084 | vlefevre | 2012-03-09 12:03:59 +0000 (Fri, 09 Mar 2012) | 4 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Improved macros from the changeset r8080, in
+particular to avoid an error with the --enable-assert configure
+option and the -ansi -pedantic-errors gcc compiler flags.
+(merged changesets r7910,8082,8083 from the trunk)
+------------------------------------------------------------------------
+r8080 | vlefevre | 2012-03-08 14:11:02 +0000 (Thu, 08 Mar 2012) | 8 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/add1.c
+ M /branches/3.1/src/add1sp.c
+ M /branches/3.1/src/agm.c
+ M /branches/3.1/src/eq.c
+ M /branches/3.1/src/exp.c
+ M /branches/3.1/src/get_d.c
+ M /branches/3.1/src/get_flt.c
+ M /branches/3.1/src/get_str.c
+ M /branches/3.1/src/init2.c
+ M /branches/3.1/src/lngamma.c
+ M /branches/3.1/src/mpfr-impl.h
+ M /branches/3.1/src/mul.c
+ M /branches/3.1/src/pow.c
+ M /branches/3.1/src/print_raw.c
+ M /branches/3.1/src/round_prec.c
+ M /branches/3.1/src/round_raw_generic.c
+ M /branches/3.1/src/set.c
+ M /branches/3.1/src/set_f.c
+ M /branches/3.1/src/set_prec.c
+ M /branches/3.1/src/setmax.c
+ M /branches/3.1/src/sqr.c
+ M /branches/3.1/src/stack_interface.c
+ M /branches/3.1/src/strtofr.c
+ M /branches/3.1/src/sub1sp.c
+ M /branches/3.1/src/urandomb.c
+ M /branches/3.1/tests/tinits.c
+
+Avoid potential integer overflows and improve consistency. This should
+fix bug #13918 "Segfault with precision = MPFR_PREC_MAX on 32-bit".
+Note: this problem appeared in MPFR 3.0.0 when the precision type (now
+mpfr_prec_t) was changed to a signed integer.
+Added a large precision test in tests/tinits.c (enabled by setting
+MPFR_CHECK_LARGEMEM=1) to trigger the bug mentioned above on 32-bit
+machines (or when MPFR is built with -m32).
+(merged changesets r8025,8026,8029,8031,8077 from the trunk)
+------------------------------------------------------------------------
+r8069 | vlefevre | 2012-03-07 15:02:17 +0000 (Wed, 07 Mar 2012) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/mpfr.h
+
+[src/mpfr.h] Simple temporary fix following GMP's internal __gmp_const
+macro removal in <http://gmplib.org:8000/gmp/rev/d287cfaf6732> (and its
+replacement by const): if __gmp_const isn't define, let's define it to
+const.
+(merged changeset r8061 from the trunk)
+------------------------------------------------------------------------
+r8059 | vlefevre | 2012-03-03 03:00:29 +0000 (Sat, 03 Mar 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/NEWS
+
+[NEWS] Mention the mpfr_exp bug fix (from r6964 in exp_2.c).
+(merged changeset r8058 from the trunk)
+------------------------------------------------------------------------
+r8049 | vlefevre | 2012-02-24 13:45:11 +0000 (Fri, 24 Feb 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Use %.*Rg instead of %.*Rf for MPFR_LOG_VAR.
+(merged changeset r8048 from the trunk)
+------------------------------------------------------------------------
+r8047 | vlefevre | 2012-02-24 12:38:46 +0000 (Fri, 24 Feb 2012) | 6 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/add_d.c
+ M /branches/3.1/src/add_ui.c
+ M /branches/3.1/src/mul_d.c
+
+Corrected a typo in MPFR_LOG_FUNC of add_d.c, add_ui.c and mul_d.c
+(mpfr_get_prec → mpfr_log_prec), fixing bug 13933.
+The consequence was random freezes (on the same binary) with dynamic
+linking (and just more memory with static linking to the MPFR library)
+when logging was used.
+(merged changeset r8043 from the trunk)
+------------------------------------------------------------------------
+r8045 | vlefevre | 2012-02-24 12:22:24 +0000 (Fri, 24 Feb 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/NEWS
+
+[NEWS] Mention an internal change in MPFR 3.1.0.
+(merged changeset r8044 from the trunk)
+------------------------------------------------------------------------
+r8017 | vlefevre | 2012-01-27 08:36:16 +0000 (Fri, 27 Jan 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/mparam_h.in
+ M /branches/3.1/src/x86_64/core2/mparam.h
+
+Use the core2 tuning parameters for nocona as timings are very similar.
+[Merged r8013 through r8016 from the trunk]
+------------------------------------------------------------------------
+r8012 | vlefevre | 2012-01-23 01:28:48 +0000 (Mon, 23 Jan 2012) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/mparam_h.in
+
+[mparam_h.in] swap tests for 32-bit and 64-bit powerpc, since on powerpc64
+ the parameters for 32-bit are used!
+(merged changeset r8010 from the trunk)
+------------------------------------------------------------------------
+r7999 | vlefevre | 2012-01-10 12:51:46 +0000 (Tue, 10 Jan 2012) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7997 | vlefevre | 2012-01-10 12:49:58 +0000 (Tue, 10 Jan 2012) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Mention the AriC project-team.
+------------------------------------------------------------------------
+r7995 | vlefevre | 2012-01-10 12:47:05 +0000 (Tue, 10 Jan 2012) | 3 lines
+Changed paths:
+ M /branches/3.1/BUGS
+ M /branches/3.1/INSTALL
+ M /branches/3.1/NEWS
+ M /branches/3.1/README
+ M /branches/3.1/TODO
+ M /branches/3.1/acinclude.m4
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/FAQ.html
+ M /branches/3.1/doc/README.dev
+ M /branches/3.1/doc/faq.xsl
+ M /branches/3.1/examples/divworst.c
+ M /branches/3.1/examples/rndo-add.c
+ M /branches/3.1/examples/sample.c
+ M /branches/3.1/examples/version.c
+ M /branches/3.1/src/abort_prec_max.c
+ M /branches/3.1/src/acos.c
+ M /branches/3.1/src/acosh.c
+ M /branches/3.1/src/add.c
+ M /branches/3.1/src/add1.c
+ M /branches/3.1/src/add1sp.c
+ M /branches/3.1/src/add_d.c
+ M /branches/3.1/src/add_ui.c
+ M /branches/3.1/src/agm.c
+ M /branches/3.1/src/ai.c
+ M /branches/3.1/src/asin.c
+ M /branches/3.1/src/asinh.c
+ M /branches/3.1/src/atan.c
+ M /branches/3.1/src/atan2.c
+ M /branches/3.1/src/atanh.c
+ M /branches/3.1/src/bernoulli.c
+ M /branches/3.1/src/buildopt.c
+ M /branches/3.1/src/cache.c
+ M /branches/3.1/src/cbrt.c
+ M /branches/3.1/src/check.c
+ M /branches/3.1/src/clear.c
+ M /branches/3.1/src/clears.c
+ M /branches/3.1/src/cmp.c
+ M /branches/3.1/src/cmp2.c
+ M /branches/3.1/src/cmp_abs.c
+ M /branches/3.1/src/cmp_d.c
+ M /branches/3.1/src/cmp_ld.c
+ M /branches/3.1/src/cmp_si.c
+ M /branches/3.1/src/cmp_ui.c
+ M /branches/3.1/src/comparisons.c
+ M /branches/3.1/src/const_catalan.c
+ M /branches/3.1/src/const_euler.c
+ M /branches/3.1/src/const_log2.c
+ M /branches/3.1/src/const_pi.c
+ M /branches/3.1/src/constant.c
+ M /branches/3.1/src/copysign.c
+ M /branches/3.1/src/cos.c
+ M /branches/3.1/src/cosh.c
+ M /branches/3.1/src/cot.c
+ M /branches/3.1/src/coth.c
+ M /branches/3.1/src/csc.c
+ M /branches/3.1/src/csch.c
+ M /branches/3.1/src/d_div.c
+ M /branches/3.1/src/d_sub.c
+ M /branches/3.1/src/digamma.c
+ M /branches/3.1/src/dim.c
+ M /branches/3.1/src/div.c
+ M /branches/3.1/src/div_2exp.c
+ M /branches/3.1/src/div_2si.c
+ M /branches/3.1/src/div_2ui.c
+ M /branches/3.1/src/div_d.c
+ M /branches/3.1/src/div_ui.c
+ M /branches/3.1/src/dump.c
+ M /branches/3.1/src/eint.c
+ M /branches/3.1/src/eq.c
+ M /branches/3.1/src/erf.c
+ M /branches/3.1/src/erfc.c
+ M /branches/3.1/src/exceptions.c
+ M /branches/3.1/src/exp.c
+ M /branches/3.1/src/exp10.c
+ M /branches/3.1/src/exp2.c
+ M /branches/3.1/src/exp3.c
+ M /branches/3.1/src/exp_2.c
+ M /branches/3.1/src/expm1.c
+ M /branches/3.1/src/extract.c
+ M /branches/3.1/src/factorial.c
+ M /branches/3.1/src/fits_intmax.c
+ M /branches/3.1/src/fits_s.h
+ M /branches/3.1/src/fits_sint.c
+ M /branches/3.1/src/fits_slong.c
+ M /branches/3.1/src/fits_sshort.c
+ M /branches/3.1/src/fits_u.h
+ M /branches/3.1/src/fits_uint.c
+ M /branches/3.1/src/fits_uintmax.c
+ M /branches/3.1/src/fits_ulong.c
+ M /branches/3.1/src/fits_ushort.c
+ M /branches/3.1/src/fma.c
+ M /branches/3.1/src/fms.c
+ M /branches/3.1/src/frac.c
+ M /branches/3.1/src/free_cache.c
+ M /branches/3.1/src/frexp.c
+ M /branches/3.1/src/gamma.c
+ M /branches/3.1/src/gammaonethird.c
+ M /branches/3.1/src/gen_inverse.h
+ M /branches/3.1/src/get_d.c
+ M /branches/3.1/src/get_d64.c
+ M /branches/3.1/src/get_exp.c
+ M /branches/3.1/src/get_f.c
+ M /branches/3.1/src/get_flt.c
+ M /branches/3.1/src/get_ld.c
+ M /branches/3.1/src/get_si.c
+ M /branches/3.1/src/get_sj.c
+ M /branches/3.1/src/get_str.c
+ M /branches/3.1/src/get_ui.c
+ M /branches/3.1/src/get_uj.c
+ M /branches/3.1/src/get_z.c
+ M /branches/3.1/src/get_z_exp.c
+ M /branches/3.1/src/gmp_op.c
+ M /branches/3.1/src/grandom.c
+ M /branches/3.1/src/hypot.c
+ M /branches/3.1/src/ieee_floats.h
+ M /branches/3.1/src/init.c
+ M /branches/3.1/src/init2.c
+ M /branches/3.1/src/inits.c
+ M /branches/3.1/src/inits2.c
+ M /branches/3.1/src/inp_str.c
+ M /branches/3.1/src/int_ceil_log2.c
+ M /branches/3.1/src/isinf.c
+ M /branches/3.1/src/isinteger.c
+ M /branches/3.1/src/isnan.c
+ M /branches/3.1/src/isnum.c
+ M /branches/3.1/src/isqrt.c
+ M /branches/3.1/src/isregular.c
+ M /branches/3.1/src/iszero.c
+ M /branches/3.1/src/jn.c
+ M /branches/3.1/src/jyn_asympt.c
+ M /branches/3.1/src/li2.c
+ M /branches/3.1/src/lngamma.c
+ M /branches/3.1/src/log.c
+ M /branches/3.1/src/log10.c
+ M /branches/3.1/src/log1p.c
+ M /branches/3.1/src/log2.c
+ M /branches/3.1/src/logging.c
+ M /branches/3.1/src/min_prec.c
+ M /branches/3.1/src/minmax.c
+ M /branches/3.1/src/modf.c
+ M /branches/3.1/src/mpf2mpfr.h
+ M /branches/3.1/src/mpfr-gmp.c
+ M /branches/3.1/src/mpfr-gmp.h
+ M /branches/3.1/src/mpfr-impl.h
+ M /branches/3.1/src/mpfr-intmax.h
+ M /branches/3.1/src/mpfr-thread.h
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/mpn_exp.c
+ M /branches/3.1/src/mul.c
+ M /branches/3.1/src/mul_2exp.c
+ M /branches/3.1/src/mul_2si.c
+ M /branches/3.1/src/mul_2ui.c
+ M /branches/3.1/src/mul_d.c
+ M /branches/3.1/src/mul_ui.c
+ M /branches/3.1/src/mulders.c
+ M /branches/3.1/src/neg.c
+ M /branches/3.1/src/next.c
+ M /branches/3.1/src/out_raw.c
+ M /branches/3.1/src/out_str.c
+ M /branches/3.1/src/pow.c
+ M /branches/3.1/src/pow_si.c
+ M /branches/3.1/src/pow_ui.c
+ M /branches/3.1/src/pow_z.c
+ M /branches/3.1/src/powerof2.c
+ M /branches/3.1/src/print_raw.c
+ M /branches/3.1/src/print_rnd_mode.c
+ M /branches/3.1/src/printf.c
+ M /branches/3.1/src/rec_sqrt.c
+ M /branches/3.1/src/reldiff.c
+ M /branches/3.1/src/rem1.c
+ M /branches/3.1/src/rint.c
+ M /branches/3.1/src/root.c
+ M /branches/3.1/src/round_near_x.c
+ M /branches/3.1/src/round_p.c
+ M /branches/3.1/src/round_prec.c
+ M /branches/3.1/src/round_raw_generic.c
+ M /branches/3.1/src/scale2.c
+ M /branches/3.1/src/sec.c
+ M /branches/3.1/src/sech.c
+ M /branches/3.1/src/set.c
+ M /branches/3.1/src/set_d.c
+ M /branches/3.1/src/set_d64.c
+ M /branches/3.1/src/set_dfl_prec.c
+ M /branches/3.1/src/set_exp.c
+ M /branches/3.1/src/set_f.c
+ M /branches/3.1/src/set_flt.c
+ M /branches/3.1/src/set_inf.c
+ M /branches/3.1/src/set_ld.c
+ M /branches/3.1/src/set_nan.c
+ M /branches/3.1/src/set_prc_raw.c
+ M /branches/3.1/src/set_prec.c
+ M /branches/3.1/src/set_q.c
+ M /branches/3.1/src/set_rnd.c
+ M /branches/3.1/src/set_si.c
+ M /branches/3.1/src/set_si_2exp.c
+ M /branches/3.1/src/set_sj.c
+ M /branches/3.1/src/set_str.c
+ M /branches/3.1/src/set_str_raw.c
+ M /branches/3.1/src/set_ui.c
+ M /branches/3.1/src/set_ui_2exp.c
+ M /branches/3.1/src/set_uj.c
+ M /branches/3.1/src/set_z.c
+ M /branches/3.1/src/set_z_exp.c
+ M /branches/3.1/src/set_zero.c
+ M /branches/3.1/src/setmax.c
+ M /branches/3.1/src/setmin.c
+ M /branches/3.1/src/setsign.c
+ M /branches/3.1/src/sgn.c
+ M /branches/3.1/src/si_op.c
+ M /branches/3.1/src/signbit.c
+ M /branches/3.1/src/sin.c
+ M /branches/3.1/src/sin_cos.c
+ M /branches/3.1/src/sinh.c
+ M /branches/3.1/src/sinh_cosh.c
+ M /branches/3.1/src/sqr.c
+ M /branches/3.1/src/sqrt.c
+ M /branches/3.1/src/sqrt_ui.c
+ M /branches/3.1/src/stack_interface.c
+ M /branches/3.1/src/strtofr.c
+ M /branches/3.1/src/sub.c
+ M /branches/3.1/src/sub1.c
+ M /branches/3.1/src/sub1sp.c
+ M /branches/3.1/src/sub_d.c
+ M /branches/3.1/src/sub_ui.c
+ M /branches/3.1/src/subnormal.c
+ M /branches/3.1/src/sum.c
+ M /branches/3.1/src/swap.c
+ M /branches/3.1/src/tan.c
+ M /branches/3.1/src/tanh.c
+ M /branches/3.1/src/uceil_exp2.c
+ M /branches/3.1/src/uceil_log2.c
+ M /branches/3.1/src/ufloor_log2.c
+ M /branches/3.1/src/ui_div.c
+ M /branches/3.1/src/ui_pow.c
+ M /branches/3.1/src/ui_pow_ui.c
+ M /branches/3.1/src/ui_sub.c
+ M /branches/3.1/src/urandom.c
+ M /branches/3.1/src/urandomb.c
+ M /branches/3.1/src/vasprintf.c
+ M /branches/3.1/src/version.c
+ M /branches/3.1/src/volatile.c
+ M /branches/3.1/src/yn.c
+ M /branches/3.1/src/zeta.c
+ M /branches/3.1/src/zeta_ui.c
+ M /branches/3.1/tests/cmp_str.c
+ M /branches/3.1/tests/data/digamma
+ M /branches/3.1/tests/data/li2
+ M /branches/3.1/tests/memory.c
+ M /branches/3.1/tests/mpf_compat.c
+ M /branches/3.1/tests/mpf_compat.h
+ M /branches/3.1/tests/mpfr-test.h
+ M /branches/3.1/tests/mpfr_compat.c
+ M /branches/3.1/tests/random2.c
+ M /branches/3.1/tests/reuse.c
+ M /branches/3.1/tests/rnd_mode.c
+ M /branches/3.1/tests/tabs.c
+ M /branches/3.1/tests/tacos.c
+ M /branches/3.1/tests/tacosh.c
+ M /branches/3.1/tests/tadd.c
+ M /branches/3.1/tests/tadd1sp.c
+ M /branches/3.1/tests/tadd_d.c
+ M /branches/3.1/tests/tadd_ui.c
+ M /branches/3.1/tests/tagm.c
+ M /branches/3.1/tests/tai.c
+ M /branches/3.1/tests/tasin.c
+ M /branches/3.1/tests/tasinh.c
+ M /branches/3.1/tests/tatan.c
+ M /branches/3.1/tests/tatanh.c
+ M /branches/3.1/tests/taway.c
+ M /branches/3.1/tests/tbuildopt.c
+ M /branches/3.1/tests/tcan_round.c
+ M /branches/3.1/tests/tcbrt.c
+ M /branches/3.1/tests/tcheck.c
+ M /branches/3.1/tests/tcmp.c
+ M /branches/3.1/tests/tcmp2.c
+ M /branches/3.1/tests/tcmp_d.c
+ M /branches/3.1/tests/tcmp_ld.c
+ M /branches/3.1/tests/tcmp_ui.c
+ M /branches/3.1/tests/tcmpabs.c
+ M /branches/3.1/tests/tcomparisons.c
+ M /branches/3.1/tests/tconst_catalan.c
+ M /branches/3.1/tests/tconst_euler.c
+ M /branches/3.1/tests/tconst_log2.c
+ M /branches/3.1/tests/tconst_pi.c
+ M /branches/3.1/tests/tcopysign.c
+ M /branches/3.1/tests/tcos.c
+ M /branches/3.1/tests/tcosh.c
+ M /branches/3.1/tests/tcot.c
+ M /branches/3.1/tests/tcoth.c
+ M /branches/3.1/tests/tcsc.c
+ M /branches/3.1/tests/tcsch.c
+ M /branches/3.1/tests/td_div.c
+ M /branches/3.1/tests/td_sub.c
+ M /branches/3.1/tests/tdigamma.c
+ M /branches/3.1/tests/tdim.c
+ M /branches/3.1/tests/tdiv.c
+ M /branches/3.1/tests/tdiv_d.c
+ M /branches/3.1/tests/tdiv_ui.c
+ M /branches/3.1/tests/teint.c
+ M /branches/3.1/tests/teq.c
+ M /branches/3.1/tests/terf.c
+ M /branches/3.1/tests/tests.c
+ M /branches/3.1/tests/texceptions.c
+ M /branches/3.1/tests/texp.c
+ M /branches/3.1/tests/texp10.c
+ M /branches/3.1/tests/texp2.c
+ M /branches/3.1/tests/texpm1.c
+ M /branches/3.1/tests/tfactorial.c
+ M /branches/3.1/tests/tfits.c
+ M /branches/3.1/tests/tfma.c
+ M /branches/3.1/tests/tfmod.c
+ M /branches/3.1/tests/tfms.c
+ M /branches/3.1/tests/tfprintf.c
+ M /branches/3.1/tests/tfrac.c
+ M /branches/3.1/tests/tfrexp.c
+ M /branches/3.1/tests/tgamma.c
+ M /branches/3.1/tests/tgeneric.c
+ M /branches/3.1/tests/tgeneric_ui.c
+ M /branches/3.1/tests/tget_d.c
+ M /branches/3.1/tests/tget_d_2exp.c
+ M /branches/3.1/tests/tget_f.c
+ M /branches/3.1/tests/tget_flt.c
+ M /branches/3.1/tests/tget_ld_2exp.c
+ M /branches/3.1/tests/tget_set_d64.c
+ M /branches/3.1/tests/tget_sj.c
+ M /branches/3.1/tests/tget_str.c
+ M /branches/3.1/tests/tget_z.c
+ M /branches/3.1/tests/tgmpop.c
+ M /branches/3.1/tests/tgrandom.c
+ M /branches/3.1/tests/thyperbolic.c
+ M /branches/3.1/tests/thypot.c
+ M /branches/3.1/tests/tinits.c
+ M /branches/3.1/tests/tinp_str.c
+ M /branches/3.1/tests/tinternals.c
+ M /branches/3.1/tests/tisnan.c
+ M /branches/3.1/tests/tisqrt.c
+ M /branches/3.1/tests/tj0.c
+ M /branches/3.1/tests/tj1.c
+ M /branches/3.1/tests/tjn.c
+ M /branches/3.1/tests/tl2b.c
+ M /branches/3.1/tests/tlgamma.c
+ M /branches/3.1/tests/tli2.c
+ M /branches/3.1/tests/tlngamma.c
+ M /branches/3.1/tests/tlog.c
+ M /branches/3.1/tests/tlog10.c
+ M /branches/3.1/tests/tlog1p.c
+ M /branches/3.1/tests/tlog2.c
+ M /branches/3.1/tests/tmin_prec.c
+ M /branches/3.1/tests/tminmax.c
+ M /branches/3.1/tests/tmodf.c
+ M /branches/3.1/tests/tmul.c
+ M /branches/3.1/tests/tmul_2exp.c
+ M /branches/3.1/tests/tmul_d.c
+ M /branches/3.1/tests/tmul_ui.c
+ M /branches/3.1/tests/tnext.c
+ M /branches/3.1/tests/tout_str.c
+ M /branches/3.1/tests/toutimpl.c
+ M /branches/3.1/tests/tpow.c
+ M /branches/3.1/tests/tpow3.c
+ M /branches/3.1/tests/tpow_all.c
+ M /branches/3.1/tests/tpow_z.c
+ M /branches/3.1/tests/tprintf.c
+ M /branches/3.1/tests/trandom.c
+ M /branches/3.1/tests/trec_sqrt.c
+ M /branches/3.1/tests/tremquo.c
+ M /branches/3.1/tests/trint.c
+ M /branches/3.1/tests/troot.c
+ M /branches/3.1/tests/tround_prec.c
+ M /branches/3.1/tests/tsec.c
+ M /branches/3.1/tests/tsech.c
+ M /branches/3.1/tests/tset.c
+ M /branches/3.1/tests/tset_d.c
+ M /branches/3.1/tests/tset_exp.c
+ M /branches/3.1/tests/tset_f.c
+ M /branches/3.1/tests/tset_ld.c
+ M /branches/3.1/tests/tset_q.c
+ M /branches/3.1/tests/tset_si.c
+ M /branches/3.1/tests/tset_sj.c
+ M /branches/3.1/tests/tset_str.c
+ M /branches/3.1/tests/tset_z.c
+ M /branches/3.1/tests/tset_z_exp.c
+ M /branches/3.1/tests/tsgn.c
+ M /branches/3.1/tests/tsi_op.c
+ M /branches/3.1/tests/tsin.c
+ M /branches/3.1/tests/tsin_cos.c
+ M /branches/3.1/tests/tsinh.c
+ M /branches/3.1/tests/tsinh_cosh.c
+ M /branches/3.1/tests/tsprintf.c
+ M /branches/3.1/tests/tsqr.c
+ M /branches/3.1/tests/tsqrt.c
+ M /branches/3.1/tests/tsqrt_ui.c
+ M /branches/3.1/tests/tstckintc.c
+ M /branches/3.1/tests/tstdint.c
+ M /branches/3.1/tests/tstrtofr.c
+ M /branches/3.1/tests/tsub.c
+ M /branches/3.1/tests/tsub1sp.c
+ M /branches/3.1/tests/tsub_d.c
+ M /branches/3.1/tests/tsub_ui.c
+ M /branches/3.1/tests/tsubnormal.c
+ M /branches/3.1/tests/tsum.c
+ M /branches/3.1/tests/tswap.c
+ M /branches/3.1/tests/ttan.c
+ M /branches/3.1/tests/ttanh.c
+ M /branches/3.1/tests/ttrunc.c
+ M /branches/3.1/tests/tui_div.c
+ M /branches/3.1/tests/tui_pow.c
+ M /branches/3.1/tests/tui_sub.c
+ M /branches/3.1/tests/turandom.c
+ M /branches/3.1/tests/tvalist.c
+ M /branches/3.1/tests/tversion.c
+ M /branches/3.1/tests/ty0.c
+ M /branches/3.1/tests/ty1.c
+ M /branches/3.1/tests/tyn.c
+ M /branches/3.1/tests/tzeta.c
+ M /branches/3.1/tests/tzeta_ui.c
+ M /branches/3.1/tools/get_patches.sh
+ M /branches/3.1/tune/bidimensional_sample.c
+ M /branches/3.1/tune/speed.c
+ M /branches/3.1/tune/tuneup.c
+
+Changed Arenaire to AriC with:
+ perl -pi -e 's/Contributed by the Arenaire/Contributed by the AriC/' **/*(^/)
+under zsh, reverting the ChangeLog file.
+------------------------------------------------------------------------
+r7992 | vlefevre | 2012-01-10 12:30:53 +0000 (Tue, 10 Jan 2012) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/FAQ.html
+ M /branches/3.1/doc/faq.xsl
+
+[doc] In faq.xsl, remove only the top-level comments from the HTML file.
+Updated FAQ.html with update-faq.
+------------------------------------------------------------------------
+r7987 | vlefevre | 2012-01-10 11:54:24 +0000 (Tue, 10 Jan 2012) | 5 lines
+Changed paths:
+ M /branches/3.1/BUGS
+ M /branches/3.1/INSTALL
+ M /branches/3.1/Makefile.am
+ M /branches/3.1/NEWS
+ M /branches/3.1/README
+ M /branches/3.1/TODO
+ M /branches/3.1/acinclude.m4
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/FAQ.html
+ M /branches/3.1/doc/Makefile.am
+ M /branches/3.1/doc/README.dev
+ M /branches/3.1/doc/faq.xsl
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/examples/divworst.c
+ M /branches/3.1/examples/rndo-add.c
+ M /branches/3.1/examples/sample.c
+ M /branches/3.1/examples/version.c
+ M /branches/3.1/src/Makefile.am
+ M /branches/3.1/src/abort_prec_max.c
+ M /branches/3.1/src/acos.c
+ M /branches/3.1/src/acosh.c
+ M /branches/3.1/src/add.c
+ M /branches/3.1/src/add1.c
+ M /branches/3.1/src/add1sp.c
+ M /branches/3.1/src/add_d.c
+ M /branches/3.1/src/add_ui.c
+ M /branches/3.1/src/agm.c
+ M /branches/3.1/src/ai.c
+ M /branches/3.1/src/amd/amdfam10/mparam.h
+ M /branches/3.1/src/amd/athlon/mparam.h
+ M /branches/3.1/src/amd/k8/mparam.h
+ M /branches/3.1/src/arm/mparam.h
+ M /branches/3.1/src/asin.c
+ M /branches/3.1/src/asinh.c
+ M /branches/3.1/src/atan.c
+ M /branches/3.1/src/atan2.c
+ M /branches/3.1/src/atanh.c
+ M /branches/3.1/src/bernoulli.c
+ M /branches/3.1/src/buildopt.c
+ M /branches/3.1/src/cache.c
+ M /branches/3.1/src/cbrt.c
+ M /branches/3.1/src/check.c
+ M /branches/3.1/src/clear.c
+ M /branches/3.1/src/clears.c
+ M /branches/3.1/src/cmp.c
+ M /branches/3.1/src/cmp2.c
+ M /branches/3.1/src/cmp_abs.c
+ M /branches/3.1/src/cmp_d.c
+ M /branches/3.1/src/cmp_ld.c
+ M /branches/3.1/src/cmp_si.c
+ M /branches/3.1/src/cmp_ui.c
+ M /branches/3.1/src/comparisons.c
+ M /branches/3.1/src/const_catalan.c
+ M /branches/3.1/src/const_euler.c
+ M /branches/3.1/src/const_log2.c
+ M /branches/3.1/src/const_pi.c
+ M /branches/3.1/src/constant.c
+ M /branches/3.1/src/copysign.c
+ M /branches/3.1/src/cos.c
+ M /branches/3.1/src/cosh.c
+ M /branches/3.1/src/cot.c
+ M /branches/3.1/src/coth.c
+ M /branches/3.1/src/csc.c
+ M /branches/3.1/src/csch.c
+ M /branches/3.1/src/d_div.c
+ M /branches/3.1/src/d_sub.c
+ M /branches/3.1/src/digamma.c
+ M /branches/3.1/src/dim.c
+ M /branches/3.1/src/div.c
+ M /branches/3.1/src/div_2exp.c
+ M /branches/3.1/src/div_2si.c
+ M /branches/3.1/src/div_2ui.c
+ M /branches/3.1/src/div_d.c
+ M /branches/3.1/src/div_ui.c
+ M /branches/3.1/src/dump.c
+ M /branches/3.1/src/eint.c
+ M /branches/3.1/src/eq.c
+ M /branches/3.1/src/erf.c
+ M /branches/3.1/src/erfc.c
+ M /branches/3.1/src/exceptions.c
+ M /branches/3.1/src/exp.c
+ M /branches/3.1/src/exp10.c
+ M /branches/3.1/src/exp2.c
+ M /branches/3.1/src/exp3.c
+ M /branches/3.1/src/exp_2.c
+ M /branches/3.1/src/expm1.c
+ M /branches/3.1/src/extract.c
+ M /branches/3.1/src/factorial.c
+ M /branches/3.1/src/fits_intmax.c
+ M /branches/3.1/src/fits_s.h
+ M /branches/3.1/src/fits_sint.c
+ M /branches/3.1/src/fits_slong.c
+ M /branches/3.1/src/fits_sshort.c
+ M /branches/3.1/src/fits_u.h
+ M /branches/3.1/src/fits_uint.c
+ M /branches/3.1/src/fits_uintmax.c
+ M /branches/3.1/src/fits_ulong.c
+ M /branches/3.1/src/fits_ushort.c
+ M /branches/3.1/src/fma.c
+ M /branches/3.1/src/fms.c
+ M /branches/3.1/src/frac.c
+ M /branches/3.1/src/free_cache.c
+ M /branches/3.1/src/frexp.c
+ M /branches/3.1/src/gamma.c
+ M /branches/3.1/src/gammaonethird.c
+ M /branches/3.1/src/gen_inverse.h
+ M /branches/3.1/src/generic/mparam.h
+ M /branches/3.1/src/get_d.c
+ M /branches/3.1/src/get_d64.c
+ M /branches/3.1/src/get_exp.c
+ M /branches/3.1/src/get_f.c
+ M /branches/3.1/src/get_flt.c
+ M /branches/3.1/src/get_ld.c
+ M /branches/3.1/src/get_si.c
+ M /branches/3.1/src/get_sj.c
+ M /branches/3.1/src/get_str.c
+ M /branches/3.1/src/get_ui.c
+ M /branches/3.1/src/get_uj.c
+ M /branches/3.1/src/get_z.c
+ M /branches/3.1/src/get_z_exp.c
+ M /branches/3.1/src/gmp_op.c
+ M /branches/3.1/src/grandom.c
+ M /branches/3.1/src/hppa/mparam.h
+ M /branches/3.1/src/hypot.c
+ M /branches/3.1/src/ia64/mparam.h
+ M /branches/3.1/src/ieee_floats.h
+ M /branches/3.1/src/init.c
+ M /branches/3.1/src/init2.c
+ M /branches/3.1/src/inits.c
+ M /branches/3.1/src/inits2.c
+ M /branches/3.1/src/inp_str.c
+ M /branches/3.1/src/int_ceil_log2.c
+ M /branches/3.1/src/isinf.c
+ M /branches/3.1/src/isinteger.c
+ M /branches/3.1/src/isnan.c
+ M /branches/3.1/src/isnum.c
+ M /branches/3.1/src/isqrt.c
+ M /branches/3.1/src/isregular.c
+ M /branches/3.1/src/iszero.c
+ M /branches/3.1/src/jn.c
+ M /branches/3.1/src/jyn_asympt.c
+ M /branches/3.1/src/li2.c
+ M /branches/3.1/src/lngamma.c
+ M /branches/3.1/src/log.c
+ M /branches/3.1/src/log10.c
+ M /branches/3.1/src/log1p.c
+ M /branches/3.1/src/log2.c
+ M /branches/3.1/src/logging.c
+ M /branches/3.1/src/min_prec.c
+ M /branches/3.1/src/minmax.c
+ M /branches/3.1/src/modf.c
+ M /branches/3.1/src/mp_clz_tab.c
+ M /branches/3.1/src/mparam_h.in
+ M /branches/3.1/src/mpf2mpfr.h
+ M /branches/3.1/src/mpfr-gmp.c
+ M /branches/3.1/src/mpfr-gmp.h
+ M /branches/3.1/src/mpfr-impl.h
+ M /branches/3.1/src/mpfr-intmax.h
+ M /branches/3.1/src/mpfr-longlong.h
+ M /branches/3.1/src/mpfr-thread.h
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/mpn_exp.c
+ M /branches/3.1/src/mul.c
+ M /branches/3.1/src/mul_2exp.c
+ M /branches/3.1/src/mul_2si.c
+ M /branches/3.1/src/mul_2ui.c
+ M /branches/3.1/src/mul_d.c
+ M /branches/3.1/src/mul_ui.c
+ M /branches/3.1/src/mulders.c
+ M /branches/3.1/src/neg.c
+ M /branches/3.1/src/next.c
+ M /branches/3.1/src/out_raw.c
+ M /branches/3.1/src/out_str.c
+ M /branches/3.1/src/pow.c
+ M /branches/3.1/src/pow_si.c
+ M /branches/3.1/src/pow_ui.c
+ M /branches/3.1/src/pow_z.c
+ M /branches/3.1/src/powerof2.c
+ M /branches/3.1/src/powerpc32/mparam.h
+ M /branches/3.1/src/powerpc64/mparam.h
+ M /branches/3.1/src/print_raw.c
+ M /branches/3.1/src/print_rnd_mode.c
+ M /branches/3.1/src/printf.c
+ M /branches/3.1/src/rec_sqrt.c
+ M /branches/3.1/src/reldiff.c
+ M /branches/3.1/src/rem1.c
+ M /branches/3.1/src/rint.c
+ M /branches/3.1/src/root.c
+ M /branches/3.1/src/round_near_x.c
+ M /branches/3.1/src/round_p.c
+ M /branches/3.1/src/round_prec.c
+ M /branches/3.1/src/round_raw_generic.c
+ M /branches/3.1/src/scale2.c
+ M /branches/3.1/src/sec.c
+ M /branches/3.1/src/sech.c
+ M /branches/3.1/src/set.c
+ M /branches/3.1/src/set_d.c
+ M /branches/3.1/src/set_d64.c
+ M /branches/3.1/src/set_dfl_prec.c
+ M /branches/3.1/src/set_exp.c
+ M /branches/3.1/src/set_f.c
+ M /branches/3.1/src/set_flt.c
+ M /branches/3.1/src/set_inf.c
+ M /branches/3.1/src/set_ld.c
+ M /branches/3.1/src/set_nan.c
+ M /branches/3.1/src/set_prc_raw.c
+ M /branches/3.1/src/set_prec.c
+ M /branches/3.1/src/set_q.c
+ M /branches/3.1/src/set_rnd.c
+ M /branches/3.1/src/set_si.c
+ M /branches/3.1/src/set_si_2exp.c
+ M /branches/3.1/src/set_sj.c
+ M /branches/3.1/src/set_str.c
+ M /branches/3.1/src/set_str_raw.c
+ M /branches/3.1/src/set_ui.c
+ M /branches/3.1/src/set_ui_2exp.c
+ M /branches/3.1/src/set_uj.c
+ M /branches/3.1/src/set_z.c
+ M /branches/3.1/src/set_z_exp.c
+ M /branches/3.1/src/set_zero.c
+ M /branches/3.1/src/setmax.c
+ M /branches/3.1/src/setmin.c
+ M /branches/3.1/src/setsign.c
+ M /branches/3.1/src/sgn.c
+ M /branches/3.1/src/si_op.c
+ M /branches/3.1/src/signbit.c
+ M /branches/3.1/src/sin.c
+ M /branches/3.1/src/sin_cos.c
+ M /branches/3.1/src/sinh.c
+ M /branches/3.1/src/sinh_cosh.c
+ M /branches/3.1/src/sparc64/mparam.h
+ M /branches/3.1/src/sqr.c
+ M /branches/3.1/src/sqrt.c
+ M /branches/3.1/src/sqrt_ui.c
+ M /branches/3.1/src/stack_interface.c
+ M /branches/3.1/src/strtofr.c
+ M /branches/3.1/src/sub.c
+ M /branches/3.1/src/sub1.c
+ M /branches/3.1/src/sub1sp.c
+ M /branches/3.1/src/sub_d.c
+ M /branches/3.1/src/sub_ui.c
+ M /branches/3.1/src/subnormal.c
+ M /branches/3.1/src/sum.c
+ M /branches/3.1/src/swap.c
+ M /branches/3.1/src/tan.c
+ M /branches/3.1/src/tanh.c
+ M /branches/3.1/src/uceil_exp2.c
+ M /branches/3.1/src/uceil_log2.c
+ M /branches/3.1/src/ufloor_log2.c
+ M /branches/3.1/src/ui_div.c
+ M /branches/3.1/src/ui_pow.c
+ M /branches/3.1/src/ui_pow_ui.c
+ M /branches/3.1/src/ui_sub.c
+ M /branches/3.1/src/urandom.c
+ M /branches/3.1/src/urandomb.c
+ M /branches/3.1/src/vasprintf.c
+ M /branches/3.1/src/version.c
+ M /branches/3.1/src/volatile.c
+ M /branches/3.1/src/x86/core2/mparam.h
+ M /branches/3.1/src/x86/mparam.h
+ M /branches/3.1/src/x86_64/core2/mparam.h
+ M /branches/3.1/src/x86_64/pentium4/mparam.h
+ M /branches/3.1/src/yn.c
+ M /branches/3.1/src/zeta.c
+ M /branches/3.1/src/zeta_ui.c
+ M /branches/3.1/tests/Makefile.am
+ M /branches/3.1/tests/cmp_str.c
+ M /branches/3.1/tests/data/digamma
+ M /branches/3.1/tests/data/li2
+ M /branches/3.1/tests/memory.c
+ M /branches/3.1/tests/mpf_compat.c
+ M /branches/3.1/tests/mpf_compat.h
+ M /branches/3.1/tests/mpfr-test.h
+ M /branches/3.1/tests/mpfr_compat.c
+ M /branches/3.1/tests/random2.c
+ M /branches/3.1/tests/reuse.c
+ M /branches/3.1/tests/rnd_mode.c
+ M /branches/3.1/tests/tabs.c
+ M /branches/3.1/tests/tacos.c
+ M /branches/3.1/tests/tacosh.c
+ M /branches/3.1/tests/tadd.c
+ M /branches/3.1/tests/tadd1sp.c
+ M /branches/3.1/tests/tadd_d.c
+ M /branches/3.1/tests/tadd_ui.c
+ M /branches/3.1/tests/tagm.c
+ M /branches/3.1/tests/tai.c
+ M /branches/3.1/tests/tasin.c
+ M /branches/3.1/tests/tasinh.c
+ M /branches/3.1/tests/tatan.c
+ M /branches/3.1/tests/tatanh.c
+ M /branches/3.1/tests/taway.c
+ M /branches/3.1/tests/tbuildopt.c
+ M /branches/3.1/tests/tcan_round.c
+ M /branches/3.1/tests/tcbrt.c
+ M /branches/3.1/tests/tcheck.c
+ M /branches/3.1/tests/tcmp.c
+ M /branches/3.1/tests/tcmp2.c
+ M /branches/3.1/tests/tcmp_d.c
+ M /branches/3.1/tests/tcmp_ld.c
+ M /branches/3.1/tests/tcmp_ui.c
+ M /branches/3.1/tests/tcmpabs.c
+ M /branches/3.1/tests/tcomparisons.c
+ M /branches/3.1/tests/tconst_catalan.c
+ M /branches/3.1/tests/tconst_euler.c
+ M /branches/3.1/tests/tconst_log2.c
+ M /branches/3.1/tests/tconst_pi.c
+ M /branches/3.1/tests/tcopysign.c
+ M /branches/3.1/tests/tcos.c
+ M /branches/3.1/tests/tcosh.c
+ M /branches/3.1/tests/tcot.c
+ M /branches/3.1/tests/tcoth.c
+ M /branches/3.1/tests/tcsc.c
+ M /branches/3.1/tests/tcsch.c
+ M /branches/3.1/tests/td_div.c
+ M /branches/3.1/tests/td_sub.c
+ M /branches/3.1/tests/tdigamma.c
+ M /branches/3.1/tests/tdim.c
+ M /branches/3.1/tests/tdiv.c
+ M /branches/3.1/tests/tdiv_d.c
+ M /branches/3.1/tests/tdiv_ui.c
+ M /branches/3.1/tests/teint.c
+ M /branches/3.1/tests/teq.c
+ M /branches/3.1/tests/terf.c
+ M /branches/3.1/tests/tests.c
+ M /branches/3.1/tests/texceptions.c
+ M /branches/3.1/tests/texp.c
+ M /branches/3.1/tests/texp10.c
+ M /branches/3.1/tests/texp2.c
+ M /branches/3.1/tests/texpm1.c
+ M /branches/3.1/tests/tfactorial.c
+ M /branches/3.1/tests/tfits.c
+ M /branches/3.1/tests/tfma.c
+ M /branches/3.1/tests/tfmod.c
+ M /branches/3.1/tests/tfms.c
+ M /branches/3.1/tests/tfprintf.c
+ M /branches/3.1/tests/tfrac.c
+ M /branches/3.1/tests/tfrexp.c
+ M /branches/3.1/tests/tgamma.c
+ M /branches/3.1/tests/tgeneric.c
+ M /branches/3.1/tests/tgeneric_ui.c
+ M /branches/3.1/tests/tget_d.c
+ M /branches/3.1/tests/tget_d_2exp.c
+ M /branches/3.1/tests/tget_f.c
+ M /branches/3.1/tests/tget_flt.c
+ M /branches/3.1/tests/tget_ld_2exp.c
+ M /branches/3.1/tests/tget_set_d64.c
+ M /branches/3.1/tests/tget_sj.c
+ M /branches/3.1/tests/tget_str.c
+ M /branches/3.1/tests/tget_z.c
+ M /branches/3.1/tests/tgmpop.c
+ M /branches/3.1/tests/tgrandom.c
+ M /branches/3.1/tests/thyperbolic.c
+ M /branches/3.1/tests/thypot.c
+ M /branches/3.1/tests/tinits.c
+ M /branches/3.1/tests/tinp_str.c
+ M /branches/3.1/tests/tinternals.c
+ M /branches/3.1/tests/tisnan.c
+ M /branches/3.1/tests/tisqrt.c
+ M /branches/3.1/tests/tj0.c
+ M /branches/3.1/tests/tj1.c
+ M /branches/3.1/tests/tjn.c
+ M /branches/3.1/tests/tl2b.c
+ M /branches/3.1/tests/tlgamma.c
+ M /branches/3.1/tests/tli2.c
+ M /branches/3.1/tests/tlngamma.c
+ M /branches/3.1/tests/tlog.c
+ M /branches/3.1/tests/tlog10.c
+ M /branches/3.1/tests/tlog1p.c
+ M /branches/3.1/tests/tlog2.c
+ M /branches/3.1/tests/tmin_prec.c
+ M /branches/3.1/tests/tminmax.c
+ M /branches/3.1/tests/tmodf.c
+ M /branches/3.1/tests/tmul.c
+ M /branches/3.1/tests/tmul_2exp.c
+ M /branches/3.1/tests/tmul_d.c
+ M /branches/3.1/tests/tmul_ui.c
+ M /branches/3.1/tests/tnext.c
+ M /branches/3.1/tests/tout_str.c
+ M /branches/3.1/tests/toutimpl.c
+ M /branches/3.1/tests/tpow.c
+ M /branches/3.1/tests/tpow3.c
+ M /branches/3.1/tests/tpow_all.c
+ M /branches/3.1/tests/tpow_z.c
+ M /branches/3.1/tests/tprintf.c
+ M /branches/3.1/tests/trandom.c
+ M /branches/3.1/tests/trec_sqrt.c
+ M /branches/3.1/tests/tremquo.c
+ M /branches/3.1/tests/trint.c
+ M /branches/3.1/tests/troot.c
+ M /branches/3.1/tests/tround_prec.c
+ M /branches/3.1/tests/tsec.c
+ M /branches/3.1/tests/tsech.c
+ M /branches/3.1/tests/tset.c
+ M /branches/3.1/tests/tset_d.c
+ M /branches/3.1/tests/tset_exp.c
+ M /branches/3.1/tests/tset_f.c
+ M /branches/3.1/tests/tset_ld.c
+ M /branches/3.1/tests/tset_q.c
+ M /branches/3.1/tests/tset_si.c
+ M /branches/3.1/tests/tset_sj.c
+ M /branches/3.1/tests/tset_str.c
+ M /branches/3.1/tests/tset_z.c
+ M /branches/3.1/tests/tset_z_exp.c
+ M /branches/3.1/tests/tsgn.c
+ M /branches/3.1/tests/tsi_op.c
+ M /branches/3.1/tests/tsin.c
+ M /branches/3.1/tests/tsin_cos.c
+ M /branches/3.1/tests/tsinh.c
+ M /branches/3.1/tests/tsinh_cosh.c
+ M /branches/3.1/tests/tsprintf.c
+ M /branches/3.1/tests/tsqr.c
+ M /branches/3.1/tests/tsqrt.c
+ M /branches/3.1/tests/tsqrt_ui.c
+ M /branches/3.1/tests/tstckintc.c
+ M /branches/3.1/tests/tstdint.c
+ M /branches/3.1/tests/tstrtofr.c
+ M /branches/3.1/tests/tsub.c
+ M /branches/3.1/tests/tsub1sp.c
+ M /branches/3.1/tests/tsub_d.c
+ M /branches/3.1/tests/tsub_ui.c
+ M /branches/3.1/tests/tsubnormal.c
+ M /branches/3.1/tests/tsum.c
+ M /branches/3.1/tests/tswap.c
+ M /branches/3.1/tests/ttan.c
+ M /branches/3.1/tests/ttanh.c
+ M /branches/3.1/tests/ttrunc.c
+ M /branches/3.1/tests/tui_div.c
+ M /branches/3.1/tests/tui_pow.c
+ M /branches/3.1/tests/tui_sub.c
+ M /branches/3.1/tests/turandom.c
+ M /branches/3.1/tests/tvalist.c
+ M /branches/3.1/tests/tversion.c
+ M /branches/3.1/tests/ty0.c
+ M /branches/3.1/tests/ty1.c
+ M /branches/3.1/tests/tyn.c
+ M /branches/3.1/tests/tzeta.c
+ M /branches/3.1/tests/tzeta_ui.c
+ M /branches/3.1/tools/ck-copyright-notice
+ M /branches/3.1/tools/ck-mparam
+ M /branches/3.1/tools/ck-version-info
+ M /branches/3.1/tools/get_patches.sh
+ M /branches/3.1/tune/Makefile.am
+ M /branches/3.1/tune/bidimensional_sample.c
+ M /branches/3.1/tune/speed.c
+ M /branches/3.1/tune/tuneup.c
+
+Copyright notice update: added 2012 with
+ perl -pi -e 's/2011 Free Software/2011, 2012 Free Software/' **/*(^/)
+under zsh, reverting the ChangeLog file (the m4 and tools/mbench
+directories were not modified).
+Removed 2011 from the example in the doc/README.dev file.
+------------------------------------------------------------------------
+r7980 | vlefevre | 2011-12-09 13:43:03 +0000 (Fri, 09 Dec 2011) | 4 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/INSTALL
+ M /branches/3.1/configure.ac
+
+Merged changesets r7976-7978 from the trunk:
+[INSTALL] Added information about system/compiler bugs related to TLS
+ or optimizations.
+[configure.ac] Mention --disable-thread-safe.
+------------------------------------------------------------------------
+r7972 | vlefevre | 2011-11-28 12:20:46 +0000 (Mon, 28 Nov 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/turandom.c
+
+[tests/turandom.c] Removed an obsolete comment.
+------------------------------------------------------------------------
+r7969 | vlefevre | 2011-11-28 11:36:10 +0000 (Mon, 28 Nov 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7968 | vlefevre | 2011-11-28 11:34:34 +0000 (Mon, 28 Nov 2011) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/tests/trandom.c
+ M /branches/3.1/tests/turandom.c
+
+Merged changesets r7965-7966 from the trunk:
+[doc/mpfr.texi] Mentioned the difference between GMP 4.1 and 4.2 about
+the changes of mpfr_urandom and mpfr_urandomb in MPFR 3.1.
+[tests/trandom.c,tests/turandom.c] Fixed compatibility with GMP 4.1.x
+(since the default PRNG has changed between GMP 4.1 and 4.2).
+------------------------------------------------------------------------
+r7945 | vlefevre | 2011-11-03 16:11:08 +0000 (Thu, 03 Nov 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/vasprintf.c
+
+[src/vasprintf.c] Corrected a comment.
+------------------------------------------------------------------------
+r7942 | vlefevre | 2011-11-03 14:49:58 +0000 (Thu, 03 Nov 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/tests/tsprintf.c
+
+[tests/tsprintf.c] Coding style.
+------------------------------------------------------------------------
+r7940 | vlefevre | 2011-11-03 14:10:49 +0000 (Thu, 03 Nov 2011) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/vasprintf.c
+ M /branches/3.1/tests/tsprintf.c
+
+[src/vasprintf.c] Fixed bug reported by Pavel Holoborodko.
+[tests/tsprintf.c] Added testcases.
+(Merged changesets r7931 (except src/mpn_exp.c) and r7933-7936.)
+------------------------------------------------------------------------
+r7921 | vlefevre | 2011-10-14 10:18:30 +0000 (Fri, 14 Oct 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/INSTALL
+ M /branches/3.1/tests/Makefile.am
+
+[tests/Makefile.am] Added -L$(top_builddir)/src/.libs to AM_LDFLAGS.
+[INSTALL] Removed the notes on HP-UX (obsolete after the above change).
+------------------------------------------------------------------------
+r7919 | vlefevre | 2011-10-13 11:30:54 +0000 (Thu, 13 Oct 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/INSTALL
+
+[INSTALL] Corrected notes for HP-UX.
+------------------------------------------------------------------------
+r7917 | vlefevre | 2011-10-13 11:20:23 +0000 (Thu, 13 Oct 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/INSTALL
+
+[INSTALL] Added notes for HP-UX after a bug report. See discussion:
+https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00042.html
+------------------------------------------------------------------------
+r7908 | vlefevre | 2011-10-04 11:14:48 +0000 (Tue, 04 Oct 2011) | 3 lines
+Changed paths:
+ M /branches/3.1/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Fixed a bug in the MPFR_UNLIKELY macro for GCC
+(found under Mac OS X / PowerPC with the mode32 GMP ABI, and MPFR
+built with --enable-assert=full).
+------------------------------------------------------------------------
+r7907 | vlefevre | 2011-10-04 10:04:11 +0000 (Tue, 04 Oct 2011) | 1 line
+Changed paths:
+ M /branches/3.1/INSTALL
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.1-dev.
+------------------------------------------------------------------------
+r7897 | vlefevre | 2011-10-03 08:16:03 +0000 (Mon, 03 Oct 2011) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r7896 | vlefevre | 2011-10-03 08:10:45 +0000 (Mon, 03 Oct 2011) | 1 line
+Changed paths:
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.0.
+------------------------------------------------------------------------
+r7895 | vlefevre | 2011-10-03 08:09:19 +0000 (Mon, 03 Oct 2011) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7893 | vlefevre | 2011-09-29 22:25:41 +0000 (Thu, 29 Sep 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] added reference and comment for eint
+(Merged changeset r7892 from the trunk.)
+------------------------------------------------------------------------
+r7890 | vlefevre | 2011-09-25 00:17:05 +0000 (Sun, 25 Sep 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Rephrased mpfr_frexp description.
+(Merged changeset r7889 from the trunk.)
+------------------------------------------------------------------------
+r7887 | vlefevre | 2011-09-24 10:01:07 +0000 (Sat, 24 Sep 2011) | 5 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/NEWS
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/log1p.c
+ M /branches/3.1/tests/tagm.c
+ M /branches/3.1/tests/tgeneric.c
+
+Renamed "division-by-zero" to "divide-by-zero" (term used by the
+ISO C99 standard, the IEEE 754-2008 standard using divideByZero,
+and the old IEEE 754-1985 standard using both "divide by zero"
+and "division by zero").
+(Merged changeset r7886 from the trunk.)
+------------------------------------------------------------------------
+r7885 | vlefevre | 2011-09-24 09:40:03 +0000 (Sat, 24 Sep 2011) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/gmp_op.c
+ M /branches/3.1/tests/tgmpop.c
+
+[tests/tgmpop.c] Improved division-by-zero tests.
+[src/gmp_op.c] Forgot to update the flags in some functions.
+(Merged changesets r7882 and r7883 from the trunk.)
+------------------------------------------------------------------------
+r7884 | vlefevre | 2011-09-24 09:39:02 +0000 (Sat, 24 Sep 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/faq.xsl
+
+[doc/faq.xsl] Added a comment about the MPFR logo.
+(Merged changeset r7881 from the trunk.)
+------------------------------------------------------------------------
+r7880 | vlefevre | 2011-09-22 10:38:10 +0000 (Thu, 22 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Improved mpfr_frexp description.
+------------------------------------------------------------------------
+r7878 | vlefevre | 2011-09-22 10:09:40 +0000 (Thu, 22 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Corrected typo in the mpfr_frexp description.
+------------------------------------------------------------------------
+r7874 | vlefevre | 2011-09-20 08:50:37 +0000 (Tue, 20 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r7872 | vlefevre | 2011-09-20 07:37:01 +0000 (Tue, 20 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.0-rc2.
+------------------------------------------------------------------------
+r7871 | vlefevre | 2011-09-20 07:35:18 +0000 (Tue, 20 Sep 2011) | 18 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/NEWS
+ M /branches/3.1/TODO
+ M /branches/3.1/doc/README.dev
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/examples/version.c
+ M /branches/3.1/src/agm.c
+ M /branches/3.1/src/buildopt.c
+ M /branches/3.1/src/gmp_op.c
+ M /branches/3.1/src/mpfr-gmp.h
+ M /branches/3.1/src/mpfr-impl.h
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/tests/tbuildopt.c
+ M /branches/3.1/tests/tgmpop.c
+
+Merged r7857 through r7870 from the trunk:
+ * [src/mpfr-gmp.h] Fixed a prototype (mpfr_limb_ptr isn't available
+ yet) and added missing prototype for __gmpn_sbpi1_divappr_q.
+ * [src/mpfr-impl.h] Define new macros MPFR_EXT_EMIN and MPFR_EXT_EMAX.
+ * [src/agm.c] Replaced __gmpfr_emin and __gmpfr_emax by MPFR_EXT_EMIN
+ and MPFR_EXT_EMAX respectively (this should be a bit faster with TLS
+ and also is a workaround to a bug occurring with TLS and GCC 4.3.2
+ on a Linux/Sparc machine, gcc54.fsffrance.org).
+ * [tests/tgmpop.c] Check for erange flag in mpfr_cmp_[f,q,z].
+ * [src/gmp_op.c] Handle the special cases in mpfr_cmp_q and mpfr_cmp_f
+ (fixing the problem with the erange flag in particular).
+ * [src/buildopt.c,src/mpfr.h,tests/tbuildopt.c,doc/mpfr.texi,NEWS]
+ Added mpfr_buildopt_gmpinternals_p function.
+ * [examples/version.c] Output mpfr_buildopt_gmpinternals_p() and
+ mpfr_buildopt_tune_case() values with MPFR 3.1 or later.
+ * [doc/README.dev] Updated "To make a release". Document how to
+ specify the minimum exponent or the maximum exponent.
+ * [TODO] Added an item about the minimum and maximum exponents.
+------------------------------------------------------------------------
+r7857 | vlefevre | 2011-09-19 08:22:17 +0000 (Mon, 19 Sep 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Correction: "5 exception types" → "6 exception types"
+(thanks to Case Vanhorsen for the report).
+------------------------------------------------------------------------
+r7854 | vlefevre | 2011-09-17 11:58:18 +0000 (Sat, 17 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r7853 | vlefevre | 2011-09-14 21:38:49 +0000 (Wed, 14 Sep 2011) | 4 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Define LONGLONG_STANDALONE before including
+mpfr-longlong.h so that udiv_qrnnd_preinv is defined (this is
+useful at least on IA64 when compiling without gmp-impl.h).
+Thanks to Patrick Pélissier for the fix.
+------------------------------------------------------------------------
+r7851 | vlefevre | 2011-09-11 09:21:52 +0000 (Sun, 11 Sep 2011) | 3 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/NEWS
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated "API Compatibility" section. Documented
+ function mpfr_buildopt_tune_case. Minor consistency changes.
+[NEWS] Function mpfr_buildopt_tune_case is new in MPFR 3.1.
+------------------------------------------------------------------------
+r7844 | vlefevre | 2011-09-11 07:49:03 +0000 (Sun, 11 Sep 2011) | 2 lines
+Changed paths:
+ M /branches/3.1
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] MPFR_RNDA was introduced in MPFR 3.0.0 and should
+no longer be considered experimental.
+------------------------------------------------------------------------
+r7842 | vlefevre | 2011-09-10 21:25:45 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -rHEAD:0 -v" (in UTF-8 locales).
+------------------------------------------------------------------------
+r7841 | vlefevre | 2011-09-10 21:24:05 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7840 | vlefevre | 2011-09-10 21:23:08 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /branches/3.1/INSTALL
+ M /branches/3.1/VERSION
+ M /branches/3.1/configure.ac
+ M /branches/3.1/doc/mpfr.texi
+ M /branches/3.1/src/mpfr.h
+ M /branches/3.1/src/version.c
+
+Updated version to 3.1.0-rc1.
+------------------------------------------------------------------------
+r7839 | vlefevre | 2011-09-10 21:21:59 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ A /branches/3.1 (from /trunk:7838)
+
+Recreated 3.1 branch from the trunk.
+------------------------------------------------------------------------
+r7836 | vlefevre | 2011-09-10 21:15:45 +0000 (Sat, 10 Sep 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/trec_sqrt.c
+
+[tests/trec_sqrt.c] Fixed bug introduced in r7711 (build failure
+with a C++ compiler).
+------------------------------------------------------------------------
+r7835 | vlefevre | 2011-09-10 20:13:19 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /trunk
+ M /trunk/NEWS
+ M /trunk/doc/mpfr.texi
+
+Removed now useless svn:mergeinfo properties.
+------------------------------------------------------------------------
+r7832 | vlefevre | 2011-09-10 20:04:07 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+[TODO] Replaced "configure.in" by "configure.ac".
+------------------------------------------------------------------------
+r7831 | vlefevre | 2011-09-10 20:02:56 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Removed obsolete paragraph about AM_MAINTAINER_MODE.
+------------------------------------------------------------------------
+r7826 | vlefevre | 2011-09-10 19:08:42 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Correction after r7825.
+------------------------------------------------------------------------
+r7825 | vlefevre | 2011-09-10 19:07:39 +0000 (Sat, 10 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Run tools/ck-mparam.
+------------------------------------------------------------------------
+r7824 | vlefevre | 2011-09-10 19:04:57 +0000 (Sat, 10 Sep 2011) | 2 lines
+Changed paths:
+ A /trunk/tools/ck-mparam
+
+Added tools/ck-mparam sh script to check the mparam.h files
+(gcc is needed).
+------------------------------------------------------------------------
+r7823 | zimmerma | 2011-09-10 07:15:46 +0000 (Sat, 10 Sep 2011) | 2 lines
+Changed paths:
+ M /trunk/src/amd/k8/mparam.h
+
+[src/amd/k8/mparam.h] removed spurious end of comment
+
+------------------------------------------------------------------------
+r7821 | vlefevre | 2011-09-09 17:19:39 +0000 (Fri, 09 Sep 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] For the valgrind example, use the same arguments
+as in gnulib's valgrind-tests.m4 file.
+------------------------------------------------------------------------
+r7818 | vlefevre | 2011-09-09 13:48:33 +0000 (Fri, 09 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v".
+------------------------------------------------------------------------
+r7817 | vlefevre | 2011-09-09 13:32:55 +0000 (Fri, 09 Sep 2011) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/tools/ck-copyright-notice
+
+[Makefile.am] Added tools/ck-copyright-notice to EXTRA_DIST as it is
+ used in dist-hook.
+[tools/ck-copyright-notice] Added copyright notice (since this file is
+ distributed in the tarballs). Note: the first year is 2008 as a part
+ of the code comes from r5370 in mpfrlint.
+------------------------------------------------------------------------
+r7816 | vlefevre | 2011-09-09 11:40:33 +0000 (Fri, 09 Sep 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/ck-copyright-notice
+
+[tools/ck-copyright-notice] Skip src/mpfr-longlong.h as this file
+(which comes from GMP) has a specific copyright notice.
+------------------------------------------------------------------------
+r7815 | vlefevre | 2011-09-09 11:37:01 +0000 (Fri, 09 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/src/mp_clz_tab.c
+
+[src/mp_clz_tab.c] Updated the copyright notice.
+------------------------------------------------------------------------
+r7814 | vlefevre | 2011-09-09 11:31:07 +0000 (Fri, 09 Sep 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/ck-copyright-notice
+
+[tools/ck-copyright-notice] Check that the first copyright year for
+the mparam.h files is 2005.
+------------------------------------------------------------------------
+r7813 | vlefevre | 2011-09-09 11:26:02 +0000 (Fri, 09 Sep 2011) | 2 lines
+Changed paths:
+ M /trunk/src/amd/amdfam10/mparam.h
+ M /trunk/src/amd/athlon/mparam.h
+ M /trunk/src/amd/k8/mparam.h
+ M /trunk/src/arm/mparam.h
+ M /trunk/src/generic/mparam.h
+ M /trunk/src/hppa/mparam.h
+ M /trunk/src/ia64/mparam.h
+ M /trunk/src/powerpc32/mparam.h
+ M /trunk/src/powerpc64/mparam.h
+ M /trunk/src/sparc64/mparam.h
+ M /trunk/src/x86/core2/mparam.h
+ M /trunk/src/x86/mparam.h
+ M /trunk/src/x86_64/core2/mparam.h
+ M /trunk/src/x86_64/pentium4/mparam.h
+
+Added copyright notice to the mparam.h files (with the same years
+as in the template).
+------------------------------------------------------------------------
+r7812 | vlefevre | 2011-09-09 11:20:25 +0000 (Fri, 09 Sep 2011) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/tools/ck-copyright-notice
+ M /trunk/tools/mpfrlint
+
+Added tools/ck-copyright-notice sh script from mpfrlint (updated) to
+check that copyright notices exist and appear to be correct. Updated
+tools/mpfrlint to run tools/ck-copyright-notice instead of its old
+test. In Makefile.am, run tools/ck-copyright-notice in dist-hook for
+"make dist".
+------------------------------------------------------------------------
+r7811 | vlefevre | 2011-09-09 10:57:23 +0000 (Fri, 09 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] More files under src and tests directories.
+------------------------------------------------------------------------
+r7809 | vlefevre | 2011-09-08 09:13:50 +0000 (Thu, 08 Sep 2011) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Update for MPFR 3.1.x.
+------------------------------------------------------------------------
+r7808 | vlefevre | 2011-09-08 09:07:08 +0000 (Thu, 08 Sep 2011) | 7 lines
+Changed paths:
+ M /trunk/doc/README.dev
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am]
+ * Added "AM_LDFLAGS = -no-install" to prevent libtool from generating
+ wrapper scripts for the tests (according to discussions and tests,
+ there should be no negative effects); useful for gdb and valgrind.
+ * Added $(VALGRIND) to TESTS_ENVIRONMENT in order to easily run the
+ tests under valgrind with: VALGRIND="valgrind -q" make check
+[doc/README.dev] Update for gdb and valgrind.
+------------------------------------------------------------------------
+r7807 | vlefevre | 2011-08-31 08:55:56 +0000 (Wed, 31 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Improved the specification of mpfr_get_f.
+------------------------------------------------------------------------
+r7805 | zimmerma | 2011-08-30 12:01:16 +0000 (Tue, 30 Aug 2011) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] added comment about minimal GMP version
+
+------------------------------------------------------------------------
+r7804 | zimmerma | 2011-08-30 08:23:16 +0000 (Tue, 30 Aug 2011) | 3 lines
+Changed paths:
+ M /trunk/src/add.c
+
+dummy change to check if GMP_CHECK_RANDOMIZE is now used in the Hydra
+builds on http://hydra.nixos.org/jobset/gnu/mpfr-trunk
+
+------------------------------------------------------------------------
+r7803 | vlefevre | 2011-08-19 10:03:19 +0000 (Fri, 19 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Added some references to the ternary definition.
+------------------------------------------------------------------------
+r7802 | zimmerma | 2011-08-19 09:01:58 +0000 (Fri, 19 Aug 2011) | 3 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] improved the documentation of mpfr_set_str, as suggested by
+ Vincent Lefevre
+
+------------------------------------------------------------------------
+r7801 | vlefevre | 2011-08-19 08:45:07 +0000 (Fri, 19 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Added "Ternary value" to the concept index.
+------------------------------------------------------------------------
+r7800 | vlefevre | 2011-08-15 12:34:40 +0000 (Mon, 15 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added information on how to update the FAQ.
+------------------------------------------------------------------------
+r7798 | vlefevre | 2011-08-15 11:55:59 +0000 (Mon, 15 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/FAQ.html
+
+[doc] Updated FAQ.html with update-faq.
+------------------------------------------------------------------------
+r7796 | vlefevre | 2011-08-12 11:39:06 +0000 (Fri, 12 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tune/tuneup.c] Untabified.
+------------------------------------------------------------------------
+r7795 | vlefevre | 2011-08-12 11:35:51 +0000 (Fri, 12 Aug 2011) | 3 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] Replaced MPFR_ASSERTD by MPFR_ASSERTN on constant
+expressions (this is a temporary change, as they should later be
+replaced by static assertions).
+------------------------------------------------------------------------
+r7794 | vlefevre | 2011-08-12 11:33:09 +0000 (Fri, 12 Aug 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] Replaced mp_ptr and mp_srcptr (internal to GMP) by
+mpfr_limb_ptr and mpfr_limb_srcptr.
+------------------------------------------------------------------------
+r7793 | vlefevre | 2011-08-12 11:25:25 +0000 (Fri, 12 Aug 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-gmp.h
+
+[src/mpfr-gmp.h] Avoid potential identifier collision by using an
+underscore for variable names declared in the invert_pi1 macro.
+------------------------------------------------------------------------
+r7792 | vlefevre | 2011-08-12 11:18:12 +0000 (Fri, 12 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-gmp.h
+
+[src/mpfr-gmp.h] Untabified.
+------------------------------------------------------------------------
+r7791 | vlefevre | 2011-08-12 11:14:38 +0000 (Fri, 12 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7790 | zimmerma | 2011-08-06 13:30:28 +0000 (Sat, 06 Aug 2011) | 2 lines
+Changed paths:
+ M /trunk/src/amd/k8/mparam.h
+
+[k8/mparam.h] added comment
+
+------------------------------------------------------------------------
+r7789 | zimmerma | 2011-08-06 12:01:58 +0000 (Sat, 06 Aug 2011) | 3 lines
+Changed paths:
+ M /trunk/src/amd/amdfam10/mparam.h
+ M /trunk/src/x86/mparam.h
+
+[x86/mparam.h] new tuning contributed by Jim Cloos
+[amd/amdfam10/mparam.h] added GMP version
+
+------------------------------------------------------------------------
+r7788 | zimmerma | 2011-08-06 11:52:12 +0000 (Sat, 06 Aug 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mulders.c
+
+[mpfr-gmp.h] use mpfr_pi1_t instead of gmp_pi1_t to avoid using GMP's namespace
+
+------------------------------------------------------------------------
+r7787 | zimmerma | 2011-08-05 14:22:26 +0000 (Fri, 05 Aug 2011) | 5 lines
+Changed paths:
+ M /trunk/configure.ac
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mulders.c
+ M /trunk/tune/tuneup.c
+
+[src/mulders.c] use mpn_sbpi1_divappr_q if available and WANT_GMP_INTERNALS
+ is defined
+[src/mpfr-gmp.h] defined macros needed for mpfr_divhigh_n_basecase
+[configure.ac] check for mpn_sbpi1_divappr_q
+
+------------------------------------------------------------------------
+r7786 | vlefevre | 2011-08-05 13:17:23 +0000 (Fri, 05 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.ac
+ M /trunk/doc/mpfr.texi
+ M /trunk/src/mpfr.h
+ M /trunk/src/version.c
+
+Updated version to 3.2.0-dev.
+------------------------------------------------------------------------
+r7784 | zimmerma | 2011-08-05 12:56:08 +0000 (Fri, 05 Aug 2011) | 2 lines
+Changed paths:
+ A /trunk/src/amd/amdfam10
+ A /trunk/src/amd/amdfam10/mparam.h
+
+[amdfam10/mparam.h] tuning parameters contributed by Jim Cloos
+
+------------------------------------------------------------------------
+r7783 | zimmerma | 2011-08-05 03:08:42 +0000 (Fri, 05 Aug 2011) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/src/Makefile.am
+ M /trunk/src/mulders.c
+ M /trunk/tune/tuneup.c
+
+[mulders.c] added a basecase code for Mulders' short division
+[tuneup.c] added corresponding tuning code
+[TODO] added an item
+
+------------------------------------------------------------------------
+r7782 | vlefevre | 2011-08-04 14:36:42 +0000 (Thu, 04 Aug 2011) | 4 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] In the INTMAX_MAX test, no longer hardcode the
+"#include <stdint.h>" (for instance, this doesn't work under
+Solaris 9: INTMAX_MAX is defined only via <inttypes.h>), but
+include "mpfr-intmax.h" instead (needs a temporary CPPFLAGS).
+------------------------------------------------------------------------
+r7781 | vlefevre | 2011-08-01 14:39:08 +0000 (Mon, 01 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Much faster formatted output (mpfr_printf, etc.) with %Rg and similar.
+------------------------------------------------------------------------
+r7780 | vlefevre | 2011-08-01 13:56:27 +0000 (Mon, 01 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added copyright notice in case the file is distributed.
+------------------------------------------------------------------------
+r7779 | vlefevre | 2011-08-01 13:50:17 +0000 (Mon, 01 Aug 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added information on how to run the MPFR test suite
+under valgrind.
+------------------------------------------------------------------------
+r7778 | vlefevre | 2011-08-01 12:36:04 +0000 (Mon, 01 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/src/div.c
+ M /trunk/src/rec_sqrt.c
+ M /trunk/tests/trec_sqrt.c
+
+Untabified and removed trailing spaces.
+------------------------------------------------------------------------
+r7777 | vlefevre | 2011-08-01 12:13:50 +0000 (Mon, 01 Aug 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tversion.c
+
+[tests/tversion.c] Improved output information.
+------------------------------------------------------------------------
+r7776 | zimmerma | 2011-07-31 19:44:32 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/hppa/mparam.h
+
+[hppa/mparam.h] updated for new Mulders' division
+
+------------------------------------------------------------------------
+r7775 | zimmerma | 2011-07-31 19:40:23 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/sparc64/mparam.h
+
+[sparc64/mparam.h] updated for new Mulders' division
+
+------------------------------------------------------------------------
+r7774 | zimmerma | 2011-07-31 15:43:40 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/powerpc64/mparam.h
+
+[powerpc64/mparam.h] updated for new Mulders' division
+
+------------------------------------------------------------------------
+r7773 | zimmerma | 2011-07-31 15:08:43 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/ia64/mparam.h
+
+[ia64/mparam.h] updated for new Mulders' division
+
+------------------------------------------------------------------------
+r7772 | zimmerma | 2011-07-31 12:43:03 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/amd/k8/mparam.h
+
+[amd/k8/mparam.h] updated for new Mulders' division
+
+------------------------------------------------------------------------
+r7771 | zimmerma | 2011-07-31 12:39:57 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/x86/core2/mparam.h
+
+[x86/core2/mparam.h] updated thresholds for new Mulders' division
+
+------------------------------------------------------------------------
+r7770 | zimmerma | 2011-07-31 10:54:38 +0000 (Sun, 31 Jul 2011) | 5 lines
+Changed paths:
+ M /trunk/src/mparam_h.in
+ M /trunk/tests/tversion.c
+
+[mparam_h.in] changed the detection of 64-bit Core 2, and added
+ MPFR_TUNE_CASE for default case
+[tversion.c] print GMP version (header and library), and file for tuning
+ parameters
+
+------------------------------------------------------------------------
+r7769 | zimmerma | 2011-07-31 10:29:31 +0000 (Sun, 31 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/x86_64/core2/mparam.h
+
+[x86_64/core2/mparam.h] updated for Mulders' division
+
+------------------------------------------------------------------------
+r7768 | zimmerma | 2011-07-31 08:59:53 +0000 (Sun, 31 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/src/div.c
+ M /trunk/src/generic/mparam.h
+ M /trunk/tune/tuneup.c
+
+Added tuning for MPFR_DIV_THRESHOLD, and default value.
+It now remains to do the tuning on the architectures in mparam_in.h.
+
+------------------------------------------------------------------------
+r7767 | zimmerma | 2011-07-29 20:46:45 +0000 (Fri, 29 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] added speed improvement in mpfr_div
+
+------------------------------------------------------------------------
+r7765 | zimmerma | 2011-07-29 20:15:02 +0000 (Fri, 29 Jul 2011) | 39 lines
+Changed paths:
+ M /trunk/src/div.c
+ M /trunk/src/mulders.c
+
+[mulders.c] fixed bug in mpfr_divhigh_n (this routine was not used yet)
+[div.c] now use Mulders' short product for large division. It remains to
+ do the automatic tuning of MPFR_DIV_THRESHOLD. The speedup is nice,
+ for example on my Core 2 Duo laptop we got with MPFR 3.0.0:
+
+[zimmerma@coing tests]$ ./timings-mpfr 1000
+Using MPFR-3.0.0 with GMP-5.0.2
+[precision is 3322 bits]
+x*y took 0.004543 ms (262143 eval in 1191 ms)
+x*x took 0.003616 ms (524287 eval in 1896 ms)
+x/y took 0.009087 ms (131071 eval in 1191 ms)
+sqrt(x) took 0.007004 ms (262143 eval in 1836 ms)
+exp(x) took 0.293040 ms (4095 eval in 1200 ms)
+log(x) took 0.253724 ms (4095 eval in 1039 ms)
+sin(x) took 0.306960 ms (4095 eval in 1257 ms)
+cos(x) took 0.290842 ms (4095 eval in 1191 ms)
+arccos(x) took 0.590620 ms (2047 eval in 1209 ms)
+arctan(x) took 0.560332 ms (2047 eval in 1147 ms)
+
+and now we get:
+
+[zimmerma@coing tests]$ ./timings-mpfr 1000
+Using MPFR-3.1.0-dev with GMP-5.0.2
+[precision is 3322 bits]
+x*y took 0.004444 ms (262143 eval in 1165 ms)
+x*x took 0.002686 ms (524287 eval in 1408 ms)
+x/y took 0.006989 ms (262143 eval in 1832 ms)
+sqrt(x) took 0.007084 ms (262143 eval in 1857 ms)
+exp(x) took 0.292063 ms (4095 eval in 1196 ms)
+log(x) took 0.246886 ms (4095 eval in 1011 ms)
+sin(x) took 0.259096 ms (4095 eval in 1061 ms)
+cos(x) took 0.244933 ms (4095 eval in 1003 ms)
+arccos(x) took 0.556424 ms (2047 eval in 1139 ms)
+arctan(x) took 0.526624 ms (2047 eval in 1078 ms)
+
+We see that other routines also benefit from the speedup in mpfr_sqr and
+mpfr_div (log, sin, cos, arccos, arctan).
+
+
+------------------------------------------------------------------------
+r7764 | zimmerma | 2011-07-29 15:21:09 +0000 (Fri, 29 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/doc/algorithms.bib
+ M /trunk/doc/algorithms.tex
+
+[algorithms.tex] added algorithm for division with Mulders' short product
+ (can anybody check the algorithm is ok?)
+
+------------------------------------------------------------------------
+r7763 | vlefevre | 2011-07-29 12:48:21 +0000 (Fri, 29 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/src/vasprintf.c
+
+[src/vasprintf.c] Added a comment.
+------------------------------------------------------------------------
+r7762 | vlefevre | 2011-07-29 12:24:18 +0000 (Fri, 29 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/get_str.c
+
+[src/get_str.c] Added a comment about the use of mpfr_ceil_mul
+(exported and declared in mpfr-impl.h since r7760).
+------------------------------------------------------------------------
+r7761 | thevenyp | 2011-07-28 23:01:52 +0000 (Thu, 28 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/src/vasprintf.c
+ M /trunk/tests/tsprintf.c
+
+Avoid expensive calls to mpfr_get_prec() using mpfr_ceil_mul() instead.
+------------------------------------------------------------------------
+r7760 | thevenyp | 2011-07-28 22:59:01 +0000 (Thu, 28 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/src/get_str.c
+ M /trunk/src/mpfr-impl.h
+
+Make ceil_mul() public as mpfr_ceil_mul() in mpfr-impl.h
+------------------------------------------------------------------------
+r7759 | vlefevre | 2011-07-28 18:50:21 +0000 (Thu, 28 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] MPFR coding conventions for r7752.
+------------------------------------------------------------------------
+r7758 | zimmerma | 2011-07-28 17:17:24 +0000 (Thu, 28 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/src/amd/k8/mparam.h
+ M /trunk/src/arm/mparam.h
+ M /trunk/src/hppa/mparam.h
+ M /trunk/src/ia64/mparam.h
+ M /trunk/src/mulders.c
+ M /trunk/src/powerpc32/mparam.h
+ M /trunk/src/powerpc64/mparam.h
+ M /trunk/src/sparc64/mparam.h
+ M /trunk/src/x86/core2/mparam.h
+ M /trunk/src/x86/mparam.h
+ M /trunk/src/x86_64/core2/mparam.h
+ M /trunk/src/x86_64/pentium4/mparam.h
+
+modified the default tuning parameters so they are within the bounds of the
+ARITH-20 paper "Short Division of Long Integers"
+
+------------------------------------------------------------------------
+r7757 | zimmerma | 2011-07-28 16:38:55 +0000 (Thu, 28 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] declare mpfr_mullow_n as non-static since it might be useful
+ elsewhere
+
+------------------------------------------------------------------------
+r7756 | zimmerma | 2011-07-28 16:36:50 +0000 (Thu, 28 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] fix tuning bounds of short product and division according to the
+ ARITH-20 paper
+
+------------------------------------------------------------------------
+r7755 | zimmerma | 2011-07-28 16:36:01 +0000 (Thu, 28 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] detect long double format in m68k
+
+------------------------------------------------------------------------
+r7754 | zimmerma | 2011-07-28 16:35:25 +0000 (Thu, 28 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tget_flt.c] added test to check FLT_MAX + FLT_MAX gives INFP
+ (to early detect compiler bugs)
+
+------------------------------------------------------------------------
+r7753 | zimmerma | 2011-07-28 16:30:38 +0000 (Thu, 28 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/nightly-test
+
+[nightly-test] changed -pedantic-errors into -pedantic
+
+------------------------------------------------------------------------
+r7752 | zimmerma | 2011-07-28 16:29:51 +0000 (Thu, 28 Jul 2011) | 4 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[mulders.c] added some code for short division (FoldDiv, not used),
+ added comments and fixed bounds in accordance with the
+ ARITH-20 paper
+
+------------------------------------------------------------------------
+r7751 | thevenyp | 2011-07-28 16:16:36 +0000 (Thu, 28 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/src/vasprintf.c
+
+Use a buffer in order to avoid a double call to mpfr_get_str.
+------------------------------------------------------------------------
+r7750 | vlefevre | 2011-07-26 13:12:46 +0000 (Tue, 26 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/src/log.c
+
+[src/log.c] Replaced TMP_* by MPFR_GROUP_* (patch by Patrick).
+------------------------------------------------------------------------
+r7749 | vlefevre | 2011-07-22 10:24:38 +0000 (Fri, 22 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Added a comment about TLS variable initialization.
+------------------------------------------------------------------------
+r7748 | vlefevre | 2011-07-22 10:15:04 +0000 (Fri, 22 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Added information about TLS variable initialization.
+------------------------------------------------------------------------
+r7747 | vlefevre | 2011-07-22 10:09:28 +0000 (Fri, 22 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Split Chapter "MPFR Basics" into nodes as it is now
+quite large (thus references to particular sections are now possible).
+------------------------------------------------------------------------
+r7744 | zimmerma | 2011-07-18 19:03:25 +0000 (Mon, 18 Jul 2011) | 7 lines
+Changed paths:
+ M /trunk/src/vasprintf.c
+
+[vasprintf.c] simplified and improved round_to_10_power(), also contributed
+ a negative number of lines of code :-)
+ Still not optimal, since round_to_10_power() is still called
+ twice for printing say pi with mpfr_printf ("%Rg\n", x), once
+ from partition_number(), once from regular_fg(), and thus
+ mpfr_get_str is called at least 3 times!
+
+------------------------------------------------------------------------
+r7743 | zimmerma | 2011-07-18 12:21:29 +0000 (Mon, 18 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] improve error message when libgmp is not found
+
+------------------------------------------------------------------------
+r7742 | zimmerma | 2011-07-18 11:24:40 +0000 (Mon, 18 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[mpfr.texi] added note about threads for mpfr_set_default_prec and
+ mpfr_get_default_prec
+
+------------------------------------------------------------------------
+r7740 | vlefevre | 2011-07-06 15:57:22 +0000 (Wed, 06 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7738 | vlefevre | 2011-07-06 13:47:35 +0000 (Wed, 06 Jul 2011) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/doc/mpfr.texi
+
+[NEWS, doc/mpfr.texi] mpfr_min_prec was a new function in MPFR 3.0.0.
+------------------------------------------------------------------------
+r7736 | vlefevre | 2011-07-01 15:17:47 +0000 (Fri, 01 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tests/tget_flt.c] Replaced FLT_MAX + FLT_MAX by (float) DBL_POS_INF,
+which should trigger fewer compiler bugs. See:
+ https://sympa.inria.fr/sympa/arc/mpfr/2011-07/msg00002.html
+------------------------------------------------------------------------
+r7734 | vlefevre | 2011-07-01 08:07:35 +0000 (Fri, 01 Jul 2011) | 2 lines
+Changed paths:
+ M /trunk/src/ieee_floats.h
+
+[src/ieee_floats.h] Added a comment about the NaN format when
+_GMP_IEEE_FLOATS is defined.
+------------------------------------------------------------------------
+r7733 | zimmerma | 2011-07-01 08:04:50 +0000 (Fri, 01 Jul 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tget_flt.c] check for compiler bug
+ (https://sympa.inria.fr/sympa/arc/mpfr/2011-07/msg00000.html)
+
+------------------------------------------------------------------------
+r7731 | vlefevre | 2011-06-30 00:17:40 +0000 (Thu, 30 Jun 2011) | 3 lines
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/BUGS
+ M /trunk/COPYING
+ M /trunk/COPYING.LESSER
+ M /trunk/ChangeLog
+ M /trunk/INSTALL
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/PATCHES
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/VERSION
+ M /trunk/acinclude.m4
+ M /trunk/configure.ac
+ M /trunk/doc/FAQ.html
+ M /trunk/doc/README.dev
+ M /trunk/doc/algorithms.bib
+ M /trunk/doc/algorithms.tex
+ M /trunk/doc/faq.xsl
+ M /trunk/doc/fdl.texi
+ M /trunk/doc/mpfr.texi
+ M /trunk/doc/update-faq
+ M /trunk/examples/divworst.c
+ M /trunk/examples/rndo-add.c
+ M /trunk/examples/sample.c
+ M /trunk/examples/version.c
+ M /trunk/other/cputime.h
+ M /trunk/other/div-short.c
+ M /trunk/src/Makefile.am
+ M /trunk/src/abort_prec_max.c
+ M /trunk/src/acos.c
+ M /trunk/src/acosh.c
+ M /trunk/src/add.c
+ M /trunk/src/add1.c
+ M /trunk/src/add1sp.c
+ M /trunk/src/add_d.c
+ M /trunk/src/add_ui.c
+ M /trunk/src/agm.c
+ M /trunk/src/ai.c
+ M /trunk/src/asin.c
+ M /trunk/src/asinh.c
+ M /trunk/src/atan.c
+ M /trunk/src/atan2.c
+ M /trunk/src/atanh.c
+ M /trunk/src/bernoulli.c
+ M /trunk/src/buildopt.c
+ M /trunk/src/cache.c
+ M /trunk/src/cbrt.c
+ M /trunk/src/check.c
+ M /trunk/src/clear.c
+ M /trunk/src/clears.c
+ M /trunk/src/cmp.c
+ M /trunk/src/cmp2.c
+ M /trunk/src/cmp_abs.c
+ M /trunk/src/cmp_d.c
+ M /trunk/src/cmp_ld.c
+ M /trunk/src/cmp_si.c
+ M /trunk/src/cmp_ui.c
+ M /trunk/src/comparisons.c
+ M /trunk/src/const_catalan.c
+ M /trunk/src/const_euler.c
+ M /trunk/src/const_log2.c
+ M /trunk/src/const_pi.c
+ M /trunk/src/constant.c
+ M /trunk/src/copysign.c
+ M /trunk/src/cos.c
+ M /trunk/src/cosh.c
+ M /trunk/src/cot.c
+ M /trunk/src/coth.c
+ M /trunk/src/csc.c
+ M /trunk/src/csch.c
+ M /trunk/src/d_div.c
+ M /trunk/src/d_sub.c
+ M /trunk/src/digamma.c
+ M /trunk/src/dim.c
+ M /trunk/src/div.c
+ M /trunk/src/div_2exp.c
+ M /trunk/src/div_2si.c
+ M /trunk/src/div_2ui.c
+ M /trunk/src/div_d.c
+ M /trunk/src/div_ui.c
+ M /trunk/src/dump.c
+ M /trunk/src/eint.c
+ M /trunk/src/eq.c
+ M /trunk/src/erf.c
+ M /trunk/src/erfc.c
+ M /trunk/src/exceptions.c
+ M /trunk/src/exp.c
+ M /trunk/src/exp10.c
+ M /trunk/src/exp2.c
+ M /trunk/src/exp3.c
+ M /trunk/src/exp_2.c
+ M /trunk/src/expm1.c
+ M /trunk/src/extract.c
+ M /trunk/src/factorial.c
+ M /trunk/src/fits_intmax.c
+ M /trunk/src/fits_s.h
+ M /trunk/src/fits_sint.c
+ M /trunk/src/fits_slong.c
+ M /trunk/src/fits_sshort.c
+ M /trunk/src/fits_u.h
+ M /trunk/src/fits_uint.c
+ M /trunk/src/fits_uintmax.c
+ M /trunk/src/fits_ulong.c
+ M /trunk/src/fits_ushort.c
+ M /trunk/src/fma.c
+ M /trunk/src/fms.c
+ M /trunk/src/frac.c
+ M /trunk/src/free_cache.c
+ M /trunk/src/gamma.c
+ M /trunk/src/gammaonethird.c
+ M /trunk/src/gen_inverse.h
+ M /trunk/src/get_d.c
+ M /trunk/src/get_d64.c
+ M /trunk/src/get_exp.c
+ M /trunk/src/get_f.c
+ M /trunk/src/get_flt.c
+ M /trunk/src/get_ld.c
+ M /trunk/src/get_si.c
+ M /trunk/src/get_sj.c
+ M /trunk/src/get_str.c
+ M /trunk/src/get_ui.c
+ M /trunk/src/get_uj.c
+ M /trunk/src/get_z.c
+ M /trunk/src/get_z_exp.c
+ M /trunk/src/gmp_op.c
+ M /trunk/src/hypot.c
+ M /trunk/src/ieee_floats.h
+ M /trunk/src/init.c
+ M /trunk/src/init2.c
+ M /trunk/src/inits.c
+ M /trunk/src/inits2.c
+ M /trunk/src/inp_str.c
+ M /trunk/src/int_ceil_log2.c
+ M /trunk/src/isinf.c
+ M /trunk/src/isinteger.c
+ M /trunk/src/isnan.c
+ M /trunk/src/isnum.c
+ M /trunk/src/isqrt.c
+ M /trunk/src/isregular.c
+ M /trunk/src/iszero.c
+ M /trunk/src/jn.c
+ M /trunk/src/jyn_asympt.c
+ M /trunk/src/li2.c
+ M /trunk/src/lngamma.c
+ M /trunk/src/log.c
+ M /trunk/src/log10.c
+ M /trunk/src/log1p.c
+ M /trunk/src/log2.c
+ M /trunk/src/logging.c
+ M /trunk/src/min_prec.c
+ M /trunk/src/minmax.c
+ M /trunk/src/modf.c
+ M /trunk/src/mp_clz_tab.c
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mpf2mpfr.h
+ M /trunk/src/mpfr-gmp.c
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mpfr-longlong.h
+ M /trunk/src/mpfr-thread.h
+ M /trunk/src/mpfr.h
+ M /trunk/src/mpn_exp.c
+ M /trunk/src/mul.c
+ M /trunk/src/mul_2exp.c
+ M /trunk/src/mul_2si.c
+ M /trunk/src/mul_2ui.c
+ M /trunk/src/mul_d.c
+ M /trunk/src/mul_ui.c
+ M /trunk/src/mulders.c
+ M /trunk/src/neg.c
+ M /trunk/src/next.c
+ M /trunk/src/out_str.c
+ M /trunk/src/pow.c
+ M /trunk/src/pow_si.c
+ M /trunk/src/pow_ui.c
+ M /trunk/src/pow_z.c
+ M /trunk/src/powerof2.c
+ M /trunk/src/print_raw.c
+ M /trunk/src/print_rnd_mode.c
+ M /trunk/src/printf.c
+ M /trunk/src/rec_sqrt.c
+ M /trunk/src/reldiff.c
+ M /trunk/src/rem1.c
+ M /trunk/src/rint.c
+ M /trunk/src/root.c
+ M /trunk/src/round_near_x.c
+ M /trunk/src/round_p.c
+ M /trunk/src/round_prec.c
+ M /trunk/src/round_raw_generic.c
+ M /trunk/src/scale2.c
+ M /trunk/src/sec.c
+ M /trunk/src/sech.c
+ M /trunk/src/set.c
+ M /trunk/src/set_d.c
+ M /trunk/src/set_d64.c
+ M /trunk/src/set_dfl_prec.c
+ M /trunk/src/set_exp.c
+ M /trunk/src/set_f.c
+ M /trunk/src/set_flt.c
+ M /trunk/src/set_inf.c
+ M /trunk/src/set_ld.c
+ M /trunk/src/set_nan.c
+ M /trunk/src/set_prc_raw.c
+ M /trunk/src/set_prec.c
+ M /trunk/src/set_q.c
+ M /trunk/src/set_rnd.c
+ M /trunk/src/set_si.c
+ M /trunk/src/set_si_2exp.c
+ M /trunk/src/set_sj.c
+ M /trunk/src/set_str.c
+ M /trunk/src/set_str_raw.c
+ M /trunk/src/set_ui.c
+ M /trunk/src/set_ui_2exp.c
+ M /trunk/src/set_uj.c
+ M /trunk/src/set_z.c
+ M /trunk/src/set_z_exp.c
+ M /trunk/src/set_zero.c
+ M /trunk/src/setmax.c
+ M /trunk/src/setmin.c
+ M /trunk/src/setsign.c
+ M /trunk/src/sgn.c
+ M /trunk/src/si_op.c
+ M /trunk/src/signbit.c
+ M /trunk/src/sin.c
+ M /trunk/src/sin_cos.c
+ M /trunk/src/sinh.c
+ M /trunk/src/sinh_cosh.c
+ M /trunk/src/sqr.c
+ M /trunk/src/sqrt.c
+ M /trunk/src/sqrt_ui.c
+ M /trunk/src/stack_interface.c
+ M /trunk/src/strtofr.c
+ M /trunk/src/sub.c
+ M /trunk/src/sub1.c
+ M /trunk/src/sub1sp.c
+ M /trunk/src/sub_d.c
+ M /trunk/src/sub_ui.c
+ M /trunk/src/subnormal.c
+ M /trunk/src/sum.c
+ M /trunk/src/swap.c
+ M /trunk/src/tan.c
+ M /trunk/src/tanh.c
+ M /trunk/src/uceil_exp2.c
+ M /trunk/src/uceil_log2.c
+ M /trunk/src/ufloor_log2.c
+ M /trunk/src/ui_div.c
+ M /trunk/src/ui_pow.c
+ M /trunk/src/ui_pow_ui.c
+ M /trunk/src/ui_sub.c
+ M /trunk/src/urandom.c
+ M /trunk/src/urandomb.c
+ M /trunk/src/vasprintf.c
+ M /trunk/src/version.c
+ M /trunk/src/volatile.c
+ M /trunk/src/yn.c
+ M /trunk/src/zeta.c
+ M /trunk/src/zeta_ui.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/RRTest.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/inp_str.data
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/random2.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tai.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdigamma.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmin_prec.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tset_z_exp.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstdint.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/turandom.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tools/check_inits_clears
+ M /trunk/tools/ck-version-info
+ M /trunk/tools/coverage
+ M /trunk/tools/get_patches.sh
+ M /trunk/tools/mbench/generate.c
+ M /trunk/tools/mbench/mfv5.h
+ M /trunk/tools/mbench/mpfr-gfx.c
+ M /trunk/tools/mbench/mpfr-v4.c
+ M /trunk/tools/mbench/mpfr-v6.c
+ M /trunk/tools/mbench/timp.h
+ M /trunk/tools/update-patchv
+ M /trunk/tools/update-version
+ M /trunk/tune/speed.c
+ M /trunk/tune/tuneup.c
+
+Removed all the svn:eol-style properties (they were set to "native"),
+and in doc/README.dev, explained why svn:eol-style native should not
+be used.
+------------------------------------------------------------------------
+r7729 | vlefevre | 2011-06-28 22:55:59 +0000 (Tue, 28 Jun 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/ck-version-info
+
+[tools/ck-version-info] Check DLL version in LIBMPFR_LDFLAGS line from
+configure.ac (patch by Stefan Graff, with minor changes).
+------------------------------------------------------------------------
+r7726 | vlefevre | 2011-06-26 09:44:11 +0000 (Sun, 26 Jun 2011) | 5 lines
+Changed paths:
+ M /trunk/tools/ck-version-info
+
+[tools/ck-version-info] 2 corrections:
+ * update due to the change of the libmpfr_la_LDFLAGS line in r7724;
+ * to support the CRLF end-of-line sometimes used under MS-Windows
+ (perl should normally take care of that, but Windows software is
+ not always consistent).
+------------------------------------------------------------------------
+r7725 | vlefevre | 2011-06-26 09:30:05 +0000 (Sun, 26 Jun 2011) | 4 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Due to the "@unnumbered Function and Type Index",
+replaced the other "Function Index" by "Function and Type Index"
+(note: the function index and the type index are merged thanks to
+the "@synindex tp fn" line at the beginning of mpfr.texi).
+------------------------------------------------------------------------
+r7724 | vlefevre | 2011-06-25 16:08:39 +0000 (Sat, 25 Jun 2011) | 4 lines
+Changed paths:
+ M /trunk/configure.ac
+ M /trunk/src/Makefile.am
+
+Ported patch r7723 (changes suggested by Stefan Graff to be able
+to build Windows DLLs with GCC 4.6[*]) to the trunk, not tested
+(something more may be needed due to the source reorganization).
+[*] https://sympa.inria.fr/sympa/arc/mpfr/2011-06/msg00013.html
+------------------------------------------------------------------------
+r7722 | vlefevre | 2011-06-21 20:45:27 +0000 (Tue, 21 Jun 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7721 | vlefevre | 2011-06-21 20:41:51 +0000 (Tue, 21 Jun 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Corrected a note about mpfr_set_*, due to the addition
+of mpfr_set_decimal64.
+------------------------------------------------------------------------
+r7720 | vlefevre | 2011-06-20 14:38:24 +0000 (Mon, 20 Jun 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Removed comment added in r7181, as it is no longer
+necessary since r7182 (new option --enable-gmp-internals).
+------------------------------------------------------------------------
+r7719 | vlefevre | 2011-06-20 14:36:28 +0000 (Mon, 20 Jun 2011) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Updated comment concerning __gmpn_rootrem (mention
+WANT_GMP_INTERNALS).
+------------------------------------------------------------------------
+r7718 | vlefevre | 2011-06-20 14:10:04 +0000 (Mon, 20 Jun 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added a note about logging and timeout.
+------------------------------------------------------------------------
+r7717 | vlefevre | 2011-06-20 13:59:31 +0000 (Mon, 20 Jun 2011) | 1 line
+Changed paths:
+ M /trunk/src/atan2.c
+ M /trunk/src/pow.c
+
+[src] Conversion into UTF-8 (only comments were concerned).
+------------------------------------------------------------------------
+r7716 | vlefevre | 2011-06-20 13:57:40 +0000 (Mon, 20 Jun 2011) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+[TODO] Conversion into UTF-8.
+------------------------------------------------------------------------
+r7715 | vlefevre | 2011-06-20 13:56:51 +0000 (Mon, 20 Jun 2011) | 2 lines
+Changed paths:
+ M /trunk/src/pow.c
+
+[src/pow.c] Made the code more robust concerning the scaling (a bug was
+very unlikely, though), and updated the comments (partial proof).
+------------------------------------------------------------------------
+r7714 | vlefevre | 2011-06-01 01:32:26 +0000 (Wed, 01 Jun 2011) | 1 line
+Changed paths:
+ M /trunk/examples/version.c
+
+[examples/version.c] Output MPFR features and size of MPFR types.
+------------------------------------------------------------------------
+r7711 | zimmerma | 2011-05-22 19:13:25 +0000 (Sun, 22 May 2011) | 3 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+ M /trunk/tests/trec_sqrt.c
+
+[src/rec_sqrt.c] continued review; I can now prove that cu=0 in all cases
+[tests/trec_sqrt.c] added tests for corner cases
+
+------------------------------------------------------------------------
+r7710 | zimmerma | 2011-05-20 05:51:22 +0000 (Fri, 20 May 2011) | 2 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[rec_sqrt.c] more review of codes, following comments from Vincent
+
+------------------------------------------------------------------------
+r7709 | zimmerma | 2011-05-19 08:37:24 +0000 (Thu, 19 May 2011) | 2 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[rec_sqrt.c] removed tabs
+
+------------------------------------------------------------------------
+r7708 | zimmerma | 2011-05-19 06:44:00 +0000 (Thu, 19 May 2011) | 4 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[rec_sqrt.c] review and small change of changeset 7651: most probably cu=0
+ when th=0 (and maybe cu=0 always, I cannot find an example where
+ cu <> 0) but considering the case th=0 is more natural.
+
+------------------------------------------------------------------------
+r7707 | vlefevre | 2011-05-18 15:02:52 +0000 (Wed, 18 May 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] List the contributors in the alphabetic order, like
+the main authors.
+------------------------------------------------------------------------
+r7706 | vlefevre | 2011-05-18 14:52:18 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/doc/mpfr.texi
+
+Made AUTHORS and doc/mpfr.texi consistent.
+------------------------------------------------------------------------
+r7705 | vlefevre | 2011-05-18 14:44:37 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/src/acos.c
+ M /trunk/src/asin.c
+ M /trunk/src/atan.c
+ M /trunk/src/atan2.c
+ M /trunk/src/erf.c
+ M /trunk/src/get_str.c
+ M /trunk/src/mpn_exp.c
+ M /trunk/src/round_near_x.c
+ M /trunk/src/zeta.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tdigamma.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tzeta.c
+
+Updated AUTHORS file and copyright notices (for more consistency).
+------------------------------------------------------------------------
+r7704 | vlefevre | 2011-05-18 14:26:30 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+[tests/thyperbolic.c] Fixed copyright notice.
+------------------------------------------------------------------------
+r7703 | vlefevre | 2011-05-18 14:25:11 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/inp_str.c
+
+[src/inp_str.c] Improved comment.
+------------------------------------------------------------------------
+r7702 | vlefevre | 2011-05-18 14:18:41 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/fits_s.h
+
+[src/fits_s.h] Improved comment.
+------------------------------------------------------------------------
+r7701 | vlefevre | 2011-05-18 14:09:54 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7700 | vlefevre | 2011-05-18 14:09:05 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Avoid a warning from mpfrlint.
+------------------------------------------------------------------------
+r7699 | vlefevre | 2011-05-18 13:09:33 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Consistency change in the copyright notice.
+------------------------------------------------------------------------
+r7698 | vlefevre | 2011-05-18 11:09:30 +0000 (Wed, 18 May 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tsqr.c
+
+[tests/tsqr.c] Added a note in the check_mpn_sqr error message.
+------------------------------------------------------------------------
+r7697 | vlefevre | 2011-05-18 10:59:48 +0000 (Wed, 18 May 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqr.c
+
+[tests/tsqr.c] Added a test of mpn_sqr concerning a bug seen
+with GCC 4.5.2 and GMP 5.0.1 on m68k (m68000 target).
+------------------------------------------------------------------------
+r7696 | vlefevre | 2011-05-17 14:25:37 +0000 (Tue, 17 May 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added a note about a texinfo bug.
+------------------------------------------------------------------------
+r7695 | vlefevre | 2011-05-13 15:58:57 +0000 (Fri, 13 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/Makefile.am
+ M /trunk/src/fits_intmax.c
+ M /trunk/src/fits_uintmax.c
+ M /trunk/src/get_sj.c
+ M /trunk/src/get_uj.c
+ M /trunk/src/mpfr-impl.h
+ A /trunk/src/mpfr-intmax.h
+ M /trunk/src/set_sj.c
+ M /trunk/src/set_uj.c
+ M /trunk/src/vasprintf.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tset_sj.c
+
+Added mpfr-intmax.h header.
+------------------------------------------------------------------------
+r7694 | vlefevre | 2011-05-13 15:19:50 +0000 (Fri, 13 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mpfr.h
+ M /trunk/tests/tstdint.c
+ M /trunk/tests/tvalist.c
+
+Started to support mpfr_exp_t defined as intmax_t (_MPFR_EXP_FORMAT==4).
+------------------------------------------------------------------------
+r7693 | vlefevre | 2011-05-13 11:52:28 +0000 (Fri, 13 May 2011) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Added that the mpfr.h header can be included several times,
+while still supporting optional functions.
+------------------------------------------------------------------------
+r7692 | vlefevre | 2011-05-13 11:48:13 +0000 (Fri, 13 May 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Document what to do if mpfr.h can be included
+multiple times (fixes MPFR bug #9653).
+------------------------------------------------------------------------
+r7690 | vlefevre | 2011-05-12 15:29:24 +0000 (Thu, 12 May 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added a note to run tests with -D_MPFR_PREC_FORMAT=2.
+------------------------------------------------------------------------
+r7689 | vlefevre | 2011-05-12 14:10:39 +0000 (Thu, 12 May 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Exponent properties: corrected comments and removed
+obsolete mp_exp_unsigned_t definition (was internal only).
+------------------------------------------------------------------------
+r7688 | vlefevre | 2011-05-12 13:57:02 +0000 (Thu, 12 May 2011) | 4 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mpfr.h
+ M /trunk/src/vasprintf.c
+
+[src/{mpfr.h,mpfr-impl.h,vasprintf.c}] Clean-up and improvement
+of definitions related to mpfr_exp_t. MPFR can now be built with
+-D_MPFR_PREC_FORMAT=2 to have mpfr_prec_t and mpfr_exp_t defined
+as an int.
+------------------------------------------------------------------------
+r7687 | vlefevre | 2011-05-12 12:40:39 +0000 (Thu, 12 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Fixed spaces in a comment.
+------------------------------------------------------------------------
+r7686 | vlefevre | 2011-05-12 12:36:13 +0000 (Thu, 12 May 2011) | 3 lines
+Changed paths:
+ M /trunk
+ M /trunk/src/add1sp.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/turandom.c
+
+Fixed printf's calls: support the case where mpfr_prec_t is not a long
+(or unsigned long).
+[merged changeset r7643 from the exp-int branch]
+------------------------------------------------------------------------
+r7685 | vlefevre | 2011-05-12 12:30:41 +0000 (Thu, 12 May 2011) | 5 lines
+Changed paths:
+ M /trunk
+ M /trunk/src/strtofr.c
+
+[src/strtofr.c] Support the case where mpfr_exp_t < long; mpfr_exp_t is
+currently defined as mp_exp_t, which comes from GMP, and GMP currently
+defines mp_exp_t as a long, except on Cray (never tested for MPFR). But
+this may change in the future (possibly as an option)...
+[merged changeset r7642 from the exp-int branch]
+------------------------------------------------------------------------
+r7684 | vlefevre | 2011-05-12 12:21:49 +0000 (Thu, 12 May 2011) | 2 lines
+Changed paths:
+ M /trunk
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Added missing parentheses in MPFR_SADD_OVERFLOW
+(fortunately the current MPFR code was not affected).
+------------------------------------------------------------------------
+r7683 | vlefevre | 2011-05-12 12:18:38 +0000 (Thu, 12 May 2011) | 1 line
+Changed paths:
+ M /trunk
+ M /trunk/tests/tpow_z.c
+
+[tests/tpow_z.c] More details for a test in case of failure.
+------------------------------------------------------------------------
+r7682 | vlefevre | 2011-05-12 12:16:01 +0000 (Thu, 12 May 2011) | 5 lines
+Changed paths:
+ M /trunk
+ M /trunk/src/sub1.c
+
+[src/sub1.c] Fixed several bugs: integer overflows and potential
+out-of-bound pointers. They might be visible on particular platforms,
+with a particular configuration (e.g. 64-bit limbs and 32-bit exponent
+type) or particular compiler options (to check such overflows).
+[merged changesets r7637-7638 from the exp-int branch]
+------------------------------------------------------------------------
+r7679 | vlefevre | 2011-05-11 13:50:01 +0000 (Wed, 11 May 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tsin.c
+
+[tests/tsin.c] Added a test (it failed before the fix in r7308).
+------------------------------------------------------------------------
+r7678 | vlefevre | 2011-05-11 00:07:05 +0000 (Wed, 11 May 2011) | 10 lines
+Changed paths:
+ M /trunk/src/const_log2.c
+ M /trunk/src/const_pi.c
+ M /trunk/src/free_cache.c
+ M /trunk/src/mpfr-impl.h
+
+Fixed constants pi and log(2) computation when logging is used: When
+MPFR is built with logging support, these two constants are used by
+the logging functions (via mpfr_fprintf, then mpfr_log, for the base
+conversion). Since the mpfr_cache function isn't re-entrant when
+working on the same cache, we need to define two caches for each
+constant. Otherwise the constants could be incorrect; for instance,
+"MPFR_LOG_ALL=1 ./tconst_pi" was failing.
+Note: the bug was introduced with the new logging system from r7575
+for MPFR 3.1.0, based on mpfr_fprintf instead of mpfr_out_str (which
+doesn't depend on mpfr_log).
+------------------------------------------------------------------------
+r7676 | vlefevre | 2011-05-09 12:03:20 +0000 (Mon, 09 May 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+[tests/tests.c] Replaced atoi by strtoul to read the seed from
+GMP_CHECK_RANDOMIZE, as it is an unsigned long.
+------------------------------------------------------------------------
+r7674 | vlefevre | 2011-05-09 11:17:43 +0000 (Mon, 09 May 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+[tests/texp.c] Fixed the test comparing mpfr_exp_2 and mpfr_exp_3:
+filter out 0, as it is handled correctly only by mpfr_exp.
+------------------------------------------------------------------------
+r7672 | vlefevre | 2011-05-06 13:30:28 +0000 (Fri, 06 May 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Completed the note to run tests under gdb.
+------------------------------------------------------------------------
+r7671 | vlefevre | 2011-05-06 12:50:43 +0000 (Fri, 06 May 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added a note to run tests under gdb.
+------------------------------------------------------------------------
+r7670 | zimmerma | 2011-05-06 12:31:24 +0000 (Fri, 06 May 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/README.dev
+
+[README.dev] added hint for logging
+
+------------------------------------------------------------------------
+r7667 | vlefevre | 2011-05-04 23:46:17 +0000 (Wed, 04 May 2011) | 6 lines
+Changed paths:
+ M /trunk/src/atan.c
+
+[src/atan.c] Fixed bug in mpfr_atan: mpfr_check_range was called on the
+unrounded result (no longer allocated) instead of the rounded result.
+Consequence of this bug: possible incorrect or invalid result and/or
+incorrect flags if either the unrounded result or rounded result is not
+in the current exponent range. Or possibly worse if the memory used by
+the unrounded result is modified before the return of the function.
+------------------------------------------------------------------------
+r7666 | vlefevre | 2011-05-04 23:25:24 +0000 (Wed, 04 May 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tatan.c
+
+[tests/tatan.c] Corrected a comment.
+------------------------------------------------------------------------
+r7665 | vlefevre | 2011-05-04 23:20:18 +0000 (Wed, 04 May 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+[tests/tatan.c] Added a testcase showing a failure of mpfr_atan
+in a reduced exponent range.
+------------------------------------------------------------------------
+r7664 | vlefevre | 2011-05-04 22:04:17 +0000 (Wed, 04 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/const_pi.c
+
+[src/const_pi.c] Removed useless assignment.
+------------------------------------------------------------------------
+r7663 | zimmerma | 2011-05-04 21:58:12 +0000 (Wed, 04 May 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[mpfr-impl.h] fixed typo
+
+------------------------------------------------------------------------
+r7661 | vlefevre | 2011-05-03 17:26:31 +0000 (Tue, 03 May 2011) | 5 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mul.c
+
+[src/mpfr-impl.h] In MPFR_RNDRAW_GEN, do not try to compute the
+ sticky bit when not necessary (directed mode with rb = 1).
+[src/mul.c] FIXME comment: with the change in MPFR_RNDRAW_GEN,
+ uninitialized data are no longer read; there's still something
+ wrong, at least with the code documentation, though.
+------------------------------------------------------------------------
+r7660 | vlefevre | 2011-05-03 13:59:19 +0000 (Tue, 03 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mul.c
+
+[src/mul.c] Updated the FIXME comment.
+------------------------------------------------------------------------
+r7659 | vlefevre | 2011-05-03 13:51:52 +0000 (Tue, 03 May 2011) | 6 lines
+Changed paths:
+ M /trunk/src/mul.c
+ M /trunk/tests/tmul.c
+
+Bug in mpfr_mul: a call mpfr_mulhigh_n(pointers..., n) where n is some
+size is done, but the mpfr_mul code assumes a result whose size can be
+arbitrarily larger, thus may depend on uninitialised data.
+ * [src/mul.c] Added a FIXME comment.
+ * [tests/tmul.c] Added a corresponding test. The result is not checked
+ but valgrind complains of the use of uninitialised value(s).
+------------------------------------------------------------------------
+r7658 | vlefevre | 2011-05-03 13:17:04 +0000 (Tue, 03 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] MPFR_RNDRAW_GEN: added other missing parentheses.
+------------------------------------------------------------------------
+r7657 | vlefevre | 2011-05-03 13:14:25 +0000 (Tue, 03 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] MPFR_RNDRAW_GEN: added missing parentheses.
+------------------------------------------------------------------------
+r7656 | vlefevre | 2011-05-03 12:38:50 +0000 (Tue, 03 May 2011) | 3 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Logging: do not take into account the Ziv loops due
+to logging (i.e. used by the MPFR functions called by the mpfr_fprintf
+in LOG_PRINT).
+------------------------------------------------------------------------
+r7655 | vlefevre | 2011-05-03 12:23:23 +0000 (Tue, 03 May 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Avoid recursive logging for MPFR_ZIV_* macros too,
+and fixed type for the output of the precision.
+------------------------------------------------------------------------
+r7654 | vlefevre | 2011-05-03 11:11:47 +0000 (Tue, 03 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Avoid recursive logging (not wanted and freezes MPFR).
+------------------------------------------------------------------------
+r7652 | vlefevre | 2011-05-03 07:34:04 +0000 (Tue, 03 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Improved the comment added in r7651.
+------------------------------------------------------------------------
+r7651 | vlefevre | 2011-05-02 13:46:38 +0000 (Mon, 02 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Fixed the buffer overflow (bug 12553).
+------------------------------------------------------------------------
+r7650 | vlefevre | 2011-05-02 13:26:29 +0000 (Mon, 02 May 2011) | 4 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Added an assertion to avoid a buffer overflow
+(mpn_add_1 and mpn_sub_1 don't support size = 0). It sometimes
+fails, and this is the following bug:
+https://gforge.inria.fr/tracker/index.php?func=detail&aid=12553&group_id=136&atid=619
+------------------------------------------------------------------------
+r7649 | vlefevre | 2011-05-02 13:01:30 +0000 (Mon, 02 May 2011) | 2 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Added a comment about a buffer overflow. Bug report:
+https://gforge.inria.fr/tracker/index.php?func=detail&aid=12553&group_id=136&atid=619
+------------------------------------------------------------------------
+r7648 | vlefevre | 2011-05-02 10:49:33 +0000 (Mon, 02 May 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tvalist.c
+
+[tests/tvalist.c] Make sure that fct is used (avoid a warning).
+------------------------------------------------------------------------
+r7647 | vlefevre | 2011-05-02 10:36:08 +0000 (Mon, 02 May 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+[tests/tsin_cos.c] status_f and status were not read (compared) in
+coverage_01032011, yielding a warning.
+------------------------------------------------------------------------
+r7646 | vlefevre | 2011-05-02 10:34:06 +0000 (Mon, 02 May 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Avoid a spurious warning with some use of MPFR_BLOCK.
+------------------------------------------------------------------------
+r7645 | vlefevre | 2011-05-02 10:13:17 +0000 (Mon, 02 May 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added command to test with valgrind.
+------------------------------------------------------------------------
+r7644 | vlefevre | 2011-05-01 01:45:29 +0000 (Sun, 01 May 2011) | 6 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.ac
+
+Added "make dist" support for -dev MPFR versions by distributing the
+tests/data files in the tarball for such MPFR versions ("make check"
+fails if some data file couldn't be read for such versions).
+ * configure.ac: add a Makefile variable DATAFILES, which contains the
+ list of the tests/data files if the MPFR version ends with "-dev".
+ * Makefile.am: add $(DATAFILES) to EXTRA_DIST.
+------------------------------------------------------------------------
+r7640 | vlefevre | 2011-04-29 11:33:48 +0000 (Fri, 29 Apr 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/trint.c
+
+[tests/trint.c] Removed a useless pointer cast (in general, such casts
+are either useless or incorrect, as breaking aliasing rules).
+------------------------------------------------------------------------
+r7636 | vlefevre | 2011-04-28 12:54:20 +0000 (Thu, 28 Apr 2011) | 1 line
+Changed paths:
+ M /trunk/src/cmp2.c
+
+[src/cmp2.c] Added an assertion.
+------------------------------------------------------------------------
+r7634 | vlefevre | 2011-04-18 14:53:03 +0000 (Mon, 18 Apr 2011) | 5 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Correction of problems triggering the warning
+ "warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body"
+with autoconf 2.68:
+* Fixed missing quoting in an AC_RUN_IFELSE.
+* Added an AC_LANG_SOURCE in another AC_RUN_IFELSE.
+------------------------------------------------------------------------
+r7633 | vlefevre | 2011-04-18 12:11:10 +0000 (Mon, 18 Apr 2011) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] s/can not/cannot/
+------------------------------------------------------------------------
+r7632 | vlefevre | 2011-04-18 12:09:25 +0000 (Mon, 18 Apr 2011) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Added comment about the warning:
+ warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
+------------------------------------------------------------------------
+r7631 | vlefevre | 2011-04-15 12:35:11 +0000 (Fri, 15 Apr 2011) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Use conventional quotes.
+------------------------------------------------------------------------
+r7630 | vlefevre | 2011-04-15 12:15:16 +0000 (Fri, 15 Apr 2011) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Added a comment.
+------------------------------------------------------------------------
+r7625 | vlefevre | 2011-04-12 08:17:39 +0000 (Tue, 12 Apr 2011) | 3 lines
+Changed paths:
+ M /trunk/src/asin.c
+ M /trunk/tests/tasin.c
+
+[src/asin.c] Fixed bug in mpfr_asin for x = 1 or -1 in extremely reduced
+ exponent range (when pi is not representable, but pi/2 is).
+[tests/tasin.c] Added testcase.
+------------------------------------------------------------------------
+r7624 | vlefevre | 2011-04-08 15:32:40 +0000 (Fri, 08 Apr 2011) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] Removed "allow generic tests to run with a restricted
+exponent range" (this was done in r7470).
+------------------------------------------------------------------------
+r7623 | zimmerma | 2011-04-08 13:18:37 +0000 (Fri, 08 Apr 2011) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added item
+
+------------------------------------------------------------------------
+r7621 | vlefevre | 2011-04-05 08:47:39 +0000 (Tue, 05 Apr 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7620 | vlefevre | 2011-04-05 08:45:37 +0000 (Tue, 05 Apr 2011) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/doc/mpfr.texi
+
+[INSTALL,doc/mpfr.texi] Say that mpfr@loria.fr is the MPFR mailing-list.
+------------------------------------------------------------------------
+r7611 | vlefevre | 2011-04-01 14:28:45 +0000 (Fri, 01 Apr 2011) | 4 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Removed the -Wno-format GCC option, which was added
+when logging was used, as it is no longer needed after the changes
+done in r7575,7578 (mpfr_fprintf is now used for logging instead of
+fprintf with the Glibc register_printf_function extension).
+------------------------------------------------------------------------
+r7607 | vlefevre | 2011-03-29 11:49:11 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/reuse.c
+
+[tests/reuse.c] Added a comment.
+------------------------------------------------------------------------
+r7606 | vlefevre | 2011-03-29 11:45:40 +0000 (Tue, 29 Mar 2011) | 4 lines
+Changed paths:
+ M /trunk/src/pow.c
+
+[src/pow.c] Fixed a bug in mpfr_pow_general when an argument is reused
+(e.g. mpfr_pow(x,x,y,rnd) or mpfr_pow(y,x,y,rnd)) and the result is
+negative, thus when x is negative and y is a huge odd integer ("huge"
+because not-too-large integers are currently handled by mpfr_pow_z).
+------------------------------------------------------------------------
+r7605 | vlefevre | 2011-03-29 11:36:49 +0000 (Tue, 29 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+[tests/reuse.c] Added a mpfr_pow(x,x,y,rnd) test showing a failure
+when x is negative and y is a huge odd integer.
+------------------------------------------------------------------------
+r7604 | vlefevre | 2011-03-29 11:10:29 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/subnormal.c
+
+[src/subnormal.c] Improved a comment.
+------------------------------------------------------------------------
+r7603 | vlefevre | 2011-03-29 11:01:33 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/reuse.c
+
+[tests/reuse.c] Test also negative numbers.
+------------------------------------------------------------------------
+r7602 | vlefevre | 2011-03-29 10:52:35 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/reuse.c
+
+[tests/reuse.c] GNU coding style.
+------------------------------------------------------------------------
+r7601 | vlefevre | 2011-03-29 10:27:45 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/mul.c
+
+[src/mul.c] Updated a comment.
+------------------------------------------------------------------------
+r7600 | vlefevre | 2011-03-29 10:20:58 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/powerof2.c
+
+[src/powerof2.c] Updated comment.
+------------------------------------------------------------------------
+r7599 | vlefevre | 2011-03-29 09:30:11 +0000 (Tue, 29 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/powerof2.c
+
+[src/powerof2.c] More detailed comment.
+------------------------------------------------------------------------
+r7595 | zimmerma | 2011-03-21 10:52:35 +0000 (Mon, 21 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/cfarm.sh
+
+[cfarm.sh] complete tests with mpfr-3.0.1-rc1
+
+------------------------------------------------------------------------
+r7592 | vlefevre | 2011-03-21 02:43:09 +0000 (Mon, 21 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/pow_z.c
+
+[src/pow_z.c] Fixed bug bug20110320, that occurs in extremely reduced
+exponent range (more precisely, if 1 is out of range, i.e. emin > 1).
+------------------------------------------------------------------------
+r7591 | vlefevre | 2011-03-21 02:32:07 +0000 (Mon, 21 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+[tests/tpow.c] Added testcase bug20110320.
+------------------------------------------------------------------------
+r7590 | vlefevre | 2011-03-21 02:13:16 +0000 (Mon, 21 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Added debug information.
+------------------------------------------------------------------------
+r7589 | zimmerma | 2011-03-20 19:24:24 +0000 (Sun, 20 Mar 2011) | 2 lines
+Changed paths:
+ A /trunk/tools/cfarm.sh
+
+[cfarm.sh] shell script to test MPFR on the GCC Compile Farm
+
+------------------------------------------------------------------------
+r7587 | zimmerma | 2011-03-18 12:30:22 +0000 (Fri, 18 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/digamma.c
+
+[digamma.c] fixed compiler warning (ISO C90 forbids mixed declarations and code)
+
+------------------------------------------------------------------------
+r7581 | vlefevre | 2011-03-17 15:44:58 +0000 (Thu, 17 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Added a note about the fix in the mpfr_subnormalize
+implementation, in case users would think the old behavior
+was chosen on purpose.
+------------------------------------------------------------------------
+r7578 | vlefevre | 2011-03-17 09:30:32 +0000 (Thu, 17 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/div_ui.c
+
+Completed r7575 (Get rid of deprecated register_printf_function
+function in logging system): there was a remaining old MPFR_LOG_FUNC
+in "src/div_ui.c". Now, the MPFR source no longer contains '%#R'.
+------------------------------------------------------------------------
+r7577 | vlefevre | 2011-03-17 08:45:21 +0000 (Thu, 17 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/mul_2si.c
+
+[src/mul_2si.c] Removed trailing whitespace.
+------------------------------------------------------------------------
+r7576 | vlefevre | 2011-03-17 08:43:54 +0000 (Thu, 17 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Fixed variable name from r7575.
+------------------------------------------------------------------------
+r7575 | thevenyp | 2011-03-17 06:30:11 +0000 (Thu, 17 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+ M /trunk/src/acos.c
+ M /trunk/src/acosh.c
+ M /trunk/src/add.c
+ M /trunk/src/add_d.c
+ M /trunk/src/add_ui.c
+ M /trunk/src/agm.c
+ M /trunk/src/ai.c
+ M /trunk/src/asin.c
+ M /trunk/src/asinh.c
+ M /trunk/src/atan.c
+ M /trunk/src/atan2.c
+ M /trunk/src/atanh.c
+ M /trunk/src/cbrt.c
+ M /trunk/src/const_catalan.c
+ M /trunk/src/const_log2.c
+ M /trunk/src/const_pi.c
+ M /trunk/src/cos.c
+ M /trunk/src/cosh.c
+ M /trunk/src/d_div.c
+ M /trunk/src/d_sub.c
+ M /trunk/src/digamma.c
+ M /trunk/src/div.c
+ M /trunk/src/div_2si.c
+ M /trunk/src/div_2ui.c
+ M /trunk/src/div_d.c
+ M /trunk/src/div_ui.c
+ M /trunk/src/eint.c
+ M /trunk/src/erf.c
+ M /trunk/src/erfc.c
+ M /trunk/src/exp.c
+ M /trunk/src/exp2.c
+ M /trunk/src/exp3.c
+ M /trunk/src/exp_2.c
+ M /trunk/src/expm1.c
+ M /trunk/src/fma.c
+ M /trunk/src/fms.c
+ M /trunk/src/gamma.c
+ M /trunk/src/hypot.c
+ M /trunk/src/jn.c
+ M /trunk/src/li2.c
+ M /trunk/src/lngamma.c
+ M /trunk/src/log.c
+ M /trunk/src/log10.c
+ M /trunk/src/log1p.c
+ M /trunk/src/log2.c
+ M /trunk/src/logging.c
+ M /trunk/src/modf.c
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mul.c
+ M /trunk/src/mul_2si.c
+ M /trunk/src/mul_2ui.c
+ M /trunk/src/mul_d.c
+ M /trunk/src/pow.c
+ M /trunk/src/pow_si.c
+ M /trunk/src/pow_ui.c
+ M /trunk/src/pow_z.c
+ M /trunk/src/rec_sqrt.c
+ M /trunk/src/root.c
+ M /trunk/src/sin.c
+ M /trunk/src/sin_cos.c
+ M /trunk/src/sinh.c
+ M /trunk/src/sinh_cosh.c
+ M /trunk/src/sqr.c
+ M /trunk/src/sqrt.c
+ M /trunk/src/sub.c
+ M /trunk/src/sub_d.c
+ M /trunk/src/sub_ui.c
+ M /trunk/src/tan.c
+ M /trunk/src/tanh.c
+ M /trunk/src/ui_div.c
+ M /trunk/src/ui_sub.c
+ M /trunk/src/yn.c
+ M /trunk/src/zeta.c
+
+Get rid of deprecated register_printf_function function in logging system.
+------------------------------------------------------------------------
+r7573 | vlefevre | 2011-03-15 15:15:22 +0000 (Tue, 15 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/erfc.c
+
+[src/erfc.c] Fixed a problem (incorrect flags or possible crash) in
+extremely reduced exponent range. Support the case where mpfr_prec_t
+is larger than a long.
+------------------------------------------------------------------------
+r7572 | vlefevre | 2011-03-15 15:10:40 +0000 (Tue, 15 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+[tests/terf.c] Added some tests of the flags (no failure in them,
+thanks to the mpfr_cmp_si (x, -27282) in erfc.c, for 1b).
+------------------------------------------------------------------------
+r7571 | vlefevre | 2011-03-15 11:23:25 +0000 (Tue, 15 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] In failure messages, output the name of the
+tested function. This is useful for programs that have generic
+tests for several functions, such as terf.
+------------------------------------------------------------------------
+r7570 | vlefevre | 2011-03-15 10:01:59 +0000 (Tue, 15 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+[tests/terf.c] Added a testcase showing a failure due to bad flags
+in a reduced exponent range.
+------------------------------------------------------------------------
+r7568 | vlefevre | 2011-03-14 09:44:21 +0000 (Mon, 14 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/terf.c
+
+[tests/terf.c] Changed mp_exp_t (r7564) to mpfr_exp_t.
+------------------------------------------------------------------------
+r7567 | vlefevre | 2011-03-11 15:45:48 +0000 (Fri, 11 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/erfc.c
+
+[src/erfc.c] Added an assertion for future platforms (e.g. with 128-bit
+exponent type).
+------------------------------------------------------------------------
+r7566 | vlefevre | 2011-03-11 15:37:07 +0000 (Fri, 11 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/erfc.c
+
+[src/erfc.c] Fixed r7564 (comparison must really be signed).
+------------------------------------------------------------------------
+r7565 | vlefevre | 2011-03-11 15:23:59 +0000 (Fri, 11 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/terf.c
+
+[tests/terf.c] Fixed test added in r7564 for 32-bit machines.
+------------------------------------------------------------------------
+r7564 | zimmerma | 2011-03-11 15:09:06 +0000 (Fri, 11 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/erfc.c
+ M /trunk/tests/terf.c
+
+[erfc.c] fixed bug found by Pascal Molin: when we increase the exponent range
+ on 64-bit machines, erfc() wrongly underflows for x >= 27282
+
+------------------------------------------------------------------------
+r7561 | vlefevre | 2011-03-10 14:48:28 +0000 (Thu, 10 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Fixed the MPFR_FAST_COMPUTE_IF_SMALL_INPUT test for n == 1
+in underflow cases.
+------------------------------------------------------------------------
+r7560 | vlefevre | 2011-03-10 13:46:23 +0000 (Thu, 10 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] No need for mpfr_clear_flags (already done in MPFR_BLOCK).
+------------------------------------------------------------------------
+r7559 | vlefevre | 2011-03-10 13:44:47 +0000 (Thu, 10 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Check that no intermediate underflow or overflow occurs.
+------------------------------------------------------------------------
+r7558 | vlefevre | 2011-03-10 13:30:33 +0000 (Thu, 10 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/algorithms.tex
+
+[doc/algorithms.tex] For the Bessel function, say that the algorithm
+assumes that no underflows/overflows occur.
+------------------------------------------------------------------------
+r7556 | vlefevre | 2011-03-09 15:54:42 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/gamma.c
+
+[src/gamma.c] More robust code (for the change in r7551).
+------------------------------------------------------------------------
+r7555 | vlefevre | 2011-03-09 15:52:33 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tsin_cos.c
+
+Removed trailing spaces.
+------------------------------------------------------------------------
+r7553 | vlefevre | 2011-03-09 15:38:58 +0000 (Wed, 09 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Added feature for MPFR_SUSPICIOUS_OVERFLOW to avoid
+spurious failures by defining TGENERIC_SO_TEST to some well-chosen test.
+------------------------------------------------------------------------
+r7552 | vlefevre | 2011-03-09 15:35:17 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Added a comment about MPFR_SUSPICIOUS_OVERFLOW.
+------------------------------------------------------------------------
+r7551 | vlefevre | 2011-03-09 15:30:46 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/gamma.c
+
+[src/gamma.c] Fixed the special code for tiny values.
+------------------------------------------------------------------------
+r7550 | vlefevre | 2011-03-09 15:29:44 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Corrected a test and added other tests for tiny x > 0.
+------------------------------------------------------------------------
+r7549 | vlefevre | 2011-03-09 14:57:05 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Updated a comment.
+------------------------------------------------------------------------
+r7548 | vlefevre | 2011-03-09 14:07:54 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Restore emax.
+------------------------------------------------------------------------
+r7547 | vlefevre | 2011-03-09 14:03:40 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Do not initialize x twice.
+------------------------------------------------------------------------
+r7546 | vlefevre | 2011-03-09 13:44:02 +0000 (Wed, 09 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Do not run the same test twice if emin = MPFR_EMIN_MIN.
+------------------------------------------------------------------------
+r7545 | vlefevre | 2011-03-09 13:41:51 +0000 (Wed, 09 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Added tests for tiny values, showing bugs in special
+code for such values. Run tgamma with at least an argument to get all
+the failures.
+------------------------------------------------------------------------
+r7542 | vlefevre | 2011-03-07 15:17:24 +0000 (Mon, 07 Mar 2011) | 8 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Fixed mpfr_jn_k0() internal function:
+ * The prototype was incorrect: one needs "unsigned long" for n
+ (actually absn), in case absn is equal to - LONG_MIN.
+ * The formula and the code were incorrect for n = 0, due to the
+ division by n; it was yielding k0 = ULONG_MAX. The case n = 0
+ is now handled separately.
+ * Small optimization: division by log(2) -> multiplication by
+ 1/log(2).
+------------------------------------------------------------------------
+r7541 | vlefevre | 2011-03-07 14:07:47 +0000 (Mon, 07 Mar 2011) | 4 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Avoid integer overflow in the computation of the initial
+working precision. This makes several tests fail, but logging shows
+that previous non-failure was due to undefined behavior due to huge
+k0 computed by mpfr_jn_k0.
+------------------------------------------------------------------------
+r7539 | vlefevre | 2011-03-07 13:03:30 +0000 (Mon, 07 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Added a comment for mpfrlint.
+------------------------------------------------------------------------
+r7538 | vlefevre | 2011-03-07 13:01:36 +0000 (Mon, 07 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Change of r7515: any mpfr_clear_* can be mentioned.
+------------------------------------------------------------------------
+r7537 | vlefevre | 2011-03-07 11:08:08 +0000 (Mon, 07 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Added comments and fixed a bug.
+------------------------------------------------------------------------
+r7536 | vlefevre | 2011-03-07 10:57:44 +0000 (Mon, 07 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Detect incorrect error analysis (that may have been the goal
+of the assertion corrected in r7534, but this wasn't documented). Added
+a FIXME comment.
+------------------------------------------------------------------------
+r7534 | vlefevre | 2011-03-07 10:40:24 +0000 (Mon, 07 Mar 2011) | 5 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Fixed incorrect assertion. It could occur only
+in precision >= 2^(1+s/2), where s is the bitsize of a
+"long", e.g. p >= 2^17 = 131072 on most 32-bit machines and
+p >= 2^33 = 8,589,934,592 on most 64-bit machines. Only some
+arguments are affected (|z| between around 2^(s/2) and p/2).
+------------------------------------------------------------------------
+r7533 | vlefevre | 2011-03-07 10:13:34 +0000 (Mon, 07 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] Added a comment.
+------------------------------------------------------------------------
+r7532 | vlefevre | 2011-03-07 10:07:44 +0000 (Mon, 07 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Corrected a typo.
+------------------------------------------------------------------------
+r7530 | vlefevre | 2011-03-06 10:03:21 +0000 (Sun, 06 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Improved underflow detection. Still not complete, though.
+------------------------------------------------------------------------
+r7529 | vlefevre | 2011-03-06 09:51:13 +0000 (Sun, 06 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Comments: English usage.
+------------------------------------------------------------------------
+r7528 | vlefevre | 2011-03-05 00:19:31 +0000 (Sat, 05 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/trint.c
+
+[tests/trint.c] mantissa -> significand (standard and correct term).
+------------------------------------------------------------------------
+r7527 | vlefevre | 2011-03-05 00:17:45 +0000 (Sat, 05 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/trint.c
+
+[tests/trint.c] Do not use snprintf (C99).
+------------------------------------------------------------------------
+r7526 | vlefevre | 2011-03-04 23:20:51 +0000 (Fri, 04 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Added a test to check that the snprintf function (C99)
+is not used.
+------------------------------------------------------------------------
+r7525 | demengeo | 2011-03-04 17:57:53 +0000 (Fri, 04 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/trint.c
+
+Previous extented coverage test in trint.c now self generate tests in and compare values
+------------------------------------------------------------------------
+r7524 | demengeo | 2011-03-04 14:14:13 +0000 (Fri, 04 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/trint.c
+
+Extend test coverage of mpfr_rint to 100%
+------------------------------------------------------------------------
+r7523 | zimmerma | 2011-03-03 19:27:37 +0000 (Thu, 03 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/add1sp.c
+
+[src/add1sp.c] same as previous commits
+
+------------------------------------------------------------------------
+r7522 | zimmerma | 2011-03-03 19:26:07 +0000 (Thu, 03 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/sub1sp.c
+
+[src/sub1sp.c] ibidem (see previous commit log)
+
+------------------------------------------------------------------------
+r7521 | zimmerma | 2011-03-03 19:24:25 +0000 (Thu, 03 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/add1.c
+
+[add1.c] ibidem (see previous commit log)
+
+------------------------------------------------------------------------
+r7520 | vlefevre | 2011-03-03 18:54:10 +0000 (Thu, 03 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/add.c
+ M /trunk/src/sub.c
+
+[src/add.c,src/sub.c] Split assertions for C90 compilers, to avoid
+too long strings generated by #expr. Problem seen with:
+ gcc -ansi -pedantic-errors
+------------------------------------------------------------------------
+r7518 | vlefevre | 2011-03-03 16:18:16 +0000 (Thu, 03 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/yn.c
+
+[src/yn.c] Minor change.
+------------------------------------------------------------------------
+r7517 | vlefevre | 2011-03-03 16:17:36 +0000 (Thu, 03 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/yn.c
+
+[src/yn.c] Extend the exponent range (code not checked concerning
+internal exceptions, such as overflows, underflows and divby0).
+------------------------------------------------------------------------
+r7516 | vlefevre | 2011-03-03 15:41:28 +0000 (Thu, 03 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Added comments (for mpfrlint, in particular).
+------------------------------------------------------------------------
+r7515 | vlefevre | 2011-03-03 15:40:58 +0000 (Thu, 03 Mar 2011) | 4 lines
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] The use of mpfr_overflow_p, etc. is allowed if
+mpfr_clear_flags is mentioned (useful for checking purpose at the
+end of a function, but this needs an explicit mpfr_clear_flags;
+otherwise MPFR_BLOCK should still be used).
+------------------------------------------------------------------------
+r7514 | vlefevre | 2011-03-03 15:29:10 +0000 (Thu, 03 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Completed scaling to avoid intermediate overflow/underflow.
+------------------------------------------------------------------------
+r7513 | vlefevre | 2011-03-03 12:09:34 +0000 (Thu, 03 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Bug fix in error computation: in Ziv's iteration, err kept
+its value from the previous iteration instead of being reset to 0.
+Consequence: a possible loss of performance in rare cases.
+------------------------------------------------------------------------
+r7512 | vlefevre | 2011-03-03 11:30:29 +0000 (Thu, 03 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/cmp2.c
+
+[src/cmp2.c] Removed a useless assertion and updated comments.
+------------------------------------------------------------------------
+r7511 | vlefevre | 2011-03-02 14:05:39 +0000 (Wed, 02 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Added a FIXME comment.
+------------------------------------------------------------------------
+r7510 | vlefevre | 2011-03-02 13:58:05 +0000 (Wed, 02 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Updated exception checking (more informative).
+------------------------------------------------------------------------
+r7509 | vlefevre | 2011-03-02 13:54:18 +0000 (Wed, 02 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Check internal exceptions: the error analysis may be
+incorrect in case of exception.
+------------------------------------------------------------------------
+r7508 | vlefevre | 2011-03-02 13:41:36 +0000 (Wed, 02 Mar 2011) | 2 lines
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Implemented scaling to avoid intermediate overflow/underflow
+(but the tagm test still fails, due to a rounding error this time).
+------------------------------------------------------------------------
+r7507 | vlefevre | 2011-03-02 10:03:40 +0000 (Wed, 02 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tagm.c
+
+[tests/tagm.c] Added tests triggering intermediate underflow/overflow.
+------------------------------------------------------------------------
+r7506 | vlefevre | 2011-03-02 09:15:24 +0000 (Wed, 02 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tagm.c
+
+[tests/tagm.c] Also test the ternary value and the flags.
+------------------------------------------------------------------------
+r7505 | vlefevre | 2011-03-02 08:57:31 +0000 (Wed, 02 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tagm.c
+
+[tests/tagm.c] Corrected values (using Pari).
+------------------------------------------------------------------------
+r7504 | vlefevre | 2011-03-02 08:36:00 +0000 (Wed, 02 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/agm.c
+
+[src/agm.c] Extend the exponent range. This doesn't make the algorithm
+correct yet, as intermediate underflow or overflow is still possible in
+the first multiplication.
+------------------------------------------------------------------------
+r7503 | demengeo | 2011-03-01 18:10:07 +0000 (Tue, 01 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+Change some functions called in test tsin_cos.c
+------------------------------------------------------------------------
+r7502 | demengeo | 2011-03-01 17:08:11 +0000 (Tue, 01 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+Extend coverage test of mpfr_sincos_fast to 100%
+------------------------------------------------------------------------
+r7501 | demengeo | 2011-03-01 15:47:36 +0000 (Tue, 01 Mar 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tstckintc.c
+
+Extend coverage test of mpfr_custom_get_kind to 100%
+------------------------------------------------------------------------
+r7500 | vlefevre | 2011-02-25 16:39:22 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Fix: support reduced exponent ranges for small inputs.
+------------------------------------------------------------------------
+r7499 | vlefevre | 2011-02-25 16:23:48 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/gamma.c
+
+[src/gamma.c] Added a comment about an overflow case.
+------------------------------------------------------------------------
+r7498 | vlefevre | 2011-02-25 16:20:41 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Added tests in maximum exponent range.
+------------------------------------------------------------------------
+r7497 | vlefevre | 2011-02-25 16:15:10 +0000 (Fri, 25 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/src/gamma.c
+
+[src/gamma.c] Fixed flags when x if very small (protect from
+intermediate overflow).
+------------------------------------------------------------------------
+r7496 | vlefevre | 2011-02-25 16:08:03 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Corrected test number.
+------------------------------------------------------------------------
+r7495 | vlefevre | 2011-02-25 16:07:17 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Added a test in maximum exponent range.
+------------------------------------------------------------------------
+r7494 | vlefevre | 2011-02-25 16:02:48 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/gamma.c
+
+[src/gamma.c] Fixed inexact flag when x if very small.
+------------------------------------------------------------------------
+r7493 | vlefevre | 2011-02-25 16:02:04 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Added tests.
+------------------------------------------------------------------------
+r7492 | vlefevre | 2011-02-25 15:17:44 +0000 (Fri, 25 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/src/gamma.c
+ M /trunk/tests/tgamma.c
+
+[src/gamma.c] Fixed a bug occurring in reduced exponent range.
+[tests/tgamma.c] Added corresponding testcase.
+------------------------------------------------------------------------
+r7491 | vlefevre | 2011-02-25 14:50:37 +0000 (Fri, 25 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/src/lngamma.c
+
+[src/lngamma.c] Do not use MPFR_EXP after a mpfr_clear (even though
+this currently work).
+------------------------------------------------------------------------
+r7490 | vlefevre | 2011-02-25 14:23:20 +0000 (Fri, 25 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/src/rem1.c
+
+[src/rem1.c] Fixed mpfr_rem1 in reduced exponent range (the function
+is actually simplified).
+------------------------------------------------------------------------
+r7487 | zimmerma | 2011-02-25 07:49:00 +0000 (Fri, 25 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added an item
+
+------------------------------------------------------------------------
+r7486 | vlefevre | 2011-02-25 02:45:40 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/div_2si.c
+ M /trunk/src/div_2ui.c
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mul_2si.c
+
+Fixed mpfr_div_2si, mpfr_div_2ui and mpfr_mul_2si in some corner cases.
+------------------------------------------------------------------------
+r7485 | vlefevre | 2011-02-25 02:38:25 +0000 (Fri, 25 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+[tests/tmul_2exp.c] Small correction in output (in case of failure).
+------------------------------------------------------------------------
+r7484 | vlefevre | 2011-02-21 23:41:20 +0000 (Mon, 21 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tset_q.c
+
+[tests/tset_q.c] Corrections in function prototypes.
+------------------------------------------------------------------------
+r7483 | demengeo | 2011-02-21 16:17:14 +0000 (Mon, 21 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tgmpop.c
+
+Remove the use of mpfr_get_default_prec in some coverage test
+------------------------------------------------------------------------
+r7482 | demengeo | 2011-02-21 15:59:32 +0000 (Mon, 21 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tset_q.c
+
+Add some coverage test in tests/tset_q.c
+------------------------------------------------------------------------
+r7481 | demengeo | 2011-02-21 13:07:44 +0000 (Mon, 21 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tgmpop.c
+
+fixed coding convention of 2 tests functions
+------------------------------------------------------------------------
+r7480 | zimmerma | 2011-02-19 08:18:28 +0000 (Sat, 19 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+[tget_d.c] fixed some compiler errors and warnings
+
+------------------------------------------------------------------------
+r7479 | vlefevre | 2011-02-18 15:27:22 +0000 (Fri, 18 Feb 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+[tests/tversion.c] Split a printf into several ones to reduce the
+string length below the 509-byte limit from C90 (useful to avoid
+an error when testing with gcc -ansi -pedantic-errors).
+------------------------------------------------------------------------
+r7478 | demengeo | 2011-02-18 15:13:38 +0000 (Fri, 18 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+Extend test coverage to 100% on mpfr_z_sub and mpfr_mul_q function
+------------------------------------------------------------------------
+r7477 | demengeo | 2011-02-18 14:53:44 +0000 (Fri, 18 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+Extend test coverage on mpfr_get_d_2exp function
+------------------------------------------------------------------------
+r7476 | vlefevre | 2011-02-18 11:43:30 +0000 (Fri, 18 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+[tests/tmul_2exp.c] Also test mpfr_div_2si and mpfr_div_2ui (same bug).
+------------------------------------------------------------------------
+r7475 | vlefevre | 2011-02-18 11:37:39 +0000 (Fri, 18 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+[tests/tmul_2exp.c] Added a testcase showing a bug in mpfr_mul_2si
+(possible intermediate overflow).
+------------------------------------------------------------------------
+r7474 | vlefevre | 2011-02-18 10:29:13 +0000 (Fri, 18 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/src/zeta.c
+
+[src/zeta.c] Support zeta(eps) with |eps| very small or 0
+in extremely reduced exponent range.
+------------------------------------------------------------------------
+r7473 | vlefevre | 2011-02-18 09:54:09 +0000 (Fri, 18 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/src/atan2.c
+
+[src/atan2.c] Fix: the overflow or underflow flag was set in the case
+x = power of two and y/x overflows or underflows.
+------------------------------------------------------------------------
+r7472 | vlefevre | 2011-02-18 09:48:15 +0000 (Fri, 18 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/atan2.c
+
+[src/atan2.c] Support special cases in extremely reduced exponent range.
+------------------------------------------------------------------------
+r7471 | vlefevre | 2011-02-18 09:17:14 +0000 (Fri, 18 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/acos.c
+
+[src/acos.c] Support acos(0) in extremely reduced exponent range.
+------------------------------------------------------------------------
+r7470 | vlefevre | 2011-02-17 13:44:57 +0000 (Thu, 17 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Added generic tests in a reduced exponent range.
+This currently makes 10 tests fail on a 64-bit machine.
+------------------------------------------------------------------------
+r7469 | vlefevre | 2011-02-17 13:43:31 +0000 (Thu, 17 Feb 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+
+[tests/mpfr-test.h] Defined a SAME_VAL(X,Y) macro to test whether two
+floating-point data have the same value, seen as an element of the set
+of the floating-point data (Level 2 in the IEEE 754-2008 standard).
+------------------------------------------------------------------------
+r7468 | vlefevre | 2011-02-17 13:41:12 +0000 (Thu, 17 Feb 2011) | 3 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Defined a MPFR_EXP_FSPEC macro containing the
+format specifier for mpfr_eexp_t, to output an exponent with:
+ printf ("%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) exponent);
+------------------------------------------------------------------------
+r7467 | vlefevre | 2011-02-17 12:01:57 +0000 (Thu, 17 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Reformat.
+------------------------------------------------------------------------
+r7465 | vlefevre | 2011-02-17 11:33:30 +0000 (Thu, 17 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added a warning about whitespace in the mpfr.texi file.
+------------------------------------------------------------------------
+r7463 | vlefevre | 2011-02-17 11:10:58 +0000 (Thu, 17 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Fixed spacing for the mpfr.info file.
+------------------------------------------------------------------------
+r7460 | vlefevre | 2011-02-10 01:31:16 +0000 (Thu, 10 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Detect the use of mp_ptr and mp_srcptr.
+------------------------------------------------------------------------
+r7459 | vlefevre | 2011-02-10 01:26:13 +0000 (Thu, 10 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7458 | vlefevre | 2011-02-10 01:25:00 +0000 (Thu, 10 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/gmp_op.c
+
+[src/gmp_op.c] Added a blank line.
+------------------------------------------------------------------------
+r7457 | demengeo | 2011-02-09 17:34:50 +0000 (Wed, 09 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/TODO
+ M /trunk/doc/mpfr.texi
+ M /trunk/src/gmp_op.c
+ M /trunk/src/mpfr.h
+ M /trunk/tests/tgmpop.c
+
+Added mpfr_z_sub (function/test/doc)
+------------------------------------------------------------------------
+r7455 | vlefevre | 2011-02-09 14:15:10 +0000 (Wed, 09 Feb 2011) | 3 lines
+Changed paths:
+ M /trunk/src/div.c
+ M /trunk/src/eq.c
+ M /trunk/src/init2.c
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mulders.c
+ M /trunk/src/rec_sqrt.c
+ M /trunk/src/round_prec.c
+ M /trunk/src/set_d.c
+ M /trunk/src/set_prec.c
+ M /trunk/src/sqrt.c
+ M /trunk/src/urandom.c
+ M /trunk/src/urandomb.c
+ M /trunk/src/vasprintf.c
+ M /trunk/tests/random2.c
+ M /trunk/tune/speed.c
+ M /trunk/tune/tuneup.c
+
+Added new types mpfr_limb_ptr and mpfr_limb_srcptr to src/mpfr-impl.h,
+and replaced mp_ptr and mp_srcptr (GMP internals) by these 2 new types
+respectively.
+------------------------------------------------------------------------
+r7453 | vlefevre | 2011-02-08 11:43:39 +0000 (Tue, 08 Feb 2011) | 3 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Fix for Intel's compiler (ICC) under MS Windows:
+MPFR was incorrectly assuming that ICC had some extensions like
+under GNU/Linux. This made the MPFR compilation fail.
+------------------------------------------------------------------------
+r7452 | vlefevre | 2011-02-08 02:48:01 +0000 (Tue, 08 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Corrected a typo in a comment.
+------------------------------------------------------------------------
+r7451 | vlefevre | 2011-02-05 13:37:55 +0000 (Sat, 05 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Removed incorrect note.
+------------------------------------------------------------------------
+r7450 | zimmerma | 2011-02-05 08:15:42 +0000 (Sat, 05 Feb 2011) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added hint for VS2008 and Intel compiler v11.1
+
+------------------------------------------------------------------------
+r7448 | vlefevre | 2011-02-03 09:02:05 +0000 (Thu, 03 Feb 2011) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.ac
+
+[configure.ac,Makefile.am] Clean-up and depend on GNU Automake 1.11.
+------------------------------------------------------------------------
+r7443 | vlefevre | 2011-01-31 01:53:11 +0000 (Mon, 31 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/zeta_ui.c
+ M /trunk/tests/tzeta_ui.c
+
+[src/zeta_ui.c,tests/tzeta_ui.c] Patch from Patrick Pélissier for
+the division-by-zero support in mpfr_zeta_ui (and test):
+------------------------------------------------------------------------
+r7442 | zimmerma | 2011-01-30 09:33:00 +0000 (Sun, 30 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/zeta.c
+ M /trunk/tests/tzeta.c
+
+[src/zeta.c] patch from Patrick Pelissier (problem with division by zero flag)
+
+------------------------------------------------------------------------
+r7440 | zimmerma | 2011-01-28 16:19:45 +0000 (Fri, 28 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] removed division by zero item (done)
+
+------------------------------------------------------------------------
+r7439 | zimmerma | 2011-01-28 16:18:25 +0000 (Fri, 28 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/src/get_str.c
+
+[src/get_str.c,TODO] updated comments, mpfr_get_str already supports base <= 62
+
+------------------------------------------------------------------------
+r7438 | vlefevre | 2011-01-27 17:53:35 +0000 (Thu, 27 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tj0.c
+
+[tests/tj0.c] GMP_RNDN → MPFR_RNDN.
+------------------------------------------------------------------------
+r7437 | vlefevre | 2011-01-27 17:07:48 +0000 (Thu, 27 Jan 2011) | 4 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+ M /trunk/src/subnormal.c
+ M /trunk/tests/tsubnormal.c
+
+[src/subnormal.c] Set the inexact and underflow flags when needed. Fixes
+ https://gforge.inria.fr/tracker/index.php?func=detail&aid=7958&group_id=136&atid=622
+[tests/tsubnormal.c] Improved the tests, in particular for the flags.
+[doc/mpfr.texi] Documented the change.
+------------------------------------------------------------------------
+r7436 | vlefevre | 2011-01-27 16:38:35 +0000 (Thu, 27 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Corrected order in Section "Changed Functions".
+------------------------------------------------------------------------
+r7435 | vlefevre | 2011-01-27 14:17:49 +0000 (Thu, 27 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tj0.c
+
+[tests/tj0.c] Added case for which s = 0 occurs in mpfr_jn.
+------------------------------------------------------------------------
+r7434 | vlefevre | 2011-01-27 13:54:45 +0000 (Thu, 27 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Added a log message.
+------------------------------------------------------------------------
+r7433 | vlefevre | 2011-01-27 13:47:11 +0000 (Thu, 27 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/div_ui.c
+
+[src/div_ui.c] Added logging support.
+------------------------------------------------------------------------
+r7431 | vlefevre | 2011-01-26 14:06:39 +0000 (Wed, 26 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tsum.c
+
+[tests/tsum.c] Fixed bug in test (do not set the exponent on 0).
+------------------------------------------------------------------------
+r7430 | vlefevre | 2011-01-26 13:58:44 +0000 (Wed, 26 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tsum.c
+
+[tests/tsum.c] Formatting.
+------------------------------------------------------------------------
+r7429 | vlefevre | 2011-01-26 13:58:21 +0000 (Wed, 26 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/tests/tsum.c
+
+[tests/tsum.c] Fixed get_prec_max and added some checks.
+Current failure: tab[1] is not valid.
+------------------------------------------------------------------------
+r7428 | vlefevre | 2011-01-26 13:28:10 +0000 (Wed, 26 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/sum.c
+
+[src/sum.c] Added an assertion.
+------------------------------------------------------------------------
+r7427 | vlefevre | 2011-01-26 13:12:06 +0000 (Wed, 26 Jan 2011) | 4 lines
+Changed paths:
+ M /trunk/src/check.c
+
+[src/check.c] Replaced MPFR_IS_PURE_FP by !MPFR_IS_SINGULAR, the
+former macro now has a check for validity in debug mode (r7426).
+The goal of mpfr_check is to test the validity, so that we don't
+want this check here.
+------------------------------------------------------------------------
+r7426 | vlefevre | 2011-01-26 13:05:53 +0000 (Wed, 26 Jan 2011) | 4 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] In the MPFR_IS_PURE_FP test, if positive, check that
+the number is normalized (debug mode only). This makes 2 tests fail:
+tcheck and tsum. Note: with logging active, tsum was already triggering
+an assertion failure in mpfr_get_str (via mpfr_add).
+------------------------------------------------------------------------
+r7425 | vlefevre | 2011-01-26 12:51:41 +0000 (Wed, 26 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/add.c
+
+[src/add.c] Formatting.
+------------------------------------------------------------------------
+r7423 | vlefevre | 2011-01-26 12:02:31 +0000 (Wed, 26 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/li2.c
+
+[src/li2.c] Fixed crash in mpfr_li2 when logging is used.
+------------------------------------------------------------------------
+r7421 | vlefevre | 2011-01-24 16:37:43 +0000 (Mon, 24 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Corrected a comment.
+------------------------------------------------------------------------
+r7420 | zimmerma | 2011-01-24 16:14:18 +0000 (Mon, 24 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] added notes for correctness of the algorithm used
+
+------------------------------------------------------------------------
+r7419 | vlefevre | 2011-01-24 12:41:28 +0000 (Mon, 24 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] C90 compatibility fix (empty macro arguments are undefined).
+------------------------------------------------------------------------
+r7418 | vlefevre | 2011-01-24 10:17:50 +0000 (Mon, 24 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Added an assaertion against a potential overflow (which
+probably never occurs, but this should be proved...).
+------------------------------------------------------------------------
+r7417 | zimmerma | 2011-01-24 07:21:27 +0000 (Mon, 24 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] patch from Patrick Pelissier
+
+------------------------------------------------------------------------
+r7416 | vlefevre | 2011-01-23 04:04:08 +0000 (Sun, 23 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Forgot to change an MPFR_EXP to MPFR_GET_EXP.
+------------------------------------------------------------------------
+r7415 | vlefevre | 2011-01-23 04:02:09 +0000 (Sun, 23 Jan 2011) | 3 lines
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Replaced MPFR_EXP by MPFR_GET_EXP when the value should
+really be an exponent. Removed incorrect and useless casts. Added
+an assertion to protect against potentially incorrect code.
+------------------------------------------------------------------------
+r7414 | vlefevre | 2011-01-23 03:41:39 +0000 (Sun, 23 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/jn.c
+
+[src/jn.c] Patch from Patrick Pélissier (mpfr_check_range and other).
+------------------------------------------------------------------------
+r7413 | vlefevre | 2011-01-21 14:19:35 +0000 (Fri, 21 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Update the check for mpfr_printf-like functions
+in the tests.
+------------------------------------------------------------------------
+r7412 | vlefevre | 2011-01-21 14:15:39 +0000 (Fri, 21 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+[tests/tprintf.c] Consistency.
+------------------------------------------------------------------------
+r7411 | vlefevre | 2011-01-21 13:59:12 +0000 (Fri, 21 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgrandom.c
+
+[tests/tgrandom.c] Added a comment.
+------------------------------------------------------------------------
+r7410 | vlefevre | 2011-01-21 13:54:50 +0000 (Fri, 21 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgrandom.c
+
+[tests/tgrandom.c] Protection of the mpfr_printf by #ifdef HAVE_STDARG.
+------------------------------------------------------------------------
+r7408 | vlefevre | 2011-01-20 12:13:58 +0000 (Thu, 20 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/eint.c
+
+[src/eint.c] Added a FIXME.
+------------------------------------------------------------------------
+r7406 | zimmerma | 2011-01-18 16:50:28 +0000 (Tue, 18 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/out_raw.c
+
+[src/out_raw.c] added pointer to discussion
+
+------------------------------------------------------------------------
+r7405 | vlefevre | 2011-01-17 13:11:15 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tvalist.c
+
+[tests/tvalist.c] Correction for C++ compilers.
+------------------------------------------------------------------------
+r7403 | vlefevre | 2011-01-17 04:01:56 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Added division-by-zero exception.
+------------------------------------------------------------------------
+r7402 | vlefevre | 2011-01-17 03:55:51 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Updated "To make a release".
+------------------------------------------------------------------------
+r7401 | vlefevre | 2011-01-17 03:52:41 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Update for MPFR 3.1.x.
+------------------------------------------------------------------------
+r7400 | vlefevre | 2011-01-17 03:39:24 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/grandom.c
+
+[src/grandom.c] Reformat.
+------------------------------------------------------------------------
+r7399 | vlefevre | 2011-01-17 03:36:24 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] tests/tvalist.c can use mpfr_printf-like functions.
+------------------------------------------------------------------------
+r7398 | vlefevre | 2011-01-17 03:34:40 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgrandom.c
+
+[tests/tgrandom.c] Added a FIXME: do not use mpfr_printf in the tests.
+------------------------------------------------------------------------
+r7397 | vlefevre | 2011-01-17 03:33:17 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tai.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tfrexp.c
+ M /trunk/tests/tgrandom.c
+
+[tests] Untabified and removed trailing spaces.
+------------------------------------------------------------------------
+r7396 | vlefevre | 2011-01-17 03:31:25 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/grandom.c
+ M /trunk/src/mpfr.h
+
+[src/grandom.c,src/mpfr.h] Untabified and removed trailing spaces.
+------------------------------------------------------------------------
+r7395 | vlefevre | 2011-01-17 03:29:36 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/frexp.c
+
+[src/frexp.c] Corrections.
+------------------------------------------------------------------------
+r7394 | vlefevre | 2011-01-17 03:25:50 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/out_raw.c
+
+[src/out_raw.c] Untabified.
+------------------------------------------------------------------------
+r7393 | vlefevre | 2011-01-17 03:25:07 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/out_raw.c
+
+[src/out_raw.c] Fixed some bugs on the incomplete code.
+------------------------------------------------------------------------
+r7392 | vlefevre | 2011-01-17 03:06:09 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/atan2.c
+
+[src/atan2.c] MPFR_EXP -> MPFR_GET_EXP and reformat.
+------------------------------------------------------------------------
+r7391 | vlefevre | 2011-01-17 03:05:33 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/ai.c
+
+[src/ai.c] Removed trailing spaces.
+------------------------------------------------------------------------
+r7390 | vlefevre | 2011-01-17 03:02:39 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7389 | vlefevre | 2011-01-17 03:01:30 +0000 (Mon, 17 Jan 2011) | 4 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/INSTALL
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/acinclude.m4
+ M /trunk/configure.ac
+ M /trunk/doc/FAQ.html
+ M /trunk/doc/Makefile.am
+ M /trunk/doc/faq.xsl
+ M /trunk/doc/mpfr.texi
+ M /trunk/examples/divworst.c
+ M /trunk/examples/rndo-add.c
+ M /trunk/examples/sample.c
+ M /trunk/examples/version.c
+ M /trunk/src/Makefile.am
+ M /trunk/src/abort_prec_max.c
+ M /trunk/src/acos.c
+ M /trunk/src/acosh.c
+ M /trunk/src/add.c
+ M /trunk/src/add1.c
+ M /trunk/src/add1sp.c
+ M /trunk/src/add_d.c
+ M /trunk/src/add_ui.c
+ M /trunk/src/agm.c
+ M /trunk/src/ai.c
+ M /trunk/src/asin.c
+ M /trunk/src/asinh.c
+ M /trunk/src/atan.c
+ M /trunk/src/atan2.c
+ M /trunk/src/atanh.c
+ M /trunk/src/bernoulli.c
+ M /trunk/src/buildopt.c
+ M /trunk/src/cache.c
+ M /trunk/src/cbrt.c
+ M /trunk/src/check.c
+ M /trunk/src/clear.c
+ M /trunk/src/clears.c
+ M /trunk/src/cmp.c
+ M /trunk/src/cmp2.c
+ M /trunk/src/cmp_abs.c
+ M /trunk/src/cmp_d.c
+ M /trunk/src/cmp_ld.c
+ M /trunk/src/cmp_si.c
+ M /trunk/src/cmp_ui.c
+ M /trunk/src/comparisons.c
+ M /trunk/src/const_catalan.c
+ M /trunk/src/const_euler.c
+ M /trunk/src/const_log2.c
+ M /trunk/src/const_pi.c
+ M /trunk/src/constant.c
+ M /trunk/src/copysign.c
+ M /trunk/src/cos.c
+ M /trunk/src/cosh.c
+ M /trunk/src/cot.c
+ M /trunk/src/coth.c
+ M /trunk/src/csc.c
+ M /trunk/src/csch.c
+ M /trunk/src/d_div.c
+ M /trunk/src/d_sub.c
+ M /trunk/src/digamma.c
+ M /trunk/src/dim.c
+ M /trunk/src/div.c
+ M /trunk/src/div_2exp.c
+ M /trunk/src/div_2si.c
+ M /trunk/src/div_2ui.c
+ M /trunk/src/div_d.c
+ M /trunk/src/div_ui.c
+ M /trunk/src/dump.c
+ M /trunk/src/eint.c
+ M /trunk/src/eq.c
+ M /trunk/src/erf.c
+ M /trunk/src/erfc.c
+ M /trunk/src/exceptions.c
+ M /trunk/src/exp.c
+ M /trunk/src/exp10.c
+ M /trunk/src/exp2.c
+ M /trunk/src/exp3.c
+ M /trunk/src/exp_2.c
+ M /trunk/src/expm1.c
+ M /trunk/src/extract.c
+ M /trunk/src/factorial.c
+ M /trunk/src/fits_intmax.c
+ M /trunk/src/fits_s.h
+ M /trunk/src/fits_sint.c
+ M /trunk/src/fits_slong.c
+ M /trunk/src/fits_sshort.c
+ M /trunk/src/fits_u.h
+ M /trunk/src/fits_uint.c
+ M /trunk/src/fits_uintmax.c
+ M /trunk/src/fits_ulong.c
+ M /trunk/src/fits_ushort.c
+ M /trunk/src/fma.c
+ M /trunk/src/fms.c
+ M /trunk/src/frac.c
+ M /trunk/src/free_cache.c
+ M /trunk/src/gamma.c
+ M /trunk/src/gammaonethird.c
+ M /trunk/src/gen_inverse.h
+ M /trunk/src/get_d.c
+ M /trunk/src/get_d64.c
+ M /trunk/src/get_exp.c
+ M /trunk/src/get_f.c
+ M /trunk/src/get_flt.c
+ M /trunk/src/get_ld.c
+ M /trunk/src/get_si.c
+ M /trunk/src/get_sj.c
+ M /trunk/src/get_str.c
+ M /trunk/src/get_ui.c
+ M /trunk/src/get_uj.c
+ M /trunk/src/get_z.c
+ M /trunk/src/get_z_exp.c
+ M /trunk/src/gmp_op.c
+ M /trunk/src/hypot.c
+ M /trunk/src/ieee_floats.h
+ M /trunk/src/init.c
+ M /trunk/src/init2.c
+ M /trunk/src/inits.c
+ M /trunk/src/inits2.c
+ M /trunk/src/inp_str.c
+ M /trunk/src/int_ceil_log2.c
+ M /trunk/src/isinf.c
+ M /trunk/src/isinteger.c
+ M /trunk/src/isnan.c
+ M /trunk/src/isnum.c
+ M /trunk/src/isqrt.c
+ M /trunk/src/isregular.c
+ M /trunk/src/iszero.c
+ M /trunk/src/jn.c
+ M /trunk/src/jyn_asympt.c
+ M /trunk/src/li2.c
+ M /trunk/src/lngamma.c
+ M /trunk/src/log.c
+ M /trunk/src/log10.c
+ M /trunk/src/log1p.c
+ M /trunk/src/log2.c
+ M /trunk/src/logging.c
+ M /trunk/src/min_prec.c
+ M /trunk/src/minmax.c
+ M /trunk/src/modf.c
+ M /trunk/src/mp_clz_tab.c
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mpf2mpfr.h
+ M /trunk/src/mpfr-gmp.c
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mpfr-longlong.h
+ M /trunk/src/mpfr-thread.h
+ M /trunk/src/mpfr.h
+ M /trunk/src/mpn_exp.c
+ M /trunk/src/mul.c
+ M /trunk/src/mul_2exp.c
+ M /trunk/src/mul_2si.c
+ M /trunk/src/mul_2ui.c
+ M /trunk/src/mul_d.c
+ M /trunk/src/mul_ui.c
+ M /trunk/src/mulders.c
+ M /trunk/src/neg.c
+ M /trunk/src/next.c
+ M /trunk/src/out_str.c
+ M /trunk/src/pow.c
+ M /trunk/src/pow_si.c
+ M /trunk/src/pow_ui.c
+ M /trunk/src/pow_z.c
+ M /trunk/src/powerof2.c
+ M /trunk/src/print_raw.c
+ M /trunk/src/print_rnd_mode.c
+ M /trunk/src/printf.c
+ M /trunk/src/rec_sqrt.c
+ M /trunk/src/reldiff.c
+ M /trunk/src/rem1.c
+ M /trunk/src/rint.c
+ M /trunk/src/root.c
+ M /trunk/src/round_near_x.c
+ M /trunk/src/round_p.c
+ M /trunk/src/round_prec.c
+ M /trunk/src/round_raw_generic.c
+ M /trunk/src/scale2.c
+ M /trunk/src/sec.c
+ M /trunk/src/sech.c
+ M /trunk/src/set.c
+ M /trunk/src/set_d.c
+ M /trunk/src/set_d64.c
+ M /trunk/src/set_dfl_prec.c
+ M /trunk/src/set_exp.c
+ M /trunk/src/set_f.c
+ M /trunk/src/set_flt.c
+ M /trunk/src/set_inf.c
+ M /trunk/src/set_ld.c
+ M /trunk/src/set_nan.c
+ M /trunk/src/set_prc_raw.c
+ M /trunk/src/set_prec.c
+ M /trunk/src/set_q.c
+ M /trunk/src/set_rnd.c
+ M /trunk/src/set_si.c
+ M /trunk/src/set_si_2exp.c
+ M /trunk/src/set_sj.c
+ M /trunk/src/set_str.c
+ M /trunk/src/set_str_raw.c
+ M /trunk/src/set_ui.c
+ M /trunk/src/set_ui_2exp.c
+ M /trunk/src/set_uj.c
+ M /trunk/src/set_z.c
+ M /trunk/src/set_z_exp.c
+ M /trunk/src/set_zero.c
+ M /trunk/src/setmax.c
+ M /trunk/src/setmin.c
+ M /trunk/src/setsign.c
+ M /trunk/src/sgn.c
+ M /trunk/src/si_op.c
+ M /trunk/src/signbit.c
+ M /trunk/src/sin.c
+ M /trunk/src/sin_cos.c
+ M /trunk/src/sinh.c
+ M /trunk/src/sinh_cosh.c
+ M /trunk/src/sqr.c
+ M /trunk/src/sqrt.c
+ M /trunk/src/sqrt_ui.c
+ M /trunk/src/stack_interface.c
+ M /trunk/src/strtofr.c
+ M /trunk/src/sub.c
+ M /trunk/src/sub1.c
+ M /trunk/src/sub1sp.c
+ M /trunk/src/sub_d.c
+ M /trunk/src/sub_ui.c
+ M /trunk/src/subnormal.c
+ M /trunk/src/sum.c
+ M /trunk/src/swap.c
+ M /trunk/src/tan.c
+ M /trunk/src/tanh.c
+ M /trunk/src/uceil_exp2.c
+ M /trunk/src/uceil_log2.c
+ M /trunk/src/ufloor_log2.c
+ M /trunk/src/ui_div.c
+ M /trunk/src/ui_pow.c
+ M /trunk/src/ui_pow_ui.c
+ M /trunk/src/ui_sub.c
+ M /trunk/src/urandom.c
+ M /trunk/src/urandomb.c
+ M /trunk/src/vasprintf.c
+ M /trunk/src/version.c
+ M /trunk/src/volatile.c
+ M /trunk/src/yn.c
+ M /trunk/src/zeta.c
+ M /trunk/src/zeta_ui.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/digamma
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/random2.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tai.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdigamma.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmin_prec.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tset_z_exp.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstdint.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/turandom.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tools/ck-version-info
+ M /trunk/tools/get_patches.sh
+ M /trunk/tune/Makefile.am
+ M /trunk/tune/bidimensional_sample.c
+ M /trunk/tune/speed.c
+ M /trunk/tune/tuneup.c
+
+Copyright notice update: added 2011 with
+ perl -pi -e 's/2010 Free Software/2010, 2011 Free Software/' **/*(^/)
+under zsh, reverting the ChangeLog file and the m4 and tools/mbench
+directories.
+------------------------------------------------------------------------
+r7388 | vlefevre | 2011-01-17 02:57:17 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Updated year in example.
+------------------------------------------------------------------------
+r7387 | vlefevre | 2011-01-17 02:51:54 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+------------------------------------------------------------------------
+r7386 | vlefevre | 2011-01-17 02:26:55 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/pow.c
+
+[src/pow.c] Added an assertion.
+------------------------------------------------------------------------
+r7385 | vlefevre | 2011-01-17 02:20:19 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/td_div.c
+
+[tests/td_div.c] Consistency change.
+------------------------------------------------------------------------
+r7384 | vlefevre | 2011-01-17 02:19:11 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tdiv_d.c
+
+[tests/tdiv_d.c] Updated test of special cases.
+------------------------------------------------------------------------
+r7383 | vlefevre | 2011-01-17 02:13:23 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/log1p.c
+
+[src/log1p.c] Added support for the division-by-zero exception.
+------------------------------------------------------------------------
+r7382 | vlefevre | 2011-01-17 02:10:32 +0000 (Mon, 17 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tlog1p.c
+
+[tests/tlog1p.c] Test the flags for special cases.
+------------------------------------------------------------------------
+r7381 | vlefevre | 2011-01-17 02:04:11 +0000 (Mon, 17 Jan 2011) | 4 lines
+Changed paths:
+ M /trunk/src/atanh.c
+ M /trunk/src/cot.c
+ M /trunk/src/coth.c
+ M /trunk/src/csc.c
+ M /trunk/src/csch.c
+ M /trunk/src/digamma.c
+ M /trunk/src/eint.c
+ M /trunk/src/gamma.c
+ M /trunk/src/lngamma.c
+ M /trunk/src/log.c
+ M /trunk/src/log10.c
+ M /trunk/src/log2.c
+
+Added support for the division-by-zero exception in functions
+mpfr_atanh, mpfr_cot, mpfr_coth, mpfr_csc, mpfr_csch,
+mpfr_digamma, mpfr_eint, mpfr_gamma, mpfr_lgamma, mpfr_lngamma,
+mpfr_log, mpfr_log2 and mpfr_log10.
+------------------------------------------------------------------------
+r7380 | lfousse | 2011-01-16 21:13:28 +0000 (Sun, 16 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgrandom.c
+
+[tests/tgrandom.c] Add missing cast for malloc.
+------------------------------------------------------------------------
+r7379 | vlefevre | 2011-01-16 14:00:34 +0000 (Sun, 16 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/yn.c
+
+[src/yn.c] Added support for the division-by-zero exception.
+------------------------------------------------------------------------
+r7378 | vlefevre | 2011-01-16 13:57:55 +0000 (Sun, 16 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Added support for the division-by-zero exception.
+------------------------------------------------------------------------
+r7377 | vlefevre | 2011-01-16 13:55:41 +0000 (Sun, 16 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/pow_si.c
+
+[src/pow_si.c] Improved robustness (in case of future changes).
+------------------------------------------------------------------------
+r7376 | vlefevre | 2011-01-16 13:51:36 +0000 (Sun, 16 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/pow.c
+ M /trunk/src/pow_si.c
+ M /trunk/src/pow_z.c
+ M /trunk/tests/tpow.c
+
+Added support for the division-by-zero exception for the power functions
+(with additional tests). (Corrected patch from Patrick.)
+------------------------------------------------------------------------
+r7375 | lfousse | 2011-01-16 00:25:40 +0000 (Sun, 16 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+ M /trunk/src/Makefile.am
+ A /trunk/src/grandom.c (from /trunk/src/urandom_gaussian.c:7374)
+ M /trunk/src/mpfr.h
+ D /trunk/src/urandom_gaussian.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tgrandom.c (from /trunk/tests/turandom_gaussian.c:7374)
+ D /trunk/tests/turandom_gaussian.c
+
+Rename mpfr_urandom_gaussian to mpfr_grandom.
+------------------------------------------------------------------------
+r7374 | vlefevre | 2011-01-15 14:33:25 +0000 (Sat, 15 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Corrections for mpfr_urandom_gaussian.
+------------------------------------------------------------------------
+r7373 | vlefevre | 2011-01-15 14:28:43 +0000 (Sat, 15 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/turandom_gaussian.c
+
+[tests/turandom_gaussian.c] Fixed C99-only code.
+------------------------------------------------------------------------
+r7372 | zimmerma | 2011-01-15 08:14:51 +0000 (Sat, 15 Jan 2011) | 5 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/TODO
+ M /trunk/doc/mpfr.texi
+ M /trunk/src/Makefile.am
+ A /trunk/src/frexp.c
+ M /trunk/src/mpfr.h
+ M /trunk/src/out_raw.c
+ M /trunk/src/urandom_gaussian.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tfrexp.c
+
+[src/frexp.c,tests/tfrexp.c] added new function mpfr_frexp
+[src/urandom_gaussian.c] fixed copyright line
+[src/out_raw.c] started writing code (work in progress, please continue if
+ you are interested)
+
+------------------------------------------------------------------------
+r7371 | lfousse | 2011-01-14 22:11:44 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Document urandom_gaussian.
+------------------------------------------------------------------------
+r7370 | lfousse | 2011-01-14 22:10:58 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] Include turandom_gaussian in tests.
+------------------------------------------------------------------------
+r7369 | lfousse | 2011-01-14 22:10:44 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ A /trunk/tests/turandom_gaussian.c
+
+[tests/turandom_gaussian.c] Add tests for urandom_gaussian.
+------------------------------------------------------------------------
+r7368 | vlefevre | 2011-01-14 19:54:38 +0000 (Fri, 14 Jan 2011) | 3 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+[tests/tdiv.c] Added consistency tests between mpfr_div, mpfr_ui_div,
+mpfr_si_div, mpfr_div_ui and mpfr_div_si (check the ternary value,
+the flags and the result of the division).
+------------------------------------------------------------------------
+r7367 | vlefevre | 2011-01-14 19:52:06 +0000 (Fri, 14 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/div_ui.c
+ M /trunk/src/ui_div.c
+
+[src/ui_div.c] Fixed prototype formatting.
+[src/div_ui.c] Fixed prototype formatting. Set division-by-zero flag.
+------------------------------------------------------------------------
+r7366 | lfousse | 2011-01-14 17:46:07 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/urandom_gaussian.c
+
+[src/urandom_gaussian.c] Fix x -> xp, and scaling.
+------------------------------------------------------------------------
+r7365 | lfousse | 2011-01-14 17:15:32 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/urandom_gaussian.c
+
+[src/urandom_gaussian.c] Pick the signs of the outputs at random.
+------------------------------------------------------------------------
+r7364 | lfousse | 2011-01-14 16:52:35 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/urandom_gaussian.c
+
+[src/urandom_gaussian.c] Fix precision of temporary results.
+------------------------------------------------------------------------
+r7363 | lfousse | 2011-01-14 16:34:48 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/urandom_gaussian.c
+
+[src/urandom_gaussian.c] Add missing inits/clears.
+------------------------------------------------------------------------
+r7360 | lfousse | 2011-01-14 15:54:39 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Declare urandom_gaussian.
+------------------------------------------------------------------------
+r7359 | lfousse | 2011-01-14 15:54:38 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/Makefile.am
+
+[src/Makefile.am] Add urandom_gaussian.c to the sources.
+------------------------------------------------------------------------
+r7358 | lfousse | 2011-01-14 15:54:37 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ A /trunk/src/urandom_gaussian.c
+
+[src/urandom_gaussian] Start work on gaussian distribution.
+------------------------------------------------------------------------
+r7357 | vlefevre | 2011-01-14 15:49:37 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Fixed code introduced in r7346, again.
+------------------------------------------------------------------------
+r7356 | zimmerma | 2011-01-14 15:48:46 +0000 (Fri, 14 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/sin_cos.c
+
+[sin_cos.c] moved macros to mpfr-impl.h, added README
+
+------------------------------------------------------------------------
+r7355 | zimmerma | 2011-01-14 15:40:49 +0000 (Fri, 14 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/sin_cos.c
+
+[sin_cos.c] new inexact flags computed by mpfr_check_range were lost
+
+------------------------------------------------------------------------
+r7354 | vlefevre | 2011-01-14 15:28:45 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Fixed code introduced in r7346.
+------------------------------------------------------------------------
+r7353 | vlefevre | 2011-01-14 15:21:45 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tools/coverage
+
+[tools/coverage] Update from Patrick.
+------------------------------------------------------------------------
+r7352 | vlefevre | 2011-01-14 15:10:42 +0000 (Fri, 14 Jan 2011) | 4 lines
+Changed paths:
+ M /trunk/src/ui_div.c
+ M /trunk/tests/tui_div.c
+
+[src/ui_div.c] Set the division-by-zero flag.
+[tests/tui_div.c] Updated and improved the test of special cases.
+Note: tpow_all currently fails since the support of the division-by-zero
+exception is not complete yet.
+------------------------------------------------------------------------
+r7351 | vlefevre | 2011-01-14 13:43:28 +0000 (Fri, 14 Jan 2011) | 3 lines
+Changed paths:
+ M /trunk/src/div.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/tdiv.c
+
+[src/div.c] Set the division-by-zero flag.
+[tests/tdiv.c, tests/td_div.c] Updated and improved the test of special
+cases.
+------------------------------------------------------------------------
+r7348 | vlefevre | 2011-01-14 11:44:41 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tset.c
+
+[tests/tset.c] Tests didn't fail in case of error from PRINT_ERROR_IF.
+------------------------------------------------------------------------
+r7347 | vlefevre | 2011-01-14 11:37:11 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Added comments.
+------------------------------------------------------------------------
+r7346 | vlefevre | 2011-01-14 11:35:27 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tests/tgeneric.c] Check the division-by-zero flag.
+------------------------------------------------------------------------
+r7345 | vlefevre | 2011-01-14 11:10:43 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+Improved tests/texceptions.c (mpfr_clear_*, mpfr_set_*).
+------------------------------------------------------------------------
+r7344 | vlefevre | 2011-01-14 11:03:30 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/exceptions.c
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mpfr.h
+ M /trunk/tests/texceptions.c
+
+Added support for the division-by-zero exception.
+------------------------------------------------------------------------
+r7343 | vlefevre | 2011-01-14 10:54:28 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/exceptions.c
+
+[src/exceptions.c] Fixed bad #undef's (with currently no consequences).
+------------------------------------------------------------------------
+r7342 | zimmerma | 2011-01-14 10:49:44 +0000 (Fri, 14 Jan 2011) | 3 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] removed item about inlined mpfr_neg: Patrick Pelissier tried it but it
+ does not speed things
+
+------------------------------------------------------------------------
+r7341 | vlefevre | 2011-01-14 10:47:04 +0000 (Fri, 14 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Removed an obsolete comment.
+------------------------------------------------------------------------
+r7338 | lfousse | 2011-01-13 18:39:57 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/atan2.c
+
+[src/atan2.c] "Exact" division can be inexact because of the exponent range.
+------------------------------------------------------------------------
+r7337 | zimmerma | 2011-01-13 18:14:26 +0000 (Thu, 13 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/out_raw.c
+
+[out_raw.c] exchanged bits for precision and exponent
+
+------------------------------------------------------------------------
+r7336 | zimmerma | 2011-01-13 18:13:39 +0000 (Thu, 13 Jan 2011) | 2 lines
+Changed paths:
+ A /trunk/src/out_raw.c
+
+[out_raw.c] first proposal for external format
+
+------------------------------------------------------------------------
+r7334 | vlefevre | 2011-01-13 17:05:35 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] MPFR_IS_POWER_OF_2: added parentheses.
+------------------------------------------------------------------------
+r7333 | lfousse | 2011-01-13 16:24:48 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tatan.c
+
+Add tests for special case of atan2 (x power of 2).
+------------------------------------------------------------------------
+r7332 | lfousse | 2011-01-13 16:24:41 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/atan2.c
+
+Add special case for atan2(x,y) when x is a power of 2.
+------------------------------------------------------------------------
+r7331 | lfousse | 2011-01-13 16:24:35 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+New macro MPFR_IS_POWER_OF_2.
+------------------------------------------------------------------------
+r7329 | vlefevre | 2011-01-13 16:20:48 +0000 (Thu, 13 Jan 2011) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/NEWS
+ M /trunk/acinclude.m4
+ M /trunk/configure.ac
+
+TLS support is now detected automatically. If TLS is supported, MPFR is
+built as thread safe by default. To disable TLS explicitly, configure
+MPFR with --disable-thread-safe.
+------------------------------------------------------------------------
+r7328 | lfousse | 2011-01-13 15:50:37 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tai.c
+
+Add tests for mpfr_ai special case x=0.
+------------------------------------------------------------------------
+r7327 | lfousse | 2011-01-13 15:50:30 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/ai.c
+
+Add special case for x=0 in mpfr_ai1.
+------------------------------------------------------------------------
+r7325 | zimmerma | 2011-01-13 15:38:23 +0000 (Thu, 13 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/doc/algorithms.tex
+
+[algorithms.tex] extended Lemma 2 to the case of terms of the form 1/(1+delta)
+
+------------------------------------------------------------------------
+r7323 | vlefevre | 2011-01-13 15:27:13 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tstdint.c
+ M /trunk/tests/tvalist.c
+
+tests: return 77 for skipped tests (see GNU Automake manual).
+------------------------------------------------------------------------
+r7322 | vlefevre | 2011-01-13 15:20:24 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+------------------------------------------------------------------------
+r7321 | vlefevre | 2011-01-13 15:19:32 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+TODO update after r7317 and r7320.
+------------------------------------------------------------------------
+r7320 | vlefevre | 2011-01-13 15:17:16 +0000 (Thu, 13 Jan 2011) | 3 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tvalist.c
+
+Support multiple inclusions of mpfr.h w.r.t. <stdio.h> and <stdarg.h>
+(MPFR_USE_FILE and/or MPFR_USE_VA_LIST are needed until GMP is fixed).
+Added test "tests/tvalist.c".
+------------------------------------------------------------------------
+r7319 | zimmerma | 2011-01-13 14:46:07 +0000 (Thu, 13 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-longlong.h
+
+[src/mpfr-longlong.h] idem as previous commit for other 2 FIXME's
+
+------------------------------------------------------------------------
+r7318 | zimmerma | 2011-01-13 14:43:29 +0000 (Thu, 13 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-longlong.h
+
+[mpfr-longlong.h] resolved one FIXME, by adding a new one :-)
+
+------------------------------------------------------------------------
+r7317 | vlefevre | 2011-01-13 14:42:53 +0000 (Thu, 13 Jan 2011) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+ M /trunk/tests/Makefile.am
+
+Support multiple inclusions of mpfr.h w.r.t. <stdint.h> / <inttypes.h>.
+------------------------------------------------------------------------
+r7314 | zimmerma | 2011-01-06 16:53:07 +0000 (Thu, 06 Jan 2011) | 2 lines
+Changed paths:
+ M /trunk/tools/mbench/mfv5-mpfr.cc
+ M /trunk/tools/mbench/mfv5.cc
+ M /trunk/tools/mbench/mfv5.h
+
+another patch from Patrick Pelissier to test get_ld (with export of data used)
+
+------------------------------------------------------------------------
+r7313 | zimmerma | 2011-01-06 16:44:13 +0000 (Thu, 06 Jan 2011) | 6 lines
+Changed paths:
+ M /trunk/tools/mbench/Makefile
+ M /trunk/tools/mbench/timp.h
+
+patch from Patrick Pelissier to use clock_getime instead of rdtsc
+(use "make rt" instead of "make")
+References:
+http://stackoverflow.com/questions/3388134/rdtsc-accuracy-across-cpu-cores
+http://en.wikipedia.org/wiki/Time_Stamp_Counter
+
+------------------------------------------------------------------------
+r7312 | vlefevre | 2010-12-25 17:24:58 +0000 (Sat, 25 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/get_ld.c
+
+[src/get_ld.c] Updated a comment about the last change.
+------------------------------------------------------------------------
+r7311 | vlefevre | 2010-12-25 17:08:16 +0000 (Sat, 25 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/get_ld.c
+
+[src/get_ld.c] Minor performance improvement.
+------------------------------------------------------------------------
+r7310 | vlefevre | 2010-12-19 02:00:52 +0000 (Sun, 19 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/tools/mbench/Makefile
+
+[tools/mbench/Makefile] Update due to source reorganization (r7087):
+patch from Patrick Pelissier.
+------------------------------------------------------------------------
+r7309 | vlefevre | 2010-12-17 16:29:47 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+[TODO] Update (exp-int branch, internal macro).
+------------------------------------------------------------------------
+r7308 | vlefevre | 2010-12-17 16:22:37 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/sin.c
+
+[src/sin.c] Fixed failure in debug mode (missing MPFR_IS_ZERO test).
+------------------------------------------------------------------------
+r7307 | vlefevre | 2010-12-17 16:08:54 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Improved comment.
+------------------------------------------------------------------------
+r7305 | zimmerma | 2010-12-17 15:54:55 +0000 (Fri, 17 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[rec_sqrt.c] put back some information lost in commit 7302
+
+------------------------------------------------------------------------
+r7304 | vlefevre | 2010-12-17 15:31:24 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/cmp2.c
+
+[src/cmp2.c] Corrected a comment.
+------------------------------------------------------------------------
+r7303 | vlefevre | 2010-12-17 15:25:04 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/cos.c
+ M /trunk/src/sin.c
+ M /trunk/src/zeta.c
+
+Replaced some MPFR_EXP by MPFR_GET_EXP.
+------------------------------------------------------------------------
+r7302 | vlefevre | 2010-12-17 13:15:46 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/rec_sqrt.c
+
+[src/rec_sqrt.c] Removed a variable that was used only once.
+------------------------------------------------------------------------
+r7301 | vlefevre | 2010-12-17 11:40:51 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Changed comment for mpfrlint.
+------------------------------------------------------------------------
+r7300 | vlefevre | 2010-12-17 11:38:36 +0000 (Fri, 17 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/src/add1.c
+ M /trunk/src/add1sp.c
+ M /trunk/src/div.c
+ M /trunk/src/div_ui.c
+ M /trunk/src/get_str.c
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mpn_exp.c
+ M /trunk/src/mul.c
+ M /trunk/src/mul_ui.c
+ M /trunk/src/mulders.c
+ M /trunk/src/rec_sqrt.c
+ M /trunk/src/round_prec.c
+ M /trunk/src/set_f.c
+ M /trunk/src/sqr.c
+ M /trunk/src/sqrt.c
+ M /trunk/src/strtofr.c
+ M /trunk/src/sub1.c
+ M /trunk/src/sub1sp.c
+ M /trunk/tools/mpfrlint
+
+Added MPFR_TMP_LIMBS_ALLOC macro and updated the source to use it.
+tools/mpfrlint: check its use instead of MPFR_TMP_ALLOC.
+------------------------------------------------------------------------
+r7299 | vlefevre | 2010-12-17 11:31:08 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/sum.c
+
+[src/sum.c] Improved readability.
+------------------------------------------------------------------------
+r7298 | vlefevre | 2010-12-17 09:40:03 +0000 (Fri, 17 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Formatting.
+------------------------------------------------------------------------
+r7297 | vlefevre | 2010-12-14 14:36:06 +0000 (Tue, 14 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+[TODO] Added year on a date (the item was added on 2007-07-28 in r4707).
+------------------------------------------------------------------------
+r7296 | vlefevre | 2010-12-13 00:02:38 +0000 (Mon, 13 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/src
+
+Added configure.lineno (generated by configure) to the svn:ignore
+property of the src directory.
+------------------------------------------------------------------------
+r7295 | vlefevre | 2010-12-12 23:39:43 +0000 (Sun, 12 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Update concerning the --with-gmp-build configure option.
+------------------------------------------------------------------------
+r7294 | vlefevre | 2010-12-12 23:36:38 +0000 (Sun, 12 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Corrected a typo from r7293.
+------------------------------------------------------------------------
+r7293 | vlefevre | 2010-12-12 23:35:04 +0000 (Sun, 12 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Updated INSTALL file after the recent changes in configure.ac concerning
+the --with-gmp-build configure option.
+------------------------------------------------------------------------
+r7292 | vlefevre | 2010-12-12 23:29:50 +0000 (Sun, 12 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] With --with-gmp-build, do not duplicate the include
+search paths if the GMP source and build directories are the same.
+------------------------------------------------------------------------
+r7291 | vlefevre | 2010-12-12 22:31:51 +0000 (Sun, 12 Dec 2010) | 3 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Fixed another bug in r7289. This new version now seems
+to work with GMP's srcdir pointing to a relative directory or to an
+absolute one.
+------------------------------------------------------------------------
+r7290 | vlefevre | 2010-12-12 22:28:53 +0000 (Sun, 12 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Fixed bug in r7289.
+------------------------------------------------------------------------
+r7289 | vlefevre | 2010-12-12 22:17:16 +0000 (Sun, 12 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Corrected Patrick Pelissier's patch (not tested).
+------------------------------------------------------------------------
+r7288 | zimmerma | 2010-12-12 20:47:23 +0000 (Sun, 12 Dec 2010) | 4 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] patch from Patrick Pelissier to solve the problem with
+ --with-gmp-build when the GMP build directory and the GMP
+ source directory differ
+
+------------------------------------------------------------------------
+r7287 | vlefevre | 2010-12-12 11:02:00 +0000 (Sun, 12 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] tversion is also run at the end (after a discussion
+with Patrick and Paul).
+------------------------------------------------------------------------
+r7286 | vlefevre | 2010-12-12 09:55:44 +0000 (Sun, 12 Dec 2010) | 4 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Fixed two problems with --with-gmp-build:
+ * "grep -w" isn't POSIX (an error shouldn't matter with recent GMP
+ versions, as CFLAGS and CC would then be retrieved from gmp.h).
+ * "sed" was used instead of "$SED".
+------------------------------------------------------------------------
+r7279 | vlefevre | 2010-12-07 13:59:45 +0000 (Tue, 07 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Added a section "If 'gmp.h' and 'libgmp' do not match".
+------------------------------------------------------------------------
+r7278 | vlefevre | 2010-12-07 12:51:14 +0000 (Tue, 07 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Improved warning message in case of unmatched 'gmp.h'
+and 'libgmp'.
+------------------------------------------------------------------------
+r7277 | vlefevre | 2010-12-07 11:41:09 +0000 (Tue, 07 Dec 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Update concerning "configure".
+------------------------------------------------------------------------
+r7276 | zimmerma | 2010-12-06 20:54:14 +0000 (Mon, 06 Dec 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] fixed news for 3.0.0
+
+------------------------------------------------------------------------
+r7275 | vlefevre | 2010-12-03 08:55:24 +0000 (Fri, 03 Dec 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+[tests/tversion.c] Now fail if the versions of gmp.h and libgmp do not
+match (error message improved); previously, the warning could remain
+unnoticed, in particular with automatic installations.
+------------------------------------------------------------------------
+r7274 | schevill | 2010-11-30 16:41:38 +0000 (Tue, 30 Nov 2010) | 3 lines
+Changed paths:
+ A /trunk/tools/metaMPFR
+ A /trunk/tools/metaMPFR/metaMPFR_common.mpl
+ A /trunk/tools/metaMPFR/metaMPFR_straightforwardAlgo.mpl
+ A /trunk/tools/metaMPFR/metaMPFR_tests.mpl
+
+Added metaMPFR in the tools directory of MPFR.
+
+
+------------------------------------------------------------------------
+r7273 | vlefevre | 2010-11-29 15:35:52 +0000 (Mon, 29 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Defined MPFR_DEPRECATED to mark MPFR functions, types
+or variables as deprecated.
+------------------------------------------------------------------------
+r7272 | vlefevre | 2010-11-25 07:52:24 +0000 (Thu, 25 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+[tests/tui_pow.c] Updated a comment.
+------------------------------------------------------------------------
+r7271 | vlefevre | 2010-11-23 08:28:00 +0000 (Tue, 23 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Support BSD sed.
+------------------------------------------------------------------------
+r7270 | vlefevre | 2010-11-19 08:53:09 +0000 (Fri, 19 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Detect the use of __mpfr_struct structure members
+in .c files.
+------------------------------------------------------------------------
+r7269 | vlefevre | 2010-11-19 08:46:38 +0000 (Fri, 19 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/src/min_prec.c
+
+[src/min_prec.c] Replaced x->_mpfr_d by MPFR_MANT(x).
+------------------------------------------------------------------------
+r7268 | vlefevre | 2010-11-18 23:41:50 +0000 (Thu, 18 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Commented out the declaration of mpfr_round_raw_3
+(since this function is no longer defined).
+------------------------------------------------------------------------
+r7267 | vlefevre | 2010-11-18 23:20:59 +0000 (Thu, 18 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/src/min_prec.c
+
+[src/min_prec.c] Major simplification of mpfr_min_prec by using
+mpn_scan1 (suggestion by Andreas Enge).
+------------------------------------------------------------------------
+r7266 | vlefevre | 2010-11-15 15:20:03 +0000 (Mon, 15 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Added a comment about mpn_sqr_n.
+------------------------------------------------------------------------
+r7265 | zimmerma | 2010-11-15 13:56:51 +0000 (Mon, 15 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/algorithms.tex
+
+[algorithms.tex] replaced reference to Graillat05 by earlier one (Higham02)
+
+------------------------------------------------------------------------
+r7263 | vlefevre | 2010-11-12 11:38:42 +0000 (Fri, 12 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/tools/nightly-test
+
+[tools/nightly-test] Added a comment about the use of -pedantic-errors.
+------------------------------------------------------------------------
+r7262 | vlefevre | 2010-11-10 23:17:02 +0000 (Wed, 10 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/src/sub1.c
+
+[src/sub1.c] Minor simplification.
+------------------------------------------------------------------------
+r7261 | vlefevre | 2010-11-10 22:48:27 +0000 (Wed, 10 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+[tests/tpow.c] Avoid warnings if mpfr_exp_t < long.
+------------------------------------------------------------------------
+r7260 | zimmerma | 2010-11-10 20:17:17 +0000 (Wed, 10 Nov 2010) | 3 lines
+Changed paths:
+ M /trunk/src/mul.c
+
+[mul.c] fixed bug introduced in revision 7183, and reported by Brian Gladman
+ on Windows, where mpfr_exp_t has 32 bits and mpfr_limb_t has 64 bits
+
+------------------------------------------------------------------------
+r7257 | vlefevre | 2010-11-09 14:24:34 +0000 (Tue, 09 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Use only mpfr_* types in __MPFR_EXP_* macro definitions
+(should have been done in r7236).
+------------------------------------------------------------------------
+r7255 | vlefevre | 2010-11-09 13:43:29 +0000 (Tue, 09 Nov 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Changed a "void" into a "mpfr_void" in a macro definition
+(should have been done in r7236).
+------------------------------------------------------------------------
+r7254 | vlefevre | 2010-11-09 12:37:23 +0000 (Tue, 09 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+[tests/tset_si.c] Added testcase for problem fixed in r7236.
+------------------------------------------------------------------------
+r7251 | vlefevre | 2010-11-08 13:22:04 +0000 (Mon, 08 Nov 2010) | 3 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Removed some useless casts that where added in r7121 and
+r7236 (such casts prevented the compiler from emitting diagnostics in
+incorrect calls).
+------------------------------------------------------------------------
+r7250 | vlefevre | 2010-11-08 12:55:16 +0000 (Mon, 08 Nov 2010) | 1 line
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] Added a comment (warning about LOADLIBES).
+------------------------------------------------------------------------
+r7247 | zimmerma | 2010-10-25 13:53:16 +0000 (Mon, 25 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/taway.c
+
+[taway.c] reduced time of the test
+
+------------------------------------------------------------------------
+r7246 | vlefevre | 2010-10-25 10:00:45 +0000 (Mon, 25 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/NEWS
+
+Mentioned --enable-gmp-internals in INSTALL and NEWS.
+------------------------------------------------------------------------
+r7244 | vlefevre | 2010-10-24 13:27:47 +0000 (Sun, 24 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/tests/taway.c
+
+[tests/taway.c] Added a FIXME (test is too long on old machines).
+------------------------------------------------------------------------
+r7243 | vlefevre | 2010-10-24 12:41:01 +0000 (Sun, 24 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Corrected comment for PowerPC.
+------------------------------------------------------------------------
+r7242 | zimmerma | 2010-10-24 08:01:49 +0000 (Sun, 24 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/src/Makefile.am
+ A /trunk/src/hppa
+ A /trunk/src/hppa/mparam.h
+ M /trunk/src/mparam_h.in
+
+added tuning parameters for HPPA (on HP-UX machine kindly provided by David
+Kirkby)
+
+------------------------------------------------------------------------
+r7241 | zimmerma | 2010-10-23 16:45:32 +0000 (Sat, 23 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/src/powerpc32/mparam.h
+
+[powerpc32/mparam.h] added more info on processor and operating system used
+
+------------------------------------------------------------------------
+r7240 | zimmerma | 2010-10-23 09:18:12 +0000 (Sat, 23 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/src/Makefile.am
+ M /trunk/src/mparam_h.in
+
+needed stuff to use src/powerpc32/mparam.h file
+(note that long double is IEEE double on PowerPC32)
+
+------------------------------------------------------------------------
+r7239 | zimmerma | 2010-10-23 09:07:33 +0000 (Sat, 23 Oct 2010) | 2 lines
+Changed paths:
+ A /trunk/src/powerpc32
+ A /trunk/src/powerpc32/mparam.h
+
+[powerpc32/mparam.h] param file for powerpc32 (made on PowerPC 604 under AIX)
+
+------------------------------------------------------------------------
+r7238 | zimmerma | 2010-10-22 14:54:43 +0000 (Fri, 22 Oct 2010) | 5 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] added cast from time_t to long, after warning under HP-UX:
+tuneup.c:1131: warning: format '%ld' expects type 'long int', but argument 3 has type 'time_t'
+tuneup.c:1133: warning: format '%ld' expects type 'long int', but argument 2 has type 'time_t'
+(I don't know if it is because time_t is unsigned, or has a different width)
+
+------------------------------------------------------------------------
+r7237 | vlefevre | 2010-10-22 13:30:50 +0000 (Fri, 22 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Added a space.
+------------------------------------------------------------------------
+r7236 | vlefevre | 2010-10-22 13:27:59 +0000 (Fri, 22 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Avoid some problems with macro expansion if the user
+defines macros with the same name as keywords.
+[doc/mpfr.texi] Document the use of macros.
+------------------------------------------------------------------------
+r7235 | schevill | 2010-10-22 10:10:37 +0000 (Fri, 22 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/src/Makefile.am
+
+Included the new /arch/mparam.h files into the dist.
+
+
+------------------------------------------------------------------------
+r7231 | schevill | 2010-10-20 16:08:04 +0000 (Wed, 20 Oct 2010) | 6 lines
+Changed paths:
+ M /trunk/src/amd/athlon/mparam.h
+ M /trunk/src/amd/k8/mparam.h
+ M /trunk/src/arm/mparam.h
+ M /trunk/src/ia64/mparam.h
+ M /trunk/src/mparam_h.in
+ M /trunk/src/powerpc64/mparam.h
+ M /trunk/src/sparc64/mparam.h
+ M /trunk/src/x86/core2/mparam.h
+ M /trunk/src/x86/mparam.h
+ M /trunk/src/x86_64/core2/mparam.h
+ M /trunk/src/x86_64/pentium4/mparam.h
+ M /trunk/tune/tuneup.c
+
+Cosmetic change: the constant MPFR_TUNE_CASE is now defined in mparam_h.in.
+Hence the files src/some-architecture/mparam.h are now simply obtained by
+performing 'make tune' on some architecture and copying the resulting
+src/mparam.h to src/some-architecture/mparam.h.
+
+
+------------------------------------------------------------------------
+r7230 | schevill | 2010-10-20 13:16:51 +0000 (Wed, 20 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+Typo.
+
+
+------------------------------------------------------------------------
+r7229 | schevill | 2010-10-20 11:40:52 +0000 (Wed, 20 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/src/amd/athlon/mparam.h
+ M /trunk/src/amd/k8/mparam.h
+ M /trunk/src/arm/mparam.h
+ M /trunk/src/ia64/mparam.h
+ M /trunk/src/mparam_h.in
+ M /trunk/src/powerpc64/mparam.h
+ M /trunk/src/sparc64/mparam.h
+ M /trunk/src/x86/core2/mparam.h
+ M /trunk/src/x86/mparam.h
+ M /trunk/src/x86_64/core2/mparam.h
+ M /trunk/src/x86_64/pentium4/mparam.h
+ M /trunk/tune/tuneup.c
+
+Up-to-date thresholds.
+
+
+------------------------------------------------------------------------
+r7228 | vlefevre | 2010-10-20 01:23:23 +0000 (Wed, 20 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tsub.c
+
+[tests/tsub.c] mp_prec_t -> mpfr_prec_t
+------------------------------------------------------------------------
+r7227 | vlefevre | 2010-10-20 01:22:38 +0000 (Wed, 20 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/src/sub1.c
+
+[src/sub1.c] Removed trailing spaces.
+------------------------------------------------------------------------
+r7226 | vlefevre | 2010-10-19 16:21:41 +0000 (Tue, 19 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_z_exp.c
+ M /trunk/tests/tsprintf.c
+
+[tests/*.c] Support the case where mpfr_exp_t is not a long int
+(but with such a future extension, one should probably provide
+a MPFR_PRIexp macro, similar to what <inttypes.h> does).
+------------------------------------------------------------------------
+r7225 | vlefevre | 2010-10-19 15:56:24 +0000 (Tue, 19 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+[tests/texceptions.c] Added casts, in case mpfr_exp_t is not a long int.
+------------------------------------------------------------------------
+r7224 | zimmerma | 2010-10-19 15:03:32 +0000 (Tue, 19 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+[tset_ld.c] replaced hexadecimal long double constants by decimal constants
+
+------------------------------------------------------------------------
+r7223 | vlefevre | 2010-10-19 14:43:12 +0000 (Tue, 19 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+[tests/tset_ld.c] Added a FIXME for r7222 change.
+------------------------------------------------------------------------
+r7222 | zimmerma | 2010-10-19 14:22:09 +0000 (Tue, 19 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/src/set_ld.c
+ M /trunk/tests/tset_ld.c
+
+[set_ld.c] fixed bug #11300 on bug tracker
+[tset_ld.c] added corresponding tests
+
+------------------------------------------------------------------------
+r7221 | zimmerma | 2010-10-19 12:24:21 +0000 (Tue, 19 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/algorithms.tex
+
+[algorithms.tex] modified proof of mpfr_sub in accordance with source code
+
+------------------------------------------------------------------------
+r7220 | zimmerma | 2010-10-19 12:06:00 +0000 (Tue, 19 Oct 2010) | 13 lines
+Changed paths:
+ A /trunk/doc/sub_tree.pdf
+
+this is a tree of all possible cases that can happen for rounding in mpfr_sub
+(file sub1.c) for rounding to nearest.
+
+The nodes at depth 1 of the tree correspond to the 3 possible cases before
+rounding: (1) sh=0, (2) sh>0 and the low sh bits are 1/2 ulp, (3) sh>0 and
+the low sh bits are 0.
+
+The nodes at depth 2 represent the possible subcases for k=0 in the rounding
+loop.
+
+The nodes at depth 3 represent the possible subcases for k=1 in the rounding
+loop.
+
+------------------------------------------------------------------------
+r7219 | zimmerma | 2010-10-19 11:12:07 +0000 (Tue, 19 Oct 2010) | 7 lines
+Changed paths:
+ M /trunk/src/sub1.c
+ M /trunk/tests/tsub.c
+
+[src/sub1.c] fixed another remaining issue in case 1d1
+ (case sh=0, i.e., the result uses a full number of limbs,
+ the first neglected limbs of b and c match,
+ and for the next limbs, low(b) > low(c)).
+ This case was incorrectly rounded up (add_one_ulp).
+[tests/tsub.c] added more test cases
+
+------------------------------------------------------------------------
+r7218 | zimmerma | 2010-10-19 11:06:38 +0000 (Tue, 19 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tgmpop.c] in case of error, print mpz_t in decimal instead of binary
+
+------------------------------------------------------------------------
+r7217 | zimmerma | 2010-10-19 06:36:56 +0000 (Tue, 19 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] increase maximal number of calls to speed_measure from 5 to 30
+ (seems to solve problems on gcc15)
+
+------------------------------------------------------------------------
+r7215 | vlefevre | 2010-10-18 23:51:35 +0000 (Mon, 18 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tcan_round.c
+
+[tests/tcan_round.c] Removed an incorrect cast, fixing a bug (in the
+test) that was producing a failure for GMP_CHECK_RANDOMIZE=1287710095
+on 64-bit machines (visible since mpfr_prec_t is now signed).
+------------------------------------------------------------------------
+r7214 | vlefevre | 2010-10-18 22:21:33 +0000 (Mon, 18 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/src/sub1.c
+
+[src/sub1.c] Removed trailing whitespace.
+------------------------------------------------------------------------
+r7213 | zimmerma | 2010-10-18 21:02:22 +0000 (Mon, 18 Oct 2010) | 4 lines
+Changed paths:
+ M /trunk/src/sub1.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tsub.c
+
+[sub1.c] previous fix was not incorrect (but strangely our tests cases did
+ not exhibit that)
+[tfma.c] added more test cases from Jakub Jelinek
+
+------------------------------------------------------------------------
+r7212 | zimmerma | 2010-10-18 18:54:56 +0000 (Mon, 18 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/src/sub1.c
+
+[sub1.c] fixed bug found by Jakub Jelinek (#11301 on tracker)
+
+------------------------------------------------------------------------
+r7211 | vlefevre | 2010-10-18 17:17:11 +0000 (Mon, 18 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7209 | vlefevre | 2010-10-18 16:16:39 +0000 (Mon, 18 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tsub.c
+
+[tests/tsub.c] Fixed inex test in bug20101017.
+------------------------------------------------------------------------
+r7208 | schevill | 2010-10-18 14:14:49 +0000 (Mon, 18 Oct 2010) | 9 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Mention the warning message displayed by gcc when the ABI of gcc and MPFR
+differ.
+
+Note: the message does not automatically imply the problem; however, if the
+message appears, the ABI somehow differ, so it is worth mentioning it.
+Users might look for the message in INSTALL in order to see if their problem is
+mentioned.
+
+
+------------------------------------------------------------------------
+r7206 | zimmerma | 2010-10-18 13:01:12 +0000 (Mon, 18 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added "Notes about ABI" section
+
+------------------------------------------------------------------------
+r7205 | vlefevre | 2010-10-18 12:18:11 +0000 (Mon, 18 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tsub.c
+
+[tests/tsub.c] Updated comment of bug20101017.
+------------------------------------------------------------------------
+r7204 | vlefevre | 2010-10-18 11:59:39 +0000 (Mon, 18 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+[tests/tsub.c] Added testcase for bug found by Jakub Jelinek
+(bug 11301 on INRIAGforge).
+------------------------------------------------------------------------
+r7203 | zimmerma | 2010-10-18 09:41:37 +0000 (Mon, 18 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] print size when speed_measure fails
+
+------------------------------------------------------------------------
+r7202 | zimmerma | 2010-10-17 19:33:37 +0000 (Sun, 17 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[mpfr.texi] added that the 'N' mode rounds ties to even in the mpfr*printf
+ functions
+
+------------------------------------------------------------------------
+r7201 | schevill | 2010-10-15 15:18:18 +0000 (Fri, 15 Oct 2010) | 4 lines
+Changed paths:
+ A /trunk/src/amd
+ A /trunk/src/amd/athlon
+ A /trunk/src/amd/athlon/mparam.h
+ A /trunk/src/amd/k8
+ A /trunk/src/amd/k8/mparam.h
+ A /trunk/src/arm
+ A /trunk/src/arm/mparam.h
+ M /trunk/src/buildopt.c
+ A /trunk/src/generic
+ A /trunk/src/generic/mparam.h
+ A /trunk/src/ia64
+ A /trunk/src/ia64/mparam.h
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mpfr.h
+ A /trunk/src/powerpc64
+ A /trunk/src/powerpc64/mparam.h
+ A /trunk/src/sparc64
+ A /trunk/src/sparc64/mparam.h
+ A /trunk/src/x86
+ A /trunk/src/x86/core2
+ A /trunk/src/x86/core2/mparam.h
+ A /trunk/src/x86/mparam.h
+ A /trunk/src/x86_64
+ A /trunk/src/x86_64/core2
+ A /trunk/src/x86_64/core2/mparam.h
+ A /trunk/src/x86_64/pentium4
+ A /trunk/src/x86_64/pentium4/mparam.h
+ M /trunk/tune/tuneup.c
+
+Reorganized mparam_h.in in separate files.
+Added mpfr_buildopt_tune_case function.
+
+
+------------------------------------------------------------------------
+r7200 | schevill | 2010-10-14 15:31:16 +0000 (Thu, 14 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+Modified the number of iterations in the loop of mpfr_speed_measure.
+
+
+------------------------------------------------------------------------
+r7199 | zimmerma | 2010-10-14 10:55:09 +0000 (Thu, 14 Oct 2010) | 4 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] new function mpfr_speed_measure, which calls speed_measure() several
+ times (currently 30) until there is no failure.
+ In case all 30 calls fail, give some hints to the user.
+
+------------------------------------------------------------------------
+r7198 | zimmerma | 2010-10-13 19:58:28 +0000 (Wed, 13 Oct 2010) | 5 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] try again when speed_measure returns -1.0 (i.e. fails)
+ also check return value of speed_measure in all cases
+ (was not done for mulhigh, sqrhigh and divhigh, reported
+ by Sylvain Chevillard)
+
+------------------------------------------------------------------------
+r7197 | schevill | 2010-10-12 15:39:21 +0000 (Tue, 12 Oct 2010) | 3 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+Small indication explaining what is the negative threshold for Ai.
+
+
+------------------------------------------------------------------------
+r7196 | vlefevre | 2010-10-10 20:48:51 +0000 (Sun, 10 Oct 2010) | 4 lines
+Changed paths:
+ M /trunk/src/add1.c
+ M /trunk/src/mpfr-impl.h
+
+[src/mpfr-impl.h] Added MPFR_UEXP macro to check (in debug mode) that
+a value is nonnegative before a cast to mpfr_uexp_t.
+[src/add1.c] Use the MPFR_UEXP macro to make sure that the avoided
+warning doesn't hide a real bug.
+------------------------------------------------------------------------
+r7195 | zimmerma | 2010-10-10 17:28:05 +0000 (Sun, 10 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tsprintf.c
+
+avoid several compiler warnings with g++
+
+------------------------------------------------------------------------
+r7194 | zimmerma | 2010-10-10 17:00:18 +0000 (Sun, 10 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tools/nightly-test
+
+[nightly-test] added -Wno-sign-compare for g++, to avoid spurious warnings
+
+------------------------------------------------------------------------
+r7193 | zimmerma | 2010-10-10 09:04:53 +0000 (Sun, 10 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/tools/nightly-test
+
+[nightly-test] do not use -Wmissing-prototypes for g++
+
+------------------------------------------------------------------------
+r7192 | zimmerma | 2010-10-10 08:54:37 +0000 (Sun, 10 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/src/add1.c
+
+[add1.c] fixed compiler warning (from g++)
+
+------------------------------------------------------------------------
+r7191 | zimmerma | 2010-10-08 18:29:16 +0000 (Fri, 08 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] fixed comment
+
+------------------------------------------------------------------------
+r7189 | zimmerma | 2010-10-03 07:39:44 +0000 (Sun, 03 Oct 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+ M /trunk/src/sqrt.c
+
+[sqrt.c,mulders.c] added missing cast (detected by nightly builds with g++)
+
+------------------------------------------------------------------------
+r7188 | vlefevre | 2010-10-01 15:58:44 +0000 (Fri, 01 Oct 2010) | 1 line
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] Untabified.
+------------------------------------------------------------------------
+r7187 | zimmerma | 2010-09-30 19:14:00 +0000 (Thu, 30 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] fixed comments about error analysis in short product,
+ and improved short division code
+
+------------------------------------------------------------------------
+r7186 | vlefevre | 2010-09-30 16:46:23 +0000 (Thu, 30 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mul.c
+ M /trunk/tune/tuneup.c
+
+Removed trailing spaces and untabified several files.
+------------------------------------------------------------------------
+r7185 | vlefevre | 2010-09-30 16:40:04 +0000 (Thu, 30 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/mul.c
+
+[src/mul.c] Added comments concerning the latest changes about mulhigh.
+------------------------------------------------------------------------
+r7184 | zimmerma | 2010-09-30 07:10:37 +0000 (Thu, 30 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] removed leftover debug stuff
+
+------------------------------------------------------------------------
+r7183 | zimmerma | 2010-09-29 16:03:04 +0000 (Wed, 29 Sep 2010) | 11 lines
+Changed paths:
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/mul.c
+ M /trunk/src/mulders.c
+ M /trunk/src/round_p.c
+ M /trunk/src/sqrt.c
+ M /trunk/tune/tuneup.c
+
+[src/mulders.c] added new function mpfr_divhigh_n() for short division
+ (not used yet), fixed comments and added error analysis
+ in mpfr_mulhigh_n() and mpfr_sqrhigh_n()
+[src/sqrt.c] fixed ill-placed MPFR_TMP_MARK
+[src/mparam_h.in] added default MPFR_DIVHIGH_TAB for mpfr_divhigh_n()
+[src/round_p.c] typo
+[src/mpfr-impl.h] added prototype for mpfr_divhigh_n
+[src/mul.c] added comment, simplified code
+[tune/tuneup.c] added tuning for mpfr_divhigh_n(), increased MAX_STEPS to get
+ a better tuning (will take longer), set tolerance to 1.0
+
+------------------------------------------------------------------------
+r7182 | zimmerma | 2010-09-29 13:15:33 +0000 (Wed, 29 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/configure.ac
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/sqrt.c
+
+added new option --enable-gmp-internals to use GMP undocumented function
+(at user's own risk). So far only mpn_rootrem is used in mpfr_sqrt.
+
+------------------------------------------------------------------------
+r7181 | zimmerma | 2010-09-29 10:07:00 +0000 (Wed, 29 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/README.dev
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/sqrt.c
+
+[doc/README.dev] added comment about mpn_rootrem
+
+------------------------------------------------------------------------
+r7180 | vlefevre | 2010-09-28 23:09:34 +0000 (Tue, 28 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] Added a FIXME note about incorrect use of an internal
+GMP symbol (__gmpn_rootrem).
+------------------------------------------------------------------------
+r7179 | zimmerma | 2010-09-28 15:40:36 +0000 (Tue, 28 Sep 2010) | 4 lines
+Changed paths:
+ M /trunk/src/sqrt.c
+
+[src/sqrt.c] followup to previous commit: only compute an extra limb of the
+ square root for rounding to nearest (for directed rounding, it
+ suffices to know if the remainder is zero or not)
+
+------------------------------------------------------------------------
+r7178 | zimmerma | 2010-09-28 15:08:34 +0000 (Tue, 28 Sep 2010) | 5 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/configure.ac
+ M /trunk/src/mpfr-gmp.h
+ M /trunk/src/mpfr-impl.h
+ M /trunk/src/sqrt.c
+ M /trunk/tests/reuse.c
+
+[src/sqrt.c] now uses mpn_rootrem (if available) instead of mpn_sqrtrem since
+ mpn_rootrem is faster. Also refactored the code: now compute one
+ more limb of the square root when the target precision is a
+ multiple of GMP_NUMB_LIMB. This greatly simplifies the code.
+
+------------------------------------------------------------------------
+r7177 | zimmerma | 2010-09-28 11:40:08 +0000 (Tue, 28 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/sqrt.c
+
+[src/sqrt.c] simplified computation of sticky bit
+
+------------------------------------------------------------------------
+r7176 | zimmerma | 2010-09-27 11:34:08 +0000 (Mon, 27 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[mulders.c] fixed typo
+
+------------------------------------------------------------------------
+r7175 | vlefevre | 2010-09-27 10:25:08 +0000 (Mon, 27 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[src/mulders.c] Replaced MPFR_ASSERTD with constant expression
+by MPFR_ASSERTN.
+------------------------------------------------------------------------
+r7174 | vlefevre | 2010-09-27 10:21:17 +0000 (Mon, 27 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Added a test:
+Constant checking should use MPFR_ASSERTN, not MPFR_ASSERTD.
+------------------------------------------------------------------------
+r7173 | zimmerma | 2010-09-27 08:17:11 +0000 (Mon, 27 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[mulders.c] modified mpfr_sqrhigh_n threshold so that it is > n/2
+
+------------------------------------------------------------------------
+r7172 | vlefevre | 2010-09-27 00:54:13 +0000 (Mon, 27 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Added a FIXME concerning autoconf 2.68.
+------------------------------------------------------------------------
+r7171 | zimmerma | 2010-09-25 03:57:06 +0000 (Sat, 25 Sep 2010) | 4 lines
+Changed paths:
+ M /trunk/src/mulders.c
+
+[mulders.c] use mpn_lshift instead of mpn_add_n, and improved the default
+ Mulders cutoff k beyond 1024 limbs (extrapolated from the cutoff
+ k for n=1023 on Core 2, and checked experimentally it is faster)
+
+------------------------------------------------------------------------
+r7170 | zimmerma | 2010-09-24 19:57:30 +0000 (Fri, 24 Sep 2010) | 4 lines
+Changed paths:
+ M /trunk/tune/tuneup.c
+
+[tuneup.c] changed lower bound for exp_2 threshold from MPFR_PREC_MIN (2) to
+ GMP_NUMB_BITS. Seems to be better (since for p=2 the 2nd routine
+ was sometimes already faster).
+
+------------------------------------------------------------------------
+r7169 | zimmerma | 2010-09-24 19:12:08 +0000 (Fri, 24 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mul.c
+
+[mul.c] another changes for Mulders' algorithm in case of a square
+
+------------------------------------------------------------------------
+r7168 | vlefevre | 2010-09-24 18:51:54 +0000 (Fri, 24 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/mul.c
+
+[src/mul.c] Change in r7166 was incomplete. Fixed suspicious code.
+------------------------------------------------------------------------
+r7167 | zimmerma | 2010-09-24 18:35:00 +0000 (Fri, 24 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mparam_h.in
+
+[mparam_h.in] updated for 64-bit Core2
+
+------------------------------------------------------------------------
+r7166 | zimmerma | 2010-09-24 18:27:25 +0000 (Fri, 24 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/src/mparam_h.in
+ M /trunk/src/mul.c
+ M /trunk/src/sqr.c
+ M /trunk/tune/tuneup.c
+
+now use Mulders' algorithm also for mpfr_sqr, provides nice speed improvement
+in all functions that perform squarings
+
+------------------------------------------------------------------------
+r7165 | vlefevre | 2010-09-21 10:57:23 +0000 (Tue, 21 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] API compatibility section: noted that mpfr_urandom
+and mpfr_urandomb changed for MPFR 3.1.
+------------------------------------------------------------------------
+r7164 | zimmerma | 2010-09-21 08:50:50 +0000 (Tue, 21 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] update about "make tune"
+
+------------------------------------------------------------------------
+r7163 | vlefevre | 2010-09-21 08:43:47 +0000 (Tue, 21 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/doc/FAQ.html
+
+[doc] Updated FAQ.html with update-faq.
+------------------------------------------------------------------------
+r7159 | schevill | 2010-09-20 15:47:36 +0000 (Mon, 20 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/README
+
+Indicated the location of README.dev.
+
+
+------------------------------------------------------------------------
+r7158 | vlefevre | 2010-09-19 17:58:10 +0000 (Sun, 19 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Minor update.
+------------------------------------------------------------------------
+r7157 | zimmerma | 2010-09-19 12:32:22 +0000 (Sun, 19 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] inform the users that mpfr_add_one_ulp and mpfr_sub_one_ulp will be
+ removed
+
+------------------------------------------------------------------------
+r7156 | zimmerma | 2010-09-18 19:50:36 +0000 (Sat, 18 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added efficiency item
+
+------------------------------------------------------------------------
+r7150 | zimmerma | 2010-09-16 02:56:41 +0000 (Thu, 16 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tset_z_exp.c
+
+replaced calls to mpfr_printf by calls to mpfr_dump
+(mpfr_printf might not be defined)
+
+------------------------------------------------------------------------
+r7149 | zimmerma | 2010-09-16 00:41:32 +0000 (Thu, 16 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/doc/mpfr.texi
+
+[NEWS,doc/mpfr.texi] updated: the GMP random functions do not depend on the
+ computer word size
+
+------------------------------------------------------------------------
+r7145 | vlefevre | 2010-09-15 15:17:09 +0000 (Wed, 15 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/tools/mpfrlint
+
+[tools/mpfrlint] Check for mpfr_printf-like functions in the tests.
+------------------------------------------------------------------------
+r7144 | vlefevre | 2010-09-15 15:15:06 +0000 (Wed, 15 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] Updated the month.
+------------------------------------------------------------------------
+r7143 | zimmerma | 2010-09-15 13:26:39 +0000 (Wed, 15 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/mpfr.texi
+
+[doc/mpfr.texi] added notes for mpfr_urandom and mpfr_urandomb
+
+------------------------------------------------------------------------
+r7142 | zimmerma | 2010-09-15 09:27:38 +0000 (Wed, 15 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[Makefile.am] updated LOADLIBES with reorganization of the sources
+
+------------------------------------------------------------------------
+r7141 | zimmerma | 2010-09-15 09:15:57 +0000 (Wed, 15 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/algorithms.tex
+
+[algorithms.tex] added sections for pow_ui and root
+
+------------------------------------------------------------------------
+r7140 | zimmerma | 2010-09-15 08:30:10 +0000 (Wed, 15 Sep 2010) | 4 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/src/urandom.c
+ M /trunk/tests/turandom.c
+
+[src/urandom.c] now mpfr_urandom also returns identical values on 32-bit and
+ 64-bit machines
+[tests/turandom.c] modified corresponding test
+
+------------------------------------------------------------------------
+r7139 | zimmerma | 2010-09-15 07:47:50 +0000 (Wed, 15 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+ M /trunk/tests/turandom.c
+
+replaced mpfr_printf in tests by calls to mpfr_out_str
+
+------------------------------------------------------------------------
+r7138 | vlefevre | 2010-09-15 07:35:16 +0000 (Wed, 15 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Updated the paragraph added in r7137.
+------------------------------------------------------------------------
+r7137 | vlefevre | 2010-09-15 07:30:13 +0000 (Wed, 15 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/doc/README.dev
+
+[doc/README.dev] Added a paragraph about the use of system-dependent
+functions in the test suite.
+------------------------------------------------------------------------
+r7136 | vlefevre | 2010-09-15 07:28:34 +0000 (Wed, 15 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/init2.c
+ M /trunk/src/set_ld.c
+ M /trunk/src/vasprintf.c
+
+Some minor corrections in comments.
+------------------------------------------------------------------------
+r7135 | vlefevre | 2010-09-15 07:24:05 +0000 (Wed, 15 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/printf.c
+
+[src/printf.c] Typo in a comment.
+------------------------------------------------------------------------
+r7134 | vlefevre | 2010-09-15 07:23:25 +0000 (Wed, 15 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/printf.c
+
+[src/printf.c] Slight modification of a comment.
+------------------------------------------------------------------------
+r7133 | zimmerma | 2010-09-15 02:50:32 +0000 (Wed, 15 Sep 2010) | 8 lines
+Changed paths:
+ M /trunk/src/urandom.c
+ M /trunk/src/urandomb.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/turandom.c
+
+[urandomb.c] modified to leave the GMP random generator in the same state,
+ independent of GMP_NUMB_BITS
+[trandom.c] test of the above
+[urandom.c] added FIXME's
+[turandom.c] check we leave the GMP random generator in the same state,
+ independent of GMP_NUMB_BITS. Currently this fails on 64-bit
+ computers.
+
+------------------------------------------------------------------------
+r7132 | zimmerma | 2010-09-15 01:57:46 +0000 (Wed, 15 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/urandomb.c
+
+[urandomb.c] added comment + slight change
+
+------------------------------------------------------------------------
+r7121 | vlefevre | 2010-09-01 11:30:22 +0000 (Wed, 01 Sep 2010) | 4 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Added casts to improve robustness in case of undefined
+behavior and compiler extensions based on UB (in particular -fwrapv).
+MPFR doesn't use such extensions, but these macros will be used by
+3rd-party code, where such extensions may be required.
+------------------------------------------------------------------------
+r7120 | vlefevre | 2010-09-01 11:06:07 +0000 (Wed, 01 Sep 2010) | 1 line
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Updated a comment concerning -Wconversion.
+------------------------------------------------------------------------
+r7118 | vlefevre | 2010-09-01 10:42:55 +0000 (Wed, 01 Sep 2010) | 6 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Added casts to unsigned long in mpfr_cmp_si and mpfr_set_si
+macros for GCC, in order to avoid warnings in programs that use MPFR and
+are compiled with -Wconversion (suggestion by Andreas Enge); such casts
+are OK since if X is a constant expression, then (unsigned long) X is
+also a constant expression, so that the optimizations still work.
+Reformatted these macros.
+------------------------------------------------------------------------
+r7116 | vlefevre | 2010-09-01 09:25:27 +0000 (Wed, 01 Sep 2010) | 4 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Fixed bug in the mpfr_cmp_ui macro for GCC (also used
+by mpfr_cmp_si), when the evaluation of the first argument yields
+side effects and the second argument is a constant expression with
+the value 0.
+------------------------------------------------------------------------
+r7115 | vlefevre | 2010-09-01 09:19:43 +0000 (Wed, 01 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+[tests/tcmp_ui.c] Added side-effect tests similar to those in tset_si.c,
+showing a bug in the mpfr_cmp_ui and mpfr_cmp_si macros.
+------------------------------------------------------------------------
+r7114 | vlefevre | 2010-09-01 09:07:59 +0000 (Wed, 01 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+[tests/tcmp_ui.c] Check mpfr_cmp_ui and mpfr_cmp_si macros against
+side effects in the arguments.
+------------------------------------------------------------------------
+r7113 | vlefevre | 2010-09-01 08:58:22 +0000 (Wed, 01 Sep 2010) | 2 lines
+Changed paths:
+ M /trunk/src/mpfr.h
+
+[src/mpfr.h] Added a comment about the macros that use
+__builtin_constant_p.
+------------------------------------------------------------------------
+r7112 | zimmerma | 2010-08-30 09:04:00 +0000 (Mon, 30 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+[tsqrt.c] improved comment, and added test sqrt(+0) == +0
+
+------------------------------------------------------------------------
+r7111 | vlefevre | 2010-08-29 19:26:00 +0000 (Sun, 29 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+[tests/tsqrt.c] Renamed check_nan() to check_singular().
+------------------------------------------------------------------------
+r7110 | vlefevre | 2010-08-29 19:23:52 +0000 (Sun, 29 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+[tests/tsqrt.c] Check that sqrt(-0) has a negative sign.
+------------------------------------------------------------------------
+r7108 | vlefevre | 2010-08-26 14:44:41 +0000 (Thu, 26 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Replaced "patches" by "allpatches".
+------------------------------------------------------------------------
+r7107 | zimmerma | 2010-08-25 20:15:24 +0000 (Wed, 25 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.ac
+
+[configure.ac] fixed typo
+
+------------------------------------------------------------------------
+r7106 | vlefevre | 2010-08-23 15:24:10 +0000 (Mon, 23 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/src/gmp_op.c
+
+[src/gmp_op.c] Extend the exponent range in mpfr_cmp_q and mpfr_cmp_f.
+------------------------------------------------------------------------
+r7105 | vlefevre | 2010-08-23 15:03:37 +0000 (Mon, 23 Aug 2010) | 5 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+
+[src/gmp_op.c] In mpfr_add_q / mpfr_sub_q, check with MPFR_ASSERTN
+that an internal overflow/underflow doesn't occur. In theory, such
+an exception is possible, but only if q has a huge numerator or
+denominator. This is not supported (note: other problems may occur
+first, such as insufficient memory).
+------------------------------------------------------------------------
+r7104 | vlefevre | 2010-08-23 14:46:44 +0000 (Mon, 23 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tests/tgmpop.c] Added overflow tests for mpfr_add_q / mpfr_sub_q.
+------------------------------------------------------------------------
+r7103 | vlefevre | 2010-08-23 14:03:07 +0000 (Mon, 23 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/tests.c
+
+[tests/{mpfr-test.h,tests.c}] Added flags_out function to output flags.
+------------------------------------------------------------------------
+r7102 | vlefevre | 2010-08-23 13:34:08 +0000 (Mon, 23 Aug 2010) | 3 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+[src/gmp_op.c] Extend the exponent range in mpfr_add_q / mpfr_sub_q
+ (overflow/underflow exceptions are not supported yet).
+[tests/tgmpop.c] Added corresponding testcases.
+------------------------------------------------------------------------
+r7101 | vlefevre | 2010-08-19 12:08:41 +0000 (Thu, 19 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+[src/gmp_op.c] Fixed the Inf +/- Inf cases for mpfr_add_q / mpfr_sub_q.
+[tests/tgmpop.c] Added Inf +/- Inf tests.
+------------------------------------------------------------------------
+r7100 | thevenyp | 2010-08-19 08:56:31 +0000 (Thu, 19 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tests/tgmpop.c] Fix rounding mode in overflow tests
+------------------------------------------------------------------------
+r7099 | vlefevre | 2010-08-19 01:26:16 +0000 (Thu, 19 Aug 2010) | 3 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+[src/gmp_op.c] The function mpfr_cmp_z could fail in a reduced
+exponent range.
+[tests/tgmpop.c] Added a corresponding testcase.
+------------------------------------------------------------------------
+r7098 | vlefevre | 2010-08-19 01:00:53 +0000 (Thu, 19 Aug 2010) | 3 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+[src/gmp_op.c] The functions mpfr_mul_z, mpfr_div_z, mpfr_add_z and
+mpfr_sub_z could fail in a reduced exponent range. Fixed.
+[tests/tgmpop.c] Added corresponding testcase.
+------------------------------------------------------------------------
+r7097 | vlefevre | 2010-08-18 21:19:07 +0000 (Wed, 18 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tests/tgmpop.c] Disabled buggy tests.
+------------------------------------------------------------------------
+r7096 | vlefevre | 2010-08-18 13:24:30 +0000 (Wed, 18 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+
+[src/gmp_op.c] Fixed the intermediate overflow case in mpfr_muldiv_z
+(for mpfr_mul_q and mpfr_div_q).
+------------------------------------------------------------------------
+r7095 | vlefevre | 2010-08-18 11:55:19 +0000 (Wed, 18 Aug 2010) | 5 lines
+Changed paths:
+ M /trunk/src/gmp_op.c
+
+[src/gmp_op.c] Added function mpfr_muldiv_z (currently static -- should
+it be in the API?) that computes y = RND(x*n/d), where n and d are mpz
+integers. Changed mpfr_mul_q and mpfr_div_q to use this function.
+Note: the code of the general case is currently the same as the old
+mpfr_mul_q/mpfr_div_q code, thus needs to be fixed.
+------------------------------------------------------------------------
+r7094 | vlefevre | 2010-08-18 08:59:58 +0000 (Wed, 18 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tests/tgmpop.c] Replaced GMP_RNDN by MPFR_RNDN.
+------------------------------------------------------------------------
+r7093 | vlefevre | 2010-08-18 08:29:03 +0000 (Wed, 18 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tests/tgmpop.c] Added testcase for mpfr_mul_q/mpfr_div_q bug noted
+in src/gmp_op.c (due to intermediate overflow).
+------------------------------------------------------------------------
+r7092 | vlefevre | 2010-08-17 15:32:53 +0000 (Tue, 17 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/src/logging.c
+
+[src/logging.c] Added a comment about register_printf_function.
+------------------------------------------------------------------------
+r7091 | vlefevre | 2010-08-17 12:45:22 +0000 (Tue, 17 Aug 2010) | 6 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/tools/ck-version-info
+
+Added tools/ck-version-info Perl script with the same license as
+Makefile.am, to check consistency concerning -version-info and
+that the -version-info value is up-to-date.
+Updated Makefile.am:
+ * In dist-hook, replaced complex sh code by a call to ck-version-info.
+ * Distribute ck-version-info (EXTRA_DIST).
+------------------------------------------------------------------------
+r7090 | vlefevre | 2010-08-17 12:30:02 +0000 (Tue, 17 Aug 2010) | 1 line
+Changed paths:
+ M /trunk
+ M /trunk/doc
+ M /trunk/src
+ M /trunk/tune
+
+Updated svn:ignore properties.
+------------------------------------------------------------------------
+r7089 | vlefevre | 2010-08-17 09:31:09 +0000 (Tue, 17 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Put tools/get_patches.sh back to EXTRA_DIST.
+------------------------------------------------------------------------
+r7088 | vlefevre | 2010-08-17 09:25:39 +0000 (Tue, 17 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/src/Makefile.am
+
+[src/Makefile.am] Fixed -version-info (I forgot to increment CURRENT).
+------------------------------------------------------------------------
+r7087 | vlefevre | 2010-08-17 09:10:13 +0000 (Tue, 17 Aug 2010) | 38 lines
+Changed paths:
+ D /trunk/FAQ.html
+ M /trunk/INSTALL
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/README
+ D /trunk/README.dev
+ M /trunk/TODO
+ D /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ D /trunk/acos.c
+ D /trunk/acosh.c
+ D /trunk/add.c
+ D /trunk/add1.c
+ D /trunk/add1sp.c
+ D /trunk/add_d.c
+ D /trunk/add_ui.c
+ D /trunk/agm.c
+ D /trunk/ai.c
+ D /trunk/algorithm2e.sty
+ D /trunk/algorithms.bib
+ D /trunk/algorithms.tex
+ D /trunk/asin.c
+ D /trunk/asinh.c
+ D /trunk/atan.c
+ D /trunk/atan2.c
+ D /trunk/atanh.c
+ D /trunk/bernoulli.c
+ D /trunk/bidimensional_sample.c
+ D /trunk/buildopt.c
+ D /trunk/cache.c
+ D /trunk/cbrt.c
+ D /trunk/check.c
+ D /trunk/check_inits_clears
+ D /trunk/clear.c
+ D /trunk/clears.c
+ D /trunk/cmp.c
+ D /trunk/cmp2.c
+ D /trunk/cmp_abs.c
+ D /trunk/cmp_d.c
+ D /trunk/cmp_ld.c
+ D /trunk/cmp_si.c
+ D /trunk/cmp_ui.c
+ D /trunk/comparisons.c
+ A /trunk/configure.ac (from /trunk/configure.in:7086)
+ D /trunk/configure.in
+ D /trunk/const_catalan.c
+ D /trunk/const_euler.c
+ D /trunk/const_log2.c
+ D /trunk/const_pi.c
+ D /trunk/constant.c
+ D /trunk/copysign.c
+ D /trunk/cos.c
+ D /trunk/cosh.c
+ D /trunk/cot.c
+ D /trunk/coth.c
+ D /trunk/coverage
+ D /trunk/cputime.h
+ D /trunk/csc.c
+ D /trunk/csch.c
+ D /trunk/d_div.c
+ D /trunk/d_sub.c
+ D /trunk/digamma.c
+ D /trunk/dim.c
+ D /trunk/div-short.c
+ D /trunk/div.c
+ D /trunk/div_2exp.c
+ D /trunk/div_2si.c
+ D /trunk/div_2ui.c
+ D /trunk/div_d.c
+ D /trunk/div_ui.c
+ A /trunk/doc
+ A /trunk/doc/FAQ.html (from /trunk/FAQ.html:7086)
+ A /trunk/doc/Makefile.am
+ A /trunk/doc/README.dev (from /trunk/README.dev:7086)
+ A /trunk/doc/algorithm2e.sty (from /trunk/algorithm2e.sty:7086)
+ A /trunk/doc/algorithms.bib (from /trunk/algorithms.bib:7086)
+ A /trunk/doc/algorithms.tex (from /trunk/algorithms.tex:7086)
+ A /trunk/doc/faq.xsl (from /trunk/faq.xsl:7086)
+ A /trunk/doc/fdl.texi (from /trunk/fdl.texi:7086)
+ A /trunk/doc/mpfr.texi (from /trunk/mpfr.texi:7086)
+ A /trunk/doc/update-faq (from /trunk/update-faq:7086)
+ D /trunk/dump.c
+ D /trunk/eint.c
+ D /trunk/eq.c
+ D /trunk/erf.c
+ D /trunk/erfc.c
+ D /trunk/exceptions.c
+ D /trunk/exp.c
+ D /trunk/exp10.c
+ D /trunk/exp2.c
+ D /trunk/exp3.c
+ D /trunk/exp_2.c
+ D /trunk/expm1.c
+ D /trunk/extract.c
+ D /trunk/factorial.c
+ D /trunk/faq.xsl
+ D /trunk/fdl.texi
+ D /trunk/fits_intmax.c
+ D /trunk/fits_s.h
+ D /trunk/fits_sint.c
+ D /trunk/fits_slong.c
+ D /trunk/fits_sshort.c
+ D /trunk/fits_u.h
+ D /trunk/fits_uint.c
+ D /trunk/fits_uintmax.c
+ D /trunk/fits_ulong.c
+ D /trunk/fits_ushort.c
+ D /trunk/fma.c
+ D /trunk/fms.c
+ D /trunk/frac.c
+ D /trunk/free_cache.c
+ D /trunk/gamma.c
+ D /trunk/gammaonethird.c
+ D /trunk/gen_inverse.h
+ D /trunk/get_d.c
+ D /trunk/get_d64.c
+ D /trunk/get_exp.c
+ D /trunk/get_f.c
+ D /trunk/get_flt.c
+ D /trunk/get_ld.c
+ D /trunk/get_patches.sh
+ D /trunk/get_si.c
+ D /trunk/get_sj.c
+ D /trunk/get_str.c
+ D /trunk/get_ui.c
+ D /trunk/get_uj.c
+ D /trunk/get_z.c
+ D /trunk/get_z_exp.c
+ D /trunk/gmp_op.c
+ D /trunk/hypot.c
+ D /trunk/ieee_floats.h
+ D /trunk/init.c
+ D /trunk/init2.c
+ D /trunk/inits.c
+ D /trunk/inits2.c
+ D /trunk/inp_str.c
+ D /trunk/int_ceil_log2.c
+ D /trunk/isinf.c
+ D /trunk/isinteger.c
+ D /trunk/isnan.c
+ D /trunk/isnum.c
+ D /trunk/isqrt.c
+ D /trunk/isregular.c
+ D /trunk/iszero.c
+ D /trunk/jn.c
+ D /trunk/jyn_asympt.c
+ D /trunk/li2.c
+ D /trunk/lngamma.c
+ D /trunk/log.c
+ D /trunk/log10.c
+ D /trunk/log1p.c
+ D /trunk/log2.c
+ D /trunk/logging.c
+ D /trunk/mbench
+ D /trunk/min_prec.c
+ D /trunk/minmax.c
+ D /trunk/modf.c
+ D /trunk/mp_clz_tab.c
+ D /trunk/mparam_h.in
+ D /trunk/mpf2mpfr.h
+ D /trunk/mpfr-gmp.c
+ D /trunk/mpfr-gmp.h
+ D /trunk/mpfr-impl.h
+ D /trunk/mpfr-longlong.h
+ D /trunk/mpfr-thread.h
+ D /trunk/mpfr.h
+ D /trunk/mpfr.texi
+ D /trunk/mpfrlint
+ D /trunk/mpn_exp.c
+ D /trunk/mul.c
+ D /trunk/mul_2exp.c
+ D /trunk/mul_2si.c
+ D /trunk/mul_2ui.c
+ D /trunk/mul_d.c
+ D /trunk/mul_ui.c
+ D /trunk/mulders.c
+ D /trunk/neg.c
+ D /trunk/next.c
+ D /trunk/nightly-test
+ A /trunk/other
+ A /trunk/other/cputime.h (from /trunk/cputime.h:7086)
+ A /trunk/other/div-short.c (from /trunk/div-short.c:7086)
+ D /trunk/out_str.c
+ D /trunk/pow.c
+ D /trunk/pow_si.c
+ D /trunk/pow_ui.c
+ D /trunk/pow_z.c
+ D /trunk/powerof2.c
+ D /trunk/print_raw.c
+ D /trunk/print_rnd_mode.c
+ D /trunk/printf.c
+ D /trunk/rec_sqrt.c
+ D /trunk/reldiff.c
+ D /trunk/rem1.c
+ D /trunk/replace_all
+ D /trunk/rint.c
+ D /trunk/root.c
+ D /trunk/round_near_x.c
+ D /trunk/round_p.c
+ D /trunk/round_prec.c
+ D /trunk/round_raw_generic.c
+ D /trunk/scale2.c
+ D /trunk/sec.c
+ D /trunk/sech.c
+ D /trunk/set.c
+ D /trunk/set_d.c
+ D /trunk/set_d64.c
+ D /trunk/set_dfl_prec.c
+ D /trunk/set_exp.c
+ D /trunk/set_f.c
+ D /trunk/set_flt.c
+ D /trunk/set_inf.c
+ D /trunk/set_ld.c
+ D /trunk/set_nan.c
+ D /trunk/set_prc_raw.c
+ D /trunk/set_prec.c
+ D /trunk/set_q.c
+ D /trunk/set_rnd.c
+ D /trunk/set_si.c
+ D /trunk/set_si_2exp.c
+ D /trunk/set_sj.c
+ D /trunk/set_str.c
+ D /trunk/set_str_raw.c
+ D /trunk/set_ui.c
+ D /trunk/set_ui_2exp.c
+ D /trunk/set_uj.c
+ D /trunk/set_z.c
+ D /trunk/set_z_exp.c
+ D /trunk/set_zero.c
+ D /trunk/setmax.c
+ D /trunk/setmin.c
+ D /trunk/setsign.c
+ D /trunk/sgn.c
+ D /trunk/si_op.c
+ D /trunk/signbit.c
+ D /trunk/sin.c
+ D /trunk/sin_cos.c
+ D /trunk/sinh.c
+ D /trunk/sinh_cosh.c
+ D /trunk/speed.c
+ D /trunk/sqr.c
+ D /trunk/sqrt.c
+ D /trunk/sqrt_ui.c
+ A /trunk/src
+ A /trunk/src/Makefile.am (from /trunk/Makefile.am:7086)
+ A /trunk/src/abort_prec_max.c (from /trunk/abort_prec_max.c:7086)
+ A /trunk/src/acos.c (from /trunk/acos.c:7086)
+ A /trunk/src/acosh.c (from /trunk/acosh.c:7086)
+ A /trunk/src/add.c (from /trunk/add.c:7086)
+ A /trunk/src/add1.c (from /trunk/add1.c:7086)
+ A /trunk/src/add1sp.c (from /trunk/add1sp.c:7086)
+ A /trunk/src/add_d.c (from /trunk/add_d.c:7086)
+ A /trunk/src/add_ui.c (from /trunk/add_ui.c:7086)
+ A /trunk/src/agm.c (from /trunk/agm.c:7086)
+ A /trunk/src/ai.c (from /trunk/ai.c:7086)
+ A /trunk/src/asin.c (from /trunk/asin.c:7086)
+ A /trunk/src/asinh.c (from /trunk/asinh.c:7086)
+ A /trunk/src/atan.c (from /trunk/atan.c:7086)
+ A /trunk/src/atan2.c (from /trunk/atan2.c:7086)
+ A /trunk/src/atanh.c (from /trunk/atanh.c:7086)
+ A /trunk/src/bernoulli.c (from /trunk/bernoulli.c:7086)
+ A /trunk/src/buildopt.c (from /trunk/buildopt.c:7086)
+ A /trunk/src/cache.c (from /trunk/cache.c:7086)
+ A /trunk/src/cbrt.c (from /trunk/cbrt.c:7086)
+ A /trunk/src/check.c (from /trunk/check.c:7086)
+ A /trunk/src/clear.c (from /trunk/clear.c:7086)
+ A /trunk/src/clears.c (from /trunk/clears.c:7086)
+ A /trunk/src/cmp.c (from /trunk/cmp.c:7086)
+ A /trunk/src/cmp2.c (from /trunk/cmp2.c:7086)
+ A /trunk/src/cmp_abs.c (from /trunk/cmp_abs.c:7086)
+ A /trunk/src/cmp_d.c (from /trunk/cmp_d.c:7086)
+ A /trunk/src/cmp_ld.c (from /trunk/cmp_ld.c:7086)
+ A /trunk/src/cmp_si.c (from /trunk/cmp_si.c:7086)
+ A /trunk/src/cmp_ui.c (from /trunk/cmp_ui.c:7086)
+ A /trunk/src/comparisons.c (from /trunk/comparisons.c:7086)
+ A /trunk/src/const_catalan.c (from /trunk/const_catalan.c:7086)
+ A /trunk/src/const_euler.c (from /trunk/const_euler.c:7086)
+ A /trunk/src/const_log2.c (from /trunk/const_log2.c:7086)
+ A /trunk/src/const_pi.c (from /trunk/const_pi.c:7086)
+ A /trunk/src/constant.c (from /trunk/constant.c:7086)
+ A /trunk/src/copysign.c (from /trunk/copysign.c:7086)
+ A /trunk/src/cos.c (from /trunk/cos.c:7086)
+ A /trunk/src/cosh.c (from /trunk/cosh.c:7086)
+ A /trunk/src/cot.c (from /trunk/cot.c:7086)
+ A /trunk/src/coth.c (from /trunk/coth.c:7086)
+ A /trunk/src/csc.c (from /trunk/csc.c:7086)
+ A /trunk/src/csch.c (from /trunk/csch.c:7086)
+ A /trunk/src/d_div.c (from /trunk/d_div.c:7086)
+ A /trunk/src/d_sub.c (from /trunk/d_sub.c:7086)
+ A /trunk/src/digamma.c (from /trunk/digamma.c:7086)
+ A /trunk/src/dim.c (from /trunk/dim.c:7086)
+ A /trunk/src/div.c (from /trunk/div.c:7086)
+ A /trunk/src/div_2exp.c (from /trunk/div_2exp.c:7086)
+ A /trunk/src/div_2si.c (from /trunk/div_2si.c:7086)
+ A /trunk/src/div_2ui.c (from /trunk/div_2ui.c:7086)
+ A /trunk/src/div_d.c (from /trunk/div_d.c:7086)
+ A /trunk/src/div_ui.c (from /trunk/div_ui.c:7086)
+ A /trunk/src/dump.c (from /trunk/dump.c:7086)
+ A /trunk/src/eint.c (from /trunk/eint.c:7086)
+ A /trunk/src/eq.c (from /trunk/eq.c:7086)
+ A /trunk/src/erf.c (from /trunk/erf.c:7086)
+ A /trunk/src/erfc.c (from /trunk/erfc.c:7086)
+ A /trunk/src/exceptions.c (from /trunk/exceptions.c:7086)
+ A /trunk/src/exp.c (from /trunk/exp.c:7086)
+ A /trunk/src/exp10.c (from /trunk/exp10.c:7086)
+ A /trunk/src/exp2.c (from /trunk/exp2.c:7086)
+ A /trunk/src/exp3.c (from /trunk/exp3.c:7086)
+ A /trunk/src/exp_2.c (from /trunk/exp_2.c:7086)
+ A /trunk/src/expm1.c (from /trunk/expm1.c:7086)
+ A /trunk/src/extract.c (from /trunk/extract.c:7086)
+ A /trunk/src/factorial.c (from /trunk/factorial.c:7086)
+ A /trunk/src/fits_intmax.c (from /trunk/fits_intmax.c:7086)
+ A /trunk/src/fits_s.h (from /trunk/fits_s.h:7086)
+ A /trunk/src/fits_sint.c (from /trunk/fits_sint.c:7086)
+ A /trunk/src/fits_slong.c (from /trunk/fits_slong.c:7086)
+ A /trunk/src/fits_sshort.c (from /trunk/fits_sshort.c:7086)
+ A /trunk/src/fits_u.h (from /trunk/fits_u.h:7086)
+ A /trunk/src/fits_uint.c (from /trunk/fits_uint.c:7086)
+ A /trunk/src/fits_uintmax.c (from /trunk/fits_uintmax.c:7086)
+ A /trunk/src/fits_ulong.c (from /trunk/fits_ulong.c:7086)
+ A /trunk/src/fits_ushort.c (from /trunk/fits_ushort.c:7086)
+ A /trunk/src/fma.c (from /trunk/fma.c:7086)
+ A /trunk/src/fms.c (from /trunk/fms.c:7086)
+ A /trunk/src/frac.c (from /trunk/frac.c:7086)
+ A /trunk/src/free_cache.c (from /trunk/free_cache.c:7086)
+ A /trunk/src/gamma.c (from /trunk/gamma.c:7086)
+ A /trunk/src/gammaonethird.c (from /trunk/gammaonethird.c:7086)
+ A /trunk/src/gen_inverse.h (from /trunk/gen_inverse.h:7086)
+ A /trunk/src/get_d.c (from /trunk/get_d.c:7086)
+ A /trunk/src/get_d64.c (from /trunk/get_d64.c:7086)
+ A /trunk/src/get_exp.c (from /trunk/get_exp.c:7086)
+ A /trunk/src/get_f.c (from /trunk/get_f.c:7086)
+ A /trunk/src/get_flt.c (from /trunk/get_flt.c:7086)
+ A /trunk/src/get_ld.c (from /trunk/get_ld.c:7086)
+ A /trunk/src/get_si.c (from /trunk/get_si.c:7086)
+ A /trunk/src/get_sj.c (from /trunk/get_sj.c:7086)
+ A /trunk/src/get_str.c (from /trunk/get_str.c:7086)
+ A /trunk/src/get_ui.c (from /trunk/get_ui.c:7086)
+ A /trunk/src/get_uj.c (from /trunk/get_uj.c:7086)
+ A /trunk/src/get_z.c (from /trunk/get_z.c:7086)
+ A /trunk/src/get_z_exp.c (from /trunk/get_z_exp.c:7086)
+ A /trunk/src/gmp_op.c (from /trunk/gmp_op.c:7086)
+ A /trunk/src/hypot.c (from /trunk/hypot.c:7086)
+ A /trunk/src/ieee_floats.h (from /trunk/ieee_floats.h:7086)
+ A /trunk/src/init.c (from /trunk/init.c:7086)
+ A /trunk/src/init2.c (from /trunk/init2.c:7086)
+ A /trunk/src/inits.c (from /trunk/inits.c:7086)
+ A /trunk/src/inits2.c (from /trunk/inits2.c:7086)
+ A /trunk/src/inp_str.c (from /trunk/inp_str.c:7086)
+ A /trunk/src/int_ceil_log2.c (from /trunk/int_ceil_log2.c:7086)
+ A /trunk/src/isinf.c (from /trunk/isinf.c:7086)
+ A /trunk/src/isinteger.c (from /trunk/isinteger.c:7086)
+ A /trunk/src/isnan.c (from /trunk/isnan.c:7086)
+ A /trunk/src/isnum.c (from /trunk/isnum.c:7086)
+ A /trunk/src/isqrt.c (from /trunk/isqrt.c:7086)
+ A /trunk/src/isregular.c (from /trunk/isregular.c:7086)
+ A /trunk/src/iszero.c (from /trunk/iszero.c:7086)
+ A /trunk/src/jn.c (from /trunk/jn.c:7086)
+ A /trunk/src/jyn_asympt.c (from /trunk/jyn_asympt.c:7086)
+ A /trunk/src/li2.c (from /trunk/li2.c:7086)
+ A /trunk/src/lngamma.c (from /trunk/lngamma.c:7086)
+ A /trunk/src/log.c (from /trunk/log.c:7086)
+ A /trunk/src/log10.c (from /trunk/log10.c:7086)
+ A /trunk/src/log1p.c (from /trunk/log1p.c:7086)
+ A /trunk/src/log2.c (from /trunk/log2.c:7086)
+ A /trunk/src/logging.c (from /trunk/logging.c:7086)
+ A /trunk/src/min_prec.c (from /trunk/min_prec.c:7086)
+ A /trunk/src/minmax.c (from /trunk/minmax.c:7086)
+ A /trunk/src/modf.c (from /trunk/modf.c:7086)
+ A /trunk/src/mp_clz_tab.c (from /trunk/mp_clz_tab.c:7086)
+ A /trunk/src/mparam_h.in (from /trunk/mparam_h.in:7086)
+ A /trunk/src/mpf2mpfr.h (from /trunk/mpf2mpfr.h:7086)
+ A /trunk/src/mpfr-gmp.c (from /trunk/mpfr-gmp.c:7086)
+ A /trunk/src/mpfr-gmp.h (from /trunk/mpfr-gmp.h:7086)
+ A /trunk/src/mpfr-impl.h (from /trunk/mpfr-impl.h:7086)
+ A /trunk/src/mpfr-longlong.h (from /trunk/mpfr-longlong.h:7086)
+ A /trunk/src/mpfr-thread.h (from /trunk/mpfr-thread.h:7086)
+ A /trunk/src/mpfr.h (from /trunk/mpfr.h:7086)
+ A /trunk/src/mpn_exp.c (from /trunk/mpn_exp.c:7086)
+ A /trunk/src/mul.c (from /trunk/mul.c:7086)
+ A /trunk/src/mul_2exp.c (from /trunk/mul_2exp.c:7086)
+ A /trunk/src/mul_2si.c (from /trunk/mul_2si.c:7086)
+ A /trunk/src/mul_2ui.c (from /trunk/mul_2ui.c:7086)
+ A /trunk/src/mul_d.c (from /trunk/mul_d.c:7086)
+ A /trunk/src/mul_ui.c (from /trunk/mul_ui.c:7086)
+ A /trunk/src/mulders.c (from /trunk/mulders.c:7086)
+ A /trunk/src/neg.c (from /trunk/neg.c:7086)
+ A /trunk/src/next.c (from /trunk/next.c:7086)
+ A /trunk/src/out_str.c (from /trunk/out_str.c:7086)
+ A /trunk/src/pow.c (from /trunk/pow.c:7086)
+ A /trunk/src/pow_si.c (from /trunk/pow_si.c:7086)
+ A /trunk/src/pow_ui.c (from /trunk/pow_ui.c:7086)
+ A /trunk/src/pow_z.c (from /trunk/pow_z.c:7086)
+ A /trunk/src/powerof2.c (from /trunk/powerof2.c:7086)
+ A /trunk/src/print_raw.c (from /trunk/print_raw.c:7086)
+ A /trunk/src/print_rnd_mode.c (from /trunk/print_rnd_mode.c:7086)
+ A /trunk/src/printf.c (from /trunk/printf.c:7086)
+ A /trunk/src/rec_sqrt.c (from /trunk/rec_sqrt.c:7086)
+ A /trunk/src/reldiff.c (from /trunk/reldiff.c:7086)
+ A /trunk/src/rem1.c (from /trunk/rem1.c:7086)
+ A /trunk/src/rint.c (from /trunk/rint.c:7086)
+ A /trunk/src/root.c (from /trunk/root.c:7086)
+ A /trunk/src/round_near_x.c (from /trunk/round_near_x.c:7086)
+ A /trunk/src/round_p.c (from /trunk/round_p.c:7086)
+ A /trunk/src/round_prec.c (from /trunk/round_prec.c:7086)
+ A /trunk/src/round_raw_generic.c (from /trunk/round_raw_generic.c:7086)
+ A /trunk/src/scale2.c (from /trunk/scale2.c:7086)
+ A /trunk/src/sec.c (from /trunk/sec.c:7086)
+ A /trunk/src/sech.c (from /trunk/sech.c:7086)
+ A /trunk/src/set.c (from /trunk/set.c:7086)
+ A /trunk/src/set_d.c (from /trunk/set_d.c:7086)
+ A /trunk/src/set_d64.c (from /trunk/set_d64.c:7086)
+ A /trunk/src/set_dfl_prec.c (from /trunk/set_dfl_prec.c:7086)
+ A /trunk/src/set_exp.c (from /trunk/set_exp.c:7086)
+ A /trunk/src/set_f.c (from /trunk/set_f.c:7086)
+ A /trunk/src/set_flt.c (from /trunk/set_flt.c:7086)
+ A /trunk/src/set_inf.c (from /trunk/set_inf.c:7086)
+ A /trunk/src/set_ld.c (from /trunk/set_ld.c:7086)
+ A /trunk/src/set_nan.c (from /trunk/set_nan.c:7086)
+ A /trunk/src/set_prc_raw.c (from /trunk/set_prc_raw.c:7086)
+ A /trunk/src/set_prec.c (from /trunk/set_prec.c:7086)
+ A /trunk/src/set_q.c (from /trunk/set_q.c:7086)
+ A /trunk/src/set_rnd.c (from /trunk/set_rnd.c:7086)
+ A /trunk/src/set_si.c (from /trunk/set_si.c:7086)
+ A /trunk/src/set_si_2exp.c (from /trunk/set_si_2exp.c:7086)
+ A /trunk/src/set_sj.c (from /trunk/set_sj.c:7086)
+ A /trunk/src/set_str.c (from /trunk/set_str.c:7086)
+ A /trunk/src/set_str_raw.c (from /trunk/set_str_raw.c:7086)
+ A /trunk/src/set_ui.c (from /trunk/set_ui.c:7086)
+ A /trunk/src/set_ui_2exp.c (from /trunk/set_ui_2exp.c:7086)
+ A /trunk/src/set_uj.c (from /trunk/set_uj.c:7086)
+ A /trunk/src/set_z.c (from /trunk/set_z.c:7086)
+ A /trunk/src/set_z_exp.c (from /trunk/set_z_exp.c:7086)
+ A /trunk/src/set_zero.c (from /trunk/set_zero.c:7086)
+ A /trunk/src/setmax.c (from /trunk/setmax.c:7086)
+ A /trunk/src/setmin.c (from /trunk/setmin.c:7086)
+ A /trunk/src/setsign.c (from /trunk/setsign.c:7086)
+ A /trunk/src/sgn.c (from /trunk/sgn.c:7086)
+ A /trunk/src/si_op.c (from /trunk/si_op.c:7086)
+ A /trunk/src/signbit.c (from /trunk/signbit.c:7086)
+ A /trunk/src/sin.c (from /trunk/sin.c:7086)
+ A /trunk/src/sin_cos.c (from /trunk/sin_cos.c:7086)
+ A /trunk/src/sinh.c (from /trunk/sinh.c:7086)
+ A /trunk/src/sinh_cosh.c (from /trunk/sinh_cosh.c:7086)
+ A /trunk/src/sqr.c (from /trunk/sqr.c:7086)
+ A /trunk/src/sqrt.c (from /trunk/sqrt.c:7086)
+ A /trunk/src/sqrt_ui.c (from /trunk/sqrt_ui.c:7086)
+ A /trunk/src/stack_interface.c (from /trunk/stack_interface.c:7086)
+ A /trunk/src/strtofr.c (from /trunk/strtofr.c:7086)
+ A /trunk/src/sub.c (from /trunk/sub.c:7086)
+ A /trunk/src/sub1.c (from /trunk/sub1.c:7086)
+ A /trunk/src/sub1sp.c (from /trunk/sub1sp.c:7086)
+ A /trunk/src/sub_d.c (from /trunk/sub_d.c:7086)
+ A /trunk/src/sub_ui.c (from /trunk/sub_ui.c:7086)
+ A /trunk/src/subnormal.c (from /trunk/subnormal.c:7086)
+ A /trunk/src/sum.c (from /trunk/sum.c:7086)
+ A /trunk/src/swap.c (from /trunk/swap.c:7086)
+ A /trunk/src/tan.c (from /trunk/tan.c:7086)
+ A /trunk/src/tanh.c (from /trunk/tanh.c:7086)
+ A /trunk/src/uceil_exp2.c (from /trunk/uceil_exp2.c:7086)
+ A /trunk/src/uceil_log2.c (from /trunk/uceil_log2.c:7086)
+ A /trunk/src/ufloor_log2.c (from /trunk/ufloor_log2.c:7086)
+ A /trunk/src/ui_div.c (from /trunk/ui_div.c:7086)
+ A /trunk/src/ui_pow.c (from /trunk/ui_pow.c:7086)
+ A /trunk/src/ui_pow_ui.c (from /trunk/ui_pow_ui.c:7086)
+ A /trunk/src/ui_sub.c (from /trunk/ui_sub.c:7086)
+ A /trunk/src/urandom.c (from /trunk/urandom.c:7086)
+ A /trunk/src/urandomb.c (from /trunk/urandomb.c:7086)
+ A /trunk/src/vasprintf.c (from /trunk/vasprintf.c:7086)
+ A /trunk/src/version.c (from /trunk/version.c:7086)
+ A /trunk/src/volatile.c (from /trunk/volatile.c:7086)
+ A /trunk/src/yn.c (from /trunk/yn.c:7086)
+ A /trunk/src/zeta.c (from /trunk/zeta.c:7086)
+ A /trunk/src/zeta_ui.c (from /trunk/zeta_ui.c:7086)
+ D /trunk/stack_interface.c
+ D /trunk/strtofr.c
+ D /trunk/sub.c
+ D /trunk/sub1.c
+ D /trunk/sub1sp.c
+ D /trunk/sub_d.c
+ D /trunk/sub_ui.c
+ D /trunk/subnormal.c
+ D /trunk/sum.c
+ D /trunk/swap.c
+ D /trunk/tan.c
+ D /trunk/tanh.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tools
+ A /trunk/tools/check_inits_clears (from /trunk/check_inits_clears:7086)
+ A /trunk/tools/coverage (from /trunk/coverage:7086)
+ A /trunk/tools/get_patches.sh (from /trunk/get_patches.sh:7086)
+ A /trunk/tools/mbench (from /trunk/mbench:7086)
+ A /trunk/tools/mpfrlint (from /trunk/mpfrlint:7086)
+ A /trunk/tools/nightly-test (from /trunk/nightly-test:7086)
+ A /trunk/tools/update-patchv (from /trunk/update-patchv:7086)
+ A /trunk/tools/update-version (from /trunk/update-version:7086)
+ A /trunk/tune
+ A /trunk/tune/Makefile.am
+ A /trunk/tune/bidimensional_sample.c (from /trunk/bidimensional_sample.c:7086)
+ A /trunk/tune/speed.c (from /trunk/speed.c:7086)
+ A /trunk/tune/tuneup.c (from /trunk/tuneup.c:7086)
+ D /trunk/tuneup.c
+ D /trunk/uceil_exp2.c
+ D /trunk/uceil_log2.c
+ D /trunk/ufloor_log2.c
+ D /trunk/ui_div.c
+ D /trunk/ui_pow.c
+ D /trunk/ui_pow_ui.c
+ D /trunk/ui_sub.c
+ D /trunk/update-faq
+ D /trunk/update-patchv
+ D /trunk/update-version
+ D /trunk/urandom.c
+ D /trunk/urandomb.c
+ D /trunk/vasprintf.c
+ D /trunk/version.c
+ D /trunk/volatile.c
+ D /trunk/yn.c
+ D /trunk/zeta.c
+ D /trunk/zeta_ui.c
+
+Source reorganization. In short:
+ * Added directories and moved related files into them:
+ - src for the MPFR source files (to build the library).
+ - doc for documentation files (except INSTALL, README...).
+ - tools for various tools (scripts) and mbench.
+ - tune for tuneup-related source files.
+ - other for other source files (not distributed in tarballs).
+ Existing directories:
+ - tests for the source files of the test suite (make check).
+ - examples for examples.
+ - m4 for m4 files.
+ * Renamed configure.in to configure.ac.
+ * Added/updated Makefile.am files where needed.
+ * Updated acinclude.m4 and configure.ac (AC_CONFIG_FILES line).
+ * Updated the documentation (INSTALL, README, doc/README.dev and
+ doc/mpfr.texi).
+ * Updated NEWS and TODO.
+ * Updated the scripts now in tools.
+
+The following script was used:
+
+#!/usr/bin/env zsh
+svn mkdir doc other src tools tune
+svn mv ${${(M)$(sed -n '/libmpfr_la_SOURCES/,/[^\]$/p' \
+ Makefile.am):#*.[ch]}:#get_patches.c} mparam_h.in \
+ round_raw_generic.c jyn_asympt.c src
+svn mv mbench check_inits_clears coverage get_patches.sh mpfrlint \
+ nightly-test update-patchv update-version tools
+svn mv bidimensional_sample.c speed.c tuneup.c tune
+svn mv *.{c,h} other
+svn mv FAQ.html README.dev algorithm* faq.xsl fdl.texi mpfr.texi \
+ update-faq doc
+svn mv configure.in configure.ac
+svn cp Makefile.am src/Makefile.am
+svn rm replace_all
+[Modifying some files, see above]
+svn add doc/Makefile.am
+svn add tune/Makefile.am
+------------------------------------------------------------------------
+r7086 | vlefevre | 2010-08-16 13:09:20 +0000 (Mon, 16 Aug 2010) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Updated -version-info (the interface hasn't really been
+changed yet -- though the future bug fix / rewrite of mpfr_mul_q and
+mpfr_div_q could be seen as an addition -- but this eases maintenance
+and avoids -version-info conflict with the 3.0 branch).
+------------------------------------------------------------------------
+r7085 | vlefevre | 2010-08-16 12:40:14 +0000 (Mon, 16 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/bidimensional_sample.c
+
+[bidimensional_sample.c] Added copyright notice.
+------------------------------------------------------------------------
+r7084 | vlefevre | 2010-08-16 12:37:37 +0000 (Mon, 16 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] Prototype clean-up.
+------------------------------------------------------------------------
+r7083 | vlefevre | 2010-08-16 09:21:21 +0000 (Mon, 16 Aug 2010) | 12 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/acinclude.m4
+ M /trunk/fits_intmax.c
+ M /trunk/fits_uintmax.c
+ M /trunk/get_sj.c
+ M /trunk/get_uj.c
+ M /trunk/m4/size_max.m4
+ M /trunk/set_sj.c
+ M /trunk/set_uj.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/vasprintf.c
+
+Avoid a compilation failure on OSF/1 (Tru64) 5.1 due to non-C99
+conformance though <inttypes.h> is available. In various source
+files and m4 files, use the following form only:
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+Updated README.dev to mention this form.
+------------------------------------------------------------------------
+r7078 | vlefevre | 2010-08-13 14:46:58 +0000 (Fri, 13 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/random2.c
+
+Deleted old svn:mergeinfo property on tests/random2.c
+------------------------------------------------------------------------
+r7077 | vlefevre | 2010-08-13 10:11:25 +0000 (Fri, 13 Aug 2010) | 10 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tzeta_ui.c
+
+[tests] Avoid warning due to -Wunused-but-set-variable (from future
+GCC 4.6). Only let the one from tsubnormal.c because it's a TODO.
+ * mpf_compat.h: use the variables, that are there for prototype
+ checking.
+ * tpow.c, tpow_z.c: test the ternary value.
+ * tremquo.c: removed inex variables (the bug due to the MPFR value).
+ * tset.c: test the ternary value.
+ * tset_ld.c: removed the long double variable (it cannot be tested
+ in a portable way and the bug was an assertion failure).
+ * tzeta_ui.c: removed the inexact variable (not really useful here).
+------------------------------------------------------------------------
+r7076 | vlefevre | 2010-08-13 09:44:19 +0000 (Fri, 13 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/get_f.c
+
+[get_f.c] Avoid warning due to -Wunused-but-set-variable (from
+future GCC 4.6).
+------------------------------------------------------------------------
+r7075 | vlefevre | 2010-08-13 09:41:27 +0000 (Fri, 13 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+[gamma.c] Avoid warning due to -Wunused-but-set-variable (from
+future GCC 4.6).
+------------------------------------------------------------------------
+r7074 | vlefevre | 2010-08-13 09:38:28 +0000 (Fri, 13 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+
+[gmp_op.c] Avoid warning due to -Wunused-but-set-variable (from
+future GCC 4.6).
+------------------------------------------------------------------------
+r7073 | vlefevre | 2010-08-13 09:32:58 +0000 (Fri, 13 Aug 2010) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] No longer define qn and sizer, which are no longer used since
+r6919. This was detected by gcc-snapshot (4.6.0 prerelease) under Debian
+(-Wunused-but-set-variable).
+------------------------------------------------------------------------
+r7072 | vlefevre | 2010-08-13 08:12:06 +0000 (Fri, 13 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Update.
+------------------------------------------------------------------------
+r7071 | vlefevre | 2010-08-13 08:11:16 +0000 (Fri, 13 Aug 2010) | 3 lines
+Changed paths:
+ M /trunk/ieee_floats.h
+
+[ieee_floats.h] Avoid breaking aliasing-rules when _GMP_IEEE_FLOATS is
+defined (e.g. with --with-gmp-build), by replacing a struct by a union
+like in r6381 for long double.
+------------------------------------------------------------------------
+r7070 | vlefevre | 2010-08-13 07:58:14 +0000 (Fri, 13 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] Removed useless slash.
+------------------------------------------------------------------------
+r7069 | vlefevre | 2010-08-12 14:28:59 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Prepare for new version.
+------------------------------------------------------------------------
+r7067 | vlefevre | 2010-08-12 14:13:48 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Removed obsolete paragraph about the old prepare script.
+------------------------------------------------------------------------
+r7066 | vlefevre | 2010-08-12 13:46:41 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/update-version
+
+[update-version] Detect errors.
+------------------------------------------------------------------------
+r7065 | vlefevre | 2010-08-12 10:51:17 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/FAQ.html
+
+Updated FAQ.html with update-faq.
+------------------------------------------------------------------------
+r7064 | vlefevre | 2010-08-12 10:50:56 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/faq.xsl
+
+[faq.xsl] Do not copy XML comments.
+------------------------------------------------------------------------
+r7063 | vlefevre | 2010-08-12 10:48:45 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/FAQ.html
+
+Updated FAQ.html with update-faq.
+------------------------------------------------------------------------
+r7059 | vlefevre | 2010-08-12 08:52:54 +0000 (Thu, 12 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] INRIAGforge -> INRIAGForge.
+------------------------------------------------------------------------
+r7058 | vlefevre | 2010-08-12 08:49:23 +0000 (Thu, 12 Aug 2010) | 5 lines
+Changed paths:
+ M /trunk/README
+
+[README] Update:
+ * InriaGforge -> INRIAGForge (official typography).
+ * Updated URL of the Subversion FAQ (now on apache.org).
+ * README.dev provided via SVN only.
+ * Removed the old note about the old CVS repository.
+------------------------------------------------------------------------
+r7057 | vlefevre | 2010-08-11 13:56:25 +0000 (Wed, 11 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/gmp_op.c
+
+[gmp_op.c] mpfr_mul_q and mpfr_div_q are still buggy; added comment.
+------------------------------------------------------------------------
+r7056 | vlefevre | 2010-08-11 13:39:05 +0000 (Wed, 11 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+[tests/tgmpop.c] Added missing "static".
+------------------------------------------------------------------------
+r7055 | thevenyp | 2010-08-11 10:48:45 +0000 (Wed, 11 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+gmp_op.c: Fix ternary value returned by mpfr_mul_q and mpfr_div_q in overflow cases.
+------------------------------------------------------------------------
+r7051 | vlefevre | 2010-08-04 23:51:21 +0000 (Wed, 04 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release" (test of FP division by 0).
+------------------------------------------------------------------------
+r7050 | vlefevre | 2010-08-04 23:45:25 +0000 (Wed, 04 Aug 2010) | 10 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_ld.c
+
+Support implementations where the floating-point division by 0 fails.
+ * acinclude.m4: added a test to check whether the FP division by 0
+ fails, and define MPFR_ERRDIVZERO in such a case.
+ * tests/tests.c: if MPFR_TEST_DIVBYZERO is defined, test whether
+ there has been a floating-point division by 0 (FE_DIVBYZERO or
+ FE_INVALID exception).
+ * tests/tgeneric.c: if MPFR_ERRDIVZERO is defined, disable the
+ huge and tiny cases.
+ * tests/t*_{flt,d,ld}.c: if MPFR_ERRDIVZERO is defined, disable
+ tests involving NaN and infinities.
+------------------------------------------------------------------------
+r7049 | vlefevre | 2010-08-04 22:09:17 +0000 (Wed, 04 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Update about the compilers.
+------------------------------------------------------------------------
+r7048 | vlefevre | 2010-08-04 14:50:54 +0000 (Wed, 04 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Mention clang.
+------------------------------------------------------------------------
+r7047 | vlefevre | 2010-08-04 14:25:17 +0000 (Wed, 04 Aug 2010) | 7 lines
+Changed paths:
+ M /trunk/get_sj.c
+
+[get_sj.c] Fixed bug found by John Regehr:
+https://gforge.inria.fr/tracker/index.php?func=detail&aid=10839&group_id=136&atid=619
+Note: the problem was an undefined behavior that could occur when
+sizeof(mp_limb_t) < sizeof(intmax_t) and |x| was small enough,
+because a right shift was >= the type width. However as the shifted
+value was 0, most platforms should not be affected by this bug. This
+problem was detected with clang -fcatch-undefined-ansic-behavior.
+------------------------------------------------------------------------
+r7046 | vlefevre | 2010-08-04 14:05:09 +0000 (Wed, 04 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tget_sj.c
+
+[tests/tget_sj.c] Added tests of 1 and -1.
+------------------------------------------------------------------------
+r7045 | vlefevre | 2010-08-04 13:35:48 +0000 (Wed, 04 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/get_sj.c
+
+[get_sj.c] Added assertions concerning
+https://gforge.inria.fr/tracker/?func=detail&atid=619&aid=10839&group_id=136
+------------------------------------------------------------------------
+r7044 | vlefevre | 2010-08-04 10:59:01 +0000 (Wed, 04 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] When logging is enabled, remove the possible -pedantic
+from GMP's CFLAGS to avoid warnings about C conformance.
+------------------------------------------------------------------------
+r7043 | vlefevre | 2010-08-04 10:17:14 +0000 (Wed, 04 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+[mpfr-impl.h] Reverse-merged changeset r7042. The code was not
+incorrect: the warning is due to the -pedantic from GMP's CFLAGS.
+------------------------------------------------------------------------
+r7042 | vlefevre | 2010-08-04 09:58:06 +0000 (Wed, 04 Aug 2010) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+[mpfr-impl.h] Correction to avoid GCC warnings
+ warning: invalid storage class for function 'x_f'
+ warning: invalid storage class for function '__mpfr_log_cleanup'
+when building MPFR with logging support.
+------------------------------------------------------------------------
+r7041 | vlefevre | 2010-08-03 15:16:22 +0000 (Tue, 03 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+[mpfrlint] Correction for the future MPFR source structure.
+------------------------------------------------------------------------
+r7040 | vlefevre | 2010-08-03 15:08:22 +0000 (Tue, 03 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+[mpfrlint] Execute check_inits_clears.
+------------------------------------------------------------------------
+r7039 | vlefevre | 2010-08-03 15:06:58 +0000 (Tue, 03 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/check_inits_clears
+
+[check_inits_clears] Correction.
+------------------------------------------------------------------------
+r7038 | vlefevre | 2010-08-02 15:07:51 +0000 (Mon, 02 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Moved ieee_floats.h from EXTRA_DIST to libmpfr_la_SOURCES.
+------------------------------------------------------------------------
+r7037 | vlefevre | 2010-08-02 15:03:24 +0000 (Mon, 02 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Clean-up: removed gen_inverse.h from EXTRA_DIST because
+it is already in libmpfr_la_SOURCES.
+------------------------------------------------------------------------
+r7036 | vlefevre | 2010-08-01 19:47:36 +0000 (Sun, 01 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] Removed the comment about the dependency bug.
+(svn merge -r7032:7031 mparam_h.in)
+------------------------------------------------------------------------
+r7033 | vlefevre | 2010-08-01 19:26:12 +0000 (Sun, 01 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Added "BUILT_SOURCES = mparam.h", fixing bug
+https://gforge.inria.fr/tracker/index.php?func=detail&aid=10810&group_id=136&atid=619
+------------------------------------------------------------------------
+r7032 | vlefevre | 2010-08-01 18:45:45 +0000 (Sun, 01 Aug 2010) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] Added a comment concerning the bug in the mparam.h dependency rule:
+https://gforge.inria.fr/tracker/index.php?func=detail&aid=10810&group_id=136&atid=619
+------------------------------------------------------------------------
+r7031 | vlefevre | 2010-08-01 18:39:52 +0000 (Sun, 01 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] Enable C mode for Emacs.
+------------------------------------------------------------------------
+r7030 | vlefevre | 2010-08-01 17:09:24 +0000 (Sun, 01 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] Deleted trailing whitespace.
+------------------------------------------------------------------------
+r7029 | vlefevre | 2010-08-01 17:08:36 +0000 (Sun, 01 Aug 2010) | 1 line
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] Bug fix: added a newline at the end of the file.
+------------------------------------------------------------------------
+r7026 | vlefevre | 2010-07-30 15:44:24 +0000 (Fri, 30 Jul 2010) | 4 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/INSTALL
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/README.dev
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/ai.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/bernoulli.c
+ M /trunk/buildopt.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/digamma.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erfc.c
+ M /trunk/examples/divworst.c
+ M /trunk/examples/rndo-add.c
+ M /trunk/examples/sample.c
+ M /trunk/examples/version.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gammaonethird.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_flt.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/ieee_floats.h
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/isregular.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/min_prec.c
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-thread.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/scale2.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_flt.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/set_z_exp.c
+ M /trunk/set_zero.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/digamma
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/random2.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tai.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdigamma.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmin_prec.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tset_z_exp.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstdint.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/turandom.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandom.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta_ui.c
+
+Replaced
+ Contributed by the Arenaire and Cacao projects
+by
+ Contributed by the Arenaire and Caramel projects
+------------------------------------------------------------------------
+r7024 | vlefevre | 2010-07-30 15:26:12 +0000 (Fri, 30 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/AUTHORS
+
+[AUTHORS] Updated a sentence.
+------------------------------------------------------------------------
+r7021 | vlefevre | 2010-07-30 09:36:55 +0000 (Fri, 30 Jul 2010) | 1 line
+Changed paths:
+ M /trunk
+
+Added configure.lineno (generated by configure) to svn:ignore property.
+------------------------------------------------------------------------
+r7016 | vlefevre | 2010-07-29 16:01:45 +0000 (Thu, 29 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] For announces, changed mpfr into mpfr-announce.
+------------------------------------------------------------------------
+r7014 | vlefevre | 2010-07-26 11:12:22 +0000 (Mon, 26 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] Replaced mp_exp_t by mpfr_exp_t.
+------------------------------------------------------------------------
+r7013 | vlefevre | 2010-07-25 19:31:31 +0000 (Sun, 25 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] Fixed several bugs in mpfr_ai.
+------------------------------------------------------------------------
+r7010 | schevill | 2010-07-20 13:18:42 +0000 (Tue, 20 Jul 2010) | 3 lines
+Changed paths:
+ M /trunk/bidimensional_sample.c
+
+Updated bidimensional_sample to take into account the fact the mpfr_ai1 and mpfr_ai2 are now statically defined.
+
+
+------------------------------------------------------------------------
+r7009 | schevill | 2010-07-20 12:49:26 +0000 (Tue, 20 Jul 2010) | 3 lines
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/mpfr.h
+
+mpfr_ai1 and mpfr_ai2 are now declared static. Only mpfr_ai is global.
+
+
+------------------------------------------------------------------------
+r7008 | schevill | 2010-07-20 12:38:44 +0000 (Tue, 20 Jul 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Forgot a declaration in the previous commit.
+
+
+------------------------------------------------------------------------
+r7007 | schevill | 2010-07-20 12:32:42 +0000 (Tue, 20 Jul 2010) | 9 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/ai.c
+ D /trunk/ai2.c
+ M /trunk/bidimensional_sample.c
+ M /trunk/mparam_h.in
+ M /trunk/mpfr-impl.h
+ M /trunk/tuneup.c
+
+Added automatic tuning of mpfr_ai.
+
+More precisely:
+* removed ai2.c: both implementations are now in the same file ai.c
+* added thresholds and automatic choice of the method to use in function of the thresholds.
+* added procedures for tuning functions like ai into tuneup.c
+* added a tuning procedure into tuneup.c
+
+
+------------------------------------------------------------------------
+r7005 | vlefevre | 2010-07-19 08:29:11 +0000 (Mon, 19 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tests/tget_flt.c] Fixed printf strings (missing backslash).
+------------------------------------------------------------------------
+r7004 | zimmerma | 2010-07-15 12:54:15 +0000 (Thu, 15 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tget_flt.c] completed previous commit
+
+------------------------------------------------------------------------
+r7003 | zimmerma | 2010-07-15 12:49:09 +0000 (Thu, 15 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tget_flt.c] print more information in case a test fails
+
+------------------------------------------------------------------------
+r6999 | vlefevre | 2010-07-09 23:59:50 +0000 (Fri, 09 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/gamma.c
+
+[gamma.c] Added an assert concerning the mpfr_exp_t size.
+------------------------------------------------------------------------
+r6998 | vlefevre | 2010-07-09 23:48:40 +0000 (Fri, 09 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+[tests/tgamma.c] Use mpfr_set_str instead of mpfr_set_d.
+------------------------------------------------------------------------
+r6997 | vlefevre | 2010-07-09 23:33:24 +0000 (Fri, 09 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] Untabified.
+------------------------------------------------------------------------
+r6996 | zimmerma | 2010-07-09 20:09:08 +0000 (Fri, 09 Jul 2010) | 6 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+[gamma.c] fixed bug reported on MPFR list:
+ https://sympa.inria.fr/sympa/arc/mpfr/2010-07/msg00001.html
+ In the underflow detection:
+ * we took log instead of log2
+ * at the end, we added the wrong terms
+
+------------------------------------------------------------------------
+r6995 | vlefevre | 2010-07-01 12:58:19 +0000 (Thu, 01 Jul 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+[mpfr-impl.h] Added a comment concerning the 'noreturn' property.
+------------------------------------------------------------------------
+r6994 | zimmerma | 2010-06-28 15:32:21 +0000 (Mon, 28 Jun 2010) | 6 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] added 3 more bits to initial working precision. On a sample of 20247
+ tests by Sylvain Chevillard with precisions in [50, 100], the number
+ of Ziv's failures decreased from 1184 to 144, which is less than 1%
+ (to reduce to zero, we would have to increase the number of extra
+ bits from 8 to 17).
+
+------------------------------------------------------------------------
+r6993 | vlefevre | 2010-06-28 13:10:28 +0000 (Mon, 28 Jun 2010) | 3 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+[round_prec.c] Applied a patch from Patrick Pélissier (with
+slightly modified comments) to make mpfr_prec_round compatible
+with non-mpfr_init allocation methods when no realloc is needed.
+------------------------------------------------------------------------
+r6989 | vlefevre | 2010-06-25 12:46:50 +0000 (Fri, 25 Jun 2010) | 4 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-gmp.h
+
+[acinclude.m4] Use AC_FUNC_ALLOCA to have HAVE_ALLOCA_H defined
+when available. This problem was introduced when AC_FUNC_ALLOCA
+was removed from configure.in in r6765. Note: building MPFR with
+--with-gmp-build is not affected as GMP's config.h is used.
+------------------------------------------------------------------------
+r6988 | vlefevre | 2010-06-25 11:44:00 +0000 (Fri, 25 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+[mpfr-gmp.h] Reverted incorrect changeset r6987 (see code about alloca).
+------------------------------------------------------------------------
+r6987 | zimmerma | 2010-06-25 10:00:44 +0000 (Fri, 25 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+[mpfr-gmp.h] include alloca.h
+
+------------------------------------------------------------------------
+r6986 | zimmerma | 2010-06-25 08:20:10 +0000 (Fri, 25 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] added comment about config.log
+
+------------------------------------------------------------------------
+r6985 | zimmerma | 2010-06-24 20:39:09 +0000 (Thu, 24 Jun 2010) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] fixed problem reported by Sylvain Chevillard for large x, where the
+ cancelled bits were counted twice
+
+------------------------------------------------------------------------
+r6983 | vlefevre | 2010-06-24 06:11:32 +0000 (Thu, 24 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+[tests/tfprintf.c] Cosmetic improvement suggested by Denis Excoffier.
+------------------------------------------------------------------------
+r6982 | vlefevre | 2010-06-23 13:47:19 +0000 (Wed, 23 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Minor change to match a filename on the website.
+------------------------------------------------------------------------
+r6979 | vlefevre | 2010-06-23 10:13:07 +0000 (Wed, 23 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+[tests/tout_str.c] Fixed bug introduced in r6976: changed size_t into
+unsigned int for printf (the size of unsigned int is sufficient here).
+------------------------------------------------------------------------
+r6978 | vlefevre | 2010-06-22 15:59:16 +0000 (Tue, 22 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/out_str.c
+
+[out_str.c] Handle the output errors.
+------------------------------------------------------------------------
+r6977 | vlefevre | 2010-06-22 15:27:34 +0000 (Tue, 22 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+[out_str.c] Handle output error in the special cases of mpfr_out_str
+(and use MPFR_IS_SINGULAR like in the other functions).
+------------------------------------------------------------------------
+r6976 | thevenyp | 2010-06-22 14:59:21 +0000 (Tue, 22 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/out_str.c
+ M /trunk/tests/tout_str.c
+
+Fix wrong return value of mpfr_out_str on special values.
+------------------------------------------------------------------------
+r6974 | vlefevre | 2010-06-22 13:24:56 +0000 (Tue, 22 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version to 3.1.0-dev.
+------------------------------------------------------------------------
+r6973 | vlefevre | 2010-06-22 13:23:33 +0000 (Tue, 22 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Added a paragraph about the precision, rounding mode and
+exponent types.
+------------------------------------------------------------------------
+r6972 | vlefevre | 2010-06-22 13:17:29 +0000 (Tue, 22 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/ai2.c
+ M /trunk/bidimensional_sample.c
+ M /trunk/gammaonethird.c
+ M /trunk/get_f.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfrlint
+
+In mpfrlint, detect the use of mp_exp_t and mp_prec_t.
+Fixed the files that were generating warnings.
+------------------------------------------------------------------------
+r6971 | schevill | 2010-06-22 13:12:09 +0000 (Tue, 22 Jun 2010) | 3 lines
+Changed paths:
+ M /trunk/ai2.c
+
+I forgot to replace one occurence of isqrt.
+
+
+------------------------------------------------------------------------
+r6968 | schevill | 2010-06-22 08:45:00 +0000 (Tue, 22 Jun 2010) | 4 lines
+Changed paths:
+ M /trunk/ai2.c
+
+Use of __gmpfr_isqrt instead of my own isqrt wrapper.
+
+
+
+------------------------------------------------------------------------
+r6967 | schevill | 2010-06-22 08:43:18 +0000 (Tue, 22 Jun 2010) | 6 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/bidimensional_sample.c
+
+Added a tool for nicely displaying which method is the best in function of x
+and prec when several method can be used for evaluating a given function f in x
+at precision prec.
+
+
+
+------------------------------------------------------------------------
+r6965 | vlefevre | 2010-06-21 12:32:44 +0000 (Mon, 21 Jun 2010) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Fixed dist-hook for -dev versions (I assumed that ||
+and && were right associative, while they are left associative).
+Thanks to Laurent Rineau for noticing this problem.
+------------------------------------------------------------------------
+r6964 | zimmerma | 2010-06-21 09:40:15 +0000 (Mon, 21 Jun 2010) | 9 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] fixed inefficiency for large x: the initial precision was too small,
+ which had the effect that the first Ziv iteration did fail with
+ non-negligible probability (problem reported by Sylvain Chevillard).
+ Also in case of 2 iterations or more the K variable was corrupted.
+Note (2012-03-03): huge inefficiency has been noticed when evaluating
+mpfr_exp on an argument close to log(2^n) in RNDU:
+ https://sympa.inria.fr/sympa/arc/mpfr/2012-03/msg00000.html
+One has an obvious hard-to-round case, meaning that several iterations
+are needed and that K is corrupted. This changeset fixes this bug.
+------------------------------------------------------------------------
+r6962 | zimmerma | 2010-06-15 21:14:08 +0000 (Tue, 15 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added note about problem with MSVC runtime (seems to be fixed)
+
+------------------------------------------------------------------------
+r6961 | zimmerma | 2010-06-15 20:46:21 +0000 (Tue, 15 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/mbench/Makefile
+
+[Makefile] alternate patch to r6959 from Patrick Pelissier
+
+------------------------------------------------------------------------
+r6960 | zimmerma | 2010-06-15 16:56:09 +0000 (Tue, 15 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] comments from Vincent Lefevre
+
+------------------------------------------------------------------------
+r6959 | zimmerma | 2010-06-15 12:14:12 +0000 (Tue, 15 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/mbench/Makefile
+ M /trunk/mbench/mfv5.h
+
+[mbench] fixes to make mbench work again (tested with GCC 4.4.3)
+
+------------------------------------------------------------------------
+r6958 | zimmerma | 2010-06-15 11:18:50 +0000 (Tue, 15 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] updated notes on Windows (contributed by Brian Gladman)
+
+------------------------------------------------------------------------
+r6955 | vlefevre | 2010-06-10 14:10:03 +0000 (Thu, 10 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] Reordered check_PROGRAMS.
+------------------------------------------------------------------------
+r6953 | vlefevre | 2010-06-10 11:49:55 +0000 (Thu, 10 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Untabified.
+------------------------------------------------------------------------
+r6951 | vlefevre | 2010-06-10 11:26:38 +0000 (Thu, 10 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/BUGS
+
+[BUGS] Update.
+------------------------------------------------------------------------
+r6943 | vlefevre | 2010-06-09 11:26:02 +0000 (Wed, 09 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Added a note on Mac OS X; thanks to FX Coudert and Fumihiro
+Chiba: https://sympa.inria.fr/sympa/arc/mpfr/2010-06/msg00011.html
+------------------------------------------------------------------------
+r6940 | vlefevre | 2010-06-08 16:17:48 +0000 (Tue, 08 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Update concerning CC/CFLAGS and the --with-gmp-build option.
+------------------------------------------------------------------------
+r6938 | vlefevre | 2010-06-07 08:20:58 +0000 (Mon, 07 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Added an item about the --with-gmp-build configure option and
+the use of GMP's internal header files.
+------------------------------------------------------------------------
+r6933 | vlefevre | 2010-06-06 11:21:26 +0000 (Sun, 06 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] Reverted incorrect optimization patch r6922 (added a comment).
+There were failures on 32-bit machines.
+------------------------------------------------------------------------
+r6932 | vlefevre | 2010-06-06 11:17:06 +0000 (Sun, 06 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+[mpfr-impl.h] Added log messages for the MPFR_GROUP_* macros.
+------------------------------------------------------------------------
+r6930 | vlefevre | 2010-06-06 10:16:01 +0000 (Sun, 06 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+[mpfrlint] Detect incorrect use of MPFR_LOG_MSG.
+------------------------------------------------------------------------
+r6929 | vlefevre | 2010-06-06 10:06:40 +0000 (Sun, 06 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/ai2.c
+
+[ai2.c] Fixed build failure with --enable-logging, due to incorrect
+MPFR_LOG_MSG usage (see README.dev).
+------------------------------------------------------------------------
+r6927 | vlefevre | 2010-06-06 10:00:50 +0000 (Sun, 06 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release".
+------------------------------------------------------------------------
+r6925 | vlefevre | 2010-06-06 09:47:32 +0000 (Sun, 06 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] Fixed build failure with --enable-logging, due to incorrect
+MPFR_LOG_MSG usage (see README.dev).
+------------------------------------------------------------------------
+r6922 | zimmerma | 2010-06-04 18:32:18 +0000 (Fri, 04 Jun 2010) | 9 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] speed improvement using MPFR_GROUP_* (from Patrick Pelissier):
+Pass 69
+ mpfr_add: 63 / 102.97 / 126
+ mpfr_exp: 430 / 11861.26 / 46588
+Was before we removed MY_MPZ_INIT:
+Pass 50
+ mpfr_add: 63 / 103.09 / 126
+ mpfr_exp: 430 / 10911.86 / 44215
+
+------------------------------------------------------------------------
+r6920 | vlefevre | 2010-06-04 08:37:54 +0000 (Fri, 04 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] Removed useless and possibly incorrect cast
+(in case -q doesn't necessarily fit in an int).
+------------------------------------------------------------------------
+r6919 | zimmerma | 2010-06-04 07:51:27 +0000 (Fri, 04 Jun 2010) | 14 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] got rid of MY_INIT_MPZ, small slowdown, but code should be more
+ robust. Below are timings from Patrick Pelissier with mbench:
+mpz_init:
+Pass 78
+ mpfr_add: 63 / 102.86 / 126
+ mpfr_exp: 441 / 12067.81 / 47355
+
+MY_MPZ_INIT
+Pass 50
+ mpfr_add: 63 / 103.09 / 126
+ mpfr_exp: 430 / 10911.86 / 44215
+
+Prec=53 bits (core 2 duo 64 bits)
+
+------------------------------------------------------------------------
+r6918 | zimmerma | 2010-06-03 16:18:31 +0000 (Thu, 03 Jun 2010) | 22 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] fixed problem reported by Sylvain Chevillard with following code
+ and MPFR_EXP_2_THRESHOLD=36 (valgrind complains).
+ It was due to the fact that GMP might allocate extra limbs,
+ see http://gmplib.org/list-archives/gmp-devel/2010-June/001577.html.
+ The fix is not optimal in the sense that GMP does not give a bound
+ on the allocated memory, thus we can only guess.
+
+#include "mpfr.h"
+int main(void) {
+ mpfr_t x,w;
+
+ mpfr_init2(x, 37);
+ mpfr_init2(w, 37);
+ mpfr_set_str(x, "-1.000001100100100001111110110101010001p+20", 2, MPFR_RNDN);
+ mpfr_exp (w, x, MPFR_RNDN);
+
+ mpfr_clear (w);
+ mpfr_clear (x);
+
+ return 0;
+}
+
+------------------------------------------------------------------------
+r6915 | vlefevre | 2010-06-03 15:07:52 +0000 (Thu, 03 Jun 2010) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Math library check: removed rule specific to HP-UX
+(only -lM was tested while this library may not be available; so,
+let's use the default rule as -lm works).
+------------------------------------------------------------------------
+r6912 | vlefevre | 2010-06-03 08:24:49 +0000 (Thu, 03 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Arenaire -> Arénaire.
+------------------------------------------------------------------------
+r6909 | vlefevre | 2010-06-02 11:02:34 +0000 (Wed, 02 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] 3.0 -> 3.0.0.
+------------------------------------------------------------------------
+r6907 | vlefevre | 2010-06-02 11:01:18 +0000 (Wed, 02 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Added test coverage for MPFR 3.0.0.
+------------------------------------------------------------------------
+r6904 | vlefevre | 2010-05-31 22:43:23 +0000 (Mon, 31 May 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Added missing blank lines (consistency).
+------------------------------------------------------------------------
+r6901 | vlefevre | 2010-05-31 22:27:56 +0000 (Mon, 31 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tset_z_exp.c
+
+[tests/tset_z_exp.c] Fixed type in a printf.
+------------------------------------------------------------------------
+r6900 | zimmerma | 2010-05-31 20:10:06 +0000 (Mon, 31 May 2010) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added instructions for "make tune"
+
+------------------------------------------------------------------------
+r6899 | zimmerma | 2010-05-31 20:01:03 +0000 (Mon, 31 May 2010) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] completed missing instructions for "make tune"
+
+------------------------------------------------------------------------
+r6898 | zimmerma | 2010-05-31 19:36:42 +0000 (Mon, 31 May 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_z_exp.c
+
+[tset_z_exp.c] fixed two FIXME
+
+------------------------------------------------------------------------
+r6897 | vlefevre | 2010-05-31 14:29:44 +0000 (Mon, 31 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tset_z_exp.c
+
+[tests/tset_z_exp.c] Added 2 FIXME in the test.
+------------------------------------------------------------------------
+r6896 | vlefevre | 2010-05-31 14:20:24 +0000 (Mon, 31 May 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_z_exp.c
+
+[tests/tset_z_exp.c] Removed testcase bug20100531 (this was a bug in
+the test, which didn't detect overflow cases due to too large random
+exponent).
+------------------------------------------------------------------------
+r6895 | vlefevre | 2010-05-31 14:12:27 +0000 (Mon, 31 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tset_z_exp.c
+
+[tests/tset_z_exp.c] Added testcase bug20100531.
+------------------------------------------------------------------------
+r6893 | vlefevre | 2010-05-31 13:44:36 +0000 (Mon, 31 May 2010) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+[mpfr.texi, NEWS] Update related to r6879: "Made defined the previously
+undefined cases of mpfr_get_si, mpfr_get_ui, mpfr_get_sj, mpfr_get_uj,
+mpfr_get_z and mpfr_get_z_2exp. In such cases, the erange flag is set.".
+------------------------------------------------------------------------
+r6892 | vlefevre | 2010-05-31 13:08:17 +0000 (Mon, 31 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Corrected mpfr_atan2 range (added in r6831).
+------------------------------------------------------------------------
+r6891 | vlefevre | 2010-05-28 15:07:49 +0000 (Fri, 28 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Made an example fit on 80 columns for the info manual.
+------------------------------------------------------------------------
+r6890 | vlefevre | 2010-05-28 14:29:08 +0000 (Fri, 28 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Changed some @math into @var in the mpfr_fmod description
+(for consistency).
+------------------------------------------------------------------------
+r6889 | vlefevre | 2010-05-28 10:54:55 +0000 (Fri, 28 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Corrected a paragraph.
+------------------------------------------------------------------------
+r6888 | vlefevre | 2010-05-28 10:33:21 +0000 (Fri, 28 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Added an example to get the MPFR version (and at the same
+time, check whether MPFR is already installed).
+------------------------------------------------------------------------
+r6886 | vlefevre | 2010-05-28 09:52:37 +0000 (Fri, 28 May 2010) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/examples/version.c
+
+Added examples/version.c (and updated Makefile.am).
+------------------------------------------------------------------------
+r6885 | vlefevre | 2010-05-28 09:25:36 +0000 (Fri, 28 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Correction (English usage).
+------------------------------------------------------------------------
+r6883 | vlefevre | 2010-05-28 08:16:16 +0000 (Fri, 28 May 2010) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Improved dist-hook rule.
+------------------------------------------------------------------------
+r6882 | thevenyp | 2010-05-27 09:14:02 +0000 (Thu, 27 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix typo.
+------------------------------------------------------------------------
+r6881 | zimmerma | 2010-05-26 19:39:02 +0000 (Wed, 26 May 2010) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] removed one item, added one
+
+------------------------------------------------------------------------
+r6880 | zimmerma | 2010-05-26 19:35:30 +0000 (Wed, 26 May 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] removed FIXME (resolved: Philippe confirmed that gmp_printf does
+ not work with mpf2mpfr.h)
+
+------------------------------------------------------------------------
+r6879 | vlefevre | 2010-05-25 16:19:48 +0000 (Tue, 25 May 2010) | 3 lines
+Changed paths:
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tset_si.c
+
+Made defined the previously undefined cases of mpfr_get_si, mpfr_get_ui,
+mpfr_get_sj, mpfr_get_uj, mpfr_get_z and mpfr_get_z_2exp. In such cases,
+the erange flag is set.
+------------------------------------------------------------------------
+r6878 | schevill | 2010-05-25 14:27:57 +0000 (Tue, 25 May 2010) | 3 lines
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+
+* 80 columns.
+
+
+------------------------------------------------------------------------
+r6877 | schevill | 2010-05-25 14:14:37 +0000 (Tue, 25 May 2010) | 3 lines
+Changed paths:
+ M /trunk/gammaonethird.c
+
+do ... while(0) style for macros.
+
+
+------------------------------------------------------------------------
+r6875 | vlefevre | 2010-05-25 13:20:34 +0000 (Tue, 25 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Correction.
+------------------------------------------------------------------------
+r6873 | vlefevre | 2010-05-25 11:05:42 +0000 (Tue, 25 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Minor changes.
+------------------------------------------------------------------------
+r6872 | vlefevre | 2010-05-25 10:43:08 +0000 (Tue, 25 May 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] Reverted incorrect changeset r6870.
+------------------------------------------------------------------------
+r6871 | vlefevre | 2010-05-25 10:41:44 +0000 (Tue, 25 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Added a comment about non-ASCII characters.
+------------------------------------------------------------------------
+r6870 | thevenyp | 2010-05-25 10:38:51 +0000 (Tue, 25 May 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/mpfr.texi
+
+More explicit documentation on the use of specifiers in printf function.
+------------------------------------------------------------------------
+r6869 | vlefevre | 2010-05-25 10:34:07 +0000 (Tue, 25 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Encoding correction for ±.
+------------------------------------------------------------------------
+r6868 | vlefevre | 2010-05-25 10:26:12 +0000 (Tue, 25 May 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+[NEWS, mpfr.texi] mpfr_custom_get_mantissa was renamed to
+mpfr_custom_get_significand.
+------------------------------------------------------------------------
+r6867 | vlefevre | 2010-05-25 10:15:30 +0000 (Tue, 25 May 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tstckintc.c
+
+[tests/tstckintc.c] Changed mpfr_custom_get_mantissa into
+mpfr_custom_get_significand (but mpfr_custom_get_mantissa
+was still working thanks to the #define).
+------------------------------------------------------------------------
+r6866 | vlefevre | 2010-05-25 10:13:26 +0000 (Tue, 25 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/stack_interface.c
+
+[mpfr.h, stack_interface.c] Changed mpfr_custom_get_mantissa into
+mpfr_custom_get_significand (r6862 was incomplete).
+------------------------------------------------------------------------
+r6865 | vlefevre | 2010-05-25 09:29:40 +0000 (Tue, 25 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+[mpfr.h] <stdint.h> support: also test _STDINT (for MS Visual Studio).
+Thanks to Brian Gladman for the information.
+------------------------------------------------------------------------
+r6863 | vlefevre | 2010-05-25 07:24:18 +0000 (Tue, 25 May 2010) | 3 lines
+Changed paths:
+ M /trunk/buildopt.c
+ M /trunk/mpfrlint
+
+[buildopt.c] Missing #include "mpfr-impl.h" for cygwin builds.
+[mpfrlint] Detect such errors (mpfr-impl.h may be needed because it
+ includes config.h when there is one).
+------------------------------------------------------------------------
+r6862 | zimmerma | 2010-05-24 16:56:52 +0000 (Mon, 24 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+[mpfr.texi] more changes after answers by Vincent to my questions
+
+------------------------------------------------------------------------
+r6860 | vlefevre | 2010-05-24 10:54:03 +0000 (Mon, 24 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Reformat / fixed typography.
+------------------------------------------------------------------------
+r6855 | vlefevre | 2010-05-24 00:01:40 +0000 (Mon, 24 May 2010) | 6 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+[sub1sp.c] Fixed a problem that appeared after mpfr_prec_t has been
+made signed. It was visible on PowerPC (tested on Linux 32 bits and
+on Mac OS X 32 & 64 bits), but could potentially affect any platform
+as a negative shift count was generated. As the faulty expressions
+were in a MPFR_ASSERTD, the failure could occur only when assertion
+checking had been enabled.
+------------------------------------------------------------------------
+r6852 | vlefevre | 2010-05-22 23:08:17 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Removed trailing spaces.
+------------------------------------------------------------------------
+r6851 | vlefevre | 2010-05-22 23:06:49 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Added information about intmax_t and corresponding macros.
+------------------------------------------------------------------------
+r6849 | vlefevre | 2010-05-22 22:42:05 +0000 (Sat, 22 May 2010) | 6 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/fits_intmax.c
+ M /trunk/fits_uintmax.c
+ M /trunk/get_sj.c
+ M /trunk/get_uj.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tset_sj.c
+
+Detect when the intmax_t type is available but INTMAX_MAX doesn't work
+(e.g. with gcc -ansi -pedantic-errors in 32-bit mode under GNU/Linux).
+New macros MPFR_UINTMAX_MAX, MPFR_INTMAX_MAX and MPFR_INTMAX_MIN are
+defined and used internally instead of UINTMAX_MAX, INTMAX_MAX and
+INTMAX_MIN. If these C99 macros work, then the MPFR_* macros use them,
+otherwise MPFR uses its own definitions.
+------------------------------------------------------------------------
+r6846 | vlefevre | 2010-05-22 19:41:07 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/gammaonethird.c
+ M /trunk/mpfr-impl.h
+
+mpfr_div_ui8 and mpfr_mul_ui5 didn't have to be exported.
+------------------------------------------------------------------------
+r6845 | vlefevre | 2010-05-22 19:33:22 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+ M /trunk/bernoulli.c
+ M /trunk/buildopt.c
+ M /trunk/digamma.c
+ M /trunk/gammaonethird.c
+ M /trunk/get_flt.c
+ M /trunk/ieee_floats.h
+ M /trunk/isregular.c
+ M /trunk/mbench/mfv5.h
+ M /trunk/mbench/timp.h
+ M /trunk/min_prec.c
+ M /trunk/scale2.c
+ M /trunk/set_flt.c
+ M /trunk/set_z_exp.c
+ M /trunk/set_zero.c
+ M /trunk/speed.c
+ M /trunk/tests/tai.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tdigamma.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tmin_prec.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tset_z_exp.c
+ M /trunk/tests/tstdint.c
+
+Updated Subversion properties.
+------------------------------------------------------------------------
+r6844 | vlefevre | 2010-05-22 19:13:37 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai2.c
+
+[ai2.c] GNU style.
+------------------------------------------------------------------------
+r6843 | vlefevre | 2010-05-22 16:04:13 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai2.c
+
+[ai2.c] Style correction (necessary for ansi2knr, if still useful).
+------------------------------------------------------------------------
+r6842 | vlefevre | 2010-05-22 13:55:22 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+
+[ai.c, ai2.c] Untabified / removed trailing spaces.
+------------------------------------------------------------------------
+r6841 | vlefevre | 2010-05-22 13:53:19 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] GNU style.
+------------------------------------------------------------------------
+r6840 | vlefevre | 2010-05-22 10:21:11 +0000 (Sat, 22 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Corrected the paragraph about whether MPFR is installed.
+------------------------------------------------------------------------
+r6839 | vlefevre | 2010-05-22 00:12:31 +0000 (Sat, 22 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Corrections and answers to PZ comments from r6831.
+The document encoding is now UTF-8.
+------------------------------------------------------------------------
+r6838 | vlefevre | 2010-05-21 21:06:07 +0000 (Fri, 21 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] n-char-sequence was changed into n-char-sequence-opt
+in r6132, but I forgot to update all the occurrences.
+------------------------------------------------------------------------
+r6837 | schevill | 2010-05-21 09:47:13 +0000 (Fri, 21 May 2010) | 5 lines
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+
+* Removed double precision numbers.
+* Handle +0 and -0 the same way.
+* Use MPFR_GET_EXP in ai2.c
+
+
+------------------------------------------------------------------------
+r6836 | schevill | 2010-05-20 14:19:47 +0000 (Thu, 20 May 2010) | 3 lines
+Changed paths:
+ M /trunk/ai.c
+
+* Corrected a bug when x=0 (MPFR_GET_EXP requires to assert that x!=0).
+
+
+------------------------------------------------------------------------
+r6835 | schevill | 2010-05-20 13:34:26 +0000 (Thu, 20 May 2010) | 3 lines
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+ M /trunk/gammaonethird.c
+ M /trunk/mpfr-impl.h
+
+Corrected some warnings.
+
+
+------------------------------------------------------------------------
+r6834 | schevill | 2010-05-20 12:39:34 +0000 (Thu, 20 May 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Corrected an error that prevented the doc from compiling.
+
+
+------------------------------------------------------------------------
+r6833 | vlefevre | 2010-05-20 09:47:02 +0000 (Thu, 20 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: corrections.
+------------------------------------------------------------------------
+r6832 | zimmerma | 2010-05-20 09:35:06 +0000 (Thu, 20 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] explain why mpfr_sum uses an array of pointers to mpfr_t
+
+------------------------------------------------------------------------
+r6831 | zimmerma | 2010-05-20 09:10:47 +0000 (Thu, 20 May 2010) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/fdl.texi
+ M /trunk/mpfr.texi
+
+[mpfr.texi] changes after a complete reading of the documentation.
+ There are some issues left that I don't know how to solve,
+ they are marked with @c PZ in mpfr.texi.
+
+------------------------------------------------------------------------
+r6829 | vlefevre | 2010-05-19 23:07:54 +0000 (Wed, 19 May 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+[mpfr.texi, NEWS] Noted that the mpfr_ai implementation is incomplete
+and experimental.
+------------------------------------------------------------------------
+r6827 | vlefevre | 2010-05-19 23:04:40 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] Use MPFR_IS_SINGULAR. Added a FIXME comment for Ai(0).
+------------------------------------------------------------------------
+r6825 | vlefevre | 2010-05-19 22:41:29 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/turandom.c
+
+Type corrections for C++ compilers (in particular, mpfr_rnd_t vs int).
+------------------------------------------------------------------------
+r6822 | vlefevre | 2010-05-19 14:30:02 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+
+[ai.c] Fixed possible problem in reduced exponent range.
+------------------------------------------------------------------------
+r6821 | vlefevre | 2010-05-19 14:25:02 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+
+Removed trailing spaces.
+------------------------------------------------------------------------
+r6820 | schevill | 2010-05-19 13:48:46 +0000 (Wed, 19 May 2010) | 4 lines
+Changed paths:
+ M /trunk/ai.c
+ M /trunk/ai2.c
+ M /trunk/gammaonethird.c
+
+* Removed some warnings.
+* More conform to GNU coding standards.
+
+
+------------------------------------------------------------------------
+r6818 | vlefevre | 2010-05-19 13:09:29 +0000 (Wed, 19 May 2010) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ D /trunk/patch-aclocal-icc
+
+Removed obsolete patch-aclocal-icc and updated README.dev (about
+"To make a release").
+------------------------------------------------------------------------
+r6813 | vlefevre | 2010-05-19 12:38:01 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] Added a comment concerning -version-info and MPFR 3.0.x.
+------------------------------------------------------------------------
+r6812 | vlefevre | 2010-05-19 11:53:33 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v".
+------------------------------------------------------------------------
+r6811 | vlefevre | 2010-05-19 10:18:37 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Preliminary interfaces are no longer preliminary.
+------------------------------------------------------------------------
+r6810 | vlefevre | 2010-05-19 10:13:39 +0000 (Wed, 19 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] API Compatibility: mention the detection of the availability
+of intmax_t with C++ compilers.
+------------------------------------------------------------------------
+r6809 | vlefevre | 2010-05-19 09:07:33 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] signness -> signedness (thanks to Philippe).
+------------------------------------------------------------------------
+r6808 | vlefevre | 2010-05-19 00:11:39 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Missing @code.
+------------------------------------------------------------------------
+r6807 | vlefevre | 2010-05-19 00:09:11 +0000 (Wed, 19 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Corrected C terminology (table -> array).
+------------------------------------------------------------------------
+r6806 | vlefevre | 2010-05-18 14:40:36 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+[mpfr.texi, NEWS] Mention that mpfr_ai is a new function in MPFR 3.0.
+------------------------------------------------------------------------
+r6805 | vlefevre | 2010-05-18 14:36:05 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ D /trunk/prepare
+
+Removed obsolete prepare script (autoreconf does the same thing).
+------------------------------------------------------------------------
+r6804 | schevill | 2010-05-18 14:34:57 +0000 (Tue, 18 May 2010) | 21 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/ai.c
+ A /trunk/ai2.c
+ A /trunk/gammaonethird.c
+ M /trunk/mpfr.h
+
+* I added a new implementation of Airy Ai. This implementation uses Smith's
+algorithm.
+Currently, it is provided as a separate implementation mpfr_ai2.
+
+* Please note that both mpfr_ai and mpfr_ai2 need to efficiently evaluate
+Gamma(1/3) and Gamma(2/3). This is provided by functions in the file
+gammaonethird.c
+
+* There is no test file for mpfr_ai2 since it should quickly disappear behind
+a single implementation using the best of mpfr_ai and mpfr_ai2.
+However, if necessary, a test file can be obtained by copying tai.c and
+replacing mpfr_ai by mpfr_ai2 everywhere.
+
+* I do not know if gammaonethird.c will remain like that in the future. Should
+we make this implementation available as a public MPFR function? In this case,
+I have to write a wrapper for providing a correctly rounded implementation.
+Moreover, it contains functions that could be interesting for the
+implementation of other functions (the functions mpfr_div_ui*). Maybe, it
+could be worth providing a file specially for this purpose.
+
+
+------------------------------------------------------------------------
+r6803 | vlefevre | 2010-05-18 14:32:07 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Added release name.
+------------------------------------------------------------------------
+r6802 | vlefevre | 2010-05-18 14:30:38 +0000 (Tue, 18 May 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] Updated "Changes from versions 2.3.* to version 2.4.0"
+from MPFR 2.4.2.
+------------------------------------------------------------------------
+r6801 | vlefevre | 2010-05-18 14:25:20 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Completed Section 6.1 "Type and Macro Changes".
+------------------------------------------------------------------------
+r6800 | vlefevre | 2010-05-18 14:07:26 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Updated Section 6.1 "Type and Macro Changes".
+------------------------------------------------------------------------
+r6799 | vlefevre | 2010-05-18 13:57:03 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Missing space.
+------------------------------------------------------------------------
+r6798 | vlefevre | 2010-05-18 13:54:47 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Updated Section 6.1 "Type and Macro Changes".
+------------------------------------------------------------------------
+r6797 | vlefevre | 2010-05-18 13:53:06 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] A bit less ambiguous...
+------------------------------------------------------------------------
+r6796 | vlefevre | 2010-05-18 13:12:49 +0000 (Tue, 18 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] More details for mp_rnd_t/mpfr_rnd_t, like mp_prec_t/mpfr_prec_t.
+------------------------------------------------------------------------
+r6795 | vlefevre | 2010-05-17 15:51:28 +0000 (Mon, 17 May 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+Added "API Compatibility" section to the MPFR manual.
+TODO: Section 6.1 "Type and Macro Changes".
+------------------------------------------------------------------------
+r6794 | vlefevre | 2010-05-17 13:31:19 +0000 (Mon, 17 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] mpfr_strtofr now accepts bases from 37 to 62 (r5965).
+------------------------------------------------------------------------
+r6793 | vlefevre | 2010-05-10 09:25:01 +0000 (Mon, 10 May 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: updated section about MS Windows.
+------------------------------------------------------------------------
+r6792 | vlefevre | 2010-05-10 09:05:12 +0000 (Mon, 10 May 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: updated section about MS Windows.
+------------------------------------------------------------------------
+r6791 | vlefevre | 2010-05-08 17:17:18 +0000 (Sat, 08 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tests.c
+
+[tests/tests.c] Fixed code when _MPFR_PREC_FORMAT != 3.
+------------------------------------------------------------------------
+r6790 | zimmerma | 2010-05-08 08:01:05 +0000 (Sat, 08 May 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+[tests/tests.c] fixed compiler warning (found by nightly tests)
+
+------------------------------------------------------------------------
+r6789 | vlefevre | 2010-05-07 15:13:02 +0000 (Fri, 07 May 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/README.dev
+ M /trunk/TODO
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/ai.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/cmp.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_euler.c
+ M /trunk/cos.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/digamma.c
+ M /trunk/div.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/gamma.c
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_flt.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/isinteger.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/mbench/mfv5.cc
+ M /trunk/mbench/mpfr-v6.c
+ M /trunk/modf.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_z.c
+ M /trunk/print_raw.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/set_d.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_ld.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_z_exp.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tanh.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/random2.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tset_z_exp.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/turandom.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/urandom.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+
+New exponent type mpfr_exp_t for MPFR (replacing GMP's mp_exp_t).
+------------------------------------------------------------------------
+r6788 | vlefevre | 2010-05-07 14:18:54 +0000 (Fri, 07 May 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] Updated a paragraph concerning signed and unsigned types.
+------------------------------------------------------------------------
+r6787 | vlefevre | 2010-05-07 13:57:28 +0000 (Fri, 07 May 2010) | 12 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/tests/tcheck.c
+
+Changed the precision type mpfr_prec_t from an unsigned integer type
+into the corresponding signed integer type, in order to avoid problems
+due to the usual arithmetic conversions when mixing mpfr_prec_t and
+mp_exp_t in an expression.
+* NEWS: mentioned this change.
+* mpfr-impl.h: removed MPFR_INTPREC_MAX (which wasn't used) and updated
+ the MPFR_UNSIGNED_MINUS_MODULO(S,A) macro, which assumed that A was
+ unsigned; this macro now works even when A is signed.
+* mpfr.h: added mpfr_uprec_t; updated mpfr_prec_t and MPFR_PREC_MAX.
+* tests/tcheck.c: disabled a test on MPFR_PREC_MAX+1 with MPFR >= 3
+ (this test doesn't work with a signed mpfr_prec_t and isn't needed).
+Note: all tests pass under GNU Linux x86 and x86_64.
+------------------------------------------------------------------------
+r6786 | vlefevre | 2010-05-07 12:36:55 +0000 (Fri, 07 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tcheck.c
+
+[tests/tcheck.c] Forgot to remove a printf (added during testing).
+------------------------------------------------------------------------
+r6785 | vlefevre | 2010-05-07 12:33:57 +0000 (Fri, 07 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tcheck.c
+
+[tests/tcheck.c] Support signed mpfr_prec_t (avoid integer overflow).
+------------------------------------------------------------------------
+r6784 | vlefevre | 2010-05-07 12:31:53 +0000 (Fri, 07 May 2010) | 1 line
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+
+[tests/mpf_compat.h] Fixed prototype of function main.
+------------------------------------------------------------------------
+r6783 | vlefevre | 2010-05-07 12:23:22 +0000 (Fri, 07 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+[mpfr.h] Added a comment concerning the definition of MPFR_PREC_MAX.
+------------------------------------------------------------------------
+r6782 | vlefevre | 2010-05-06 10:10:52 +0000 (Thu, 06 May 2010) | 2 lines
+Changed paths:
+ M /trunk/print_rnd_mode.c
+
+print_rnd_mode.c: added an assertion so that we do not forget to update
+this file after a new rounding mode is added.
+------------------------------------------------------------------------
+r6780 | vlefevre | 2010-05-03 14:26:06 +0000 (Mon, 03 May 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Added a paragraph about multiple inclusions of mpfr.h and/or
+gmp.h header files.
+------------------------------------------------------------------------
+r6779 | thevenyp | 2010-05-03 14:19:20 +0000 (Mon, 03 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update documentation for mpfr_print_rnd_mode.
+------------------------------------------------------------------------
+r6778 | vlefevre | 2010-05-03 13:15:15 +0000 (Mon, 03 May 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+To avoid breaking the ABI when faithful rounding gets implemented, added
+MPFR_RNDF to the mpfr_rnd_t enum type now, and removed MPFR_RND_MAX from
+the enumeration (it is now defined as a macro in mpfr-impl.h).
+------------------------------------------------------------------------
+r6777 | vlefevre | 2010-05-03 12:52:28 +0000 (Mon, 03 May 2010) | 1 line
+Changed paths:
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+
+fits_* (signed version): corrections and optimizations.
+------------------------------------------------------------------------
+r6776 | vlefevre | 2010-05-03 12:30:46 +0000 (Mon, 03 May 2010) | 5 lines
+Changed paths:
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+
+[fits_uintmax.c, fits_u.h] Some casts could be incorrect in the case
+mp_exp_t > mpfr_prec_t. Set prec to the int type since in practice,
+prec will be small enough to fit in an int. The fact that prec is now
+signed allows us to remove a useless test (also note that prec should
+be computed at compile time, so that this should be at least as fast).
+------------------------------------------------------------------------
+r6775 | vlefevre | 2010-05-03 12:04:56 +0000 (Mon, 03 May 2010) | 1 line
+Changed paths:
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+
+[fits_uintmax.c, fits_u.h] Comments: doesn't -> don't
+------------------------------------------------------------------------
+r6774 | vlefevre | 2010-05-03 11:10:41 +0000 (Mon, 03 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6773 | thevenyp | 2010-05-03 09:20:38 +0000 (Mon, 03 May 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+Add specifier 'Y' for the rounding away from zero mode in printf-like functions.
+------------------------------------------------------------------------
+r6772 | zimmerma | 2010-04-30 16:10:44 +0000 (Fri, 30 Apr 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] removed obsolete mpfr_round_prec
+
+------------------------------------------------------------------------
+r6770 | vlefevre | 2010-04-30 15:57:34 +0000 (Fri, 30 Apr 2010) | 1 line
+Changed paths:
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+
+[fits_intmax.c,fits_s.h] Added FIXME comments.
+------------------------------------------------------------------------
+r6769 | vlefevre | 2010-04-30 15:50:27 +0000 (Fri, 30 Apr 2010) | 2 lines
+Changed paths:
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+
+Optimized fits_u.h and made fits_uintmax.c like fits_u.h for the
+special numbers.
+------------------------------------------------------------------------
+r6768 | vlefevre | 2010-04-30 15:44:39 +0000 (Fri, 30 Apr 2010) | 1 line
+Changed paths:
+ M /trunk/fits_uintmax.c
+
+Optimized mpfr_fits_uintmax_p.
+------------------------------------------------------------------------
+r6767 | vlefevre | 2010-04-30 14:37:47 +0000 (Fri, 30 Apr 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/README.dev
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/cmp2.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/digamma.c
+ M /trunk/eint.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/examples/rndo-add.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_f.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init2.c
+ M /trunk/inits2.c
+ M /trunk/isinteger.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/mbench/mpfr-gfx.c
+ M /trunk/mbench/mpfr-v4.c
+ M /trunk/mbench/mpfr-v6.c
+ M /trunk/modf.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/print_raw.c
+ M /trunk/rec_sqrt.c
+ M /trunk/root.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_z_exp.c
+ M /trunk/setmax.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/turandom.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tuneup.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/urandom.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Changed mp_prec_t into mpfr_prec_t.
+------------------------------------------------------------------------
+r6766 | vlefevre | 2010-04-19 14:35:35 +0000 (Mon, 19 Apr 2010) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] r6765 introduced non-POSIX syntax. Fixed.
+------------------------------------------------------------------------
+r6765 | zimmerma | 2010-04-19 11:26:12 +0000 (Mon, 19 Apr 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] check for GMP internal files only with --with-gmp-build
+
+------------------------------------------------------------------------
+r6764 | vlefevre | 2010-04-12 00:11:48 +0000 (Mon, 12 Apr 2010) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] New function mpfr_regular_p (was added in r6417, 2009-09-14).
+------------------------------------------------------------------------
+r6762 | vlefevre | 2010-04-07 02:15:06 +0000 (Wed, 07 Apr 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+[mpfr-gmp.h] Fixed alloca prototype (bug detected by tcc 0.9.25
+under Linux/x86_64).
+------------------------------------------------------------------------
+r6753 | vlefevre | 2010-03-24 12:45:47 +0000 (Wed, 24 Mar 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Improved/corrected the documentation of functions
+mpfr_lgamma, mpfr_digamma, mpfr_j0/j1/jn, mpfr_y0/y1/yn, mpfr_agm,
+mpfr_hypot and mpfr_min_prec.
+------------------------------------------------------------------------
+r6752 | vlefevre | 2010-03-24 12:24:28 +0000 (Wed, 24 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Removed a "currently" that is no longer needed.
+------------------------------------------------------------------------
+r6751 | vlefevre | 2010-03-24 12:20:41 +0000 (Wed, 24 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Updated description of mpfr_atan2, now that IEEE 754-2008
+has been published and follows the same conventions as C99 for atan2.
+------------------------------------------------------------------------
+r6750 | vlefevre | 2010-03-24 12:12:00 +0000 (Wed, 24 Mar 2010) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Updated description of mpfr_pow, now that IEEE 754-2008
+has been published and follows the same conventions as C99 for pow.
+(IEEE 754-2008 doesn't currently specify pow(±inf,non-zero), but
+I've suggested a correction for the errata page.)
+------------------------------------------------------------------------
+r6747 | vlefevre | 2010-03-23 15:28:41 +0000 (Tue, 23 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Improved documentation of mpfr_print_rnd_mode (from a
+suggestion by Chris Saunders).
+------------------------------------------------------------------------
+r6746 | vlefevre | 2010-03-22 10:59:28 +0000 (Mon, 22 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Various corrections and other improvements.
+------------------------------------------------------------------------
+r6745 | vlefevre | 2010-03-22 10:38:59 +0000 (Mon, 22 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Improved the documentation of mpfr_dim too.
+------------------------------------------------------------------------
+r6744 | zimmerma | 2010-03-22 10:04:29 +0000 (Mon, 22 Mar 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] improved the documentation of mpfr_rec_sqrt and mpfr_cbrt
+ (thanks Vincent)
+
+------------------------------------------------------------------------
+r6743 | zimmerma | 2010-03-22 09:30:44 +0000 (Mon, 22 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] improved documentation of mpfr_sqrt and mpfr_sqrt_ui
+
+------------------------------------------------------------------------
+r6741 | vlefevre | 2010-03-21 18:17:12 +0000 (Sun, 21 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+[mpfr.h] Added a comment about integer overflows in macros.
+------------------------------------------------------------------------
+r6740 | zimmerma | 2010-03-19 14:48:17 +0000 (Fri, 19 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tai.c
+
+[tai.c] enable first test of check_large, and reduced total time
+
+------------------------------------------------------------------------
+r6739 | schevill | 2010-03-19 14:15:23 +0000 (Fri, 19 Mar 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added a mention about the current limitation of mpfr_ai in mpfr.texi.
+
+
+------------------------------------------------------------------------
+r6738 | schevill | 2010-03-19 13:43:13 +0000 (Fri, 19 Mar 2010) | 6 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/tests/tai.c
+
+Removed check of ai.c for large arguments. I added in algorithms.tex a
+mention about the fact that mpfr_ai is currently not made for large
+arguments.
+
+
+
+------------------------------------------------------------------------
+r6737 | schevill | 2010-03-19 12:16:12 +0000 (Fri, 19 Mar 2010) | 3 lines
+Changed paths:
+ M /trunk/ai.c
+
+* Corrected problems regarding the GNU recommendations for formatting source code.
+
+
+------------------------------------------------------------------------
+r6735 | vlefevre | 2010-03-18 12:55:37 +0000 (Thu, 18 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: added tai to the svn:ignore property.
+------------------------------------------------------------------------
+r6734 | zimmerma | 2010-03-18 12:37:13 +0000 (Thu, 18 Mar 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tai.c
+
+[tai.c] reduce the maximal exponents in test_generic()
+ also reduce the number of random tests to decrease the test time
+
+------------------------------------------------------------------------
+r6733 | vlefevre | 2010-03-18 12:26:19 +0000 (Thu, 18 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: in the tests, use mpfr_equal_p rather than mpfr_cmp.
+------------------------------------------------------------------------
+r6732 | zimmerma | 2010-03-18 12:23:43 +0000 (Thu, 18 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tai.c
+
+[tai.c] replace mpfr_cmp by mpfr_equal_p
+
+------------------------------------------------------------------------
+r6731 | vlefevre | 2010-03-18 12:11:29 +0000 (Thu, 18 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tset_z_exp.c
+
+tests/tset_z_exp.c untabified.
+------------------------------------------------------------------------
+r6730 | vlefevre | 2010-03-18 12:11:13 +0000 (Thu, 18 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: removed trailing whitespace.
+------------------------------------------------------------------------
+r6729 | vlefevre | 2010-03-18 11:59:57 +0000 (Thu, 18 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6728 | vlefevre | 2010-03-18 11:54:24 +0000 (Thu, 18 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/AUTHORS
+
+Untabified AUTHORS (consistency).
+------------------------------------------------------------------------
+r6727 | schevill | 2010-03-18 11:50:39 +0000 (Thu, 18 Mar 2010) | 4 lines
+Changed paths:
+ M /trunk/ai.c
+
+* Corrected problems regarding the GNU recommendations for formatting source code.
+* Corrected the date of the copyright.
+
+
+------------------------------------------------------------------------
+r6726 | zimmerma | 2010-03-18 09:50:20 +0000 (Thu, 18 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tai.c
+
+[tai.c] added test for large inputs
+
+------------------------------------------------------------------------
+r6725 | zimmerma | 2010-03-18 09:22:02 +0000 (Thu, 18 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+[AUTHORS] added Sylvain Chevillard
+
+------------------------------------------------------------------------
+r6724 | zimmerma | 2010-03-17 21:12:09 +0000 (Wed, 17 Mar 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] added Sylvain as contributor
+
+------------------------------------------------------------------------
+r6723 | schevill | 2010-03-17 17:35:59 +0000 (Wed, 17 Mar 2010) | 18 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/README.dev
+ A /trunk/ai.c
+ A /trunk/algorithm2e.sty
+ M /trunk/algorithms.tex
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tai.c
+
+* Added function mpfr_ai. The implementation is the most naive: it evaluates
+ the series step by step until it can stop.
+ A special strategy is used to detect possible problems when Ai(x) is very
+ close to 0.
+
+* Updated algorithms.tex with the technical description of the implementation
+ of mpfr_ai.
+
+* Added algorithm2e.sty and algorithm2e-compatibility.sty (necessary to
+ compile algorithms.tex now).
+
+* Updated mpfr.texi to let it know this new function.
+
+* Added a basic test file for mpfr_ai. I will add other test cases later.
+
+* Added a small HOWTO to README.dev about how to add a new test file for new
+ functions.
+
+------------------------------------------------------------------------
+r6720 | vlefevre | 2010-03-11 09:43:53 +0000 (Thu, 11 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+GMP_RNDx -> MPFR_RNDx
+------------------------------------------------------------------------
+r6719 | zimmerma | 2010-03-11 09:24:00 +0000 (Thu, 11 Mar 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+[tstrtofr.c] added test for 1.23e, cf
+ http://gmplib.org/list-archives/gmp-bugs/2010-March/001898.html
+
+------------------------------------------------------------------------
+r6718 | vlefevre | 2010-03-11 01:02:58 +0000 (Thu, 11 Mar 2010) | 4 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+[tests/tsqrt.c] Add the test -1 <= x/sqrt(x^2) <= 1, which corresponds
+to -1 <= x/sqrt(x^2+y^2) <= 1 with y = 0. I don't think the test with
+random y is still necessary, though, since even a bad sqrt accuracy
+would not be detected.
+------------------------------------------------------------------------
+r6717 | vlefevre | 2010-03-10 10:07:46 +0000 (Wed, 10 Mar 2010) | 1 line
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+[tests/tsqrt.c] Added a comment about the x/sqrt(x^2+y^2) test.
+------------------------------------------------------------------------
+r6716 | zimmerma | 2010-03-10 09:00:47 +0000 (Wed, 10 Mar 2010) | 4 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+[tsqrt.c] fixed bug reported by Sam Rawlins
+ (https://sympa.inria.fr/sympa/arc/mpfr/2010-03/msg00007.html)
+Note: this "bug" had no noticeable consequences; this can just be seen
+as an incomplete test.
+------------------------------------------------------------------------
+r6715 | zimmerma | 2010-02-26 08:27:10 +0000 (Fri, 26 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] added item
+
+------------------------------------------------------------------------
+r6714 | zimmerma | 2010-02-24 15:49:04 +0000 (Wed, 24 Feb 2010) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] now also recognize "IEEE double, little endian" long-double
+ format (not tested, should happen on ARM)
+
+------------------------------------------------------------------------
+r6713 | zimmerma | 2010-02-24 15:07:39 +0000 (Wed, 24 Feb 2010) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] added recognition of "IEEE double big endian" long double format
+ (tested on gcc40.fsffrance.org and gcc53, both PowerPC's)
+
+------------------------------------------------------------------------
+r6712 | vlefevre | 2010-02-24 12:59:19 +0000 (Wed, 24 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] Added test for long double = double-double (GCC/PowerPC).
+This test cannot currently be reliable, so we just output a warning.
+------------------------------------------------------------------------
+r6711 | zimmerma | 2010-02-23 16:39:02 +0000 (Tue, 23 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] minor grammar fix
+
+------------------------------------------------------------------------
+r6710 | zimmerma | 2010-02-23 16:27:08 +0000 (Tue, 23 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] be more precise about API compatibility
+
+------------------------------------------------------------------------
+r6709 | zimmerma | 2010-02-23 15:54:30 +0000 (Tue, 23 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.h
+
+[mpfr.h] added #define mpfr_get_z_exp mpfr_get_z_2exp for compatibility
+
+------------------------------------------------------------------------
+r6708 | vlefevre | 2010-02-23 01:35:39 +0000 (Tue, 23 Feb 2010) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: added tset_z_exp to the svn:ignore property.
+------------------------------------------------------------------------
+r6707 | zimmerma | 2010-02-22 17:23:27 +0000 (Mon, 22 Feb 2010) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/atan.c
+ M /trunk/cbrt.c
+ M /trunk/cos.c
+ M /trunk/eint.c
+ M /trunk/exp_2.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/pow.c
+ M /trunk/rem1.c
+ M /trunk/root.c
+ M /trunk/set_z.c
+ M /trunk/set_z_exp.c
+ M /trunk/sin_cos.c
+ M /trunk/tests/tset_z_exp.c
+
+changed mpfr_get_z_exp -> mpfr_get_z_2exp (old function)
+ mpfr_set_z_exp -> mpfr_set_z_2exp (new function)
+
+------------------------------------------------------------------------
+r6706 | zimmerma | 2010-02-22 15:45:30 +0000 (Mon, 22 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_z.c
+ A /trunk/set_z_exp.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tset_z_exp.c
+
+added new function mpfr_set_z_exp (companion to mpfr_get_z_exp)
+
+------------------------------------------------------------------------
+r6705 | vlefevre | 2010-02-18 17:05:48 +0000 (Thu, 18 Feb 2010) | 6 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/tests
+ A /trunk/tests/tstdint.c
+
+* Added tests/tstdint.c to test the double inclusion of mpfr.h when only
+ the second occurrence needs <stdint.h> (this can happen when one uses
+ several libraries that use MPFR under different conditions).
+* Added tstdint to the svn:ignore property of "tests".
+* TODO: mentions that tstdint should be added to check_PROGRAMS in
+ the tests/Makefile.am file once this is fixed.
+------------------------------------------------------------------------
+r6701 | vlefevre | 2010-02-18 02:02:55 +0000 (Thu, 18 Feb 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated Section "Internals".
+------------------------------------------------------------------------
+r6700 | vlefevre | 2010-02-16 17:43:28 +0000 (Tue, 16 Feb 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6699 | vlefevre | 2010-02-16 17:02:40 +0000 (Tue, 16 Feb 2010) | 5 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+mpfr.h: disable the INTMAX_C / UINTMAX_C test with C++ compilers as it
+doesn't work well in this case (e.g. possible failure with Boost); see
+ https://sympa.inria.fr/sympa/arc/mpfr/2010-02/msg00025.html
+and the whole discussion.
+mpfr.texi: update.
+------------------------------------------------------------------------
+r6696 | zimmerma | 2010-02-05 07:13:10 +0000 (Fri, 05 Feb 2010) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] removed check for C++ and Fortran compiler (comment said to
+ remove it for libtool >= 2.0)
+
+------------------------------------------------------------------------
+r6695 | zimmerma | 2010-02-01 09:25:46 +0000 (Mon, 01 Feb 2010) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] dummy change to check if we still get commit mails
+
+------------------------------------------------------------------------
+r6694 | zimmerma | 2010-01-29 13:44:58 +0000 (Fri, 29 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] added note about mpfr_set_str
+
+------------------------------------------------------------------------
+r6691 | vlefevre | 2010-01-25 10:54:30 +0000 (Mon, 25 Jan 2010) | 3 lines
+Changed paths:
+ M /trunk/get_patches.sh
+
+Simplified get_patches.sh; minor consequence: the trailing space in
+the string returned by mpfr_get_patches() when there are patches is
+no longer present (this trailing space wasn't desired anyway).
+------------------------------------------------------------------------
+r6687 | vlefevre | 2010-01-25 00:33:37 +0000 (Mon, 25 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: updated message for different gmp.h and libgmp versions.
+See <https://sympa.inria.fr/sympa/arc/mpfr/2010-01/msg00051.html>.
+------------------------------------------------------------------------
+r6686 | vlefevre | 2010-01-20 12:09:45 +0000 (Wed, 20 Jan 2010) | 6 lines
+Changed paths:
+ M /trunk/FAQ.html
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/faq.xsl
+
+FAQ.html, faq.xsl, README, TODO: slightly changed the copyright notice
+to make it consistent with the one of the other files. In short, "and
+the GNU General Public License" has been removed, but it was ambiguous
+(we did not say which version of the GNU GPL) and useless (for GPLv3)
+because the LGPLv3 is compatible with the GPLv3:
+ http://www.fsf.org/licensing/licenses/gpl-faq.html#WhatDoesCompatMean
+------------------------------------------------------------------------
+r6685 | vlefevre | 2010-01-20 11:56:23 +0000 (Wed, 20 Jan 2010) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL:
+ * added copyright notice (at the top, like GMP);
+ * replaced "Installing MPFR" by "Installing GNU MPFR".
+------------------------------------------------------------------------
+r6684 | vlefevre | 2010-01-20 11:48:25 +0000 (Wed, 20 Jan 2010) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/bernoulli.c
+ M /trunk/buildopt.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/digamma.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/examples/divworst.c
+ M /trunk/examples/rndo-add.c
+ M /trunk/examples/sample.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_flt.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/ieee_floats.h
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/isregular.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/min_prec.c
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-longlong.h
+ M /trunk/mpfr-thread.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/scale2.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_flt.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/set_zero.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/digamma
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/random2.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdigamma.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_flt.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmin_prec.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/turandom.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandom.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Copyright notice update: added 2010 with
+ perl -pi -e 's/2009 Free Software/2009, 2010 Free Software/' **/*(^/)
+under zsh, reverting the ChangeLog file and the mbench directory.
+------------------------------------------------------------------------
+r6683 | vlefevre | 2010-01-20 11:35:49 +0000 (Wed, 20 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: added turandom to the svn:ignore property.
+------------------------------------------------------------------------
+r6682 | vlefevre | 2010-01-20 11:33:30 +0000 (Wed, 20 Jan 2010) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: updated paragraphs about the search paths (in particular,
+--with-gmp=/usr/local is no longer chosen as an example as it does
+not work as expected; a note has been added about that).
+------------------------------------------------------------------------
+r6681 | vlefevre | 2010-01-20 09:57:24 +0000 (Wed, 20 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: rewrote a paragraph about search paths.
+------------------------------------------------------------------------
+r6680 | thevenyp | 2010-01-18 18:30:44 +0000 (Mon, 18 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Fix case emin > 0.
+------------------------------------------------------------------------
+r6679 | zimmerma | 2010-01-18 15:28:50 +0000 (Mon, 18 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added more details for random distribution functions
+
+------------------------------------------------------------------------
+r6678 | zimmerma | 2010-01-18 14:30:15 +0000 (Mon, 18 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+[tprintf.c, tfprintf.c] cleaned up previous commit
+
+------------------------------------------------------------------------
+r6677 | vlefevre | 2010-01-18 13:50:17 +0000 (Mon, 18 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/tests/turandom.c
+
+tests/turandom.c: updated a test (if emin > 1 and rnd == MPFR_RNDN,
+then the result is necessarily 0).
+------------------------------------------------------------------------
+r6676 | vlefevre | 2010-01-18 13:39:17 +0000 (Mon, 18 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/tests/turandom.c
+
+tests/turandom.c: more tests in restricted exponent range.
+------------------------------------------------------------------------
+r6675 | vlefevre | 2010-01-18 13:27:04 +0000 (Mon, 18 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+urandom.c: corrected a comment.
+------------------------------------------------------------------------
+r6674 | zimmerma | 2010-01-18 12:37:30 +0000 (Mon, 18 Jan 2010) | 3 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+[tprintf.c,tfprintf.c] print obtained chain in test #8
+ (https://sympa.inria.fr/sympa/arc/mpfr/2009-12/msg00035.html)
+
+------------------------------------------------------------------------
+r6673 | thevenyp | 2010-01-18 09:48:47 +0000 (Mon, 18 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Fix bug in setting random exponent.
+------------------------------------------------------------------------
+r6672 | vlefevre | 2010-01-16 10:13:53 +0000 (Sat, 16 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+urandom.c: added a FIXME comment.
+------------------------------------------------------------------------
+r6671 | vlefevre | 2010-01-15 17:11:08 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+urandom.c: removed unused variable k; updated a comment.
+------------------------------------------------------------------------
+r6670 | thevenyp | 2010-01-15 16:38:11 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Improve generation of random exponent.
+------------------------------------------------------------------------
+r6669 | thevenyp | 2010-01-15 16:36:42 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Fix bug introduced in r6667.
+------------------------------------------------------------------------
+r6668 | zimmerma | 2010-01-15 15:17:18 +0000 (Fri, 15 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added item
+
+------------------------------------------------------------------------
+r6667 | thevenyp | 2010-01-15 14:25:06 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Fix case nextabove(0) in reduced exponent range.
+------------------------------------------------------------------------
+r6666 | thevenyp | 2010-01-15 10:06:20 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/tests/turandom.c
+
+[tests/turandom.c] Change accumulation of ternary value in the loop, it was not portable in system with sign and magnitude representation for integers.
+------------------------------------------------------------------------
+r6665 | thevenyp | 2010-01-15 09:51:31 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Move generation of a random rounding bit in a separate function.
+------------------------------------------------------------------------
+r6664 | thevenyp | 2010-01-15 09:49:14 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Remove trailing whitespace.
+------------------------------------------------------------------------
+r6663 | thevenyp | 2010-01-15 09:32:43 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+[urandom.c] Call mpfr_nextabove in maximum exponent range.
+------------------------------------------------------------------------
+r6662 | vlefevre | 2010-01-15 04:21:01 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+urandom.c: added a FIXME so that it is not forgotten.
+------------------------------------------------------------------------
+r6661 | vlefevre | 2010-01-15 02:01:52 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6659 | vlefevre | 2010-01-15 01:57:05 +0000 (Fri, 15 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: require bash.
+------------------------------------------------------------------------
+r6658 | vlefevre | 2010-01-14 16:03:37 +0000 (Thu, 14 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/urandom.c
+
+urandom.c: clean-up (avoid a useless goto).
+------------------------------------------------------------------------
+r6657 | vlefevre | 2010-01-14 15:22:37 +0000 (Thu, 14 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a paragraph (use MPFR_ASSERTN, not printf + exit).
+------------------------------------------------------------------------
+r6656 | thevenyp | 2010-01-14 12:16:15 +0000 (Thu, 14 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Cosmetic change.
+------------------------------------------------------------------------
+r6655 | thevenyp | 2010-01-14 11:55:05 +0000 (Thu, 14 Jan 2010) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/turandom.c
+ M /trunk/urandom.c
+
+[urandom.c, mpfr.texi] Change the behavior of mpfr_urandom to the usual mpfr function interface (wrt the ternary value and the out-of-range behavior).
+[tests/turandom.c] Check new behavior and add a test for the inclusion in [0, 1].
+
+------------------------------------------------------------------------
+r6654 | thevenyp | 2010-01-13 18:12:54 +0000 (Wed, 13 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/turandom.c (from /trunk/tests/trandom.c:6653)
+ A /trunk/urandom.c (from /trunk/urandomb.c:6653)
+
+New function mpfr_urandom.
+------------------------------------------------------------------------
+r6652 | vlefevre | 2010-01-11 15:42:05 +0000 (Mon, 11 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a note about patches and the autotools.
+------------------------------------------------------------------------
+r6650 | vlefevre | 2010-01-10 23:24:54 +0000 (Sun, 10 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+Added mpfrlint test for the required autoconf versions (see r6649).
+------------------------------------------------------------------------
+r6649 | zimmerma | 2010-01-10 10:27:09 +0000 (Sun, 10 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/acinclude.m4
+
+[README.dev] required version of autoconf did not agree with acinclude.m4
+
+------------------------------------------------------------------------
+r6648 | vlefevre | 2010-01-08 21:44:07 +0000 (Fri, 08 Jan 2010) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: replaced BITS_PER_MP_LIMB by GMP_NUMB_BITS (should have
+been done in r6645).
+------------------------------------------------------------------------
+r6647 | vlefevre | 2010-01-08 21:37:05 +0000 (Fri, 08 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: check that GMP_LIMB_BITS isn't used.
+------------------------------------------------------------------------
+r6646 | vlefevre | 2010-01-08 21:36:26 +0000 (Fri, 08 Jan 2010) | 1 line
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/algorithms.tex
+ M /trunk/atan.c
+ M /trunk/check.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/configure.in
+ M /trunk/div-short.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/extract.c
+ M /trunk/frac.c
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_f.c
+ M /trunk/get_flt.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/gmp_op.c
+ M /trunk/init2.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinteger.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/min_prec.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/rec_sqrt.c
+ M /trunk/rint.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_f.c
+ M /trunk/set_ld.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sin_cos.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_ui.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/random2.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tuneup.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/zeta_ui.c
+
+Replaced GMP_LIMB_BITS by GMP_NUMB_BITS to use only one of these macros.
+------------------------------------------------------------------------
+r6645 | zimmerma | 2010-01-08 20:04:27 +0000 (Fri, 08 Jan 2010) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] put back test BITS_PER_MP_LIMB == BYTES_PER_MP_LIMB * CHAR_BIT
+ (this is done only with --with-gmp-build, and BYTES_PER_MP_LIMB
+ is defined in this case in gmp-impl.h, at least in GMP 5)
+
+------------------------------------------------------------------------
+r6644 | zimmerma | 2010-01-08 19:13:48 +0000 (Fri, 08 Jan 2010) | 4 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/algorithms.tex
+ M /trunk/atan.c
+ M /trunk/check.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/configure.in
+ M /trunk/div-short.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/extract.c
+ M /trunk/frac.c
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_f.c
+ M /trunk/get_flt.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/gmp_op.c
+ M /trunk/init2.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinteger.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/min_prec.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/rec_sqrt.c
+ M /trunk/rint.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_f.c
+ M /trunk/set_ld.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_ui.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/random2.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tuneup.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/zeta_ui.c
+
+BITS_PER_MP_LIMB -> GMP_LIMB_BITS
+got rid of BYTES_PER_MP_LIMB in configure.in (no longer defined by GMP)
+Note[VL] (mpfr-impl.h): a mpn_sqr_n() macro is defined to use mpn_mul
+if it is not already defined (in gmp-impl.h from GMP 4.x).
+------------------------------------------------------------------------
+r6643 | vlefevre | 2009-12-23 19:10:15 +0000 (Wed, 23 Dec 2009) | 2 lines
+Changed paths:
+ M /trunk/mbench/Makefile
+
+[mbench/Makefile] Patch from Patrick Pelissier to solve the -I problem
+with GCC.
+------------------------------------------------------------------------
+r6642 | vlefevre | 2009-12-21 00:44:35 +0000 (Mon, 21 Dec 2009) | 1 line
+Changed paths:
+ M /trunk/mbench/Makefile
+
+[mbench/Makefile] Added a comment (warning about the use of -I).
+------------------------------------------------------------------------
+r6641 | zimmerma | 2009-12-20 10:26:22 +0000 (Sun, 20 Dec 2009) | 2 lines
+Changed paths:
+ M /trunk/mbench/Makefile
+
+patch from Patrick Pelissier
+
+------------------------------------------------------------------------
+r6640 | zimmerma | 2009-12-18 14:57:19 +0000 (Fri, 18 Dec 2009) | 8 lines
+Changed paths:
+ M /trunk/exp_2.c
+ M /trunk/mparam_h.in
+ M /trunk/scale2.c
+ M /trunk/tuneup.c
+
+[scale2.c] added missing include (compilation with --with-gmp-build did fail)
+[exp_2.c] small improvements in Smith method: compute x^{2i} as (x^i)^2 instead
+ of x^{i-1} * x. The error analysis is unchanged.
+[tuneup.c] fix for sin_cos threshold (we had a problem since mpfr_sin_cos
+ was calling mpfr_cos, which was calling mpfr_sincos_fast in some
+ cases
+[mparam_h.in] put new thresholds for Core 2 64-bit
+
+------------------------------------------------------------------------
+r6633 | zimmerma | 2009-12-11 09:41:47 +0000 (Fri, 11 Dec 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] reversed order for case "quad, mais en little endian" for
+ coherence with other cases
+
+------------------------------------------------------------------------
+r6632 | zimmerma | 2009-12-10 21:05:50 +0000 (Thu, 10 Dec 2009) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-impl.h
+
+patch to recognize IEEE quad, little endian format for "long double"
+
+------------------------------------------------------------------------
+r6631 | zimmerma | 2009-12-10 15:43:28 +0000 (Thu, 10 Dec 2009) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/get_d.c
+ M /trunk/get_flt.c
+ M /trunk/mpfr-impl.h
+ M /trunk/scale2.c
+
+[scale2.c] now mpfr_scale2 is included in mpfr-impl.h, instead of #including
+ "scale2.c" twice (thus it was compiled twice)
+
+------------------------------------------------------------------------
+r6628 | vlefevre | 2009-12-07 11:53:04 +0000 (Mon, 07 Dec 2009) | 7 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+sin_cos.c: in case of tiny inputs, keep the flags. In practice, this
+fixes the following bug in mpfr_sin_cos (shown by the latest additions
+to tsin_cos.c): if emin is the minimal exponent (MPFR_EMIN_MIN), the
+absolute value of the input is the minimum positive number and the
+rounding mode is toward 0 (or equivalent), then the underflow flag is
+dropped. The other exception cases (e.g., in case of reduced exponent
+range) are handled by mpfr_check_range().
+------------------------------------------------------------------------
+r6627 | vlefevre | 2009-12-07 11:21:51 +0000 (Mon, 07 Dec 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: in consistency(), better error message.
+------------------------------------------------------------------------
+r6626 | vlefevre | 2009-12-07 11:15:46 +0000 (Mon, 07 Dec 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: in consistency(), improved testing on underflow case.
+------------------------------------------------------------------------
+r6625 | vlefevre | 2009-12-07 10:29:57 +0000 (Mon, 07 Dec 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: in consistency(), added testing on underflow case.
+------------------------------------------------------------------------
+r6624 | vlefevre | 2009-12-07 10:22:33 +0000 (Mon, 07 Dec 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: in consistency(), fixed flags testing.
+------------------------------------------------------------------------
+r6623 | vlefevre | 2009-12-07 10:16:17 +0000 (Mon, 07 Dec 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: in consistency(), test also the flags.
+------------------------------------------------------------------------
+r6622 | vlefevre | 2009-12-07 10:10:13 +0000 (Mon, 07 Dec 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: in consistency(), test also the returned value
+(the one that gives inexact-related information).
+------------------------------------------------------------------------
+r6619 | zimmerma | 2009-11-30 15:12:30 +0000 (Mon, 30 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfits.c
+
+[tfits.c] converted to GNU coding style
+
+------------------------------------------------------------------------
+r6612 | vlefevre | 2009-11-30 11:57:07 +0000 (Mon, 30 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release".
+------------------------------------------------------------------------
+r6602 | vlefevre | 2009-11-30 02:17:23 +0000 (Mon, 30 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/uceil_exp2.c
+
+uceil_exp2.c: fixed indentation.
+------------------------------------------------------------------------
+r6599 | vlefevre | 2009-11-29 03:17:53 +0000 (Sun, 29 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: got rid of broken code when _GMP_IEEE_FLOATS was defined
+(broken aliasing rules, yielding failures with GCC 4.5.0 20091119).
+------------------------------------------------------------------------
+r6598 | zimmerma | 2009-11-27 06:38:45 +0000 (Fri, 27 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+[tset_ld.c] now perform tests even if old gcc bug is present
+
+------------------------------------------------------------------------
+r6597 | zimmerma | 2009-11-26 16:38:26 +0000 (Thu, 26 Nov 2009) | 4 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+[tget_d.c] removed workaround for old gcc bug. Comment was:
+ /* workaround for gcc bug on m68040-unknown-netbsd1.4.1,
+ where DBL_MIN gives (1-2^(-52))/2^1022 */
+
+------------------------------------------------------------------------
+r6596 | zimmerma | 2009-11-26 16:26:06 +0000 (Thu, 26 Nov 2009) | 9 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tmul.c
+
+[tadd.c, tmul.c] got rid of workaround for old gcc bug. Comment was:
+/* Parameter "z1" of check() used to be last in the argument list, but that
+ tickled a bug in 32-bit sparc gcc 2.95.2. A "double" in that position is
+ passed on the stack at an address which is 4mod8, but the generated code
+ didn't take into account that alignment, resulting in bus errors. The
+ easiest workaround is to move it to the start of the arg list (where it's
+ passed in registers), this macro does that. FIXME: Change the actual
+ calls to check(), rather than using a macro. */
+
+------------------------------------------------------------------------
+r6595 | zimmerma | 2009-11-26 15:58:02 +0000 (Thu, 26 Nov 2009) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+[strtofr.c] removed patch for old FreeBsd/Alpha bug
+ (http://www.freebsd.org/cgi/query-pr.cgi?pr=72024)
+
+------------------------------------------------------------------------
+r6594 | vlefevre | 2009-11-26 14:15:51 +0000 (Thu, 26 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+[pow_si.c] Updated comment added in r4355 concerning a bug
+in Sun's compiler for Solaris/x86.
+------------------------------------------------------------------------
+r6593 | vlefevre | 2009-11-26 13:38:38 +0000 (Thu, 26 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/strtofr.c
+
+Updated comments concerning the old FreeBSD bug 72024 on LONG_MIN / 1.
+------------------------------------------------------------------------
+r6587 | vlefevre | 2009-11-25 12:16:22 +0000 (Wed, 25 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+[tfprintf.c,tprintf.c] Fixed other types in function with variable
+arguments (even though there were no warnings on the tested machine).
+------------------------------------------------------------------------
+r6586 | vlefevre | 2009-11-25 12:00:43 +0000 (Wed, 25 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+[tfprintf.c,tprintf.c] Fixed types in function with variable arguments.
+------------------------------------------------------------------------
+r6585 | zimmerma | 2009-11-25 11:03:20 +0000 (Wed, 25 Nov 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+[tfprintf.c,tprintf.c] applied patch from Philippe Theveny
+[acinclude.m4] removed check for %zu, no longer needed
+
+------------------------------------------------------------------------
+r6582 | zimmerma | 2009-11-25 10:20:53 +0000 (Wed, 25 Nov 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+[acinclude.m4] added test for %zu
+[tfprintf.c,tprintf.c] added #ifdef's for NPRINTF_ZU
+
+------------------------------------------------------------------------
+r6580 | vlefevre | 2009-11-25 10:16:29 +0000 (Wed, 25 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: corrected a comment.
+------------------------------------------------------------------------
+r6577 | vlefevre | 2009-11-25 09:46:52 +0000 (Wed, 25 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tstckintc.c
+
+tests/tstckintc.c: fixed types for the printf %p format specifier.
+------------------------------------------------------------------------
+r6576 | zimmerma | 2009-11-25 08:33:58 +0000 (Wed, 25 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_flt.c
+
+[tget_flt.c] replaced %a by %.8e
+
+------------------------------------------------------------------------
+r6575 | zimmerma | 2009-11-25 08:23:23 +0000 (Wed, 25 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_ld_2exp.c
+
+[tget_d.c,tget_ld_2exp.c] replaced %a and %La by %.16e and %.16Le
+
+------------------------------------------------------------------------
+r6574 | zimmerma | 2009-11-25 08:05:41 +0000 (Wed, 25 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+[tget_d.c] removed C99-specific instruction
+
+------------------------------------------------------------------------
+r6573 | zimmerma | 2009-11-25 07:51:47 +0000 (Wed, 25 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+[nightly-test] added -ansi -pedantic-errors
+
+------------------------------------------------------------------------
+r6571 | vlefevre | 2009-11-24 17:59:14 +0000 (Tue, 24 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: completed the GMP CC/CFLAGS detection.
+------------------------------------------------------------------------
+r6570 | vlefevre | 2009-11-24 17:52:04 +0000 (Tue, 24 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: added a test to check for CC and CFLAGS in gmp.h only
+when the user doesn't redefine them and he isn't cross-compiling.
+------------------------------------------------------------------------
+r6569 | vlefevre | 2009-11-24 17:32:43 +0000 (Tue, 24 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: improved the GMP CC/CFLAGS detection.
+------------------------------------------------------------------------
+r6568 | vlefevre | 2009-11-24 16:52:57 +0000 (Tue, 24 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: try to fix the GMP CC/CFLAGS detection. Not finished.
+------------------------------------------------------------------------
+r6567 | vlefevre | 2009-11-24 15:48:35 +0000 (Tue, 24 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: replaced "test ... -o ..." (obsolete in POSIX)
+by "test ... || test ...".
+------------------------------------------------------------------------
+r6566 | vlefevre | 2009-11-24 15:44:44 +0000 (Tue, 24 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: replaced "test ... -a ..." (obsolete in POSIX)
+by "test ... && test ...".
+------------------------------------------------------------------------
+r6564 | vlefevre | 2009-11-24 15:23:00 +0000 (Tue, 24 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: made instructions more clear.
+------------------------------------------------------------------------
+r6561 | vlefevre | 2009-11-23 13:55:54 +0000 (Mon, 23 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release".
+------------------------------------------------------------------------
+r6560 | vlefevre | 2009-11-23 13:51:21 +0000 (Mon, 23 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: last things to do when making a release.
+------------------------------------------------------------------------
+r6557 | vlefevre | 2009-11-22 23:29:45 +0000 (Sun, 22 Nov 2009) | 10 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+sin_cos.c: fixed a potential bug by changing a rnd_mode into MPFR_RNDZ
+in mpfr_can_round. Indeed, in r4574, the change from
+ if (!mpfr_can_round (c, m, GMP_RNDZ, rnd_mode, MPFR_PREC (z)))
+to
+ if (!mpfr_can_round (c, m, GMP_RNDN, rnd_mode,
+ MPFR_PREC (z) + (rnd_mode == GMP_RNDN)))
+looks wrong to me: in RNDN, the extra bit due to rnd_mode == GMP_RNDN
+changes a RNDN worst case into a RNDZ worst case.
+Note: The second mpfr_can_round with the same problem has been fixed
+in r6513.
+------------------------------------------------------------------------
+r6556 | vlefevre | 2009-11-22 22:44:40 +0000 (Sun, 22 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: ported bug20091122 from the 2.4 branch to the trunk.
+But no failure in the trunk.
+------------------------------------------------------------------------
+r6550 | vlefevre | 2009-11-20 21:40:00 +0000 (Fri, 20 Nov 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tconst_pi.c
+
+tests/tconst_pi.c: fixed types for C++.
+------------------------------------------------------------------------
+r6545 | vlefevre | 2009-11-20 12:48:49 +0000 (Fri, 20 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Changeset r6162 broke Solaris builds. Fixed that by no longer checking
+INTMAX_MAX and UINTMAX_MAX to detect use of <stdint.h> / <inttypes.h>.
+------------------------------------------------------------------------
+r6535 | zimmerma | 2009-11-01 21:22:16 +0000 (Sun, 01 Nov 2009) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+[cos.c] fixed case where reduced argument is zero
+
+------------------------------------------------------------------------
+r6534 | vlefevre | 2009-10-30 15:13:05 +0000 (Fri, 30 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+tcos.c: added a testcase yielding an assertion failure (this bug makes
+tsin_cos fail).
+------------------------------------------------------------------------
+r6533 | vlefevre | 2009-10-30 15:05:28 +0000 (Fri, 30 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: ported the consistency test from the 2.4 branch.
+This yields an assertion failure (Linux/x86_64).
+------------------------------------------------------------------------
+r6527 | zimmerma | 2009-10-30 10:09:56 +0000 (Fri, 30 Oct 2009) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/cache.c
+ M /trunk/tests/tconst_pi.c
+
+[cache.c] fixed bug with directed rounding
+[tconst_pi.c] added test for bug with directed rounding
+
+------------------------------------------------------------------------
+r6524 | vlefevre | 2009-10-21 13:38:30 +0000 (Wed, 21 Oct 2009) | 1 line
+Changed paths:
+ M /trunk/exceptions.c
+
+exceptions.c: improved a comment.
+------------------------------------------------------------------------
+r6523 | vlefevre | 2009-10-21 13:21:04 +0000 (Wed, 21 Oct 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added an overflow test.
+------------------------------------------------------------------------
+r6522 | vlefevre | 2009-10-21 13:13:54 +0000 (Wed, 21 Oct 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added an overflow test in RNDZ.
+------------------------------------------------------------------------
+r6521 | zimmerma | 2009-10-20 07:21:23 +0000 (Tue, 20 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added efficiency item
+
+------------------------------------------------------------------------
+r6520 | zimmerma | 2009-10-19 08:16:45 +0000 (Mon, 19 Oct 2009) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+[lngamma.c] fixed typo, added comments about argument reduction, and replaced
+ code using doubles
+
+------------------------------------------------------------------------
+r6519 | zimmerma | 2009-10-19 06:57:02 +0000 (Mon, 19 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added efficiency item
+
+------------------------------------------------------------------------
+r6518 | zimmerma | 2009-10-15 11:19:20 +0000 (Thu, 15 Oct 2009) | 4 lines
+Changed paths:
+ M /trunk/exp.c
+
+[exp.c] binary splitting is now used for prec >= MPFR_EXP_THRESHOLD
+ (instead of prec > MPFR_EXP_THRESHOLD before). This is more
+ consistent with the other thresholds.
+
+------------------------------------------------------------------------
+r6517 | zimmerma | 2009-10-15 11:07:26 +0000 (Thu, 15 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added efficiency item
+
+------------------------------------------------------------------------
+r6516 | zimmerma | 2009-10-15 10:30:55 +0000 (Thu, 15 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] added /* bits */ for MPFR_EXP_THRESHOLD and MPFR_EXP_2_THRESHOLD
+
+------------------------------------------------------------------------
+r6514 | zimmerma | 2009-10-13 08:11:10 +0000 (Tue, 13 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+[tsin_cos.c] removed useless instruction, and added comments
+
+------------------------------------------------------------------------
+r6513 | zimmerma | 2009-10-13 06:57:06 +0000 (Tue, 13 Oct 2009) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+
+[sin_cos.c] fixed call to mpfr_can_round (rounding mode was wrong)
+[tsin_cos.c] added new test
+
+------------------------------------------------------------------------
+r6512 | zimmerma | 2009-10-13 06:37:15 +0000 (Tue, 13 Oct 2009) | 3 lines
+Changed paths:
+ M /trunk/li2.c
+ M /trunk/tests/tli2.c
+
+[li2.c] fixed bug when x is near 0
+[tli2.c] added new test
+
+------------------------------------------------------------------------
+r6510 | vlefevre | 2009-10-09 07:29:54 +0000 (Fri, 09 Oct 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: mp_rnd_t -> mpfr_rnd_t.
+------------------------------------------------------------------------
+r6509 | vlefevre | 2009-10-09 07:27:36 +0000 (Fri, 09 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: added a comment about bug20091008, corresponding to
+r6507; in fact, the bug concerns only the return value (see r6444).
+------------------------------------------------------------------------
+r6507 | zimmerma | 2009-10-08 07:51:49 +0000 (Thu, 08 Oct 2009) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+
+[sin_cos.c] fixed error analysis
+[tsin_cos.c] added new test
+
+------------------------------------------------------------------------
+r6506 | vlefevre | 2009-10-07 14:18:35 +0000 (Wed, 07 Oct 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: mp_rnd_t -> mpfr_rnd_t.
+------------------------------------------------------------------------
+r6505 | vlefevre | 2009-10-07 12:06:35 +0000 (Wed, 07 Oct 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tests/tsin_cos.c: removed trailing spaces.
+------------------------------------------------------------------------
+r6504 | zimmerma | 2009-10-07 08:58:51 +0000 (Wed, 07 Oct 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+[tsin_cos.c] changed binary to hexadecimal string (was too long for C89)
+
+------------------------------------------------------------------------
+r6503 | zimmerma | 2009-10-07 07:05:13 +0000 (Wed, 07 Oct 2009) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+
+[sin_cos.c] fixed bug introduced in r6447 (some variables had their precision not updated in Ziv's loop)
+[tsin_cos.c] added a new test
+
+------------------------------------------------------------------------
+r6498 | vlefevre | 2009-09-29 14:44:22 +0000 (Tue, 29 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+------------------------------------------------------------------------
+r6497 | zimmerma | 2009-09-29 11:28:00 +0000 (Tue, 29 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/round_prec.c
+ M /trunk/tests/tcan_round.c
+
+[mpfr.texi] added note about mpfr_can_round
+[tcan_round.c] added more tests
+
+------------------------------------------------------------------------
+r6490 | zimmerma | 2009-09-24 06:16:52 +0000 (Thu, 24 Sep 2009) | 4 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] added item for new releases: we should say if they are binary
+ and/or API compatible with previous releases (we often forgot
+ to say it in the past)
+
+------------------------------------------------------------------------
+r6489 | vlefevre | 2009-09-23 15:09:42 +0000 (Wed, 23 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: added tget_flt to the svn:ignore property.
+------------------------------------------------------------------------
+r6488 | vlefevre | 2009-09-23 15:08:39 +0000 (Wed, 23 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+tests/Makefile.am: added information about LOADLIBES.
+------------------------------------------------------------------------
+r6487 | zimmerma | 2009-09-23 13:32:35 +0000 (Wed, 23 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] put back LOADLIBES=... (enables to compile a program foo.c
+ in the test directory by simply doing "make foo")
+
+------------------------------------------------------------------------
+r6486 | zimmerma | 2009-09-23 06:21:27 +0000 (Wed, 23 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+[atan.c] updated the comments
+
+------------------------------------------------------------------------
+r6485 | vlefevre | 2009-09-22 15:56:16 +0000 (Tue, 22 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/atan.c
+
+atan.c: added a FIXME comment.
+------------------------------------------------------------------------
+r6484 | vlefevre | 2009-09-22 15:51:15 +0000 (Tue, 22 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/atan.c
+
+atan.c: added some assertions.
+------------------------------------------------------------------------
+r6483 | zimmerma | 2009-09-22 13:58:25 +0000 (Tue, 22 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/algorithms.tex
+ M /trunk/atan.c
+
+[atan.c] implemented argument reduction (cf error analysis in algorithms.tex)
+
+------------------------------------------------------------------------
+r6482 | zimmerma | 2009-09-21 07:34:07 +0000 (Mon, 21 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+[tests/Makefile.am] removed LOADLIBES=...
+
+------------------------------------------------------------------------
+r6480 | vlefevre | 2009-09-20 23:31:37 +0000 (Sun, 20 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: check that lines aren't too long.
+------------------------------------------------------------------------
+r6478 | vlefevre | 2009-09-20 19:07:03 +0000 (Sun, 20 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: line-wrap libmpfr_la_SOURCES (M-q with Emacs) for
+compatibility with some vendor grep.
+------------------------------------------------------------------------
+r6476 | vlefevre | 2009-09-20 19:00:11 +0000 (Sun, 20 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/tests/Makefile.am
+
+Makefile.am, tests/Makefile.am: patch from Ralf Wildenhues.
+http://lists.gnu.org/archive/html/bug-automake/2009-09/msg00033.html
+------------------------------------------------------------------------
+r6475 | vlefevre | 2009-09-18 15:00:09 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+
+mpfr-impl.h, sin_cos.c, tests/tsin_cos.c: mp_rnd_t -> mpfr_rnd_t.
+------------------------------------------------------------------------
+r6474 | vlefevre | 2009-09-18 14:55:57 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/sin_cos.c
+
+sin_cos.c: GMP_RNDx -> MPFR_RNDx.
+------------------------------------------------------------------------
+r6473 | vlefevre | 2009-09-18 14:54:38 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/sin_cos.c
+
+sin_cos.c: untabified.
+------------------------------------------------------------------------
+r6471 | vlefevre | 2009-09-18 14:45:47 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/frac.c
+ M /trunk/tests/tfrac.c
+
+frac.c, tests/tfrac.c: fixed underflow case in mpfr_frac and added
+testcase.
+------------------------------------------------------------------------
+r6470 | zimmerma | 2009-09-18 14:03:56 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/atan.c
+
+[acos.c] initial working precision was too small
+
+------------------------------------------------------------------------
+r6469 | vlefevre | 2009-09-18 13:56:21 +0000 (Fri, 18 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/modf.c
+
+modf.c: no longer extend the exponent range at all, since there are
+no intermediate computations (note: the mpfr_frac bug that has just
+been fixed affected this change in modf.c).
+------------------------------------------------------------------------
+r6467 | vlefevre | 2009-09-18 13:50:21 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/frac.c
+
+[frac.c] Patch r6456 was incorrect: the problem with the non-significant
+bits had to be dealt with only in the case t = r. This is now fixed.
+------------------------------------------------------------------------
+r6466 | vlefevre | 2009-09-18 13:47:10 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: reverted overflow case test (was incorrect because the
+input was too large).
+------------------------------------------------------------------------
+r6465 | vlefevre | 2009-09-18 13:42:12 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: also test the overflow case.
+------------------------------------------------------------------------
+r6464 | vlefevre | 2009-09-18 13:33:43 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: more tests (case where the fractional part rounds to 1).
+------------------------------------------------------------------------
+r6463 | zimmerma | 2009-09-18 13:31:56 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] added item
+
+------------------------------------------------------------------------
+r6461 | zimmerma | 2009-09-18 13:10:35 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.texi
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/tuneup.c
+
+[sin.c,cos.c] use mpfr_sincos_fast when prec >= MPFR_SINCOS_THRESHOLD
+
+------------------------------------------------------------------------
+r6460 | vlefevre | 2009-09-18 12:03:38 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: more tests (there are also problems in rounding away
+from zero or equivalent).
+------------------------------------------------------------------------
+r6459 | zimmerma | 2009-09-18 11:59:23 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tuneup.c
+
+added tuning mechanism for mpfr_sin_cos
+
+------------------------------------------------------------------------
+r6458 | vlefevre | 2009-09-18 11:46:28 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: also test the ternary value (it is incorrect too).
+------------------------------------------------------------------------
+r6456 | vlefevre | 2009-09-18 11:27:48 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/frac.c
+
+frac.c: fixed bug in mpfr_frac (the non-significant bits in low limb
+were not cleared).
+------------------------------------------------------------------------
+r6455 | vlefevre | 2009-09-18 11:19:11 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: improved the testcase so that it triggers the bug for
+both 32 bits and 64 bits.
+------------------------------------------------------------------------
+r6454 | vlefevre | 2009-09-18 11:16:00 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: added a comment for latest testcase.
+------------------------------------------------------------------------
+r6453 | vlefevre | 2009-09-18 11:09:03 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+tests/tfrac.c: added testcase for bug in mpfr_frac.
+------------------------------------------------------------------------
+r6451 | vlefevre | 2009-09-18 10:38:19 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tmodf.c
+
+tests/tmodf.c: typo in error message.
+------------------------------------------------------------------------
+r6450 | vlefevre | 2009-09-18 10:26:26 +0000 (Fri, 18 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/modf.c
+
+modf.c: extending the exponent range in the first two cases is useless
+because there are no intermediate computations (just a mpfr_set). Let's
+do that only for the general case.
+------------------------------------------------------------------------
+r6449 | vlefevre | 2009-09-18 10:23:07 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tmodf.c
+
+tests/tmodf.c: added overflow tests.
+------------------------------------------------------------------------
+r6448 | vlefevre | 2009-09-18 09:27:10 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/modf.c
+
+modf.c: corrected a comment (rounding can yield an overflow, but not
+an underflow).
+------------------------------------------------------------------------
+r6447 | zimmerma | 2009-09-18 09:08:01 +0000 (Fri, 18 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+
+[sin_cos.c] added asymptotically fast code, with threshold currently hardcoded
+ at 20000 bits, should be determined by tuneup.c
+
+------------------------------------------------------------------------
+r6446 | vlefevre | 2009-09-18 09:00:24 +0000 (Fri, 18 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_flt.c
+
+Deleted trailing spaces.
+------------------------------------------------------------------------
+r6445 | zimmerma | 2009-09-18 08:13:43 +0000 (Fri, 18 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/modf.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tmodf.c
+
+[modf.c] changed semantics of return value in accordance with mpfr_sin_cos
+
+------------------------------------------------------------------------
+r6444 | zimmerma | 2009-09-17 11:30:18 +0000 (Thu, 17 Sep 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/sin_cos.c
+ M /trunk/sinh_cosh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tsin_cos.c
+
+[sin_cos.c] more precise meaning of the return value
+[sinh_cosh.c] idem as above
+[taway.c] fixed to check the more precise return value
+
+------------------------------------------------------------------------
+r6443 | zimmerma | 2009-09-16 06:17:47 +0000 (Wed, 16 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] t was not initialized in Newton's example
+
+------------------------------------------------------------------------
+r6442 | zimmerma | 2009-09-15 13:48:15 +0000 (Tue, 15 Sep 2009) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ D /trunk/get_binary32.c
+ A /trunk/get_flt.c (from /trunk/get_binary32.c:6441)
+ D /trunk/set_binary32.c
+ A /trunk/set_flt.c (from /trunk/set_binary32.c:6441)
+ M /trunk/tests/Makefile.am
+ D /trunk/tests/tget_binary32.c
+ A /trunk/tests/tget_flt.c (from /trunk/tests/tget_binary32.c:6441)
+
+changed _binary32 into _flt for file names too:
+ svn mv get_binary32.c get_flt.c
+ svn mv set_binary32.c set_flt.c
+ svn mv tests/tget_binary32.c tests/tget_flt.c
+
+------------------------------------------------------------------------
+r6441 | zimmerma | 2009-09-15 13:42:49 +0000 (Tue, 15 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.texi
+
+[TODO] removed an item
+[mpfr.texi] added an example for mpfr_prec_round
+
+------------------------------------------------------------------------
+r6440 | zimmerma | 2009-09-15 13:26:11 +0000 (Tue, 15 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+[NEWS] added mpfr_set_flt and mpfr_get_flt
+
+------------------------------------------------------------------------
+r6439 | zimmerma | 2009-09-15 13:17:40 +0000 (Tue, 15 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/get_binary32.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_binary32.c
+ M /trunk/tests/tget_binary32.c
+
+changed suffix _binary32 -> _flt
+[get_binary32.c] fixed a bug in subnormal range
+
+------------------------------------------------------------------------
+r6437 | vlefevre | 2009-09-15 13:15:23 +0000 (Tue, 15 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: bug fix.
+------------------------------------------------------------------------
+r6435 | vlefevre | 2009-09-15 13:13:28 +0000 (Tue, 15 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6433 | vlefevre | 2009-09-15 13:12:38 +0000 (Tue, 15 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: execute svn in C locale.
+------------------------------------------------------------------------
+r6431 | vlefevre | 2009-09-15 13:10:50 +0000 (Tue, 15 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: check mpfr.texi's UPDATED-MONTH.
+------------------------------------------------------------------------
+r6428 | zimmerma | 2009-09-15 12:21:15 +0000 (Tue, 15 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+[tget_d.c] fixed FIXME
+
+------------------------------------------------------------------------
+r6427 | vlefevre | 2009-09-15 12:12:35 +0000 (Tue, 15 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+tget_d.c code is C99-only (bug introduced in r6424). Please fix!
+------------------------------------------------------------------------
+r6426 | zimmerma | 2009-09-15 11:42:27 +0000 (Tue, 15 Sep 2009) | 2 lines
+Changed paths:
+ A /trunk/get_binary32.c
+
+[get_binary32.c] also forgot in previous commit
+
+------------------------------------------------------------------------
+r6425 | zimmerma | 2009-09-15 11:41:52 +0000 (Tue, 15 Sep 2009) | 2 lines
+Changed paths:
+ A /trunk/set_binary32.c
+
+[set_binary32.c] file forgot in previous commit
+
+------------------------------------------------------------------------
+r6424 | zimmerma | 2009-09-15 11:37:40 +0000 (Tue, 15 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ A /trunk/ieee_floats.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/scale2.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tget_binary32.c
+ M /trunk/tests/tget_d.c
+
+added new functions mpfr_set_binary32 and mpfr_get_binary32
+fixed bug in mpfr_get_d and mpfr_get_decimal64 for RNDA
+
+------------------------------------------------------------------------
+r6423 | zimmerma | 2009-09-15 08:27:20 +0000 (Tue, 15 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] improved description of mpfr_sum, and fixed typo
+
+------------------------------------------------------------------------
+r6421 | vlefevre | 2009-09-14 16:29:44 +0000 (Mon, 14 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: added mpfr_regular_p macro.
+------------------------------------------------------------------------
+r6419 | zimmerma | 2009-09-14 14:12:03 +0000 (Mon, 14 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+[sum.c] added reference
+
+------------------------------------------------------------------------
+r6418 | zimmerma | 2009-09-14 13:10:57 +0000 (Mon, 14 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/get_ld.c
+ M /trunk/tests/tget_ld_2exp.c
+
+[get_ld.c] fixed bug reported by Nelson Beebe
+ https://sympa.inria.fr/sympa/arc/mpfr/2009-05/msg00061.html
+
+------------------------------------------------------------------------
+r6417 | zimmerma | 2009-09-14 09:29:55 +0000 (Mon, 14 Sep 2009) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/isregular.c
+ M /trunk/iszero.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tisnan.c
+
+[isregular.c] new function mpfr_regular_p
+[iszero.c] fixed typo in comment
+[tests/tisnan.c] added tests for mpfr_regular_p
+
+------------------------------------------------------------------------
+r6415 | vlefevre | 2009-09-11 22:03:10 +0000 (Fri, 11 Sep 2009) | 6 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: changeset r6414 was incorrect, in particular under Linux
+(at least some platforms), where wint_t is an unsigned int, not an int.
+Instead, let's detect whether integer promotion will occur or not, even
+though the ISO C99 standard requires a wint_t type that doesn't yield
+an integer promotion (7.24.1#2), because mingw32 defines wint_t as an
+unsigned short (thus with integer promotion).
+------------------------------------------------------------------------
+r6414 | zimmerma | 2009-09-11 07:52:33 +0000 (Fri, 11 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+[vasprintf.c] https://sympa.inria.fr/sympa/arc/mpfr/2009-09/msg00012.html
+ (changed __wint_type into int)
+
+------------------------------------------------------------------------
+r6413 | vlefevre | 2009-09-08 08:49:33 +0000 (Tue, 08 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tdigamma.c
+
+tests/tdigamma.c: added missing void in prototype.
+------------------------------------------------------------------------
+r6412 | zimmerma | 2009-09-08 08:35:04 +0000 (Tue, 08 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/digamma.c
+ M /trunk/tests/tdigamma.c
+
+[digamma.c] forgot to set sign for Psi(+Inf)
+
+------------------------------------------------------------------------
+r6411 | zimmerma | 2009-09-04 12:29:27 +0000 (Fri, 04 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/bernoulli.c
+ M /trunk/digamma.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/mpfr-impl.h
+
+changed function into bernoulli.c (which was static, included 3 times) into
+an internal function mpfr_bernoulli_internal
+
+------------------------------------------------------------------------
+r6410 | zimmerma | 2009-09-03 06:45:11 +0000 (Thu, 03 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] removed psi(=digamma)
+
+------------------------------------------------------------------------
+r6409 | vlefevre | 2009-09-02 23:17:32 +0000 (Wed, 02 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/data/digamma
+
+tests/data/digamma: for the special values, use the new mode '*'
+(exact cases) instead of 'n'.
+------------------------------------------------------------------------
+r6408 | vlefevre | 2009-09-02 23:16:03 +0000 (Wed, 02 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: added special support for exact cases in data_check (to test
+all the rounding modes and check the ternary value).
+------------------------------------------------------------------------
+r6407 | vlefevre | 2009-09-02 23:02:29 +0000 (Wed, 02 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/div.c
+ M /trunk/exp2.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-longlong.h
+ M /trunk/mpn_exp.c
+ M /trunk/pow.c
+ M /trunk/pow_z.c
+ M /trunk/rec_sqrt.c
+ M /trunk/rint.c
+ M /trunk/round_near_x.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tsqrt.c
+
+towards -> toward (consistency).
+------------------------------------------------------------------------
+r6404 | vlefevre | 2009-09-02 12:13:23 +0000 (Wed, 02 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: added tdigamma to svn:ignore property.
+------------------------------------------------------------------------
+r6403 | vlefevre | 2009-09-02 12:11:05 +0000 (Wed, 02 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/digamma.c
+
+digamma.c: moved a comment.
+------------------------------------------------------------------------
+r6402 | zimmerma | 2009-09-02 12:08:05 +0000 (Wed, 02 Sep 2009) | 4 lines
+Changed paths:
+ M /trunk/digamma.c
+ M /trunk/tests/data/digamma
+ M /trunk/tests/tests.c
+
+[digamma.c] fixed bug (emin/emax were not restored)
+[data/digamma] added special values
+[tests/tests.c] fix to allow putting nan in data/* files
+
+------------------------------------------------------------------------
+r6401 | zimmerma | 2009-09-02 11:56:48 +0000 (Wed, 02 Sep 2009) | 3 lines
+Changed paths:
+ A /trunk/tests/data/digamma
+ M /trunk/tests/tdigamma.c
+
+[data/digamma] unitary test file for mpfr_digamma
+[tdigamma.c] now use data/digamma
+
+------------------------------------------------------------------------
+r6400 | vlefevre | 2009-09-02 11:54:53 +0000 (Wed, 02 Sep 2009) | 1 line
+Changed paths:
+ M /trunk/digamma.c
+
+Removed trailing whitespace.
+------------------------------------------------------------------------
+r6399 | zimmerma | 2009-09-02 11:39:14 +0000 (Wed, 02 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+bernoulli.c goes into EXTRA_DIST
+
+------------------------------------------------------------------------
+r6398 | zimmerma | 2009-09-02 11:38:07 +0000 (Wed, 02 Sep 2009) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/algorithms.tex
+ A /trunk/bernoulli.c
+ A /trunk/digamma.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tdigamma.c
+
+[digamma.c] new function mpfr_digamma
+[lngamma.c,li2.c] factored computation of Bernoulli numbers in new file
+ bernoulli.c (also used by digamma.c)
+
+------------------------------------------------------------------------
+r6397 | zimmerma | 2009-08-27 09:27:10 +0000 (Thu, 27 Aug 2009) | 8 lines
+Changed paths:
+ M /trunk/cbrt.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/cos.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/get_z.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/pow.c
+ M /trunk/rem1.c
+ M /trunk/root.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/urandomb.c
+ M /trunk/zeta_ui.c
+
+replaced obsolete GMP functions (suggested by Brian Gladman):
+1. mpz_div_2exp ==> mpz_fdiv_q_2exp
+2. mpz_div_ui ==> mpz_fdiv_q_ui
+3. gmp_randinit (state, GMP_RAND_ALG_LC, 128) ==> gmp_randinit_lc_2exp_size (state, 128)
+(Didn't replace mpn_divrem by mpn_tdiv_qr since the parameters differ, and also
+for efficiency reasons.)
+
+
+------------------------------------------------------------------------
+r6396 | vlefevre | 2009-08-26 23:30:06 +0000 (Wed, 26 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: fixed locale_da_DK test.
+------------------------------------------------------------------------
+r6394 | zimmerma | 2009-08-26 20:13:50 +0000 (Wed, 26 Aug 2009) | 3 lines
+Changed paths:
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+
+[csch.c,coth.c,csc.c,cot.c] fixed bug for tiny input and RNDA (result was
+ rounded to zero instead of away)
+
+------------------------------------------------------------------------
+r6393 | vlefevre | 2009-08-26 17:01:54 +0000 (Wed, 26 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: bug fix (uncommented an "exit(1);").
+------------------------------------------------------------------------
+r6390 | zimmerma | 2009-08-26 15:28:25 +0000 (Wed, 26 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tgeneric.c] revert previous change, bug is elsewhere
+
+------------------------------------------------------------------------
+r6389 | zimmerma | 2009-08-26 15:23:51 +0000 (Wed, 26 Aug 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+[tgeneric.c] temporary fix in mpfr_can_round call (mpfr_can_round does not
+ correctly handle MPFR_RNDA)
+
+------------------------------------------------------------------------
+r6381 | vlefevre | 2009-08-26 08:48:37 +0000 (Wed, 26 Aug 2009) | 5 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+set_ld.c: replaced a struct by a union. The struct was triggering the
+following warning with GCC 4.4:
+ dereferencing type-punned pointer will break strict-aliasing rules
+(possibly due to possible memory alignment problems). The old code
+looked strange anyway and unions are exactly for such kind of things.
+------------------------------------------------------------------------
+r6380 | zimmerma | 2009-08-26 08:10:51 +0000 (Wed, 26 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tset.c
+
+[tset.c] removed unused variables
+
+------------------------------------------------------------------------
+r6378 | vlefevre | 2009-08-25 12:23:42 +0000 (Tue, 25 Aug 2009) | 4 lines
+Changed paths:
+ M /trunk/tests/tcmp_ld.c
+
+tcmp_ld.c: use "long double" constants.
+Note: this might solve the tcmp_ld failure reported on
+http://www.linuxquestions.org/questions/linux-from-scratch-13/mpfr-2.4.1-check-failures-in-lfs-6.5-rc2-746538/
+(not tested).
+------------------------------------------------------------------------
+r6376 | vlefevre | 2009-08-24 13:21:03 +0000 (Mon, 24 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: update (new function mpfr_set_zero, added in r6339).
+------------------------------------------------------------------------
+r6375 | vlefevre | 2009-08-24 13:01:15 +0000 (Mon, 24 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: NaN has a sign bit (in its binary representation),
+but as a FP datum, it does not have a sign.
+------------------------------------------------------------------------
+r6374 | zimmerma | 2009-08-24 12:48:30 +0000 (Mon, 24 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] added mention of unspecified NaN sign bit for mpfr_set_nan
+
+------------------------------------------------------------------------
+r6372 | vlefevre | 2009-08-21 21:58:15 +0000 (Fri, 21 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: do not use @code for roundTiesToAway and binary64 as this is
+not code and the IEEE 754-2008 standard doesn't use special typography.
+------------------------------------------------------------------------
+r6369 | vlefevre | 2009-08-21 21:43:16 +0000 (Fri, 21 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: the sign bit of a NaN is unspecified.
+------------------------------------------------------------------------
+r6368 | vlefevre | 2009-08-18 15:51:08 +0000 (Tue, 18 Aug 2009) | 7 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/README
+ A /trunk/examples
+ A /trunk/examples/ReadMe
+ A /trunk/examples/divworst.c
+ A /trunk/examples/rndo-add.c
+ A /trunk/examples/sample.c
+
+Add examples into $docdir (without using a subdir, as this would be
+a bit bloated just to add a few files).
+ * Added "examples" directory with a ReadMe file and 3 examples.
+ * Makefile.am: added files from the "examples" directory and changed
+ dist_doc_DATA into nobase_dist_doc_DATA so that the "examples"
+ directory is not stripped in the target directory $docdir.
+ * README: added "examples/".
+------------------------------------------------------------------------
+r6367 | vlefevre | 2009-08-18 13:46:15 +0000 (Tue, 18 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/get_str.c
+
+get_str.c: corrected copyright notice, incorrectly modified in r6364.
+------------------------------------------------------------------------
+r6366 | thevenyp | 2009-08-12 14:30:48 +0000 (Wed, 12 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Fix typo.
+
+------------------------------------------------------------------------
+r6365 | thevenyp | 2009-08-12 14:10:33 +0000 (Wed, 12 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+get_str.c: Format a comment.
+
+------------------------------------------------------------------------
+r6364 | thevenyp | 2009-08-12 14:07:24 +0000 (Wed, 12 Aug 2009) | 4 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+get_str.c vasprintf.c: Add support for the rounding away from zero mode.
+mpfr.texi: MPFR_RNDA mode support in printf functions.
+tests/tsprintf.c tests/tget_str.c: Test MPFR_RNDA support.
+
+------------------------------------------------------------------------
+r6363 | vlefevre | 2009-08-06 00:21:17 +0000 (Thu, 06 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: update.
+------------------------------------------------------------------------
+r6362 | vlefevre | 2009-08-06 00:18:37 +0000 (Thu, 06 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.texi
+
+Install some documentation files.
+------------------------------------------------------------------------
+r6360 | vlefevre | 2009-08-05 11:39:30 +0000 (Wed, 05 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated section "Installing MPFR".
+------------------------------------------------------------------------
+r6358 | vlefevre | 2009-08-05 10:39:20 +0000 (Wed, 05 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: corrected a spelling mistake.
+------------------------------------------------------------------------
+r6356 | vlefevre | 2009-08-05 10:24:16 +0000 (Wed, 05 Aug 2009) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.in
+
+Since GNU Automake 1.11 is available on too few platforms, removed its
+requirement (reverted to 1.10 requirement: 1.10.1 was needed only for
+dist-lzma, which has been removed). Instead, added hardcoded dist-xz
+support (tested with both Automake 1.10.2 and Automake 1.11).
+------------------------------------------------------------------------
+r6354 | vlefevre | 2009-08-04 00:55:30 +0000 (Tue, 04 Aug 2009) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: replaced dist-lzma by dist-xz (the xz format is the
+successor of the lzma format); as a consequence, automake 1.11 is
+needed.
+------------------------------------------------------------------------
+r6353 | vlefevre | 2009-07-30 18:06:49 +0000 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/tests/Makefile.am
+
+Makefile.am, tests/Makefile.am: added copyright notice (similar to
+the one of the generated Makefile.in file).
+------------------------------------------------------------------------
+r6352 | vlefevre | 2009-07-30 17:59:36 +0000 (Thu, 30 Jul 2009) | 3 lines
+Changed paths:
+ M /trunk/COPYING
+ M /trunk/README
+
+Since COPYING.LESSER makes a reference to the GPLv3, updated COPYING
+to the GPLv3. Autotool files are now distributed under the same licence
+of MPFR (to avoid any reference to the GPLv2).
+------------------------------------------------------------------------
+r6351 | vlefevre | 2009-07-30 17:47:39 +0000 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ A /trunk/COPYING.LESSER (from /trunk/COPYING.LIB:6350)
+ D /trunk/COPYING.LIB
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/buildopt.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/mbench/Makefile
+ M /trunk/mbench/generate.c
+ M /trunk/mbench/mfv5-arprec.cc
+ M /trunk/mbench/mfv5-cln.cc
+ M /trunk/mbench/mfv5-crlibm.cc
+ M /trunk/mbench/mfv5-libc.cc
+ M /trunk/mbench/mfv5-lidia.cc
+ M /trunk/mbench/mfv5-mpf.cc
+ M /trunk/mbench/mfv5-mpfr.cc
+ M /trunk/mbench/mfv5-ntl.cc
+ M /trunk/mbench/mfv5-pari.cc
+ M /trunk/mbench/mfv5-void.cc
+ M /trunk/mbench/mfv5.cc
+ M /trunk/mbench/mfv5.h
+ M /trunk/mbench/mpfr-gfx.c
+ M /trunk/mbench/mpfr-v4.c
+ M /trunk/mbench/mpfr-v6.c
+ M /trunk/mbench/timp.h
+ M /trunk/min_prec.c
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-thread.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/set_zero.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/random2.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tbuildopt.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmin_prec.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Renamed COPYING.LIB as COPYING.LESSER (GNU Coding Standards, #7.3)
+and updated all the references (except in ChangeLog).
+------------------------------------------------------------------------
+r6350 | vlefevre | 2009-07-30 17:38:46 +0000 (Thu, 30 Jul 2009) | 1 line
+Changed paths:
+ M /trunk
+
+Added algorithms.fdb_latexmk to svn:ignore property.
+------------------------------------------------------------------------
+r6349 | thevenyp | 2009-07-30 16:30:24 +0000 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tset.c
+
+tests/tset.c: With revision 6339, some tests were moved and added in the function check_special but this one was not called.
+
+------------------------------------------------------------------------
+r6348 | thevenyp | 2009-07-30 16:22:55 +0000 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+tests/Makefile.am: Strech check_PROGRAMS list to ease insertion of new tests.
+
+------------------------------------------------------------------------
+r6347 | thevenyp | 2009-07-30 16:03:04 +0000 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Makefile.am: Sort tests in alphabetical order except the very first ones which are needed by the test suite itself.
+
+------------------------------------------------------------------------
+r6340 | thevenyp | 2009-07-20 14:40:40 +0000 (Mon, 20 Jul 2009) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c mpfr.texi: Change behavior with %Rf and an empty precision field. The default precision is now 6 with %Rf and %Rg.
+tests/tprintf.c tests/tfprintf.c tests/tsprintf.c: Change tests with empty precision field and %Rf.
+
+------------------------------------------------------------------------
+r6339 | thevenyp | 2009-07-20 09:22:08 +0000 (Mon, 20 Jul 2009) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/set_zero.c
+ M /trunk/tests/tset.c
+
+Makefile.am mpfr.h mpfr.texi set_zero.c: New function mpfr_set_zero.
+tests/tset.c: Replace all MPFR_ASSERTN with verbose message. Add tests for mpfr_set_zero.
+
+------------------------------------------------------------------------
+r6336 | zimmerma | 2009-07-15 00:30:44 +0000 (Wed, 15 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] hint about patch command
+
+------------------------------------------------------------------------
+r6335 | zimmerma | 2009-07-14 08:37:32 +0000 (Tue, 14 Jul 2009) | 3 lines
+Changed paths:
+ M /trunk/mpn_exp.c
+
+[mpn_exp.c] reverted previous change (MPN_ZERO is a macro for memset, which
+ does not forbid zero size)
+
+------------------------------------------------------------------------
+r6334 | zimmerma | 2009-07-14 07:47:57 +0000 (Tue, 14 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/tests/tcoth.c
+
+[coth.c, tcoth.c] fixed coth(+/0) which was wrong (reported by Christopher Creutzig)
+
+------------------------------------------------------------------------
+r6333 | zimmerma | 2009-07-14 07:39:38 +0000 (Tue, 14 Jul 2009) | 3 lines
+Changed paths:
+ M /trunk/mpn_exp.c
+
+[mpn_exp.c] fixed bug reported by David Kirkby on Solaris (GMP compiled with
+ Solaris compiler)
+
+------------------------------------------------------------------------
+r6330 | vlefevre | 2009-07-08 13:35:34 +0000 (Wed, 08 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: typo in a comment.
+------------------------------------------------------------------------
+r6329 | thevenyp | 2009-07-08 13:24:46 +0000 (Wed, 08 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug with %Rf, non-zero precision and a value rounded up to the next power of ten.
+
+------------------------------------------------------------------------
+r6328 | vlefevre | 2009-07-08 10:44:31 +0000 (Wed, 08 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: deleted trailing spaces.
+------------------------------------------------------------------------
+r6326 | vlefevre | 2009-07-08 10:42:02 +0000 (Wed, 08 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: added tests of some halfway cases.
+------------------------------------------------------------------------
+r6325 | thevenyp | 2009-07-08 09:46:52 +0000 (Wed, 08 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug in precision 0 with format %.0Rf (0.5 rounds to 0).
+
+------------------------------------------------------------------------
+r6322 | vlefevre | 2009-07-08 07:39:56 +0000 (Wed, 08 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: added a test that triggers an assertion failure.
+------------------------------------------------------------------------
+r6319 | vlefevre | 2009-07-08 07:17:20 +0000 (Wed, 08 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: fixed a test and added more tests for %.0Rf with the even
+rounding rule (shows a bug added in the latest corrections).
+------------------------------------------------------------------------
+r6316 | vlefevre | 2009-07-07 08:18:45 +0000 (Tue, 07 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: completed the test on emax (for %Ra and %Rb).
+Everything is OK.
+------------------------------------------------------------------------
+r6315 | vlefevre | 2009-07-07 07:55:06 +0000 (Tue, 07 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: my test was incorrect (I forgot the R), sorry.
+Still completing it...
+------------------------------------------------------------------------
+r6314 | vlefevre | 2009-07-07 07:40:22 +0000 (Tue, 07 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: comment (so that the test can be ported to the 2.4 branch).
+------------------------------------------------------------------------
+r6313 | vlefevre | 2009-07-07 07:38:00 +0000 (Tue, 07 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: started to write a test for emax, showing a bug (random
+output).
+------------------------------------------------------------------------
+r6311 | vlefevre | 2009-07-06 12:44:41 +0000 (Mon, 06 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v".
+------------------------------------------------------------------------
+r6307 | vlefevre | 2009-07-06 11:17:09 +0000 (Mon, 06 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6305 | vlefevre | 2009-07-06 11:15:38 +0000 (Mon, 06 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi consistency: @var{stdout} -> @code{stdout}.
+------------------------------------------------------------------------
+r6303 | vlefevre | 2009-07-06 11:04:50 +0000 (Mon, 06 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: do not use a potential function call in SAFE_ABS macro.
+------------------------------------------------------------------------
+r6301 | thevenyp | 2009-07-06 08:36:59 +0000 (Mon, 06 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c tests/tsprintf.c: deleted trailing spaces.
+
+------------------------------------------------------------------------
+r6298 | thevenyp | 2009-06-29 13:09:42 +0000 (Mon, 29 Jun 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug when the value to be printed is rounded to the next power of ten with %Rf or %Rg (continuation of fix in r6278).
+tests/tsprintf.c: Add tests for rounding to next power of ten bug with %Rf or %Rg.
+
+------------------------------------------------------------------------
+r6297 | vlefevre | 2009-06-26 15:47:03 +0000 (Fri, 26 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/cmp2.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/get_z_exp.c
+ M /trunk/hypot.c
+ M /trunk/mpn_exp.c
+ M /trunk/round_prec.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/vasprintf.c
+
+mp_exp_unsigned_t -> mpfr_uexp_t (internal type only).
+------------------------------------------------------------------------
+r6296 | vlefevre | 2009-06-26 15:40:06 +0000 (Fri, 26 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: check the use of the obsolete mp_rnd_t type.
+------------------------------------------------------------------------
+r6295 | vlefevre | 2009-06-26 15:35:01 +0000 (Fri, 26 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/README.dev
+ M /trunk/TODO
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/eint.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_z.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/inp_str.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/minmax.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_f.c
+ M /trunk/set_ld.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setsign.c
+ M /trunk/si_op.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/vasprintf.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+mp_rnd_t -> mpfr_rnd_t
+------------------------------------------------------------------------
+r6294 | vlefevre | 2009-06-26 15:19:14 +0000 (Fri, 26 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/add.c
+ M /trunk/agm.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/frac.c
+ M /trunk/hypot.c
+ M /trunk/inp_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/next.c
+ M /trunk/pow_si.c
+ M /trunk/rec_sqrt.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/tests/random2.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tui_div.c
+ M /trunk/urandomb.c
+
+Suppressed MPFR_CLEAR_FLAGS (no longer did anything).
+------------------------------------------------------------------------
+r6290 | vlefevre | 2009-06-23 02:17:04 +0000 (Tue, 23 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6287 | vlefevre | 2009-06-23 02:06:27 +0000 (Tue, 23 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: fixed description of mpfr_get_str (clash with variables,
+inconsistent cases in the info format).
+------------------------------------------------------------------------
+r6286 | vlefevre | 2009-06-23 01:56:01 +0000 (Tue, 23 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/get_str.c
+
+get_str.c: added a space.
+------------------------------------------------------------------------
+r6283 | vlefevre | 2009-06-21 20:54:34 +0000 (Sun, 21 Jun 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: corrected comments.
+------------------------------------------------------------------------
+r6282 | thevenyp | 2009-06-19 19:55:18 +0000 (Fri, 19 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: convert GMP_RNDx to MPFR_RNDx.
+
+------------------------------------------------------------------------
+r6280 | thevenyp | 2009-06-19 16:40:57 +0000 (Fri, 19 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: Add brace to disambiguate nested if, and remove unused variable.
+
+------------------------------------------------------------------------
+r6279 | thevenyp | 2009-06-19 15:57:09 +0000 (Fri, 19 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tests/tfprintf.c tests/tprintf.c: Do not test very small values with %f.
+
+------------------------------------------------------------------------
+r6278 | thevenyp | 2009-06-19 15:55:57 +0000 (Fri, 19 Jun 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug when the value to be printed is rounded to the next power of ten with %Rf or %Rg.
+tests/tsprintf.c: Add tests for rounding to next power of ten bug.
+
+------------------------------------------------------------------------
+r6277 | zimmerma | 2009-06-18 12:34:24 +0000 (Thu, 18 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added new functions to implement
+
+------------------------------------------------------------------------
+r6276 | thevenyp | 2009-06-16 11:14:48 +0000 (Tue, 16 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/sinh_cosh.c
+
+sinh_cosh.c: precision of intermediate computation no more depends on precision of input variables.
+
+------------------------------------------------------------------------
+r6275 | vlefevre | 2009-06-15 01:58:34 +0000 (Mon, 15 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: new MPFR_VALUE_OF macro, now used by mpfr_get_prec and
+mpfr_get_exp macros (this is cleaner than the old hack).
+------------------------------------------------------------------------
+r6274 | vlefevre | 2009-06-14 11:57:18 +0000 (Sun, 14 Jun 2009) | 5 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: Make sure results of calculations on constants used with
+the fesetround() test are not precomputed by GCC (occurs on MIPS).
+Patch from Maciej W. Rozycki.
+ https://sympa.inria.fr/sympa/arc/mpfr/2009-06/msg00036.html
+ http://article.gmane.org/gmane.comp.lib.mpfr.general/174
+------------------------------------------------------------------------
+r6272 | zimmerma | 2009-06-13 02:00:58 +0000 (Sat, 13 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+[algorithms.tex] bounds for get_str were checked by Mark Dickinson
+
+------------------------------------------------------------------------
+r6271 | zimmerma | 2009-06-12 04:25:44 +0000 (Fri, 12 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+[algorithms.tex] fixed typo
+
+------------------------------------------------------------------------
+r6270 | zimmerma | 2009-06-12 04:17:46 +0000 (Fri, 12 Jun 2009) | 4 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/mpfr.texi
+
+[algorithms.tex] fixed and completed up to b=62 table of bounds for get_str
+[mpfr.texi] fixed description of case n=0 for get_str (case of powers of two
+ bases was not coherent with the code)
+
+------------------------------------------------------------------------
+r6269 | zimmerma | 2009-06-10 18:52:10 +0000 (Wed, 10 Jun 2009) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+
+[algorithms.tex] analyzed precisely the cases where the value is m+1 instead
+ of m
+
+------------------------------------------------------------------------
+r6268 | vlefevre | 2009-06-10 05:21:05 +0000 (Wed, 10 Jun 2009) | 11 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: reverted incorrect patch r6267 that makes the test
+no longer work on x86 (with traditional FPU, no SSE), where one
+should get
+ checking for gcc float-conversion bug... yes, use -ffloat-store
+instead of
+ checking for gcc float-conversion bug... no
+Indeed the "volatile" has the effect to have all the intermediate
+results x stored into memory, i.e. it is more or less equivalent
+to the -ffloat-store option, so that it does not allow one to test
+whether -ffloat-store is needed or not (which is the goal of this
+test).
+------------------------------------------------------------------------
+r6267 | zimmerma | 2009-06-09 22:02:10 +0000 (Tue, 09 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+[acinclude.m4] patch from Maciej W. Rozycki on mpfr mailing-list, 9 Jun 2009
+
+------------------------------------------------------------------------
+r6266 | zimmerma | 2009-06-09 18:42:04 +0000 (Tue, 09 Jun 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/data/j0
+ M /trunk/tests/data/j1
+ M /trunk/tests/data/y0
+ M /trunk/tests/data/y1
+
+added more test cases for the Bessel functions (from John Harrison paper at
+Arith19)
+
+------------------------------------------------------------------------
+r6265 | thevenyp | 2009-06-04 17:15:24 +0000 (Thu, 04 Jun 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: Binary output with no digit after the decimal point is now supported. Fix bug when the binary or hexadecimal output value is rounded to the next power of the base. This also change outputs like 0xf.f with format string "%.0Ra" from 8p+1 to 1p+4 (as does gnu libc's printf).
+tests/tsprintf.c: add check for rounding to the next base power and fix some test value with %.0Ra (now output 1p+4 instead of 8p+3).
+
+------------------------------------------------------------------------
+r6264 | thevenyp | 2009-06-03 09:01:22 +0000 (Wed, 03 Jun 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr-longlong.h
+
+mpfr-longlong.h: Update to newer GMP version (changeset 12418:12a1d0bf21f0 Sun Mar 01 23:47:31 2009 +0100), merging modifications from r4657.
+
+------------------------------------------------------------------------
+r6263 | vlefevre | 2009-05-29 13:53:06 +0000 (Fri, 29 May 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: do not use GMP's namespace for identifiers defined in MPFR.
+------------------------------------------------------------------------
+r6261 | vlefevre | 2009-05-29 13:05:24 +0000 (Fri, 29 May 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added: do not use the GMP namespaces...
+------------------------------------------------------------------------
+r6259 | vlefevre | 2009-05-29 12:27:38 +0000 (Fri, 29 May 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: rewrote a comment.
+------------------------------------------------------------------------
+r6258 | thevenyp | 2009-05-29 07:37:23 +0000 (Fri, 29 May 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug, "%%" was not correctly displayed when used alone or before a mpfr_t output.
+tests/tfprintf.c tests/tprintf.c: Fix expected values for tests with "%%".
+
+------------------------------------------------------------------------
+r6257 | thevenyp | 2009-05-29 06:56:02 +0000 (Fri, 29 May 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Restate subsection Formatted Output Functions/Format String.
+
+------------------------------------------------------------------------
+r6256 | thevenyp | 2009-05-28 07:33:43 +0000 (Thu, 28 May 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: details on use of 'P' type in mpfr_printf.
+
+------------------------------------------------------------------------
+r6252 | thevenyp | 2009-05-27 14:59:54 +0000 (Wed, 27 May 2009) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: remind bug fixes since version 2.4.0.
+
+------------------------------------------------------------------------
+r6248 | thevenyp | 2009-05-27 13:17:03 +0000 (Wed, 27 May 2009) | 2 lines
+Changed paths:
+ M /trunk/set_d64.c
+
+set_d64.c: Partial revert of r6190 to fix problem in a simpler way: the decimal digits can be stored in array of char (no need to be unsigned).
+
+------------------------------------------------------------------------
+r6245 | vlefevre | 2009-05-27 02:26:50 +0000 (Wed, 27 May 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6241 | vlefevre | 2009-05-27 02:20:51 +0000 (Wed, 27 May 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfmod.c
+
+tests/tfmod.c: deleted trailing whitespace.
+------------------------------------------------------------------------
+r6240 | thevenyp | 2009-05-22 10:44:03 +0000 (Fri, 22 May 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tests/tatan.c: Add test triggering underflow (test coverage is now 100%).
+
+------------------------------------------------------------------------
+r6237 | vlefevre | 2009-05-20 21:54:03 +0000 (Wed, 20 May 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tests/tgeneric.c: for the second computation, increase the precision
+of the inputs in order to trigger the mpfr_fmod bug fixed in r6230
+(and potentially other bugs). Thanks to Eric Veach for the idea.
+------------------------------------------------------------------------
+r6236 | vlefevre | 2009-05-20 21:34:52 +0000 (Wed, 20 May 2009) | 1 line
+Changed paths:
+ M /trunk/tests
+
+Added tbuildopt to svn:ignore property of tests.
+------------------------------------------------------------------------
+r6234 | thevenyp | 2009-05-20 15:28:07 +0000 (Wed, 20 May 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfmod.c
+
+tests/tfmod.c: complete tests with special values.
+
+------------------------------------------------------------------------
+r6233 | thevenyp | 2009-05-20 15:26:47 +0000 (Wed, 20 May 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfmod.c
+
+tests/tfmod.c: code simplification + check ternary value too.
+
+------------------------------------------------------------------------
+r6232 | vlefevre | 2009-05-20 10:34:33 +0000 (Wed, 20 May 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfmod.c
+
+tests/tfmod.c: replaced NULL by (mpfr_ptr) 0 in mpfr_inits2/mpfr_clears.
+------------------------------------------------------------------------
+r6231 | vlefevre | 2009-05-20 10:32:07 +0000 (Wed, 20 May 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/tfmod.c
+
+tests/mpfr-test.h: added mpfr_cmp_ui0 macro (check that x is not a NaN).
+tests/tfmod.c (bug20090519): check that the results are not NaN's and
+replaced GMP_RNDN by MPFR_RNDN.
+------------------------------------------------------------------------
+r6230 | zimmerma | 2009-05-20 10:17:17 +0000 (Wed, 20 May 2009) | 3 lines
+Changed paths:
+ M /trunk/rem1.c
+ M /trunk/tests/tfmod.c
+
+[tests/tfmod.c] added testcase for bug reported by Eric Veach
+[rem1.c] fixed bug reported by Eric Veach
+
+------------------------------------------------------------------------
+r6229 | zimmerma | 2009-05-19 08:20:15 +0000 (Tue, 19 May 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added one item
+
+------------------------------------------------------------------------
+r6220 | lfousse | 2009-05-13 20:33:03 +0000 (Wed, 13 May 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Clarify the fact that mpfr_sum guarantees correct rounding.
+
+------------------------------------------------------------------------
+r6211 | vlefevre | 2009-05-13 15:40:36 +0000 (Wed, 13 May 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: updated a comment.
+------------------------------------------------------------------------
+r6210 | thevenyp | 2009-05-13 15:37:35 +0000 (Wed, 13 May 2009) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: Add a warning comment (removed in r6026).
+[merge -c 6209 from branch 2.4]
+
+------------------------------------------------------------------------
+r6196 | vlefevre | 2009-05-13 00:02:10 +0000 (Wed, 13 May 2009) | 2 lines
+Changed paths:
+ M /trunk/fms.c
+
+fms.c: improve the performance of memory allocations in small precision
+(almost identical to changeset 6195 for fma.c).
+------------------------------------------------------------------------
+r6195 | vlefevre | 2009-05-12 23:54:31 +0000 (Tue, 12 May 2009) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: patch by Patrick Pélissier to improve the performance of
+memory allocations in small precision.
+------------------------------------------------------------------------
+r6192 | thevenyp | 2009-05-05 17:13:37 +0000 (Tue, 05 May 2009) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/dump.c
+ M /trunk/get_d64.c
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/out_str.c
+ M /trunk/printf.c
+ M /trunk/set_d.c
+ M /trunk/strtofr.c
+ M /trunk/swap.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tversion.c
+ M /trunk/vasprintf.c
+
+Put '#include <string.h>' in mpfr-impl.h, remove it elsewhere.
+Other cleanup of header inclusion.
+Other change (by mistake): corrections in algorithms.tex
+------------------------------------------------------------------------
+r6191 | vlefevre | 2009-05-05 15:42:32 +0000 (Tue, 05 May 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: corrections / limit to 80 characters per line.
+------------------------------------------------------------------------
+r6190 | thevenyp | 2009-05-05 14:37:42 +0000 (Tue, 05 May 2009) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+
+get_d64.c set_d64.c: Fix types.
+
+------------------------------------------------------------------------
+r6189 | thevenyp | 2009-05-05 14:34:41 +0000 (Tue, 05 May 2009) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/tests/tpow_all.c
+
+printf.c tests/tpow_all.c: <string.h> is not automatically included when compiling with --with-gmp-build option.
+
+------------------------------------------------------------------------
+r6188 | thevenyp | 2009-05-05 14:06:43 +0000 (Tue, 05 May 2009) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ A /trunk/buildopt.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tbuildopt.c
+
+NEWS Makefile.am mpfr.h mpfr.texi buildopt.c: New functions mpfr_buildopt_tls_p and mpfr_buildopt_decimal_p.
+tests/Makefile.am tests/tbuildopt.c: Add tests for mpfr_buildopt_tls_p and mpfr_buildopt_decimal_p.
+
+------------------------------------------------------------------------
+r6187 | vlefevre | 2009-05-05 13:55:21 +0000 (Tue, 05 May 2009) | 1 line
+Changed paths:
+ M /trunk/atan.c
+
+atan.c: added comments after checking r6186.
+------------------------------------------------------------------------
+r6186 | thevenyp | 2009-05-05 10:07:47 +0000 (Tue, 05 May 2009) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/tests/tatan.c
+
+atan.c: expand exponent range when computing arctan(Inf) and arctan(+-1).
+tests/tatan.c: Check underflow of arctan(Inf) and arctan(1) with reduced exponent range.
+
+------------------------------------------------------------------------
+r6185 | vlefevre | 2009-05-04 16:27:56 +0000 (Mon, 04 May 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tests/tatan.c: replaced GMP_RNDN by MPFR_RNDN.
+------------------------------------------------------------------------
+r6182 | vlefevre | 2009-04-29 16:19:26 +0000 (Wed, 29 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/tests/tget_f.c
+
+Removed trailing spaces.
+------------------------------------------------------------------------
+r6181 | zimmerma | 2009-04-29 16:07:29 +0000 (Wed, 29 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+[atan.c] fixed bug when x is very near but differs from 1
+
+------------------------------------------------------------------------
+r6180 | vlefevre | 2009-04-29 15:41:23 +0000 (Wed, 29 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tests/tatan.c: added testcase for bug found by Christopher Creutzig
+(atan2_different_prec).
+------------------------------------------------------------------------
+r6177 | vlefevre | 2009-04-22 12:46:41 +0000 (Wed, 22 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c (data_check): try to open the data file first from the
+build directory, then from the source directory.
+------------------------------------------------------------------------
+r6176 | vlefevre | 2009-04-22 12:00:23 +0000 (Wed, 22 Apr 2009) | 4 lines
+Changed paths:
+ M /trunk/init2.c
+
+init2.c: check that mp_bits_per_limb == BITS_PER_MP_LIMB (useful
+in case GMP is upgraded with a different ABI, e.g. 32 vs mode32
+on PowerPC 64). Without such a check, MPFR can give incorrect
+results if the ABI's don't match.
+------------------------------------------------------------------------
+r6175 | vlefevre | 2009-04-22 08:33:57 +0000 (Wed, 22 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tmul.c
+
+Improved fix for problem dealt with in r6174: use function src_fopen()
+(from tests.c) instead of a macro MPFR_SRCDIR.
+------------------------------------------------------------------------
+r6174 | vlefevre | 2009-04-22 08:13:40 +0000 (Wed, 22 Apr 2009) | 10 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tmul.c
+
+Fixed problem when the srcdir value contains a word that is #define'd
+by the C implementation (test failure) or a comma (worse, the build of
+the tests terminates with an error). This can happen only when objdir
+and srcdir are different directories.
+ * tests/Makefile.am (tmul_CPPFLAGS): Put srcdir pathname in quotes.
+ * tests/tmul.c (MPFR_SRCDIR): Make the default a string.
+ (QUOTE, NAME): Delete.
+ (check_regression): Don't QUOTE MPFR_SRCDIR.
+Thanks to Sandra Loosemore for the patch.
+https://sympa.inria.fr/sympa/arc/mpfr/2009-04/msg00038.html
+------------------------------------------------------------------------
+r6173 | thevenyp | 2009-04-15 17:07:42 +0000 (Wed, 15 Apr 2009) | 3 lines
+Changed paths:
+ M /trunk/get_f.c
+ M /trunk/tests/tget_f.c
+
+get_f.c: remove dead code (x and z always have the same number of limbs).
+tests/tget_f.c: Add tests with every rounding mode, add tests with random values.
+
+------------------------------------------------------------------------
+r6172 | thevenyp | 2009-04-15 09:34:54 +0000 (Wed, 15 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+tests/tget_f.c: Fix typos, better error messages.
+
+------------------------------------------------------------------------
+r6171 | thevenyp | 2009-04-14 14:34:20 +0000 (Tue, 14 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/get_f.c
+ M /trunk/tests/tget_f.c
+
+tests/tget_f.c get_f.c: Set result to the maximum value when the mpfr_t is plus infinity and set correct ternary value.
+
+------------------------------------------------------------------------
+r6170 | thevenyp | 2009-04-14 14:29:16 +0000 (Tue, 14 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+tests/tget_f.c: Fix typo, increase size of y so that x and y have different limb size (they had the same size on MacOS X-32bits).
+
+------------------------------------------------------------------------
+r6168 | vlefevre | 2009-04-10 08:29:47 +0000 (Fri, 10 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: update concerning intmax_t after the change in r6166.
+------------------------------------------------------------------------
+r6166 | vlefevre | 2009-04-10 08:23:33 +0000 (Fri, 10 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: for intmax_t, also test _STDINT_H and _STDINT_H_.
+[merged changeset r6165 from the 2.4 branch]
+------------------------------------------------------------------------
+r6164 | vlefevre | 2009-04-10 08:10:37 +0000 (Fri, 10 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r6162 | vlefevre | 2009-04-10 08:09:47 +0000 (Fri, 10 Apr 2009) | 5 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+mpfr.h: for the intmax_t detection, also test INTMAX_MAX / UINTMAX_MAX
+(this may be useful for users of C++ compilers, if they have defined
+__STDC_LIMIT_MACROS but not __STDC_CONSTANT_MACROS).
+mpfr.texi: improvement concerning the use of intmax_t and uintmax_t.
+[merged changesets r6160 and r6161 from the 2.4 branch]
+------------------------------------------------------------------------
+r6159 | zimmerma | 2009-04-09 07:40:14 +0000 (Thu, 09 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] updated Notes on AIX/PowerPC
+
+------------------------------------------------------------------------
+r6158 | thevenyp | 2009-04-08 14:59:21 +0000 (Wed, 08 Apr 2009) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/get_f.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_f.c
+
+NEWS mpfr.texi get_f.c: mpfr_get_f now returns the usual ternary value.
+tests/tget_f.c: test the ternary value and the erange flag.
+
+------------------------------------------------------------------------
+r6157 | vlefevre | 2009-04-08 14:25:26 +0000 (Wed, 08 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/get_z.c
+ M /trunk/tests/tget_z.c
+
+tests/tget_z.c: do not assume specific values of the ternary value.
+get_z.c: simplified code.
+------------------------------------------------------------------------
+r6156 | vlefevre | 2009-04-08 14:19:23 +0000 (Wed, 08 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: s/an inexact value/a ternary value/
+------------------------------------------------------------------------
+r6155 | thevenyp | 2009-04-08 12:53:37 +0000 (Wed, 08 Apr 2009) | 4 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/get_z.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_z.c
+
+NEWS mpfr.texi get_z.c: mpfr_get_z now returns an inexact value.
+mpfr.h: change prototype of mpfr_get_z.
+tests/tget_z.c: test inexact value.
+
+------------------------------------------------------------------------
+r6154 | zimmerma | 2009-04-08 11:10:46 +0000 (Wed, 08 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+[mpf2mpfr.h] added comment for #endif
+
+------------------------------------------------------------------------
+r6153 | thevenyp | 2009-04-08 11:09:14 +0000 (Wed, 08 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+mpf2mpfr.h: fix typo
+
+------------------------------------------------------------------------
+r6152 | vlefevre | 2009-04-02 16:03:05 +0000 (Thu, 02 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/get_z.c
+
+get_z.c: fixed title in comment.
+------------------------------------------------------------------------
+r6151 | vlefevre | 2009-04-01 14:22:03 +0000 (Wed, 01 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/get_z.c
+
+get_z.c: detect out-of-range precision (such a detection could be missed
+if mpfr_exp_t > mpfr_prec_t).
+------------------------------------------------------------------------
+r6150 | vlefevre | 2009-04-01 14:07:29 +0000 (Wed, 01 Apr 2009) | 2 lines
+Changed paths:
+ M /trunk/get_z.c
+ M /trunk/mpfr.h
+
+Removed the comment from mpfr.h added in r6149, and patched get_z.c
+(safer code is better than a comment).
+------------------------------------------------------------------------
+r6149 | vlefevre | 2009-04-01 14:02:14 +0000 (Wed, 01 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: important comment to validate the change done in r6147.
+------------------------------------------------------------------------
+r6148 | vlefevre | 2009-04-01 13:46:30 +0000 (Wed, 01 Apr 2009) | 1 line
+Changed paths:
+ M /trunk/get_z_exp.c
+
+get_z_exp.c: updated comments.
+------------------------------------------------------------------------
+r6147 | zimmerma | 2009-04-01 13:26:42 +0000 (Wed, 01 Apr 2009) | 3 lines
+Changed paths:
+ M /trunk/get_z.c
+ M /trunk/tests/tget_z.c
+
+[get_z.c] simplified the code, removed the FIXME
+[tget_z.c] added new test
+
+------------------------------------------------------------------------
+r6146 | zimmerma | 2009-04-01 13:11:13 +0000 (Wed, 01 Apr 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_z.c
+
+[mpfr.texi] completed documentation of mpfr_get_z_exp (was incomplete for 0)
+[tget_z.c] added test case for 0 with emin > 0 (should give 100% coverage for
+ get_z.c)
+
+------------------------------------------------------------------------
+r6145 | thevenyp | 2009-03-30 14:47:28 +0000 (Mon, 30 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tset_str.c
+ M /trunk/vasprintf.c
+
+strtofr.c tests/tset_str.c: Code simplification (sizeof (char) is always 1).
+vasprintf.c: Cast into size_t (just in case).
+
+------------------------------------------------------------------------
+r6144 | thevenyp | 2009-03-30 12:15:40 +0000 (Mon, 30 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: Code simplification (sizeof (char) is always 1).
+
+------------------------------------------------------------------------
+r6143 | thevenyp | 2009-03-27 09:34:03 +0000 (Fri, 27 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+acinclude.m4: remove definition of va_copy, just detect its presence.
+printf.c vasprintf.c: #define a replacement of va_copy if needed (in the same way as gmp).
+
+------------------------------------------------------------------------
+r6142 | thevenyp | 2009-03-26 15:09:38 +0000 (Thu, 26 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: Change MPFR_FUNC_PRINTF_SPEC (renamed MPFR_FUNC_GMP_PRINTF_SPEC) so that it actually checks output.
+
+------------------------------------------------------------------------
+r6141 | thevenyp | 2009-03-25 17:53:50 +0000 (Wed, 25 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/out_str.c
+ M /trunk/tests/inp_str.data
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_str.c
+
+Change base upper limit in string conversion up to 62.
+
+------------------------------------------------------------------------
+r6140 | zimmerma | 2009-03-25 12:13:58 +0000 (Wed, 25 Mar 2009) | 4 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_str.c
+
+[mpfr.texi] fixed documentation of mpfr_get_str which was wrong
+[tget_str.c] added test cases for odd base and tie breaking case
+[get_str.c] fixed typos in comments
+
+------------------------------------------------------------------------
+r6139 | zimmerma | 2009-03-25 08:54:17 +0000 (Wed, 25 Mar 2009) | 5 lines
+Changed paths:
+ M /trunk/tests/random2.c
+
+[tests/random2.c] added missing mpfr-test.h (revealed by nightly tests), and
+ removed mpfr-impl.h (already included in mpfr-test.h)
+ I have also removed MPFR_NEED_LONGLONG_H: I don't see why it
+ is needed, and all tests pass.
+
+------------------------------------------------------------------------
+r6138 | thevenyp | 2009-03-24 17:19:55 +0000 (Tue, 24 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Add a note on mpfr_printf output in binary with precision one.
+
+------------------------------------------------------------------------
+r6137 | thevenyp | 2009-03-24 16:51:17 +0000 (Tue, 24 Mar 2009) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/random2.c
+ M /trunk/tests/tests.c
+ M /trunk/urandomb.c
+
+urandomb.c mpfr-gmp.c mpfr-gmp.h: mpfr_rand_raw is now in urandom.c.
+mpfr-impl.h: mpfr_rand_raw is now always build as an internal function.
+TODO tests/tests.c tests/random2.c: Use mpfr_rand_raw instead of _gmp_rand
+
+------------------------------------------------------------------------
+r6136 | thevenyp | 2009-03-24 15:10:52 +0000 (Tue, 24 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ D /trunk/random2.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ A /trunk/tests/random2.c (from /trunk/random2.c:6135)
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+
+Move mpfr_random2 to tests directory, remove it from API.
+
+------------------------------------------------------------------------
+r6135 | thevenyp | 2009-03-24 14:29:04 +0000 (Tue, 24 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Improve documentation in Formatted Output Functions/Format String subsection.
+
+------------------------------------------------------------------------
+r6134 | vlefevre | 2009-03-24 11:33:41 +0000 (Tue, 24 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/sin.c
+
+cos.c, sin.c: added MPFR_ASSERTN for huge expx.
+------------------------------------------------------------------------
+r6132 | vlefevre | 2009-03-21 00:52:31 +0000 (Sat, 21 Mar 2009) | 6 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tstrtofr.c
+
+mpfr.texi: corrected mpfr_strtofr documentation ("NAN()" is accepted).
+tests/tstrtofr.c: added a test for "NAN()".
+Note: the code follows the ISO C99 standard for strtod, as explained
+in the mpfr_strtofr documentation, so that the code was correct.
+[merged changeset 6131 from the 2.4 branch and changed GMP_RNDN into
+MPFR_RNDN]
+------------------------------------------------------------------------
+r6130 | vlefevre | 2009-03-19 02:11:38 +0000 (Thu, 19 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: added some tests for acinclude.m4 and configure.in (sh).
+------------------------------------------------------------------------
+r6128 | vlefevre | 2009-03-19 02:03:29 +0000 (Thu, 19 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Applied patch from Ralf Wildenhues.
+ * configure.in: Avoid unportable (and unneeded) shell quoting.
+ * acinclude.m4: Avoid non-POSIX shell construct.
+------------------------------------------------------------------------
+r6126 | vlefevre | 2009-03-18 11:15:05 +0000 (Wed, 18 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tmin_prec.c
+
+tests/tmin_prec.c: replaced GMP_RNDN by MPFR_RNDN.
+------------------------------------------------------------------------
+r6125 | vlefevre | 2009-03-16 18:38:03 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+tests/tset_ld.c: removed unused variable.
+------------------------------------------------------------------------
+r6124 | thevenyp | 2009-03-16 17:46:18 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+tests/tset_ld.c: Add test case for the bug fixed with r6101.
+
+------------------------------------------------------------------------
+r6123 | vlefevre | 2009-03-16 15:50:58 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tmin_prec.c
+
+tests/tmin_prec.c: added tests.
+------------------------------------------------------------------------
+r6122 | vlefevre | 2009-03-16 15:43:39 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+------------------------------------------------------------------------
+r6121 | vlefevre | 2009-03-16 15:40:48 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/min_prec.c
+
+min_prec.c: fixed another bug (the code was incorrect with >= 2 limbs).
+------------------------------------------------------------------------
+r6120 | vlefevre | 2009-03-16 15:37:10 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tmin_prec.c
+
+tests/tmin_prec.c: bug fix (side effects in MPFR_ASSERTN), new tests.
+------------------------------------------------------------------------
+r6119 | vlefevre | 2009-03-16 15:28:11 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a note about assertions and code with side effects.
+------------------------------------------------------------------------
+r6118 | thevenyp | 2009-03-16 15:23:46 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+tests/tfprintf.c: Use a value less than 2^31-1 compatible (thus < LONG_MAX) in bug_20090316 (cf r6112).
+
+------------------------------------------------------------------------
+r6117 | vlefevre | 2009-03-16 15:07:50 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tmin_prec.c
+
+Replaced GMP_RND* by MPFR_RND*.
+------------------------------------------------------------------------
+r6116 | zimmerma | 2009-03-16 12:50:24 +0000 (Mon, 16 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tmin_prec.c
+
+[tests/tmin_prec.c] new file contributed from Laurent Fousse
+[tests/Makefile.am] added tmin_prec
+
+------------------------------------------------------------------------
+r6115 | vlefevre | 2009-03-16 12:35:27 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/min_prec.c
+
+min_prec.c: removed a useless test.
+------------------------------------------------------------------------
+r6114 | vlefevre | 2009-03-16 12:30:20 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/min_prec.c
+
+min_prec.c: fixed another bug.
+------------------------------------------------------------------------
+r6113 | thevenyp | 2009-03-16 12:26:29 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: Add more debug assertion on the buffer size.
+
+------------------------------------------------------------------------
+r6112 | thevenyp | 2009-03-16 12:03:43 +0000 (Mon, 16 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug_20090316 (in buffer_cat, the buffer was 1 character too small in some cases).
+tests/tfprintf.c: Add test for bug_20090316.
+
+------------------------------------------------------------------------
+r6111 | vlefevre | 2009-03-16 11:57:41 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+tests/tadd.c: changed GMP_RND* (from r6071) into MPFR_RND*; this should
+have been done when porting the patch from the 2.4 branch.
+------------------------------------------------------------------------
+r6110 | thevenyp | 2009-03-16 10:25:16 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: Use new environment variable MPFR_CHECK_LARGEMEM for memory expensive test.
+
+------------------------------------------------------------------------
+r6109 | vlefevre | 2009-03-16 10:12:57 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/min_prec.c
+
+min_prec.c: bug fixed by Laurent.
+------------------------------------------------------------------------
+r6108 | thevenyp | 2009-03-16 10:01:24 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: Fix typo.
+
+------------------------------------------------------------------------
+r6107 | vlefevre | 2009-03-16 09:32:21 +0000 (Mon, 16 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/min_prec.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Fixed the prototype of mpfr_min_prec (should return a mpfr_prec_t)
+and its description.
+------------------------------------------------------------------------
+r6106 | vlefevre | 2009-03-16 09:26:54 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/min_prec.c
+
+min_prec.c: fixed a bug (but the code should be improved).
+------------------------------------------------------------------------
+r6105 | vlefevre | 2009-03-16 09:23:46 +0000 (Mon, 16 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/min_prec.c
+
+min_prec.c: simplified the singular cases (see other functions).
+------------------------------------------------------------------------
+r6104 | lfousse | 2009-03-15 20:44:23 +0000 (Sun, 15 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Add protoype for mpfr_min_prec in mpfr.h.
+
+------------------------------------------------------------------------
+r6103 | lfousse | 2009-03-15 20:34:33 +0000 (Sun, 15 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation for mpfr_min_prec.
+
+------------------------------------------------------------------------
+r6102 | lfousse | 2009-03-15 20:34:00 +0000 (Sun, 15 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/min_prec.c
+
+New function mpfr_min_prec.
+
+------------------------------------------------------------------------
+r6101 | vlefevre | 2009-03-15 03:17:06 +0000 (Sun, 15 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+get_ld.c: fixed bugs in the case HAVE_LDOUBLE_IEEE_EXT_LITTLE (one found
+by Steve Kargl, and another one concerning the mpfr_set_emax value).
+------------------------------------------------------------------------
+r6100 | thevenyp | 2009-03-13 17:58:59 +0000 (Fri, 13 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: This is probably dead code, but being uncertain, put an assert here.
+
+------------------------------------------------------------------------
+r6099 | thevenyp | 2009-03-13 17:55:13 +0000 (Fri, 13 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: As the buffer helper functions are not used in the current code with a zero parameter len, do not handle this case anymore, check that these cases do not happend in MPFR_ASSERTD macros, add some additional assert to ensure consistency.
+
+------------------------------------------------------------------------
+r6098 | thevenyp | 2009-03-13 17:47:57 +0000 (Fri, 13 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: make clear that string_buffer.curr is a pointer to the null terminating character, fix the only place where it was not handle so.
+
+------------------------------------------------------------------------
+r6097 | thevenyp | 2009-03-13 17:36:20 +0000 (Fri, 13 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug.
+
+------------------------------------------------------------------------
+r6096 | thevenyp | 2009-03-13 17:30:10 +0000 (Fri, 13 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+tests/tprintf.c: Add an expensive test where the output number has more than INT_MAX characters.
+vasprintf.c: Fix the bug triggered by the new test in tsprintf.c.
+
+------------------------------------------------------------------------
+r6095 | thevenyp | 2009-03-13 17:17:42 +0000 (Fri, 13 Mar 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+
+mpfr.texi: Do cosmetic changes and add some details on printf behavior when the precision field is empty.
+tests/tsprintf.c: improve code coverage.
+tests/tprintf.c: improve code coverage, check the behavior describe in mpfr.texi.
+
+------------------------------------------------------------------------
+r6091 | vlefevre | 2009-03-12 12:54:29 +0000 (Thu, 12 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/zeta_ui.c
+
+zeta_ui.c: correction r6090 was incorrect as there was another problem:
+the 3rd argument of mpz_divexact_ui is an unsigned long, not a limb.
+So, fixed the shift count (assuming no padding bits in unsigned long).
+------------------------------------------------------------------------
+r6090 | vlefevre | 2009-03-12 12:45:21 +0000 (Thu, 12 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/zeta_ui.c
+
+zeta_ui.c bug fix: a shift count could be >= width of type (if a limb is
+a long long and long long is twice the size of a long). This problem was
+detected by a warning on gcc40 with CFLAGS="-mpowerpc64 -mcpu=970 -O2".
+------------------------------------------------------------------------
+r6088 | vlefevre | 2009-03-10 01:11:36 +0000 (Tue, 10 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: added missing cast to void * for %p.
+------------------------------------------------------------------------
+r6086 | vlefevre | 2009-03-09 15:51:27 +0000 (Mon, 09 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+tests/tfprintf.c: added missing cast to void * for %p.
+------------------------------------------------------------------------
+r6084 | vlefevre | 2009-03-09 15:42:51 +0000 (Mon, 09 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: fixed bug in CONSUME_VA_ARG for case MP_LIMB_ARG (%Mu).
+------------------------------------------------------------------------
+r6082 | vlefevre | 2009-03-09 14:09:10 +0000 (Mon, 09 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: GMP with ABI=mode32 should be tested on 64-bit PowerPC.
+------------------------------------------------------------------------
+r6081 | thevenyp | 2009-03-06 18:07:12 +0000 (Fri, 06 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: now return -1 when the format string is invalid (undefined behavior in standard C99)
+tests/tprintf.c: Additional checks with invalid format strings.
+
+------------------------------------------------------------------------
+r6080 | thevenyp | 2009-03-06 18:01:24 +0000 (Fri, 06 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Add missing conversion specifier accepted with mpfr_t variable.
+
+------------------------------------------------------------------------
+r6079 | vlefevre | 2009-03-06 13:03:44 +0000 (Fri, 06 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/add1.c
+
+add1.c: assertions on the argument values should use MPFR_ASSERTN.
+------------------------------------------------------------------------
+r6077 | zimmerma | 2009-03-06 11:50:19 +0000 (Fri, 06 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/cache.c
+
+[cache.c] improved comment for mpfr_init_cache
+
+------------------------------------------------------------------------
+r6076 | zimmerma | 2009-03-06 11:44:10 +0000 (Fri, 06 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+
+[add1.c] transformed switch() into if-then-else, to get 100% coverage
+
+------------------------------------------------------------------------
+r6074 | vlefevre | 2009-03-06 00:45:57 +0000 (Fri, 06 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/cache.c
+
+untabify
+------------------------------------------------------------------------
+r6073 | vlefevre | 2009-03-06 00:40:20 +0000 (Fri, 06 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/update-faq
+
+update-faq: change GMP_RND into MPFR_RND from the version on the web
+(since MPFR 3.0 hasn't been released yet, the FAQ still uses the 2.x
+API).
+------------------------------------------------------------------------
+r6071 | vlefevre | 2009-03-05 23:46:45 +0000 (Thu, 05 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tadd.c
+
+tests/tadd.c: completed the code coverage (case bk == 0 in add1.c).
+------------------------------------------------------------------------
+r6070 | zimmerma | 2009-03-05 19:44:05 +0000 (Thu, 05 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/mpfr-impl.h
+
+[mpfr-impl.h,cache.c] commented out mpfr_init_cache
+
+------------------------------------------------------------------------
+r6069 | zimmerma | 2009-03-05 16:37:19 +0000 (Thu, 05 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/const_catalan.c
+
+[const_catalan.c] decreased initial Ziv precision to get 100% coverage
+
+------------------------------------------------------------------------
+r6068 | zimmerma | 2009-03-05 16:28:13 +0000 (Thu, 05 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/cmp2.c
+ M /trunk/tests/tcmp2.c
+
+[cmp2.c] added comments
+[tcmp2.c] added test to improve coverage to 100%
+
+------------------------------------------------------------------------
+r6067 | zimmerma | 2009-03-05 14:12:32 +0000 (Thu, 05 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/tests/tatan.c
+
+[atan2.c,tatan.c] reduced Ziv's initial precision and added test to have
+ 100% coverage of atan2.c
+
+------------------------------------------------------------------------
+r6066 | zimmerma | 2009-03-05 13:43:18 +0000 (Thu, 05 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+[atan.c] coverage should now be 100%
+
+------------------------------------------------------------------------
+r6065 | zimmerma | 2009-03-04 17:09:02 +0000 (Wed, 04 Mar 2009) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+[algorithms.bib] added new reference
+[TODO] added pointers
+
+------------------------------------------------------------------------
+r6059 | vlefevre | 2009-03-04 12:59:50 +0000 (Wed, 04 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+
+mpfr-gmp.c (mpfr_assert_fail): output "MPFR" too in assertion failure
+messages.
+------------------------------------------------------------------------
+r6057 | vlefevre | 2009-03-04 01:33:17 +0000 (Wed, 04 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/mpfrlint
+
+Updated mpfrlint script.
+------------------------------------------------------------------------
+r6056 | vlefevre | 2009-03-04 01:06:47 +0000 (Wed, 04 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated month.
+------------------------------------------------------------------------
+r6055 | vlefevre | 2009-03-04 01:02:26 +0000 (Wed, 04 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: say that the license has changed.
+------------------------------------------------------------------------
+r6054 | vlefevre | 2009-03-03 17:32:00 +0000 (Tue, 03 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+Updated NEWS (function mpfr_random has been removed).
+------------------------------------------------------------------------
+r6053 | zimmerma | 2009-03-03 16:51:07 +0000 (Tue, 03 Mar 2009) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/TODO
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/div.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/eint.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_ld.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/modf.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/replace_all
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sech.c
+ M /trunk/set_ld.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/vasprintf.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+GMP_RNDX -> MPFR_RNDX
+
+------------------------------------------------------------------------
+r6051 | vlefevre | 2009-03-03 14:05:38 +0000 (Tue, 03 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/tests
+
+tests: added taway to svn:ignore property.
+------------------------------------------------------------------------
+r6050 | vlefevre | 2009-03-03 14:03:06 +0000 (Tue, 03 Mar 2009) | 1 line
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/COPYING.LIB
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/mbench/Makefile
+ M /trunk/mbench/README
+ M /trunk/mbench/generate.c
+ M /trunk/mbench/mfv5-arprec.cc
+ M /trunk/mbench/mfv5-cln.cc
+ M /trunk/mbench/mfv5-crlibm.cc
+ M /trunk/mbench/mfv5-libc.cc
+ M /trunk/mbench/mfv5-lidia.cc
+ M /trunk/mbench/mfv5-mpf.cc
+ M /trunk/mbench/mfv5-mpfr.cc
+ M /trunk/mbench/mfv5-ntl.cc
+ M /trunk/mbench/mfv5-pari.cc
+ M /trunk/mbench/mfv5-void.cc
+ M /trunk/mbench/mfv5.cc
+ M /trunk/mbench/mfv5.h
+ M /trunk/mbench/mpfr-gfx.c
+ M /trunk/mbench/mpfr-v4.c
+ M /trunk/mbench/mpfr-v6.c
+ M /trunk/mbench/timp.h
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-longlong.h
+ M /trunk/mpfr-thread.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/random2.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/speed.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Update to LGPL v3+, as decided by the main MPFR developers.
+------------------------------------------------------------------------
+r6043 | vlefevre | 2009-02-27 15:46:06 +0000 (Fri, 27 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/add.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/rem1.c
+ M /trunk/round_near_x.c
+ M /trunk/set_z.c
+ M /trunk/tests/taway.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Untabified and deleted trailing spaces (for patches).
+------------------------------------------------------------------------
+r6041 | zimmerma | 2009-02-27 14:33:12 +0000 (Fri, 27 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/rint.c
+ M /trunk/tests/tget_sj.c
+
+[rint.c] fixed a bug incorporated with the round away mode
+[tget_sj.c] fixed the tests for round away
+
+------------------------------------------------------------------------
+r6040 | zimmerma | 2009-02-27 14:11:22 +0000 (Fri, 27 Feb 2009) | 5 lines
+Changed paths:
+ M /trunk/rint.c
+ M /trunk/set_z.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/taway.c
+
+[rint.c] fixed bug with round away
+[taway.c] new test file for round away (with random values)
+[tests/Makefile.am] added taway
+[set_z.c] GNU style
+
+------------------------------------------------------------------------
+r6037 | thevenyp | 2009-02-27 13:38:30 +0000 (Fri, 27 Feb 2009) | 5 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: Change test5rm (formerly test4rm) so that it checks the new
+GMP_RNDA rounding mode, and that the corresponding rounding towards infinity
+is checked with GMP_RNDZ or with GMP_RNDA in one-pass mode (now, two-pass
+mode). Remove a comment about a warning from gcc solved with r5057.
+
+------------------------------------------------------------------------
+r6036 | zimmerma | 2009-02-27 13:27:41 +0000 (Fri, 27 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/rem1.c
+ M /trunk/tests/tremquo.c
+
+[rem1.c] fixed bug found in adding tests for round away
+
+------------------------------------------------------------------------
+r6035 | zimmerma | 2009-02-27 06:36:54 +0000 (Fri, 27 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+[add.c] added comment for 0 + 0 with round away
+
+------------------------------------------------------------------------
+r6034 | vlefevre | 2009-02-26 23:02:57 +0000 (Thu, 26 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+tests/texceptions.c: removed obsolete comments from r2427.
+------------------------------------------------------------------------
+r6033 | zimmerma | 2009-02-26 21:28:42 +0000 (Thu, 26 Feb 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/tsub.c
+
+[mpfr.h] added comment about order of rounding modes
+[texceptions.c] added comments, fixed typo
+[tsub.c] added test, fixed typo
+
+------------------------------------------------------------------------
+r6032 | thevenyp | 2009-02-26 18:21:14 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+
+Add tests with round away mode.
+
+------------------------------------------------------------------------
+r6031 | vlefevre | 2009-02-26 17:25:26 +0000 (Thu, 26 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version to 3.0.0-dev.
+------------------------------------------------------------------------
+r6030 | zimmerma | 2009-02-26 15:47:06 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/TODO
+ M /trunk/add1.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/div_ui.c
+ M /trunk/erf.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/hypot.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/print_rnd_mode.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/set_rnd.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+added round to away (still experimental)
+
+------------------------------------------------------------------------
+r6026 | zimmerma | 2009-02-26 10:31:39 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+[mpfr.h] added comments for rounding modes
+
+------------------------------------------------------------------------
+r6022 | vlefevre | 2009-02-26 01:41:26 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/m4
+
+Added svn:ignore property on the m4 directory (these .m4 files are
+generated automatically).
+------------------------------------------------------------------------
+r6021 | vlefevre | 2009-02-26 01:36:06 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: updated -version-info (since mpfr_random has been removed,
+we already know its value).
+------------------------------------------------------------------------
+r6019 | vlefevre | 2009-02-26 01:26:45 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: do not check libtool -version-info value if the VERSION
+file contains "-dev".
+------------------------------------------------------------------------
+r6018 | vlefevre | 2009-02-26 01:16:02 +0000 (Thu, 26 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: In a "make dist", check that libtool -version-info value
+is up-to-date (this is a heuristic only).
+------------------------------------------------------------------------
+r6016 | vlefevre | 2009-02-26 00:36:25 +0000 (Thu, 26 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release" -- it is important to read
+this section entirely before making any release (even if some steps
+may be skipped for some particular releases).
+------------------------------------------------------------------------
+r6010 | vlefevre | 2009-02-25 22:06:27 +0000 (Wed, 25 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: do not use VLA's (C99 only).
+------------------------------------------------------------------------
+r6003 | vlefevre | 2009-02-25 14:24:06 +0000 (Wed, 25 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: update about patches.
+------------------------------------------------------------------------
+r5999 | vlefevre | 2009-02-25 12:44:51 +0000 (Wed, 25 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: coding style: removed spurious spaces.
+------------------------------------------------------------------------
+r5997 | vlefevre | 2009-02-25 12:16:17 +0000 (Wed, 25 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated month.
+------------------------------------------------------------------------
+r5996 | vlefevre | 2009-02-25 12:14:38 +0000 (Wed, 25 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/printf.c
+
+printf.c: fixed assertion failures in the case buffer == NULL and
+size == 0 (see r5995). Also replaced MPFR_ASSERTD(buf != NULL) by
+MPFR_ASSERTN(buf != NULL) since buf is provided as an argument.
+------------------------------------------------------------------------
+r5995 | vlefevre | 2009-02-25 12:12:52 +0000 (Wed, 25 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: added mpfr_snprintf/mpfr_vsnprintf tests with
+buffer == NULL and size == 0 (as allowed in C99 snprintf/vsnprintf
+and by the MPFR documentation).
+------------------------------------------------------------------------
+r5994 | thevenyp | 2009-02-25 09:58:15 +0000 (Wed, 25 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Fix typos.
+
+------------------------------------------------------------------------
+r5993 | vlefevre | 2009-02-24 19:40:06 +0000 (Tue, 24 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/tuneup.c
+
+tuneup.c: untabified.
+------------------------------------------------------------------------
+r5992 | thevenyp | 2009-02-24 18:04:04 +0000 (Tue, 24 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/tests/tsprintf.c
+
+printf.c: Fix wrong return value, mpfr_snprintf and mpfr_vsnprintf functions must always return the number of character that would be written if the parameter n had been sufficiently large (it previously returned zero when n == 0).
+tests/tsprintf.c: Fix test of mpfr_snprintf and mpfr_vsnprintf (the wrong return value was checked).
+
+------------------------------------------------------------------------
+r5991 | vlefevre | 2009-02-24 15:38:37 +0000 (Tue, 24 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/printf.c
+
+printf.c: fix buffer overflow in mpfr_snprintf and mpfr_vsnprintf.
+------------------------------------------------------------------------
+r5990 | vlefevre | 2009-02-24 15:37:33 +0000 (Tue, 24 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: added a test showing a buffer overflow in mpfr_vsnprintf.
+------------------------------------------------------------------------
+r5989 | vlefevre | 2009-02-24 15:30:06 +0000 (Tue, 24 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: added a test showing a buffer overflow in mpfr_snprintf.
+------------------------------------------------------------------------
+r5985 | vlefevre | 2009-02-23 12:21:47 +0000 (Mon, 23 Feb 2009) | 12 lines
+Changed paths:
+ M /trunk/tests/tests.c
+ M /trunk/tests/tversion.c
+ M /trunk/update-version
+
+Changed how the test of MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR and
+MPFR_VERSION_PATCHLEVEL vs MPFR_VERSION_STRING is performed.
+Detailed explanations:
+ The test was enabled only in release tarballs (suffix not present),
+ where tests/tversion.c normally contained a "#if 1" (though this
+ is not the case in the MPFR 2.4.0 tarball). In patches, this test
+ should be disabled by changing the "#if 1" into "#if 0", due to
+ the suffix. But as one should be able to apply any patches (in any
+ order), this method was not satisfactory. The test has been moved
+ from tests/tversion.c to tests/tests.c (in function test_version),
+ and the suffix is now ignored in this test; the change of #if has
+ been removed from the update-version script.
+------------------------------------------------------------------------
+r5981 | vlefevre | 2009-02-20 21:51:01 +0000 (Fri, 20 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: corrected update-version usage for patches.
+------------------------------------------------------------------------
+r5978 | vlefevre | 2009-02-20 16:04:19 +0000 (Fri, 20 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+------------------------------------------------------------------------
+r5975 | zimmerma | 2009-02-20 15:11:17 +0000 (Fri, 20 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/mparam_h.in
+ M /trunk/tuneup.c
+
+[mparam_h.in] added default thresholds for sparc64
+[tuneup.c] print gcc patchlevel
+
+------------------------------------------------------------------------
+r5970 | vlefevre | 2009-02-19 01:10:31 +0000 (Thu, 19 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/speed.c
+ M /trunk/tests/texp.c
+
+speed.c, tests/texp.c: untabified.
+------------------------------------------------------------------------
+r5969 | vlefevre | 2009-02-19 01:08:00 +0000 (Thu, 19 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: improved mpfr_strtofr documentation (completing r5965).
+------------------------------------------------------------------------
+r5967 | zimmerma | 2009-02-18 21:31:24 +0000 (Wed, 18 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] added tuning for powerpc64
+
+------------------------------------------------------------------------
+r5966 | thevenyp | 2009-02-18 17:06:02 +0000 (Wed, 18 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: fix typo.
+
+------------------------------------------------------------------------
+r5965 | thevenyp | 2009-02-18 16:55:21 +0000 (Wed, 18 Feb 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+strtofr.c: accept bases up to 62.
+mpfr.texi: modify mpfr_strtofr documentation accordingly.
+tests/tstrtofr.c: add tests for bases 62, 60, and 61.
+
+------------------------------------------------------------------------
+r5964 | thevenyp | 2009-02-17 16:52:33 +0000 (Tue, 17 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+mparam_h.in: Change core2/64bit parameters.
+
+------------------------------------------------------------------------
+r5963 | vlefevre | 2009-02-17 16:46:56 +0000 (Tue, 17 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+Checks whether C99 length modifiers 'hh' and 'll' are supported by the
+system ('hh' is absent on alpha-OSF1-V5, bug reported by Kate Minola).
+[Merged changeset 5956 from the 2.4 branch.]
+------------------------------------------------------------------------
+r5962 | zimmerma | 2009-02-17 16:31:46 +0000 (Tue, 17 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+[texp.c] yet another better fix
+
+------------------------------------------------------------------------
+r5961 | zimmerma | 2009-02-17 16:23:41 +0000 (Tue, 17 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+[texp.c] fixed previous patch and added comment
+
+------------------------------------------------------------------------
+r5960 | zimmerma | 2009-02-17 16:19:25 +0000 (Tue, 17 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+[texp.c] fixed corner case test
+
+------------------------------------------------------------------------
+r5958 | vlefevre | 2009-02-16 14:27:52 +0000 (Mon, 16 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: improved latest change.
+------------------------------------------------------------------------
+r5957 | vlefevre | 2009-02-16 14:25:10 +0000 (Mon, 16 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: mentioned update-version for patches.
+------------------------------------------------------------------------
+r5955 | zimmerma | 2009-02-11 10:09:36 +0000 (Wed, 11 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mbench/mpfr-gfx.c
+
+[mpfr-gfx.c] added -p option to produce a Postscript file
+
+------------------------------------------------------------------------
+r5954 | zimmerma | 2009-02-10 21:02:22 +0000 (Tue, 10 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] added thresholds for ARM
+
+------------------------------------------------------------------------
+r5953 | zimmerma | 2009-02-10 17:39:27 +0000 (Tue, 10 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] added description of how to tune MPFR
+
+------------------------------------------------------------------------
+r5952 | zimmerma | 2009-02-10 15:52:48 +0000 (Tue, 10 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] added another example of using mpfr-gfx
+
+------------------------------------------------------------------------
+r5951 | zimmerma | 2009-02-10 15:50:40 +0000 (Tue, 10 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/mbench/Makefile
+
+[Makefile] modified Makefile to compile statically, and to allow also
+ build directories of GMP/MPFR
+
+------------------------------------------------------------------------
+r5950 | thevenyp | 2009-02-10 14:21:45 +0000 (Tue, 10 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mbench/mpfr-gfx.c
+
+mbench/mpfr-gfx.c: add option -rPREC_RATIO for geometric progression.
+
+------------------------------------------------------------------------
+r5949 | zimmerma | 2009-02-10 12:10:46 +0000 (Tue, 10 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] updated Itanium parameters (now for Itanium2)
+
+------------------------------------------------------------------------
+r5948 | zimmerma | 2009-02-10 11:26:25 +0000 (Tue, 10 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] added symbol __itanium__ for Itanium[12]
+
+------------------------------------------------------------------------
+r5947 | zimmerma | 2009-02-09 21:50:22 +0000 (Mon, 09 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/mbench/mpfr-gfx.c
+
+[README.dev] fixed typo
+[mpfr-gfx.c] added comments in the code (might be useful)
+
+------------------------------------------------------------------------
+r5946 | zimmerma | 2009-02-09 20:25:42 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] added pointer to mbench to check the thresholds
+
+------------------------------------------------------------------------
+r5945 | zimmerma | 2009-02-09 20:17:46 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mbench/mpfr-gfx.c
+
+[mpfr-gfx.c] now also produces a plot.gnuplot file together with plot.data
+
+------------------------------------------------------------------------
+r5944 | zimmerma | 2009-02-09 16:18:50 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] updated default thresholds with gmp-4.2.4
+
+------------------------------------------------------------------------
+r5943 | zimmerma | 2009-02-09 16:16:33 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/tuneup.c
+
+[tuneup.c] fixed typo
+
+------------------------------------------------------------------------
+r5942 | zimmerma | 2009-02-09 14:34:34 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+[Makefile.am] added stuff to compile speed program
+
+------------------------------------------------------------------------
+r5941 | zimmerma | 2009-02-09 14:22:20 +0000 (Mon, 09 Feb 2009) | 5 lines
+Changed paths:
+ A /trunk/speed.c
+
+[speed.c] preliminary program to check the tuning of mpfr (based on tuneup.c)
+ So far it only measures mpfr_mul up to 1000 bits, with increment
+ ratio of 1.1. Requires --with-gmp-build like tuneup.
+ Feel free to improve!
+
+------------------------------------------------------------------------
+r5940 | zimmerma | 2009-02-09 13:26:07 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] allow __tune_ia64__ in addition to __ia64
+
+------------------------------------------------------------------------
+r5937 | zimmerma | 2009-02-09 08:16:08 +0000 (Mon, 09 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+[mparam_h.in] replaced __pentium4 by __tune_pentium4__, ...
+
+------------------------------------------------------------------------
+r5936 | zimmerma | 2009-02-08 21:58:11 +0000 (Sun, 08 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mparam_h.in
+
+[acinclude.m4] removed detection of HAVE_HOST_CORE2
+[mparam_h.in] replaced HAVE_HOST_CORE2 by __tune_core2__
+
+------------------------------------------------------------------------
+r5930 | thevenyp | 2009-02-06 14:06:54 +0000 (Fri, 06 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+
+tests/mpf_compat.h: complete r5922 adding missing mpz_init/mpz_clear.
+
+------------------------------------------------------------------------
+r5927 | vlefevre | 2009-02-06 11:57:57 +0000 (Fri, 06 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+TODO: updated efficiency items.
+------------------------------------------------------------------------
+r5926 | zimmerma | 2009-02-06 11:18:48 +0000 (Fri, 06 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added 2 efficiency items
+
+------------------------------------------------------------------------
+r5925 | vlefevre | 2009-02-06 00:02:35 +0000 (Fri, 06 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: moved MPFR_DECL_INIT specification into Section
+"Initialization Functions" (now in the standard MPFR API),
+and removed now empty Section "Advanced Functions".
+------------------------------------------------------------------------
+r5924 | vlefevre | 2009-02-05 14:40:38 +0000 (Thu, 05 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/mparam_h.in
+
+mparam_h.in: updated comment to mention -march=native and -mtune=native.
+------------------------------------------------------------------------
+r5923 | vlefevre | 2009-02-05 11:42:26 +0000 (Thu, 05 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: updated a comment concerning MPFR_DECL_INIT.
+------------------------------------------------------------------------
+r5922 | zimmerma | 2009-02-05 08:01:46 +0000 (Thu, 05 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+ M /trunk/tests/mpf_compat.h
+
+[mpf2mpfr.h] added mpz_set_f (reported by Francois Morain)
+
+------------------------------------------------------------------------
+r5921 | zimmerma | 2009-02-05 07:26:51 +0000 (Thu, 05 Feb 2009) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.texi
+
+[mpfr.texi] moved mpfr_inits, mpfr_inits2, mpfr_clears to supported functions
+[TODO] added new info about MPIR
+
+------------------------------------------------------------------------
+r5920 | zimmerma | 2009-02-04 19:46:50 +0000 (Wed, 04 Feb 2009) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+[TODO] added info to distinguish GMP and MPIR
+
+------------------------------------------------------------------------
+r5893 | vlefevre | 2009-01-26 17:04:26 +0000 (Mon, 26 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated the version on the trunk.
+------------------------------------------------------------------------
+r5888 | zimmerma | 2009-01-25 12:50:42 +0000 (Sun, 25 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+[nightly-test] removed --disable-alloca (GMP option)
+
+------------------------------------------------------------------------
+r5887 | vlefevre | 2009-01-25 00:19:30 +0000 (Sun, 25 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: --disable-alloca is a GMP configure option.
+------------------------------------------------------------------------
+r5886 | thevenyp | 2009-01-21 15:01:25 +0000 (Wed, 21 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: remove tests against libc's printf with "%a" (not in ISO C90), and with "%p" (implementation defined).
+[merge -c 5885 from branches/2.4]
+
+------------------------------------------------------------------------
+r5883 | vlefevre | 2009-01-21 12:43:57 +0000 (Wed, 21 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: avoid a compiler bug under Mac OS X Tiger + Xcode (&x == &x
+is false) that makes tset_d fail; this problem was introduced in r5880.
+------------------------------------------------------------------------
+r5880 | vlefevre | 2009-01-20 22:12:11 +0000 (Tue, 20 Jan 2009) | 6 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tset_ld.c
+
+Fixed bug reported by Chris Saunders: if _GMP_IEEE_FLOATS is defined,
+the build of tset_ld.c fails because DOUBLE_ISNAN expects a lvalue.
+* mpfr-impl.h: documented that for such macros, the argument must
+ be a lvalue, and always make sure that it is a lvalue (so that
+ a failure doesn't depend on the environment).
+* tests/tset_ld.c: fixed the bug.
+------------------------------------------------------------------------
+r5879 | vlefevre | 2009-01-20 15:08:45 +0000 (Tue, 20 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+tests/tversion.c: be more tolerant when checking whether gmp.h version
+and libgmp version are the same (in case patch level is 0).
+------------------------------------------------------------------------
+r5878 | vlefevre | 2009-01-20 12:47:05 +0000 (Tue, 20 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+tests/tset_ld.c: added explanation of NaN-related failures in case
+MPFR_NANISNAN is defined.
+------------------------------------------------------------------------
+r5875 | vlefevre | 2009-01-20 00:43:20 +0000 (Tue, 20 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tstrtofr.c
+
+Added missing void's.
+------------------------------------------------------------------------
+r5874 | vlefevre | 2009-01-20 00:35:41 +0000 (Tue, 20 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: removed a blank line (for consistency with the
+2.4 branch).
+------------------------------------------------------------------------
+r5873 | vlefevre | 2009-01-20 00:33:09 +0000 (Tue, 20 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: deleted trailing spaces.
+------------------------------------------------------------------------
+r5869 | vlefevre | 2009-01-19 23:57:53 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: comment for DOUBLE_ISNAN with MPFR_NANISNAN defined.
+------------------------------------------------------------------------
+r5868 | vlefevre | 2009-01-19 23:42:33 +0000 (Mon, 19 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+tests/tset_d.c: fixed test of mpfr_set_d on -0 with gcc -ffast-math
+(the -d for d = 0.0 was giving 0.0, hence a spurious failure).
+------------------------------------------------------------------------
+r5867 | vlefevre | 2009-01-19 23:34:54 +0000 (Mon, 19 Jan 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tset_ld.c
+
+mpfr-impl.h: the DOUBLE_ISNAN macro wasn't working with gcc -ffast-math
+(at least on x86_64); fixed that by adding another test.
+tests/tset_ld.c: Isnan_ld wasn't working either; also the NaN test was
+incorrect. Now, the failure on NaN is correctly reported.
+------------------------------------------------------------------------
+r5866 | vlefevre | 2009-01-19 22:44:45 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tset_d.c
+
+tests/tcmp_d.c, tests/tcmp_ld.c, tests/tset_d.c: corrected message.
+------------------------------------------------------------------------
+r5865 | vlefevre | 2009-01-19 22:37:27 +0000 (Mon, 19 Jan 2009) | 4 lines
+Changed paths:
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tset_d.c
+
+tests/tcmp_d.c, tests/tcmp_ld.c, tests/tset_d.c: added explanations
+of NaN-related failures in case MPFR_NANISNAN is defined.
+Note: in tset_d.c, moved the NaN test before the signed-zero test
+to catch the failure on the NaN first.
+------------------------------------------------------------------------
+r5864 | vlefevre | 2009-01-19 22:23:26 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: improved warning message.
+------------------------------------------------------------------------
+r5863 | vlefevre | 2009-01-19 22:16:15 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: updated "In case of problem".
+------------------------------------------------------------------------
+r5862 | vlefevre | 2009-01-19 22:12:09 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: added a warning message for the NAN != NAN test.
+------------------------------------------------------------------------
+r5860 | thevenyp | 2009-01-19 19:59:12 +0000 (Mon, 19 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tset_d.c
+
+tcmp_d.c tset_d.c tcmp_ld.c: Remove tests with NaN when MPFR_NANISNAN is defined.
+tests.c: Add a warning in a comment that Isnan always returns 0 on systems where MPFR_NANISNAN is defined.
+
+------------------------------------------------------------------------
+r5855 | thevenyp | 2009-01-19 18:14:55 +0000 (Mon, 19 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: do not support 't' when NPRINTF_T is defined, HAVE_STDINT_H -> _MPFR_H_HAVE_INTMAX_T.
+
+------------------------------------------------------------------------
+r5853 | thevenyp | 2009-01-19 17:05:13 +0000 (Mon, 19 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+tests/tfprintf.c: renumber tests (there was two tests #9).
+
+------------------------------------------------------------------------
+r5852 | vlefevre | 2009-01-19 16:56:17 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+tests/tfprintf.c: %c takes an int argument, not a char (see C standard).
+------------------------------------------------------------------------
+r5851 | vlefevre | 2009-01-19 16:53:56 +0000 (Mon, 19 Jan 2009) | 4 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+
+tests/tprintf.c, tests/tsprintf.c:
+ * %c takes an int argument, not a char (see C standard), even though
+ this may be equivalent due to integer promotion.
+ * Add void in prototypes of functions taking no arguments.
+------------------------------------------------------------------------
+r5844 | vlefevre | 2009-01-19 15:46:41 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated references to the GMP manual.
+------------------------------------------------------------------------
+r5843 | vlefevre | 2009-01-19 15:31:54 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: typo in comment.
+------------------------------------------------------------------------
+r5842 | vlefevre | 2009-01-19 15:30:52 +0000 (Mon, 19 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added .info extension in cross-references, to avoid the bug
+reported here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484740
+------------------------------------------------------------------------
+r5841 | vlefevre | 2009-01-19 14:34:22 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added a reference to a texinfo bug in a comment.
+------------------------------------------------------------------------
+r5840 | vlefevre | 2009-01-19 14:02:49 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added missing @code{}.
+------------------------------------------------------------------------
+r5839 | vlefevre | 2009-01-19 14:01:13 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: don't -> do not, doesn't -> does not, won't -> will not.
+------------------------------------------------------------------------
+r5838 | vlefevre | 2009-01-19 13:58:50 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: improved Section "Format String".
+------------------------------------------------------------------------
+r5837 | thevenyp | 2009-01-19 13:51:45 +0000 (Mon, 19 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: check if native types are really processed by libc printf.
+
+------------------------------------------------------------------------
+r5836 | vlefevre | 2009-01-19 13:31:27 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: no longer mentions HAVE_QUAD_T since it is no longer used.
+------------------------------------------------------------------------
+r5835 | thevenyp | 2009-01-19 12:50:08 +0000 (Mon, 19 Jan 2009) | 5 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr.texi
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+mpfr.texi: Explicit list of type supported by mpfr_printf functions.
+acinclude.m4: Remove detection of type modifier 'q'.
+vasprintf.c: Remove support of type modifier 'q'.
+tests/tfprintf.c tests/tprintf.c: Remove tests with type modifier 'q'.
+
+------------------------------------------------------------------------
+r5834 | thevenyp | 2009-01-19 11:05:10 +0000 (Mon, 19 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/configure.in
+
+INSTALL: Warn that --with-gmp, --with-gmp-include/--with-gmp-lib, and --with-gmp-build options are mutually exclusive.
+configure.in: Check and fail if --with-gmp, --with-gmp-include/--with-gmp-lib, or --with-gmp-build are use simultaneously.
+
+------------------------------------------------------------------------
+r5833 | vlefevre | 2009-01-19 10:08:58 +0000 (Mon, 19 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: include <sys/fpu.h> only if need be.
+------------------------------------------------------------------------
+r5831 | zimmerma | 2009-01-16 15:32:11 +0000 (Fri, 16 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] made difference between mpfr_set_str and mpfr_strtofr clearer
+ (after remark from Luis Rivera)
+
+------------------------------------------------------------------------
+r5830 | zimmerma | 2009-01-16 15:24:45 +0000 (Fri, 16 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] fixed order -> kind (typo found by Luis Rivera, thanks)
+
+------------------------------------------------------------------------
+r5828 | thevenyp | 2009-01-16 13:35:04 +0000 (Fri, 16 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tfprintf.c tprintf.c: Test double with "%f" instead of "%e" so as to avoid failure due to exponent "e+000" on MS Windows.
+
+------------------------------------------------------------------------
+r5827 | thevenyp | 2009-01-16 13:06:27 +0000 (Fri, 16 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+tests/tfprintf.c tests/tsprintf.c tests/tprintf.c acinclude.m4 vasprintf.c: No longer check libc's printf.
+
+------------------------------------------------------------------------
+r5826 | thevenyp | 2009-01-16 09:53:15 +0000 (Fri, 16 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+
+acinclude.m4: Check if %Ld specification is supported (not always the case with MS Windows)
+tests/tfprintf.c tests/tprintf.c tests/tsprintf.c: do not check %Ld specification when not available.
+
+------------------------------------------------------------------------
+r5825 | thevenyp | 2009-01-16 09:26:18 +0000 (Fri, 16 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/fits_intmax.c
+ M /trunk/fits_uintmax.c
+ M /trunk/get_sj.c
+ M /trunk/get_uj.c
+ M /trunk/set_sj.c
+ M /trunk/set_uj.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/vasprintf.c
+
+get_uj.c get_sj.c tests/tset_sj.c tests/tfits.c fits_intmax.c fits_uintmax.c set_uj.c set_sj.c: make #include-s for intmax_t uniform.
+vasprintf.c: make #include-s for intmax_t uniform and use _MPFR_H_HAVE_INTMAX_T instead of HAVE_INTMAX_T.
+
+------------------------------------------------------------------------
+r5823 | thevenyp | 2009-01-15 13:24:35 +0000 (Thu, 15 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tfprintf.c tprintf.c: Remove tests with u_quad_t (on Solaris 10, quad_t exists but u_quad_t doesn't, bug reported by Michael Abshoff).
+
+------------------------------------------------------------------------
+r5822 | thevenyp | 2009-01-15 13:17:14 +0000 (Thu, 15 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tfprintf.c tprintf.c: Fix included headers, type intmax_t may be defined in inttypes.h or in stdint.h (see autoconf manual 5.6.1 Portability of Headers).
+
+------------------------------------------------------------------------
+r5821 | vlefevre | 2009-01-15 10:13:44 +0000 (Thu, 15 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v".
+------------------------------------------------------------------------
+r5817 | vlefevre | 2009-01-15 02:22:45 +0000 (Thu, 15 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: deleted trailing spaces.
+------------------------------------------------------------------------
+r5816 | vlefevre | 2009-01-15 02:21:57 +0000 (Thu, 15 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: be more tolerant when checking whether gmp.h version
+and libgmp version are the same (in case patch level is 0).
+------------------------------------------------------------------------
+r5814 | vlefevre | 2009-01-15 01:56:55 +0000 (Thu, 15 Jan 2009) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/ChangeLog
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/mbench/Makefile
+ M /trunk/mbench/generate.c
+ M /trunk/mbench/mfv5-arprec.cc
+ M /trunk/mbench/mfv5-cln.cc
+ M /trunk/mbench/mfv5-crlibm.cc
+ M /trunk/mbench/mfv5-libc.cc
+ M /trunk/mbench/mfv5-lidia.cc
+ M /trunk/mbench/mfv5-mpf.cc
+ M /trunk/mbench/mfv5-mpfr.cc
+ M /trunk/mbench/mfv5-ntl.cc
+ M /trunk/mbench/mfv5-pari.cc
+ M /trunk/mbench/mfv5-void.cc
+ M /trunk/mbench/mfv5.cc
+ M /trunk/mbench/mfv5.h
+ M /trunk/mbench/mpfr-gfx.c
+ M /trunk/mbench/mpfr-v4.c
+ M /trunk/mbench/mpfr-v6.c
+ M /trunk/mbench/timp.h
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-thread.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/random2.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Copyright notice update: added 2009 with
+ perl -pi -e 's/2008 Free Software/2008, 2009 Free Software/' **/*(^/)
+under zsh.
+------------------------------------------------------------------------
+r5813 | vlefevre | 2009-01-14 00:46:45 +0000 (Wed, 14 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tsqrt.c
+
+Fixed remaining printf format strings.
+------------------------------------------------------------------------
+r5812 | vlefevre | 2009-01-14 00:27:06 +0000 (Wed, 14 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tsub1sp.c
+
+tests/tadd1sp.c, tests/tsub1sp.c: fixed function prototypes.
+------------------------------------------------------------------------
+r5811 | vlefevre | 2009-01-14 00:23:44 +0000 (Wed, 14 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/teq.c
+ M /trunk/tests/tests.c
+
+tests/teq.c, tests/tests.c: fixed printf format strings.
+------------------------------------------------------------------------
+r5810 | vlefevre | 2009-01-14 00:06:00 +0000 (Wed, 14 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+tests/tcmp2.c: fixed printf format strings.
+------------------------------------------------------------------------
+r5809 | vlefevre | 2009-01-13 23:59:17 +0000 (Tue, 13 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+tests/tset_str.c: fixed printf format string.
+------------------------------------------------------------------------
+r5804 | vlefevre | 2009-01-12 17:30:00 +0000 (Mon, 12 Jan 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: consistency changes and corrections concerning the "erange"
+flag (do not use @code{} as this is not an identifier, @emph{} is used
+as this is not an English word -- but @emph{} should probably be used
+too for the other flag names).
+------------------------------------------------------------------------
+r5803 | vlefevre | 2009-01-12 17:18:45 +0000 (Mon, 12 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: typo.
+------------------------------------------------------------------------
+r5801 | thevenyp | 2009-01-12 16:01:14 +0000 (Mon, 12 Jan 2009) | 5 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+acinclude.m4: New macro MPFR_CHECK_PRINTF_SPEC looking for support of the "%jd", "%qd", and "%td" conversion specifications in printf and gmp_printf.
+configure.in: Call MPFR_CHECK_PRINTF_SPEC when we can link against a suitable gmp library and run test programs at compile time, otherwise (for instance, when cross compiling), everything is enable by default.
+vasprintf.c: Disable support for length modifiers not supported by libc's printf ('j' and 'q' for this time).
+tests/tprintf.c, tests/tfprintf.c: Disable tests for length modifiers not supported by gmp_printf ('j', 'q', and 't' for this time).
+
+------------------------------------------------------------------------
+r5800 | thevenyp | 2009-01-12 14:16:22 +0000 (Mon, 12 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Fix typo.
+
+------------------------------------------------------------------------
+r5795 | vlefevre | 2009-01-08 15:36:55 +0000 (Thu, 08 Jan 2009) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: update to January 2009.
+------------------------------------------------------------------------
+r5794 | vlefevre | 2009-01-08 15:34:27 +0000 (Thu, 08 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tsprintf.c
+
+Removed useless #include of gmp.h from tests/tfprintf.c and
+tests/tsprintf.c for consistency.
+------------------------------------------------------------------------
+r5788 | thevenyp | 2009-01-08 11:56:10 +0000 (Thu, 08 Jan 2009) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tfprintf.c
+ M /trunk/vasprintf.c
+
+tests/tfprintf.c: Make tests with 'M' specifier optional.
+mpfr.texi: Add a warning that gmp may not support 'M' specifier.
+vasprintf.c: Add warning comment about 'M' specifier.
+
+------------------------------------------------------------------------
+r5787 | thevenyp | 2009-01-08 11:52:52 +0000 (Thu, 08 Jan 2009) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: Fix wrong definition of rounding specifiers.
+
+------------------------------------------------------------------------
+r5786 | vlefevre | 2008-12-30 13:57:11 +0000 (Tue, 30 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/out_str.c
+
+out_str.c: added assert (check that base is in the required range).
+------------------------------------------------------------------------
+r5785 | vlefevre | 2008-12-26 14:10:24 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: suggest "-Wformat=2".
+------------------------------------------------------------------------
+r5784 | vlefevre | 2008-12-26 14:02:55 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/zeta.c
+
+zeta.c: fixed types for printf when DEBUG is defined.
+------------------------------------------------------------------------
+r5783 | vlefevre | 2008-12-26 13:57:32 +0000 (Fri, 26 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+sub1sp.c: fixed types for printf when WANT_ASSERT >= 2 and
+when DEBUG is defined.
+------------------------------------------------------------------------
+r5782 | vlefevre | 2008-12-26 13:50:14 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/sub1.c
+
+sub1.c: fixed types for printf when DEBUG is defined.
+------------------------------------------------------------------------
+r5781 | vlefevre | 2008-12-26 13:44:28 +0000 (Fri, 26 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/set_d64.c
+
+set_d64.c: set T[] to unsigned int (instead of int) since its values
+are printed with %u.
+------------------------------------------------------------------------
+r5780 | vlefevre | 2008-12-26 13:36:13 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/add1sp.c
+
+add1sp.c: fixed types for printf when DEBUG is defined.
+------------------------------------------------------------------------
+r5779 | vlefevre | 2008-12-26 13:33:05 +0000 (Fri, 26 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: fixed MPFR_UNSIGNED_MINUS_MODULO logic and added missing
+parentheses.
+------------------------------------------------------------------------
+r5778 | vlefevre | 2008-12-26 13:06:14 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/div.c
+
+div.c: fixed types for fprintf when DEBUG and/or DEBUG2 is defined.
+------------------------------------------------------------------------
+r5777 | vlefevre | 2008-12-26 12:56:09 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/div.c
+
+div.c: fixed #ifdef.
+------------------------------------------------------------------------
+r5775 | vlefevre | 2008-12-26 12:39:03 +0000 (Fri, 26 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/round_p.c
+
+round_p.c: fixed types for fprintf when WANT_ASSERT >= 2 (since
+mp_prec_t is unsigned, it's better to use unsigned long).
+------------------------------------------------------------------------
+r5774 | vlefevre | 2008-12-26 12:02:07 +0000 (Fri, 26 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/round_p.c
+
+round_p.c: fixed types for fprintf when WANT_ASSERT >= 2.
+------------------------------------------------------------------------
+r5772 | zimmerma | 2008-12-22 10:40:24 +0000 (Mon, 22 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.tex] improve documentation of %P
+
+------------------------------------------------------------------------
+r5768 | vlefevre | 2008-12-18 15:59:55 +0000 (Thu, 18 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+Deleted trailing spaces.
+------------------------------------------------------------------------
+r5762 | thevenyp | 2008-12-17 16:07:32 +0000 (Wed, 17 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: clean-up code, improve comment, and put optional tests in tail so that they fail last.
+
+------------------------------------------------------------------------
+r5761 | thevenyp | 2008-12-17 15:55:20 +0000 (Wed, 17 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: Add two regression tests.
+
+------------------------------------------------------------------------
+r5760 | thevenyp | 2008-12-16 15:56:42 +0000 (Tue, 16 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr.texi
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+acinclude.m4, vasprintf.c, tests/tfprintf.c, tests/tprintf.c, mpfr.texi: quad_t support
+
+------------------------------------------------------------------------
+r5759 | thevenyp | 2008-12-16 15:51:59 +0000 (Tue, 16 Dec 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tests/tfprintf.c: code clean-up and output improvement.
+tests/tprintf.c: code clean-up.
+Note that unsigned long long variable is not set to 1 instead of -1 which was architecture dependant.
+
+------------------------------------------------------------------------
+r5758 | vlefevre | 2008-12-16 13:56:28 +0000 (Tue, 16 Dec 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c:
+ * stdout_redirect is a boolean (i.e., 0 or 1).
+ * output freopen(..., stdout) error message to stderr.
+------------------------------------------------------------------------
+r5757 | thevenyp | 2008-12-16 13:10:05 +0000 (Tue, 16 Dec 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tfprintf.c: more user-friendly messages.
+tprintf.c: more user-friendly messages. Warning: because stdout might be redirected, error messages are printed to stderr.
+
+------------------------------------------------------------------------
+r5756 | vlefevre | 2008-12-15 23:38:21 +0000 (Mon, 15 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: more explanations on the precision field for mpfr_printf.
+------------------------------------------------------------------------
+r5755 | vlefevre | 2008-12-15 17:37:05 +0000 (Mon, 15 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/tests/tsprintf.c
+
+untabify and remove trailing spaces
+------------------------------------------------------------------------
+r5754 | thevenyp | 2008-12-15 17:07:40 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: more explanations on the precision field.
+
+------------------------------------------------------------------------
+r5753 | thevenyp | 2008-12-15 16:19:26 +0000 (Mon, 15 Dec 2008) | 5 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr.texi
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+mpfr.texi: Clearly mention that the length modifier 'q' is unsupported by mpfr-*printf.
+vasprintf.c: Do not take quad_t as a long long but as an insupported length modifier.
+acinclude.m4: Remove check for quad_t.
+tests/tprintf.c tests/tfprintf.c: Remove tests with 'q' length modifier.
+
+------------------------------------------------------------------------
+r5751 | vlefevre | 2008-12-15 14:52:54 +0000 (Mon, 15 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tests/tstrtofr.c: fixed a test (in case |res| > 1).
+------------------------------------------------------------------------
+r5750 | vlefevre | 2008-12-15 14:35:01 +0000 (Mon, 15 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tests/tstrtofr.c: fixed alignment bug in error message.
+------------------------------------------------------------------------
+r5749 | zimmerma | 2008-12-15 13:44:25 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+[nightly-test] added MPFR_CHECK_LIBC_PRINTF
+
+------------------------------------------------------------------------
+r5748 | thevenyp | 2008-12-15 13:43:52 +0000 (Mon, 15 Dec 2008) | 4 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/acinclude.m4
+ M /trunk/vasprintf.c
+
+acinclude.m4: Check for quad_t.
+vasprintf.c: Accept length modifier 'q' if HAVE_QUAD_T is defined (instead of HAVE_LONG_LONG).
+README.dev: Add notice for new HAVE_QUAD_T macro.
+
+------------------------------------------------------------------------
+r5747 | zimmerma | 2008-12-15 13:43:40 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] added warning about usage of mpfr_init
+
+------------------------------------------------------------------------
+r5746 | vlefevre | 2008-12-15 13:39:35 +0000 (Mon, 15 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: _MPFR_H_HAVE_INTMAX_T -> HAVE_STDINT_H for <stdint.h>.
+------------------------------------------------------------------------
+r5745 | thevenyp | 2008-12-15 13:33:22 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: Tests against libc's sprintf function are no more executed unless the MPFR_CHECK_LIBC_PRINTF is defined.
+
+------------------------------------------------------------------------
+r5744 | thevenyp | 2008-12-15 13:27:49 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: move bugs 20080610 and 20081214 outside the function random_double.
+
+------------------------------------------------------------------------
+r5743 | vlefevre | 2008-12-15 12:49:58 +0000 (Mon, 15 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: completed comment about the sign of a null exponent.
+------------------------------------------------------------------------
+r5742 | vlefevre | 2008-12-15 12:44:09 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: added a note saying the L modifier was added in C89 (source:
+C99 rationale, Section 7.19.6.1).
+------------------------------------------------------------------------
+r5741 | zimmerma | 2008-12-15 12:17:46 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] more Windows-related changes
+
+------------------------------------------------------------------------
+r5740 | zimmerma | 2008-12-15 11:02:17 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] update on Windows (from Brian Gladman)
+
+------------------------------------------------------------------------
+r5739 | zimmerma | 2008-12-15 09:47:46 +0000 (Mon, 15 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+[configure.in] removed useless comment
+
+------------------------------------------------------------------------
+r5738 | vlefevre | 2008-12-14 15:28:17 +0000 (Sun, 14 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: references to ISO (international) instead of ANSI (American).
+------------------------------------------------------------------------
+r5737 | vlefevre | 2008-12-14 15:18:54 +0000 (Sun, 14 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: corrected a comment.
+------------------------------------------------------------------------
+r5736 | zimmerma | 2008-12-14 09:43:40 +0000 (Sun, 14 Dec 2008) | 3 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+[printf.c,vasprintf.c] include config.h if HAVE_CONFIG_H is defined, to
+ solve problem noticed by Brian Gladman
+
+------------------------------------------------------------------------
+r5735 | vlefevre | 2008-12-14 09:37:05 +0000 (Sun, 14 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: untabified.
+------------------------------------------------------------------------
+r5734 | zimmerma | 2008-12-14 09:27:08 +0000 (Sun, 14 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added hint for using the MinGW runtime
+
+------------------------------------------------------------------------
+r5733 | zimmerma | 2008-12-14 08:36:37 +0000 (Sun, 14 Dec 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+[tsprintf.c] added new hard-coded test (needs work to overcome error in
+ system asprintf)
+
+------------------------------------------------------------------------
+r5732 | zimmerma | 2008-12-14 08:24:42 +0000 (Sun, 14 Dec 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+[tsprintf.c] fixed hard-coded test (spec was missing), and print values of
+ xi,yi,spec in case of error
+
+------------------------------------------------------------------------
+r5731 | vlefevre | 2008-12-14 00:05:20 +0000 (Sun, 14 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: corrections on r5730.
+------------------------------------------------------------------------
+r5730 | zimmerma | 2008-12-13 10:19:25 +0000 (Sat, 13 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added notes on Windows Vista 64 problem
+
+------------------------------------------------------------------------
+r5727 | vlefevre | 2008-12-12 15:00:33 +0000 (Fri, 12 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/README
+
+README: added "compile" since it is distributed in the tarball.
+------------------------------------------------------------------------
+r5723 | vlefevre | 2008-12-12 14:07:19 +0000 (Fri, 12 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk
+
+Added "compile" to svn:ignore property (this file is installed by
+"automake --add-missing" due to AM_PROG_CC_C_O, added in r5710).
+------------------------------------------------------------------------
+r5722 | vlefevre | 2008-12-12 14:01:33 +0000 (Fri, 12 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: avoid an abort if field width or precision is > INT_MAX.
+------------------------------------------------------------------------
+r5721 | thevenyp | 2008-12-12 14:00:33 +0000 (Fri, 12 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tset_ld.c
+
+tests.c, tset_ld.c, tgeneric.c: Code clean-up based on icc warnings (as in r5492): Use #ifdef BOOL_MACRO instead of #if BOOL_MACRO.
+
+------------------------------------------------------------------------
+r5720 | thevenyp | 2008-12-12 13:54:37 +0000 (Fri, 12 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: remove line 'GCC=' in icc tests which seems to confuse libtool.
+
+------------------------------------------------------------------------
+r5719 | vlefevre | 2008-12-12 12:54:10 +0000 (Fri, 12 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/set_ld.c
+
+set_ld.c: rewrote exp computation.
+------------------------------------------------------------------------
+r5718 | vlefevre | 2008-12-12 12:12:11 +0000 (Fri, 12 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: avoid a possible gcc 4.1.2 bug with -ftrapv.
+------------------------------------------------------------------------
+r5717 | vlefevre | 2008-12-12 11:57:37 +0000 (Fri, 12 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: revert incorrect change in r5713.
+------------------------------------------------------------------------
+r5716 | zimmerma | 2008-12-12 11:47:52 +0000 (Fri, 12 Dec 2008) | 8 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+[set_ld.c] fixed problem with CC=g++ on 64-bit computer:
+$ g++ -v
+Using built-in specs.
+Target: x86_64-linux-gnu
+Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release x86_64-linux-gnu
+Thread model: posix
+gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
+
+------------------------------------------------------------------------
+r5713 | zimmerma | 2008-12-12 10:05:49 +0000 (Fri, 12 Dec 2008) | 3 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+[vasprintf.c] patch to MPFR_ASSERTN(...) call to avoid failure with gcc -ftrapv
+ with gcc 4.1.2 (probably compiler error)
+
+------------------------------------------------------------------------
+r5712 | thevenyp | 2008-12-12 09:20:14 +0000 (Fri, 12 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tmul.c
+
+Makefile.am, tmul.c: Rename macro __SRCDIR to MPFR_SRCDIR.
+
+------------------------------------------------------------------------
+r5710 | thevenyp | 2008-12-11 15:20:56 +0000 (Thu, 11 Dec 2008) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tmul.c
+
+configure.in: Add AM_PROG_CC_C_O needed by tmul_CPPFLAGS.
+tests/Makefile.am: Add tmul.dat in EXTRA_DIST and pass srcdir to tmul.c through tmul_CPPFLAGS.
+tests/tmul.c: Add path to tmul.dat.
+
+------------------------------------------------------------------------
+r5703 | vlefevre | 2008-12-09 16:46:13 +0000 (Tue, 09 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: TLS on darwin may work, but I don't know anything more.
+See thread <http://gcc.gnu.org/ml/gcc/2008-12/msg00107.html>.
+------------------------------------------------------------------------
+r5702 | vlefevre | 2008-12-08 16:02:29 +0000 (Mon, 08 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/README
+
+README: CVS -> Subversion.
+------------------------------------------------------------------------
+r5701 | vlefevre | 2008-12-03 12:40:01 +0000 (Wed, 03 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: format --enable-decimal-float description on 80 columns.
+------------------------------------------------------------------------
+r5700 | vlefevre | 2008-12-03 12:38:06 +0000 (Wed, 03 Dec 2008) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: for --enable-thread-safe, say that the system must support
+it (like what has been done for --enable-logging, just above).
+------------------------------------------------------------------------
+r5699 | vlefevre | 2008-12-03 12:31:28 +0000 (Wed, 03 Dec 2008) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: added details about ---enable-thread-safe and TLS support.
+------------------------------------------------------------------------
+r5698 | vlefevre | 2008-11-28 12:09:08 +0000 (Fri, 28 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/urandomb.c
+
+urandomb.c: added comments and cleaned up code.
+mpfr.texi: improved description of mpfr_urandomb.
+------------------------------------------------------------------------
+r5697 | vlefevre | 2008-11-26 14:39:22 +0000 (Wed, 26 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: changed URL added in r5696 to avoid a redirection.
+------------------------------------------------------------------------
+r5696 | zimmerma | 2008-11-26 14:22:37 +0000 (Wed, 26 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] added official url on ftp.gnu.org
+
+------------------------------------------------------------------------
+r5695 | vlefevre | 2008-11-26 09:16:40 +0000 (Wed, 26 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tmul.c
+
+tests/tmul.c: removed useless variable.
+------------------------------------------------------------------------
+r5694 | vlefevre | 2008-11-26 09:14:38 +0000 (Wed, 26 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tmul.c
+
+tests/tmul.c: made reading a string from file more robust.
+------------------------------------------------------------------------
+r5693 | zimmerma | 2008-11-26 08:14:13 +0000 (Wed, 26 Nov 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+ A /trunk/tests/tmul.dat
+
+[tmul.c] moved long strings to file tmul.dat, so that gcc -ansi
+ -pedantic-errors works (ISO C90 does not support strings of length
+ > 509)
+
+------------------------------------------------------------------------
+r5692 | vlefevre | 2008-11-26 00:55:32 +0000 (Wed, 26 Nov 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tinternals.c
+
+tests/tinternals.c: updated tests for guaranteed C90 support, e.g. with
+gcc -ansi -pedantic-errors (avoid error "string length 'nnn' is greater
+than the length '509' ISO C90 compilers are required to support" because
+expression for #expr in ASSERT_FAIL macro is too long).
+------------------------------------------------------------------------
+r5691 | vlefevre | 2008-11-26 00:48:12 +0000 (Wed, 26 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: in Section "To make a release", suggest -pedantic-errors.
+------------------------------------------------------------------------
+r5690 | vlefevre | 2008-11-22 15:49:07 +0000 (Sat, 22 Nov 2008) | 5 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/agm.c
+ M /trunk/atan.c
+ M /trunk/cos.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/gamma.c
+ M /trunk/get_str.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/modf.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/mulders.c
+ M /trunk/rec_sqrt.c
+ M /trunk/root.c
+ M /trunk/tanh.c
+ M /trunk/vasprintf.c
+ M /trunk/yn.c
+
+r5689 undone: some casts were incorrect (mp_exp_t may be greater than
+mp_prec_t, so that casting a mp_exp_t into a mp_prec_t can introduce a
+bug). There may be bugs in some cases, but the casts fix the symptom,
+not the bug (unless one casts the unsigned type to a signed type that
+is *strictly* larger, which is not possible here).
+------------------------------------------------------------------------
+r5689 | zimmerma | 2008-11-22 09:55:42 +0000 (Sat, 22 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/agm.c
+ M /trunk/atan.c
+ M /trunk/cos.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/gamma.c
+ M /trunk/get_str.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/modf.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/mulders.c
+ M /trunk/rec_sqrt.c
+ M /trunk/root.c
+ M /trunk/tanh.c
+ M /trunk/vasprintf.c
+ M /trunk/yn.c
+
+fixed some signed/unsigned warnings with g++ (please review)
+
+------------------------------------------------------------------------
+r5688 | zimmerma | 2008-11-21 12:53:47 +0000 (Fri, 21 Nov 2008) | 3 lines
+Changed paths:
+ M /trunk/nightly-test
+
+[nightly-test] removed MPFR_CHECK_ALL (no longer used)
+ added possibility to choose compiler (e.g., g++)
+
+------------------------------------------------------------------------
+r5687 | zimmerma | 2008-11-21 12:44:39 +0000 (Fri, 21 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] better check ./configure CC=g++
+
+------------------------------------------------------------------------
+r5686 | thevenyp | 2008-11-21 10:07:53 +0000 (Fri, 21 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+Fix inclusion order: the limit of integer types like size_t are defined in C++ only when __STDC_LIMIT_MACROS is defined before <stdint.h> is included (from ISO C99 7.18.3).
+
+------------------------------------------------------------------------
+r5685 | vlefevre | 2008-11-21 08:27:07 +0000 (Fri, 21 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/README
+
+README: added m4 directory (since it is distributed in the tarball).
+------------------------------------------------------------------------
+r5684 | vlefevre | 2008-11-20 19:29:58 +0000 (Thu, 20 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+
+Forgot to update Makefile.am too (for r5680).
+------------------------------------------------------------------------
+r5683 | vlefevre | 2008-11-20 19:20:18 +0000 (Thu, 20 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: added AC_CONFIG_MACRO_DIR([m4]) for r5680.
+------------------------------------------------------------------------
+r5682 | zimmerma | 2008-11-20 17:14:35 +0000 (Thu, 20 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+
+[mpfr-gmp.c] added comment on recent bug fix on MacOS
+
+------------------------------------------------------------------------
+r5681 | zimmerma | 2008-11-20 10:53:02 +0000 (Thu, 20 Nov 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/texp.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tpow_all.c
+
+[tests] changes to make compilation work with g++ (only fixed errors,
+ several warnings remain)
+
+------------------------------------------------------------------------
+r5680 | vlefevre | 2008-11-20 10:42:50 +0000 (Thu, 20 Nov 2008) | 1 line
+Changed paths:
+ A /trunk/m4
+ A /trunk/m4/size_max.m4
+
+Added m4/size_max.m4 file (from gettext).
+------------------------------------------------------------------------
+r5679 | vlefevre | 2008-11-20 10:26:32 +0000 (Thu, 20 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: paragraph on tentative definitions.
+------------------------------------------------------------------------
+r5678 | zimmerma | 2008-11-20 09:13:09 +0000 (Thu, 20 Nov 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+
+[mpfr-gmp.c] replace tentative definitions by real definitions, solves
+ configure problems with mpc (see http://lists.gforge.inria.fr/pipermail/mpc-discuss/2008-November/000048.html)
+
+------------------------------------------------------------------------
+r5677 | vlefevre | 2008-11-18 01:01:33 +0000 (Tue, 18 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/hypot.c
+
+hypot.c: updated a comment.
+------------------------------------------------------------------------
+r5676 | vlefevre | 2008-11-18 00:40:13 +0000 (Tue, 18 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/tests/thypot.c
+
+tests/thypot.c: added a test.
+------------------------------------------------------------------------
+r5675 | vlefevre | 2008-11-18 00:21:09 +0000 (Tue, 18 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/hypot.c
+
+hypot.c: simplified an expression; cosmetic changes.
+------------------------------------------------------------------------
+r5674 | thevenyp | 2008-11-17 08:43:59 +0000 (Mon, 17 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+hypot.c: Fix underflow problem when diff_exp<=MPFR_EMAX_MAX-2 using fma (provided that mpfr_fma is immune to it).
+
+------------------------------------------------------------------------
+r5673 | thevenyp | 2008-11-17 08:40:52 +0000 (Mon, 17 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: Fix one typo in dilogarithm section.
+
+------------------------------------------------------------------------
+r5672 | vlefevre | 2008-11-12 14:53:07 +0000 (Wed, 12 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+mpfr.texi, NEWS: update concerning mpfr_eq.
+------------------------------------------------------------------------
+r5671 | vlefevre | 2008-11-12 14:09:45 +0000 (Wed, 12 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: improved mpfr_eq documentation.
+------------------------------------------------------------------------
+r5670 | thevenyp | 2008-11-12 12:33:37 +0000 (Wed, 12 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tests/tstrtofr.c: Add more information when test bug20081028 fails.
+
+------------------------------------------------------------------------
+r5669 | thevenyp | 2008-11-07 10:19:42 +0000 (Fri, 07 Nov 2008) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+strtofr.c: Replace non-zero digits look up by a simpler test, using the fact that parse_string did remove zeros at end of pstr->mant.
+tests/tstrtofr.c: Add other test values around 1 for the bug20081028 non regression test.
+
+------------------------------------------------------------------------
+r5668 | vlefevre | 2008-11-07 01:12:36 +0000 (Fri, 07 Nov 2008) | 1 line
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: improved style ("exact" is a boolean).
+------------------------------------------------------------------------
+r5667 | zimmerma | 2008-11-06 16:53:17 +0000 (Thu, 06 Nov 2008) | 4 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+[strtofr.c] new patch (ternary value was still wrong in some cases), should
+ be ok now
+[tstrtofr.c] added new test
+
+------------------------------------------------------------------------
+r5666 | zimmerma | 2008-11-05 17:10:10 +0000 (Wed, 05 Nov 2008) | 2 lines
+Changed paths:
+ M /trunk/mpn_exp.c
+ M /trunk/strtofr.c
+
+[strtofr.c] review of patch added in revision 5660, and added comments
+
+------------------------------------------------------------------------
+r5665 | vlefevre | 2008-10-29 14:31:20 +0000 (Wed, 29 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+Updated NEWS file.
+------------------------------------------------------------------------
+r5662 | vlefevre | 2008-10-29 13:52:17 +0000 (Wed, 29 Oct 2008) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: in r5660, as pstr_size and pstr->prec both have type size_t,
+changed the type of i from mp_size_t to size_t for consistency.
+------------------------------------------------------------------------
+r5661 | vlefevre | 2008-10-29 13:43:14 +0000 (Wed, 29 Oct 2008) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: reverted the change done in r3008, which led to a trivial
+assertion. I think the goal is to make sure that pstr_size (of type
+size_t) can be represented in a mp_exp_t (as required in the code).
+------------------------------------------------------------------------
+r5660 | thevenyp | 2008-10-29 12:05:11 +0000 (Wed, 29 Oct 2008) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: fix bug '[#6604] incorrect directed rounding in mpfr_strtofr'.
+
+------------------------------------------------------------------------
+r5659 | vlefevre | 2008-10-29 02:31:21 +0000 (Wed, 29 Oct 2008) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: replaced $(...) quoting style by "`...`" since the former
+is not supported everywhere (and indeed is not used by the autotools):
+http://swox.com/list-archives/gmp-bugs/2008-October/001185.html
+------------------------------------------------------------------------
+r5658 | vlefevre | 2008-10-29 01:21:29 +0000 (Wed, 29 Oct 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tests/tstrtofr.c: added bug20081028 (bug found by Christoph Lauter
+in mpfr_set_str; this is the corresponding bug in mpfr_strtofr).
+------------------------------------------------------------------------
+r5657 | vlefevre | 2008-10-29 01:10:36 +0000 (Wed, 29 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tests/tstrtofr.c: corrections related to C usage.
+------------------------------------------------------------------------
+r5656 | vlefevre | 2008-10-29 00:59:00 +0000 (Wed, 29 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+tests/tset_str.c: added bug20081028 (bug found by Christoph Lauter).
+------------------------------------------------------------------------
+r5655 | vlefevre | 2008-10-27 03:55:33 +0000 (Mon, 27 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated @dircategory (request by Karl Berry).
+------------------------------------------------------------------------
+r5654 | vlefevre | 2008-10-27 03:27:10 +0000 (Mon, 27 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-thread.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpfrlint
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/random2.c
+ M /trunk/rec_sqrt.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_all.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+This is now GNU MPFR!
+------------------------------------------------------------------------
+r5653 | vlefevre | 2008-10-27 03:10:36 +0000 (Mon, 27 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/README
+
+README: CVS -> Subversion.
+------------------------------------------------------------------------
+r5652 | thevenyp | 2008-10-23 18:40:33 +0000 (Thu, 23 Oct 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: Fix bug with '#' and 'g' flag combination, see also defect report at http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_233.htm.
+tests/tsprintf.c: Fix wrong test value accordingly, add non-regression tests.
+
+------------------------------------------------------------------------
+r5651 | zimmerma | 2008-10-23 07:29:29 +0000 (Thu, 23 Oct 2008) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+
+[get_d64.c,set_d64.c] added reference to TR 24732
+
+------------------------------------------------------------------------
+r5650 | vlefevre | 2008-10-16 08:17:35 +0000 (Thu, 16 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: added a comment about MPFR_SIGN.
+------------------------------------------------------------------------
+r5649 | zimmerma | 2008-10-05 08:51:41 +0000 (Sun, 05 Oct 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+[mpfr.h] fixed typo, and added warning about MPFR_SIGN.
+ Shouldn't we move it in mpfr-impl.h?
+
+------------------------------------------------------------------------
+r5647 | vlefevre | 2008-10-03 11:45:14 +0000 (Fri, 03 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/configure.in
+
+INSTALL, configure.in: corrected documentation of --with-gmp* options.
+------------------------------------------------------------------------
+r5645 | vlefevre | 2008-10-02 11:40:42 +0000 (Thu, 02 Oct 2008) | 1 line
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: gave more details about --with-gmp-build.
+------------------------------------------------------------------------
+r5644 | zimmerma | 2008-10-02 11:17:49 +0000 (Thu, 02 Oct 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+[INSTALL] added warning about usage of --with-gmp-build
+
+------------------------------------------------------------------------
+r5643 | vlefevre | 2008-09-21 11:56:06 +0000 (Sun, 21 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: updated LIA-2 terminology ("pole" was in the latest public draft,
+"infinitary" in the final standard).
+------------------------------------------------------------------------
+r5642 | thevenyp | 2008-09-19 08:50:01 +0000 (Fri, 19 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tests/tstrtofr.c: Remove underflow test unintentionally commited with revision 5640.
+
+------------------------------------------------------------------------
+r5640 | thevenyp | 2008-09-18 16:33:16 +0000 (Thu, 18 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ D /trunk/random.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+
+Remove obsolete mpfr_random function and replace it by mpfr_urandomb in tests.
+
+------------------------------------------------------------------------
+r5639 | thevenyp | 2008-09-18 16:25:31 +0000 (Thu, 18 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+
+Add void in prototype.
+
+------------------------------------------------------------------------
+r5638 | vlefevre | 2008-09-18 13:40:11 +0000 (Thu, 18 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: added comments about the MPFR_FPU_PREC macro.
+------------------------------------------------------------------------
+r5636 | zimmerma | 2008-09-18 12:48:28 +0000 (Thu, 18 Sep 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+[tget_str.c] replaced 'double' input by 'char*' to avoid problems with single
+ precision (partially solves #3353)
+
+------------------------------------------------------------------------
+r5634 | zimmerma | 2008-09-17 12:28:22 +0000 (Wed, 17 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+[README.dev] added item about coverage of releases
+
+------------------------------------------------------------------------
+r5632 | zimmerma | 2008-09-16 12:48:29 +0000 (Tue, 16 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/Makefile.am
+ M /trunk/algorithms.tex
+ M /trunk/atan.c
+ M /trunk/extract.c
+ M /trunk/mpfr.texi
+
+final got rid of generic.c (bug 6199)
+
+------------------------------------------------------------------------
+r5631 | zimmerma | 2008-09-16 12:37:11 +0000 (Tue, 16 Sep 2008) | 2 lines
+Changed paths:
+ D /trunk/generic.c
+
+[generic.c] removed unused file
+
+------------------------------------------------------------------------
+r5630 | vlefevre | 2008-09-16 09:53:59 +0000 (Tue, 16 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+NEWS, mpfr.texi: documented the fact that mpfr_random and mpfr_random2
+will be suppressed in the next release.
+------------------------------------------------------------------------
+r5629 | vlefevre | 2008-09-16 08:53:00 +0000 (Tue, 16 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC svn log -rHEAD:0 -v".
+------------------------------------------------------------------------
+r5623 | thevenyp | 2008-09-10 10:00:31 +0000 (Wed, 10 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+tests/tpow_z.c: Check test for bug20080904 with the minimum possible negative exponent so as not to underflow with (future) 128 bits machine.
+
+------------------------------------------------------------------------
+r5620 | vlefevre | 2008-09-06 10:19:10 +0000 (Sat, 06 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: fixed bug20080904 (from tpow_z.c).
+------------------------------------------------------------------------
+r5619 | vlefevre | 2008-09-06 10:08:37 +0000 (Sat, 06 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: added log messages.
+------------------------------------------------------------------------
+r5618 | thevenyp | 2008-09-05 10:10:41 +0000 (Fri, 05 Sep 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+tests/tpow_z.c: Add a test that underflows.
+
+------------------------------------------------------------------------
+r5616 | vlefevre | 2008-09-05 09:05:25 +0000 (Fri, 05 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: updated a comment (for the next automake version).
+------------------------------------------------------------------------
+r5614 | vlefevre | 2008-09-05 08:56:53 +0000 (Fri, 05 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: added a note about mpfr_init_gmp_rand (removed in r4953).
+------------------------------------------------------------------------
+r5613 | vlefevre | 2008-09-04 02:44:04 +0000 (Thu, 04 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: update (about AM_MAINTAINER_MODE).
+------------------------------------------------------------------------
+r5609 | vlefevre | 2008-09-02 15:09:20 +0000 (Tue, 02 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/README
+
+Updated README file.
+------------------------------------------------------------------------
+r5607 | vlefevre | 2008-09-01 11:51:00 +0000 (Mon, 01 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+ D /trunk/patch-libtool
+
+Removed patch-libtool and updated README.dev as libtool has been fixed.
+------------------------------------------------------------------------
+r5606 | vlefevre | 2008-09-01 11:47:16 +0000 (Mon, 01 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS file update (get default $CC and $CFLAGS from gmp.h).
+------------------------------------------------------------------------
+r5605 | vlefevre | 2008-09-01 11:46:24 +0000 (Mon, 01 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: removed a useless blank line.
+------------------------------------------------------------------------
+r5604 | vlefevre | 2008-09-01 11:40:36 +0000 (Mon, 01 Sep 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: reverse-merged r5440 (about __GMP_CC/__GMP_CFLAGS) as said.
+------------------------------------------------------------------------
+r5602 | zimmerma | 2008-08-27 11:43:31 +0000 (Wed, 27 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+[algorithms.tex] the truncation error for rec_sqrt was correct, but the
+reasoning was not detailed enough
+
+------------------------------------------------------------------------
+r5600 | vlefevre | 2008-08-27 10:58:23 +0000 (Wed, 27 Aug 2008) | 3 lines
+Changed paths:
+ A /trunk/patch-aclocal-icc
+
+Added patch-aclocal-icc; this is a port of the patch posted on
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485421
+for aclocal.m4 when libtool 1.5.26-4 from Debian has been used.
+------------------------------------------------------------------------
+r5599 | zimmerma | 2008-08-27 10:00:35 +0000 (Wed, 27 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/rec_sqrt.c
+ M /trunk/round_p.c
+
+[rec_sqrt.c] fixed bug "bad_case1" (truncation error was forgotten, when
+output precision was smaller than input precision)
+
+------------------------------------------------------------------------
+r5595 | vlefevre | 2008-08-27 08:40:53 +0000 (Wed, 27 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+------------------------------------------------------------------------
+r5593 | vlefevre | 2008-08-26 13:56:06 +0000 (Tue, 26 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/trec_sqrt.c
+
+tests/trec_sqrt.c: enable the tests only with MPFR 2.4.0+.
+------------------------------------------------------------------------
+r5592 | vlefevre | 2008-08-26 13:32:45 +0000 (Tue, 26 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: noted when some changes were applied in 2.3.* versions.
+------------------------------------------------------------------------
+r5590 | vlefevre | 2008-08-25 13:26:32 +0000 (Mon, 25 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: completed information about integer types.
+------------------------------------------------------------------------
+r5589 | vlefevre | 2008-08-25 10:55:38 +0000 (Mon, 25 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added information about mixing signed and unsigned types.
+------------------------------------------------------------------------
+r5588 | vlefevre | 2008-08-25 10:40:09 +0000 (Mon, 25 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/li2.c
+
+li2.c: avoid even more mixing between signed and unsigned types, by
+casting mpfr_prec_t to mp_exp_t in expressions involving mp_exp_t.
+This time the bug is fixed: tli2 no longer freezes in 64 bits.
+------------------------------------------------------------------------
+r5587 | vlefevre | 2008-08-25 10:26:54 +0000 (Mon, 25 Aug 2008) | 4 lines
+Changed paths:
+ M /trunk/li2.c
+
+li2.c: use an "int" instead of "unsigned int" in li2_series() to avoid
+mixing signed and unsigned types, which can yield implicit conversions
+from signed into unsigned, and maybe problems on some platforms. This
+doesn't fix the current freeze of tli2 on 64-bit machines, though.
+------------------------------------------------------------------------
+r5585 | vlefevre | 2008-08-24 23:07:45 +0000 (Sun, 24 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tests/tgeneric.c: changed the way a warning with gcc 4.2+ is avoided
+(r5335), as suggested by Manuel López-Ibáñez on GCC bug 36299.
+------------------------------------------------------------------------
+r5584 | vlefevre | 2008-08-21 10:27:58 +0000 (Thu, 21 Aug 2008) | 2 lines
+Changed paths:
+ A /trunk/tests/data/sqr
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+
+Added data_check support to mpfr_sqr.
+Added bad_cases support to mpfr_sqr and mpfr_sqrt.
+------------------------------------------------------------------------
+r5582 | vlefevre | 2008-08-21 10:17:19 +0000 (Thu, 21 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tsqr.c
+
+tests/tsqr.c: corrected function definitions.
+------------------------------------------------------------------------
+r5581 | vlefevre | 2008-08-21 10:12:49 +0000 (Thu, 21 Aug 2008) | 1 line
+Changed paths:
+ A /trunk/tests/data/rec_sqrt
+ M /trunk/tests/trec_sqrt.c
+
+Added data_check & bad_cases support to mpfr_rec_sqrt.
+------------------------------------------------------------------------
+r5580 | vlefevre | 2008-08-21 10:09:34 +0000 (Thu, 21 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/trec_sqrt.c
+
+tests/trec_sqrt.c: added bad case that makes mpfr_rec_sqrt fail.
+------------------------------------------------------------------------
+r5579 | vlefevre | 2008-08-21 03:03:23 +0000 (Thu, 21 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: as not all ICC versions define the __ICC macro (only
+the __INTEL_COMPILER macro can be defined), define the __MPFR_ICC
+and __MPFR_GNUC macros in another way.
+------------------------------------------------------------------------
+r5578 | vlefevre | 2008-08-21 02:48:41 +0000 (Thu, 21 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: fixed compilation failure when HAVE_DENORMS isn't
+defined, such as with icc 10.1 on Itanium.
+------------------------------------------------------------------------
+r5577 | vlefevre | 2008-08-21 02:43:45 +0000 (Thu, 21 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: to allow random values to be reproducible,
+do not call randlimb several times in a same expression,
+because the evaluation order is unspecified.
+------------------------------------------------------------------------
+r5576 | vlefevre | 2008-08-21 02:38:07 +0000 (Thu, 21 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added test of mpfr_rec_sqrt (only with MPFR 2.4.0+).
+------------------------------------------------------------------------
+r5575 | vlefevre | 2008-08-21 02:35:37 +0000 (Thu, 21 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: removed useless parentheses.
+------------------------------------------------------------------------
+r5574 | vlefevre | 2008-08-21 02:27:56 +0000 (Thu, 21 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/rec_sqrt.c
+
+rec_sqrt.c: added logging support.
+------------------------------------------------------------------------
+r5572 | vlefevre | 2008-08-21 01:27:38 +0000 (Thu, 21 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: replaced "towards" by "toward" for consistency with
+the MPFR manual and the standards.
+------------------------------------------------------------------------
+r5570 | vlefevre | 2008-08-21 01:22:42 +0000 (Thu, 21 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: corrected English usage, spelling and typography
+in the section on mpfr_hypot.
+------------------------------------------------------------------------
+r5566 | vlefevre | 2008-08-20 22:17:34 +0000 (Wed, 20 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+tests/thypot.c: added a test for tiny x and y (already done by the
+generic tests, but not yet in the 2.3 branch in extended exponent
+range).
+------------------------------------------------------------------------
+r5565 | vlefevre | 2008-08-20 21:43:34 +0000 (Wed, 20 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tests/tgeneric.c: for the special cases tested in precision p1
+for n <= 3, set the extended exponent range.
+------------------------------------------------------------------------
+r5564 | vlefevre | 2008-08-20 21:10:29 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/thypot.c
+
+tests/thypot.c: improved error messages.
+------------------------------------------------------------------------
+r5563 | vlefevre | 2008-08-20 20:48:44 +0000 (Wed, 20 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+tests/thypot.c: perform some tests both in the current exponent range
+and in the extended exponent range, so that the lost-overflow bug of
+MPFR 2.3.1 can be triggered on 64-bit machines too.
+------------------------------------------------------------------------
+r5561 | vlefevre | 2008-08-20 19:43:57 +0000 (Wed, 20 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c:
+ * In cmpres(), if z1 and z2 were both zeros, their sign wasn't tested.
+ * Added test of mpfr_sqr and mpfr_sqrt.
+------------------------------------------------------------------------
+r5559 | vlefevre | 2008-08-20 16:24:24 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added a paragraph on MPFR internal data.
+------------------------------------------------------------------------
+r5557 | vlefevre | 2008-08-20 14:11:18 +0000 (Wed, 20 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: fixed the underflow/overflow detection for n < 0 by using
+a method similar to mpfr_pow_z.
+------------------------------------------------------------------------
+r5556 | vlefevre | 2008-08-20 13:21:00 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: added logging support.
+------------------------------------------------------------------------
+r5555 | vlefevre | 2008-08-20 12:58:21 +0000 (Wed, 20 Aug 2008) | 4 lines
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: fixed bug in mpfr_pow_general by computing correct bounds
+on exp(y*ln|x|). ==> tpow no longer fails in bug20080820.
+Note: this bug could affect only underflow cases and possibly cases
+near overflow.
+------------------------------------------------------------------------
+r5554 | vlefevre | 2008-08-20 12:48:53 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: updated comment for bug20080820().
+------------------------------------------------------------------------
+r5553 | vlefevre | 2008-08-20 12:47:40 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: added testcase for bug mentioned in r5552.
+------------------------------------------------------------------------
+r5552 | vlefevre | 2008-08-20 11:41:13 +0000 (Wed, 20 Aug 2008) | 4 lines
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: solves the underflow problem in round-to-nearest by using
+mpfr_pow_general in precision 2 (like in mpfr_pow_pos_z), but this
+currently fails due to a more general bug from r4940 (the rounding
+modes to compute an upper bound on exp(y*ln|x|) are incorrect).
+------------------------------------------------------------------------
+r5551 | vlefevre | 2008-08-20 06:42:16 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: formatting.
+------------------------------------------------------------------------
+r5550 | vlefevre | 2008-08-20 06:36:59 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: moved a log message.
+------------------------------------------------------------------------
+r5549 | vlefevre | 2008-08-20 06:34:52 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: added log messages.
+------------------------------------------------------------------------
+r5548 | vlefevre | 2008-08-20 05:55:56 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added an underflow test of x^y with y integer < 0.
+------------------------------------------------------------------------
+r5547 | vlefevre | 2008-08-20 04:17:03 +0000 (Wed, 20 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: no longer take care of the possibly lost overflow flag, as
+the other functions do not do this either; this general problem has
+been fixed in mpfr_check_range (r5545).
+------------------------------------------------------------------------
+r5545 | vlefevre | 2008-08-20 04:07:16 +0000 (Wed, 20 Aug 2008) | 7 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/exceptions.c
+ M /trunk/mpfr.texi
+
+Fixed the following problem:
+ The overflow flag can be lost in many functions called with the
+ maximum exponent equal to MPFR_EMAX_MAX (this is the default on
+ 32-bit machines) when the temporary result (in a higher precision)
+ is representable but once rounded, it yields an overflow.
+This needed a slight change of behavior of the mpfr_check_range function
+(defined in exceptions.c). Described this change in mpfr.texi and NEWS.
+------------------------------------------------------------------------
+r5544 | vlefevre | 2008-08-20 02:59:16 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: fixed some of the underflow/overflow problems for z < 0.
+------------------------------------------------------------------------
+r5543 | vlefevre | 2008-08-20 02:56:38 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: fixed mpfr_clear in overflow_inv.
+------------------------------------------------------------------------
+r5542 | vlefevre | 2008-08-20 02:50:02 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: more detailed error messages.
+------------------------------------------------------------------------
+r5541 | vlefevre | 2008-08-20 01:23:30 +0000 (Wed, 20 Aug 2008) | 5 lines
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: improved overflow_inv tests to trigger a bug
+in mpfr_pow_z due to incorrect rounding mode settings in r5315:
+on a 64-bit Linux machine, "./tpow_all 1" ends with:
+Bad overflow flag in overflow_inv for mpfr_pow, extended exponent range,
+s = 1, t = 1, GMP_RNDZ
+------------------------------------------------------------------------
+r5540 | vlefevre | 2008-08-20 00:32:17 +0000 (Wed, 20 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: in overflow_inv, reduced t to [0,5] and added tests.
+------------------------------------------------------------------------
+r5539 | vlefevre | 2008-08-19 23:48:19 +0000 (Tue, 19 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: improved error messages.
+------------------------------------------------------------------------
+r5538 | vlefevre | 2008-08-19 23:39:35 +0000 (Tue, 19 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: changed the precisions in overflow_inv for clearer
+output (the reported failures are the same).
+------------------------------------------------------------------------
+r5537 | vlefevre | 2008-08-19 23:34:23 +0000 (Tue, 19 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: information about extended exponent range wasn't
+always output. For simplicity to provide such an information, made
+ext a global variable.
+------------------------------------------------------------------------
+r5536 | vlefevre | 2008-08-19 23:23:10 +0000 (Tue, 19 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added overflow tests for x^(-1). -> Failure.
+------------------------------------------------------------------------
+r5535 | vlefevre | 2008-08-19 00:35:49 +0000 (Tue, 19 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/pow.c
+
+Fixed basic underflow checking in mpfr_pow.
+------------------------------------------------------------------------
+r5534 | vlefevre | 2008-08-18 23:30:59 +0000 (Mon, 18 Aug 2008) | 4 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/lngamma.c
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: defined macro INITIALIZED to declare that some variable
+ is initialized before being used.
+README.dev: described the use of this macro.
+lngamma.c: replaced the dummy initialization by this macro.
+------------------------------------------------------------------------
+r5533 | vlefevre | 2008-08-16 01:04:05 +0000 (Sat, 16 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: updated comments.
+------------------------------------------------------------------------
+r5532 | vlefevre | 2008-08-16 00:48:58 +0000 (Sat, 16 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added tests -> assertion failed in pow.c line 603.
+------------------------------------------------------------------------
+r5531 | vlefevre | 2008-08-15 23:56:47 +0000 (Fri, 15 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added test of mpfr_ui_div.
+------------------------------------------------------------------------
+r5530 | vlefevre | 2008-08-15 23:28:46 +0000 (Fri, 15 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: improved comments.
+------------------------------------------------------------------------
+r5527 | vlefevre | 2008-08-14 16:34:58 +0000 (Thu, 14 Aug 2008) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: additions related to MPFR caches.
+ * Added Section "Memory Handling" mentioning caches.
+ * Added call to mpfr_free_cache in the first example.
+ * Updated description of function mpfr_free_cache.
+------------------------------------------------------------------------
+r5525 | vlefevre | 2008-08-14 10:17:24 +0000 (Thu, 14 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: improved an underflow test to trigger the bug fixed
+in r5453 on 32-bit machines too.
+------------------------------------------------------------------------
+r5524 | vlefevre | 2008-08-14 09:39:24 +0000 (Thu, 14 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/log.c
+
+log.c: fixed a log message.
+------------------------------------------------------------------------
+r5523 | vlefevre | 2008-08-14 09:38:04 +0000 (Thu, 14 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: fixed other log messages.
+------------------------------------------------------------------------
+r5522 | vlefevre | 2008-08-14 09:20:14 +0000 (Thu, 14 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: fixed a log message (the format didn't correspond to the types)
+and improved it.
+------------------------------------------------------------------------
+r5519 | vlefevre | 2008-08-12 22:27:44 +0000 (Tue, 12 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+tests/tdiv.c: completed underflow test by testing negative results too.
+------------------------------------------------------------------------
+r5517 | vlefevre | 2008-08-12 22:03:37 +0000 (Tue, 12 Aug 2008) | 5 lines
+Changed paths:
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/mul_2si.c
+ M /trunk/tests/tmul_2exp.c
+
+mul_2si.c, div_2si.c, div_2ui.c: fixed double-rounding problem in
+rounding to nearest when the rounded result in unbounded exponent
+range is 2^(emin - 2).
+tests/tmul_2exp.c: test x = 15/16 too. Now tmul_2exp no longer fails
+(with the correction in div.c from r5515).
+------------------------------------------------------------------------
+r5516 | vlefevre | 2008-08-12 21:56:55 +0000 (Tue, 12 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+tests/tdiv.c correction: the underflow bug was in case when the
+result had to be zero.
+------------------------------------------------------------------------
+r5515 | vlefevre | 2008-08-12 21:52:25 +0000 (Tue, 12 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+div.c: fixed underflow bug that occurs in rounding to nearest when
+the rounded result in unbounded exponent range is 2^(emin - 2) and
+inex > 0: one got a non-zero result instead of +/-0.
+------------------------------------------------------------------------
+r5514 | vlefevre | 2008-08-12 21:47:44 +0000 (Tue, 12 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+tests/tdiv.c: added a test that triggers a bug in mpfr_div in case of
+underflow in rounding to nearest when the result must be non-zero.
+------------------------------------------------------------------------
+r5513 | vlefevre | 2008-08-12 14:43:50 +0000 (Tue, 12 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/div.c
+
+div.c: added logging support.
+------------------------------------------------------------------------
+r5512 | vlefevre | 2008-08-12 13:54:40 +0000 (Tue, 12 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+tests/tmul_2exp.c: test mpfr_div_2ui too.
+------------------------------------------------------------------------
+r5511 | vlefevre | 2008-08-12 13:37:03 +0000 (Tue, 12 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+tests/tmul_2exp.c: test mpfr_div_2si too.
+------------------------------------------------------------------------
+r5510 | vlefevre | 2008-08-12 13:28:20 +0000 (Tue, 12 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+tests/tmul_2exp.c: updated underflow() test to trigger a double-rounding
+bug in case of underflow.
+------------------------------------------------------------------------
+r5509 | vlefevre | 2008-08-12 13:11:19 +0000 (Tue, 12 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: updated comment (the double-rounding bug triggered by
+underflow_up() is in mpfr_mul_2si).
+------------------------------------------------------------------------
+r5508 | vlefevre | 2008-08-12 13:02:08 +0000 (Tue, 12 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: updated underflow_up() test: added case exp(eps) ~= 1/2,
+which fails due to a double-rounding problem in rescaling the result.
+------------------------------------------------------------------------
+r5507 | vlefevre | 2008-08-12 12:08:10 +0000 (Tue, 12 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: improved comments in underflow_up().
+------------------------------------------------------------------------
+r5505 | vlefevre | 2008-08-11 08:09:14 +0000 (Mon, 11 Aug 2008) | 33 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/pow.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow_all.c
+
+Merged vlefevre branch:
+ svn merge -c-5445 .
+ svn merge -r5436:HEAD .../mpfr/branches/vlefevre
+* pow.c:
+ - Moved the general case from mpfr_pow() to a new internal function
+ mpfr_pow_general().
+ - In this function (from old code), avoid unnecessary overflow test
+ if the intermediate result is not an infinity (which was the case
+ of underflow with non-zero result, thus not an overflow).
+ - Fixed a double-rounding problem that occurred in this function in
+ some underflow cases when rescaling the result.
+ - Added log messages.
+* mpfr-impl.h: added mpfr_pow_general prototype.
+* pow_z.c:
+ - The underflow case of mpfr_pow_pos_z() in rounding to nearest,
+ which was incorrect, is now handled by calling mpfr_pow_general(),
+ which can scale the result thus decide whether the rounded result
+ should be 0 or nextabove(0). To avoid the exact cases of x^y with
+ y integer (not supported by mpfr_pow_general()), rounding is done
+ in precision 2 (this is also faster!).
+ - Fixed underflow-related bug (case exact result = 2^(emin-2), in
+ rounding to nearest).
+ - Added log messages.
+* pow_ui.c:
+ - Swapped parameters x and y for consistency (-> y = x^n).
+ - Fixed the internal overflows and underflows (which could yield
+ spurious overflows/underflows and incorrect results) by using
+ mpfr_pow_z.
+* tests/tpow_all.c:
+ - Test flags in test_others and cmpres; cmpres argument z1 can now
+ be a null pointer (if unknown pure FP value, thus not tested).
+ - Added a test of 2^(emin - i/4) with 0 <= i <= 12, that triggered
+ the bugs mentioned above (and now fixed).
+------------------------------------------------------------------------
+r5503 | vlefevre | 2008-08-11 07:02:01 +0000 (Mon, 11 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+tests/tmul_2exp.c: added underflow tests.
+------------------------------------------------------------------------
+r5502 | vlefevre | 2008-08-11 07:00:17 +0000 (Mon, 11 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+
+Added logging support to mpfr_{mul,div}_2{si,ui}.
+------------------------------------------------------------------------
+r5498 | vlefevre | 2008-08-08 14:29:03 +0000 (Fri, 08 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: added a space for MPFR_LOG_MSG.
+------------------------------------------------------------------------
+r5496 | vlefevre | 2008-08-08 14:20:45 +0000 (Fri, 08 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: corrected MPFR_LOG_MSG example.
+------------------------------------------------------------------------
+r5494 | vlefevre | 2008-08-08 07:27:23 +0000 (Fri, 08 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: added a comment concerning ICC.
+------------------------------------------------------------------------
+r5493 | vlefevre | 2008-08-07 21:56:50 +0000 (Thu, 07 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/get_d64.c
+ M /trunk/li2.c
+ M /trunk/set_d64.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/yn.c
+
+Final code clean-up based on icc warnings.
+------------------------------------------------------------------------
+r5492 | vlefevre | 2008-08-07 21:17:14 +0000 (Thu, 07 Aug 2008) | 7 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/clears.c
+ M /trunk/cos.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_uintmax.c
+ M /trunk/frac.c
+ M /trunk/get_ld.c
+ M /trunk/get_sj.c
+ M /trunk/get_uj.c
+ M /trunk/hypot.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/set_sj.c
+ M /trunk/set_uj.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/volatile.c
+
+Further code clean-up (and consistency) based on icc warnings:
+ * Removed useless code.
+ * Avoid hiding variable declarations.
+ * Use #ifdef BOOL_MACRO instead of #if BOOL_MACRO.
+ * In MPFR_RNDRAW_GEN macro definition, variables declared locally now
+ start with an underscore to avoid possible conflits with parameters
+ (and modified macro calls that use these variables).
+------------------------------------------------------------------------
+r5491 | vlefevre | 2008-08-07 17:13:16 +0000 (Thu, 07 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/round_prec.c
+
+round_prec.c: avoid hiding variable declaration (detected by icc).
+------------------------------------------------------------------------
+r5490 | vlefevre | 2008-08-07 16:30:13 +0000 (Thu, 07 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: fixed Ziv's iteration (code from r3305) by using MPFR_ZIV_NEXT
+(problem detected by icc, because variable "loop" was never used).
+------------------------------------------------------------------------
+r5489 | vlefevre | 2008-08-07 16:15:28 +0000 (Thu, 07 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+mul_ui.c: removed variable that was set but never used (detected by icc,
+but not by gcc, probably because of early optimization).
+------------------------------------------------------------------------
+r5488 | vlefevre | 2008-08-07 16:08:45 +0000 (Thu, 07 Aug 2008) | 4 lines
+Changed paths:
+ M /trunk/inp_str.c
+
+inp_str.c: fixed possible implementation-defined behavior (a value
+from the unsigned char range -- from getc -- was stored in a char,
+and if the char type is signed and the value cannot be represented
+in a char, this is implementation-defined).
+------------------------------------------------------------------------
+r5487 | vlefevre | 2008-08-07 15:36:59 +0000 (Thu, 07 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/get_str.c
+
+get_str.c: avoid hiding variable declaration (detected by icc).
+------------------------------------------------------------------------
+r5486 | vlefevre | 2008-08-07 14:44:18 +0000 (Thu, 07 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/div.c
+
+div.c: avoid hiding variable declaration (detected by icc).
+------------------------------------------------------------------------
+r5485 | vlefevre | 2008-08-07 14:33:44 +0000 (Thu, 07 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+mpfr.h, mpfr-impl.h: avoid warnings with icc (at least icc 10.1).
+README.dev: added a paragraph on the test of "boolean" macros.
+------------------------------------------------------------------------
+r5483 | vlefevre | 2008-08-05 08:02:07 +0000 (Tue, 05 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: dist-lzma needs automake 1.10.1.
+------------------------------------------------------------------------
+r5481 | vlefevre | 2008-08-04 08:39:47 +0000 (Mon, 04 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: "make dist" generates lzma-compressed tarball too.
+------------------------------------------------------------------------
+r5480 | zimmerma | 2008-08-02 09:36:31 +0000 (Sat, 02 Aug 2008) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] fixed case where cancel is negative, added comments and improved
+code when initial n is known to be 0
+
+------------------------------------------------------------------------
+r5479 | vlefevre | 2008-08-01 21:18:06 +0000 (Fri, 01 Aug 2008) | 1 line
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: MPFR_EXP -> MPFR_GET_EXP.
+------------------------------------------------------------------------
+r5478 | zimmerma | 2008-08-01 16:45:45 +0000 (Fri, 01 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+[exp_2.c] fixed bug20080731
+
+------------------------------------------------------------------------
+r5477 | vlefevre | 2008-07-31 16:30:31 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk
+
+Added algorithms.out to svn:ignore property.
+------------------------------------------------------------------------
+r5476 | vlefevre | 2008-07-31 16:27:42 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: added testcase for new bug found in mpfr_exp_2.
+------------------------------------------------------------------------
+r5475 | vlefevre | 2008-07-31 16:02:54 +0000 (Thu, 31 Jul 2008) | 3 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp_2.c
+
+exp.c, exp_2.c: fixed the overflow/underflow detection. The underflow_up
+test in texp.c still fails for mpfr_exp_2 only, but this seems to be due
+to a bug in this function (incorrect error bound?).
+------------------------------------------------------------------------
+r5474 | vlefevre | 2008-07-31 15:03:49 +0000 (Thu, 31 Jul 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: added underflow tests to underflow_up; currently fail due
+to incorrect underflow detection in mpfr_exp (and if this detection is
+disabled, mpfr_exp_3 behaves correctly, but not mpfr_exp_2).
+------------------------------------------------------------------------
+r5473 | thevenyp | 2008-07-31 14:08:09 +0000 (Thu, 31 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+Fix typos, improve wording.
+
+------------------------------------------------------------------------
+r5472 | vlefevre | 2008-07-31 13:01:16 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/exp_2.c
+
+Added logging support to mpfr_exp_2 (exp_2.c).
+------------------------------------------------------------------------
+r5471 | vlefevre | 2008-07-31 11:36:01 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: updated comment concerning the bug fixed in r5469.
+------------------------------------------------------------------------
+r5470 | vlefevre | 2008-07-31 10:24:28 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/exp.c
+
+exp.c: updated comment about the exp3.c routine.
+------------------------------------------------------------------------
+r5469 | vlefevre | 2008-07-31 10:22:48 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/exp3.c
+
+exp3.c: fixed internal underflow.
+------------------------------------------------------------------------
+r5468 | vlefevre | 2008-07-31 09:59:53 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/fma.c
+ M /trunk/fms.c
+
+fma.c, fms.c: added a comment about apparently incorrect scaling.
+------------------------------------------------------------------------
+r5466 | vlefevre | 2008-07-31 09:46:43 +0000 (Thu, 31 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+
+Added logging support to mpfr_sqr and mpfr_sqrt.
+------------------------------------------------------------------------
+r5465 | thevenyp | 2008-07-31 08:31:11 +0000 (Thu, 31 Jul 2008) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/hypot.c
+
+hypot.c: Fix comment.
+BUGS: Add known bug for mpfr_hypot.
+
+------------------------------------------------------------------------
+r5464 | thevenyp | 2008-07-30 15:13:42 +0000 (Wed, 30 Jul 2008) | 5 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/hypot.c
+ M /trunk/tests/thypot.c
+
+algorithms.tex: Prove the correctness of the algorithm used for mpfr_hypot
+when the difference of inputs' exponents is less then exp_max - 2.
+hypot.c: Change algorithm according to its description in algorithms.tex
+tests/thypot.c: Fix tests (some were present but didn't trigger any error).
+
+------------------------------------------------------------------------
+r5463 | vlefevre | 2008-07-30 14:01:45 +0000 (Wed, 30 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: completed a comment.
+------------------------------------------------------------------------
+r5462 | vlefevre | 2008-07-30 11:26:52 +0000 (Wed, 30 Jul 2008) | 6 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: updated underflow_up test of log(2^(emin - 1)) + eps:
+ * In the old test (- log(2) < eps < 0 in GMP_RNDN), do not test
+ the flags, as this may be incorrect on some platforms (though
+ unlikely). Better tests will be provided later.
+ * Added test for case eps > 0, which triggers a bug in mpfr_exp_3
+ (underflow flag sometimes set while it shouldn't be set).
+------------------------------------------------------------------------
+r5461 | vlefevre | 2008-07-30 08:33:51 +0000 (Wed, 30 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+exp.c: completed a comment, describing how rigorous underflow/overflow
+detection can be done.
+------------------------------------------------------------------------
+r5460 | vlefevre | 2008-07-30 08:18:01 +0000 (Wed, 30 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+exp.c: removed an incorrect comment (corresponds to exp_2.c and already
+in exp_2.c).
+------------------------------------------------------------------------
+r5459 | vlefevre | 2008-07-29 14:34:10 +0000 (Tue, 29 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/exp.c
+
+exp.c: underflow/overflow detection is still a bit incorrect.
+------------------------------------------------------------------------
+r5458 | vlefevre | 2008-07-29 14:17:18 +0000 (Tue, 29 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+TODO: added "test underflow/overflow detection...".
+------------------------------------------------------------------------
+r5457 | vlefevre | 2008-07-29 14:13:11 +0000 (Tue, 29 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/exp.c
+
+exp.c: fixed underflow/overflow detection.
+------------------------------------------------------------------------
+r5456 | vlefevre | 2008-07-29 13:24:19 +0000 (Tue, 29 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: GNU style.
+------------------------------------------------------------------------
+r5455 | vlefevre | 2008-07-29 12:23:04 +0000 (Tue, 29 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: make sure that mpfr_get_exp_t and mpfr_set_exp_t are
+correctly defined.
+------------------------------------------------------------------------
+r5454 | vlefevre | 2008-07-26 10:46:26 +0000 (Sat, 26 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: updated comment of underflow_up.
+------------------------------------------------------------------------
+r5453 | vlefevre | 2008-07-26 10:44:22 +0000 (Sat, 26 Jul 2008) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: solved the assertion failure by detecting a zero due to a
+cancellation and increasing the precision via Ziv's loop in such a
+case.
+------------------------------------------------------------------------
+r5452 | vlefevre | 2008-07-26 10:29:57 +0000 (Sat, 26 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: added another assertion, that is checked independently of
+the value of MPFR_EXP_2_THRESHOLD (better for debugging).
+------------------------------------------------------------------------
+r5451 | vlefevre | 2008-07-26 10:21:09 +0000 (Sat, 26 Jul 2008) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+exp_2.c: added an assertion (more explicit than a similar assertion
+that would fail later) in mpfr_exp2_aux, caught by the underflow_up
+test in texp.c for prec = 16 on a 64-bit Linux machine.
+------------------------------------------------------------------------
+r5450 | vlefevre | 2008-07-25 21:02:13 +0000 (Fri, 25 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+tests/texp.c: added a test that shows incorrect underflow detection
+in mpfr_exp, with possible assertion failure.
+------------------------------------------------------------------------
+r5445 | vlefevre | 2008-07-25 11:52:07 +0000 (Fri, 25 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added test of mpfr_exp2 and mpfr_exp10.
+------------------------------------------------------------------------
+r5443 | vlefevre | 2008-07-25 10:31:19 +0000 (Fri, 25 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+TODO: update.
+------------------------------------------------------------------------
+r5442 | vlefevre | 2008-07-25 10:28:41 +0000 (Fri, 25 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/TODO
+
+TODO: added "option to use a 32-bit exponent type on LP64 machines".
+------------------------------------------------------------------------
+r5441 | vlefevre | 2008-07-23 13:52:09 +0000 (Wed, 23 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: updated AC_PREREQ line due to the use of AC_PROG_SED.
+------------------------------------------------------------------------
+r5440 | zimmerma | 2008-07-23 13:29:50 +0000 (Wed, 23 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added reminder
+
+------------------------------------------------------------------------
+r5439 | zimmerma | 2008-07-23 13:26:26 +0000 (Wed, 23 Jul 2008) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+patch from Patrick to get __GMP_CC and __GMP_CFLAGS from gmp.h
+(future undocumented feature for GMP 4.2.3) -> we need to check
+those are the names chosen by GMP 4.2.3 when it will be out
+
+------------------------------------------------------------------------
+r5434 | vlefevre | 2008-07-21 23:03:36 +0000 (Mon, 21 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: fixed incorrect rounding in the general case when the result
+is negative and rnd = GMP_RNDD or GMP_RNDU (bug20080721 in tpow.c).
+------------------------------------------------------------------------
+r5433 | vlefevre | 2008-07-21 22:44:32 +0000 (Mon, 21 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: completed test bug20080721.
+------------------------------------------------------------------------
+r5432 | vlefevre | 2008-07-21 22:01:11 +0000 (Mon, 21 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: fixed the non-trivial cases with large integer y.
+------------------------------------------------------------------------
+r5431 | vlefevre | 2008-07-21 17:17:51 +0000 (Mon, 21 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: added comment for bug20080721.
+------------------------------------------------------------------------
+r5430 | vlefevre | 2008-07-21 16:54:18 +0000 (Mon, 21 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: found another bug in mpfr_pow with large integers.
+------------------------------------------------------------------------
+r5429 | vlefevre | 2008-07-21 13:06:51 +0000 (Mon, 21 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: added a test that detects a bug in an underflow case.
+------------------------------------------------------------------------
+r5428 | vlefevre | 2008-07-21 09:48:22 +0000 (Mon, 21 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_all.c
+
+tests/tpow_all.c: made the comparisons between the power functions
+generic to be able to add other tests.
+------------------------------------------------------------------------
+r5427 | vlefevre | 2008-07-20 23:34:50 +0000 (Sun, 20 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: use MPFR_IS_POS(x) instead of MPFR_SIGN(x) > 0.
+------------------------------------------------------------------------
+r5425 | vlefevre | 2008-07-20 00:36:23 +0000 (Sun, 20 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: corrected a comment.
+------------------------------------------------------------------------
+r5424 | vlefevre | 2008-07-20 00:22:50 +0000 (Sun, 20 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+tests/tpow_z.c: fixed NaN^0 test.
+------------------------------------------------------------------------
+r5423 | vlefevre | 2008-07-20 00:17:02 +0000 (Sun, 20 Jul 2008) | 4 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/tests
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tpow_all.c
+
+Fixed a bug in pow_ui.c and pow_z.c: NaN^0 returned NaN instead of 1
+(see documentation). Affected functions: mpfr_pow_ui, mpfr_pow_si and
+mpfr_pow_z (but not mpfr_pow). Added new test file tests/tpow_all.c
+to test all the MPFR power functions on simple and special values.
+------------------------------------------------------------------------
+r5418 | vlefevre | 2008-07-19 16:09:13 +0000 (Sat, 19 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: forgot the case x^(±0).
+------------------------------------------------------------------------
+r5417 | vlefevre | 2008-07-19 15:36:57 +0000 (Sat, 19 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: updated comments.
+------------------------------------------------------------------------
+r5416 | vlefevre | 2008-07-19 15:21:30 +0000 (Sat, 19 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+tests/tpow_z.c: test bug20080223() didn't check that the result wasn't
+a NaN. Fixed.
+------------------------------------------------------------------------
+r5413 | vlefevre | 2008-07-19 13:52:27 +0000 (Sat, 19 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tests/tsprintf.c: removed trailing whitespace.
+------------------------------------------------------------------------
+r5412 | vlefevre | 2008-07-11 01:52:47 +0000 (Fri, 11 Jul 2008) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: potential problem with integer division and pre-C99 compilers,
+noted by Philippe.
+------------------------------------------------------------------------
+r5411 | thevenyp | 2008-07-08 12:44:59 +0000 (Tue, 08 Jul 2008) | 1 line
+Changed paths:
+ M /trunk/generic.c
+ M /trunk/vasprintf.c
+
+Fix typos
+------------------------------------------------------------------------
+r5410 | thevenyp | 2008-06-30 12:31:54 +0000 (Mon, 30 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+Fix typo (gmp macro TMP_ALLOC instead of MPFR_TMP_ALLOC).
+
+------------------------------------------------------------------------
+r5409 | vlefevre | 2008-06-27 09:26:43 +0000 (Fri, 27 Jun 2008) | 1 line
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: fixed comment from r5408.
+------------------------------------------------------------------------
+r5408 | thevenyp | 2008-06-27 08:36:34 +0000 (Fri, 27 Jun 2008) | 6 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+acinclude.m4: add a check defining va_copy macro when needed.
+vasprintf.c: use TMP_ALLOC instead of variable-length array (C99).
+tests/tfprintf.c tests/tsprintf.c: #define length of array instead of const int so as to avoid variable-length array (C99).
+tests/tprintf.c: #define length of array instead of const int so as to avoid variable-length array (C99).
+ remove use of function dup (dependency with <unistd.h>).
+
+------------------------------------------------------------------------
+r5407 | vlefevre | 2008-06-25 09:08:26 +0000 (Wed, 25 Jun 2008) | 1 line
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release" (mention various compilers).
+------------------------------------------------------------------------
+r5406 | vlefevre | 2008-06-23 02:27:02 +0000 (Mon, 23 Jun 2008) | 1 line
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: added comments about icc.
+------------------------------------------------------------------------
+r5405 | vlefevre | 2008-06-22 12:16:43 +0000 (Sun, 22 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: added "replace the *_THRESHOLD macros by global (TLS) variables
+that can be changed at run time [...]".
+------------------------------------------------------------------------
+r5400 | vlefevre | 2008-06-16 22:06:11 +0000 (Mon, 16 Jun 2008) | 4 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: updated GMP's URL (the old one no longer worked), using
+http://www.gnu.org/software/gmp/ as suggested by Karl Berry (see
+GNU policies).
+
+------------------------------------------------------------------------
+r5398 | vlefevre | 2008-06-13 13:54:37 +0000 (Fri, 13 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: changed the license for the inclusion of the manual in Debian
+(see <http://www.debian.org/vote/2006/vote_001>).
+
+------------------------------------------------------------------------
+r5396 | vlefevre | 2008-06-11 13:09:33 +0000 (Wed, 11 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+AUTHORS: converted from ISO-8859-1 to UTF-8 (this is the standard
+nowadays and this is the encoding declared on InriaGforge).
+
+------------------------------------------------------------------------
+r5395 | thevenyp | 2008-06-11 10:06:56 +0000 (Wed, 11 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix typo in mpfr_printf documentation.
+
+------------------------------------------------------------------------
+r5394 | vlefevre | 2008-06-11 09:25:01 +0000 (Wed, 11 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: removed a misleading and now useless comment.
+
+------------------------------------------------------------------------
+r5393 | vlefevre | 2008-06-11 09:21:26 +0000 (Wed, 11 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: improved a comment.
+
+------------------------------------------------------------------------
+r5392 | vlefevre | 2008-06-11 09:20:53 +0000 (Wed, 11 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+tsprintf.c: typo in a comment.
+
+------------------------------------------------------------------------
+r5391 | thevenyp | 2008-06-11 08:57:47 +0000 (Wed, 11 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+Fix comparison between mpfr string and libc string.
+
+------------------------------------------------------------------------
+r5390 | zimmerma | 2008-06-10 21:12:32 +0000 (Tue, 10 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+added test for bug(?) found by Vincent with icc
+
+------------------------------------------------------------------------
+r5389 | thevenyp | 2008-06-10 14:18:37 +0000 (Tue, 10 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+Change #include <stdio.h> to #include <cstdio> when compiled with a C++ compiler.
+Assume that mpfr_rnd_t and wchar_t arguments in a variadic functions are converted to 'int' by C++ compilers.
+
+------------------------------------------------------------------------
+r5387 | vlefevre | 2008-06-10 14:13:59 +0000 (Tue, 10 Jun 2008) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: generate an error (with a clear error message) with g++ and
+--enable-logging since compilation fails (--enable-logging is mainly for
+testing and is already incompatible with threading support anyway).
+
+------------------------------------------------------------------------
+r5386 | zimmerma | 2008-06-10 08:47:11 +0000 (Tue, 10 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+ M /trunk/exp_2.c
+
+the O(l^{1/2}) method to evaluate power series is due to
+Paterson and Stockmeyer and not Brent/Kung
+
+------------------------------------------------------------------------
+r5385 | vlefevre | 2008-06-09 16:21:34 +0000 (Mon, 09 Jun 2008) | 9 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/acinclude.m4
+ M /trunk/get_str.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/vasprintf.c
+
+Clean-up and various changes to be able to build MPFR with g++.
+But the following 3 tests currently fail with g++ 4.3.1:
+ FAIL: tprintf
+ FAIL: tsprintf
+ FAIL: tfprintf
+This is an "Illegal instruction" error, so probably a bug in g++.
+[Edit: acinclude.m4 now uses gl_SIZE_MAX, typically from size_max.m4,
+but which is not installed on all machines; this will be added to the
+MPFR repository in changesets 5680 and 5683.]
+------------------------------------------------------------------------
+r5384 | vlefevre | 2008-06-09 14:09:34 +0000 (Mon, 09 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: do not use pointer arithmetic on void *.
+
+------------------------------------------------------------------------
+r5383 | vlefevre | 2008-06-09 13:55:05 +0000 (Mon, 09 Jun 2008) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: added -Wpointer-arith to gcc options (this warning
+is useful as pointer arithmetic on void * is a gcc extension and
+doesn't work with g++).
+
+------------------------------------------------------------------------
+r5382 | vlefevre | 2008-06-09 12:26:26 +0000 (Mon, 09 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: mentioned a libtool bug with recent versions of icc.
+
+------------------------------------------------------------------------
+r5381 | vlefevre | 2008-06-09 08:47:58 +0000 (Mon, 09 Jun 2008) | 4 lines
+Changed paths:
+ M /trunk/sum.c
+
+sum.c:
+ * Completed a comment about T ** and const T ** mismatch.
+ * Removed a useless and misleading const that makes icc complain.
+
+------------------------------------------------------------------------
+r5380 | zimmerma | 2008-06-08 12:14:11 +0000 (Sun, 08 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/log.c
+
+fixed typos
+
+------------------------------------------------------------------------
+r5379 | zimmerma | 2008-06-07 21:45:24 +0000 (Sat, 07 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+use DeclareMathOperator for erf and erfc
+
+------------------------------------------------------------------------
+r5378 | zimmerma | 2008-06-07 11:34:59 +0000 (Sat, 07 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/atan.c
+
+fixed typo, added argument reduction for atan (we should try it since I believe
+atan is slow wrt exp, log, sin, cos for large precisions)
+
+------------------------------------------------------------------------
+r5377 | zimmerma | 2008-06-07 11:21:14 +0000 (Sat, 07 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/log1p.c
+
+simplified error analysis of log1p (did not match the code), and improved the
+code (in particular when 1+x is exact, directly call mpfr_log and avoid Ziv).
+
+------------------------------------------------------------------------
+r5376 | vlefevre | 2008-06-06 12:01:17 +0000 (Fri, 06 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/rec_sqrt.c
+
+rec_sqrt.c: removed execution bit.
+
+------------------------------------------------------------------------
+r5375 | vlefevre | 2008-06-06 11:47:19 +0000 (Fri, 06 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: update about build problems and the FAQ.
+
+------------------------------------------------------------------------
+r5374 | vlefevre | 2008-06-06 02:10:19 +0000 (Fri, 06 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added a comment about why the cross reference to GNU Libtool
+doesn't work from MPFR's directory.
+
+------------------------------------------------------------------------
+r5373 | vlefevre | 2008-06-06 01:33:49 +0000 (Fri, 06 Jun 2008) | 5 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added Section 4.1 "Headers and Libraries" partly based on
+GMP's. Note: in the generated mpfr.info file, the cross reference to
+libtool does not work (though GMP's info manual has exactly the same
+one and it works there). I couldn't figure out why.
+
+------------------------------------------------------------------------
+r5372 | vlefevre | 2008-06-06 01:17:08 +0000 (Fri, 06 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: make cross reference in HTML similar to texinfo's default one
+in PDF.
+
+------------------------------------------------------------------------
+r5371 | vlefevre | 2008-06-04 11:57:28 +0000 (Wed, 04 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the month.
+
+------------------------------------------------------------------------
+r5370 | vlefevre | 2008-06-04 11:51:25 +0000 (Wed, 04 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: check the LGPL license version.
+
+------------------------------------------------------------------------
+r5369 | vlefevre | 2008-06-04 11:34:10 +0000 (Wed, 04 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated paragraph on the license in "Introduction to MPFR".
+
+------------------------------------------------------------------------
+r5368 | vlefevre | 2008-06-04 11:25:59 +0000 (Wed, 04 Jun 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated GFDL version from 1.1 to 1.2 to match fdl.texi
+(this should have been done in r4059).
+
+------------------------------------------------------------------------
+r5367 | vlefevre | 2008-06-04 11:24:37 +0000 (Wed, 04 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: check GFDL versions.
+
+------------------------------------------------------------------------
+r5366 | vlefevre | 2008-06-04 11:13:23 +0000 (Wed, 04 Jun 2008) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/update-version
+
+mpfr.texi, update-version: in the MPFR manual, replaced two
+http://www.mpfr.org/ by the URL corresponding to the version,
+which can be updated by update-version.
+
+------------------------------------------------------------------------
+r5365 | vlefevre | 2008-06-04 10:30:48 +0000 (Wed, 04 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: completed paragraph on MPFR vs double-precision numbers.
+
+------------------------------------------------------------------------
+r5364 | vlefevre | 2008-06-04 10:22:02 +0000 (Wed, 04 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: replaced each @code{mpfr} by MPFR (for consistency).
+
+------------------------------------------------------------------------
+r5362 | vlefevre | 2008-06-03 09:06:48 +0000 (Tue, 03 Jun 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: fixed a comment.
+
+------------------------------------------------------------------------
+r5361 | vlefevre | 2008-05-23 13:44:59 +0000 (Fri, 23 May 2008) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: added tprintf to svn:ignore property.
+
+------------------------------------------------------------------------
+r5360 | vlefevre | 2008-05-23 11:00:28 +0000 (Fri, 23 May 2008) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/lngamma.c
+ M /trunk/sub1sp.c
+
+Added documentation about "'var' may be used uninitialized in this
+function" warnings.
+
+------------------------------------------------------------------------
+r5359 | zimmerma | 2008-05-22 11:05:19 +0000 (Thu, 22 May 2008) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/sub1sp.c
+
+Added comments about int i = i trick to avoid warning about uninitialized
+variables. This has the advantage to generate no code, but works for gcc only.
+
+------------------------------------------------------------------------
+r5358 | zimmerma | 2008-05-21 08:23:21 +0000 (Wed, 21 May 2008) | 4 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+initialize bbcp and bbcp1 to -1 (should be invalid)
+added MPFR_ASSERTN to check they are not -1 before reads
+simplified a test: (rnd == RNDN) || (rnd != RNDZ) ==> rnd != RNDZ
+
+------------------------------------------------------------------------
+r5357 | zimmerma | 2008-05-21 07:01:17 +0000 (Wed, 21 May 2008) | 4 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/sub1sp.c
+
+got rid of false (?) compiler warnings for uninitialized values
+-> we might want to revert this change if we find a better solution and/or
+ if the problem is fixed in gcc
+
+------------------------------------------------------------------------
+r5356 | vlefevre | 2008-05-20 09:38:38 +0000 (Tue, 20 May 2008) | 4 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/hypot.c
+ M /trunk/mpfr-impl.h
+ M /trunk/round_near_x.c
+
+Reverted changeset r5355. Better patch to avoid the warnings
+"warning: label 'addoneulp_doit' defined but not used" in
+MPFR_RNDRAW_GEN by adding the dummy code in the macro itself.
+
+------------------------------------------------------------------------
+r5355 | vlefevre | 2008-05-20 09:31:17 +0000 (Tue, 20 May 2008) | 4 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/hypot.c
+ M /trunk/mpfr-impl.h
+ M /trunk/round_near_x.c
+
+Avoid warnings "warning: label 'addoneulp_doit' defined but not used"
+due to the use of MPFR_RNDRAW_GEN. Dummy source code is inserted, but
+this is safe, clean (optimized away) and IMHO not too obtrusive.
+
+------------------------------------------------------------------------
+r5353 | vlefevre | 2008-05-08 01:12:42 +0000 (Thu, 08 May 2008) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: locally add -I$srcdir to CPPFLAGS for the thread-safe test
+(fixes bug #5556).
+
+------------------------------------------------------------------------
+r5351 | vlefevre | 2008-04-10 08:13:11 +0000 (Thu, 10 Apr 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: added a paragraph about -ffast-math / -fast compiler options.
+
+------------------------------------------------------------------------
+r5350 | vlefevre | 2008-04-07 09:13:52 +0000 (Mon, 07 Apr 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+tcmp.c: fixed some tests (if mpfr_cmp2 returns an incorrect result,
+the bug may be some non-reproducible behavior, so don't compute it
+a second time to say what the value was!) and clean-up.
+
+------------------------------------------------------------------------
+r5349 | zimmerma | 2008-04-07 08:54:32 +0000 (Mon, 07 Apr 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+fixed compiler warning
+
+------------------------------------------------------------------------
+r5348 | zimmerma | 2008-04-06 21:14:07 +0000 (Sun, 06 Apr 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/memory.c
+ M /trunk/tests/tcmp2.c
+
+some other changes suggested by Patrick Pelissier for 16-bit portability
+
+------------------------------------------------------------------------
+r5347 | zimmerma | 2008-04-06 20:03:47 +0000 (Sun, 06 Apr 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tui_sub.c
+
+a few patches suggested by Patrick Pelissier to ease porting to 16-bit
+architectures: removed useless #include <time.h>, changed 1024 to 1024L,
+int i to lng i
+
+------------------------------------------------------------------------
+r5346 | zimmerma | 2008-03-17 12:14:38 +0000 (Mon, 17 Mar 2008) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item about frac_* functions
+
+------------------------------------------------------------------------
+r5345 | zimmerma | 2008-03-16 12:45:07 +0000 (Sun, 16 Mar 2008) | 2 lines
+Changed paths:
+ M /trunk/modf.c
+
+fixed typo
+
+------------------------------------------------------------------------
+r5344 | thevenyp | 2008-03-11 12:35:57 +0000 (Tue, 11 Mar 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tprintf.c
+
+tests/tfprintf.c: set output to stdout when invocked with one command-line
+ parameter.
+tests/tprintf.c: add IO errors processing.
+
+------------------------------------------------------------------------
+r5343 | thevenyp | 2008-03-10 16:33:41 +0000 (Mon, 10 Mar 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tprintf.c
+
+tests/tprintf.c: add tests for mpfr_printf and mpfr_vprintf.
+Makefile.am: add tprintf.c to check_PROGRAMS.
+
+------------------------------------------------------------------------
+r5342 | thevenyp | 2008-03-10 16:18:45 +0000 (Mon, 10 Mar 2008) | 6 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/tests/tfprintf.c
+ M /trunk/vasprintf.c
+
+TODO: remove newly added functions
+vasprintf.c: change type of some variables taking care of signed/unsigned
+ comparisons, improve conditional tests, improve buffer
+ allocation, improve comments.
+tests/tfprintf.c: remove silly code.
+
+------------------------------------------------------------------------
+r5341 | thevenyp | 2008-03-10 15:41:09 +0000 (Mon, 10 Mar 2008) | 5 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tfprintf.c
+ M /trunk/vasprintf.c
+
+acinclude.m4: add check for long long compiler support, define HAVE_LONG_LONG.
+vasprintf.c: raise an error when it encounter an unsupported format in format
+ string.
+tests/tfprintf.c: HAVE_SDTINT_H -> _MPFR_H_HAVE_INTMAX_T
+
+------------------------------------------------------------------------
+r5340 | thevenyp | 2008-03-10 14:14:12 +0000 (Mon, 10 Mar 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix rounding bit bug with %RNa.
+tests/tsprintf.c: add tests for %RNa (rounding bit bug, tie case, trailing
+zeros in fractional part.
+
+------------------------------------------------------------------------
+r5339 | thevenyp | 2008-03-10 13:56:46 +0000 (Mon, 10 Mar 2008) | 5 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix bug in macro CONSUME_VA_ARG with a mp_limb_t or mp_limb_t array argument
+vasprintf.c: clean code storing the number of character in a pointer and fix bug with a mp_limb_t or mp_limb_t array argument
+tests/tfprintf.c: add tests for %n with all kinds of type, get rid of machine dependent limits of type (use +1/-1 instead)
+
+
+------------------------------------------------------------------------
+r5338 | thevenyp | 2008-03-10 10:56:03 +0000 (Mon, 10 Mar 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix bug of forgotten decimal point with %#.0Rf
+tests/tsprintf.c: add test with %#Rf and an integer mpfr_t
+
+------------------------------------------------------------------------
+r5337 | thevenyp | 2008-03-10 10:06:48 +0000 (Mon, 10 Mar 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/li2.c
+
+li2.c: improve error estimation in Ziv loop.
+algorithm.tex:improve proof of mpfr_li2 algorithm.
+
+------------------------------------------------------------------------
+r5336 | thevenyp | 2008-03-10 09:53:18 +0000 (Mon, 10 Mar 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/hypot.c
+
+hypot.c: change shift amount for exponents so as to avoid overflow in Ziv loop.
+algorithm.tex: improve proof for mpfr_hypot algorithm (unfinished).
+
+------------------------------------------------------------------------
+r5335 | vlefevre | 2008-03-07 15:08:07 +0000 (Fri, 07 Mar 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: avoid a warning with gcc 4.2+ about a test that is always
+true (the style of the code is now a bit better too).
+
+------------------------------------------------------------------------
+r5334 | thevenyp | 2008-02-29 14:29:15 +0000 (Fri, 29 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+add mpfr_hypot
+
+------------------------------------------------------------------------
+r5333 | thevenyp | 2008-02-29 12:30:07 +0000 (Fri, 29 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+fix wrong arguments (set in r5332)
+
+------------------------------------------------------------------------
+r5332 | thevenyp | 2008-02-29 12:16:26 +0000 (Fri, 29 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+add missing functions
+
+------------------------------------------------------------------------
+r5331 | thevenyp | 2008-02-29 10:23:46 +0000 (Fri, 29 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r5330 | thevenyp | 2008-02-28 16:11:33 +0000 (Thu, 28 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+add mixed format tests (with different types and different sizes)
+
+------------------------------------------------------------------------
+r5329 | thevenyp | 2008-02-28 16:05:50 +0000 (Thu, 28 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix "%%" bug
+tests/tsprintf.c: add a test setting "%%" bug off
+
+------------------------------------------------------------------------
+r5328 | thevenyp | 2008-02-28 15:17:52 +0000 (Thu, 28 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r5327 | thevenyp | 2008-02-28 15:16:09 +0000 (Thu, 28 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+use system number of bits in the significant of a double (instead of 53)
+
+------------------------------------------------------------------------
+r5326 | thevenyp | 2008-02-27 15:19:55 +0000 (Wed, 27 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/cosh.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+
+add handle for the case exp(x) overflows but sinh(x) is representable
+
+------------------------------------------------------------------------
+r5325 | thevenyp | 2008-02-27 13:42:35 +0000 (Wed, 27 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/add_d.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/div_d.c
+ M /trunk/mul_d.c
+ M /trunk/sub_d.c
+
+further code simplification
+
+------------------------------------------------------------------------
+r5324 | thevenyp | 2008-02-27 12:57:24 +0000 (Wed, 27 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mul_d.c
+
+code simplification (same as in r5323)
+
+------------------------------------------------------------------------
+r5323 | thevenyp | 2008-02-27 12:55:12 +0000 (Wed, 27 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/add_d.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/div_d.c
+ M /trunk/sub_d.c
+
+code simplification.
+
+------------------------------------------------------------------------
+r5322 | thevenyp | 2008-02-27 11:13:18 +0000 (Wed, 27 Feb 2008) | 4 lines
+Changed paths:
+ M /trunk/add_d.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/div_d.c
+ M /trunk/sub_d.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tsub_d.c
+
+add_d.c, div_d.c, sub_d.c, d_div.c, d_sub.c: restore flags in case of exception. This fixes the bug revealed by MPFR_SUSPICIOUS_OVERFLOW
+tests/tadd_d.c, tests/tsub_d.c, tests/tdiv_d.c, tests/tmul_d.c, tests/td_sub.c, tests/td_div.c, test/tmul_d.c: add checks for exception flags and ternary value
+
+
+------------------------------------------------------------------------
+r5321 | thevenyp | 2008-02-27 10:00:11 +0000 (Wed, 27 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/mul_d.c
+ M /trunk/tests/tmul_d.c
+
+mul_d.c: restore flags set by mpfr_mul. This fixes the bug revealed by MPFR_SUSPICIOUS_OVERFLOW
+test/tmul_d.c: add checks for exception flags
+
+------------------------------------------------------------------------
+r5320 | vlefevre | 2008-02-27 09:43:38 +0000 (Wed, 27 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated the section about new functions (added a paragraph
+on exception handling).
+
+------------------------------------------------------------------------
+r5319 | thevenyp | 2008-02-26 17:45:53 +0000 (Tue, 26 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+improve proof for euclidean distance algorithm (unfinished)
+
+------------------------------------------------------------------------
+r5318 | vlefevre | 2008-02-26 16:20:04 +0000 (Tue, 26 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: rewrote an ambiguous comment.
+
+------------------------------------------------------------------------
+r5317 | vlefevre | 2008-02-26 16:10:28 +0000 (Tue, 26 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: removed obsolete comments and updated a comment.
+
+------------------------------------------------------------------------
+r5316 | vlefevre | 2008-02-26 15:57:53 +0000 (Tue, 26 Feb 2008) | 4 lines
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: the same variable was used with two different meanings.
+Changed the type and the name of the one inside the Ziv loop
+(unsigned is theoretically more correct due to the bitwise OR).
+
+------------------------------------------------------------------------
+r5315 | zimmerma | 2008-02-24 18:17:18 +0000 (Sun, 24 Feb 2008) | 8 lines
+Changed paths:
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow_z.c
+
+fixed bug reported by Carl Witty (on 32-bit computers):
+sage: RR(1.99999999)^RR(-(2^30))
+5.11264311088393e-323228495
+sage: RR(1.999999999)^RR(-(2^30))
+0.000000000000000
+sage: RR(2.0)^RR(-(2^30))
+2.38256490488795e-323228497
+
+------------------------------------------------------------------------
+r5314 | zimmerma | 2008-02-23 22:52:30 +0000 (Sat, 23 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+added bug reported by Carl Witty
+
+------------------------------------------------------------------------
+r5313 | thevenyp | 2008-02-22 16:04:09 +0000 (Fri, 22 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tli2.c
+
+remove commented code
+
+------------------------------------------------------------------------
+r5312 | thevenyp | 2008-02-22 15:59:35 +0000 (Fri, 22 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tli2.c
+
+add worst cases for RNDZ and RNDU with inexact flag checking
+
+------------------------------------------------------------------------
+r5311 | vlefevre | 2008-02-22 15:49:36 +0000 (Fri, 22 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+hypot.c: added a FIXME comment.
+
+------------------------------------------------------------------------
+r5310 | vlefevre | 2008-02-22 15:45:27 +0000 (Fri, 22 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: one can have a better upper bound on \sqrt{x^2+y^2}-|x|
+(added as a comment in case this can be useful).
+
+------------------------------------------------------------------------
+r5309 | vlefevre | 2008-02-22 15:17:19 +0000 (Fri, 22 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: use hyperref.
+
+------------------------------------------------------------------------
+r5308 | thevenyp | 2008-02-21 16:42:13 +0000 (Thu, 21 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+add more details in mpfr_hypot description
+
+------------------------------------------------------------------------
+r5307 | thevenyp | 2008-02-21 16:40:40 +0000 (Thu, 21 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+cosmetic change: display "EXP" in small capitals
+no more use of {\rm \EXP}, use macro \Exp everywhere
+
+------------------------------------------------------------------------
+r5306 | thevenyp | 2008-02-20 14:04:46 +0000 (Wed, 20 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tli2.c
+
+add worst case test
+
+------------------------------------------------------------------------
+r5305 | thevenyp | 2008-02-20 11:54:26 +0000 (Wed, 20 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+add test with locale da_DK
+
+------------------------------------------------------------------------
+r5304 | thevenyp | 2008-02-20 10:33:33 +0000 (Wed, 20 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfms.c
+
+actually trigger overflow on all architectures
+
+------------------------------------------------------------------------
+r5303 | zimmerma | 2008-02-20 08:36:44 +0000 (Wed, 20 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+added MPFR_SUSPICIOUS_OVERFLOW in nightly tests
+
+------------------------------------------------------------------------
+r5302 | vlefevre | 2008-02-20 03:08:46 +0000 (Wed, 20 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/hypot.c
+
+hypot.c: fixed overflow flag problem in RNDD/RNDZ modes (testcase was
+added in r5301, and another check in r5300).
+
+------------------------------------------------------------------------
+r5301 | vlefevre | 2008-02-20 02:51:30 +0000 (Wed, 20 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+tests/thypot.c: added check_overflow test (currently fails in 32 bits).
+
+------------------------------------------------------------------------
+r5300 | vlefevre | 2008-02-20 02:38:05 +0000 (Wed, 20 Feb 2008) | 7 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tests/tgeneric.c: added a test that detects suspicious overflows and
+fails when the overflow flag is not set. This test is enabled only if
+the MPFR_SUSPICIOUS_OVERFLOW environment variable is set, and shows a
+bug in mpfr_hypot on 32-bit machines (i.e. when the current exponent
+range is the maximum exponent range, so that mpfr_check_range() has
+no effect).
+
+------------------------------------------------------------------------
+r5299 | thevenyp | 2008-02-19 15:54:49 +0000 (Tue, 19 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+restore flag overflow dropped by MPFR_SAVE_EXPO
+
+------------------------------------------------------------------------
+r5298 | thevenyp | 2008-02-18 17:30:02 +0000 (Mon, 18 Feb 2008) | 5 lines
+Changed paths:
+ M /trunk/tests/tests.c
+ M /trunk/tests/tsum.c
+
+use of (*__gmp_allocate_func)/(*__gmp_free_func) instead of
+mpfr_allocate_func/mpfr_free_func;
+the modification in r5281 doesn't work when mpfr is compiled with --gmp_build
+option.
+
+------------------------------------------------------------------------
+r5297 | vlefevre | 2008-02-18 16:37:03 +0000 (Mon, 18 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+hypot.c: it's better to scale by (Ex + Ey) / 2.
+
+------------------------------------------------------------------------
+r5296 | vlefevre | 2008-02-18 16:06:20 +0000 (Mon, 18 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: now, the ChangeLog file should be in UTF-8, like in other
+software (not much difference in practice).
+
+------------------------------------------------------------------------
+r5295 | thevenyp | 2008-02-18 15:58:36 +0000 (Mon, 18 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+improve code coverage
+
+------------------------------------------------------------------------
+r5294 | thevenyp | 2008-02-18 15:39:45 +0000 (Mon, 18 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/tests/tsprintf.c
+
+code simplification
+
+------------------------------------------------------------------------
+r5293 | thevenyp | 2008-02-18 13:48:11 +0000 (Mon, 18 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+take trailing zeros into account when separating thousands
+
+------------------------------------------------------------------------
+r5292 | zimmerma | 2008-02-18 13:24:47 +0000 (Mon, 18 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+fixed problem when x and y are very small
+
+------------------------------------------------------------------------
+r5291 | thevenyp | 2008-02-18 12:37:31 +0000 (Mon, 18 Feb 2008) | 4 lines
+Changed paths:
+ M /trunk/hypot.c
+ M /trunk/tests/thypot.c
+
+hypot.c: set flags when returning
+tests/thypot.c: change custom random tests to tgeneric ones
+
+
+------------------------------------------------------------------------
+r5290 | vlefevre | 2008-02-15 17:38:31 +0000 (Fri, 15 Feb 2008) | 12 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/li2.c
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/pow.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsprintf.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+For the terminating null pointer of the functions mpfr_inits,
+mpfr_inits2, mpfr_clears, always use the type mpfr_ptr (no longer
+void *). Updated the description of these functions in the manual
+(mpfr.texi). The reason is that the C standard does not guarantee
+that (void *) 0 has the same representation as a null pointer to
+a structure (and even the same size). In most C implementations,
+the representations are the same, but one never knows (dynamical
+checking is also always possible)...
+The change has been done with: perl -pi -e \
+ 's/(mpfr_(clear|init)s.*)\(void *\*\) *0\)/$1(mpfr_ptr) 0)/' **/*.c
+under zsh.
+
+------------------------------------------------------------------------
+r5289 | thevenyp | 2008-02-15 15:58:21 +0000 (Fri, 15 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix typo
+
+------------------------------------------------------------------------
+r5288 | thevenyp | 2008-02-15 15:30:06 +0000 (Fri, 15 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix buffer_sandwich (use for thousands separator)
+tests/tsprintf.c: add tests with "da_DK" locale
+
+------------------------------------------------------------------------
+r5287 | thevenyp | 2008-02-15 14:04:11 +0000 (Fri, 15 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tset.c
+
+add generic tests
+
+------------------------------------------------------------------------
+r5286 | thevenyp | 2008-02-15 12:49:53 +0000 (Fri, 15 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r5285 | thevenyp | 2008-02-15 09:10:03 +0000 (Fri, 15 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+fix incorrect function call
+
+------------------------------------------------------------------------
+r5284 | thevenyp | 2008-02-14 17:09:35 +0000 (Thu, 14 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/tests/tsprintf.c
+ M /trunk/vasprintf.c
+
+fix "%P" case, add test for it.
+
+------------------------------------------------------------------------
+r5283 | thevenyp | 2008-02-13 17:21:27 +0000 (Wed, 13 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+
+avoid style 'f' with large numbers
+
+------------------------------------------------------------------------
+r5282 | vlefevre | 2008-02-13 13:43:01 +0000 (Wed, 13 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+
+------------------------------------------------------------------------
+r5281 | thevenyp | 2008-02-12 15:32:22 +0000 (Tue, 12 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+ M /trunk/tests/tsum.c
+
+use of mpfr_allocate_func/mpfr_free_func instead of malloc/free
+
+------------------------------------------------------------------------
+r5280 | thevenyp | 2008-02-12 14:46:22 +0000 (Tue, 12 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+remove unneeded free and mpfr_clear
+
+------------------------------------------------------------------------
+r5279 | thevenyp | 2008-02-12 14:40:34 +0000 (Tue, 12 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+add tests for mpfr_snprintf and mpfr_vsnprintf
+
+------------------------------------------------------------------------
+r5278 | vlefevre | 2008-02-12 14:21:21 +0000 (Tue, 12 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a note about freeing the memory in the tests.
+
+------------------------------------------------------------------------
+r5277 | thevenyp | 2008-02-12 13:50:14 +0000 (Tue, 12 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tout_str.c
+
+move tests of mpfr_get_str function from tout_str.c to tget_str.c
+
+------------------------------------------------------------------------
+r5276 | thevenyp | 2008-02-12 13:46:16 +0000 (Tue, 12 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tsprintf.c
+
+initialize fmt[] size
+
+------------------------------------------------------------------------
+r5275 | thevenyp | 2008-02-12 13:30:39 +0000 (Tue, 12 Feb 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tfprintf.c
+ M /trunk/tests/tsprintf.c
+
+tfprintf.c: fix comment.
+tsprintf.c: fix comment and get rid of libc rand().
+
+
+------------------------------------------------------------------------
+r5274 | thevenyp | 2008-02-12 12:52:35 +0000 (Tue, 12 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tfprintf.c
+ D /trunk/tests/tprintf.c
+ A /trunk/tests/tsprintf.c (from /trunk/tests/tprintf.c:5272)
+
+rename tprintf.c as tsprintf.c, because it does not deal with mpfr_printf.
+add tests for mpfr_fprintf functions
+
+------------------------------------------------------------------------
+r5273 | thevenyp | 2008-02-12 08:43:02 +0000 (Tue, 12 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/printf.c
+
+remove errno setting in snprintf, it is already done in vasprintf
+correct grammatical faults in comment
+
+------------------------------------------------------------------------
+r5272 | vlefevre | 2008-02-08 16:25:37 +0000 (Fri, 08 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: undo r5270.
+
+------------------------------------------------------------------------
+r5271 | vlefevre | 2008-02-08 16:23:31 +0000 (Fri, 08 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: fixed assertion failure introduced in r5265.
+
+------------------------------------------------------------------------
+r5270 | thevenyp | 2008-02-08 16:19:41 +0000 (Fri, 08 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+remove exponent checking
+
+------------------------------------------------------------------------
+r5269 | thevenyp | 2008-02-08 13:53:09 +0000 (Fri, 08 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+ M /trunk/set_uj.c
+
+mpfr-gmp.h: Cancel r5261 changes removing the overload due to added test.
+set_uj.c: Don't call memset when len is zero.
+
+------------------------------------------------------------------------
+r5268 | thevenyp | 2008-02-08 13:20:24 +0000 (Fri, 08 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+improve assertion.
+
+------------------------------------------------------------------------
+r5267 | thevenyp | 2008-02-08 09:59:57 +0000 (Fri, 08 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+add support of thousands separator option (' flag, defined in Single UNIX Specification v2)
+
+------------------------------------------------------------------------
+r5266 | thevenyp | 2008-02-08 09:41:25 +0000 (Fri, 08 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+better string buffer management
+
+------------------------------------------------------------------------
+r5265 | vlefevre | 2008-02-07 14:40:53 +0000 (Thu, 07 Feb 2008) | 9 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tgeneric.c
+
+In tests_default_random, allow emin and emax to be outside of the
+current exponent range, so that underflow/overflow checks can be
+done on 64-bit machines. If the resulting random number is outside
+of the current range, the exponent range is extended, and restored
+by the caller once the test has been done.
+In tests/tacosh.c, changed TEST_RANDOM_EMIN and TEST_RANDOM_EMAX
+to MPFR_EMAX_MAX for test_generic_huge, so that the intermediate
+overflow case in mpfr_acosh is tested on 64-bit machines.
+
+------------------------------------------------------------------------
+r5264 | thevenyp | 2008-02-07 14:17:36 +0000 (Thu, 07 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+fix comment.
+In fact, GNU libc4 accept '%F', libc5, glibc 2.0, and glibc 2.1 don't, and glibc 2.2 accept it with C99 semantics.
+
+------------------------------------------------------------------------
+r5263 | vlefevre | 2008-02-06 14:17:26 +0000 (Wed, 06 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: added a comment about the mpfr_rnd_t enum.
+
+------------------------------------------------------------------------
+r5262 | vlefevre | 2008-02-06 13:48:33 +0000 (Wed, 06 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: removed MPFR_CHECK* macros as they are not used.
+
+------------------------------------------------------------------------
+r5261 | thevenyp | 2008-02-05 17:08:25 +0000 (Tue, 05 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+MPN_ZERO (dst, n) doesn't call memset when n==0, it prevents warning when compiled with gcc -D_FORTIFY_SOURCE
+
+------------------------------------------------------------------------
+r5260 | zimmerma | 2008-02-04 16:39:56 +0000 (Mon, 04 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion from Keith Briggs
+
+------------------------------------------------------------------------
+r5259 | thevenyp | 2008-02-04 16:15:06 +0000 (Mon, 04 Feb 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: add code for %n specifier with any type
+tests/tprintf.c: add test for %n specifier
+
+------------------------------------------------------------------------
+r5258 | thevenyp | 2008-02-04 16:10:17 +0000 (Mon, 04 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+improve mention on format string restriction
+
+------------------------------------------------------------------------
+r5257 | thevenyp | 2008-02-04 15:28:16 +0000 (Mon, 04 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mention restriction on type field in the format string.
+
+------------------------------------------------------------------------
+r5256 | thevenyp | 2008-02-04 14:28:14 +0000 (Mon, 04 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+check possible overflows in exponent part, improve comments.
+
+------------------------------------------------------------------------
+r5255 | thevenyp | 2008-02-04 13:46:52 +0000 (Mon, 04 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+
+ensure null-terminated string for (v)snprintf.
+
+------------------------------------------------------------------------
+r5254 | thevenyp | 2008-02-01 16:07:40 +0000 (Fri, 01 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+improve mpfr_printf documentation
+
+------------------------------------------------------------------------
+r5253 | vlefevre | 2008-02-01 14:08:37 +0000 (Fri, 01 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: fixed perror argument in data_check.
+
+------------------------------------------------------------------------
+r5252 | thevenyp | 2008-02-01 14:02:52 +0000 (Fri, 01 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+improve error handling
+
+------------------------------------------------------------------------
+r5251 | thevenyp | 2008-02-01 12:05:07 +0000 (Fri, 01 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+check fscanf return value, manage error case
+
+------------------------------------------------------------------------
+r5249 | zimmerma | 2008-02-01 11:02:22 +0000 (Fri, 01 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added parentheses to avoid ambiguity (suggested by Keith Briggs)
+
+------------------------------------------------------------------------
+r5248 | thevenyp | 2008-02-01 09:48:38 +0000 (Fri, 01 Feb 2008) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+
+add some "%s" format string to prevent format string attack
+
+------------------------------------------------------------------------
+r5247 | thevenyp | 2008-01-31 08:41:14 +0000 (Thu, 31 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix typo
+
+------------------------------------------------------------------------
+r5246 | thevenyp | 2008-01-30 13:19:36 +0000 (Wed, 30 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+homogeneous use of logical variable
+
+------------------------------------------------------------------------
+r5245 | vlefevre | 2008-01-30 12:48:51 +0000 (Wed, 30 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/rec_sqrt.c
+
+rec_sqrt.c: use MPFR_GET_EXP instead of MPFR_EXP, and avoid the
+bitwise AND on a signed integer.
+
+------------------------------------------------------------------------
+r5244 | vlefevre | 2008-01-30 12:39:02 +0000 (Wed, 30 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/rec_sqrt.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trec_sqrt.c
+
+Reformat.
+
+------------------------------------------------------------------------
+r5242 | vlefevre | 2008-01-30 12:29:13 +0000 (Wed, 30 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/mpfr.texi
+
+Document how to produce PDF and HTML versions of the manual.
+
+------------------------------------------------------------------------
+r5241 | thevenyp | 2008-01-30 10:06:38 +0000 (Wed, 30 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+change to values acceptable by 32-bits machines
+
+------------------------------------------------------------------------
+r5240 | thevenyp | 2008-01-30 09:34:21 +0000 (Wed, 30 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix wrong statement in MPFR_ASSERTD
+
+------------------------------------------------------------------------
+r5239 | zimmerma | 2008-01-30 08:19:41 +0000 (Wed, 30 Jan 2008) | 5 lines
+Changed paths:
+ M /trunk/nightly-test
+
+added compilation options suggested by Debian:
+http://alioth.debian.org/projects/hardening/
+http://lists.debian.org/debian-devel/2007/12/msg00090.html
+(except -Wl,zrelro which does not seem to work)
+
+------------------------------------------------------------------------
+r5238 | thevenyp | 2008-01-29 17:59:18 +0000 (Tue, 29 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+So as to avoid conversion error, get rid of mpfr_set_d/mpf_set_d except in random_double().
+Skip conversion error in random_double().
+
+------------------------------------------------------------------------
+r5237 | thevenyp | 2008-01-29 17:01:24 +0000 (Tue, 29 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix typo in comment
+
+------------------------------------------------------------------------
+r5236 | thevenyp | 2008-01-29 17:00:31 +0000 (Tue, 29 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+get rid of limitation on number of character by specifier
+
+------------------------------------------------------------------------
+r5235 | thevenyp | 2008-01-29 15:42:47 +0000 (Tue, 29 Jan 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix %Rg case
+tests/tprintf.c: add %Re, %Rf, and %Rg tests
+tests/tprintf.c: add random checking against libc
+
+------------------------------------------------------------------------
+r5231 | thevenyp | 2008-01-28 10:46:20 +0000 (Mon, 28 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+remove (undocumented) integer conversion support for mpfr_t
+
+------------------------------------------------------------------------
+r5230 | thevenyp | 2008-01-28 10:34:46 +0000 (Mon, 28 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+set errno to EOVERFLOW when printf-like functions should return value exceeding INT_MAX
+
+------------------------------------------------------------------------
+r5229 | thevenyp | 2008-01-28 10:19:09 +0000 (Mon, 28 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+change internal name of printf-like functions under preprocessor conditionals, add explanation in comment.
+
+------------------------------------------------------------------------
+r5228 | vlefevre | 2008-01-25 15:09:21 +0000 (Fri, 25 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: added a possible class of tests.
+
+------------------------------------------------------------------------
+r5225 | vlefevre | 2008-01-23 17:01:24 +0000 (Wed, 23 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: remove a blank line in an error message.
+
+------------------------------------------------------------------------
+r5224 | vlefevre | 2008-01-23 16:51:02 +0000 (Wed, 23 Jan 2008) | 4 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/tests.c
+ M /trunk/tests/tversion.c
+
+Test that the MPFR library version matches the mpfr.h version in any
+test file (this should avoid some bug reports that don't mention the
+real problem).
+
+------------------------------------------------------------------------
+r5222 | vlefevre | 2008-01-23 16:24:59 +0000 (Wed, 23 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+tversion.c: improved an error message.
+
+------------------------------------------------------------------------
+r5219 | vlefevre | 2008-01-23 13:36:21 +0000 (Wed, 23 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: fixed configure test for TLS support.
+
+------------------------------------------------------------------------
+r5217 | vlefevre | 2008-01-23 12:29:30 +0000 (Wed, 23 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS file update (configure test for TLS support).
+
+------------------------------------------------------------------------
+r5213 | vlefevre | 2008-01-23 12:17:51 +0000 (Wed, 23 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/add_d.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/div_d.c
+ M /trunk/li2.c
+ M /trunk/mbench/generate.c
+ M /trunk/mbench/mpfr-gfx.c
+ M /trunk/mbench/mpfr-v4.c
+ M /trunk/mbench/mpfr-v6.c
+ M /trunk/modf.c
+ M /trunk/mul_d.c
+ M /trunk/printf.c
+ M /trunk/rec_sqrt.c
+ M /trunk/rem1.c
+ M /trunk/sinh_cosh.c
+ M /trunk/sub_d.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trec_sqrt.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/vasprintf.c
+
+Added svn:keywords and svn:eol-style properties on new .c files.
+
+------------------------------------------------------------------------
+r5212 | vlefevre | 2008-01-23 11:46:10 +0000 (Wed, 23 Jan 2008) | 9 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-impl.h
+ A /trunk/mpfr-thread.h
+
+Changes related to thread-local variables / TLS support.
+ * Moved the MPFR_THREAD_ATTR definition from mpfr-impl.h into a new
+ header file mpfr-thread.h, and updated Makefile.am accordingly.
+ * Removed the compiler check __MPFR_GNUC(3,3) || __MPFR_ICC(8,1,0)
+ as this test leaded to both false positives and false negatives
+ concerning TLS support. Assume that __thread should be used for
+ thread-local variables (except for the MS compiler).
+ * Added a configure test to acinclude.m4 (in MPFR_CONFIGS).
+
+------------------------------------------------------------------------
+r5211 | zimmerma | 2008-01-22 12:13:08 +0000 (Tue, 22 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added item about timings for a new release
+
+------------------------------------------------------------------------
+r5210 | zimmerma | 2008-01-22 12:09:19 +0000 (Tue, 22 Jan 2008) | 3 lines
+Changed paths:
+ A /trunk/mbench
+ A /trunk/mbench/Makefile
+ A /trunk/mbench/README
+ A /trunk/mbench/generate.c
+ A /trunk/mbench/mfv5-arprec.cc
+ A /trunk/mbench/mfv5-cln.cc
+ A /trunk/mbench/mfv5-crlibm.cc
+ A /trunk/mbench/mfv5-libc.cc
+ A /trunk/mbench/mfv5-lidia.cc
+ A /trunk/mbench/mfv5-mpf.cc
+ A /trunk/mbench/mfv5-mpfr.cc
+ A /trunk/mbench/mfv5-ntl.cc
+ A /trunk/mbench/mfv5-pari.cc
+ A /trunk/mbench/mfv5-void.cc
+ A /trunk/mbench/mfv5.cc
+ A /trunk/mbench/mfv5.h
+ A /trunk/mbench/mpfr-gfx.c
+ A /trunk/mbench/mpfr-v4.c
+ A /trunk/mbench/mpfr-v6.c
+ A /trunk/mbench/timp.h
+
+mbench program written by Patrick Pelissier to measure clock cycles of MPFR
+(and other libraries) for small precision
+
+------------------------------------------------------------------------
+r5207 | vlefevre | 2008-01-22 09:51:00 +0000 (Tue, 22 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: noted the changes concerning mpfr_strtofr (changesets 5146, 5147,
+5148, 5149, 5167, 5172, 5173).
+
+------------------------------------------------------------------------
+r5205 | vlefevre | 2008-01-22 09:21:37 +0000 (Tue, 22 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+mpfr-gmp.h: small fix of a macro.
+
+------------------------------------------------------------------------
+r5204 | vlefevre | 2008-01-21 12:42:57 +0000 (Mon, 21 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+mpfr-gmp.h: for temporary allocations, use alloca() if size < 16384.
+
+------------------------------------------------------------------------
+r5203 | vlefevre | 2008-01-19 10:43:38 +0000 (Sat, 19 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: inverse square root -> reciprocal square root.
+
+------------------------------------------------------------------------
+r5202 | zimmerma | 2008-01-18 16:20:48 +0000 (Fri, 18 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_rec_sqrt in mpfr.texi (forgot in last commit)
+
+------------------------------------------------------------------------
+r5201 | vlefevre | 2008-01-18 15:47:39 +0000 (Fri, 18 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: added mpfr_rec_sqrt for MPFR 2.4.*.
+
+------------------------------------------------------------------------
+r5200 | zimmerma | 2008-01-18 14:03:27 +0000 (Fri, 18 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed rec_sqrt (done)
+
+------------------------------------------------------------------------
+r5199 | thevenyp | 2008-01-17 17:46:53 +0000 (Thu, 17 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: merge code for "%Ra" and "%Rb"
+
+------------------------------------------------------------------------
+r5198 | thevenyp | 2008-01-16 12:54:47 +0000 (Wed, 16 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+cosmetic change: replace "enum _arg_type" by "enum arg_t"
+
+------------------------------------------------------------------------
+r5197 | thevenyp | 2008-01-16 10:58:11 +0000 (Wed, 16 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix %g case; merge %e, %f, %g code
+tests/tprintf.c: add tests for %Rg
+
+------------------------------------------------------------------------
+r5196 | thevenyp | 2008-01-16 10:50:42 +0000 (Wed, 16 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+add MPFR_SAVE_EXPO macros
+
+------------------------------------------------------------------------
+r5195 | thevenyp | 2008-01-16 10:44:18 +0000 (Wed, 16 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+cosmetic changes: only one leading underscore for an identifier with file scope
+
+------------------------------------------------------------------------
+r5194 | thevenyp | 2008-01-16 10:29:58 +0000 (Wed, 16 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+add needed va_list argument in READ_INT macro
+
+------------------------------------------------------------------------
+r5193 | vlefevre | 2008-01-16 09:30:15 +0000 (Wed, 16 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: added trec_sqrt to svn:ignore property.
+
+------------------------------------------------------------------------
+r5191 | vlefevre | 2008-01-16 09:05:22 +0000 (Wed, 16 Jan 2008) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: when building MPFR with the GMP build directory,
+use TMP_ALLOC(s) instead of TMP_SALLOC(s), as we don't know
+whether allocations are small or big (see gmp-impl.h).
+
+------------------------------------------------------------------------
+r5190 | zimmerma | 2008-01-16 07:57:24 +0000 (Wed, 16 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/rec_sqrt.c
+
+moved from ASSERTD to ASSERTN an assertion which does not depend on MPFR
+
+------------------------------------------------------------------------
+r5189 | zimmerma | 2008-01-15 17:16:35 +0000 (Tue, 15 Jan 2008) | 2 lines
+Changed paths:
+ A /trunk/tests/trec_sqrt.c
+
+this file might be useful to test mpfr_rec_sqrt...
+
+------------------------------------------------------------------------
+r5188 | zimmerma | 2008-01-15 17:10:17 +0000 (Tue, 15 Jan 2008) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/algorithms.tex
+ M /trunk/mpfr.h
+ M /trunk/rec_sqrt.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tests.c
+
+rec_sqrt.c: complete rewrite, to allow to use directly the MPFR internal
+ representation as input (without shift), and to allow different
+ input and output precisions, without loss of efficiency
+other files: added new function mpfr_rec_sqrt
+
+------------------------------------------------------------------------
+r5187 | vlefevre | 2008-01-14 17:23:44 +0000 (Mon, 14 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/rec_sqrt.c
+
+rec_sqrt.c: deleted trailing whitespace.
+
+------------------------------------------------------------------------
+r5186 | vlefevre | 2008-01-14 17:22:35 +0000 (Mon, 14 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+
+mpfr-gmp.{c,h}: no longer use alloca() for the temporary allocations as
+this can make MPFR crash in some high precisions, due to limited stack.
+
+------------------------------------------------------------------------
+r5185 | thevenyp | 2008-01-14 10:41:19 +0000 (Mon, 14 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+add bug found by Paul Zimmermann
+
+------------------------------------------------------------------------
+r5184 | thevenyp | 2008-01-14 10:33:01 +0000 (Mon, 14 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: fix wrong computation of digit number with %Rf when 0 < op < 1
+tests/tprintf.c: simpler 10^-n case
+
+------------------------------------------------------------------------
+r5182 | vlefevre | 2008-01-14 08:34:00 +0000 (Mon, 14 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: typo.
+
+------------------------------------------------------------------------
+r5181 | vlefevre | 2008-01-11 21:54:06 +0000 (Fri, 11 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated month.
+
+------------------------------------------------------------------------
+r5180 | vlefevre | 2008-01-11 21:45:08 +0000 (Fri, 11 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added a warning concerning huge precisions.
+
+------------------------------------------------------------------------
+r5179 | thevenyp | 2008-01-10 17:18:23 +0000 (Thu, 10 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+fix %f case
+
+------------------------------------------------------------------------
+r5178 | thevenyp | 2008-01-10 17:06:11 +0000 (Thu, 10 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r5177 | zimmerma | 2008-01-08 07:36:23 +0000 (Tue, 08 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+small changes for acos/asin/atan/atan2 rounded outside their output range
+
+------------------------------------------------------------------------
+r5176 | zimmerma | 2008-01-07 21:11:03 +0000 (Mon, 07 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added note about output of acos/asin/atan/atan2 which might be outside the
+function domain
+
+------------------------------------------------------------------------
+r5175 | zimmerma | 2008-01-05 09:20:12 +0000 (Sat, 05 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/rec_sqrt.c
+
+new version with improved tables, use macros from mpfr-impl.h, removed tabs
+
+------------------------------------------------------------------------
+r5173 | vlefevre | 2008-01-04 21:57:08 +0000 (Fri, 04 Jan 2008) | 4 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+Fixed return value of mpfr_strtofr in case of invalid data (it was -1,
+but it should be 0 since it is a ternary value and the result is 0,
+which is exact). Added test of the ternary value in this case.
+
+------------------------------------------------------------------------
+r5172 | vlefevre | 2008-01-04 21:33:19 +0000 (Fri, 04 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: better description of mpfr_strtofr.
+
+------------------------------------------------------------------------
+r5171 | vlefevre | 2008-01-04 13:11:46 +0000 (Fri, 04 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS update (new functions in the trunk).
+
+------------------------------------------------------------------------
+r5167 | vlefevre | 2008-01-04 12:07:14 +0000 (Fri, 04 Jan 2008) | 15 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+Changes related to mpfr_strtofr.
+ * strtofr.c: for mpfr_strtofr, data corresponding to NaN can now have
+ an optional sign (since the documentation said that parsing followed
+ the standard C strtod function and this change makes invalid data
+ now valid, so that there should be no compatibility problems).
+ * tests/tstrtofr.c: changed the test for -42P17 in base 16 (this was
+ eventually regarded as a documentation bug); added tests.
+ * mpfr.texi: almost completely rewrote the specification of the
+ mpfr_strtofr function. Changes:
+ - the binary exponent is now accepted even without the 0b or 0x
+ prefix;
+ - data corresponding to NaN can now have an optional sign (this was
+ a bit ambiguous);
+ - many other ambiguities avoided.
+
+------------------------------------------------------------------------
+r5166 | zimmerma | 2008-01-04 10:35:04 +0000 (Fri, 04 Jan 2008) | 5 lines
+Changed paths:
+ A /trunk/rec_sqrt.c
+
+the function mpfr_mpn_rec_sqrt() provides a faithful approximation of the
+inverse square root. Some improvements can still be made, but the interface
+should not change, thus we can start writing the mpfr_rec_sqrt function that
+calls it.
+
+------------------------------------------------------------------------
+r5164 | vlefevre | 2008-01-02 17:19:42 +0000 (Wed, 02 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+
+------------------------------------------------------------------------
+r5161 | vlefevre | 2008-01-01 12:31:06 +0000 (Tue, 01 Jan 2008) | 3 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+tgamma.c: completed test in r5159 with another one that was failing
+in the default exponent range.
+
+------------------------------------------------------------------------
+r5160 | vlefevre | 2008-01-01 12:07:21 +0000 (Tue, 01 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+delete trailing spaces.
+
+------------------------------------------------------------------------
+r5159 | zimmerma | 2008-01-01 09:44:28 +0000 (Tue, 01 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed bug in case of underflow (wrong sign)
+
+------------------------------------------------------------------------
+r5157 | vlefevre | 2008-01-01 03:57:20 +0000 (Tue, 01 Jan 2008) | 4 lines
+Changed paths:
+ M /trunk/gen_inverse.h
+
+gen_inverse.h: fixed the bug reported by Kevin Rauch a few hours ago
+(and that was detected by the generic tests and by mpfrlint after the
+latest changes).
+
+------------------------------------------------------------------------
+r5154 | vlefevre | 2008-01-01 03:47:50 +0000 (Tue, 01 Jan 2008) | 2 lines
+Changed paths:
+ M /trunk/mpfrlint
+
+mpfrlint: incorrect use of mpfr_<flag>_p is also checked in .h files.
+
+------------------------------------------------------------------------
+r5151 | vlefevre | 2008-01-01 03:26:37 +0000 (Tue, 01 Jan 2008) | 4 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_d.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/d_div.c
+ M /trunk/d_sub.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_d.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_patches.sh
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/modf.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_d.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/printf.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rem1.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/setsign.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/signbit.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_d.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/data/li2
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tfms.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tisqrt.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/vasprintf.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/yn.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Copyright notice update: added 2008 with
+ perl -pi -e 's/2007 Free Software/2007, 2008 Free Software/' **/*(^/)
+under zsh.
+
+------------------------------------------------------------------------
+r5150 | vlefevre | 2008-01-01 03:17:56 +0000 (Tue, 01 Jan 2008) | 5 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: in the bug detection with flags set before the function
+call, the erange flag was set, so that no checks were performed on
+the return value. Fixed that by not setting the erange flag.
+-> Now, 7 tests fail!
+
+------------------------------------------------------------------------
+r5149 | vlefevre | 2007-12-31 02:32:11 +0000 (Mon, 31 Dec 2007) | 5 lines
+Changed paths:
+ M /trunk/tests/tstrtofr.c
+
+tstrtofr.c: added test of -42P17 with base = 0 and 16. This currently
+fails with base = 16 (-42P17 is parsed as -0x42P17 instead of -42 with
+the remaining characters "P17"), but we could alternatively regard the
+mpfr_strtofr specification (in mpfr.texi) as incorrect.
+
+------------------------------------------------------------------------
+r5148 | vlefevre | 2007-12-30 18:20:34 +0000 (Sun, 30 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: corrections in the specification of mpfr_strtofr (see FIXME).
+
+------------------------------------------------------------------------
+r5147 | vlefevre | 2007-12-30 17:48:06 +0000 (Sun, 30 Dec 2007) | 5 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tset_str.c
+
+strtofr.c: base arguments different from 0 and 2..36 have never been
+accepted. So, instead of returning the confusing -1 (it's a ternary
+value), let's add an assert for the moment. An alternative solution
+is to return 0 and set the erange flag.
+
+------------------------------------------------------------------------
+r5146 | vlefevre | 2007-12-30 17:17:36 +0000 (Sun, 30 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: minor change (in the style); a comment was ambiguous.
+
+------------------------------------------------------------------------
+r5145 | vlefevre | 2007-12-29 22:02:14 +0000 (Sat, 29 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO update (tests: generic bad cases).
+
+------------------------------------------------------------------------
+r5144 | vlefevre | 2007-12-29 21:46:50 +0000 (Sat, 29 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsub_d.c
+
+Added #if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) conditionals to be
+able to test MPFR 2.3.* with the (more complete) tests from the trunk.
+
+------------------------------------------------------------------------
+r5143 | vlefevre | 2007-12-29 17:07:10 +0000 (Sat, 29 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated item 6 of "To make a release".
+
+------------------------------------------------------------------------
+r5138 | vlefevre | 2007-12-28 02:37:11 +0000 (Fri, 28 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated month.
+
+------------------------------------------------------------------------
+r5136 | vlefevre | 2007-12-27 16:12:57 +0000 (Thu, 27 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tsubnormal.c
+
+tests: check the exponent range, in particular at the end of each test.
+
+------------------------------------------------------------------------
+r5135 | vlefevre | 2007-12-27 16:00:56 +0000 (Thu, 27 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+texceptions.c: GNU coding style.
+
+------------------------------------------------------------------------
+r5134 | vlefevre | 2007-12-27 15:59:46 +0000 (Thu, 27 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+texceptions.c: restore the exponent range.
+
+------------------------------------------------------------------------
+r5132 | vlefevre | 2007-12-27 03:10:01 +0000 (Thu, 27 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+
+exp2.c: removed incorrect comment (the overflow test was OK due to the
+mpfr_clear_flags above, but the new test is slightly better anyway).
+
+------------------------------------------------------------------------
+r5127 | zimmerma | 2007-12-21 15:31:55 +0000 (Fri, 21 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+added tuning parameters for 32-bit Core 2
+(thanks to Patrick Pelissier and Emmanuel Thome)
+
+------------------------------------------------------------------------
+r5124 | vlefevre | 2007-12-20 08:53:50 +0000 (Thu, 20 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: enable testcase bug20071218.
+
+------------------------------------------------------------------------
+r5123 | vlefevre | 2007-12-19 18:15:03 +0000 (Wed, 19 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: possible incorrect results due to internal underflow.
+
+------------------------------------------------------------------------
+r5122 | vlefevre | 2007-12-19 18:00:59 +0000 (Wed, 19 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: detect all underflow cases (some of them were leading to
+an infinite loop, see bug20071218 in tpow.c).
+
+------------------------------------------------------------------------
+r5121 | vlefevre | 2007-12-19 15:04:43 +0000 (Wed, 19 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: updated description of MPFR_CAN_ROUND.
+
+------------------------------------------------------------------------
+r5120 | vlefevre | 2007-12-19 14:49:34 +0000 (Wed, 19 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/round_p.c
+
+round_p.c: in comment, "round to zero" -> "round toward zero".
+
+------------------------------------------------------------------------
+r5119 | vlefevre | 2007-12-19 14:27:30 +0000 (Wed, 19 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: formatting.
+
+------------------------------------------------------------------------
+r5118 | vlefevre | 2007-12-19 14:25:10 +0000 (Wed, 19 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added testcase for another bug found by Kevin P. Rauch.
+Execute tpow with an argument to enable it.
+
+------------------------------------------------------------------------
+r5117 | thevenyp | 2007-12-19 10:32:52 +0000 (Wed, 19 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: add sprnt_fp_e for "%e" processing
+tests/tprintf.c: change tests for decimal output (but need further tests)
+
+------------------------------------------------------------------------
+r5116 | thevenyp | 2007-12-19 09:26:37 +0000 (Wed, 19 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+add checks for zero
+
+------------------------------------------------------------------------
+r5115 | vlefevre | 2007-12-18 15:51:00 +0000 (Tue, 18 Dec 2007) | 11 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/atan2.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/gamma.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfrlint
+ M /trunk/pow.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/rint.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/yn.c
+
+Merged the feature-block branch to the trunk:
+* New MPFR_BLOCK* macros (see mpfr-impl.h) and mpfrlint check to test
+ exception flags in a more reliable way and detect possible problems
+ with mpfrlint.
+* Improved the generic tests (tests/tgeneric.c): for the second
+ function call, sometimes set all the flags since risk of failures
+ are known when some flags are already set.
+* Modified code to use these new MPFR_BLOCK* macros. This fixed bugs
+ related to exceptions (where flags are set before the call); in
+ particular, tcot and ty1 failed with the improved generic tests.
+
+------------------------------------------------------------------------
+r5113 | thevenyp | 2007-12-18 15:09:30 +0000 (Tue, 18 Dec 2007) | 4 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+printf.c: each mpfr_printf-like function return -1 and set erange flag in error case
+vasprintf.c: change types in struct char_fp
+vasprintf.c: add many size checking
+
+------------------------------------------------------------------------
+r5112 | thevenyp | 2007-12-18 13:48:07 +0000 (Tue, 18 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+simplify code, improve comments
+
+------------------------------------------------------------------------
+r5110 | vlefevre | 2007-12-18 12:54:25 +0000 (Tue, 18 Dec 2007) | 6 lines
+Changed paths:
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow_z.c
+
+Fixed bug in mpfr_pow_z: if x = y (same mpfr_t argument), the input
+argument is negative and not a power of two, z is positive and odd,
+an overflow or underflow occurs, and the temporary result res is
+positive, then the result gets a wrong sign (positive instead of
+negative). Testcase.
+
+------------------------------------------------------------------------
+r5108 | vlefevre | 2007-12-18 12:08:42 +0000 (Tue, 18 Dec 2007) | 5 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/tests/tpow.c
+
+Fixed bug in mpfr_pow_ui (introduced in r3214): if x = y (same mpfr_t
+argument), the input argument is negative, n is odd, an overflow or
+underflow occurs, and the temporary result res is positive, then the
+result gets a wrong sign (positive instead of negative). Testcase.
+
+------------------------------------------------------------------------
+r5107 | vlefevre | 2007-12-18 11:24:53 +0000 (Tue, 18 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_ui.c
+
+pow_ui.c: fixed an assertion.
+
+------------------------------------------------------------------------
+r5106 | vlefevre | 2007-12-18 10:27:28 +0000 (Tue, 18 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: update concerning overflow/underflow exceptions.
+
+------------------------------------------------------------------------
+r5105 | thevenyp | 2007-12-18 10:08:21 +0000 (Tue, 18 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+exponent continuity with one hexadecimal digit ouput
+
+------------------------------------------------------------------------
+r5104 | thevenyp | 2007-12-17 14:41:58 +0000 (Mon, 17 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+#define CASE_INT_MAX_ARG to nil when HAVE_STDINT_H is not defined
+
+------------------------------------------------------------------------
+r5103 | thevenyp | 2007-12-17 13:52:26 +0000 (Mon, 17 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: add sprnt_fp_b for "%b" processing
+tests/tprintf.c: add tests for binary output
+
+------------------------------------------------------------------------
+r5102 | thevenyp | 2007-12-17 13:49:11 +0000 (Mon, 17 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix count of characters in exponent part
+
+------------------------------------------------------------------------
+r5101 | thevenyp | 2007-12-17 13:46:24 +0000 (Mon, 17 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+simplify code, remove trailing spaces and improve comment
+
+------------------------------------------------------------------------
+r5100 | vlefevre | 2007-12-17 12:04:53 +0000 (Mon, 17 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: added note about the successive calls to strcat in vasprintf.c.
+
+------------------------------------------------------------------------
+r5099 | thevenyp | 2007-12-17 10:16:34 +0000 (Mon, 17 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+add tests for 1 hexa digit output
+
+------------------------------------------------------------------------
+r5093 | vlefevre | 2007-12-16 00:15:25 +0000 (Sun, 16 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: fixed indentation.
+
+------------------------------------------------------------------------
+r5092 | zimmerma | 2007-12-15 14:29:06 +0000 (Sat, 15 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/reldiff.c
+
+fixed typo
+
+------------------------------------------------------------------------
+r5091 | zimmerma | 2007-12-15 09:42:13 +0000 (Sat, 15 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/tests/tasin.c
+
+fixed bug reported by Kevin Rauch
+
+------------------------------------------------------------------------
+r5090 | thevenyp | 2007-12-14 17:12:05 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+change display with just one hexadecimal digit
+
+------------------------------------------------------------------------
+r5089 | zimmerma | 2007-12-14 14:26:21 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+simplified MPFR_FAST_COMPUTE_IF_SMALL_INPUT part (in case of overlap)
+
+------------------------------------------------------------------------
+r5088 | thevenyp | 2007-12-14 14:08:28 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+fix wrong call
+
+------------------------------------------------------------------------
+r5087 | zimmerma | 2007-12-14 13:24:44 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/round_near_x.c
+
+added comments, got rid of compiler warnings
+
+------------------------------------------------------------------------
+r5086 | zimmerma | 2007-12-14 13:10:41 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/sinh_cosh.c
+
+added warning
+
+------------------------------------------------------------------------
+r5085 | vlefevre | 2007-12-14 12:36:25 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+sin_cos.c: improved changeset 5084; in particular, added a missing cast.
+
+------------------------------------------------------------------------
+r5084 | zimmerma | 2007-12-14 09:24:11 +0000 (Fri, 14 Dec 2007) | 4 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tsin_cos.c
+
+sin_cos.c, tsin_cos.c: fixed bug occurring when arguments overlap and
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT fails
+reuse.c: improved output in case of error
+
+------------------------------------------------------------------------
+r5083 | thevenyp | 2007-12-14 09:20:36 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+improve one digit case, add comment
+
+------------------------------------------------------------------------
+r5082 | vlefevre | 2007-12-14 09:06:26 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: added a FIXME comment. Bug?
+
+------------------------------------------------------------------------
+r5081 | vlefevre | 2007-12-14 09:05:30 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/vasprintf.c
+
+Minor changes concerning num_to_text. The ending \0 isn't needed.
+
+------------------------------------------------------------------------
+r5080 | thevenyp | 2007-12-14 08:56:31 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsinh_cosh.c
+
+simplify error output code
+
+------------------------------------------------------------------------
+r5079 | thevenyp | 2007-12-14 08:45:48 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+add num_to_text array for hexadecimal digits
+
+------------------------------------------------------------------------
+r5078 | thevenyp | 2007-12-14 08:17:43 +0000 (Fri, 14 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tsinh_cosh.c
+
+output errors to stdout
+
+------------------------------------------------------------------------
+r5077 | thevenyp | 2007-12-13 17:20:42 +0000 (Thu, 13 Dec 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+ M /trunk/vasprintf.c
+
+vasprintf.c: group hexadecimal output processing in a new sprnt_fp_a function.
+tests/tprintf.c: add tests for %a case
+tests/tprintf.c: factorize error message output
+
+------------------------------------------------------------------------
+r5076 | vlefevre | 2007-12-13 17:08:44 +0000 (Thu, 13 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+
+get_d64.c: fixed comment.
+
+------------------------------------------------------------------------
+r5075 | vlefevre | 2007-12-13 17:03:19 +0000 (Thu, 13 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: added missing #include <string.h> (useful if MPFR is built
+with the GMP build directory, as mpfr-gmp.h isn't used in this case).
+
+------------------------------------------------------------------------
+r5074 | thevenyp | 2007-12-13 16:59:31 +0000 (Thu, 13 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix typos.
+
+------------------------------------------------------------------------
+r5073 | thevenyp | 2007-12-13 16:58:01 +0000 (Thu, 13 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+
+Add handle for null size case in mpfr_snprintf
+
+------------------------------------------------------------------------
+r5072 | thevenyp | 2007-12-13 16:53:24 +0000 (Thu, 13 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+Add some comments and assertions.
+
+------------------------------------------------------------------------
+r5071 | thevenyp | 2007-12-13 16:42:19 +0000 (Thu, 13 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+#define's for nan and inf strings
+
+------------------------------------------------------------------------
+r5070 | thevenyp | 2007-12-13 16:20:30 +0000 (Thu, 13 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+short documentation of printf-like functions.
+
+------------------------------------------------------------------------
+r5069 | vlefevre | 2007-12-12 23:02:12 +0000 (Wed, 12 Dec 2007) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added information about my tool "eet" to be able to see the
+warnings more easily.
+
+------------------------------------------------------------------------
+r5068 | vlefevre | 2007-12-12 14:46:26 +0000 (Wed, 12 Dec 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: updated comment concerning the case nbchar > INT_MAX.
+
+------------------------------------------------------------------------
+r5067 | zimmerma | 2007-11-30 17:26:38 +0000 (Fri, 30 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+
+changed default return value in mpfr_jn_k0
+
+------------------------------------------------------------------------
+r5066 | zimmerma | 2007-11-30 17:09:03 +0000 (Fri, 30 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp3.c
+ M /trunk/tests/texp.c
+
+fixed underflow problem in mpfr_exp_3
+
+------------------------------------------------------------------------
+r5065 | zimmerma | 2007-11-30 15:03:56 +0000 (Fri, 30 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/jn.c
+ M /trunk/tests/tset_str.c
+
+tests/tset_str.c: added command-line argument for output base
+jn.c: replaced double-precision LOG2 constant by binary string (more portable)
+
+------------------------------------------------------------------------
+r5064 | zimmerma | 2007-11-30 13:50:23 +0000 (Fri, 30 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+fixed underflow problem
+
+------------------------------------------------------------------------
+r5063 | zimmerma | 2007-11-30 12:05:02 +0000 (Fri, 30 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mparam_h.in
+
+experimental code to distinguish Core2 from AMD64
+
+------------------------------------------------------------------------
+r5062 | zimmerma | 2007-11-30 10:43:43 +0000 (Fri, 30 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/pow_ui.c
+
+removed manual change to __gmpfr_emin outside the allowed range
+
+------------------------------------------------------------------------
+r5061 | zimmerma | 2007-11-30 10:02:38 +0000 (Fri, 30 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+added suggestion from Patrick Pelissier
+
+------------------------------------------------------------------------
+r5059 | zimmerma | 2007-11-29 21:34:15 +0000 (Thu, 29 Nov 2007) | 5 lines
+Changed paths:
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow.c
+
+Fixed another bug reported by Kevin Rauch (__gmpfr_emin was set smaller
+than the minimum allowed value, which produced an exponent wrap-around
+and a wrong result in mpfr_mul). Not sure if all problems are solved,
+nevertheless __gmpfr_emin is now in the allowed range.
+
+------------------------------------------------------------------------
+r5058 | vlefevre | 2007-11-29 18:03:50 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Fixed indentation.
+
+------------------------------------------------------------------------
+r5057 | vlefevre | 2007-11-29 17:55:42 +0000 (Thu, 29 Nov 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: in test4rm, initialize rndnext with an invalid value (meaning
+that rndnext will really be initialized later), and added an assert to
+check that this value isn't propagated to rnd.
+
+------------------------------------------------------------------------
+r5056 | vlefevre | 2007-11-29 17:45:03 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: added a comment about rndnext in test4rm.
+
+------------------------------------------------------------------------
+r5055 | vlefevre | 2007-11-29 17:28:34 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: added an assertion.
+
+------------------------------------------------------------------------
+r5054 | zimmerma | 2007-11-29 17:00:34 +0000 (Thu, 29 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+fixed bug reported by Kevin Rauch (wrong sign in case of underflow for
+large negative x and large odd negative y)
+
+------------------------------------------------------------------------
+r5053 | thevenyp | 2007-11-29 14:02:23 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+untabify and remove trailing spaces
+
+------------------------------------------------------------------------
+r5052 | thevenyp | 2007-11-29 12:54:29 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix padding error in sprnt_inf
+
+------------------------------------------------------------------------
+r5051 | thevenyp | 2007-11-29 12:50:50 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+factorization of special numbers output in sprnt_nan and sprnt_inf functions
+
+------------------------------------------------------------------------
+r5050 | thevenyp | 2007-11-29 12:43:47 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix comment about the size of format string buffer
+
+------------------------------------------------------------------------
+r5049 | thevenyp | 2007-11-29 12:32:02 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+replace memory management functions mpfr_default_* by __gmp_*_func
+
+------------------------------------------------------------------------
+r5048 | zimmerma | 2007-11-29 10:16:37 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+updated Core 2 thresholds (obtained with gmp-4.2.2 and Gaudry's patch)
+
+------------------------------------------------------------------------
+r5047 | vlefevre | 2007-11-29 09:21:01 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+Typo in comment.
+
+------------------------------------------------------------------------
+r5046 | thevenyp | 2007-11-29 08:36:49 +0000 (Thu, 29 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+
+fix typo pointed out in revision 5044
+
+------------------------------------------------------------------------
+r5045 | vlefevre | 2007-11-28 14:36:21 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+
+printf.c: more comments about snprintf.
+
+------------------------------------------------------------------------
+r5044 | vlefevre | 2007-11-28 14:00:33 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+
+printf.c: added a comment concerning a warning (a bug, IMHO).
+
+------------------------------------------------------------------------
+r5043 | vlefevre | 2007-11-28 13:35:22 +0000 (Wed, 28 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: added FIXME comment concerning the case nbchar > INT_MAX,
+with a reference to POSIX.
+
+------------------------------------------------------------------------
+r5042 | thevenyp | 2007-11-28 13:32:24 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+add explanations about buffer size
+
+------------------------------------------------------------------------
+r5041 | thevenyp | 2007-11-28 12:53:15 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+change __gmp_const into const
+
+------------------------------------------------------------------------
+r5040 | vlefevre | 2007-11-28 10:29:33 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: added an assert.
+
+------------------------------------------------------------------------
+r5039 | thevenyp | 2007-11-28 10:13:55 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+fix output with space flag
+
+------------------------------------------------------------------------
+r5038 | thevenyp | 2007-11-28 10:09:19 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+add MPFR_ASSERTD to prevent buffer overflow
+
+------------------------------------------------------------------------
+r5037 | thevenyp | 2007-11-28 10:00:42 +0000 (Wed, 28 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+replace use of ptrdiff_t by size_t where possible
+
+------------------------------------------------------------------------
+r5032 | thevenyp | 2007-11-27 15:13:44 +0000 (Tue, 27 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+factorisation of temp string alloc in buffer_pad function
+
+------------------------------------------------------------------------
+r5031 | thevenyp | 2007-11-27 14:47:30 +0000 (Tue, 27 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r5030 | thevenyp | 2007-11-27 14:05:29 +0000 (Tue, 27 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+compatibility of types between nbc fields and mp_exp_t
+fix wrong size of buffer string exp_fmt
+
+------------------------------------------------------------------------
+r5026 | vlefevre | 2007-11-27 12:55:31 +0000 (Tue, 27 Nov 2007) | 3 lines
+Changed paths:
+ A /trunk/mpfrlint
+
+Added initial mpfrlint sh script to check possible problems in
+the MPFR source.
+
+------------------------------------------------------------------------
+r5025 | thevenyp | 2007-11-27 09:53:31 +0000 (Tue, 27 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+change 'g'/'G' to 'e'/'E' or 'f'/'F' according to C99 rules
+
+------------------------------------------------------------------------
+r5024 | thevenyp | 2007-11-26 17:44:10 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+replace mpfr_default_(re)allocate by __gmp_(re)allocate for the returned string (freed by mpfr_free_str)
+
+------------------------------------------------------------------------
+r5023 | thevenyp | 2007-11-26 17:38:17 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tprintf.c: replace __gmp_const by const
+
+------------------------------------------------------------------------
+r5022 | vlefevre | 2007-11-26 15:27:56 +0000 (Mon, 26 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/printf.c
+
+printf.c: added FIXME comment: snprintf is new in C99. It must be
+checked with a configure test.
+
+------------------------------------------------------------------------
+r5021 | vlefevre | 2007-11-26 15:19:46 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+
+------------------------------------------------------------------------
+r5020 | vlefevre | 2007-11-26 15:16:09 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: reformat.
+
+------------------------------------------------------------------------
+r5019 | vlefevre | 2007-11-26 15:14:23 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/out_str.c
+ M /trunk/strtofr.c
+
+MPFR_DECIMAL_POINT now needs to have type char (because of vasprintf.c).
+
+------------------------------------------------------------------------
+r5018 | vlefevre | 2007-11-26 15:11:53 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: changeset 4996 was incorrect. Fixed.
+
+------------------------------------------------------------------------
+r5017 | vlefevre | 2007-11-26 14:42:46 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: Avoid variable names "l", "I" and "O".
+
+------------------------------------------------------------------------
+r5016 | vlefevre | 2007-11-26 14:09:52 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a note about the locales.
+
+------------------------------------------------------------------------
+r5015 | thevenyp | 2007-11-26 13:55:28 +0000 (Mon, 26 Nov 2007) | 6 lines
+Changed paths:
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+printf.c: fix use of pointer of string
+vasprintf.c: add conditional compilation directives for wchar and wint_t
+vasprintf.c: add padding for special values
+vasprintf.c: fix output for value 1.0 and format "%Rf"
+vasprintf.c: replace __gmp_const by const
+
+------------------------------------------------------------------------
+r5014 | vlefevre | 2007-11-26 09:57:47 +0000 (Mon, 26 Nov 2007) | 9 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/vasprintf.c
+
+acinclude.m4: check wchar.h header (see below).
+vasprintf.c:
+ * No longer depend on toupper (which returns locale-dependent results)
+ to generate 'A'..'F' (see C standard).
+ * Removed #include <ctype.h> which was hiding a bug (see below).
+ * Added missing #include <wchar.h> if HAVE_WCHAR_H is defined. But
+ the compilation fails if <wchar.h> doesn't exist due to the use of
+ wchar_t and wint_t.
+
+------------------------------------------------------------------------
+r5013 | vlefevre | 2007-11-26 09:44:24 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: updated comments.
+
+------------------------------------------------------------------------
+r5012 | vlefevre | 2007-11-26 09:37:47 +0000 (Mon, 26 Nov 2007) | 5 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c:
+ * Removed #include <stdlib.h> now useless.
+ * Added FIXME comment.
+ * Replaced _MP_EXP_FORMAT_SPEC (reserved) by MPFR_EXP_FORMAT_SPEC.
+
+------------------------------------------------------------------------
+r5011 | vlefevre | 2007-11-26 09:32:20 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: added FIXME comments.
+
+------------------------------------------------------------------------
+r5010 | vlefevre | 2007-11-26 09:18:06 +0000 (Mon, 26 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: fixed a typo in a comment and improved another comment.
+
+------------------------------------------------------------------------
+r5009 | vlefevre | 2007-11-24 01:46:30 +0000 (Sat, 24 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: moved function declarations out of "#ifdef _MPFR_H_HAVE_VA_LIST"
+and/or "#ifdef _MPFR_H_HAVE_FILE" when this makes sense.
+
+------------------------------------------------------------------------
+r5008 | vlefevre | 2007-11-24 01:41:33 +0000 (Sat, 24 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: added missing "void" in function declarations.
+
+------------------------------------------------------------------------
+r5007 | vlefevre | 2007-11-24 01:36:47 +0000 (Sat, 24 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tprintf.c
+ M /trunk/tests/tset_f.c
+ M /trunk/vasprintf.c
+
+Untabified and removed trailing spaces.
+
+------------------------------------------------------------------------
+r5006 | vlefevre | 2007-11-24 01:33:00 +0000 (Sat, 24 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/mpfr.texi
+
+mpfr.texi: corrections (English usage and texinfo). Added corresponding
+notes at the end of the README.dev file.
+
+------------------------------------------------------------------------
+r5005 | vlefevre | 2007-11-24 01:24:05 +0000 (Sat, 24 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: s/rounding to the nearest mode/rounding to nearest mode/
+
+------------------------------------------------------------------------
+r5004 | vlefevre | 2007-11-24 01:22:31 +0000 (Sat, 24 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi consistency changes: "towards" -> "toward" (because this
+is what the IEEE-754 standard uses, and we have mpfr_nexttoward).
+
+------------------------------------------------------------------------
+r5003 | vlefevre | 2007-11-24 01:17:08 +0000 (Sat, 24 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: English typography corrections (no space before ":").
+
+------------------------------------------------------------------------
+r5002 | vlefevre | 2007-11-24 01:15:22 +0000 (Sat, 24 Nov 2007) | 4 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: the use of the abs function was incorrect as its argument
+has type int, which may be smaller than an mp_exp_t. Fixed that and
+replaced uceil_log10 by uceil_log10_exp_p2.
+
+------------------------------------------------------------------------
+r5001 | vlefevre | 2007-11-24 00:55:50 +0000 (Sat, 24 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+vasprintf.c: fixed uceil_log10 for x close to ULONG_MAX.
+
+------------------------------------------------------------------------
+r5000 | zimmerma | 2007-11-23 20:22:10 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/vasprintf.c
+
+got rid of math.h
+
+------------------------------------------------------------------------
+r4999 | vlefevre | 2007-11-23 19:20:38 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: include <stdarg.h>.
+
+------------------------------------------------------------------------
+r4998 | vlefevre | 2007-11-23 19:19:04 +0000 (Fri, 23 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/printf.c
+ M /trunk/vasprintf.c
+
+stdarg-related corrections, as HAVE_STDARG is not standard thus must not
+be tested in mpfr.h!
+
+------------------------------------------------------------------------
+r4997 | vlefevre | 2007-11-23 19:07:54 +0000 (Fri, 23 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c: enable the tests only if HAVE_STDARG is defined,
+i.e. if the printf-like functions are defined.
+
+------------------------------------------------------------------------
+r4996 | vlefevre | 2007-11-23 19:02:46 +0000 (Fri, 23 Nov 2007) | 7 lines
+Changed paths:
+ M /trunk/tests/tprintf.c
+
+tests/tprintf.c:
+ * Non-standard headers should be included after the standard headers
+ (when possible).
+ * The setlocale function is used only if <locale.h> has been included.
+ * Use tests_start_mpfr / tests_end_mpfr; this shows a bug:
+ tests_free(): attempt to free bad pointer 0x1801200
+
+------------------------------------------------------------------------
+r4995 | vlefevre | 2007-11-23 18:54:37 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: setlocale is used only if <locale.h> has been included.
+
+------------------------------------------------------------------------
+r4994 | vlefevre | 2007-11-23 18:48:52 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+out_str.c: remove other occurrence of <locale.h>.
+
+------------------------------------------------------------------------
+r4993 | thevenyp | 2007-11-23 17:35:46 +0000 (Fri, 23 Nov 2007) | 12 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/printf.c
+ M /trunk/strtofr.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tests.c
+ A /trunk/tests/tprintf.c
+ A /trunk/vasprintf.c
+
+Makefile.am: add mpfr_printf-like functions
+mpfr.h: add mpfr_printf-like functions
+printf.c: printf, sprintf, snprintf, asprintf and 'v' variants
+vasprintf.c: vasprintf functions used by its likes
+mpfr.texi: add description for printf family functions
+tests/Makefile.am: add test for printf
+tests/tprintf.c: tests for printf-like functions
+acinclude.m4: define HAVE_LOCALE_H
+mpfr-impl.h: define MPFR_DECIMAL_POINT even if no locale.h
+strtofr.c: remove locale.h inclusion (done by mpfr-impl.h )
+tests/tests.c: use HAVE_LOCALE_H
+
+------------------------------------------------------------------------
+r4991 | vlefevre | 2007-11-23 16:55:03 +0000 (Fri, 23 Nov 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tisqrt.c
+
+tests/tisqrt.c: test the 32-bit __gmpfr_cuberoot bound cases (9 per
+value) exhaustively (running tisqrt is still immediate on a recent
+machine).
+
+------------------------------------------------------------------------
+r4990 | vlefevre | 2007-11-23 16:49:45 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tisqrt.c
+
+tests/tisqrt.c: test the 32-bit __gmpfr_isqrt bound cases exhaustively.
+
+------------------------------------------------------------------------
+r4989 | vlefevre | 2007-11-23 15:10:56 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: test the availability of <string.h>.
+
+------------------------------------------------------------------------
+r4988 | vlefevre | 2007-11-23 14:30:36 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: test the availability of <locale.h>.
+
+------------------------------------------------------------------------
+r4987 | vlefevre | 2007-11-23 14:26:39 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: updated comment concerning the checked functions.
+
+------------------------------------------------------------------------
+r4986 | vlefevre | 2007-11-23 14:24:50 +0000 (Fri, 23 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: added memmove to the checked functions (though this test
+is currently useless, except for the corresponding information).
+
+------------------------------------------------------------------------
+r4985 | vlefevre | 2007-11-23 14:19:40 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+acinclude.m4: updated a comment concerning the function checking.
+
+------------------------------------------------------------------------
+r4984 | vlefevre | 2007-11-23 13:46:04 +0000 (Fri, 23 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/gmp_op.c
+
+gmp_op.c: removed old "#include <stddef.h>" line (seems to be useless
+now, and note that <stdio.h> is included by default in mpfr-impl.h).
+
+------------------------------------------------------------------------
+r4982 | vlefevre | 2007-11-23 13:09:39 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tj0.c
+
+tests/tj0.c: fixed test.
+
+------------------------------------------------------------------------
+r4980 | vlefevre | 2007-11-23 12:58:53 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+
+jn.c: added integer overflow checking.
+
+------------------------------------------------------------------------
+r4978 | vlefevre | 2007-11-23 10:06:07 +0000 (Fri, 23 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/memory.c
+
+tests/memory.c: fixed copyright notice.
+
+------------------------------------------------------------------------
+r4969 | vlefevre | 2007-11-21 14:50:18 +0000 (Wed, 21 Nov 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+tests/tzeta.c: completed test of mpfr_zeta bug fixed in r4920 (the value
+of zeta(large negative) was also wrong in GMP_RNDU: -Inf instead of the
+largest negative MPFR number).
+
+------------------------------------------------------------------------
+r4957 | zimmerma | 2007-11-20 14:43:14 +0000 (Tue, 20 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tinp_str.c
+
+reverted back to rev. 4951 (otherwise we would have to free memory for all
+exit calls)
+
+------------------------------------------------------------------------
+r4956 | thevenyp | 2007-11-20 11:21:10 +0000 (Tue, 20 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_f.c
+
+use of RANDS instead of __gmp_rands
+tset_f.c add checking with random values
+
+------------------------------------------------------------------------
+r4955 | thevenyp | 2007-11-19 11:07:49 +0000 (Mon, 19 Nov 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tests.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_f.c
+
+tli2.c: fix wrong assertion in copyright motice
+test.c: fixed seed for reproducable errors
+trandom.c tpow_z.c tset_f.c: integration with GMP_CHECK_RANDOMIZE process
+
+------------------------------------------------------------------------
+r4954 | zimmerma | 2007-11-17 12:15:53 +0000 (Sat, 17 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tasin.c
+
+added missing call to tests_end_mpfr
+
+------------------------------------------------------------------------
+r4953 | zimmerma | 2007-11-17 09:59:19 +0000 (Sat, 17 Nov 2007) | 5 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tli2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/tsub_ui.c
+
+got rid of mpfr_init_gmp_rand/MPFR_TEST_USE_RANDS and not-reentrant gmp
+random functions (mpn_random*, mpz_random*, mpf_random*). Now all tests use
+either RANDS (which is cleared by tests_rand_end called by tests_end_mpfr),
+or the gmp_randstate_t mechanism.
+
+------------------------------------------------------------------------
+r4952 | zimmerma | 2007-11-16 17:09:12 +0000 (Fri, 16 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tinp_str.c
+
+added missing mpfr_clear and tests_end_mpfr (thanks Michael Abshoff)
+
+------------------------------------------------------------------------
+r4951 | zimmerma | 2007-11-16 14:28:29 +0000 (Fri, 16 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+fixed problem reported by valgrind (thanks to Michael Abshoff)
+
+------------------------------------------------------------------------
+r4950 | zimmerma | 2007-11-06 22:07:31 +0000 (Tue, 06 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+ M /trunk/tests/tdiv_ui.c
+
+fixed bug in div_ui for x=0 and u<>0 (sign of result was not set)
+
+------------------------------------------------------------------------
+r4949 | thevenyp | 2007-11-06 10:53:43 +0000 (Tue, 06 Nov 2007) | 4 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+algorithms.tex: fix bibtex references for dilogarithm function
+algorithms.bib: add references for dilogarithm function
+
+
+------------------------------------------------------------------------
+r4948 | vlefevre | 2007-11-05 11:18:46 +0000 (Mon, 05 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: removed trailing spaces.
+
+------------------------------------------------------------------------
+r4947 | zimmerma | 2007-11-05 10:53:21 +0000 (Mon, 05 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/pow.c
+
+added new macro MPFR_ALIAS
+
+------------------------------------------------------------------------
+r4946 | zimmerma | 2007-11-04 11:10:23 +0000 (Sun, 04 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+
+removed unused label
+
+------------------------------------------------------------------------
+r4945 | vlefevre | 2007-11-04 00:46:45 +0000 (Sun, 04 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/pow_z.c
+
+pow_z.c: fixed bug that occurs when x is a power of 2 and the result
+overflows (wrong sign); this bug has always been present (from r3215).
+
+------------------------------------------------------------------------
+r4944 | vlefevre | 2007-11-04 00:44:04 +0000 (Sun, 04 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow_z.c
+
+tpow.c, tpow_z.c: removed a printf that was left by mistake.
+
+------------------------------------------------------------------------
+r4943 | vlefevre | 2007-11-04 00:36:23 +0000 (Sun, 04 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+tpow_z.c: added testcase for the latest mpfr_pow bug (rev 4942),
+which is in fact a bug in mpfr_pow_z.
+
+------------------------------------------------------------------------
+r4942 | vlefevre | 2007-11-04 00:28:20 +0000 (Sun, 04 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added testcase for new bug found by Kevin P. Rauch; removed a
+mpfr_dump that was left by mistake.
+
+------------------------------------------------------------------------
+r4941 | vlefevre | 2007-11-03 09:28:23 +0000 (Sat, 03 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: removed FIXME comment.
+
+------------------------------------------------------------------------
+r4940 | zimmerma | 2007-11-03 08:45:17 +0000 (Sat, 03 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+fixed case x < 0, y large integer
+
+------------------------------------------------------------------------
+r4939 | vlefevre | 2007-11-03 02:05:04 +0000 (Sat, 03 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: added FIXME comment.
+
+------------------------------------------------------------------------
+r4938 | vlefevre | 2007-11-03 01:59:23 +0000 (Sat, 03 Nov 2007) | 5 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added testcase for new bug found by Kevin P. Rauch. The problem
+occurs on x^y with x negative and y an integer whose exponent is > 256
+(so that mpfr_pow_z isn't used, and the generic code is used instead and
+fails because x is negative).
+
+------------------------------------------------------------------------
+r4937 | vlefevre | 2007-11-02 15:02:50 +0000 (Fri, 02 Nov 2007) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+Fixed several bugs in mpfr_pow (from rev 3592 and 4932); added testcase.
+
+------------------------------------------------------------------------
+r4936 | vlefevre | 2007-11-02 14:29:21 +0000 (Fri, 02 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added an overflow test in reduced exponent range
+(-> assertion failure in the current pow.c code).
+
+------------------------------------------------------------------------
+r4935 | vlefevre | 2007-11-02 13:02:45 +0000 (Fri, 02 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: added a comment concerning __gmpfr_one, __gmpfr_two and
+__gmpfr_four.
+
+------------------------------------------------------------------------
+r4934 | vlefevre | 2007-11-02 12:54:14 +0000 (Fri, 02 Nov 2007) | 3 lines
+Changed paths:
+ M /trunk/cmp_abs.c
+
+Bug fix: in cmp_abs.c, changed MPFR_GET_EXP into MPFR_EXP to allow
+exponents outside the current exponent range (needed for mpfr_pow).
+
+------------------------------------------------------------------------
+r4933 | vlefevre | 2007-10-31 15:46:57 +0000 (Wed, 31 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/erfc.c
+ M /trunk/li2.c
+ M /trunk/lngamma.c
+ M /trunk/mpfr.texi
+ M /trunk/pow.c
+ M /trunk/rem1.c
+ M /trunk/tests/tfmod.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tzeta.c
+
+Untabified and removed trailing spaces.
+
+------------------------------------------------------------------------
+r4932 | zimmerma | 2007-10-30 16:29:46 +0000 (Tue, 30 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+pow.c, tpow.c: fixed bugs reported by Kevin Rauch
+mpfr-impl.h: fixed typo
+
+------------------------------------------------------------------------
+r4931 | zimmerma | 2007-10-30 14:35:24 +0000 (Tue, 30 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r4930 | zimmerma | 2007-10-30 14:00:30 +0000 (Tue, 30 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added missing \Li2
+
+------------------------------------------------------------------------
+r4929 | zimmerma | 2007-10-28 15:18:03 +0000 (Sun, 28 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/li2.c
+ M /trunk/tests/data/li2
+ M /trunk/tests/tli2.c
+
+added more test cases for mpfr_li2
+improved MPFR_FAST_COMPUTE_IF_SMALL_INPUT case for x > 0
+
+------------------------------------------------------------------------
+r4928 | zimmerma | 2007-10-28 13:16:02 +0000 (Sun, 28 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlgamma.c
+
+fixed bug mentioned by Kevin Rauch: mpfr_lgamma was hanging for tiny input
+(had to implement a complete loop in that case)
+
+------------------------------------------------------------------------
+r4927 | zimmerma | 2007-10-28 12:29:01 +0000 (Sun, 28 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+ M /trunk/jyn_asympt.c
+ M /trunk/tests/tj0.c
+
+fixed bug reported by Kevin Rauch: wrong sign for jn(n even, large negative x)
+
+------------------------------------------------------------------------
+r4926 | zimmerma | 2007-10-28 12:18:04 +0000 (Sun, 28 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/TODO
+
+removed item on mpfr_sinh_cosh (done)
+added more info on item on efficiency of mpfr_sin
+
+------------------------------------------------------------------------
+r4925 | zimmerma | 2007-10-28 11:53:51 +0000 (Sun, 28 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added comment about function/macro in custom interface
+
+------------------------------------------------------------------------
+r4924 | zimmerma | 2007-10-28 11:11:13 +0000 (Sun, 28 Oct 2007) | 4 lines
+Changed paths:
+ M /trunk/jn.c
+ M /trunk/tests/tjn.c
+
+jn.c: improved choice of initial precision in Taylor series (takes into
+ account cancellation)
+tests/tjn.c: now "tjn p n z" evaluates j(n,z) to precision p
+
+------------------------------------------------------------------------
+r4923 | vlefevre | 2007-10-27 12:59:35 +0000 (Sat, 27 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+
+factorial.c: added FIXME comment.
+
+------------------------------------------------------------------------
+r4922 | vlefevre | 2007-10-27 12:23:43 +0000 (Sat, 27 Oct 2007) | 4 lines
+Changed paths:
+ M /trunk/gamma.c
+
+gamma.c: attempt to fix wrong fix in 4918 (the maximum exponent can
+be > 2^30 on 64-bit machines). There may still be problems in huge
+precisions.
+
+------------------------------------------------------------------------
+r4921 | zimmerma | 2007-10-27 11:17:24 +0000 (Sat, 27 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added note about efficiency of special functions
+corrected typo
+
+------------------------------------------------------------------------
+r4920 | zimmerma | 2007-10-27 11:07:33 +0000 (Sat, 27 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+fixed bug in zeta(large negative) reported by Kevin Rauch [wrong inexact flag]
+
+------------------------------------------------------------------------
+r4919 | zimmerma | 2007-10-27 08:15:57 +0000 (Sat, 27 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/erfc.c
+ M /trunk/tests/terf.c
+
+fixed inefficiency reported by Kevin Rauch when x large negative (erfc -> 2)
+
+------------------------------------------------------------------------
+r4918 | zimmerma | 2007-10-26 19:12:24 +0000 (Fri, 26 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed another bug found by Kevin Rauch: gamma(huge integer) failed on 64-bit
+
+------------------------------------------------------------------------
+r4917 | zimmerma | 2007-10-26 18:34:54 +0000 (Fri, 26 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlgamma.c
+
+fixed bug found by Kevin Rauch (emin/emax not restored for x=1,2)
+
+------------------------------------------------------------------------
+r4916 | zimmerma | 2007-10-26 18:05:43 +0000 (Fri, 26 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tli2.c
+
+added test for reference values
+
+------------------------------------------------------------------------
+r4915 | zimmerma | 2007-10-26 18:05:12 +0000 (Fri, 26 Oct 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/li2
+
+reference values for li2
+
+------------------------------------------------------------------------
+r4914 | thevenyp | 2007-10-26 17:32:19 +0000 (Fri, 26 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/li2.c
+
+algorithms.tex: description of dilogarithm algorithm
+li2.c: conformity with description in algorithm.tex
+
+------------------------------------------------------------------------
+r4913 | vlefevre | 2007-10-23 10:16:22 +0000 (Tue, 23 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: small change in the description of mpfr_subnormalize.
+
+------------------------------------------------------------------------
+r4912 | zimmerma | 2007-10-23 09:02:35 +0000 (Tue, 23 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added more details in the description of subnormalize
+
+------------------------------------------------------------------------
+r4908 | vlefevre | 2007-10-23 02:43:39 +0000 (Tue, 23 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+
+subnormal.c: fixed the bugs when old_inex is INT_MIN or INT_MAX.
+
+------------------------------------------------------------------------
+r4907 | vlefevre | 2007-10-23 02:35:00 +0000 (Tue, 23 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tsubnormal.c
+
+tsubnormal.c: added some tests showing bugs when old_inex is INT_MIN
+or INT_MAX.
+
+------------------------------------------------------------------------
+r4906 | vlefevre | 2007-10-23 02:31:48 +0000 (Tue, 23 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+
+subnormal.c: corrected comment.
+
+------------------------------------------------------------------------
+r4905 | vlefevre | 2007-10-23 01:52:28 +0000 (Tue, 23 Oct 2007) | 8 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/subnormal.c
+
+Changeset r4904 introduced an assertion failure, but the assertion
+emax - emin >= PREC(x) wasn't necessary: the value of emax doesn't
+matter, except when the exponent is increased due to the rounding.
+So, we just document that if the result cannot be represented in the
+current exponent range, the behavior is undefined (updated mpfr.texi
+accordingly). Removed the assertion from subnormal.c and added a new
+one to have an abort if such an undefined behavior occurs.
+
+------------------------------------------------------------------------
+r4904 | zimmerma | 2007-10-22 18:38:49 +0000 (Mon, 22 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+ M /trunk/tests/tsubnormal.c
+
+fixed 2 bugs reported by Kevin Rauch
+
+------------------------------------------------------------------------
+r4903 | vlefevre | 2007-10-22 16:41:45 +0000 (Mon, 22 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+
+subnormal.c: replaced incorrect comment.
+
+------------------------------------------------------------------------
+r4902 | vlefevre | 2007-10-22 15:22:24 +0000 (Mon, 22 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4901 | zimmerma | 2007-10-22 08:55:51 +0000 (Mon, 22 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+
+added new references
+
+------------------------------------------------------------------------
+r4899 | zimmerma | 2007-10-20 09:18:37 +0000 (Sat, 20 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/li2.c
+
+added asymptotic expansions
+
+------------------------------------------------------------------------
+r4898 | thevenyp | 2007-10-19 16:08:27 +0000 (Fri, 19 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/li2.c
+ M /trunk/tests/tli2.c
+
+li2.c: add Ziv's loop in li2_series
+tli2.c: add a function for fixed value checking
+
+------------------------------------------------------------------------
+r4897 | thevenyp | 2007-10-17 16:10:03 +0000 (Wed, 17 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/li2.c
+ M /trunk/tests/tli2.c
+
+li2.c: fix a typo and fix use of taylor series
+tests/tli2.c: use default random function
+
+------------------------------------------------------------------------
+r4896 | thevenyp | 2007-10-16 17:02:02 +0000 (Tue, 16 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/li2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ A /trunk/tests/tli2.c
+
+add dilogarithm function
+
+------------------------------------------------------------------------
+r4895 | zimmerma | 2007-10-15 14:11:22 +0000 (Mon, 15 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item in Efficiency section
+
+------------------------------------------------------------------------
+r4894 | zimmerma | 2007-10-15 13:14:30 +0000 (Mon, 15 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/TODO
+
+added table of contents
+removed last section (mpf/mpfr integration)
+
+------------------------------------------------------------------------
+r4893 | vlefevre | 2007-10-15 01:58:45 +0000 (Mon, 15 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/algorithms.tex
+
+Fixed acosh(x) with x slightly larger than 1, using sqrt(2(x-1)) and
+a complete error analysis.
+
+------------------------------------------------------------------------
+r4892 | vlefevre | 2007-10-15 00:46:10 +0000 (Mon, 15 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+
+tests/tacosh.c: added another test with x a bit larger than 1 and
+prec(y) << prec(x).
+
+------------------------------------------------------------------------
+r4891 | vlefevre | 2007-10-12 16:07:23 +0000 (Fri, 12 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+acosh.c: added a comment about the fix I did in r4814.
+
+------------------------------------------------------------------------
+r4890 | zimmerma | 2007-10-09 20:22:47 +0000 (Tue, 09 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added extra reference for slowness of mpfr_root
+
+------------------------------------------------------------------------
+r4888 | vlefevre | 2007-10-09 11:48:52 +0000 (Tue, 09 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update (added Question 8).
+
+------------------------------------------------------------------------
+r4887 | vlefevre | 2007-10-09 11:03:16 +0000 (Tue, 09 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: another small change in Contributors section.
+
+------------------------------------------------------------------------
+r4886 | vlefevre | 2007-10-09 10:35:28 +0000 (Tue, 09 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: small change in Contributors section.
+
+------------------------------------------------------------------------
+r4885 | vlefevre | 2007-10-09 09:59:18 +0000 (Tue, 09 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: mention Fiable and AOC actions in the Contributors section.
+
+------------------------------------------------------------------------
+r4884 | zimmerma | 2007-10-09 07:50:42 +0000 (Tue, 09 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added reference to ACM TOMS paper
+updated other references, and Contributors section
+
+------------------------------------------------------------------------
+r4883 | zimmerma | 2007-10-09 06:11:31 +0000 (Tue, 09 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed typo in sectioning
+
+------------------------------------------------------------------------
+r4882 | zimmerma | 2007-10-08 17:16:51 +0000 (Mon, 08 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+removed mpfr_get_d1 from documented functions
+removed old commented functions
+
+------------------------------------------------------------------------
+r4881 | zimmerma | 2007-10-08 14:48:38 +0000 (Mon, 08 Oct 2007) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+renamed "Rounding Mode Related Functions" to "Rounding Related Functions"
+put mpfr_can_round in "Rounding Related Functions" (now exported)
+exchanged order of sections "Miscellaneous Functions" and "Rounding Related Functions"
+
+------------------------------------------------------------------------
+r4880 | zimmerma | 2007-10-08 11:04:34 +0000 (Mon, 08 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added hint for mpfr_can_round to get ternary value
+
+------------------------------------------------------------------------
+r4879 | zimmerma | 2007-10-08 10:09:56 +0000 (Mon, 08 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+changed mpfr_can_round() call into MPFR_CAN_ROUND() call
+
+------------------------------------------------------------------------
+r4878 | vlefevre | 2007-10-05 12:18:17 +0000 (Fri, 05 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/update-version
+
+Updated update-version to make patches easier to produce.
+
+------------------------------------------------------------------------
+r4876 | vlefevre | 2007-10-04 01:57:35 +0000 (Thu, 04 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/tests/tatan.c
+
+Fixed a bug (found by Robert Bajema) in mpfr_atan2, which can occur if
+the underflow flag is set before the call and x > 0; added testcase.
+
+------------------------------------------------------------------------
+r4875 | vlefevre | 2007-10-03 15:13:06 +0000 (Wed, 03 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: improved mpfr_set_exp description too.
+
+------------------------------------------------------------------------
+r4874 | vlefevre | 2007-10-03 15:09:49 +0000 (Wed, 03 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: improved mpfr_get_exp documentation.
+
+------------------------------------------------------------------------
+r4873 | vlefevre | 2007-10-03 15:05:31 +0000 (Wed, 03 Oct 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: mantissa -> significand (to use the terminology from IEEE 754
+and ISO C99).
+
+------------------------------------------------------------------------
+r4872 | vlefevre | 2007-10-03 14:36:38 +0000 (Wed, 03 Oct 2007) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: better error message if libgmp is not found.
+
+------------------------------------------------------------------------
+r4871 | thevenyp | 2007-10-02 16:08:02 +0000 (Tue, 02 Oct 2007) | 1 line
+Changed paths:
+ M /trunk/algorithms.tex
+
+fix some typos
+------------------------------------------------------------------------
+r4870 | zimmerma | 2007-09-28 16:14:03 +0000 (Fri, 28 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added references
+
+------------------------------------------------------------------------
+r4869 | thevenyp | 2007-09-28 12:08:56 +0000 (Fri, 28 Sep 2007) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ D /trunk/fmod.c
+ M /trunk/mpfr.texi
+ A /trunk/rem1.c
+ D /trunk/remquo.c
+ M /trunk/tests/tfmod.c
+
+merge fmod, remaider and remquo into a single file rem1.c.
+merge code into a single internal function mpfr_rem1.
+fix false statement in mpfr.texi: rop and op1 have the same sign for mpfr_fmod
+but not for mpfr_remainder and mpfr_remquo.
+
+------------------------------------------------------------------------
+r4868 | vlefevre | 2007-09-26 16:20:35 +0000 (Wed, 26 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfmod.c
+
+tests/tfmod.c: added static.
+
+------------------------------------------------------------------------
+r4867 | thevenyp | 2007-09-26 11:30:29 +0000 (Wed, 26 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/fmod.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ A /trunk/tests/tfmod.c
+
+new fmod function
+
+------------------------------------------------------------------------
+r4866 | vlefevre | 2007-09-22 00:17:11 +0000 (Sat, 22 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4865 | vlefevre | 2007-09-22 00:15:49 +0000 (Sat, 22 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/add_d.c
+ M /trunk/modf.c
+ M /trunk/mpfr.texi
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sinh_cosh.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tmodf.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tsinh_cosh.c
+ M /trunk/tests/tsub_d.c
+ M /trunk/tests/ttrunc.c
+
+GNU coding style, reformatting, exit (-1) -> exit (1).
+
+------------------------------------------------------------------------
+r4864 | thevenyp | 2007-09-21 08:29:01 +0000 (Fri, 21 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/sinh_cosh.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ A /trunk/tests/tsinh_cosh.c
+
+new mpfr_sinh_cosh function
+
+------------------------------------------------------------------------
+r4863 | vlefevre | 2007-09-19 02:24:31 +0000 (Wed, 19 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: removed __gmpfr_isqrt bug.
+
+------------------------------------------------------------------------
+r4862 | vlefevre | 2007-09-19 02:12:09 +0000 (Wed, 19 Sep 2007) | 3 lines
+Changed paths:
+ M /trunk/isqrt.c
+ M /trunk/tests/tisqrt.c
+
+isqrt.c: quick fix of __gmpfr_cuberoot (a full proof is needed).
+tests/tisqrt.c: added much more tests for __gmpfr_cuberoot.
+
+------------------------------------------------------------------------
+r4861 | vlefevre | 2007-09-19 01:46:58 +0000 (Wed, 19 Sep 2007) | 7 lines
+Changed paths:
+ M /trunk/tests/tisqrt.c
+
+tisqrt.c: improved tests. When doing
+ touch tests.c tisqrt.c
+ make tisqrt CFLAGS="-g -O2 -ffloat-store -DMPFR_FPU_PREC=_FPU_SINGLE"
+ ./tisqrt
+with gcc 4.2.1 on a Linux/x86 machine, on gets:
+ Error in __gmpfr_cuberoot (4251527999): got 1620 instead of 1619
+
+------------------------------------------------------------------------
+r4860 | vlefevre | 2007-09-19 01:12:33 +0000 (Wed, 19 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tisqrt.c
+
+tisqrt.c: added __gmpfr_cuberoot() tests.
+
+------------------------------------------------------------------------
+r4859 | vlefevre | 2007-09-19 01:03:11 +0000 (Wed, 19 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/isqrt.c
+
+isqrt.c: corrected the explanation.
+
+------------------------------------------------------------------------
+r4858 | vlefevre | 2007-09-19 00:57:46 +0000 (Wed, 19 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/isqrt.c
+
+isqrt.c: fixed __gmpfr_isqrt.
+
+------------------------------------------------------------------------
+r4857 | vlefevre | 2007-09-18 14:54:59 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+tests: updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4856 | vlefevre | 2007-09-18 14:52:23 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tisqrt.c
+
+tests: added tisqrt.c (test file for __gmpfr_isqrt internal function).
+
+------------------------------------------------------------------------
+r4855 | vlefevre | 2007-09-18 14:37:59 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: added __gmpfr_isqrt bug.
+
+------------------------------------------------------------------------
+r4854 | vlefevre | 2007-09-18 14:26:48 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/isqrt.c
+
+isqrt.c: fixed a cast and added a FIXME comment.
+
+------------------------------------------------------------------------
+r4853 | vlefevre | 2007-09-18 14:16:46 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/isqrt.c
+
+isqrt.c: GNU coding style.
+
+------------------------------------------------------------------------
+r4852 | vlefevre | 2007-09-18 12:21:14 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+sin.c: extend the exponent range.
+
+------------------------------------------------------------------------
+r4851 | vlefevre | 2007-09-18 12:14:15 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/sqr.c
+
+sqr.c: set the global inexact flag.
+
+------------------------------------------------------------------------
+r4850 | vlefevre | 2007-09-18 12:09:13 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+sqrt.c: avoid the exponent range extension.
+
+------------------------------------------------------------------------
+r4849 | vlefevre | 2007-09-18 12:02:07 +0000 (Tue, 18 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqr.c
+
+tsqr.c: added generic tests (shows that the inexact flag isn't set).
+
+------------------------------------------------------------------------
+r4848 | vlefevre | 2007-09-18 11:55:32 +0000 (Tue, 18 Sep 2007) | 3 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+sqrt.c: extend exponent range (this also fixes the fact that the global
+inexact flag wasn't set).
+
+------------------------------------------------------------------------
+r4847 | vlefevre | 2007-09-18 11:51:23 +0000 (Tue, 18 Sep 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+tsqrt.c: added generic tests (shows that the inexact flag isn't set,
+which is a bug reported by Guillaume Revy).
+
+------------------------------------------------------------------------
+r4846 | thevenyp | 2007-09-17 11:05:18 +0000 (Mon, 17 Sep 2007) | 1 line
+Changed paths:
+ M /trunk/modf.c
+ M /trunk/tests/tmodf.c
+
+modf.c: take care of user exponent range (possible underflow/overflow)
+------------------------------------------------------------------------
+r4845 | vlefevre | 2007-09-16 09:44:33 +0000 (Sun, 16 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tsin_cos.c: fixed the tiny() test.
+
+------------------------------------------------------------------------
+r4844 | vlefevre | 2007-09-16 09:43:04 +0000 (Sun, 16 Sep 2007) | 4 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+sin_cos.c: fixed the overflow and cancellation problems by using
+MPFR_FAST_COMPUTE_IF_SMALL_INPUT from the mpfr_sin and mpfr_cos
+functions (I'll fix the test later).
+
+------------------------------------------------------------------------
+r4843 | vlefevre | 2007-09-16 09:09:39 +0000 (Sun, 16 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+tsin_cos.c: added test on tiny values.
+
+------------------------------------------------------------------------
+r4842 | zimmerma | 2007-09-16 08:28:27 +0000 (Sun, 16 Sep 2007) | 4 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+Put back previous patch, now avoids overflow, and added more explanations.
+This is still not a definitive solution, but more efficient than 2.3.0
+in the case x is small.
+
+------------------------------------------------------------------------
+r4841 | vlefevre | 2007-09-15 08:30:36 +0000 (Sat, 15 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+Efficiency regression wasn't fixed correctly -> commented out the code.
+
+------------------------------------------------------------------------
+r4840 | zimmerma | 2007-09-15 08:15:15 +0000 (Sat, 15 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+fixed efficiency regression pointed out by Andreas Enge
+
+------------------------------------------------------------------------
+r4839 | zimmerma | 2007-09-13 19:08:25 +0000 (Thu, 13 Sep 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/sin_cos.c
+ M /trunk/tests/reuse.c
+
+fixed bug in mpfr_sin_cos found by Philippe: z (to save the cosine) was not
+allowed to be identical to the input x
+
+------------------------------------------------------------------------
+r4838 | thevenyp | 2007-09-13 16:48:49 +0000 (Thu, 13 Sep 2007) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ A /trunk/modf.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/sin_cos.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ A /trunk/tests/tmodf.c
+
+new function mpfr_modf and add restrictions on mpfr_sin_cos' variables
+------------------------------------------------------------------------
+r4837 | thevenyp | 2007-09-11 13:01:54 +0000 (Tue, 11 Sep 2007) | 1 line
+Changed paths:
+ M /trunk/tests/tadd_d.c
+ M /trunk/tests/td_div.c
+ M /trunk/tests/td_sub.c
+ M /trunk/tests/tdiv_d.c
+ M /trunk/tests/tmul_d.c
+ M /trunk/tests/tsub_d.c
+
+add some simple test cases in tadd_d.c and friends
+------------------------------------------------------------------------
+r4836 | vlefevre | 2007-09-10 07:55:58 +0000 (Mon, 10 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/prepare
+
+prepare: output a message saying that this script is obsolete.
+
+------------------------------------------------------------------------
+r4835 | zimmerma | 2007-09-09 19:08:17 +0000 (Sun, 09 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added restrictions to mpfr_add_d and friends
+
+------------------------------------------------------------------------
+r4834 | zimmerma | 2007-09-08 06:41:22 +0000 (Sat, 08 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed functions mpfr_add_d ... which are done
+
+------------------------------------------------------------------------
+r4833 | zimmerma | 2007-09-07 15:35:49 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+added Philippe Theveny
+
+------------------------------------------------------------------------
+r4832 | thevenyp | 2007-09-07 14:47:34 +0000 (Fri, 07 Sep 2007) | 1 line
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/add_d.c
+ A /trunk/d_div.c
+ A /trunk/d_sub.c
+ A /trunk/div_d.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/mul_d.c
+ A /trunk/sub_d.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tadd_d.c
+ A /trunk/tests/td_div.c
+ A /trunk/tests/td_sub.c
+ A /trunk/tests/tdiv_d.c
+ M /trunk/tests/tgeneric.c
+ A /trunk/tests/tmul_d.c
+ A /trunk/tests/tsub_d.c
+
+new arithmetic functions with a double argument
+------------------------------------------------------------------------
+r4831 | vlefevre | 2007-09-07 13:04:09 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+
+tacosh.c: added generic tests for the overflow case.
+
+------------------------------------------------------------------------
+r4830 | vlefevre | 2007-09-07 13:03:32 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+acosh.c: reduce the precision for ln(2); smaller error bound.
+
+------------------------------------------------------------------------
+r4829 | vlefevre | 2007-09-07 13:02:13 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: undefine some macros at the end.
+
+------------------------------------------------------------------------
+r4828 | vlefevre | 2007-09-07 12:30:36 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+acosh.c: fixed overflow bug.
+
+------------------------------------------------------------------------
+r4827 | vlefevre | 2007-09-07 11:54:53 +0000 (Fri, 07 Sep 2007) | 3 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/tests/tacosh.c
+
+acosh.c: mentioned bug due to overflow in mpfr_mul.
+tests/tacosh.c: added corresponding testcase (for 32-bit machines).
+
+------------------------------------------------------------------------
+r4826 | vlefevre | 2007-09-07 11:26:30 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+
+tacosh.c: use tests_default_random().
+
+------------------------------------------------------------------------
+r4825 | vlefevre | 2007-09-07 11:25:42 +0000 (Fri, 07 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: improved tests_default_random().
+
+------------------------------------------------------------------------
+r4823 | vlefevre | 2007-09-02 23:17:48 +0000 (Sun, 02 Sep 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: fixed get_patches rule.
+
+------------------------------------------------------------------------
+r4821 | vlefevre | 2007-09-02 22:29:28 +0000 (Sun, 02 Sep 2007) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: cd $(srcdir) before executing get_patches.sh (thanks to
+Daniel Jacobowitz for noticing this); for more information, see the
+note just before the get_patches.c rule.
+
+------------------------------------------------------------------------
+r4819 | vlefevre | 2007-08-31 17:09:15 +0000 (Fri, 31 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+acosh.c: added MPFR_UNLIKELY.
+
+------------------------------------------------------------------------
+r4817 | vlefevre | 2007-08-31 15:50:48 +0000 (Fri, 31 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+
+Added generic bad case tests.
+
+------------------------------------------------------------------------
+r4816 | vlefevre | 2007-08-31 15:34:23 +0000 (Fri, 31 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: deleted trailing spaces.
+
+------------------------------------------------------------------------
+r4815 | vlefevre | 2007-08-31 15:33:34 +0000 (Fri, 31 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: correction in section on mpfr_asinh: acosh -> asinh.
+
+------------------------------------------------------------------------
+r4814 | vlefevre | 2007-08-31 15:31:37 +0000 (Fri, 31 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/algorithms.tex
+ M /trunk/tests/tacosh.c
+
+Fixed bug in mpfr_acosh for arguments slightly larger than 1;
+updated algorithms.tex; fixed testcase.
+
+------------------------------------------------------------------------
+r4813 | vlefevre | 2007-08-31 13:06:59 +0000 (Fri, 31 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+
+tacosh.c: added testcase for bug in mpfr_acosh (assertion failure).
+
+------------------------------------------------------------------------
+r4812 | vlefevre | 2007-08-31 12:02:37 +0000 (Fri, 31 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tasin.c
+
+tasin.c: increased the number of generic tests.
+
+------------------------------------------------------------------------
+r4811 | vlefevre | 2007-08-31 11:33:53 +0000 (Fri, 31 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tzeta.c
+
+Improved generic tests by limiting the exponent range of the random
+numbers for some functions.
+
+------------------------------------------------------------------------
+r4810 | vlefevre | 2007-08-30 15:09:11 +0000 (Thu, 30 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tpow.c
+
+Generic tests: adjust the proportion of negative numbers returned
+by the random function in order to get fewer NaN cases.
+
+------------------------------------------------------------------------
+r4809 | vlefevre | 2007-08-30 14:26:54 +0000 (Thu, 30 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: output a warning when too few normal cases are tested
+(so that the random function can be improved...).
+
+------------------------------------------------------------------------
+r4808 | vlefevre | 2007-08-30 13:50:59 +0000 (Thu, 30 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: function split (for future addition).
+
+------------------------------------------------------------------------
+r4806 | vlefevre | 2007-08-30 10:37:17 +0000 (Thu, 30 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: updated copyright notice (for consistency).
+
+------------------------------------------------------------------------
+r4803 | vlefevre | 2007-08-30 10:29:54 +0000 (Thu, 30 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/mpfr-test.h
+
+Bug fix: added missing _MPFR_PROTO in mpfr-test.h.
+
+------------------------------------------------------------------------
+r4802 | vlefevre | 2007-08-30 10:12:22 +0000 (Thu, 30 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: updated description line.
+
+------------------------------------------------------------------------
+r4800 | vlefevre | 2007-08-29 19:59:07 +0000 (Wed, 29 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/acinclude.m4
+ M /trunk/comparisons.c
+ M /trunk/exp.c
+ M /trunk/faq.xsl
+ M /trunk/neg.c
+
+Updated copyright notice (for an unknown reason, some files were missing
+from the change done in r4350).
+
+------------------------------------------------------------------------
+r4795 | vlefevre | 2007-08-28 15:37:59 +0000 (Tue, 28 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/atan2.c
+
+atan2.c: as we supposed some property, let's add an assertion (which
+can be evaluated at compile time).
+
+------------------------------------------------------------------------
+r4794 | vlefevre | 2007-08-28 15:27:17 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+
+atan2.c: improved comment.
+
+------------------------------------------------------------------------
+r4793 | vlefevre | 2007-08-28 15:24:27 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+
+atan2.c: completed the underflow case.
+
+------------------------------------------------------------------------
+r4792 | vlefevre | 2007-08-28 14:19:37 +0000 (Tue, 28 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/atan2.c
+
+atan2.c: fixed the underflow case except in GMP_RNDN with
+2^(-emin-2) < |y/x| < 2^(-emin-1).
+
+------------------------------------------------------------------------
+r4791 | vlefevre | 2007-08-28 14:18:35 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tatan.c: added small-value tests in the other rounding modes.
+
+------------------------------------------------------------------------
+r4790 | vlefevre | 2007-08-28 13:51:04 +0000 (Tue, 28 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/atan2.c
+
+atan2.c: implemented the special case where x is positive and y/x is
+computed exactly (solving the underflow problems in this case).
+
+------------------------------------------------------------------------
+r4789 | vlefevre | 2007-08-28 13:49:02 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tatan.c: added a similar test, but with an exact division result.
+
+------------------------------------------------------------------------
+r4788 | vlefevre | 2007-08-28 13:35:40 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tatan.c: fixed test.
+
+------------------------------------------------------------------------
+r4786 | vlefevre | 2007-08-28 13:16:16 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a paragraph concerning Ziv loops.
+
+------------------------------------------------------------------------
+r4785 | vlefevre | 2007-08-28 09:34:36 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tatan.c: updated comment.
+
+------------------------------------------------------------------------
+r4784 | vlefevre | 2007-08-28 08:59:09 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tatan.c: extended the latest testcase to any platform (e.g. 64 bits).
+
+------------------------------------------------------------------------
+r4783 | vlefevre | 2007-08-28 08:49:00 +0000 (Tue, 28 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+tatan.c: added testcase from a bug reported by Christopher Creutzig.
+
+------------------------------------------------------------------------
+r4781 | vlefevre | 2007-08-27 14:27:34 +0000 (Mon, 27 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk
+ M /trunk/tests
+
+Updated svn:ignore properties.
+
+------------------------------------------------------------------------
+r4779 | vlefevre | 2007-08-27 11:55:00 +0000 (Mon, 27 Aug 2007) | 7 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update:
+ * The question numbers are now hardcoded instead of being generated
+ with CSS rules.
+ * Added the list of questions at the top.
+ * CSS styles: a grey bar is displayed on the left of the target answer
+ (if the browser supports the ":target" pseudo-class from CSS3).
+
+------------------------------------------------------------------------
+r4778 | vlefevre | 2007-08-27 10:56:11 +0000 (Mon, 27 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/faq.xsl
+
+faq.xsl: added a comment.
+
+------------------------------------------------------------------------
+r4776 | vlefevre | 2007-08-27 10:44:17 +0000 (Mon, 27 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+
+------------------------------------------------------------------------
+r4774 | vlefevre | 2007-08-22 15:51:41 +0000 (Wed, 22 Aug 2007) | 6 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: added another warning concerning the --with-gmp options.
+For instance, under Linux, "cpp -I/usr/include -v < /dev/null" says:
+ ignoring duplicate directory "/usr/include"
+ as it is a non-system directory that duplicates a system directory
+and does not modify the include search path as wanted.
+
+------------------------------------------------------------------------
+r4772 | vlefevre | 2007-08-15 17:29:44 +0000 (Wed, 15 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: improved description of mpfr_setsign.
+
+------------------------------------------------------------------------
+r4770 | vlefevre | 2007-08-14 11:41:37 +0000 (Tue, 14 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Added to NEWS: Thread-safe support with Microsoft Visual compiler.
+
+------------------------------------------------------------------------
+r4768 | vlefevre | 2007-08-14 11:34:22 +0000 (Tue, 14 Aug 2007) | 5 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: if MPFR_USE_THREAD_SAFE is defined (--enable-thread-safe):
+ * Added support for MSC (thanks to Brian Gladman).
+ * Define MPFR_THREAD_ATTR even after #error to make the error more
+ visible (see comment in the source).
+
+------------------------------------------------------------------------
+r4765 | vlefevre | 2007-08-13 10:41:51 +0000 (Mon, 13 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tstckintc.c
+
+tstckintc.c: fixed bus error on Solaris (the address of Buffer was not
+a multiple of 4).
+
+------------------------------------------------------------------------
+r4761 | vlefevre | 2007-08-13 05:05:39 +0000 (Mon, 13 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: new functions mpfr_signbit, mpfr_setsign, mpfr_copysign.
+
+------------------------------------------------------------------------
+r4759 | vlefevre | 2007-08-13 04:53:32 +0000 (Mon, 13 Aug 2007) | 8 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ M /trunk/copysign.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/setsign.c
+ A /trunk/signbit.c
+ M /trunk/tests/tcopysign.c
+
+Implemented changes suggested in
+<https://sympa.inria.fr/sympa/arc/mpfr/2007-07/msg00123.html>.
+* Made mpfr_copysign() like the corresponding function in IEEE 754
+ (was an internal function until now).
+* Added mpfr_signbit() and mpfr_setsign().
+* Documented these three functions.
+* Updated TODO.
+
+------------------------------------------------------------------------
+r4757 | vlefevre | 2007-08-13 04:34:33 +0000 (Mon, 13 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/jyn_asympt.c
+ M /trunk/remquo.c
+ M /trunk/tests/texp10.c
+ M /trunk/tests/tl2b.c
+
+Make svn properties consistent.
+
+------------------------------------------------------------------------
+r4752 | vlefevre | 2007-08-11 22:41:05 +0000 (Sat, 11 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+Fixed mpfr_inits and mpfr_clears calls in tests/tatan.c.
+
+------------------------------------------------------------------------
+r4751 | vlefevre | 2007-08-11 22:38:54 +0000 (Sat, 11 Aug 2007) | 3 lines
+Changed paths:
+ A /trunk/check_inits_clears
+
+Added check_inits_clears Perl script to check that a cast is performed
+for the last argument of mpfr_inits, mpfr_inits2 and mpfr_clears.
+
+------------------------------------------------------------------------
+r4747 | vlefevre | 2007-08-10 02:19:57 +0000 (Fri, 10 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version to 2.4.0-dev.
+
+------------------------------------------------------------------------
+r4744 | vlefevre | 2007-08-10 02:11:05 +0000 (Fri, 10 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS update.
+
+------------------------------------------------------------------------
+r4743 | vlefevre | 2007-08-10 02:06:56 +0000 (Fri, 10 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update with "TZ=UTC svn log -v".
+
+------------------------------------------------------------------------
+r4742 | vlefevre | 2007-08-10 01:41:01 +0000 (Fri, 10 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/asinh.c
+
+asinh.c: fixed assertion failure (see test 4 in tasinh.c, added
+in r4740), that was due to an exception.
+
+------------------------------------------------------------------------
+r4741 | vlefevre | 2007-08-10 01:38:25 +0000 (Fri, 10 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tasinh.c
+
+tasinh.c: fixed test.
+
+------------------------------------------------------------------------
+r4740 | vlefevre | 2007-08-10 01:18:46 +0000 (Fri, 10 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tasinh.c
+
+tasinh.c: added worst case that yields an assertion failure.
+
+------------------------------------------------------------------------
+r4739 | vlefevre | 2007-08-09 17:21:32 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/cbrt
+ M /trunk/tests/tcbrt.c
+
+Added data_check support to cbrt.
+
+------------------------------------------------------------------------
+r4738 | vlefevre | 2007-08-09 15:45:47 +0000 (Thu, 09 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/log.c
+
+log.c: fixed assertion failure (see test x_near_one in tlog.c, added
+in r4736), that was due to an exception.
+
+------------------------------------------------------------------------
+r4737 | vlefevre | 2007-08-09 12:12:56 +0000 (Thu, 09 Aug 2007) | 6 lines
+Changed paths:
+ M /trunk/pow.c
+
+pow.c: added MPFR_SMALL_INPUT_AFTER_SAVE_EXPO for the case where
+|y * log(x)| is very small (I can't really test because this code
+currently fails due to a bug in mpfr_log: see test x_near_one
+added to tlog.c as changeset 4736; this bug is also present in
+the 2.2 branch).
+
+------------------------------------------------------------------------
+r4736 | vlefevre | 2007-08-09 11:58:59 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+tlog.c: added a test leading to an assertion failure in mpfr_log.
+
+------------------------------------------------------------------------
+r4735 | vlefevre | 2007-08-09 11:45:19 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: added a test where x is close to 1.
+
+------------------------------------------------------------------------
+r4734 | vlefevre | 2007-08-09 11:02:28 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/exp10
+
+Added empty file tests/data/exp10 to avoid an error with -dev versions.
+
+------------------------------------------------------------------------
+r4733 | vlefevre | 2007-08-09 10:18:50 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/round_near_x.c
+
+Added a TODO concerning the description of mpfr_round_near_x.
+
+------------------------------------------------------------------------
+r4732 | vlefevre | 2007-08-09 09:48:59 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/expm1
+ A /trunk/tests/data/log1p
+ A /trunk/tests/data/log2
+
+Added empty files in tests/data to avoid errors with -dev versions.
+
+------------------------------------------------------------------------
+r4731 | vlefevre | 2007-08-09 09:39:43 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+mpfr_ui_pow fix: added a MPFR_SAVE_EXPO_UPDATE_FLAGS.
+
+------------------------------------------------------------------------
+r4730 | vlefevre | 2007-08-09 02:52:27 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/texp10.c
+
+Added texp10.c (texp10 currently fails).
+
+------------------------------------------------------------------------
+r4729 | vlefevre | 2007-08-09 02:26:33 +0000 (Thu, 09 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/texp2.c
+
+texp2.c: reformat and added some tests which were missing.
+
+------------------------------------------------------------------------
+r4728 | vlefevre | 2007-08-08 15:12:56 +0000 (Wed, 08 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tl2b.c
+ M /trunk/tests/tremquo.c
+
+Updated svn:keywords and svn:eol-style properties in tests.
+
+------------------------------------------------------------------------
+r4727 | vlefevre | 2007-08-08 15:11:15 +0000 (Wed, 08 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+
+Added data_check calls to texpm1, tlog1p and tlog2.
+
+------------------------------------------------------------------------
+r4726 | vlefevre | 2007-08-08 14:37:28 +0000 (Wed, 08 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: in data_check(), mode 'Z', do not test GMP_RNDN if
+the precision for the directed rounding modes is MPFR_PREC_MIN.
+
+------------------------------------------------------------------------
+r4725 | vlefevre | 2007-08-04 23:13:52 +0000 (Sat, 04 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: more on mpfr_sin (and mpfr_cos).
+
+------------------------------------------------------------------------
+r4724 | vlefevre | 2007-08-04 22:58:01 +0000 (Sat, 04 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: update concerning sin/cos/tan.
+
+------------------------------------------------------------------------
+r4723 | vlefevre | 2007-08-03 02:45:32 +0000 (Fri, 03 Aug 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: in data_check(), check the 4 rounding modes if rnd is 'Z'
+(in order to test the worst cases).
+
+------------------------------------------------------------------------
+r4722 | vlefevre | 2007-08-03 01:30:20 +0000 (Fri, 03 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Fixed coding style (for ansi2knr in particular).
+
+------------------------------------------------------------------------
+r4721 | vlefevre | 2007-08-02 10:19:44 +0000 (Thu, 02 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: added a comment about "get_patches.c".
+
+------------------------------------------------------------------------
+r4720 | vlefevre | 2007-08-02 10:07:48 +0000 (Thu, 02 Aug 2007) | 8 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+No longer set "CLEANFILES = get_patches.c" in Makefile.am so that a
+"make clean" doesn't remove the get_patches.c file, as rebuilding it
+needs a Unix shell (and some standard utilities). Anyway the update
+of this file should be regarded as part of the patch process, then
+this file is just like any other .c files. Note: "make dist" includes
+this file in the archives, so that concerning the build, everything
+is like before as long as no patches are applied.
+
+------------------------------------------------------------------------
+r4719 | zimmerma | 2007-08-01 18:07:32 +0000 (Wed, 01 Aug 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item about sNaN/qNaN
+
+------------------------------------------------------------------------
+r4718 | vlefevre | 2007-07-31 14:28:20 +0000 (Tue, 31 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/copysign.c
+
+copysign.c: reformat, updated comment (but this function is still not
+documented in mpfr.texi).
+
+------------------------------------------------------------------------
+r4717 | vlefevre | 2007-07-31 14:12:15 +0000 (Tue, 31 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version back to 2.3.0-dev since the 2.3 branch will be recreated
+from the trunk (too many changes!).
+
+------------------------------------------------------------------------
+r4716 | vlefevre | 2007-07-31 13:34:37 +0000 (Tue, 31 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tl2b.c
+
+tl2b.c: enable output even when the constants are correct.
+
+------------------------------------------------------------------------
+r4715 | vlefevre | 2007-07-31 13:25:24 +0000 (Tue, 31 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk
+
+Added get_patches.c to the svn:ignore property, as this file is
+generated.
+
+------------------------------------------------------------------------
+r4714 | vlefevre | 2007-07-31 13:23:37 +0000 (Tue, 31 Jul 2007) | 13 lines
+Changed paths:
+ M /trunk/free_cache.c
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tl2b.c
+
+Replaced l2b cache by constants, as suggested by Patrick Pelissier,
+to avoid efficiency problems with the stack interface and heavily
+threaded applications.
+ * Added tests/tl2b.c to generate / check the constants.
+ * tests/Makefile.am: added tl2b to check_PROGRAMS.
+ * tests directory: added tl2b to the svn:ignore property.
+ * mpfr-impl.h: updated the __gmpfr_l2b declaration.
+ * free_cache.c: disabled free_l2b (since there's no longer a cache).
+ * get_str.c: added the code generated by tl2b; for the bootstrap, one
+ can just write:
+ const __mpfr_struct __gmpfr_l2b[BASE_MAX-1][2] = { { { 0 } } };
+ Removed the code (in ceil_mul) that computed these constants.
+
+------------------------------------------------------------------------
+r4713 | vlefevre | 2007-07-30 22:37:30 +0000 (Mon, 30 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the documentation of the mpfr_get_d function family.
+
+------------------------------------------------------------------------
+r4712 | vlefevre | 2007-07-30 11:12:45 +0000 (Mon, 30 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/TODO
+
+Patch tracking: updated README.dev and TODO files.
+
+------------------------------------------------------------------------
+r4711 | vlefevre | 2007-07-30 10:45:01 +0000 (Mon, 30 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ A /trunk/PATCHES
+ A /trunk/get_patches.sh
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Added support for tracking applied patches with new function
+mpfr_get_patches().
+
+------------------------------------------------------------------------
+r4710 | vlefevre | 2007-07-30 09:41:55 +0000 (Mon, 30 Jul 2007) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the example concerning mpfr_get_version() vs
+MPFR_VERSION_STRING ("Warning" instead of "Error", make sure that
+the example fits on 80 columns in the info file).
+
+------------------------------------------------------------------------
+r4709 | vlefevre | 2007-07-30 09:37:06 +0000 (Mon, 30 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated description of mpfr_get_version().
+
+------------------------------------------------------------------------
+r4708 | vlefevre | 2007-07-30 09:31:58 +0000 (Mon, 30 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated description of mpfr_get_version().
+
+------------------------------------------------------------------------
+r4707 | zimmerma | 2007-07-28 15:03:05 +0000 (Sat, 28 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added files that are not 100% covered by tests
+
+------------------------------------------------------------------------
+r4706 | vlefevre | 2007-07-27 22:04:24 +0000 (Fri, 27 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/coverage
+
+coverage: added --disable-shared --enable-static to configure.
+
+------------------------------------------------------------------------
+r4705 | vlefevre | 2007-07-27 21:59:04 +0000 (Fri, 27 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: added more casts for g++.
+
+------------------------------------------------------------------------
+r4704 | vlefevre | 2007-07-27 21:54:22 +0000 (Fri, 27 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Reformat.
+
+------------------------------------------------------------------------
+r4703 | vlefevre | 2007-07-27 21:48:03 +0000 (Fri, 27 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/const_log2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+
+Applied patch from Patrick to be able to build MPFR with g++.
+
+------------------------------------------------------------------------
+r4702 | zimmerma | 2007-07-26 12:02:24 +0000 (Thu, 26 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+added default thresholds for Core 2
+
+------------------------------------------------------------------------
+r4701 | vlefevre | 2007-07-25 15:34:52 +0000 (Wed, 25 Jul 2007) | 5 lines
+Changed paths:
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+
+No longer use MPFR_CHECK_ALL in tests. In '-dev' versions, assume
+that the data files exist and return an error whenever a file cannot
+be opened. In the other versions, return silently if the file cannot
+be opened.
+
+------------------------------------------------------------------------
+r4700 | vlefevre | 2007-07-25 15:18:45 +0000 (Wed, 25 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ D /trunk/mpfr-test.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/mpfr-test.h (from /trunk/mpfr-test.h:4698)
+
+Moved mpfr-test.h into the tests directory.
+
+------------------------------------------------------------------------
+r4699 | zimmerma | 2007-07-25 15:15:55 +0000 (Wed, 25 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+fixed "efficiency bug" (argument reduction was broken)
+
+------------------------------------------------------------------------
+r4698 | vlefevre | 2007-07-25 14:45:13 +0000 (Wed, 25 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: in data_check(), made whitespace skipping consistent and
+check that the result value is immediately followed by a \n.
+
+------------------------------------------------------------------------
+r4697 | vlefevre | 2007-07-25 14:02:23 +0000 (Wed, 25 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+[tests.c] Fixed some types (the result of getc() is not necessarily
+representable in a char).
+
+------------------------------------------------------------------------
+r4696 | vlefevre | 2007-07-25 13:45:10 +0000 (Wed, 25 Jul 2007) | 5 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests.c: changes in the error messages (BTW, we decided to output
+everything to stdout for consistency, even though messages for
+assertion failure are written to stderr) and replaced an abort ()
+by an exit (1).
+
+------------------------------------------------------------------------
+r4695 | vlefevre | 2007-07-25 10:58:54 +0000 (Wed, 25 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/jyn_asympt.c
+ M /trunk/tests/tests.c
+
+Delete trailing spaces.
+
+------------------------------------------------------------------------
+r4694 | zimmerma | 2007-07-25 10:01:45 +0000 (Wed, 25 Jul 2007) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/jn.c
+ A /trunk/jyn_asympt.c
+ M /trunk/tests/tests.c
+ M /trunk/yn.c
+
+jyn_asympt.c: new common file for asymptotic expansion in jn/yn
+tests/tests.c: print precisions in case of failure
+jn.c: now use jyn_asympt.c
+yn.c: now implement asymptotic expansion (jyn_asympt.c)
+
+------------------------------------------------------------------------
+r4693 | zimmerma | 2007-07-25 09:58:31 +0000 (Wed, 25 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/data/y0
+ M /trunk/tests/data/y1
+
+fixed more wrong entries in Gonnet's test suite
+
+------------------------------------------------------------------------
+r4692 | zimmerma | 2007-07-24 15:12:39 +0000 (Tue, 24 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+
+contribution of first neglected term to error was wrong
+
+------------------------------------------------------------------------
+r4691 | zimmerma | 2007-07-24 15:08:51 +0000 (Tue, 24 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/data/y0
+
+fixed wrong entry (not enough precision was used in Maple)
+
+------------------------------------------------------------------------
+r4690 | zimmerma | 2007-07-24 13:42:35 +0000 (Tue, 24 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/jn.c
+ M /trunk/tests/data/j0
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+
+implemented asymptotic expansion for large argument in j0/j1/jn
+
+------------------------------------------------------------------------
+r4689 | zimmerma | 2007-07-20 16:12:03 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+define MPFR_CHECK_ALL for nightly tests
+
+------------------------------------------------------------------------
+r4688 | zimmerma | 2007-07-20 16:11:15 +0000 (Fri, 20 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tlgamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+
+Added code to check mpfr against Gonnet's tables when the environment variable
+MPFR_CHECK_ALL is defined (some table entries were checked by MuPAD)
+
+------------------------------------------------------------------------
+r4687 | zimmerma | 2007-07-20 16:04:38 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/data/gonnet.mpl
+
+added comment
+
+------------------------------------------------------------------------
+r4686 | zimmerma | 2007-07-20 15:58:20 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/y0
+ A /trunk/tests/data/y1
+
+test data files mpfr mpfr_y0 and mpfr_y1, ***not*** checked with MuPAD
+
+------------------------------------------------------------------------
+r4685 | zimmerma | 2007-07-20 15:55:03 +0000 (Fri, 20 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/data/CheckData.mu
+
+added auxiliary MuPAD functions
+improved Ziv's strategy: add half of DIGITS each time
+
+------------------------------------------------------------------------
+r4684 | zimmerma | 2007-07-20 15:52:52 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/tanh
+
+test data file for mpfr_tanh, checked by MuPAD
+
+------------------------------------------------------------------------
+r4683 | zimmerma | 2007-07-20 15:51:28 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/tan
+
+test data file for mpfr_tan, checked with MuPAD (except 3 indicated entries)
+
+------------------------------------------------------------------------
+r4682 | zimmerma | 2007-07-20 15:39:23 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/sqrt
+
+test data file for mpfr_sqrt, checked with MuPAD
+
+------------------------------------------------------------------------
+r4681 | zimmerma | 2007-07-20 15:28:32 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/sinh
+
+test data file for mpfr_sinh, checked by MuPAD (except indicated lines)
+
+------------------------------------------------------------------------
+r4680 | zimmerma | 2007-07-20 15:17:58 +0000 (Fri, 20 Jul 2007) | 3 lines
+Changed paths:
+ A /trunk/tests/data/sin
+
+test data file for mpfr_sin, checked by MuPAD (except tiny inputs indicated
+in file)
+
+------------------------------------------------------------------------
+r4679 | zimmerma | 2007-07-20 13:45:40 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/pow275
+
+test data file for x^(11/4), checked with MuPAD
+
+------------------------------------------------------------------------
+r4678 | zimmerma | 2007-07-20 13:41:01 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/data/log10
+
+finally, I was able to check it with MuPAD
+
+------------------------------------------------------------------------
+r4677 | zimmerma | 2007-07-20 13:36:16 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/exp2
+
+test data file for 2^x, checked with MuPAD
+
+------------------------------------------------------------------------
+r4676 | zimmerma | 2007-07-20 13:28:30 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/mulpi
+
+test data file for Pi*x, checked with MuPAD
+
+------------------------------------------------------------------------
+r4675 | zimmerma | 2007-07-20 12:56:27 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/log
+
+test data file for mpfr_log, checked with MuPAD
+
+------------------------------------------------------------------------
+r4674 | zimmerma | 2007-07-20 12:54:43 +0000 (Fri, 20 Jul 2007) | 3 lines
+Changed paths:
+ A /trunk/tests/data/j0
+ A /trunk/tests/data/j1
+ A /trunk/tests/data/lgamma
+ A /trunk/tests/data/log10
+
+test data files for mpfr_j0, mpfr_j1, mpfr_lgamma, mpfr_log10,
+***not*** tested with MuPAD (not Dom::Interval interface)
+
+------------------------------------------------------------------------
+r4673 | zimmerma | 2007-07-20 12:52:25 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/inv
+
+test data file for 1/x, i.e., mpfr_ui_div(1,x), checked with MuPAD
+
+------------------------------------------------------------------------
+r4672 | zimmerma | 2007-07-20 12:45:10 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/gamma
+
+test data file for mpfr_gamma, ***not*** checked by MuPAD
+
+------------------------------------------------------------------------
+r4671 | zimmerma | 2007-07-20 12:44:09 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/exp
+
+test data file for mpfr_exp, checked with MuPAD
+
+------------------------------------------------------------------------
+r4670 | zimmerma | 2007-07-20 12:43:34 +0000 (Fri, 20 Jul 2007) | 3 lines
+Changed paths:
+ A /trunk/tests/data/erf
+ A /trunk/tests/data/erfc
+
+test data files for erf and erfc (not checked by MuPAD, since Dom::Interval
+does not have an interface for those functions in MuPAD 3.2.0)
+
+------------------------------------------------------------------------
+r4669 | zimmerma | 2007-07-20 12:35:54 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/cosh
+
+test data file for mpfr_cosh, checked with MuPAD
+
+------------------------------------------------------------------------
+r4668 | zimmerma | 2007-07-20 12:33:31 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/cos
+
+test data file for mpfr_cos, checked by MuPAD
+
+------------------------------------------------------------------------
+r4667 | zimmerma | 2007-07-20 12:02:36 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/atanh
+
+test data file for mpfr_atanh, checked with MuPAD
+
+------------------------------------------------------------------------
+r4666 | zimmerma | 2007-07-20 11:42:54 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/atan
+
+test data file for atan, checked with MuPAD
+
+------------------------------------------------------------------------
+r4665 | zimmerma | 2007-07-20 11:06:48 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/asinh
+
+test file for mpfr_asinh, checked with MuPAD
+
+------------------------------------------------------------------------
+r4664 | zimmerma | 2007-07-20 11:04:14 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/asin
+
+data file for mpfr_asin, checked with MuPAD using CheckData.mu
+
+------------------------------------------------------------------------
+r4663 | zimmerma | 2007-07-20 10:13:10 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/acosh
+
+data file for mpfr_acosh, checked with MuPAD using CheckData.mu
+
+------------------------------------------------------------------------
+r4662 | zimmerma | 2007-07-20 10:12:37 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/data/CheckData.mu
+
+improved output
+
+------------------------------------------------------------------------
+r4661 | zimmerma | 2007-07-20 10:05:11 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data/CheckData.mu
+
+MuPAD file to check a data file
+
+------------------------------------------------------------------------
+r4658 | vlefevre | 2007-07-20 00:18:14 +0000 (Fri, 20 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/free_cache.c
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+
+Renamed mpfr_l2b as __gmpfr_l2b for consistency.
+
+------------------------------------------------------------------------
+r4657 | zimmerma | 2007-07-19 19:49:15 +0000 (Thu, 19 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-longlong.h
+
+patch from Brian Gladman to build mpfr.dll
+
+------------------------------------------------------------------------
+r4656 | zimmerma | 2007-07-19 16:07:58 +0000 (Thu, 19 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/data/acos
+ M /trunk/tests/data/gonnet.mpl
+
+added copyright information about Gonnet's package
+
+------------------------------------------------------------------------
+r4655 | zimmerma | 2007-07-19 16:03:38 +0000 (Thu, 19 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+modified data_check() to allow comment lines starting with #
+
+------------------------------------------------------------------------
+r4654 | zimmerma | 2007-07-19 14:55:47 +0000 (Thu, 19 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tests.c
+
+new (experimental) mechanism to check data files (see example in tacos.c)
+
+------------------------------------------------------------------------
+r4653 | zimmerma | 2007-07-19 14:54:49 +0000 (Thu, 19 Jul 2007) | 2 lines
+Changed paths:
+ A /trunk/tests/data
+ A /trunk/tests/data/acos
+ A /trunk/tests/data/gonnet.mpl
+
+new directory for test data
+
+------------------------------------------------------------------------
+r4652 | zimmerma | 2007-07-19 10:52:00 +0000 (Thu, 19 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+added test for inexact flag (bug fixed in r4630)
+
+------------------------------------------------------------------------
+r4651 | vlefevre | 2007-07-18 23:09:35 +0000 (Wed, 18 Jul 2007) | 4 lines
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/erfc.c
+
+erfc.c, atan2.c: added missing "MPFR_SAVE_EXPO_FREE (expo);" before
+ "return mpfr_underflow (...);".
+erfc.c: replaced a goto by an else.
+
+------------------------------------------------------------------------
+r4650 | zimmerma | 2007-07-18 16:24:08 +0000 (Wed, 18 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+
+now deal with underflow in y/x (remains to deal with overflow)
+
+------------------------------------------------------------------------
+r4649 | zimmerma | 2007-07-18 16:19:31 +0000 (Wed, 18 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+now can specify output base when argc > 1
+
+------------------------------------------------------------------------
+r4648 | zimmerma | 2007-07-18 16:18:14 +0000 (Wed, 18 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tlgamma.c
+
+MPFR_EQUAL -> mpfr_equal_p
+
+------------------------------------------------------------------------
+r4647 | zimmerma | 2007-07-18 15:48:57 +0000 (Wed, 18 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/erfc.c
+ M /trunk/tests/terf.c
+
+fixed problem with erfc() near underflow region
+
+------------------------------------------------------------------------
+r4646 | zimmerma | 2007-07-18 13:51:07 +0000 (Wed, 18 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/tests/tatan.c
+
+atan2.c: quick-and-dirty fix for atan2(y,1)
+tests/tatan.c: fix tests from Christopher [x and y were interchanged]
+
+------------------------------------------------------------------------
+r4645 | zimmerma | 2007-07-18 12:19:22 +0000 (Wed, 18 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+added test from Ch. Creutzig
+
+------------------------------------------------------------------------
+r4644 | zimmerma | 2007-07-18 08:23:30 +0000 (Wed, 18 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+apply patch suggested in bug #3604
+
+------------------------------------------------------------------------
+r4643 | zimmerma | 2007-07-17 14:30:00 +0000 (Tue, 17 Jul 2007) | 4 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlgamma.c
+
+previous bug fix for tiny negative inputs in mpfr_lgamma was incorrect:
+result was NaN, but this was not detected by the tests since mpfr_cmp (y, NaN)
+is always true!
+
+------------------------------------------------------------------------
+r4642 | vlefevre | 2007-07-17 13:14:21 +0000 (Tue, 17 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/strtofr.c
+
+Added comments and fixed an indentation bug.
+
+------------------------------------------------------------------------
+r4641 | zimmerma | 2007-07-17 06:26:24 +0000 (Tue, 17 Jul 2007) | 4 lines
+Changed paths:
+ M /trunk/cos.c
+
+in reconstruction after computation of cos(x/2^k) for reduced argument,
+it may be that cos(x) is zero to the working precision. Then restart Ziv's
+algorithm with a larger precision.
+
+------------------------------------------------------------------------
+r4640 | zimmerma | 2007-07-16 12:51:17 +0000 (Mon, 16 Jul 2007) | 4 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlgamma.c
+
+lngamma.c: fix for small inputs
+tlgamma.c: added more tests from Kaveh Ghazi
+
+
+------------------------------------------------------------------------
+r4639 | zimmerma | 2007-07-16 11:22:13 +0000 (Mon, 16 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/ttan.c
+
+sin_cos.c: 2nd arg of 1st mpfr_can_round call was wrong
+ttan.c: fixed wrong reference value
+
+------------------------------------------------------------------------
+r4638 | zimmerma | 2007-07-16 06:58:08 +0000 (Mon, 16 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added comment about sinpi, etc.
+
+------------------------------------------------------------------------
+r4637 | zimmerma | 2007-07-15 09:09:10 +0000 (Sun, 15 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/ttan.c
+
+added new test, and re-enabled test that was too slow
+
+------------------------------------------------------------------------
+r4636 | zimmerma | 2007-07-14 07:30:37 +0000 (Sat, 14 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+removed MPFR_CHECK_TINY, added MPFR_CHECK_MAX
+
+------------------------------------------------------------------------
+r4635 | vlefevre | 2007-07-10 08:52:50 +0000 (Tue, 10 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+terf.c: added testcase for bug reported by Christopher Creutzig.
+
+------------------------------------------------------------------------
+r4633 | vlefevre | 2007-07-09 11:41:04 +0000 (Mon, 09 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+
+Removed a #include that was probably added by mistake in r2590.
+
+------------------------------------------------------------------------
+r4632 | vlefevre | 2007-07-09 11:39:29 +0000 (Mon, 09 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/abort_prec_max.c
+ M /trunk/cos.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/fma.c
+ M /trunk/fms.c
+ M /trunk/free_cache.c
+ M /trunk/get_d64.c
+ M /trunk/get_si.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/init2.c
+ M /trunk/inp_str.c
+ M /trunk/logging.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-impl.h
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/remquo.c
+ M /trunk/set_d64.c
+ M /trunk/set_uj.c
+ M /trunk/strtofr.c
+ M /trunk/tuneup.c
+ M /trunk/ui_pow.c
+ M /trunk/zeta.c
+
+<stdio.h> and <limits.h> are now included unconditionally in mpfr-impl.h
+(removed their inclusion from the C files for consistency).
+
+------------------------------------------------------------------------
+r4630 | zimmerma | 2007-07-04 10:07:31 +0000 (Wed, 04 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+ternary flag was wrong in case s=1 or -1 and rounding up/nearest
+
+------------------------------------------------------------------------
+r4629 | zimmerma | 2007-07-04 09:32:23 +0000 (Wed, 04 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/tan.c
+
+updated algorithms.tex with new additive argument reduction for sin/cos/tan
+
+------------------------------------------------------------------------
+r4628 | vlefevre | 2007-07-03 23:35:05 +0000 (Tue, 03 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+lngamma.c: reformat and replaced mpfr_cmp(...) == 0 by mpfr_equal_p.
+
+------------------------------------------------------------------------
+r4626 | zimmerma | 2007-07-03 19:12:40 +0000 (Tue, 03 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/free_cache.c
+
+changed stdlib to stdio for NULL (see README.dev)
+
+------------------------------------------------------------------------
+r4625 | zimmerma | 2007-07-03 19:10:33 +0000 (Tue, 03 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlgamma.c
+
+fixed bug in tlgamma and added test (need to implement Ziv's strategy in
+tiny case)
+
+------------------------------------------------------------------------
+r4624 | zimmerma | 2007-07-03 18:45:28 +0000 (Tue, 03 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/free_cache.c
+
+added missing include
+
+------------------------------------------------------------------------
+r4622 | vlefevre | 2007-07-03 16:11:39 +0000 (Tue, 03 Jul 2007) | 7 lines
+Changed paths:
+ M /trunk/free_cache.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tests.c
+
+Fixed the bug reported by David Billinghurst to the MPFR mailing-list
+on 2007-07-03 (memory leaks under some conditions):
+ * moved the free_l2b() function from tests/tests.c to free_cache.c;
+ * mpfr_free_cache() (from free_cache.c) now calls free_l2b();
+ * as a consequence, no longer call free_l2b() in tests_end_mpfr();
+ * documented the behavior in mpfr.texi (under mpfr_free_cache).
+
+------------------------------------------------------------------------
+r4620 | vlefevre | 2007-07-03 15:05:01 +0000 (Tue, 03 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tj0.c
+
+tj0.c: added testcase from Sisyphus (assertion failed).
+
+------------------------------------------------------------------------
+r4618 | vlefevre | 2007-07-03 13:03:22 +0000 (Tue, 03 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: explain how to test the library interface compatibility.
+
+------------------------------------------------------------------------
+r4616 | vlefevre | 2007-07-02 23:30:52 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: mentions patch-libtool and how to apply it.
+
+------------------------------------------------------------------------
+r4615 | vlefevre | 2007-07-02 23:26:01 +0000 (Mon, 02 Jul 2007) | 3 lines
+Changed paths:
+ A /trunk/patch-libtool
+
+Added patch-libtool (patch for aclocal.m4 and configure that comes from
+<http://thread.gmane.org/gmane.comp.gnu.libtool.bugs/5771/focus=5776>).
+
+------------------------------------------------------------------------
+r4614 | vlefevre | 2007-07-02 12:17:08 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: mention that the shared library is now enabled by default on 2.3.
+
+------------------------------------------------------------------------
+r4610 | vlefevre | 2007-07-02 10:44:17 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated item 2 of "To make a release".
+
+------------------------------------------------------------------------
+r4608 | vlefevre | 2007-07-02 10:39:46 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.texi
+
+Reformat.
+
+------------------------------------------------------------------------
+r4607 | vlefevre | 2007-07-02 00:41:32 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version to 2.4.0-dev.
+
+------------------------------------------------------------------------
+r4605 | vlefevre | 2007-07-02 00:32:27 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+ChangeLog update.
+
+------------------------------------------------------------------------
+r4604 | vlefevre | 2007-07-02 00:31:13 +0000 (Mon, 02 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: update.
+
+------------------------------------------------------------------------
+r4603 | vlefevre | 2007-07-01 23:17:57 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: updated comment concerning -version-info.
+
+------------------------------------------------------------------------
+r4602 | vlefevre | 2007-07-01 23:01:10 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/TODO
+ A /trunk/fms.c (from /trunk/fma.c:4598)
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tfms.c (from /trunk/tests/tfma.c:4601)
+
+Added mpfr_fms based on mpfr_fma.
+
+------------------------------------------------------------------------
+r4601 | vlefevre | 2007-07-01 22:45:08 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: added a space.
+
+------------------------------------------------------------------------
+r4600 | vlefevre | 2007-07-01 22:38:39 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: typo.
+
+------------------------------------------------------------------------
+r4599 | vlefevre | 2007-07-01 22:20:09 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+Reformat.
+
+------------------------------------------------------------------------
+r4598 | vlefevre | 2007-07-01 22:14:15 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: minor changes for consistency with the future fms.
+
+------------------------------------------------------------------------
+r4597 | vlefevre | 2007-07-01 21:52:21 +0000 (Sun, 01 Jul 2007) | 5 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/fma.c
+ M /trunk/tests/tfma.c
+
+Completed the implementation of mpfr_fma (except in some corner cases
+where overflows/underflows and huge precisions are involved at the
+same time). Added underflow tests. Removed item from the BUGS file
+(the remaining problems more or less correspond to the first item).
+
+------------------------------------------------------------------------
+r4596 | vlefevre | 2007-07-01 03:10:06 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+
+Untabified.
+
+------------------------------------------------------------------------
+r4595 | vlefevre | 2007-07-01 01:58:17 +0000 (Sun, 01 Jul 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: added overflow test to test_underflow.
+
+------------------------------------------------------------------------
+r4594 | vlefevre | 2007-07-01 01:36:04 +0000 (Sun, 01 Jul 2007) | 3 lines
+Changed paths:
+ M /trunk/fma.c
+ M /trunk/tests/tfma.c
+
+fma.c: implemented the main cases where x * y underflows.
+tests/tfma.c: fixed overflow tests and added underflow tests.
+
+------------------------------------------------------------------------
+r4593 | vlefevre | 2007-06-30 02:11:43 +0000 (Sat, 30 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+NEWS: update.
+
+------------------------------------------------------------------------
+r4592 | vlefevre | 2007-06-29 23:36:34 +0000 (Fri, 29 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: updated item on mpfr_fma.
+
+------------------------------------------------------------------------
+r4591 | vlefevre | 2007-06-29 23:32:29 +0000 (Fri, 29 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: completed the cases where x*y/4 needs to be used, except the very
+particular cases where an underflow occurs, that remain to be done.
+
+------------------------------------------------------------------------
+r4590 | vlefevre | 2007-06-29 13:35:03 +0000 (Fri, 29 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: fixed a printf.
+
+------------------------------------------------------------------------
+r4589 | vlefevre | 2007-06-29 13:32:20 +0000 (Fri, 29 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: added an assertion.
+
+------------------------------------------------------------------------
+r4588 | vlefevre | 2007-06-29 13:30:30 +0000 (Fri, 29 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: fixed overflow tests.
+
+------------------------------------------------------------------------
+r4587 | vlefevre | 2007-06-29 12:24:40 +0000 (Fri, 29 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: check NaN in test_overflow2.
+
+------------------------------------------------------------------------
+r4586 | vlefevre | 2007-06-29 12:19:09 +0000 (Fri, 29 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: updated a comment.
+
+------------------------------------------------------------------------
+r4585 | vlefevre | 2007-06-29 12:14:55 +0000 (Fri, 29 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: added more overflow tests (needed to distinguish the cases
+where z/4 underflows or not -- see fma.c).
+
+------------------------------------------------------------------------
+r4584 | vlefevre | 2007-06-29 12:06:13 +0000 (Fri, 29 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: added tests (-> assertion failed because mpfr_fma implementation
+isn't complete).
+
+------------------------------------------------------------------------
+r4583 | vlefevre | 2007-06-28 23:01:22 +0000 (Thu, 28 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/acos.c
+
+acos.c: disabled change from r3145 ("Optimize mpfr_acos by choosing
+a better initial precision.") that was buggy.
+BUGS: removed mpfr_acos bug.
+
+------------------------------------------------------------------------
+r4582 | vlefevre | 2007-06-28 22:40:59 +0000 (Thu, 28 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: updated item on the mpfr_acos bug.
+
+------------------------------------------------------------------------
+r4581 | vlefevre | 2007-06-28 22:38:10 +0000 (Thu, 28 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: updated item on the mpfr_acos test (the bug wasn't visible on
+32-bit machines due to an integer overflow, but the result should
+have been correct anyway).
+
+------------------------------------------------------------------------
+r4580 | vlefevre | 2007-06-28 22:27:09 +0000 (Thu, 28 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/acos.c
+
+acos.c: fixed integer overflows; to avoid undefined behavior, I had
+to add an assertion that is not always satisfied (the code needs to
+be rewritten to take tiny arguments into account).
+
+------------------------------------------------------------------------
+r4579 | vlefevre | 2007-06-28 17:30:39 +0000 (Thu, 28 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: update (mpfr_cot has just been fixed).
+
+------------------------------------------------------------------------
+r4578 | vlefevre | 2007-06-28 17:29:27 +0000 (Thu, 28 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/cot.c
+ M /trunk/tests/tcot.c
+
+cot.c: implemented the case |x| = 2^emin.
+tests/tcot.c: added tests for this case, in 3 exponent ranges
+(as this is an overflow limit).
+
+------------------------------------------------------------------------
+r4577 | vlefevre | 2007-06-28 17:00:15 +0000 (Thu, 28 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+Fixed bug in div.c: rnd_mode could be modified (MPFR_INVERT_RND), but
+the original value was assumed in case of underflow or overflow.
+
+------------------------------------------------------------------------
+r4576 | vlefevre | 2007-06-28 16:40:26 +0000 (Thu, 28 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+tdiv.c: added a test showing another bug in mpfr_div.
+
+------------------------------------------------------------------------
+r4575 | vlefevre | 2007-06-28 11:54:41 +0000 (Thu, 28 Jun 2007) | 5 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/cot.c
+
+cot.c: use MPFR_SAVE_EXPO_UPDATE_FLAGS, but the case +/- 2^emin could
+still be buggy with the current code; added a MPFR_ASSERTN (0) until
+it is implemented.
+BUGS: updated item on mpfr_cot.
+
+------------------------------------------------------------------------
+r4574 | zimmerma | 2007-06-28 07:59:28 +0000 (Thu, 28 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/tan.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/ttan.c
+
+fixed several problems with huge arguments in periodic functions
+mpfr_sin: complete rewrite, using mpfr_remainder for argument reduction
+mpfr_sin_cos: ditto
+
+------------------------------------------------------------------------
+r4573 | zimmerma | 2007-06-25 13:29:38 +0000 (Mon, 25 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/tests/tcos.c
+
+fixed stupid bug (subtraction of unsigned longs)
+
+------------------------------------------------------------------------
+r4572 | zimmerma | 2007-06-25 09:48:43 +0000 (Mon, 25 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tgeneric.c
+
+cos.c: implemented argument reduction by 2Pi
+tcos.c/tgeneric.c: reduce large exponent used when MPFR_CHECK_MAX is defined
+
+------------------------------------------------------------------------
+r4571 | vlefevre | 2007-06-22 14:45:28 +0000 (Fri, 22 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: added bugs.
+
+------------------------------------------------------------------------
+r4570 | vlefevre | 2007-06-22 12:15:03 +0000 (Fri, 22 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/sech.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tsech.c
+
+coth.c, sech.c: a rounding mode was incorrect.
+tests/tcoth.c: added underflowed_cothinf test.
+tests/tsech.c: added overflowed_sech0 test.
+
+------------------------------------------------------------------------
+r4569 | vlefevre | 2007-06-22 00:12:18 +0000 (Fri, 22 Jun 2007) | 8 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/gen_inverse.h
+ M /trunk/sec.c
+ M /trunk/tests/tsec.c
+
+* gen_inverse.h: ACTION_TINY must be called after MPFR_SAVE_EXPO_MARK
+ (this is necessary for some functions). Moved MPFR_SAVE_EXPO_FREE
+ after the "end:" label.
+* coth.c, csc.c, csch.c: as a consequence, MPFR_SAVE_EXPO_UPDATE_FLAGS
+ had to be added before "goto end;".
+* sec.c: a rounding mode was incorrect.
+* tests/tsec.c: added overflowed_sec0 test.
+
+------------------------------------------------------------------------
+r4568 | vlefevre | 2007-06-21 23:36:19 +0000 (Thu, 21 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tests/tsin_cos.c
+
+sin_cos.c: fixed a bug for x = 0 in reduced exponent range.
+tests/tsin_cos.c: added overflowed_sin_cos0 test.
+
+------------------------------------------------------------------------
+r4567 | vlefevre | 2007-06-21 14:32:14 +0000 (Thu, 21 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: Some functions do not use MPFR_SAVE_EXPO_* macros, thus do not
+behave correctly in a reduced exponent range.
+
+------------------------------------------------------------------------
+r4566 | vlefevre | 2007-06-21 14:28:13 +0000 (Thu, 21 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/factorial.c
+ M /trunk/tests/tfactorial.c
+
+factorial.c: a rounding mode was incorrect.
+tests/tfactorial.c: added overflowed_fac0 test.
+
+------------------------------------------------------------------------
+r4565 | vlefevre | 2007-06-21 14:16:17 +0000 (Thu, 21 Jun 2007) | 5 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+exp2.c: use MPFR_SMALL_INPUT_AFTER_SAVE_EXPO instead of
+MPFR_FAST_COMPUTE_IF_SMALL_INPUT since 1 (__gmpfr_one) isn't
+necessarily representable.
+tests/texp2.c: added overflowed_exp2_0 test.
+
+------------------------------------------------------------------------
+r4564 | vlefevre | 2007-06-21 13:59:38 +0000 (Thu, 21 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/tests/texp.c
+
+exp.c: fixed problems in reduced exponent range.
+tests/texp.c: added overflowed_exp0 test.
+
+------------------------------------------------------------------------
+r4563 | vlefevre | 2007-06-21 13:43:03 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+exp.c bug fix: a rounding mode was incorrect.
+
+------------------------------------------------------------------------
+r4562 | vlefevre | 2007-06-21 13:40:55 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+tcos.c: fixed error message in overflowed_cos0 test.
+
+------------------------------------------------------------------------
+r4561 | vlefevre | 2007-06-21 13:38:44 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+tcos.c: removed an obsolete comment from the overflowed_cos0 test.
+
+------------------------------------------------------------------------
+r4560 | vlefevre | 2007-06-21 13:35:45 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+tcos.c: improved overflowed_cos0 test.
+
+------------------------------------------------------------------------
+r4559 | vlefevre | 2007-06-21 12:49:03 +0000 (Thu, 21 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/tests/tget_str.c
+
+get_str.c: use MPFR_SAVE_EXPO.
+tests/tget_str.c: enabled the test with a reduced exponent range.
+
+------------------------------------------------------------------------
+r4558 | vlefevre | 2007-06-21 12:13:06 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+tget_str.c: added a test (disabled by default) with emax = 0.
+
+------------------------------------------------------------------------
+r4557 | vlefevre | 2007-06-21 11:53:16 +0000 (Thu, 21 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/mul.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+Corrected mpfr_inits, mpfr_inits2 and mpfr_clears calls with NULL
+argument (-> (void *) 0).
+
+------------------------------------------------------------------------
+r4556 | vlefevre | 2007-06-21 11:38:33 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+tget_str.c: reformatted/corrected a function.
+
+------------------------------------------------------------------------
+r4555 | vlefevre | 2007-06-21 11:30:38 +0000 (Thu, 21 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/ttanh.c
+
+Tests: when restoring the exponent range, save emin/emax first instead
+of using MPFR_EMIN_MIN/MPFR_EMAX_MAX (which have no longer corresponded
+to the default exponent range since quite a long time).
+
+------------------------------------------------------------------------
+r4554 | vlefevre | 2007-06-21 11:01:46 +0000 (Thu, 21 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: update.
+
+------------------------------------------------------------------------
+r4553 | vlefevre | 2007-06-20 13:22:49 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/atan.c
+ M /trunk/exp3.c
+ M /trunk/gen_inverse.h
+ M /trunk/jn.c
+ M /trunk/lngamma.c
+ M /trunk/mpfr.h
+ M /trunk/remquo.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sqr.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tremquo.c
+ M /trunk/tests/tyn.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/zeta_ui.c
+
+Untabified and removed trailing spaces.
+
+------------------------------------------------------------------------
+r4552 | vlefevre | 2007-06-20 13:12:41 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/generic.c
+ M /trunk/mpfr-gmp.h
+
+Bug fix: preprocessor # must be in the first column.
+
+------------------------------------------------------------------------
+r4551 | vlefevre | 2007-06-20 12:29:26 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/remquo.c
+
+remquo.c bug fix: preprocessor # must be in the first column.
+
+------------------------------------------------------------------------
+r4550 | vlefevre | 2007-06-20 11:58:25 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+tcos.c: fixed and improved the overflowed_cos0 test.
+
+------------------------------------------------------------------------
+r4549 | vlefevre | 2007-06-20 11:38:47 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+cos.c bug fix: a rounding mode was incorrect.
+
+------------------------------------------------------------------------
+r4548 | vlefevre | 2007-06-20 11:32:56 +0000 (Wed, 20 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+
+cos.c: use MPFR_SMALL_INPUT_AFTER_SAVE_EXPO instead of
+MPFR_FAST_COMPUTE_IF_SMALL_INPUT.
+
+------------------------------------------------------------------------
+r4547 | vlefevre | 2007-06-20 11:27:41 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+cos.c: untabified.
+
+------------------------------------------------------------------------
+r4546 | vlefevre | 2007-06-20 10:55:52 +0000 (Wed, 20 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+tcos.c: added tests for x very small and emax = 0 (some of them
+currently fail).
+
+------------------------------------------------------------------------
+r4545 | vlefevre | 2007-06-20 10:06:56 +0000 (Wed, 20 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Added a comment concerning the MPFR_SMALL_INPUT_AFTER_SAVE_EXPO macro.
+
+------------------------------------------------------------------------
+r4544 | vlefevre | 2007-06-20 10:03:03 +0000 (Wed, 20 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/expm1.c
+ M /trunk/mpfr-impl.h
+
+Added MPFR_SMALL_INPUT_AFTER_SAVE_EXPO macro; updated expm1.c to use
+this variant (and moved MPFR_SAVE_EXPO_MARK after the test ex < 0).
+
+------------------------------------------------------------------------
+r4543 | vlefevre | 2007-06-19 15:17:21 +0000 (Tue, 19 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Documented log(-0).
+
+------------------------------------------------------------------------
+r4542 | vlefevre | 2007-06-19 15:11:21 +0000 (Tue, 19 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+
+Added a few tests of log functions.
+
+------------------------------------------------------------------------
+r4541 | vlefevre | 2007-06-18 13:01:03 +0000 (Mon, 18 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated Section "Floating-Point Values on Special Numbers".
+
+------------------------------------------------------------------------
+r4540 | vlefevre | 2007-06-12 10:54:06 +0000 (Tue, 12 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: allow generic tests to run with a restricted exponent range.
+
+------------------------------------------------------------------------
+r4539 | vlefevre | 2007-06-12 10:51:17 +0000 (Tue, 12 Jun 2007) | 4 lines
+Changed paths:
+ M /trunk/expm1.c
+
+expm1.c: fixed bug for x = -max_value due to an intermediate overflow
+(flags were incorrect); at the same time, potential problems due to a
+restricted exponent range are also fixed.
+
+------------------------------------------------------------------------
+r4538 | vlefevre | 2007-06-12 09:17:33 +0000 (Tue, 12 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: check the function on large arguments (±maximum_value)
+when the MPFR_CHECK_MAX environment variable is defined.
+
+------------------------------------------------------------------------
+r4537 | vlefevre | 2007-06-11 13:40:14 +0000 (Mon, 11 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tlgamma.c
+
+tests/tlgamma.c: re-enabled sign checking.
+
+------------------------------------------------------------------------
+r4536 | zimmerma | 2007-06-11 09:30:08 +0000 (Mon, 11 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlgamma.c
+
+fixed problem with mpfr_lgamma for tiny negative input (and fixed use of
+generic test)
+
+------------------------------------------------------------------------
+r4535 | vlefevre | 2007-06-05 20:50:07 +0000 (Tue, 05 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+[mpfr.texi] Small change in new Section "Floating-Point Values on
+Special Numbers" (suggested by Paul).
+
+------------------------------------------------------------------------
+r4534 | zimmerma | 2007-06-05 19:41:43 +0000 (Tue, 05 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+fixed bug for tiny negative input (and added corresponding test)
+
+------------------------------------------------------------------------
+r4533 | vlefevre | 2007-06-05 11:06:57 +0000 (Tue, 05 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: Mulder -> Mulders.
+
+------------------------------------------------------------------------
+r4532 | zimmerma | 2007-06-04 11:26:10 +0000 (Mon, 04 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added test for "Witty's bug" on 64-bit machines
+
+------------------------------------------------------------------------
+r4531 | vlefevre | 2007-06-04 11:19:33 +0000 (Mon, 04 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+div.c: GNU coding style.
+
+------------------------------------------------------------------------
+r4530 | zimmerma | 2007-06-04 11:04:30 +0000 (Mon, 04 Jun 2007) | 3 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/tests/tdiv.c
+
+tdiv.c: added missing mpfr_clear's, and spaces before function calls
+div.c: fixed bug found by Carl Witty, and added more comments
+
+------------------------------------------------------------------------
+r4529 | vlefevre | 2007-06-04 10:55:47 +0000 (Mon, 04 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+tdiv.c: oops... the result should be 1.
+
+------------------------------------------------------------------------
+r4528 | vlefevre | 2007-06-04 10:50:42 +0000 (Mon, 04 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+tdiv.c: added test from Carl Witty's bug report on 2007-06-03.
+
+------------------------------------------------------------------------
+r4527 | vlefevre | 2007-06-01 13:48:35 +0000 (Fri, 01 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated Section "Floating-Point Values on Special Numbers".
+
+------------------------------------------------------------------------
+r4526 | vlefevre | 2007-06-01 13:31:14 +0000 (Fri, 01 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated Section "Floating-Point Values on Special Numbers".
+
+------------------------------------------------------------------------
+r4525 | vlefevre | 2007-06-01 13:29:33 +0000 (Fri, 01 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated month.
+
+------------------------------------------------------------------------
+r4524 | vlefevre | 2007-06-01 13:01:20 +0000 (Fri, 01 Jun 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added @: after "resp." (when it was missing).
+
+------------------------------------------------------------------------
+r4523 | vlefevre | 2007-05-31 15:51:37 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Started a new section "Floating-Point Values on Special Numbers".
+
+------------------------------------------------------------------------
+r4522 | vlefevre | 2007-05-31 15:47:00 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: inf -> Inf for consistency.
+
+------------------------------------------------------------------------
+r4521 | vlefevre | 2007-05-31 15:05:19 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi @deftypefun correction: void * -> {void *} (for the PDF).
+
+------------------------------------------------------------------------
+r4520 | vlefevre | 2007-05-31 15:02:11 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: consistency changes in section titles; made titles unique.
+
+------------------------------------------------------------------------
+r4519 | vlefevre | 2007-05-31 12:16:06 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/set_d64.c
+
+set_d64.c: replaced an "if" by a "#if" to avoid a gcc warning.
+
+------------------------------------------------------------------------
+r4518 | vlefevre | 2007-05-31 12:11:03 +0000 (Thu, 31 May 2007) | 4 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+
+get_d64.c: use BITS_PER_MP_LIMB instead of GMP_BITS_PER_LIMB (which
+does not seem to exist).
+set_d64.c: use BITS_PER_MP_LIMB instead of mp_bits_per_limb.
+
+------------------------------------------------------------------------
+r4517 | vlefevre | 2007-05-31 11:50:08 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+
+get_d64.c, set_d64.c: improved code to avoid some warnings.
+
+------------------------------------------------------------------------
+r4516 | vlefevre | 2007-05-31 11:39:23 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+
+Untabified get_d64.c and set_d64.c.
+
+------------------------------------------------------------------------
+r4515 | vlefevre | 2007-05-31 11:33:55 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+
+get_d64.c: added missing #include.
+
+------------------------------------------------------------------------
+r4514 | vlefevre | 2007-05-31 09:20:43 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: update.
+
+------------------------------------------------------------------------
+r4513 | vlefevre | 2007-05-31 09:16:38 +0000 (Thu, 31 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: improved error message when thread safe is not supported.
+
+------------------------------------------------------------------------
+r4512 | vlefevre | 2007-05-30 15:27:10 +0000 (Wed, 30 May 2007) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: say that relative paths in configure options are not supported
+(autoconf doesn't seem to have support for them).
+
+------------------------------------------------------------------------
+r4511 | vlefevre | 2007-05-30 12:04:22 +0000 (Wed, 30 May 2007) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.texi
+ M /trunk/tests/tsgn.c
+
+Documented the new behavior of mpfr_sgn (in fact, it was already partly
+required by the tsgn.c tests!) and added new mpfr_sgn tests.
+
+------------------------------------------------------------------------
+r4510 | vlefevre | 2007-05-30 11:21:32 +0000 (Wed, 30 May 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: added an item about the behavior of mpfr_sgn on NaN.
+
+------------------------------------------------------------------------
+r4509 | vlefevre | 2007-05-30 11:13:23 +0000 (Wed, 30 May 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: no longer check the MPFR_CHECK_TINY environment variable
+as all the bugs related to tiny arguments have been fixed.
+
+------------------------------------------------------------------------
+r4508 | vlefevre | 2007-05-30 10:17:09 +0000 (Wed, 30 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: corrections following the remarks by Nathalie Revol.
+
+------------------------------------------------------------------------
+r4507 | vlefevre | 2007-05-29 23:11:06 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/yn.c
+
+yn.c: untabify.
+
+------------------------------------------------------------------------
+r4506 | zimmerma | 2007-05-29 22:02:35 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/yn.c
+
+fix for small inputs in y1
+
+------------------------------------------------------------------------
+r4505 | vlefevre | 2007-05-29 21:31:22 +0000 (Tue, 29 May 2007) | 4 lines
+Changed paths:
+ M /trunk/erf.c
+ M /trunk/lngamma.c
+ M /trunk/mpfr-impl.h
+
+Defined new macros SIGN and SAME_SIGN in mpfr-impl.h to canonicalize
+the ternary value and to compare such values. Use SAME_SIGN in erf.c
+and lngamma.c.
+
+------------------------------------------------------------------------
+r4504 | zimmerma | 2007-05-29 21:04:57 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/yn.c
+
+fixed problem of tiny arguments for y0
+
+------------------------------------------------------------------------
+r4503 | zimmerma | 2007-05-29 16:44:02 +0000 (Tue, 29 May 2007) | 4 lines
+Changed paths:
+ M /trunk/erf.c
+ M /trunk/lngamma.c
+
+lngamma.c: fixed problem of tiny inputs in lngamma (still remains lgamma
+ to deal with)
+erf.c: small correction (inexact flags might have been inexact :-)
+
+------------------------------------------------------------------------
+r4502 | zimmerma | 2007-05-29 12:24:20 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/csch.c
+ M /trunk/jn.c
+
+fixed tiny input problem with csch, j0, j1
+
+------------------------------------------------------------------------
+r4501 | zimmerma | 2007-05-29 10:09:00 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/cot.c
+
+added special code for tiny inputs
+
+------------------------------------------------------------------------
+r4500 | vlefevre | 2007-05-29 09:52:12 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric_ui.c
+
+tgeneric_ui.c: no longer check the MPFR_CHECK_TINY environment variable.
+
+------------------------------------------------------------------------
+r4499 | vlefevre | 2007-05-29 09:33:56 +0000 (Tue, 29 May 2007) | 2 lines
+Changed paths:
+ M /trunk/erf.c
+
+erf.c: removed workaround to mpfr_div_ui bug, as the bug is now fixed.
+
+------------------------------------------------------------------------
+r4498 | vlefevre | 2007-05-29 09:29:02 +0000 (Tue, 29 May 2007) | 5 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+div_ui.c:
+ * Cleaned up the use of the sh variable (there was a useless sh = 0,
+ so I'm not sure that there isn't a bug...).
+ * Added underflow check.
+
+------------------------------------------------------------------------
+r4497 | vlefevre | 2007-05-29 08:48:49 +0000 (Tue, 29 May 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tgeneric_ui.c
+
+Added check of tiny arguments to tgeneric_ui.c (if MPFR_CHECK_TINY is
+defined, like in tgeneric.c); mpfr_div_ui currently fails due to the
+lack of underflow checking.
+
+------------------------------------------------------------------------
+r4496 | zimmerma | 2007-05-29 08:12:30 +0000 (Tue, 29 May 2007) | 5 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/erf.c
+
+README.dev: fixed typo
+erf.c: implemented special case for tiny x, and partially get rid of double
+ usage
+implemented
+
+------------------------------------------------------------------------
+r4495 | vlefevre | 2007-05-28 23:11:56 +0000 (Mon, 28 May 2007) | 4 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/cos.c
+ M /trunk/exp2.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/sinh.c
+
+MPFR_RET (mpfr_check_range (...)) -> return mpfr_check_range (...)
+as mpfr_check_range already handles the inexact flag.
+Reformatting (removed trailing spaces, untabified).
+
+------------------------------------------------------------------------
+r4494 | zimmerma | 2007-05-28 21:51:11 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/sech.c
+
+fixed problem of tiny input
+
+------------------------------------------------------------------------
+r4493 | zimmerma | 2007-05-28 21:44:37 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/csc.c
+
+fixed problem of tiny input for coth (and new fix again for csc, which
+takes into account the sign of the input)
+
+------------------------------------------------------------------------
+r4492 | zimmerma | 2007-05-28 21:23:23 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/csc.c
+ M /trunk/gen_inverse.h
+ M /trunk/sec.c
+
+fixed problem of tiny inputs in mpfr_sec and mpfr_csc,
+by adding a SPECIAL_TINY macro in gen_inverse.h
+
+------------------------------------------------------------------------
+r4491 | zimmerma | 2007-05-28 20:56:41 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+the test for the tiny input case was too optimistic: fixed and added test.
+
+------------------------------------------------------------------------
+r4490 | zimmerma | 2007-05-28 20:24:23 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+fixed case of tiny input
+
+------------------------------------------------------------------------
+r4489 | zimmerma | 2007-05-28 19:54:27 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+fixed problem for tiny arguments
+
+------------------------------------------------------------------------
+r4488 | zimmerma | 2007-05-28 18:33:26 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/cosh.c
+
+added MPFR_FAST_COMPUTE_IF_SMALL_INPUT call
+
+------------------------------------------------------------------------
+r4487 | zimmerma | 2007-05-28 18:19:08 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/round_near_x.c
+
+changed 1st-order Taylor term from x to v to avoid confusion with the
+argument x of the function f(x), and fixed some typos
+
+------------------------------------------------------------------------
+r4486 | zimmerma | 2007-05-28 17:15:11 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+
+fixed direction of rounding for MPFR_FAST_COMPUTE_IF_SMALL_INPUT
+(was wrong for x < 0)
+
+------------------------------------------------------------------------
+r4485 | zimmerma | 2007-05-28 17:02:57 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+fixed typo
+
+------------------------------------------------------------------------
+r4484 | zimmerma | 2007-05-28 16:19:06 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+added call to MPFR_FAST_COMPUTE_IF_SMALL_INPUT in exp2
+
+------------------------------------------------------------------------
+r4483 | zimmerma | 2007-05-28 15:51:00 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+re-enabled MPFR_CHECK_TINY
+
+------------------------------------------------------------------------
+r4482 | zimmerma | 2007-05-28 15:34:10 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr.texi
+
+improved documentation of mpfr_set/get_decimal64 functions
+fixed problem in configure.in (_Decimal64 was tested too early)
+
+------------------------------------------------------------------------
+r4481 | vlefevre | 2007-05-28 15:17:44 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: fixed two bugs concerning the timeout (including an
+old one: we need to call getrlimit to initialize rlim_max).
+
+------------------------------------------------------------------------
+r4480 | zimmerma | 2007-05-28 15:07:05 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+new syntax for timeouts
+
+------------------------------------------------------------------------
+r4479 | zimmerma | 2007-05-28 15:06:30 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+fixed typo
+
+------------------------------------------------------------------------
+r4478 | vlefevre | 2007-05-28 13:57:32 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk
+
+Added mkinstalldirs to svn:ignore property.
+
+------------------------------------------------------------------------
+r4477 | vlefevre | 2007-05-28 13:56:33 +0000 (Mon, 28 May 2007) | 5 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/tests/tests.c
+
+Changed --with-tests-timeout into --enable-tests-timeout as documented
+in the autoconf manual (--with-* are for external packages only). When
+this is enabled, environment variable MPFR_TESTS_TIMEOUT allows to
+override the default timeout (use the value 0 to disable timeouts).
+
+------------------------------------------------------------------------
+r4476 | vlefevre | 2007-05-28 11:29:45 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Updated NEWS file.
+
+------------------------------------------------------------------------
+r4475 | vlefevre | 2007-05-28 11:04:00 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: small improvement.
+
+------------------------------------------------------------------------
+r4474 | vlefevre | 2007-05-28 10:37:07 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/sgn.c
+ M /trunk/tests/tcmp_ui.c
+
+Fixed a bug in the mpfr_cmp_ui macro occurring on NaN and the constant 0
+by specifying the behavior of mpfr_sgn on NaN.
+
+------------------------------------------------------------------------
+r4473 | vlefevre | 2007-05-28 09:26:07 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: typography corrections concerning "i.e.".
+
+------------------------------------------------------------------------
+r4472 | vlefevre | 2007-05-28 09:17:37 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: consistency changes.
+
+------------------------------------------------------------------------
+r4471 | vlefevre | 2007-05-28 09:11:39 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: more details in Section "Exceptions".
+
+------------------------------------------------------------------------
+r4470 | vlefevre | 2007-05-28 02:12:05 +0000 (Mon, 28 May 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+tgeneric.c: check the function on tiny arguments (±2^(emin-1)) when
+the MPFR_CHECK_TINY environment variable is defined.
+
+------------------------------------------------------------------------
+r4469 | vlefevre | 2007-05-28 00:54:09 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Typo.
+
+------------------------------------------------------------------------
+r4468 | vlefevre | 2007-05-28 00:27:16 +0000 (Mon, 28 May 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cos.c
+ M /trunk/erfc.c
+ M /trunk/expm1.c
+ M /trunk/log1p.c
+ M /trunk/mpfr-impl.h
+ M /trunk/round_near_x.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/zeta.c
+
+Avoid integer overflow in MPFR_FAST_COMPUTE_IF_SMALL_INPUT.
+
+------------------------------------------------------------------------
+r4467 | zimmerma | 2007-05-25 21:03:43 +0000 (Fri, 25 May 2007) | 3 lines
+Changed paths:
+ M /trunk/remquo.c
+ M /trunk/tests/tremquo.c
+
+completed implementation of Vincent's algorithm for mpfr_remquo
+all tests now pass again
+
+------------------------------------------------------------------------
+r4466 | zimmerma | 2007-05-24 21:45:25 +0000 (Thu, 24 May 2007) | 3 lines
+Changed paths:
+ M /trunk/remquo.c
+
+new version of mpfr_remainder, using Vincent's algorithm
+(still remains to deal with special arguments, and make mpfr_remquo call it)
+
+------------------------------------------------------------------------
+r4465 | zimmerma | 2007-05-23 22:09:57 +0000 (Wed, 23 May 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added note about fms
+
+------------------------------------------------------------------------
+r4464 | zimmerma | 2007-05-23 21:55:55 +0000 (Wed, 23 May 2007) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fixed typo
+
+------------------------------------------------------------------------
+r4463 | zimmerma | 2007-05-23 21:26:14 +0000 (Wed, 23 May 2007) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed problem for x integer and rounding to nearest
+
+------------------------------------------------------------------------
+r4462 | zimmerma | 2007-05-23 18:33:35 +0000 (Wed, 23 May 2007) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+workaround for bug when x is very small (check_tiny in tsin)
+
+------------------------------------------------------------------------
+r4461 | vlefevre | 2007-05-22 12:06:00 +0000 (Tue, 22 May 2007) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Updated BUGS (again).
+
+------------------------------------------------------------------------
+r4460 | vlefevre | 2007-05-22 11:50:06 +0000 (Tue, 22 May 2007) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/TODO
+
+Updated BUGS and TODO (mpfr_lgamma has been implemented, but see BUGS,
+and gamma(-integer) with integer >= 1 is defined as NaN).
+
+------------------------------------------------------------------------
+r4459 | vlefevre | 2007-05-22 08:41:00 +0000 (Tue, 22 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+tsin.c: check sin on +/- 2^(emin-1) (test by Christopher Creutzig).
+
+------------------------------------------------------------------------
+r4458 | vlefevre | 2007-05-22 08:25:20 +0000 (Tue, 22 May 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+tgamma.c: added test of gamma on some integral values (from Christopher
+Creutzig); this test is enabled only when an argument is provided.
+
+------------------------------------------------------------------------
+r4457 | vlefevre | 2007-05-22 00:29:16 +0000 (Tue, 22 May 2007) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: improved comments and simplified the code.
+
+------------------------------------------------------------------------
+r4456 | vlefevre | 2007-05-22 00:11:18 +0000 (Tue, 22 May 2007) | 5 lines
+Changed paths:
+ M /trunk/fma.c
+
+fma.c: implemented exponent range expansion and the main part when the
+multiplication overflows. The following remains to do:
+ * when the multiplication overflows: some corner cases;
+ * when the multiplication underflows: everything.
+
+------------------------------------------------------------------------
+r4455 | vlefevre | 2007-05-21 11:52:33 +0000 (Mon, 21 May 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tlgamma.c
+
+tlgamma.c: I re-enable the generic tests of mpfr_lgamma now, to make
+sure that it is fixed before the 2.3.0 release candidate.
+
+------------------------------------------------------------------------
+r4454 | vlefevre | 2007-05-21 11:49:41 +0000 (Mon, 21 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: added an overflow test (currently fails).
+
+------------------------------------------------------------------------
+r4453 | vlefevre | 2007-05-21 08:44:22 +0000 (Mon, 21 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: whitespace change.
+
+------------------------------------------------------------------------
+r4452 | vlefevre | 2007-05-21 08:43:41 +0000 (Mon, 21 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+tfma.c: added tests on special and exact values.
+
+------------------------------------------------------------------------
+r4451 | zimmerma | 2007-05-17 22:05:42 +0000 (Thu, 17 May 2007) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/lngamma.c
+
+fixed error analysis in mpfr_lngamma
+added mpfr_inp_raw/mpfr_out_raw in TODO
+
+------------------------------------------------------------------------
+r4450 | vlefevre | 2007-05-16 14:52:57 +0000 (Wed, 16 May 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: fixed mpfr_fms formula to match the one on Itanium and PowerPC.
+
+------------------------------------------------------------------------
+r4449 | vlefevre | 2007-05-07 09:01:39 +0000 (Mon, 07 May 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: improved the description of mpfr_remquo.
+
+------------------------------------------------------------------------
+r4448 | zimmerma | 2007-05-06 13:25:55 +0000 (Sun, 06 May 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+improved description of remainder and remquo
+
+------------------------------------------------------------------------
+r4447 | vlefevre | 2007-05-06 11:16:12 +0000 (Sun, 06 May 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+My latest change was not completely correct...
+
+------------------------------------------------------------------------
+r4446 | vlefevre | 2007-05-06 11:13:41 +0000 (Sun, 06 May 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+Updated description of algorithm for mpfr_remainder.
+
+------------------------------------------------------------------------
+r4445 | zimmerma | 2007-05-06 08:18:50 +0000 (Sun, 06 May 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added description of algorithm for mpfr_remainder
+
+------------------------------------------------------------------------
+r4444 | vlefevre | 2007-05-04 14:25:31 +0000 (Fri, 04 May 2007) | 2 lines
+Changed paths:
+ M /trunk/remquo.c
+
+remquo.c: suggest to use mpz_powm.
+
+------------------------------------------------------------------------
+r4443 | vlefevre | 2007-05-04 13:19:27 +0000 (Fri, 04 May 2007) | 3 lines
+Changed paths:
+ M /trunk/remquo.c
+
+remquo.c: added a comment (idea to compute the remainder much more
+efficiently in the case x much larger than y).
+
+------------------------------------------------------------------------
+r4442 | zimmerma | 2007-05-04 12:45:36 +0000 (Fri, 04 May 2007) | 2 lines
+Changed paths:
+ M /trunk/remquo.c
+
+added assert and ideas for native implementation
+
+------------------------------------------------------------------------
+r4441 | zimmerma | 2007-05-04 06:27:38 +0000 (Fri, 04 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tremquo.c
+
+put back test (disabled for test)
+
+------------------------------------------------------------------------
+r4440 | zimmerma | 2007-05-04 06:26:56 +0000 (Fri, 04 May 2007) | 2 lines
+Changed paths:
+ M /trunk/remquo.c
+ M /trunk/tests/tremquo.c
+
+fixed problem when rem and x are the same variable
+
+------------------------------------------------------------------------
+r4439 | vlefevre | 2007-05-04 00:36:01 +0000 (Fri, 04 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tremquo.c
+
+tremquo.c: added a test that leads to a segmentation fault.
+
+------------------------------------------------------------------------
+r4438 | vlefevre | 2007-05-04 00:29:47 +0000 (Fri, 04 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tremquo.c
+
+tremquo.c: fixed tests (= -> ==).
+
+------------------------------------------------------------------------
+r4437 | zimmerma | 2007-05-03 20:07:20 +0000 (Thu, 03 May 2007) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/remquo.c
+ M /trunk/tests/tremquo.c
+
+fixed two issues found by Kaveh Ghazi:
+* remainder was wrong for |x/y| < 1
+* remainder had wrong sign when zero
+
+------------------------------------------------------------------------
+r4436 | zimmerma | 2007-05-03 15:56:03 +0000 (Thu, 03 May 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+more details of error analysis
+
+------------------------------------------------------------------------
+r4435 | vlefevre | 2007-05-03 13:30:34 +0000 (Thu, 03 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+Updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4434 | vlefevre | 2007-05-03 13:28:31 +0000 (Thu, 03 May 2007) | 2 lines
+Changed paths:
+ M /trunk
+
+Updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4433 | zimmerma | 2007-05-03 13:16:34 +0000 (Thu, 03 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tremquo.c
+
+fixed precision for command-line usage
+
+------------------------------------------------------------------------
+r4432 | vlefevre | 2007-05-03 13:15:49 +0000 (Thu, 03 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added mpfr_lgamma.
+
+------------------------------------------------------------------------
+r4431 | zimmerma | 2007-05-03 13:10:31 +0000 (Thu, 03 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tremquo.c
+
+added code to use tremquo with command-line arguments (tremquo x y)
+
+------------------------------------------------------------------------
+r4430 | vlefevre | 2007-05-02 16:03:52 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: improved comment.
+
+------------------------------------------------------------------------
+r4429 | vlefevre | 2007-05-02 15:52:51 +0000 (Wed, 02 May 2007) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: added a comment on the AC_ARG_ENABLE(decimal-float...)
+part. The addition of this code was the cause of the test_CFLAGS problem
+(see r4425 log), but this code is still wrong.
+
+------------------------------------------------------------------------
+r4428 | zimmerma | 2007-05-02 15:41:18 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tremquo.c
+
+modified test (2147483648 is not representable as 32-bit long in C90)
+
+------------------------------------------------------------------------
+r4427 | vlefevre | 2007-05-02 15:20:50 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/remquo.c
+ M /trunk/yn.c
+
+Removed unused variables.
+
+------------------------------------------------------------------------
+r4426 | vlefevre | 2007-05-02 15:18:18 +0000 (Wed, 02 May 2007) | 4 lines
+Changed paths:
+ M /trunk/get_str.c
+
+get_str.c:
+ * Removed useless prototype declaration (function no longer defined).
+ * Fixed initializer.
+
+------------------------------------------------------------------------
+r4425 | vlefevre | 2007-05-02 15:14:44 +0000 (Wed, 02 May 2007) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: moved the definition of test_CFLAGS upward (it was
+always set to "set", either because of things added to configure.in
+or because of new autoconf).
+
+------------------------------------------------------------------------
+r4424 | vlefevre | 2007-05-02 14:54:47 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr.h: added mpfr_lgamma prototype.
+
+------------------------------------------------------------------------
+r4423 | zimmerma | 2007-05-02 14:23:11 +0000 (Wed, 02 May 2007) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/remquo.c
+ M /trunk/tests/tremquo.c
+
+argument quo of remquo is now a pointer to long instead of int
+added new functions in NEWS
+
+------------------------------------------------------------------------
+r4422 | zimmerma | 2007-05-02 12:21:24 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/remquo.c
+ M /trunk/tests/tremquo.c
+
+changed order of arguments: now mpfr_remquo (r, q, x, y, rnd).
+
+------------------------------------------------------------------------
+r4421 | vlefevre | 2007-05-02 11:53:58 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/remquo.c
+
+remquo.c: fixed variable name for MPFR_LOG_FUNC.
+
+------------------------------------------------------------------------
+r4420 | zimmerma | 2007-05-02 10:12:11 +0000 (Wed, 02 May 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/remquo.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tremquo.c
+
+added mpfr_remquo and mpfr_remainder
+
+------------------------------------------------------------------------
+r4419 | zimmerma | 2007-04-27 12:48:01 +0000 (Fri, 27 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+fixed error analysis (error was over-estimated)
+
+------------------------------------------------------------------------
+r4418 | vlefevre | 2007-04-26 10:12:51 +0000 (Thu, 26 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+lngamma.c: a bit more details in the error analysis for z0 < 1.
+
+------------------------------------------------------------------------
+r4417 | vlefevre | 2007-04-26 09:20:37 +0000 (Thu, 26 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+lngamma.c: a bit more details in the error analysis for z0 < 1.
+
+------------------------------------------------------------------------
+r4416 | zimmerma | 2007-04-26 08:26:39 +0000 (Thu, 26 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+u was used for two different meanings in the error analysis for z0 < 1
+
+------------------------------------------------------------------------
+r4415 | vlefevre | 2007-04-25 12:52:09 +0000 (Wed, 25 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/jn.c
+ M /trunk/set_d64.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+ M /trunk/tests/tjn.c
+ M /trunk/tests/ty0.c
+ M /trunk/tests/ty1.c
+ M /trunk/tests/tyn.c
+ M /trunk/yn.c
+
+Updated Subversion properties on .c files (now consistent).
+
+------------------------------------------------------------------------
+r4414 | vlefevre | 2007-04-25 12:49:47 +0000 (Wed, 25 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+Updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4413 | vlefevre | 2007-04-25 12:48:05 +0000 (Wed, 25 Apr 2007) | 4 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tlgamma.c
+ M /trunk/tests/tlngamma.c
+
+Added preliminary support for mpfr_lngamma and tests.
+TODO: add support for negative numbers with small exponent.
+Re-enable the generic tests when this is done.
+
+------------------------------------------------------------------------
+r4412 | vlefevre | 2007-04-25 10:58:14 +0000 (Wed, 25 Apr 2007) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+lngamma.c: There was an assertion failed, probably because the error
+was too large; fixed that by restarting with a larger precision.
+
+------------------------------------------------------------------------
+r4411 | vlefevre | 2007-04-25 10:51:03 +0000 (Wed, 25 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+lngamma.c: fixed -2k-1 <= x <= -2k test.
+
+------------------------------------------------------------------------
+r4410 | vlefevre | 2007-04-25 09:07:03 +0000 (Wed, 25 Apr 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tlngamma.c
+
+tests/tlngamma.c: added a test showing a bug in lngamma (due to the
+use of mpfr_get_si even when the number doesn't fit in a long).
+
+------------------------------------------------------------------------
+r4409 | zimmerma | 2007-04-22 08:58:35 +0000 (Sun, 22 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+ M /trunk/tests/tjn.c
+
+fixed bug for negative even index in mpfr_jn (wrong sign)
+
+------------------------------------------------------------------------
+r4408 | zimmerma | 2007-04-12 12:16:04 +0000 (Thu, 12 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added warning
+
+------------------------------------------------------------------------
+r4407 | zimmerma | 2007-04-12 08:24:19 +0000 (Thu, 12 Apr 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added Bit Twiddling Hacks
+
+------------------------------------------------------------------------
+r4406 | vlefevre | 2007-04-05 12:01:07 +0000 (Thu, 05 Apr 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+MPFR manual: added a brief description of mpfr_t (this may be needed
+to write correct code) and mpfr_ptr (used by mpfr_sum).
+
+------------------------------------------------------------------------
+r4405 | vlefevre | 2007-04-02 15:32:00 +0000 (Mon, 02 Apr 2007) | 4 lines
+Changed paths:
+ M /trunk/jn.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tjn.c
+ M /trunk/tests/tyn.c
+ M /trunk/yn.c
+
+Changed mpfr_{jn,yn}_si (mpfr_t res, mpfr_t x, long n, ...) into
+mpfr_{jn,yn} (mpfr_t res, long n, mpfr_t x, ...), as discussed by
+mail; fixed a typo in mpfr.texi in mpfr_{y0,y1,yn} description.
+
+------------------------------------------------------------------------
+r4404 | zimmerma | 2007-03-31 21:23:00 +0000 (Sat, 31 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added url of GSL manual
+
+------------------------------------------------------------------------
+r4403 | zimmerma | 2007-03-31 21:15:26 +0000 (Sat, 31 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+fixed misunderstanding about definition of Bessel functions
+
+------------------------------------------------------------------------
+r4402 | zimmerma | 2007-03-31 17:59:23 +0000 (Sat, 31 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed Bessel functions J_n and Y_n
+
+------------------------------------------------------------------------
+r4401 | zimmerma | 2007-03-31 14:01:00 +0000 (Sat, 31 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+ M /trunk/jn.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/ty0.c
+ A /trunk/tests/ty1.c
+ A /trunk/tests/tyn.c
+ A /trunk/yn.c
+
+added Bessel functions of second kind (y0, y1, yn_si)
+
+------------------------------------------------------------------------
+r4400 | zimmerma | 2007-03-31 13:55:06 +0000 (Sat, 31 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tj0.c
+ M /trunk/tests/tj1.c
+
+now test_generic calls respectively j0 and j1, not zeta!
+
+------------------------------------------------------------------------
+r4399 | vlefevre | 2007-03-30 14:35:56 +0000 (Fri, 30 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: INF -> Inf for consistency.
+
+------------------------------------------------------------------------
+r4398 | vlefevre | 2007-03-30 14:34:00 +0000 (Fri, 30 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: PI -> Pi for consistency.
+
+------------------------------------------------------------------------
+r4397 | vlefevre | 2007-03-29 02:33:02 +0000 (Thu, 29 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: -0 -> @minus{}0.
+
+------------------------------------------------------------------------
+r4396 | vlefevre | 2007-03-29 02:28:46 +0000 (Thu, 29 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: fixed bug introduced in rev 4377, which made TeX fail.
+
+------------------------------------------------------------------------
+r4395 | vlefevre | 2007-03-29 02:00:04 +0000 (Thu, 29 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+Added tj0, tj1 and tjn to svn:ignore property of "tests" directory.
+
+------------------------------------------------------------------------
+r4393 | zimmerma | 2007-03-26 09:29:40 +0000 (Mon, 26 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+
+mpfr_jn -> mpfr_jn_si
+
+------------------------------------------------------------------------
+r4392 | zimmerma | 2007-03-23 20:30:20 +0000 (Fri, 23 Mar 2007) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/jn.c
+ M /trunk/tests/tjn.c
+
+now check underflow for large n in mpfr_jn_si
+added more tests
+
+------------------------------------------------------------------------
+r4391 | zimmerma | 2007-03-23 16:37:16 +0000 (Fri, 23 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tjn.c
+
+added more tests (large values of n)
+
+------------------------------------------------------------------------
+r4390 | zimmerma | 2007-03-23 16:22:01 +0000 (Fri, 23 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/jn.c
+
+fixed another stupid bug
+
+------------------------------------------------------------------------
+r4389 | zimmerma | 2007-03-23 15:49:35 +0000 (Fri, 23 Mar 2007) | 3 lines
+Changed paths:
+ M /trunk/jn.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tjn.c
+
+mpfr_jn -> mpfr_jn_si, with 'int' argument changed to 'long'
+fixed bug in mpfr_jn_si (forgot to increase working precision)
+
+------------------------------------------------------------------------
+r4388 | vlefevre | 2007-03-23 15:47:17 +0000 (Fri, 23 Mar 2007) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a warning about the meaning of the output "inexact"
+value in the function logging code.
+
+------------------------------------------------------------------------
+r4387 | vlefevre | 2007-03-23 15:38:20 +0000 (Fri, 23 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/sub.c
+
+Added log support for mpfr_add and mpfr_sub.
+
+------------------------------------------------------------------------
+r4386 | lfousse | 2007-03-23 13:43:18 +0000 (Fri, 23 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+Correction: added missing $b_n$.
+
+------------------------------------------------------------------------
+r4385 | zimmerma | 2007-03-22 17:12:00 +0000 (Thu, 22 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/algorithms.tex
+ A /trunk/jn.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ A /trunk/tests/tj0.c
+ A /trunk/tests/tj1.c
+ A /trunk/tests/tjn.c
+
+added Bessel functions of first kind: j0, j1, jn
+
+------------------------------------------------------------------------
+r4384 | vlefevre | 2007-03-19 09:11:17 +0000 (Mon, 19 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+MPFR manual: improved description of mpfr_get_str.
+
+------------------------------------------------------------------------
+r4383 | zimmerma | 2007-03-19 07:43:16 +0000 (Mon, 19 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed typos in comments
+
+------------------------------------------------------------------------
+r4382 | zimmerma | 2007-03-18 20:16:15 +0000 (Sun, 18 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+documented restriction to n in mpfr_get_str
+
+------------------------------------------------------------------------
+r4380 | vlefevre | 2007-03-13 15:46:08 +0000 (Tue, 13 Mar 2007) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Updated INSTALL based on AIX/PowerPC tests and results from Julie Kurpa
+and information on <http://www.ess.uci.edu/esmf/FAQ.html#gcc-errors>.
+
+------------------------------------------------------------------------
+r4379 | vlefevre | 2007-03-03 01:55:32 +0000 (Sat, 03 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release" section.
+
+------------------------------------------------------------------------
+r4378 | vlefevre | 2007-03-02 11:16:59 +0000 (Fri, 02 Mar 2007) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Made modified paragraph on mpfr_get_str more correct from a logical
+point of view.
+
+------------------------------------------------------------------------
+r4377 | zimmerma | 2007-03-02 09:15:04 +0000 (Fri, 02 Mar 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+modified paragraph on mpfr_get_str (size of allocated string)
+
+------------------------------------------------------------------------
+r4376 | zimmerma | 2007-02-25 13:04:13 +0000 (Sun, 25 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added tentative implementation of fmod
+
+------------------------------------------------------------------------
+r4375 | zimmerma | 2007-02-20 02:58:16 +0000 (Tue, 20 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion about remquo
+
+------------------------------------------------------------------------
+r4374 | zimmerma | 2007-02-19 21:50:26 +0000 (Mon, 19 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added comment
+
+------------------------------------------------------------------------
+r4373 | zimmerma | 2007-02-19 21:43:23 +0000 (Mon, 19 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added C99 rationale for remquo
+
+------------------------------------------------------------------------
+r4372 | zimmerma | 2007-02-19 03:52:30 +0000 (Mon, 19 Feb 2007) | 3 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/algorithms.tex
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+ M /trunk/const_catalan.c
+ M /trunk/log1p.c
+
+fixed error in generic error for the logarithm, and propagated new bound
+in algorithms.tex and source files
+
+------------------------------------------------------------------------
+r4371 | zimmerma | 2007-02-18 20:10:20 +0000 (Sun, 18 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new item
+
+------------------------------------------------------------------------
+r4370 | vlefevre | 2007-02-15 23:35:25 +0000 (Thu, 15 Feb 2007) | 3 lines
+Changed paths:
+ A /trunk/update-patchv (from /branches/2.2/update-patchv:4367)
+
+Added update-patchv script to update some files before a patch is built
+(script from 2.2 branch).
+
+------------------------------------------------------------------------
+r4365 | vlefevre | 2007-02-14 09:31:19 +0000 (Wed, 14 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated paragraph on the underflow before/after rounding.
+
+------------------------------------------------------------------------
+r4364 | zimmerma | 2007-02-14 03:34:21 +0000 (Wed, 14 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added reference
+
+------------------------------------------------------------------------
+r4363 | vlefevre | 2007-02-12 16:34:21 +0000 (Mon, 12 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: added Exceptions section.
+
+------------------------------------------------------------------------
+r4361 | vlefevre | 2007-02-12 12:18:19 +0000 (Mon, 12 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated month.
+
+------------------------------------------------------------------------
+r4359 | vlefevre | 2007-02-12 12:04:14 +0000 (Mon, 12 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+Note that the mpfr.info file is now installed in the share subdirectory.
+
+------------------------------------------------------------------------
+r4358 | vlefevre | 2007-02-10 11:30:18 +0000 (Sat, 10 Feb 2007) | 4 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: removed comment since there are other <limits.h> macros
+in the file (and this is an old bug: the first one was introduced in
+rev 2783).
+
+------------------------------------------------------------------------
+r4357 | zimmerma | 2007-02-10 08:05:30 +0000 (Sat, 10 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added missing include
+
+------------------------------------------------------------------------
+r4356 | vlefevre | 2007-02-09 14:17:32 +0000 (Fri, 09 Feb 2007) | 3 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/tests/tpow.c
+
+Fixed an integer overflow in pow_si.c (detected with -ftrapv) and
+added a corresponding testcase in tests/tpow.c.
+
+------------------------------------------------------------------------
+r4355 | vlefevre | 2007-02-09 13:30:57 +0000 (Fri, 09 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: another comment about the overflow detection.
+
+------------------------------------------------------------------------
+r4354 | vlefevre | 2007-02-09 13:14:07 +0000 (Fri, 09 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: added the proof of overflow checking.
+
+------------------------------------------------------------------------
+r4353 | vlefevre | 2007-02-09 11:55:51 +0000 (Fri, 09 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: added a comment about the exponent limits for MPFR numbers.
+
+------------------------------------------------------------------------
+r4352 | vlefevre | 2007-02-08 15:47:13 +0000 (Thu, 08 Feb 2007) | 7 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/tests/tset_si.c
+
+Reimplemented mpfr_set_si_2exp and mpfr_set_ui_2exp, and mpfr_set_si
+and mpfr_set_ui using the 2exp versions with e = 0. This fixes a bug
+in corner cases (emin >= 4 and some other constraints) in mpfr_set_si
+and mpfr_set_ui that incorrectly lead to an underflow flag set, and
+fixes mpfr_set_si_2exp and mpfr_set_ui_2exp in case of overflow or
+underflow (replacing the r4346 fix). Added corresponding testcases.
+
+------------------------------------------------------------------------
+r4350 | vlefevre | 2007-02-07 01:48:01 +0000 (Wed, 07 Feb 2007) | 3 lines
+Changed paths:
+ M /trunk/abort_prec_max.c
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/zeta_ui.c
+
+Added "Contributed by the Arenaire and Cacao projects, INRIA." to the
+copyright notices and removed a few old things.
+
+------------------------------------------------------------------------
+r4347 | zimmerma | 2007-02-01 13:15:34 +0000 (Thu, 01 Feb 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added missing macro (thanks to Izhar Wallach <izharw@keddem.com>)
+
+------------------------------------------------------------------------
+r4346 | vlefevre | 2007-01-20 13:45:20 +0000 (Sat, 20 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/set_si_2exp.c
+
+Fixed mpfr_set_si_2exp in case of overflow or underflow.
+
+------------------------------------------------------------------------
+r4345 | vlefevre | 2007-01-19 08:31:32 +0000 (Fri, 19 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: fixed the overflow detection for x power of 2 and n negative.
+
+------------------------------------------------------------------------
+r4344 | vlefevre | 2007-01-19 07:24:26 +0000 (Fri, 19 Jan 2007) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+tests/tget_f.c: fixed a test that had an integer overflow (detected
+with -ftrapv).
+
+------------------------------------------------------------------------
+r4343 | vlefevre | 2007-01-19 07:07:10 +0000 (Fri, 19 Jan 2007) | 6 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: Before fixing the bug corresponding to the testcase added in
+rev 4342, let's fix another one that can be detected with -ftrapv when
+n = LONG_MIN (since -n is not representable in this case).
+With wrapping, we always got the correct result because mp_exp_t is
+currently at most a long *and* because of side effects!
+
+------------------------------------------------------------------------
+r4342 | vlefevre | 2007-01-19 06:51:13 +0000 (Fri, 19 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: added a test which fails (undetected integer overflow).
+
+------------------------------------------------------------------------
+r4341 | vlefevre | 2007-01-19 06:44:09 +0000 (Fri, 19 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: new test was wrong; fixed.
+
+------------------------------------------------------------------------
+r4340 | vlefevre | 2007-01-19 06:39:23 +0000 (Fri, 19 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: corrected tests and added another test.
+
+------------------------------------------------------------------------
+r4339 | vlefevre | 2007-01-19 05:10:16 +0000 (Fri, 19 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: added tests.
+
+------------------------------------------------------------------------
+r4338 | vlefevre | 2007-01-19 04:23:17 +0000 (Fri, 19 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+pow_si.c: added an assertion.
+
+------------------------------------------------------------------------
+r4337 | vlefevre | 2007-01-18 01:28:02 +0000 (Thu, 18 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: merged both requests for mpfr_sinh_cosh.
+
+------------------------------------------------------------------------
+r4335 | zimmerma | 2007-01-17 19:38:49 +0000 (Wed, 17 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/dim.c
+ M /trunk/mpfr.texi
+
+added documentation for mpfr_dim (was missing)
+
+------------------------------------------------------------------------
+r4334 | zimmerma | 2007-01-17 19:26:47 +0000 (Wed, 17 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item
+
+------------------------------------------------------------------------
+r4333 | vlefevre | 2007-01-17 17:34:09 +0000 (Wed, 17 Jan 2007) | 4 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tests.c
+
+Replaced some computations using the type double by computations using
+MPFR, for mpfr_get_str, allowing it to work with an x86 processor set
+up in single-precision mode.
+
+------------------------------------------------------------------------
+r4332 | vlefevre | 2007-01-16 23:15:29 +0000 (Tue, 16 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+Updated comment concerning LONG_MIN / 1.
+
+------------------------------------------------------------------------
+r4331 | vlefevre | 2007-01-15 00:40:17 +0000 (Mon, 15 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated "To make a release" section.
+
+------------------------------------------------------------------------
+r4329 | vlefevre | 2007-01-10 16:35:27 +0000 (Wed, 10 Jan 2007) | 2 lines
+Changed paths:
+ D /trunk/mpzroot.c
+ D /trunk/rootrem.c
+
+Removed mpzroot.c and rootrem.c from the repository.
+
+------------------------------------------------------------------------
+r4328 | vlefevre | 2007-01-10 16:32:46 +0000 (Wed, 10 Jan 2007) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ D /trunk/log_b2.h
+
+Removed log_b2.h (has never been used) from the repository and from
+libmpfr_la_SOURCES in Makefile.am.
+
+------------------------------------------------------------------------
+r4327 | vlefevre | 2007-01-10 15:40:05 +0000 (Wed, 10 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ.html: Added details to MPF-related Q&A's.
+
+------------------------------------------------------------------------
+r4326 | vlefevre | 2007-01-10 12:51:56 +0000 (Wed, 10 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_d64.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mpzroot.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/rootrem.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_d64.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_set_d64.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Copyright notice update: added 2007.
+
+------------------------------------------------------------------------
+r4325 | vlefevre | 2007-01-10 12:37:05 +0000 (Wed, 10 Jan 2007) | 6 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/README.dev
+ M /trunk/tests/tests.c
+
+* tests/tests.c: under Linux/x86, the FPU precision can be set before
+doing the tests (see MPFR_FPU_PREC), so that MPFR can be tested under
+various FP environments (2 tests currently fail with _FPU_SINGLE).
+* README.dev: updated "To make a release" section.
+* BUGS: mentioned the above bug.
+
+------------------------------------------------------------------------
+r4323 | vlefevre | 2007-01-08 16:36:00 +0000 (Mon, 08 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi -> January 2007.
+
+------------------------------------------------------------------------
+r4321 | zimmerma | 2007-01-08 16:03:52 +0000 (Mon, 08 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added support from LIP, and different INRIA project-teams
+
+------------------------------------------------------------------------
+r4320 | vlefevre | 2007-01-03 16:19:45 +0000 (Wed, 03 Jan 2007) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+Minor change.
+
+------------------------------------------------------------------------
+r4319 | vlefevre | 2006-12-29 03:42:39 +0000 (Fri, 29 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: macros/functions to get/set the sign of a MPFR number.
+
+------------------------------------------------------------------------
+r4318 | zimmerma | 2006-12-21 14:10:51 +0000 (Thu, 21 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/root.c
+
+remove new rootrem implementation (unclear copyright status)
+
+------------------------------------------------------------------------
+r4317 | vlefevre | 2006-12-19 22:32:09 +0000 (Tue, 19 Dec 2006) | 3 lines
+Changed paths:
+ M /trunk/const_catalan.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/eint.c
+ M /trunk/erfc.c
+ M /trunk/gamma.c
+ M /trunk/lngamma.c
+ M /trunk/zeta.c
+
+Replaced mpfr_mul_2exp and mpfr_div_2exp by mpfr_mul_2ui and
+mpfr_div_2ui respectively (when this makes sense, of course).
+
+------------------------------------------------------------------------
+r4316 | zimmerma | 2006-12-19 13:59:59 +0000 (Tue, 19 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/zeta_ui.c
+
+mpfr_div_2exp -> mpfr_div_2ui
+
+------------------------------------------------------------------------
+r4315 | zimmerma | 2006-12-19 07:08:13 +0000 (Tue, 19 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/algorithms.tex
+ M /trunk/zeta_ui.c
+
+improved efficiency of zeta_ui(s) for 3^(-s) < 1/2*ulp(1)
+
+------------------------------------------------------------------------
+r4314 | vlefevre | 2006-12-18 17:09:43 +0000 (Mon, 18 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: update concerning MPFR_USE_EXTENSION.
+
+------------------------------------------------------------------------
+r4313 | zimmerma | 2006-12-18 16:03:26 +0000 (Mon, 18 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/rootrem.c
+
+added copyright header
+
+------------------------------------------------------------------------
+r4312 | zimmerma | 2006-12-18 12:04:19 +0000 (Mon, 18 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item
+
+------------------------------------------------------------------------
+r4311 | vlefevre | 2006-12-15 14:28:53 +0000 (Fri, 15 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Implemented MPFR_USE_EXTENSION support.
+
+------------------------------------------------------------------------
+r4310 | zimmerma | 2006-12-15 08:42:21 +0000 (Fri, 15 Dec 2006) | 4 lines
+Changed paths:
+ M /trunk/zeta_ui.c
+
+improved efficiency for zeta(m) in precision p when m is large
+but still smaller than p, for example m=1024 and p=2048 gives a
+speedup of about 23 (thanks to Jim White for reporting the problem)
+
+------------------------------------------------------------------------
+r4309 | zimmerma | 2006-12-14 15:19:17 +0000 (Thu, 14 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/zeta_ui.c
+
+added MPFR_ZIV_INIT stuff
+
+------------------------------------------------------------------------
+r4308 | zimmerma | 2006-12-07 07:17:58 +0000 (Thu, 07 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+fixed typo
+
+------------------------------------------------------------------------
+r4307 | vlefevre | 2006-12-05 09:42:22 +0000 (Tue, 05 Dec 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: to be added: MPFR_USE_EXTENSION macro.
+
+------------------------------------------------------------------------
+r4306 | vlefevre | 2006-11-29 09:50:57 +0000 (Wed, 29 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: update.
+
+------------------------------------------------------------------------
+r4300 | vlefevre | 2006-11-29 08:54:24 +0000 (Wed, 29 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: update of the "Notes on Windows 32" section.
+
+------------------------------------------------------------------------
+r4299 | zimmerma | 2006-11-27 08:56:12 +0000 (Mon, 27 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/set_uj.c
+
+added comment about last change
+
+------------------------------------------------------------------------
+r4298 | zimmerma | 2006-11-27 08:26:02 +0000 (Mon, 27 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/set_uj.c
+
+fixed warning on 64-bit machines
+
+------------------------------------------------------------------------
+r4297 | vlefevre | 2006-11-26 18:58:05 +0000 (Sun, 26 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tests/tpow.c: added worst cases.
+
+------------------------------------------------------------------------
+r4296 | vlefevre | 2006-11-26 18:52:26 +0000 (Sun, 26 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/troot.c
+
+tests/troot.c: two more worst cases.
+
+------------------------------------------------------------------------
+r4295 | vlefevre | 2006-11-25 20:05:15 +0000 (Sat, 25 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/troot.c
+
+tests/troot.c: added a worst case.
+
+------------------------------------------------------------------------
+r4293 | vlefevre | 2006-11-25 19:46:42 +0000 (Sat, 25 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: removed obsolete "compiler bugs" section.
+
+------------------------------------------------------------------------
+r4292 | zimmerma | 2006-11-25 09:51:07 +0000 (Sat, 25 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added worst case
+
+------------------------------------------------------------------------
+r4286 | vlefevre | 2006-11-25 00:15:30 +0000 (Sat, 25 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Partially rewrote the INSTALL file.
+
+------------------------------------------------------------------------
+r4284 | vlefevre | 2006-11-24 14:46:41 +0000 (Fri, 24 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Makefile.am: fixed libtool's -version-info flag (and comment).
+
+------------------------------------------------------------------------
+r4279 | vlefevre | 2006-11-24 00:44:20 +0000 (Fri, 24 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: check for gmp.h a bit earlier.
+
+------------------------------------------------------------------------
+r4278 | zimmerma | 2006-11-23 14:10:10 +0000 (Thu, 23 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+added --with-tests-timeout=60 for nightly tests
+
+------------------------------------------------------------------------
+r4277 | zimmerma | 2006-11-23 14:08:47 +0000 (Thu, 23 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/tests/tests.c
+
+test timeout is now a configure option (e.g. --with-tests-timeout=60)
+
+------------------------------------------------------------------------
+r4276 | zimmerma | 2006-11-23 13:25:35 +0000 (Thu, 23 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+replaced set_d by set_str_binary (more portable)
+
+------------------------------------------------------------------------
+r4274 | vlefevre | 2006-11-23 00:34:58 +0000 (Thu, 23 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: several additions.
+
+------------------------------------------------------------------------
+r4272 | vlefevre | 2006-11-22 17:25:20 +0000 (Wed, 22 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: small update.
+
+------------------------------------------------------------------------
+r4270 | vlefevre | 2006-11-22 15:25:22 +0000 (Wed, 22 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update (added a CSS counter).
+
+------------------------------------------------------------------------
+r4268 | vlefevre | 2006-11-22 15:23:30 +0000 (Wed, 22 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/update-faq
+
+update-faq: added a workaround for the libxslt bug 377440.
+
+------------------------------------------------------------------------
+r4267 | vlefevre | 2006-11-22 11:48:44 +0000 (Wed, 22 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: update concerning the patches information.
+
+------------------------------------------------------------------------
+r4266 | zimmerma | 2006-11-22 08:03:59 +0000 (Wed, 22 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+set GMP_CHECK_RANDOMIZE to get random tests
+
+------------------------------------------------------------------------
+r4263 | vlefevre | 2006-11-21 18:01:15 +0000 (Tue, 21 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/README
+
+Updated README file.
+
+------------------------------------------------------------------------
+r4259 | vlefevre | 2006-11-20 16:32:36 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: mention the version suffix.
+
+------------------------------------------------------------------------
+r4258 | vlefevre | 2006-11-20 16:25:47 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version to 2.3.0-dev.
+
+------------------------------------------------------------------------
+r4257 | vlefevre | 2006-11-20 16:24:20 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+ M /trunk/update-version
+
+Added version suffix support (useful for dev and rc versions).
+
+------------------------------------------------------------------------
+r4256 | vlefevre | 2006-11-20 14:45:50 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+Rewrote nightly-test in sh and fixed a security hole.
+
+------------------------------------------------------------------------
+r4255 | zimmerma | 2006-11-20 14:08:00 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+added cpu time limit of 60 seconds in tests
+
+------------------------------------------------------------------------
+r4254 | vlefevre | 2006-11-20 13:44:04 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: update.
+
+------------------------------------------------------------------------
+r4252 | zimmerma | 2006-11-20 12:59:26 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+added an argument to give the branch (use trunk or branches/2.2 for example)
+
+------------------------------------------------------------------------
+r4250 | vlefevre | 2006-11-20 11:36:25 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+tests/tgamma.c: restore emin and emax to their default values.
+
+------------------------------------------------------------------------
+r4249 | zimmerma | 2006-11-20 11:00:45 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed bug in overflow test
+
+------------------------------------------------------------------------
+r4248 | zimmerma | 2006-11-20 09:52:45 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed bug in mpfr_gamma for exact result
+
+------------------------------------------------------------------------
+r4246 | zimmerma | 2006-11-20 07:39:36 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/nightly-test
+
+added two configure options
+
+------------------------------------------------------------------------
+r4245 | zimmerma | 2006-11-20 07:32:36 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/erfc.c
+
+simplified test :-)
+
+------------------------------------------------------------------------
+r4244 | vlefevre | 2006-11-20 05:40:58 +0000 (Mon, 20 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: unset GMP_CFLAGS and GMP_CC in case the user has set such
+environment variables for another use.
+
+------------------------------------------------------------------------
+r4243 | vlefevre | 2006-11-20 04:45:11 +0000 (Mon, 20 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/tests/texp2.c
+
+tests/texp2.c: fixed a problem with a value that is not necessarily
+representable (on platforms without long long).
+
+------------------------------------------------------------------------
+r4242 | vlefevre | 2006-11-20 00:27:53 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: removed item on mpfr_eint (now fixed).
+
+------------------------------------------------------------------------
+r4241 | vlefevre | 2006-11-20 00:25:10 +0000 (Mon, 20 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/erfc.c
+
+Untabify.
+
+------------------------------------------------------------------------
+r4240 | zimmerma | 2006-11-19 21:27:33 +0000 (Sun, 19 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+replaced double by mpfr_t (problem on 64-bit machines)
+
+------------------------------------------------------------------------
+r4239 | zimmerma | 2006-11-19 18:22:51 +0000 (Sun, 19 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+added more tests
+
+------------------------------------------------------------------------
+r4238 | zimmerma | 2006-11-19 18:08:38 +0000 (Sun, 19 Nov 2006) | 2 lines
+Changed paths:
+ A /trunk/nightly-test
+
+script for nightly tests
+
+------------------------------------------------------------------------
+r4237 | zimmerma | 2006-11-19 14:35:02 +0000 (Sun, 19 Nov 2006) | 4 lines
+Changed paths:
+ M /trunk/erfc.c
+ M /trunk/pow.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/ttan.c
+
+fixed bug in pow (isodd -> assertion failed)
+fixed problem in erfc for large input
+reduced tests that took too much time
+
+------------------------------------------------------------------------
+r4236 | vlefevre | 2006-11-19 11:34:06 +0000 (Sun, 19 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated description of mpfr_eint, as the whole input domain
+is now supported.
+
+------------------------------------------------------------------------
+r4235 | vlefevre | 2006-11-19 11:17:03 +0000 (Sun, 19 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+ M /trunk/erfc.c
+
+Untabify.
+
+------------------------------------------------------------------------
+r4234 | vlefevre | 2006-11-19 11:01:25 +0000 (Sun, 19 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: added a comment about MPFR_WARNING.
+
+------------------------------------------------------------------------
+r4233 | zimmerma | 2006-11-19 09:28:35 +0000 (Sun, 19 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/eint.c
+ M /trunk/erfc.c
+
+fixed bug in erfc (forgot to compare result of cmp_si)
+fixed infinite loop in eint (test for use of asympt was not tight enough)
+
+------------------------------------------------------------------------
+r4232 | zimmerma | 2006-11-19 08:48:17 +0000 (Sun, 19 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/eint.c
+ M /trunk/tests/teint.c
+
+added asymptotic expansion for mpfr_eint (don't need MPFR_WARNING any more)
+
+------------------------------------------------------------------------
+r4231 | vlefevre | 2006-11-18 20:55:17 +0000 (Sat, 18 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/tests/terf.c
+
+Added a mpfr_erfc test that shows a bug and updated BUGS file.
+
+------------------------------------------------------------------------
+r4229 | vlefevre | 2006-11-17 09:07:23 +0000 (Fri, 17 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: Added a comment concerning GMP version checking.
+
+------------------------------------------------------------------------
+r4228 | vlefevre | 2006-11-17 08:58:29 +0000 (Fri, 17 Nov 2006) | 5 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: Before testing GMP header and library versions, set
+LD_RUN_PATH locally if a --with-gmp* option is used, so that the
+right version of the GMP library is used. There is no need to do
+something similar for "make check" as libtool does the job.
+
+------------------------------------------------------------------------
+r4227 | vlefevre | 2006-11-17 08:15:24 +0000 (Fri, 17 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Updated mpfr_erfc documentation (now supported in whole domain).
+
+------------------------------------------------------------------------
+r4226 | vlefevre | 2006-11-17 03:16:16 +0000 (Fri, 17 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: removed mpfr_pow_z bug.
+
+------------------------------------------------------------------------
+r4225 | vlefevre | 2006-11-17 03:13:24 +0000 (Fri, 17 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tests.c
+ M /trunk/tests/tgeneric.c
+
+Merged the new generic tests.
+
+------------------------------------------------------------------------
+r4224 | vlefevre | 2006-11-17 02:55:09 +0000 (Fri, 17 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+Partially fixed a bug in mpfr_pow_si (overflow/underflow detection for
+n < 0).
+
+------------------------------------------------------------------------
+r4223 | vlefevre | 2006-11-17 02:46:56 +0000 (Fri, 17 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+tests/tpow_z.c: various corrections.
+
+------------------------------------------------------------------------
+r4222 | vlefevre | 2006-11-17 02:27:06 +0000 (Fri, 17 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow.c
+
+Partially fixed another bug in mpfr_pow_z (overflow/underflow detection
+for z < 0) and added corresponding testcases.
+
+------------------------------------------------------------------------
+r4221 | vlefevre | 2006-11-17 01:56:31 +0000 (Fri, 17 Nov 2006) | 4 lines
+Changed paths:
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow.c
+
+Fixed a bug in mpfr_pow_z concerning the underflow flag and added the
+corresponding testcase (but the case z < 0 is still buggy concerning
+the flags).
+
+------------------------------------------------------------------------
+r4219 | zimmerma | 2006-11-16 15:02:08 +0000 (Thu, 16 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/algorithms.tex
+ M /trunk/erfc.c
+ M /trunk/tests/terf.c
+
+implemented asymptotic formula for erfc (fixed both slowness for large
+arguments, and call to MPFR_WARNING with return value NaN for huge arguments)
+
+------------------------------------------------------------------------
+r4218 | zimmerma | 2006-11-16 10:19:19 +0000 (Thu, 16 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+added new test
+
+------------------------------------------------------------------------
+r4216 | zimmerma | 2006-11-14 16:42:46 +0000 (Tue, 14 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/erfc.c
+ M /trunk/tests/terf.c
+
+fixed problem for large negative input
+
+------------------------------------------------------------------------
+r4215 | vlefevre | 2006-11-14 14:26:02 +0000 (Tue, 14 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: slight change in the proposed mpfr_lgamma prototype (arg order).
+
+------------------------------------------------------------------------
+r4214 | vlefevre | 2006-11-13 09:07:20 +0000 (Mon, 13 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.texi
+
+About mpfr_lngamma/mpfr_lgamma: added mpfr_lgamma to TODO and updated
+mpfr_lngamma description in mpfr.texi.
+
+------------------------------------------------------------------------
+r4213 | vlefevre | 2006-11-13 08:39:16 +0000 (Mon, 13 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: update.
+
+------------------------------------------------------------------------
+r4212 | vlefevre | 2006-11-13 07:26:31 +0000 (Mon, 13 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+tests/terf.c: added a test that yields a segfault (execute "terf 1").
+
+------------------------------------------------------------------------
+r4211 | zimmerma | 2006-11-10 16:05:07 +0000 (Fri, 10 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+moved the [gs]et_decimal64 functions after the [gs]et_ld functions
+
+------------------------------------------------------------------------
+r4210 | vlefevre | 2006-11-10 15:14:58 +0000 (Fri, 10 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: changed @code{--enable-decimal-float} into @samp{...}
+for consistency with the other configure options.
+
+------------------------------------------------------------------------
+r4209 | vlefevre | 2006-11-10 15:13:30 +0000 (Fri, 10 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: updated the note concerning mpfr_eint and mpfr_erfc.
+
+------------------------------------------------------------------------
+r4208 | vlefevre | 2006-11-10 14:54:19 +0000 (Fri, 10 Nov 2006) | 9 lines
+Changed paths:
+ M /branches/new-generic-tests/tests/Makefile.am
+ M /trunk/configure.in
+ M /trunk/eint.c
+ M /trunk/erfc.c
+ M /trunk/mpfr-impl.h
+
+Added warnings support.
+ * configure.in: added --enable-warnings configure option.
+ * mpfr-impl.h: defined MPFR_WARNING(W) macro.
+ * eint.c, erfc.c: use MPFR_WARNING instead of fprintf.
+ * tests/Makefile.am (new-generic-tests branch): run the tests with
+ MPFR_QUIET=1 to avoid output of useless warnings, as some tests
+ (with large arguments) can generate such warnings, which are all
+ expected.
+
+------------------------------------------------------------------------
+r4206 | vlefevre | 2006-11-10 13:28:54 +0000 (Fri, 10 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests
+
+Added tget_set_d64 to svn:ignore property of "tests" directory.
+
+------------------------------------------------------------------------
+r4205 | vlefevre | 2006-11-10 09:05:56 +0000 (Fri, 10 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: "add a configure test for --enable-logging..."
+
+------------------------------------------------------------------------
+r4204 | vlefevre | 2006-11-10 01:30:10 +0000 (Fri, 10 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+More information for --enable-logging configure option.
+
+------------------------------------------------------------------------
+r4203 | vlefevre | 2006-11-10 01:24:33 +0000 (Fri, 10 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/logging.c
+ M /trunk/mpfr-impl.h
+
+Fixed test of logging support.
+
+------------------------------------------------------------------------
+r4202 | vlefevre | 2006-11-10 01:01:24 +0000 (Fri, 10 Nov 2006) | 5 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/configure.in
+
+Removed --with-irix64 configure option and "case $OS_TYPE" code from
+configure.in; see
+ http://sympa.loria.fr/wwsympa/arc/mpfr/2006-11/msg00009.html
+for the reasons.
+
+------------------------------------------------------------------------
+r4201 | zimmerma | 2006-11-09 14:25:48 +0000 (Thu, 09 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_set_d64.c
+
+added more checks with native format
+
+------------------------------------------------------------------------
+r4200 | zimmerma | 2006-11-09 13:37:33 +0000 (Thu, 09 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/tests/tget_set_d64.c
+
+added detection of decimal format in configure (DPD or BID)
+
+------------------------------------------------------------------------
+r4199 | vlefevre | 2006-11-09 11:39:34 +0000 (Thu, 09 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: removed a useless cast (ISO C99 standard 6.2.5#3) and updated
+a comment as isdigit is no longer used.
+
+------------------------------------------------------------------------
+r4198 | vlefevre | 2006-11-09 11:13:48 +0000 (Thu, 09 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c fix: no longer use isdigit, as MPFR requires non-localized
+digits.
+
+------------------------------------------------------------------------
+r4197 | zimmerma | 2006-11-09 11:05:05 +0000 (Thu, 09 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+ M /trunk/tests/tget_set_d64.c
+
+modified to work on 64-bit machines too
+
+------------------------------------------------------------------------
+r4196 | vlefevre | 2006-11-09 09:31:09 +0000 (Thu, 09 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/get_d64.c
+
+get_d64.c: fixed problems related to signed/unsigned values.
+
+------------------------------------------------------------------------
+r4195 | vlefevre | 2006-11-09 09:03:17 +0000 (Thu, 09 Nov 2006) | 4 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+strtofr.c: fixed a bug that could occur on platforms with signed chars,
+when the user provides a string with negative characters (e.g. accented
+characters, in practice).
+
+------------------------------------------------------------------------
+r4194 | zimmerma | 2006-11-09 07:29:15 +0000 (Thu, 09 Nov 2006) | 4 lines
+Changed paths:
+ M /trunk/get_d64.c
+ M /trunk/set_d64.c
+ M /trunk/tests/tget_set_d64.c
+
+complete rewrite of mpfr_set_decimal64 and mpfr_get_decimal64: now use
+internal string <-> _Decimal64 conversion functions, which perform native
+conversion from/to BID or DPD
+
+------------------------------------------------------------------------
+r4193 | zimmerma | 2006-11-08 09:32:52 +0000 (Wed, 08 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_set_decimal64 and mpfr_get_decimal64
+
+------------------------------------------------------------------------
+r4192 | vlefevre | 2006-11-08 08:55:33 +0000 (Wed, 08 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+mpfr-impl.h: fixed a compile error if _Decimal64 is unknown.
+
+------------------------------------------------------------------------
+r4191 | zimmerma | 2006-11-08 07:47:07 +0000 (Wed, 08 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/get_d64.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/set_d64.c
+ M /trunk/tests/tget_set_d64.c
+
+added new configure option --enable-decimal-float to build mpfr_set_decimal64
+and mpfr_get_decimal64 (checks _Decimal64, and _GMP_IEEE_FLOATS is defined)
+
+------------------------------------------------------------------------
+r4190 | zimmerma | 2006-11-07 16:47:45 +0000 (Tue, 07 Nov 2006) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/get_d64.c
+ M /trunk/mpfr.h
+ M /trunk/set_d64.c
+ M /trunk/tests/tget_set_d64.c
+
+added --enable-decimal-float in configure, and corresponding macro
+WANT_DECIMAL_FLOATS
+
+------------------------------------------------------------------------
+r4189 | vlefevre | 2006-11-07 15:09:16 +0000 (Tue, 07 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+tests/tversion.c: improved error message and added gmp.h/libgmp test.
+
+------------------------------------------------------------------------
+r4188 | vlefevre | 2006-11-07 14:38:42 +0000 (Tue, 07 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+Fixed a small bug in tests/tversion.c (should never occur anyway).
+
+------------------------------------------------------------------------
+r4187 | vlefevre | 2006-11-06 01:23:37 +0000 (Mon, 06 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/logging.c
+
+logging.c: clean-up.
+
+------------------------------------------------------------------------
+r4186 | vlefevre | 2006-11-05 16:12:16 +0000 (Sun, 05 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: updated things to do before a release.
+
+------------------------------------------------------------------------
+r4185 | zimmerma | 2006-11-05 15:41:27 +0000 (Sun, 05 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_d64.c
+ M /trunk/get_str.c
+ M /trunk/mpfr.h
+ A /trunk/set_d64.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tget_set_d64.c
+
+added new (preliminary) conversions functions to/from decimal64
+
+------------------------------------------------------------------------
+r4184 | zimmerma | 2006-11-05 15:17:30 +0000 (Sun, 05 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/erfc.c
+
+changed header file: stdlib.h -> stdio.h
+
+------------------------------------------------------------------------
+r4183 | vlefevre | 2006-11-03 18:38:05 +0000 (Fri, 03 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Fixed a bug related to signed/unsigned types.
+
+------------------------------------------------------------------------
+r4182 | vlefevre | 2006-11-03 10:05:51 +0000 (Fri, 03 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+tgamma.c: avoid useless mpfr_get_d.
+
+------------------------------------------------------------------------
+r4181 | vlefevre | 2006-11-03 09:54:24 +0000 (Fri, 03 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+tpow.c: replaced a mpfr_cmp_d by a mpfr_cmp_str1.
+
+------------------------------------------------------------------------
+r4180 | vlefevre | 2006-11-03 09:50:45 +0000 (Fri, 03 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+lngamma.c: added a comment.
+
+------------------------------------------------------------------------
+r4179 | vlefevre | 2006-11-03 09:42:31 +0000 (Fri, 03 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tlngamma.c
+
+tlngamma.c: avoid useless mpfr_get_d.
+
+------------------------------------------------------------------------
+r4178 | vlefevre | 2006-10-27 21:21:56 +0000 (Fri, 27 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+
+eint.c: better overflow checking; fix: all allocated memory now freed.
+
+------------------------------------------------------------------------
+r4177 | vlefevre | 2006-10-27 17:03:32 +0000 (Fri, 27 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+
+eint.c: forgot 2 mpfr_clear's.
+
+------------------------------------------------------------------------
+r4174 | vlefevre | 2006-10-27 16:12:34 +0000 (Fri, 27 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+
+eint.c fix: and changed the #if into if.
+
+------------------------------------------------------------------------
+r4173 | vlefevre | 2006-10-27 16:10:22 +0000 (Fri, 27 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+
+eint.c fix: replaced BITS_PER_MP_LIMB by sizeof(mp_exp_t) * CHAR_BIT.
+
+------------------------------------------------------------------------
+r4172 | vlefevre | 2006-10-27 12:39:20 +0000 (Fri, 27 Oct 2006) | 4 lines
+Changed paths:
+ M /trunk/erfc.c
+ M /trunk/mpfr.texi
+
+The current implementation of mpfr_erfc cannot compute the result for
+large inputs. Return NaN with the erange flag set instead of aborting.
+Documented this behavior in mpfr.texi.
+
+------------------------------------------------------------------------
+r4171 | zimmerma | 2006-10-27 11:56:14 +0000 (Fri, 27 Oct 2006) | 3 lines
+Changed paths:
+ M /trunk/eint.c
+
+improved bound for x with BITS_PER_MP_LIMB=32
+ added bound for BITS_PER_MP_LIMB=64
+
+------------------------------------------------------------------------
+r4169 | vlefevre | 2006-10-27 01:30:32 +0000 (Fri, 27 Oct 2006) | 4 lines
+Changed paths:
+ M /trunk/eint.c
+ M /trunk/mpfr.texi
+
+The current implementation of mpfr_eint cannot compute the result for
+large inputs. Return NaN with the erange flag set instead of aborting.
+Documented this behavior in mpfr.texi.
+
+------------------------------------------------------------------------
+r4168 | vlefevre | 2006-10-27 00:59:33 +0000 (Fri, 27 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+tzeta.c patch 4166 should have been committed to the trunk. Fixing...
+
+------------------------------------------------------------------------
+r4167 | zimmerma | 2006-10-26 17:17:01 +0000 (Thu, 26 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+
+added tests for overflows or underflows
+
+------------------------------------------------------------------------
+r4166 | zimmerma | 2006-10-26 15:19:43 +0000 (Thu, 26 Oct 2006) | 2 lines
+Changed paths:
+ M /branches/new-generic-tests/tests/tzeta.c
+ M /trunk/zeta.c
+
+fixed problem for large negative s (return +Inf or -Inf)
+
+------------------------------------------------------------------------
+r4165 | zimmerma | 2006-10-26 13:55:26 +0000 (Thu, 26 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/coth.c
+
+fixed dummy error in last commit
+
+------------------------------------------------------------------------
+r4164 | vlefevre | 2006-10-26 08:52:01 +0000 (Thu, 26 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+
+In latest change, replaced exit(1) by abort().
+
+------------------------------------------------------------------------
+r4163 | zimmerma | 2006-10-26 08:18:23 +0000 (Thu, 26 Oct 2006) | 4 lines
+Changed paths:
+ M /trunk/eint.c
+ M /trunk/tests/teint.c
+
+added test for eint()
+added error message when input is too large in eint(), waiting for asymptotic
+ expansion
+
+------------------------------------------------------------------------
+r4162 | vlefevre | 2006-10-26 01:40:17 +0000 (Thu, 26 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/gen_inverse.h
+
+Untabified and added a FIXME.
+
+------------------------------------------------------------------------
+r4161 | zimmerma | 2006-10-25 17:49:57 +0000 (Wed, 25 Oct 2006) | 3 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/csch.c
+ M /trunk/gen_inverse.h
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tsech.c
+
+fixed overflow/underflow problems in csch and sech
+fixed problem for huge argument in coth
+
+------------------------------------------------------------------------
+r4159 | vlefevre | 2006-10-25 17:01:07 +0000 (Wed, 25 Oct 2006) | 9 lines
+Changed paths:
+ M /trunk/FAQ.html
+ M /trunk/faq.xsl
+ M /trunk/update-faq
+
+FAQ-related updates:
+ * faq.xsl: Include styles from http://www.mpfr.org/styles/visual.css
+ by using a system entity (but GNOME libxslt bug 345147 is still
+ present in Debian, so don't use /*<![CDATA[*/ and /*]]>*/ yet).
+ * update-faq: add /*<![CDATA[*/ and /*]]>*/ after calling xsltproc.
+ * FAQ.html: update from the MPFR web site: various changes, including:
+ + added id attributes on dt elements (FAQ items) to allow anchors;
+ + updated FAQ for undefined references.
+
+------------------------------------------------------------------------
+r4157 | vlefevre | 2006-10-25 14:18:59 +0000 (Wed, 25 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: mention the MPFR FAQ.
+
+------------------------------------------------------------------------
+r4155 | vlefevre | 2006-10-23 02:10:13 +0000 (Mon, 23 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/set_uj.c
+
+Added a comment about a warning (this confused a user).
+
+------------------------------------------------------------------------
+r4153 | vlefevre | 2006-10-11 11:43:07 +0000 (Wed, 11 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: added an item about version information.
+
+------------------------------------------------------------------------
+r4152 | vlefevre | 2006-10-05 14:40:39 +0000 (Thu, 05 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: updated item.
+
+------------------------------------------------------------------------
+r4151 | zimmerma | 2006-10-05 10:52:30 +0000 (Thu, 05 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item
+
+------------------------------------------------------------------------
+r4149 | zimmerma | 2006-10-02 19:55:09 +0000 (Mon, 02 Oct 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed wrong emax in example for mpfr_subnormalize
+
+------------------------------------------------------------------------
+r4147 | vlefevre | 2006-09-07 09:27:11 +0000 (Thu, 07 Sep 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+MPFR manual: say that errno may be set to non-zero.
+
+------------------------------------------------------------------------
+r4145 | vlefevre | 2006-08-31 12:26:29 +0000 (Thu, 31 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+tests/tests.c: typo.
+
+------------------------------------------------------------------------
+r4143 | vlefevre | 2006-08-28 12:09:10 +0000 (Mon, 28 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/texp2.c
+
+Fixed texp2 overflow tests on 64-bit machines.
+
+------------------------------------------------------------------------
+r4142 | vlefevre | 2006-08-28 11:58:54 +0000 (Mon, 28 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+tests/reuse.c: avoid a warning; code reformatted (GNU style).
+
+------------------------------------------------------------------------
+r4140 | vlefevre | 2006-08-23 14:08:12 +0000 (Wed, 23 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: minor update.
+
+------------------------------------------------------------------------
+r4138 | vlefevre | 2006-08-21 12:51:49 +0000 (Mon, 21 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: updated "known bugs" section.
+
+------------------------------------------------------------------------
+r4136 | vlefevre | 2006-08-21 12:40:20 +0000 (Mon, 21 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Fixed an exponent/flags-related bug in lngamma.c.
+
+------------------------------------------------------------------------
+r4134 | vlefevre | 2006-08-21 11:12:25 +0000 (Mon, 21 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk
+
+Updated svn:ignore property.
+
+------------------------------------------------------------------------
+r4133 | vlefevre | 2006-08-20 08:34:40 +0000 (Sun, 20 Aug 2006) | 5 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+Fixed several problems in pow.c concerning underflows, overflows and
+flags (including the inexact flag, which could be incorrectly set in
+case of NaN), and added some testcases. Problems in pow_z.c have not
+been fixed yet.
+
+------------------------------------------------------------------------
+r4131 | vlefevre | 2006-08-20 00:44:26 +0000 (Sun, 20 Aug 2006) | 5 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+
+Partial fix: The inexact flag was not always set in some functions.
+In particular, it is now set by mpfr_check_range (if t is not zero)
+since mpfr_check_range usually comes just after MPFR_SAVE_EXPO_FREE
+(which restores the previous flags).
+
+------------------------------------------------------------------------
+r4129 | vlefevre | 2006-08-19 14:33:23 +0000 (Sat, 19 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+Added an assertion for mpfr_exp2 and a test.
+
+------------------------------------------------------------------------
+r4127 | vlefevre | 2006-08-16 20:09:49 +0000 (Wed, 16 Aug 2006) | 5 lines
+Changed paths:
+ M /trunk/expm1.c
+
+Optimized mpfr_expm1 for large (in absolute value) negative values in
+order to avoid the TMD (the result is very close to -1). Without this
+patch, mpfr_expm1 could take dozens of MBs and the new generic tests
+for texpm1 could take several hours instead of less than 1 second.
+
+------------------------------------------------------------------------
+r4125 | vlefevre | 2006-08-16 16:31:25 +0000 (Wed, 16 Aug 2006) | 7 lines
+Changed paths:
+ M /trunk/expm1.c
+
+Fixed a bug in expm1 for very small negative arguments (and perhaps
+some very small positive arguments too); this bug is similar to the
+one in log1p that was recently found and fixed. It was detected by
+the new generic tests (not committed yet), therefore no testcases
+are provided. Note: the mpfr_expm1 function is still buggy (freezes
+on -0.10E18, prec 2 -> prec 13); this is a different bug.
+
+------------------------------------------------------------------------
+r4123 | vlefevre | 2006-08-16 09:20:00 +0000 (Wed, 16 Aug 2006) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+In mpfr_exp2, the overflow flag was not set if mpfr_exp2 overflowed
+with x < emax. Added testcase.
+
+------------------------------------------------------------------------
+r4121 | vlefevre | 2006-08-15 17:52:21 +0000 (Tue, 15 Aug 2006) | 4 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+The latest mpfr_exp2 fix contained a bug. Partially rewrote mpfr_exp2
+to fix this bug and another one (and added a corresponding testcase:
+exp2(10000000000.5), which was freezing).
+
+------------------------------------------------------------------------
+r4119 | vlefevre | 2006-08-15 11:37:20 +0000 (Tue, 15 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+Better fix for exp2 exponent range bug.
+
+------------------------------------------------------------------------
+r4117 | vlefevre | 2006-08-15 10:44:34 +0000 (Tue, 15 Aug 2006) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+Fixed bug in mpfr_exp2 when the argument is an integer and emin > 1.
+Added a testcase to texp2.
+
+------------------------------------------------------------------------
+r4116 | vlefevre | 2006-08-14 23:00:39 +0000 (Mon, 14 Aug 2006) | 3 lines
+Changed paths:
+ M /trunk/tests
+
+Added tget_ld_2exp to svn:ignore property of "tests" directory
+(should have been done in rev 4028).
+
+------------------------------------------------------------------------
+r4114 | vlefevre | 2006-08-14 22:23:01 +0000 (Mon, 14 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/log1p.c
+ M /trunk/tests/tlog1p.c
+
+Fixed bug in log1p for small negative values of x and added testcase.
+
+------------------------------------------------------------------------
+r4112 | vlefevre | 2006-08-14 17:39:01 +0000 (Mon, 14 Aug 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Code style correction for ansi2knr.
+
+------------------------------------------------------------------------
+r4110 | vlefevre | 2006-07-25 21:10:21 +0000 (Tue, 25 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: more information.
+
+------------------------------------------------------------------------
+r4108 | vlefevre | 2006-07-25 20:36:23 +0000 (Tue, 25 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: added a note about include/library paths.
+
+------------------------------------------------------------------------
+r4106 | vlefevre | 2006-07-21 08:22:40 +0000 (Fri, 21 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+INSTALL: added information about setup after the library installation.
+
+------------------------------------------------------------------------
+r4104 | vlefevre | 2006-07-20 07:23:06 +0000 (Thu, 20 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Improved linker flag settings on darwin.
+
+------------------------------------------------------------------------
+r4103 | vlefevre | 2006-07-18 07:51:58 +0000 (Tue, 18 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: fixed a linking problem on darwin.
+
+------------------------------------------------------------------------
+r4101 | vlefevre | 2006-07-16 02:52:18 +0000 (Sun, 16 Jul 2006) | 5 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/tests/Makefile.am
+
+One needs automake 1.6; autoreconf fails with automake 1.4. Adding
+the 1.6 automake option will make the error message less obfuscated,
+but unfortunately, one won't have the necessary automake version
+automatically called, even if it is installed.
+
+------------------------------------------------------------------------
+r4099 | zimmerma | 2006-07-05 14:35:36 +0000 (Wed, 05 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item
+
+------------------------------------------------------------------------
+r4098 | zimmerma | 2006-07-05 14:23:57 +0000 (Wed, 05 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/root.c
+
+fixed wrong comment (thanks Keith Briggs)
+
+------------------------------------------------------------------------
+r4097 | zimmerma | 2006-07-05 14:23:16 +0000 (Wed, 05 Jul 2006) | 2 lines
+Changed paths:
+ M /trunk/root.c
+
+new mpn_rootrem is still not in gmp-4.2
+
+------------------------------------------------------------------------
+r4096 | zimmerma | 2006-06-20 12:55:55 +0000 (Tue, 20 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+replaced <= by =
+
+------------------------------------------------------------------------
+r4095 | zimmerma | 2006-06-19 13:57:32 +0000 (Mon, 19 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+changed <= into =
+
+------------------------------------------------------------------------
+r4094 | zimmerma | 2006-06-19 09:10:38 +0000 (Mon, 19 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+comments from Keith Briggs
+
+------------------------------------------------------------------------
+r4093 | vlefevre | 2006-06-09 13:36:30 +0000 (Fri, 09 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: corrected several English mistakes and typography.
+
+------------------------------------------------------------------------
+r4092 | zimmerma | 2006-06-09 12:41:47 +0000 (Fri, 09 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+fixed typo
+
+------------------------------------------------------------------------
+r4091 | zimmerma | 2006-06-09 09:51:59 +0000 (Fri, 09 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+replaced error() by \error()
+
+------------------------------------------------------------------------
+r4090 | vlefevre | 2006-06-09 08:17:58 +0000 (Fri, 09 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: another fixed notation for roundings.
+
+------------------------------------------------------------------------
+r4089 | zimmerma | 2006-06-09 08:07:29 +0000 (Fri, 09 Jun 2006) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added section on Notations
+fixed notations for roundings
+
+------------------------------------------------------------------------
+r4088 | vlefevre | 2006-06-09 07:49:43 +0000 (Fri, 09 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+algorithms.tex: changed the page style to plain (for page numbers).
+
+------------------------------------------------------------------------
+r4086 | vlefevre | 2006-06-07 23:48:43 +0000 (Wed, 07 Jun 2006) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+
+------------------------------------------------------------------------
+r4083 | vlefevre | 2006-05-29 19:00:31 +0000 (Mon, 29 May 2006) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Define HAVE_ATTRIBUTE_MODE if supported; useful for s390, but incomplete
+and will fail on platforms with gcc and CHAR_BIT != 8.
+
+------------------------------------------------------------------------
+r4081 | vlefevre | 2006-05-19 16:43:35 +0000 (Fri, 19 May 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Add compiler flags (CPPFLAGS, LDFLAGS) in a consistent order.
+
+------------------------------------------------------------------------
+r4079 | vlefevre | 2006-05-18 00:10:06 +0000 (Thu, 18 May 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+MPFR manual consistency: Custom interface -> Custom Interface.
+
+------------------------------------------------------------------------
+r4075 | vlefevre | 2006-05-17 23:20:38 +0000 (Wed, 17 May 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: added a note about the change 4049 in div.c.
+
+------------------------------------------------------------------------
+r4072 | vlefevre | 2006-04-18 15:08:52 +0000 (Tue, 18 Apr 2006) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+Removed the #ifndef __hpux from mul.c (after a test on a HP-UX machine,
+I got no failures, even with the old mpfr-longlong.h).
+
+------------------------------------------------------------------------
+r4071 | vlefevre | 2006-04-18 14:38:10 +0000 (Tue, 18 Apr 2006) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added a point on mpfr-longlong.h in "To make a release".
+
+------------------------------------------------------------------------
+r4070 | vlefevre | 2006-04-18 14:37:19 +0000 (Tue, 18 Apr 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr-longlong.h
+
+Updated mpfr-longlong.h from the GMP 4.2 longlong.h file.
+
+------------------------------------------------------------------------
+r4068 | vlefevre | 2006-04-18 13:30:52 +0000 (Tue, 18 Apr 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr.texi: removed dot from a section title.
+
+------------------------------------------------------------------------
+r4066 | vlefevre | 2006-04-11 13:54:39 +0000 (Tue, 11 Apr 2006) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+
+------------------------------------------------------------------------
+r4065 | vlefevre | 2006-04-06 13:58:46 +0000 (Thu, 06 Apr 2006) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+div.c: removed the bad use of MPFR_LIMB_ZERO.
+
+------------------------------------------------------------------------
+r4064 | vlefevre | 2006-04-06 12:52:24 +0000 (Thu, 06 Apr 2006) | 3 lines
+Changed paths:
+ M /trunk/get_f.c
+
+In get_f.c, updated the case precy + sh > precx: this one was correct,
+but added a comment, assertions and simplified a MPN_ZERO.
+
+------------------------------------------------------------------------
+r4063 | vlefevre | 2006-04-05 16:32:23 +0000 (Wed, 05 Apr 2006) | 4 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+tget_f.c: test that there is no lost of accuracy when converting
+a mpfr_t number into a mpf_t number (test with various precisions
+and exponents).
+
+------------------------------------------------------------------------
+r4062 | vlefevre | 2006-04-05 15:52:26 +0000 (Wed, 05 Apr 2006) | 3 lines
+Changed paths:
+ M /trunk/get_f.c
+
+The fix of get_f.c was wrong. This should be now OK for the case
+precy + sh <= precx.
+
+------------------------------------------------------------------------
+r4061 | vlefevre | 2006-04-05 09:31:34 +0000 (Wed, 05 Apr 2006) | 2 lines
+Changed paths:
+ M /trunk/get_f.c
+ M /trunk/tests/tget_f.c
+
+Fixed bug in mpfr_get_f (reported by Yury Lukach) and added test.
+
+------------------------------------------------------------------------
+r4059 | vlefevre | 2006-03-31 16:47:40 +0000 (Fri, 31 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/fdl.texi
+
+Updated FDL to version 1.2.
+
+------------------------------------------------------------------------
+r4057 | vlefevre | 2006-03-31 16:30:52 +0000 (Fri, 31 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+ M /trunk/lngamma.c
+ M /trunk/mparam_h.in
+ M /trunk/mpzroot.c
+ M /trunk/tests/mpf_compat.h
+
+Updated FSF address.
+
+------------------------------------------------------------------------
+r4055 | vlefevre | 2006-03-31 14:19:52 +0000 (Fri, 31 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-longlong.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_ld_2exp.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Fixed FSF address.
+
+------------------------------------------------------------------------
+r4053 | vlefevre | 2006-03-30 14:41:30 +0000 (Thu, 30 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+Another FAQ update (taking GMP 4.2 into account).
+
+------------------------------------------------------------------------
+r4051 | vlefevre | 2006-03-30 14:22:52 +0000 (Thu, 30 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+FAQ update.
+
+------------------------------------------------------------------------
+r4050 | vlefevre | 2006-03-24 14:46:54 +0000 (Fri, 24 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-impl.h
+
+Removed all code related to mpn_sub_nc (no longer used).
+
+------------------------------------------------------------------------
+r4049 | vlefevre | 2006-03-24 13:51:52 +0000 (Fri, 24 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+div.c: fixed a bug and no longer use mpn_sub_nc.
+
+------------------------------------------------------------------------
+r4048 | vlefevre | 2006-03-24 12:43:41 +0000 (Fri, 24 Mar 2006) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+Some clean-up in div.c; do not steal GMP's namespace (could lead to
+clashes if future GMP versions define the corresponding macros).
+
+------------------------------------------------------------------------
+r4047 | vlefevre | 2006-03-24 08:49:28 +0000 (Fri, 24 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/configure.in
+
+Build shared libraries by default.
+
+------------------------------------------------------------------------
+r4046 | vlefevre | 2006-03-23 10:57:46 +0000 (Thu, 23 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+random2.c: minor change suggested by Patrick.
+
+------------------------------------------------------------------------
+r4044 | vlefevre | 2006-03-23 09:18:54 +0000 (Thu, 23 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+configure.in: typography consistency.
+
+------------------------------------------------------------------------
+r4043 | vlefevre | 2006-03-23 09:16:34 +0000 (Thu, 23 Mar 2006) | 4 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Mention --enable-thread-safe and --enable-shared in the INSTALL file
+since users may need them and could be confused otherwise (just seen
+that). Untabified the file.
+
+------------------------------------------------------------------------
+r4041 | vlefevre | 2006-03-16 18:10:24 +0000 (Thu, 16 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+TODO: new exception "division by zero" / "pole".
+
+------------------------------------------------------------------------
+r4040 | vlefevre | 2006-03-16 18:04:36 +0000 (Thu, 16 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: added "Do not use C99-only features, such as...".
+
+------------------------------------------------------------------------
+r4038 | zimmerma | 2006-03-16 14:49:50 +0000 (Thu, 16 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/expm1.c
+ M /trunk/log1p.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/zeta.c
+
+replaced 6th empty argument of MPFR_FAST_COMPUTE_IF_SMALL_INPUT by {}
+
+------------------------------------------------------------------------
+r4037 | vlefevre | 2006-03-14 16:07:28 +0000 (Tue, 14 Mar 2006) | 3 lines
+Changed paths:
+ M /trunk/random2.c
+
+In random2.c, replaced NULL by 0 (more general) and removed the
+now unnecessary #include <stdio.h>.
+
+------------------------------------------------------------------------
+r4036 | zimmerma | 2006-03-14 15:33:31 +0000 (Tue, 14 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+added missing include file
+
+------------------------------------------------------------------------
+r4035 | vlefevre | 2006-03-14 14:59:00 +0000 (Tue, 14 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Tests: added new worst case for x^(3/2).
+
+------------------------------------------------------------------------
+r4034 | zimmerma | 2006-03-02 17:28:41 +0000 (Thu, 02 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added reference to INRIA report for Zeta
+
+------------------------------------------------------------------------
+r4033 | zimmerma | 2006-03-02 11:05:35 +0000 (Thu, 02 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added another reference
+
+------------------------------------------------------------------------
+r4032 | zimmerma | 2006-03-02 11:02:23 +0000 (Thu, 02 Mar 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added reference
+
+------------------------------------------------------------------------
+r4031 | vlefevre | 2006-02-28 23:20:24 +0000 (Tue, 28 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+More details concerning mpfr_eq.
+
+------------------------------------------------------------------------
+r4030 | zimmerma | 2006-02-28 10:46:59 +0000 (Tue, 28 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+removed "but does not make much sense"
+
+------------------------------------------------------------------------
+r4029 | zimmerma | 2006-02-28 09:39:25 +0000 (Tue, 28 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added contribution from Damien
+
+------------------------------------------------------------------------
+r4028 | zimmerma | 2006-02-28 09:18:17 +0000 (Tue, 28 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tget_ld_2exp.c
+
+new test file for mpfr_get_ld_2exp
+
+------------------------------------------------------------------------
+r4027 | zimmerma | 2006-02-27 10:15:24 +0000 (Mon, 27 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+ M /trunk/get_ld.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+added mpfr_get_ld_2exp (contributed by Damien Stehle)
+
+------------------------------------------------------------------------
+r4026 | vlefevre | 2006-02-20 14:40:28 +0000 (Mon, 20 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Updated mpfr_random2 user documentation.
+
+------------------------------------------------------------------------
+r4024 | vlefevre | 2006-02-20 10:12:06 +0000 (Mon, 20 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+ M /trunk/tests/trandom.c
+
+Fixed bug in mpfr_random2 when size == 0 and added testcase.
+
+------------------------------------------------------------------------
+r4023 | vlefevre | 2006-02-20 10:07:41 +0000 (Mon, 20 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+trandom.c: reformat.
+
+------------------------------------------------------------------------
+r4022 | vlefevre | 2006-02-20 10:06:47 +0000 (Mon, 20 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+trandom.c: use calloc instead of malloc and check return value.
+
+------------------------------------------------------------------------
+r4021 | vlefevre | 2006-02-20 09:42:13 +0000 (Mon, 20 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+mpfr_random2_raw -> static.
+
+------------------------------------------------------------------------
+r4019 | vlefevre | 2006-02-17 08:17:46 +0000 (Fri, 17 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Added mpfr_remainder to TODO.
+
+------------------------------------------------------------------------
+r4018 | zimmerma | 2006-02-15 14:40:35 +0000 (Wed, 15 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+
+fixed wrong url
+
+------------------------------------------------------------------------
+r4017 | vlefevre | 2006-02-15 13:41:51 +0000 (Wed, 15 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+Fixed various spelling mistakes, typos... in algorithms.tex.
+
+------------------------------------------------------------------------
+r4016 | vlefevre | 2006-02-15 13:20:41 +0000 (Wed, 15 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+In algorithms.tex, \em -> \emph.
+
+------------------------------------------------------------------------
+r4015 | vlefevre | 2006-02-15 13:17:33 +0000 (Wed, 15 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+Typography corrections in algorithms.tex.
+
+------------------------------------------------------------------------
+r4014 | vlefevre | 2006-02-15 13:04:22 +0000 (Wed, 15 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+In algorithms.tex, added a missing blackslash.
+
+------------------------------------------------------------------------
+r4013 | vlefevre | 2006-02-15 13:02:07 +0000 (Wed, 15 Feb 2006) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+In algorithms.tex, removed \date (was incorrectly used) and added the
+web site as a footnote.
+
+------------------------------------------------------------------------
+r4012 | vlefevre | 2006-02-13 17:25:19 +0000 (Mon, 13 Feb 2006) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+ M /trunk/tests/trandom.c
+
+Code reformatted. C99 comment replaced by traditional comment.
+
+------------------------------------------------------------------------
+r4011 | hanrot | 2006-02-13 15:03:43 +0000 (Mon, 13 Feb 2006) | 6 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/random2.c
+ M /trunk/tests/trandom.c
+
+* Added comments on all random number generator functions ;
+* Inlined the mpn_random2 code in mpfr_random2, to avoid the use of the
+same internal randstate ; added a mpfr_random2_raw (not exported at the
+time) to allow specification of a randstate ;
+* Checked normalization of the result of random2 in trandom.c
+
+------------------------------------------------------------------------
+r4009 | vlefevre | 2006-01-31 09:53:51 +0000 (Tue, 31 Jan 2006) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Changed a part of the documentation of mpfr_get_d_2exp, introduced in
+rev 4008, to specify a behavior very similar to the ISO C standard.
+
+------------------------------------------------------------------------
+r4008 | zimmerma | 2006-01-31 07:28:05 +0000 (Tue, 31 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed documentation bug
+
+------------------------------------------------------------------------
+r4006 | vlefevre | 2006-01-19 15:00:18 +0000 (Thu, 19 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+ M /trunk/tests/tset_ld.c
+
+Reverted comments on <float.h> (that were added in r3976).
+
+------------------------------------------------------------------------
+r4005 | vlefevre | 2006-01-19 14:53:44 +0000 (Thu, 19 Jan 2006) | 6 lines
+Changed paths:
+ M /trunk/get_d.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_d.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_ld.c
+
+Replaced -0.0 by a new macro DBL_NEG_ZERO. With MSVC, the negative zero
+no longer depends on the non-standard _chgsign function, as
+ static double double_zero = 0.0;
+ # define DBL_NEG_ZERO (-double_zero)
+has been reported to work.
+
+------------------------------------------------------------------------
+r4004 | vlefevre | 2006-01-17 12:31:26 +0000 (Tue, 17 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Added comments.
+
+------------------------------------------------------------------------
+r4002 | vlefevre | 2006-01-13 14:37:25 +0000 (Fri, 13 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/get_f.c
+
+Type clean-up.
+
+------------------------------------------------------------------------
+r4001 | vlefevre | 2006-01-13 14:11:41 +0000 (Fri, 13 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+The problem with the conversion was not completely fixed... Now OK.
+
+------------------------------------------------------------------------
+r4000 | vlefevre | 2006-01-13 14:04:31 +0000 (Fri, 13 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+Fixed conversion with a non-representable value.
+
+------------------------------------------------------------------------
+r3999 | vlefevre | 2006-01-13 13:31:23 +0000 (Fri, 13 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+Untabify.
+
+------------------------------------------------------------------------
+r3997 | vlefevre | 2006-01-12 10:27:27 +0000 (Thu, 12 Jan 2006) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+More reliable tests for mpfr_set_f (x, y, GMP_RNDN) for
+y = 2^emax and y = 2^(emax-1).
+
+------------------------------------------------------------------------
+r3996 | vlefevre | 2006-01-12 10:15:33 +0000 (Thu, 12 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+Use mpfr_get_emax() instead of obsolete __mpfr_emax.
+
+------------------------------------------------------------------------
+r3995 | vlefevre | 2006-01-12 10:12:29 +0000 (Thu, 12 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+More reliable test for mpfr_set_f (x, y, GMP_RNDN) for y=2^ULONG_MAX.
+
+------------------------------------------------------------------------
+r3994 | vlefevre | 2006-01-12 10:00:45 +0000 (Thu, 12 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+Untabified.
+
+------------------------------------------------------------------------
+r3993 | vlefevre | 2006-01-12 09:56:13 +0000 (Thu, 12 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+Fixed a bug related to exponent range.
+
+------------------------------------------------------------------------
+r3992 | vlefevre | 2006-01-12 09:47:53 +0000 (Thu, 12 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+Replaced obsolete __mpfr_emax by __gmpfr_emax.
+
+------------------------------------------------------------------------
+r3990 | vlefevre | 2006-01-11 16:50:15 +0000 (Wed, 11 Jan 2006) | 2 lines
+Changed paths:
+ D /trunk/add_one_ulp.c
+ D /trunk/sub_one_ulp.c
+
+Removed add_one_ulp.c and sub_one_ulp.c (no longer used).
+
+------------------------------------------------------------------------
+r3987 | vlefevre | 2006-01-10 13:49:26 +0000 (Tue, 10 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+MPFR manual: changes from Paul concerning the ulps.
+
+------------------------------------------------------------------------
+r3986 | vlefevre | 2006-01-10 09:32:17 +0000 (Tue, 10 Jan 2006) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+In the manual, replaced "exact rounding" by "correct rounding",
+and added a sentence on the consequence of correct rounding (as
+suggested by Paul).
+
+------------------------------------------------------------------------
+r3985 | vlefevre | 2006-01-05 02:20:28 +0000 (Thu, 05 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/gamma.c
+ M /trunk/generic.c
+ M /trunk/get_exp.c
+ M /trunk/isinf.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/iszero.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/powerof2.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/set.c
+ M /trunk/set_exp.c
+ M /trunk/set_inf.c
+ M /trunk/set_nan.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/tanh.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Added ', Inc.' when missing after 'Free Software Foundation'.
+
+------------------------------------------------------------------------
+r3984 | vlefevre | 2006-01-05 02:14:39 +0000 (Thu, 05 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: Added a note about copyright notices.
+
+------------------------------------------------------------------------
+r3983 | vlefevre | 2006-01-05 02:02:47 +0000 (Thu, 05 Jan 2006) | 7 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/FAQ.html
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/abort_prec_max.c
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/faq.xsl
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/lngamma.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mparam_h.in
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-longlong.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mpzroot.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/rootrem.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/stack_interface.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlngamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstckintc.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsubnormal.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tests/tzeta_ui.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/zeta.c
+ M /trunk/zeta_ui.c
+
+Updated the copyright notices according to the new GNU rules on:
+ http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices
+i.e. added 2006 to every MPFR file.
+Note: the copyright notices (currently 336) should match the regexp
+ Copyright.* 2006 Free Software
+so that it will be easier to update them for the next year...
+
+------------------------------------------------------------------------
+r3982 | zimmerma | 2006-01-03 11:49:03 +0000 (Tue, 03 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion from K. Briggs
+
+------------------------------------------------------------------------
+r3981 | vlefevre | 2006-01-01 22:22:53 +0000 (Sun, 01 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+Updated copyright line (we are now in 2006!).
+
+------------------------------------------------------------------------
+r3980 | zimmerma | 2006-01-01 21:09:01 +0000 (Sun, 01 Jan 2006) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+use mpfr_overflow
+
+------------------------------------------------------------------------
+r3979 | zimmerma | 2005-12-29 17:48:46 +0000 (Thu, 29 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+ M /trunk/tests/tset_f.c
+
+fixed bug in mpfr_set_f for huge argument
+
+------------------------------------------------------------------------
+r3978 | zimmerma | 2005-12-26 11:04:31 +0000 (Mon, 26 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/get_f.c
+ M /trunk/tests/tget_f.c
+
+bug fix in mpfr_get_f
+
+------------------------------------------------------------------------
+r3976 | zimmerma | 2005-12-23 15:45:17 +0000 (Fri, 23 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+ M /trunk/tests/tset_ld.c
+
+updated comment for float.h (_chgsign)
+
+------------------------------------------------------------------------
+r3975 | zimmerma | 2005-12-23 15:33:43 +0000 (Fri, 23 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+fixed bug found by Vincent (worst-case)
+
+------------------------------------------------------------------------
+r3974 | zimmerma | 2005-12-23 12:28:00 +0000 (Fri, 23 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+ M /trunk/tests/tset_ld.c
+
+patch for Visual C (does not compile -0.0 properly)
+
+------------------------------------------------------------------------
+r3973 | zimmerma | 2005-12-23 12:17:45 +0000 (Fri, 23 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+patch for Visual C (-0.0)
+
+------------------------------------------------------------------------
+r3972 | zimmerma | 2005-12-20 21:09:41 +0000 (Tue, 20 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+fixed typo
+
+------------------------------------------------------------------------
+r3971 | vlefevre | 2005-12-16 16:58:24 +0000 (Fri, 16 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+Better definition for mpf_set_prec_raw (so that the value is kept).
+
+------------------------------------------------------------------------
+r3970 | vlefevre | 2005-12-08 11:56:03 +0000 (Thu, 08 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+Updated a comment.
+
+------------------------------------------------------------------------
+r3969 | vlefevre | 2005-12-08 11:51:41 +0000 (Thu, 08 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+Added test cases for a bug introduced on 2005-01-29 in sin.c rev 3248.
+
+------------------------------------------------------------------------
+r3968 | vlefevre | 2005-12-08 02:12:03 +0000 (Thu, 08 Dec 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+README.dev: remember to test MPFR on the worst cases.
+
+------------------------------------------------------------------------
+r3967 | zimmerma | 2005-11-29 20:56:16 +0000 (Tue, 29 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added lemma + reference
+
+------------------------------------------------------------------------
+r3966 | vlefevre | 2005-11-25 01:36:29 +0000 (Fri, 25 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Removed mpfr_div bug from BUGS (as it has been fixed).
+
+------------------------------------------------------------------------
+r3964 | vlefevre | 2005-11-25 00:59:13 +0000 (Fri, 25 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+Added consistency tests for mpfr_div (e.g. to test small-size divisors).
+
+------------------------------------------------------------------------
+r3963 | zimmerma | 2005-11-24 20:39:23 +0000 (Thu, 24 Nov 2005) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+fixed efficiency bug for small divisor (division had same cost than for
+divisor of the same size than the result)
+
+------------------------------------------------------------------------
+r3960 | vlefevre | 2005-11-23 14:35:54 +0000 (Wed, 23 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+
+Updated FAQ.
+
+------------------------------------------------------------------------
+r3959 | vlefevre | 2005-11-23 14:35:38 +0000 (Wed, 23 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/faq.xsl
+
+faq.xsl: add copyright information to the downloaded FAQ.
+
+------------------------------------------------------------------------
+r3957 | vlefevre | 2005-11-23 10:53:04 +0000 (Wed, 23 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/README.dev
+ M /trunk/update-version
+
+Added information about the patches to the INSTALL file.
+
+------------------------------------------------------------------------
+r3956 | vlefevre | 2005-11-23 08:38:39 +0000 (Wed, 23 Nov 2005) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+
+BUGS: Noted the slow division when the precision of the divisor
+is small compared to the precision of the target.
+
+------------------------------------------------------------------------
+r3955 | vlefevre | 2005-11-21 20:31:47 +0000 (Mon, 21 Nov 2005) | 3 lines
+Changed paths:
+ M /trunk/rootrem.c
+
+Fixed a bug preventing the compilation of MPFR with GMP 4.1.90
+(non-public development version) without the build directory.
+
+------------------------------------------------------------------------
+r3954 | vlefevre | 2005-11-21 14:43:49 +0000 (Mon, 21 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/rootrem.c
+
+Fixed memory leak in mpfr_mpn_rootrem().
+
+------------------------------------------------------------------------
+r3953 | vlefevre | 2005-11-09 16:34:09 +0000 (Wed, 09 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Added a note about running the trunk tests in a branch.
+
+------------------------------------------------------------------------
+r3952 | vlefevre | 2005-11-09 16:18:35 +0000 (Wed, 09 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tinternals.c
+ M /trunk/tests/tzeta_ui.c
+
+Make trunk tests work with MPFR 2.2 (branch), by testing the version.
+
+------------------------------------------------------------------------
+r3951 | vlefevre | 2005-11-09 16:09:16 +0000 (Wed, 09 Nov 2005) | 2 lines
+Changed paths:
+ D /trunk/tests/.cvsignore
+
+Removed .cvsignore file (useless after the switch to Subversion).
+
+------------------------------------------------------------------------
+r3948 | vlefevre | 2005-11-09 15:42:41 +0000 (Wed, 09 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/cache.c
+
+Added a MPFR_UNLIKELY.
+
+------------------------------------------------------------------------
+r3947 | vlefevre | 2005-11-09 14:41:46 +0000 (Wed, 09 Nov 2005) | 5 lines
+Changed paths:
+ M /trunk/round_near_x.c
+
+In mpfr_round_near_x, use the new MPFR_RNDRAW_GEN with a correct middle
+handler instead of MPFR_RNDRAW_EVEN so that the correction of the wrong
+rounding is no longer necessary (BTW, the wrong rounding could have lead
+to problems in case of intermediate underflow/overflow -- not checked).
+
+------------------------------------------------------------------------
+r3946 | vlefevre | 2005-11-09 14:05:46 +0000 (Wed, 09 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tinternals.c
+
+mpfr_round_near_x test completed.
+
+------------------------------------------------------------------------
+r3945 | vlefevre | 2005-11-09 11:57:03 +0000 (Wed, 09 Nov 2005) | 9 lines
+Changed paths:
+ M /trunk/tests/tcbrt.c
+
+Added a test for mpfr_cbrt, from the following failure with MPFR 2.2
+and gcc 4.0.2 under Linux/m68k:
+ Seed GMP_CHECK_RANDOMIZE=1131612275 (include this in bug reports)
+ results differ for x=1.1000e-2 prec=5 rnd_mode=GMP_RNDN
+ got 1.1000e-1
+ expected 1.0111e-1
+ approx 0.101110001001100E0
+ FAIL: tcbrt
+
+------------------------------------------------------------------------
+r3943 | vlefevre | 2005-11-04 22:11:53 +0000 (Fri, 04 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Improved note r3493 concerning mpfr_set_d/ld.
+
+------------------------------------------------------------------------
+r3941 | vlefevre | 2005-11-04 14:26:49 +0000 (Fri, 04 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+More information in the "Reporting Bugs" section.
+
+------------------------------------------------------------------------
+r3940 | vlefevre | 2005-11-04 01:28:04 +0000 (Fri, 04 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Added a comment about the macros MPFR_RNDRAW* and the labels.
+
+------------------------------------------------------------------------
+r3939 | vlefevre | 2005-11-04 00:58:23 +0000 (Fri, 04 Nov 2005) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+Moved definitions of struct __gmpfr_cache_s and mpfr_cache_t, and
+declarations of mpfr_init_cache, mpfr_clear_cache and mpfr_cache
+from mpfr.h to mpfr-impl.h as they are internal (not documented).
+
+------------------------------------------------------------------------
+r3938 | vlefevre | 2005-11-03 16:39:31 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tinternals.c
+
+Eliminated the case inex == 0.
+
+------------------------------------------------------------------------
+r3937 | vlefevre | 2005-11-03 16:26:38 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tinternals.c
+
+Started to write code to test mpfr_round_near_x.
+
+------------------------------------------------------------------------
+r3936 | vlefevre | 2005-11-03 14:32:01 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/strtofr.c
+
+Typos & English usage.
+
+------------------------------------------------------------------------
+r3935 | vlefevre | 2005-11-03 14:27:26 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/round_near_x.c
+
+Fixed typos.
+
+------------------------------------------------------------------------
+r3934 | zimmerma | 2005-11-03 09:24:43 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added hint on forbidden variable name
+
+------------------------------------------------------------------------
+r3932 | zimmerma | 2005-11-03 07:35:53 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added "tune" item for new releases
+
+------------------------------------------------------------------------
+r3931 | zimmerma | 2005-11-03 07:24:38 +0000 (Thu, 03 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+done make tune for amd64 with gmp-4.1.4
+
+------------------------------------------------------------------------
+r3929 | vlefevre | 2005-11-02 17:22:13 +0000 (Wed, 02 Nov 2005) | 15 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/hypot.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/thypot.c
+
+Merged the changes from branch vlefevre:
+ * mpfr-impl.h: Added MPFR_RNDRAW_GEN based on MPFR_RNDRAW and
+ MPFR_RNDRAW_EVEN codes, but taking an additional argument: a
+ handler executed in rounding to nearest mode when the value
+ is the middle of two consecutive numbers in dest precision.
+ MPFR_RNDRAW and MPFR_RNDRAW_EVEN are now defined by a "call"
+ to MPFR_RNDRAW_GEN.
+ * cache.c: Clean-up and use MPFR_RNDRAW_GEN instead of
+ MPFR_RNDRAW_EVEN to avoid an unnecessary correction in the
+ halfway case.
+ * hypot.c: Fixed mpfr_hypot when the rounding mode is to nearest,
+ x is "much larger" than y, and x is the middle of two consecutive
+ numbers in the target precision.
+ * tests/thypot.c: Added the corresponding testcase.
+
+------------------------------------------------------------------------
+r3928 | vlefevre | 2005-11-02 17:09:25 +0000 (Wed, 02 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk
+ M /trunk/tests
+
+Updated svn:ignore property.
+
+------------------------------------------------------------------------
+r3926 | zimmerma | 2005-11-02 16:12:59 +0000 (Wed, 02 Nov 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+fixed remaining problems
+
+------------------------------------------------------------------------
+r3924 | zimmerma | 2005-11-02 13:49:00 +0000 (Wed, 02 Nov 2005) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+
+declared variables as mp_prec_t instead of int
+use MPFR_MPZ_SIZEINBASE2 instead of mpz_sizeinbase
+
+------------------------------------------------------------------------
+r3919 | vlefevre | 2005-11-02 09:27:53 +0000 (Wed, 02 Nov 2005) | 5 lines
+Changed paths:
+ M /trunk/constant.c
+ M /trunk/mpfr-impl.h
+
+Reverted the latest change to constant.c: removed MPFR_THREAD_ATTR as
+these constants can be shared. Removed MPFR_THREAD_ATTR from mpfr-impl.h
+too (this should have been the right correction for rev 3838 concerning
+the type mismatch). Thanks to Patrick for noticing this.
+
+------------------------------------------------------------------------
+r3918 | vlefevre | 2005-10-31 21:27:08 +0000 (Mon, 31 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/int_ceil_log2.c
+ M /trunk/mpfr-impl.h
+
+Added an MPFR_UNLIKELY (suggested by Patrick) and an MPFR_ASSERTN.
+
+------------------------------------------------------------------------
+r3917 | zimmerma | 2005-10-31 18:55:13 +0000 (Mon, 31 Oct 2005) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/exp3.c
+
+factored calls to gmp_alloc
+removed unused variables
+
+------------------------------------------------------------------------
+r3916 | zimmerma | 2005-10-31 14:49:45 +0000 (Mon, 31 Oct 2005) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/atan.c
+ M /trunk/tanh.c
+
+improved atan (now can cut series before 2^m)
+revised error analysis and code of tanh
+
+------------------------------------------------------------------------
+r3915 | vlefevre | 2005-10-31 12:17:09 +0000 (Mon, 31 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/log10.c
+
+Reformat (GNU coding style).
+
+------------------------------------------------------------------------
+r3914 | vlefevre | 2005-10-31 12:08:13 +0000 (Mon, 31 Oct 2005) | 5 lines
+Changed paths:
+ M /trunk/div_ui.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul_ui.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tinternals.c
+
+Fixed MPFR_INT_CEIL_LOG2 (in mpfr-impl.h) and __gmpfr_int_ceil_log2
+(in int_ceil_log2.c) when the argument is a power of 2, and added a
+test (new test file tests/tinternals.c). This made a bug appear in
+div_ui.c and mul_ui.c; fixed that too.
+
+------------------------------------------------------------------------
+r3913 | vlefevre | 2005-10-31 11:43:58 +0000 (Mon, 31 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+Added a test that fails after fixing MPFR_INT_CEIL_LOG2.
+
+------------------------------------------------------------------------
+r3912 | zimmerma | 2005-10-30 20:07:45 +0000 (Sun, 30 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/exp3.c
+ M /trunk/tests/texp.c
+
+improved exp_3 (binary-splitting algorithm)
+
+------------------------------------------------------------------------
+r3911 | vlefevre | 2005-10-30 14:50:52 +0000 (Sun, 30 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Fixed padding-bit test.
+
+------------------------------------------------------------------------
+r3910 | vlefevre | 2005-10-30 13:20:46 +0000 (Sun, 30 Oct 2005) | 5 lines
+Changed paths:
+ M /trunk/cos.c
+
+3 corrections in cos.c concerning maxi:
+ * corrected a comment;
+ * failed if sizeof(int) <= sizeof(long) / 2;
+ * now take possible padding bits into account.
+
+------------------------------------------------------------------------
+r3909 | zimmerma | 2005-10-29 21:07:36 +0000 (Sat, 29 Oct 2005) | 4 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/exp3.c
+ M /trunk/root.c
+ M /trunk/rootrem.c
+
+patched root.c to use rootrem.c with gmp-4.1.90
+added comment in exp3.c
+added more initial guard bits in agm
+
+------------------------------------------------------------------------
+r3908 | zimmerma | 2005-10-29 13:14:20 +0000 (Sat, 29 Oct 2005) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mulders.c
+ M /trunk/sqr.c
+ M /trunk/tuneup.c
+
+now tune Mulders short square (not yet used)
+improved mpfr_cos
+
+------------------------------------------------------------------------
+r3907 | zimmerma | 2005-10-26 15:45:42 +0000 (Wed, 26 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/root.c
+ M /trunk/rootrem.c
+
+updated code for gmp-dev
+
+------------------------------------------------------------------------
+r3906 | vlefevre | 2005-10-26 11:28:36 +0000 (Wed, 26 Oct 2005) | 2 lines
+Changed paths:
+ D /trunk/.cvsignore
+
+Removed .cvsignore file (useless after the switch to Subversion).
+
+------------------------------------------------------------------------
+r3903 | vlefevre | 2005-10-25 01:33:31 +0000 (Tue, 25 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/update-version
+
+More portable update-version script (use perl instead of sed).
+
+------------------------------------------------------------------------
+r3889 | vlefevre | 2005-10-24 13:43:07 +0000 (Mon, 24 Oct 2005) | 4 lines
+Changed paths:
+ M /trunk/README
+ M /trunk/README.dev
+ D /trunk/fixperm
+
+First revision after the switch to Subversion:
+ * Removed fixperm as it is now useless.
+ * Updated README and README.dev files.
+
+------------------------------------------------------------------------
+r3888 | vlefevre | 2005-10-24 11:29:40 +0000 (Mon, 24 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3887 | zimmerma | 2005-10-19 20:23:44 +0000 (Wed, 19 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/algorithms.tex
+
+documented algorithm used in mpfr_agm and fixed code accordingly
+
+------------------------------------------------------------------------
+r3886 | zimmerma | 2005-10-10 09:43:26 +0000 (Mon, 10 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added efficiency item
+
+------------------------------------------------------------------------
+r3885 | zimmerma | 2005-10-10 09:16:44 +0000 (Mon, 10 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/mpzroot.c
+ M /trunk/root.c
+ M /trunk/rootrem.c
+
+now mpzroot/rootrem compile without gmp internal headers
+
+------------------------------------------------------------------------
+r3884 | vlefevre | 2005-10-07 16:43:40 +0000 (Fri, 07 Oct 2005) | 3 lines
+Changed paths:
+ M /trunk/root.c
+
+Disabled new rootrem/mpz_root as compilation fails (headers can't
+be found).
+
+------------------------------------------------------------------------
+r3883 | vlefevre | 2005-10-07 16:30:45 +0000 (Fri, 07 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Temporary optimization (patch from Patrick Pelissier).
+
+------------------------------------------------------------------------
+r3882 | vlefevre | 2005-10-06 10:03:56 +0000 (Thu, 06 Oct 2005) | 4 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+One of the tests was using the fabs function, but -lm isn't given when
+generating the executable, making the linking fail under HP-UX. Fixed
+by not using this fabs function.
+
+------------------------------------------------------------------------
+r3880 | zimmerma | 2005-10-05 21:57:48 +0000 (Wed, 05 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+small improvement in sign detection
+
+------------------------------------------------------------------------
+r3879 | zimmerma | 2005-10-05 20:36:56 +0000 (Wed, 05 Oct 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/mpzroot.c
+ M /trunk/root.c
+ A /trunk/rootrem.c
+
+improved mpfr_root, using the new mpn_rootrem code written with Torbjo"rn
+
+------------------------------------------------------------------------
+r3876 | vlefevre | 2005-09-29 09:52:33 +0000 (Thu, 29 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3875 | vlefevre | 2005-09-29 09:47:08 +0000 (Thu, 29 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/tests/tset_si.c
+
+Fixed bug in mpfr_set_ui macro when parameters are expressions
+with side effects.
+
+------------------------------------------------------------------------
+r3874 | zimmerma | 2005-09-29 06:40:15 +0000 (Thu, 29 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+fixed missing accent
+
+------------------------------------------------------------------------
+r3873 | vlefevre | 2005-09-28 15:30:17 +0000 (Wed, 28 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Small optimization.
+
+------------------------------------------------------------------------
+r3872 | vlefevre | 2005-09-28 14:28:19 +0000 (Wed, 28 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tlngamma.c
+
+Test the sign of 0.
+
+------------------------------------------------------------------------
+r3871 | zimmerma | 2005-09-28 14:14:42 +0000 (Wed, 28 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+ M /trunk/tests/tlngamma.c
+
+fixed infinite loop for lngamma(2)
+
+------------------------------------------------------------------------
+r3870 | vlefevre | 2005-09-28 00:45:27 +0000 (Wed, 28 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Updated libmpfr_la_LDFLAGS (note: it shouldn't be incremented again
+before the 2.3.0 release).
+
+------------------------------------------------------------------------
+r3869 | zimmerma | 2005-09-26 16:28:47 +0000 (Mon, 26 Sep 2005) | 2 lines
+Changed paths:
+ A /trunk/zeta_ui.c
+
+new function: Zeta with integer argument
+
+------------------------------------------------------------------------
+r3868 | zimmerma | 2005-09-23 21:35:03 +0000 (Fri, 23 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tzeta_ui.c
+
+new function mpfr_zeta_ui for integer argument
+
+------------------------------------------------------------------------
+r3867 | zimmerma | 2005-09-21 13:51:34 +0000 (Wed, 21 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added brief description of algorithm for mpfr_zeta
+
+------------------------------------------------------------------------
+r3863 | vlefevre | 2005-09-18 23:36:44 +0000 (Sun, 18 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Mentioned problems with the Tru64 make and other minor changes.
+
+------------------------------------------------------------------------
+r3861 | vlefevre | 2005-09-17 10:24:43 +0000 (Sat, 17 Sep 2005) | 5 lines
+Changed paths:
+ M /trunk/configure.in
+
+Fixed the GMP linking test: replaced __gmp_version, which corresponds
+to a variable, by __gmpz_init (suggested by the GMP documentation),
+which corresponds to a function, as the auto tools assume the symbol
+corresponds to a function. It was failing with the AIX linker.
+
+------------------------------------------------------------------------
+r3857 | vlefevre | 2005-09-16 14:22:40 +0000 (Fri, 16 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/const_euler.c
+
+Untabify.
+
+------------------------------------------------------------------------
+r3856 | vlefevre | 2005-09-16 13:22:53 +0000 (Fri, 16 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3854 | vlefevre | 2005-09-16 10:58:41 +0000 (Fri, 16 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Untabify.
+
+------------------------------------------------------------------------
+r3852 | zimmerma | 2005-09-16 09:41:47 +0000 (Fri, 16 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added missing documentation for mpfr_get_f and mpfr_pow_z
+
+------------------------------------------------------------------------
+r3851 | vlefevre | 2005-09-16 08:02:15 +0000 (Fri, 16 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fixed typos found by Tomonori Kouya.
+
+------------------------------------------------------------------------
+r3850 | zimmerma | 2005-09-16 07:38:22 +0000 (Fri, 16 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/coth.c
+ M /trunk/tests/tcoth.c
+
+fixed stupid bug (coth was computing 1/tan instead of 1/tanh)
+
+------------------------------------------------------------------------
+r3849 | zimmerma | 2005-09-15 21:55:08 +0000 (Thu, 15 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/const_euler.c
+
+fixed overflow problem for large precision
+
+------------------------------------------------------------------------
+r3848 | zimmerma | 2005-09-15 21:11:25 +0000 (Thu, 15 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+added log(precz) in initial precision
+
+------------------------------------------------------------------------
+r3844 | zimmerma | 2005-09-13 12:57:38 +0000 (Tue, 13 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/tests/texp.c
+
+fixed bug in exp(-eps) for rounding toward zero (test was also wrong...)
+
+------------------------------------------------------------------------
+r3843 | vlefevre | 2005-09-13 02:05:56 +0000 (Tue, 13 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Updated "To make a release".
+
+------------------------------------------------------------------------
+r3839 | vlefevre | 2005-09-13 01:32:41 +0000 (Tue, 13 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Minor update.
+
+------------------------------------------------------------------------
+r3838 | vlefevre | 2005-09-13 01:28:09 +0000 (Tue, 13 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/constant.c
+
+Added missing MPFR_THREAD_ATTR.
+
+------------------------------------------------------------------------
+r3835 | vlefevre | 2005-09-11 22:50:06 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tuneup.c
+
+Avoid a conflict with GMP.
+
+------------------------------------------------------------------------
+r3834 | vlefevre | 2005-09-11 22:37:58 +0000 (Sun, 11 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/mparam_h.in
+ M /trunk/mul.c
+ M /trunk/tuneup.c
+
+Reverted to previous mparam_h.in and mul.c, and applied Patrick's
+patch instead.
+
+------------------------------------------------------------------------
+r3832 | vlefevre | 2005-09-11 22:15:29 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3830 | vlefevre | 2005-09-11 21:59:31 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tstckintc.c
+
+Added #include <string.h> for memmove (see ISO C99 standard).
+
+------------------------------------------------------------------------
+r3829 | vlefevre | 2005-09-11 21:56:32 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Minor change.
+
+------------------------------------------------------------------------
+r3828 | vlefevre | 2005-09-11 21:55:20 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/trint.c
+
+Fixed uninitialized variable (with gcc -std=c99).
+
+------------------------------------------------------------------------
+r3827 | vlefevre | 2005-09-11 21:43:14 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fixed a #ifdef (when --enable-assert isn't used).
+
+------------------------------------------------------------------------
+r3824 | vlefevre | 2005-09-11 18:21:02 +0000 (Sun, 11 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3823 | vlefevre | 2005-09-11 17:56:43 +0000 (Sun, 11 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/int_ceil_log2.c
+ M /trunk/mpfr-impl.h
+
+Changed the MPFR_ASSERTD into a MPFR_ASSERTN for MPFR_INT_CEIL_LOG2
+since the assertion cannot be guaranteed for every C implementation.
+
+------------------------------------------------------------------------
+r3822 | pelissip | 2005-09-10 15:20:48 +0000 (Sat, 10 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fix spelling mistake.
+
+------------------------------------------------------------------------
+r3821 | pelissip | 2005-09-10 15:17:54 +0000 (Sat, 10 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add new note about MPFR_TMP_DECL
+
+------------------------------------------------------------------------
+r3819 | zimmerma | 2005-09-09 14:45:54 +0000 (Fri, 09 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+reduced default of MPFR_MUL_THRESHOLD by 1, since now MPFR_MUL_THRESHOLD+1
+is considered in mul.c
+
+------------------------------------------------------------------------
+r3818 | vlefevre | 2005-09-09 14:37:51 +0000 (Fri, 09 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+Fixed another LaTeX error.
+
+------------------------------------------------------------------------
+r3817 | vlefevre | 2005-09-09 14:26:08 +0000 (Fri, 09 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3816 | vlefevre | 2005-09-09 12:09:47 +0000 (Fri, 09 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Updated "To make a release".
+
+------------------------------------------------------------------------
+r3815 | vlefevre | 2005-09-09 10:21:11 +0000 (Fri, 09 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Use (mpz_t *) 0 instead of NULL (this is not less clear and this
+works with the native SunOS 4 C compiler).
+
+------------------------------------------------------------------------
+r3814 | zimmerma | 2005-09-09 09:33:04 +0000 (Fri, 09 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+avoid . in mpf_set_str (locale-sensitive)
+
+------------------------------------------------------------------------
+r3813 | zimmerma | 2005-09-09 09:26:22 +0000 (Fri, 09 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/lngamma.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tlngamma.c
+
+cleanup of gamma and lngamma
+
+------------------------------------------------------------------------
+r3812 | zimmerma | 2005-09-08 09:37:46 +0000 (Thu, 08 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+MUL_THRESHOLD -> MUL_THRESHOLD+1 (to allow MUL_THRESHOLD=0, needed for
+tuneup.c)
+
+------------------------------------------------------------------------
+r3811 | zimmerma | 2005-09-08 09:21:02 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+fixed LaTeX error
+
+------------------------------------------------------------------------
+r3809 | vlefevre | 2005-09-08 09:12:20 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Fix.
+
+------------------------------------------------------------------------
+r3808 | vlefevre | 2005-09-08 09:08:46 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3804 | vlefevre | 2005-09-08 09:02:58 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ A /trunk/fixperm
+
+Added fixperm script to fix the file permissions broken by CVS.
+
+------------------------------------------------------------------------
+r3803 | vlefevre | 2005-09-08 09:01:50 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update.
+
+------------------------------------------------------------------------
+r3798 | zimmerma | 2005-09-08 06:48:10 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item
+
+------------------------------------------------------------------------
+r3797 | vlefevre | 2005-09-08 06:45:52 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3795 | vlefevre | 2005-09-08 02:51:45 +0000 (Thu, 08 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Fix: readded dependencies.
+
+------------------------------------------------------------------------
+r3793 | vlefevre | 2005-09-06 14:37:32 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tversion.c
+
+More detailed error message.
+
+------------------------------------------------------------------------
+r3791 | vlefevre | 2005-09-06 13:54:57 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Change for ansi2knr.
+
+------------------------------------------------------------------------
+r3790 | vlefevre | 2005-09-06 13:42:02 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Code clean-up (again).
+
+------------------------------------------------------------------------
+r3789 | vlefevre | 2005-09-06 13:31:12 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Use GMP's allocate functions instead of C's. Code clean-up.
+
+------------------------------------------------------------------------
+r3788 | vlefevre | 2005-09-06 13:02:37 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/lngamma.c
+
+Reformat.
+
+------------------------------------------------------------------------
+r3787 | zimmerma | 2005-09-06 12:42:39 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+missing set_emin
+
+------------------------------------------------------------------------
+r3786 | zimmerma | 2005-09-06 12:25:03 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+added missing call to MPFR_TEST_USE_RANDS() [3 blocks non-freed]
+
+------------------------------------------------------------------------
+r3784 | vlefevre | 2005-09-06 12:00:54 +0000 (Tue, 06 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+Fixed a bug (detected after mpfr_set_str_binary has been fixed)
+in tests/tsub.c introduced in 1.6 (2001-10-19).
+
+------------------------------------------------------------------------
+r3783 | vlefevre | 2005-09-06 11:50:09 +0000 (Tue, 06 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+mpfr_set_str_binary was buggy and inefficient. Let's use mpfr_strtofr.
+
+------------------------------------------------------------------------
+r3781 | vlefevre | 2005-09-06 11:30:40 +0000 (Tue, 06 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Replaced unsigned long bit-fields (GCC extension) by insigned int
+bit-fields.
+
+------------------------------------------------------------------------
+r3779 | vlefevre | 2005-09-05 13:28:20 +0000 (Mon, 05 Sep 2005) | 4 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+MPN_COPY now calls memcpy only if dst != src (otherwise this is an
+undefined behavior), and if WANT_ASSERT is defined, it checks that
+there is no overlap.
+
+------------------------------------------------------------------------
+r3776 | vlefevre | 2005-09-02 14:08:09 +0000 (Fri, 02 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Avoid MIPSpro / IRIX64 (incorrect) optimizations for DOUBLE_ISNAN.
+
+------------------------------------------------------------------------
+r3775 | vlefevre | 2005-09-02 13:25:32 +0000 (Fri, 02 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-impl.h
+
+More portable DOUBLE_ISNAN (useful for MIPSpro under IRIX64).
+
+------------------------------------------------------------------------
+r3774 | zimmerma | 2005-09-02 12:55:37 +0000 (Fri, 02 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+improved trade-off between fac_ui and gamma when argument is integer
+
+------------------------------------------------------------------------
+r3773 | vlefevre | 2005-09-02 12:33:24 +0000 (Fri, 02 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Reformat.
+
+------------------------------------------------------------------------
+r3772 | zimmerma | 2005-09-02 09:52:07 +0000 (Fri, 02 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed remaining problem in gamma
+removed LogGamma from TODO
+
+------------------------------------------------------------------------
+r3771 | vlefevre | 2005-09-02 08:17:37 +0000 (Fri, 02 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/sub1sp.c
+
+Do not put expressions with side effects in MPFR_ASSERTN.
+
+------------------------------------------------------------------------
+r3770 | zimmerma | 2005-09-01 21:44:42 +0000 (Thu, 01 Sep 2005) | 3 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+now uses lngamma code for x < 1 too
+added new tests from Kenneth Wilder
+
+------------------------------------------------------------------------
+r3769 | zimmerma | 2005-09-01 11:54:57 +0000 (Thu, 01 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+added another test
+
+------------------------------------------------------------------------
+r3768 | zimmerma | 2005-09-01 08:59:19 +0000 (Thu, 01 Sep 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+removed useless prototype
+
+------------------------------------------------------------------------
+r3764 | vlefevre | 2005-08-31 23:57:06 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+Fixed memory leak (missing MPFR_TMP_FREE in a particular case).
+
+------------------------------------------------------------------------
+r3763 | vlefevre | 2005-08-31 23:52:53 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+Fixed the code formatting.
+
+------------------------------------------------------------------------
+r3762 | vlefevre | 2005-08-31 23:38:13 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Updated Point 6 of "To make a release".
+
+------------------------------------------------------------------------
+r3761 | vlefevre | 2005-08-31 23:27:29 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Fixed memory leak (missing MPFR_TMP_FREE in a particular case).
+
+------------------------------------------------------------------------
+r3759 | zimmerma | 2005-08-31 20:32:03 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added lngamma
+
+------------------------------------------------------------------------
+r3758 | zimmerma | 2005-08-31 20:29:36 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added new test (emax)
+
+------------------------------------------------------------------------
+r3757 | zimmerma | 2005-08-31 20:28:25 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+now random tests also use x >= 1
+
+------------------------------------------------------------------------
+r3756 | zimmerma | 2005-08-31 20:26:33 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+added SAVE_EXPO stuff
+
+------------------------------------------------------------------------
+r3754 | zimmerma | 2005-08-31 20:25:36 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ A /trunk/lngamma.c
+ M /trunk/mpfr.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tlngamma.c
+
+new function lngamma
+
+------------------------------------------------------------------------
+r3753 | zimmerma | 2005-08-31 20:24:16 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+now uses lngamma code for x > 1
+
+------------------------------------------------------------------------
+r3752 | zimmerma | 2005-08-31 20:23:06 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added lngamma
+
+------------------------------------------------------------------------
+r3750 | vlefevre | 2005-08-31 12:21:14 +0000 (Wed, 31 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/VERSION
+ M /trunk/configure.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated version to 2.3.0.
+
+------------------------------------------------------------------------
+r3749 | vlefevre | 2005-08-31 12:18:31 +0000 (Wed, 31 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+Fix for the following problem: #error is not sufficient with cc
+on IRIX64, and autoconf 2.59 doesn't cope with that.
+
+------------------------------------------------------------------------
+r3745 | vlefevre | 2005-08-30 13:23:51 +0000 (Tue, 30 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk
+ A /trunk/.cvsignore
+ M /trunk/tests
+ A /trunk/tests/.cvsignore
+
+Added .cvsignore files.
+
+------------------------------------------------------------------------
+r3744 | vlefevre | 2005-08-30 12:08:42 +0000 (Tue, 30 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Unobfuscated 2 assertions.
+
+------------------------------------------------------------------------
+r3743 | vlefevre | 2005-08-30 11:59:12 +0000 (Tue, 30 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Fixed indentation and some comments.
+
+------------------------------------------------------------------------
+r3742 | vlefevre | 2005-08-30 11:49:24 +0000 (Tue, 30 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Recommitted the patch (without discarding previous modifications).
+
+------------------------------------------------------------------------
+r3741 | vlefevre | 2005-08-30 11:46:58 +0000 (Tue, 30 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+Reverted to the previous version, as the patch discarded previous
+modifications.
+
+------------------------------------------------------------------------
+r3740 | zimmerma | 2005-08-30 10:27:11 +0000 (Tue, 30 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+added two new tests
+
+------------------------------------------------------------------------
+r3739 | zimmerma | 2005-08-30 10:09:59 +0000 (Tue, 30 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+patch from Patrick to solve efficiency problem when one operand is sparse
+(e.g. from ui_pow_ui)
+
+------------------------------------------------------------------------
+r3738 | zimmerma | 2005-08-29 14:07:51 +0000 (Mon, 29 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/gamma.c
+ M /trunk/mpfr-impl.h
+ M /trunk/pow.c
+ M /trunk/tests/tgamma.c
+
+check for overflow/underflow in pow and gamma
+
+------------------------------------------------------------------------
+r3737 | vlefevre | 2005-08-24 15:37:36 +0000 (Wed, 24 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/print_raw.c
+ M /trunk/sub1sp.c
+
+When WANT_ASSERT >= 2: the corresponding messages are now output
+to stderr instead of stdout.
+
+------------------------------------------------------------------------
+r3736 | vlefevre | 2005-08-24 14:23:41 +0000 (Wed, 24 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3735 | vlefevre | 2005-08-24 14:16:04 +0000 (Wed, 24 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/set_uj.c
+
+Improved C compliance when mp_limb_t and uintmax_t have the same size
+(concerning >> BITS_PER_MP_LIMB); some other small improvements.
+
+------------------------------------------------------------------------
+r3734 | vlefevre | 2005-08-24 13:27:12 +0000 (Wed, 24 Aug 2005) | 5 lines
+Changed paths:
+ M /trunk/round_p.c
+ M /trunk/tests/tcan_round.c
+
+No longer assume that a mp_limb_t fits in an unsigned long (this
+is not true under IRIX, where a mp_limb_t has 64 bits and a long
+has 32 bits by default). In round_p.c, error messages are output
+to stderr instead of stdout.
+
+------------------------------------------------------------------------
+r3733 | vlefevre | 2005-08-23 17:21:45 +0000 (Tue, 23 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3732 | vlefevre | 2005-08-23 15:57:21 +0000 (Tue, 23 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+This was wrong. Let's do it even more like the 2.1 branch.
+
+------------------------------------------------------------------------
+r3731 | vlefevre | 2005-08-23 15:41:39 +0000 (Tue, 23 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3730 | vlefevre | 2005-08-23 15:37:53 +0000 (Tue, 23 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Patch 1.25 didn't work under OSF1 with cc. Let's do it like
+the 2.1 branch (it now does work under OSF1 with cc).
+
+------------------------------------------------------------------------
+r3729 | vlefevre | 2005-08-21 22:57:15 +0000 (Sun, 21 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.texi
+ M /trunk/out_str.c
+ M /trunk/strtofr.c
+
+Better locale support (for the decimal point in string conversions
+and input/output).
+
+------------------------------------------------------------------------
+r3728 | vlefevre | 2005-08-18 17:17:02 +0000 (Thu, 18 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3727 | vlefevre | 2005-08-18 17:08:30 +0000 (Thu, 18 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Misc changes (spelling, typography...).
+
+------------------------------------------------------------------------
+r3726 | vlefevre | 2005-08-18 17:03:17 +0000 (Thu, 18 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1sp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/coth.c
+ M /trunk/div-short.c
+ M /trunk/div.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uintmax.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/gamma.c
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_str.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/gmp_op.c
+ M /trunk/inp_str.c
+ M /trunk/isinteger.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/log_b2.h
+ M /trunk/minmax.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/out_str.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/print_raw.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/root.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sqrt.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/swap.c
+ M /trunk/tanh.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/urandomb.c
+
+Removed trailing spaces (better for future patches, as such spaces
+are sometimes stripped).
+
+------------------------------------------------------------------------
+r3725 | vlefevre | 2005-08-18 16:35:19 +0000 (Thu, 18 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1sp.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div-short.c
+ M /trunk/div.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_ld.c
+ M /trunk/get_str.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/init2.c
+ M /trunk/inp_str.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/print_raw.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_q.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/RRTest.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/zeta.c
+
+Converted tabs to spaces with expand.
+
+------------------------------------------------------------------------
+r3724 | vlefevre | 2005-08-18 15:27:33 +0000 (Thu, 18 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/extract.c
+ M /trunk/fits_u.h
+ M /trunk/free_cache.c
+ M /trunk/generic.c
+ M /trunk/get_si.c
+ M /trunk/init2.c
+ M /trunk/mpfr-test.h
+ M /trunk/next.c
+ M /trunk/print_raw.c
+ M /trunk/set_f.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tversion.c
+
+Updated copyright line.
+
+------------------------------------------------------------------------
+r3723 | vlefevre | 2005-08-18 14:51:33 +0000 (Thu, 18 Aug 2005) | 4 lines
+Changed paths:
+ M /trunk/set_ld.c
+ M /trunk/tests/tset_ld.c
+
+Support C implementations giving an incorrect value for the precision
+of long double or where long doubles are implemented with FP expansions
+(like under Mac OS X), as in the 2.1 branch.
+
+------------------------------------------------------------------------
+r3722 | vlefevre | 2005-08-18 13:46:30 +0000 (Thu, 18 Aug 2005) | 5 lines
+Changed paths:
+ M /trunk/get_ld.c
+ M /trunk/mpfr-impl.h
+
+Updated mpfr_get_ld: removed useless and non-portable hacks, fixed
+bugs, and slightly changed the behavior for the x87 extended format
+(we shouldn't return long double's with more precision than really
+supported, e.g. on FreeBSD and NetBSD).
+
+------------------------------------------------------------------------
+r3721 | vlefevre | 2005-08-18 13:08:07 +0000 (Thu, 18 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+Added an assertion.
+
+------------------------------------------------------------------------
+r3720 | vlefevre | 2005-08-17 16:45:18 +0000 (Wed, 17 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Reformatted (GNU style).
+
+------------------------------------------------------------------------
+r3719 | pelissip | 2005-08-17 16:26:10 +0000 (Wed, 17 Aug 2005) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+Improve the warning message by adding the lines:
+"we cannot run a program linked with GMP (if you cannot
+see the version numbers above)."
+
+------------------------------------------------------------------------
+r3718 | zimmerma | 2005-08-16 14:26:05 +0000 (Tue, 16 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added pointer for gamma
+
+------------------------------------------------------------------------
+r3717 | zimmerma | 2005-08-16 14:24:15 +0000 (Tue, 16 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+fixed comments (code did not change)
+
+------------------------------------------------------------------------
+r3716 | zimmerma | 2005-08-16 14:01:22 +0000 (Tue, 16 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+ M /trunk/gamma.c
+
+added formula for gamma function
+
+------------------------------------------------------------------------
+r3715 | zimmerma | 2005-08-16 13:20:14 +0000 (Tue, 16 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+fixed last test (expected result was wrong)
+
+------------------------------------------------------------------------
+r3714 | zimmerma | 2005-08-16 13:19:09 +0000 (Tue, 16 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+fixed bug for tiny input
+
+------------------------------------------------------------------------
+r3713 | zimmerma | 2005-08-16 09:36:05 +0000 (Tue, 16 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+added test case
+
+------------------------------------------------------------------------
+r3712 | pelissip | 2005-08-12 15:11:37 +0000 (Fri, 12 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Reintroduce the computing of the dependencies.
+
+------------------------------------------------------------------------
+r3711 | vlefevre | 2005-08-11 14:56:47 +0000 (Thu, 11 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tset_d.c
+
+Added MPFR_DOUBLE_SPEC (not used yet, except for warning messages).
+
+------------------------------------------------------------------------
+r3710 | vlefevre | 2005-08-10 20:41:16 +0000 (Wed, 10 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Completed the documentation of mpfr_strtofr (concerning the exponent).
+
+------------------------------------------------------------------------
+r3709 | vlefevre | 2005-08-10 20:32:41 +0000 (Wed, 10 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Removed double spaces in mpfr_strtofr description (this matters
+for the info format).
+
+------------------------------------------------------------------------
+r3708 | vlefevre | 2005-08-10 01:02:57 +0000 (Wed, 10 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+Added a temporary test for non-IEEE-754 double's.
+
+------------------------------------------------------------------------
+r3707 | pelissip | 2005-08-09 08:17:14 +0000 (Tue, 09 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/tests/tstckintc.c
+
+Fix bug for pre-ansi compiler.
+
+------------------------------------------------------------------------
+r3706 | pelissip | 2005-08-09 08:16:46 +0000 (Tue, 09 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Remove redundant entries.
+
+------------------------------------------------------------------------
+r3705 | zimmerma | 2005-08-08 13:01:31 +0000 (Mon, 08 Aug 2005) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/TODO
+ M /trunk/sin.c
+ M /trunk/tests/tsin.c
+
+fixed bug in mpfr_sin (possible wrong inexact flag for rounding to nearest)
+added items in NEWS and TODO
+
+------------------------------------------------------------------------
+r3704 | pelissip | 2005-08-05 23:09:58 +0000 (Fri, 05 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update information
+
+------------------------------------------------------------------------
+r3703 | pelissip | 2005-08-05 23:08:29 +0000 (Fri, 05 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/stack_interface.c
+ M /trunk/tests/tstckintc.c
+
+Rename mpfr_stack to mpfr_custom_
+
+------------------------------------------------------------------------
+r3695 | vlefevre | 2005-08-03 10:35:59 +0000 (Wed, 03 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/FAQ.html
+ M /trunk/README
+
+Added/updated copyright information.
+
+------------------------------------------------------------------------
+r3694 | vlefevre | 2005-08-03 10:13:41 +0000 (Wed, 03 Aug 2005) | 2 lines
+Changed paths:
+ M /branches/mpfr-2-1-branch/NEWS
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3693 | pelissip | 2005-08-02 08:28:22 +0000 (Tue, 02 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove "Stack Interface" from TODO.
+
+------------------------------------------------------------------------
+r3692 | pelissip | 2005-08-01 15:23:51 +0000 (Mon, 01 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tsubnormal.c
+
+Add test file for mpfr_subnormalize
+
+------------------------------------------------------------------------
+r3691 | pelissip | 2005-08-01 15:23:07 +0000 (Mon, 01 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation for MPFR stack interface
+
+------------------------------------------------------------------------
+r3690 | pelissip | 2005-08-01 14:04:35 +0000 (Mon, 01 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tstckintc.c
+
+Add a new test to avoid potential problems if mp_limb_t != long.
+
+------------------------------------------------------------------------
+r3689 | vlefevre | 2005-08-01 10:04:33 +0000 (Mon, 01 Aug 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3685 | pelissip | 2005-07-26 16:08:02 +0000 (Tue, 26 Jul 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/stack_interface.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tstckintc.c
+
+Add first version of MPFR stack interface.
+Need to check if everything is ok, specially the test.
+
+------------------------------------------------------------------------
+r3684 | pelissip | 2005-07-26 14:07:18 +0000 (Tue, 26 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fix and clean up logging for GCC 4.0.x
+
+------------------------------------------------------------------------
+r3683 | pelissip | 2005-07-26 13:02:30 +0000 (Tue, 26 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Clean up code.
+
+------------------------------------------------------------------------
+r3682 | pelissip | 2005-07-26 12:26:08 +0000 (Tue, 26 Jul 2005) | 4 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/logging.c
+ M /trunk/mpfr-impl.h
+
+Improve logging:
+ + The file is not created if there is nothing to log.
+ + Add new ENVIRONMENT variables: MPFR_LOG_ALL and MPFR_LOG_STAT.
+
+------------------------------------------------------------------------
+r3681 | pelissip | 2005-07-26 12:06:11 +0000 (Tue, 26 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Add experimental code (Disabled).
+
+------------------------------------------------------------------------
+r3680 | pelissip | 2005-07-26 12:05:45 +0000 (Tue, 26 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+Fix comment
+
+------------------------------------------------------------------------
+r3679 | pelissip | 2005-07-26 12:05:03 +0000 (Tue, 26 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+Add a new regression test (to fix).
+
+------------------------------------------------------------------------
+r3678 | pelissip | 2005-07-22 14:01:30 +0000 (Fri, 22 Jul 2005) | 4 lines
+Changed paths:
+ M /trunk/erfc.c
+
+Fix bug for high values of input (assertion failed)
+because erf(x) ~ 1, so 1-erf(x) ~ 0, and we can't
+get the EXP of tmp.
+
+------------------------------------------------------------------------
+r3677 | pelissip | 2005-07-18 12:55:30 +0000 (Mon, 18 Jul 2005) | 3 lines
+Changed paths:
+ M /trunk/update-version
+
+Fix bug (AC_INIT version wasn't updated).
+Display a note about libtool version before quitting.
+
+------------------------------------------------------------------------
+r3676 | pelissip | 2005-07-18 12:54:45 +0000 (Mon, 18 Jul 2005) | 4 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Clean up.
+Add comment.
+Add a new test: check if the charset has consecutive values.
+
+------------------------------------------------------------------------
+r3675 | vlefevre | 2005-07-12 21:27:55 +0000 (Tue, 12 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Updated documentation of mpfr_strtofr.
+
+------------------------------------------------------------------------
+r3674 | pelissip | 2005-07-12 09:48:36 +0000 (Tue, 12 Jul 2005) | 3 lines
+Changed paths:
+ M /trunk/exp3.c
+
+Fix an overflow bug (use of int instead of unsigned long).
+Optimize code (5% faster).
+
+------------------------------------------------------------------------
+r3671 | vlefevre | 2005-07-11 16:13:27 +0000 (Mon, 11 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-impl.h
+ D /trunk/strcasecmp.c
+ D /trunk/strncasecmp.c
+ M /trunk/strtofr.c
+
+Fixed locale bug. Function strncasecmp is no longer used.
+
+------------------------------------------------------------------------
+r3670 | vlefevre | 2005-07-09 17:52:53 +0000 (Sat, 09 Jul 2005) | 5 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/acinclude.m4
+ M /trunk/tests/tests.c
+
+In the tests, set the locale to the current one. This allows to test
+MPFR under various locales, showing a bug in the parse_string function
+due to the use of the strncasecmp function ('i' and 'I' don't match
+with LC_ALL="tr_TR.ISO8859-9").
+
+------------------------------------------------------------------------
+r3669 | pelissip | 2005-07-07 07:38:02 +0000 (Thu, 07 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Improve displayed warning if GMP versions differ.
+
+------------------------------------------------------------------------
+r3668 | pelissip | 2005-07-06 08:45:47 +0000 (Wed, 06 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Add a solution for a problem.
+
+------------------------------------------------------------------------
+r3667 | vlefevre | 2005-07-05 13:47:37 +0000 (Tue, 05 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+Added in-place tests for atan(+/-0).
+
+------------------------------------------------------------------------
+r3665 | pelissip | 2005-07-05 08:04:21 +0000 (Tue, 05 Jul 2005) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+
+Fix bug of signed 0.
+Optimize code. (20% for 53 bits).
+
+------------------------------------------------------------------------
+r3664 | pelissip | 2005-07-05 08:03:38 +0000 (Tue, 05 Jul 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+Improve test for signed 0.
+
+------------------------------------------------------------------------
+r3663 | pelissip | 2005-06-28 16:46:42 +0000 (Tue, 28 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+
+Simplify a condition which was always true.
+(p is always negative).
+
+------------------------------------------------------------------------
+r3662 | pelissip | 2005-06-28 16:13:03 +0000 (Tue, 28 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Add assertion.
+
+------------------------------------------------------------------------
+r3661 | pelissip | 2005-06-28 16:09:00 +0000 (Tue, 28 Jun 2005) | 4 lines
+Changed paths:
+ M /trunk/atan.c
+
+Simplify code for final step (when i== n0):
+since we do n0-i=0 steps, atan(Ak/2^k) ~= Ak/2^k.
+So we could speed up the final computation (9% faster).
+
+------------------------------------------------------------------------
+r3660 | pelissip | 2005-06-28 15:52:32 +0000 (Tue, 28 Jun 2005) | 4 lines
+Changed paths:
+ M /trunk/atan.c
+
+Optimize: when computing arctan(p/2^r) simplify
+p/2^r if p is even.
+Clean up and remove tabi table. It was useless.
+
+------------------------------------------------------------------------
+r3659 | pelissip | 2005-06-22 08:58:50 +0000 (Wed, 22 Jun 2005) | 6 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Clean up configure and acinclude:
+ + Remove useless test in MPFR_CONFIGS (Check for valid NAN).
+ Its result is not use by MPFR.
+ + Remove useless macros (AC_CHECK_OS, AC_CHECK_MACH and AC_MY_HEADERS).
+ + Move detection of math/rint,round,floor,ceil to MPFR_CONFIGS.
+
+------------------------------------------------------------------------
+r3658 | vlefevre | 2005-06-20 09:30:34 +0000 (Mon, 20 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+GNU coding style.
+
+------------------------------------------------------------------------
+r3657 | zimmerma | 2005-06-16 13:48:23 +0000 (Thu, 16 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+improved m=0 case when b is a power of 2
+
+------------------------------------------------------------------------
+r3656 | pelissip | 2005-06-15 16:12:27 +0000 (Wed, 15 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+
+Replace mpfr_div_2ui call by SET_EXP/GET_EXP
+since it can't overflow.
+
+------------------------------------------------------------------------
+r3655 | pelissip | 2005-06-15 15:47:16 +0000 (Wed, 15 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Speed up a few (from 10822 to 10600).
+
+------------------------------------------------------------------------
+r3654 | pelissip | 2005-06-15 13:56:23 +0000 (Wed, 15 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update
+
+------------------------------------------------------------------------
+r3653 | pelissip | 2005-06-14 11:42:25 +0000 (Tue, 14 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/powerof2.c
+
+Replace check for a power of 2 for the high limb by a check
+for "high bit limb" for the high limb.
+
+------------------------------------------------------------------------
+r3652 | pelissip | 2005-06-14 11:30:10 +0000 (Tue, 14 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Fix bug in mul_ui (always alloc buffer instead of trying to reuse it).
+
+------------------------------------------------------------------------
+r3651 | pelissip | 2005-06-14 11:27:56 +0000 (Tue, 14 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+Add new test (failed).
+
+------------------------------------------------------------------------
+r3650 | pelissip | 2005-06-14 11:17:55 +0000 (Tue, 14 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/div_ui.c
+ M /trunk/mul_ui.c
+
+Add Fast case for u==1
+Add Fast case for u a power of 2 (Call mul/div_2si).
+
+------------------------------------------------------------------------
+r3649 | pelissip | 2005-06-14 09:04:44 +0000 (Tue, 14 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Fix bug (use of GCC specific attribute).
+
+------------------------------------------------------------------------
+r3648 | pelissip | 2005-06-13 12:19:30 +0000 (Mon, 13 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/root.c
+ M /trunk/tests/troot.c
+
+Rechnage the meaning of root for k=0.
+
+------------------------------------------------------------------------
+r3647 | pelissip | 2005-06-13 12:03:30 +0000 (Mon, 13 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/root.c
+ M /trunk/tests/troot.c
+
+Fix bug with x<0 and k even
+
+------------------------------------------------------------------------
+r3646 | pelissip | 2005-06-13 11:45:50 +0000 (Mon, 13 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/root.c
+ M /trunk/tests/troot.c
+
+Add special case for k==0
+Add test for special case k==0
+
+------------------------------------------------------------------------
+r3645 | zimmerma | 2005-06-13 11:33:57 +0000 (Mon, 13 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+added assertion
+
+------------------------------------------------------------------------
+r3644 | pelissip | 2005-06-13 11:23:37 +0000 (Mon, 13 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/cache.c
+
+Improve efficiency of initial call to mpfr_cache.
+
+------------------------------------------------------------------------
+r3643 | pelissip | 2005-06-13 08:51:44 +0000 (Mon, 13 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsum.c
+
+Add new check (+INF -INF --> NAN).
+
+------------------------------------------------------------------------
+r3642 | pelissip | 2005-06-10 15:11:02 +0000 (Fri, 10 Jun 2005) | 6 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/sum.c
+ M /trunk/tests/tsum.c
+
+Fix bug of NAN and INF.
+Fix bug in documentation (mpfr_sum wasn't exactly what is decribed).
+Improve test.
+Change internal names.
+Clean up.
+
+------------------------------------------------------------------------
+r3641 | pelissip | 2005-06-10 15:05:54 +0000 (Fri, 10 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/eint.c
+
+Fix bug: check if mpfr_log returns 0.
+
+------------------------------------------------------------------------
+r3640 | pelissip | 2005-06-08 12:35:31 +0000 (Wed, 08 Jun 2005) | 5 lines
+Changed paths:
+ M /trunk/eint.c
+
+Replace MPFR_EXP to MPFR_GET_EXP
+Use GROUP function
+Use MPFR_MPZ_SIZEINBASE2
+Factorize the mpfr_mul_2exp chain.
+
+------------------------------------------------------------------------
+r3639 | pelissip | 2005-06-08 12:34:47 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+Replace int to mp_prec_t for precision...
+
+------------------------------------------------------------------------
+r3638 | pelissip | 2005-06-08 12:34:21 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/const_euler.c
+ M /trunk/mulders.c
+ M /trunk/zeta.c
+
+Fix warning due to comparison of unsigned and signed integers.
+
+------------------------------------------------------------------------
+r3637 | pelissip | 2005-06-08 11:45:06 +0000 (Wed, 08 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/extract.c
+ M /trunk/strtofr.c
+
+Fix warnings due to comparaison between signed and unsigned.
+Reinclude string.h for strtofr.
+
+------------------------------------------------------------------------
+r3635 | vlefevre | 2005-06-08 10:18:24 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+
+Fixed bug introduced with the new internal format on 2003-10-27.
+
+------------------------------------------------------------------------
+r3634 | vlefevre | 2005-06-08 10:02:28 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+
+Updated comments.
+
+------------------------------------------------------------------------
+r3633 | pelissip | 2005-06-08 10:00:21 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Fix introduced bug due to missing NULL.
+
+------------------------------------------------------------------------
+r3632 | pelissip | 2005-06-08 09:58:57 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/clear.c
+
+Fix introduced bug (NULL not defined).
+
+------------------------------------------------------------------------
+r3631 | pelissip | 2005-06-08 09:53:48 +0000 (Wed, 08 Jun 2005) | 4 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/atan.c
+ M /trunk/clear.c
+ M /trunk/div.c
+ M /trunk/gamma.c
+ M /trunk/get_f.c
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/round_p.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/strtofr.c
+ M /trunk/sub1sp.c
+ M /trunk/subnormal.c
+ M /trunk/zeta.c
+
+Clean up use of stdio.h:
+ it is now included by mpfr-impl iff DEBUG is defined or WANT_ASSERT is
+defined.
+
+------------------------------------------------------------------------
+r3630 | pelissip | 2005-06-08 09:53:05 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsum.c
+
+Fix warnings.
+
+------------------------------------------------------------------------
+r3629 | pelissip | 2005-06-08 09:13:41 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Clean up code.
+
+------------------------------------------------------------------------
+r3628 | pelissip | 2005-06-08 09:08:27 +0000 (Wed, 08 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/add1sp.c
+
+Improve checking if WANT_ASSERT >= 2
+
+------------------------------------------------------------------------
+r3627 | pelissip | 2005-06-07 16:06:38 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+Fix wrong assertion.
+
+------------------------------------------------------------------------
+r3626 | pelissip | 2005-06-07 16:03:24 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsum.c
+
+Improve test by adding special cases.
+
+------------------------------------------------------------------------
+r3625 | pelissip | 2005-06-07 16:02:48 +0000 (Tue, 07 Jun 2005) | 5 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+MPFR_GET_EXP was wrongly defined and does nothing due to recursive
+macro (mpfr_get_exp is also defined to be a fast macro). Fix this
+by removing the macro call in MPFR_GET_EXP in case of ASSERT >= 1.
+2 tests failed now!
+
+------------------------------------------------------------------------
+r3624 | pelissip | 2005-06-07 15:42:17 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsum.c
+
+Clean up and improve check.
+
+------------------------------------------------------------------------
+r3623 | pelissip | 2005-06-07 15:41:57 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+Handle case n==0 and n==1 as special cases.
+
+------------------------------------------------------------------------
+r3622 | pelissip | 2005-06-07 14:27:34 +0000 (Tue, 07 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/const_catalan.c
+ M /trunk/tests/tconst_catalan.c
+
+Simplify test to use tgeneric.
+Add note about Worst Case of const_catalan up to 100,000,000
+
+------------------------------------------------------------------------
+r3621 | pelissip | 2005-06-07 14:26:45 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Use GROUP functions.
+
+------------------------------------------------------------------------
+r3620 | pelissip | 2005-06-07 09:52:04 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tconst_pi.c
+
+Improve coverage.
+
+------------------------------------------------------------------------
+r3619 | pelissip | 2005-06-07 09:51:49 +0000 (Tue, 07 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fix bug in MPFR_GROUP_REPREC_3.
+
+------------------------------------------------------------------------
+r3618 | pelissip | 2005-06-06 14:49:55 +0000 (Mon, 06 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/ui_pow_ui.c
+
+Improve coverage
+
+------------------------------------------------------------------------
+r3617 | pelissip | 2005-06-06 14:13:47 +0000 (Mon, 06 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+Improve coverage test
+
+------------------------------------------------------------------------
+r3616 | pelissip | 2005-06-06 13:52:29 +0000 (Mon, 06 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tzeta.c
+
+Remove mpfr_sub_one_ulp from MPFR library.
+Keep the C file until we are sure it not needed anymore.
+
+------------------------------------------------------------------------
+r3615 | pelissip | 2005-06-06 13:42:40 +0000 (Mon, 06 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tnext.c
+
+Improve coverage.
+
+------------------------------------------------------------------------
+r3614 | pelissip | 2005-06-06 13:39:40 +0000 (Mon, 06 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/div_ui.c
+ M /trunk/hypot.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tzeta.c
+
+Remove mpfr_add_one_ulp from MPFR library.
+The function is still in the CVS.
+
+------------------------------------------------------------------------
+r3613 | pelissip | 2005-06-06 12:06:15 +0000 (Mon, 06 Jun 2005) | 4 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Add experimental code (disabled).
+For 5000 bits, gamma(12.5) takes 4s instead of 18s.
+But it changes the error analysis...
+
+------------------------------------------------------------------------
+r3612 | pelissip | 2005-06-06 11:27:08 +0000 (Mon, 06 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Reduce use of intermediary variables.
+
+------------------------------------------------------------------------
+r3611 | pelissip | 2005-06-06 09:42:16 +0000 (Mon, 06 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+Improve comment of previous change.
+
+------------------------------------------------------------------------
+r3610 | pelissip | 2005-06-06 09:30:13 +0000 (Mon, 06 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/zeta.c
+
+Use FastCompute if x is positive and big, ie it uses
+Zeta(x)=1+1/2^X+O(1/3^x)
+
+------------------------------------------------------------------------
+r3609 | pelissip | 2005-06-03 11:15:05 +0000 (Fri, 03 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/ui_pow_ui.c
+
+Add new and faster trivial case for y <= 1 and n <= 1
+
+------------------------------------------------------------------------
+r3608 | pelissip | 2005-06-02 16:20:05 +0000 (Thu, 02 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/COPYING
+ M /trunk/COPYING.LIB
+
+Forget thoses two. Update from FSF site.
+
+------------------------------------------------------------------------
+r3607 | pelissip | 2005-06-02 16:16:17 +0000 (Thu, 02 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+
+Finish updating files.
+
+------------------------------------------------------------------------
+r3606 | pelissip | 2005-06-02 16:12:06 +0000 (Thu, 02 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/abort_prec_max.c
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atan2.c
+ M /trunk/atanh.c
+ M /trunk/cache.c
+ M /trunk/cbrt.c
+ M /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_ld.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/const_catalan.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/constant.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/cot.c
+ M /trunk/coth.c
+ M /trunk/csc.c
+ M /trunk/csch.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eint.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/erfc.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fits_intmax.c
+ M /trunk/fits_s.h
+ M /trunk/fits_sint.c
+ M /trunk/fits_slong.c
+ M /trunk/fits_sshort.c
+ M /trunk/fits_u.h
+ M /trunk/fits_uint.c
+ M /trunk/fits_uintmax.c
+ M /trunk/fits_ulong.c
+ M /trunk/fits_ushort.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/free_cache.c
+ M /trunk/gamma.c
+ M /trunk/gen_inverse.h
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_exp.c
+ M /trunk/get_f.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/get_z.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/int_ceil_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/isqrt.c
+ M /trunk/iszero.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/logging.c
+ M /trunk/minmax.c
+ M /trunk/mp_clz_tab.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-longlong.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/mulders.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/powerof2.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/root.c
+ M /trunk/round_near_x.c
+ M /trunk/round_p.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/sec.c
+ M /trunk/sech.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_ld.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_sj.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/si_op.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/strcasecmp.c
+ M /trunk/strncasecmp.c
+ M /trunk/strtofr.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/subnormal.c
+ M /trunk/sum.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcopysign.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tcot.c
+ M /trunk/tests/tcoth.c
+ M /trunk/tests/tcsc.c
+ M /trunk/tests/tcsch.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teint.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfits.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_f.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tminmax.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/troot.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tsec.c
+ M /trunk/tests/tsech.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tstrtofr.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tversion.c
+ M /trunk/tests/tzeta.c
+ M /trunk/tuneup.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+ M /trunk/zeta.c
+
+Change the address of the FSF.
+
+------------------------------------------------------------------------
+r3605 | pelissip | 2005-06-02 15:55:58 +0000 (Thu, 02 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Optimize it a few by avoiding calling fac_ui for each iteration
+of the main loop.
+
+------------------------------------------------------------------------
+r3604 | pelissip | 2005-06-02 15:16:19 +0000 (Thu, 02 Jun 2005) | 4 lines
+Changed paths:
+ M /trunk/zeta.c
+
+Reduce # of vars inside the main loop.
+Use GROUP function.
+Improve overflow problems (Use of int instead of mp_prec_t).
+
+------------------------------------------------------------------------
+r3603 | pelissip | 2005-06-02 15:15:44 +0000 (Thu, 02 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Improve efficiency by removing 2 variables (Loop uses only 4 vars).
+Use GROUP.
+
+------------------------------------------------------------------------
+r3602 | pelissip | 2005-06-02 15:15:02 +0000 (Thu, 02 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/abort_prec_max.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+
+Add support for MPFR_GROUP functions.
+
+------------------------------------------------------------------------
+r3601 | pelissip | 2005-06-02 15:14:15 +0000 (Thu, 02 Jun 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add attribute const and noreturn for function (via macros).
+Add new macros GROUP_INIT_6 and GROUP_REPREC_6 for zeta and gamma.
+
+------------------------------------------------------------------------
+r3600 | zimmerma | 2005-06-02 10:17:09 +0000 (Thu, 02 Jun 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added missing functions from gnumeric
+
+------------------------------------------------------------------------
+r3599 | pelissip | 2005-06-02 09:22:55 +0000 (Thu, 02 Jun 2005) | 5 lines
+Changed paths:
+ M /trunk/TODO
+
+Update stack-interface.
+Remove round_near_x item.
+Add new functions to implement.
+Reformat file.
+
+------------------------------------------------------------------------
+r3598 | pelissip | 2005-06-02 07:40:56 +0000 (Thu, 02 Jun 2005) | 4 lines
+Changed paths:
+ M /trunk/tests/tconst_pi.c
+
+Fix input precision of mp_prec_t.
+May be outside 'int' range. So it uses 'long' instead and
+a proper check.
+
+------------------------------------------------------------------------
+r3597 | vlefevre | 2005-05-25 14:32:37 +0000 (Wed, 25 May 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Added coding recommendations concerning C++ compilers.
+
+------------------------------------------------------------------------
+r3596 | pelissip | 2005-05-23 12:31:57 +0000 (Mon, 23 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Final version of MPFR_GROUP macros.
+
+------------------------------------------------------------------------
+r3595 | pelissip | 2005-05-23 12:31:43 +0000 (Mon, 23 May 2005) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3594 | pelissip | 2005-05-20 09:30:19 +0000 (Fri, 20 May 2005) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+Remove variable t which wasn't used!
+
+------------------------------------------------------------------------
+r3593 | pelissip | 2005-05-18 15:57:10 +0000 (Wed, 18 May 2005) | 6 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/agm.c
+ M /trunk/cos.c
+ M /trunk/div-short.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/exp_2.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/init2.c
+ M /trunk/log.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/round_prec.c
+ M /trunk/set_f.c
+ M /trunk/sqr.c
+ M /trunk/sqrt.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sum.c
+ M /trunk/tests/tsum.c
+ M /trunk/tuneup.c
+
+Replace TMP_ALLOC by MPFR_TMP_ALLOC
+Replace TMP_DECL by MPFR_TMP_DECL
+Replace TMP_MARK by MPFR_TMP_MARK
+Replace TMP_FREE by MPFR_TMP_FREE
+Add support for GMP's TMP_SALLOC.
+
+------------------------------------------------------------------------
+r3592 | pelissip | 2005-05-18 13:17:40 +0000 (Wed, 18 May 2005) | 5 lines
+Changed paths:
+ M /trunk/pow.c
+
+New way of handling exact value.
+Fix bug of wrong rounding and wrong ternary value if the power
+is exact, but at an upper precision than the working precision.
+Now it computes the power exactly if it detects it is exact.
+
+------------------------------------------------------------------------
+r3591 | pelissip | 2005-05-18 13:13:15 +0000 (Wed, 18 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Precise that 1 is not the only value.
+
+------------------------------------------------------------------------
+r3590 | vlefevre | 2005-05-18 13:03:10 +0000 (Wed, 18 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+an 1 -> a 1.
+
+------------------------------------------------------------------------
+r3589 | pelissip | 2005-05-18 09:42:00 +0000 (Wed, 18 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add a note about special case 1
+
+------------------------------------------------------------------------
+r3588 | pelissip | 2005-05-18 09:01:41 +0000 (Wed, 18 May 2005) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+Add assertions
+Remove useless function is_odd_even.
+
+------------------------------------------------------------------------
+r3587 | pelissip | 2005-05-18 08:53:39 +0000 (Wed, 18 May 2005) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+Fix bug: returning 1 didn't take the rounding mode into account.
+Simplify dependencies of mpfr_pow.
+
+------------------------------------------------------------------------
+r3586 | pelissip | 2005-05-18 08:42:54 +0000 (Wed, 18 May 2005) | 4 lines
+Changed paths:
+ M /trunk/expm1.c
+ M /trunk/tests/texpm1.c
+
+Fix bug of overflow
+Fix bug of wrong ternary value in case of overflow
+Add test cases.
+
+------------------------------------------------------------------------
+r3585 | pelissip | 2005-05-18 08:22:55 +0000 (Wed, 18 May 2005) | 3 lines
+Changed paths:
+ M /trunk/cosh.c
+ M /trunk/tests/tcosh.c
+
+Fix bug of overflow.
+Fix bug of ternary value in case of overflow.
+
+------------------------------------------------------------------------
+r3584 | pelissip | 2005-05-18 08:22:28 +0000 (Wed, 18 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+Clean up previous patch.
+
+------------------------------------------------------------------------
+r3583 | pelissip | 2005-05-18 07:30:01 +0000 (Wed, 18 May 2005) | 4 lines
+Changed paths:
+ M /trunk/sinh.c
+ M /trunk/tests/tsinh.c
+
+Fix bug of overflow.
+Fix bug of ternary value in case of overflow.
+Still some bugs...
+
+------------------------------------------------------------------------
+r3582 | pelissip | 2005-05-17 16:17:12 +0000 (Tue, 17 May 2005) | 4 lines
+Changed paths:
+ M /trunk/tanh.c
+ M /trunk/tests/ttanh.c
+
+Rewrite the way of handling overflow.
+Fix bug due to overflow.
+Fix bug due to wrong ternary value.
+
+------------------------------------------------------------------------
+r3581 | pelissip | 2005-05-17 16:15:15 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Typo.
+
+------------------------------------------------------------------------
+r3580 | pelissip | 2005-05-17 15:37:02 +0000 (Tue, 17 May 2005) | 3 lines
+Changed paths:
+ M /trunk/sinh.c
+ M /trunk/tests/tsinh.c
+
+Fix bug of overflow.
+Still a problem if exp(x) is near the limit of EMAX_MAX.
+
+------------------------------------------------------------------------
+r3579 | pelissip | 2005-05-17 15:35:38 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add new macro MPFR_SAVE_DECL_UPDATE_FLAGS
+
+------------------------------------------------------------------------
+r3578 | pelissip | 2005-05-17 15:17:32 +0000 (Tue, 17 May 2005) | 3 lines
+Changed paths:
+ M /trunk/sinh.c
+ M /trunk/tests/tsinh.c
+
+Improve way of handling overflow (still not perfect but far better).
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3577 | pelissip | 2005-05-17 15:14:53 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/get_si.c
+ M /trunk/tests/tset_si.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3576 | vlefevre | 2005-05-17 15:14:37 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/thypot.c
+
+hypot(±oo, NaN) now returns +oo, as in ISO C99 (wasn't documented).
+
+------------------------------------------------------------------------
+r3575 | pelissip | 2005-05-17 14:09:21 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tasin.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3574 | pelissip | 2005-05-17 14:09:10 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+
+Remove useless test.
+
+------------------------------------------------------------------------
+r3573 | pelissip | 2005-05-17 13:28:02 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3572 | pelissip | 2005-05-17 13:06:26 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_z.c
+
+Improve coverage
+
+------------------------------------------------------------------------
+r3571 | pelissip | 2005-05-17 12:58:43 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmpabs.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3570 | pelissip | 2005-05-17 12:58:30 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/coverage
+
+Add CFLAGS -g.
+
+------------------------------------------------------------------------
+r3569 | pelissip | 2005-05-17 12:27:39 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Clean up
+
+------------------------------------------------------------------------
+r3568 | pelissip | 2005-05-17 12:13:44 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tfits.c
+
+Improve coverage tests.
+
+------------------------------------------------------------------------
+r3567 | pelissip | 2005-05-17 11:45:11 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3566 | pelissip | 2005-05-17 11:34:11 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+Special a condition by the simplified one.
+
+------------------------------------------------------------------------
+r3565 | pelissip | 2005-05-17 10:31:34 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_catalan.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tget_d.c
+
+Improve coverage test (Forget to test tiny functions).
+
+------------------------------------------------------------------------
+r3564 | pelissip | 2005-05-17 10:12:30 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/coverage
+
+Typo
+
+------------------------------------------------------------------------
+r3563 | pelissip | 2005-05-17 10:04:14 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ A /trunk/coverage
+
+Add 'coverage' script.
+
+------------------------------------------------------------------------
+r3562 | pelissip | 2005-05-17 10:03:54 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/constant.c
+
+Add 'static'
+
+------------------------------------------------------------------------
+r3561 | pelissip | 2005-05-17 08:52:13 +0000 (Tue, 17 May 2005) | 5 lines
+Changed paths:
+ M /trunk/cos.c
+
+Reformating code.
+Fix potential (?) overflow for very large precision.
+Various tiny optimizations
+Improve the initial estimation of the needed precision.
+
+------------------------------------------------------------------------
+r3560 | pelissip | 2005-05-17 08:46:45 +0000 (Tue, 17 May 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/constant.c
+ M /trunk/log.c
+ M /trunk/mpfr-impl.h
+
+Extract constants (__gmpfr_one, two and four) from log.c to constant.c
+Fix bug in MPFR_SET_ONE.
+
+------------------------------------------------------------------------
+r3559 | pelissip | 2005-05-17 08:45:00 +0000 (Tue, 17 May 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+Remove a space.
+
+------------------------------------------------------------------------
+r3558 | vlefevre | 2005-05-16 14:29:49 +0000 (Mon, 16 May 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Typography + spelling.
+
+------------------------------------------------------------------------
+r3557 | vlefevre | 2005-05-16 14:26:20 +0000 (Mon, 16 May 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Note that mpfr_out_str has slightly changed.
+
+------------------------------------------------------------------------
+r3556 | pelissip | 2005-05-16 07:34:04 +0000 (Mon, 16 May 2005) | 3 lines
+Changed paths:
+ M /trunk/TODO
+
+asin, atan, atanh are not slow anymore for small input.
+Remove it in the TODO.
+
+------------------------------------------------------------------------
+r3555 | vlefevre | 2005-05-14 17:53:00 +0000 (Sat, 14 May 2005) | 4 lines
+Changed paths:
+ M /trunk/atanh.c
+
+Fixed a bug due to a typo on a variable name. It produced a
+segmentation fault in the tests on Linux/ppc (uninitialized data were
+read), not always reproducible when stepping with gdb.
+
+------------------------------------------------------------------------
+r3553 | pelissip | 2005-05-13 11:49:46 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+ M /trunk/log1p.c
+
+Add support for MPFR_FAST_COMPUTE_IS_SMALL_INPUT
+
+------------------------------------------------------------------------
+r3552 | pelissip | 2005-05-13 11:41:39 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+
+Add support for FAST_COMPUTE_IS_SMALL_INPUT.
+
+------------------------------------------------------------------------
+r3551 | pelissip | 2005-05-13 10:58:38 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Add round_near_x support for small arguments.
+
+------------------------------------------------------------------------
+r3550 | pelissip | 2005-05-13 10:58:20 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/round_near_x.c
+
+Add new internal function mpfr_round_near_x.
+
+------------------------------------------------------------------------
+r3549 | zimmerma | 2005-05-13 09:37:42 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added missing documentation for mpfr_hypot
+
+------------------------------------------------------------------------
+r3548 | pelissip | 2005-05-13 09:12:07 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+Add a \n for all error strings.
+
+------------------------------------------------------------------------
+r3547 | pelissip | 2005-05-13 09:11:48 +0000 (Fri, 13 May 2005) | 2 lines
+Changed paths:
+ M /trunk/version.c
+
+Fix copyright date.
+
+------------------------------------------------------------------------
+r3546 | pelissip | 2005-05-13 09:11:11 +0000 (Fri, 13 May 2005) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/texp.c
+
+Fix some problems when you define mpfr_prec_t to be an unsigned short.
+Now all tests passed when mpfr_prec_t is defined to be an unsigned short
+on a 32 bit CPU!
+
+------------------------------------------------------------------------
+r3542 | vlefevre | 2005-05-12 09:21:49 +0000 (Thu, 12 May 2005) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+Detect/avoid potential integer overflows.
+
+------------------------------------------------------------------------
+r3541 | pelissip | 2005-05-12 08:55:27 +0000 (Thu, 12 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+Fix typos.
+
+------------------------------------------------------------------------
+r3540 | pelissip | 2005-05-11 15:43:40 +0000 (Wed, 11 May 2005) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+ M /trunk/tests/texp.c
+
+Same patch for exp_3.
+
+------------------------------------------------------------------------
+r3539 | pelissip | 2005-05-11 15:24:48 +0000 (Wed, 11 May 2005) | 5 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp_2.c
+ M /trunk/tests/texp.c
+
+Fix bug when exp(x) is near the limit of an overflow or an
+underflow (mpfr_exp_2 didn't allow an overflow/underflow in its
+internal loop).
+Add corresponding test case. exp_3 may need similar patchs.
+
+------------------------------------------------------------------------
+r3538 | vlefevre | 2005-05-11 11:03:55 +0000 (Wed, 11 May 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update (with reformatting so that the logs are readable on 80 columns).
+
+------------------------------------------------------------------------
+r3537 | pelissip | 2005-05-11 07:42:05 +0000 (Wed, 11 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/tests/tmul.c
+
+Fix bug due to wrong assertion.
+
+------------------------------------------------------------------------
+r3536 | pelissip | 2005-05-10 11:49:58 +0000 (Tue, 10 May 2005) | 9 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+
+1. Change the prototype of mpfr_can_round to use const.
+2. Change the prototype of mpfr_round_raw_2 (remove first argument since it is
+ useless).
+3. Change round_raw_generic to use preprocessor if rather than compiler
+ to detect if flag == 1 or 0
+4. mpfr_round_raw_xxx use const attribute too.
+5. Remove mpfr_round_raw_3 since it is unused by MPFR.
+6. Add first prototype of MPFR_FAST_COMPUTE_IF_SMALL.
+
+------------------------------------------------------------------------
+r3535 | pelissip | 2005-05-10 09:52:11 +0000 (Tue, 10 May 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update.
+
+------------------------------------------------------------------------
+r3534 | pelissip | 2005-05-10 09:34:22 +0000 (Tue, 10 May 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/tests/tmul.c
+
+Fix a bug in the product of 2limbs per 2 limbs.
+Add new regression test.
+
+------------------------------------------------------------------------
+r3533 | pelissip | 2005-05-10 07:28:06 +0000 (Tue, 10 May 2005) | 5 lines
+Changed paths:
+ M /trunk/configure.in
+
+Fix problem with mingw: if the configure detects MS-Windows, it skips the
+tests which try to link against GMP within the configure, hoping the Makefile
+works. The main problem is that we need libtool inside the configure to link
+against GMP.
+
+------------------------------------------------------------------------
+r3532 | pelissip | 2005-05-09 09:09:37 +0000 (Mon, 09 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+Improve random tests.
+
+------------------------------------------------------------------------
+r3531 | pelissip | 2005-05-04 16:20:06 +0000 (Wed, 04 May 2005) | 4 lines
+Changed paths:
+ M /trunk/cos.c
+
+Replace initial estimation of K0 from sqrt (p/2)
+to sqrt(p/16). It seems to be 30% faster for 5000 bits, and 5% faster
+for 50 bits.
+
+------------------------------------------------------------------------
+r3529 | vlefevre | 2005-05-04 15:59:49 +0000 (Wed, 04 May 2005) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+Reformatted the code.
+
+------------------------------------------------------------------------
+r3528 | zimmerma | 2005-05-04 15:20:17 +0000 (Wed, 04 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+fixed dummy init2 followed by set_prec
+
+------------------------------------------------------------------------
+r3527 | vlefevre | 2005-05-04 13:42:36 +0000 (Wed, 04 May 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Added LIA-2 functions to implement.
+
+------------------------------------------------------------------------
+r3526 | pelissip | 2005-05-04 09:51:10 +0000 (Wed, 04 May 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/TODO
+ A /trunk/coth.c
+ A /trunk/csch.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/sech.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tcot.c
+ A /trunk/tests/tcoth.c
+ A /trunk/tests/tcsch.c
+ M /trunk/tests/tsec.c
+ A /trunk/tests/tsech.c
+
+Add functions mpfr_sech, mpfr_coth and mpfr_csch.
+
+------------------------------------------------------------------------
+r3525 | pelissip | 2005-05-04 09:49:51 +0000 (Wed, 04 May 2005) | 2 lines
+Changed paths:
+ M /trunk/gen_inverse.h
+
+init2 alloc what is needed, not 2 (more efficient).
+
+------------------------------------------------------------------------
+r3524 | zimmerma | 2005-05-04 09:27:48 +0000 (Wed, 04 May 2005) | 4 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/algorithms.tex
+ M /trunk/asinh.c
+ M /trunk/const_euler.c
+ M /trunk/cosh.c
+ M /trunk/eint.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/hypot.c
+ M /trunk/log10.c
+ M /trunk/log2.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/tanh.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+
+improved const_euler and eint
+removed dependency from input precision in several functions
+fixed two bugs in pow (detection of exact cases)
+
+------------------------------------------------------------------------
+r3523 | pelissip | 2005-05-04 08:35:23 +0000 (Wed, 04 May 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update to reflect the current state.
+
+------------------------------------------------------------------------
+r3522 | pelissip | 2005-05-03 16:39:04 +0000 (Tue, 03 May 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Fix computing of `sup` to reflect what is decribed in algorithms.tex.
+
+------------------------------------------------------------------------
+r3521 | pelissip | 2005-05-03 14:57:04 +0000 (Tue, 03 May 2005) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+
+Tiny optimization of mpfr_atan.
+On opteron with p=53, from 9231 / 18049.89 / 81758 to 9004 / 17522.76 / 78601.
+
+------------------------------------------------------------------------
+r3520 | vlefevre | 2005-05-03 12:42:01 +0000 (Tue, 03 May 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Fixed a problem in test_small (already done in the 2.1 branch)
+when long double = double.
+
+------------------------------------------------------------------------
+r3519 | pelissip | 2005-05-03 10:42:41 +0000 (Tue, 03 May 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Improve detection again (use callback).
+
+------------------------------------------------------------------------
+r3518 | pelissip | 2005-05-03 10:15:46 +0000 (Tue, 03 May 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Improve previous change.
+
+------------------------------------------------------------------------
+r3517 | pelissip | 2005-05-03 09:51:50 +0000 (Tue, 03 May 2005) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/tests/trint.c
+
+Add detection of function round, rint, ceil, floor and nearbyint at configure
+time so that spe206 which defines itself as C99 compliant can build the
+trint test.
+
+------------------------------------------------------------------------
+r3516 | pelissip | 2005-05-03 08:55:18 +0000 (Tue, 03 May 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update (Move bugs to potential).
+
+------------------------------------------------------------------------
+r3515 | vlefevre | 2005-05-03 08:08:50 +0000 (Tue, 03 May 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/hypot.c
+ M /trunk/tests/thypot.c
+
+Fixed the mpfr_hypot bug, and re-enabled the test_large_small test.
+
+------------------------------------------------------------------------
+r3514 | vlefevre | 2005-05-02 23:17:44 +0000 (Mon, 02 May 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3512 | vlefevre | 2005-05-02 22:57:16 +0000 (Mon, 02 May 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Mention the mpfr_hypot bug.
+
+------------------------------------------------------------------------
+r3511 | vlefevre | 2005-05-02 22:46:56 +0000 (Mon, 02 May 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+Added a test showing a bug, enabled when TEST_LARGE_SMALL is defined
+(to avoid a freeze with make check).
+
+------------------------------------------------------------------------
+r3510 | pelissip | 2005-05-02 15:05:43 +0000 (Mon, 02 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix bug.
+
+------------------------------------------------------------------------
+r3509 | pelissip | 2005-05-02 15:05:30 +0000 (Mon, 02 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Remove useless function f.
+
+------------------------------------------------------------------------
+r3508 | pelissip | 2005-05-02 13:11:39 +0000 (Mon, 02 May 2005) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+
+Fix a bug: the test to detect EVEN_rounding was wrong.
+
+------------------------------------------------------------------------
+r3507 | pelissip | 2005-05-02 13:11:07 +0000 (Mon, 02 May 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update example of use of mpfr_subnormalize.
+
+------------------------------------------------------------------------
+r3506 | pelissip | 2005-05-02 13:10:44 +0000 (Mon, 02 May 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/cmp_str.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmpabs.c
+
+mpfr_cmp_str checks for NAN.
+Add macro mpfr_cmp0 in mpfr-test.
+
+------------------------------------------------------------------------
+r3505 | pelissip | 2005-05-02 13:09:35 +0000 (Mon, 02 May 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/troot.c
+
+Undo previous change for tgeneric.
+troot uses tgeneric_ui instead.
+
+------------------------------------------------------------------------
+r3504 | pelissip | 2005-05-01 09:21:43 +0000 (Sun, 01 May 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Add new funcions in reuse test.
+
+------------------------------------------------------------------------
+r3503 | zimmerma | 2005-04-30 11:03:47 +0000 (Sat, 30 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added efficiency item
+
+------------------------------------------------------------------------
+r3502 | zimmerma | 2005-04-30 10:36:21 +0000 (Sat, 30 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ M /trunk/algorithms.tex
+ A /trunk/eint.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/teint.c
+
+added mpfr_eint
+
+------------------------------------------------------------------------
+r3501 | pelissip | 2005-04-29 17:24:30 +0000 (Fri, 29 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Add something to do :)
+
+------------------------------------------------------------------------
+r3500 | zimmerma | 2005-04-29 08:19:01 +0000 (Fri, 29 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added comment about efficiency of atan
+
+------------------------------------------------------------------------
+r3499 | vlefevre | 2005-04-29 07:42:30 +0000 (Fri, 29 Apr 2005) | 3 lines
+Changed paths:
+ A /trunk/FAQ.html
+ M /trunk/Makefile.am
+ M /trunk/README
+ M /trunk/README.dev
+ A /trunk/faq.xsl
+ A /trunk/update-faq
+
+The FAQ is now distributed with MPFR. Use update-faq to update it
+from the MPFR web site.
+
+------------------------------------------------------------------------
+r3498 | zimmerma | 2005-04-29 07:30:29 +0000 (Fri, 29 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+commented out argument reduction analysis for arctan (was wrong)
+
+------------------------------------------------------------------------
+r3496 | zimmerma | 2005-04-28 09:47:32 +0000 (Thu, 28 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+wrong commit, put revision 1.37 back
+
+------------------------------------------------------------------------
+r3495 | zimmerma | 2005-04-28 09:45:05 +0000 (Thu, 28 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+wrong commit, put back revision 1.47
+
+------------------------------------------------------------------------
+r3494 | zimmerma | 2005-04-28 09:38:45 +0000 (Thu, 28 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/cos.c
+ M /trunk/sin.c
+
+added error analysis for Geoff's argument reduction for arctan
+
+------------------------------------------------------------------------
+r3493 | vlefevre | 2005-04-27 20:56:08 +0000 (Wed, 27 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added a note about mpfr_set_d and mpfr_set_ld.
+
+------------------------------------------------------------------------
+r3492 | vlefevre | 2005-04-27 13:51:06 +0000 (Wed, 27 Apr 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/update-version
+
+Define MPFR_VERSION_STRING using the update-version script
+(works with any compiler).
+
+------------------------------------------------------------------------
+r3491 | zimmerma | 2005-04-26 10:46:13 +0000 (Tue, 26 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added internal interface
+
+------------------------------------------------------------------------
+r3490 | zimmerma | 2005-04-26 10:02:01 +0000 (Tue, 26 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion from Geoff
+
+------------------------------------------------------------------------
+r3489 | zimmerma | 2005-04-26 09:37:28 +0000 (Tue, 26 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tversion.c
+
+added MPFR_VERSION_STRING
+
+------------------------------------------------------------------------
+r3488 | zimmerma | 2005-04-25 13:06:11 +0000 (Mon, 25 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new item
+
+------------------------------------------------------------------------
+r3487 | zimmerma | 2005-04-25 12:51:56 +0000 (Mon, 25 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/expm1.c
+ M /trunk/log1p.c
+
+improved expm1/log1p for small argument
+
+------------------------------------------------------------------------
+r3486 | zimmerma | 2005-04-25 12:16:12 +0000 (Mon, 25 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+
+improved to taken account of case |x| small (reported by Keith Briggs)
+
+------------------------------------------------------------------------
+r3485 | vlefevre | 2005-04-25 12:12:17 +0000 (Mon, 25 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added a missing "-" and replaced a few "-" by @minus{}.
+
+------------------------------------------------------------------------
+r3484 | vlefevre | 2005-04-25 11:53:56 +0000 (Mon, 25 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added a note for mpfr_cmp functions.
+
+------------------------------------------------------------------------
+r3483 | zimmerma | 2005-04-25 05:41:27 +0000 (Mon, 25 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+ M /trunk/tests/tset_ld.c
+
+fixed bug with tiny number
+
+------------------------------------------------------------------------
+r3482 | zimmerma | 2005-04-22 22:23:09 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed done item
+
+------------------------------------------------------------------------
+r3481 | pelissip | 2005-04-22 15:20:22 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add a macro for mpfr_const_catalan for internal use.
+
+------------------------------------------------------------------------
+r3480 | pelissip | 2005-04-22 15:18:33 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix typos.
+
+------------------------------------------------------------------------
+r3479 | zimmerma | 2005-04-22 10:38:21 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed Root, updated eint*
+
+------------------------------------------------------------------------
+r3478 | zimmerma | 2005-04-22 10:13:05 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ A /trunk/cot.c
+ A /trunk/csc.c
+ A /trunk/gen_inverse.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/sec.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tcot.c
+ A /trunk/tests/tcsc.c
+ A /trunk/tests/tsec.c
+
+added sec, csc, cot
+
+------------------------------------------------------------------------
+r3477 | zimmerma | 2005-04-22 08:48:44 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+proposal for exponential integral definition
+
+------------------------------------------------------------------------
+r3476 | zimmerma | 2005-04-22 05:38:41 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ M /trunk/tests/Makefile.am
+
+added mpfr_root, removed from TODO
+
+------------------------------------------------------------------------
+r3475 | zimmerma | 2005-04-22 05:32:01 +0000 (Fri, 22 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/cbrt.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/root.c
+ M /trunk/tests/tgeneric.c
+ A /trunk/tests/troot.c
+
+added mpfr_root
+
+------------------------------------------------------------------------
+r3474 | vlefevre | 2005-04-21 15:21:40 +0000 (Thu, 21 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3469 | vlefevre | 2005-04-21 13:05:42 +0000 (Thu, 21 Apr 2005) | 4 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Added the ability to change the control word when compiling tset_ld
+with -DWITH_FPU_CONTROL=1 and executing tset_ld with an argument
+(not used in the automatical tests yet).
+
+------------------------------------------------------------------------
+r3465 | vlefevre | 2005-04-21 09:32:22 +0000 (Thu, 21 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Added test_small (the same as in the 2.1 branch).
+
+------------------------------------------------------------------------
+r3463 | vlefevre | 2005-04-21 09:14:46 +0000 (Thu, 21 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+Updated a comment and reformatted the code.
+
+------------------------------------------------------------------------
+r3460 | zimmerma | 2005-04-21 06:33:22 +0000 (Thu, 21 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added explanation
+
+------------------------------------------------------------------------
+r3457 | zimmerma | 2005-04-20 07:59:38 +0000 (Wed, 20 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/const_catalan.c
+ M /trunk/tests/Makefile.am
+
+adjusted initial guard digits for const_catalan to avoid failure for prec<=10^4
+
+------------------------------------------------------------------------
+r3456 | zimmerma | 2005-04-20 05:53:17 +0000 (Wed, 20 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/const_catalan.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tconst_catalan.c
+
+updated documentation and improved tests for mpfr_const_catalan
+
+------------------------------------------------------------------------
+r3455 | zimmerma | 2005-04-20 03:43:06 +0000 (Wed, 20 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed Catalan's constant (done)
+
+------------------------------------------------------------------------
+r3454 | zimmerma | 2005-04-20 03:40:24 +0000 (Wed, 20 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ A /trunk/const_catalan.c
+ M /trunk/free_cache.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ A /trunk/tests/tconst_catalan.c
+
+added Catalan's constant
+
+------------------------------------------------------------------------
+r3453 | zimmerma | 2005-04-20 01:23:23 +0000 (Wed, 20 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added efficiency items suggested by Geoff Bailey
+
+------------------------------------------------------------------------
+r3452 | zimmerma | 2005-04-20 00:12:45 +0000 (Wed, 20 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+
+fixed minor problem (wrong rounding mode for x=0, y<0), thanks Geoff Bailey
+
+------------------------------------------------------------------------
+r3451 | zimmerma | 2005-04-19 09:23:28 +0000 (Tue, 19 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one efficiency item
+
+------------------------------------------------------------------------
+r3450 | zimmerma | 2005-04-19 09:01:03 +0000 (Tue, 19 Apr 2005) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+completely rewritten algorithm and error analysis for acosh
+(did not match those in acosh.c)
+
+------------------------------------------------------------------------
+r3449 | zimmerma | 2005-04-19 08:59:31 +0000 (Tue, 19 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+algorithm and error bound did not match those of algorithm.tex!!!
+
+------------------------------------------------------------------------
+r3448 | zimmerma | 2005-04-19 07:50:22 +0000 (Tue, 19 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added missing functions for Magma
+
+------------------------------------------------------------------------
+r3447 | zimmerma | 2005-04-19 07:17:54 +0000 (Tue, 19 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+
+changed semantics of mpfr_get_str for ndigits=0
+
+------------------------------------------------------------------------
+r3446 | zimmerma | 2005-04-14 13:44:58 +0000 (Thu, 14 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item (efficiency)
+
+------------------------------------------------------------------------
+r3445 | pelissip | 2005-04-14 13:29:06 +0000 (Thu, 14 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tatan.c
+
+Fix atan2 to fit C99 semantic.
+
+------------------------------------------------------------------------
+r3444 | pelissip | 2005-04-14 09:20:24 +0000 (Thu, 14 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix typos.
+
+------------------------------------------------------------------------
+r3443 | pelissip | 2005-04-14 09:20:13 +0000 (Thu, 14 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+
+Add TODO.
+
+------------------------------------------------------------------------
+r3442 | pelissip | 2005-04-14 08:48:54 +0000 (Thu, 14 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation for mpfr_subnormalize.
+
+------------------------------------------------------------------------
+r3441 | pelissip | 2005-04-14 08:14:49 +0000 (Thu, 14 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/subnormal.c
+
+Fix bugs.
+
+------------------------------------------------------------------------
+r3440 | pelissip | 2005-04-13 17:23:03 +0000 (Wed, 13 Apr 2005) | 3 lines
+Changed paths:
+ M /trunk/div_ui.c
+ M /trunk/tests/tsi_op.c
+
+Apply Guillaume's patch about mpfr_div_ui.
+Fix a bug in tsi_op (forget to clean memory).
+
+------------------------------------------------------------------------
+r3439 | pelissip | 2005-04-13 16:05:02 +0000 (Wed, 13 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ A /trunk/subnormal.c
+
+Add function mpfr_subnormalize (To Test!!!!!)
+
+------------------------------------------------------------------------
+r3438 | pelissip | 2005-04-13 15:48:51 +0000 (Wed, 13 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/atan2.c
+
+Add TODO.
+
+------------------------------------------------------------------------
+r3437 | pelissip | 2005-04-13 15:46:45 +0000 (Wed, 13 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+
+Fix wrong comment.
+
+------------------------------------------------------------------------
+r3436 | pelissip | 2005-04-07 13:35:38 +0000 (Thu, 07 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/terf.c
+
+Reenable tests.
+
+------------------------------------------------------------------------
+r3435 | pelissip | 2005-04-07 11:58:52 +0000 (Thu, 07 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation about mpfr_atan2.
+
+------------------------------------------------------------------------
+r3434 | pelissip | 2005-04-07 11:34:05 +0000 (Thu, 07 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsi_op.c
+ M /trunk/tests/tsub_ui.c
+
+Improve test suite by adding new random values.
+
+------------------------------------------------------------------------
+r3433 | pelissip | 2005-04-07 07:44:14 +0000 (Thu, 07 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tsub.c
+
+Add random tests (tgeneric + random2).
+
+------------------------------------------------------------------------
+r3432 | vlefevre | 2005-04-05 09:03:29 +0000 (Tue, 05 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Test with -ansi when making a release.
+
+------------------------------------------------------------------------
+r3431 | vlefevre | 2005-04-05 08:57:29 +0000 (Tue, 05 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Typo.
+
+------------------------------------------------------------------------
+r3430 | zimmerma | 2005-04-05 07:11:53 +0000 (Tue, 05 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/div-short.c
+ M /trunk/tests/terf.c
+
+replaced // comments by /* ... */
+
+------------------------------------------------------------------------
+r3428 | pelissip | 2005-04-04 10:12:29 +0000 (Mon, 04 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Add note about mpfr_neg
+
+------------------------------------------------------------------------
+r3427 | pelissip | 2005-04-04 08:54:42 +0000 (Mon, 04 Apr 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/NEWS
+ M /trunk/TODO
+ A /trunk/atan2.c
+ M /trunk/mpfr.h
+ M /trunk/tests/tatan.c
+
+Add function mpfr_atan2
+
+------------------------------------------------------------------------
+r3426 | pelissip | 2005-03-31 16:13:11 +0000 (Thu, 31 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+ M /trunk/mpfr-gmp.h
+ M /trunk/mulders.c
+
+Change to add future function mpfr_sqrhigh_n.
+
+------------------------------------------------------------------------
+r3425 | pelissip | 2005-03-31 14:52:03 +0000 (Thu, 31 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation for mpfr_erfc.
+
+------------------------------------------------------------------------
+r3424 | pelissip | 2005-03-31 13:26:32 +0000 (Thu, 31 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Add items.
+
+------------------------------------------------------------------------
+r3423 | pelissip | 2005-03-31 13:13:58 +0000 (Thu, 31 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ A /trunk/erfc.c
+ M /trunk/mpfr.h
+ M /trunk/tests/terf.c
+ M /trunk/tests/tgeneric.c
+
+Add function mpfr_erfc.
+Add a note about auto-checking correctness of MPFR.
+
+------------------------------------------------------------------------
+r3422 | vlefevre | 2005-03-30 14:49:03 +0000 (Wed, 30 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Added a testcase (the one added to the 2.1 branch).
+
+------------------------------------------------------------------------
+r3420 | pelissip | 2005-03-30 14:14:46 +0000 (Wed, 30 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Use random2 instead of random.
+
+------------------------------------------------------------------------
+r3419 | vlefevre | 2005-03-30 13:38:59 +0000 (Wed, 30 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/round_p.c
+
+Weaker conditions for return 0 in mpfr_round_p.
+
+------------------------------------------------------------------------
+r3418 | pelissip | 2005-03-30 13:13:20 +0000 (Wed, 30 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tgeneric.c
+ A /trunk/tests/tgeneric_ui.c
+ M /trunk/tests/tpow.c
+
+Add generic test for functions which looks
+ inexact = MPFR_TOTO (rop, op, INTEGER, RND);
+
+------------------------------------------------------------------------
+r3417 | pelissip | 2005-03-30 12:58:45 +0000 (Wed, 30 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+
+Add ceil(log2(size)) bits to initial precision to avoid
+commiting in error for huge operands.
+
+------------------------------------------------------------------------
+r3416 | vlefevre | 2005-03-30 12:21:53 +0000 (Wed, 30 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Added a test (corresp. to the one added on 2005-03-25 in tpow_z.c).
+
+------------------------------------------------------------------------
+r3415 | vlefevre | 2005-03-29 10:25:12 +0000 (Tue, 29 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+
+Reformatted code (GNU style, untabify...).
+
+------------------------------------------------------------------------
+r3414 | pelissip | 2005-03-29 08:42:07 +0000 (Tue, 29 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Tiny update.
+Add group functions macros.
+
+------------------------------------------------------------------------
+r3413 | pelissip | 2005-03-29 07:51:18 +0000 (Tue, 29 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/tests/tpow_z.c
+
+Replace test ('p <= i') by assertion ('p > i).
+
+------------------------------------------------------------------------
+r3412 | zimmerma | 2005-03-25 21:35:57 +0000 (Fri, 25 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/mpfr.texi
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tpow_z.c
+
+fixed bug in pow_ui (and pow_z): missing factor 2 in error bound
+fixed bug in gamma of negative integer
+
+------------------------------------------------------------------------
+r3411 | pelissip | 2005-03-25 15:03:13 +0000 (Fri, 25 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/div-short.c
+
+Add info.
+
+------------------------------------------------------------------------
+r3410 | pelissip | 2005-03-25 15:02:36 +0000 (Fri, 25 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/print_raw.c
+
+Add new internal function for debugging reasons.
+
+------------------------------------------------------------------------
+r3409 | pelissip | 2005-03-25 08:43:12 +0000 (Fri, 25 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+Forget to free x and y
+
+------------------------------------------------------------------------
+r3408 | pelissip | 2005-03-25 08:38:26 +0000 (Fri, 25 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow_z.c
+
+Add failed regression test.
+
+------------------------------------------------------------------------
+r3407 | pelissip | 2005-03-25 08:38:10 +0000 (Fri, 25 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/div-short.c
+
+Improved version.
+
+------------------------------------------------------------------------
+r3406 | pelissip | 2005-03-25 08:32:09 +0000 (Fri, 25 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/tests/tmul.c
+
+Undo previous change (I was wrong).
+Add new regression test.
+
+------------------------------------------------------------------------
+r3405 | pelissip | 2005-03-24 10:47:41 +0000 (Thu, 24 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+Fix wrong extimated precision.
+It is log2(n+2) ulps so that log2(log2(n+2)) bits!
+
+------------------------------------------------------------------------
+r3404 | pelissip | 2005-03-24 10:01:31 +0000 (Thu, 24 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/div-short.c
+
+Add checking.
+
+------------------------------------------------------------------------
+r3403 | zimmerma | 2005-03-23 19:55:06 +0000 (Wed, 23 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added new test
+
+------------------------------------------------------------------------
+r3402 | pelissip | 2005-03-23 14:42:35 +0000 (Wed, 23 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_f.c
+
+Remove an signed integer trap overflow (GCC 4 + '-ftrapv').
+
+------------------------------------------------------------------------
+r3401 | pelissip | 2005-03-23 13:04:37 +0000 (Wed, 23 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Don't use Mulder at n+1 for MPFR_MUL_THRESHOLD+1
+
+------------------------------------------------------------------------
+r3400 | pelissip | 2005-03-23 13:03:55 +0000 (Wed, 23 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+Reduce the threshold for AMD64.
+
+------------------------------------------------------------------------
+r3399 | pelissip | 2005-03-22 13:58:19 +0000 (Tue, 22 Mar 2005) | 2 lines
+Changed paths:
+ A /trunk/div-short.c
+
+Initial version of Short Division.
+
+------------------------------------------------------------------------
+r3398 | pelissip | 2005-03-22 12:18:33 +0000 (Tue, 22 Mar 2005) | 4 lines
+Changed paths:
+ M /trunk/mul.c
+
+Fix bug on HP-UX.
+longlong's umul_ppmm seems to be buggy on such a system.
+Don't use it under HP-UX.
+
+------------------------------------------------------------------------
+r3396 | pelissip | 2005-03-21 10:34:12 +0000 (Mon, 21 Mar 2005) | 5 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/tests/tmul.c
+ M /trunk/tuneup.c
+
+Add case where bn == 1 and bn == 2 by using longlong.h.
+Modify tuneup to start with prec=2*BITS_PER_MP_LIMB+1
+Fix bug in computing the estimated precision when you switch from N limbs to N+1 limbs.
+Add regression tests.
+
+------------------------------------------------------------------------
+r3395 | vlefevre | 2005-03-19 01:27:54 +0000 (Sat, 19 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/isqrt.c
+
+Typo.
+
+------------------------------------------------------------------------
+r3394 | zimmerma | 2005-03-18 07:44:55 +0000 (Fri, 18 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one efficiency item
+
+------------------------------------------------------------------------
+r3393 | zimmerma | 2005-03-17 12:54:56 +0000 (Thu, 17 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added two property-tests
+
+------------------------------------------------------------------------
+r3391 | vlefevre | 2005-03-17 00:15:18 +0000 (Thu, 17 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/atanh.c
+ M /trunk/tests/tatanh.c
+
+Fixed a bug for mpfr_atanh(x) with 1 < |x| < 2 (found by Matt Reddick).
+
+------------------------------------------------------------------------
+r3390 | pelissip | 2005-03-14 10:07:14 +0000 (Mon, 14 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Update
+
+------------------------------------------------------------------------
+r3389 | pelissip | 2005-03-14 10:05:56 +0000 (Mon, 14 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tcan_round.c
+
+Improve test: compare between mpfr_round_p and mpfr_can_round.
+
+------------------------------------------------------------------------
+r3388 | pelissip | 2005-03-14 09:50:29 +0000 (Mon, 14 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/const_euler.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/erf.c
+ M /trunk/exp2.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/mul.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/zeta.c
+
+Replace mpfr_can_round (..., GMP_RNDN, GMP_RNDZ, ...) to fast replacement
+mpfr_round_p.
+
+------------------------------------------------------------------------
+r3387 | pelissip | 2005-03-14 09:49:36 +0000 (Mon, 14 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+Remove a FIXME.
+
+------------------------------------------------------------------------
+r3386 | pelissip | 2005-03-14 09:48:45 +0000 (Mon, 14 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr-impl.h
+ A /trunk/round_p.c
+
+Add new internal function mpfr_round_p which is a fast replacement
+to mpfr_can_round (x, y, GMP_RNDN, GMP_RNDZ, ...)
+
+------------------------------------------------------------------------
+r3385 | pelissip | 2005-03-14 09:47:44 +0000 (Mon, 14 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+Improve an error message.
+
+------------------------------------------------------------------------
+r3384 | pelissip | 2005-03-10 10:46:06 +0000 (Thu, 10 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+Fix bug: tmp may have changed in mulhigh code.
+Restore it before calling mpn_mul.
+
+------------------------------------------------------------------------
+r3383 | pelissip | 2005-03-09 15:53:12 +0000 (Wed, 09 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+Better defaults threshold.
+
+------------------------------------------------------------------------
+r3381 | pelissip | 2005-03-09 14:24:09 +0000 (Wed, 09 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+
+Handle case where Prec(a) ~ estimated prec of mulhigh.
+Add one extra limb, and still uses mulhigh.
+
+------------------------------------------------------------------------
+r3380 | pelissip | 2005-03-09 14:23:19 +0000 (Wed, 09 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tuneup.c
+
+Fix bug: compute Mulder Threshold from n/2+1 instead of (n+1)/2
+
+------------------------------------------------------------------------
+r3379 | pelissip | 2005-03-09 12:25:47 +0000 (Wed, 09 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Forget ';;' in switch.
+
+------------------------------------------------------------------------
+r3378 | pelissip | 2005-03-09 11:13:31 +0000 (Wed, 09 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Add '-v' for tuneup.
+
+------------------------------------------------------------------------
+r3377 | pelissip | 2005-03-09 11:10:56 +0000 (Wed, 09 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/mulders.c
+
+Add assertion.
+
+------------------------------------------------------------------------
+r3376 | pelissip | 2005-03-09 10:49:38 +0000 (Wed, 09 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/tests/tmul.c
+
+Improve checking
+Add test. Short Mulder product failed for this.
+
+------------------------------------------------------------------------
+r3375 | pelissip | 2005-03-09 10:20:51 +0000 (Wed, 09 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mul.c
+ M /trunk/sub1sp.c
+
+Improve full assertion mode (Check mpfr_mul).
+
+------------------------------------------------------------------------
+r3373 | pelissip | 2005-03-08 16:06:36 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/logging.c
+ M /trunk/mpfr-impl.h
+
+Move GLIBC detection from mpfr-impl to logging.c
+
+------------------------------------------------------------------------
+r3372 | pelissip | 2005-03-08 16:06:18 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Add log info.
+
+------------------------------------------------------------------------
+r3371 | pelissip | 2005-03-08 16:06:01 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+Improve default threshold.
+
+------------------------------------------------------------------------
+r3370 | pelissip | 2005-03-08 14:32:09 +0000 (Tue, 08 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/mul.c
+ M /trunk/tuneup.c
+
+Add Mulder Short product for mpfr_mul.
+Update algorithm.tex to describe the estimated error.
+
+------------------------------------------------------------------------
+r3369 | pelissip | 2005-03-08 14:14:49 +0000 (Tue, 08 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Add an assert.
+Cosmetic change.
+
+------------------------------------------------------------------------
+r3368 | pelissip | 2005-03-08 14:14:08 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+Update default values.
+
+------------------------------------------------------------------------
+r3367 | pelissip | 2005-03-08 14:13:35 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Clean up macro namespace.
+
+------------------------------------------------------------------------
+r3366 | pelissip | 2005-03-08 14:13:07 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tsqrt.c
+
+Cosmetics change.
+
+------------------------------------------------------------------------
+r3365 | zimmerma | 2005-03-08 13:24:44 +0000 (Tue, 08 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_f.c
+ M /trunk/mpfr.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tget_f.c
+
+new function mpfr_get_f
+
+------------------------------------------------------------------------
+r3364 | pelissip | 2005-03-08 08:57:00 +0000 (Tue, 08 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/tests/tadd1sp.c
+
+Fix bug in case of reuse of variable (a,b,a) with Exp(b)=Exp(a)+Prec(b).
+Move copy of mantissa after test.
+
+------------------------------------------------------------------------
+r3363 | pelissip | 2005-03-07 11:40:39 +0000 (Mon, 07 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.in
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mulders.c
+ M /trunk/tuneup.c
+
+Add tune for mpfr_mulhigh
+Add --with-mulhigh-size option at configure time.
+
+------------------------------------------------------------------------
+r3362 | pelissip | 2005-03-04 17:40:53 +0000 (Fri, 04 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+ M /trunk/tests/texp.c
+
+Fix bug due to wrong estimation of (get_d (x) / LOG2).
+TODO: Rexamine the algorithm of mpfr_exp_2!
+
+------------------------------------------------------------------------
+r3361 | pelissip | 2005-03-04 17:32:13 +0000 (Fri, 04 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+Transform DEBUG message to LOG message.
+
+------------------------------------------------------------------------
+r3360 | pelissip | 2005-03-04 17:14:03 +0000 (Fri, 04 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Improve it.
+
+------------------------------------------------------------------------
+r3359 | pelissip | 2005-03-04 17:13:42 +0000 (Fri, 04 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+ M /trunk/mparam_h.in
+ M /trunk/tuneup.c
+
+Tune mpfr_exp_2 now!
+
+------------------------------------------------------------------------
+r3358 | pelissip | 2005-03-03 14:59:25 +0000 (Thu, 03 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Fix bugs.
+
+------------------------------------------------------------------------
+r3357 | pelissip | 2005-03-03 14:25:20 +0000 (Thu, 03 Mar 2005) | 3 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Update it.
+New code for mpfr_mul.
+
+------------------------------------------------------------------------
+r3356 | pelissip | 2005-03-02 10:46:39 +0000 (Wed, 02 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/mparam_h.in
+
+Add new default threshold for different CPU.
+
+------------------------------------------------------------------------
+r3355 | pelissip | 2005-03-02 10:23:31 +0000 (Wed, 02 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Update for tune.
+
+------------------------------------------------------------------------
+r3354 | pelissip | 2005-03-02 08:57:26 +0000 (Wed, 02 Mar 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/tests/tatan.c
+
+Fix bug in estimated error (See previous ChangeLog).
+
+------------------------------------------------------------------------
+r3353 | pelissip | 2005-02-24 17:32:25 +0000 (Thu, 24 Feb 2005) | 6 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.in
+ A /trunk/mparam_h.in
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tuneup.c
+
+Add tune program for MPFR.
+Do make tune instead of make.
+BUT you need to have configure MPFR with --with-gmp-build=...
+(It uses internal libspeed.la of GMP).
+Tuning is slow...
+
+------------------------------------------------------------------------
+r3352 | pelissip | 2005-02-24 17:08:27 +0000 (Thu, 24 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Add note.
+
+------------------------------------------------------------------------
+r3349 | pelissip | 2005-02-22 16:40:41 +0000 (Tue, 22 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/fits_s.h
+ M /trunk/fits_u.h
+
+Tiny optimization
+
+------------------------------------------------------------------------
+r3348 | pelissip | 2005-02-22 12:30:56 +0000 (Tue, 22 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update
+
+------------------------------------------------------------------------
+r3347 | pelissip | 2005-02-22 12:12:18 +0000 (Tue, 22 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+
+Add logging.
+
+------------------------------------------------------------------------
+r3346 | pelissip | 2005-02-22 10:50:14 +0000 (Tue, 22 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/div_ui.c
+ M /trunk/mul_ui.c
+ M /trunk/si_op.c
+ M /trunk/ui_div.c
+
+Reduce InterObject dependency by moving mul_si, div_si and si_div
+to the unique function they used.
+Improve mul_ui by inlining the rounding.
+
+------------------------------------------------------------------------
+r3345 | pelissip | 2005-02-21 13:48:23 +0000 (Mon, 21 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+Improve test to 1.
+
+------------------------------------------------------------------------
+r3344 | vlefevre | 2005-02-21 13:08:46 +0000 (Mon, 21 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tsin.c
+
+Updated copyright lines.
+
+------------------------------------------------------------------------
+r3342 | vlefevre | 2005-02-21 12:13:00 +0000 (Mon, 21 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sub_ui.c
+
+Code reindented / reformatted.
+
+------------------------------------------------------------------------
+r3341 | vlefevre | 2005-02-21 12:09:47 +0000 (Mon, 21 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+ M /trunk/ui_sub.c
+
+Fixed a bug for u == 0 and x == +0 introduced in ui_sub.c 1.23,
+when 0 was taken into account as a special case: the sign of the
+result 0 was incorrect. -> Consider the case u == 0 first.
+
+------------------------------------------------------------------------
+r3340 | zimmerma | 2005-02-19 22:04:01 +0000 (Sat, 19 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/RRTest.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsin.c
+
+added generic tests in tpow
+
+------------------------------------------------------------------------
+r3339 | zimmerma | 2005-02-18 22:09:19 +0000 (Fri, 18 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/tests/tsqrt.c
+
+fixed bug (variable used twice for different things)
+
+------------------------------------------------------------------------
+r3338 | zimmerma | 2005-02-18 20:19:44 +0000 (Fri, 18 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+ M /trunk/mpfr-test.h
+ M /trunk/tests/RRTest.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+
+more changes for interface with NTL
+
+------------------------------------------------------------------------
+r3337 | pelissip | 2005-02-18 16:33:39 +0000 (Fri, 18 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+Likely a test.
+
+------------------------------------------------------------------------
+r3336 | pelissip | 2005-02-18 16:33:25 +0000 (Fri, 18 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Update
+
+------------------------------------------------------------------------
+r3335 | zimmerma | 2005-02-18 15:28:25 +0000 (Fri, 18 Feb 2005) | 2 lines
+Changed paths:
+ A /trunk/tests/RRTest.c
+ M /trunk/tests/tadd.c
+
+added interface for NTL
+
+------------------------------------------------------------------------
+r3334 | vlefevre | 2005-02-16 17:08:25 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3333 | vlefevre | 2005-02-16 17:05:19 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Suppress some spaces.
+
+------------------------------------------------------------------------
+r3332 | pelissip | 2005-02-16 16:04:54 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Reenable underflow tests.
+
+------------------------------------------------------------------------
+r3331 | pelissip | 2005-02-16 15:58:48 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Update
+
+------------------------------------------------------------------------
+r3330 | vlefevre | 2005-02-16 13:27:24 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ D /trunk/texinfo.tex
+
+Removed texinfo.tex, as it can be installed by autoreconf -i.
+
+------------------------------------------------------------------------
+r3329 | pelissip | 2005-02-16 13:19:25 +0000 (Wed, 16 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Fix LOADLIBES so that it works (it doesn't due to libtool change). But it
+still needs to have s static version of MPFR.
+
+------------------------------------------------------------------------
+r3328 | vlefevre | 2005-02-16 12:54:27 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+autoreconf -> autoreconf -i
+
+------------------------------------------------------------------------
+r3327 | pelissip | 2005-02-16 12:49:40 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/asinh.c
+ M /trunk/exp3.c
+ M /trunk/mpfr-impl.h
+ M /trunk/sin_cos.c
+ M /trunk/tan.c
+
+Fix wrong integer types.
+
+------------------------------------------------------------------------
+r3324 | vlefevre | 2005-02-16 11:03:35 +0000 (Wed, 16 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+ M /trunk/mul.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+
+Spelling mistakes & reformatted code.
+
+------------------------------------------------------------------------
+r3322 | vlefevre | 2005-02-15 16:28:31 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sub1.c
+
+Reformatted code.
+
+------------------------------------------------------------------------
+r3321 | pelissip | 2005-02-15 14:56:00 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+Improve initial prec.
+
+------------------------------------------------------------------------
+r3319 | pelissip | 2005-02-15 14:52:06 +0000 (Tue, 15 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/tanh.c
+
+Remove code.
+Add special case if t=1.
+
+------------------------------------------------------------------------
+r3318 | pelissip | 2005-02-15 14:51:51 +0000 (Tue, 15 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/sub1.c
+
+mpfr_set doesn't produce an EVEN inexact flag.
+Fix this.
+
+------------------------------------------------------------------------
+r3317 | pelissip | 2005-02-15 14:51:23 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+USe of mpfr_nexttozero.
+
+------------------------------------------------------------------------
+r3316 | pelissip | 2005-02-15 14:32:16 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/atanh.c
+
+Fix bug: use x instead of xf in LOG.
+
+------------------------------------------------------------------------
+r3315 | pelissip | 2005-02-15 10:29:31 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cosh.c
+ M /trunk/erf.c
+ M /trunk/exp.c
+ M /trunk/gamma.c
+ M /trunk/log.c
+ M /trunk/pow.c
+ M /trunk/sinh.c
+ M /trunk/tanh.c
+ M /trunk/zeta.c
+
+Log input and ouput of functions.
+
+------------------------------------------------------------------------
+r3314 | pelissip | 2005-02-15 10:06:39 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tan.c
+
+Fix bug of overflow in tan.
+
+------------------------------------------------------------------------
+r3313 | pelissip | 2005-02-15 09:54:23 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/tan.c
+
+Use of MPFR_LOG_FUNC.
+
+------------------------------------------------------------------------
+r3312 | pelissip | 2005-02-15 09:53:44 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Do not print final log message if there was no call.
+
+------------------------------------------------------------------------
+r3311 | pelissip | 2005-02-15 09:39:57 +0000 (Tue, 15 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+Add ZivLoop for sign
+
+------------------------------------------------------------------------
+r3310 | pelissip | 2005-02-14 16:02:59 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/logging.c
+
+Fix bug: during the display of a logged var, logging is turn off.
+
+------------------------------------------------------------------------
+r3309 | pelissip | 2005-02-14 15:55:12 +0000 (Mon, 14 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/mpfr-impl.h
+
+Add MPFR_LOG_FUNC
+Use mpfr_cos as testing example.
+
+------------------------------------------------------------------------
+r3308 | pelissip | 2005-02-14 14:38:06 +0000 (Mon, 14 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+
+Add ZivLoop controller for constantes.
+Augment exponent range in the cache.
+Remove it in const_pi.
+
+------------------------------------------------------------------------
+r3307 | pelissip | 2005-02-14 14:23:13 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Add generic ZivLoop controller.
+
+------------------------------------------------------------------------
+r3306 | fousse | 2005-02-14 14:21:50 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Document mpfr_sum returned int value.
+
+------------------------------------------------------------------------
+r3305 | pelissip | 2005-02-14 14:18:40 +0000 (Mon, 14 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/strtofr.c
+ M /trunk/sum.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/zeta.c
+
+Clean up code.
+Add generic ZivLoop controller.
+
+------------------------------------------------------------------------
+r3303 | fousse | 2005-02-14 13:33:31 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+Consider return value's precision for rounding in mpfr_sum.
+
+------------------------------------------------------------------------
+r3302 | zimmerma | 2005-02-14 12:41:16 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+removed garbage
+
+------------------------------------------------------------------------
+r3301 | pelissip | 2005-02-14 11:26:45 +0000 (Mon, 14 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/gamma.c
+ M /trunk/hypot.c
+
+Clean up
+Add ZivLoop
+
+------------------------------------------------------------------------
+r3300 | pelissip | 2005-02-14 10:55:09 +0000 (Mon, 14 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/const_log2.c
+
+Remove malloc/free.
+Use of MPFR_INT_CEIL_LOG2
+Add ZivLoop controller.
+
+------------------------------------------------------------------------
+r3299 | pelissip | 2005-02-14 10:54:42 +0000 (Mon, 14 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/erf.c
+
+Clean up code.
+Fix bug with Exponent range.
+Add ZivLoop controller.
+
+------------------------------------------------------------------------
+r3298 | pelissip | 2005-02-14 10:54:06 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/cbrt.c
+
+Cleanup code.
+
+------------------------------------------------------------------------
+r3297 | zimmerma | 2005-02-14 10:38:04 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/const_log2.c
+
+further efficiency improvement (avoid mpz_init/mpz_clear)
+
+------------------------------------------------------------------------
+r3296 | pelissip | 2005-02-14 10:11:17 +0000 (Mon, 14 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+
+Add ZivLoop controller.
+Clean up code.
+Optimize it by removing the # of used vars.
+
+------------------------------------------------------------------------
+r3295 | pelissip | 2005-02-14 10:10:51 +0000 (Mon, 14 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/asin.c
+ M /trunk/atan.c
+
+Add ZivLoop controler.
+
+------------------------------------------------------------------------
+r3294 | zimmerma | 2005-02-12 16:01:39 +0000 (Sat, 12 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/const_log2.c
+ M /trunk/mpfr-impl.h
+
+new faster algorithm for log(2)
+
+------------------------------------------------------------------------
+r3293 | pelissip | 2005-02-11 13:08:25 +0000 (Fri, 11 Feb 2005) | 6 lines
+Changed paths:
+ M /trunk/configure.in
+
+Remove detection of C++ and Fortran due to libtool.
+----
+Note (VL, 2010-02-08): this removal by an always false test was working
+with libtool 1.5.26, but doesn't work with libtool 2.2 to 2.2.6b (used
+by the MPFR 2.4.{0,1,2} tarballs).
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568520
+------------------------------------------------------------------------
+r3292 | pelissip | 2005-02-11 11:28:00 +0000 (Fri, 11 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.in
+ M /trunk/tests/Makefile.am
+
+Clean up configure (more simplier).
+Still a bug with CXXCPP to solve.
+
+------------------------------------------------------------------------
+r3291 | pelissip | 2005-02-11 11:27:36 +0000 (Fri, 11 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/const_log2.c
+ M /trunk/mpfr-impl.h
+
+Clean up const_log2 code.
+
+------------------------------------------------------------------------
+r3290 | pelissip | 2005-02-10 15:43:41 +0000 (Thu, 10 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/cosh.c
+ M /trunk/exp.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/log.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+
+Add log for other functions.
+Add ZivLoop too.
+Cleanup exp3.
+
+------------------------------------------------------------------------
+r3289 | pelissip | 2005-02-09 16:24:18 +0000 (Wed, 09 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Update for ICC (disable shared since it doesn't work).
+
+------------------------------------------------------------------------
+r3288 | pelissip | 2005-02-09 15:05:45 +0000 (Wed, 09 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+The previous fixs don't work. New one which works but is VERY ugly.
+
+------------------------------------------------------------------------
+r3287 | pelissip | 2005-02-09 14:26:29 +0000 (Wed, 09 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Fix again to avoid fail on laurent5...
+
+------------------------------------------------------------------------
+r3286 | pelissip | 2005-02-09 14:21:48 +0000 (Wed, 09 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Set CXXCPP to "g++ -E" to avoid detection (which may fail on some systems).
+
+------------------------------------------------------------------------
+r3285 | pelissip | 2005-02-09 14:11:13 +0000 (Wed, 09 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Reduce the tested compiler for C++ and Fortran to the minimum.
+
+------------------------------------------------------------------------
+r3284 | pelissip | 2005-02-09 13:19:17 +0000 (Wed, 09 Feb 2005) | 6 lines
+Changed paths:
+ M /trunk/configure.in
+
+Update GMP detection to be much more libtool compatible.
+As a consequence some tests using AC_RUN_IFELSE may fail due to ugly things
+like LD_LIBRARY_PATH no set or wrong selection of libgmp.
+So they just produce a warning, not a fatal error.
+TODO: Check if we can avoid thoses problems...
+
+------------------------------------------------------------------------
+r3283 | pelissip | 2005-02-08 15:49:12 +0000 (Tue, 08 Feb 2005) | 3 lines
+Changed paths:
+ D /trunk/ansi2knr.1
+ D /trunk/ansi2knr.c
+ D /trunk/config.guess
+ D /trunk/config.sub
+ D /trunk/depcomp
+ D /trunk/install-sh
+ D /trunk/missing
+ D /trunk/mkinstalldirs
+ M /trunk/prepare
+
+Remove automake and libtool files.
+Use `automake --add-missing --copy -i` to generate them.
+
+------------------------------------------------------------------------
+r3282 | pelissip | 2005-02-08 13:57:04 +0000 (Tue, 08 Feb 2005) | 2 lines
+Changed paths:
+ A /trunk/ansi2knr.1
+ A /trunk/ansi2knr.c
+
+Add support for ansi2knr
+
+------------------------------------------------------------------------
+r3281 | pelissip | 2005-02-08 13:54:10 +0000 (Tue, 08 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/README.dev
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/prepare
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tests.c
+ M /trunk/update-version
+
+Add support for Shared Library in MPFR (both Unix and Windows) by using libtool.
+Improve configure (remove unused macros, make dist produce .zip and .bz2)
+Update update-version to modify configure.in too.
+
+------------------------------------------------------------------------
+r3280 | pelissip | 2005-02-08 13:51:09 +0000 (Tue, 08 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update NEWS.
+
+------------------------------------------------------------------------
+r3279 | vlefevre | 2005-02-04 12:15:25 +0000 (Fri, 04 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3278 | pelissip | 2005-02-04 10:25:10 +0000 (Fri, 04 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Add forgotten functions to reuse test.
+
+------------------------------------------------------------------------
+r3277 | pelissip | 2005-02-04 10:10:37 +0000 (Fri, 04 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Improve reuse tests (Include 1, -1, 1/2, 2, PI and PI/2 now).
+
+------------------------------------------------------------------------
+r3276 | pelissip | 2005-02-04 09:14:37 +0000 (Fri, 04 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/tests/tatan.c
+
+Fix bug of atan(-1) (wrong sign).
+
+------------------------------------------------------------------------
+r3275 | pelissip | 2005-02-03 16:03:50 +0000 (Thu, 03 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Remove unused option --disable-cache.
+
+------------------------------------------------------------------------
+r3274 | pelissip | 2005-02-03 15:59:28 +0000 (Thu, 03 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_rnd.c
+
+Add option "thread-safe" to configure.
+Limited to use with GCC and ICC (using extension __thread).
+
+------------------------------------------------------------------------
+r3273 | pelissip | 2005-02-03 15:18:17 +0000 (Thu, 03 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add description of added functions.
+
+------------------------------------------------------------------------
+r3272 | pelissip | 2005-02-03 15:09:51 +0000 (Thu, 03 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+mpfr.h doesn't export anymore any globals.
+It doesn't define MPFR_FLAGS too.
+
+------------------------------------------------------------------------
+r3271 | pelissip | 2005-02-03 14:59:39 +0000 (Thu, 03 Feb 2005) | 7 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+Change user interface for mpfr_const_pi, mpfr_const_log2 and
+mpfr_const_euler. No more access to the cache itself.
+Create dummy functions which call the cache, and rename old
+functions to "_internal".
+Internally, it doesn't change at all (You still call directly
+the cache instead of the dummy function which calls the cache).
+
+------------------------------------------------------------------------
+r3270 | pelissip | 2005-02-03 14:43:20 +0000 (Thu, 03 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/mpfr.h
+ M /trunk/tests/texceptions.c
+
+Add functions mpfr_set_overflow, mpfr_set_underflow, mpfr_set_erangeflag,
+mpfr_set_inexflag, mpfr_set_nanflag
+
+------------------------------------------------------------------------
+r3269 | pelissip | 2005-02-03 14:33:31 +0000 (Thu, 03 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add1sp.c
+ M /trunk/add_one_ulp.c
+ M /trunk/cache.c
+ M /trunk/div.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/pow.c
+ M /trunk/pow_ui.c
+ M /trunk/pow_z.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+ M /trunk/set_sj.c
+ M /trunk/set_ui.c
+ M /trunk/set_uj.c
+ M /trunk/set_z.c
+ M /trunk/sqr.c
+ M /trunk/strtofr.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/tests/texceptions.c
+
+Rename internal functions mpfr_set_overflow in mpfr_overflow and
+ mpfr_set_underflow in mpfr_underflow so that we can add new functions
+mpfr_set_underflow and mpfr_set_overflow (which set the global flags).
+
+------------------------------------------------------------------------
+r3268 | pelissip | 2005-02-03 12:46:18 +0000 (Thu, 03 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/sin.c
+
+Add support for logging.
+Add support for ZivLoop.
+Improve efficiency if prec(op) >> prec(rop), and rop ~= 0
+
+------------------------------------------------------------------------
+r3267 | pelissip | 2005-02-03 12:44:51 +0000 (Thu, 03 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Fix wrong place for MPFR_LOG_BEGIN.
+
+------------------------------------------------------------------------
+r3266 | pelissip | 2005-02-03 12:44:15 +0000 (Thu, 03 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/logging.c
+
+Rename MPFR_LOG_BADCASE in MPFR_LOG_ZIV
+
+------------------------------------------------------------------------
+r3265 | pelissip | 2005-02-03 12:43:44 +0000 (Thu, 03 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Reduce the size of some lines (more than 80 chars).
+
+------------------------------------------------------------------------
+r3264 | pelissip | 2005-02-02 16:30:05 +0000 (Wed, 02 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+
+Fix again. My previous fix was incorrect.
+
+------------------------------------------------------------------------
+r3262 | pelissip | 2005-02-02 15:55:38 +0000 (Wed, 02 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/logging.c
+
+Fix wrong order of include system files.
+(printf.h is not available everywhere).
+
+------------------------------------------------------------------------
+r3261 | zimmerma | 2005-02-02 15:50:51 +0000 (Wed, 02 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+inexact flag was inexact :-)
+
+------------------------------------------------------------------------
+r3260 | pelissip | 2005-02-02 15:49:20 +0000 (Wed, 02 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/next.c
+ M /trunk/sin.c
+ M /trunk/sub1.c
+
+Move mpfr_nexttozero and mpfr_nexttoinf from static to mpfr-impl.
+Use them in sub1 and sin.
+
+------------------------------------------------------------------------
+r3259 | pelissip | 2005-02-02 14:58:36 +0000 (Wed, 02 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/README.dev
+ A /trunk/logging.c
+
+Add forgotten logging file.
+Add description of new macros in README.dev
+
+------------------------------------------------------------------------
+r3258 | pelissip | 2005-02-02 14:14:01 +0000 (Wed, 02 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/tests/tcos.c
+
+Add support for ZivLoop controler and logging.
+
+------------------------------------------------------------------------
+r3257 | pelissip | 2005-02-02 14:13:39 +0000 (Wed, 02 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.in
+ M /trunk/mpfr-impl.h
+
+Add experimental logging feature.
+Add ZivLoop controler.
+
+------------------------------------------------------------------------
+r3256 | pelissip | 2005-02-02 14:09:18 +0000 (Wed, 02 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+
+Forget that mpf doesn't have mpf_free_str.
+Fix this.
+
+------------------------------------------------------------------------
+r3255 | pelissip | 2005-02-02 13:50:45 +0000 (Wed, 02 Feb 2005) | 3 lines
+Changed paths:
+ M /trunk/sub1.c
+ M /trunk/tests/tsin.c
+
+Fix bug of sub1 if dest=src2 and src1 >> src2
+=> Fix problem of mpfr_sin
+
+------------------------------------------------------------------------
+r3254 | zimmerma | 2005-02-02 13:45:48 +0000 (Wed, 02 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tui_sub.c
+
+added two tests
+
+------------------------------------------------------------------------
+r3253 | pelissip | 2005-02-01 14:50:19 +0000 (Tue, 01 Feb 2005) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Now MPFR tries to get GMP's CC and CFLAGS from its build directory.
+
+------------------------------------------------------------------------
+r3252 | pelissip | 2005-02-01 09:58:43 +0000 (Tue, 01 Feb 2005) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+Add AC_COPYRIGHT
+Clean up AC_ARG_ENABLE handling
+Add `--enable-logging` option.
+
+------------------------------------------------------------------------
+r3251 | zimmerma | 2005-01-31 09:37:09 +0000 (Mon, 31 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item
+
+------------------------------------------------------------------------
+r3250 | pelissip | 2005-01-31 08:47:04 +0000 (Mon, 31 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Fix a wrong assertion when double == long double.
+
+------------------------------------------------------------------------
+r3249 | pelissip | 2005-01-31 08:44:16 +0000 (Mon, 31 Jan 2005) | 4 lines
+Changed paths:
+ M /trunk/sin.c
+
+Add loop counter
+Check if the result is 0 (Due to new algorithm, it may be 0)
+and in that case, increase a lot the precision.
+
+------------------------------------------------------------------------
+r3248 | zimmerma | 2005-01-29 20:40:51 +0000 (Sat, 29 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/sin.c
+
+changed algorithm for mpfr_sin (to get inexact flag)
+
+------------------------------------------------------------------------
+r3246 | vlefevre | 2005-01-29 11:32:17 +0000 (Sat, 29 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/tests/texp.c
+
+Fixed a sign bug in mpfr_exp (found by Mark J Watkins).
+
+------------------------------------------------------------------------
+r3245 | zimmerma | 2005-01-28 16:57:22 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+solved efficiency problem in mpfr_sin_sign for x near Pi
+
+------------------------------------------------------------------------
+r3243 | vlefevre | 2005-01-28 14:22:34 +0000 (Fri, 28 Jan 2005) | 3 lines
+Changed paths:
+ D /trunk/tests/tdump.c
+
+Removed tests/tdump.c (was no longer used and mpfr_dump is already
+tested in toutimpl.c).
+
+------------------------------------------------------------------------
+r3242 | vlefevre | 2005-01-28 14:20:09 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+Updated copyright line.
+
+------------------------------------------------------------------------
+r3240 | pelissip | 2005-01-28 13:49:30 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Clean up code (due to mix with Paul changes).
+
+------------------------------------------------------------------------
+r3239 | pelissip | 2005-01-28 13:43:11 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+Improve inexact code since sin & cos can't be exact if x != 0
+
+------------------------------------------------------------------------
+r3238 | vlefevre | 2005-01-28 13:28:30 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Removed a useless test in macro MPFR_UNSIGNED_MINUS_MODULO.
+
+------------------------------------------------------------------------
+r3237 | pelissip | 2005-01-28 13:10:04 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+
+Much faster worst case (ie result near 0 or 1).
+
+------------------------------------------------------------------------
+r3236 | zimmerma | 2005-01-28 13:08:20 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+speed-up special case where approximation is 1 or -1
+
+------------------------------------------------------------------------
+r3235 | vlefevre | 2005-01-28 13:04:10 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/rint.c
+
+Updated comments about the rounding modes.
+
+------------------------------------------------------------------------
+r3234 | pelissip | 2005-01-28 12:23:55 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/reldiff.c
+
+Fix bug and optimize code.
+
+------------------------------------------------------------------------
+r3233 | pelissip | 2005-01-28 11:00:34 +0000 (Fri, 28 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/get_str.c
+
+FIx a warning (Wrong proto between declaration and implementation :
+ forget some const).
+
+------------------------------------------------------------------------
+r3232 | vlefevre | 2005-01-28 10:58:01 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Updated copyright line.
+
+------------------------------------------------------------------------
+r3231 | vlefevre | 2005-01-28 10:56:19 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cmp_si.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/div.c
+ M /trunk/erf.c
+ M /trunk/exp_2.c
+ M /trunk/get_d.c
+ M /trunk/get_ld.c
+ M /trunk/get_str.c
+ M /trunk/get_z_exp.c
+ M /trunk/mpfr.h
+ M /trunk/mpn_exp.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/rint.c
+ M /trunk/set_str.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr_compat.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tzeta.c
+
+Updated copyright lines.
+
+------------------------------------------------------------------------
+r3230 | zimmerma | 2005-01-28 10:43:30 +0000 (Fri, 28 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+fixed efficiency problem in case of cos(Pi)
+
+------------------------------------------------------------------------
+r3229 | pelissip | 2005-01-28 09:58:28 +0000 (Fri, 28 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/rint.c
+ M /trunk/tests/trint.c
+
+Fix bug if dest==src.
+Transform some MPFR_ASSERTN to MPFR_ASSERTD.
+
+------------------------------------------------------------------------
+r3227 | pelissip | 2005-01-27 16:02:23 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Fix a buffer overflow.
+
+------------------------------------------------------------------------
+r3226 | pelissip | 2005-01-27 15:40:39 +0000 (Thu, 27 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/get_ld.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_ld.c
+ M /trunk/tests/tset_ld.c
+
+New version of mpfr_set_ld and mpfr_get_ld for IEEE Extended Little Endian.
+(Due to problem on x86 with extended precision).
+
+------------------------------------------------------------------------
+r3225 | zimmerma | 2005-01-27 13:58:24 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/mpfr_compat.c
+
+partially fixed memory leak
+
+------------------------------------------------------------------------
+r3224 | zimmerma | 2005-01-27 13:40:13 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+test for huge cancellation was misplaced
+
+------------------------------------------------------------------------
+r3223 | zimmerma | 2005-01-27 13:28:49 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tsum.c
+
+fixed memory leak
+
+------------------------------------------------------------------------
+r3222 | zimmerma | 2005-01-27 12:53:45 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+fixed inefficiency problem for x near from Pi
+
+------------------------------------------------------------------------
+r3221 | zimmerma | 2005-01-27 10:56:44 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmpabs.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/toutimpl.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tpow_z.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqr.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsum.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tzeta.c
+
+casts to allow compilation with g++
+
+------------------------------------------------------------------------
+r3220 | zimmerma | 2005-01-27 09:35:41 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+added missing cast
+
+------------------------------------------------------------------------
+r3219 | zimmerma | 2005-01-27 09:28:29 +0000 (Thu, 27 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+added missing casts
+
+------------------------------------------------------------------------
+r3218 | zimmerma | 2005-01-25 18:23:38 +0000 (Tue, 25 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+fixed bug (overlap in mpn_divrem)
+
+------------------------------------------------------------------------
+r3217 | vlefevre | 2005-01-24 16:23:29 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ D /trunk/tests/Makefile.in
+
+Removed tests/Makefile.in from CVS.
+
+------------------------------------------------------------------------
+r3216 | pelissip | 2005-01-24 15:48:34 +0000 (Mon, 24 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+Fix bug reported by Eric Buchlin by using new function
+mpfr_pow_z.
+
+------------------------------------------------------------------------
+r3215 | pelissip | 2005-01-24 15:36:49 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ A /trunk/pow_z.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tpow_z.c
+
+Add new function mpfr_pow_z and its test file.
+
+------------------------------------------------------------------------
+r3214 | pelissip | 2005-01-24 15:35:08 +0000 (Mon, 24 Jan 2005) | 4 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/tests/tpow.c
+
+Fix overflows problems.
+Clean up overflow handling.
+Maybe some bugs remain...
+
+------------------------------------------------------------------------
+r3213 | vlefevre | 2005-01-24 15:04:05 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3212 | pelissip | 2005-01-24 14:19:20 +0000 (Mon, 24 Jan 2005) | 4 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Add an explicit reference to mpfr_dump so that
+you can use this function inside the tests with GDB, even if
+you don't use it in the tests.
+
+------------------------------------------------------------------------
+r3211 | zimmerma | 2005-01-24 13:45:38 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+added check before mpz_get_si() call
+
+------------------------------------------------------------------------
+r3210 | vlefevre | 2005-01-24 10:43:16 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r3209 | vlefevre | 2005-01-24 10:31:26 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Corrections on the typography.
+
+------------------------------------------------------------------------
+r3208 | vlefevre | 2005-01-24 10:16:51 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Corrected English usage.
+
+------------------------------------------------------------------------
+r3207 | vlefevre | 2005-01-24 00:03:59 +0000 (Mon, 24 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Typos.
+
+------------------------------------------------------------------------
+r3206 | zimmerma | 2005-01-21 12:20:54 +0000 (Fri, 21 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added LOADLIBES=...
+
+------------------------------------------------------------------------
+r3201 | vlefevre | 2005-01-21 10:20:17 +0000 (Fri, 21 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+Updated Copyright line.
+
+------------------------------------------------------------------------
+r3195 | pelissip | 2005-01-20 14:32:20 +0000 (Thu, 20 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sub1.c
+
+Fix again this previous patch!
+
+------------------------------------------------------------------------
+r3194 | zimmerma | 2005-01-20 11:23:51 +0000 (Thu, 20 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpn_exp.c
+
+fixed problems in get_str for huge exponent
+
+------------------------------------------------------------------------
+r3193 | pelissip | 2005-01-20 09:53:45 +0000 (Thu, 20 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-longlong.h
+
+Update longlong from GMP 4.1.4 (problem with opteron).
+
+------------------------------------------------------------------------
+r3192 | pelissip | 2005-01-18 13:30:50 +0000 (Tue, 18 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/sum.c
+
+Fix bug in case n==0 or n==1 (Reported and fixed by Laurent Fousse).
+
+------------------------------------------------------------------------
+r3191 | pelissip | 2005-01-14 15:02:15 +0000 (Fri, 14 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/sub1.c
+
+Add comments
+Fix bug in my patch (Need tests).
+
+------------------------------------------------------------------------
+r3190 | pelissip | 2005-01-14 13:50:09 +0000 (Fri, 14 Jan 2005) | 7 lines
+Changed paths:
+ M /trunk/atan.c
+
+Optimize mpfr_atan_aux by removing all power of 2 in the sum to
+reduce the size of the multiplication, normalize the input to extract
+as many zeros as possible and add a special case if the input is 1
+(after normalisation). But it doesn't optimize too much...
+I need to invertigate a few more too understand what is still costly.
+It seems that mpz_mul is the most called function.
+
+------------------------------------------------------------------------
+r3189 | pelissip | 2005-01-14 13:28:45 +0000 (Fri, 14 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+Improve and fix tanh for big floats.
+
+------------------------------------------------------------------------
+r3188 | pelissip | 2005-01-14 13:28:03 +0000 (Fri, 14 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/sub1.c
+
+Fix bug in some corner case (Just hope it doesn't add new bugs).
+It should be much faster in these cases too.
+
+------------------------------------------------------------------------
+r3187 | pelissip | 2005-01-14 13:26:55 +0000 (Fri, 14 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+Remove warning
+
+------------------------------------------------------------------------
+r3186 | pelissip | 2005-01-14 11:40:22 +0000 (Fri, 14 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Tiny update
+
+------------------------------------------------------------------------
+r3185 | pelissip | 2005-01-14 08:20:35 +0000 (Fri, 14 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+
+Fix bug (Forget a debug line).
+
+------------------------------------------------------------------------
+r3184 | pelissip | 2005-01-13 16:21:47 +0000 (Thu, 13 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/sinh.c
+
+Fix overflow bug
+Optimize code
+
+------------------------------------------------------------------------
+r3183 | pelissip | 2005-01-13 08:22:09 +0000 (Thu, 13 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Fix bug in mpn_sub_nc in case the compiler optimize too much.
+
+------------------------------------------------------------------------
+r3182 | pelissip | 2005-01-12 10:00:52 +0000 (Wed, 12 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+
+Add forgotten 2005 copyright line.
+
+------------------------------------------------------------------------
+r3181 | pelissip | 2005-01-12 09:57:57 +0000 (Wed, 12 Jan 2005) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+
+Fix problem of `mpn_sub_nc' which may or may not be defined in libgmp.a
+ (Add a test in the configure and a new macro MPFR_HAVE_MPN_SUB_NC)
+Add MPFR_LOG2_BIT_PER_MP_LIMB macro
+
+------------------------------------------------------------------------
+r3180 | pelissip | 2005-01-12 09:22:37 +0000 (Wed, 12 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/atan.c
+
+Massive optimization of mpfr_atan (20x faster than 2.1.0 at 53 bits!)
+Minor optimization of mpfr_acos
+
+------------------------------------------------------------------------
+r3179 | pelissip | 2005-01-11 16:27:42 +0000 (Tue, 11 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Fix typo
+
+------------------------------------------------------------------------
+r3178 | pelissip | 2005-01-11 08:42:16 +0000 (Tue, 11 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/gmp_op.c
+
+Reduce size of code
+Optimize a few too.
+
+------------------------------------------------------------------------
+r3177 | pelissip | 2005-01-11 08:40:51 +0000 (Tue, 11 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Forget 2005 !
+
+------------------------------------------------------------------------
+r3176 | pelissip | 2005-01-11 08:39:49 +0000 (Tue, 11 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Improve and fix detection of NAN and GCC bug.
+
+------------------------------------------------------------------------
+r3175 | pelissip | 2005-01-04 15:04:18 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+new version (completely rewritten) by Paul Zimmermann.
+
+------------------------------------------------------------------------
+r3174 | pelissip | 2005-01-04 14:52:28 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/tests/tatan.c
+
+Fix forgotten '2005' Line.
+
+------------------------------------------------------------------------
+r3173 | pelissip | 2005-01-04 14:41:09 +0000 (Tue, 04 Jan 2005) | 5 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/tests/tatan.c
+
+Fix wrong inexact value (regression).
+FIXME: It seems that adding MPFR_GET_EXP (xp) bits is too much
+ (since previously it always add 0, but the results were quite
+ always exact - this bug was only discovered under rare case).
+
+------------------------------------------------------------------------
+r3172 | zimmerma | 2005-01-04 12:23:41 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item (mpfr_printf)
+
+------------------------------------------------------------------------
+r3171 | pelissip | 2005-01-04 10:34:17 +0000 (Tue, 04 Jan 2005) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+ M /trunk/mpfr-impl.h
+
+Optimize mpfr_exp2 by inlining some code, and by avoiding using
+mpz_sizeinbase.
+
+------------------------------------------------------------------------
+r3170 | pelissip | 2005-01-04 10:33:18 +0000 (Tue, 04 Jan 2005) | 4 lines
+Changed paths:
+ M /trunk/erf.c
+
+Remove unused code.
+Remove _MPFR_PROTO for static functions.
+Other cosmetic change.
+
+------------------------------------------------------------------------
+r3169 | pelissip | 2005-01-04 10:32:01 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/get_str.c
+
+Remove _MPFR_PROTO for static functions.
+
+------------------------------------------------------------------------
+r3168 | pelissip | 2005-01-04 10:29:14 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Remove unused code.
+
+------------------------------------------------------------------------
+r3167 | pelissip | 2005-01-04 10:28:41 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Optimize mpfr_get_d.
+
+------------------------------------------------------------------------
+r3166 | pelissip | 2005-01-04 10:28:03 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add a new configuration to check before releasing MPFR.
+
+------------------------------------------------------------------------
+r3165 | pelissip | 2005-01-04 10:26:44 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/sum.c
+
+Fix problem of tab with ncurses.
+
+------------------------------------------------------------------------
+r3164 | pelissip | 2005-01-04 10:26:14 +0000 (Tue, 04 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/cmp_si.c
+ M /trunk/get_z_exp.c
+
+Likely some tests
+
+------------------------------------------------------------------------
+r3163 | pelissip | 2005-01-04 10:25:40 +0000 (Tue, 04 Jan 2005) | 4 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+
+Fix bug if not gmp-impl.h (mpn_sub_nc is internal).
+Move MPFR_SET_EXP after checking the exponent range.
+Minor change in the way to return the ternary value.
+
+------------------------------------------------------------------------
+r3162 | zimmerma | 2005-01-01 12:17:16 +0000 (Sat, 01 Jan 2005) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/sum.c
+
+changed tab[] into *tab (and removed 'tab' in mpfr.h)
+
+------------------------------------------------------------------------
+r3161 | zimmerma | 2004-12-24 10:41:39 +0000 (Fri, 24 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+new version (completely rewritten)
+
+------------------------------------------------------------------------
+r3160 | zimmerma | 2004-12-24 10:28:47 +0000 (Fri, 24 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/tests/tsqrt.c
+
+improved coverage (and fixed bug)
+
+------------------------------------------------------------------------
+r3159 | pelissip | 2004-12-21 15:54:00 +0000 (Tue, 21 Dec 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+ M /trunk/tests/trint.c
+
+Fixed errors reported by Nelson H. F. Beebe
+(forget to include sys/fpu.h if defined and math.h if std=c99).
+
+------------------------------------------------------------------------
+r3158 | pelissip | 2004-12-20 12:54:45 +0000 (Mon, 20 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+Fix wrong integer type and a test.
+
+------------------------------------------------------------------------
+r3157 | pelissip | 2004-12-20 12:53:46 +0000 (Mon, 20 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Add some assertion.
+
+------------------------------------------------------------------------
+r3156 | pelissip | 2004-12-20 12:53:20 +0000 (Mon, 20 Dec 2004) | 3 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+Unlikely one test.
+Fix wrong integer type
+
+------------------------------------------------------------------------
+r3155 | pelissip | 2004-12-20 12:52:47 +0000 (Mon, 20 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+ M /trunk/sub1.c
+
+Reindent the code.
+
+------------------------------------------------------------------------
+r3154 | pelissip | 2004-12-17 14:18:49 +0000 (Fri, 17 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+ M /trunk/tan.c
+
+Optimize mpfr_tan
+
+------------------------------------------------------------------------
+r3153 | pelissip | 2004-12-17 13:36:51 +0000 (Fri, 17 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+
+Optimize the computing of the sign of sinus if GET_EXP(x) < 0
+
+------------------------------------------------------------------------
+r3152 | pelissip | 2004-12-17 13:20:13 +0000 (Fri, 17 Dec 2004) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+
+Optimize mpfr_cos.
+From 3363 / 21663.99 / 79727 to 3139 / 18920.58 / 69624 (opteron).
+
+------------------------------------------------------------------------
+r3151 | pelissip | 2004-12-17 13:13:50 +0000 (Fri, 17 Dec 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Fix precision used to test long double.
+Now it is sizeof(long_double)*CHAR_BIT instead of fixed 113.
+
+------------------------------------------------------------------------
+r3150 | pelissip | 2004-12-17 11:14:56 +0000 (Fri, 17 Dec 2004) | 3 lines
+Changed paths:
+ M /trunk/extract.c
+
+FIx wrong integer types
+Add an assertion.
+
+------------------------------------------------------------------------
+r3149 | pelissip | 2004-12-17 11:14:23 +0000 (Fri, 17 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+Likely / Unlikely some code.
+
+------------------------------------------------------------------------
+r3148 | pelissip | 2004-12-17 11:13:53 +0000 (Fri, 17 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/get_ld.c
+ M /trunk/set_d.c
+ M /trunk/set_ld.c
+ M /trunk/tests/tset_ld.c
+
+Fix problem with long double with ICC (Wrong x86 processor flag).
+
+------------------------------------------------------------------------
+r3147 | pelissip | 2004-12-16 13:41:21 +0000 (Thu, 16 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+Fix wrong integer types.
+
+------------------------------------------------------------------------
+r3146 | pelissip | 2004-12-16 13:37:23 +0000 (Thu, 16 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Fix bug.
+
+------------------------------------------------------------------------
+r3145 | pelissip | 2004-12-16 13:27:11 +0000 (Thu, 16 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+
+Optimize mpfr_acos by choosing a better initial precision.
+
+------------------------------------------------------------------------
+r3144 | pelissip | 2004-12-16 13:12:42 +0000 (Thu, 16 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+
+Optimize mpfr_asin by improving the choice of the initial precision.
+
+------------------------------------------------------------------------
+r3143 | pelissip | 2004-12-16 12:04:10 +0000 (Thu, 16 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Optimize mpfr_atan.
+
+------------------------------------------------------------------------
+r3142 | pelissip | 2004-12-15 16:32:57 +0000 (Wed, 15 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/inp_str.c
+ M /trunk/tests/tinp_str.c
+
+Fix problem with GCC 4.0 20041212.
+
+------------------------------------------------------------------------
+r3141 | pelissip | 2004-12-15 14:22:50 +0000 (Wed, 15 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Remove thread attribut until I found a good way to use it.
+
+------------------------------------------------------------------------
+r3140 | pelissip | 2004-12-15 10:49:11 +0000 (Wed, 15 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Test
+
+------------------------------------------------------------------------
+r3139 | pelissip | 2004-12-15 10:47:42 +0000 (Wed, 15 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/strtofr.c
+
+Add 'const' attribute to table.
+
+------------------------------------------------------------------------
+r3138 | pelissip | 2004-12-15 10:46:00 +0000 (Wed, 15 Dec 2004) | 2 lines
+Changed paths:
+ D /trunk/save_expo.c
+
+Remove unused file.
+
+------------------------------------------------------------------------
+r3137 | pelissip | 2004-12-15 09:04:07 +0000 (Wed, 15 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+New way of detecting GMP libraray, which should be more portable.
+
+------------------------------------------------------------------------
+r3136 | pelissip | 2004-12-14 12:30:30 +0000 (Tue, 14 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-test.h
+ M /trunk/tests/Makefile.am
+ D /trunk/tests/amd64.asm
+ M /trunk/tests/tests.c
+ M /trunk/tests/tset_ld.c
+ D /trunk/tests/x86.asm
+
+Remove useless assembly code.
+
+------------------------------------------------------------------------
+r3135 | pelissip | 2004-12-14 10:54:47 +0000 (Tue, 14 Dec 2004) | 6 lines
+Changed paths:
+ M /trunk/cmp.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/set.c
+
+Add "MPFR_USE_NO_MACRO" user macro: it allows the user to link
+directly with MPFR functions rather than using Macros to access
+them. It doesn't define MPFR variable inside mpfr.h too.
+Fix set.c and cmp.c in consequences.
+Fix mpf2mpfr.h to use mpfr_get_default_rounding_mode () if needed.
+
+------------------------------------------------------------------------
+r3134 | pelissip | 2004-12-13 14:32:26 +0000 (Mon, 13 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/mulders.c
+
+Improved prototype.
+
+------------------------------------------------------------------------
+r3133 | pelissip | 2004-12-13 14:31:11 +0000 (Mon, 13 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/set_q.c
+
+Fix bug of overflow (I hope).
+
+------------------------------------------------------------------------
+r3132 | pelissip | 2004-12-13 10:23:33 +0000 (Mon, 13 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.texi
+ M /trunk/set_q.c
+
+Update mpfr_set_q overflow problem.
+
+------------------------------------------------------------------------
+r3131 | pelissip | 2004-12-13 08:24:58 +0000 (Mon, 13 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/generic.c
+
+Fix wrong integer types.
+
+------------------------------------------------------------------------
+r3130 | pelissip | 2004-12-10 16:02:03 +0000 (Fri, 10 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Optimize by increasing with BITS_PER_MP_LIMB instead of log2(prec)
+
+------------------------------------------------------------------------
+r3129 | pelissip | 2004-12-10 15:59:15 +0000 (Fri, 10 Dec 2004) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+
+Clean up code (Fix integer types + rewrite some code).
+Optimize the code by reducing the number of used variables inside the loop.
+
+------------------------------------------------------------------------
+r3128 | pelissip | 2004-12-10 15:58:13 +0000 (Fri, 10 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+
+Replace mpfr_neg to MPFR_CHANGE_SIGN.
+
+------------------------------------------------------------------------
+r3127 | pelissip | 2004-12-10 15:57:48 +0000 (Fri, 10 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/add1sp.c
+
+Cosmetic changes.
+
+------------------------------------------------------------------------
+r3126 | pelissip | 2004-12-10 14:45:54 +0000 (Fri, 10 Dec 2004) | 4 lines
+Changed paths:
+ M /trunk/acos.c
+
+Clean the code.
+Avoid mixing integer types.
+Fix bug of overflow if Pi is in the range but not Pi/2.
+
+------------------------------------------------------------------------
+r3125 | pelissip | 2004-12-10 14:22:49 +0000 (Fri, 10 Dec 2004) | 5 lines
+Changed paths:
+ M /trunk/asin.c
+
+Clean up the code (Removing useless variables and avoid mixing wrong integer types).
+Optimize the code by improving memory allocation scheme and by incrementating by
+BITS_PER_MP_LIMB in case of an error instead of MPFR_INT_CEIL_LOG2 (prec).
+Fix an overflow bug for X=+/-1 (If PI is inside the exponent range, but not PI/2).
+
+------------------------------------------------------------------------
+r3124 | pelissip | 2004-12-09 14:34:47 +0000 (Thu, 09 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Simplify MPFR_SIGN by removing unnecessary ( ).
+
+------------------------------------------------------------------------
+r3123 | pelissip | 2004-12-09 14:31:23 +0000 (Thu, 09 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Add support for new attribut sentinel in incoming GCC 4.0
+
+------------------------------------------------------------------------
+r3122 | pelissip | 2004-12-09 13:23:25 +0000 (Thu, 09 Dec 2004) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+
+Optimize initial precision in case of EXP(x) < 0.
+
+------------------------------------------------------------------------
+r3121 | pelissip | 2004-12-09 10:13:55 +0000 (Thu, 09 Dec 2004) | 6 lines
+Changed paths:
+ M /trunk/cache.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_sj.c
+
+Optimize mpfr_set4.
+Inline rounding in mpfr_set4 and mpfr_cache
+mpfr_set4 dosn't return MPFR_EVEN_INEX (It was undocumented before).
+Fix problems with tests (Avoid mixing MPFR_EVEN_INEX and 1).
+Add MPFR_RNDRAW_EVEN for rounding with MPFR_EVEN_INEX inexact support
+
+------------------------------------------------------------------------
+r3120 | pelissip | 2004-12-08 14:08:45 +0000 (Wed, 08 Dec 2004) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/tests/tsqr.c
+
+Optimize mpfr_mul by inlining and rewriting the rounding.
+It seems that GCC option `-frename-registers` for mpfr_mul / Athlon XP
+improves its performance (But it decreases it on Pentium4)...
+
+------------------------------------------------------------------------
+r3119 | zimmerma | 2004-12-01 11:34:21 +0000 (Wed, 01 Dec 2004) | 2 lines
+Changed paths:
+ A /trunk/mulders.c
+
+first try to implement Mulders' algorithm
+
+------------------------------------------------------------------------
+r3118 | pelissip | 2004-11-29 15:10:29 +0000 (Mon, 29 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update TODO.
+
+------------------------------------------------------------------------
+r3117 | zimmerma | 2004-11-29 13:58:14 +0000 (Mon, 29 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added new tests for corner cases
+
+------------------------------------------------------------------------
+r3116 | zimmerma | 2004-11-29 13:52:35 +0000 (Mon, 29 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added algo for pi
+
+------------------------------------------------------------------------
+r3115 | pelissip | 2004-11-25 10:28:32 +0000 (Thu, 25 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/tan.c
+
+Change initial term if exp(a)<0.
+
+------------------------------------------------------------------------
+r3114 | pelissip | 2004-11-25 10:28:13 +0000 (Thu, 25 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+Simplify the inner loop.
+
+------------------------------------------------------------------------
+r3113 | pelissip | 2004-11-25 10:11:07 +0000 (Thu, 25 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+Change initial precision if EXP(op) < 0.
+
+------------------------------------------------------------------------
+r3112 | pelissip | 2004-11-23 12:49:15 +0000 (Tue, 23 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/set_z.c
+
+Optimize code and rewrite the rounding part.
+FIXME: It seems that the previous rounding code was buggy. Still I am not sure.
+
+------------------------------------------------------------------------
+r3111 | pelissip | 2004-11-23 12:48:00 +0000 (Tue, 23 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tgmpop.c
+
+Improve tests.
+
+------------------------------------------------------------------------
+r3110 | pelissip | 2004-11-19 14:38:28 +0000 (Fri, 19 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+Improve the initial value of prec: 10% improvement (?) on average.
+
+------------------------------------------------------------------------
+r3109 | pelissip | 2004-11-19 14:36:11 +0000 (Fri, 19 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+Improve coverage test.
+
+------------------------------------------------------------------------
+r3108 | pelissip | 2004-11-19 13:02:04 +0000 (Fri, 19 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+ M /trunk/ui_pow_ui.c
+
+Fix bug for mpfr_ui_pow_ui (Wrong inexact flag).
+
+------------------------------------------------------------------------
+r3107 | pelissip | 2004-11-19 12:39:10 +0000 (Fri, 19 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/get_z.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/tget_z.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_sj.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsqr.c
+ M /trunk/ufloor_log2.c
+
+Improve coverage tests.
+
+------------------------------------------------------------------------
+r3106 | pelissip | 2004-11-19 10:28:33 +0000 (Fri, 19 Nov 2004) | 4 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/README.dev
+ M /trunk/mpfr-impl.h
+
+Fix typos in INSTALL.
+Sort README.dev, and add a new section about How to write a MPFR function.
+Add a link to README.dev in mpfr-impl.h.
+
+------------------------------------------------------------------------
+r3105 | pelissip | 2004-11-19 08:35:48 +0000 (Fri, 19 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+
+Fix a bug on some compilators:
+ First MPFR_SAVE_EXPO_DECL, then TMP_DECL.
+
+------------------------------------------------------------------------
+r3104 | pelissip | 2004-11-18 15:53:55 +0000 (Thu, 18 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/tests/tpow.c
+
+Fix an overflow bug.
+
+------------------------------------------------------------------------
+r3103 | pelissip | 2004-11-18 15:15:27 +0000 (Thu, 18 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/tests/tset_si.c
+
+Fix bug with inexact flag.
+FIXME: Maybe still a bug with inexact flag if overflow in mpfr_mul_2exp ?
+
+------------------------------------------------------------------------
+r3102 | pelissip | 2004-11-18 15:00:06 +0000 (Thu, 18 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr-impl.h
+ M /trunk/pow_ui.c
+
+Remove mpfr_save_emin_emax and mpfr_restore_emin_emax
+from MPFR library since they are useless.
+
+------------------------------------------------------------------------
+r3101 | pelissip | 2004-11-18 14:55:08 +0000 (Thu, 18 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+Forget to remove rndraw.c test.
+
+------------------------------------------------------------------------
+r3100 | pelissip | 2004-11-18 14:52:59 +0000 (Thu, 18 Nov 2004) | 4 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add_ui.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/gamma.c
+ M /trunk/hypot.c
+ M /trunk/mpfr-impl.h
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/rint.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_ld.c
+ M /trunk/set_q.c
+ M /trunk/set_si_2exp.c
+ M /trunk/set_ui_2exp.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+ M /trunk/tanh.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+
+Replace use of mpfr_save_emin_emax () / mpfr_restore_emin_emax()
+by MPFR_SAVE_EXPO macros (DECL, MARK and FREE) which are faster
+and thread safe.
+
+------------------------------------------------------------------------
+r3098 | pelissip | 2004-11-18 14:04:52 +0000 (Thu, 18 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+Enable fast computing.
+
+------------------------------------------------------------------------
+r3097 | vlefevre | 2004-11-18 14:04:50 +0000 (Thu, 18 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix: GMP -> MPFR Copying Conditions (noted by Patrick).
+
+------------------------------------------------------------------------
+r3096 | pelissip | 2004-11-18 10:08:49 +0000 (Thu, 18 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Reorder the file and put sections to make it cleaner and more readable.
+
+------------------------------------------------------------------------
+r3095 | pelissip | 2004-11-18 09:11:19 +0000 (Thu, 18 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/log.c
+
+Reduce number of used variables.
+Optimize code and clean it.
+
+------------------------------------------------------------------------
+r3093 | vlefevre | 2004-11-18 08:56:06 +0000 (Thu, 18 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+In HTML, suppress the non-existing link to GMP.
+
+------------------------------------------------------------------------
+r3092 | pelissip | 2004-11-18 08:32:01 +0000 (Thu, 18 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/init2.c
+ M /trunk/mpfr-impl.h
+
+Add a prototype of own TMP_ALLOC. Don't know if it is a good idea.
+To enable it, just build MPFR with MPFR_USE_OWN_TMP_ALLOC.
+
+------------------------------------------------------------------------
+r3091 | pelissip | 2004-11-17 16:22:14 +0000 (Wed, 17 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/strtofr.c
+ M /trunk/sum.c
+
+Fix bug with TMP_MARK.
+
+------------------------------------------------------------------------
+r3090 | pelissip | 2004-11-16 16:14:43 +0000 (Tue, 16 Nov 2004) | 4 lines
+Changed paths:
+ M /trunk/pow_ui.c
+
+Optimize the code:
+ + Special case for n == 2
+ + The first squaring is done using the original input.
+
+------------------------------------------------------------------------
+r3089 | pelissip | 2004-11-16 16:13:30 +0000 (Tue, 16 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+
+Add new assertion to check.
+
+------------------------------------------------------------------------
+r3088 | pelissip | 2004-11-16 16:13:01 +0000 (Tue, 16 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/cmp2.c
+
+Likely / Unlikely some tests.
+
+------------------------------------------------------------------------
+r3087 | pelissip | 2004-11-15 11:44:26 +0000 (Mon, 15 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+Add unused code (Still needs a proof).
+
+------------------------------------------------------------------------
+r3086 | pelissip | 2004-11-15 11:43:33 +0000 (Mon, 15 Nov 2004) | 4 lines
+Changed paths:
+ M /trunk/get_exp.c
+ M /trunk/mpfr.h
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_prec.c
+ M /trunk/set_rnd.c
+ M /trunk/set_ui.c
+
+Add macro version for small functions:
+ mpfr_get_prec, mpfr_get_exp, mpfr_get_default_rounding_mode,
+ mpfr_get_default_prec and mpfr_set_ui
+
+------------------------------------------------------------------------
+r3085 | pelissip | 2004-11-15 08:38:36 +0000 (Mon, 15 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Refix another bug (The same).
+
+------------------------------------------------------------------------
+r3084 | pelissip | 2004-11-15 08:32:23 +0000 (Mon, 15 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Fix a bug (Use __gmpfr_ceil_log2 instead of MPFR_INT_CEIL_LOG2).
+
+------------------------------------------------------------------------
+r3083 | zimmerma | 2004-11-12 17:29:54 +0000 (Fri, 12 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added algorithm for mpfr_sqrt
+improved algorithm for mpfr_div
+
+------------------------------------------------------------------------
+r3082 | zimmerma | 2004-11-12 17:22:57 +0000 (Fri, 12 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+use MPFR_SET_EXP/MPFR_GET_EXP instead of MPFR_EXP(r)++
+
+------------------------------------------------------------------------
+r3081 | vlefevre | 2004-11-12 16:03:43 +0000 (Fri, 12 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Bug fix: delayed all the initializations after the singular test.
+
+------------------------------------------------------------------------
+r3080 | vlefevre | 2004-11-11 11:30:46 +0000 (Thu, 11 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Untabified the source.
+
+------------------------------------------------------------------------
+r3079 | vlefevre | 2004-11-11 11:26:51 +0000 (Thu, 11 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+The test MPFR_GET_EXP(u) != MPFR_EMAX_MAX is no longer necessary
+since we decided to lower MPFR_EMAX_MAX to avoid such tests.
+
+------------------------------------------------------------------------
+r3078 | pelissip | 2004-11-10 16:12:53 +0000 (Wed, 10 Nov 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/sqrt.c
+
+Remove use of CNST_LIMB and TMP_ALLOC_LIMB which are GMP internal.
+Add MPFR_LIMB_ZERO.
+
+------------------------------------------------------------------------
+r3077 | zimmerma | 2004-11-10 12:10:16 +0000 (Wed, 10 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/tests/tsqrt.c
+
+new simpler and faster code
+
+------------------------------------------------------------------------
+r3076 | pelissip | 2004-11-10 12:05:20 +0000 (Wed, 10 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cosh.c
+ M /trunk/erf.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/gamma.c
+ M /trunk/get_str.c
+ M /trunk/hypot.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sum.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+
+Replace __gmpfr_ceil_log2 by MPFR_INT_CEIL_LOG2 when possible.
+
+------------------------------------------------------------------------
+r3075 | pelissip | 2004-11-10 12:02:34 +0000 (Wed, 10 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add __extension__ to avoid warning useless in GCC.
+
+------------------------------------------------------------------------
+r3074 | vlefevre | 2004-11-03 16:14:38 +0000 (Wed, 03 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/README
+
+Update.
+
+------------------------------------------------------------------------
+r3069 | pelissip | 2004-11-03 09:11:31 +0000 (Wed, 03 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fix wrong Visual C++ code.
+
+------------------------------------------------------------------------
+r3068 | vlefevre | 2004-11-02 17:01:49 +0000 (Tue, 02 Nov 2004) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Code checking for GMP library wasn't working (always returning "yes"?).
+
+------------------------------------------------------------------------
+r3066 | vlefevre | 2004-10-27 16:34:33 +0000 (Wed, 27 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Updated copyright line.
+
+------------------------------------------------------------------------
+r3064 | vlefevre | 2004-10-27 14:13:24 +0000 (Wed, 27 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Added a bug and updated copyright line.
+
+------------------------------------------------------------------------
+r3062 | vlefevre | 2004-10-27 13:06:42 +0000 (Wed, 27 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3061 | vlefevre | 2004-10-27 13:04:10 +0000 (Wed, 27 Oct 2004) | 7 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/set_d.c
+
+Removed the definitions of DBL_POS_INF/DBL_NEG_INF/DBL_NAN for
+Visual C++ as they were incorrect. Modified DOUBLE_ISINF(x) so
+that infinities are no longer used (this should fix a part of
+the problem for Visual C++). If IEEE 754 is not supported, one
+should probably use the standard INFINITY macro instead of
+(1.0/0.0), since (1.0/0.0) is specific to IEEE 754.
+
+------------------------------------------------------------------------
+r3060 | vlefevre | 2004-10-27 11:55:05 +0000 (Wed, 27 Oct 2004) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/tests/tests.c
+
+Applied patch by Steve M. Robbins for non-IRIX MIPS systems
+(originally for MPFR 2.0.3).
+
+------------------------------------------------------------------------
+r3059 | vlefevre | 2004-10-26 02:11:43 +0000 (Tue, 26 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tsub1sp.c
+
+Reformatted the code.
+
+------------------------------------------------------------------------
+r3058 | vlefevre | 2004-10-26 01:49:26 +0000 (Tue, 26 Oct 2004) | 5 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/ttanh.c
+
+Replaced mpfr_set_emin/emax by set_emin/emax in tests to check
+the return value; defined set_emin/emax in "tests/tests.c".
+Fix: added missing #include <string.h> in "tests/tests.c".
+Removed variable names in prototypes in "mpfr-test.h".
+
+------------------------------------------------------------------------
+r3057 | vlefevre | 2004-10-22 13:19:48 +0000 (Fri, 22 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+
+Reformatted the code -> GNU style.
+
+------------------------------------------------------------------------
+r3054 | vlefevre | 2004-10-22 12:49:32 +0000 (Fri, 22 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3053 | pelissip | 2004-10-22 08:00:56 +0000 (Fri, 22 Oct 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Declaration of "tests_rand_start" and "tests_rand_end" with the same storage class specifier
+in tests.c (static missing line 65 and 109).
+
+------------------------------------------------------------------------
+r3052 | vlefevre | 2004-10-21 11:53:26 +0000 (Thu, 21 Oct 2004) | 4 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+Bug fixed: cast to unsigned char instead of int for isspace (no,
+these are not "psycho" systems, just systems with signed chars).
+Untabified the source.
+
+------------------------------------------------------------------------
+r3051 | pelissip | 2004-10-20 13:27:25 +0000 (Wed, 20 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Improve ICC CFLAGS by removins meaningless warnings.
+
+------------------------------------------------------------------------
+r3050 | pelissip | 2004-10-20 12:52:33 +0000 (Wed, 20 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+Remove some warnings on some "psycho" systems.
+
+------------------------------------------------------------------------
+r3049 | pelissip | 2004-10-20 09:37:55 +0000 (Wed, 20 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Update the chapter "Make a release".
+
+------------------------------------------------------------------------
+r3048 | pelissip | 2004-10-20 09:36:18 +0000 (Wed, 20 Oct 2004) | 4 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/tests.c
+ M /trunk/tests/tinp_str.c
+
+Fix bug when you build MPFR outside source directory.
+Add function src_fopen to open a file in the source directory, which
+may be different from the current directory.
+
+------------------------------------------------------------------------
+r3047 | pelissip | 2004-10-20 07:12:08 +0000 (Wed, 20 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Fix a typo.
+
+------------------------------------------------------------------------
+r3046 | vlefevre | 2004-10-19 13:07:28 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Another correction (English).
+
+------------------------------------------------------------------------
+r3045 | vlefevre | 2004-10-19 13:05:34 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Minor correction.
+
+------------------------------------------------------------------------
+r3044 | pelissip | 2004-10-19 12:49:15 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update NEWS to reflect the change in mpfr_set_str.
+
+------------------------------------------------------------------------
+r3043 | pelissip | 2004-10-19 12:45:45 +0000 (Tue, 19 Oct 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+ M /trunk/tests/tset_str.c
+
+Update mpfr_set_str to be much more like strtofr.
+Update the documentation to reflect the changes.
+
+------------------------------------------------------------------------
+r3042 | zimmerma | 2004-10-19 10:18:14 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+changed contributors section
+
+------------------------------------------------------------------------
+r3041 | pelissip | 2004-10-19 09:53:00 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Add a line about binary compatibility.
+
+------------------------------------------------------------------------
+r3040 | zimmerma | 2004-10-19 09:24:10 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+changed "contributors" section
+
+------------------------------------------------------------------------
+r3039 | zimmerma | 2004-10-19 09:02:46 +0000 (Tue, 19 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+changed rights (remove executable permission)
+
+------------------------------------------------------------------------
+r3038 | vlefevre | 2004-10-18 15:07:09 +0000 (Mon, 18 Oct 2004) | 7 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Misc corrections:
+ + spelling mistakes
+ + consistency: in direction @var{rnd} -> in the direction @var{rnd}
+ + @code{NULL} pointer -> null pointer (as in the C standard)
+ + in the example for mpfr_inits2 / mpfr_clears: NULL -> (void *) 0
+ as NULL isn't necessarily a pointer.
+
+------------------------------------------------------------------------
+r3037 | pelissip | 2004-10-18 14:23:01 +0000 (Mon, 18 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/README
+
+Update
+
+------------------------------------------------------------------------
+r3036 | pelissip | 2004-10-18 13:28:28 +0000 (Mon, 18 Oct 2004) | 7 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+ M /trunk/strtofr.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tstrtofr.c
+
+Change "unsigned int" to "int" for base in proto of strtofr.
+Change set_str to use strtofr (Fix a bug too).
+Limit base to 36 in strtofr (since get_str is limited to 36).
+Update documentation to reflect the changes.
+mpfr_get_d1 is moved to section internal in the documentation.
+Update the tests.
+
+------------------------------------------------------------------------
+r3035 | pelissip | 2004-10-18 13:21:55 +0000 (Mon, 18 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Hard code NAN, +INF and -INF values for MVC.
+
+------------------------------------------------------------------------
+r3034 | pelissip | 2004-10-18 09:47:37 +0000 (Mon, 18 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/tout_str.c
+
+Fix problem on systems where "/dev/null" doesn't exist.
+
+------------------------------------------------------------------------
+r3033 | vlefevre | 2004-10-16 10:48:15 +0000 (Sat, 16 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/mpfr.texi
+
+Misc corrections.
+
+------------------------------------------------------------------------
+r3032 | vlefevre | 2004-10-15 14:06:28 +0000 (Fri, 15 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Updated the section "To make a release".
+
+------------------------------------------------------------------------
+r3031 | vlefevre | 2004-10-15 13:58:37 +0000 (Fri, 15 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/VERSION
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/version.c
+
+Updated the version on the trunk.
+
+------------------------------------------------------------------------
+r3030 | vlefevre | 2004-10-15 12:52:20 +0000 (Fri, 15 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r3029 | vlefevre | 2004-10-15 12:49:05 +0000 (Fri, 15 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update for 2.1.0.
+
+------------------------------------------------------------------------
+r3028 | vlefevre | 2004-10-13 08:35:11 +0000 (Wed, 13 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Added a comment about autoreconf and a bug in Debian (now fixed).
+
+------------------------------------------------------------------------
+r3027 | pelissip | 2004-10-12 07:24:51 +0000 (Tue, 12 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Add a note about Windows 64.
+
+------------------------------------------------------------------------
+r3026 | pelissip | 2004-10-11 13:52:42 +0000 (Mon, 11 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update documentation.
+
+------------------------------------------------------------------------
+r3025 | pelissip | 2004-10-11 13:52:29 +0000 (Mon, 11 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Improve Windows installation.
+
+------------------------------------------------------------------------
+r3024 | pelissip | 2004-10-11 13:52:07 +0000 (Mon, 11 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add a line about "near" and "far".
+
+------------------------------------------------------------------------
+r3023 | pelissip | 2004-10-07 11:53:27 +0000 (Thu, 07 Oct 2004) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+ M /trunk/tests/tget_str.c
+
+Add support for ".lib" since it seems to work.
+Display GMP version inside the configure.
+
+------------------------------------------------------------------------
+r3022 | zimmerma | 2004-10-05 09:45:29 +0000 (Tue, 05 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added one new test
+
+------------------------------------------------------------------------
+r3021 | vlefevre | 2004-10-04 13:40:35 +0000 (Mon, 04 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+Added worst cases.
+
+------------------------------------------------------------------------
+r3020 | zimmerma | 2004-10-02 07:28:07 +0000 (Sat, 02 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added new tests (worst-case)
+
+------------------------------------------------------------------------
+r3019 | zimmerma | 2004-10-01 12:31:46 +0000 (Fri, 01 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added new worst-cases (directed rounding)
+
+------------------------------------------------------------------------
+r3018 | zimmerma | 2004-10-01 07:35:34 +0000 (Fri, 01 Oct 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new function to implement (dilog)
+
+------------------------------------------------------------------------
+r3017 | zimmerma | 2004-09-30 16:11:13 +0000 (Thu, 30 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed bug in get_str_aux when one extra digit
+
+------------------------------------------------------------------------
+r3016 | vlefevre | 2004-09-30 16:06:25 +0000 (Thu, 30 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/rint.c
+ M /trunk/tests/trint.c
+
+Added functions mpfr_rint_round, mpfr_rint_trunc, mpfr_rint_ceil,
+mpfr_rint_floor.
+
+------------------------------------------------------------------------
+r3015 | pelissip | 2004-09-30 13:03:52 +0000 (Thu, 30 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+Add new test (One failed).
+
+------------------------------------------------------------------------
+r3014 | vlefevre | 2004-09-30 09:21:11 +0000 (Thu, 30 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/get_sj.c
+
+The cast to uintmax_t wasn't really useful, so I removed it.
+Added a comment.
+
+------------------------------------------------------------------------
+r3013 | vlefevre | 2004-09-30 09:06:37 +0000 (Thu, 30 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_sj.c
+
+The real fix for sizeof(intmax_t) == sizeof(mp_limb_t).
+
+------------------------------------------------------------------------
+r3012 | pelissip | 2004-09-30 08:08:59 +0000 (Thu, 30 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_sj.c
+
+Fix a bug if sizeof(intmax_t) == sizeof(mp_limb_t)
+
+------------------------------------------------------------------------
+r3011 | zimmerma | 2004-09-29 16:05:01 +0000 (Wed, 29 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added worst-case
+
+------------------------------------------------------------------------
+r3010 | pelissip | 2004-09-29 13:58:06 +0000 (Wed, 29 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/cmp.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ld.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcmpabs.c
+
+cmp(x,y) if x=NAN or y=NAN returns 0 and erange flag.
+
+------------------------------------------------------------------------
+r3009 | pelissip | 2004-09-29 12:54:47 +0000 (Wed, 29 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/mpfr.texi
+
+Update documentation and NEWS to reflect new functions
+and functionnality.
+
+------------------------------------------------------------------------
+r3008 | pelissip | 2004-09-29 12:28:17 +0000 (Wed, 29 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_z.c
+ M /trunk/strtofr.c
+
+Improve assertion.
+
+------------------------------------------------------------------------
+r3007 | pelissip | 2004-09-29 12:27:36 +0000 (Wed, 29 Sep 2004) | 6 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/get_si.c
+ M /trunk/get_sj.c
+ M /trunk/get_ui.c
+ M /trunk/get_uj.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_sj.c
+ M /trunk/set_uj.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/tget_sj.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_sj.c
+
+Add mpfr_clear_erangeflag and mpfr_erangeflag_p.
+Add test for theses two functions.
+mpfr_get_[s/u][i/j] have a deterministic behavior in case of OVERFLOW.
+(Return the MINIMUM or the MAXIMUM in the current type, and set
+ERANGE_flag).
+
+------------------------------------------------------------------------
+r3006 | pelissip | 2004-09-29 12:23:54 +0000 (Wed, 29 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/fits_intmax.c
+ A /trunk/fits_uintmax.c
+ M /trunk/mpfr.h
+ M /trunk/tests/tfits.c
+
+Add mpfr_uintmax_p and mpfr_intmax_p.
+
+------------------------------------------------------------------------
+r3005 | pelissip | 2004-09-29 12:21:03 +0000 (Wed, 29 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/TODO
+
+Update INSTALL about C++
+Update TODO and VERSION.
+
+------------------------------------------------------------------------
+r3004 | pelissip | 2004-09-29 08:59:58 +0000 (Wed, 29 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Move mpfr_inits from mpfr-impl to mpfr.h.
+Add doc too.
+
+------------------------------------------------------------------------
+r3003 | pelissip | 2004-09-28 10:09:18 +0000 (Tue, 28 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_sj.c
+ M /trunk/get_uj.c
+
+Reindent the sources (again).
+
+------------------------------------------------------------------------
+r3002 | pelissip | 2004-09-28 09:26:34 +0000 (Tue, 28 Sep 2004) | 5 lines
+Changed paths:
+ M /trunk/mpn_exp.c
+
+Fix how to detect overflow so that it can be build with GCC -ftrapv
+option without any bugs (In the previous code, the overflow was
+detected afterwards, whereas, now, it is detected before).
+Fix also another real problem of overflow (Addition of two signed integers).
+
+------------------------------------------------------------------------
+r3001 | pelissip | 2004-09-28 08:24:07 +0000 (Tue, 28 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Rename this variable again.
+
+------------------------------------------------------------------------
+r3000 | pelissip | 2004-09-28 07:53:46 +0000 (Tue, 28 Sep 2004) | 4 lines
+Changed paths:
+ M /trunk/div.c
+
+Replace variable 'near' to 'the_real_near' since MSVC incorreclty
+recognize "far" and "near" as obsolete keywords (100% incorrect, and
+clearly MSVC fault but it doesn't cost many things to change the name).
+
+------------------------------------------------------------------------
+r2999 | pelissip | 2004-09-27 14:59:46 +0000 (Mon, 27 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix typo in the documentation about get_ functions.
+
+------------------------------------------------------------------------
+r2998 | pelissip | 2004-09-27 14:58:37 +0000 (Mon, 27 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_sj.c
+ M /trunk/get_uj.c
+
+Retab the sources.
+
+------------------------------------------------------------------------
+r2997 | vlefevre | 2004-09-27 13:58:21 +0000 (Mon, 27 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Added mpfr_get_uj and mpfr_get_sj in the changes 2.0.3 -> 2.1.0.
+
+------------------------------------------------------------------------
+r2996 | vlefevre | 2004-09-27 13:38:24 +0000 (Mon, 27 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Added an item about the future MPFR_FLAGS_ERANGE flag.
+
+------------------------------------------------------------------------
+r2995 | vlefevre | 2004-09-27 13:21:12 +0000 (Mon, 27 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_sj.c
+ A /trunk/get_uj.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tget_sj.c
+
+New functions mpfr_get_sj and mpfr_get_uj, with tests.
+
+------------------------------------------------------------------------
+r2994 | pelissip | 2004-09-27 08:35:25 +0000 (Mon, 27 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/set_sj.c
+
+Remove MPFR_NEED_LONGLONG_H macro.
+
+------------------------------------------------------------------------
+r2993 | vlefevre | 2004-09-26 22:18:46 +0000 (Sun, 26 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/set_sj.c
+
+Added a cast to avoid an integer overflow.
+
+------------------------------------------------------------------------
+r2992 | vlefevre | 2004-09-24 14:53:05 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_si.c
+
+Fixed integer overflow.
+
+------------------------------------------------------------------------
+r2991 | vlefevre | 2004-09-24 14:13:20 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_si.c
+
+Fixed bugs (like those in mpfr_get_ui).
+
+------------------------------------------------------------------------
+r2990 | vlefevre | 2004-09-24 13:38:39 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+The standard autoreconf script should now be used instead of prepare.
+
+------------------------------------------------------------------------
+r2989 | zimmerma | 2004-09-24 11:43:47 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_ui.c
+
+forgot to check for 0
+
+------------------------------------------------------------------------
+r2988 | zimmerma | 2004-09-24 11:15:45 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_ui.c
+
+now use mpfr_rint()
+
+------------------------------------------------------------------------
+r2987 | pelissip | 2004-09-24 08:32:31 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update doc of mpfr_get_str (Minimum space is 7).
+
+------------------------------------------------------------------------
+r2986 | zimmerma | 2004-09-24 07:21:04 +0000 (Fri, 24 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/get_ui.c
+ M /trunk/tests/tset_si.c
+
+fixed double-rounding bug in get_ui
+
+------------------------------------------------------------------------
+r2985 | pelissip | 2004-09-23 15:28:35 +0000 (Thu, 23 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+Prevent from multiple inclusion.
+mpf_init inits to 0 rather than NAN.
+
+------------------------------------------------------------------------
+r2984 | pelissip | 2004-09-23 13:54:41 +0000 (Thu, 23 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix some tiny problems.
+
+------------------------------------------------------------------------
+r2983 | zimmerma | 2004-09-23 10:16:45 +0000 (Thu, 23 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added item on rounding to odd
+
+------------------------------------------------------------------------
+r2982 | pelissip | 2004-09-21 12:42:37 +0000 (Tue, 21 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+Fix a bug in FreeBsd 5.20 / Alpha / Gcc 3.3.3.
+Not a MPFR bug, but add some code to avoid it.
+Reference: http://www.freebsd.org/cgi/query-pr.cgi?pr=72024
+------------------------------------------------------------------------
+r2981 | pelissip | 2004-09-21 11:46:11 +0000 (Tue, 21 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+ M /trunk/tests/tstrtofr.c
+
+Add a new test and clarify a comment.
+
+------------------------------------------------------------------------
+r2980 | pelissip | 2004-09-21 09:52:54 +0000 (Tue, 21 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/strtofr.c
+
+Update Assertion for pow2.
+
+------------------------------------------------------------------------
+r2979 | pelissip | 2004-09-20 15:38:19 +0000 (Mon, 20 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Update NEWS.
+
+------------------------------------------------------------------------
+r2978 | pelissip | 2004-09-20 15:13:51 +0000 (Mon, 20 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update TODO due to new function mpfr_strtofr
+
+------------------------------------------------------------------------
+r2977 | pelissip | 2004-09-20 14:45:32 +0000 (Mon, 20 Sep 2004) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/get_d.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/set_d.c
+ M /trunk/strtofr.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tstrtofr.c
+
+Add ICC detection && support.
+Remove some potential warnings in the test files.
+
+------------------------------------------------------------------------
+r2976 | pelissip | 2004-09-20 08:57:28 +0000 (Mon, 20 Sep 2004) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.texi
+ A /trunk/strtofr.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tstrtofr.c
+
+Add mpfr_strtofr function.
+Add mpfr_strtofr test file.
+Add mpfr_strtofr documentation.
+
+------------------------------------------------------------------------
+r2975 | pelissip | 2004-09-20 08:55:56 +0000 (Mon, 20 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Improve GMP.h vs libgmp.a version checking.
+
+------------------------------------------------------------------------
+r2974 | zimmerma | 2004-09-17 16:26:22 +0000 (Fri, 17 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one entry (new function 1/sqrt(x))
+
+------------------------------------------------------------------------
+r2973 | pelissip | 2004-09-17 09:49:50 +0000 (Fri, 17 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+ M /trunk/tests/Makefile.am
+
+Use LIBS instead of LDADD for libraries (GMP).
+
+------------------------------------------------------------------------
+r2972 | pelissip | 2004-09-17 07:21:31 +0000 (Fri, 17 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Min GMP version is 4.1.0 now.
+
+------------------------------------------------------------------------
+r2971 | pelissip | 2004-09-16 11:12:09 +0000 (Thu, 16 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Add a check if both gmp.h and libgmp.a have the same version.
+
+------------------------------------------------------------------------
+r2970 | pelissip | 2004-09-16 11:11:23 +0000 (Thu, 16 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fix a typo.
+
+------------------------------------------------------------------------
+r2969 | pelissip | 2004-09-15 08:50:55 +0000 (Wed, 15 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+Add a forgotten regression test "1.2.3"
+
+------------------------------------------------------------------------
+r2968 | vlefevre | 2004-09-15 08:38:08 +0000 (Wed, 15 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/config.guess
+ M /trunk/config.sub
+
+Update from the autotools-dev Debian package.
+
+------------------------------------------------------------------------
+r2967 | vlefevre | 2004-09-15 08:27:38 +0000 (Wed, 15 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2966 | pelissip | 2004-09-14 15:11:07 +0000 (Tue, 14 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add 2 new macros for handling correctly overflow.
+
+------------------------------------------------------------------------
+r2965 | zimmerma | 2004-09-13 14:00:36 +0000 (Mon, 13 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+fixed bug (several '.' allowed in mantissa)
+
+------------------------------------------------------------------------
+r2964 | zimmerma | 2004-09-03 09:06:13 +0000 (Fri, 03 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added notes for Windows
+
+------------------------------------------------------------------------
+r2963 | pelissip | 2004-09-02 07:06:39 +0000 (Thu, 02 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Add a line about Dynamic Version of MPFR.
+
+------------------------------------------------------------------------
+r2962 | zimmerma | 2004-09-01 16:42:07 +0000 (Wed, 01 Sep 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added warnings about init functions (mpf wrt mpfr)
+
+------------------------------------------------------------------------
+r2961 | pelissip | 2004-08-31 13:01:00 +0000 (Tue, 31 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update documentations.
+
+------------------------------------------------------------------------
+r2960 | pelissip | 2004-08-31 13:00:15 +0000 (Tue, 31 Aug 2004) | 3 lines
+Changed paths:
+ M /trunk/get_z.c
+ M /trunk/mpfr.h
+ M /trunk/tests/tget_z.c
+
+Rename mpz_set_fr to mpfr_get_z.
+Provide a conditionnal macro for mpz_set_fr.
+
+------------------------------------------------------------------------
+r2959 | pelissip | 2004-08-31 09:20:41 +0000 (Tue, 31 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add doc for mpfr_sqr.
+
+------------------------------------------------------------------------
+r2958 | pelissip | 2004-08-31 08:58:29 +0000 (Tue, 31 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix month.
+
+------------------------------------------------------------------------
+r2957 | pelissip | 2004-08-26 09:05:32 +0000 (Thu, 26 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+Add a new test to check overflow.
+
+------------------------------------------------------------------------
+r2956 | pelissip | 2004-08-24 14:00:42 +0000 (Tue, 24 Aug 2004) | 3 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+Try to retype correctly the functions (replace int by the correct type).
+Still some works to do.
+
+------------------------------------------------------------------------
+r2955 | pelissip | 2004-08-23 09:32:27 +0000 (Mon, 23 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add description of what does MPFR_INT_CEIL_LOG2.
+
+------------------------------------------------------------------------
+r2954 | pelissip | 2004-08-23 09:31:32 +0000 (Mon, 23 Aug 2004) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/exp_2.c
+ A /trunk/isqrt.c
+
+Move __gmpfr_isqrt and __gmpfr_cuberoot to another file.
+Clean up the code of mpfr_exp_2: remove DEBUG condition to use TRACE, ASSERT and DUMP.
+Use MPFR_INT_CEIL_LOG2 instead of __gmpfr_ceil_log2.
+
+------------------------------------------------------------------------
+r2953 | pelissip | 2004-08-23 09:29:55 +0000 (Mon, 23 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Improve a comment.
+
+------------------------------------------------------------------------
+r2952 | pelissip | 2004-08-23 09:01:18 +0000 (Mon, 23 Aug 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/int_ceil_log2.c
+ M /trunk/mpfr-impl.h
+
+Add MPFR_INT_CEIL_LOG2 macro and __gmpfr_int_ceil_log2 function
+(don't use function but macro).
+
+------------------------------------------------------------------------
+r2951 | pelissip | 2004-08-23 08:58:24 +0000 (Mon, 23 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Fix 2 typos.
+
+------------------------------------------------------------------------
+r2950 | pelissip | 2004-08-19 15:02:18 +0000 (Thu, 19 Aug 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Fix a bug on 64-bits introduced due to huger MPFR_EMAX_MAX.
+
+------------------------------------------------------------------------
+r2949 | pelissip | 2004-08-19 14:42:03 +0000 (Thu, 19 Aug 2004) | 5 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Add new functions: mpfr_get_emin_min, mpfr_get_emax_max, mpfr_get_emin_max and
+mpfr_get_emax_min.
+Add documentation and explanation about potential portability problem when
+you mpfr_set_emin and mpfr_set_emax.
+
+------------------------------------------------------------------------
+r2948 | vlefevre | 2004-07-28 15:10:23 +0000 (Wed, 28 Jul 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Added mpfr-longlong.h to libmpfr_a_SOURCES so that it is distributed
+with make dist.
+
+------------------------------------------------------------------------
+r2947 | vlefevre | 2004-07-28 15:06:29 +0000 (Wed, 28 Jul 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Added mpfr-gmp.h to libmpfr_a_SOURCES so that it is distributed
+with make dist.
+
+------------------------------------------------------------------------
+r2946 | pelissip | 2004-07-26 14:38:56 +0000 (Mon, 26 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add a new section.
+
+------------------------------------------------------------------------
+r2945 | pelissip | 2004-07-20 09:09:34 +0000 (Tue, 20 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ A /trunk/sqr.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tsqr.c
+
+Add function mpfr_sqr (TODO: Make doc)
+
+------------------------------------------------------------------------
+r2944 | pelissip | 2004-07-19 11:48:10 +0000 (Mon, 19 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+Fix an unsigned/signed comparison.
+
+------------------------------------------------------------------------
+r2943 | pelissip | 2004-07-19 11:39:27 +0000 (Mon, 19 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+Improve the emulation of mpn_sqr_n and fix some typos.
+
+------------------------------------------------------------------------
+r2942 | pelissip | 2004-07-16 11:33:34 +0000 (Fri, 16 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+Remove unused item "rnd_mode" in cache struct.
+
+------------------------------------------------------------------------
+r2941 | pelissip | 2004-07-16 08:59:40 +0000 (Fri, 16 Jul 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tversion.c
+ M /trunk/version.c
+
+Renamme mpfr_version to mpfr_get_version to be more GMP compatible.
+Add macro mpfr_version.
+
+------------------------------------------------------------------------
+r2940 | pelissip | 2004-07-16 08:54:53 +0000 (Fri, 16 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+ M /trunk/round_raw_generic.c
+
+Likely some tests.
+
+------------------------------------------------------------------------
+r2939 | pelissip | 2004-07-15 07:58:02 +0000 (Thu, 15 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/set_si.c
+
+Add a speciliation for set_si for GCC.
+
+------------------------------------------------------------------------
+r2938 | pelissip | 2004-07-09 09:42:26 +0000 (Fri, 09 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+Try to optimize a few agm by rewriting a few the loop.
+
+------------------------------------------------------------------------
+r2937 | pelissip | 2004-07-09 09:41:45 +0000 (Fri, 09 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Likely / Unlikely some tests using gcov.
+
+------------------------------------------------------------------------
+r2936 | pelissip | 2004-07-06 12:16:52 +0000 (Tue, 06 Jul 2004) | 5 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Remove some unused code.
+Add MPFR_LMIB_PER_DOUBLE
+Add MPFR_DUMP
+Add MPFR_TRACE
+
+------------------------------------------------------------------------
+r2935 | pelissip | 2004-07-06 12:14:44 +0000 (Tue, 06 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Likely some tests.
+
+------------------------------------------------------------------------
+r2934 | pelissip | 2004-07-06 12:14:11 +0000 (Tue, 06 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Used static precision for the array of limb for double.
+
+------------------------------------------------------------------------
+r2933 | pelissip | 2004-07-06 12:10:24 +0000 (Tue, 06 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Likely some tests / Other minor optimisations.
+
+------------------------------------------------------------------------
+r2932 | pelissip | 2004-07-06 12:09:31 +0000 (Tue, 06 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/ui_div.c
+
+Minor modifications.
+
+------------------------------------------------------------------------
+r2931 | pelissip | 2004-07-06 12:08:13 +0000 (Tue, 06 Jul 2004) | 3 lines
+Changed paths:
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+
+Unlikely a test so that it is faster when you call theses functions
+with the same dest and source which is the common case in MPFR.
+
+------------------------------------------------------------------------
+r2930 | pelissip | 2004-07-06 12:04:08 +0000 (Tue, 06 Jul 2004) | 3 lines
+Changed paths:
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+
+Likely a test to optimize when dest and src are the same
+(which is very likely inside MPFR).
+
+------------------------------------------------------------------------
+r2929 | pelissip | 2004-07-06 12:02:59 +0000 (Tue, 06 Jul 2004) | 2 lines
+Changed paths:
+ M /trunk/cache.c
+
+Likely a test (since cache should always work fine).
+
+------------------------------------------------------------------------
+r2928 | pelissip | 2004-06-28 12:11:44 +0000 (Mon, 28 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+ M /trunk/get_d.c
+
+Add some likely, and use a static table instead of a dynamic one.
+
+------------------------------------------------------------------------
+r2927 | pelissip | 2004-06-16 12:08:30 +0000 (Wed, 16 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/atan.c
+
+Unlikely some tests.
+
+------------------------------------------------------------------------
+r2926 | pelissip | 2004-06-10 15:10:12 +0000 (Thu, 10 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+Likely / Unlikely the code.
+
+------------------------------------------------------------------------
+r2925 | pelissip | 2004-06-10 14:03:10 +0000 (Thu, 10 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Respace some macro.
+
+------------------------------------------------------------------------
+r2924 | pelissip | 2004-06-10 14:02:30 +0000 (Thu, 10 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/save_expo.c
+
+Retab some lines.
+
+------------------------------------------------------------------------
+r2923 | pelissip | 2004-06-10 14:01:33 +0000 (Thu, 10 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/get_z.c
+
+Optimize a bit.
+
+------------------------------------------------------------------------
+r2922 | pelissip | 2004-06-10 13:59:50 +0000 (Thu, 10 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/tests/tsin.c
+
+Fix an overflow bug.
+
+------------------------------------------------------------------------
+r2921 | zimmerma | 2004-06-08 07:27:40 +0000 (Tue, 08 Jun 2004) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+ M /trunk/tests/texp.c
+
+fixed bug in mpfr_exp_3 (wrong assert)
+
+------------------------------------------------------------------------
+r2920 | pelissip | 2004-05-27 14:39:34 +0000 (Thu, 27 May 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix typos.
+
+------------------------------------------------------------------------
+r2919 | pelissip | 2004-05-27 09:52:44 +0000 (Thu, 27 May 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update doc.
+
+------------------------------------------------------------------------
+r2918 | zimmerma | 2004-05-18 16:00:28 +0000 (Tue, 18 May 2004) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+
+fixed problem for x near from Pi/2 (the internal precision should take
+into account the cancellation)
+
+------------------------------------------------------------------------
+r2917 | pelissip | 2004-05-18 15:26:19 +0000 (Tue, 18 May 2004) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/tests/tsin.c
+
+Improve tests for sin.
+
+------------------------------------------------------------------------
+r2916 | zimmerma | 2004-05-18 14:29:55 +0000 (Tue, 18 May 2004) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+mpfr_sin_sign() should use at least MPFR_GET_EXP() bits
+
+------------------------------------------------------------------------
+r2915 | pelissip | 2004-05-17 07:57:34 +0000 (Mon, 17 May 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove an item.
+
+------------------------------------------------------------------------
+r2914 | pelissip | 2004-05-12 14:57:36 +0000 (Wed, 12 May 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+ M /trunk/tests/ttan.c
+
+Add a potential test (Too slow).
+
+------------------------------------------------------------------------
+r2913 | pelissip | 2004-05-12 14:57:10 +0000 (Wed, 12 May 2004) | 2 lines
+Changed paths:
+ M /trunk/tan.c
+
+Simplify the code.
+
+------------------------------------------------------------------------
+r2912 | pelissip | 2004-05-11 07:21:45 +0000 (Tue, 11 May 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Remove a C++ comment.
+
+------------------------------------------------------------------------
+r2911 | pelissip | 2004-05-10 07:03:28 +0000 (Mon, 10 May 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Remove a forgotten "assertd" which isn't usefull anymore.
+
+------------------------------------------------------------------------
+r2910 | pelissip | 2004-05-07 15:04:30 +0000 (Fri, 07 May 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/mpfr-impl.h
+
+Optimize cos.
+
+------------------------------------------------------------------------
+r2909 | zimmerma | 2004-05-07 13:00:11 +0000 (Fri, 07 May 2004) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+
+improved initial value of working precision (did not take into account
+2K lost bits for large arguments)
+
+------------------------------------------------------------------------
+r2908 | pelissip | 2004-05-06 12:37:21 +0000 (Thu, 06 May 2004) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/asin.c
+ M /trunk/atan.c
+ M /trunk/exp2.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/ttanh.c
+
+Fix overflow and add corresponding tests.
+
+------------------------------------------------------------------------
+r2907 | pelissip | 2004-05-06 10:42:56 +0000 (Thu, 06 May 2004) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Fix a bug in a formula.
+
+------------------------------------------------------------------------
+r2906 | pelissip | 2004-05-06 10:42:44 +0000 (Thu, 06 May 2004) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+Optimize it a bit.
+
+------------------------------------------------------------------------
+r2905 | pelissip | 2004-05-06 09:56:48 +0000 (Thu, 06 May 2004) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp_2.c
+ M /trunk/gamma.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tgamma.c
+
+Fix overflow problems.
+
+------------------------------------------------------------------------
+r2904 | pelissip | 2004-05-06 09:11:20 +0000 (Thu, 06 May 2004) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tcosh.c
+
+Fix overflow bug.
+
+------------------------------------------------------------------------
+r2903 | pelissip | 2004-05-05 15:34:06 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Remove the double vars. (Use fixed instead).
+
+------------------------------------------------------------------------
+r2902 | pelissip | 2004-05-05 15:14:07 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Add a note about tanh.
+
+------------------------------------------------------------------------
+r2901 | pelissip | 2004-05-05 15:10:43 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+ M /trunk/tests/ttanh.c
+
+Fix a bug in cas of overflow in tanh.
+
+------------------------------------------------------------------------
+r2900 | pelissip | 2004-05-05 13:02:20 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+Optimize a few by reducing the # of used vars.
+
+------------------------------------------------------------------------
+r2899 | pelissip | 2004-05-05 12:29:28 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/cosh.c
+ M /trunk/tests/tcosh.c
+
+Fix critical bugs due to different kind of overflow in cosh.
+
+------------------------------------------------------------------------
+r2898 | pelissip | 2004-05-05 12:28:38 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add MPFR_TMP_INIT_ABS macro.
+
+------------------------------------------------------------------------
+r2897 | pelissip | 2004-05-05 09:39:23 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+ M /trunk/cosh.c
+
+Optimize cosh a few by removing an unused intermedary var.
+
+------------------------------------------------------------------------
+r2896 | pelissip | 2004-05-05 07:49:22 +0000 (Wed, 05 May 2004) | 2 lines
+Changed paths:
+ M /trunk/const_log2.c
+
+Fix a critical bug in case of overflow.
+
+------------------------------------------------------------------------
+r2895 | pelissip | 2004-05-04 15:46:42 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tlog.c
+
+Fix a critical bug in cos in case you have set the float range for the exponents.
+
+------------------------------------------------------------------------
+r2894 | pelissip | 2004-05-04 14:17:54 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+Optimize a few cos.
+
+------------------------------------------------------------------------
+r2893 | pelissip | 2004-05-04 13:34:15 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+Optimize the way of computing initial precision.
+
+------------------------------------------------------------------------
+r2892 | pelissip | 2004-05-04 12:52:01 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+Add a test to check an overflow in const_pi (called by log in case of emulation of the float type).
+
+------------------------------------------------------------------------
+r2891 | pelissip | 2004-05-04 12:50:59 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+Move to ASSERT mode some code.
+
+------------------------------------------------------------------------
+r2890 | pelissip | 2004-05-04 12:46:13 +0000 (Tue, 04 May 2004) | 3 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+Push/Pop emin/emax so that an overflow can't occur in mpfr_set_z(x,pi,r)
+Add test too.
+
+------------------------------------------------------------------------
+r2889 | pelissip | 2004-05-04 09:06:04 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/mul_2ui.c
+
+Add some UNLIKELY to the while.
+
+------------------------------------------------------------------------
+r2888 | pelissip | 2004-05-04 09:05:30 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+Add some UNLIKELY to the tests.
+
+------------------------------------------------------------------------
+r2887 | pelissip | 2004-05-04 09:05:00 +0000 (Tue, 04 May 2004) | 2 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/tests/tadd1sp.c
+
+Fix an overflow bug in add1sp.
+
+------------------------------------------------------------------------
+r2885 | pelissip | 2004-04-29 07:31:09 +0000 (Thu, 29 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Fix a typo in AC_MY_LIBS.
+
+------------------------------------------------------------------------
+r2884 | pelissip | 2004-04-28 07:47:59 +0000 (Wed, 28 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+ M /trunk/mpfr.h
+
+Add mpfr_cmp as a real function, not only a macro.
+
+------------------------------------------------------------------------
+r2883 | pelissip | 2004-04-28 07:43:36 +0000 (Wed, 28 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/set.c
+
+Add mpfr_set and mpfr_abs as real functions.
+
+------------------------------------------------------------------------
+r2882 | pelissip | 2004-04-27 13:35:45 +0000 (Tue, 27 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+When using GCC, optimize certain common comparisons.
+
+------------------------------------------------------------------------
+r2881 | zimmerma | 2004-04-27 11:40:47 +0000 (Tue, 27 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item
+
+------------------------------------------------------------------------
+r2880 | pelissip | 2004-04-27 09:04:14 +0000 (Tue, 27 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+Minor Optimizations.
+
+------------------------------------------------------------------------
+r2879 | pelissip | 2004-04-27 09:03:17 +0000 (Tue, 27 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/cache.c
+
+Fix a bug (Use nextbeloz instead of sub_one_ulp).
+
+------------------------------------------------------------------------
+r2878 | pelissip | 2004-04-21 13:07:50 +0000 (Wed, 21 Apr 2004) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr-impl.h
+
+Add option in configure: --disable-cache
+to disable the use of the cache for the const.
+
+------------------------------------------------------------------------
+r2877 | pelissip | 2004-04-21 12:47:53 +0000 (Wed, 21 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix a typo.
+
+------------------------------------------------------------------------
+r2876 | pelissip | 2004-04-21 12:36:30 +0000 (Wed, 21 Apr 2004) | 5 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/cache.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/free_cache.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+
+Add preliminary generic code to handle cached const.
+Move const_pi, const_log2 to use this generic cache,
+which fix bugs of the previous implementation.
+const_euler is now cached too.
+
+------------------------------------------------------------------------
+r2875 | pelissip | 2004-04-21 12:34:00 +0000 (Wed, 21 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+Fix a bug (If x = Nan, the new new precision wasn't set).
+
+------------------------------------------------------------------------
+r2874 | pelissip | 2004-04-21 12:33:29 +0000 (Wed, 21 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/cputime.h
+
+Fix a typo bug.
+
+------------------------------------------------------------------------
+r2873 | pelissip | 2004-04-20 12:13:51 +0000 (Tue, 20 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tconst_log2.c
+
+Add new test about the cache: new bug to fix.
+
+------------------------------------------------------------------------
+r2872 | pelissip | 2004-04-20 12:03:40 +0000 (Tue, 20 Apr 2004) | 2 lines
+Changed paths:
+ A /trunk/iszero.c
+
+Add forgotten file for mpfr_zero_p.
+
+------------------------------------------------------------------------
+r2871 | pelissip | 2004-04-20 09:32:20 +0000 (Tue, 20 Apr 2004) | 6 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/isinf.c
+ M /trunk/isnan.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/sgn.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tsgn.c
+
+Add mpfr_zero_p.
+Add macros for mpfr_inf_p, mpfr_nan_p and mpfr_zero_p.
+Add macro for mpfr_sgn.
+Update doc.
+Add new tests.
+
+------------------------------------------------------------------------
+r2870 | pelissip | 2004-04-20 09:30:56 +0000 (Tue, 20 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+Fix a bug in a proto.
+
+------------------------------------------------------------------------
+r2869 | pelissip | 2004-04-20 09:29:48 +0000 (Tue, 20 Apr 2004) | 3 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/tests/tagm.c
+
+Fix a bug when both op are < 0 (It seems it was my fault).
+Add a test to check it.
+
+------------------------------------------------------------------------
+r2868 | pelissip | 2004-04-09 08:38:02 +0000 (Fri, 09 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+
+Fix a bug (Remove useless function).
+
+------------------------------------------------------------------------
+r2867 | pelissip | 2004-04-08 09:12:08 +0000 (Thu, 08 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+Fix another bug (Maybe the last?).
+
+------------------------------------------------------------------------
+r2866 | pelissip | 2004-04-08 09:09:45 +0000 (Thu, 08 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.h
+
+Fix a tiny bug.
+
+------------------------------------------------------------------------
+r2865 | pelissip | 2004-04-08 09:07:10 +0000 (Thu, 08 Apr 2004) | 4 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-test.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_f.c
+
+Update memory allocations scheme without gmp-impl.h.
+Now the semantic of the memory allocation scheme is the same
+with and without gmp-impl, as it should be.
+
+------------------------------------------------------------------------
+r2864 | pelissip | 2004-04-07 14:42:32 +0000 (Wed, 07 Apr 2004) | 3 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/gmp_op.c
+ M /trunk/mpfr.texi
+ M /trunk/sub_ui.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/ui_sub.c
+
+For add/sub_type functions where type is a type without signed zeros,
+specify the expected result when both operands are 0.
+
+------------------------------------------------------------------------
+r2863 | pelissip | 2004-04-07 14:40:47 +0000 (Wed, 07 Apr 2004) | 4 lines
+Changed paths:
+ M /trunk/init2.c
+ M /trunk/mpfr-gmp.c
+ M /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+Modify a few the allocation scheme without gmp-impl.h
+Add pseudo-constants __MPFR_EXP_NAN, __MPFR_EXP_ZERO and __MPFR_EXP_INF
+for future (?) inlining of some functions.
+
+------------------------------------------------------------------------
+r2862 | zimmerma | 2004-04-07 14:19:44 +0000 (Wed, 07 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/mpn_exp.c
+ M /trunk/set_str.c
+ M /trunk/tests/tset_str.c
+
+fixed problem when overflow in destination exponent happens
+
+------------------------------------------------------------------------
+r2861 | pelissip | 2004-04-07 13:31:54 +0000 (Wed, 07 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+Fix a bug in case a mpz_t == 0 (mpz_sizeinbase(0Z,2)==0 and MPFR_PREC_MIN=2).
+
+------------------------------------------------------------------------
+r2860 | pelissip | 2004-04-07 13:12:41 +0000 (Wed, 07 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/tests/tpow.c
+
+Fix a bug in case of pow(2E1000000,-10);
+
+------------------------------------------------------------------------
+r2859 | zimmerma | 2004-04-05 08:53:04 +0000 (Mon, 05 Apr 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+fixed problem (cmpabs doesn't work for x=0)
+
+------------------------------------------------------------------------
+r2858 | pelissip | 2004-03-26 13:27:16 +0000 (Fri, 26 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/check.c
+ M /trunk/cmp2.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/next.c
+ M /trunk/random2.c
+ M /trunk/round_prec.c
+ M /trunk/set_d.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/trandom.c
+ M /trunk/urandomb.c
+
+Change from MP_LIMB_T_ONE to MPFR_LIMB_ONE and/or MPFR_LIMB_MASK.
+
+------------------------------------------------------------------------
+r2857 | pelissip | 2004-03-26 13:26:29 +0000 (Fri, 26 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+
+Improve comments.
+
+------------------------------------------------------------------------
+r2856 | pelissip | 2004-03-26 13:24:58 +0000 (Fri, 26 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+Fix a bug.
+
+------------------------------------------------------------------------
+r2855 | pelissip | 2004-03-26 13:24:14 +0000 (Fri, 26 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+Move detecting macros (__MPFR_GCC, __MPFR_STDC, __MPFR_GLIBC and __MPFR_GMP) from mpfr to mpfr-impl
+
+------------------------------------------------------------------------
+r2854 | zimmerma | 2004-03-22 10:54:28 +0000 (Mon, 22 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+removed blank
+
+------------------------------------------------------------------------
+r2853 | vlefevre | 2004-03-22 10:20:16 +0000 (Mon, 22 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+
+Test write access to CVS.
+
+------------------------------------------------------------------------
+r2852 | pelissip | 2004-03-18 09:57:51 +0000 (Thu, 18 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-gmp.c
+
+Fix a bug in a string.
+
+------------------------------------------------------------------------
+r2851 | pelissip | 2004-03-17 15:50:27 +0000 (Wed, 17 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation of 'j' functions.
+
+------------------------------------------------------------------------
+r2850 | pelissip | 2004-03-17 12:40:01 +0000 (Wed, 17 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix (?) definition of MPFR_PREC_MAX.
+
+------------------------------------------------------------------------
+r2849 | pelissip | 2004-03-17 09:45:26 +0000 (Wed, 17 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Change the order of the tests.
+
+------------------------------------------------------------------------
+r2848 | pelissip | 2004-03-17 08:45:08 +0000 (Wed, 17 Mar 2004) | 4 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp3.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/texp.c
+
+Rename mpfr_exp3 in mpfr_exp_3.
+Update THRESHOLD for mpfr_exp.
+Add MPFR_EXP_THRESHOLD.
+
+------------------------------------------------------------------------
+r2847 | pelissip | 2004-03-16 15:24:50 +0000 (Tue, 16 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Add new option "--with-gmp-build="
+
+------------------------------------------------------------------------
+r2846 | pelissip | 2004-03-16 15:24:26 +0000 (Tue, 16 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Update INSTALL
+
+------------------------------------------------------------------------
+r2845 | pelissip | 2004-03-16 13:44:38 +0000 (Tue, 16 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix a bug (Forget to cast to mp_exp_t).
+
+------------------------------------------------------------------------
+r2844 | pelissip | 2004-03-16 10:45:49 +0000 (Tue, 16 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/swap.c
+
+Update comment
+
+------------------------------------------------------------------------
+r2843 | pelissip | 2004-03-16 10:43:24 +0000 (Tue, 16 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_z.c
+ M /trunk/mpfr.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tget_z.c
+
+Add mpz_set_fr function and its test.
+
+------------------------------------------------------------------------
+r2842 | pelissip | 2004-03-15 14:09:49 +0000 (Mon, 15 Mar 2004) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ A /trunk/set_sj.c
+ A /trunk/set_uj.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tset_sj.c
+
+Add new functions:
+ mpfr_set_sj_2exp, mpfr_set_sj
+ mpfr_set_uj_2exp, mpfr_set_uj
+
+------------------------------------------------------------------------
+r2841 | pelissip | 2004-03-15 14:08:54 +0000 (Mon, 15 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/sub1sp.c
+
+Fix a compiler bug (limb !=0 instead of limb).
+
+------------------------------------------------------------------------
+r2840 | pelissip | 2004-03-15 13:26:42 +0000 (Mon, 15 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+
+Fix a cast problem on some systems (sizeof(mp_limb_t) > sizeof(unsigned long)).
+
+------------------------------------------------------------------------
+r2839 | pelissip | 2004-03-12 17:45:07 +0000 (Fri, 12 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd1sp.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tsub1sp.c
+
+Remove use of abort (They can create core dump on some systems).
+
+------------------------------------------------------------------------
+r2838 | pelissip | 2004-03-12 13:17:53 +0000 (Fri, 12 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/tests/tacos.c
+
+Fix bug of inexact flag for acos(0).
+
+------------------------------------------------------------------------
+r2837 | pelissip | 2004-03-12 12:51:09 +0000 (Fri, 12 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/tests/memory.c
+
+Update.
+
+------------------------------------------------------------------------
+r2836 | pelissip | 2004-03-11 12:39:08 +0000 (Thu, 11 Mar 2004) | 3 lines
+Changed paths:
+ M /trunk/si_op.c
+ M /trunk/tests/tsi_op.c
+
+Fix bug about forgotten MPFR_INVERT_RND.
+Add test too.
+
+------------------------------------------------------------------------
+r2835 | pelissip | 2004-03-11 12:38:33 +0000 (Thu, 11 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add doc about HAVE_STDINT_H
+
+------------------------------------------------------------------------
+r2834 | pelissip | 2004-03-10 16:16:28 +0000 (Wed, 10 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix doc about MPFR_DECL_INIT.
+
+------------------------------------------------------------------------
+r2833 | pelissip | 2004-03-10 15:31:42 +0000 (Wed, 10 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix the declaration of 'MPFR_DECL_INIT'
+
+------------------------------------------------------------------------
+r2832 | pelissip | 2004-03-10 14:58:16 +0000 (Wed, 10 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Add 'MPFR_DECL_INIT' macro.
+
+------------------------------------------------------------------------
+r2831 | pelissip | 2004-03-10 10:16:51 +0000 (Wed, 10 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/rint.c
+
+Rename NEAREST_AWAY in GMP_RNDNA.
+
+------------------------------------------------------------------------
+r2830 | pelissip | 2004-03-10 09:35:45 +0000 (Wed, 10 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add the description of mpfr_set_ui_2exp and mpfr_set_si_2exp.
+
+------------------------------------------------------------------------
+r2829 | pelissip | 2004-03-09 17:31:29 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ A /trunk/set_si_2exp.c
+ A /trunk/set_ui_2exp.c
+ M /trunk/tests/tset_si.c
+
+Add mpfr_set_si_2exp and mpfr_set_ui_2exp and their tests.
+
+------------------------------------------------------------------------
+r2828 | pelissip | 2004-03-09 15:20:01 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add doc about mpfr_cmp_f function
+
+------------------------------------------------------------------------
+r2827 | pelissip | 2004-03-09 15:18:17 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/mpfr.h
+ M /trunk/set_f.c
+ M /trunk/tests/tgmpop.c
+
+Add mpfr_cmp_f and its test.
+
+------------------------------------------------------------------------
+r2826 | pelissip | 2004-03-09 14:11:27 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/cmp_ld.c
+ M /trunk/mpfr.h
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tcmp_d.c
+ A /trunk/tests/tcmp_ld.c
+
+Add mpfr_cmp_ld and its test
+
+------------------------------------------------------------------------
+r2825 | pelissip | 2004-03-09 13:58:39 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add doc of 2 macros.
+
+------------------------------------------------------------------------
+r2824 | pelissip | 2004-03-09 13:51:50 +0000 (Tue, 09 Mar 2004) | 3 lines
+Changed paths:
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/mpfr.h
+
+Add mpfr_cmp_ui and mpfr_cmp_si as real functions
+(The macros are still defined and used).
+
+------------------------------------------------------------------------
+r2823 | pelissip | 2004-03-09 13:43:31 +0000 (Tue, 09 Mar 2004) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/si_op.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tsi_op.c
+
+Add mpfr_add_si, mpfr_sub_si, mpfr_si_sub, mpfr_mul_si, mpfr_div_si and
+mpfr_si_div.
+Add the corresponding test.
+
+------------------------------------------------------------------------
+r2822 | pelissip | 2004-03-09 11:02:34 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tgmpop.c
+
+Add `mpfr_cmp_q` and `mpfr_cmp_z`.
+
+------------------------------------------------------------------------
+r2821 | pelissip | 2004-03-09 10:06:01 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Clean up configure
+
+------------------------------------------------------------------------
+r2820 | pelissip | 2004-03-09 09:51:08 +0000 (Tue, 09 Mar 2004) | 2 lines
+Changed paths:
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+
+Add ASSERT for NAN.
+
+------------------------------------------------------------------------
+r2819 | pelissip | 2004-02-27 12:41:37 +0000 (Fri, 27 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add documentation for MPFR_VERSION
+
+------------------------------------------------------------------------
+r2818 | pelissip | 2004-02-26 11:20:49 +0000 (Thu, 26 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Optimize a few mpfr_mul.
+
+------------------------------------------------------------------------
+r2817 | pelissip | 2004-02-26 10:05:12 +0000 (Thu, 26 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+Add Laurent Fousse in the AUTHORS file.
+
+------------------------------------------------------------------------
+r2816 | vlefevre | 2004-02-26 09:56:02 +0000 (Thu, 26 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Fixed a bug in check2b and added a test; add1.c coverage is now
+complete.
+
+------------------------------------------------------------------------
+r2815 | vlefevre | 2004-02-25 16:30:33 +0000 (Wed, 25 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Improved coverage.
+
+------------------------------------------------------------------------
+r2814 | vlefevre | 2004-02-25 16:00:58 +0000 (Wed, 25 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Improved coverage.
+
+------------------------------------------------------------------------
+r2813 | vlefevre | 2004-02-25 15:44:56 +0000 (Wed, 25 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Bugs fixed in a test function -> improved coverage.
+
+------------------------------------------------------------------------
+r2812 | pelissip | 2004-02-25 15:02:22 +0000 (Wed, 25 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/round_raw_generic.c
+
+Optimize mpfr_round_raw_?
+
+------------------------------------------------------------------------
+r2811 | pelissip | 2004-02-25 10:57:16 +0000 (Wed, 25 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add1sp.c
+ M /trunk/sgn.c
+ M /trunk/sub1sp.c
+
+Simplify the code.
+
+------------------------------------------------------------------------
+r2808 | vlefevre | 2004-02-24 14:51:42 +0000 (Tue, 24 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+Avoid integer overflow.
+
+------------------------------------------------------------------------
+r2807 | vlefevre | 2004-02-24 14:44:38 +0000 (Tue, 24 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Ported code clean-up to trunk.
+
+------------------------------------------------------------------------
+r2802 | pelissip | 2004-02-24 13:23:35 +0000 (Tue, 24 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/div.c
+ M /trunk/eq.c
+ M /trunk/frac.c
+ M /trunk/log10.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set_d.c
+ M /trunk/set_str.c
+ M /trunk/sin.c
+ M /trunk/sqrt.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sum.c
+ M /trunk/tests/tests.c
+
+Remove some warnings.
+MPFR can be compiled (but not checked!) with a C++ compiler.
+
+------------------------------------------------------------------------
+r2797 | pelissip | 2004-02-24 09:12:03 +0000 (Tue, 24 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tzeta.c
+
+Improve test coverage.
+
+------------------------------------------------------------------------
+r2796 | zimmerma | 2004-02-24 08:14:39 +0000 (Tue, 24 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+further simplification of the code (replaced one in-place shift and copy
+by out-of-place shift or copy)
+
+------------------------------------------------------------------------
+r2795 | zimmerma | 2004-02-23 16:47:46 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tui_div.c
+
+use GMP_RND_MAX instead of hard-coded constant
+
+------------------------------------------------------------------------
+r2794 | zimmerma | 2004-02-23 16:23:59 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/tests/tdiv.c
+
+simplified the code of div.c and improved coverage
+
+------------------------------------------------------------------------
+r2792 | pelissip | 2004-02-23 14:20:32 +0000 (Mon, 23 Feb 2004) | 3 lines
+Changed paths:
+ D /trunk/longlong.h
+ M /trunk/mpfr-impl.h
+ A /trunk/mpfr-longlong.h
+
+Rename 'longlong.h' in 'mpfr-longlong.h' so that when MPFR is built
+within GMP it uses GMP's 'longlong.h' rather than MPFR's copy.
+
+------------------------------------------------------------------------
+r2791 | vlefevre | 2004-02-23 14:19:02 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2789 | pelissip | 2004-02-23 14:09:10 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ A /trunk/free_cache.c
+
+Add mpfr_free_cache (2).
+
+------------------------------------------------------------------------
+r2788 | pelissip | 2004-02-23 14:08:44 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tests.c
+
+Add mpfr_free_cache.
+
+------------------------------------------------------------------------
+r2787 | pelissip | 2004-02-23 13:51:41 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_str.c
+
+Add mpfr_free_str function.
+
+------------------------------------------------------------------------
+r2786 | pelissip | 2004-02-23 12:14:40 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Remove a warning.
+
+------------------------------------------------------------------------
+r2785 | pelissip | 2004-02-23 12:14:29 +0000 (Mon, 23 Feb 2004) | 4 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Reorder the declarations of the functions.
+Remove duplicate declarations.
+Remove mpfr_factorial.
+
+------------------------------------------------------------------------
+r2784 | zimmerma | 2004-02-23 10:01:42 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+patch from Guillaume Hanrot
+
+------------------------------------------------------------------------
+r2783 | pelissip | 2004-02-23 09:43:29 +0000 (Mon, 23 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/set_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+
+Improve coverage tests.
+Fix 2 underflow bugs.
+
+------------------------------------------------------------------------
+r2782 | pelissip | 2004-02-23 09:42:29 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Update comment
+
+------------------------------------------------------------------------
+r2781 | pelissip | 2004-02-23 09:42:04 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Improve comments.
+
+------------------------------------------------------------------------
+r2780 | pelissip | 2004-02-23 09:41:28 +0000 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Add a comment.
+
+------------------------------------------------------------------------
+r2779 | vlefevre | 2004-02-22 01:48:32 +0000 (Sun, 22 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Added tests.
+
+------------------------------------------------------------------------
+r2775 | fousse | 2004-02-20 13:15:44 +0000 (Fri, 20 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/sum.c
+ M /trunk/tests/tsum.c
+
+Changed mpfr_sum to use unsigned long instead of unsigned int. More tests.
+
+------------------------------------------------------------------------
+r2774 | pelissip | 2004-02-20 12:58:30 +0000 (Fri, 20 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/neg.c
+ M /trunk/tests/tset.c
+
+mpfr_neg (b, b, r) for b=NAN didnt' set NAN flag.
+
+------------------------------------------------------------------------
+r2773 | pelissip | 2004-02-20 10:49:34 +0000 (Fri, 20 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr_sgn is no longer a macro.
+
+------------------------------------------------------------------------
+r2770 | pelissip | 2004-02-19 12:33:47 +0000 (Thu, 19 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+Fix bug with exact rationnal arguments (0.5+3/2 freezes).
+
+------------------------------------------------------------------------
+r2767 | vlefevre | 2004-02-18 12:47:00 +0000 (Wed, 18 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/config.guess
+ M /trunk/config.sub
+
+Update from the autotools-dev Debian package (2004-01-05).
+
+------------------------------------------------------------------------
+r2761 | vlefevre | 2004-02-18 10:41:00 +0000 (Wed, 18 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+ M /trunk/tests/tset_f.c
+
+Fixed a bug in mpfr_set_f for 0 (wrong sign) and added the test.
+
+------------------------------------------------------------------------
+r2760 | pelissip | 2004-02-18 10:29:40 +0000 (Wed, 18 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Fix bug if you build MPFR with ASSERT.
+
+------------------------------------------------------------------------
+r2759 | pelissip | 2004-02-17 14:39:16 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Reduce the number of used variables.
+
+------------------------------------------------------------------------
+r2758 | zimmerma | 2004-02-17 14:29:28 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/round_raw_generic.c
+
+improved again documentation
+
+------------------------------------------------------------------------
+r2757 | zimmerma | 2004-02-17 14:27:06 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+simplified rounding
+
+------------------------------------------------------------------------
+r2756 | zimmerma | 2004-02-17 14:17:31 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/round_raw_generic.c
+
+improved documentation of *inexp
+
+------------------------------------------------------------------------
+r2752 | pelissip | 2004-02-17 12:12:21 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub1sp.c
+
+Simplify the random code.
+
+------------------------------------------------------------------------
+r2751 | pelissip | 2004-02-17 12:12:02 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Optimize it a few.
+
+------------------------------------------------------------------------
+r2750 | pelissip | 2004-02-17 12:11:49 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/round_raw_generic.c
+
+Add 2004 in copyright line.
+
+------------------------------------------------------------------------
+r2749 | pelissip | 2004-02-17 12:11:26 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add a section which describes the needed macros for building MPFR.
+
+------------------------------------------------------------------------
+r2747 | zimmerma | 2004-02-17 11:21:04 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+added comment about probability of normalized product
+
+------------------------------------------------------------------------
+r2744 | vlefevre | 2004-02-17 10:36:11 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added a note about the ternary value, important in practice.
+
+------------------------------------------------------------------------
+r2743 | zimmerma | 2004-02-17 10:02:29 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+ M /trunk/tests/tset_f.c
+
+fixed 2 bugs and added test
+
+------------------------------------------------------------------------
+r2742 | zimmerma | 2004-02-17 10:01:18 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/round_raw_generic.c
+
+added comment about return value
+
+------------------------------------------------------------------------
+r2741 | pelissip | 2004-02-17 08:57:19 +0000 (Tue, 17 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Try so support GMP as a Shared Library.
+
+------------------------------------------------------------------------
+r2740 | zimmerma | 2004-02-16 18:23:49 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+improved error message
+
+------------------------------------------------------------------------
+r2739 | pelissip | 2004-02-16 18:02:42 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+
+Fix the computing of the error for mpq_add and mpq_sub.
+
+------------------------------------------------------------------------
+r2738 | vlefevre | 2004-02-16 17:57:38 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Added more tests (improved tadd1.c coverage).
+
+------------------------------------------------------------------------
+r2737 | zimmerma | 2004-02-16 17:47:59 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+added cancellation test for add_q
+
+------------------------------------------------------------------------
+r2736 | vlefevre | 2004-02-16 17:37:59 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Added tests (improved tadd1.c coverage).
+
+------------------------------------------------------------------------
+r2735 | pelissip | 2004-02-16 17:35:26 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/tests/tgmpop.c
+
+Fix bug of add_q and sub_q with special values (NAN, INF and ZERO).
+
+------------------------------------------------------------------------
+r2734 | zimmerma | 2004-02-16 17:12:45 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/set_d.c
+ M /trunk/set_q.c
+
+deal with overflow/underflow in mpfr_div
+
+------------------------------------------------------------------------
+r2733 | zimmerma | 2004-02-16 17:04:34 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tgmpop.c
+
+added hard-coded tests
+
+------------------------------------------------------------------------
+r2732 | vlefevre | 2004-02-16 16:50:31 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+When the precisions are the same, test both mpfr_add1sp and mpfr_add1.
+
+------------------------------------------------------------------------
+r2731 | vlefevre | 2004-02-16 16:34:39 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Added overflow check.
+
+------------------------------------------------------------------------
+r2730 | pelissip | 2004-02-16 16:17:38 +0000 (Mon, 16 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/add1sp.c
+ M /trunk/div.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/tsub1sp.c
+
+Optimize add1sp, sub1sp and div.
+Improve coverage test for sub1sp.
+
+------------------------------------------------------------------------
+r2729 | vlefevre | 2004-02-16 16:06:11 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+Removed unused label.
+
+------------------------------------------------------------------------
+r2727 | vlefevre | 2004-02-16 15:05:18 +0000 (Mon, 16 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+Really reverted to rev. 1.54 + kept optimization + commented out
+is_odd_even.
+
+------------------------------------------------------------------------
+r2725 | zimmerma | 2004-02-16 14:30:43 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+ M /trunk/set_ld.c
+
+take into account possible out-of-range exponent
+
+------------------------------------------------------------------------
+r2724 | zimmerma | 2004-02-16 14:24:48 +0000 (Mon, 16 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+revert to rev 1.54 code for case x infinite
+(was less efficient but simpler)
+
+------------------------------------------------------------------------
+r2723 | zimmerma | 2004-02-16 13:56:42 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+fixed bug with in-place computation
+
+------------------------------------------------------------------------
+r2722 | vlefevre | 2004-02-16 13:55:27 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tsqrt.c
+
+Code clean-up and fix to avoid warnings.
+
+------------------------------------------------------------------------
+r2721 | zimmerma | 2004-02-16 13:35:20 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+changed back to C99 standard for special values of x^y
+
+------------------------------------------------------------------------
+r2720 | zimmerma | 2004-02-16 11:33:24 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/trint.c
+
+added test for *function* mpfr_round
+
+------------------------------------------------------------------------
+r2719 | zimmerma | 2004-02-16 11:06:06 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tinp_str.c
+ M /trunk/tests/tout_str.c
+
+check return value of fopen
+
+------------------------------------------------------------------------
+r2718 | vlefevre | 2004-02-16 11:01:38 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Removed the no longer used label "fin" and fixed the indentation.
+
+------------------------------------------------------------------------
+r2717 | vlefevre | 2004-02-16 10:55:36 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Fix: MPFR_NOT_ZERO -> MPFR_NOTZERO.
+
+------------------------------------------------------------------------
+r2716 | vlefevre | 2004-02-16 10:52:40 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+Commented out the now useless "double uo, vo;".
+
+------------------------------------------------------------------------
+r2715 | zimmerma | 2004-02-16 10:41:02 +0000 (Mon, 16 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+improved coverage tests
+
+------------------------------------------------------------------------
+r2714 | zimmerma | 2004-02-14 23:05:51 +0000 (Sat, 14 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/mpfr.texi
+ M /trunk/set_d.c
+ M /trunk/set_q.c
+ M /trunk/set_str_raw.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tset_d.c
+ A /trunk/tests/tset_exp.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+
+new coverage tests
+
+------------------------------------------------------------------------
+r2713 | zimmerma | 2004-02-14 11:11:31 +0000 (Sat, 14 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+ M /trunk/inp_str.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/mpfr.texi
+ M /trunk/mpn_exp.c
+ M /trunk/mul_ui.c
+ M /trunk/next.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/inp_str.data
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/thypot.c
+ A /trunk/tests/tinp_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+
+improved coverage test
+
+------------------------------------------------------------------------
+r2712 | zimmerma | 2004-02-13 17:39:02 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tset_si.c
+
+improved coverage test
+
+------------------------------------------------------------------------
+r2711 | zimmerma | 2004-02-13 17:17:52 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/tests/tget_str.c
+
+improved test coverage
+
+------------------------------------------------------------------------
+r2710 | zimmerma | 2004-02-13 16:00:10 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+improved test coverage
+
+------------------------------------------------------------------------
+r2709 | zimmerma | 2004-02-13 15:35:19 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+ M /trunk/tests/texp.c
+
+improved test coverage
+
+------------------------------------------------------------------------
+r2708 | pelissip | 2004-02-13 15:05:42 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd1sp.c
+
+Fix a bug in taddsp (Forget to check if random does not generate zero).
+
+------------------------------------------------------------------------
+r2707 | zimmerma | 2004-02-13 13:57:24 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/teq.c
+
+improved editing style
+
+------------------------------------------------------------------------
+r2706 | zimmerma | 2004-02-13 13:44:41 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/div_ui.c
+ M /trunk/tests/tdiv_ui.c
+
+improved test coverage
+
+------------------------------------------------------------------------
+r2705 | zimmerma | 2004-02-13 13:43:27 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/eq.c
+ M /trunk/tests/teq.c
+
+partly rewritten, and improved test coverage
+
+------------------------------------------------------------------------
+r2704 | vlefevre | 2004-02-13 13:33:10 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+Added tests for mpfr_mul_2si and mpfr_div_2si + corrections.
+
+------------------------------------------------------------------------
+r2703 | vlefevre | 2004-02-13 12:31:49 +0000 (Fri, 13 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+Replaced mpfr_mul_2exp and mpfr_div_2exp by mpfr_mul_2ui and
+mpfr_div_2ui as the 2exp form is obsolete.
+
+------------------------------------------------------------------------
+r2702 | zimmerma | 2004-02-13 12:25:14 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tfactorial.c
+
+removed warnings
+
+------------------------------------------------------------------------
+r2701 | pelissip | 2004-02-13 11:30:05 +0000 (Fri, 13 Feb 2004) | 5 lines
+Changed paths:
+ M /trunk/check.c
+ M /trunk/cmp_abs.c
+ M /trunk/set.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tcmpabs.c
+ M /trunk/tests/texceptions.c
+ A /trunk/tests/tfits.c
+ A /trunk/tests/toutimpl.c
+
+Add test for mpfr_cmpabs
+Add test for mpfr_fits_
+Add test for internal dumping functions.
+Improve coverage test for exceptions / set / check.
+
+------------------------------------------------------------------------
+r2700 | zimmerma | 2004-02-13 10:52:11 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+ M /trunk/tests/tconst_pi.c
+
+improved coverage
+
+------------------------------------------------------------------------
+r2699 | zimmerma | 2004-02-13 10:31:42 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+removed Kevin, added missing accent
+
+------------------------------------------------------------------------
+r2698 | zimmerma | 2004-02-13 09:33:55 +0000 (Fri, 13 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/uceil_exp2.c
+
+improved coverage test
+
+------------------------------------------------------------------------
+r2697 | pelissip | 2004-02-12 18:02:28 +0000 (Thu, 12 Feb 2004) | 4 lines
+Changed paths:
+ M /trunk/dump.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr.h
+
+Rewrite (simplify) mpfr_dump.
+Change its proto.
+Fix mpf_dump macro in mpf2mpfr.
+
+------------------------------------------------------------------------
+r2696 | pelissip | 2004-02-12 17:58:40 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/div.c
+ M /trunk/mul.c
+ M /trunk/sub.c
+
+Remove MPFR_ASSERTN(0) and add MPFR_ASSERTD(last condition) instead.
+
+------------------------------------------------------------------------
+r2695 | zimmerma | 2004-02-12 16:54:28 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+improved coverage
+
+------------------------------------------------------------------------
+r2694 | zimmerma | 2004-02-12 16:38:06 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+
+improved coverage
+
+------------------------------------------------------------------------
+r2693 | zimmerma | 2004-02-12 16:25:29 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+improved cov. test
+
+------------------------------------------------------------------------
+r2692 | zimmerma | 2004-02-12 16:08:00 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+improved cov. test
+
+------------------------------------------------------------------------
+r2691 | zimmerma | 2004-02-12 16:01:26 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+ M /trunk/tests/tfma.c
+
+improved coverage test
+
+------------------------------------------------------------------------
+r2690 | zimmerma | 2004-02-12 15:05:14 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+ M /trunk/tests/tfactorial.c
+
+improved coverage test
+
+------------------------------------------------------------------------
+r2689 | zimmerma | 2004-02-12 14:30:20 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+ M /trunk/tests/texpm1.c
+
+improved test coverage
+
+------------------------------------------------------------------------
+r2688 | pelissip | 2004-02-12 14:20:43 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+
+Improve coverage of const_pi and const_log2 (Test for prec > 20000).
+
+------------------------------------------------------------------------
+r2687 | zimmerma | 2004-02-12 14:08:06 +0000 (Thu, 12 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/tests/texp.c
+
+fixed tiny bugs for corner cases
+improved test coverage
+
+------------------------------------------------------------------------
+r2686 | pelissip | 2004-02-12 13:49:44 +0000 (Thu, 12 Feb 2004) | 6 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/add.c
+ A /trunk/add1sp.c
+ M /trunk/copysign.c
+ M /trunk/div_2ui.c
+ M /trunk/mpfr-impl.h
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tadd1sp.c
+ A /trunk/tests/tcopysign.c
+ M /trunk/tests/tdim.c
+ M /trunk/tests/texp.c
+ A /trunk/tests/tminmax.c
+ M /trunk/tests/tmul_2exp.c
+
++ Add mpfr_add1sp which provides addition when all the operands have the same precision.
++ Add new test files for mpfr_copysign and mpfr_min and mpfr_max.
++ Add test for mpfr_exp10 in tests/texp.c
++ Improve coverage of div_2ui.c and mul_2ui.c
++ Add a forgotten ASSERT in mpfr_sqrt
+
+------------------------------------------------------------------------
+r2685 | zimmerma | 2004-02-12 13:20:50 +0000 (Thu, 12 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+improved test coverage
+replaced mpfr_get_d1 by mpfr_get_si
+
+------------------------------------------------------------------------
+r2684 | zimmerma | 2004-02-12 12:54:48 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/erf.c
+ M /trunk/tests/terf.c
+
+improved coverage test
+
+------------------------------------------------------------------------
+r2683 | zimmerma | 2004-02-12 12:38:17 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added new coverage test
+
+------------------------------------------------------------------------
+r2682 | pelissip | 2004-02-12 11:42:34 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Fix some mistakes.
+
+------------------------------------------------------------------------
+r2681 | pelissip | 2004-02-12 11:38:49 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Add a description of the gcov tool.
+
+------------------------------------------------------------------------
+r2680 | zimmerma | 2004-02-12 11:35:50 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+now 100% of coverage of sub1.c
+
+------------------------------------------------------------------------
+r2679 | zimmerma | 2004-02-12 11:06:02 +0000 (Thu, 12 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/dim.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tdim.c
+
+new test file for mpfr_dim
+
+------------------------------------------------------------------------
+r2672 | pelissip | 2004-02-06 15:57:28 +0000 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Replace AS_HELP_STRING to AC_HELP_STRING (obsolete)
+
+------------------------------------------------------------------------
+r2671 | pelissip | 2004-02-06 15:37:40 +0000 (Fri, 06 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/add1.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asinh.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/dump.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/fma.c
+ M /trunk/get_exp.c
+ M /trunk/get_z_exp.c
+ M /trunk/init.c
+ M /trunk/inits.c
+ M /trunk/inp_str.c
+ M /trunk/isinf.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/log1p.c
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/powerof2.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_inf.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/volatile.c
+
+Add forgotten copyright 2004 line.
+Add a small documentation about mpfr_sum.
+
+------------------------------------------------------------------------
+r2668 | pelissip | 2004-02-06 13:59:56 +0000 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ A /trunk/sum.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tsum.c
+
+Added mpfr_sum function.
+
+------------------------------------------------------------------------
+r2665 | pelissip | 2004-02-06 13:27:05 +0000 (Fri, 06 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/acinclude.m4
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/clear.c
+ M /trunk/clears.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_d.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/comparisons.c
+ M /trunk/configure.in
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp10.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fits_s.h
+ M /trunk/fits_u.h
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/gamma.c
+ M /trunk/get_d.c
+ M /trunk/get_exp.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_z_exp.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+ M /trunk/inp_str.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ A /trunk/longlong.h
+ M /trunk/minmax.c
+ A /trunk/mp_clz_tab.c
+ A /trunk/mpfr-gmp.c
+ A /trunk/mpfr-gmp.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpn_exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/next.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/powerof2.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sgn.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub1sp.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/uceil_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/version.c
+ M /trunk/volatile.c
+
++ Better support of non IEEE doubles.
++ You can compile MPFR without gmp internal files (ie gmp-impl.h, gmp-mparam.h, and config.h). You only need gmp.h and libgmp.a. But you can still compile with GMP internal files (configure detects them).
+
+------------------------------------------------------------------------
+r2664 | vlefevre | 2004-02-06 13:06:36 +0000 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2660 | vlefevre | 2004-02-06 10:54:26 +0000 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Updated MPFR URL.
+
+------------------------------------------------------------------------
+r2659 | vlefevre | 2004-02-06 10:49:54 +0000 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+Added the changes from version 2.0.1 to version 2.0.2.
+
+------------------------------------------------------------------------
+r2657 | vlefevre | 2004-02-06 10:14:00 +0000 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Added: "3) Update the NEWS file.".
+
+------------------------------------------------------------------------
+r2655 | zimmerma | 2004-02-03 10:06:53 +0000 (Tue, 03 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_str.c
+
+fixed bug in get_str (case pow2, rnd=up or down)
+
+------------------------------------------------------------------------
+r2654 | zimmerma | 2004-01-30 16:27:35 +0000 (Fri, 30 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+fixed problem (s1 = s-1 inexact)
+
+------------------------------------------------------------------------
+r2653 | zimmerma | 2004-01-30 15:06:42 +0000 (Fri, 30 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+ M /trunk/gamma.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tgamma.c
+
+fixed problem in gamma/factorial
+
+------------------------------------------------------------------------
+r2652 | zimmerma | 2004-01-30 12:51:58 +0000 (Fri, 30 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/hypot.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/thypot.c
+
+added new tests for agm and hypot (+ fixed bugs)
+
+------------------------------------------------------------------------
+r2651 | pelissip | 2004-01-29 16:12:42 +0000 (Thu, 29 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Add GMP_RND_MAX so that a for loop of the rounding modes looks like:
+ for(int r = 0 ; r < GMP_RND_MAX ; r++)
+
+------------------------------------------------------------------------
+r2650 | pelissip | 2004-01-28 14:22:05 +0000 (Wed, 28 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_d.c
+ M /trunk/set_ld.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/uceil_exp2.c
+ M /trunk/ufloor_log2.c
+
+Better supports of non IEEE-754 floats (don't use anymore ieee_double_extract if _GMP_IEEE is not set).
+
+------------------------------------------------------------------------
+r2649 | vlefevre | 2004-01-28 11:32:57 +0000 (Wed, 28 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/frac.c
+
+Added comments and a temporary fix.
+
+------------------------------------------------------------------------
+r2648 | zimmerma | 2004-01-27 08:00:00 +0000 (Tue, 27 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/cbrt.c
+ M /trunk/erf.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tzeta.c
+
+fixed bugs in atan cbrt erf
+added new hard-coded tests
+
+------------------------------------------------------------------------
+r2647 | zimmerma | 2004-01-26 13:14:55 +0000 (Mon, 26 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+removed argument reduction in sin(Pi*s/2) [delegated to mpfr_sin]
+
+------------------------------------------------------------------------
+r2646 | zimmerma | 2004-01-26 13:11:54 +0000 (Mon, 26 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+print inputs of test2 in binary form
+commented out test for 0.8 (input is not exactly representable)
+
+------------------------------------------------------------------------
+r2645 | pelissip | 2004-01-26 11:45:21 +0000 (Mon, 26 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
++ Internal functions of zeta are now declared as static.
++ Add new tests which fail.
+
+------------------------------------------------------------------------
+r2644 | zimmerma | 2004-01-22 22:30:52 +0000 (Thu, 22 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/algorithms.tex
+ M /trunk/asin.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/erf.c
+ M /trunk/exp_2.c
+ M /trunk/frac.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/trint.c
+
+added several hard-coded tests (and fixed bugs found)
+
+------------------------------------------------------------------------
+r2643 | pelissip | 2004-01-20 13:08:53 +0000 (Tue, 20 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fix tiny bug of Concept Index / Rounding Modes.
+
+------------------------------------------------------------------------
+r2642 | pelissip | 2004-01-20 13:04:30 +0000 (Tue, 20 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update minor things.
+
+------------------------------------------------------------------------
+r2641 | zimmerma | 2004-01-20 11:07:48 +0000 (Tue, 20 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+minor change in contributions
+
+------------------------------------------------------------------------
+r2640 | zimmerma | 2004-01-20 10:56:59 +0000 (Tue, 20 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added Patrick in the main contributors
+
+------------------------------------------------------------------------
+r2639 | vlefevre | 2004-01-20 10:08:27 +0000 (Tue, 20 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Fixed spelling mistake.
+
+------------------------------------------------------------------------
+r2638 | pelissip | 2004-01-20 09:15:19 +0000 (Tue, 20 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Reorder the documentation.
+
+------------------------------------------------------------------------
+r2637 | ryde | 2004-01-19 23:51:46 +0000 (Mon, 19 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+# Add a remark to mpf_strto.
+
+------------------------------------------------------------------------
+r2636 | ryde | 2004-01-19 23:31:56 +0000 (Mon, 19 Jan 2004) | 4 lines
+Changed paths:
+ M /trunk/TODO
+
+# Drop my thought about addmul instead of fma. The latter takes a
+# separate destination and is hence not the same as what mpn and mpz
+# addmul do.
+
+------------------------------------------------------------------------
+r2635 | pelissip | 2004-01-19 16:06:34 +0000 (Mon, 19 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tset_d.c
+
+Update tests to remove the use of double when possible.
+
+------------------------------------------------------------------------
+r2634 | pelissip | 2004-01-19 16:05:24 +0000 (Mon, 19 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Reenable the cmp between inexact flags.
+
+------------------------------------------------------------------------
+r2633 | pelissip | 2004-01-19 16:03:30 +0000 (Mon, 19 Jan 2004) | 4 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/set_rnd.c
+ M /trunk/tests/texceptions.c
+
+Add mpfr_get_default_rounding_mode.
+Add the tests for mpfr_get/set_default_rounding_mode.
+Fix mpfr_set_default_rounding_mode.
+
+------------------------------------------------------------------------
+r2632 | vlefevre | 2004-01-19 03:01:10 +0000 (Mon, 19 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+_mpfr_ceil -> mpfr_ceil_double + check for overflow.
+
+------------------------------------------------------------------------
+r2631 | vlefevre | 2004-01-19 02:39:21 +0000 (Mon, 19 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/get_str.c
+ A /trunk/mpn_exp.c
+
+Moved the mpfr_mpn_exp function to a new file "mpn_exp.c" as it is
+used by both "get_str.c" and "set_str.c".
+
+------------------------------------------------------------------------
+r2630 | pelissip | 2004-01-16 15:55:15 +0000 (Fri, 16 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+Update it to remove the use of float/double.
+
+------------------------------------------------------------------------
+r2629 | pelissip | 2004-01-15 16:57:35 +0000 (Thu, 15 Jan 2004) | 2 lines
+Changed paths:
+ D /trunk/from_Torbjorn
+ M /trunk/get_str.c
+ M /trunk/tests/tget_str.c
+
+Add a new check in tget_str.c.
+
+------------------------------------------------------------------------
+r2628 | pelissip | 2004-01-15 16:56:48 +0000 (Thu, 15 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Add new macros.
+
+------------------------------------------------------------------------
+r2627 | pelissip | 2004-01-15 16:55:45 +0000 (Thu, 15 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+Readd stdio.h in case of DEBUG mode.
+
+------------------------------------------------------------------------
+r2626 | pelissip | 2004-01-15 16:55:25 +0000 (Thu, 15 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Optimize a few sub1sp by removing the normalisation in case of exact rounding and by removing the calcul of the rounding mode in case of exact rounding.
+
+------------------------------------------------------------------------
+r2625 | zimmerma | 2004-01-15 14:43:17 +0000 (Thu, 15 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed problem in case m=0 and b=2^k (lost bits from 1st digit were not taken
+into account)
+
+------------------------------------------------------------------------
+r2624 | zimmerma | 2004-01-15 12:09:25 +0000 (Thu, 15 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_str.c
+
+mpn_exp -> mpfr_mpn_exp
+
+------------------------------------------------------------------------
+r2623 | vlefevre | 2004-01-15 08:49:34 +0000 (Thu, 15 Jan 2004) | 2 lines
+Changed paths:
+ D /trunk/gammaPiAGMformula.c
+
+Removed gammaPiAGMformula.c (old version, no longer used).
+
+------------------------------------------------------------------------
+r2622 | vlefevre | 2004-01-14 17:18:34 +0000 (Wed, 14 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/cbrt.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/div_ui.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp_2.c
+ M /trunk/get_ld.c
+ M /trunk/hypot.c
+ M /trunk/init2.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log2.c
+ M /trunk/reldiff.c
+ M /trunk/save_expo.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_str.c
+ M /trunk/ui_div.c
+ M /trunk/zeta.c
+
+Changed some error messages into assertions.
+Removed some useless #include's.
+
+------------------------------------------------------------------------
+r2621 | pelissip | 2004-01-14 12:42:22 +0000 (Wed, 14 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+
+Continue to port tests so that they don't use double.
+
+------------------------------------------------------------------------
+r2620 | pelissip | 2004-01-09 16:00:54 +0000 (Fri, 09 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/cmp_str.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tgmpop.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+Update the tests to reduce the use of floats.
+
+------------------------------------------------------------------------
+r2619 | pelissip | 2004-01-09 10:15:51 +0000 (Fri, 09 Jan 2004) | 2 lines
+Changed paths:
+ D /trunk/mpfi.c
+ D /trunk/mpfi.h
+
+Remove unused files mpfi.c and mpfi.h
+
+------------------------------------------------------------------------
+r2618 | pelissip | 2004-01-09 09:51:23 +0000 (Fri, 09 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+
+Update test.
+Don't use floats anymore.
+
+------------------------------------------------------------------------
+r2617 | pelissip | 2004-01-09 09:50:45 +0000 (Fri, 09 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+Add RND_RAND
+Add SIGN_RAND
+
+------------------------------------------------------------------------
+r2616 | pelissip | 2004-01-09 08:58:24 +0000 (Fri, 09 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/isinteger.c
+
++ Simplify the signular code.
++ Fix potential type errors. (Used mpfr_prec_t instead of mpfr_uexp_t).
+
+------------------------------------------------------------------------
+r2615 | pelissip | 2004-01-08 16:51:51 +0000 (Thu, 08 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tgmpop.c
+
++ Add a new test file for checking functions mpfr_add/sub/mul/div_q/z (from gmp_op.c).
++ Fix bugs of mpfr_add/sub/mul/div_q/z.
+
+------------------------------------------------------------------------
+r2614 | vlefevre | 2004-01-07 19:58:45 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+-0 -> @minus{}0.
+
+------------------------------------------------------------------------
+r2613 | vlefevre | 2004-01-07 19:54:53 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Specifications for mpfr_min and mpfr_max.
+
+------------------------------------------------------------------------
+r2612 | vlefevre | 2004-01-07 17:21:06 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Updated MPFR_INTPREC_MAX definition, as mpfr_prec_t has changed.
+
+------------------------------------------------------------------------
+r2611 | pelissip | 2004-01-07 16:37:09 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub1sp.c
+
+Add a new test between sub1 and sub1sp.
+
+------------------------------------------------------------------------
+r2610 | pelissip | 2004-01-07 16:28:42 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/minmax.c
+
+Fix copyright line.
+
+------------------------------------------------------------------------
+r2609 | zimmerma | 2004-01-07 16:27:09 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/sub1.c
+ M /trunk/tests/tsub.c
+
+fixed wrong sign of inexact flag
+
+------------------------------------------------------------------------
+r2608 | vlefevre | 2004-01-07 16:11:04 +0000 (Wed, 07 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Added casts to size_t so that integers representing a size get
+this type as soon as possible.
+
+------------------------------------------------------------------------
+r2607 | pelissip | 2004-01-07 14:48:33 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Use MPFR_ASSERTN(0) instead of abort.
+
+------------------------------------------------------------------------
+r2606 | pelissip | 2004-01-07 14:48:10 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix the definition of MPFR_PREC_MAX
+
+------------------------------------------------------------------------
+r2605 | zimmerma | 2004-01-07 14:46:09 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added new test to check bug repair
+
+------------------------------------------------------------------------
+r2604 | zimmerma | 2004-01-07 14:45:21 +0000 (Wed, 07 Jan 2004) | 3 lines
+Changed paths:
+ M /trunk/sub1.c
+
+fixed bug (wrong inexact flag) for rounding to nearest when sh=0 and
+first trailing limbs coincide
+
+------------------------------------------------------------------------
+r2603 | pelissip | 2004-01-07 14:27:34 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/sub.c
+
+Fix copyright lines (2004).
+
+------------------------------------------------------------------------
+r2602 | pelissip | 2004-01-07 14:05:30 +0000 (Wed, 07 Jan 2004) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/add.c
+ M /trunk/sub.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tsub1sp.c
+
+Fix bug of sub1sp.c on sparck.
+Add new tests for sub1sp.
+Reenable sub1sp for mpfr_add / mpfr_sub.
+
+------------------------------------------------------------------------
+r2601 | pelissip | 2004-01-07 14:04:30 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+
+Change output format of mpfr_print_mant_binary.
+
+------------------------------------------------------------------------
+r2600 | vlefevre | 2004-01-07 13:27:29 +0000 (Wed, 07 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/cmp2.c
+
+Clarified comment.
+
+------------------------------------------------------------------------
+r2599 | vlefevre | 2004-01-06 14:17:50 +0000 (Tue, 06 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Updated copyright line.
+
+------------------------------------------------------------------------
+r2598 | vlefevre | 2004-01-06 14:06:48 +0000 (Tue, 06 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tversion.c
+ M /trunk/update-version
+ A /trunk/version.c
+
+Added mpfr_version function and test.
+
+------------------------------------------------------------------------
+r2597 | vlefevre | 2004-01-06 13:46:32 +0000 (Tue, 06 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+The mpfr_print_rnd_mode return type is const char *, not char *.
+
+------------------------------------------------------------------------
+r2596 | pelissip | 2004-01-06 13:06:37 +0000 (Tue, 06 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_z.c
+
+Update the copyright line of the source files to 2004.
+
+------------------------------------------------------------------------
+r2595 | pelissip | 2004-01-06 12:30:41 +0000 (Tue, 06 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_z.c
+
+Add the tests to check if 0 for signed class with unsigned 0 is set to 0+.
+
+------------------------------------------------------------------------
+r2594 | zimmerma | 2004-01-05 16:35:08 +0000 (Mon, 05 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+specified sign of zero in mpfr_set_*
+
+------------------------------------------------------------------------
+r2593 | zimmerma | 2004-01-05 14:32:56 +0000 (Mon, 05 Jan 2004) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+removed test using denorms
+
+------------------------------------------------------------------------
+r2592 | pelissip | 2003-12-22 17:08:57 +0000 (Mon, 22 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/add.c
+ M /trunk/sub.c
+
+Disable sub1sp in add.c and in sub.c since it provides some bugs on spark (Log/acos/asin and atan tests failed but not tsub or tsub1sp).
+
+------------------------------------------------------------------------
+r2591 | pelissip | 2003-12-22 17:08:01 +0000 (Mon, 22 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Change comment.
+
+------------------------------------------------------------------------
+r2590 | pelissip | 2003-12-22 14:13:24 +0000 (Mon, 22 Dec 2003) | 3 lines
+Changed paths:
+ M /trunk/init2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
++ Rearrange the code to be more "compatible" with broken systems.
++ Preprocessing checks are done in init2.c since GMP constants can't be used in preprocessing #if.
+
+------------------------------------------------------------------------
+r2589 | pelissip | 2003-12-22 13:56:15 +0000 (Mon, 22 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/sub1sp.c
+
+Use MPFR_UNSIGNED_MINUS_MODULO when needed.
+
+------------------------------------------------------------------------
+r2588 | pelissip | 2003-12-22 10:57:56 +0000 (Mon, 22 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/clears.c
+ M /trunk/inits.c
+ M /trunk/inits2.c
+
+Explicit support for K&R C since ansi2knr can't be used.
+
+------------------------------------------------------------------------
+r2587 | ryde | 2003-12-20 00:02:38 +0000 (Sat, 20 Dec 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+(tests_rand_start): Use gmp_randinit_default not the
+RANDS macro, to cope with new non-seeding MT setup by RANDS.
+
+------------------------------------------------------------------------
+r2586 | pelissip | 2003-12-19 16:29:48 +0000 (Fri, 19 Dec 2003) | 3 lines
+Changed paths:
+ M /trunk/get_ui.c
+ M /trunk/init2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+Support of MPFR_PREC_FORMAT.
+Fix a bug in case mp_prec_t = unsigned short.
+
+------------------------------------------------------------------------
+r2585 | vlefevre | 2003-12-19 14:19:53 +0000 (Fri, 19 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/update-version
+
+Update due to a change in mpfr.h.
+
+------------------------------------------------------------------------
+r2584 | pelissip | 2003-12-19 11:56:42 +0000 (Fri, 19 Dec 2003) | 4 lines
+Changed paths:
+ M /trunk/VERSION
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
++ Modify Version to 2.1.0.
++ Add MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR and MPFR_VERSION_PATCHLEVEL in mpfr.h
++ Add MPFR_VERSION_NUM and MPFR_VERSION to check Mpfr version.
+
+------------------------------------------------------------------------
+r2583 | pelissip | 2003-12-19 11:54:48 +0000 (Fri, 19 Dec 2003) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/sub1sp.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+
+Remove one warning in mpf_compat.h
+Create a new macro: MPFR_RET_NEVER_GO_HERE
+Modify ui_sub/div to use it to make Insure++ happy.
+
+------------------------------------------------------------------------
+r2582 | zimmerma | 2003-12-19 11:44:42 +0000 (Fri, 19 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated mpfr_root entry
+
+------------------------------------------------------------------------
+r2581 | vlefevre | 2003-12-19 11:41:10 +0000 (Fri, 19 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ A /trunk/update-version
+
+Added update-version script to update the MPFR version.
+
+------------------------------------------------------------------------
+r2580 | zimmerma | 2003-12-19 10:06:10 +0000 (Fri, 19 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed one item, added one
+
+------------------------------------------------------------------------
+r2579 | zimmerma | 2003-12-16 12:46:28 +0000 (Tue, 16 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+removed unused target "tests"
+
+------------------------------------------------------------------------
+r2578 | zimmerma | 2003-12-16 12:38:36 +0000 (Tue, 16 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+removed AC_DEFINE(hpux) [not used any more]
+
+------------------------------------------------------------------------
+r2577 | ryde | 2003-12-15 22:01:21 +0000 (Mon, 15 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+(EXTRA_DIST): Add round_raw_generic.c.
+
+------------------------------------------------------------------------
+r2576 | pelissip | 2003-12-15 14:39:35 +0000 (Mon, 15 Dec 2003) | 8 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/atan.c
+ M /trunk/cbrt.c
+ M /trunk/div.c
+ M /trunk/fits_u.h
+ M /trunk/gamma.c
+ M /trunk/get_d.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/round_prec.c
+ M /trunk/round_raw_generic.c
+ M /trunk/set_ld.c
+ M /trunk/set_ui.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/memory.c
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/rnd_mode.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcomparisons.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_d_2exp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tinits.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tnext.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsgn.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub1sp.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
++ Optimize a few div.c
++ Remove some warnings in asin.c, atan.c.
++ Include limits.h before gmp-impl.h in mpfr-impl.h
++ mpfr-tests.h doesn't include anumore standard include files.
++ Test files include only standard includes and mpfr-tests.h.
++ Add some forgotten mpfr_clear in mpf[r]_compat.
++ Remove some warnings in the tests.
+
+------------------------------------------------------------------------
+r2575 | zimmerma | 2003-12-15 09:11:37 +0000 (Mon, 15 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+removed unused arguments
+
+------------------------------------------------------------------------
+r2574 | zimmerma | 2003-12-15 09:00:22 +0000 (Mon, 15 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+removed AC_DEFINE(__STDC__) for OSF
+
+------------------------------------------------------------------------
+r2573 | zimmerma | 2003-12-15 08:48:24 +0000 (Mon, 15 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+removed MISCFLAGS (not used any more)
+
+------------------------------------------------------------------------
+r2572 | ryde | 2003-12-14 00:42:04 +0000 (Sun, 14 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Quote AC_DEFUN names, for automake 1.8.
+
+------------------------------------------------------------------------
+r2571 | pelissip | 2003-12-10 13:40:52 +0000 (Wed, 10 Dec 2003) | 3 lines
+Changed paths:
+ M /trunk/powerof2.c
+ M /trunk/sub1sp.c
+ M /trunk/tests/tsub1sp.c
+
++ Add a new test in case of underflow.
++ Fix bug in case of underflow for sub1 / sub1sp (mpfr_powerof2 could be called with inalid numbers).
+
+------------------------------------------------------------------------
+r2570 | pelissip | 2003-12-09 14:58:26 +0000 (Tue, 09 Dec 2003) | 3 lines
+Changed paths:
+ M /trunk/print_raw.c
+ M /trunk/sub1sp.c
+
++ Fixed bugs of mpfr_print_mant_binary on 64 bits CPU (1L instead of 1).
++ Fixed bugs of mpfr_sub1sp on 64-bits CPU (mp_limb_t instead of int).
+
+------------------------------------------------------------------------
+r2569 | pelissip | 2003-12-09 13:52:50 +0000 (Tue, 09 Dec 2003) | 8 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/add.c
+ M /trunk/clear.c
+ M /trunk/init2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/print_raw.c
+ M /trunk/round_prec.c
+ M /trunk/set_prec.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ A /trunk/sub1sp.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ A /trunk/tests/tsub1sp.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_pow.c
+
++ Add function mpfr_print_mantissa_binary, for debugging reason.
++ Rename MPFR_ALLOC_SIZE in MPFR_MALLOC_SIZE.
++ Add conditionnal -DSMALL directive in mpfr-impl.h.
++ Add new function: sub1sp.
+ Substraction in case of all the ops have the same prec.
++ Add its test (tsub1sp).
++ Modify a few the tests to avoid comparing mpfr results with double, for portability reason.
+
+------------------------------------------------------------------------
+r2568 | vlefevre | 2003-12-05 17:47:09 +0000 (Fri, 05 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/exp10.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Added mpfr_exp10 function.
+
+------------------------------------------------------------------------
+r2567 | pelissip | 2003-12-01 10:25:01 +0000 (Mon, 01 Dec 2003) | 3 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/get_d.c
+ M /trunk/mpfr-impl.h
+ M /trunk/neg.c
+ M /trunk/powerof2.c
+ M /trunk/set_d.c
+ M /trunk/set_ld.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+
+Port all the IEEE dependent remaining functions so that it uses a generic way to compute the result if it detects that the double is not in IEEE format ( _GMP_IEEE_FLOATS == 0).
+MPFR now should work well on non-IEEE machines.
+
+------------------------------------------------------------------------
+r2566 | zimmerma | 2003-12-01 10:20:37 +0000 (Mon, 01 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion for 2 new functions
+
+------------------------------------------------------------------------
+r2565 | zimmerma | 2003-12-01 09:17:41 +0000 (Mon, 01 Dec 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added entry (portability)
+
+------------------------------------------------------------------------
+r2564 | pelissip | 2003-11-25 17:22:31 +0000 (Tue, 25 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/cmp.c
+ M /trunk/mpfr-impl.h
+ M /trunk/sub1.c
+
+Optmize a few add1.c/sub1.c by using MPFR_LIKELY / MPFR_UNLIKELY.
+
+------------------------------------------------------------------------
+r2563 | pelissip | 2003-11-21 16:26:19 +0000 (Fri, 21 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/eq.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/factorial.c
+ M /trunk/fits_s.h
+ M /trunk/fits_u.h
+ M /trunk/gamma.c
+ M /trunk/inp_str.c
+ M /trunk/isinteger.c
+ M /trunk/mul.c
+ M /trunk/pow.c
+ M /trunk/pow_ui.c
+ M /trunk/round_prec.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/sub1.c
+ M /trunk/zeta.c
+
+Remove some warnings and potential errors (Comparaison between signed and unsigned).
+
+------------------------------------------------------------------------
+r2562 | pelissip | 2003-11-21 15:27:35 +0000 (Fri, 21 Nov 2003) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/check.c
+ M /trunk/clear.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tcbrt.c
+ A /trunk/tests/tcheck.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_pow.c
+
++ Add new internal function: mpfr_check.
++ Add the corresponding test file.
++ Translate mpfr_set_d to mpfr_set_str / mpfr_set_ui in the tests for portability reasons.
+
+------------------------------------------------------------------------
+r2558 | zimmerma | 2003-11-21 10:16:17 +0000 (Fri, 21 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+use integers instead of double's
+
+------------------------------------------------------------------------
+r2557 | vlefevre | 2003-11-21 08:05:29 +0000 (Fri, 21 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/TODO
+
+Notes about not using mpfr_set_d in the tests.
+
+------------------------------------------------------------------------
+r2554 | pelissip | 2003-11-19 10:01:34 +0000 (Wed, 19 Nov 2003) | 4 lines
+Changed paths:
+ M /trunk/mul.c
+ M /trunk/pow.c
+ M /trunk/set_ui.c
+
+ Optimization of mpfr_mul.
+ Tiny optimization of mpfr_pow (The case y=0 has been put inside the MPFR_ARE_SINGULAR block).
+ Tiny optimisation of mpfr_set_ui.
+
+------------------------------------------------------------------------
+r2553 | zimmerma | 2003-11-18 16:07:12 +0000 (Tue, 18 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+fixed bug in case exact result
+
+------------------------------------------------------------------------
+r2552 | zimmerma | 2003-11-18 16:05:36 +0000 (Tue, 18 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+added new tests
+
+------------------------------------------------------------------------
+r2551 | pelissip | 2003-11-18 11:46:34 +0000 (Tue, 18 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/round_raw_generic.c
+
+ Optimize round_raw_generic by reducing the number of redundant tests.
+
+------------------------------------------------------------------------
+r2550 | pelissip | 2003-11-17 14:43:54 +0000 (Mon, 17 Nov 2003) | 9 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/exceptions.c
+ M /trunk/get_d.c
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/round_prec.c
+ A /trunk/round_raw_generic.c
+ M /trunk/set_str.c
+ M /trunk/sub1.c
+ M /trunk/tests/Makefile.am
+
+* Optimize a few div.c and mul.c.
+* Reorder the tests.
+* Remove mpfr_round_raw_generic and create 4 new functions which replace it, for efficiency reasons.
+* Add round_raw_generic.c which is the generic file to create the 4 new functions.
+* Add new MACRO: MPFR_RNDUTEST_OR_RNDDNOTTEST which is a faster way to check if (rnd_mode==GMP_RNDU && test) || (rnd_mode==GMP_RNDD && !test).
+* Add new MACRO: MPFR_UNSIGNED_MINUS_MODULO.
+* Optimize mpfr_can_round_raw.
+* Some new defines in mpfr.h to increase compatibility with MPFR v2.0.1 and above.
+
+------------------------------------------------------------------------
+r2548 | zimmerma | 2003-11-14 12:47:01 +0000 (Fri, 14 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/tests/tpow.c
+
+fixed bug in pow_si (exact result, case z = x)
+
+------------------------------------------------------------------------
+r2546 | zimmerma | 2003-11-14 10:44:53 +0000 (Fri, 14 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+added test to check bug fix (bug was in mpfr_pow)
+
+------------------------------------------------------------------------
+r2545 | zimmerma | 2003-11-14 10:43:40 +0000 (Fri, 14 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+added new test to check for bug fix (output precision > input precisions)
+
+------------------------------------------------------------------------
+r2544 | zimmerma | 2003-11-14 10:42:30 +0000 (Fri, 14 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+just improved editing style
+
+------------------------------------------------------------------------
+r2543 | zimmerma | 2003-11-14 10:41:35 +0000 (Fri, 14 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+fixed bug for output precision > max(input precisions)
+
+------------------------------------------------------------------------
+r2542 | vlefevre | 2003-11-14 10:40:26 +0000 (Fri, 14 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Ported the gcc-3.3 bug detection patch to the trunk.
+
+------------------------------------------------------------------------
+r2539 | pelissip | 2003-11-07 16:15:45 +0000 (Fri, 07 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+
+Fix a stupid bug (diff_exp is not equal to the difference of prec)
+
+------------------------------------------------------------------------
+r2538 | vlefevre | 2003-11-07 13:25:18 +0000 (Fri, 07 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+
+Initialize the exp field.
+
+------------------------------------------------------------------------
+r2537 | pelissip | 2003-11-07 10:08:57 +0000 (Fri, 07 Nov 2003) | 4 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/copysign.c
+ M /trunk/div.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/exceptions.c
+ M /trunk/extract.c
+ M /trunk/get_d.c
+ M /trunk/get_exp.c
+ M /trunk/get_str.c
+ M /trunk/init2.c
+ M /trunk/isinteger.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/set_prec.c
+ M /trunk/set_str_raw.c
+ M /trunk/sub1.c
+ M /trunk/swap.c
+
+Some minor optimizations.
+Optimization of mul.c / sub1.c.
+Some clean up in the header files.
+
+------------------------------------------------------------------------
+r2536 | pelissip | 2003-11-05 16:18:16 +0000 (Wed, 05 Nov 2003) | 3 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add_one_ulp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/cmp.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_ui.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/erf.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/get_z_exp.c
+ M /trunk/hypot.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/rint.c
+ M /trunk/set.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/zeta.c
+
+Fix some bugs (Use MPFR_ASSERT(1) instead of MPFR_ASSERT(0))
+Optimize swap.c and copysign.c.
+
+------------------------------------------------------------------------
+r2535 | pelissip | 2003-11-05 12:11:47 +0000 (Wed, 05 Nov 2003) | 4 lines
+Changed paths:
+ M /trunk/cmp2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/sub1.c
+
+Optimize mpfr_prec_round.
+Optimize mpfr_set (Case of both src & dest have the same precision).
+Start optimizing mpfr_sub1.
+
+------------------------------------------------------------------------
+r2534 | pelissip | 2003-11-05 09:00:03 +0000 (Wed, 05 Nov 2003) | 7 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/cmp_ui.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/set.c
+ M /trunk/set_ui.c
+ A /trunk/sgn.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tsgn.c
+
+Add a real function for mpfr_sgn (not a call to mpfr_cmp_ui_2exp).
+Add a test for mpfr_sgn.
+Change the proto of mpfr_add1 and mpfr_sub1 by removing the last arg.
+Simplify the logic of the sign in mpfr_sub1.
+Tiny speed up for cmp/set/sqrt.
+mpfr-impl auto include all the needed local header files (gmp, gmp-impl, mpfr).
+
+------------------------------------------------------------------------
+r2533 | vlefevre | 2003-11-04 16:14:47 +0000 (Tue, 04 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/pow_ui.c
+
+Merged the mpfr-2-0-2-branch pow_ui.c changes to the trunk.
+
+------------------------------------------------------------------------
+r2530 | vlefevre | 2003-11-04 13:51:03 +0000 (Tue, 04 Nov 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+
+The check_inf test wasn't called. Added 2 missing mpfr_clear and \n.
+
+------------------------------------------------------------------------
+r2529 | pelissip | 2003-11-04 13:15:26 +0000 (Tue, 04 Nov 2003) | 10 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cputime.h
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/erf.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/get_str.c
+ M /trunk/hypot.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/minmax.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set_inf.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/sin_cos.c
+ M /trunk/sub.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/zeta.c
+
++ Remove MPFR_CLEAR_NAN and MPFR_CLEAR_INF. Only use MPFR_CLEAR_FLAGS.
+ MPFR_SET_INF, MPFR_SET_ZERO and MPFR_SET_ZERO must clear the flags before setting them.
++ Add a new test in tacosh.c : check Inf / Nan flags.
++ Use MPFR_IS_SINGULAR in all the remaining files.
++ Fix the use of MPFR_CLEAR_FLAGS.
++ mpfr-impl.h auto include gmp.h, gmp-impl.h, mpfr.h and limits.h.
++ Rename _PROTO to _MPFR_PROTO, and remove _GMP_PROTO.
++ Add MPFR_INT_SIGN macro.
++ Encapsulate a few more the sign.
+
+------------------------------------------------------------------------
+r2526 | vlefevre | 2003-10-30 00:03:26 +0000 (Thu, 30 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/log1p.c
+
+MPFR_RET_NAN -> MPFR_RET(0).
+
+------------------------------------------------------------------------
+r2525 | pelissip | 2003-10-28 16:31:13 +0000 (Tue, 28 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/div.c
+ M /trunk/eq.c
+ M /trunk/erf.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/fma.c
+ M /trunk/frac.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/hypot.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/minmax.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/next.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/tpow.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/zeta.c
+
+Use of MPFR_UNLIKELY and MPFR_IS_SINGULAR for fast detection of special values (Nan, Inf or Zero).
+Start to encapsulate the sign to be independant of the reprensation (Must be 1 or -1).
+
+------------------------------------------------------------------------
+r2524 | pelissip | 2003-10-27 15:15:04 +0000 (Mon, 27 Oct 2003) | 8 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/div.c
+ M /trunk/exceptions.c
+ M /trunk/extract.c
+ M /trunk/get_d.c
+ M /trunk/get_si.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/init2.c
+ M /trunk/log.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+
+Change the internal format of MPFR: ZERO, INF and NAN have special values of exp.
+Rename MPFR_ESIZE in MPFR_LIMB_SIZE.
+Rename MPFR_ABSZISE in MPFR_ALLOC_SIZE.
+Rename MPFR_INIT in MPFR_TMP_INIT (INIT1 too).
+"mpfr.h" includes <gmp.h> if GMP isn't detected.
+Change the way of detecting stdio.h (To check).
+Use mpfr namespace for new definitions in "mpfr.h".
+
+------------------------------------------------------------------------
+r2522 | vlefevre | 2003-10-27 13:06:22 +0000 (Mon, 27 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+Another fix, for acosh(-INF).
+
+------------------------------------------------------------------------
+r2521 | vlefevre | 2003-10-27 12:57:27 +0000 (Mon, 27 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+Fixed exit status.
+
+------------------------------------------------------------------------
+r2519 | vlefevre | 2003-10-21 12:33:17 +0000 (Tue, 21 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/mpfr.h
+ M /trunk/tests/trint.c
+
+Merged the mpfr-2-0-2-branch changes to the trunk.
+
+------------------------------------------------------------------------
+r2514 | vlefevre | 2003-10-20 15:47:10 +0000 (Mon, 20 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/gmp_op.c
+ M /trunk/mpfr.texi
+ M /trunk/rint.c
+ M /trunk/tests/trint.c
+
+Merged the mpfr-2-0-2-branch changes to the trunk.
+
+------------------------------------------------------------------------
+r2511 | vlefevre | 2003-10-17 13:34:46 +0000 (Fri, 17 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/erf.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/trint.c
+
+Merged the mpfr-2-0-2-branch changes to the trunk.
+
+------------------------------------------------------------------------
+r2505 | vlefevre | 2003-10-16 12:48:40 +0000 (Thu, 16 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Update.
+
+------------------------------------------------------------------------
+r2504 | vlefevre | 2003-10-16 11:54:20 +0000 (Thu, 16 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/VERSION
+
+Updated version on trunk.
+
+------------------------------------------------------------------------
+r2503 | vlefevre | 2003-10-16 11:48:31 +0000 (Thu, 16 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2502 | vlefevre | 2003-10-16 09:55:46 +0000 (Thu, 16 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+ M /trunk/set_d.c
+
+Fixed several bugs.
+
+------------------------------------------------------------------------
+r2501 | vlefevre | 2003-10-16 09:32:26 +0000 (Thu, 16 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Added XDEBUG support (like in set_d.c).
+
+------------------------------------------------------------------------
+r2500 | vlefevre | 2003-10-15 09:46:52 +0000 (Wed, 15 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Replaced all non-ASCII characters by an equivalent 7-bit sequence
+to support unpatched texinfo.tex files.
+
+------------------------------------------------------------------------
+r2499 | zimmerma | 2003-10-15 09:32:21 +0000 (Wed, 15 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+removed #define DEBUG (turned on accidentally)
+
+------------------------------------------------------------------------
+r2498 | vlefevre | 2003-10-15 09:15:19 +0000 (Wed, 15 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Bug on the ternary value was fixed by Paul Zimmermann on 2003-10-14.
+
+------------------------------------------------------------------------
+r2497 | zimmerma | 2003-10-14 12:29:45 +0000 (Tue, 14 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added preamble about ternary flag for special functions
+
+------------------------------------------------------------------------
+r2496 | zimmerma | 2003-10-14 12:13:37 +0000 (Tue, 14 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tzeta.c
+
+now uses #include "tgeneric.c" everywhere
+(and modified test_generic to check also the inexact flag)
+
+------------------------------------------------------------------------
+r2495 | zimmerma | 2003-10-14 12:12:10 +0000 (Tue, 14 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_div.c
+
+check_nan() is back
+
+------------------------------------------------------------------------
+r2494 | zimmerma | 2003-10-14 12:08:37 +0000 (Tue, 14 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+removed old unused code
+
+------------------------------------------------------------------------
+r2493 | zimmerma | 2003-10-14 12:05:25 +0000 (Tue, 14 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+fixed tests for x=0
+removed composition tests (were already in-between #if 0 ... #endif)
+
+------------------------------------------------------------------------
+r2492 | zimmerma | 2003-10-14 11:49:06 +0000 (Tue, 14 Oct 2003) | 4 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/erf.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/gamma.c
+ M /trunk/hypot.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/zeta.c
+
+replaced mpfr_can_round (approx, err, rnd1, GMP_RNDN, prec)
+by mpfr_can_round (approx, err, rnd1, GMP_RNDZ, prec + 1)
+which in addition guarantees a correct inexact flag
+
+------------------------------------------------------------------------
+r2491 | zimmerma | 2003-10-14 11:42:51 +0000 (Tue, 14 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new items (version number, rounding modes)
+
+------------------------------------------------------------------------
+r2490 | zimmerma | 2003-10-14 11:42:00 +0000 (Tue, 14 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+added comment about --enable-alloca=debug
+
+------------------------------------------------------------------------
+r2489 | zimmerma | 2003-10-13 13:12:46 +0000 (Mon, 13 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+added section "Problems due to compiler bugs"
+
+------------------------------------------------------------------------
+r2488 | zimmerma | 2003-10-13 08:03:14 +0000 (Mon, 13 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+
+change in can_round calls to get correct inexact flag for rounding to nearest
+
+------------------------------------------------------------------------
+r2487 | zimmerma | 2003-10-10 09:05:15 +0000 (Fri, 10 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+fixed bug in mpfr_pow found by Ming J. Tsai (overflow)
+
+------------------------------------------------------------------------
+r2486 | vlefevre | 2003-10-08 15:43:13 +0000 (Wed, 08 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/asin.c
+ M /trunk/atan.c
+
+Removed useless inclusion of standard headers and some #ifdef DEBUG
+code. Partial reindentation.
+
+------------------------------------------------------------------------
+r2485 | vlefevre | 2003-10-08 15:22:05 +0000 (Wed, 08 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/strncasecmp.c
+
+Added a #include <stddef.h> because size_t is used.
+
+------------------------------------------------------------------------
+r2484 | zimmerma | 2003-10-07 08:37:28 +0000 (Tue, 07 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tzeta.c
+
+reduced test time
+
+------------------------------------------------------------------------
+r2483 | zimmerma | 2003-10-07 07:41:55 +0000 (Tue, 07 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+reduced test time
+
+------------------------------------------------------------------------
+r2482 | zimmerma | 2003-10-07 07:36:12 +0000 (Tue, 07 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+reduced test time
+
+------------------------------------------------------------------------
+r2481 | zimmerma | 2003-10-06 16:11:15 +0000 (Mon, 06 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+fixed comment of mpfr_round_raw_generic
+
+------------------------------------------------------------------------
+r2480 | zimmerma | 2003-10-06 15:53:46 +0000 (Mon, 06 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/extract.c
+ M /trunk/get_si.c
+ M /trunk/get_ui.c
+
+replaced ABSSIZE by ESIZE (ABSSIZE is the allocated size, and should be
+used only in functions init, set_prec, round_prec)
+
+------------------------------------------------------------------------
+r2479 | zimmerma | 2003-10-06 15:52:25 +0000 (Mon, 06 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+fixed bug in allocation for in-place operation
+
+------------------------------------------------------------------------
+r2478 | zimmerma | 2003-10-06 14:44:18 +0000 (Mon, 06 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/atan.c
+
+inexact flag should now be correct for directed rounding
+fixed a bug for mpfr_atan(-Inf) [gave +Pi/2 instead of -Pi/2]
+
+------------------------------------------------------------------------
+r2477 | zimmerma | 2003-10-06 14:43:00 +0000 (Mon, 06 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+added test for atan(-Inf)
+
+------------------------------------------------------------------------
+r2476 | zimmerma | 2003-10-06 13:32:02 +0000 (Mon, 06 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+use macros to avoid possible problem with float input
+
+------------------------------------------------------------------------
+r2475 | zimmerma | 2003-10-06 13:31:20 +0000 (Mon, 06 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+new proposal for mpfr_can_round
+
+------------------------------------------------------------------------
+r2474 | zimmerma | 2003-10-06 08:35:42 +0000 (Mon, 06 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr_mul_2exp/mpfr_div_2exp are not obsolete
+
+------------------------------------------------------------------------
+r2473 | vlefevre | 2003-10-05 23:11:12 +0000 (Sun, 05 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Clearer mpfr_eq documentation (thanks to Kevin Ryde for the remark).
+
+------------------------------------------------------------------------
+r2472 | vlefevre | 2003-10-03 13:00:41 +0000 (Fri, 03 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+MPFR_ASSERTN rewritten to avoid "statement with no effect" warnings
+with gcc when the assertion is always true.
+
+------------------------------------------------------------------------
+r2471 | vlefevre | 2003-10-03 12:49:59 +0000 (Fri, 03 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/add1.c
+
+Optimization (thanks to Patrick Pelissier), as the allocated size
+may be larger than the size used by the significant bits.
+
+------------------------------------------------------------------------
+r2470 | vlefevre | 2003-10-03 12:30:14 +0000 (Fri, 03 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/mpfr.texi
+
+Updated installation notes.
+
+------------------------------------------------------------------------
+r2469 | vlefevre | 2003-10-03 08:01:45 +0000 (Fri, 03 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/cmp_abs.c
+ M /trunk/mpfr.texi
+
+Infinities are now accepted in mpfr_cmpabs. Updated its definition
+in the source (no longer sign(abs(b) - abs(c))).
+
+------------------------------------------------------------------------
+r2468 | vlefevre | 2003-10-02 22:30:16 +0000 (Thu, 02 Oct 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Use @url{} for URLs.
+
+------------------------------------------------------------------------
+r2467 | vlefevre | 2003-10-02 21:57:39 +0000 (Thu, 02 Oct 2003) | 6 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+As suggested by PZ:
+ o documentation of mpfr_fits_* functions moved to the section
+ on conversions;
+ o grouped some mpfr_pow special cases;
+ o explanation concerning the meaning of rnd in mpfr_frac.
+
+------------------------------------------------------------------------
+r2466 | vlefevre | 2003-10-02 17:17:59 +0000 (Thu, 02 Oct 2003) | 8 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/print_raw.c
+ M /trunk/set_str_raw.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+Updated documentation. In particular, mpfr_set_str_raw renamed
+as mpfr_set_str_binary. This function and mpfr_print_binary are
+now internal functions. mpfr_print_binary no longer prints the
+non-significant 0 bits. Updated the source to match the manual.
+mpfr_print_binary has been completely rewritten (now directly
+prints to stdout, without using an intermediate string). In
+mpfr_set_str_binary, replaced atol by strtol + error checking.
+
+------------------------------------------------------------------------
+r2465 | zimmerma | 2003-10-02 14:14:08 +0000 (Thu, 02 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added paragraph on support/grants
+added help for mpfr_erf
+
+------------------------------------------------------------------------
+r2464 | vlefevre | 2003-10-02 14:05:59 +0000 (Thu, 02 Oct 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Make node titles match section titles, and updated menus and xrefs.
+Added a line break after @samp{uninstall}.
+
+------------------------------------------------------------------------
+r2463 | vlefevre | 2003-10-01 15:06:25 +0000 (Wed, 01 Oct 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/zeta.c
+
+Corrections in the MPFR manual (PZ & VL). Functions mpfr_const_pi,
+mpfr_const_log2 and mpfr_zeta now return a ternary value. Updated
+TODO file.
+
+------------------------------------------------------------------------
+r2462 | vlefevre | 2003-09-30 16:50:58 +0000 (Tue, 30 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Added a bug related to the ternary value and worst cases.
+
+------------------------------------------------------------------------
+r2461 | vlefevre | 2003-09-30 16:29:01 +0000 (Tue, 30 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+
+Added exponent range support.
+
+------------------------------------------------------------------------
+r2460 | vlefevre | 2003-09-30 10:34:39 +0000 (Tue, 30 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Corrections up to Section 5.6 (PZ & VL).
+
+------------------------------------------------------------------------
+r2459 | vlefevre | 2003-09-30 10:12:24 +0000 (Tue, 30 Sep 2003) | 7 lines
+Changed paths:
+ M /trunk/get_z_exp.c
+
+Re-added the assert on the exponent, but replacing MPFR_EMIN_MIN by
+MP_EXP_T_MIN (this makes more sense): an assertion failed would mean
+that the exponent is not representable (an undefined behavior in the
+ISO C standard). If need be, we could choose to return MP_EXP_T_MIN
+in such a case, or perhaps MP_EXP_T_MAX to signal an error. The
+mantissa would still be meaningful.
+
+------------------------------------------------------------------------
+r2458 | pelissip | 2003-09-30 07:47:49 +0000 (Tue, 30 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update TODO & mpfr_set_prec.
+
+------------------------------------------------------------------------
+r2457 | vlefevre | 2003-09-29 14:40:11 +0000 (Mon, 29 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Corrections up to Section 4.
+
+------------------------------------------------------------------------
+r2456 | vlefevre | 2003-09-29 08:00:19 +0000 (Mon, 29 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+Added authors Kevin Ryde and Patrick Pelissier.
+
+------------------------------------------------------------------------
+r2455 | vlefevre | 2003-09-29 07:48:10 +0000 (Mon, 29 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Removed "known problems" that are no longer problems.
+
+------------------------------------------------------------------------
+r2454 | vlefevre | 2003-09-26 12:39:37 +0000 (Fri, 26 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+
+Removed bugs related to the tests and to the exponents
+as they no longer occur. Updated some potentials bugs.
+
+------------------------------------------------------------------------
+r2453 | vlefevre | 2003-09-25 16:50:34 +0000 (Thu, 25 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tinits.c
+
+Removed mpfr_inits, mpfr_inits2, mpfr_clears from the documentation.
+Moved their prototypes to mpfr-impl.h (internal functions until
+decided otherwise).
+
+------------------------------------------------------------------------
+r2452 | pelissip | 2003-09-25 12:03:36 +0000 (Thu, 25 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/generic.c
+
+Modify 'r' arg of GENERIC from int to long (min 32 bits).
+
+------------------------------------------------------------------------
+r2451 | vlefevre | 2003-09-25 10:31:23 +0000 (Thu, 25 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+8-bit ISO-8859-1 characters + consistent spelling.
+
+------------------------------------------------------------------------
+r2450 | vlefevre | 2003-09-25 10:17:00 +0000 (Thu, 25 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2449 | vlefevre | 2003-09-25 08:15:42 +0000 (Thu, 25 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/mpf_compat.h
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_d.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tfrac.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+
+Changed the remaining stderr to stdout.
+
+------------------------------------------------------------------------
+r2448 | vlefevre | 2003-09-24 22:32:40 +0000 (Wed, 24 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+Changed some stderr to stdout.
+
+------------------------------------------------------------------------
+r2447 | vlefevre | 2003-09-24 21:05:42 +0000 (Wed, 24 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/comparisons.c
+ M /trunk/mpfr.texi
+
+Added documentation for mpfr_greater_p, mpfr_greaterequal_p,
+mpfr_less_p, mpfr_lessequal_p, mpfr_lessgreater_p, mpfr_equal_p
+and mpfr_unordered_p.
+
+------------------------------------------------------------------------
+r2446 | vlefevre | 2003-09-24 20:26:48 +0000 (Wed, 24 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tcomparisons.c
+
+Added tests for mpfr_greater_p, mpfr_greaterequal_p, mpfr_less_p,
+mpfr_lessequal_p, mpfr_lessgreater_p, mpfr_equal_p, mpfr_unordered_p.
+
+------------------------------------------------------------------------
+r2445 | vlefevre | 2003-09-24 16:31:11 +0000 (Wed, 24 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/tests/tnext.c
+
+Added a few more tests (involving mpfr_nexttoward). The tests for
+the mpfr_nextabove, mpfr_nextbelow and mpfr_nexttoward functions
+should now be sufficient.
+
+------------------------------------------------------------------------
+r2444 | vlefevre | 2003-09-24 13:19:30 +0000 (Wed, 24 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/next.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tnext.c
+
+Added generic tests for mpfr_nextabove and mpfr_nextbelow.
+Fixed a bug in next.c related to assertion checks.
+
+------------------------------------------------------------------------
+r2443 | vlefevre | 2003-09-24 12:02:45 +0000 (Wed, 24 Sep 2003) | 5 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/set_str.c
+ M /trunk/tests/tset_str.c
+
+Accept (case-insensitive) NaN and Inf in input for bases <= 16 for
+backward compatibility in these bases (for bases > 16, we cannot
+guaranty backward compatibility with the current wanted behavior).
+Added tests.
+
+------------------------------------------------------------------------
+r2442 | zimmerma | 2003-09-24 10:33:20 +0000 (Wed, 24 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item from Kevin
+
+------------------------------------------------------------------------
+r2441 | vlefevre | 2003-09-24 09:26:34 +0000 (Wed, 24 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/texinfo.tex
+
+Added support for some top-bit-set characters in the .texi source.
+
+------------------------------------------------------------------------
+r2440 | vlefevre | 2003-09-24 08:40:04 +0000 (Wed, 24 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added information on special values for mpfr_pow.
+
+------------------------------------------------------------------------
+r2439 | zimmerma | 2003-09-24 08:35:06 +0000 (Wed, 24 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added MAKEINFOFLAGS = --enable-encoding to get 8-bit characters in mpfr.info
+
+------------------------------------------------------------------------
+r2438 | zimmerma | 2003-09-24 08:05:50 +0000 (Wed, 24 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/mpfr.texi
+
+used ISO-8859-1 in AUTHORS
+and @`e, @"o in mpfr.texi (waiting for code for ISO-8859-1 compatibility)
+
+------------------------------------------------------------------------
+r2437 | ryde | 2003-09-24 00:40:24 +0000 (Wed, 24 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_C_LONG_DOUBLE_FORMAT): Remove conftest* temporary
+files.
+
+------------------------------------------------------------------------
+r2436 | vlefevre | 2003-09-24 00:36:19 +0000 (Wed, 24 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Fixed comparisons (cases @NaN@ and @Inf@).
+
+------------------------------------------------------------------------
+r2435 | zimmerma | 2003-09-23 09:19:22 +0000 (Tue, 23 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+two updates
+
+------------------------------------------------------------------------
+r2434 | vlefevre | 2003-09-22 15:03:30 +0000 (Mon, 22 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Updated mpfr_pow description.
+
+------------------------------------------------------------------------
+r2433 | zimmerma | 2003-09-22 13:50:46 +0000 (Mon, 22 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/print_rnd_mode.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+
+changed __gmp_const into const in *.c
+[Torbjo"rn: Please use __gmp_const just in user header files, plain C const in other files.]
+
+------------------------------------------------------------------------
+r2432 | vlefevre | 2003-09-22 13:30:46 +0000 (Mon, 22 Sep 2003) | 6 lines
+Changed paths:
+ M /trunk/TODO
+
+Removed
+
+- allow the ISO C "P" exponent separator for base 16 in input functions
+
+(already done).
+
+------------------------------------------------------------------------
+r2431 | vlefevre | 2003-09-22 13:09:16 +0000 (Mon, 22 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/tests/tset_ld.c
+
+Implemented the following:
+- use (LDBL_MAX/2)+(LDBL_MAX/4*LDBL_EPSILON) instead of loop in tset_ld
+ to get largest power of 2 that fits in a long double
+
+------------------------------------------------------------------------
+r2430 | vlefevre | 2003-09-22 11:23:09 +0000 (Mon, 22 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/sub1.c
+
+Added some MPFR_ASSERTN and improved a comment.
+
+------------------------------------------------------------------------
+r2429 | vlefevre | 2003-09-22 07:56:47 +0000 (Mon, 22 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+
+Avoid string literals longer than 509 characters (ISO C89 limit).
+
+------------------------------------------------------------------------
+r2428 | vlefevre | 2003-09-22 07:53:16 +0000 (Mon, 22 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+(test_set_underflow, test_set_overflow): Cleaner fix (for pre-C99
+compilers).
+
+------------------------------------------------------------------------
+r2427 | ryde | 2003-09-22 01:45:07 +0000 (Mon, 22 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/texceptions.c
+
+(test_set_underflow, test_set_overflow): Use
+"static" on "r" to allow non-constant initializers.
+
+------------------------------------------------------------------------
+r2426 | ryde | 2003-09-21 00:37:17 +0000 (Sun, 21 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Converting Floats): In mpfr_get_d_2exp, the rounding mode
+is given, it doesn't use the default mode.
+
+------------------------------------------------------------------------
+r2425 | ryde | 2003-09-21 00:14:49 +0000 (Sun, 21 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Assigning Floats): In mpfr_set_str and mpfr_set_str_raw,
+show "const" not "__gmp_const".
+(Simultaneous Float Init & Assign): In mpfr_init_set_str, ditto.
+
+------------------------------------------------------------------------
+r2424 | ryde | 2003-09-21 00:07:26 +0000 (Sun, 21 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Rounding Modes): Add blank line around @itemize.
+
+------------------------------------------------------------------------
+r2423 | ryde | 2003-09-21 00:06:03 +0000 (Sun, 21 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Miscellaneous Float Functions): In mpfr_urandomb and
+mpfr_random, use @math and @le.
+
+------------------------------------------------------------------------
+r2422 | ryde | 2003-09-20 23:51:49 +0000 (Sat, 20 Sep 2003) | 6 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Assigning Floats): In mpfr_set_*, remove remarks about
+long being rounded (this should be clear already), about rounding of
+decimal double constants like 0.1 (too basic to appear here),
+(Converting Floats): In mpfr_get_d_2exp, remove remark about exp
+exceeding IEEE exponent range (should be clear already).
+
+------------------------------------------------------------------------
+r2421 | zimmerma | 2003-09-19 14:25:15 +0000 (Fri, 19 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated items: removed conversion from/to float (obsolete)
+
+------------------------------------------------------------------------
+r2420 | zimmerma | 2003-09-19 14:09:51 +0000 (Fri, 19 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/zeta.c
+
+got rid of <math.h> dependency in mpfr_zeta
+
+------------------------------------------------------------------------
+r2419 | zimmerma | 2003-09-19 13:41:10 +0000 (Fri, 19 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/exp_2.c
+ M /trunk/get_str.c
+ M /trunk/log_b2.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/round_prec.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tzeta.c
+
+mpfr_round_prec is now obsolete
+new function mpfr_prec_round replaces it
+
+------------------------------------------------------------------------
+r2418 | vlefevre | 2003-09-18 10:33:57 +0000 (Thu, 18 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Fix for C implementations with 16-bit int.
+
+------------------------------------------------------------------------
+r2417 | pelissip | 2003-09-18 08:37:38 +0000 (Thu, 18 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+ Optimization of macros MPFR_IS_INF, MPFR_IS_NAN and MPFR_IS_FP
+
+------------------------------------------------------------------------
+r2416 | vlefevre | 2003-09-18 06:50:14 +0000 (Thu, 18 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Removed a comment that should have been removed in revision 1.8.
+
+------------------------------------------------------------------------
+r2415 | zimmerma | 2003-09-15 15:55:00 +0000 (Mon, 15 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+No longer perform the pre-check for exactness when first division step was
+actually a complete division. This introduced way too much overhead.
+
+------------------------------------------------------------------------
+r2414 | zimmerma | 2003-09-15 15:30:31 +0000 (Mon, 15 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/inp_str.c
+
+replaced test stream==0 by stream==NULL
+
+------------------------------------------------------------------------
+r2413 | vlefevre | 2003-09-15 13:55:30 +0000 (Mon, 15 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/round_prec.c
+ M /trunk/tests/tcan_round.c
+
+Fixed a bug in mpfr_can_round_raw and added other mpfr_can_round
+tests.
+
+------------------------------------------------------------------------
+r2412 | vlefevre | 2003-09-15 13:05:05 +0000 (Mon, 15 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/round_prec.c
+ M /trunk/tests/tcan_round.c
+
+Added a test to tests/tcan_round.c and assertions to round_prec.c.
+
+------------------------------------------------------------------------
+r2411 | vlefevre | 2003-09-14 08:52:44 +0000 (Sun, 14 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/tests/texceptions.c
+
+Fixed mpfr_set_overflow, added tests for mpfr_set_underflow
+and mpfr_set_overflow, and reverted exp.c.
+
+------------------------------------------------------------------------
+r2410 | zimmerma | 2003-09-13 08:46:47 +0000 (Sat, 13 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+overflow with round to zero was incorrect
+
+------------------------------------------------------------------------
+r2409 | vlefevre | 2003-09-11 16:49:11 +0000 (Thu, 11 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/clears.c
+ A /trunk/inits.c
+ A /trunk/inits2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tinits.c
+
+New functions mpfr_inits, mpfr_inits2 and mpfr_clears to initialize or
+free several floating-point numbers (written by Patrick Pélissier).
+
+------------------------------------------------------------------------
+r2408 | vlefevre | 2003-09-09 16:09:42 +0000 (Tue, 09 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/zeta.c
+
+Replaced malloc/free by __gmp_allocate_func/__gmp_free_func in
+mpfr_zeta_pos. zeta.c still uses math (libm) functions -> TODO:
+remove this dependence.
+
+------------------------------------------------------------------------
+r2407 | vlefevre | 2003-09-09 15:13:38 +0000 (Tue, 09 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+Added a test that makes MPFR crash (coming from the mpfr_zeta crash).
+
+------------------------------------------------------------------------
+r2406 | vlefevre | 2003-09-09 14:28:47 +0000 (Tue, 09 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+Case that crashes MPFR (coming from test_generic) -> function test1.
+
+------------------------------------------------------------------------
+r2405 | vlefevre | 2003-09-09 11:33:45 +0000 (Tue, 09 Sep 2003) | 6 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+Ended up by simplifying mpfr_ui_pow to fix it completely (with a
+call to mpfr_pow, in a way similar to other ui functions). There
+isn't significant differences with the old code anyway, and the
+case integer^integer wasn't optimized like in mpfr_pow.
+The test tui_pow now passes, but the test tzeta now fails!
+
+------------------------------------------------------------------------
+r2404 | vlefevre | 2003-09-09 10:39:01 +0000 (Tue, 09 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+ M /trunk/ui_pow.c
+
+Code clean-up and reindented. Replaced a 8 by CHAR_BIT,
+as CHAR_BIT isn't necessarily equal to 8. The bug seems
+to occur on all machines.
+
+------------------------------------------------------------------------
+r2403 | vlefevre | 2003-09-08 16:22:08 +0000 (Mon, 08 Sep 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+Added a test to reproduce a bug (to be fixed later) on all 64-bit
+machines.
+
+------------------------------------------------------------------------
+r2402 | vlefevre | 2003-09-08 15:50:30 +0000 (Mon, 08 Sep 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+Added a cast (useful under Linux/alpha).
+
+------------------------------------------------------------------------
+r2401 | vlefevre | 2003-09-01 15:20:39 +0000 (Mon, 01 Sep 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/print_rnd_mode.c
+
+Changes (Patrick Pelissier's suggestions):
+ _ mpfr_print_rnd_mode now has __gmp_const char * return type;
+ _ some corrections in mpfr.texi, documentencoding set.
+
+------------------------------------------------------------------------
+r2400 | ryde | 2003-08-30 23:25:43 +0000 (Sat, 30 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/amd64.asm
+
+#Corrections to initial checkin.
+
+------------------------------------------------------------------------
+r2399 | ryde | 2003-08-30 02:13:55 +0000 (Sat, 30 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+(EXTRA_libfrtests_a_SOURCES): Add amd64.asm.
+
+------------------------------------------------------------------------
+r2398 | ryde | 2003-08-30 02:13:34 +0000 (Sat, 30 Aug 2003) | 2 lines
+Changed paths:
+ A /trunk/tests/amd64.asm
+
+New file.
+
+------------------------------------------------------------------------
+r2397 | ryde | 2003-08-30 02:13:18 +0000 (Sat, 30 Aug 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Correction to:
+(MPFR_CONFIGS): Add amd64-*-* to x86 test objects.
+
+------------------------------------------------------------------------
+r2396 | ryde | 2003-08-30 01:42:49 +0000 (Sat, 30 Aug 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+(tests_machine_prec_long_double): Add amd64 to the
+comments.
+
+------------------------------------------------------------------------
+r2395 | ryde | 2003-08-30 01:41:08 +0000 (Sat, 30 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_CONFIGS): Add amd64-*-* to x86 test objects.
+
+------------------------------------------------------------------------
+r2394 | ryde | 2003-08-30 01:39:32 +0000 (Sat, 30 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+(check_set_get): Improve error messages.
+
+------------------------------------------------------------------------
+r2393 | ryde | 2003-08-30 01:38:46 +0000 (Sat, 30 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tests.c
+
+(ld_trace): New function.
+
+------------------------------------------------------------------------
+r2392 | ryde | 2003-08-30 01:37:40 +0000 (Sat, 30 Aug 2003) | 3 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+(ldbl_max_struct): Use octal character constants, since hex
+is an ANSI-ism.
+
+------------------------------------------------------------------------
+r2391 | vlefevre | 2003-08-07 07:56:08 +0000 (Thu, 07 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/ui_pow_ui.c
+
+Avoid a potential overflow.
+
+------------------------------------------------------------------------
+r2390 | zimmerma | 2003-08-04 11:13:04 +0000 (Mon, 04 Aug 2003) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/tests/tagm.c
+
+fixed pb found by Damien Fisher
+
+------------------------------------------------------------------------
+r2389 | vlefevre | 2003-07-24 15:47:17 +0000 (Thu, 24 Jul 2003) | 3 lines
+Changed paths:
+ M /trunk/get_d.c
+
+If the exponent of the number is meaningless (src = NaN, inf or 0),
+0 is stored in expptr (behavior similar to the ISO C frexp function).
+
+------------------------------------------------------------------------
+r2388 | zimmerma | 2003-07-21 13:16:54 +0000 (Mon, 21 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item
+
+------------------------------------------------------------------------
+r2387 | ryde | 2003-07-19 00:17:02 +0000 (Sat, 19 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+(check_PROGRAMS): Add tget_d_2exp.c.
+
+------------------------------------------------------------------------
+r2386 | ryde | 2003-07-19 00:15:46 +0000 (Sat, 19 Jul 2003) | 2 lines
+Changed paths:
+ A /trunk/tests/tget_d_2exp.c
+
+New file, partly derived from tget_d.c.
+
+------------------------------------------------------------------------
+r2385 | ryde | 2003-07-19 00:12:19 +0000 (Sat, 19 Jul 2003) | 3 lines
+Changed paths:
+ M /trunk/get_d.c
+
+(mpfr_get_d_2exp): Ensure 0.5 <= abs(ret) < 1.0 is respected
+when rounding away from zero.
+
+------------------------------------------------------------------------
+r2384 | ryde | 2003-07-19 00:07:32 +0000 (Sat, 19 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tests.c
+
+(d_trace): New function.
+
+------------------------------------------------------------------------
+r2383 | ryde | 2003-07-19 00:06:15 +0000 (Sat, 19 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Converting Floats): mpfr_get_d_2exp stores to a long.
+
+------------------------------------------------------------------------
+r2382 | ryde | 2003-07-19 00:00:24 +0000 (Sat, 19 Jul 2003) | 3 lines
+Changed paths:
+ M /trunk/get_d.c
+ M /trunk/mpfr.h
+
+(mpfr_get_d_2exp): Store exp in a long, same as
+mpz_get_d_2exp and mpf_get_d_2exp.
+
+------------------------------------------------------------------------
+r2381 | vlefevre | 2003-07-15 14:42:08 +0000 (Tue, 15 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Updated comment.
+
+------------------------------------------------------------------------
+r2380 | vlefevre | 2003-07-08 14:31:44 +0000 (Tue, 08 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+Correction in a comment (patch by Torbjorn).
+
+------------------------------------------------------------------------
+r2379 | zimmerma | 2003-07-01 14:47:05 +0000 (Tue, 01 Jul 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/round_prec.c
+
+can_round returns 0 for NaN/Inf
+
+------------------------------------------------------------------------
+r2378 | zimmerma | 2003-07-01 10:49:04 +0000 (Tue, 01 Jul 2003) | 3 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+fixed Uninitialized memory read in mpfr_can_round
+(when b is NaN or Inf)
+
+------------------------------------------------------------------------
+r2377 | zimmerma | 2003-06-30 15:59:19 +0000 (Mon, 30 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+fixed array bound write (need 6+1 characters in s1 to represent -@inf@ + \0)
+
+------------------------------------------------------------------------
+r2376 | ryde | 2003-06-28 00:17:24 +0000 (Sat, 28 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Add "const" to IEEE byte sequence data.
+
+------------------------------------------------------------------------
+r2375 | ryde | 2003-06-28 00:15:04 +0000 (Sat, 28 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+(tests_rand_end): Remove explicit __gmp_rands
+clearing, it's what RANDS_CLEAR does already.
+
+------------------------------------------------------------------------
+r2374 | ryde | 2003-06-26 23:01:02 +0000 (Thu, 26 Jun 2003) | 4 lines
+Changed paths:
+ M /trunk/TODO
+
+# Clarify nan/inf bits under efficiency.
+# Add mpfr_get_d3 ieee portability.
+# Add mpfr_random not wanted in mpf integration.
+
+------------------------------------------------------------------------
+r2373 | zimmerma | 2003-06-26 13:40:08 +0000 (Thu, 26 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/cmp_d.c
+ M /trunk/get_d.c
+ M /trunk/get_ld.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_ld.c
+
+moved macros for [L]DBL_MANT_DIG in mpfr-impl.h
+
+------------------------------------------------------------------------
+r2372 | zimmerma | 2003-06-25 10:16:43 +0000 (Wed, 25 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+fixed several problems noticed by Kevin
+
+------------------------------------------------------------------------
+r2371 | zimmerma | 2003-06-25 07:47:53 +0000 (Wed, 25 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+changed test for 2^1024, using LDBL_MAX_EXP
+
+------------------------------------------------------------------------
+r2370 | ryde | 2003-06-25 00:47:56 +0000 (Wed, 25 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+# Add efficiency of separate flag bit operations.
+
+------------------------------------------------------------------------
+r2369 | ryde | 2003-06-24 23:57:33 +0000 (Tue, 24 Jun 2003) | 2 lines
+Changed paths:
+ D /trunk/mpfr-math.h
+
+Remove file, no longer used.
+
+------------------------------------------------------------------------
+r2368 | ryde | 2003-06-24 23:56:41 +0000 (Tue, 24 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+(libmpfr_a_SOURCES): Remove mpfr-math.h.
+
+------------------------------------------------------------------------
+r2367 | ryde | 2003-06-24 23:55:52 +0000 (Tue, 24 Jun 2003) | 5 lines
+Changed paths:
+ M /trunk/get_d.c
+
+(MPFR_DBL_INFP, MPFR_DBL_INFM, MPFR_DBL_NAN): Make private
+definitions based on IEEE byte sequences, in particular avoid HUGE_VAL
+from mpfr-math.h since that's not infinity on hppa1.1-hp-hpux10.
+Remove includes of mpfr-math.h, math.h and stddef.h.
+
+------------------------------------------------------------------------
+r2366 | ryde | 2003-06-24 23:50:03 +0000 (Tue, 24 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+(check_inf_nan): New test.
+
+------------------------------------------------------------------------
+r2365 | ryde | 2003-06-24 23:45:21 +0000 (Tue, 24 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_C_LONG_DOUBLE_FORMAT): Use octal char constants,
+'\xHH' is an ANSI-ism.
+
+------------------------------------------------------------------------
+r2364 | zimmerma | 2003-06-24 10:21:38 +0000 (Tue, 24 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+check 2^1024 only when sizeof(long double) > sizeof(double)
+
+------------------------------------------------------------------------
+r2363 | zimmerma | 2003-06-24 08:20:41 +0000 (Tue, 24 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+correction to previous patch
+
+------------------------------------------------------------------------
+r2362 | zimmerma | 2003-06-24 08:14:39 +0000 (Tue, 24 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+correction to previous patch: problem was that x and u can be 0,
+then MPFR_PREC() undefined
+
+------------------------------------------------------------------------
+r2361 | ryde | 2003-06-24 00:32:32 +0000 (Tue, 24 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+(tests_start_mpfr): Make stdout and stderr unbuffered.
+
+------------------------------------------------------------------------
+r2360 | ryde | 2003-06-24 00:30:25 +0000 (Tue, 24 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+(check_inexact): For pz, use at least MPFR_PREC_MIN
+since this is required by mpfr_set_prec.
+
+------------------------------------------------------------------------
+r2359 | ryde | 2003-06-24 00:29:32 +0000 (Tue, 24 Jun 2003) | 4 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+# Correction to:
+# (check_inexact): For pz, use at least MPFR_PREC_MIN
+# since this is required by mpfr_set_prec.
+
+------------------------------------------------------------------------
+r2358 | ryde | 2003-06-24 00:20:41 +0000 (Tue, 24 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+(check_inexact): For pz, use at least MPFR_PREC_MIN
+since this is required by mpfr_set_prec.
+
+------------------------------------------------------------------------
+r2357 | ryde | 2003-06-23 23:58:03 +0000 (Mon, 23 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove mingw portability of random/rand48, no longer used.
+
+------------------------------------------------------------------------
+r2356 | ryde | 2003-06-23 23:55:24 +0000 (Mon, 23 Jun 2003) | 5 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove __setfpucw, no longer used.
+Remove mpfr_integer_p, done.
+Remove gmp rand functions in test programs, done.
+Remove MPFR_CHECK_RANDOMIZE, done (as GMP_CHECK_RANDOMIZE).
+
+------------------------------------------------------------------------
+r2355 | vlefevre | 2003-06-21 07:56:50 +0000 (Sat, 21 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr_random is deprecated.
+
+------------------------------------------------------------------------
+r2354 | zimmerma | 2003-06-20 15:01:01 +0000 (Fri, 20 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tui_div.c
+
+changed since mpfr_random now can return 0
+
+------------------------------------------------------------------------
+r2353 | vlefevre | 2003-06-20 14:21:36 +0000 (Fri, 20 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/random.c
+
+The distribution should now be uniform (mpfr_random implemented
+by calling mpfr_urandomb).
+
+------------------------------------------------------------------------
+r2352 | vlefevre | 2003-06-20 12:30:42 +0000 (Fri, 20 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/urandomb.c
+
+Take the current exponent range into account in mpfr_urandomb
+(which now returns an int).
+
+------------------------------------------------------------------------
+r2351 | vlefevre | 2003-06-20 10:37:26 +0000 (Fri, 20 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+Bug fix.
+
+------------------------------------------------------------------------
+r2350 | zimmerma | 2003-06-20 10:30:35 +0000 (Fri, 20 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+moved _gmp_rands_initialized stuff from tests_end_mpfr() to tests_rand_end()
+
+------------------------------------------------------------------------
+r2349 | zimmerma | 2003-06-20 09:58:46 +0000 (Fri, 20 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_z.c
+
+reduced default number of tests
+improved style
+
+------------------------------------------------------------------------
+r2348 | zimmerma | 2003-06-20 09:53:15 +0000 (Fri, 20 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+reduced default number of tests
+improved style
+
+------------------------------------------------------------------------
+r2347 | zimmerma | 2003-06-19 17:17:48 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+fixed bug in mpfr_exp2_aux2 (spe175.testdrive.hp.com)
+
+------------------------------------------------------------------------
+r2346 | zimmerma | 2003-06-19 15:40:52 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+
+improved style
+
+------------------------------------------------------------------------
+r2345 | zimmerma | 2003-06-19 14:57:05 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added more information in case of failure
+
+------------------------------------------------------------------------
+r2344 | zimmerma | 2003-06-19 09:12:26 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+
+removed randseed() stuff [obsolete now we use the GMP mechanism]
+
+------------------------------------------------------------------------
+r2343 | zimmerma | 2003-06-19 08:55:03 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+added memory test mechanism
+
+------------------------------------------------------------------------
+r2342 | zimmerma | 2003-06-19 08:54:42 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added new test from Parks
+
+------------------------------------------------------------------------
+r2341 | zimmerma | 2003-06-19 08:54:07 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+fixed allocation problem (forgot to clear)
+
+------------------------------------------------------------------------
+r2340 | vlefevre | 2003-06-19 01:01:38 +0000 (Thu, 19 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+Removed drand48/lrand48/srand48 prototypes.
+
+------------------------------------------------------------------------
+r2339 | ryde | 2003-06-18 22:57:32 +0000 (Wed, 18 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_z.c
+
+Don't use mpz_get_d1, since a 53-bit double is not
+enough when long is 64-bits.
+
+------------------------------------------------------------------------
+r2338 | ryde | 2003-06-18 22:50:59 +0000 (Wed, 18 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+Don't use mpz_get_d1, since a 53-bit double is not
+enough when long is 64-bits.
+
+------------------------------------------------------------------------
+r2337 | ryde | 2003-06-13 22:43:53 +0000 (Fri, 13 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Use autoconf recommended style for time.h with
+sys/time.h.
+
+------------------------------------------------------------------------
+r2336 | ryde | 2003-06-13 22:40:44 +0000 (Fri, 13 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_CONFIGS): Require AC_HEADER_TIME, add
+AC_CHECK_HEADERS of sys/time.h.
+
+------------------------------------------------------------------------
+r2335 | ryde | 2003-06-13 22:33:50 +0000 (Fri, 13 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_CONFIGS): Add AC_CHECK_FUNCS of gettimeofday.
+
+------------------------------------------------------------------------
+r2334 | zimmerma | 2003-06-13 15:19:12 +0000 (Fri, 13 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+moved disabled test to "special" code
+
+------------------------------------------------------------------------
+r2333 | zimmerma | 2003-06-13 11:50:07 +0000 (Fri, 13 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added reference to Higham
+
+------------------------------------------------------------------------
+r2332 | zimmerma | 2003-06-13 08:22:53 +0000 (Fri, 13 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/erf.c
+ M /trunk/exp.c
+
+improved error analysis on erf
+
+------------------------------------------------------------------------
+r2331 | zimmerma | 2003-06-13 07:52:01 +0000 (Fri, 13 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+improved indentation
+
+------------------------------------------------------------------------
+r2330 | zimmerma | 2003-06-12 16:29:34 +0000 (Thu, 12 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+added support for random see
+(when env. variable GMP_CHECK_RANDOMIZE set)
+
+------------------------------------------------------------------------
+r2329 | vlefevre | 2003-06-12 16:13:49 +0000 (Thu, 12 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/terf.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+Replaced misc random functions by GMP ones.
+
+------------------------------------------------------------------------
+r2328 | vlefevre | 2003-06-12 13:52:56 +0000 (Thu, 12 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tests.c
+
+Added function randlimb().
+
+------------------------------------------------------------------------
+r2327 | vlefevre | 2003-06-12 11:37:31 +0000 (Thu, 12 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/erf.c
+
+Fixed a few bugs concerning special values, code simplified.
+
+------------------------------------------------------------------------
+r2326 | zimmerma | 2003-06-12 09:10:34 +0000 (Thu, 12 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/algorithms.tex
+ A /trunk/erf.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/terf.c
+
+added error function
+
+------------------------------------------------------------------------
+r2325 | vlefevre | 2003-06-11 23:38:43 +0000 (Wed, 11 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+Make x positive + some minor changes.
+
+------------------------------------------------------------------------
+r2324 | vlefevre | 2003-06-11 23:31:05 +0000 (Wed, 11 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+New version written by Torbjorn Granlund.
+
+------------------------------------------------------------------------
+r2323 | zimmerma | 2003-06-10 15:24:16 +0000 (Tue, 10 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+updated formular for erf
+added url for Abramowitz & Stegun
+
+------------------------------------------------------------------------
+r2322 | vlefevre | 2003-06-10 13:22:52 +0000 (Tue, 10 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Added a comment concerning NO_MATH_DEFS.
+
+------------------------------------------------------------------------
+r2321 | zimmerma | 2003-06-10 08:43:05 +0000 (Tue, 10 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+made test faster
+
+------------------------------------------------------------------------
+r2320 | zimmerma | 2003-06-10 08:41:47 +0000 (Tue, 10 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+reduced test time
+
+------------------------------------------------------------------------
+r2319 | zimmerma | 2003-06-10 08:38:54 +0000 (Tue, 10 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+reduced time of test
+
+------------------------------------------------------------------------
+r2318 | zimmerma | 2003-06-10 08:20:21 +0000 (Tue, 10 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tfrac.c
+
+reduced time
+
+------------------------------------------------------------------------
+r2317 | ryde | 2003-06-09 22:48:18 +0000 (Mon, 09 Jun 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+Patch by Torbjorn: use puts not putchar, to avoid GNUPro compiler bug.
+
+------------------------------------------------------------------------
+r2316 | ryde | 2003-06-08 23:56:47 +0000 (Sun, 08 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+Disable "8093416094703476*2^(-1075)" because mips64
+SGI cc doesn't seem to like the value (a denorm).
+
+------------------------------------------------------------------------
+r2315 | ryde | 2003-06-08 22:44:59 +0000 (Sun, 08 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Include <stddef.h> before <math.h>, to avoid problems with
+gcc 3.2 on hppa2.0w-hp-hpux11.11.
+
+------------------------------------------------------------------------
+r2314 | ryde | 2003-06-08 22:35:03 +0000 (Sun, 08 Jun 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+(random): Remove prototype, since it conflicts with
+stdlib.h on osf4.
+
+------------------------------------------------------------------------
+r2313 | vlefevre | 2003-05-28 14:04:50 +0000 (Wed, 28 May 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tzeta.c
+
+Added prototypes of non-standard functions that weren't always defined.
+
+------------------------------------------------------------------------
+r2312 | vlefevre | 2003-05-28 08:44:17 +0000 (Wed, 28 May 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+MPFR_EXP_CHECK is now defined when WANT_ASSERT is defined.
+
+------------------------------------------------------------------------
+r2311 | vlefevre | 2003-05-26 20:31:56 +0000 (Mon, 26 May 2003) | 3 lines
+Changed paths:
+ M /trunk/zeta.c
+
+The special case s = 1 is taken into account (the previous code
+seemed to work, but perhaps not for rigorous reasons).
+
+------------------------------------------------------------------------
+r2310 | vlefevre | 2003-05-26 20:31:38 +0000 (Mon, 26 May 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+Added test for case s = 1.
+
+------------------------------------------------------------------------
+r2309 | vlefevre | 2003-05-26 15:34:17 +0000 (Mon, 26 May 2003) | 3 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+(mpfr_round_prec): Bug fixed (case zero wasn't taken into account)
+and 'assertion failed' avoided.
+
+------------------------------------------------------------------------
+r2308 | vlefevre | 2003-05-26 15:20:27 +0000 (Mon, 26 May 2003) | 2 lines
+Changed paths:
+ M /trunk/add_one_ulp.c
+ M /trunk/div_ui.c
+ M /trunk/sub_one_ulp.c
+
+Update related to MPFR_GET_EXP and MPFR_SET_EXP.
+
+------------------------------------------------------------------------
+r2307 | vlefevre | 2003-05-26 14:46:42 +0000 (Mon, 26 May 2003) | 2 lines
+Changed paths:
+ M /trunk/rint.c
+
+MPFR_GET_EXP (r) -> exp.
+
+------------------------------------------------------------------------
+r2306 | vlefevre | 2003-05-26 13:20:54 +0000 (Mon, 26 May 2003) | 2 lines
+Changed paths:
+ M /trunk/swap.c
+
+Function mpfr_swap rewritten using memcpy.
+
+------------------------------------------------------------------------
+r2305 | vlefevre | 2003-05-26 12:03:59 +0000 (Mon, 26 May 2003) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+Updates/optimizations related to MPFR_GET_EXP and MPFR_SET_EXP.
+
+------------------------------------------------------------------------
+r2304 | vlefevre | 2003-05-26 11:47:04 +0000 (Mon, 26 May 2003) | 2 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+
+Updates/optimizations related to MPFR_GET_EXP and MPFR_SET_EXP.
+
+------------------------------------------------------------------------
+r2303 | vlefevre | 2003-05-23 10:28:12 +0000 (Fri, 23 May 2003) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+
+Code clean-up. Assertion failed avoided.
+
+------------------------------------------------------------------------
+r2302 | vlefevre | 2003-05-22 22:11:01 +0000 (Thu, 22 May 2003) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2301 | vlefevre | 2003-05-22 21:39:40 +0000 (Thu, 22 May 2003) | 8 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/div.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/eq.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/frac.c
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_exp.c
+ M /trunk/get_ld.c
+ M /trunk/get_si.c
+ M /trunk/get_str.c
+ M /trunk/get_ui.c
+ M /trunk/get_z_exp.c
+ M /trunk/hypot.c
+ M /trunk/isinteger.c
+ M /trunk/log.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/next.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_exp.c
+ M /trunk/set_f.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+Macros MPFR_EXP_INVALID (invalid exponent value) and MPFR_EXP_CHECK
+added. Code update to use MPFR_GET_EXP and MPFR_SET_EXP instead of
+MPFR_EXP to allow more bug detection related to special values.
+Macros MPFR_SET_NAN, MPFR_SET_INF, MPFR_SET_ZERO and MPFR_INIT set
+the exponent of the number to MPFR_EXP_INVALID if MPFR_EXP_CHECK
+is defined. Compile with -DMPFR_EXP_CHECK and make check to see
+the potential problems; currently, 40 of 76 tests fail.
+
+------------------------------------------------------------------------
+r2300 | vlefevre | 2003-05-21 15:16:49 +0000 (Wed, 21 May 2003) | 2 lines
+Changed paths:
+ M /trunk/pow_ui.c
+ M /trunk/tests/tacos.c
+
+#include "gmp-impl.h" added.
+
+------------------------------------------------------------------------
+r2299 | vlefevre | 2003-05-21 14:49:03 +0000 (Wed, 21 May 2003) | 5 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+MPFR_ASSERTD: use MPFR_ASSERTN instead of ASSERT_ALWAYS so that
+it can be used as an expression.
+New macros MPFR_GET_EXP and MPFR_SET_EXP (they should almost
+completely replace MPFR_EXP).
+
+------------------------------------------------------------------------
+r2298 | zimmerma | 2003-05-19 15:04:20 +0000 (Mon, 19 May 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/teq.c
+
+added test 'special'
+
+------------------------------------------------------------------------
+r2297 | zimmerma | 2003-05-19 15:03:11 +0000 (Mon, 19 May 2003) | 2 lines
+Changed paths:
+ M /trunk/eq.c
+
+fixed bug when n_bits larger than size*BITS_PER_MP_LIMB
+
+------------------------------------------------------------------------
+r2296 | vlefevre | 2003-05-18 00:11:11 +0000 (Sun, 18 May 2003) | 2 lines
+Changed paths:
+ M /trunk/eq.c
+
+Bugs fixed (special cases).
+
+------------------------------------------------------------------------
+r2295 | zimmerma | 2003-05-13 16:02:44 +0000 (Tue, 13 May 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+removed dummy test tdump
+
+------------------------------------------------------------------------
+r2294 | zimmerma | 2003-05-13 16:00:44 +0000 (Tue, 13 May 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+compatibility with mpf is done
+
+------------------------------------------------------------------------
+r2293 | zimmerma | 2003-05-13 15:52:30 +0000 (Tue, 13 May 2003) | 3 lines
+Changed paths:
+ M /trunk/cmp_d.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr.texi
+
+updated mpfr_cmp_d
+added mpfr_cmp_d in mpf2mpfr.h and mpfr.texi
+
+------------------------------------------------------------------------
+r2292 | hanrot | 2003-05-13 15:03:49 +0000 (Tue, 13 May 2003) | 2 lines
+Changed paths:
+ A /trunk/cmp_d.c
+ A /trunk/tests/tcmp_d.c
+
+Added cmp_d.c, tcmp_d.c.
+
+------------------------------------------------------------------------
+r2291 | hanrot | 2003-05-13 15:03:07 +0000 (Tue, 13 May 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/mpf_compat.h
+
+Added cmp_d/tcmp_d.
+
+------------------------------------------------------------------------
+r2290 | zimmerma | 2003-04-11 10:08:39 +0000 (Fri, 11 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/zeta.c
+
+moved test for NaN/Inf
+
+------------------------------------------------------------------------
+r2289 | zimmerma | 2003-04-11 09:54:23 +0000 (Fri, 11 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+added Riemann Zeta function (contribution from Jean-Luc Re'my)
+
+------------------------------------------------------------------------
+r2288 | ryde | 2003-04-08 23:50:59 +0000 (Tue, 08 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Move macros down below @copying.
+
+------------------------------------------------------------------------
+r2287 | ryde | 2003-04-08 23:43:51 +0000 (Tue, 08 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Add @: after various abbreviations.
+
+------------------------------------------------------------------------
+r2286 | zimmerma | 2003-04-01 11:49:34 +0000 (Tue, 01 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+fixed pb with count_leading_zeros (n=0)
+
+------------------------------------------------------------------------
+r2285 | zimmerma | 2003-04-01 10:39:48 +0000 (Tue, 01 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added test for bug found by Franky Backeljauw
+
+------------------------------------------------------------------------
+r2284 | zimmerma | 2003-04-01 10:39:14 +0000 (Tue, 01 Apr 2003) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+fixed bug found by Franky
+
+------------------------------------------------------------------------
+r2283 | vlefevre | 2003-03-28 12:56:46 +0000 (Fri, 28 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+
+Added some asserts.
+
+------------------------------------------------------------------------
+r2282 | zimmerma | 2003-03-28 09:22:37 +0000 (Fri, 28 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tconst_pi.c
+
+fixed pb found by Will Galway <galway@pims.math.ca> (continued)
+
+------------------------------------------------------------------------
+r2281 | hanrot | 2003-03-28 09:13:19 +0000 (Fri, 28 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+ M /trunk/tests/tconst_pi.c
+
+Patches from W. Galway.
+
+------------------------------------------------------------------------
+r2280 | zimmerma | 2003-03-28 08:40:59 +0000 (Fri, 28 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed reference to Plouffe/Bailey/Borwein formula
+
+------------------------------------------------------------------------
+r2279 | hanrot | 2003-03-27 09:37:37 +0000 (Thu, 27 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/const_pi.c
+
+Credits for the pi formula modified.
+
+------------------------------------------------------------------------
+r2278 | zimmerma | 2003-03-26 10:01:02 +0000 (Wed, 26 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+
+changed back "unsigned char *" to "char *"
+
+------------------------------------------------------------------------
+r2277 | zimmerma | 2003-03-25 09:17:50 +0000 (Tue, 25 Mar 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+
+char * -> const unsigned char * for mpfr_set_str, mpfr_set_str_raw,
+and mpfr_init_set_str
+
+------------------------------------------------------------------------
+r2276 | zimmerma | 2003-03-24 13:24:54 +0000 (Mon, 24 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+removed unused variable
+
+------------------------------------------------------------------------
+r2275 | zimmerma | 2003-03-18 10:55:37 +0000 (Tue, 18 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed documentation bug in mpfr_log2 (exact results)
+
+------------------------------------------------------------------------
+r2274 | zimmerma | 2003-03-18 09:05:42 +0000 (Tue, 18 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+changed new test in 'check4' style
+
+------------------------------------------------------------------------
+r2273 | vlefevre | 2003-03-17 02:08:03 +0000 (Mon, 17 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/mpfr.texi
+
+Update concerning underflow problems.
+
+------------------------------------------------------------------------
+r2272 | ryde | 2003-03-17 00:20:46 +0000 (Mon, 17 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+(main): Comment out underflows(), until it works.
+
+------------------------------------------------------------------------
+r2271 | ryde | 2003-03-17 00:04:41 +0000 (Mon, 17 Mar 2003) | 3 lines
+Changed paths:
+ M /trunk/get_z_exp.c
+
+Comment out an assert tickled for an f with exponent
+near MPFR_EMIN_MIN.
+
+------------------------------------------------------------------------
+r2270 | ryde | 2003-03-16 23:32:38 +0000 (Sun, 16 Mar 2003) | 7 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+(LONGDOUBLE_NAN_ACTION): New version for IEEE quad big
+endian, fixing HP cc.
+(WANT_LONGDOUBLE_VOLATILE): New define for when LONGDOUBLE_VOLATILE is
+wanted.
+(WANT_GMPFR_LONGDOUBLE_VOLATILE): New define for when
+__gmpfr_longdouble_volatile is wanted.
+
+------------------------------------------------------------------------
+r2269 | ryde | 2003-03-16 23:32:05 +0000 (Sun, 16 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/volatile.c
+
+Use WANT_GMPFR_LONGDOUBLE_VOLATILE.
+
+------------------------------------------------------------------------
+r2268 | ryde | 2003-03-16 23:29:27 +0000 (Sun, 16 Mar 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_C_LONG_DOUBLE_FORMAT): Add IEEE quad big endian,
+check long double exists before testing.
+
+------------------------------------------------------------------------
+r2267 | vlefevre | 2003-03-14 11:55:34 +0000 (Fri, 14 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Added underflow test showing a bug in mpfr_pow.
+
+------------------------------------------------------------------------
+r2266 | zimmerma | 2003-03-14 08:22:36 +0000 (Fri, 14 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+fixed bug for x=1
+
+------------------------------------------------------------------------
+r2265 | vlefevre | 2003-03-14 01:50:48 +0000 (Fri, 14 Mar 2003) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/pow.c
+
+This wasn't a compiler bug; mpfr_pow is really buggy.
+Added some asserts to show that.
+
+------------------------------------------------------------------------
+r2264 | vlefevre | 2003-03-14 01:12:44 +0000 (Fri, 14 Mar 2003) | 5 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/tests/tpow.c
+
+The infinite loop concerning 1^0.5 was probably due to a bug in the
+compiler [cc (GCC) 3.2.3 20030309 (Debian prerelease)]: adding some
+printf's changes the values of the variables and the correct result
+is returned.
+
+------------------------------------------------------------------------
+r2263 | zimmerma | 2003-03-13 17:11:52 +0000 (Thu, 13 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+fixed sign problem in particular_cases()
+
+------------------------------------------------------------------------
+r2262 | zimmerma | 2003-03-13 17:10:45 +0000 (Thu, 13 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+declared mpfr_ui_pow_is_exact as static
+
+------------------------------------------------------------------------
+r2261 | zimmerma | 2003-03-13 17:10:02 +0000 (Thu, 13 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+
+gnu-style
+
+------------------------------------------------------------------------
+r2260 | vlefevre | 2003-03-13 00:26:48 +0000 (Thu, 13 Mar 2003) | 4 lines
+Changed paths:
+ M /trunk/tests/tpow3.c
+
+Removed some useless and inaccurate tests on NaN, infinities, zeros
+(as the behavior of mpfr_pow on such particular cases has changed);
+similar tests were added to "tests/tpow.c".
+
+------------------------------------------------------------------------
+r2259 | vlefevre | 2003-03-13 00:15:19 +0000 (Thu, 13 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/tests/tpow.c
+
+Test of mpfr_pow: particular cases. Bugs.
+
+------------------------------------------------------------------------
+r2258 | vlefevre | 2003-03-12 18:19:59 +0000 (Wed, 12 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tpow3.c
+
+Special cases for mpfr_pow().
+
+------------------------------------------------------------------------
+r2257 | zimmerma | 2003-03-11 17:32:46 +0000 (Tue, 11 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+when stream=NULL, use stdout (as indicated in the documentation)
+
+------------------------------------------------------------------------
+r2256 | vlefevre | 2003-03-03 06:04:29 +0000 (Mon, 03 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+mpfr_sin_sign -> static.
+
+------------------------------------------------------------------------
+r2255 | vlefevre | 2003-03-03 06:03:24 +0000 (Mon, 03 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Useless declaration removed.
+
+------------------------------------------------------------------------
+r2254 | vlefevre | 2003-03-03 05:51:30 +0000 (Mon, 03 Mar 2003) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+Special cases for mpfr_pow: like Section F.9.4.4 of the
+ISO C99 standard.
+
+------------------------------------------------------------------------
+r2253 | vlefevre | 2003-03-03 05:14:18 +0000 (Mon, 03 Mar 2003) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Prototype fixed.
+
+------------------------------------------------------------------------
+r2252 | vlefevre | 2003-02-27 10:20:34 +0000 (Thu, 27 Feb 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+ M /trunk/tests/tset_str.c
+
+mpfr_set_str now accepts a binary exponent for base 16
+(as defined by the ISO C99 standard).
+
+------------------------------------------------------------------------
+r2251 | vlefevre | 2003-02-27 05:32:01 +0000 (Thu, 27 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Comment concerning the installation of MPFR: done.
+
+------------------------------------------------------------------------
+r2250 | vlefevre | 2003-02-27 05:18:56 +0000 (Thu, 27 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/mpfr.texi
+
+New recommendation to install MPFR.
+
+------------------------------------------------------------------------
+r2249 | hanrot | 2003-02-24 12:32:56 +0000 (Mon, 24 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/dump.c
+ M /trunk/get_str.c
+ M /trunk/out_str.c
+ M /trunk/print_raw.c
+ M /trunk/set_str.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tset_str.c
+
+Replaced NaN, Inf by @NaN@, @Inf@ [for bases > 24].
+
+------------------------------------------------------------------------
+r2248 | zimmerma | 2003-02-21 15:06:24 +0000 (Fri, 21 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+added one test
+
+------------------------------------------------------------------------
+r2247 | vlefevre | 2003-02-21 15:04:06 +0000 (Fri, 21 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/get_ui.c
+
+Fixed cast (though unnecessary).
+
+------------------------------------------------------------------------
+r2246 | zimmerma | 2003-02-21 13:07:46 +0000 (Fri, 21 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one test
+
+------------------------------------------------------------------------
+r2245 | zimmerma | 2003-02-13 15:31:51 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added mpf_compat, mpfr_compat
+
+------------------------------------------------------------------------
+r2244 | zimmerma | 2003-02-13 15:30:41 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ A /trunk/tests/mpf_compat.c
+ A /trunk/tests/mpf_compat.h
+ A /trunk/tests/mpfr_compat.c
+
+test files for mpf-mpfr compatibility
+
+------------------------------------------------------------------------
+r2243 | zimmerma | 2003-02-13 15:29:27 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+added mpfr_init_set_str
+
+------------------------------------------------------------------------
+r2242 | zimmerma | 2003-02-13 14:50:37 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added "const" to char* arg. of mpfr_init_set_str
+
+------------------------------------------------------------------------
+r2241 | zimmerma | 2003-02-13 14:49:47 +0000 (Thu, 13 Feb 2003) | 3 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+added macros for new mpfr functions
+changed some old macros
+
+------------------------------------------------------------------------
+r2240 | zimmerma | 2003-02-13 08:57:19 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/frac.c
+ M /trunk/isinteger.c
+ M /trunk/log10.c
+ M /trunk/pow.c
+ M /trunk/tests/tpow3.c
+
+mpfr_isinteger -> mpfr_integer_p
+
+------------------------------------------------------------------------
+r2239 | zimmerma | 2003-02-13 08:56:34 +0000 (Thu, 13 Feb 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+document new functions (fits_*, get_ui, get_si, get_d_2exp)
+added integer_p that was not documented
+
+------------------------------------------------------------------------
+r2238 | zimmerma | 2003-02-13 08:55:23 +0000 (Thu, 13 Feb 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr_isinteger -> mpfr_integer_p
+new functions: mpfr_fits_*, mpfr_get_ui, mpfr_get_si, mpfr_get_d_2exp
+
+------------------------------------------------------------------------
+r2237 | zimmerma | 2003-02-13 08:53:54 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+added mpfr_get_d_2exp
+
+------------------------------------------------------------------------
+r2236 | zimmerma | 2003-02-13 08:52:15 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+new functions mpfr_fits_* and mpfr_get_ui/si
+
+------------------------------------------------------------------------
+r2235 | zimmerma | 2003-02-13 08:51:29 +0000 (Thu, 13 Feb 2003) | 2 lines
+Changed paths:
+ A /trunk/fits_s.h
+ A /trunk/fits_sint.c
+ A /trunk/fits_slong.c
+ A /trunk/fits_sshort.c
+ A /trunk/fits_u.h
+ A /trunk/fits_uint.c
+ A /trunk/fits_ulong.c
+ A /trunk/fits_ushort.c
+ A /trunk/get_si.c
+ A /trunk/get_ui.c
+
+new functions mpfr_fits_* and mpfr_get_[us]i
+
+------------------------------------------------------------------------
+r2234 | zimmerma | 2003-01-27 10:13:37 +0000 (Mon, 27 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+check for +/-0.0 after variable set to NaN
+
+------------------------------------------------------------------------
+r2233 | vlefevre | 2003-01-25 02:44:06 +0000 (Sat, 25 Jan 2003) | 4 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Suppressed the underscores of AC_CHECK_LIBM in comments, otherwise
+aclocal 1.4-p6 includes libtool code in aclocal.m4 and this leads
+to compilation problems.
+
+------------------------------------------------------------------------
+r2232 | ryde | 2003-01-25 00:44:05 +0000 (Sat, 25 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+(_MPFR_H_HAVE_FILE): Copy FILE define tests from gmp.h, adds
+Borland, Microsoft and Apple MPW.
+
+------------------------------------------------------------------------
+r2231 | ryde | 2003-01-25 00:28:59 +0000 (Sat, 25 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+(libmpfr_a_SOURCES): Add volatile.c.
+
+------------------------------------------------------------------------
+r2230 | ryde | 2003-01-25 00:28:30 +0000 (Sat, 25 Jan 2003) | 2 lines
+Changed paths:
+ A /trunk/volatile.c
+
+New file.
+
+------------------------------------------------------------------------
+r2229 | ryde | 2003-01-25 00:28:04 +0000 (Sat, 25 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+(Isnan_ld): New function based on LONGDOUBLE_NAN_ACTION, use it
+instead of LONGDOUBLE_ISNAN.
+
+------------------------------------------------------------------------
+r2228 | ryde | 2003-01-25 00:21:21 +0000 (Sat, 25 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+(LONGDOUBLE_ISNAN): Remove.
+
+------------------------------------------------------------------------
+r2227 | ryde | 2003-01-25 00:21:02 +0000 (Sat, 25 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+(LONGDOUBLE_ISNAN): Remove this, use LONGDOUBLE_NAN_ACTION instead.
+
+------------------------------------------------------------------------
+r2226 | ryde | 2003-01-25 00:20:07 +0000 (Sat, 25 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+(LONGDOUBLE_NAN_ACTION): New macro.
+
+------------------------------------------------------------------------
+r2225 | ryde | 2003-01-24 21:47:56 +0000 (Fri, 24 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Allow "e" exponent in base<=10 not <10. Restrict "E"
+exponent to base<=10 too, since digits are not case sensitive.
+
+------------------------------------------------------------------------
+r2224 | vlefevre | 2003-01-24 19:08:07 +0000 (Fri, 24 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+
+Prototypes: use static. Some code reformatting.
+
+------------------------------------------------------------------------
+r2223 | vlefevre | 2003-01-24 16:49:54 +0000 (Fri, 24 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+The sign wasn't set when the result was zero.
+
+------------------------------------------------------------------------
+r2222 | ryde | 2003-01-24 16:17:04 +0000 (Fri, 24 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Reject "", "+" and "-", also fixing an attempt to allocate a 0 length
+block in these cases.
+
+------------------------------------------------------------------------
+r2221 | ryde | 2003-01-24 16:03:35 +0000 (Fri, 24 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Clear NAN and INF flags when setting result to zero.
+
+------------------------------------------------------------------------
+r2220 | vlefevre | 2003-01-24 11:29:42 +0000 (Fri, 24 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/tui_sub.c
+
+Fixed prototypes (use static...).
+
+------------------------------------------------------------------------
+r2219 | vlefevre | 2003-01-24 11:28:34 +0000 (Fri, 24 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tcbrt.c
+
+Missing #include.
+
+------------------------------------------------------------------------
+r2218 | zimmerma | 2003-01-23 13:16:00 +0000 (Thu, 23 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+workaround for gcc bug on m68040-unknown-netbsd1.4.1
+
+------------------------------------------------------------------------
+r2217 | zimmerma | 2003-01-23 12:41:31 +0000 (Thu, 23 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+added cast to double
+
+------------------------------------------------------------------------
+r2216 | ryde | 2003-01-23 00:00:29 +0000 (Thu, 23 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Use mpfr_set_nan and mpfr_set_inf for NaN and Inf tests,
+not "double" nans and infs.
+
+------------------------------------------------------------------------
+r2215 | ryde | 2003-01-22 23:40:43 +0000 (Wed, 22 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+Use mpfr_set_nan and mpfr_set_inf for NaN and Inf tests,
+not "double" nans and infs.
+
+------------------------------------------------------------------------
+r2214 | ryde | 2003-01-22 23:32:19 +0000 (Wed, 22 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_sub.c
+
+Use mpfr_set_nan and mpfr_set_inf for NaN and Inf tests,
+not "double" nans and infs.
+
+------------------------------------------------------------------------
+r2213 | ryde | 2003-01-22 22:59:46 +0000 (Wed, 22 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tgamma.c
+
+Use tests_start_mpfr / tests_end_mpfr.
+
+------------------------------------------------------------------------
+r2212 | ryde | 2003-01-22 22:39:38 +0000 (Wed, 22 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tcbrt.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tzeta.c
+
+Use tests_start_mpfr / tests_end_mpfr.
+
+------------------------------------------------------------------------
+r2211 | ryde | 2003-01-22 22:34:54 +0000 (Wed, 22 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+Use tests_start_mpfr / tests_end_mpfr.
+(check_large): Use __gmp_free_func to free mpfr_get_str result.
+
+------------------------------------------------------------------------
+r2210 | ryde | 2003-01-22 22:27:46 +0000 (Wed, 22 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+Use mpfr_set_nan and mpfr_set_inf for NaN and Inf tests,
+not "double" nans and infs. Use tests_start_mpfr / tests_end_mpfr.
+
+------------------------------------------------------------------------
+r2209 | ryde | 2003-01-22 22:24:50 +0000 (Wed, 22 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+Use mpfr_set_nan and mpfr_set_inf for NaN and Inf tests,
+not "double" nans and infs.
+
+------------------------------------------------------------------------
+r2208 | ryde | 2003-01-22 22:18:09 +0000 (Wed, 22 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+Remove tests involving "double" nans and infs, covered by check_nan.
+
+------------------------------------------------------------------------
+r2207 | ryde | 2003-01-22 22:15:49 +0000 (Wed, 22 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/ttan.c
+
+Use mpfr_set_nan and mpfr_set_inf for NaN and Inf tests,
+not "double" nans and infs.
+
+------------------------------------------------------------------------
+r2206 | ryde | 2003-01-18 00:31:30 +0000 (Sat, 18 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Move log_b2.h from include_HEADERS to libmpfr_a_SOURCES, it doesn't
+want to be installed.
+
+------------------------------------------------------------------------
+r2205 | ryde | 2003-01-18 00:14:32 +0000 (Sat, 18 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Correction to memory leak fix, need "result" for final rounding.
+
+------------------------------------------------------------------------
+r2204 | ryde | 2003-01-17 23:50:10 +0000 (Fri, 17 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Fix two memory leaks.
+
+------------------------------------------------------------------------
+r2203 | ryde | 2003-01-17 23:08:05 +0000 (Fri, 17 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+(LDADD): Add $(MPFR_LIBM).
+
+------------------------------------------------------------------------
+r2202 | ryde | 2003-01-17 23:00:42 +0000 (Fri, 17 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Remove -lm setups, now handled by MPFR_CHECK_LIBM.
+
+------------------------------------------------------------------------
+r2201 | ryde | 2003-01-17 22:59:51 +0000 (Fri, 17 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_CHECK_LIBM): New macro.
+(MPFR_CONFIGS): Use it.
+
+------------------------------------------------------------------------
+r2200 | zimmerma | 2003-01-17 14:59:48 +0000 (Fri, 17 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/acinclude.m4
+
+added copyright notices and license statements
+
+------------------------------------------------------------------------
+r2199 | zimmerma | 2003-01-17 08:58:45 +0000 (Fri, 17 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+now use __gmpfr_floor_log2 instead of floor/log to get rid of math.h
+
+------------------------------------------------------------------------
+r2198 | zimmerma | 2003-01-17 08:52:49 +0000 (Fri, 17 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+removed unused function dagm(), and get rid of math.h
+added tests for NaN, Inf's
+
+------------------------------------------------------------------------
+r2197 | vlefevre | 2003-01-17 00:55:13 +0000 (Fri, 17 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Re-added $OBJEXT, using AC_REQUIRE([AC_OBJEXT]) for old autoconf.
+
+------------------------------------------------------------------------
+r2196 | zimmerma | 2003-01-16 17:46:17 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+put back math.h
+
+------------------------------------------------------------------------
+r2195 | zimmerma | 2003-01-16 17:44:13 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+added back math.h (for sqrt)
+
+------------------------------------------------------------------------
+r2194 | zimmerma | 2003-01-16 17:32:19 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added log_b2.h in include_HEADERS
+
+------------------------------------------------------------------------
+r2193 | zimmerma | 2003-01-16 17:28:18 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tsin_cos
+
+------------------------------------------------------------------------
+r2192 | zimmerma | 2003-01-16 17:23:25 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added #ifdef HAVE_DENORMS for denormalized test
+
+------------------------------------------------------------------------
+r2191 | zimmerma | 2003-01-16 17:18:07 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tsub.c
+
+removed math.h
+
+------------------------------------------------------------------------
+r2190 | zimmerma | 2003-01-16 17:13:43 +0000 (Thu, 16 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+
+added year 2003 in copyright line
+removed math.h
+
+------------------------------------------------------------------------
+r2189 | zimmerma | 2003-01-16 17:01:07 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+added 2003, removed math.h
+
+------------------------------------------------------------------------
+r2188 | zimmerma | 2003-01-16 16:58:56 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/memory.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tset_str.c
+
+added 2003
+
+------------------------------------------------------------------------
+r2187 | zimmerma | 2003-01-16 16:57:37 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+ M /trunk/tests/trandom.c
+
+removed math.h
+
+------------------------------------------------------------------------
+r2186 | zimmerma | 2003-01-16 16:52:51 +0000 (Thu, 16 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added year 2003
+removed math.h
+
+------------------------------------------------------------------------
+r2185 | zimmerma | 2003-01-16 16:40:46 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+patch for compiler bug on hppa2.0w-hp-hpux11.11
+
+------------------------------------------------------------------------
+r2184 | vlefevre | 2003-01-16 16:33:05 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Macro LONGDOUBLE_ISNAN wasn't defined.
+
+------------------------------------------------------------------------
+r2183 | zimmerma | 2003-01-16 16:04:04 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+now always define Isnan
+
+------------------------------------------------------------------------
+r2182 | zimmerma | 2003-01-16 16:03:34 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+moved LONGDOUBLE_ISNAN to mpfr-test.h
+
+------------------------------------------------------------------------
+r2181 | zimmerma | 2003-01-16 16:03:04 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+removed check from isnan
+
+------------------------------------------------------------------------
+r2180 | zimmerma | 2003-01-16 16:01:55 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tests.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_ld.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+replaced isnan() by Isnan()
+
+------------------------------------------------------------------------
+r2179 | vlefevre | 2003-01-16 13:58:55 +0000 (Thu, 16 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+AC_PREREQ(2.50) added (useful when both autoconf 2.13 and autoconf
+2.50 are installed, with a wrapper to select the required version).
+
+------------------------------------------------------------------------
+r2178 | vlefevre | 2003-01-16 13:30:03 +0000 (Thu, 16 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Comment in mpfr_test_init: s/preprocessor/compiler/.
+
+------------------------------------------------------------------------
+r2177 | zimmerma | 2003-01-16 13:26:53 +0000 (Thu, 16 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+fixed pb in mpfr_test_init with the compiler optimizing too much
+(this happened on Alpha with -O1 or higher)
+
+------------------------------------------------------------------------
+r2176 | vlefevre | 2003-01-15 20:43:58 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+Standard prototype only. Particular cases added.
+
+------------------------------------------------------------------------
+r2175 | zimmerma | 2003-01-15 17:29:10 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/set_str.c
+
+moved common prototype for mpn_exp in mpfr-impl.h
+
+------------------------------------------------------------------------
+r2174 | zimmerma | 2003-01-15 17:28:33 +0000 (Wed, 15 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+removed spurious ; after MPFR_ESIZE
+added prototype for mpn_exp
+
+------------------------------------------------------------------------
+r2173 | zimmerma | 2003-01-15 17:17:17 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed items done
+
+------------------------------------------------------------------------
+r2172 | zimmerma | 2003-01-15 17:14:32 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+new tests from Alain Delplanque
+
+------------------------------------------------------------------------
+r2171 | zimmerma | 2003-01-15 17:13:50 +0000 (Wed, 15 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/set_str.c
+
+new version using mpn_set_str
+[written by Alain Delplanque, edited by Paul Zimmermann]
+
+------------------------------------------------------------------------
+r2170 | vlefevre | 2003-01-15 13:05:06 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Replace $OBJEXT by o (as $OBJEXT isn't defined everywhere).
+
+------------------------------------------------------------------------
+r2169 | vlefevre | 2003-01-15 12:50:13 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+A ` must be quoted to avoid an error with Autoconf 2.13.
+
+------------------------------------------------------------------------
+r2168 | vlefevre | 2003-01-15 11:40:35 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Use type mp_prec_t for precisions.
+
+------------------------------------------------------------------------
+r2167 | vlefevre | 2003-01-15 11:29:46 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Source re-indented.
+
+------------------------------------------------------------------------
+r2166 | vlefevre | 2003-01-15 11:22:26 +0000 (Wed, 15 Jan 2003) | 4 lines
+Changed paths:
+ M /trunk/gamma.c
+
+Several bugs fixed concerning the particular cases.
+<stdio.h> and <stdlib.h> not included by default.
+int mpfr_gamma _PROTO ... removed (was useless).
+
+------------------------------------------------------------------------
+r2165 | zimmerma | 2003-01-15 09:54:12 +0000 (Wed, 15 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+
+get rid of ceil() call, that requires -lm
+
+------------------------------------------------------------------------
+r2164 | ryde | 2003-01-14 23:02:26 +0000 (Tue, 14 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+Force LDBL_MANT_DIG on IEEE extended, to avoid problems with
+some i386 gcc.
+
+------------------------------------------------------------------------
+r2163 | ryde | 2003-01-14 22:48:03 +0000 (Tue, 14 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Avoid problems with bad LDBL_MAX and LDBL_MANT_DIG on some i386 gcc.
+
+------------------------------------------------------------------------
+r2162 | ryde | 2003-01-14 22:43:24 +0000 (Tue, 14 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_C_LONG_DOUBLE_FORMAT): New macro.
+(MPFR_CONFIGS): Use it.
+
+------------------------------------------------------------------------
+r2161 | vlefevre | 2003-01-11 19:32:47 +0000 (Sat, 11 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/memory.c
+
+Required casts added (and switch from uint to ulong);
+in particular, useful on Alpha.
+
+------------------------------------------------------------------------
+r2160 | ryde | 2003-01-10 21:42:53 +0000 (Fri, 10 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/get_ld.c
+ M /trunk/set_ld.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+
+# Add a copyright year.
+
+------------------------------------------------------------------------
+r2159 | ryde | 2003-01-10 21:31:31 +0000 (Fri, 10 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+Tolerate empty argv[1], which can arise from ancient bash executing
+the libtool shared library wrapper script.
+
+------------------------------------------------------------------------
+r2158 | ryde | 2003-01-10 20:59:19 +0000 (Fri, 10 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tconst_pi.c
+
+Tolerate empty argv[1], which can arise from ancient bash executing
+the libtool shared library wrapper script.
+
+------------------------------------------------------------------------
+r2157 | ryde | 2003-01-10 15:39:03 +0000 (Fri, 10 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+Avoid unnecessary extra power of 2 squaring, so as not to provoke an
+overflow exception when result is in range.
+
+------------------------------------------------------------------------
+r2156 | vlefevre | 2003-01-10 13:41:42 +0000 (Fri, 10 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+Extended precision detection fixed.
+
+------------------------------------------------------------------------
+r2155 | zimmerma | 2003-01-09 14:06:37 +0000 (Thu, 09 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+fixed possible overflow when EXP=1024
+
+------------------------------------------------------------------------
+r2154 | zimmerma | 2003-01-09 14:05:30 +0000 (Thu, 09 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+rewritten to avoid overflows
+
+------------------------------------------------------------------------
+r2153 | zimmerma | 2003-01-09 09:56:04 +0000 (Thu, 09 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added one test
+
+------------------------------------------------------------------------
+r2152 | ryde | 2003-01-08 23:14:50 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tests.c
+ M /trunk/tests/tset_ld.c
+
+# Add a copyright year.
+
+------------------------------------------------------------------------
+r2151 | ryde | 2003-01-08 23:09:51 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr-test.h
+
+#Add a copyright year.
+
+------------------------------------------------------------------------
+r2150 | ryde | 2003-01-08 23:04:40 +0000 (Wed, 08 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/get_str.c
+
+(mpn_exp): Don't store -1 in a uint then return it as a long.
+Fixes systems such as alpha where sizeof(uint)!=sizeof(long).
+
+------------------------------------------------------------------------
+r2149 | ryde | 2003-01-08 22:07:59 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(AC_CHECK_HEADERS): Remove fpu_control.h, no longer required.
+
+------------------------------------------------------------------------
+r2148 | ryde | 2003-01-08 21:17:29 +0000 (Wed, 08 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Use tests_machine_prec_long_double.
+Use LDBL_MAX for largest value and to find largest power of 2.
+
+------------------------------------------------------------------------
+r2147 | ryde | 2003-01-08 21:03:01 +0000 (Wed, 08 Jan 2003) | 4 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+(__setfpucw, _FPU_EXTENDED, etc): Remove these setups.
+(tests_machine_prec_double, tests_machine_prec_long_double,
+x86_fstcw, x86_fldcw): Add prototypes.
+
+------------------------------------------------------------------------
+r2146 | ryde | 2003-01-08 21:00:32 +0000 (Wed, 08 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/tests/tests.c
+
+(tests_machine_prec_double, tests_machine_prec_long_double): New functions.
+(mpfr_test_init): Replace __setfpucw with tests_machine_prec_double.
+
+------------------------------------------------------------------------
+r2145 | ryde | 2003-01-08 20:52:04 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(MPFR_CONFIGS): Add tests/x86.asm support.
+
+------------------------------------------------------------------------
+r2144 | ryde | 2003-01-08 20:48:47 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+(X86_PATTERN): New define, supporting acinclude.m4.
+
+------------------------------------------------------------------------
+r2143 | ryde | 2003-01-08 20:43:02 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Add x86.asm support.
+
+------------------------------------------------------------------------
+r2142 | ryde | 2003-01-08 20:35:33 +0000 (Wed, 08 Jan 2003) | 2 lines
+Changed paths:
+ A /trunk/tests/x86.asm
+
+New file.
+
+------------------------------------------------------------------------
+r2141 | zimmerma | 2003-01-07 10:31:43 +0000 (Tue, 07 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+fixed pb for underflow and rounding to nearest
+
+------------------------------------------------------------------------
+r2140 | zimmerma | 2003-01-07 09:25:47 +0000 (Tue, 07 Jan 2003) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/set_ld.c
+
+added macro LONGDOUBLE_ISNAN
+use LONGDOUBLE_ISNAN in set_ld instead of cast to double and DOUBLE_ISNAN
+(did raise exception under freebsd)
+
+------------------------------------------------------------------------
+r2139 | vlefevre | 2003-01-07 01:46:51 +0000 (Tue, 07 Jan 2003) | 4 lines
+Changed paths:
+ M /trunk/exp2.c
+
+Added assertions that can be resolved at compile time: the exponents
+must be representable in a long int (IMHO, this limitation should be
+avoided in a clean way).
+
+------------------------------------------------------------------------
+r2138 | ryde | 2003-01-06 21:56:38 +0000 (Mon, 06 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove mpfr_get_ld, done.
+
+------------------------------------------------------------------------
+r2137 | ryde | 2003-01-06 21:53:01 +0000 (Mon, 06 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove mpfr_set_machine_rnd_mode, done.
+
+------------------------------------------------------------------------
+r2136 | vlefevre | 2003-01-06 21:48:33 +0000 (Mon, 06 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+Bug fix: __mpfr_emax -> __gmpfr_emax.
+
+------------------------------------------------------------------------
+r2135 | ryde | 2003-01-06 21:47:37 +0000 (Mon, 06 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Use separate function calls to second strncasecmp and strncmp
+for consistency and to avoid gcc warnings.
+
+------------------------------------------------------------------------
+r2134 | zimmerma | 2003-01-06 19:28:25 +0000 (Mon, 06 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/tests/texp2.c
+
+fixed infinite loop for 2^integer
+
+------------------------------------------------------------------------
+r2133 | vlefevre | 2003-01-06 10:30:52 +0000 (Mon, 06 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Use digit_value_in_base for the part after the '.'.
+
+------------------------------------------------------------------------
+r2132 | vlefevre | 2003-01-06 10:11:15 +0000 (Mon, 06 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Static function digit_value_in_base is now compatible with any locale.
+
+------------------------------------------------------------------------
+r2131 | ryde | 2003-01-03 23:07:37 +0000 (Fri, 03 Jan 2003) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tests.c
+
+(<sys/fpu.h>) [__mips]: Move from mpfr-test.h to tests/tests.c,
+and conditionalize with HAVE_SYS_FPU_H.
+
+------------------------------------------------------------------------
+r2130 | ryde | 2003-01-03 23:03:35 +0000 (Fri, 03 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(AC_CHECK_HEADERS): Add sys/fpu.h.
+
+------------------------------------------------------------------------
+r2129 | ryde | 2003-01-03 23:02:12 +0000 (Fri, 03 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+(HAVE_DENORMS) [__mips]: Remove this, let the configure test decide.
+
+------------------------------------------------------------------------
+r2128 | ryde | 2003-01-03 21:47:20 +0000 (Fri, 03 Jan 2003) | 4 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Use separate function calls to strncasecmp and strncmp, rather than
+?: on function pointers, since the latter demands declarations not
+present on SunOS. Both forms are optimized the same by gcc.
+
+------------------------------------------------------------------------
+r2127 | vlefevre | 2003-01-03 21:38:33 +0000 (Fri, 03 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Added some potential bugs (mpfr_exp2 is known to have such a bug).
+
+------------------------------------------------------------------------
+r2126 | ryde | 2003-01-02 23:48:32 +0000 (Thu, 02 Jan 2003) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tset_str.c
+
+Add gmp-impl.h for __gmp_free_func.
+
+------------------------------------------------------------------------
+r2125 | vlefevre | 2002-12-16 00:56:03 +0000 (Mon, 16 Dec 2002) | 15 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/factorial.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/get_d.c
+ M /trunk/get_str.c
+ M /trunk/get_z_exp.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/next.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_exp.c
+ M /trunk/set_nan.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tests.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_pow.c
+
+Suppress some #define and fix symbol names (makes code cleaner):
+perl -pi -e 's/__mpfr_flags/__gmpfr_flags/g' **/*.{c,h}
+perl -pi -e 's/__mpfr_emin/__gmpfr_emin/g' **/*.{c,h}
+perl -pi -e 's/__mpfr_emax/__gmpfr_emax/g' **/*.{c,h}
+perl -pi -e 's/__mpfr_default_fp_bit_precision/__gmpfr_default_fp_bit_precision/g' **/*.{c,h}
+perl -pi -e 's/__gmp_default_rounding_mode/__gmpfr_default_rounding_mode/g' **/*.{c,h}
+perl -pi -e 's/__mpfr_const_log2_prec/__gmpfr_const_log2_prec/g' **/*.{c,h}
+perl -pi -e 's/__mpfr_const_pi_prec/__gmpfr_const_pi_prec/g' **/*.{c,h}
+perl -pi -e 's/_mpfr_ceil_log2/__gmpfr_ceil_log2/g' **/*.{c,h}
+perl -pi -e 's/_mpfr_floor_log2/__gmpfr_floor_log2/g' **/*.{c,h}
+perl -pi -e 's/_mpfr_ceil_exp2/__gmpfr_ceil_exp2/g' **/*.{c,h}
+perl -pi -e 's/_mpfr_isqrt/__gmpfr_isqrt/g' **/*.{c,h}
+perl -pi -e 's/_mpfr_cuberoot/__gmpfr_cuberoot/g' **/*.{c,h}
+perl -pi -e 's/^#define __gmpfr_.*\n//' *.h
+
+------------------------------------------------------------------------
+r2124 | vlefevre | 2002-12-13 18:06:58 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2123 | vlefevre | 2002-12-13 18:01:04 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+IEEE 754 / IEEE P754 -> IEEE 754-1985.
+
+------------------------------------------------------------------------
+r2122 | vlefevre | 2002-12-13 11:20:28 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Correction.
+
+------------------------------------------------------------------------
+r2121 | vlefevre | 2002-12-13 11:19:25 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Added a note about the signed zero.
+
+------------------------------------------------------------------------
+r2120 | vlefevre | 2002-12-13 02:35:45 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Assertion re-added.
+
+------------------------------------------------------------------------
+r2119 | vlefevre | 2002-12-13 02:34:50 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/missing
+
+Update for new version of automake/autoconf.
+
+------------------------------------------------------------------------
+r2118 | vlefevre | 2002-12-13 02:23:23 +0000 (Fri, 13 Dec 2002) | 2 lines
+Changed paths:
+ A /trunk/depcomp
+
+depcomp script added for new version of automake.
+
+------------------------------------------------------------------------
+r2117 | ryde | 2002-12-12 22:30:05 +0000 (Thu, 12 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Don't -D define PACKAGE_VERSION etc, to avoid conflict with gmp config.h.
+
+------------------------------------------------------------------------
+r2116 | zimmerma | 2002-12-12 16:41:43 +0000 (Thu, 12 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added paragraph about accuracy
+
+------------------------------------------------------------------------
+r2115 | zimmerma | 2002-12-12 15:32:52 +0000 (Thu, 12 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+rewritten unclear paragraph about precision
+
+------------------------------------------------------------------------
+r2114 | zimmerma | 2002-12-12 14:42:42 +0000 (Thu, 12 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item
+
+------------------------------------------------------------------------
+r2113 | zimmerma | 2002-12-12 14:38:03 +0000 (Thu, 12 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+use MPN_NORMALIZE_NOT_ZERO instead of loop
+
+------------------------------------------------------------------------
+r2112 | vlefevre | 2002-12-11 14:31:28 +0000 (Wed, 11 Dec 2002) | 3 lines
+Changed paths:
+ M /trunk/tests/memory.c
+
+Added #include "mpfr.h" (needed by mpfr-test.h as it uses
+mp_rnd_t in one of the prototypes).
+
+------------------------------------------------------------------------
+r2111 | vlefevre | 2002-12-10 22:23:04 +0000 (Tue, 10 Dec 2002) | 5 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Patch by Torbjorn Granlund <tege@swox.com>: Don't use TMP_ allocation
+mechanism for fixed size objects. Resulting streamlining. Misc
+addressing changes to work around GNUPro bugs.
+Patch by VL: Some other changes in mpfr_set_d.
+
+------------------------------------------------------------------------
+r2110 | vlefevre | 2002-12-07 12:26:11 +0000 (Sat, 07 Dec 2002) | 3 lines
+Changed paths:
+ M /trunk/const_euler.c
+
+(mpfr_const_euler_S, mpfr_const_euler_R)
+Make declaration match prototype (patch by Torbjorn Granlund).
+
+------------------------------------------------------------------------
+r2109 | vlefevre | 2002-12-04 11:22:24 +0000 (Wed, 04 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/config.guess
+ M /trunk/config.sub
+
+Update from ftp://ftp.gnu.org/pub/gnu/config/
+
+------------------------------------------------------------------------
+r2108 | zimmerma | 2002-12-03 13:32:21 +0000 (Tue, 03 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Use @ifnottex/@end iffnotex instead of @ifinfo/@end ifinfo
+
+------------------------------------------------------------------------
+r2107 | vlefevre | 2002-12-02 11:44:35 +0000 (Mon, 02 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/rnd_mode.c
+
+Fix rnd_mode.c (again).
+
+------------------------------------------------------------------------
+r2106 | zimmerma | 2002-12-02 09:44:41 +0000 (Mon, 02 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+put redefinitions of external symbols just before prototypes
+
+------------------------------------------------------------------------
+r2105 | zimmerma | 2002-12-02 09:23:47 +0000 (Mon, 02 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated
+
+------------------------------------------------------------------------
+r2104 | zimmerma | 2002-12-02 09:21:40 +0000 (Mon, 02 Dec 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+added new known bugs
+
+------------------------------------------------------------------------
+r2103 | ryde | 2002-11-29 23:05:47 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Add notes on mpf_t maintaining actual size for efficiency.
+
+------------------------------------------------------------------------
+r2102 | ryde | 2002-11-29 22:52:20 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove mpfr_set_machine_rnd_mode task.
+
+------------------------------------------------------------------------
+r2101 | ryde | 2002-11-29 22:51:58 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Tweak some math formatting for tex.
+
+------------------------------------------------------------------------
+r2100 | ryde | 2002-11-29 22:45:40 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+
+(mpfr_set_machine_rnd_mode): Move prototype to mpfr-test.h.
+
+------------------------------------------------------------------------
+r2099 | ryde | 2002-11-29 22:42:19 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+(libfrtests_a_SOURCES): Add rnd_mode.c.
+
+------------------------------------------------------------------------
+r2098 | ryde | 2002-11-29 22:41:57 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+(libmpfr_a_SOURCES): Remove rnd_mode.c.
+
+------------------------------------------------------------------------
+r2097 | ryde | 2002-11-29 22:40:40 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ D /trunk/rnd_mode.c
+
+Remove file, moved to tests directory.
+
+------------------------------------------------------------------------
+r2096 | ryde | 2002-11-29 22:40:01 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ A /trunk/tests/rnd_mode.c
+
+New file, moved from top-level directory.
+
+------------------------------------------------------------------------
+r2095 | ryde | 2002-11-29 22:22:40 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Rounding Modes): Remove mpfr_set_machine_rnd_mode.
+
+------------------------------------------------------------------------
+r2094 | ryde | 2002-11-29 21:42:11 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/setmin.c
+
+Use GNU style code layout.
+
+------------------------------------------------------------------------
+r2093 | ryde | 2002-11-29 21:35:59 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/setmax.c
+
+Use GNU style code layout.
+
+------------------------------------------------------------------------
+r2092 | zimmerma | 2002-11-29 17:26:31 +0000 (Fri, 29 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+redefined external symbols in the __gmpfr namespace
+
+------------------------------------------------------------------------
+r2091 | zimmerma | 2002-11-25 17:04:36 +0000 (Mon, 25 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+added one fprintf in case of error
+
+------------------------------------------------------------------------
+r2090 | vlefevre | 2002-11-25 16:11:33 +0000 (Mon, 25 Nov 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/rnd_mode.c
+
+mpfr_set_machine_rnd_mode fixed to compile on some architectures
+(e.g. ARM). Now returns an int.
+
+------------------------------------------------------------------------
+r2089 | vlefevre | 2002-11-25 15:30:56 +0000 (Mon, 25 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r2088 | zimmerma | 2002-11-25 12:54:49 +0000 (Mon, 25 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+removed all tests that compare to libm
+
+------------------------------------------------------------------------
+r2087 | zimmerma | 2002-11-25 10:54:35 +0000 (Mon, 25 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+changed to distinguish mpfr failures from libm failures
+
+------------------------------------------------------------------------
+r2086 | zimmerma | 2002-11-25 10:37:43 +0000 (Mon, 25 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added 3 tests that make libm fail under HP-PA
+
+------------------------------------------------------------------------
+r2085 | vlefevre | 2002-11-23 23:47:18 +0000 (Sat, 23 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2084 | zimmerma | 2002-11-22 10:40:05 +0000 (Fri, 22 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+forgot to remove debug statement
+
+------------------------------------------------------------------------
+r2083 | zimmerma | 2002-11-22 10:26:38 +0000 (Fri, 22 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/ui_pow.c
+
+fixed bug (infinite loop) for exact powers
+
+------------------------------------------------------------------------
+r2082 | ryde | 2002-11-21 22:28:44 +0000 (Thu, 21 Nov 2002) | 3 lines
+Changed paths:
+ M /trunk/TODO
+
+More on tuned thresholds, more on config.h etc, new section on mpf/mpfr
+integration.
+
+------------------------------------------------------------------------
+r2081 | vlefevre | 2002-11-20 14:34:08 +0000 (Wed, 20 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Code clean-up.
+
+------------------------------------------------------------------------
+r2080 | zimmerma | 2002-11-20 13:08:23 +0000 (Wed, 20 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/log.c
+ M /trunk/set_ld.c
+
+fixed some problems found by insure
+
+------------------------------------------------------------------------
+r2079 | zimmerma | 2002-11-20 11:03:21 +0000 (Wed, 20 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+forgotten fclose() call
+
+------------------------------------------------------------------------
+r2078 | zimmerma | 2002-11-20 10:13:01 +0000 (Wed, 20 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+fixed array bound write
+
+------------------------------------------------------------------------
+r2077 | zimmerma | 2002-11-19 16:46:45 +0000 (Tue, 19 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed non-ansi features
+
+------------------------------------------------------------------------
+r2076 | zimmerma | 2002-11-19 16:26:22 +0000 (Tue, 19 Nov 2002) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/div_ui.c
+
+added explicit cast
+
+------------------------------------------------------------------------
+r2075 | zimmerma | 2002-10-24 12:04:59 +0000 (Thu, 24 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_cbrt
+
+------------------------------------------------------------------------
+r2074 | vlefevre | 2002-10-20 09:46:03 +0000 (Sun, 20 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r2073 | zimmerma | 2002-10-20 07:43:07 +0000 (Sun, 20 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+fixed bug with wrong sign detection
+
+------------------------------------------------------------------------
+r2072 | vlefevre | 2002-10-19 10:25:49 +0000 (Sat, 19 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+Some fixes to avoid overflows.
+
+------------------------------------------------------------------------
+r2071 | zimmerma | 2002-10-19 08:08:47 +0000 (Sat, 19 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+fixed bug for large arguments
+
+------------------------------------------------------------------------
+r2070 | zimmerma | 2002-10-19 08:08:15 +0000 (Sat, 19 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/cbrt.c
+
+improved code for rounding to nearest
+
+------------------------------------------------------------------------
+r2069 | zimmerma | 2002-10-19 08:05:45 +0000 (Sat, 19 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/asinh.c
+
+fixed bug for EXP(x) > EMAX/2
+
+------------------------------------------------------------------------
+r2068 | zimmerma | 2002-10-19 08:04:51 +0000 (Sat, 19 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+modified description of hypot and cbrt
+
+------------------------------------------------------------------------
+r2067 | vlefevre | 2002-10-18 14:57:01 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r2066 | vlefevre | 2002-10-18 14:53:53 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+Added test showing bug in sign detection.
+
+------------------------------------------------------------------------
+r2065 | vlefevre | 2002-10-18 13:45:02 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+Added newline.
+
+------------------------------------------------------------------------
+r2064 | vlefevre | 2002-10-18 12:39:07 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Bug in mpfr_hypot.
+
+------------------------------------------------------------------------
+r2063 | vlefevre | 2002-10-18 12:26:16 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+Added test that makes mpfr_hypot fail.
+
+------------------------------------------------------------------------
+r2062 | vlefevre | 2002-10-18 12:06:17 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+Precision Nt: int -> mp_prec_t.
+
+------------------------------------------------------------------------
+r2061 | vlefevre | 2002-10-18 10:21:31 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tcbrt.c
+
+Added some tests.
+
+------------------------------------------------------------------------
+r2060 | vlefevre | 2002-10-18 09:58:41 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tcbrt.c
+
+main () -> main (void).
+
+------------------------------------------------------------------------
+r2059 | zimmerma | 2002-10-18 07:00:18 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tcbrt.c
+
+added tcbrt.c, test file for mpfr_cbrt
+
+------------------------------------------------------------------------
+r2058 | zimmerma | 2002-10-18 06:58:51 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+fixed overflow problem
+
+------------------------------------------------------------------------
+r2057 | zimmerma | 2002-10-18 06:58:08 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/cbrt.c
+
+completely rewritten using mpz_root
+
+------------------------------------------------------------------------
+r2056 | zimmerma | 2002-10-18 06:57:14 +0000 (Fri, 18 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added cbrt
+
+------------------------------------------------------------------------
+r2055 | vlefevre | 2002-10-17 16:48:10 +0000 (Thu, 17 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+C9X -> ISO/IEC 9899:1999 (ISO C99).
+
+------------------------------------------------------------------------
+r2054 | vlefevre | 2002-10-17 16:03:57 +0000 (Thu, 17 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+Cases NaN and -0.0 taken into account.
+
+------------------------------------------------------------------------
+r2053 | zimmerma | 2002-10-17 15:37:00 +0000 (Thu, 17 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+added check for +0 and -0
+
+------------------------------------------------------------------------
+r2052 | zimmerma | 2002-10-17 15:13:09 +0000 (Thu, 17 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+added one test (2^1024)
+
+------------------------------------------------------------------------
+r2051 | zimmerma | 2002-10-17 15:11:54 +0000 (Thu, 17 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+fixed bug when overflow for double type
+
+------------------------------------------------------------------------
+r2050 | zimmerma | 2002-10-17 12:56:49 +0000 (Thu, 17 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_set_ld and mpfr_get_ld
+
+------------------------------------------------------------------------
+r2049 | vlefevre | 2002-10-16 18:37:48 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/get_ld.c
+
+Fix for -0.0.
+
+------------------------------------------------------------------------
+r2048 | zimmerma | 2002-10-16 18:21:54 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ A /trunk/log_b2.h
+
+constants for mpfr_get_str and mpfr_set_str
+
+------------------------------------------------------------------------
+r2047 | vlefevre | 2002-10-16 16:25:56 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Obsolete comment removed.
+
+------------------------------------------------------------------------
+r2046 | vlefevre | 2002-10-16 16:23:35 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Removed log_b2.h as it doesn't seem to be necessary.
+
+------------------------------------------------------------------------
+r2045 | zimmerma | 2002-10-16 15:41:24 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_get_ld
+
+------------------------------------------------------------------------
+r2044 | zimmerma | 2002-10-16 15:40:19 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_ld.c
+ M /trunk/tests/tset_ld.c
+
+added mpfr_get_ld and tests for set_ld/get_ld
+
+------------------------------------------------------------------------
+r2043 | zimmerma | 2002-10-16 15:38:46 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+added cast to long double
+
+------------------------------------------------------------------------
+r2042 | vlefevre | 2002-10-16 10:08:09 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update (tset_ld).
+
+------------------------------------------------------------------------
+r2041 | vlefevre | 2002-10-16 08:13:25 +0000 (Wed, 16 Oct 2002) | 4 lines
+Changed paths:
+ M /trunk/tests/tset_ld.c
+
+Test removed as the minimal precision for a long double is something
+like 10 decimal digits. Anyway, there are implementations for which
+long double = double = IEEE double precision.
+
+------------------------------------------------------------------------
+r2040 | vlefevre | 2002-10-16 07:38:15 +0000 (Wed, 16 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/set_ld.c
+
+DBL_MANT_DIG and LDBL_MANT_DIG are normally defined by <float.h>.
+
+------------------------------------------------------------------------
+r2039 | zimmerma | 2002-10-15 14:58:26 +0000 (Tue, 15 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ A /trunk/set_ld.c
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tset_ld.c
+
+added mpfr_set_ld and test file
+
+------------------------------------------------------------------------
+r2038 | vlefevre | 2002-10-13 14:12:46 +0000 (Sun, 13 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Bug in mpfr_sin (and perhaps other functions): error analysis.
+
+------------------------------------------------------------------------
+r2037 | vlefevre | 2002-10-13 13:54:45 +0000 (Sun, 13 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Bug fixed (found by Dmitrii Baksheyev): atan(1) cannot be exact.
+
+------------------------------------------------------------------------
+r2036 | ryde | 2002-10-08 01:41:21 +0000 (Tue, 08 Oct 2002) | 5 lines
+Changed paths:
+ M /trunk/TODO
+
+Remove mpfr_get_str using mpn_get_str (done).
+Remove no grepping for __setfpucw, done (near enough).
+New thread-safety section, add const_pi and const_log2 caching.
+New portability section, add mingw random and _mpfr_ceil_log2 IEEE-ism.
+
+------------------------------------------------------------------------
+r2035 | ryde | 2002-10-08 01:38:34 +0000 (Tue, 08 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+(AC_MY_LIBS): Show the filename in the error message.
+
+------------------------------------------------------------------------
+r2034 | zimmerma | 2002-10-04 14:32:53 +0000 (Fri, 04 Oct 2002) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+mpfr_get_default_prec was missing (thanks to F. Morain)
+
+------------------------------------------------------------------------
+r2033 | vlefevre | 2002-09-30 12:22:28 +0000 (Mon, 30 Sep 2002) | 3 lines
+Changed paths:
+ M /trunk/BUGS
+
+Removed get_str.c bug, as the mpfr_get_str function has
+completely been rewritten.
+
+------------------------------------------------------------------------
+r2032 | zimmerma | 2002-09-26 08:15:34 +0000 (Thu, 26 Sep 2002) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed wrong inexact flag for a - b where a and b are of different signs
+and EXP(a) < EXP(b)
+
+------------------------------------------------------------------------
+r2031 | zimmerma | 2002-09-26 08:00:09 +0000 (Thu, 26 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added test for inexact flag (bug found by Andreas Enge)
+
+------------------------------------------------------------------------
+r2030 | ryde | 2002-09-23 22:51:26 +0000 (Mon, 23 Sep 2002) | 3 lines
+Changed paths:
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_prec.c
+
+(mpfr_init, mpfr_init2, mpfr_set_prec): Make void return, these always
+succeed.
+
+------------------------------------------------------------------------
+r2029 | zimmerma | 2002-09-23 12:25:52 +0000 (Mon, 23 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+fixed various tiny problems
+
+------------------------------------------------------------------------
+r2028 | zimmerma | 2002-09-23 12:19:24 +0000 (Mon, 23 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+added more tests for mpfr_urandomb, and for small precision
+
+------------------------------------------------------------------------
+r2027 | zimmerma | 2002-09-23 08:45:25 +0000 (Mon, 23 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+ M /trunk/tests/trandom.c
+
+fixed bugs in mpfr_random2 (wrong exponent, invalid numbers)
+
+------------------------------------------------------------------------
+r2026 | zimmerma | 2002-09-23 08:42:28 +0000 (Mon, 23 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+added checks for mpfr_random2
+
+------------------------------------------------------------------------
+r2025 | zimmerma | 2002-09-23 08:20:31 +0000 (Mon, 23 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/cmp_abs.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/pow.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tsub.c
+
+cmp_abs -> cmpabs (for compatibility with mpz)
+
+------------------------------------------------------------------------
+r2024 | ryde | 2002-09-21 22:57:26 +0000 (Sat, 21 Sep 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Converting Floats): Don't refer to the internal _mp_free_func with
+mpfr_get_str.
+
+------------------------------------------------------------------------
+r2023 | ryde | 2002-09-21 22:51:58 +0000 (Sat, 21 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+(Special Functions, Internals): Make these into nodes.
+
+------------------------------------------------------------------------
+r2022 | zimmerma | 2002-09-20 16:11:47 +0000 (Fri, 20 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+now accept uppercase letters too
+
+------------------------------------------------------------------------
+r2021 | zimmerma | 2002-09-20 16:07:35 +0000 (Fri, 20 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added test for uppercase letters
+
+------------------------------------------------------------------------
+r2020 | zimmerma | 2002-09-18 15:11:33 +0000 (Wed, 18 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+now mpfr_agm returns an int (inexact flag)
+
+------------------------------------------------------------------------
+r2019 | vlefevre | 2002-09-13 10:11:33 +0000 (Fri, 13 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/prepare
+
+Some more information.
+
+------------------------------------------------------------------------
+r2018 | vlefevre | 2002-09-12 11:50:34 +0000 (Thu, 12 Sep 2002) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+On HP-UX, use the +allowunsats switch for ld, otherwise ld complains
+that some GMP symbols are unsatisfied.
+
+------------------------------------------------------------------------
+r2017 | zimmerma | 2002-09-12 09:54:44 +0000 (Thu, 12 Sep 2002) | 2 lines
+Changed paths:
+ M /trunk/gamma.c
+ M /trunk/tests/tgamma.c
+
+fixed bug in reflection formula for x<1
+
+------------------------------------------------------------------------
+r2016 | vlefevre | 2002-08-23 22:05:08 +0000 (Fri, 23 Aug 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/mpfr.texi
+
+MPFR now needs GMP 4.1 or higher.
+
+------------------------------------------------------------------------
+r2015 | ryde | 2002-08-22 00:56:07 +0000 (Thu, 22 Aug 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-math.h
+
+(__mpfr_nan): Clarify comments about HP C and alpha.
+
+------------------------------------------------------------------------
+r2014 | ryde | 2002-08-22 00:47:22 +0000 (Thu, 22 Aug 2002) | 4 lines
+Changed paths:
+ M /trunk/mpfr-math.h
+
+(_MPFR_NAN_BYTES, _MPFR_INFP_BYTES, _MPFR_INFM_BYTES):
+Use HAVE_DOUBLE_IEEE_LITTLE_ENDIAN etc to select endianness, not a big
+block of #ifdefs.
+
+------------------------------------------------------------------------
+r2013 | vlefevre | 2002-08-12 00:35:25 +0000 (Mon, 12 Aug 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/strcasecmp.c
+ A /trunk/strncasecmp.c
+
+strcasecmp.c -> strcasecmp.c & strncasecmp.c
+
+------------------------------------------------------------------------
+r2012 | ryde | 2002-08-07 01:47:30 +0000 (Wed, 07 Aug 2002) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Use $(top_builddir) consistently with libmpfr.a, for the benefit of
+srcdir!=builddir.
+
+------------------------------------------------------------------------
+r2011 | vlefevre | 2002-08-02 23:36:46 +0000 (Fri, 02 Aug 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Don't touch user specified flags (CFLAGS). [patch by Kevin Ryde]
+
+------------------------------------------------------------------------
+r2010 | vlefevre | 2002-07-30 03:19:37 +0000 (Tue, 30 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-impl.h
+ M /trunk/set_str.c
+
+Better check for strcasecmp and strncasecmp. Bug fixed.
+
+------------------------------------------------------------------------
+r2009 | vlefevre | 2002-07-28 23:48:20 +0000 (Sun, 28 Jul 2002) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ A /trunk/comparisons.c
+ M /trunk/mpfr.h
+
+Functions mpfr_greater_p, mpfr_greaterequal_p, mpfr_less_p,
+mpfr_lessequal_p, mpfr_lessgreater_p, mpfr_equal_p, mpfr_unordered_p.
+
+------------------------------------------------------------------------
+r2008 | vlefevre | 2002-07-28 01:58:32 +0000 (Sun, 28 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/prepare
+ M /trunk/tests/Makefile.am
+
+Use AUTOMAKE_OPTIONS = gnu [suggested by Kevin Ryde]
+
+------------------------------------------------------------------------
+r2007 | vlefevre | 2002-07-28 01:43:29 +0000 (Sun, 28 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+check target -> TESTS = $(check_PROGRAMS) [suggested by Kevin Ryde]
+
+------------------------------------------------------------------------
+r2006 | vlefevre | 2002-07-28 01:28:54 +0000 (Sun, 28 Jul 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/strcasecmp.c
+
+strcasecmp and strncasecmp -> mpfr_strcasecmp and mpfr_strncasecmp
+if they are provided by MPFR.
+
+------------------------------------------------------------------------
+r2005 | vlefevre | 2002-07-28 00:50:51 +0000 (Sun, 28 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+TMP_MARK missing (patch by Kevin Ryde).
+
+------------------------------------------------------------------------
+r2004 | vlefevre | 2002-07-26 17:53:53 +0000 (Fri, 26 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r2003 | vlefevre | 2002-07-26 17:49:03 +0000 (Fri, 26 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/README
+ M /trunk/README.dev
+
+Update (mainly concerning CVS use).
+
+------------------------------------------------------------------------
+r2002 | vlefevre | 2002-07-26 15:52:58 +0000 (Fri, 26 Jul 2002) | 5 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/mpfr-impl.h
+ M /trunk/next.c
+ M /trunk/setmax.c
+ M /trunk/setmin.c
+
+Prototype of mpfr_setmax and mpfr_setmin changed (exponent given).
+In mpfr_exp for x ~= 0, add_one_ulp and sub_one_ulp are no longer
+used (sub_one_ulp was incorrect). These cases should now be faster.
+Small fix in mpfr_nextabove, mpfr_nextbelow and mpfr_nexttoward.
+
+------------------------------------------------------------------------
+r2001 | vlefevre | 2002-07-26 15:21:45 +0000 (Fri, 26 Jul 2002) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/TODO
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/next.c
+ A /trunk/setmax.c
+ A /trunk/setmin.c
+ M /trunk/sub_one_ulp.c
+
+New internal functions mpfr_setmin and mpfr_setmax.
+New functions mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward.
+Small fix in mpfr_sub_one_ulp.
+
+------------------------------------------------------------------------
+r2000 | zimmerma | 2002-07-26 13:24:45 +0000 (Fri, 26 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+improved the computation of g = ceil((e-1)/log_2(beta)), using two tables
+
+------------------------------------------------------------------------
+r1999 | vlefevre | 2002-07-25 15:43:49 +0000 (Thu, 25 Jul 2002) | 5 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.texi
+ M /trunk/save_expo.c
+ M /trunk/set_q.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+ M /trunk/ui_pow_ui.c
+
+Function mpfr_check_range now propagates the inexact ternary value.
+Function mpfr_restore_emin_emax OR's the saved flags with the current
+flags, as this is more useful in general.
+Macro MPFR_RESTORE_RET removed (no longer useful).
+
+------------------------------------------------------------------------
+r1998 | vlefevre | 2002-07-24 17:38:21 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/frac.c
+
+Change concerning an assertion, due to GMP limitation.
+
+------------------------------------------------------------------------
+r1997 | zimmerma | 2002-07-24 16:35:02 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+gnu indentation
+
+------------------------------------------------------------------------
+r1996 | zimmerma | 2002-07-24 16:32:49 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tgamma.c
+
+reduce range of tests (did take too much time)
+
+------------------------------------------------------------------------
+r1995 | zimmerma | 2002-07-24 16:31:00 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added plenty of new cases, now covers all lines of get_str.c
+
+------------------------------------------------------------------------
+r1994 | zimmerma | 2002-07-24 16:29:40 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+updated documentation of mpfr_get_str
+
+------------------------------------------------------------------------
+r1993 | zimmerma | 2002-07-24 16:28:21 +0000 (Wed, 24 Jul 2002) | 4 lines
+Changed paths:
+ M /trunk/get_str.c
+
+completely new version, written by Alain Delplanque and Paul Zimmermann.
+It now directly uses mpn_get_str, with subquadratic complexity.
+About 3 times faster than previous version in most cases.
+
+------------------------------------------------------------------------
+r1992 | vlefevre | 2002-07-24 16:23:27 +0000 (Wed, 24 Jul 2002) | 3 lines
+Changed paths:
+ M /trunk/frac.c
+
+Bug fixed: unsigned int variables changed to int to avoid operations
+with mixed signed/unsigned variables and unwanted casts.
+
+------------------------------------------------------------------------
+r1991 | vlefevre | 2002-07-24 16:04:16 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/frac.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tfrac.c
+
+Function mpfr_frac and tests added.
+
+------------------------------------------------------------------------
+r1990 | vlefevre | 2002-07-24 15:05:51 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+Bug fixed (0 was forgotten).
+
+------------------------------------------------------------------------
+r1989 | vlefevre | 2002-07-24 11:11:07 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/isinteger.c
+
+Optimization: mpfr_trunc no longer used!
+
+------------------------------------------------------------------------
+r1988 | vlefevre | 2002-07-24 10:13:00 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/isinteger.c
+
+mpfr_isinteger extended to non-fp numbers and to zero.
+
+------------------------------------------------------------------------
+r1987 | vlefevre | 2002-07-24 09:59:01 +0000 (Wed, 24 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/isnum.c
+
+Simpler test.
+
+------------------------------------------------------------------------
+r1986 | vlefevre | 2002-07-23 17:19:47 +0000 (Tue, 23 Jul 2002) | 2 lines
+Changed paths:
+ A /trunk/mul.c
+
+Re-adding mul.c with fixed permissions.
+
+------------------------------------------------------------------------
+r1985 | vlefevre | 2002-07-23 17:18:56 +0000 (Tue, 23 Jul 2002) | 2 lines
+Changed paths:
+ D /trunk/mul.c
+
+Temporarily removing mul.c in order to try to fix its permissions.
+
+------------------------------------------------------------------------
+r1984 | vlefevre | 2002-07-23 16:22:08 +0000 (Tue, 23 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Fixed permissions.
+
+------------------------------------------------------------------------
+r1983 | vlefevre | 2002-07-23 16:02:30 +0000 (Tue, 23 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/tests/texceptions.c
+
+Function mpfr_check_range improved in the underflow case.
+
+------------------------------------------------------------------------
+r1982 | vlefevre | 2002-07-22 15:52:33 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r1981 | zimmerma | 2002-07-22 15:22:13 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/dump.c
+
+now dump in base 2
+
+------------------------------------------------------------------------
+r1980 | zimmerma | 2002-07-22 15:11:50 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+forgot one free() call
+
+------------------------------------------------------------------------
+r1979 | vlefevre | 2002-07-22 13:57:15 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+mpfr_pow bug removed.
+
+------------------------------------------------------------------------
+r1978 | vlefevre | 2002-07-22 13:54:55 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Reindentation.
+
+------------------------------------------------------------------------
+r1977 | vlefevre | 2002-07-22 13:51:20 +0000 (Mon, 22 Jul 2002) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+pow.c: bug fixed (in the call to mpfr_can_round).
+tpow.c: mpfr_clear added.
+
+------------------------------------------------------------------------
+r1976 | vlefevre | 2002-07-22 13:26:54 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Modified the two tests to make the bug appear.
+
+------------------------------------------------------------------------
+r1975 | zimmerma | 2002-07-22 09:37:31 +0000 (Mon, 22 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added two tests
+
+------------------------------------------------------------------------
+r1974 | vlefevre | 2002-07-19 15:31:23 +0000 (Fri, 19 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Updated note concerning rcs2log.
+
+------------------------------------------------------------------------
+r1973 | vlefevre | 2002-07-19 11:31:30 +0000 (Fri, 19 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Line mpfr_get_exp / mpfr_set_exp removed.
+
+------------------------------------------------------------------------
+r1972 | zimmerma | 2002-07-16 15:33:31 +0000 (Tue, 16 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added function check_large
+
+------------------------------------------------------------------------
+r1971 | vlefevre | 2002-07-15 13:16:15 +0000 (Mon, 15 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/config.guess
+ M /trunk/config.sub
+
+Update from ftp://ftp.gnu.org/pub/gnu/config/
+
+------------------------------------------------------------------------
+r1970 | vlefevre | 2002-07-14 23:44:41 +0000 (Sun, 14 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-math.h
+
+Add __sparc__ (patch by Nix <nix@esperi.demon.co.uk>).
+
+------------------------------------------------------------------------
+r1969 | vlefevre | 2002-07-14 23:39:13 +0000 (Sun, 14 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Note about randomized tests.
+
+------------------------------------------------------------------------
+r1968 | vlefevre | 2002-07-04 15:09:17 +0000 (Thu, 04 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Bug concerning the rounding of pow().
+
+------------------------------------------------------------------------
+r1967 | vlefevre | 2002-07-04 14:26:00 +0000 (Thu, 04 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+mpfr_pow() didn't work when the exponent was a negative integer.
+
+------------------------------------------------------------------------
+r1966 | vlefevre | 2002-07-04 14:25:40 +0000 (Thu, 04 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/get_z_exp.c
+
+mpfr_get_z_exp() didn't work when the MPFR number was negative.
+
+------------------------------------------------------------------------
+r1965 | vlefevre | 2002-07-04 11:59:27 +0000 (Thu, 04 Jul 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_exp.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ A /trunk/set_exp.c
+
+New functions mpfr_get_exp and mpfr_set_exp.
+
+------------------------------------------------------------------------
+r1964 | zimmerma | 2002-06-27 14:07:06 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed duplicated entry (thread-safe)
+
+------------------------------------------------------------------------
+r1963 | zimmerma | 2002-06-27 13:57:23 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new items
+
+------------------------------------------------------------------------
+r1962 | zimmerma | 2002-06-27 12:55:03 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added special cases
+
+------------------------------------------------------------------------
+r1961 | zimmerma | 2002-06-27 12:50:36 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added one reference (nocite)
+
+------------------------------------------------------------------------
+r1960 | zimmerma | 2002-06-27 12:50:15 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+
+added one reference
+
+------------------------------------------------------------------------
+r1959 | zimmerma | 2002-06-27 12:49:01 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/inp_str.c
+
+fixed bug in return value
+
+------------------------------------------------------------------------
+r1958 | zimmerma | 2002-06-27 12:30:03 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+new additions
+
+------------------------------------------------------------------------
+r1957 | zimmerma | 2002-06-27 09:31:01 +0000 (Thu, 27 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added pointer to mpfr_inp_str in mpfr_set_str
+
+------------------------------------------------------------------------
+r1956 | vlefevre | 2002-06-26 23:55:24 +0000 (Wed, 26 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r1955 | vlefevre | 2002-06-26 23:51:49 +0000 (Wed, 26 Jun 2002) | 3 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/div.c
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/print_raw.c
+ M /trunk/rint.c
+ M /trunk/round_prec.c
+ M /trunk/set.c
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sub1.c
+
+MP_LIMB_T_HIGHBIT -> MPFR_LIMB_HIGHBIT.
+MPFR is now compatible with GMP 4.1.
+
+------------------------------------------------------------------------
+r1954 | vlefevre | 2002-06-15 10:50:23 +0000 (Sat, 15 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Added: make MPFR thread-safe.
+
+------------------------------------------------------------------------
+r1953 | zimmerma | 2002-06-14 13:14:34 +0000 (Fri, 14 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/set_q.c
+
+fixed bug found by Gerardo Ballabio
+
+------------------------------------------------------------------------
+r1952 | zimmerma | 2002-06-14 13:14:08 +0000 (Fri, 14 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_q.c
+
+added one test (bug in mpfr-2.0.1 found by Gerardo Ballabio)
+
+------------------------------------------------------------------------
+r1951 | zimmerma | 2002-06-13 12:44:16 +0000 (Thu, 13 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added mpfr_modf
+
+------------------------------------------------------------------------
+r1950 | vlefevre | 2002-06-12 22:30:26 +0000 (Wed, 12 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Added modf (to implement).
+
+------------------------------------------------------------------------
+r1949 | vlefevre | 2002-06-08 22:58:28 +0000 (Sat, 08 Jun 2002) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tmul.c
+
+check: Apply a hack to the parameter order to make sparc gcc 2.95.2
+happy (patch by Kevin Ryde) + static added.
+
+------------------------------------------------------------------------
+r1948 | vlefevre | 2002-06-08 22:45:57 +0000 (Sat, 08 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Patch by Kevin Ryde.
+
+------------------------------------------------------------------------
+r1947 | vlefevre | 2002-06-08 02:45:27 +0000 (Sat, 08 Jun 2002) | 3 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+
+Suppress tests if sqrt is not affected by mpfr_set_machine_rnd_mode
+(patch by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1946 | vlefevre | 2002-06-08 02:25:49 +0000 (Sat, 08 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r1945 | vlefevre | 2002-06-08 02:20:00 +0000 (Sat, 08 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/README
+
+fdl.texi added.
+
+------------------------------------------------------------------------
+r1944 | vlefevre | 2002-06-08 02:16:07 +0000 (Sat, 08 Jun 2002) | 9 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/README.dev
+ A /trunk/fdl.texi
+ M /trunk/mpfr.texi
+ M /trunk/texinfo.tex
+
+Patch by Kevin Ryde (and Vincent Lefevre).
+mpfr.texi: Change license to FDL, use @copying per texinfo 4.2.
+Use @dircategory, @direntry, @documentdescription.
+Move @contents to start of file.
+(VERSION, UPDATED): New variables.
+(m, GMPtimes, times): New macros.
+(Float Arithmetic): Fix html output. Reported by Richard Dawe.
+(GNU Free Documentation License): New appendix.
+
+------------------------------------------------------------------------
+r1943 | vlefevre | 2002-06-06 11:08:47 +0000 (Thu, 06 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+Use gmp-impl.h to get MPFR_HAVE_FESETROUND (reported by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1942 | zimmerma | 2002-06-05 15:27:23 +0000 (Wed, 05 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+patch for mpfr.texi
+
+------------------------------------------------------------------------
+r1941 | zimmerma | 2002-06-05 15:24:46 +0000 (Wed, 05 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+patch from Richard Dawe <richdawe@bigfoot.com> to generate HTML
+
+------------------------------------------------------------------------
+r1940 | zimmerma | 2002-06-05 15:05:21 +0000 (Wed, 05 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/gamma.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tgamma.c
+
+added mpfr_gamma in libmpfr
+
+------------------------------------------------------------------------
+r1939 | vlefevre | 2002-06-05 01:01:42 +0000 (Wed, 05 Jun 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tests.c
+
+Check for isnan.
+
+------------------------------------------------------------------------
+r1938 | vlefevre | 2002-05-29 13:08:04 +0000 (Wed, 29 May 2002) | 2 lines
+Changed paths:
+ M /trunk/rint.c
+
+Bug fixed (possible integer overflow).
+
+------------------------------------------------------------------------
+r1937 | vlefevre | 2002-05-29 12:48:06 +0000 (Wed, 29 May 2002) | 2 lines
+Changed paths:
+ M /trunk/add_one_ulp.c
+ M /trunk/sub_one_ulp.c
+
+Bug fixed (possible integer overflow).
+
+------------------------------------------------------------------------
+r1936 | vlefevre | 2002-05-29 12:41:19 +0000 (Wed, 29 May 2002) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/sub1.c
+
+Bug fixed (possible integer overflow).
+
+------------------------------------------------------------------------
+r1935 | vlefevre | 2002-05-29 12:21:32 +0000 (Wed, 29 May 2002) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+
+Note added for mpfr_check_range. Bug fixed.
+
+------------------------------------------------------------------------
+r1934 | vlefevre | 2002-05-29 11:37:31 +0000 (Wed, 29 May 2002) | 3 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+Sign wasn't set (reported by Dmitrii Baksheyev).
+Types fixed and code clean-up.
+
+------------------------------------------------------------------------
+r1933 | vlefevre | 2002-05-29 10:56:51 +0000 (Wed, 29 May 2002) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Types fixed and code clean-up.
+
+------------------------------------------------------------------------
+r1932 | vlefevre | 2002-05-27 13:48:56 +0000 (Mon, 27 May 2002) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/memory.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ A /trunk/tests/tests.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+
+Patch by Kevin Ryde for memory leak checking + misc declaration fixes.
+Code moved from mpfr-test.h to tests.c.
+
+------------------------------------------------------------------------
+r1931 | vlefevre | 2002-05-14 23:14:53 +0000 (Tue, 14 May 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Ternary flag for mpfr_agm.
+
+------------------------------------------------------------------------
+r1930 | vlefevre | 2002-05-14 23:03:08 +0000 (Tue, 14 May 2002) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/add.c
+ M /trunk/asin.c
+ M /trunk/atan.c
+ M /trunk/cmp2.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/div.c
+ M /trunk/exceptions.c
+ M /trunk/gamma.c
+ M /trunk/generic.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/isinteger.c
+ M /trunk/mpfi.h
+ M /trunk/out_str.c
+ M /trunk/set_si.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/sub.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tzeta.c
+ M /trunk/ui_div.c
+ M /trunk/zeta.c
+
+Copyright line updated.
+
+------------------------------------------------------------------------
+r1929 | zimmerma | 2002-05-14 14:47:35 +0000 (Tue, 14 May 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+ternary flag for mpfr_agm?
+
+------------------------------------------------------------------------
+r1928 | zimmerma | 2002-05-14 14:37:20 +0000 (Tue, 14 May 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+update wrt mpfr_set_machine_rnd_mode
+
+------------------------------------------------------------------------
+r1927 | zimmerma | 2002-05-14 09:44:27 +0000 (Tue, 14 May 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mathematical description of arithmetico-geometric mean
+
+------------------------------------------------------------------------
+r1926 | vlefevre | 2002-05-08 00:13:28 +0000 (Wed, 08 May 2002) | 4 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/acinclude.m4
+
+The problem on a G4 PowerPC was a bug in gcc; this is now tested
+in configure (float-conversion bug) and -ffloat-store is used if
+need be.
+
+------------------------------------------------------------------------
+r1925 | vlefevre | 2002-05-06 08:37:34 +0000 (Mon, 06 May 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Problem on the G4 PowerPC.
+
+------------------------------------------------------------------------
+r1924 | zimmerma | 2002-04-30 18:49:21 +0000 (Tue, 30 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/pow.c
+ M /trunk/tests/tpow.c
+
+fixed problem (infinite loop) in mpfr_pow for exact powers
+
+------------------------------------------------------------------------
+r1923 | zimmerma | 2002-04-30 09:54:12 +0000 (Tue, 30 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed errors found by Sylvain Pion
+
+------------------------------------------------------------------------
+r1922 | vlefevre | 2002-04-27 23:13:33 +0000 (Sat, 27 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+not relevant -> undefined.
+
+------------------------------------------------------------------------
+r1921 | vlefevre | 2002-04-27 23:07:29 +0000 (Sat, 27 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Some changes concerning the internals and zeros
+(including remarks by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1920 | vlefevre | 2002-04-25 15:40:13 +0000 (Thu, 25 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/mpfr-math.h
+
+Check if HUGE_VAL is supported.
+
+------------------------------------------------------------------------
+r1919 | vlefevre | 2002-04-25 14:03:17 +0000 (Thu, 25 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Changes in mpfr_set_str.
+
+------------------------------------------------------------------------
+r1918 | zimmerma | 2002-04-25 13:45:07 +0000 (Thu, 25 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+update
+
+------------------------------------------------------------------------
+r1917 | zimmerma | 2002-04-25 09:04:20 +0000 (Thu, 25 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+
+mpfr_set_str doesn't require any more a final '\0'
+ and return the number of characters read
+
+------------------------------------------------------------------------
+r1916 | zimmerma | 2002-04-25 09:02:31 +0000 (Thu, 25 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+modified tests for special values
+
+------------------------------------------------------------------------
+r1915 | vlefevre | 2002-04-24 10:25:02 +0000 (Wed, 24 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/cmp_abs.c
+
+Description updated.
+
+------------------------------------------------------------------------
+r1914 | vlefevre | 2002-04-24 10:23:42 +0000 (Wed, 24 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+mpfr_cmp_abs no longer an internal function and described in mpfr.texi.
+In mpfr.texi, a @var{} was forgotten.
+
+------------------------------------------------------------------------
+r1913 | vlefevre | 2002-04-24 10:21:15 +0000 (Wed, 24 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/cmp_abs.c
+
+mpfr_cmp_abs can now be called on zero numbers.
+
+------------------------------------------------------------------------
+r1912 | vlefevre | 2002-04-24 00:21:46 +0000 (Wed, 24 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-math.h
+
+Structures are used to get correct alignment.
+
+------------------------------------------------------------------------
+r1911 | vlefevre | 2002-04-23 23:32:28 +0000 (Tue, 23 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-math.h
+
+_MPFR_INF*_BYTES fix. On alpha, use a "double" for the bytes,
+to avoid a mis-conversion on alpha gcc 3.0.2. (Kevin Ryde)
+
+------------------------------------------------------------------------
+r1910 | vlefevre | 2002-04-23 20:00:42 +0000 (Tue, 23 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mul.c
+ M /trunk/mul_2si.c
+ A /trunk/powerof2.c
+ M /trunk/set_z.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+
+Underflow semantics changed (not tested).
+
+------------------------------------------------------------------------
+r1909 | vlefevre | 2002-04-23 09:35:26 +0000 (Tue, 23 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Code simplified due to change in the maximum exponent range.
+
+------------------------------------------------------------------------
+r1908 | zimmerma | 2002-04-23 09:08:33 +0000 (Tue, 23 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+modifs from Andreas
+
+------------------------------------------------------------------------
+r1907 | vlefevre | 2002-04-22 22:23:26 +0000 (Mon, 22 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-math.h
+
+Union -> array + cast because of the HP compiler.
+
+------------------------------------------------------------------------
+r1906 | vlefevre | 2002-04-20 13:17:37 +0000 (Sat, 20 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Avoid constant floating expression, as this doesn't give the correct
+result with gcc on some Alpha machines. (patch by Paul Zimmermann)
+
+------------------------------------------------------------------------
+r1905 | vlefevre | 2002-04-19 23:19:31 +0000 (Fri, 19 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+RAND_MAX defined if not already defined (as it should be).
+
+------------------------------------------------------------------------
+r1904 | vlefevre | 2002-04-19 23:10:09 +0000 (Fri, 19 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+Include config.h, for the benefit of test programs not using
+gmp-impl.h (Kevin Ryde).
+
+------------------------------------------------------------------------
+r1903 | zimmerma | 2002-04-19 18:16:53 +0000 (Fri, 19 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+added tests in mpfr_test_init for denorms and extended precision
+
+------------------------------------------------------------------------
+r1902 | zimmerma | 2002-04-19 17:22:46 +0000 (Fri, 19 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+mpfr_init and mpfr_init2 now return an int
+
+------------------------------------------------------------------------
+r1901 | vlefevre | 2002-04-19 16:37:15 +0000 (Fri, 19 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/set_q.c
+
+Exponent range saved/restored. Returns NaN when the numerator
+or the denominator is too large for MPFR.
+
+------------------------------------------------------------------------
+r1900 | vlefevre | 2002-04-19 12:26:06 +0000 (Fri, 19 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/div_ui.c
+ M /trunk/mul_ui.c
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+
+Added some assertions (any unsigned long must be representable
+in a mp_limb_t).
+
+------------------------------------------------------------------------
+r1899 | vlefevre | 2002-04-19 12:01:16 +0000 (Fri, 19 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/cmp_si.c
+ M /trunk/mpfr-impl.h
+ M /trunk/set_si.c
+
+SAFE_ABS changed so that it can be used for any unsigned type.
+
+------------------------------------------------------------------------
+r1898 | vlefevre | 2002-04-18 15:36:36 +0000 (Thu, 18 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/set_z.c
+
+Added code to prevent possible integer overflow when the input number
+is very large.
+
+------------------------------------------------------------------------
+r1897 | vlefevre | 2002-04-18 15:22:56 +0000 (Thu, 18 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+New values for exponent range.
+
+------------------------------------------------------------------------
+r1896 | zimmerma | 2002-04-18 14:28:31 +0000 (Thu, 18 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+call get_d with rounding mode in check2, to avoid problems near +Inf
+
+------------------------------------------------------------------------
+r1895 | zimmerma | 2002-04-18 12:10:49 +0000 (Thu, 18 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+2147483647 -> INT_MAX
+
+------------------------------------------------------------------------
+r1894 | zimmerma | 2002-04-18 09:47:02 +0000 (Thu, 18 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/tests/tadd.c
+
+improved ulp() to deal with infinities
+and fixed tadd/check2 to deal with infinities
+
+------------------------------------------------------------------------
+r1893 | zimmerma | 2002-04-17 12:04:21 +0000 (Wed, 17 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+improved documentation of mpfr_set_precset_prec.
+
+------------------------------------------------------------------------
+r1892 | zimmerma | 2002-04-16 16:31:42 +0000 (Tue, 16 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed documentation of cosh/sinh/tanh
+
+------------------------------------------------------------------------
+r1891 | vlefevre | 2002-04-16 13:26:15 +0000 (Tue, 16 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/cmp_si.c
+ M /trunk/cmp_ui.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+mpfr_cmp_ui_2exp and mpfr_cmp_si_2exp rewritten.
+Prototype changed.
+
+------------------------------------------------------------------------
+r1890 | vlefevre | 2002-04-16 00:56:54 +0000 (Tue, 16 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Use AC_CANONICAL_HOST and $host instead of $OS_TYPE and $MACHTYPE
+(patch suggested by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1889 | vlefevre | 2002-04-16 00:51:21 +0000 (Tue, 16 Apr 2002) | 2 lines
+Changed paths:
+ A /trunk/config.guess
+ A /trunk/config.sub
+
+Added files from ftp.gnu.org for automake and AC_CANONICAL_HOST.
+
+------------------------------------------------------------------------
+r1888 | zimmerma | 2002-04-15 17:45:46 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_sub.c
+
+replaced 2.2e-307 by DBL_MIN
+
+------------------------------------------------------------------------
+r1887 | vlefevre | 2002-04-15 16:23:49 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README
+
+Typo: Gnu -> GNU.
+
+------------------------------------------------------------------------
+r1886 | vlefevre | 2002-04-15 15:43:26 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/VERSION
+ M /trunk/mpfr.texi
+
+Update for future 2.0.2.
+
+------------------------------------------------------------------------
+r1884 | vlefevre | 2002-04-15 15:33:49 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for mpfr 2.0.1.
+
+------------------------------------------------------------------------
+r1883 | vlefevre | 2002-04-15 15:32:21 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/VERSION
+ M /trunk/mpfr.texi
+
+Back to version 2.0.1, updated documentation.
+
+------------------------------------------------------------------------
+r1882 | vlefevre | 2002-04-15 14:48:58 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+ M /trunk/VERSION
+
+Post-release commit.
+
+------------------------------------------------------------------------
+r1881 | vlefevre | 2002-04-15 14:38:45 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for mpfr 2.0.1.
+
+------------------------------------------------------------------------
+r1880 | vlefevre | 2002-04-15 14:16:20 +0000 (Mon, 15 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+
+mpfr_cmp_ui_2exp and mpfr_cmp_si_2exp can no longer be called with a NaN.
+Misc bugs fixed.
+
+------------------------------------------------------------------------
+r1879 | zimmerma | 2002-04-15 14:08:47 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+added main changes in version 2.0.1
+
+------------------------------------------------------------------------
+r1878 | vlefevre | 2002-04-15 13:47:24 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/README
+
+Update for "make dist".
+
+------------------------------------------------------------------------
+r1877 | vlefevre | 2002-04-15 13:26:56 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/COPYING
+ A /trunk/COPYING.LIB
+ M /trunk/README
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_str.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inp_str.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/minmax.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfi.c
+ M /trunk/mpfi.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-math.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/rnd_mode.c
+ M /trunk/round_prec.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+COPYING -> COPYING.LIB and GPL re-added.
+
+------------------------------------------------------------------------
+r1876 | vlefevre | 2002-04-15 12:34:08 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r1875 | vlefevre | 2002-04-15 12:13:27 +0000 (Mon, 15 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Removed switches -g -O2 as already done by configure.
+
+------------------------------------------------------------------------
+r1874 | vlefevre | 2002-04-14 22:55:55 +0000 (Sun, 14 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Update.
+
+------------------------------------------------------------------------
+r1873 | vlefevre | 2002-04-14 15:53:55 +0000 (Sun, 14 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Removed useless @iftex...
+
+------------------------------------------------------------------------
+r1872 | vlefevre | 2002-04-14 11:14:31 +0000 (Sun, 14 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update.
+
+------------------------------------------------------------------------
+r1871 | vlefevre | 2002-04-14 10:24:27 +0000 (Sun, 14 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/set_q.c
+
+When q = 0, +0 is returned.
+
+------------------------------------------------------------------------
+r1870 | vlefevre | 2002-04-13 18:32:56 +0000 (Sat, 13 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1869 | vlefevre | 2002-04-13 18:27:39 +0000 (Sat, 13 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/acinclude.m4
+ M /trunk/set_str.c
+ A /trunk/strcasecmp.c
+ M /trunk/tests/tset_str.c
+
+Support for NaN and Inf (case insensitive) in mpfr_set_str. Tests.
+
+------------------------------------------------------------------------
+r1868 | vlefevre | 2002-04-13 01:40:03 +0000 (Sat, 13 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1867 | vlefevre | 2002-04-13 01:22:51 +0000 (Sat, 13 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1866 | vlefevre | 2002-04-13 01:18:54 +0000 (Sat, 13 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Misc changes. Use of AC_CACHE_CHECK.
+
+------------------------------------------------------------------------
+r1865 | vlefevre | 2002-04-12 16:11:14 +0000 (Fri, 12 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/texp.c
+
+Code clean-up.
+
+------------------------------------------------------------------------
+r1864 | vlefevre | 2002-04-12 14:51:26 +0000 (Fri, 12 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1863 | vlefevre | 2002-04-12 14:29:58 +0000 (Fri, 12 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+New tests.
+
+------------------------------------------------------------------------
+r1862 | vlefevre | 2002-04-12 14:29:49 +0000 (Fri, 12 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/get_d.c
+
+mpfr_get_d* fixed.
+
+------------------------------------------------------------------------
+r1861 | vlefevre | 2002-04-12 10:25:34 +0000 (Fri, 12 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/const_log2.c
+
+Types fixed in const_log2.c (this fixes the tconst_log2 crash).
+
+------------------------------------------------------------------------
+r1860 | vlefevre | 2002-04-12 09:58:11 +0000 (Fri, 12 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Added a note about the native SunOS 4 C compiler.
+
+------------------------------------------------------------------------
+r1859 | vlefevre | 2002-04-11 22:37:48 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tconst_log2.c
+
+Type fixed.
+
+------------------------------------------------------------------------
+r1858 | vlefevre | 2002-04-11 16:42:20 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/set_d.c
+
+mpfr_set_d bug fixed, but other bugs still remain...
+
+------------------------------------------------------------------------
+r1857 | vlefevre | 2002-04-11 16:21:50 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/print_rnd_mode.c
+
+NULL was undeclared on some architectures (reported by Torbjorn Granlund).
+
+------------------------------------------------------------------------
+r1856 | vlefevre | 2002-04-11 13:00:43 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+ M /trunk/mpfr-math.h
+
+#include ordering changed for Windows + Cygwin 32.
+
+------------------------------------------------------------------------
+r1855 | vlefevre | 2002-04-11 12:41:54 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+LDFLAGS changed on HP-UX.
+
+------------------------------------------------------------------------
+r1854 | vlefevre | 2002-04-11 03:35:40 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1853 | vlefevre | 2002-04-11 03:29:44 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+Subnormal test in different rounding modes + fix.
+
+------------------------------------------------------------------------
+r1852 | vlefevre | 2002-04-11 02:49:49 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/configure.in
+
+Function MPFR_CONFIGS.
+
+------------------------------------------------------------------------
+r1851 | vlefevre | 2002-04-11 01:54:09 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+Tests added.
+
+------------------------------------------------------------------------
+r1850 | vlefevre | 2002-04-11 01:53:57 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/get_d.c
+
+get_d.c partly rewritten (Paul Zimmermann).
+
+------------------------------------------------------------------------
+r1849 | vlefevre | 2002-04-11 01:36:49 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/set_q.c
+
+#include ordering fixed.
+
+------------------------------------------------------------------------
+r1848 | vlefevre | 2002-04-11 01:24:20 +0000 (Thu, 11 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Check for gcc float-conversion bug.
+
+------------------------------------------------------------------------
+r1847 | vlefevre | 2002-04-10 23:21:41 +0000 (Wed, 10 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/round_prec.c
+
+Added comment for mpfr_round_raw_generic (about using 1-bit precision).
+
+------------------------------------------------------------------------
+r1846 | vlefevre | 2002-04-10 14:05:52 +0000 (Wed, 10 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update (thanks to Nathalie Revol).
+
+------------------------------------------------------------------------
+r1845 | vlefevre | 2002-04-10 12:20:13 +0000 (Wed, 10 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1844 | vlefevre | 2002-04-10 12:13:25 +0000 (Wed, 10 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/rnd_mode.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+HAVE_FESETROUND renamed to MPFR_HAVE_FESETROUND to avoid possible
+name conflict.
+
+------------------------------------------------------------------------
+r1843 | vlefevre | 2002-04-10 00:12:01 +0000 (Wed, 10 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ D /trunk/srandom.h
+
+Added missing headers in libmpfr_a_SOURCES.
+
+------------------------------------------------------------------------
+r1842 | vlefevre | 2002-04-09 23:53:57 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1841 | vlefevre | 2002-04-09 23:48:30 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Possible tconst_log2 crash under Solaris.
+
+------------------------------------------------------------------------
+r1840 | vlefevre | 2002-04-09 23:30:08 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Under OSF, use option -ffloat-store only when the compiler is gcc.
+
+------------------------------------------------------------------------
+r1839 | vlefevre | 2002-04-09 23:11:46 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+include_HEADERS should contain only mpfr.h and mpf2mpfr.h.
+
+------------------------------------------------------------------------
+r1838 | vlefevre | 2002-04-09 13:47:16 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Added code to support fesetround under Solaris.
+
+------------------------------------------------------------------------
+r1837 | vlefevre | 2002-04-09 12:49:54 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+"In case of problem" update.
+
+------------------------------------------------------------------------
+r1836 | vlefevre | 2002-04-09 12:40:11 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Old URL removed.
+
+------------------------------------------------------------------------
+r1835 | vlefevre | 2002-04-09 11:33:14 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Renaming: DIR -> GMPINSTALL, GMPDIR -> GMPBUILD. Bug on IRIX updated.
+
+------------------------------------------------------------------------
+r1834 | vlefevre | 2002-04-09 11:04:42 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Removed note about stack-alloc.h.
+
+------------------------------------------------------------------------
+r1833 | vlefevre | 2002-04-09 10:50:01 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/rnd_mode.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+Check for fenv.h -> check for fesetround.
+
+------------------------------------------------------------------------
+r1832 | vlefevre | 2002-04-09 00:12:01 +0000 (Tue, 09 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README.dev
+
+Added note concerning patch submission.
+
+------------------------------------------------------------------------
+r1831 | vlefevre | 2002-04-08 21:23:50 +0000 (Mon, 08 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Note about overflows. Functions mpfr_{div,mul}_{si,ui} described.
+
+------------------------------------------------------------------------
+r1830 | vlefevre | 2002-04-07 23:22:34 +0000 (Sun, 07 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next (and last?) pre-release.
+
+------------------------------------------------------------------------
+r1829 | vlefevre | 2002-04-07 23:11:04 +0000 (Sun, 07 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Stricter test for HAVE_INFS.
+
+------------------------------------------------------------------------
+r1828 | vlefevre | 2002-04-07 20:20:15 +0000 (Sun, 07 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r1827 | vlefevre | 2002-04-07 20:10:31 +0000 (Sun, 07 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Added note about IRIX.
+
+------------------------------------------------------------------------
+r1826 | vlefevre | 2002-04-07 01:01:01 +0000 (Sun, 07 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1825 | vlefevre | 2002-04-07 00:38:47 +0000 (Sun, 07 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/exp.c
+ M /trunk/exp_2.c
+ M /trunk/get_d.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+mpfr_get_d -> mpfr_get_d1 and mpfr_get_d2 -> mpfr_get_d.
+
+------------------------------------------------------------------------
+r1824 | vlefevre | 2002-04-06 01:01:29 +0000 (Sat, 06 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1823 | vlefevre | 2002-04-06 00:54:50 +0000 (Sat, 06 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+Update.
+
+------------------------------------------------------------------------
+r1822 | vlefevre | 2002-04-05 23:56:33 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+New file from Paul.
+
+------------------------------------------------------------------------
+r1821 | vlefevre | 2002-04-05 12:31:59 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+COPYING.LIB removed.
+
+------------------------------------------------------------------------
+r1820 | vlefevre | 2002-04-05 12:29:11 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/COPYING
+ D /trunk/COPYING.LIB
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/cbrt.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/generic.c
+ M /trunk/get_d.c
+ M /trunk/get_str.c
+ M /trunk/get_z_exp.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inp_str.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/minmax.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfi.c
+ M /trunk/mpfi.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-math.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/rnd_mode.c
+ M /trunk/round_prec.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_inf.c
+ M /trunk/set_nan.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sin_cos.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/srandom.h
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/uceil_exp2.c
+ M /trunk/uceil_log2.c
+ M /trunk/ufloor_log2.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+COPYING.LIB -> COPYING.
+
+------------------------------------------------------------------------
+r1819 | vlefevre | 2002-04-05 12:14:11 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README
+ A /trunk/README.dev
+
+README.dev added.
+
+------------------------------------------------------------------------
+r1818 | zimmerma | 2002-04-05 12:08:31 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+put back label removed by error
+
+------------------------------------------------------------------------
+r1817 | zimmerma | 2002-04-05 12:05:35 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+removed _FPU_RC_NEAREST ... for x86 (not used any more, now use fenv.h)
+
+------------------------------------------------------------------------
+r1816 | zimmerma | 2002-04-05 12:04:40 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/sqrt.c
+
+removed nested TMP_MARK's (problems when configuring gmp with --disable-alloca)
+
+------------------------------------------------------------------------
+r1815 | zimmerma | 2002-04-05 11:47:25 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+fixed pb with two markers (with --disable-alloca)
+
+------------------------------------------------------------------------
+r1814 | vlefevre | 2002-04-05 11:40:58 +0000 (Fri, 05 Apr 2002) | 2 lines
+Changed paths:
+ D /trunk/shortmul.c
+
+Removed (not used).
+
+------------------------------------------------------------------------
+r1813 | zimmerma | 2002-04-05 07:21:21 +0000 (Fri, 05 Apr 2002) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr-test.h
+ M /trunk/rnd_mode.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+use AC_CHECK_HEADERS to check for fenv.h
+and AC_CHECK_FUNCS to check for lrand48
+
+------------------------------------------------------------------------
+r1812 | vlefevre | 2002-04-04 23:44:27 +0000 (Thu, 04 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/README
+
+Added "VERSION" and "prepare" descriptions.
+
+------------------------------------------------------------------------
+r1811 | zimmerma | 2002-04-04 14:20:19 +0000 (Thu, 04 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed bugs found by Nathalie
+
+------------------------------------------------------------------------
+r1810 | vlefevre | 2002-04-04 13:50:20 +0000 (Thu, 04 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1809 | vlefevre | 2002-04-04 13:46:23 +0000 (Thu, 04 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Removed check for extended precision, as no longer used.
+
+------------------------------------------------------------------------
+r1808 | zimmerma | 2002-04-04 11:46:32 +0000 (Thu, 04 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+added check for denormalized numbers
+
+------------------------------------------------------------------------
+r1807 | zimmerma | 2002-04-04 10:19:32 +0000 (Thu, 04 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new functions to implement
+
+------------------------------------------------------------------------
+r1806 | vlefevre | 2002-04-03 16:28:40 +0000 (Wed, 03 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update for the next pre-release.
+
+------------------------------------------------------------------------
+r1805 | vlefevre | 2002-04-03 13:52:42 +0000 (Wed, 03 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+-ffloat-store is a gcc option.
+
+------------------------------------------------------------------------
+r1804 | vlefevre | 2002-04-03 13:40:49 +0000 (Wed, 03 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Added 4th argument to AC_TRY_RUN.
+
+------------------------------------------------------------------------
+r1803 | vlefevre | 2002-04-03 12:12:45 +0000 (Wed, 03 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Re-fix.
+
+------------------------------------------------------------------------
+r1802 | zimmerma | 2002-04-03 10:11:59 +0000 (Wed, 03 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr-test.h
+
+added check for fpu_control.h
+
+------------------------------------------------------------------------
+r1801 | zimmerma | 2002-04-03 10:02:27 +0000 (Wed, 03 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added missing cast to double
+
+------------------------------------------------------------------------
+r1800 | vlefevre | 2002-04-02 23:42:48 +0000 (Tue, 02 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+[ ] used around error message.
+
+------------------------------------------------------------------------
+r1799 | vlefevre | 2002-04-02 15:44:50 +0000 (Tue, 02 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update.
+
+------------------------------------------------------------------------
+r1798 | vlefevre | 2002-04-02 15:36:51 +0000 (Tue, 02 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Check BITS_PER_MP_LIMB and BYTES_PER_MP_LIMB.
+
+------------------------------------------------------------------------
+r1797 | vlefevre | 2002-04-02 12:30:24 +0000 (Tue, 02 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr-impl.h
+ D /trunk/sqrtrem.c
+
+sqrtrem.c removed.
+
+------------------------------------------------------------------------
+r1796 | vlefevre | 2002-04-02 11:50:27 +0000 (Tue, 02 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+New ChangeLog file (generated by rcs2log).
+
+------------------------------------------------------------------------
+r1795 | vlefevre | 2002-04-02 11:42:03 +0000 (Tue, 02 Apr 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Suppress PACKAGE and VERSION definitions for the compiler.
+
+------------------------------------------------------------------------
+r1794 | zimmerma | 2002-04-01 17:28:42 +0000 (Mon, 01 Apr 2002) | 2 lines
+Changed paths:
+ D /trunk/Configure
+
+old file
+
+------------------------------------------------------------------------
+r1793 | zimmerma | 2002-03-31 14:58:47 +0000 (Sun, 31 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+more "internal" changes suggested by Vincent
+
+------------------------------------------------------------------------
+r1792 | zimmerma | 2002-03-31 14:48:14 +0000 (Sun, 31 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added suggestions from Kevin in "internals"
+
+------------------------------------------------------------------------
+r1791 | zimmerma | 2002-03-28 09:01:28 +0000 (Thu, 28 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+added test for denorms
+
+------------------------------------------------------------------------
+r1790 | zimmerma | 2002-03-28 09:01:06 +0000 (Thu, 28 Mar 2002) | 3 lines
+Changed paths:
+ M /trunk/set_d.c
+
+on a 32-bit machine, denormalized numbers with high 32 bits to 0
+were flushed to zero
+
+------------------------------------------------------------------------
+r1789 | zimmerma | 2002-03-27 15:26:18 +0000 (Wed, 27 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+
+sign of sin(-1) was not set
+
+------------------------------------------------------------------------
+r1788 | zimmerma | 2002-03-27 15:25:54 +0000 (Wed, 27 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tasin.c
+
+added check for asin(-1)
+
+------------------------------------------------------------------------
+r1787 | zimmerma | 2002-03-27 14:38:50 +0000 (Wed, 27 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/texp2.c
+
+added one test
+
+------------------------------------------------------------------------
+r1786 | zimmerma | 2002-03-27 14:38:29 +0000 (Wed, 27 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+previous fix was completely wrong
+
+------------------------------------------------------------------------
+r1785 | zimmerma | 2002-03-27 14:37:39 +0000 (Wed, 27 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+
+fixed pb in cmp_si when i = -2^31 (then beware that -1 * i < 0 !!!)
+
+------------------------------------------------------------------------
+r1784 | zimmerma | 2002-03-27 14:09:35 +0000 (Wed, 27 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+added check for underflow
+
+------------------------------------------------------------------------
+r1783 | zimmerma | 2002-03-26 18:39:57 +0000 (Tue, 26 Mar 2002) | 4 lines
+Changed paths:
+ A /trunk/tests/Makefile.in
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+- use mpfr_test_init to initialize harware floats
+- use #ifdef HAVE_INFS when using DBL_NAN, ...
+- fixed some problems with wrongly converted f-p values (esp. under IRIX)
+
+------------------------------------------------------------------------
+r1782 | zimmerma | 2002-03-26 18:36:49 +0000 (Tue, 26 Mar 2002) | 3 lines
+Changed paths:
+ M /trunk/configure.in
+
+use AC_TRY_CPP instead of AC_TRY_RUN for fenv.h
+(otherwise fails on Itanium)
+
+------------------------------------------------------------------------
+r1781 | zimmerma | 2002-03-26 18:35:56 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+added function mpfr_test_init to initialize full IEEE behaviour
+
+------------------------------------------------------------------------
+r1780 | zimmerma | 2002-03-26 18:34:54 +0000 (Tue, 26 Mar 2002) | 3 lines
+Changed paths:
+ M /trunk/fma.c
+
+put back simple algorithm that computes x*y exactly and then
+directly calls mpfr_add, to avoid wrong inexact flags
+
+------------------------------------------------------------------------
+r1779 | zimmerma | 2002-03-26 09:40:54 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tdump.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+
+added 2002 in copyright line
+
+------------------------------------------------------------------------
+r1778 | zimmerma | 2002-03-26 09:40:06 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+fixed problem on x86 (set precision to double to avoid double rounding)
+
+------------------------------------------------------------------------
+r1777 | zimmerma | 2002-03-26 09:36:52 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+added check for valid 1/0, denormalized, and extended precision
+
+------------------------------------------------------------------------
+r1776 | vlefevre | 2002-03-26 09:29:34 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+New-style comment removed.
+
+------------------------------------------------------------------------
+r1775 | zimmerma | 2002-03-26 09:19:05 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added a description of the mpfr_t type in "Internals"
+
+------------------------------------------------------------------------
+r1774 | vlefevre | 2002-03-26 01:50:35 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_sub.c
+
+#include <unistd.h> removed. Redefined macros ABS removed.
+
+------------------------------------------------------------------------
+r1773 | vlefevre | 2002-03-26 01:35:24 +0000 (Tue, 26 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tui_div.c
+
+Patch by Kevin Ryde + misc fixes.
+
+------------------------------------------------------------------------
+r1772 | zimmerma | 2002-03-25 17:10:50 +0000 (Mon, 25 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+replaced getpid() by time(NULL)
+
+------------------------------------------------------------------------
+r1771 | zimmerma | 2002-03-25 14:56:28 +0000 (Mon, 25 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+MPFR_SIZE and sign were incorrectly set [thanks Kevin]
+
+------------------------------------------------------------------------
+r1770 | zimmerma | 2002-03-25 13:53:31 +0000 (Mon, 25 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added check_nan (from Kevin)
+
+------------------------------------------------------------------------
+r1769 | zimmerma | 2002-03-25 13:52:26 +0000 (Mon, 25 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+fixed bug for sqrt(-0) found by Kevin [NaN flag not cleared]
+
+------------------------------------------------------------------------
+r1768 | vlefevre | 2002-03-22 15:28:29 +0000 (Fri, 22 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+Error message now copes with extended precision.
+
+------------------------------------------------------------------------
+r1767 | zimmerma | 2002-03-22 14:41:46 +0000 (Fri, 22 Mar 2002) | 5 lines
+Changed paths:
+ M /trunk/configure.in
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.texi
+ M /trunk/rnd_mode.c
+ M /trunk/tests/tget_d.c
+
+added test in configure for checking rand48 functions (HAVE_RAND48)
+and fenv.h (HAVE_FENV)
+added mpfr_set_machine_rnd_mode (if fenv.h exists)
+replaced TEST by HAVE_FENV
+
+------------------------------------------------------------------------
+r1766 | vlefevre | 2002-03-22 01:48:18 +0000 (Fri, 22 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+Missing #include.
+
+------------------------------------------------------------------------
+r1765 | vlefevre | 2002-03-22 01:25:57 +0000 (Fri, 22 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/set_nan.c
+
+MPFR_RETNAN shouldn't be used as no value is returned.
+
+------------------------------------------------------------------------
+r1764 | vlefevre | 2002-03-22 01:22:29 +0000 (Fri, 22 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/set_inf.c
+
+Regarde 0 as positive rather than negative (though it's better not to use it).
+
+------------------------------------------------------------------------
+r1763 | vlefevre | 2002-03-22 01:09:58 +0000 (Fri, 22 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/isinteger.c
+
+Memory leak (patch by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1762 | zimmerma | 2002-03-21 15:35:48 +0000 (Thu, 21 Mar 2002) | 4 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+replaced rand/lrand48, drand48, srand/srand48 by macros
+ LONG_RAND, DBL_RAND, SEED_RAND
+and time(NULL) by getpid()
+
+------------------------------------------------------------------------
+r1761 | zimmerma | 2002-03-21 15:34:18 +0000 (Thu, 21 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+added macros LONG_RAND, DBL_RAND, SEED_RAND
+
+------------------------------------------------------------------------
+r1760 | zimmerma | 2002-03-21 10:04:49 +0000 (Thu, 21 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added VERSION and mpfr-math.h for "make dist"
+
+------------------------------------------------------------------------
+r1759 | zimmerma | 2002-03-19 16:45:01 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ A /trunk/set_inf.c
+ A /trunk/set_nan.c
+
+new functions
+
+------------------------------------------------------------------------
+r1758 | zimmerma | 2002-03-19 16:44:32 +0000 (Tue, 19 Mar 2002) | 3 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+now use macros DBL_NAN, DBL_POS_INF, DBL_NEG_INF,
+and functions mpfr_set_nan, mpfr_set_inf
+
+------------------------------------------------------------------------
+r1757 | zimmerma | 2002-03-19 16:42:26 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+defined macros for 0/0, 1/0, -1/0
+
+------------------------------------------------------------------------
+r1756 | zimmerma | 2002-03-19 16:40:41 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+added new functions mpfr_set_nan and mpfr_set_inf
+
+------------------------------------------------------------------------
+r1755 | vlefevre | 2002-03-19 15:09:16 +0000 (Tue, 19 Mar 2002) | 3 lines
+Changed paths:
+ A /trunk/VERSION
+ M /trunk/configure.in
+
+File VERSION added. Contains the next version (currently 2.0.1).
+configure.in updated accordingly.
+
+------------------------------------------------------------------------
+r1754 | vlefevre | 2002-03-19 08:47:22 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+ A /trunk/mpfr-math.h
+ M /trunk/tests/tadd.c
+
+Macros MPFR_DBL_NAN, MPFR_DBL_INFP and MPFR_DBL_INFM.
+
+------------------------------------------------------------------------
+r1753 | zimmerma | 2002-03-19 02:11:56 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+MP_LIMB_T_HIGHBIT -> ULONG_HIGHBIT
+
+------------------------------------------------------------------------
+r1752 | zimmerma | 2002-03-19 02:11:30 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+moved code under #ifdef
+
+------------------------------------------------------------------------
+r1751 | zimmerma | 2002-03-19 02:10:50 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+moved code under #ifdef TEST
+
+------------------------------------------------------------------------
+r1750 | zimmerma | 2002-03-19 02:10:13 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+remove variable sizer (not used)
+
+------------------------------------------------------------------------
+r1749 | zimmerma | 2002-03-19 02:09:11 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/cbrt.c
+
+Library GPL -> Lesser GPL
+
+------------------------------------------------------------------------
+r1748 | zimmerma | 2002-03-19 02:00:53 +0000 (Tue, 19 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated
+
+------------------------------------------------------------------------
+r1747 | vlefevre | 2002-03-17 22:13:03 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Some changes in the types.
+
+------------------------------------------------------------------------
+r1746 | zimmerma | 2002-03-17 22:13:02 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+changed Nt variable to signed
+
+------------------------------------------------------------------------
+r1745 | vlefevre | 2002-03-17 22:03:14 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log2.c
+
+Bugs fixed.
+
+------------------------------------------------------------------------
+r1744 | zimmerma | 2002-03-17 17:53:04 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+added back mpfr_sin_cos
+
+------------------------------------------------------------------------
+r1743 | zimmerma | 2002-03-17 17:50:27 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ A /trunk/sin_cos.c
+
+new version (adapted from sin.c)
+
+------------------------------------------------------------------------
+r1742 | zimmerma | 2002-03-17 17:49:08 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/ttan.c
+
+added tests for tan(3*Pi/4) and tan(7*Pi/4)
+
+------------------------------------------------------------------------
+r1741 | zimmerma | 2002-03-17 17:48:38 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tan.c
+
+fixed bug for tan(3*Pi/4) [wrong sign]
+
+------------------------------------------------------------------------
+r1740 | zimmerma | 2002-03-17 17:27:42 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog10.c
+
+added test for log(10^n)
+
+------------------------------------------------------------------------
+r1739 | zimmerma | 2002-03-17 17:21:31 +0000 (Sun, 17 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/log10.c
+
+fixed infinite loop problem for log(10^n)
+
+------------------------------------------------------------------------
+r1738 | vlefevre | 2002-03-13 01:16:23 +0000 (Wed, 13 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Fix (patch by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1737 | vlefevre | 2002-03-13 00:44:20 +0000 (Wed, 13 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/get_d.c
+
+Do not read the exponent if it has no meaning.
+
+------------------------------------------------------------------------
+r1736 | vlefevre | 2002-03-12 23:58:10 +0000 (Tue, 12 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr_random update (patch by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1735 | vlefevre | 2002-03-12 23:53:47 +0000 (Tue, 12 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+2 more known bugs.
+
+------------------------------------------------------------------------
+r1734 | vlefevre | 2002-03-12 23:48:06 +0000 (Tue, 12 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr_a{cos,sin,tan} documentation at a better place.
+
+------------------------------------------------------------------------
+r1733 | vlefevre | 2002-03-12 23:43:10 +0000 (Tue, 12 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+
+Some mpfr_clear added (patch by Kevin Ryde).
+
+------------------------------------------------------------------------
+r1732 | vlefevre | 2002-03-11 16:54:55 +0000 (Mon, 11 Mar 2002) | 3 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/get_d.c
+ M /trunk/tests/tget_d.c
+
+mpfr_get_d3 partially rewritten (to follow the new specifications).
+tget_d.c updated because of changes in get_d.c.
+
+------------------------------------------------------------------------
+r1731 | vlefevre | 2002-03-11 13:52:30 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/print_rnd_mode.c
+
+Return a null pointer if rnd_mode is an invalid rounding mode.
+
+------------------------------------------------------------------------
+r1730 | zimmerma | 2002-03-11 13:43:18 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+set sign before calling mpfr_check_range
+
+------------------------------------------------------------------------
+r1729 | zimmerma | 2002-03-11 13:40:02 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+stupid typo in previous commit
+
+------------------------------------------------------------------------
+r1728 | zimmerma | 2002-03-11 13:36:40 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+removed expx (not used)
+
+------------------------------------------------------------------------
+r1727 | zimmerma | 2002-03-11 13:35:12 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+ M /trunk/tests/tset_si.c
+
+fixed typo (ai [potentially unsigned] replaced by i)
+
+------------------------------------------------------------------------
+r1726 | vlefevre | 2002-03-11 13:16:54 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/get_d.c
+ M /trunk/get_str.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/tests/tget_d.c
+
+New mpfr_get_d, mpfr_get_d2, mpfr_get_d3.
+
+------------------------------------------------------------------------
+r1725 | zimmerma | 2002-03-11 13:00:29 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/print_rnd_mode.c
+
+added return
+
+------------------------------------------------------------------------
+r1724 | vlefevre | 2002-03-11 12:41:00 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_d.c
+ M /trunk/set_d.c
+
+set_d.c split into get_d.c and set_d.c
+
+------------------------------------------------------------------------
+r1723 | daney | 2002-03-11 12:38:44 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ A /trunk/cbrt.c
+
+add cbrt in fonctionnality
+
+------------------------------------------------------------------------
+r1722 | vlefevre | 2002-03-11 10:53:10 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Bug removed.
+
+------------------------------------------------------------------------
+r1721 | vlefevre | 2002-03-11 05:44:18 +0000 (Mon, 11 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/extract.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+#include changes.
+
+------------------------------------------------------------------------
+r1720 | zimmerma | 2002-03-07 16:42:57 +0000 (Thu, 07 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/sinh.c
+
+fixed problem when te=ti=1 (i.e. t=0) found by Kevin Ryde
+
+------------------------------------------------------------------------
+r1719 | zimmerma | 2002-03-07 16:04:54 +0000 (Thu, 07 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+simplified test4()
+
+------------------------------------------------------------------------
+r1718 | vlefevre | 2002-03-06 17:56:06 +0000 (Wed, 06 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/TODO
+
+Update.
+
+------------------------------------------------------------------------
+r1717 | vlefevre | 2002-03-06 17:05:26 +0000 (Wed, 06 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r1716 | vlefevre | 2002-03-06 16:32:50 +0000 (Wed, 06 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Patch by Kevin Ryde concerning nodes/menus.
+
+------------------------------------------------------------------------
+r1715 | vlefevre | 2002-03-05 00:13:20 +0000 (Tue, 05 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Casts fixed.
+
+------------------------------------------------------------------------
+r1714 | vlefevre | 2002-03-04 23:35:05 +0000 (Mon, 04 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/get_z_exp.c
+ D /trunk/internal_ceil_exp2.c
+ D /trunk/internal_ceil_log2.c
+ D /trunk/internal_floor_log2.c
+ D /trunk/mpz_set_fr.c
+ A /trunk/uceil_exp2.c
+ A /trunk/uceil_log2.c
+ A /trunk/ufloor_log2.c
+
+File renaming.
+
+------------------------------------------------------------------------
+r1713 | vlefevre | 2002-03-04 23:05:20 +0000 (Mon, 04 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_one_ulp.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_ui.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_2si.c
+ M /trunk/div_2ui.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/init2.c
+ M /trunk/inp_str.c
+ M /trunk/internal_ceil_exp2.c
+ M /trunk/internal_ceil_log2.c
+ M /trunk/internal_floor_log2.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/minmax.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfi.c
+ M /trunk/mpfi.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_2si.c
+ M /trunk/mul_2ui.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rint.c
+ M /trunk/rnd_mode.c
+ M /trunk/round_prec.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sqrtrem.c
+ M /trunk/srandom.h
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub_one_ulp.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tconst_euler.c
+ M /trunk/tests/tconst_log2.c
+ M /trunk/tests/tconst_pi.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/trint.c
+ M /trunk/tests/tround_prec.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+Copyright line changed.
+
+------------------------------------------------------------------------
+r1712 | zimmerma | 2002-03-01 13:03:11 +0000 (Fri, 01 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+updated
+
+------------------------------------------------------------------------
+r1711 | zimmerma | 2002-03-01 13:02:03 +0000 (Fri, 01 Mar 2002) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/exp_2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpz_set_fr.c
+ M /trunk/pow.c
+
+changed name of mpz_set_fr to mpfr_get_z_exp
+
+------------------------------------------------------------------------
+r1710 | vlefevre | 2002-02-28 14:21:20 +0000 (Thu, 28 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+
+Removed some <math.h> dependencies.
+
+------------------------------------------------------------------------
+r1709 | vlefevre | 2002-02-28 00:19:56 +0000 (Thu, 28 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+Fixed.
+
+------------------------------------------------------------------------
+r1708 | vlefevre | 2002-02-28 00:19:46 +0000 (Thu, 28 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+mpfr_get_d rewritten (still needs to be fixed when the result is a subnormal).
+
+------------------------------------------------------------------------
+r1707 | vlefevre | 2002-02-27 18:16:29 +0000 (Wed, 27 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+
+mpfr_get_d2 tested.
+
+------------------------------------------------------------------------
+r1706 | vlefevre | 2002-02-27 14:29:18 +0000 (Wed, 27 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+Update.
+
+------------------------------------------------------------------------
+r1705 | vlefevre | 2002-02-27 14:02:18 +0000 (Wed, 27 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tset_d.c
+
+New tests.
+
+------------------------------------------------------------------------
+r1704 | vlefevre | 2002-02-27 14:00:16 +0000 (Wed, 27 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/configure.in
+
+Additional flags for gcc + minor changes.
+
+------------------------------------------------------------------------
+r1703 | vlefevre | 2002-02-27 13:57:51 +0000 (Wed, 27 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Minor update.
+
+------------------------------------------------------------------------
+r1702 | vlefevre | 2002-02-25 14:50:14 +0000 (Mon, 25 Feb 2002) | 7 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/set_d.c
+
+mpfr_get_d2 prototype changed (mp_exp_t instead of long).
+__mpfr_scale2 fixes: checks for integer overflows, signed zeros, exact
+rounding for subnormals in the rounding to the nearest mode (problems
+due to multiple roundings avoided).
+mpfr_get_d2: signed zeros taken into account. This function still needs
+to be rewritten (because of multiple roundings).
+
+------------------------------------------------------------------------
+r1701 | vlefevre | 2002-02-21 15:43:40 +0000 (Thu, 21 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/agm.c
+ A /trunk/internal_ceil_exp2.c
+ A /trunk/internal_ceil_log2.c
+ A /trunk/internal_floor_log2.c
+
+_mpfr_ceil_log2, _mpfr_floor_log2, _mpfr_ceil_exp2 in separate files.
+
+------------------------------------------------------------------------
+r1700 | vlefevre | 2002-02-19 16:05:52 +0000 (Tue, 19 Feb 2002) | 3 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Fixes, code clean-up and some asserts against integer overflows.
+Code need to be checked.
+
+------------------------------------------------------------------------
+r1699 | vlefevre | 2002-02-14 11:36:40 +0000 (Thu, 14 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/acos.c
+ M /trunk/agm.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/const_euler.c
+ M /trunk/const_log2.c
+ M /trunk/const_pi.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/gamma.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/tanh.c
+ M /trunk/zeta.c
+
+mpfr_{div,mul}_2exp -> mpfr_{div,mul}_2ui.
+
+------------------------------------------------------------------------
+r1698 | vlefevre | 2002-02-14 02:35:35 +0000 (Thu, 14 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Partial code clean-up and some asserts against integer overflows (2).
+
+------------------------------------------------------------------------
+r1697 | vlefevre | 2002-02-13 13:53:46 +0000 (Wed, 13 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+Partial code clean-up and some asserts against integer overflows.
+
+------------------------------------------------------------------------
+r1696 | vlefevre | 2002-02-13 13:18:12 +0000 (Wed, 13 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+MP_EXP_T_MAX and MP_EXP_T_MIN defined.
+
+------------------------------------------------------------------------
+r1695 | vlefevre | 2002-02-13 10:49:09 +0000 (Wed, 13 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Macros IS_POW2 and NOT_POW2.
+
+------------------------------------------------------------------------
+r1694 | vlefevre | 2002-02-12 17:11:50 +0000 (Tue, 12 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/ui_pow_ui.c
+
+Use mpfr_save_emin_emax and MPFR_RESTORE_RET.
+
+------------------------------------------------------------------------
+r1693 | vlefevre | 2002-02-12 16:41:50 +0000 (Tue, 12 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tdump.c
+
+Update due to changes in mpfr_get_str.
+
+------------------------------------------------------------------------
+r1692 | vlefevre | 2002-02-12 16:41:36 +0000 (Tue, 12 Feb 2002) | 4 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpz_set_fr.c
+ M /trunk/out_str.c
+
+mpfr_get_str: the returned exponent for 0 is 0 (like in frexp()).
+mpz_set_fr.c: comment added.
+out_str.c: minor changes.
+
+------------------------------------------------------------------------
+r1691 | vlefevre | 2002-02-12 15:59:02 +0000 (Tue, 12 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Update.
+
+------------------------------------------------------------------------
+r1690 | vlefevre | 2002-02-12 14:42:23 +0000 (Tue, 12 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/ui_pow_ui.c
+
+Bug fixed and other changes.
+
+------------------------------------------------------------------------
+r1689 | vlefevre | 2002-02-12 14:08:25 +0000 (Tue, 12 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+NULL -> null pointer and other small changes.
+
+------------------------------------------------------------------------
+r1688 | vlefevre | 2002-02-12 14:03:02 +0000 (Tue, 12 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+
+mpfr_get_str: null pointer returned in case of error, NaN taken into account.
+
+------------------------------------------------------------------------
+r1687 | vlefevre | 2002-02-11 14:59:18 +0000 (Mon, 11 Feb 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+
+mpfr_set_str partially rewritten to cope with integer overflows.
+The rounding code hasn't been fixed yet.
+
+------------------------------------------------------------------------
+r1686 | vlefevre | 2002-02-08 17:04:01 +0000 (Fri, 08 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Typo.
+
+------------------------------------------------------------------------
+r1685 | vlefevre | 2002-02-08 17:01:49 +0000 (Fri, 08 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_str.c
+
+mpfr_set_str: base must be between 2 and 36.
+
+------------------------------------------------------------------------
+r1684 | daney | 2002-02-06 15:34:46 +0000 (Wed, 06 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+chnage the return values
+
+------------------------------------------------------------------------
+r1683 | daney | 2002-02-06 15:34:15 +0000 (Wed, 06 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+Change the test return values
+
+------------------------------------------------------------------------
+r1682 | vlefevre | 2002-02-06 02:57:55 +0000 (Wed, 06 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Some optimizations.
+
+------------------------------------------------------------------------
+r1681 | vlefevre | 2002-02-04 01:04:59 +0000 (Mon, 04 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/pow_ui.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_sub.c
+
+Misc bug fixes and code clean-up.
+
+------------------------------------------------------------------------
+r1680 | vlefevre | 2002-02-04 00:16:27 +0000 (Mon, 04 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/pow.c
+
+Misc bug fixes and code clean-up.
+
+------------------------------------------------------------------------
+r1679 | vlefevre | 2002-02-03 02:59:44 +0000 (Sun, 03 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+
+For the value 0, return __mpfr_emin instead of 0.
+
+------------------------------------------------------------------------
+r1678 | vlefevre | 2002-02-01 21:35:34 +0000 (Fri, 01 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/agm.c
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/hypot.c
+ M /trunk/log.c
+ M /trunk/log10.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/pow_si.c
+
+Misc bug fixes and code clean-up.
+
+------------------------------------------------------------------------
+r1677 | hanrot | 2002-02-01 18:17:56 +0000 (Fri, 01 Feb 2002) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+Patch.
+
+------------------------------------------------------------------------
+r1676 | vlefevre | 2002-01-30 14:57:31 +0000 (Wed, 30 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/trint.c
+
+Bux fixed.
+
+------------------------------------------------------------------------
+r1675 | vlefevre | 2002-01-30 14:57:24 +0000 (Wed, 30 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+mpfr_set_z rewritten.
+
+------------------------------------------------------------------------
+r1674 | vlefevre | 2002-01-30 12:37:04 +0000 (Wed, 30 Jan 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Update concerning mpfr_round_prec, mpfr_rint, mpfr_ceil, mpfr_floor,
+mpfr_round and mpfr_trunc.
+
+------------------------------------------------------------------------
+r1673 | vlefevre | 2002-01-30 04:57:52 +0000 (Wed, 30 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/reuse.c
+ A /trunk/tests/trint.c
+
+Tests added (mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round).
+
+------------------------------------------------------------------------
+r1672 | vlefevre | 2002-01-30 04:57:10 +0000 (Wed, 30 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr.h
+ A /trunk/rint.c
+ D /trunk/trunc.c
+
+mpfr_rint, mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round rewritten.
+
+------------------------------------------------------------------------
+r1671 | vlefevre | 2002-01-25 14:00:37 +0000 (Fri, 25 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/cos.c
+ M /trunk/get_str.c
+ M /trunk/mpfr.h
+ D /trunk/round.c
+ A /trunk/round_prec.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/tacos.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tgamma.c
+ D /trunk/tests/tround.c
+ A /trunk/tests/tround_prec.c
+
+mpfr_round -> mpfr_round_prec.
+
+------------------------------------------------------------------------
+r1670 | vlefevre | 2002-01-25 13:43:31 +0000 (Fri, 25 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Code reformatted.
+
+------------------------------------------------------------------------
+r1669 | vlefevre | 2002-01-23 00:08:52 +0000 (Wed, 23 Jan 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+MAX, MIN, ABS macros undefined before being redefined.
+Fix in ABS macro.
+
+------------------------------------------------------------------------
+r1668 | vlefevre | 2002-01-22 02:29:47 +0000 (Tue, 22 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+Example with high bit set.
+
+------------------------------------------------------------------------
+r1667 | vlefevre | 2002-01-22 02:29:35 +0000 (Tue, 22 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Fix (Kevin Ryde).
+
+------------------------------------------------------------------------
+r1666 | vlefevre | 2002-01-22 00:45:44 +0000 (Tue, 22 Jan 2002) | 4 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/sqrt.c
+
+MPFR_PREC_MAX redefined.
+MPFR_INTPREC_MAX defined (internal maximum precision).
+Some integer overflow detection.
+
+------------------------------------------------------------------------
+r1665 | vlefevre | 2002-01-21 11:37:41 +0000 (Mon, 21 Jan 2002) | 3 lines
+Changed paths:
+ M /trunk/sqrt_ui.c
+
+Set sign of sqrt(0).
+Support for exponent range.
+
+------------------------------------------------------------------------
+r1664 | vlefevre | 2002-01-21 10:38:37 +0000 (Mon, 21 Jan 2002) | 3 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+can_round type changed: char -> int.
+Case sqrt(0) improved.
+
+------------------------------------------------------------------------
+r1663 | vlefevre | 2002-01-21 10:26:13 +0000 (Mon, 21 Jan 2002) | 4 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Bug fixes:
+ * return 1 -> MPFR_RET_NAN
+ * a MPFR_CLEAR_INF was missing.
+
+------------------------------------------------------------------------
+r1662 | vlefevre | 2002-01-20 00:17:27 +0000 (Sun, 20 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/mpfr-impl.h
+ M /trunk/sub_ui.c
+
+New macro MPFR_RESTORE_RET.
+
+------------------------------------------------------------------------
+r1661 | vlefevre | 2002-01-18 16:13:33 +0000 (Fri, 18 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Code clean-up (goto suppressed).
+
+------------------------------------------------------------------------
+r1660 | vlefevre | 2002-01-18 15:40:30 +0000 (Fri, 18 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Cases 0 * 0 + 0.
+
+------------------------------------------------------------------------
+r1659 | vlefevre | 2002-01-18 11:33:22 +0000 (Fri, 18 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Nt: int -> mp_prec_t
+
+------------------------------------------------------------------------
+r1658 | vlefevre | 2002-01-18 11:15:54 +0000 (Fri, 18 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+ M /trunk/tests/tacosh.c
+
+<> changed back to "".
+
+------------------------------------------------------------------------
+r1657 | daney | 2002-01-18 09:58:00 +0000 (Fri, 18 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+
+change "" -> <> in headers
+
+------------------------------------------------------------------------
+r1656 | daney | 2002-01-18 09:51:03 +0000 (Fri, 18 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Change indendation + replace "" -> <> in header
+
+------------------------------------------------------------------------
+r1655 | vlefevre | 2002-01-17 21:45:41 +0000 (Thu, 17 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Particular cases rewritten.
+
+------------------------------------------------------------------------
+r1654 | vlefevre | 2002-01-17 20:33:21 +0000 (Thu, 17 Jan 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+Test "__hpux", not "hpux". Mask off mrand48 return value to 31 bits
+to work around sloppy mpfr #include practices. (Torbjorn Granlund)
+
+------------------------------------------------------------------------
+r1653 | vlefevre | 2002-01-17 20:29:58 +0000 (Thu, 17 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog10.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/tui_pow.c
+
+#include fixes (Torbjorn Granlund).
+
+------------------------------------------------------------------------
+r1652 | vlefevre | 2002-01-16 15:14:09 +0000 (Wed, 16 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Comments were incorrect.
+
+------------------------------------------------------------------------
+r1651 | vlefevre | 2002-01-15 11:23:34 +0000 (Tue, 15 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Note concerning mpfr_trunc, mpfr_floor and mpfr_ceil.
+
+------------------------------------------------------------------------
+r1650 | vlefevre | 2002-01-14 13:09:42 +0000 (Mon, 14 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Special cases.
+
+------------------------------------------------------------------------
+r1649 | vlefevre | 2002-01-12 01:27:53 +0000 (Sat, 12 Jan 2002) | 3 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/shortmul.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+Patches by Kevin Ryde for K&R compilers
+and other fixes in prototypes.
+
+------------------------------------------------------------------------
+r1648 | vlefevre | 2002-01-10 22:20:28 +0000 (Thu, 10 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+Test check_min added.
+
+------------------------------------------------------------------------
+r1647 | vlefevre | 2002-01-10 21:45:00 +0000 (Thu, 10 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+Test check_max added.
+
+------------------------------------------------------------------------
+r1646 | vlefevre | 2002-01-10 13:42:21 +0000 (Thu, 10 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+ M /trunk/cmp2.c
+ M /trunk/log.c
+
+Spelling: "canceled"
+
+------------------------------------------------------------------------
+r1645 | zimmerma | 2002-01-10 13:05:58 +0000 (Thu, 10 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+GMP_PROTO change was already done by Vincent
+
+------------------------------------------------------------------------
+r1644 | zimmerma | 2002-01-10 12:58:47 +0000 (Thu, 10 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+prepare change PROTO -> GMP_PROTO
+
+------------------------------------------------------------------------
+r1643 | vlefevre | 2002-01-04 14:41:33 +0000 (Fri, 04 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/sub_one_ulp.c
+
+The precision can no longer be 1.
+
+------------------------------------------------------------------------
+r1642 | vlefevre | 2002-01-04 03:07:23 +0000 (Fri, 04 Jan 2002) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+__GMP_PROTO defined if not already defined.
+
+------------------------------------------------------------------------
+r1641 | vlefevre | 2002-01-04 02:57:08 +0000 (Fri, 04 Jan 2002) | 5 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/agm.c
+ M /trunk/cmp2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+
+Optimization: mpfr_cmp2 now accepts any combination of real arguments
+and computes the sign of |b| - |c| (in addition to the number of
+cancelled bits); mpfr_add, mpfr_sub, mpfr_sub1, mpfr_agm and some
+tests updated to take this change into account.
+
+------------------------------------------------------------------------
+r1640 | zimmerma | 2001-12-21 16:33:10 +0000 (Fri, 21 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+added check for sin(3*Pi/2)
+
+------------------------------------------------------------------------
+r1639 | zimmerma | 2001-12-21 16:33:02 +0000 (Fri, 21 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+
+fixed bug for sin(3*Pi/2)
+
+------------------------------------------------------------------------
+r1638 | vlefevre | 2001-12-19 15:50:01 +0000 (Wed, 19 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+Global NaN flag set when result is NaN.
+
+------------------------------------------------------------------------
+r1637 | zimmerma | 2001-12-19 14:41:04 +0000 (Wed, 19 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+forgot to clear nan flag for Inf
+
+------------------------------------------------------------------------
+r1636 | zimmerma | 2001-12-19 13:32:05 +0000 (Wed, 19 Dec 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+changed description of mpfr_cmp to correspond to the implementation:
+NaNs are not allowed
+
+------------------------------------------------------------------------
+r1635 | zimmerma | 2001-12-19 12:39:49 +0000 (Wed, 19 Dec 2001) | 6 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+fixed mpfr_cmp2 : there was a bug noticed by Nicolas Magaud and Didier
+Bondyfalat for inputs:
+100 011 111
+100 010 110
+where it gave 8 instead of 5.
+
+------------------------------------------------------------------------
+r1634 | vlefevre | 2001-12-19 10:44:15 +0000 (Wed, 19 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/sub1.c
+
+Better comments.
+
+------------------------------------------------------------------------
+r1633 | zimmerma | 2001-12-10 09:20:59 +0000 (Mon, 10 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+ M /trunk/algorithms.tex
+
+added "PI and the AGM"
+
+------------------------------------------------------------------------
+r1632 | vlefevre | 2001-12-06 17:25:46 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tlog10.c
+ A /trunk/tests/tlog2.c
+ D /trunk/tests/tlog_base_10.c
+ D /trunk/tests/tlog_base_2.c
+
+Files renamed (log in base 2 and 10).
+
+------------------------------------------------------------------------
+r1631 | vlefevre | 2001-12-06 17:22:14 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tconst_euler.c
+ A /trunk/tests/tconst_log2.c
+ A /trunk/tests/tconst_pi.c
+ D /trunk/tests/teuler.c
+ D /trunk/tests/tlog2.c
+ D /trunk/tests/tpi.c
+
+Files renamed (constants).
+
+------------------------------------------------------------------------
+r1630 | vlefevre | 2001-12-06 17:12:59 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ D /trunk/aclocal.m4
+
+File aclocal.m4 removed, as generated by aclocal (called by prepare).
+
+------------------------------------------------------------------------
+r1629 | vlefevre | 2001-12-06 17:02:18 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/log10.c
+ A /trunk/log2.c
+ D /trunk/log_base_10.c
+ D /trunk/log_base_2.c
+
+Files log_base_*.c renamed.
+
+------------------------------------------------------------------------
+r1628 | vlefevre | 2001-12-06 16:53:25 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/const_euler.c
+ A /trunk/const_log2.c
+ A /trunk/const_pi.c
+ D /trunk/euler.c
+ D /trunk/log2.c
+ D /trunk/pi.c
+
+Functions (constants) renamed.
+
+------------------------------------------------------------------------
+r1627 | vlefevre | 2001-12-06 16:33:10 +0000 (Thu, 06 Dec 2001) | 3 lines
+Changed paths:
+ D /trunk/Makefile.in
+ D /trunk/configure
+ D /trunk/tests/Makefile.in
+
+Files configure, Makefile.in, tests/Makefile.in removed.
+Use the `prepare' script to generate them.
+
+------------------------------------------------------------------------
+r1626 | vlefevre | 2001-12-06 12:37:05 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+Removed 2 bugs.
+
+------------------------------------------------------------------------
+r1625 | vlefevre | 2001-12-06 12:12:43 +0000 (Thu, 06 Dec 2001) | 2 lines
+Changed paths:
+ A /trunk/prepare
+
+Initial release.
+
+------------------------------------------------------------------------
+r1624 | zimmerma | 2001-12-05 17:06:03 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added arc-tangent (from Mathieu)
+
+------------------------------------------------------------------------
+r1623 | zimmerma | 2001-12-05 16:29:15 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added paragraph on asin and acos from Mathieu Dutour
+
+------------------------------------------------------------------------
+r1622 | zimmerma | 2001-12-05 16:28:31 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ A /trunk/tests/tacos.c
+
+added tacos
+
+------------------------------------------------------------------------
+r1621 | zimmerma | 2001-12-05 16:27:44 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+in check5, test NaNs before calling mpfr_cmp
+
+------------------------------------------------------------------------
+r1620 | zimmerma | 2001-12-05 16:26:56 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+added acos
+
+------------------------------------------------------------------------
+r1619 | zimmerma | 2001-12-05 16:26:34 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added acos.c
+
+------------------------------------------------------------------------
+r1618 | zimmerma | 2001-12-05 16:26:02 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ A /trunk/acos.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+added acos (from Mathieu Dutour)
+
+------------------------------------------------------------------------
+r1617 | zimmerma | 2001-12-05 16:25:10 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+use now new sqrtrem from gmp-4.0
+
+------------------------------------------------------------------------
+r1616 | zimmerma | 2001-12-05 16:08:30 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+improved test (avoid mpfr_get_d)
+
+------------------------------------------------------------------------
+r1615 | zimmerma | 2001-12-05 15:15:47 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+removed isnan prototype
+
+------------------------------------------------------------------------
+r1614 | zimmerma | 2001-12-05 15:11:47 +0000 (Wed, 05 Dec 2001) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+added stdlib.h for exit
+
+------------------------------------------------------------------------
+r1613 | zimmerma | 2001-11-30 17:55:16 +0000 (Fri, 30 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/dump.c
+ M /trunk/tests/tdump.c
+
+test NaN before Inf
+changed precision to 2 for test
+
+------------------------------------------------------------------------
+r1612 | vlefevre | 2001-11-30 15:57:22 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/set_prc_raw.c
+
+Cast added.
+
+------------------------------------------------------------------------
+r1611 | zimmerma | 2001-11-30 14:48:45 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+added a new test (worst case)
+
+------------------------------------------------------------------------
+r1610 | zimmerma | 2001-11-30 14:48:12 +0000 (Fri, 30 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/atan.c
+
+nouvelle version de Mathieu Dutour,
+corrigeant certains bugs avec les pires cas de Vincent
+
+------------------------------------------------------------------------
+r1609 | vlefevre | 2001-11-30 14:37:25 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+ M /trunk/set_d.c
+
+#include order changed.
+
+------------------------------------------------------------------------
+r1608 | vlefevre | 2001-11-30 14:29:38 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+Misc fixes.
+
+------------------------------------------------------------------------
+r1607 | vlefevre | 2001-11-30 13:44:59 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+Unused variables.
+
+------------------------------------------------------------------------
+r1606 | zimmerma | 2001-11-30 13:37:37 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teuler.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tlog_base_10.c
+ M /trunk/tests/tlog_base_2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+
+start tests with precision 2 instead of 1
+
+------------------------------------------------------------------------
+r1605 | zimmerma | 2001-11-30 13:29:57 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+
+start from precision 2
+
+------------------------------------------------------------------------
+r1604 | zimmerma | 2001-11-30 13:29:06 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+big rewrite to fix problems when the estimate base exponent is too small
+
+------------------------------------------------------------------------
+r1603 | zimmerma | 2001-11-30 13:28:04 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+fixed detection of exact cases (in particular 0)
+
+------------------------------------------------------------------------
+r1602 | zimmerma | 2001-11-30 13:27:30 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+now use MPFR_PREC_MIN
+
+------------------------------------------------------------------------
+r1601 | zimmerma | 2001-11-30 13:27:01 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+exptol is now of type mp_exp_t
+
+------------------------------------------------------------------------
+r1600 | zimmerma | 2001-11-30 13:26:03 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+
+rewritten part with Taylor series
+
+------------------------------------------------------------------------
+r1599 | zimmerma | 2001-11-30 13:03:07 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed MPFR_PREC_MIN to 2
+
+------------------------------------------------------------------------
+r1598 | zimmerma | 2001-11-30 13:02:45 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_prc_raw.c
+
+updated wrt MPFR_PREC_MIN/MPFR_PREC_MAX
+
+------------------------------------------------------------------------
+r1597 | zimmerma | 2001-11-30 12:53:16 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+
+case x=0 was forgotten
+
+------------------------------------------------------------------------
+r1596 | zimmerma | 2001-11-30 12:52:07 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+now use MPFR_PREC_MIN
+
+------------------------------------------------------------------------
+r1595 | zimmerma | 2001-11-30 12:51:26 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/sub1.c
+
+added comment
+
+------------------------------------------------------------------------
+r1594 | vlefevre | 2001-11-30 02:41:36 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+mpfr_set_z rewritten to support overflows/underflows and ternary value.
+
+------------------------------------------------------------------------
+r1593 | vlefevre | 2001-11-30 00:10:52 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+0 -> set to +0.
+
+------------------------------------------------------------------------
+r1592 | vlefevre | 2001-11-30 00:07:36 +0000 (Fri, 30 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Better sign comparison.
+
+------------------------------------------------------------------------
+r1591 | vlefevre | 2001-11-29 23:56:56 +0000 (Thu, 29 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+
+Use MPFR_SET_POS.
+
+------------------------------------------------------------------------
+r1590 | vlefevre | 2001-11-29 14:23:12 +0000 (Thu, 29 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+Bug fixed concerning integer overflows.
+
+------------------------------------------------------------------------
+r1589 | zimmerma | 2001-11-29 09:43:55 +0000 (Thu, 29 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+
+added comment
+
+------------------------------------------------------------------------
+r1588 | zimmerma | 2001-11-29 09:43:35 +0000 (Thu, 29 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+
+fixed bug for small precision, where r can be >= 1
+
+------------------------------------------------------------------------
+r1587 | vlefevre | 2001-11-29 03:15:54 +0000 (Thu, 29 Nov 2001) | 4 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/div_2exp.c
+ A /trunk/div_2si.c
+ A /trunk/div_2ui.c
+ M /trunk/log.c
+ M /trunk/mpfr.h
+ M /trunk/mul_2exp.c
+ A /trunk/mul_2si.c
+ A /trunk/mul_2ui.c
+
+Functions mpfr_{mul,div}_2{si,ui} added.
+Functions mpfr_{mul,div}_2exp still exist for backward compatibility;
+they are obsolete and should not be used any longer.
+
+------------------------------------------------------------------------
+r1586 | vlefevre | 2001-11-28 17:57:53 +0000 (Wed, 28 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/minmax.c
+
+Particular cases (NaN and signed zeros).
+
+------------------------------------------------------------------------
+r1585 | vlefevre | 2001-11-28 17:12:35 +0000 (Wed, 28 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/thyperbolic.c
+
+Init variables to NaN instead of 0.
+
+------------------------------------------------------------------------
+r1584 | vlefevre | 2001-11-28 17:09:37 +0000 (Wed, 28 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+
+Possible integer overflow fixed.
+
+------------------------------------------------------------------------
+r1583 | vlefevre | 2001-11-28 16:54:20 +0000 (Wed, 28 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+ M /trunk/atan.c
+
+Particular cases fixed.
+
+------------------------------------------------------------------------
+r1582 | vlefevre | 2001-11-25 15:24:31 +0000 (Sun, 25 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+Overflow support.
+
+------------------------------------------------------------------------
+r1581 | vlefevre | 2001-11-25 14:44:49 +0000 (Sun, 25 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+K&R -> ISO C prototype.
+
+------------------------------------------------------------------------
+r1580 | vlefevre | 2001-11-25 08:04:07 +0000 (Sun, 25 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div_2exp.c
+
+mpfr_div_2exp rewritten.
+
+------------------------------------------------------------------------
+r1579 | vlefevre | 2001-11-25 07:49:47 +0000 (Sun, 25 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_2exp.c
+
+mpfr_mul_2exp rewritten.
+
+------------------------------------------------------------------------
+r1578 | vlefevre | 2001-11-25 06:53:41 +0000 (Sun, 25 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Overflow support.
+
+------------------------------------------------------------------------
+r1577 | vlefevre | 2001-11-25 06:20:35 +0000 (Sun, 25 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/init2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/round.c
+
+Casts to size_t added (safer and could be required in the future).
+
+------------------------------------------------------------------------
+r1576 | vlefevre | 2001-11-23 16:39:25 +0000 (Fri, 23 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Minor change.
+
+------------------------------------------------------------------------
+r1575 | vlefevre | 2001-11-23 16:28:08 +0000 (Fri, 23 Nov 2001) | 5 lines
+Changed paths:
+ M /trunk/mul.c
+
+mpfr_mul partially rewritten:
+ * Integer overflows almost completely avoided.
+ * Now supports signed zeros and overflows.
+Not tested yet.
+
+------------------------------------------------------------------------
+r1574 | vlefevre | 2001-11-22 17:21:08 +0000 (Thu, 22 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+mpfr_can_round_raw: integer overflows checked and code duplication avoided.
+
+------------------------------------------------------------------------
+r1573 | vlefevre | 2001-11-22 15:32:44 +0000 (Thu, 22 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+More bugs.
+
+------------------------------------------------------------------------
+r1572 | vlefevre | 2001-11-22 12:48:20 +0000 (Thu, 22 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/round.c
+
+mpfr_can_round and mpfr_can_round_raw: prototypes changed.
+
+------------------------------------------------------------------------
+r1571 | vlefevre | 2001-11-21 20:40:47 +0000 (Wed, 21 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1570 | vlefevre | 2001-11-21 20:07:35 +0000 (Wed, 21 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ A /trunk/add_one_ulp.c
+ D /trunk/add_ulp.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_z.c
+ A /trunk/sub_one_ulp.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tsqrt.c
+
+mpfr_add_one_ulp and mpfr_sub_one_ulp changed.
+
+------------------------------------------------------------------------
+r1569 | vlefevre | 2001-11-21 15:50:45 +0000 (Wed, 21 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/init2.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/round.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_rnd.c
+
+Added MPFR_PREC_MIN and MPFR_PREC_MAX.
+
+------------------------------------------------------------------------
+r1568 | vlefevre | 2001-11-21 14:06:36 +0000 (Wed, 21 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/init2.c
+
+Error test -> assert.
+mp_prec_t -> mp_size_t.
+
+------------------------------------------------------------------------
+r1567 | vlefevre | 2001-11-20 14:10:05 +0000 (Tue, 20 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tround.c
+
+Test added.
+
+------------------------------------------------------------------------
+r1566 | vlefevre | 2001-11-20 14:09:55 +0000 (Tue, 20 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/round.c
+
+mpfr_round rewritten.
+mpfr_round_raw_generic: NULL changed to 0 as not necessarily defined.
+
+------------------------------------------------------------------------
+r1565 | vlefevre | 2001-11-20 13:41:41 +0000 (Tue, 20 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Added macro MPFR_SET_ABSSIZE.
+
+------------------------------------------------------------------------
+r1564 | vlefevre | 2001-11-20 02:17:32 +0000 (Tue, 20 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+mpfr_round: Check for overflow.
+
+------------------------------------------------------------------------
+r1563 | vlefevre | 2001-11-17 03:58:19 +0000 (Sat, 17 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/sub1.c
+
+Some type changes.
+
+------------------------------------------------------------------------
+r1562 | vlefevre | 2001-11-16 17:58:50 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/add1.c
+ M /trunk/mpz_set_fr.c
+
+Integer overflows checked.
+
+------------------------------------------------------------------------
+r1561 | vlefevre | 2001-11-16 17:16:31 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+
+MPFR_ASSERTN instead of fprintf + exit.
+
+------------------------------------------------------------------------
+r1560 | vlefevre | 2001-11-16 17:10:30 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+GMP assert mechanism: macros changed until GMP is fixed.
+
+------------------------------------------------------------------------
+r1559 | zimmerma | 2001-11-16 17:04:15 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+version -> 2002
+removed executable flag
+
+------------------------------------------------------------------------
+r1558 | zimmerma | 2001-11-16 14:38:24 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/exp_2.c
+ M /trunk/log.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/print_raw.c
+ M /trunk/sub1.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/teuler.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+
+mpfr_print_raw -> mpfr_print_binary
+
+------------------------------------------------------------------------
+r1557 | zimmerma | 2001-11-16 14:15:57 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/init2.c
+
+split from init.c
+
+------------------------------------------------------------------------
+r1556 | daney | 2001-11-16 14:14:10 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+ M /trunk/log1p.c
+ M /trunk/tanh.c
+
+remove math.h
+
+------------------------------------------------------------------------
+r1555 | daney | 2001-11-16 14:04:13 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/sinh.c
+
+remve math.h
+
+------------------------------------------------------------------------
+r1554 | zimmerma | 2001-11-16 14:04:06 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added one test
+
+------------------------------------------------------------------------
+r1553 | daney | 2001-11-16 14:00:29 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/atanh.c
+
+remove math.h
+
+------------------------------------------------------------------------
+r1552 | zimmerma | 2001-11-16 13:54:55 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/init.c
+
+init -> init + init2.
+
+------------------------------------------------------------------------
+r1551 | daney | 2001-11-16 13:54:32 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/asinh.c
+
+remove math.h
+
+------------------------------------------------------------------------
+r1550 | hanrot | 2001-11-16 13:27:50 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Ajoute retours chariots dans div.c, etc.
+
+------------------------------------------------------------------------
+r1549 | hanrot | 2001-11-16 13:23:43 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+if () remplace par if ( ==0) ou if ( != 0)
+
+------------------------------------------------------------------------
+r1548 | zimmerma | 2001-11-16 13:22:13 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/TODO
+ M /trunk/add_ui.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+ M /trunk/clear.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fma.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/isinteger.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/log_base_10.c
+ M /trunk/log_base_2.c
+ M /trunk/minmax.c
+ M /trunk/mul.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/print_raw.c
+ M /trunk/rnd_mode.c
+ M /trunk/set_rnd.c
+ M /trunk/set_str_raw.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/Makefile.in
+ M /trunk/ui_pow.c
+
+removed K&R function headers
+
+------------------------------------------------------------------------
+r1547 | hanrot | 2001-11-16 13:19:50 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+Beuh ?
+
+------------------------------------------------------------------------
+r1546 | hanrot | 2001-11-16 13:19:42 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/inp_str.c
+
+return -> MPFR_RET, patch d'un leak dans inp_str.c
+
+------------------------------------------------------------------------
+r1545 | zimmerma | 2001-11-16 13:09:07 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+changed to use GMP assert mechanism
+
+------------------------------------------------------------------------
+r1544 | daney | 2001-11-16 12:55:53 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+
+remove stdio.h math.h
+
+------------------------------------------------------------------------
+r1543 | zimmerma | 2001-11-16 12:54:09 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/euler.c
+
+assert -> MPFR_ASSERT
+
+------------------------------------------------------------------------
+r1542 | daney | 2001-11-16 12:52:55 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+remove stdio math .h
+
+------------------------------------------------------------------------
+r1541 | daney | 2001-11-16 12:50:31 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/isinteger.c
+
+remove stdio.h math.h
+
+------------------------------------------------------------------------
+r1540 | zimmerma | 2001-11-16 12:49:36 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+ M /trunk/sub1.c
+
+ASSERT_ALWAYS -> MPFR_ASSERTN
+
+------------------------------------------------------------------------
+r1539 | zimmerma | 2001-11-16 12:39:30 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added COPYING.LIB
+
+------------------------------------------------------------------------
+r1538 | zimmerma | 2001-11-16 12:38:56 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/COPYING
+
+replaced by GPL
+
+------------------------------------------------------------------------
+r1537 | daney | 2001-11-16 12:34:00 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+
+remove limits.h
+
+------------------------------------------------------------------------
+r1536 | zimmerma | 2001-11-16 12:32:48 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/add.c
+ M /trunk/add1.c
+ M /trunk/add_ui.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/asin.c
+ M /trunk/asinh.c
+ M /trunk/atan.c
+ M /trunk/atanh.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp2.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_ui.c
+ M /trunk/copysign.c
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/dim.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/euler.c
+ M /trunk/exceptions.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/expm1.c
+ M /trunk/extract.c
+ M /trunk/factorial.c
+ M /trunk/fma.c
+ M /trunk/gamma.c
+ M /trunk/gammaPiAGMformula.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/gmp_op.c
+ M /trunk/hypot.c
+ M /trunk/init.c
+ M /trunk/inp_str.c
+ M /trunk/isinf.c
+ M /trunk/isinteger.c
+ M /trunk/isnan.c
+ M /trunk/isnum.c
+ M /trunk/log.c
+ M /trunk/log1p.c
+ M /trunk/log2.c
+ M /trunk/log_base_10.c
+ M /trunk/log_base_2.c
+ M /trunk/minmax.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfi.c
+ M /trunk/mpfi.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/pow_si.c
+ M /trunk/pow_ui.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/rnd_mode.c
+ M /trunk/round.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sqrtrem.c
+ M /trunk/srandom.h
+ M /trunk/sub.c
+ M /trunk/sub1.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tasin.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatan.c
+ M /trunk/tests/tatanh.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/teuler.c
+ M /trunk/tests/texceptions.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/texpm1.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tfma.c
+ M /trunk/tests/tgamma.c
+ M /trunk/tests/tgeneric.c
+ M /trunk/tests/tget_d.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/thypot.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog1p.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tlog_base_10.c
+ M /trunk/tests/tlog_base_2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpi.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tpow3.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tround.c
+ M /trunk/tests/tset.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_pow.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+changed Library GPL to Lesser GPL
+
+------------------------------------------------------------------------
+r1535 | zimmerma | 2001-11-16 12:31:12 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/COPYING.LIB
+
+GNU Lesser General Public License, version 2.1
+
+------------------------------------------------------------------------
+r1534 | daney | 2001-11-16 12:30:42 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+remove limits.h math.h
+
+------------------------------------------------------------------------
+r1533 | zimmerma | 2001-11-16 12:27:02 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/replace_all
+
+now treats all *.h
+
+------------------------------------------------------------------------
+r1532 | daney | 2001-11-16 12:25:25 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+remove the proto, remove math.h
+
+------------------------------------------------------------------------
+r1531 | zimmerma | 2001-11-16 12:21:07 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+removed DEBUG's
+
+------------------------------------------------------------------------
+r1530 | zimmerma | 2001-11-16 12:19:39 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+removed old patch for GMP 2.xx
+
+------------------------------------------------------------------------
+r1529 | zimmerma | 2001-11-16 12:17:56 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/eq.c
+ M /trunk/swap.c
+ M /trunk/urandomb.c
+
+GNU MP -> MPFR
+
+------------------------------------------------------------------------
+r1528 | zimmerma | 2001-11-16 12:08:08 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/add_ulp.c
+
+added year 2001 in copyright line
+
+------------------------------------------------------------------------
+r1527 | zimmerma | 2001-11-16 11:18:52 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/thyperbolic.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpi.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+
+added year 2001 in copyright line
+
+------------------------------------------------------------------------
+r1526 | zimmerma | 2001-11-16 11:18:00 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/cmp.c
+ M /trunk/cmp_abs.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/dump.c
+ M /trunk/exp3.c
+ M /trunk/exp_2.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/inp_str.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr-test.h
+ M /trunk/mpfr.h
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/out_str.c
+ M /trunk/pow_ui.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/round.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_str.c
+ M /trunk/set_z.c
+ M /trunk/sqrtrem.c
+ M /trunk/sub_ui.c
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+ M /trunk/ui_pow_ui.c
+ M /trunk/ui_sub.c
+
+added year 2001 in copyright line
+removed #if __STDC__
+
+------------------------------------------------------------------------
+r1525 | zimmerma | 2001-11-16 11:15:29 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ D /trunk/sin_cos.c
+
+now two separate files cos.c and sin.c
+
+------------------------------------------------------------------------
+r1524 | zimmerma | 2001-11-16 10:43:04 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/pi.c
+ M /trunk/urandomb.c
+
+added year 2001 in copyright line
+
+------------------------------------------------------------------------
+r1523 | zimmerma | 2001-11-16 10:38:25 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+
+updated
+
+------------------------------------------------------------------------
+r1522 | zimmerma | 2001-11-16 10:26:46 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ D /trunk/div2.c
+
+old version, removed
+
+------------------------------------------------------------------------
+r1521 | zimmerma | 2001-11-16 10:16:37 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added isinf and isnum (split from isnan)
+
+------------------------------------------------------------------------
+r1520 | zimmerma | 2001-11-16 10:16:21 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/isinf.c
+ A /trunk/isnum.c
+
+new files (split from isnan.c)
+
+------------------------------------------------------------------------
+r1519 | zimmerma | 2001-11-16 10:14:44 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+ M /trunk/copysign.c
+ M /trunk/cosh.c
+
+removed prototype already in mpfr.h
+
+------------------------------------------------------------------------
+r1518 | zimmerma | 2001-11-16 10:14:27 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+translated french comments to english
+
+------------------------------------------------------------------------
+r1517 | zimmerma | 2001-11-16 10:14:08 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added mpfr_sub
+
+------------------------------------------------------------------------
+r1516 | zimmerma | 2001-11-16 10:13:12 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/atan.c
+ M /trunk/cos.c
+ M /trunk/exp_2.c
+
+added static to local functions
+
+------------------------------------------------------------------------
+r1515 | zimmerma | 2001-11-16 10:12:42 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp2.c
+
+1 -> MP_LIMB_T_ONE
+
+------------------------------------------------------------------------
+r1514 | zimmerma | 2001-11-16 10:11:20 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/div_ui.c
+
+1 -> BITS_PER_MP_LIMB
+
+------------------------------------------------------------------------
+r1513 | zimmerma | 2001-11-16 10:10:48 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/euler.c
+
+added static to local functions
+removed prototype already in mpfr.h
+
+------------------------------------------------------------------------
+r1512 | zimmerma | 2001-11-16 10:10:29 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+removed mpfr_exp2_si (not used)
+
+------------------------------------------------------------------------
+r1511 | zimmerma | 2001-11-16 10:10:07 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/exp3.c
+
+added static to local functions
+translated french comments to english
+
+------------------------------------------------------------------------
+r1510 | zimmerma | 2001-11-16 10:09:29 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/expm1.c
+ M /trunk/log1p.c
+
+translated french comments to english
+removed prototype already in mpfr.h
+
+------------------------------------------------------------------------
+r1509 | zimmerma | 2001-11-16 10:09:09 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+
+initialized inexact to 0
+
+------------------------------------------------------------------------
+r1508 | zimmerma | 2001-11-16 10:08:47 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/generic.c
+
+used TMP_ALLOC
+translated french comments to english
+
+------------------------------------------------------------------------
+r1507 | zimmerma | 2001-11-16 10:08:18 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+simplified test
+
+------------------------------------------------------------------------
+r1506 | zimmerma | 2001-11-16 10:08:04 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/isnan.c
+
+moved inf_p and number_p to different files
+
+------------------------------------------------------------------------
+r1505 | zimmerma | 2001-11-16 10:06:38 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/log2.c
+
+added static to local functions
+explained threshold
+
+------------------------------------------------------------------------
+r1504 | zimmerma | 2001-11-16 10:06:03 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/minmax.c
+
+removed prototypes already in mpfr.h
+
+------------------------------------------------------------------------
+r1503 | zimmerma | 2001-11-16 10:05:45 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+does not include stdio.h any more
+
+------------------------------------------------------------------------
+r1502 | zimmerma | 2001-11-16 10:05:01 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+
+added stdio.h
+
+------------------------------------------------------------------------
+r1501 | zimmerma | 2001-11-16 10:04:07 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/add_ulp.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/print_raw.c
+ M /trunk/round.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/trunc.c
+
+1 -> BITS_PER_MP_LIMB
+1 << (BITS_PER_MP_LIMB - 1) -> MP_LIMB_T_HIGHBIT
+
+------------------------------------------------------------------------
+r1500 | zimmerma | 2001-11-16 09:40:02 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+ M /trunk/reldiff.c
+
+removed french comment
+
+------------------------------------------------------------------------
+r1499 | zimmerma | 2001-11-16 09:39:45 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/pi.c
+
+added static to local functions
+
+------------------------------------------------------------------------
+r1498 | zimmerma | 2001-11-16 09:39:26 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/pow_si.c
+ M /trunk/sinh.c
+ M /trunk/tanh.c
+
+removed prototype already in mpfr.h
+
+------------------------------------------------------------------------
+r1497 | zimmerma | 2001-11-16 09:39:11 +0000 (Fri, 16 Nov 2001) | 4 lines
+Changed paths:
+ M /trunk/print_raw.c
+
+1 -> BITS_PER_MP_LIMB
+translated french comments to english
+added static to local functions
+
+------------------------------------------------------------------------
+r1496 | zimmerma | 2001-11-16 09:38:47 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sub1.c
+ M /trunk/trunc.c
+
+1 -> BITS_PER_MP_LIMB
+
+------------------------------------------------------------------------
+r1495 | zimmerma | 2001-11-16 09:37:52 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/round.c
+
+1 -> BITS_PER_MP_LIMB
+translated french comments to english
+
+------------------------------------------------------------------------
+r1494 | zimmerma | 2001-11-16 09:37:15 +0000 (Fri, 16 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/set_d.c
+ M /trunk/sqrtrem.c
+
+1 -> BITS_PER_MP_LIMB
+added static to local functions
+
+------------------------------------------------------------------------
+r1493 | zimmerma | 2001-11-16 09:33:57 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+removed proto already in mpfr.h
+
+------------------------------------------------------------------------
+r1492 | zimmerma | 2001-11-16 09:33:33 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+1 -> MP_LIMB_T_ONE
+
+------------------------------------------------------------------------
+r1491 | zimmerma | 2001-11-16 09:32:45 +0000 (Fri, 16 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teuler.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tpi.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+
+added stdio.h
+
+------------------------------------------------------------------------
+r1490 | vlefevre | 2001-11-15 18:11:07 +0000 (Thu, 15 Nov 2001) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/add.c
+ A /trunk/add1.c
+ M /trunk/sub.c
+ A /trunk/sub1.c
+
+add.c -> add.c & add1.c
+sub.c -> sub.c & sub1.c + some changes.
+
+------------------------------------------------------------------------
+r1489 | zimmerma | 2001-11-13 09:33:07 +0000 (Tue, 13 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+iff the results are exact -> iff the result is exact
+
+------------------------------------------------------------------------
+r1488 | vlefevre | 2001-11-10 01:45:36 +0000 (Sat, 10 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/cmp.c
+ M /trunk/cmp_abs.c
+ M /trunk/exceptions.c
+ M /trunk/neg.c
+ M /trunk/round.c
+ M /trunk/save_expo.c
+ M /trunk/set.c
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+
+GNU coding style. K&R function headers removed.
+
+------------------------------------------------------------------------
+r1487 | vlefevre | 2001-11-10 00:47:44 +0000 (Sat, 10 Nov 2001) | 5 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+MP_LIMB_T_ONE defined.
+mp_size_unsigned_t defined.
+Important bugs fixed (in particular when int has fewer than 32 bits).
+Still unavoidable possible bugs due to the fact that mp_size_t is signed.
+
+------------------------------------------------------------------------
+r1486 | daney | 2001-11-09 11:24:05 +0000 (Fri, 09 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tgamma.c
+
+add tests file for gamma
+
+------------------------------------------------------------------------
+r1485 | daney | 2001-11-09 11:23:33 +0000 (Fri, 09 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/gammaPiAGMformula.c
+
+add gamma function an other version
+
+------------------------------------------------------------------------
+r1484 | daney | 2001-11-09 11:23:04 +0000 (Fri, 09 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/gamma.c
+
+add gamma function
+
+------------------------------------------------------------------------
+r1483 | zimmerma | 2001-11-09 06:24:52 +0000 (Fri, 09 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mis a` jour valeur de retour de mpfr_tan
+
+------------------------------------------------------------------------
+r1482 | vlefevre | 2001-11-09 01:38:45 +0000 (Fri, 09 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+Some -'s missing in floating-point.
+
+------------------------------------------------------------------------
+r1481 | zimmerma | 2001-11-08 23:15:59 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+modifs suite aux remarques de Nathalie
+
+------------------------------------------------------------------------
+r1480 | daney | 2001-11-08 17:48:33 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+remove some name of variables
+
+------------------------------------------------------------------------
+r1479 | vlefevre | 2001-11-08 17:14:01 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp2.c
+ D /trunk/pow2.c
+
+cmp2.c: Integer overflows checked.
+
+------------------------------------------------------------------------
+r1478 | vlefevre | 2001-11-08 17:11:36 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/isinteger.c
+ M /trunk/mpfr.h
+ M /trunk/pow.c
+
+Update.
+
+------------------------------------------------------------------------
+r1477 | vlefevre | 2001-11-08 16:42:30 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Fix.
+
+------------------------------------------------------------------------
+r1476 | daney | 2001-11-08 16:37:47 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+suppress variable name in dim min max
+
+------------------------------------------------------------------------
+r1475 | daney | 2001-11-08 16:23:29 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/isinteger.c
+
+export isinteger in the file isinteger.c
+
+------------------------------------------------------------------------
+r1474 | daney | 2001-11-08 16:21:56 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/pow_si.c
+
+exporte pow_si from pow2.c to pow_si.c
+
+------------------------------------------------------------------------
+r1473 | daney | 2001-11-08 16:21:06 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+rename pow2.c in pow.c (source for mpfr_pow)
+
+------------------------------------------------------------------------
+r1472 | daney | 2001-11-08 16:19:49 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/ui_pow_ui.c
+
+add ui_pow_ui.c (initially in pow.c)
+
+------------------------------------------------------------------------
+r1471 | daney | 2001-11-08 16:19:18 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ A /trunk/pow_ui.c
+
+add pow_ui.c file (initially in pow.c)
+
+------------------------------------------------------------------------
+r1470 | vlefevre | 2001-11-08 15:56:09 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp2.c
+ M /trunk/mpfr-impl.h
+
+mpfr_cmp2: return type changed to mp_prec_t.
+
+------------------------------------------------------------------------
+r1469 | daney | 2001-11-08 14:53:54 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+add function test4 for 3 input test + fma tests
+
+------------------------------------------------------------------------
+r1468 | vlefevre | 2001-11-08 03:04:00 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Macros added.
+
+------------------------------------------------------------------------
+r1467 | vlefevre | 2001-11-08 02:15:36 +0000 (Thu, 08 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+MP_LIMB_T_MAX instead of (mp_limb_t) -1 (a little nicer...).
+
+------------------------------------------------------------------------
+r1466 | vlefevre | 2001-11-06 17:05:41 +0000 (Tue, 06 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Code clean-up.
+
+------------------------------------------------------------------------
+r1465 | vlefevre | 2001-11-05 15:44:24 +0000 (Mon, 05 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+
+Prototypes for K&R C.
+
+------------------------------------------------------------------------
+r1464 | vlefevre | 2001-11-05 09:58:14 +0000 (Mon, 05 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+mpfr_round_raw_generic prototype fixed.
+
+------------------------------------------------------------------------
+r1463 | daney | 2001-11-01 14:15:23 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/asin.c
+
+clear xp for Nan Inf or 0 are returned
+
+------------------------------------------------------------------------
+r1462 | daney | 2001-11-01 14:11:48 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+clear variable if an error is return
+
+------------------------------------------------------------------------
+r1461 | daney | 2001-11-01 14:10:50 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/atanh.c
+
+clear x for Nan inf 0 return
+
+------------------------------------------------------------------------
+r1460 | daney | 2001-11-01 14:10:10 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/asinh.c
+
+clear x for Nan Inf 0 return
+
+------------------------------------------------------------------------
+r1459 | daney | 2001-11-01 14:05:15 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+
+clear te
+
+------------------------------------------------------------------------
+r1458 | vlefevre | 2001-11-01 12:20:32 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+Added prototype.
+
+------------------------------------------------------------------------
+r1457 | vlefevre | 2001-11-01 11:53:58 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1456 | zimmerma | 2001-11-01 10:05:27 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+fixed MLK's
+
+------------------------------------------------------------------------
+r1455 | zimmerma | 2001-11-01 09:44:03 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/pow2.c
+
+fixed MLK's in mpfr_isinteger
+
+------------------------------------------------------------------------
+r1454 | zimmerma | 2001-11-01 09:43:32 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow3.c
+
+fixed MLK's
+
+------------------------------------------------------------------------
+r1453 | zimmerma | 2001-11-01 09:04:19 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_pow.c
+
+fixed missing mpfr_clear's
+
+------------------------------------------------------------------------
+r1452 | zimmerma | 2001-11-01 08:02:00 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+added missing mpfr_clear
+
+------------------------------------------------------------------------
+r1451 | zimmerma | 2001-11-01 07:20:30 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added clear's in bug_ddefour
+
+------------------------------------------------------------------------
+r1450 | zimmerma | 2001-11-01 00:42:47 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+added mpfr_clear's
+
+------------------------------------------------------------------------
+r1449 | zimmerma | 2001-11-01 00:10:46 +0000 (Thu, 01 Nov 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+fixed MLK's
+
+------------------------------------------------------------------------
+r1448 | zimmerma | 2001-10-31 23:12:41 +0000 (Wed, 31 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+fixed MLK for Inf or Nan
+
+------------------------------------------------------------------------
+r1447 | zimmerma | 2001-10-31 22:52:06 +0000 (Wed, 31 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+fixed MLK in check_case_2
+
+------------------------------------------------------------------------
+r1446 | daney | 2001-10-31 10:16:21 +0000 (Wed, 31 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+rename factorial -> fac_ui
+
+------------------------------------------------------------------------
+r1445 | rouillie | 2001-10-30 15:26:27 +0000 (Tue, 30 Oct 2001) | 4 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/gmp_op.c
+ M /trunk/mpfr.h
+ M /trunk/tests/Makefile.in
+
+Change mpfr_<op>_mpz to mpfr_<op>_z
+Change mpfr_<op>_mpq to mpfr_<op>_q
+where <op> is mul,div,add,sub
+
+------------------------------------------------------------------------
+r1444 | daney | 2001-10-30 10:30:48 +0000 (Tue, 30 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+
+correct factorial -> fac_ui in comments
+
+------------------------------------------------------------------------
+r1443 | daney | 2001-10-30 10:24:08 +0000 (Tue, 30 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfactorial.c
+
+rename tfactorial -> fac_ui
+
+------------------------------------------------------------------------
+r1442 | daney | 2001-10-30 10:23:25 +0000 (Tue, 30 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+ M /trunk/mpfr.h
+
+rename factorial -> fac_ui
+
+------------------------------------------------------------------------
+r1441 | vlefevre | 2001-10-27 11:16:02 +0000 (Sat, 27 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1440 | zimmerma | 2001-10-26 16:01:03 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tsub_ui.c
+
+drand -> drand48
+
+------------------------------------------------------------------------
+r1439 | zimmerma | 2001-10-26 15:49:21 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+put MAX_PREC back to 100
+
+------------------------------------------------------------------------
+r1438 | zimmerma | 2001-10-26 15:46:37 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added test for inexact flag
+
+------------------------------------------------------------------------
+r1437 | zimmerma | 2001-10-26 15:45:42 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+use MPFR_RET_NAN and MPFR_RET
+
+------------------------------------------------------------------------
+r1436 | zimmerma | 2001-10-26 15:42:23 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+removed MPFR_DEBUG_LEVEL definition
+
+------------------------------------------------------------------------
+r1435 | zimmerma | 2001-10-26 15:39:21 +0000 (Fri, 26 Oct 2001) | 5 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+mpfr_set_q and mpfr_abs now return an int
+mpfr_pow_ui and mpfr_ui_pow_ui now implement exact rounding
+updated the documentation of the mpfr_*pow* functions
+removed some internal functions
+
+------------------------------------------------------------------------
+r1434 | zimmerma | 2001-10-26 15:32:23 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+implemented exact rounding (but no ternary flag)
+
+------------------------------------------------------------------------
+r1433 | daney | 2001-10-26 15:31:42 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+add some flags
+
+------------------------------------------------------------------------
+r1432 | daney | 2001-10-26 15:29:28 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+mixed version beetwen DD and Pau => (gestion des flag inexacte dirige)
+
+------------------------------------------------------------------------
+r1431 | daney | 2001-10-26 15:28:31 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+rien
+
+------------------------------------------------------------------------
+r1430 | zimmerma | 2001-10-26 13:48:33 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+MAX_PREC included
+
+------------------------------------------------------------------------
+r1429 | zimmerma | 2001-10-26 13:31:55 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_q.c
+
+implemented inexact flag
+
+------------------------------------------------------------------------
+r1428 | hanrot | 2001-10-26 13:28:00 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Clearing high part of rem2.
+
+------------------------------------------------------------------------
+r1427 | rouillie | 2001-10-26 13:24:02 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+adds gmp_op.c
+
+------------------------------------------------------------------------
+r1426 | zimmerma | 2001-10-26 13:23:12 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr_set_q now returns an int
+
+------------------------------------------------------------------------
+r1425 | zimmerma | 2001-10-26 13:22:22 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_q.c
+
+added test for inexact flag
+
+------------------------------------------------------------------------
+r1424 | rouillie | 2001-10-26 13:19:40 +0000 (Fri, 26 Oct 2001) | 3 lines
+Changed paths:
+ A /trunk/gmp_op.c
+
+Adds the file gmp_op.c containing the implementations of operations between
+mpfr and mpz/mpq data
+
+------------------------------------------------------------------------
+r1423 | daney | 2001-10-26 13:05:58 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+err <0 => is now tester
+
+------------------------------------------------------------------------
+r1422 | hanrot | 2001-10-26 13:00:54 +0000 (Fri, 26 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+Patch for bits shifted out when the high word of the quotient is nonzero.
+Induced error on inexact flag (and hence on rounding in some cases).
+
+------------------------------------------------------------------------
+r1421 | daney | 2001-10-26 12:46:30 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/copysign.c
+
+add copysign.c
+
+------------------------------------------------------------------------
+r1420 | zimmerma | 2001-10-26 12:41:45 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added one test
+
+------------------------------------------------------------------------
+r1419 | daney | 2001-10-26 12:37:43 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/dim.c
+
+simplify dim
+
+------------------------------------------------------------------------
+r1418 | daney | 2001-10-26 12:32:57 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/thypot.c
+
+add exact flag
+
+------------------------------------------------------------------------
+r1417 | daney | 2001-10-26 12:24:00 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/log_base_10.c
+ M /trunk/log_base_2.c
+ M /trunk/pow2.c
+
+err => long int
+
+------------------------------------------------------------------------
+r1416 | zimmerma | 2001-10-26 12:22:28 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset.c
+
+added one test
+
+------------------------------------------------------------------------
+r1415 | zimmerma | 2001-10-26 12:21:46 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log1p.c
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r1414 | zimmerma | 2001-10-26 12:21:08 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+can_round return 0 for b=0
+
+------------------------------------------------------------------------
+r1413 | daney | 2001-10-26 12:17:06 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+add thypot
+
+------------------------------------------------------------------------
+r1412 | daney | 2001-10-26 11:51:19 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+add coopysign
+
+------------------------------------------------------------------------
+r1411 | daney | 2001-10-26 11:50:27 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+add copysign
+
+------------------------------------------------------------------------
+r1410 | daney | 2001-10-26 11:47:46 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/expm1.c
+
+correct mp_prec_t err => long int
+
+------------------------------------------------------------------------
+r1409 | daney | 2001-10-26 11:47:09 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log1p.c
+
+correst mp_prec_t err => long int
+
+------------------------------------------------------------------------
+r1408 | rouillie | 2001-10-26 11:34:26 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+Add multiplication/division/addition/substraction by mpz and mpq
+
+------------------------------------------------------------------------
+r1407 | zimmerma | 2001-10-26 10:56:14 +0000 (Fri, 26 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added two tests
+fixed bug in generic tests (one more bit is needed to get an exact result)
+
+------------------------------------------------------------------------
+r1406 | zimmerma | 2001-10-26 10:55:36 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed pb with exact results not detected (ck was < 0)
+
+------------------------------------------------------------------------
+r1405 | hanrot | 2001-10-26 09:12:13 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+Rien.
+
+------------------------------------------------------------------------
+r1404 | hanrot | 2001-10-26 09:11:07 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Patch for the computation of the u_lo + r part of the remainder when u_lo = 0.
+
+------------------------------------------------------------------------
+r1403 | zimmerma | 2001-10-26 08:43:09 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tsub.c
+ M /trunk/tests/tui_div.c
+
+added test for inexact flag
+
+------------------------------------------------------------------------
+r1402 | zimmerma | 2001-10-26 08:41:29 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed pbs with inexact flag
+
+------------------------------------------------------------------------
+r1401 | zimmerma | 2001-10-26 08:41:05 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+now mpfr_div and mpfr_ui_div return an int
+
+------------------------------------------------------------------------
+r1400 | zimmerma | 2001-10-26 08:40:13 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/ui_div.c
+
+implemented ternary flag in mpfr_ui_div
+
+------------------------------------------------------------------------
+r1399 | zimmerma | 2001-10-26 08:39:28 +0000 (Fri, 26 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/log_base_2.c
+
+removed unnecessary CLEAR_FLAGS
+used MPFR_RET_NAN
+
+------------------------------------------------------------------------
+r1398 | zimmerma | 2001-10-26 08:38:58 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog_base_2.c
+
+reduced number of tests
+
+------------------------------------------------------------------------
+r1397 | zimmerma | 2001-10-26 08:31:58 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_10.c
+
+removed unnecessary CLEAR_FLAGS
+
+------------------------------------------------------------------------
+r1396 | zimmerma | 2001-10-26 08:30:00 +0000 (Fri, 26 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+improved mpfr_compare
+fixed wrong function name for mpfr_log2
+
+------------------------------------------------------------------------
+r1395 | zimmerma | 2001-10-26 08:23:51 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+rewritten to implement ternary inexact flag
+
+------------------------------------------------------------------------
+r1394 | zimmerma | 2001-10-26 08:15:24 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+fixed generic test (pb with double rounding)
+
+------------------------------------------------------------------------
+r1393 | zimmerma | 2001-10-26 07:46:30 +0000 (Fri, 26 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+increased MAX_PREC
+
+------------------------------------------------------------------------
+r1392 | hanrot | 2001-10-25 22:03:55 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+Changed the type of err from mp_prec_t (unsigned) to int.
+
+------------------------------------------------------------------------
+r1391 | hanrot | 2001-10-25 21:32:42 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/tdiv.c
+
+Added tests for inexact flag.
+
+------------------------------------------------------------------------
+r1390 | hanrot | 2001-10-25 21:32:33 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/algorithms.tex
+ M /trunk/configure
+ M /trunk/div.c
+
+Patch for even rounding.
+
+------------------------------------------------------------------------
+r1389 | daney | 2001-10-25 17:12:26 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_2.c
+
+rien
+
+------------------------------------------------------------------------
+r1388 | daney | 2001-10-25 17:05:29 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_10.c
+
+rien
+
+------------------------------------------------------------------------
+r1387 | vlefevre | 2001-10-25 17:00:10 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+Warning avoided.
+
+------------------------------------------------------------------------
+r1386 | zimmerma | 2001-10-25 17:00:06 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tfma
+
+------------------------------------------------------------------------
+r1385 | zimmerma | 2001-10-25 16:53:36 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfma.c
+
+slong -> t
+
+------------------------------------------------------------------------
+r1384 | zimmerma | 2001-10-25 16:53:05 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+nouvelew version (without loop)
+
+------------------------------------------------------------------------
+r1383 | daney | 2001-10-25 16:51:56 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/pow2.c
+
+rien
+
+------------------------------------------------------------------------
+r1382 | daney | 2001-10-25 16:50:31 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/pow2.c
+ M /trunk/tests/reuse.c
+
+rien
+
+------------------------------------------------------------------------
+r1381 | daney | 2001-10-25 16:45:27 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+change
+
+------------------------------------------------------------------------
+r1380 | vlefevre | 2001-10-25 16:45:20 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1379 | daney | 2001-10-25 16:34:55 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/pow2.c
+
+correct bugs with reuse
+
+------------------------------------------------------------------------
+r1378 | daney | 2001-10-25 16:34:05 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+test for log2 log10 pow
+
+------------------------------------------------------------------------
+r1377 | hanrot | 2001-10-25 16:29:46 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/mpfr.h
+
+La division nouvelle est arrivee.
+
+------------------------------------------------------------------------
+r1376 | zimmerma | 2001-10-25 16:04:18 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+ajoute' nouveau test
+
+------------------------------------------------------------------------
+r1375 | vlefevre | 2001-10-25 15:34:17 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1374 | hanrot | 2001-10-25 15:26:36 +0000 (Thu, 25 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/round.c
+
+round_raw, round_raw2 -> round_raw_generic. Macros to simulate previous
+behaviour. Even rounding returns +- MPFR_EVEN_INEX.
+
+------------------------------------------------------------------------
+r1373 | zimmerma | 2001-10-25 15:24:11 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_10.c
+
+fixed pb with mpfr_log10(a, a) with a=-Inf
+
+------------------------------------------------------------------------
+r1372 | zimmerma | 2001-10-25 15:14:01 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added two tests
+
+------------------------------------------------------------------------
+r1371 | zimmerma | 2001-10-25 15:06:12 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+added one test
+
+------------------------------------------------------------------------
+r1370 | daney | 2001-10-25 15:03:13 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+add log2 and log10
+
+------------------------------------------------------------------------
+r1369 | daney | 2001-10-25 15:02:59 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_10.c
+
+correction for reuse
+
+------------------------------------------------------------------------
+r1368 | daney | 2001-10-25 15:02:45 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_2.c
+
+coorection for reuse
+
+------------------------------------------------------------------------
+r1367 | zimmerma | 2001-10-25 14:53:19 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/texceptions.c
+
+test file for testing exceptions
+
+------------------------------------------------------------------------
+r1366 | vlefevre | 2001-10-25 14:32:20 +0000 (Thu, 25 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/add.c
+
+mpfr_add1 completely rewritten. Overflows are checked.
+The ternary value should now be supported (but it hasn't been tested yet).
+
+------------------------------------------------------------------------
+r1365 | daney | 2001-10-25 14:04:09 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/fma.c
+
+new version
+
+------------------------------------------------------------------------
+r1364 | zimmerma | 2001-10-25 13:54:46 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added one test
+
+------------------------------------------------------------------------
+r1363 | zimmerma | 2001-10-25 13:54:27 +0000 (Thu, 25 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/tgeneric.c
+
+add possibility to define a random function (default is mpfr_random)
+to get random variables in specific ranges
+
+------------------------------------------------------------------------
+r1362 | zimmerma | 2001-10-25 13:53:19 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tacosh.c
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatanh.c
+
+now use tgeneric.c
+
+------------------------------------------------------------------------
+r1361 | zimmerma | 2001-10-25 13:50:49 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added texceptions
+
+------------------------------------------------------------------------
+r1360 | zimmerma | 2001-10-25 13:49:56 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+documented exception mechanism (with Vincent Lefe`vre)
+
+------------------------------------------------------------------------
+r1359 | zimmerma | 2001-10-25 13:48:28 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tfactorial.c
+
+changed stupid test (was computing only 200!)
+
+------------------------------------------------------------------------
+r1358 | zimmerma | 2001-10-25 13:47:27 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/factorial.c
+
+implemented inexact flag
+
+------------------------------------------------------------------------
+r1357 | zimmerma | 2001-10-25 13:45:42 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+
+1999 -> 2001
+
+------------------------------------------------------------------------
+r1356 | zimmerma | 2001-10-25 13:45:14 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+check overflow
+
+------------------------------------------------------------------------
+r1355 | zimmerma | 2001-10-25 13:39:35 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+added two tests
+
+------------------------------------------------------------------------
+r1354 | zimmerma | 2001-10-25 13:37:24 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+implemented overflow/underflow
+
+------------------------------------------------------------------------
+r1353 | daney | 2001-10-25 13:36:56 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/atanh.c
+
+correct atanh(INF)=INF exact
+
+------------------------------------------------------------------------
+r1352 | daney | 2001-10-25 13:14:54 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+correct test inf for atanh
+
+------------------------------------------------------------------------
+r1351 | zimmerma | 2001-10-25 12:52:08 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added warning for mpfr_set_d
+
+------------------------------------------------------------------------
+r1350 | daney | 2001-10-25 09:19:06 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+correct bug in tests file (test of atanh for + or - Inf)
+
+------------------------------------------------------------------------
+r1349 | zimmerma | 2001-10-25 08:37:39 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tadd_ui (forgotten?)
+
+------------------------------------------------------------------------
+r1348 | zimmerma | 2001-10-25 08:37:19 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+
+added special test
+
+------------------------------------------------------------------------
+r1347 | zimmerma | 2001-10-25 08:36:55 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed bug in rounding part when rounding towards 0 (infinite loop due to bn<an)
+
+------------------------------------------------------------------------
+r1346 | zimmerma | 2001-10-25 08:34:51 +0000 (Thu, 25 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tasinh.c
+
+added one special test
+
+------------------------------------------------------------------------
+r1345 | daney | 2001-10-24 17:33:12 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/minmax.c
+
+correct the Nan case
+
+------------------------------------------------------------------------
+r1344 | daney | 2001-10-24 17:23:08 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/dim.c
+
+add the function mpfr_dim
+
+------------------------------------------------------------------------
+r1343 | daney | 2001-10-24 17:22:36 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/minmax.c
+
+add function mpfr_min and mpfr_max
+
+------------------------------------------------------------------------
+r1342 | daney | 2001-10-24 16:12:27 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tasinh.c
+ M /trunk/tests/tatanh.c
+
+correct these tesats files
+
+------------------------------------------------------------------------
+r1341 | daney | 2001-10-24 16:11:23 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+ M /trunk/cosh.c
+ M /trunk/sinh.c
+ M /trunk/tanh.c
+
+correct some bugs
+
+------------------------------------------------------------------------
+r1340 | zimmerma | 2001-10-24 15:47:48 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added EXTRA_DIST= tgeneric.c
+
+------------------------------------------------------------------------
+r1339 | daney | 2001-10-24 15:32:28 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+remove tfma
+
+------------------------------------------------------------------------
+r1338 | daney | 2001-10-24 15:29:56 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tfma.c
+
+add tfma
+
+------------------------------------------------------------------------
+r1337 | daney | 2001-10-24 09:34:27 +0000 (Wed, 24 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+
+acosh revue et corrige...+beau
+
+------------------------------------------------------------------------
+r1336 | daney | 2001-10-23 16:57:30 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+add mpfr_log10
+
+------------------------------------------------------------------------
+r1335 | daney | 2001-10-23 16:56:22 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ A /trunk/log_base_10.c
+
+add log_base_10
+
+------------------------------------------------------------------------
+r1334 | daney | 2001-10-23 16:55:58 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+add tlog_base_10
+
+------------------------------------------------------------------------
+r1333 | daney | 2001-10-23 16:55:25 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tlog_base_10.c
+
+add test file for log_base_10 function
+
+------------------------------------------------------------------------
+r1332 | daney | 2001-10-23 16:54:12 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+correct a bug in mpfr_log10 section
+
+------------------------------------------------------------------------
+r1331 | daney | 2001-10-23 13:14:13 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+add help of log10 + fma
+
+------------------------------------------------------------------------
+r1330 | daney | 2001-10-23 12:38:15 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_2.c
+
+correct particular cases
+
+------------------------------------------------------------------------
+r1329 | daney | 2001-10-23 12:33:00 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/log_base_2.c
+
+improve the clear flags
+
+------------------------------------------------------------------------
+r1328 | daney | 2001-10-23 09:41:29 +0000 (Tue, 23 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow3.c
+
+correction dans l'entete
+
+------------------------------------------------------------------------
+r1327 | vlefevre | 2001-10-21 07:56:29 +0000 (Sun, 21 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tdiv.c
+
+Some changes to avoid warnings.
+
+------------------------------------------------------------------------
+r1326 | vlefevre | 2001-10-21 07:12:18 +0000 (Sun, 21 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Bug fixed (char -> int).
+
+------------------------------------------------------------------------
+r1325 | vlefevre | 2001-10-19 20:47:39 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.in
+
+Update.
+
+------------------------------------------------------------------------
+r1324 | vlefevre | 2001-10-19 20:45:12 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/sub_ui.c
+
+Bugs fixed concerning the "inexact" ternary value.
+
+------------------------------------------------------------------------
+r1323 | daney | 2001-10-19 16:56:51 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+suppress thypot tgeneric
+
+------------------------------------------------------------------------
+r1322 | daney | 2001-10-19 16:53:12 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+suppress sample
+
+------------------------------------------------------------------------
+r1321 | zimmerma | 2001-10-19 16:26:47 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+void -> int as return value for mpfr_add_ui
+
+------------------------------------------------------------------------
+r1320 | zimmerma | 2001-10-19 16:26:19 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add_ui.c
+
+added ternary flag
+
+------------------------------------------------------------------------
+r1319 | zimmerma | 2001-10-19 16:24:50 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+void -> int for mpfr_add and mpfr_add_ui
+
+------------------------------------------------------------------------
+r1318 | daney | 2001-10-19 16:21:08 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/thypot.c
+
+add test for hypot
+
+------------------------------------------------------------------------
+r1317 | daney | 2001-10-19 16:15:16 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+add some test
+
+------------------------------------------------------------------------
+r1316 | daney | 2001-10-19 16:13:56 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+add some functions
+
+------------------------------------------------------------------------
+r1315 | daney | 2001-10-19 16:12:44 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+add some proto
+
+------------------------------------------------------------------------
+r1314 | daney | 2001-10-19 16:09:34 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tpow3.c
+
+add test file for pow
+
+------------------------------------------------------------------------
+r1313 | daney | 2001-10-19 16:09:01 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+add the help for pow and pow_si
+
+------------------------------------------------------------------------
+r1312 | daney | 2001-10-19 16:08:29 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/pow2.c
+
+add the function pow and pow_si
+
+------------------------------------------------------------------------
+r1311 | zimmerma | 2001-10-19 16:02:34 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added two tests for 0-c and c-0 with prec(c) > prec(a)
+
+------------------------------------------------------------------------
+r1310 | vlefevre | 2001-10-19 15:53:17 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/neg.c
+
+Removed #include <stdio.h>, "return 0;" replaced by "MPFR_RET(0);".
+
+------------------------------------------------------------------------
+r1309 | vlefevre | 2001-10-19 15:45:18 +0000 (Fri, 19 Oct 2001) | 4 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/sub.c
+
+mpfr_add1 and mpfr_sub1 prototypes moved to mpfr-impl.h (to detect clashes).
+Bug fix concerning the inexact ternary value in mpfr_sub.
+mpfr_add now returns an int (inexact ternary value unsupported if true add).
+
+------------------------------------------------------------------------
+r1308 | vlefevre | 2001-10-19 14:49:44 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+Update.
+
+------------------------------------------------------------------------
+r1307 | vlefevre | 2001-10-19 14:13:10 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+Underflow/overflow check.
+
+------------------------------------------------------------------------
+r1306 | vlefevre | 2001-10-19 14:02:01 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Documentation updated.
+
+------------------------------------------------------------------------
+r1305 | vlefevre | 2001-10-19 13:57:06 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_ui.c
+
+Comment added.
+
+------------------------------------------------------------------------
+r1304 | vlefevre | 2001-10-19 13:41:41 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+MPFR_RET(0) replaced by MPFR_RET_NAN.
+
+------------------------------------------------------------------------
+r1303 | vlefevre | 2001-10-19 13:28:41 +0000 (Fri, 19 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Macro MPFR_RET_NAN.
+
+------------------------------------------------------------------------
+r1302 | vlefevre | 2001-10-18 17:29:45 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Code clean-up in mpfr_round_raw (well... IMHO).
+
+------------------------------------------------------------------------
+r1301 | daney | 2001-10-18 15:30:04 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/ui_pow.c
+
+take in account of CHAR_BIT in ui_pow
+
+------------------------------------------------------------------------
+r1300 | zimmerma | 2001-10-18 15:21:45 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+cast to mp_limb_t was missing
+
+------------------------------------------------------------------------
+r1299 | vlefevre | 2001-10-18 15:05:45 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/acosh.c
+ M /trunk/asinh.c
+ M /trunk/atanh.c
+ M /trunk/factorial.c
+
+BITS_PER_CHAR replaced by the standard CHAR_BIT.
+
+------------------------------------------------------------------------
+r1298 | hanrot | 2001-10-18 14:58:14 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r1297 | daney | 2001-10-18 13:55:26 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tui_pow.c
+
+add test of ui_pow
+
+------------------------------------------------------------------------
+r1296 | daney | 2001-10-18 13:54:47 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+add the help of ui_pow
+
+------------------------------------------------------------------------
+r1295 | daney | 2001-10-18 13:54:21 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/ui_pow.c
+
+add the function pow(unsign long int, mpfr_t)
+
+------------------------------------------------------------------------
+r1294 | vlefevre | 2001-10-18 13:52:48 +0000 (Thu, 18 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/configure
+ M /trunk/configure.in
+
+Improved configure.in.
+configure generated by Autoconf 2.52.
+
+------------------------------------------------------------------------
+r1293 | daney | 2001-10-18 12:09:08 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+ajout du flag inexact
+
+------------------------------------------------------------------------
+r1292 | vlefevre | 2001-10-18 11:27:38 +0000 (Thu, 18 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/configure
+
+fixed and improved check for gmp.h/gmp-impl.h/config.h/gmp-mparam.h/longlong.h
+and corresponding error message
+
+------------------------------------------------------------------------
+r1291 | daney | 2001-10-18 10:38:10 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+add the help on log2
+
+------------------------------------------------------------------------
+r1290 | daney | 2001-10-18 10:36:00 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tlog_base_2.c
+
+add the test file of the log2 (log in base 2)
+
+------------------------------------------------------------------------
+r1289 | daney | 2001-10-18 10:35:11 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/log_base_2.c
+
+ajout de log2 (log en base 2)
+
+------------------------------------------------------------------------
+r1288 | daney | 2001-10-18 10:24:43 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+correst tanh(0)
+
+------------------------------------------------------------------------
+r1287 | zimmerma | 2001-10-18 10:20:41 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+added two more tests
+
+------------------------------------------------------------------------
+r1286 | zimmerma | 2001-10-18 10:20:09 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+wrong sign passed to mpfr_can_round (mp_limb_t may be unsigned)
+
+------------------------------------------------------------------------
+r1285 | daney | 2001-10-18 10:10:49 +0000 (Thu, 18 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sinh.c
+
+correct a bug for sinh(Inf)
+
+------------------------------------------------------------------------
+r1284 | daney | 2001-10-17 15:49:52 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tanh.c
+
+correct syntax of tanh.c
+
+------------------------------------------------------------------------
+r1283 | daney | 2001-10-17 15:47:03 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sinh.c
+
+correct an error
+
+------------------------------------------------------------------------
+r1282 | daney | 2001-10-17 15:42:10 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/cosh.c
+
+correct few things
+
+------------------------------------------------------------------------
+r1281 | daney | 2001-10-17 15:29:50 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/cosh.c
+
+little patch for cosh
+
+------------------------------------------------------------------------
+r1280 | daney | 2001-10-17 15:04:43 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/texpm1.c
+
+add the test function of expm1
+
+------------------------------------------------------------------------
+r1279 | daney | 2001-10-17 15:04:06 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tlog1p.c
+
+add the test of the function log1p
+
+------------------------------------------------------------------------
+r1278 | daney | 2001-10-17 15:03:04 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/expm1.c
+
+add the function expm1
+
+------------------------------------------------------------------------
+r1277 | daney | 2001-10-17 15:02:30 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/log1p.c
+
+add the function log1p
+
+------------------------------------------------------------------------
+r1276 | daney | 2001-10-17 12:50:15 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+add to mpfr.texi log1p and expm1
+
+------------------------------------------------------------------------
+r1275 | daney | 2001-10-17 12:37:46 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+actualisation de exp2.c
+
+------------------------------------------------------------------------
+r1274 | daney | 2001-10-17 12:36:51 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+actualisation de exp2
+
+------------------------------------------------------------------------
+r1273 | hanrot | 2001-10-17 10:28:27 +0000 (Wed, 17 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/tdiv.c
+
+New tests in tdiv.c.
+
+------------------------------------------------------------------------
+r1272 | hanrot | 2001-10-17 10:28:14 +0000 (Wed, 17 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/div.c
+ A /trunk/div2.c
+
+New division in div.c, old one renamed in mpfr_div2. Remains to implement
+exact/inexact flag. Should not be *that* hard.
+
+------------------------------------------------------------------------
+r1271 | daney | 2001-10-16 16:02:21 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+ajout de functions pow, fma, hypot etc etc
+
+------------------------------------------------------------------------
+r1270 | zimmerma | 2001-10-16 15:48:48 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added fma.c
+
+------------------------------------------------------------------------
+r1269 | zimmerma | 2001-10-16 15:48:34 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototypes for mpfr_fma and mpfr_hypot
+
+------------------------------------------------------------------------
+r1268 | zimmerma | 2001-10-16 15:48:12 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/hypot.c
+
+small changes for inexact flag
+
+------------------------------------------------------------------------
+r1267 | zimmerma | 2001-10-16 15:41:38 +0000 (Tue, 16 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/fma.c
+
+added some cases for Inf
+implement (partly) inexact flag
+
+------------------------------------------------------------------------
+r1266 | daney | 2001-10-16 15:09:29 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/hypot.c
+
+ajout hypot
+
+------------------------------------------------------------------------
+r1265 | daney | 2001-10-16 15:06:29 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/fma.c
+
+ajout de fma
+
+------------------------------------------------------------------------
+r1264 | vlefevre | 2001-10-16 10:13:02 +0000 (Tue, 16 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+Comment: // --> /* ... */
+
+------------------------------------------------------------------------
+r1263 | zimmerma | 2001-10-15 14:19:10 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tgeneric.c
+
+generic test file
+
+------------------------------------------------------------------------
+r1262 | zimmerma | 2001-10-15 14:16:50 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+added cast to (void*) for new functions returning an int
+
+------------------------------------------------------------------------
+r1261 | zimmerma | 2001-10-15 14:16:25 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+
+added test for inexact flag
+
+------------------------------------------------------------------------
+r1260 | zimmerma | 2001-10-15 14:15:49 +0000 (Mon, 15 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/tcos.c
+
+now use tgeneric.c
+added more tests
+
+------------------------------------------------------------------------
+r1259 | zimmerma | 2001-10-15 14:15:27 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcosh.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/texp2.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsinh.c
+ M /trunk/tests/ttan.c
+ M /trunk/tests/ttanh.c
+
+now use tgeneric.c
+
+------------------------------------------------------------------------
+r1258 | zimmerma | 2001-10-15 14:14:38 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+fixed test of return values for infinities: foo(+/-Inf) is *exact*
+
+------------------------------------------------------------------------
+r1257 | zimmerma | 2001-10-15 14:13:33 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset.c
+
+now also try with negative numbers
+
+------------------------------------------------------------------------
+r1256 | zimmerma | 2001-10-15 14:09:24 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/cos.c
+ M /trunk/cosh.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp_2.c
+ M /trunk/log.c
+
+implement ternary inexact flag
+
+------------------------------------------------------------------------
+r1255 | zimmerma | 2001-10-15 14:08:57 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/div_2exp.c
+ M /trunk/exp3.c
+ M /trunk/mul_2exp.c
+
+implement inexact flag
+
+------------------------------------------------------------------------
+r1254 | zimmerma | 2001-10-15 14:06:46 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+return type is now int for mpfr_mul_2exp and mpfr_div_2exp
+
+------------------------------------------------------------------------
+r1253 | zimmerma | 2001-10-15 14:06:17 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+return type is now int for more functions
+
+------------------------------------------------------------------------
+r1252 | zimmerma | 2001-10-15 14:05:10 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+sign was not set
+
+------------------------------------------------------------------------
+r1251 | zimmerma | 2001-10-15 14:04:24 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+rewritten completely mpfr_can_round_raw
+
+------------------------------------------------------------------------
+r1250 | zimmerma | 2001-10-15 14:02:37 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+documented mpfr_set4
+
+------------------------------------------------------------------------
+r1249 | zimmerma | 2001-10-15 14:02:13 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+return non-zero if malloc failed
+
+------------------------------------------------------------------------
+r1248 | zimmerma | 2001-10-15 14:01:42 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/set_q.c
+
+cosmetic changes
+
+------------------------------------------------------------------------
+r1247 | zimmerma | 2001-10-15 14:01:18 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sin.c
+ M /trunk/sinh.c
+ M /trunk/tan.c
+ M /trunk/tanh.c
+
+implement ternary inexact flag
+
+------------------------------------------------------------------------
+r1246 | zimmerma | 2001-10-15 14:00:45 +0000 (Mon, 15 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sqrt_ui.c
+
+avoid one variable
+
+------------------------------------------------------------------------
+r1245 | daney | 2001-10-12 15:19:02 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+correction d'erreurs sur les notations + correction de la regle 9
+
+------------------------------------------------------------------------
+r1244 | zimmerma | 2001-10-12 12:56:24 +0000 (Fri, 12 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+fixed MPFR_ASSERT
+documented MPFR_ASSERTN and MPFR_ASSERTD
+
+------------------------------------------------------------------------
+r1243 | zimmerma | 2001-10-12 12:24:18 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+added test for mpfr_init_set_f prototype
+
+------------------------------------------------------------------------
+r1242 | zimmerma | 2001-10-12 12:23:50 +0000 (Fri, 12 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added test for inexact flag
+corrected a wrong test
+
+------------------------------------------------------------------------
+r1241 | zimmerma | 2001-10-12 12:23:11 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+cosmetic change
+
+------------------------------------------------------------------------
+r1240 | zimmerma | 2001-10-12 12:22:36 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tsub_ui (did exist but forgotten in Makefile) and tset (new file)
+
+------------------------------------------------------------------------
+r1239 | zimmerma | 2001-10-12 12:21:40 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tset.c
+
+test file for mpfr_set, initial version
+
+------------------------------------------------------------------------
+r1238 | zimmerma | 2001-10-12 12:20:53 +0000 (Fri, 12 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+void -> int as return value for several functions
+and explained the ternary return value
+
+------------------------------------------------------------------------
+r1237 | zimmerma | 2001-10-12 12:19:49 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/neg.c
+ M /trunk/set_f.c
+ M /trunk/ui_sub.c
+
+implemented inexact flag
+
+------------------------------------------------------------------------
+r1236 | zimmerma | 2001-10-12 12:18:46 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+void -> int as return value for new functions implementing inexact flag
+
+------------------------------------------------------------------------
+r1235 | zimmerma | 2001-10-12 12:18:10 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+implemeted inexact flag in mpfr_set_d
+
+------------------------------------------------------------------------
+r1234 | zimmerma | 2001-10-12 12:17:24 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+implemented inexact flag in mpfr_round
+
+------------------------------------------------------------------------
+r1233 | zimmerma | 2001-10-12 12:16:13 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+completely rewritten
+
+------------------------------------------------------------------------
+r1232 | zimmerma | 2001-10-12 12:15:46 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+computation of inexact flag now directly uses mpfr_round_raw
+
+------------------------------------------------------------------------
+r1231 | zimmerma | 2001-10-12 12:13:27 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+added 'if' in MPFR_ASSERT to avoid compiler warning
+
+------------------------------------------------------------------------
+r1230 | zimmerma | 2001-10-12 12:12:07 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+put initial value in variables which may be used without being initialized
+
+------------------------------------------------------------------------
+r1229 | zimmerma | 2001-10-12 12:11:23 +0000 (Fri, 12 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated things done, added Rounding section
+
+------------------------------------------------------------------------
+r1228 | daney | 2001-10-11 16:47:30 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+ajout de log1p et expm1
+
+------------------------------------------------------------------------
+r1227 | zimmerma | 2001-10-11 15:26:57 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tatan.c
+
+reduced number of random tests (took too much time)
+
+------------------------------------------------------------------------
+r1226 | zimmerma | 2001-10-11 15:19:04 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added random tests for inexact flag
+
+------------------------------------------------------------------------
+r1225 | zimmerma | 2001-10-11 15:18:22 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+ M /trunk/sub_ui.c
+
+implemented inexact flag
+
+------------------------------------------------------------------------
+r1224 | zimmerma | 2001-10-11 15:05:13 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_sub.c
+
+added random tests for inexact flag
+
+------------------------------------------------------------------------
+r1223 | daney | 2001-10-11 14:51:03 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+ajout du log generic et de fma
+
+------------------------------------------------------------------------
+r1222 | zimmerma | 2001-10-11 12:33:08 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+inexact flag was wrong in some cases
+
+------------------------------------------------------------------------
+r1221 | zimmerma | 2001-10-11 12:31:37 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added random tests for inexact flag
+
+------------------------------------------------------------------------
+r1220 | zimmerma | 2001-10-11 12:28:53 +0000 (Thu, 11 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/tasin.c
+
+reduced number of loops per precision from 100 to 10
+(test was too long)
+
+------------------------------------------------------------------------
+r1219 | zimmerma | 2001-10-11 08:25:55 +0000 (Thu, 11 Oct 2001) | 3 lines
+Changed paths:
+ M /trunk/configure
+
+improved check for gmp-impl.h/config.h/gmp-mparam.h/longlong.h
+and corresponding error message
+
+------------------------------------------------------------------------
+r1218 | zimmerma | 2001-10-11 08:25:03 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+stack-alloc.h no longer needed (will be included in gmp-impl.h)
+
+------------------------------------------------------------------------
+r1217 | zimmerma | 2001-10-11 08:24:35 +0000 (Thu, 11 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+stack-alloc.h is no longer needed (will be included in gmp-impl.h)
+
+------------------------------------------------------------------------
+r1216 | zimmerma | 2001-10-09 13:25:20 +0000 (Tue, 09 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added proof of rules
+
+------------------------------------------------------------------------
+r1215 | zimmerma | 2001-10-09 11:38:44 +0000 (Tue, 09 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+fixed buggy test
+
+------------------------------------------------------------------------
+r1214 | zimmerma | 2001-10-05 07:35:10 +0000 (Fri, 05 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed bug for b + d where b=2^900+2^500+2^110, d=2^900-2^500-2^110
+
+------------------------------------------------------------------------
+r1213 | zimmerma | 2001-10-03 10:24:47 +0000 (Wed, 03 Oct 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+fixed bug in mpfr_set_d on 64-bit machines
+
+------------------------------------------------------------------------
+r1212 | zimmerma | 2001-09-28 12:13:30 +0000 (Fri, 28 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+fixed a few problems in mpfr_set_d for sizer < MPFR_LIMBS_PER_DOUBLE
+
+------------------------------------------------------------------------
+r1211 | zimmerma | 2001-09-28 10:15:12 +0000 (Fri, 28 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.bib
+
+added paper of Brent and McMillan
+
+------------------------------------------------------------------------
+r1210 | zimmerma | 2001-09-28 10:11:04 +0000 (Fri, 28 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+does not call compare_exp2_exp3 when argc=4
+
+------------------------------------------------------------------------
+r1209 | zimmerma | 2001-09-28 10:09:06 +0000 (Fri, 28 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one item
+
+------------------------------------------------------------------------
+r1208 | zimmerma | 2001-09-28 09:42:22 +0000 (Fri, 28 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/set_prec.c
+
+now mpfr_set_prec returns 1 instead of producing an error in case prec=0
+
+------------------------------------------------------------------------
+r1207 | daney | 2001-09-27 13:03:29 +0000 (Thu, 27 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+New version with new generic function + / * etc
+
+------------------------------------------------------------------------
+r1206 | vlefevre | 2001-09-20 15:08:05 +0000 (Thu, 20 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/BUGS
+ M /trunk/INSTALL
+ M /trunk/README
+
+BUGS updated.
+
+------------------------------------------------------------------------
+r1205 | vlefevre | 2001-09-13 16:35:18 +0000 (Thu, 13 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttan.c
+
+Prototype changes.
+
+------------------------------------------------------------------------
+r1204 | vlefevre | 2001-09-13 13:20:40 +0000 (Thu, 13 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/dump.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+
+<strings.h> -> <string.h> (ISO C).
+
+------------------------------------------------------------------------
+r1203 | vlefevre | 2001-09-13 13:12:21 +0000 (Thu, 13 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_prc_raw.c
+
+#include added.
+
+------------------------------------------------------------------------
+r1202 | vlefevre | 2001-09-13 12:32:44 +0000 (Thu, 13 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/agm.c
+ M /trunk/euler.c
+ M /trunk/init.c
+ M /trunk/pi.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/set_prec.c
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tcos.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/tests/tisnan.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/tsin.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttan.c
+
+#include added/removed.
+
+------------------------------------------------------------------------
+r1201 | vlefevre | 2001-09-13 12:16:12 +0000 (Thu, 13 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/configure
+ M /trunk/configure.in
+ M /trunk/mpfr-impl.h
+
+GCC option -Wno-implicit removed and prototype added to mpfr-impl.h
+
+------------------------------------------------------------------------
+r1200 | vlefevre | 2001-09-12 15:51:26 +0000 (Wed, 12 Sep 2001) | 8 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/Makefile.in
+
+INCLUDES in Makefile.am: -I$(top_srcdir) and @INCLUDES@ swapped.
+This defines the following precedence for the tests:
+ 1) MPFR directories
+ 2) User-defined directory
+ 3) GMP include directory
+This allows the user to override the GMP longlong.h file with the
+gcc-3 one, by using: INCLUDES="-I.../include" ./configure ...
+
+------------------------------------------------------------------------
+r1199 | vlefevre | 2001-09-12 13:50:42 +0000 (Wed, 12 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+
+#include order fixed.
+
+------------------------------------------------------------------------
+r1198 | vlefevre | 2001-09-12 12:19:27 +0000 (Wed, 12 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+Tests added (in particular, inex value).
+
+------------------------------------------------------------------------
+r1197 | vlefevre | 2001-09-12 12:19:06 +0000 (Wed, 12 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1196 | vlefevre | 2001-09-11 15:21:52 +0000 (Tue, 11 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+MPFR_RET: definition changed to avoid warning.
+
+------------------------------------------------------------------------
+r1195 | vlefevre | 2001-09-11 14:02:32 +0000 (Tue, 11 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/set.c
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+
+Inexact ternary value for mpfr_set4, mpfr_set_ui and mpfr_set_si.
+
+------------------------------------------------------------------------
+r1194 | vlefevre | 2001-09-11 13:55:08 +0000 (Tue, 11 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Macro SAFE_ABS.
+
+------------------------------------------------------------------------
+r1193 | vlefevre | 2001-09-11 13:16:51 +0000 (Tue, 11 Sep 2001) | 3 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+
+Inexact ternary value and flag for mpfr_set_underflow, mpfr_set_overflow
+and mpfr_check_range.
+
+------------------------------------------------------------------------
+r1192 | vlefevre | 2001-09-11 03:20:42 +0000 (Tue, 11 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/set.c
+
+Macro MPFR_RET added. Ternary value for mpfr_set4.
+
+------------------------------------------------------------------------
+r1191 | vlefevre | 2001-09-11 01:02:15 +0000 (Tue, 11 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+ M /trunk/mpfr.h
+
+New flags.
+
+------------------------------------------------------------------------
+r1190 | vlefevre | 2001-09-10 23:58:12 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/div.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_f.c
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/sqrt.c
+ M /trunk/tests/Makefile.in
+
+Parameter added to mpfr_round_raw: pointer to inexact ternary value.
+
+------------------------------------------------------------------------
+r1189 | hanrot | 2001-09-10 16:30:21 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Zqwiuyt
+
+------------------------------------------------------------------------
+r1188 | hanrot | 2001-09-10 16:21:42 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Zorgs.
+
+------------------------------------------------------------------------
+r1187 | hanrot | 2001-09-10 15:42:12 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Gleurbs.
+
+------------------------------------------------------------------------
+r1186 | hanrot | 2001-09-10 15:40:57 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Patch grotesque.
+
+------------------------------------------------------------------------
+r1185 | hanrot | 2001-09-10 15:20:08 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Patch for the case SIZE(r) < MPFR_LIMBS_PER_DOUBLE.
+
+------------------------------------------------------------------------
+r1184 | zimmerma | 2001-09-10 07:47:29 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/ttan.c
+
+test file for mpfr_tan
+
+------------------------------------------------------------------------
+r1183 | zimmerma | 2001-09-10 07:47:15 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin.c
+
+fixed a few typos
+
+------------------------------------------------------------------------
+r1182 | zimmerma | 2001-09-10 07:46:56 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/tests/reuse.c
+
+added mpfr_tan
+
+------------------------------------------------------------------------
+r1181 | zimmerma | 2001-09-10 07:46:37 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added ttan
+
+------------------------------------------------------------------------
+r1180 | zimmerma | 2001-09-10 07:45:54 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added the tangent
+
+------------------------------------------------------------------------
+r1179 | zimmerma | 2001-09-10 07:45:14 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added tan.c
+
+------------------------------------------------------------------------
+r1178 | zimmerma | 2001-09-10 07:44:05 +0000 (Mon, 10 Sep 2001) | 2 lines
+Changed paths:
+ A /trunk/tan.c
+
+tangent function
+
+------------------------------------------------------------------------
+r1177 | zimmerma | 2001-09-07 12:46:54 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+removed mpfr_sin and mpfr_cos (now separate implementations)
+
+------------------------------------------------------------------------
+r1176 | zimmerma | 2001-09-07 12:45:52 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+removed sin_cos
+
+------------------------------------------------------------------------
+r1175 | zimmerma | 2001-09-07 12:41:15 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added sine and cosine
+
+------------------------------------------------------------------------
+r1174 | zimmerma | 2001-09-07 12:40:29 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+removed sin_cos, added sin and cos
+
+------------------------------------------------------------------------
+r1173 | zimmerma | 2001-09-07 12:37:21 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+removed mpfr_sin_cos
+
+------------------------------------------------------------------------
+r1172 | zimmerma | 2001-09-07 12:32:28 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+removed sin_cos, added sin and cos
+
+------------------------------------------------------------------------
+r1171 | zimmerma | 2001-09-07 12:32:07 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+removed tsin_cos, added tsin and tcos
+
+------------------------------------------------------------------------
+r1170 | zimmerma | 2001-09-07 12:30:42 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tcos.c
+ A /trunk/tests/tsin.c
+
+test files for mpfr_cos and mpfr_sin
+
+------------------------------------------------------------------------
+r1169 | zimmerma | 2001-09-07 12:30:14 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ A /trunk/sin.c
+
+new implementation of mpfr_sin, using mpfr_cos
+
+------------------------------------------------------------------------
+r1168 | zimmerma | 2001-09-07 12:29:52 +0000 (Fri, 07 Sep 2001) | 2 lines
+Changed paths:
+ A /trunk/cos.c
+
+new (faster) implementation of mpfr_cos
+
+------------------------------------------------------------------------
+r1167 | vlefevre | 2001-09-06 15:59:15 +0000 (Thu, 06 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/exceptions.c
+
+Fix: flags set in mpfr_set_{under,over}flow().
+
+------------------------------------------------------------------------
+r1166 | vlefevre | 2001-09-06 12:49:53 +0000 (Thu, 06 Sep 2001) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+Cases where the result is 0 fixed.
+Integer overflow checked in mpfr_sub.
+
+------------------------------------------------------------------------
+r1165 | vlefevre | 2001-09-06 11:35:12 +0000 (Thu, 06 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/add.c
+
+In add.c: use mpfr_cmp_abs instead of mpfr_cmp3; x - x fixed for GMP_RNDD.
+
+------------------------------------------------------------------------
+r1164 | vlefevre | 2001-09-06 10:27:57 +0000 (Thu, 06 Sep 2001) | 2 lines
+Changed paths:
+ A /trunk/cmp_abs.c
+
+Compare the absolute values of two nonzero FP numbers.
+
+------------------------------------------------------------------------
+r1163 | vlefevre | 2001-09-05 15:40:47 +0000 (Wed, 05 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+ M /trunk/mpfr.h
+
+mpfr_cmp3 changed and integer overflows checked.
+
+------------------------------------------------------------------------
+r1162 | zimmerma | 2001-09-05 09:52:50 +0000 (Wed, 05 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added efficiency item
+
+------------------------------------------------------------------------
+r1161 | vlefevre | 2001-09-03 14:52:45 +0000 (Mon, 03 Sep 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Cases [+-]0 + [+-]0 fixed (depending on the rounding mode).
+
+------------------------------------------------------------------------
+r1160 | vlefevre | 2001-08-29 15:29:46 +0000 (Wed, 29 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+Optimization + overflow support.
+
+------------------------------------------------------------------------
+r1159 | vlefevre | 2001-08-29 14:10:30 +0000 (Wed, 29 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/mpfr-impl.h
+
+Case +0 + -0 fixed.
+
+------------------------------------------------------------------------
+r1158 | zimmerma | 2001-08-29 12:30:24 +0000 (Wed, 29 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added one test
+
+------------------------------------------------------------------------
+r1157 | zimmerma | 2001-08-29 09:24:30 +0000 (Wed, 29 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+another test from Norbert
+
+------------------------------------------------------------------------
+r1156 | zimmerma | 2001-08-29 09:24:10 +0000 (Wed, 29 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+another fix (final copy when xsize > ysize was wrong)
+
+------------------------------------------------------------------------
+r1155 | zimmerma | 2001-08-28 16:15:02 +0000 (Tue, 28 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added several tests for case (1b)
+
+------------------------------------------------------------------------
+r1154 | zimmerma | 2001-08-28 15:57:47 +0000 (Tue, 28 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+another fix (previous one was incomplete)
+
+------------------------------------------------------------------------
+r1153 | zimmerma | 2001-08-28 15:56:22 +0000 (Tue, 28 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added one more test (from Norbert)
+
+------------------------------------------------------------------------
+r1152 | vlefevre | 2001-08-28 14:20:50 +0000 (Tue, 28 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Bug fixed.
+
+------------------------------------------------------------------------
+r1151 | vlefevre | 2001-08-28 10:28:50 +0000 (Tue, 28 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Bug fixed and update to check the exponents.
+
+------------------------------------------------------------------------
+r1150 | zimmerma | 2001-08-27 14:54:28 +0000 (Mon, 27 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+added test for 53 <= xprec, yprec <= 128
+
+------------------------------------------------------------------------
+r1149 | zimmerma | 2001-08-27 14:10:03 +0000 (Mon, 27 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added multiple tests for 53 <= xprec, yprec <= 128
+
+------------------------------------------------------------------------
+r1148 | zimmerma | 2001-08-27 14:09:13 +0000 (Mon, 27 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+was completely wrong for ysize > xsize
+
+------------------------------------------------------------------------
+r1147 | zimmerma | 2001-08-27 12:47:37 +0000 (Mon, 27 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added faster formula in exp(-8*n) for Euler's constant
+
+------------------------------------------------------------------------
+r1146 | vlefevre | 2001-08-25 09:58:24 +0000 (Sat, 25 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Assertion support with debug level.
+
+------------------------------------------------------------------------
+r1145 | vlefevre | 2001-08-25 09:11:18 +0000 (Sat, 25 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/add_ui.c
+ A /trunk/exceptions.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ A /trunk/save_expo.c
+ M /trunk/sub_ui.c
+
+Some support for exponent change and exceptions.
+
+------------------------------------------------------------------------
+r1144 | zimmerma | 2001-08-23 14:57:09 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+added constant ALPHA (for mpfr_const_euler)
+
+------------------------------------------------------------------------
+r1143 | zimmerma | 2001-08-23 14:56:36 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.in
+
+added euler/teuler
+
+------------------------------------------------------------------------
+r1142 | zimmerma | 2001-08-23 14:53:23 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added teuler
+
+------------------------------------------------------------------------
+r1141 | zimmerma | 2001-08-23 14:47:41 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added euler.c
+
+------------------------------------------------------------------------
+r1140 | zimmerma | 2001-08-23 14:45:58 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed pb with c2 = c2old << dif with dif negative
+
+------------------------------------------------------------------------
+r1139 | zimmerma | 2001-08-23 14:25:50 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug for (2^53+4) - 1
+
+------------------------------------------------------------------------
+r1138 | zimmerma | 2001-08-23 13:51:31 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added new test from Norbert Mueller
+
+------------------------------------------------------------------------
+r1137 | zimmerma | 2001-08-23 13:41:17 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+fixed pb: sh becomes "negative"
+
+------------------------------------------------------------------------
+r1136 | zimmerma | 2001-08-23 11:13:44 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+included Euler's constant
+
+------------------------------------------------------------------------
+r1135 | zimmerma | 2001-08-23 11:13:10 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/algorithms.bib
+
+bibtex file for algorithms.tex
+
+------------------------------------------------------------------------
+r1134 | zimmerma | 2001-08-23 11:07:19 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/teuler.c
+
+test file for mpfr_const_euler
+
+------------------------------------------------------------------------
+r1133 | zimmerma | 2001-08-23 11:06:52 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/euler.c
+
+computation of Euler's constant 0.577...
+
+------------------------------------------------------------------------
+r1132 | zimmerma | 2001-08-23 11:06:23 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added missing prototype
+
+------------------------------------------------------------------------
+r1131 | zimmerma | 2001-08-23 11:01:31 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr_const_euler returns an int
+
+------------------------------------------------------------------------
+r1130 | zimmerma | 2001-08-23 11:00:34 +0000 (Thu, 23 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+added mpfr_const_euler
+
+------------------------------------------------------------------------
+r1129 | vlefevre | 2001-08-22 16:01:37 +0000 (Wed, 22 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+Tests added.
+
+------------------------------------------------------------------------
+r1128 | vlefevre | 2001-08-22 16:01:28 +0000 (Wed, 22 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+Bugs fixed (particular cases).
+
+------------------------------------------------------------------------
+r1127 | vlefevre | 2001-08-22 15:18:06 +0000 (Wed, 22 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+"mant(c) != 1/2" test was broken.
+
+------------------------------------------------------------------------
+r1126 | vlefevre | 2001-08-22 15:05:23 +0000 (Wed, 22 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+check fixed. Check added: 2^53 + 1 --> 2^53.
+
+------------------------------------------------------------------------
+r1125 | vlefevre | 2001-08-22 14:24:02 +0000 (Wed, 22 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.in
+
+Update.
+
+------------------------------------------------------------------------
+r1124 | zimmerma | 2001-08-21 15:02:19 +0000 (Tue, 21 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+added one test
+
+------------------------------------------------------------------------
+r1123 | zimmerma | 2001-08-21 15:02:05 +0000 (Tue, 21 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+fixed stupid bug when dif < 0
+
+------------------------------------------------------------------------
+r1122 | zimmerma | 2001-08-14 14:15:25 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+
+added mpfr_asin
+
+------------------------------------------------------------------------
+r1121 | zimmerma | 2001-08-14 14:14:57 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added missing cast
+
+------------------------------------------------------------------------
+r1120 | zimmerma | 2001-08-14 13:50:47 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tasin.c
+
+test file for mpfr_asin
+
+------------------------------------------------------------------------
+r1119 | zimmerma | 2001-08-14 13:47:32 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/asin.c
+
+arc-sine, contributed by Mathieu Dutour
+
+------------------------------------------------------------------------
+r1118 | zimmerma | 2001-08-14 13:37:06 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+added mpfr_asin
+
+------------------------------------------------------------------------
+r1117 | zimmerma | 2001-08-14 13:36:50 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tatan.c
+
+new name for file tarctan.c
+
+------------------------------------------------------------------------
+r1116 | zimmerma | 2001-08-14 13:36:37 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ D /trunk/tests/tarctan.c
+
+renamed to tatan.c
+
+------------------------------------------------------------------------
+r1115 | zimmerma | 2001-08-14 13:36:10 +0000 (Tue, 14 Aug 2001) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+renamed tarctan.c into tatan.c
+added tasin.c
+
+------------------------------------------------------------------------
+r1114 | zimmerma | 2001-08-14 13:32:47 +0000 (Tue, 14 Aug 2001) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+renamed arctan.c to atan.c
+added asin.c
+
+------------------------------------------------------------------------
+r1113 | zimmerma | 2001-08-14 13:32:20 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ A /trunk/atan.c
+
+new name for file arctan.c
+
+------------------------------------------------------------------------
+r1112 | zimmerma | 2001-08-14 13:32:04 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ D /trunk/arctan.c
+
+moved to atan.c
+
+------------------------------------------------------------------------
+r1111 | zimmerma | 2001-08-14 13:15:56 +0000 (Tue, 14 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+low significant bit is in ap[0] and not in ap[an-1] !!!
+
+------------------------------------------------------------------------
+r1110 | vlefevre | 2001-08-13 17:56:06 +0000 (Mon, 13 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Cleaner MPFR_SET_SAME_SIGN.
+
+------------------------------------------------------------------------
+r1109 | vlefevre | 2001-08-13 04:48:05 +0000 (Mon, 13 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Macros MPFR_SET_SAME_SIGN, MPFR_INIT and MPFR_INIT1 changed to expressions.
+
+------------------------------------------------------------------------
+r1108 | vlefevre | 2001-08-10 15:40:56 +0000 (Fri, 10 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+ M /trunk/set_ui.c
+ M /trunk/set_z.c
+
+Bugs fixed (wrong types).
+
+------------------------------------------------------------------------
+r1107 | vlefevre | 2001-08-10 12:35:30 +0000 (Fri, 10 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Macros mpfr_init_set_* changed to expressions.
+
+------------------------------------------------------------------------
+r1106 | vlefevre | 2001-08-10 12:04:17 +0000 (Fri, 10 Aug 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+Makefile.in update.
+
+------------------------------------------------------------------------
+r1105 | zimmerma | 2001-07-06 14:02:40 +0000 (Fri, 06 Jul 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+edited wrt GNU style
+
+------------------------------------------------------------------------
+r1104 | zimmerma | 2001-07-06 13:56:34 +0000 (Fri, 06 Jul 2001) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed stupid bug: ceil(a/b) isn't (a+b-1)/a but simply a/b for a negative!
+
+------------------------------------------------------------------------
+r1103 | zimmerma | 2001-07-06 13:04:04 +0000 (Fri, 06 Jul 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed array bound write (bn < an + cancel1 + 1)
+
+------------------------------------------------------------------------
+r1102 | zimmerma | 2001-07-06 12:32:13 +0000 (Fri, 06 Jul 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+macros MPFR_NOTZERO and MPFR_ISZERO did not work properly with 64-bit words
+
+------------------------------------------------------------------------
+r1101 | zimmerma | 2001-06-29 16:21:05 +0000 (Fri, 29 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed bug for output base 2^k
+
+------------------------------------------------------------------------
+r1100 | zimmerma | 2001-06-29 16:19:30 +0000 (Fri, 29 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added one test
+
+------------------------------------------------------------------------
+r1099 | zimmerma | 2001-06-29 16:17:20 +0000 (Fri, 29 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added a section for the exponential
+
+------------------------------------------------------------------------
+r1098 | zimmerma | 2001-06-29 11:56:51 +0000 (Fri, 29 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+ M /trunk/tests/tdiv_ui.c
+
+fixed bug when dividend is 0
+
+------------------------------------------------------------------------
+r1097 | zimmerma | 2001-06-28 12:45:27 +0000 (Thu, 28 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/exp_2.c
+
+moved TMP_FREE
+
+------------------------------------------------------------------------
+r1096 | zimmerma | 2001-06-28 12:39:45 +0000 (Thu, 28 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added 2 things
+
+------------------------------------------------------------------------
+r1095 | zimmerma | 2001-06-27 09:40:24 +0000 (Wed, 27 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added mpfr.info to files to remove for "make distclean"
+
+------------------------------------------------------------------------
+r1094 | vlefevre | 2001-06-23 01:41:08 +0000 (Sat, 23 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/Makefile.in
+
+Non-existent C source references removed.
+
+------------------------------------------------------------------------
+r1093 | vlefevre | 2001-06-23 01:13:41 +0000 (Sat, 23 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+Macros MPFR_INIT and MPFR_INIT1 fixed.
+
+------------------------------------------------------------------------
+r1092 | zimmerma | 2001-06-18 13:52:58 +0000 (Mon, 18 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/sqrt.c
+
+nested double TMP_DECL's
+
+------------------------------------------------------------------------
+r1091 | daney | 2001-06-14 15:55:36 +0000 (Thu, 14 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/arctan.c
+ M /trunk/mpfr.h
+ M /trunk/out_str.c
+ M /trunk/sin_cos.c
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tarctan.c
+ M /trunk/tests/tfactorial.c
+ M /trunk/ui_sub.c
+
+A few patches.
+
+------------------------------------------------------------------------
+r1090 | zimmerma | 2001-06-07 14:22:08 +0000 (Thu, 07 Jun 2001) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/sin_cos.c
+
+added mpfr_sin and mpfr_cos
+corrected in the documentation some exact values
+
+------------------------------------------------------------------------
+r1089 | zimmerma | 2001-06-01 16:15:23 +0000 (Fri, 01 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+removed 2 tabs
+
+------------------------------------------------------------------------
+r1088 | zimmerma | 2001-06-01 16:03:15 +0000 (Fri, 01 Jun 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added change explaining the LGPL with non-free programs
+
+------------------------------------------------------------------------
+r1087 | hanrot | 2001-05-31 16:56:11 +0000 (Thu, 31 May 2001) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Patch for the case b = 0 or c = 0.
+
+------------------------------------------------------------------------
+r1086 | hanrot | 2001-05-23 16:57:20 +0000 (Wed, 23 May 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+Added DDefour's bug.
+
+------------------------------------------------------------------------
+r1085 | hanrot | 2001-05-22 10:29:32 +0000 (Tue, 22 May 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+Patch in the case MPFR_PREC(b) > MPFR_PREC(a)+cancel.
+
+------------------------------------------------------------------------
+r1084 | vlefevre | 2001-05-10 12:31:23 +0000 (Thu, 10 May 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/mpfr.texi
+ M /trunk/tests/Makefile.in
+
+fixed bug in mpfr.texi
+
+------------------------------------------------------------------------
+r1083 | daney | 2001-05-10 09:19:25 +0000 (Thu, 10 May 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+correction du bug donne par vincent + ajout des aides des fonctions hyperbolic
+
+------------------------------------------------------------------------
+r1082 | daney | 2001-05-09 15:26:28 +0000 (Wed, 09 May 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r1081 | zimmerma | 2001-04-20 08:49:45 +0000 (Fri, 20 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+log(0) now returns 0 (exact infinity)
+
+------------------------------------------------------------------------
+r1080 | zimmerma | 2001-04-18 16:05:20 +0000 (Wed, 18 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+fixed pbs with NaN/Inf
+
+------------------------------------------------------------------------
+r1079 | zimmerma | 2001-04-18 11:56:09 +0000 (Wed, 18 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed new bug found by Nathalie Revol (case when add_one_ulp produces a carry)
+
+------------------------------------------------------------------------
+r1078 | zimmerma | 2001-04-18 11:51:51 +0000 (Wed, 18 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsub.c
+
+added new bug found by Nathalie Revol
+
+------------------------------------------------------------------------
+r1077 | zimmerma | 2001-04-18 11:40:26 +0000 (Wed, 18 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug for 1.0000... - 0.000001 for rounding up or nearest
+
+------------------------------------------------------------------------
+r1076 | revol | 2001-04-17 18:23:18 +0000 (Tue, 17 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+Case where argument < 0 included, NR 17-04-2001
+
+------------------------------------------------------------------------
+r1075 | zimmerma | 2001-04-12 21:38:29 +0000 (Thu, 12 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+added new (special) tests
+
+------------------------------------------------------------------------
+r1074 | zimmerma | 2001-04-12 21:38:02 +0000 (Thu, 12 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tsub.c
+
+test file for mpfr_sub
+
+------------------------------------------------------------------------
+r1073 | zimmerma | 2001-04-12 21:37:47 +0000 (Thu, 12 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tsub
+
+------------------------------------------------------------------------
+r1072 | daney | 2001-04-06 09:30:15 +0000 (Fri, 06 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+change old exp2 (conflict with 2^x) to exp_2
+
+------------------------------------------------------------------------
+r1071 | zimmerma | 2001-04-05 18:29:54 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+0 -> GMP_RNDN
+
+------------------------------------------------------------------------
+r1070 | zimmerma | 2001-04-05 18:29:03 +0000 (Thu, 05 Apr 2001) | 3 lines
+Changed paths:
+ M /trunk/cmp2.c
+
+check apart the case c=0 (otherwise some low significant limbs may be
+non zero, which may produce a wrong result)
+
+------------------------------------------------------------------------
+r1069 | zimmerma | 2001-04-05 18:18:14 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+mpfr_exp2 -> mpfr_exp_2
+
+------------------------------------------------------------------------
+r1068 | zimmerma | 2001-04-05 17:52:36 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+mpfr_exp2 -> mpfr_exp_2
+
+------------------------------------------------------------------------
+r1067 | daney | 2001-04-05 17:42:31 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+reactualise .h
+
+------------------------------------------------------------------------
+r1066 | daney | 2001-04-05 17:42:09 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/thyperbolic.c
+
+change header
+
+------------------------------------------------------------------------
+r1065 | daney | 2001-04-05 17:39:30 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+change reuse to suppress factorial
+
+------------------------------------------------------------------------
+r1064 | daney | 2001-04-05 17:33:16 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+suppress of timing in makefile
+
+------------------------------------------------------------------------
+r1063 | daney | 2001-04-05 17:22:23 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/exp_2.c
+
+add the old exp2 function and file renamed by exp_2
+
+------------------------------------------------------------------------
+r1062 | daney | 2001-04-05 17:20:11 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+change makefile for new functions
+
+------------------------------------------------------------------------
+r1061 | daney | 2001-04-05 17:19:21 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+change make file test for hyperbolic function exp2 and factorial
+
+------------------------------------------------------------------------
+r1060 | daney | 2001-04-05 17:17:38 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tacosh.c
+ A /trunk/tests/tasinh.c
+ A /trunk/tests/tatanh.c
+ A /trunk/tests/tcosh.c
+ A /trunk/tests/tsinh.c
+ A /trunk/tests/ttanh.c
+
+add new test file for hyperbolic function
+
+------------------------------------------------------------------------
+r1059 | daney | 2001-04-05 17:16:37 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/texp2.c
+ A /trunk/tests/tfactorial.c
+ A /trunk/tests/thyperbolic.c
+
+add test file for new function
+
+------------------------------------------------------------------------
+r1058 | daney | 2001-04-05 17:15:37 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ A /trunk/factorial.c
+
+add function
+
+------------------------------------------------------------------------
+r1057 | daney | 2001-04-05 17:14:44 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/acosh.c
+ A /trunk/asinh.c
+ A /trunk/atanh.c
+ A /trunk/sinh.c
+ A /trunk/tanh.c
+
+new file function
+
+------------------------------------------------------------------------
+r1056 | daney | 2001-04-05 17:13:11 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/cosh.c
+
+new function file
+
+------------------------------------------------------------------------
+r1055 | zimmerma | 2001-04-05 17:07:35 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+new version with cmp2.c
+
+------------------------------------------------------------------------
+r1054 | zimmerma | 2001-04-05 15:53:49 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+fixed pb with inexact flag when 'int' and 'mp_limb_t' has different sizes
+
+------------------------------------------------------------------------
+r1053 | daney | 2001-04-05 15:31:42 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+ M /trunk/tests/tcmp_ui.c
+
+fixed bug for mpfr_cmp_ui (Inf, 0)
+
+------------------------------------------------------------------------
+r1052 | daney | 2001-04-05 15:29:31 +0000 (Thu, 05 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/set_ui.c
+ M /trunk/tests/tset_si.c
+
+fixed bug for mpfr_set_ui (x, 0) [was giving -0]
+
+------------------------------------------------------------------------
+r1051 | zimmerma | 2001-04-03 17:36:03 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/algorithms.tex
+
+added algorithm for mpfr_cmp2
+
+------------------------------------------------------------------------
+r1050 | zimmerma | 2001-04-03 17:35:37 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added cmp2.c
+
+------------------------------------------------------------------------
+r1049 | zimmerma | 2001-04-03 17:35:03 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp2.c
+
+fixed bug when diff_exp >= BITS_PER_MP_LIMB
+
+------------------------------------------------------------------------
+r1048 | zimmerma | 2001-04-03 17:34:03 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added new test for worst cases: 1 - 1/2^i and (1 + 1/2^i) - 1/2^i
+
+------------------------------------------------------------------------
+r1047 | zimmerma | 2001-04-03 17:11:08 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+changed return value of mpfr_cmp2
+
+------------------------------------------------------------------------
+r1046 | zimmerma | 2001-04-03 17:10:39 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ A /trunk/cmp2.c
+
+new file for mpfr_cmp2
+
+------------------------------------------------------------------------
+r1045 | zimmerma | 2001-04-03 17:10:23 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+moved mpfr_cmp2 to separate file cmp2.c
+
+------------------------------------------------------------------------
+r1044 | zimmerma | 2001-04-03 17:09:44 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added several tests, and a routine that generates worst cases
+
+------------------------------------------------------------------------
+r1043 | zimmerma | 2001-04-03 10:21:10 +0000 (Tue, 03 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+two changes suggested by Kevin Ryde
+
+------------------------------------------------------------------------
+r1042 | zimmerma | 2001-04-02 17:46:07 +0000 (Mon, 02 Apr 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+new version from new Makefile.am
+
+------------------------------------------------------------------------
+r1041 | zimmerma | 2001-03-27 20:23:12 +0000 (Tue, 27 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new test
+
+------------------------------------------------------------------------
+r1040 | zimmerma | 2001-03-27 20:22:57 +0000 (Tue, 27 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed new bug in mpfr_cmp2 found by Fabrice
+
+------------------------------------------------------------------------
+r1039 | zimmerma | 2001-03-21 22:07:04 +0000 (Wed, 21 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added new test
+
+------------------------------------------------------------------------
+r1038 | zimmerma | 2001-03-21 22:05:54 +0000 (Wed, 21 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed bug found by Nathalie Revol
+
+------------------------------------------------------------------------
+r1037 | zimmerma | 2001-03-20 14:32:26 +0000 (Tue, 20 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added 2 items
+
+------------------------------------------------------------------------
+r1036 | zimmerma | 2001-03-20 10:03:08 +0000 (Tue, 20 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+added test for mpfr_cmp_ui (-0, 0)
+
+------------------------------------------------------------------------
+r1035 | zimmerma | 2001-03-20 10:02:27 +0000 (Tue, 20 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+now prints -0 for -0
+
+------------------------------------------------------------------------
+r1034 | revol | 2001-03-19 18:11:09 +0000 (Mon, 19 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+
+Comparison between 0- and 0 now returns 0, NR 19-03-2001
+
+------------------------------------------------------------------------
+r1033 | vlefevre | 2001-03-16 13:50:18 +0000 (Fri, 16 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+added cast to avoid a warning
+
+------------------------------------------------------------------------
+r1032 | zimmerma | 2001-03-13 09:32:53 +0000 (Tue, 13 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+added tests for inexact return value
+
+------------------------------------------------------------------------
+r1031 | zimmerma | 2001-03-13 09:32:28 +0000 (Tue, 13 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+tiny bug in inexact value determination
+
+------------------------------------------------------------------------
+r1030 | zimmerma | 2001-03-13 08:55:46 +0000 (Tue, 13 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+
+mpfr_mul now returns an int
+
+------------------------------------------------------------------------
+r1029 | zimmerma | 2001-03-09 17:52:21 +0000 (Fri, 09 Mar 2001) | 2 lines
+Changed paths:
+ A /trunk/algorithms.tex
+
+description of algorithms
+
+------------------------------------------------------------------------
+r1028 | zimmerma | 2001-03-09 17:14:53 +0000 (Fri, 09 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+reorganized
+
+------------------------------------------------------------------------
+r1027 | zimmerma | 2001-03-08 13:26:07 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added few things
+
+------------------------------------------------------------------------
+r1026 | zimmerma | 2001-03-08 13:25:39 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/mpfr.h
+
+added arc-tangent
+
+------------------------------------------------------------------------
+r1025 | zimmerma | 2001-03-08 13:24:57 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tarctan
+
+------------------------------------------------------------------------
+r1024 | zimmerma | 2001-03-08 13:24:29 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+
+added test to mpfr_arctan
+
+------------------------------------------------------------------------
+r1023 | zimmerma | 2001-03-08 13:23:34 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tarctan.c
+
+added header
+
+------------------------------------------------------------------------
+r1022 | zimmerma | 2001-03-08 13:22:20 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tarctan.c
+
+test file for mpfr_arctan
+
+------------------------------------------------------------------------
+r1021 | zimmerma | 2001-03-08 13:14:26 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/arctan.c
+
+removed math.h
+
+------------------------------------------------------------------------
+r1020 | zimmerma | 2001-03-08 13:08:25 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ A /trunk/arctan.c
+
+arctangent function (contributed by Mathieu Dutour, done slight changes)
+
+------------------------------------------------------------------------
+r1019 | zimmerma | 2001-03-08 13:07:32 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added Mathieu Dutour in contributors
+
+------------------------------------------------------------------------
+r1018 | zimmerma | 2001-03-08 13:06:20 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_arctan
+
+------------------------------------------------------------------------
+r1017 | zimmerma | 2001-03-08 11:21:31 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tcan_round.c
+
+added one test
+
+------------------------------------------------------------------------
+r1016 | zimmerma | 2001-03-08 11:21:14 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+fixed bug in mpfr_can_round_raw, when err > bn*BITS_PER_MP_LIMB
+
+------------------------------------------------------------------------
+r1015 | zimmerma | 2001-03-08 09:35:03 +0000 (Thu, 08 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+now tset_str <number> <prec> is possible
+
+------------------------------------------------------------------------
+r1014 | zimmerma | 2001-03-06 16:41:25 +0000 (Tue, 06 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+fixed bug for Infinity (was testing zero before)
+
+------------------------------------------------------------------------
+r1013 | zimmerma | 2001-03-01 10:32:32 +0000 (Thu, 01 Mar 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+replaced (mp_limb_t) 4294967295 by CNST_LIMB(0xFFFFFFFF)
+
+------------------------------------------------------------------------
+r1012 | zimmerma | 2001-02-22 13:40:32 +0000 (Thu, 22 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+forgot to declare q in mpfr_get_d2 when BITS_PER_MP_LIMB=64
+
+------------------------------------------------------------------------
+r1011 | zimmerma | 2001-02-21 10:40:35 +0000 (Wed, 21 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+removed fprintf() when unexpected end of string
+
+------------------------------------------------------------------------
+r1010 | zimmerma | 2001-02-21 10:39:04 +0000 (Wed, 21 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+added undef's to avoid warnings at compilation
+
+------------------------------------------------------------------------
+r1009 | zimmerma | 2001-02-19 12:46:07 +0000 (Mon, 19 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+removed mpfr_set_machine_rnd_mode
+
+------------------------------------------------------------------------
+r1008 | zimmerma | 2001-02-18 12:16:14 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/reuse.c
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpi.c
+ M /trunk/tests/tpow.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tswap.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+changed "int main(..)" to two lines
+
+------------------------------------------------------------------------
+r1007 | zimmerma | 2001-02-18 12:13:55 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+now initialize str_is_null correctly
+
+------------------------------------------------------------------------
+r1006 | zimmerma | 2001-02-18 12:13:41 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tround.c
+
+added more tests
+
+------------------------------------------------------------------------
+r1005 | zimmerma | 2001-02-18 12:13:16 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+don't change MPFR_SIZE when allocated size is enough
+
+------------------------------------------------------------------------
+r1004 | zimmerma | 2001-02-18 12:12:52 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+updated specification of mpfr_sgn
+
+------------------------------------------------------------------------
+r1003 | zimmerma | 2001-02-18 12:12:35 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed definition of mpfr_sgn to get rid of MPFR_NOTZERO
+
+------------------------------------------------------------------------
+r1002 | zimmerma | 2001-02-18 12:12:21 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+size of freed block by __gmp_free_func was wrong
+
+------------------------------------------------------------------------
+r1001 | zimmerma | 2001-02-18 12:11:59 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tisnan and tget_d
+
+------------------------------------------------------------------------
+r1000 | zimmerma | 2001-02-18 12:11:40 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/isnan.c
+
+fixed bug for Inf (recognized as an ordinary number)
+
+------------------------------------------------------------------------
+r999 | zimmerma | 2001-02-18 12:11:25 +0000 (Sun, 18 Feb 2001) | 2 lines
+Changed paths:
+ A /trunk/tests/tget_d.c
+ A /trunk/tests/tisnan.c
+
+new test file
+
+------------------------------------------------------------------------
+r998 | zimmerma | 2001-02-16 10:18:33 +0000 (Fri, 16 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+check overflow in _mpfr_ceil_exp2
+
+------------------------------------------------------------------------
+r997 | zimmerma | 2001-02-15 22:19:58 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+added prototype for Ulp
+
+------------------------------------------------------------------------
+r996 | zimmerma | 2001-02-15 22:19:42 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/isnan.c
+
+changed _d to _p, added mpfr_number_p
+
+------------------------------------------------------------------------
+r995 | zimmerma | 2001-02-15 22:19:16 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+changed MPN_COPY into MPN_COPY_INCR/MPN_COPY_DECR in mpfr_round_raw
+
+------------------------------------------------------------------------
+r994 | zimmerma | 2001-02-15 22:18:55 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+added tests for one of arguments NULL
+
+------------------------------------------------------------------------
+r993 | zimmerma | 2001-02-15 22:18:16 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+moved mpfr_sgn to mpfr.h (defined in manual)
+
+------------------------------------------------------------------------
+r992 | zimmerma | 2001-02-15 22:17:58 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+
+use MPZ_REALLOC
+
+------------------------------------------------------------------------
+r991 | zimmerma | 2001-02-15 22:17:41 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/set_str.c
+
+added const to 2nd argument of mpfr_set_str
+
+------------------------------------------------------------------------
+r990 | zimmerma | 2001-02-15 22:17:10 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added set_ui.c
+
+------------------------------------------------------------------------
+r989 | zimmerma | 2001-02-15 22:16:44 +0000 (Thu, 15 Feb 2001) | 3 lines
+Changed paths:
+ M /trunk/set_si.c
+ A /trunk/set_ui.c
+
+added cast to "unsigned long" for ai = ABS(i)
+moved mpfr_set_ui to separate file
+
+------------------------------------------------------------------------
+r988 | zimmerma | 2001-02-15 22:16:04 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/mpfr.texi
+
+now when str==NULL return a block which is exactly strlen(str)+1 bytes long
+
+------------------------------------------------------------------------
+r987 | zimmerma | 2001-02-15 22:15:38 +0000 (Thu, 15 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/agm.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/generic.c
+ M /trunk/log2.c
+ M /trunk/pi.c
+ M /trunk/print_raw.c
+ M /trunk/set_d.c
+ M /trunk/sin_cos.c
+ M /trunk/sub.c
+
+fixed problems with old K&R compilers (_PROTO missing)
+
+------------------------------------------------------------------------
+r986 | zimmerma | 2001-02-08 12:56:50 +0000 (Thu, 08 Feb 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added more items
+
+------------------------------------------------------------------------
+r985 | zimmerma | 2001-01-23 16:11:30 +0000 (Tue, 23 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+fixed ulp computation
+
+------------------------------------------------------------------------
+r984 | zimmerma | 2001-01-19 16:20:33 +0000 (Fri, 19 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+changed behaviour for "tlog N": prints only differences with increasing ulps
+
+------------------------------------------------------------------------
+r983 | zimmerma | 2001-01-19 09:55:11 +0000 (Fri, 19 Jan 2001) | 4 lines
+Changed paths:
+ M /trunk/set_d.c
+
+fixed pb in mpfr_get_d2 for 64-bit machines: in q + res/MP_BASE_AS_DOUBLE,
+q seems first to be cast into a double, which gives more than one ulp of
+error
+
+------------------------------------------------------------------------
+r982 | zimmerma | 2001-01-18 16:08:34 +0000 (Thu, 18 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added guard to prevent multiple inclusion
+
+------------------------------------------------------------------------
+r981 | zimmerma | 2001-01-18 08:42:27 +0000 (Thu, 18 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed bug in mpfr_cmp2 (found on the IA64)
+
+------------------------------------------------------------------------
+r980 | zimmerma | 2001-01-11 17:26:02 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added tests for 0 in mpfr_set_str_raw
+
+------------------------------------------------------------------------
+r979 | zimmerma | 2001-01-11 17:25:28 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+fixed bug for +0000E0
+
+------------------------------------------------------------------------
+r978 | zimmerma | 2001-01-11 16:53:48 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/sqrtrem.c
+
+incorporated changes from Kevin/Torbjorn for GMP 3.2
+
+------------------------------------------------------------------------
+r977 | zimmerma | 2001-01-11 16:46:03 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+truncate the last uk (when the precision is not a power of 2)
+
+------------------------------------------------------------------------
+r976 | zimmerma | 2001-01-11 16:45:01 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+_mp_allocate_func -> _gmp_allocate_func
+
+------------------------------------------------------------------------
+r975 | zimmerma | 2001-01-11 16:44:24 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+_mp_reallocate_func -> _gmp_reallocate_func
+
+------------------------------------------------------------------------
+r974 | zimmerma | 2001-01-11 16:44:04 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/set_dfl_prec.c
+
+__gmp_default_fp_bit_precision -> __mpfr_default_fp_bit_precision
+
+------------------------------------------------------------------------
+r973 | zimmerma | 2001-01-11 16:43:37 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+ M /trunk/round.c
+
+_mp_xxx_func -> _gmp_xxx_func
+
+------------------------------------------------------------------------
+r972 | zimmerma | 2001-01-11 16:43:16 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+removed mpfr_srandom
+
+------------------------------------------------------------------------
+r971 | zimmerma | 2001-01-11 16:42:09 +0000 (Thu, 11 Jan 2001) | 3 lines
+Changed paths:
+ M /trunk/out_str.c
+
+sprintf -> fprintf
+_mp_free_func -> _gmp_free_func
+
+------------------------------------------------------------------------
+r970 | zimmerma | 2001-01-11 16:41:33 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/mpz_set_fr.c
+
+_mp_reallocate_func -> __gmp_reallocate_func
+
+------------------------------------------------------------------------
+r969 | zimmerma | 2001-01-11 16:41:09 +0000 (Thu, 11 Jan 2001) | 4 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added paragraph on NaN and infinities, docu on mpfr_nan_d and mpfr_inf_d
+removed mpfr_srandom
+some renamings
+
+------------------------------------------------------------------------
+r968 | zimmerma | 2001-01-11 16:39:50 +0000 (Thu, 11 Jan 2001) | 4 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+removed srandom
+__gmp_default_fp_bit_precision -> __mpfr_default_fp_bit_precision
+added protocols for mpfr_get_default_prec, mpfr_nan_d and mpfr_inf_d
+
+------------------------------------------------------------------------
+r967 | zimmerma | 2001-01-11 16:38:40 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+removed superfluous TMP_FREE(marker)
+
+------------------------------------------------------------------------
+r966 | zimmerma | 2001-01-11 16:37:52 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/inp_str.c
+
+_mp_xxx_func -> _gmp_xxx_func
+
+------------------------------------------------------------------------
+r965 | zimmerma | 2001-01-11 16:22:41 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/clear.c
+ M /trunk/dump.c
+
+_mp_free_func -> _gmp_free_func
+
+------------------------------------------------------------------------
+r964 | zimmerma | 2001-01-11 16:21:43 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ A /trunk/isnan.c
+
+functions to check for NaN and infinities
+
+------------------------------------------------------------------------
+r963 | zimmerma | 2001-01-11 16:21:14 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added isnan.c, removed srandom.h
+
+------------------------------------------------------------------------
+r962 | zimmerma | 2001-01-11 16:19:06 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added two items from Kevin
+
+------------------------------------------------------------------------
+r961 | zimmerma | 2001-01-11 16:17:44 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+add 2 items
+
+------------------------------------------------------------------------
+r960 | zimmerma | 2001-01-11 16:17:31 +0000 (Thu, 11 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+0.4 -> 1.0
+
+------------------------------------------------------------------------
+r959 | zimmerma | 2001-01-05 16:24:25 +0000 (Fri, 05 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added one test for large operands
+
+------------------------------------------------------------------------
+r958 | zimmerma | 2001-01-05 16:23:34 +0000 (Fri, 05 Jan 2001) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+fixed bug in _mpfr_ceil_exp2 (underflow when exp < -1022)
+
+------------------------------------------------------------------------
+r957 | zimmerma | 2000-12-22 16:49:12 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+remove what was done
+
+------------------------------------------------------------------------
+r956 | zimmerma | 2000-12-22 16:48:24 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/README
+
+added mpfr-test.h
+
+------------------------------------------------------------------------
+r955 | zimmerma | 2000-12-22 16:44:51 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+added Vincent
+
+------------------------------------------------------------------------
+r954 | zimmerma | 2000-12-22 16:41:28 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/NEWS
+
+1.1 -> 2001
+
+------------------------------------------------------------------------
+r953 | zimmerma | 2000-12-22 16:17:45 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+cast for _mpfr_floor_log2 was on the wrong side
+
+------------------------------------------------------------------------
+r952 | zimmerma | 2000-12-22 16:17:09 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added one test
+
+------------------------------------------------------------------------
+r951 | zimmerma | 2000-12-22 16:16:54 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+simplified _mpfr_floor_log2
+
+------------------------------------------------------------------------
+r950 | zimmerma | 2000-12-22 16:16:35 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+code was wrong for infinity
+
+------------------------------------------------------------------------
+r949 | zimmerma | 2000-12-22 15:45:22 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+only editing
+
+------------------------------------------------------------------------
+r948 | zimmerma | 2000-12-22 15:45:04 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added special() cases
+
+------------------------------------------------------------------------
+r947 | zimmerma | 2000-12-22 15:42:49 +0000 (Fri, 22 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/log2.c
+
+removed #if 0 (on Alpha with cc the enclosed code was still used
+since the # was not in the first column)
+
+------------------------------------------------------------------------
+r946 | zimmerma | 2000-12-22 14:55:42 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+changes for version 1.1
+
+------------------------------------------------------------------------
+r945 | zimmerma | 2000-12-22 14:52:02 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added one test (exp2 vs exp3)
+
+------------------------------------------------------------------------
+r944 | zimmerma | 2000-12-22 14:51:00 +0000 (Fri, 22 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/exp2.c
+
+changed c from mp_limb_t into unsigned long in mpfr_exp2_aux2
+(otherwise bugs on IRIX -n32)
+
+------------------------------------------------------------------------
+r943 | zimmerma | 2000-12-22 12:22:13 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tpow.c
+
+added one test
+
+------------------------------------------------------------------------
+r942 | zimmerma | 2000-12-22 12:21:56 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+fixed wrong combination of conditions for Infinity
+
+------------------------------------------------------------------------
+r941 | zimmerma | 2000-12-22 12:10:49 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added mpfr-test.h for MIPS
+
+------------------------------------------------------------------------
+r940 | hanrot | 2000-12-22 10:47:43 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+
+Modified macro calls
+
+------------------------------------------------------------------------
+r939 | zimmerma | 2000-12-22 09:29:05 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added cast (int) to random() to avoid warning on Solaris
+
+------------------------------------------------------------------------
+r938 | zimmerma | 2000-12-22 09:07:59 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added <string.h>
+
+------------------------------------------------------------------------
+r937 | zimmerma | 2000-12-22 08:57:57 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrtrem.c
+
+tiny change at the end of main routine (suggested by Guillaume)
+
+------------------------------------------------------------------------
+r936 | zimmerma | 2000-12-22 08:54:56 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added one test
+
+------------------------------------------------------------------------
+r935 | zimmerma | 2000-12-22 08:53:59 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added two more tests
+
+------------------------------------------------------------------------
+r934 | zimmerma | 2000-12-22 08:53:25 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug when c does not overlap with a, b is negative and GMP_RNDN
+
+------------------------------------------------------------------------
+r933 | zimmerma | 2000-12-22 08:52:20 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+
+moved prototypes for mpfr_set4 and mpfr_cmp3 to mpfr.h
+
+------------------------------------------------------------------------
+r932 | zimmerma | 2000-12-22 08:51:40 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed bug in mpfr_cmp2 when d=0 and lots of bits match
+
+------------------------------------------------------------------------
+r931 | zimmerma | 2000-12-22 08:50:43 +0000 (Fri, 22 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/NEWS
+
+updated for version 1.1
+
+------------------------------------------------------------------------
+r930 | zimmerma | 2000-12-21 17:23:51 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tpow.c
+
+test file for power functions
+
+------------------------------------------------------------------------
+r929 | zimmerma | 2000-12-21 17:22:42 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/reuse.c
+
+test file for in-place operations
+
+------------------------------------------------------------------------
+r928 | zimmerma | 2000-12-21 17:17:51 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+unsigned char (or int) -> mp_rnd_t
+
+------------------------------------------------------------------------
+r927 | zimmerma | 2000-12-21 17:12:14 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+unsigned char -> mp_rnd_t
+
+------------------------------------------------------------------------
+r926 | zimmerma | 2000-12-21 17:11:31 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+unsigned int -> mp_rnd_t
+
+------------------------------------------------------------------------
+r925 | zimmerma | 2000-12-21 17:08:38 +0000 (Thu, 21 Dec 2000) | 4 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add_ui.c
+ M /trunk/agm.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/get_str.c
+ M /trunk/inp_str.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/reldiff.c
+ M /trunk/set_d.c
+ M /trunk/sin_cos.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub.c
+ M /trunk/sub_ui.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+
+k2r -> ansi style
+removed #include <math.h> by defining auxiliary functions
+fixed several tiny remaining bugs with NaN/Inf
+
+------------------------------------------------------------------------
+r924 | zimmerma | 2000-12-21 17:07:12 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+updated description of mpfr_cmp* and mpfr_sin_cos
+
+------------------------------------------------------------------------
+r923 | zimmerma | 2000-12-21 17:06:15 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added MPFR_SIGN
+
+------------------------------------------------------------------------
+r922 | zimmerma | 2000-12-21 17:05:49 +0000 (Thu, 21 Dec 2000) | 5 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+added MPFR_CLEAR_NAN
+MPFR_RESET_INF -> MPFR_CLEAR_INF
+moved MPFR_SIGN to mpfr.h
+added prototypes for log2/isqrt/cuberoot functions
+
+------------------------------------------------------------------------
+r921 | zimmerma | 2000-12-21 17:04:24 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added reuse, tcmp2, teq, tpow, trandom, ttrunc
+
+------------------------------------------------------------------------
+r920 | zimmerma | 2000-12-21 17:02:25 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+removed isnan(), ...
+
+------------------------------------------------------------------------
+r919 | zimmerma | 2000-12-21 17:00:59 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt_ui.c
+
+removed gmp-impl.h, isnan(), ...
+
+------------------------------------------------------------------------
+r918 | zimmerma | 2000-12-21 17:00:21 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+removed gmp-impl, isnan(), ...
+
+------------------------------------------------------------------------
+r917 | zimmerma | 2000-12-21 16:59:24 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+removed cputime stuff
+
+------------------------------------------------------------------------
+r916 | zimmerma | 2000-12-21 16:58:24 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tset_z.c
+
+k&r -> ansi style
+
+------------------------------------------------------------------------
+r915 | zimmerma | 2000-12-21 16:57:08 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tout_str.c
+
+removed isnan() decl.
+
+------------------------------------------------------------------------
+r914 | zimmerma | 2000-12-21 16:55:30 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+MINNORM -> mpfr-test.h
+
+------------------------------------------------------------------------
+r913 | zimmerma | 2000-12-21 16:52:57 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+ulp -> mpfr-test.h
+
+------------------------------------------------------------------------
+r912 | zimmerma | 2000-12-21 16:51:36 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+removed isnan() declaration
+
+------------------------------------------------------------------------
+r911 | zimmerma | 2000-12-21 16:50:48 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+now use MINNORM and MAXNORM
+
+------------------------------------------------------------------------
+r910 | zimmerma | 2000-12-21 16:49:00 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+max, min -> macros
+
+------------------------------------------------------------------------
+r909 | zimmerma | 2000-12-21 12:10:49 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new tests
+
+------------------------------------------------------------------------
+r908 | zimmerma | 2000-12-21 12:07:52 +0000 (Thu, 21 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+added MINNORM, MAXNORM, MIN, MAX, ABS
+
+------------------------------------------------------------------------
+r907 | hanrot | 2000-12-20 16:36:05 +0000 (Wed, 20 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+ M /trunk/tests/tset_str.c
+
+A few basic patches.
+
+------------------------------------------------------------------------
+r906 | hanrot | 2000-12-20 16:35:55 +0000 (Wed, 20 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+Added support for PPC/Linux
+
+------------------------------------------------------------------------
+r905 | hanrot | 2000-12-20 14:54:10 +0000 (Wed, 20 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr-test.h
+
+Patch for wrong prototype.
+
+------------------------------------------------------------------------
+r904 | hanrot | 2000-12-20 10:49:00 +0000 (Wed, 20 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/configure
+ M /trunk/cputime.h
+ M /trunk/mpfr-test.h
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+Added prototypes for all test files.
+
+------------------------------------------------------------------------
+r903 | vlefevre | 2000-12-18 15:07:51 +0000 (Mon, 18 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/add_ulp.c
+ M /trunk/extract.c
+ M /trunk/mpz_set_fr.c
+ M /trunk/set_d.c
+ M /trunk/set_q.c
+ M /trunk/set_z.c
+
+Warnings suppressed on Alpha/OSF1.
+
+------------------------------------------------------------------------
+r902 | zimmerma | 2000-12-18 09:44:06 +0000 (Mon, 18 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added mpfr-test.h
+
+------------------------------------------------------------------------
+r901 | zimmerma | 2000-12-18 09:40:46 +0000 (Mon, 18 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/aclocal.m4
+
+back to 1.3
+
+------------------------------------------------------------------------
+r900 | zimmerma | 2000-12-18 09:06:50 +0000 (Mon, 18 Dec 2000) | 2 lines
+Changed paths:
+ A /trunk/mpfr-test.h
+
+auxiliary test files
+
+------------------------------------------------------------------------
+r899 | zimmerma | 2000-12-18 09:06:34 +0000 (Mon, 18 Dec 2000) | 2 lines
+Changed paths:
+ D /trunk/tests/mpfr-test.h
+
+moved to main directory
+
+------------------------------------------------------------------------
+r898 | zimmerma | 2000-12-18 09:02:54 +0000 (Mon, 18 Dec 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/mpfr-test.h
+
+auxiliary test functions
+
+------------------------------------------------------------------------
+r897 | zimmerma | 2000-12-18 09:02:00 +0000 (Mon, 18 Dec 2000) | 5 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/aclocal.m4
+ M /trunk/add.c
+ M /trunk/add_ui.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/configure
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/extract.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sin_cos.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sqrtrem.c
+ M /trunk/sub.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+
+changed name of mpfr struct fields: _mp_d -> _mpfr_d
+ (to detect conflicts with mpf)
+fixed a few problems in non-STDC headers
+moved definitions of mpfr-impl.h to mpfr-test.h and created a real mpfr-impl.h
+
+------------------------------------------------------------------------
+r896 | zimmerma | 2000-12-15 17:46:34 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+removed tzeta
+
+------------------------------------------------------------------------
+r895 | zimmerma | 2000-12-15 17:42:59 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+explained how to enter NaN/Inf with mpfr_set_str_raw
+
+------------------------------------------------------------------------
+r894 | zimmerma | 2000-12-15 17:42:21 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+removed zeta.c
+
+------------------------------------------------------------------------
+r893 | zimmerma | 2000-12-15 17:40:47 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+added 'to do' for NaN/Inf flags
+
+------------------------------------------------------------------------
+r892 | zimmerma | 2000-12-15 17:39:14 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+clear NaN/Inf flags of result
+
+------------------------------------------------------------------------
+r891 | zimmerma | 2000-12-15 17:37:33 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/ui_sub.c
+
+improved indentation
+
+------------------------------------------------------------------------
+r890 | zimmerma | 2000-12-15 17:35:00 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+
+adapted to NaN/Inf
+
+------------------------------------------------------------------------
+r889 | zimmerma | 2000-12-15 17:29:01 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sub_ui.c
+
+nothing (only better indenting)
+
+------------------------------------------------------------------------
+r888 | zimmerma | 2000-12-15 17:27:03 +0000 (Fri, 15 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+adapted to NaN/Inf
+removed warnings
+
+------------------------------------------------------------------------
+r887 | zimmerma | 2000-12-15 17:21:32 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt_ui.c
+
+adapted to NaN/Inf
+
+------------------------------------------------------------------------
+r886 | zimmerma | 2000-12-15 17:20:55 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/generic.c
+ M /trunk/sin_cos.c
+
+removed warnings
+
+------------------------------------------------------------------------
+r885 | zimmerma | 2000-12-15 17:11:49 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+clear NaN/Inf flags in normal case
+
+------------------------------------------------------------------------
+r884 | zimmerma | 2000-12-15 17:06:11 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+
+adapted to NaN/Inf
+
+------------------------------------------------------------------------
+r883 | zimmerma | 2000-12-15 16:55:19 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_srandom
+
+------------------------------------------------------------------------
+r882 | zimmerma | 2000-12-15 16:54:50 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+now uses directly mpn_random, to avoid all problems with include files
+
+------------------------------------------------------------------------
+r881 | zimmerma | 2000-12-15 16:45:41 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsin_cos.c
+
+added 4 tests
+
+------------------------------------------------------------------------
+r880 | zimmerma | 2000-12-15 16:45:05 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub_ui.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+
+_mp_d -> MPFR_MANT
+
+------------------------------------------------------------------------
+r879 | zimmerma | 2000-12-15 16:41:07 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+ M /trunk/set_str_raw.c
+
+added error message when memory allocation fails
+
+------------------------------------------------------------------------
+r878 | zimmerma | 2000-12-15 16:27:51 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/inp_str.c
+ M /trunk/mpz_set_fr.c
+ M /trunk/print_raw.c
+ M /trunk/round.c
+
+added error message when memory allocation fails
+
+------------------------------------------------------------------------
+r877 | zimmerma | 2000-12-15 16:26:53 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/eq.c
+ M /trunk/log.c
+
+_mp_d -> MPFR_MANT
+
+------------------------------------------------------------------------
+r876 | zimmerma | 2000-12-15 16:26:09 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/init.c
+
+0 -> NULL
+
+------------------------------------------------------------------------
+r875 | zimmerma | 2000-12-15 16:25:14 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/generic.c
+
+added error message if memory allocation fails
+
+------------------------------------------------------------------------
+r874 | zimmerma | 2000-12-15 16:24:35 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+_mp_d -> PTR
+
+------------------------------------------------------------------------
+r873 | zimmerma | 2000-12-15 16:23:08 +0000 (Fri, 15 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/agm.c
+
+_mp_prec -> MPFR_PREC
+_mp_d -> MPFR_MANT
+
+------------------------------------------------------------------------
+r872 | zimmerma | 2000-12-15 16:18:53 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+ M /trunk/mpfr.h
+
+added mpfr_swap
+
+------------------------------------------------------------------------
+r871 | zimmerma | 2000-12-15 15:09:30 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+removed MPFR_SET_IS_FP (not used)
+
+------------------------------------------------------------------------
+r870 | hanrot | 2000-12-15 14:42:57 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/init.c
+ M /trunk/log.c
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/pow.c
+
+A few patches.
+
+------------------------------------------------------------------------
+r869 | vlefevre | 2000-12-15 14:36:22 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+MPFR_CHANGE_SIGN modified to avoid a possible side effect.
+
+------------------------------------------------------------------------
+r868 | zimmerma | 2000-12-15 14:24:11 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+warning: x is a MPF not a MPFR!
+
+------------------------------------------------------------------------
+r867 | hanrot | 2000-12-15 14:12:30 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Modification of the order of includes in random.c
+
+------------------------------------------------------------------------
+r866 | vlefevre | 2000-12-15 12:56:19 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/configure
+ M /trunk/configure.in
+ M /trunk/tests/Makefile.in
+
+Added some warning flags for GCC.
+
+------------------------------------------------------------------------
+r865 | hanrot | 2000-12-15 12:50:28 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ A /trunk/srandom.h
+
+Header file for srandom()
+
+------------------------------------------------------------------------
+r864 | hanrot | 2000-12-15 12:21:35 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/add_ulp.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/mpfr.h
+ M /trunk/pow.c
+ M /trunk/random.c
+
+Patches for compiler warnings.
+
+------------------------------------------------------------------------
+r863 | hanrot | 2000-12-15 11:16:40 +0000 (Fri, 15 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/get_str.c
+ M /trunk/log2.c
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul_ui.c
+ M /trunk/pi.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sub_ui.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+Yet another patch for include files.
+
+------------------------------------------------------------------------
+r862 | hanrot | 2000-12-15 11:05:55 +0000 (Fri, 15 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/add_ui.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/extract.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/inp_str.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sin_cos.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/sub_ui.c
+ M /trunk/swap.c
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+Permutation of includes to avoid warnings due to careless multiple definition
+of ULONG_MAX.
+
+------------------------------------------------------------------------
+r861 | vlefevre | 2000-12-14 17:47:12 +0000 (Thu, 14 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+ M /trunk/set.c
+ M /trunk/set_f.c
+
+Bug fixed concerning the flags.
+
+------------------------------------------------------------------------
+r860 | vlefevre | 2000-12-14 17:28:41 +0000 (Thu, 14 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/set_str.c
+
+Bugs fixed (in case char is signed and accented characters are given).
+
+------------------------------------------------------------------------
+r859 | vlefevre | 2000-12-14 17:02:11 +0000 (Thu, 14 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Include "urandom.h". Old code removed.
+
+------------------------------------------------------------------------
+r858 | vlefevre | 2000-12-14 15:28:28 +0000 (Thu, 14 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/reldiff.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+
+Take into account Inf, Nans ; clear the flags of the return variable
+in most function calls.
+
+------------------------------------------------------------------------
+r857 | vlefevre | 2000-12-14 14:36:09 +0000 (Thu, 14 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Use urandom().
+
+------------------------------------------------------------------------
+r856 | vlefevre | 2000-12-14 14:29:04 +0000 (Thu, 14 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+
+Take into account Inf, Nans ; clear the flags of the return variable
+in most function calls.
+
+------------------------------------------------------------------------
+r855 | hanrot | 2000-12-14 12:14:57 +0000 (Thu, 14 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Yet another random patch.
+
+------------------------------------------------------------------------
+r854 | hanrot | 2000-12-14 12:08:44 +0000 (Thu, 14 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Replaced random by rand.
+
+------------------------------------------------------------------------
+r853 | zimmerma | 2000-12-13 14:55:24 +0000 (Wed, 13 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+fixed pb with mp_ptr vs mp_srcptr
+
+------------------------------------------------------------------------
+r852 | hanrot | 2000-12-13 14:50:26 +0000 (Wed, 13 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tsin_cos.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+Take into account Inf, Nans ; clear the flags of the return variable
+in most function calls. Tests updated accordingly
+
+------------------------------------------------------------------------
+r851 | hanrot | 2000-12-13 14:50:13 +0000 (Wed, 13 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/eq.c
+ M /trunk/generic.c
+ M /trunk/inp_str.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/set_d.c
+ M /trunk/sub_ui.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+
+Take into account Inf, Nans ; clear the flags of the return variable
+in most function calls.
+
+------------------------------------------------------------------------
+r850 | zimmerma | 2000-12-13 08:42:38 +0000 (Wed, 13 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+check that we can round the cosine too
+
+------------------------------------------------------------------------
+r849 | zimmerma | 2000-12-12 16:40:05 +0000 (Tue, 12 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/exp3.c
+
+removed TIMING stuff
+ensures prec_x >= 0
+
+------------------------------------------------------------------------
+r848 | zimmerma | 2000-12-12 16:38:47 +0000 (Tue, 12 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+we need m >= 2 in mpfr_exp2_aux2
+
+------------------------------------------------------------------------
+r847 | zimmerma | 2000-12-12 13:57:34 +0000 (Tue, 12 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sub_ui.c
+
+forgot TMP_MARK(marker)
+
+------------------------------------------------------------------------
+r846 | zimmerma | 2000-12-12 13:50:44 +0000 (Tue, 12 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+
+forgot TMP_MARK(marker) or free'd in wrong order
+
+------------------------------------------------------------------------
+r845 | zimmerma | 2000-12-12 13:44:07 +0000 (Tue, 12 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+
+forgot TMP_MARK(marker)
+
+------------------------------------------------------------------------
+r844 | zimmerma | 2000-12-12 11:49:13 +0000 (Tue, 12 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+fixed mpf_reldiff, mpf_urandomb and mpf_t
+
+------------------------------------------------------------------------
+r843 | zimmerma | 2000-12-12 11:41:28 +0000 (Tue, 12 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added stack-alloc.h when --disable-alloca
+
+------------------------------------------------------------------------
+r842 | vlefevre | 2000-12-11 12:47:11 +0000 (Mon, 11 Dec 2000) | 4 lines
+Changed paths:
+ M /trunk/out_str.c
+ M /trunk/set_d.c
+
+out_str.c: <string.h> included
+set_d.c: (0./0.) instead of sqrt(-1) for NaN (doesn't need <math.h>)
+set_d.c: () added for macros Infp and Infm
+
+------------------------------------------------------------------------
+r841 | zimmerma | 2000-12-07 13:11:32 +0000 (Thu, 07 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+shortened string in mpfr_set_str_raw which was greater than precision
+
+------------------------------------------------------------------------
+r840 | zimmerma | 2000-12-07 11:25:37 +0000 (Thu, 07 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/set_d.c
+
+replaced isnan/isinf/math.h (not portable, for example isinf does not exist
+on Sparc) by new macros from mpfr.h
+
+------------------------------------------------------------------------
+r839 | zimmerma | 2000-12-07 11:24:31 +0000 (Thu, 07 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/set_str_raw.c
+
+added an error message when the mantissa is larger than the precision
+(in mpfr_set_str_raw)
+
+------------------------------------------------------------------------
+r838 | zimmerma | 2000-12-07 11:23:24 +0000 (Thu, 07 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added macros to recognize doubles that are NaNs and infinities
+(isinf is not portable and requires math.h)
+
+------------------------------------------------------------------------
+r837 | zimmerma | 2000-12-07 11:22:04 +0000 (Thu, 07 Dec 2000) | 5 lines
+Changed paths:
+ M /trunk/div.c
+
+in case the destination precision is less than that of the operands,
+and the 1st iteration fails, increase directly the precision to the maximum
+of that of the operands, otherwise divisions by 1.0 may need lots of
+iterations
+
+------------------------------------------------------------------------
+r836 | zimmerma | 2000-12-07 10:44:28 +0000 (Thu, 07 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+added 'return' after dealing with infinities
+
+------------------------------------------------------------------------
+r835 | zimmerma | 2000-12-07 10:37:08 +0000 (Thu, 07 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added wish from JC Fauge`re
+
+------------------------------------------------------------------------
+r834 | zimmerma | 2000-12-05 13:47:05 +0000 (Tue, 05 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/init.c
+ M /trunk/mpfr.texi
+
+mpfr_init/mpfr_init2 initialize to 0 (compatibility with mpf)
+
+------------------------------------------------------------------------
+r833 | zimmerma | 2000-12-05 13:24:43 +0000 (Tue, 05 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed bug in mpfr_cmp2 when return value is k*BITS_PER_MP_LIMB-1
+
+------------------------------------------------------------------------
+r832 | zimmerma | 2000-12-05 13:23:58 +0000 (Tue, 05 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+added new test for mpfr_cmp2
+
+------------------------------------------------------------------------
+r831 | zimmerma | 2000-12-05 12:37:14 +0000 (Tue, 05 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+now ABSSIZE uses only 29 bits
+
+------------------------------------------------------------------------
+r830 | zimmerma | 2000-12-04 14:36:36 +0000 (Mon, 04 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added some explanations how to free the memory space allocated by mpfr_get_str
+
+------------------------------------------------------------------------
+r829 | zimmerma | 2000-12-04 13:45:14 +0000 (Mon, 04 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+fixed one bug found by N. Mueller (MPFR_ABSSIZE(u) was used instead of usize)
+
+------------------------------------------------------------------------
+r828 | zimmerma | 2000-12-04 13:44:24 +0000 (Mon, 04 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one more test from N. Mueller
+
+------------------------------------------------------------------------
+r827 | zimmerma | 2000-12-01 17:30:41 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+ M /trunk/sin_cos.c
+
+cleaned calls to mpfr_extract
+
+------------------------------------------------------------------------
+r826 | zimmerma | 2000-12-01 17:29:33 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added new line
+
+------------------------------------------------------------------------
+r825 | zimmerma | 2000-12-01 17:29:05 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/init.c
+
+added error message when _mp_allocate_func returns 0
+
+------------------------------------------------------------------------
+r824 | zimmerma | 2000-12-01 17:28:22 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added header for mpfr_extract
+
+------------------------------------------------------------------------
+r823 | zimmerma | 2000-12-01 17:27:54 +0000 (Fri, 01 Dec 2000) | 4 lines
+Changed paths:
+ M /trunk/extract.c
+
+- documented what function does
+- cleaned code
+- added header about license...
+
+------------------------------------------------------------------------
+r822 | zimmerma | 2000-12-01 16:25:53 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/get_str.c
+ M /trunk/log2.c
+ M /trunk/mpfr.h
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/sin_cos.c
+
+replaced log(2.0) by LOG2 [first step in getting rid of math.h]
+
+------------------------------------------------------------------------
+r821 | zimmerma | 2000-12-01 15:57:33 +0000 (Fri, 01 Dec 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added extern "C" { ... } for inclusion in C++
+removed old KARATSUBA threshold for gmp 2.0.2
+
+------------------------------------------------------------------------
+r820 | zimmerma | 2000-12-01 14:58:32 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+ M /trunk/cmp.c
+ M /trunk/tests/tcmp.c
+
+fixed bug in mpfr_cmp3 (when b=0, s not taken into account)
+
+------------------------------------------------------------------------
+r819 | zimmerma | 2000-12-01 14:30:41 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/tests/Makefile.am
+
+added swap/tswap
+
+------------------------------------------------------------------------
+r818 | zimmerma | 2000-12-01 14:29:36 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tswap.c
+
+test file for new function mpfr_swap
+
+------------------------------------------------------------------------
+r817 | zimmerma | 2000-12-01 14:29:28 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ A /trunk/swap.c
+
+added new function mpfr_swap
+
+------------------------------------------------------------------------
+r816 | zimmerma | 2000-12-01 13:59:45 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add_ui.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpfi.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/reldiff.c
+ M /trunk/rnd_mode.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_rnd.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sqrtrem.c
+ M /trunk/sub.c
+ M /trunk/sub_ui.c
+ M /trunk/tests/Makefile.in
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/tdump.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpi.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/tround.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/ttrunc.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+ M /trunk/tests/tzeta.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/zeta.c
+
+changed copyright to Free Software Foundation
+
+------------------------------------------------------------------------
+r815 | zimmerma | 2000-12-01 13:57:39 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added possible bug in mpfr_get_str
+
+------------------------------------------------------------------------
+r814 | zimmerma | 2000-12-01 13:55:36 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ D /trunk/init_set.h
+
+now all is in mpfr.h
+
+------------------------------------------------------------------------
+r813 | zimmerma | 2000-12-01 13:00:22 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+return value was wrong for input non-zero (should return 1 = inexact)
+
+------------------------------------------------------------------------
+r812 | zimmerma | 2000-12-01 12:59:15 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed/improved doc. of mpfr_sin_cos and mpfr_urandomb
+
+------------------------------------------------------------------------
+r811 | zimmerma | 2000-12-01 12:58:38 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+removed macro for mpfr_init_set_str_raw
+
+------------------------------------------------------------------------
+r810 | zimmerma | 2000-12-01 12:21:43 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_sin_cos
+
+------------------------------------------------------------------------
+r809 | zimmerma | 2000-12-01 11:06:39 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+sign of result was not correctly (re)set
+
+------------------------------------------------------------------------
+r808 | zimmerma | 2000-12-01 11:05:29 +0000 (Fri, 01 Dec 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added test to check sign of square root
+
+------------------------------------------------------------------------
+r807 | zimmerma | 2000-11-29 16:36:15 +0000 (Wed, 29 Nov 2000) | 3 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+gained a factor of 2 in most cases (replaced initial constant factor=2
+for additional bits for cos(x) by log(n))
+
+------------------------------------------------------------------------
+r806 | zimmerma | 2000-11-29 16:34:14 +0000 (Wed, 29 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tsin_cos
+
+------------------------------------------------------------------------
+r805 | zimmerma | 2000-11-29 16:29:28 +0000 (Wed, 29 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed potential problem in mpfr_sub1 (k=0 and kc<0)
+
+------------------------------------------------------------------------
+r804 | zimmerma | 2000-11-29 16:28:21 +0000 (Wed, 29 Nov 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tsin_cos.c
+
+test file for sin/cos
+
+------------------------------------------------------------------------
+r803 | zimmerma | 2000-11-28 10:42:05 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+forgot cast to int before comparison between imax (can be negative) and an
+
+------------------------------------------------------------------------
+r802 | zimmerma | 2000-11-28 10:41:12 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+returned value was one too small in case d=1
+
+------------------------------------------------------------------------
+r801 | zimmerma | 2000-11-28 10:40:33 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new test from N. Mueller
+
+------------------------------------------------------------------------
+r800 | zimmerma | 2000-11-28 10:40:09 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+added return for case of infinities
+
+------------------------------------------------------------------------
+r799 | zimmerma | 2000-11-28 10:27:07 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added macro MPFR_RESET_INF
+
+------------------------------------------------------------------------
+r798 | zimmerma | 2000-11-28 10:25:04 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+don't forget to reset infinity flag if set!
+
+------------------------------------------------------------------------
+r797 | zimmerma | 2000-11-28 08:28:28 +0000 (Tue, 28 Nov 2000) | 3 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed bug in mpfr_cmp2: wrong limb considered after cp[cn--] when
+ cp[cn] was not 111...111
+
+------------------------------------------------------------------------
+r796 | zimmerma | 2000-11-28 08:25:14 +0000 (Tue, 28 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug when imax>an
+
+------------------------------------------------------------------------
+r795 | zimmerma | 2000-11-27 17:39:00 +0000 (Mon, 27 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added macro MPFR_IS_ZERO
+
+------------------------------------------------------------------------
+r794 | hanrot | 2000-11-21 15:21:39 +0000 (Tue, 21 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+
+Infinis, premiere tentative (tests)
+
+------------------------------------------------------------------------
+r793 | hanrot | 2000-11-21 15:21:33 +0000 (Tue, 21 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/configure
+ M /trunk/div.c
+ M /trunk/div_ui.c
+ M /trunk/dump.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/extract.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/log.c
+ M /trunk/mpfr.h
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/out_str.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/reldiff.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_str_raw.c
+ M /trunk/sin_cos.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/zeta.c
+
+Infinis, premiere tentative.
+
+------------------------------------------------------------------------
+r792 | zimmerma | 2000-11-13 17:13:51 +0000 (Mon, 13 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added one remark from GH
+
+------------------------------------------------------------------------
+r791 | zimmerma | 2000-11-13 17:05:34 +0000 (Mon, 13 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+removed mpfr_cmp2
+
+------------------------------------------------------------------------
+r790 | hanrot | 2000-11-13 15:13:32 +0000 (Mon, 13 Nov 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/aclocal.m4
+
+Added support for Inf. Modified zeta.
+
+------------------------------------------------------------------------
+r789 | zimmerma | 2000-10-26 12:22:07 +0000 (Thu, 26 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+protection of macros done
+
+------------------------------------------------------------------------
+r788 | zimmerma | 2000-10-26 12:11:59 +0000 (Thu, 26 Oct 2000) | 2 lines
+Changed paths:
+ A /trunk/replace_all
+
+shell-script to replace xxx by yyy in all source files
+
+------------------------------------------------------------------------
+r787 | zimmerma | 2000-10-26 12:11:11 +0000 (Thu, 26 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/ttrunc.c
+
+protected macros: xxx -> MPFR_xxx
+
+------------------------------------------------------------------------
+r786 | zimmerma | 2000-10-26 11:59:59 +0000 (Thu, 26 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/add.c
+ M /trunk/add_ui.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/eq.c
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ M /trunk/exp3.c
+ M /trunk/extract.c
+ M /trunk/generic.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpfi.c
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mpz_set_fr.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/print_raw.c
+ M /trunk/random.c
+ M /trunk/random2.c
+ M /trunk/reldiff.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/set_q.c
+ M /trunk/set_si.c
+ M /trunk/set_str.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sin_cos.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt_ui.c
+ M /trunk/sub.c
+ M /trunk/sub_ui.c
+ M /trunk/trunc.c
+ M /trunk/ui_div.c
+ M /trunk/ui_sub.c
+ M /trunk/urandomb.c
+ M /trunk/zeta.c
+
+protected all macros: xxx -> MPFR_xxx
+
+------------------------------------------------------------------------
+r785 | zimmerma | 2000-10-24 11:59:35 +0000 (Tue, 24 Oct 2000) | 2 lines
+Changed paths:
+ A /trunk/mpfi.h
+
+fichier d'include pour mpfi.c
+
+------------------------------------------------------------------------
+r784 | zimmerma | 2000-10-24 11:47:10 +0000 (Tue, 24 Oct 2000) | 2 lines
+Changed paths:
+ A /trunk/mpfi.c
+
+interval arithmetic level (1st version)
+
+------------------------------------------------------------------------
+r783 | zimmerma | 2000-10-24 08:14:07 +0000 (Tue, 24 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added two suggestions from Ben Hinkle
+
+------------------------------------------------------------------------
+r782 | hanrot | 2000-10-19 12:54:17 +0000 (Thu, 19 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+
+Bof.
+
+------------------------------------------------------------------------
+r781 | hanrot | 2000-10-19 12:53:54 +0000 (Thu, 19 Oct 2000) | 2 lines
+Changed paths:
+ D /trunk/.pure
+ D /trunk/mmpfr
+ M /trunk/mpfr.h
+
+Suppression de vieilleries.
+
+------------------------------------------------------------------------
+r780 | hanrot | 2000-10-19 09:11:50 +0000 (Thu, 19 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+1 << 31 -> ((unsigned int)1) << 31.
+
+------------------------------------------------------------------------
+r779 | hanrot | 2000-10-19 08:56:24 +0000 (Thu, 19 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/dump.c
+ M /trunk/log.c
+ M /trunk/round.c
+ M /trunk/set_d.c
+ M /trunk/set_str.c
+
+Correction de prototypes faux dans le cas ou on n'est pas -D__STDC__.
+
+------------------------------------------------------------------------
+r778 | zimmerma | 2000-10-02 08:44:58 +0000 (Mon, 02 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+ M /trunk/extract.c
+ M /trunk/generic.c
+ M /trunk/print_raw.c
+ M /trunk/set_str_raw.c
+
+malloc -> *_mp_allocate_func or TMP_ALLOC
+
+------------------------------------------------------------------------
+r777 | zimmerma | 2000-10-02 08:15:41 +0000 (Mon, 02 Oct 2000) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+ M /trunk/init.c
+ M /trunk/mpfr.h
+ M /trunk/round.c
+ M /trunk/set_d.c
+ M /trunk/set_prc_raw.c
+ M /trunk/set_prec.c
+ M /trunk/urandomb.c
+
+mpfr_t -> mpfr_ptr or mpfr_srcptr
+
+------------------------------------------------------------------------
+r776 | zimmerma | 2000-09-29 16:07:46 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ D /trunk/tests/texp2.c
+
+removed -> all is in texp.c
+
+------------------------------------------------------------------------
+r775 | zimmerma | 2000-09-29 16:06:55 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added comparison between exp2 and exp3
+
+------------------------------------------------------------------------
+r774 | zimmerma | 2000-09-29 16:04:47 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+
+take also the target precision into account for the guard bits
+
+------------------------------------------------------------------------
+r773 | zimmerma | 2000-09-29 16:04:19 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/exp2.c
+
+new faster version with O(n^(1/3)*M(n)) algorithm
+
+------------------------------------------------------------------------
+r772 | zimmerma | 2000-09-29 16:03:51 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+adjusted exp2-exp3 threshold for new faster version of mpfr_exp2
+
+------------------------------------------------------------------------
+r771 | zimmerma | 2000-09-29 14:23:59 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added mpz_set_fr.c
+
+------------------------------------------------------------------------
+r770 | zimmerma | 2000-09-29 13:03:23 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+added tdump
+
+------------------------------------------------------------------------
+r769 | zimmerma | 2000-09-29 13:02:47 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed pb for op=0 (added \0 at the end of string)
+
+------------------------------------------------------------------------
+r768 | zimmerma | 2000-09-29 13:02:01 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/dump.c
+
+use strlen to determine memory to free
+
+------------------------------------------------------------------------
+r767 | zimmerma | 2000-09-29 13:01:17 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tdump.c
+
+test file for mpfr_dump
+
+------------------------------------------------------------------------
+r766 | zimmerma | 2000-09-29 12:30:55 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+removed karasqrt.c, added sqrtrem.c
+
+------------------------------------------------------------------------
+r765 | zimmerma | 2000-09-29 12:30:15 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+kara_sqrtrem -> mpn_sqrtrem_new
+
+------------------------------------------------------------------------
+r764 | zimmerma | 2000-09-29 12:29:56 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ D /trunk/karasqrt.c
+
+now replaced by new code in sqrtrem.c
+
+------------------------------------------------------------------------
+r763 | zimmerma | 2000-09-29 12:29:24 +0000 (Fri, 29 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+now uses new code mpn_sqrtrem_new
+
+------------------------------------------------------------------------
+r762 | zimmerma | 2000-09-29 12:29:02 +0000 (Fri, 29 Sep 2000) | 3 lines
+Changed paths:
+ A /trunk/sqrtrem.c
+
+new version of fast MPN square root
+(should be integrated in a future release of GNU MP)
+
+------------------------------------------------------------------------
+r761 | zimmerma | 2000-09-28 14:06:55 +0000 (Thu, 28 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added another example from N. Mueller
+
+------------------------------------------------------------------------
+r760 | zimmerma | 2000-09-28 14:03:44 +0000 (Thu, 28 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed another ABW bug
+
+------------------------------------------------------------------------
+r759 | zimmerma | 2000-09-28 09:37:20 +0000 (Thu, 28 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed two Array Bound Writes
+
+------------------------------------------------------------------------
+r758 | zimmerma | 2000-09-28 09:36:56 +0000 (Thu, 28 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed one Array Bound Read (to_nearest, bp=cp and k>=cn)
+
+------------------------------------------------------------------------
+r757 | zimmerma | 2000-09-28 09:35:54 +0000 (Thu, 28 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added 2 new tests from Norbert Mueller
+
+------------------------------------------------------------------------
+r756 | zimmerma | 2000-09-27 13:10:43 +0000 (Wed, 27 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new test
+
+------------------------------------------------------------------------
+r755 | zimmerma | 2000-09-27 13:06:39 +0000 (Wed, 27 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed Array Bound Write
+
+------------------------------------------------------------------------
+r754 | zimmerma | 2000-09-20 11:31:42 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added some words about the inclusion of mpfr.h
+
+------------------------------------------------------------------------
+r753 | zimmerma | 2000-09-20 11:31:11 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+we need to better protect macros
+
+------------------------------------------------------------------------
+r752 | zimmerma | 2000-09-20 10:38:15 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+removed MPFR_OBJECTS (does not work)
+
+------------------------------------------------------------------------
+r751 | zimmerma | 2000-09-20 10:33:16 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added $(MPFR_OBJECTS) in libmpfr_a_LIBADD
+
+------------------------------------------------------------------------
+r750 | zimmerma | 2000-09-20 10:28:29 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+added $(MPFR_OBJECTS) in libmpfr_a_DEPENDENCIES
+
+------------------------------------------------------------------------
+r749 | zimmerma | 2000-09-20 10:08:07 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added contributions from Emmanuel Jeandel and Thom Mulders
+
+------------------------------------------------------------------------
+r748 | zimmerma | 2000-09-20 10:03:32 +0000 (Wed, 20 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+added Thom Mulders
+
+------------------------------------------------------------------------
+r747 | zimmerma | 2000-09-20 10:00:31 +0000 (Wed, 20 Sep 2000) | 3 lines
+Changed paths:
+ A /trunk/shortmul.c
+
+routines for naive/fast short multiplication,
+contributed by Thom Mulders (ETH Zu"rich)
+
+------------------------------------------------------------------------
+r746 | zimmerma | 2000-09-19 14:06:06 +0000 (Tue, 19 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+added new test for overlapping x, y
+
+------------------------------------------------------------------------
+r745 | zimmerma | 2000-09-19 14:05:37 +0000 (Tue, 19 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+fixed problem when x=y
+
+------------------------------------------------------------------------
+r744 | zimmerma | 2000-09-14 12:35:42 +0000 (Thu, 14 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added pb from Norbert Muller
+
+------------------------------------------------------------------------
+r743 | zimmerma | 2000-09-14 12:35:16 +0000 (Thu, 14 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed SEGV (mpn_lshift doesn't seem to like src_size=0)
+
+------------------------------------------------------------------------
+r742 | zimmerma | 2000-09-14 12:32:38 +0000 (Thu, 14 Sep 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+now prints "failed" when test file doesn't return 0
+
+------------------------------------------------------------------------
+r741 | zimmerma | 2000-08-29 18:14:19 +0000 (Tue, 29 Aug 2000) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+replaced mpn_divrem by mpn_tdiv_qr for gmp 3 or later
+and avoid copy of one operand when possible
+
+------------------------------------------------------------------------
+r740 | zimmerma | 2000-08-29 12:38:57 +0000 (Tue, 29 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+updated (make check, make install)
+
+------------------------------------------------------------------------
+r739 | zimmerma | 2000-08-29 12:07:24 +0000 (Tue, 29 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/README
+
+described each file
+
+------------------------------------------------------------------------
+r738 | zimmerma | 2000-08-29 11:53:09 +0000 (Tue, 29 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/NEWS
+
+News for version 1.0
+
+------------------------------------------------------------------------
+r737 | zimmerma | 2000-08-25 17:04:05 +0000 (Fri, 25 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed bug for 0.9999999999...
+
+------------------------------------------------------------------------
+r736 | zimmerma | 2000-08-25 16:58:23 +0000 (Fri, 25 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+added test for 0.99999999999999999
+
+------------------------------------------------------------------------
+r735 | zimmerma | 2000-08-24 16:46:56 +0000 (Thu, 24 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added mpfr_swap
+
+------------------------------------------------------------------------
+r734 | zimmerma | 2000-08-24 09:13:21 +0000 (Thu, 24 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+
+now store last computed value together with last rounding mode
+
+------------------------------------------------------------------------
+r733 | zimmerma | 2000-08-23 16:29:19 +0000 (Wed, 23 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+target ps -> mpfr.ps
+
+------------------------------------------------------------------------
+r732 | zimmerma | 2000-08-23 09:56:15 +0000 (Wed, 23 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+added $(srcdir) to trunc.c for sub-directory compilation
+
+------------------------------------------------------------------------
+r731 | zimmerma | 2000-08-16 15:27:56 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/sin_cos.c
+
+removed some memory leaks
+
+------------------------------------------------------------------------
+r730 | zimmerma | 2000-08-16 14:50:40 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/generic.c
+
+solved memory leaks with T[i] and qtoj[i]
+
+------------------------------------------------------------------------
+r729 | zimmerma | 2000-08-16 14:47:22 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated (done autoconf, faster mpfr_exp, sin/cos)
+
+------------------------------------------------------------------------
+r728 | zimmerma | 2000-08-16 14:37:43 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+updated for version 1.0
+
+------------------------------------------------------------------------
+r727 | zimmerma | 2000-08-16 14:21:30 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+COPYING.LIB -> COPYING
+
+------------------------------------------------------------------------
+r726 | zimmerma | 2000-08-16 14:20:59 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ A /trunk/COPYING
+
+renamed back (wanted for "make dist")
+
+------------------------------------------------------------------------
+r725 | zimmerma | 2000-08-16 14:20:42 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ D /trunk/COPYING.LIB
+
+renamed back to COPYING (wanted for "make dist")
+
+------------------------------------------------------------------------
+r724 | zimmerma | 2000-08-16 14:18:57 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ A /trunk/COPYING.LIB
+
+GNU Library General Public License
+
+------------------------------------------------------------------------
+r723 | zimmerma | 2000-08-16 14:18:22 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ D /trunk/COPYING
+
+renamed to COPYING.LIB, according to mpfr.texi
+
+------------------------------------------------------------------------
+r722 | zimmerma | 2000-08-16 14:12:40 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+
+result was free'd twice when good=1
+
+------------------------------------------------------------------------
+r721 | zimmerma | 2000-08-16 14:10:10 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+put information about authors
+
+------------------------------------------------------------------------
+r720 | zimmerma | 2000-08-16 13:50:37 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/configure
+
+PACKAGE and VERSION are not defined any more
+
+------------------------------------------------------------------------
+r719 | zimmerma | 2000-08-16 13:48:39 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+gmp-mparam.h is required too
+
+------------------------------------------------------------------------
+r718 | zimmerma | 2000-08-16 13:33:49 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+IRIX make does not recognize $< (MISCFLAGS)
+
+------------------------------------------------------------------------
+r717 | zimmerma | 2000-08-16 13:00:20 +0000 (Wed, 16 Aug 2000) | 4 lines
+Changed paths:
+ M /trunk/configure.in
+
+do not define PACKAGE and VERSION in AM_INIT_AUTOMAKE,
+this avoids conflicts with GMP 3.1 config.h
+[thanks to Kevin Ryde]
+
+------------------------------------------------------------------------
+r716 | zimmerma | 2000-08-16 12:59:04 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+updated for GMP 3.1
+
+------------------------------------------------------------------------
+r715 | zimmerma | 2000-08-16 12:56:06 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+MP_BASE_AS_DOUBLE already defined in gmp-impl.h
+
+------------------------------------------------------------------------
+r714 | zimmerma | 2000-08-16 11:26:15 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+
+nb_terms[0] was not initialized
+
+------------------------------------------------------------------------
+r713 | zimmerma | 2000-08-16 10:55:11 +0000 (Wed, 16 Aug 2000) | 3 lines
+Changed paths:
+ M /trunk/log2.c
+
+fixed some FNH (free not in heap) problems for binary splitting method
+(prec >= 30000)
+
+------------------------------------------------------------------------
+r712 | zimmerma | 2000-08-16 09:53:54 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+gmp.info -> mpfr.info
+
+------------------------------------------------------------------------
+r711 | zimmerma | 2000-08-16 09:46:59 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+set_dfl_rnd.* -> set_rnd.* (to avoid conflict with set_dfl_prec.* on DOS 8.3)
+
+------------------------------------------------------------------------
+r710 | zimmerma | 2000-08-16 09:42:43 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ D /trunk/tests/Makefile
+
+now automatically generated by configure
+
+------------------------------------------------------------------------
+r709 | zimmerma | 2000-08-16 09:40:47 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+added if (__GNU_MP_VERSION < 3) for mpn_divrem_1-bug patch
+
+------------------------------------------------------------------------
+r708 | zimmerma | 2000-08-16 09:26:18 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+set_dfl_rnd -> set_rnd
+
+------------------------------------------------------------------------
+r707 | zimmerma | 2000-08-16 09:24:15 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ A /trunk/set_rnd.c
+
+new name of set_dfl_rnd.c (avoids clash with set_dfl_prec.c on DOS 8.3)
+
+------------------------------------------------------------------------
+r706 | zimmerma | 2000-08-16 09:23:43 +0000 (Wed, 16 Aug 2000) | 3 lines
+Changed paths:
+ D /trunk/set_dfl_rnd.c
+
+renamed to set_rnd.c (otherwise truncates like set_dfl_prec.c on
+a DOS 8.3 filesystem)
+
+------------------------------------------------------------------------
+r705 | zimmerma | 2000-08-16 09:20:29 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+setfilename: gmp.info -> mpfr.info
+
+------------------------------------------------------------------------
+r704 | zimmerma | 2000-08-16 09:19:17 +0000 (Wed, 16 Aug 2000) | 4 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+replaced path for libmpfr.a by $(top_builddir)
+test files are now in check_PROGRAMS instead of bin_PROGRAMS (they don't need
+ to be installed)
+
+------------------------------------------------------------------------
+r703 | zimmerma | 2000-08-16 09:14:44 +0000 (Wed, 16 Aug 2000) | 3 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tset_si.c
+
+replaced back BITS_PER_MP_LIMB by mp_bits_per_limb
+(not important in test files)
+
+------------------------------------------------------------------------
+r702 | zimmerma | 2000-08-16 09:09:03 +0000 (Wed, 16 Aug 2000) | 10 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+replaced macros for mpfr_init_set_si by "do { ... } while (0)" so
+they'll work in an if/else like
+
+ if (foo)
+ mpfr_init_set_si (f, -123, GMP_RNDN);
+ else
+ bar ();
+
+[thanks to Kevin Ryde]
+
+------------------------------------------------------------------------
+r701 | zimmerma | 2000-08-16 09:05:15 +0000 (Wed, 16 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div_ui.c
+ M /trunk/exp2.c
+ M /trunk/mpf2mpfr.h
+ M /trunk/mul.c
+ M /trunk/print_raw.c
+ M /trunk/set_si.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+ M /trunk/tests/Makefile
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tset_si.c
+
+replaced mp_bits_per_limb by BITS_PER_MP_LIMB (constant)
+
+------------------------------------------------------------------------
+r700 | zimmerma | 2000-08-14 14:25:50 +0000 (Mon, 14 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+added mpf2mpfr.h
+
+------------------------------------------------------------------------
+r699 | zimmerma | 2000-08-14 13:11:09 +0000 (Mon, 14 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+define check2 only with -DTEST
+
+------------------------------------------------------------------------
+r698 | zimmerma | 2000-08-14 12:39:38 +0000 (Mon, 14 Aug 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+updated for new configure from Emmanuel Jeandel, to GMP 3.xxx
+and removed errors with texinfo
+
+------------------------------------------------------------------------
+r697 | zimmerma | 2000-08-14 12:12:49 +0000 (Mon, 14 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+solaris --> __sparc__
+
+------------------------------------------------------------------------
+r696 | zimmerma | 2000-08-14 11:53:15 +0000 (Mon, 14 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+ A /trunk/tests/Makefile
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+ M /trunk/tests/tsub_ui.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+ifdef IRIX64 -> ifdef __mips
+
+------------------------------------------------------------------------
+r695 | zimmerma | 2000-08-14 11:31:36 +0000 (Mon, 14 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+
+IRIX/make does not understand $< : expanded to trunc.c
+
+------------------------------------------------------------------------
+r694 | zimmerma | 2000-08-14 11:20:29 +0000 (Mon, 14 Aug 2000) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+use standard macro for Alpha
+
+------------------------------------------------------------------------
+r693 | jeandel | 2000-07-13 12:40:25 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+autoconf options described
+
+------------------------------------------------------------------------
+r692 | jeandel | 2000-07-13 12:30:53 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+
+timestamp modified
+
+------------------------------------------------------------------------
+r691 | jeandel | 2000-07-13 12:28:31 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/configure
+
+timestamp changed
+
+------------------------------------------------------------------------
+r690 | jeandel | 2000-07-13 12:27:04 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.am
+
+nothing to say
+
+------------------------------------------------------------------------
+r689 | jeandel | 2000-07-13 12:24:13 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/acinclude.m4
+ M /trunk/aclocal.m4
+
+Timestamp
+
+------------------------------------------------------------------------
+r688 | jeandel | 2000-07-13 12:21:50 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.in
+
+Small bug fixed
+
+------------------------------------------------------------------------
+r687 | jeandel | 2000-07-13 12:15:36 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/configure
+ M /trunk/configure.in
+
+Timestamp modified ?
+
+------------------------------------------------------------------------
+r686 | jeandel | 2000-07-13 12:13:18 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.in
+
+Timestamp modified
+
+------------------------------------------------------------------------
+r685 | jeandel | 2000-07-13 11:54:18 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/configure
+ M /trunk/configure.in
+
+Nothing
+
+------------------------------------------------------------------------
+r684 | jeandel | 2000-07-13 11:43:45 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/Makefile.in
+
+New release
+
+------------------------------------------------------------------------
+r683 | jeandel | 2000-07-13 09:52:17 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/Makefile.in
+
+Bugs fixed
+
+------------------------------------------------------------------------
+r682 | jeandel | 2000-07-13 09:39:27 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+
+Bug fixed
+
+------------------------------------------------------------------------
+r681 | jeandel | 2000-07-13 09:21:09 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+sin_cos added
+
+------------------------------------------------------------------------
+r680 | jeandel | 2000-07-13 08:54:06 +0000 (Thu, 13 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+ M /trunk/pi.c
+
+New algorithm, new wrapper
+
+------------------------------------------------------------------------
+r679 | zimmerma | 2000-07-12 12:50:50 +0000 (Wed, 12 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tround.c
+
+replaced 0 by GMP_RNDN
+
+------------------------------------------------------------------------
+r678 | zimmerma | 2000-07-12 12:47:37 +0000 (Wed, 12 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+fixed (hopefully) bug for 1/1 in precision 32, 64, ...
+
+------------------------------------------------------------------------
+r677 | zimmerma | 2000-07-12 12:46:05 +0000 (Wed, 12 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added test for 1/1 in precision 32 or 64
+
+------------------------------------------------------------------------
+r676 | zimmerma | 2000-07-11 13:31:50 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+use mpfr_print_rnd_mode now
+
+------------------------------------------------------------------------
+r675 | jeandel | 2000-07-11 11:44:56 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/Makefile.in
+ M /trunk/configure
+ M /trunk/configure.in
+
+Bug Fixed, and installation guide made
+
+------------------------------------------------------------------------
+r674 | jeandel | 2000-07-11 11:17:19 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure
+ M /trunk/configure.in
+
+Fixed bug
+
+------------------------------------------------------------------------
+r673 | jeandel | 2000-07-11 11:06:59 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/Makefile.in
+
+Bug Fixed with Solaris make
+
+------------------------------------------------------------------------
+r672 | jeandel | 2000-07-11 10:55:36 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/extract.c
+
+strings.h added
+
+------------------------------------------------------------------------
+r671 | jeandel | 2000-07-11 10:54:00 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Makefile.in
+ M /trunk/tests/Makefile.in
+
+Deps included
+
+------------------------------------------------------------------------
+r670 | jeandel | 2000-07-11 09:55:31 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+ M /trunk/tests/Makefile.in
+
+Bug Fixed
+
+------------------------------------------------------------------------
+r669 | jeandel | 2000-07-11 09:52:32 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.in
+
+Bug fixed
+
+------------------------------------------------------------------------
+r668 | jeandel | 2000-07-11 09:52:17 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile.am
+
+Bug Fixed
+
+------------------------------------------------------------------------
+r667 | jeandel | 2000-07-11 09:47:24 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ A /trunk/Makefile.am
+ A /trunk/Makefile.in
+ A /trunk/acinclude.m4
+ A /trunk/aclocal.m4
+ A /trunk/configure
+ A /trunk/configure.in
+ A /trunk/install-sh
+ A /trunk/missing
+ A /trunk/mkinstalldirs
+ A /trunk/tests/Makefile.am
+ A /trunk/tests/Makefile.in
+ A /trunk/texinfo.tex
+
+First Release
+
+------------------------------------------------------------------------
+r666 | jeandel | 2000-07-11 09:42:34 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ D /trunk/COPYING.LIB
+ A /trunk/NEWS
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r665 | jeandel | 2000-07-11 09:41:38 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ A /trunk/COPYING
+ A /trunk/ChangeLog
+ A /trunk/README
+
+First Release
+
+------------------------------------------------------------------------
+r664 | jeandel | 2000-07-11 09:40:32 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ A /trunk/AUTHORS
+
+First release
+
+------------------------------------------------------------------------
+r663 | jeandel | 2000-07-11 09:37:43 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Added sin_cos
+
+------------------------------------------------------------------------
+r662 | jeandel | 2000-07-11 09:33:53 +0000 (Tue, 11 Jul 2000) | 2 lines
+Changed paths:
+ A /trunk/generic.c
+ A /trunk/sin_cos.c
+
+First Release
+
+------------------------------------------------------------------------
+r661 | jeandel | 2000-06-29 14:35:36 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/extract.c
+
+Memory problems fixed
+
+------------------------------------------------------------------------
+r660 | jeandel | 2000-06-29 14:35:19 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/exp3.c
+
+Memory Leaks Fixed
+
+------------------------------------------------------------------------
+r659 | zimmerma | 2000-06-29 13:22:57 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_sub_ui
+
+------------------------------------------------------------------------
+r658 | zimmerma | 2000-06-29 13:22:34 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/init.c
+
+now use mpfr macros
+
+------------------------------------------------------------------------
+r657 | zimmerma | 2000-06-29 13:18:58 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+be careful not to call mpn_sub_n/mpn_sub_1 with a size 0
+
+------------------------------------------------------------------------
+r656 | zimmerma | 2000-06-29 13:16:45 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/clear.c
+
+fixed to free an entire number of limbs
+
+------------------------------------------------------------------------
+r655 | zimmerma | 2000-06-29 13:14:38 +0000 (Thu, 29 Jun 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tsub_ui.c
+
+test file for sub_ui
+
+------------------------------------------------------------------------
+r654 | jeandel | 2000-06-28 08:35:07 +0000 (Wed, 28 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+mpfr_exp3 and mpfr_extract added to Makefile
+
+------------------------------------------------------------------------
+r653 | jeandel | 2000-06-28 08:33:06 +0000 (Wed, 28 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/exp2.c
+ A /trunk/exp3.c
+ A /trunk/extract.c
+
+First Release
+
+------------------------------------------------------------------------
+r652 | zimmerma | 2000-06-21 15:56:25 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt_ui.c
+
+distinguish between mpfr failure and difference with sqrt()
+
+------------------------------------------------------------------------
+r651 | zimmerma | 2000-06-21 15:55:35 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+ensures random numbers given to sqrt() are positive
+
+------------------------------------------------------------------------
+r650 | zimmerma | 2000-06-21 15:52:43 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+adapted for freebsd
+
+------------------------------------------------------------------------
+r649 | zimmerma | 2000-06-21 15:52:05 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+modified drand to avoid false NaNs (makes SEGV under FreeBSD)
+
+------------------------------------------------------------------------
+r648 | zimmerma | 2000-06-21 15:51:17 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added entry for FreeBSD, removed -pedantic option
+
+------------------------------------------------------------------------
+r647 | zimmerma | 2000-06-21 14:54:08 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+added one test
+
+------------------------------------------------------------------------
+r646 | zimmerma | 2000-06-21 14:47:02 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new tests
+
+------------------------------------------------------------------------
+r645 | zimmerma | 2000-06-21 14:40:38 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_set_prec_raw
+
+------------------------------------------------------------------------
+r644 | zimmerma | 2000-06-21 14:40:17 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed work done
+
+------------------------------------------------------------------------
+r643 | zimmerma | 2000-06-21 13:54:05 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed several bugs
+
+------------------------------------------------------------------------
+r642 | zimmerma | 2000-06-21 13:52:24 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+merged different roundings in case diff_exp<PREC(a), dif<=PREC(c)
+
+------------------------------------------------------------------------
+r641 | zimmerma | 2000-06-21 09:58:17 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+removed printf for argc=1
+
+------------------------------------------------------------------------
+r640 | zimmerma | 2000-06-21 09:54:31 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tui_sub.c
+
+added one test
+
+------------------------------------------------------------------------
+r639 | zimmerma | 2000-06-21 09:52:32 +0000 (Wed, 21 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+make ceil.o,floor.o,trunc.o depend on trunc.c
+
+------------------------------------------------------------------------
+r638 | hanrot | 2000-06-20 08:50:47 +0000 (Tue, 20 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/teq.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/trandom.c
+ M /trunk/tests/ttrunc.c
+
+Various patches for leaks, UMR and (one) BUS.
+
+------------------------------------------------------------------------
+r637 | hanrot | 2000-06-19 16:20:54 +0000 (Mon, 19 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tset_str.c
+
+This patch suppresses a few mem leaks.
+
+------------------------------------------------------------------------
+r636 | hanrot | 2000-06-19 15:38:44 +0000 (Mon, 19 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tsqrt.c
+
+Suppressed memory leaks.
+
+------------------------------------------------------------------------
+r635 | hanrot | 2000-06-19 10:15:32 +0000 (Mon, 19 Jun 2000) | 3 lines
+Changed paths:
+ M /trunk/div.c
+ M /trunk/mul_ui.c
+ M /trunk/sqrt.c
+
+Patch for 1 << (BITS_PER_MP_LIMB - x) when x is 0 (produces inexact results
+on PPCs).
+
+------------------------------------------------------------------------
+r634 | zimmerma | 2000-06-16 15:23:35 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+arguments of gmp_randinit were in wrong order
+
+------------------------------------------------------------------------
+r633 | hanrot | 2000-06-16 15:13:13 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/eq.c
+
+Patch in the case when n_bits is a multiple of 32.
+
+------------------------------------------------------------------------
+r632 | zimmerma | 2000-06-16 15:05:34 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+
+added patch to get denorms on IRIX64
+
+------------------------------------------------------------------------
+r631 | zimmerma | 2000-06-16 15:02:04 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+put instruction to get denormalized numbers on IRIX64 out of #ifdef TEST
+
+------------------------------------------------------------------------
+r630 | zimmerma | 2000-06-16 14:37:23 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+fixed bug occurring on LinuxPPC (1 << 32)
+
+------------------------------------------------------------------------
+r629 | zimmerma | 2000-06-16 14:35:00 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added one test (bug on LinuxPPC)
+
+------------------------------------------------------------------------
+r628 | zimmerma | 2000-06-16 13:47:32 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added one test
+
+------------------------------------------------------------------------
+r627 | zimmerma | 2000-06-16 12:54:05 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+fixed several problems
+
+------------------------------------------------------------------------
+r626 | zimmerma | 2000-06-16 12:53:22 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/ttrunc.c
+
+added more tests
+
+------------------------------------------------------------------------
+r625 | hanrot | 2000-06-16 10:02:43 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Patches for the case where the precision is a multiple of the word size.
+
+------------------------------------------------------------------------
+r624 | zimmerma | 2000-06-16 08:28:40 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed another bug
+
+------------------------------------------------------------------------
+r623 | zimmerma | 2000-06-16 08:26:45 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tui_sub.c
+
+added one test
+
+------------------------------------------------------------------------
+r622 | zimmerma | 2000-06-16 08:22:28 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpz_set_fr
+
+------------------------------------------------------------------------
+r621 | zimmerma | 2000-06-16 08:21:53 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+improved choice of initial precision
+
+------------------------------------------------------------------------
+r620 | zimmerma | 2000-06-16 08:21:03 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+ A /trunk/mpz_set_fr.c
+
+added mpz_set_fr (conversion from mpfr to mpz)
+
+------------------------------------------------------------------------
+r619 | zimmerma | 2000-06-16 08:16:49 +0000 (Fri, 16 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tround.c
+
+added return type 'int' for main
+
+------------------------------------------------------------------------
+r618 | hanrot | 2000-06-15 17:42:09 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Added TESTFLAGS to the main Makefile. Added ttrunc.
+
+------------------------------------------------------------------------
+r617 | hanrot | 2000-06-15 17:26:03 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+Minor patch (put to 0 the nonsignificant bits).
+
+------------------------------------------------------------------------
+r616 | hanrot | 2000-06-15 17:16:02 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Added declaration of trunc, ceil, floor.
+
+------------------------------------------------------------------------
+r615 | hanrot | 2000-06-15 17:15:40 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/ttrunc.c
+
+Tests for trunc, ceil, floor.
+
+------------------------------------------------------------------------
+r614 | hanrot | 2000-06-15 16:43:40 +0000 (Thu, 15 Jun 2000) | 3 lines
+Changed paths:
+ M /trunk/Configure
+
+Added TESTFLAGS variable to the compile instruction, for use as
+make "TESTFLAGS=-DTEST"
+
+------------------------------------------------------------------------
+r613 | zimmerma | 2000-06-15 16:00:28 +0000 (Thu, 15 Jun 2000) | 3 lines
+Changed paths:
+ M /trunk/tests/teq.c
+
+1 -> (mp_limb_t) 1 [pb on 64-bit machines]
+reduced number of tests to 1000
+
+------------------------------------------------------------------------
+r612 | hanrot | 2000-06-15 10:32:04 +0000 (Thu, 15 Jun 2000) | 3 lines
+Changed paths:
+ M /trunk/tests/trandom.c
+
+Display of statistics is only toggled if a number of tests to be performed
+is given. Shameful hack, but is getopt really portable ?
+
+------------------------------------------------------------------------
+r611 | hanrot | 2000-06-15 10:25:51 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Added trandom, teq
+
+------------------------------------------------------------------------
+r610 | hanrot | 2000-06-15 10:25:20 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Added random2, urandomb
+
+------------------------------------------------------------------------
+r609 | hanrot | 2000-06-15 10:15:58 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+Added div_2exp to the (very rough) test.
+
+------------------------------------------------------------------------
+r608 | hanrot | 2000-06-15 10:13:37 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/trandom.c
+
+Very basic statistical tests for random, random2, urandomb.
+
+------------------------------------------------------------------------
+r607 | hanrot | 2000-06-15 10:13:19 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Patch for random (libc's random() is on 31 bits only)
+
+------------------------------------------------------------------------
+r606 | hanrot | 2000-06-15 08:12:10 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/teq.c
+
+Test for mpfr_eq.
+
+------------------------------------------------------------------------
+r605 | hanrot | 2000-06-15 08:11:54 +0000 (Thu, 15 Jun 2000) | 2 lines
+Changed paths:
+ M /trunk/eq.c
+
+Patch a few incoherences of eq.c wrt the manual + adapt to mpfr usual semantics
+
+------------------------------------------------------------------------
+r604 | zimmerma | 2000-06-07 09:50:41 +0000 (Wed, 07 Jun 2000) | 2 lines
+Changed paths:
+ A /trunk/cputime.h
+
+header file providing cputime() function
+
+------------------------------------------------------------------------
+r603 | zimmerma | 2000-06-07 09:45:23 +0000 (Wed, 07 Jun 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/texp2.c
+
+test file comparing mpfr_exp and mpfr_exp2
+
+------------------------------------------------------------------------
+r602 | zimmerma | 2000-06-07 09:44:40 +0000 (Wed, 07 Jun 2000) | 4 lines
+Changed paths:
+ A /trunk/exp2.c
+
+O(n^(1/3)*log(n)) algorithm using Brent's method
+and Brent-Kung's O(sqrt(t)) algorithm to evaluate
+a power series of order t [exact rounding not yet finished]
+
+------------------------------------------------------------------------
+r601 | zimmerma | 2000-05-29 15:37:53 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+fixed bug in mpfr_round (wrong sign)
+
+------------------------------------------------------------------------
+r600 | zimmerma | 2000-05-29 15:09:51 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+fixed bug in mpfr_round: did not check allocated space was large enough
+
+------------------------------------------------------------------------
+r599 | zimmerma | 2000-05-29 14:02:08 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+main -> int main
+
+------------------------------------------------------------------------
+r598 | zimmerma | 2000-05-29 13:54:39 +0000 (Mon, 29 May 2000) | 3 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+added #ifdef TEST: if not defined (default), then function
+mpfr_set_machine_rnd_mode is not defined
+
+------------------------------------------------------------------------
+r597 | zimmerma | 2000-05-29 13:53:43 +0000 (Mon, 29 May 2000) | 3 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+ M /trunk/tests/tadd_ui.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tset_q.c
+ M /trunk/tests/tui_div.c
+ M /trunk/tests/tui_sub.c
+
+added #ifdef TEST to disable comparison with machine arithmetic
+by default (i.e. calls to mpfr_set_machine_rnd_mode)
+
+------------------------------------------------------------------------
+r596 | zimmerma | 2000-05-29 13:46:24 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+removed longlong.h (not needed)
+
+------------------------------------------------------------------------
+r595 | zimmerma | 2000-05-29 13:45:51 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+now deals with NaN
+
+------------------------------------------------------------------------
+r594 | zimmerma | 2000-05-29 13:45:17 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+RND_MODE -> rnd_mode
+
+------------------------------------------------------------------------
+r593 | zimmerma | 2000-05-29 13:44:13 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+mpfr_init is now a function (no more a macro)
+
+------------------------------------------------------------------------
+r592 | zimmerma | 2000-05-29 13:43:39 +0000 (Mon, 29 May 2000) | 3 lines
+Changed paths:
+ M /trunk/init.c
+
+printf -> fprintf
+added mpfr_init as function
+
+------------------------------------------------------------------------
+r591 | zimmerma | 2000-05-29 13:42:10 +0000 (Mon, 29 May 2000) | 3 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+changed (x) -> x
+fixed several typos
+
+------------------------------------------------------------------------
+r590 | zimmerma | 2000-05-29 11:28:48 +0000 (Mon, 29 May 2000) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+removed printf
+
+------------------------------------------------------------------------
+r589 | zimmerma | 2000-05-26 16:38:44 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+added ifdef TEST
+
+------------------------------------------------------------------------
+r588 | zimmerma | 2000-05-26 16:28:09 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+removed debug line
+
+------------------------------------------------------------------------
+r587 | zimmerma | 2000-05-26 16:25:37 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+added one test
+
+------------------------------------------------------------------------
+r586 | zimmerma | 2000-05-26 16:25:13 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added 2 new tests
+
+------------------------------------------------------------------------
+r585 | zimmerma | 2000-05-26 16:24:25 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+little change
+
+------------------------------------------------------------------------
+r584 | zimmerma | 2000-05-26 16:20:49 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+more changes
+
+------------------------------------------------------------------------
+r583 | zimmerma | 2000-05-26 15:44:03 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tsqrt_ui.c
+
+added ifdef TEST
+
+------------------------------------------------------------------------
+r582 | zimmerma | 2000-05-26 15:43:31 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+does not use machine rounding mode any more
+
+------------------------------------------------------------------------
+r581 | zimmerma | 2000-05-26 15:24:40 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added 7 new tests
+
+------------------------------------------------------------------------
+r580 | zimmerma | 2000-05-26 15:24:16 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+fixed typo in printf format
+
+------------------------------------------------------------------------
+r579 | zimmerma | 2000-05-26 15:22:37 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/sub.c
+
+fixed several rounding problems
+
+------------------------------------------------------------------------
+r578 | zimmerma | 2000-05-26 12:52:45 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+rewritten case dif<=0 and PREC(b)>PREC(a) (merged all roundings)
+
+------------------------------------------------------------------------
+r577 | zimmerma | 2000-05-26 10:11:04 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+removed DEBUG, VERBOSE ifdef's
+
+------------------------------------------------------------------------
+r576 | zimmerma | 2000-05-26 10:07:43 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed (hopefully) the case dif<=0, PREC(b)>PREC(a), directed rounding
+
+------------------------------------------------------------------------
+r575 | zimmerma | 2000-05-26 08:59:28 +0000 (Fri, 26 May 2000) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+replaced (mp_limb_t)1 by macro ONE
+fixed bug for GMP_RNDN with overlap=1
+
+------------------------------------------------------------------------
+r574 | zimmerma | 2000-05-26 08:58:32 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+removed misplaced comment
+
+------------------------------------------------------------------------
+r573 | zimmerma | 2000-05-26 08:20:16 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added one test
+
+------------------------------------------------------------------------
+r572 | zimmerma | 2000-05-26 08:16:19 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+does not use rnd_mode.c by default
+
+------------------------------------------------------------------------
+r571 | zimmerma | 2000-05-26 07:41:46 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+removed unused label
+
+------------------------------------------------------------------------
+r570 | zimmerma | 2000-05-26 07:40:31 +0000 (Fri, 26 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed more tiny bugs
+
+------------------------------------------------------------------------
+r569 | zimmerma | 2000-05-25 17:00:04 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt_ui.c
+
+use mpfr_print_rnd_mode now
+
+------------------------------------------------------------------------
+r568 | zimmerma | 2000-05-25 16:59:43 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tui_sub.c
+
+added one test
+
+------------------------------------------------------------------------
+r567 | zimmerma | 2000-05-25 16:59:08 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tadd_ui.c
+
+added more tests
+
+------------------------------------------------------------------------
+r566 | zimmerma | 2000-05-25 16:55:19 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add_ui.c
+
+removed TMP_ALLOC stuff
+
+------------------------------------------------------------------------
+r565 | zimmerma | 2000-05-25 16:54:29 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed new bug when a <- b - c with tiny c
+
+------------------------------------------------------------------------
+r564 | zimmerma | 2000-05-25 16:30:10 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug in a <- b-c when c very small but does not overlap with a
+
+------------------------------------------------------------------------
+r563 | zimmerma | 2000-05-25 15:45:33 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/random2.c
+
+removed 'inline' (does not compile on Alpha with gcc 2.8.1)
+
+------------------------------------------------------------------------
+r562 | zimmerma | 2000-05-25 15:35:48 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tout_str.c
+
+added include file unistd.h
+
+------------------------------------------------------------------------
+r561 | zimmerma | 2000-05-25 15:35:08 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+fixed warning with long arguments
+
+------------------------------------------------------------------------
+r560 | zimmerma | 2000-05-25 15:28:50 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ A /trunk/inp_str.c
+ A /trunk/set_str.c
+
+initial version
+
+------------------------------------------------------------------------
+r559 | zimmerma | 2000-05-25 15:26:11 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added tests for mpfr_set_str
+
+------------------------------------------------------------------------
+r558 | zimmerma | 2000-05-25 15:25:13 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+now returns 0 if all works
+
+------------------------------------------------------------------------
+r557 | zimmerma | 2000-05-25 15:24:42 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+changed to return the error in ulps
+
+------------------------------------------------------------------------
+r556 | zimmerma | 2000-05-25 15:24:06 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added new functions mpfr_set_str and mpfr_inp_str
+
+------------------------------------------------------------------------
+r555 | zimmerma | 2000-05-25 14:58:04 +0000 (Thu, 25 May 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototypes for set_str, inp_str
+changed return value for mpfr*pow*
+
+------------------------------------------------------------------------
+r554 | zimmerma | 2000-05-25 14:56:51 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+separated functions with/without rounding argument
+
+------------------------------------------------------------------------
+r553 | zimmerma | 2000-05-25 14:56:19 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added tabs
+
+------------------------------------------------------------------------
+r552 | zimmerma | 2000-05-25 14:22:08 +0000 (Thu, 25 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added set_str.o and inp_str.o
+
+------------------------------------------------------------------------
+r551 | zimmerma | 2000-05-24 17:01:52 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ A /trunk/sub_ui.c
+
+initial version
+
+------------------------------------------------------------------------
+r550 | zimmerma | 2000-05-24 17:01:01 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added rule for sub_ui.o
+
+------------------------------------------------------------------------
+r549 | zimmerma | 2000-05-24 16:51:55 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+use only one file (trunc.c) for ceil, floor, trunc
+
+------------------------------------------------------------------------
+r548 | zimmerma | 2000-05-24 16:51:22 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ D /trunk/ceil.c
+ D /trunk/floor.c
+
+now use trunc.c for all 3 functions (ceil, floor, trunc)
+
+------------------------------------------------------------------------
+r547 | zimmerma | 2000-05-24 16:42:00 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/trunc.c
+
+added ifdef to avoid warning at compilation
+
+------------------------------------------------------------------------
+r546 | zimmerma | 2000-05-24 16:41:30 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/reldiff.c
+
+removed unused variable
+
+------------------------------------------------------------------------
+r545 | zimmerma | 2000-05-24 16:41:09 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+fixed output type for mpfr_ui_div
+
+------------------------------------------------------------------------
+r544 | zimmerma | 2000-05-24 16:37:13 +0000 (Wed, 24 May 2000) | 3 lines
+Changed paths:
+ M /trunk/urandomb.c
+
+removed 3rd argument (use PREC(rop) instead)
+added include longlong.h
+
+------------------------------------------------------------------------
+r543 | zimmerma | 2000-05-24 16:35:23 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/set_prc_raw.c
+
+stupid typo: ABSSIZE -> ABSSIZE(x)
+
+------------------------------------------------------------------------
+r542 | zimmerma | 2000-05-24 16:32:06 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+change due to new semantics of mpfr_init_set* macros
+
+------------------------------------------------------------------------
+r541 | zimmerma | 2000-05-24 16:31:18 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/set_prc_raw.c
+
+now makes an error when precision too large wrt allocated space
+
+------------------------------------------------------------------------
+r540 | zimmerma | 2000-05-24 16:28:41 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added new implemented functions
+
+------------------------------------------------------------------------
+r539 | zimmerma | 2000-05-24 16:26:30 +0000 (Wed, 24 May 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+- added macro for mpfr_sgn
+- removed argument 'p' in mpfr_init_set* macros for compatibility with mpf
+
+------------------------------------------------------------------------
+r538 | zimmerma | 2000-05-24 16:25:20 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpf2mpfr.h
+
+updated wrt new functions
+
+------------------------------------------------------------------------
+r537 | zimmerma | 2000-05-24 16:24:57 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added sub_ui
+
+------------------------------------------------------------------------
+r536 | zimmerma | 2000-05-24 15:29:24 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added new test files
+
+------------------------------------------------------------------------
+r535 | zimmerma | 2000-05-24 15:28:52 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tadd_ui.c
+ A /trunk/tests/tset_q.c
+ A /trunk/tests/tsqrt_ui.c
+ A /trunk/tests/tui_div.c
+ A /trunk/tests/tui_sub.c
+
+new test files
+
+------------------------------------------------------------------------
+r534 | zimmerma | 2000-05-24 15:24:28 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new tests
+
+------------------------------------------------------------------------
+r533 | zimmerma | 2000-05-24 15:23:54 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tabs.c
+
+improved tests
+
+------------------------------------------------------------------------
+r532 | zimmerma | 2000-05-24 15:22:08 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ A /trunk/add_ui.c
+ A /trunk/reldiff.c
+ A /trunk/sqrt_ui.c
+ A /trunk/ui_div.c
+ A /trunk/ui_sub.c
+
+new functions (compatibility with mpf)
+
+------------------------------------------------------------------------
+r531 | zimmerma | 2000-05-24 15:20:16 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+added 4th arg (was missing in non-stdc def)
+
+------------------------------------------------------------------------
+r530 | zimmerma | 2000-05-24 15:19:10 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added new functions (compatibility with mpf)
+
+------------------------------------------------------------------------
+r529 | zimmerma | 2000-05-24 15:18:37 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added several prototypes
+
+------------------------------------------------------------------------
+r528 | zimmerma | 2000-05-24 15:18:04 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed remaining bug (case overlap=5, dif>0)
+
+------------------------------------------------------------------------
+r527 | zimmerma | 2000-05-24 15:16:52 +0000 (Wed, 24 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added add_ui, sqrt_ui, ui_div, ui_sub, reldiff
+
+------------------------------------------------------------------------
+r526 | hanrot | 2000-05-21 16:47:02 +0000 (Sun, 21 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+ A /trunk/ceil.c
+ A /trunk/floor.c
+ A /trunk/trunc.c
+
+Compatibility mpf/mpfr, second part. Ceil, floor, trunc. Yet untested.
+
+------------------------------------------------------------------------
+r525 | hanrot | 2000-05-21 16:38:07 +0000 (Sun, 21 May 2000) | 2 lines
+Changed paths:
+ A /trunk/mpf2mpfr.h
+
+Include file for compatibility module mpf -> mpfr.
+
+------------------------------------------------------------------------
+r524 | hanrot | 2000-05-21 16:35:52 +0000 (Sun, 21 May 2000) | 3 lines
+Changed paths:
+ M /trunk/Configure
+ A /trunk/dump.c
+ A /trunk/eq.c
+ A /trunk/random2.c
+ A /trunk/set_prc_raw.c
+ A /trunk/urandomb.c
+
+Compatibility with mpf. WARNING: THESE FUNCTIONS ARE UNTESTED IN THEIR PRESENT
+FORM. THEY *DO* COMPILE HOWEVER.
+
+------------------------------------------------------------------------
+r523 | zimmerma | 2000-05-18 13:41:24 +0000 (Thu, 18 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+removed unused variables
+
+------------------------------------------------------------------------
+r522 | zimmerma | 2000-05-18 13:38:53 +0000 (Thu, 18 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+removed ';'
+
+------------------------------------------------------------------------
+r521 | zimmerma | 2000-05-18 13:29:55 +0000 (Thu, 18 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tround.c
+
+added return
+
+------------------------------------------------------------------------
+r520 | zimmerma | 2000-05-18 12:57:08 +0000 (Thu, 18 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+added calls to mpf[r]_clear, and rewrote to avoid memory leaks
+
+------------------------------------------------------------------------
+r519 | zimmerma | 2000-05-18 12:56:14 +0000 (Thu, 18 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added calls to free
+
+------------------------------------------------------------------------
+r518 | zimmerma | 2000-05-18 12:55:17 +0000 (Thu, 18 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+corrected comment about field mp_size
+
+------------------------------------------------------------------------
+r517 | zimmerma | 2000-05-12 08:07:56 +0000 (Fri, 12 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+added tests for negative numbers
+
+------------------------------------------------------------------------
+r516 | zimmerma | 2000-05-12 08:07:35 +0000 (Fri, 12 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added one test
+
+------------------------------------------------------------------------
+r515 | zimmerma | 2000-05-12 08:07:02 +0000 (Fri, 12 May 2000) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed pb with rounding of negative numbers
+
+------------------------------------------------------------------------
+r514 | zimmerma | 2000-05-11 15:39:48 +0000 (Thu, 11 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_abs
+
+------------------------------------------------------------------------
+r513 | zimmerma | 2000-05-11 15:38:12 +0000 (Thu, 11 May 2000) | 2 lines
+Changed paths:
+ A /trunk/tests/tabs.c
+
+test file for mpfr_abs
+
+------------------------------------------------------------------------
+r512 | zimmerma | 2000-05-11 15:37:48 +0000 (Thu, 11 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added mpfr_abs (macro using mpfr_set4)
+
+------------------------------------------------------------------------
+r511 | zimmerma | 2000-05-11 10:08:54 +0000 (Thu, 11 May 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated wrt done/new tasks
+
+------------------------------------------------------------------------
+r510 | zimmerma | 2000-05-05 13:59:56 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added two tests
+
+------------------------------------------------------------------------
+r509 | zimmerma | 2000-05-05 13:59:25 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+split mpfr_init2 into mpfr_init and mpfr_set_prec
+
+------------------------------------------------------------------------
+r508 | zimmerma | 2000-05-05 13:57:33 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+removed karadiv.o
+
+------------------------------------------------------------------------
+r507 | zimmerma | 2000-05-05 13:57:08 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ M /trunk/karasqrt.c
+
+replaced mpn_divrem_n by mpn_divrem (efficient in GMP 3.0)
+
+------------------------------------------------------------------------
+r506 | zimmerma | 2000-05-05 13:55:49 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ D /trunk/karadiv.c
+
+not needed any more with GMP 3.0
+
+------------------------------------------------------------------------
+r505 | zimmerma | 2000-05-05 13:49:02 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+removed mpn_divrem_n stuff, now that Burnikel/Ziegler algorithm is in GMP 3.0
+
+------------------------------------------------------------------------
+r504 | zimmerma | 2000-05-05 13:29:21 +0000 (Fri, 05 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tout_str.c
+
+added one test
+
+------------------------------------------------------------------------
+r503 | zimmerma | 2000-05-04 15:18:31 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+completely rewritten (changed semantics)
+
+------------------------------------------------------------------------
+r502 | zimmerma | 2000-05-04 15:17:07 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+initialized variable bh to avoid warning at compilation
+
+------------------------------------------------------------------------
+r501 | zimmerma | 2000-05-04 15:16:11 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_set_default_rounding_mode
+
+------------------------------------------------------------------------
+r500 | zimmerma | 2000-05-04 15:05:34 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+
+fixed pb in mpfr_cmp_ui_2exp for i=0
+
+------------------------------------------------------------------------
+r499 | zimmerma | 2000-05-04 13:40:09 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+updated according to meeting from May 4, 2000
+
+------------------------------------------------------------------------
+r498 | zimmerma | 2000-05-04 12:24:56 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+updated for AIX
+
+------------------------------------------------------------------------
+r497 | zimmerma | 2000-05-04 12:23:28 +0000 (Thu, 04 May 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+ M /trunk/rnd_mode.c
+
+updated for AIX (thanks to Gerardo Ballabio)
+
+------------------------------------------------------------------------
+r496 | zimmerma | 2000-05-02 16:38:27 +0000 (Tue, 02 May 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+added one test
+
+------------------------------------------------------------------------
+r495 | zimmerma | 2000-05-02 16:37:52 +0000 (Tue, 02 May 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed bug found by G. Ballabio for b=0 and 0<c<1
+
+------------------------------------------------------------------------
+r494 | zimmerma | 2000-05-02 16:37:01 +0000 (Tue, 02 May 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added info for GMP2 vs GMP3
+
+------------------------------------------------------------------------
+r493 | zimmerma | 2000-04-19 19:20:27 +0000 (Wed, 19 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added -ffloat-store for Alpha/OSF
+
+------------------------------------------------------------------------
+r492 | zimmerma | 2000-04-19 18:31:13 +0000 (Wed, 19 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+added cast to mp_limb_t (bug on Alpha in tadd with -O2)
+
+------------------------------------------------------------------------
+r491 | zimmerma | 2000-04-19 18:30:19 +0000 (Wed, 19 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added one test
+
+------------------------------------------------------------------------
+r490 | zimmerma | 2000-04-19 14:46:00 +0000 (Wed, 19 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/karasqrt.c
+
+removed #if 0
+
+------------------------------------------------------------------------
+r489 | zimmerma | 2000-04-19 14:45:27 +0000 (Wed, 19 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+swapped gmp-impl.h and longlong.h for GMP 3.0
+
+------------------------------------------------------------------------
+r488 | zimmerma | 2000-04-14 07:34:19 +0000 (Fri, 14 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+added more tests
+
+------------------------------------------------------------------------
+r487 | zimmerma | 2000-04-14 07:33:46 +0000 (Fri, 14 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+fixed pb when target precision is less than integer length
+
+------------------------------------------------------------------------
+r486 | zimmerma | 2000-04-14 07:32:36 +0000 (Fri, 14 Apr 2000) | 3 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed problem not solved so far, i.e. when adding round bit
+produces a change of exponent
+
+------------------------------------------------------------------------
+r485 | zimmerma | 2000-04-13 17:05:48 +0000 (Thu, 13 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+fixed computation of ulps
+
+------------------------------------------------------------------------
+r484 | zimmerma | 2000-04-13 17:03:32 +0000 (Thu, 13 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+removed variable xrw in mpfr_round_raw (not used)
+
+------------------------------------------------------------------------
+r483 | zimmerma | 2000-04-13 17:02:20 +0000 (Thu, 13 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+replaced 1st my by my+sh in mpfr_round_raw call
+
+------------------------------------------------------------------------
+r482 | zimmerma | 2000-04-13 17:00:16 +0000 (Thu, 13 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added 2 more tests
+
+------------------------------------------------------------------------
+r481 | hanrot | 2000-04-13 16:49:33 +0000 (Thu, 13 Apr 2000) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Correction d'un bug quand le carry contient tous les bits significatifs.
+
+------------------------------------------------------------------------
+r480 | zimmerma | 2000-02-11 17:24:38 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+improved indentation
+mpfr_pi -> mpfr_const_pi
+
+------------------------------------------------------------------------
+r479 | zimmerma | 2000-02-11 17:23:36 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_z.c
+
+added one test
+
+------------------------------------------------------------------------
+r478 | zimmerma | 2000-02-11 17:23:09 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+ M /trunk/tests/tpi.c
+
+mpfr_pi -> mpfr_const_pi
+
+------------------------------------------------------------------------
+r477 | zimmerma | 2000-02-11 17:22:34 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+use mpfr_cmp_ui instead of SIGN
+
+------------------------------------------------------------------------
+r476 | zimmerma | 2000-02-11 17:22:03 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog2.c
+
+mpfr_log2 -> mpfr_const_log2
+
+------------------------------------------------------------------------
+r475 | zimmerma | 2000-02-11 17:20:57 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/Configure
+
+added -O2 compilation flag
+added set_q
+
+------------------------------------------------------------------------
+r474 | zimmerma | 2000-02-11 17:20:19 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ A /trunk/set_q.c
+
+convert rational (mpz_q) to floating-point (mpfr_t)
+
+------------------------------------------------------------------------
+r473 | zimmerma | 2000-02-11 17:19:15 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+removed things which were done
+
+------------------------------------------------------------------------
+r472 | zimmerma | 2000-02-11 17:18:40 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/agm.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/get_str.c
+ M /trunk/log.c
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+
+unsigned char -> mp_rnd_t
+SIGN -> MPFR_SIGN
+
+------------------------------------------------------------------------
+r471 | zimmerma | 2000-02-11 17:17:47 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/clear.c
+
+use PREC() macro instead of _mp_prec, and corrected size to free
+
+------------------------------------------------------------------------
+r470 | zimmerma | 2000-02-11 17:16:36 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+
+SIGN -> MPFR_SIGN
+
+------------------------------------------------------------------------
+r469 | zimmerma | 2000-02-11 17:15:35 +0000 (Fri, 11 Feb 2000) | 4 lines
+Changed paths:
+ M /trunk/div.c
+
+unsigned char -> mp_rnd_t
+SIGN -> MPFR_SIGN
+added non standard C header
+
+------------------------------------------------------------------------
+r468 | zimmerma | 2000-02-11 17:13:54 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/div_2exp.c
+
+unsigned char -> mp_rnd_t
+
+------------------------------------------------------------------------
+r467 | zimmerma | 2000-02-11 17:11:45 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/init.c
+
+unsigned long int -> mp_prec_t
+
+------------------------------------------------------------------------
+r466 | zimmerma | 2000-02-11 17:11:01 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/log2.c
+
+renamed to mpfr_const_log2
+unsigned char -> mp_rnd_t
+
+------------------------------------------------------------------------
+r465 | zimmerma | 2000-02-11 17:10:24 +0000 (Fri, 11 Feb 2000) | 4 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+unsigned char -> mp_rnd_t
+SIGN -> MPFR_SIGN
+unsigned long int -> mp_prec_t
+
+------------------------------------------------------------------------
+r464 | zimmerma | 2000-02-11 17:10:04 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+unsigned char -> mp_rnd_t
+unsigned long int -> mp_prec_t
+
+------------------------------------------------------------------------
+r463 | zimmerma | 2000-02-11 17:08:37 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/mul_2exp.c
+ M /trunk/out_str.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/rnd_mode.c
+
+unsigned char -> mp_rnd_t
+
+------------------------------------------------------------------------
+r462 | zimmerma | 2000-02-11 17:06:41 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/pi.c
+
+renamed to mpfr_const_pi
+unsigned char -> mp_rnd_t
+
+------------------------------------------------------------------------
+r461 | zimmerma | 2000-02-11 17:06:06 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/pow.c
+
+unsigned char -> mp_rnd_t
+added non standard C header
+
+------------------------------------------------------------------------
+r460 | zimmerma | 2000-02-11 17:04:40 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+
+SIGN -> MPFR_SIGN
+
+------------------------------------------------------------------------
+r459 | zimmerma | 2000-02-11 17:03:46 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+added non standard C header
+
+------------------------------------------------------------------------
+r458 | zimmerma | 2000-02-11 17:01:46 +0000 (Fri, 11 Feb 2000) | 4 lines
+Changed paths:
+ M /trunk/round.c
+
+unsigned char -> mp_rnd_t
+SIGN -> MPFR_SIGN
+unsigned long int -> mp_prec_t
+
+------------------------------------------------------------------------
+r457 | zimmerma | 2000-02-11 17:01:15 +0000 (Fri, 11 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_si.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+
+unsigned char -> mp_rnd_t
+SIGN -> MPFR_SIGN
+
+------------------------------------------------------------------------
+r456 | zimmerma | 2000-02-11 17:00:21 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_prec.c
+
+unsigned long int -> mp_prec_t
+
+------------------------------------------------------------------------
+r455 | zimmerma | 2000-02-11 16:59:45 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/set_dfl_rnd.c
+
+har -> mp_rnd_t
+
+------------------------------------------------------------------------
+r454 | zimmerma | 2000-02-11 16:55:07 +0000 (Fri, 11 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+changed rounding mode to mp_rnd_t
+
+------------------------------------------------------------------------
+r453 | zimmerma | 2000-02-04 17:04:06 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+now distinguish between true mpfr errors and possible errors from libm.a
+
+------------------------------------------------------------------------
+r452 | zimmerma | 2000-02-04 17:03:21 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+now use print_rnd_mode
+
+------------------------------------------------------------------------
+r451 | zimmerma | 2000-02-04 17:02:42 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion from JP Merlet
+
+------------------------------------------------------------------------
+r450 | zimmerma | 2000-02-04 17:02:15 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added print_rnd_mode.c
+
+------------------------------------------------------------------------
+r449 | zimmerma | 2000-02-04 14:55:01 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+added more tests
+
+------------------------------------------------------------------------
+r448 | zimmerma | 2000-02-04 14:54:37 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/set_f.c
+
+fixed bug(s) found by Jean-Pierre Merlet
+
+------------------------------------------------------------------------
+r447 | zimmerma | 2000-02-04 14:45:43 +0000 (Fri, 04 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed prototype of mpfr_set_f (takes now only 3 arguments)
+
+------------------------------------------------------------------------
+r446 | zimmerma | 2000-02-03 08:59:19 +0000 (Thu, 03 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added karasqrt.o
+
+------------------------------------------------------------------------
+r445 | zimmerma | 2000-02-03 08:58:49 +0000 (Thu, 03 Feb 2000) | 4 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for kara_sqrtrem
+added redefinition of KARATSUBA_MUL_THRESHOLD (if not defined)
+removed definition of LOG_MP_BITS_PER_LIMB (was not used)
+
+------------------------------------------------------------------------
+r444 | zimmerma | 2000-02-03 08:57:40 +0000 (Thu, 03 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/karasqrt.c
+
+changed return type to mp_size_t and included mpfr.h
+
+------------------------------------------------------------------------
+r443 | zimmerma | 2000-02-03 08:56:58 +0000 (Thu, 03 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/karadiv.c
+
+moved definition of KARATSUBA_MUL_THRESHOLD (if not defined) to mpfr.h
+
+------------------------------------------------------------------------
+r442 | zimmerma | 2000-02-03 08:48:45 +0000 (Thu, 03 Feb 2000) | 2 lines
+Changed paths:
+ A /trunk/karasqrt.c
+
+implements Katatsuba square root
+
+------------------------------------------------------------------------
+r441 | zimmerma | 2000-02-03 08:45:55 +0000 (Thu, 03 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+now use kara_sqrtrem instead of mpn_sqrtrem
+
+------------------------------------------------------------------------
+r440 | zimmerma | 2000-02-03 08:41:35 +0000 (Thu, 03 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+fixed bug when high limb of quotient is zero
+
+------------------------------------------------------------------------
+r439 | zimmerma | 2000-02-02 18:17:30 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added one test [did fail on alpha]
+
+------------------------------------------------------------------------
+r438 | zimmerma | 2000-02-02 18:01:29 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+added cast to mp_limb_t in front of 1<<sh
+
+------------------------------------------------------------------------
+r437 | zimmerma | 2000-02-02 17:57:24 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/karadiv.c
+
+modified to be compatible with gmp-2.0.2
+
+------------------------------------------------------------------------
+r436 | zimmerma | 2000-02-02 17:54:04 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added further sqrt pb on alpha
+
+------------------------------------------------------------------------
+r435 | zimmerma | 2000-02-02 17:53:12 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+swapped longlong.h and gmp-impl.h (pb on alpha)
+
+------------------------------------------------------------------------
+r434 | zimmerma | 2000-02-02 16:02:47 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added test for bug in sub.c found by JP Merlet on Solaris
+
+------------------------------------------------------------------------
+r433 | zimmerma | 2000-02-02 15:52:54 +0000 (Wed, 02 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed mpn_rshift which could have 0 as shift argument
+(caused bug in exp on Solaris found by JP Merlet)
+
+------------------------------------------------------------------------
+r432 | zimmerma | 2000-02-02 15:49:49 +0000 (Wed, 02 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+moved debug messages to stdout
+
+------------------------------------------------------------------------
+r431 | zimmerma | 2000-02-01 16:31:42 +0000 (Tue, 01 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpn_divrem_n (Burnikel-Ziegler algorithm)
+
+------------------------------------------------------------------------
+r430 | zimmerma | 2000-02-01 16:31:05 +0000 (Tue, 01 Feb 2000) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+use mpn_divrem_n (Burnikel-Ziegler algorithm) instead of mpn_divrem
+when rsize=rrsize
+
+------------------------------------------------------------------------
+r429 | zimmerma | 2000-02-01 16:30:17 +0000 (Tue, 01 Feb 2000) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added karadiv.c (to be removed when incorporated in GMP)
+
+------------------------------------------------------------------------
+r428 | zimmerma | 2000-02-01 16:29:32 +0000 (Tue, 01 Feb 2000) | 2 lines
+Changed paths:
+ A /trunk/karadiv.c
+
+Burnikel-Ziegler division
+
+------------------------------------------------------------------------
+r427 | zimmerma | 2000-01-31 13:09:12 +0000 (Mon, 31 Jan 2000) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added further examples from V. Lefe`vre
+
+------------------------------------------------------------------------
+r426 | zimmerma | 1999-12-16 13:14:21 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added macri VERSION for target dist
+
+------------------------------------------------------------------------
+r425 | zimmerma | 1999-12-16 11:00:44 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added new tests from V. Lefe`vre
+
+------------------------------------------------------------------------
+r424 | zimmerma | 1999-12-16 11:00:14 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+improved interface: tdiv N for doing N random tests
+
+------------------------------------------------------------------------
+r423 | zimmerma | 1999-12-16 10:59:26 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+added one test
+
+------------------------------------------------------------------------
+r422 | zimmerma | 1999-12-16 10:58:50 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+DEBUG2 -> DEBUG
+
+------------------------------------------------------------------------
+r421 | zimmerma | 1999-12-16 10:58:21 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+added debug instructions
+
+------------------------------------------------------------------------
+r420 | zimmerma | 1999-12-16 10:57:44 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+fixed nasty bug in mpfr_cmp2 (case cc=1)
+
+------------------------------------------------------------------------
+r419 | zimmerma | 1999-12-16 10:54:57 +0000 (Thu, 16 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+replaced printf by fprintf for error
+
+------------------------------------------------------------------------
+r418 | zimmerma | 1999-12-10 20:32:36 +0000 (Fri, 10 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added new tests for large input
+
+------------------------------------------------------------------------
+r417 | zimmerma | 1999-12-10 20:32:07 +0000 (Fri, 10 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+fixed bug for large input
+
+------------------------------------------------------------------------
+r416 | zimmerma | 1999-12-10 13:29:54 +0000 (Fri, 10 Dec 1999) | 4 lines
+Changed paths:
+ M /trunk/log.c
+
+rewritten the error analysis:
+- now analyzes the cancellation a posteriori
+- takes into account errors from rounding and initial approximation
+
+------------------------------------------------------------------------
+r415 | zimmerma | 1999-12-10 13:27:42 +0000 (Fri, 10 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added tests from Vincent Lefe`vre
+
+------------------------------------------------------------------------
+r414 | zimmerma | 1999-12-10 13:04:09 +0000 (Fri, 10 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+no warning any more for negative exponent (thanks to V. Lefe`vre)
+
+------------------------------------------------------------------------
+r413 | zimmerma | 1999-12-08 12:12:07 +0000 (Wed, 08 Dec 1999) | 3 lines
+Changed paths:
+ M /trunk/exp.c
+
+fixed bug found by V. Lefe`vre (when n<0, we have to compute
+an upper bound of log(2) instead of a lower bound)
+
+------------------------------------------------------------------------
+r412 | zimmerma | 1999-12-08 12:10:29 +0000 (Wed, 08 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added new test (bug found by V. Lefe`vre)
+
+------------------------------------------------------------------------
+r411 | zimmerma | 1999-12-07 16:01:25 +0000 (Tue, 07 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added suggestion from V. Lefe`vre
+
+------------------------------------------------------------------------
+r410 | zimmerma | 1999-12-07 10:31:45 +0000 (Tue, 07 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/TODO
+
+added several remarks from Vincent Lefe`vre
+
+------------------------------------------------------------------------
+r409 | zimmerma | 1999-12-07 10:27:05 +0000 (Tue, 07 Dec 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+corrected many typos found by Vincent Lefe`vre
+
+------------------------------------------------------------------------
+r408 | zimmerma | 1999-11-27 08:10:56 +0000 (Sat, 27 Nov 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+
+removed executable rights
+
+------------------------------------------------------------------------
+r407 | zimmerma | 1999-11-27 08:09:46 +0000 (Sat, 27 Nov 1999) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+
+improved GMP link (thanks to Vincent Lefe`vre)
+added pointer to Alpha-Linux f-p problems
+
+------------------------------------------------------------------------
+r406 | zimmerma | 1999-11-27 08:08:35 +0000 (Sat, 27 Nov 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+removed executable right on file
+
+------------------------------------------------------------------------
+r405 | zimmerma | 1999-10-20 14:17:01 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+put back test for x=y
+
+------------------------------------------------------------------------
+r404 | zimmerma | 1999-10-20 14:11:34 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+modified to avoid y=-0.0
+
+------------------------------------------------------------------------
+r403 | zimmerma | 1999-10-20 13:31:20 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+modified test procedure to return 53 when x=y
+
+------------------------------------------------------------------------
+r402 | zimmerma | 1999-10-20 13:25:13 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+mpfr_cmp2(b,c) now returns PREC(b) if b=c, even if c=0
+
+------------------------------------------------------------------------
+r401 | zimmerma | 1999-10-20 13:06:11 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one test
+
+------------------------------------------------------------------------
+r400 | zimmerma | 1999-10-20 13:05:43 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added test under Cygwin
+
+------------------------------------------------------------------------
+r399 | zimmerma | 1999-10-20 11:16:09 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+$make -> $MAKE
+
+------------------------------------------------------------------------
+r398 | zimmerma | 1999-10-20 10:21:22 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_z.c
+
+removed *rand48 prototypes (pb under Cygwin)
+
+------------------------------------------------------------------------
+r397 | zimmerma | 1999-10-20 10:20:37 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+removed *rand48 prototypes
+
+------------------------------------------------------------------------
+r396 | zimmerma | 1999-10-20 10:20:12 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+removed lrand48 prototype (pb under Cygwin)
+
+------------------------------------------------------------------------
+r395 | zimmerma | 1999-10-20 10:19:30 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+added rounding instructions for Cygnus compiler under Windows
+
+------------------------------------------------------------------------
+r394 | zimmerma | 1999-10-20 10:18:14 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added dummy *rand48 functions for CYGWIN
+
+------------------------------------------------------------------------
+r393 | zimmerma | 1999-10-20 10:17:38 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added info about gmp-mparam.h
+
+------------------------------------------------------------------------
+r392 | zimmerma | 1999-10-20 10:16:28 +0000 (Wed, 20 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+incorporated data for CYGWIN
+
+------------------------------------------------------------------------
+r391 | zimmerma | 1999-10-15 09:51:16 +0000 (Fri, 15 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one test
+
+------------------------------------------------------------------------
+r390 | zimmerma | 1999-10-15 09:41:12 +0000 (Fri, 15 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tsqrt.c
+
+added boundary cases from paper from Michael Parks
+
+------------------------------------------------------------------------
+r389 | zimmerma | 1999-10-14 13:32:09 +0000 (Thu, 14 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+now set sign correctly
+
+------------------------------------------------------------------------
+r388 | zimmerma | 1999-10-14 13:31:45 +0000 (Thu, 14 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added test to check sign is correctly set
+
+------------------------------------------------------------------------
+r387 | zimmerma | 1999-10-14 13:31:15 +0000 (Thu, 14 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added worst case for arg. reduction
+
+------------------------------------------------------------------------
+r386 | zimmerma | 1999-10-14 13:26:40 +0000 (Thu, 14 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+fixed bug when initial approx. floor(x/log(2)) is too large
+
+------------------------------------------------------------------------
+r385 | zimmerma | 1999-10-08 15:25:42 +0000 (Fri, 08 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+now use macros for Linux case, and added ifdef for _ISOC9X_SOURCE
+
+------------------------------------------------------------------------
+r384 | zimmerma | 1999-10-08 10:03:45 +0000 (Fri, 08 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+changed target dist to create archive in a directory
+
+------------------------------------------------------------------------
+r383 | zimmerma | 1999-10-07 15:12:09 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added targets doc and dist
+
+------------------------------------------------------------------------
+r382 | zimmerma | 1999-10-07 15:11:43 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/INSTALL
+
+added documentation and contact for problems
+
+------------------------------------------------------------------------
+r381 | zimmerma | 1999-10-07 14:54:54 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ A /trunk/INSTALL
+
+file for installation of mpfr
+
+------------------------------------------------------------------------
+r380 | zimmerma | 1999-10-07 14:09:58 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tout_str.c
+
+added more tests
+
+------------------------------------------------------------------------
+r379 | zimmerma | 1999-10-07 14:06:17 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+now deal with 0 and fixed bug on 64-bit machine
+
+------------------------------------------------------------------------
+r378 | zimmerma | 1999-10-07 08:15:21 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ D /trunk/sqrt3.c
+
+moved to sqrt.c
+
+------------------------------------------------------------------------
+r377 | zimmerma | 1999-10-07 08:14:56 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+now use directly mpn_sqrtrem (previously sqrt3.c)
+
+------------------------------------------------------------------------
+r376 | zimmerma | 1999-10-07 08:14:13 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+updated prototypes of mpfr_div/mpfr_sqrt
+
+------------------------------------------------------------------------
+r375 | zimmerma | 1999-10-07 08:11:25 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+ M /trunk/mpfr.h
+
+removed div3 and sqrt3
+
+------------------------------------------------------------------------
+r374 | zimmerma | 1999-10-07 08:10:06 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+div3 -> div
+
+------------------------------------------------------------------------
+r373 | zimmerma | 1999-10-07 08:09:41 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ D /trunk/div3.c
+
+moved to div.c
+
+------------------------------------------------------------------------
+r372 | zimmerma | 1999-10-07 08:08:48 +0000 (Thu, 07 Oct 1999) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+replaced implementation using Goldschmidt's algorithm
+by that using directly mpn_divrem (previously div3.c)
+
+------------------------------------------------------------------------
+r371 | zimmerma | 1999-10-07 08:07:46 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+sqrt3 -> sqrt
+
+------------------------------------------------------------------------
+r370 | zimmerma | 1999-10-07 08:05:54 +0000 (Thu, 07 Oct 1999) | 2 lines
+Changed paths:
+ A /trunk/COPYING.LIB
+
+GNU Library Public License
+
+------------------------------------------------------------------------
+r369 | zimmerma | 1999-08-31 08:56:55 +0000 (Tue, 31 Aug 1999) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+removed printf statement
+
+------------------------------------------------------------------------
+r368 | zimmerma | 1999-08-31 08:46:21 +0000 (Tue, 31 Aug 1999) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+added ABS for SIZ(z) when z<0
+
+------------------------------------------------------------------------
+r367 | zimmerma | 1999-08-31 08:45:45 +0000 (Tue, 31 Aug 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+removed special 'exact' stuff for n=0
+
+------------------------------------------------------------------------
+r366 | zimmerma | 1999-08-31 08:18:25 +0000 (Tue, 31 Aug 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+fixed prototype of random
+
+------------------------------------------------------------------------
+r365 | zimmerma | 1999-07-30 16:48:33 +0000 (Fri, 30 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+replaced GNU MPFR by MPFR (not yet the GNU label)
+
+------------------------------------------------------------------------
+r364 | zimmerma | 1999-07-30 16:47:40 +0000 (Fri, 30 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/clear.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div3.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/get_str.c
+ M /trunk/init.c
+ M /trunk/init_set.h
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpfr-impl.h
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/rnd_mode.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_dfl_prec.c
+ M /trunk/set_dfl_rnd.c
+ M /trunk/set_f.c
+ M /trunk/set_prec.c
+ M /trunk/set_si.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sqrt3.c
+ M /trunk/sub.c
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tcan_round.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tcmp2.c
+ M /trunk/tests/tcmp_ui.c
+ M /trunk/tests/tdiv.c
+ M /trunk/tests/tdiv_ui.c
+ M /trunk/tests/texp.c
+ M /trunk/tests/tget_str.c
+ M /trunk/tests/tlog.c
+ M /trunk/tests/tlog2.c
+ M /trunk/tests/tmul.c
+ M /trunk/tests/tmul_2exp.c
+ M /trunk/tests/tmul_ui.c
+ M /trunk/tests/tout_str.c
+ M /trunk/tests/tpi.c
+ M /trunk/tests/tround.c
+ M /trunk/tests/tset_d.c
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+ M /trunk/tests/tset_z.c
+ M /trunk/tests/tsqrt.c
+ M /trunk/tests/tzeta.c
+ M /trunk/zeta.c
+
+added copyright notice
+
+------------------------------------------------------------------------
+r363 | zimmerma | 1999-07-09 18:02:58 +0000 (Fri, 09 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_z.c
+
+added one test with prec=160
+
+------------------------------------------------------------------------
+r362 | zimmerma | 1999-07-09 18:02:08 +0000 (Fri, 09 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/pi.c
+
+error term is N+1 and not N
+
+------------------------------------------------------------------------
+r361 | zimmerma | 1999-07-09 18:00:39 +0000 (Fri, 09 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set_z.c
+
+fixed bug in case sh=0
+
+------------------------------------------------------------------------
+r360 | zimmerma | 1999-07-08 16:28:56 +0000 (Thu, 08 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/round.c
+
+completely rewritten mpfr_can_round_raw, which costs now O(1)
+--- or more probably O(log n) --- instead of O(n)
+
+------------------------------------------------------------------------
+r359 | zimmerma | 1999-07-07 16:47:31 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+changed mpfr_init2 to mpfr_set_prec
+
+------------------------------------------------------------------------
+r358 | zimmerma | 1999-07-07 16:44:53 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added one test
+
+------------------------------------------------------------------------
+r357 | zimmerma | 1999-07-07 16:08:19 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+added prototype for mpfr_add1
+
+------------------------------------------------------------------------
+r356 | zimmerma | 1999-07-07 16:04:13 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcan_round.c
+
+added mpfr_clear
+
+------------------------------------------------------------------------
+r355 | hanrot | 1999-07-07 15:53:23 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt3.c
+
+sqrt3 now returns an exact / inexact flag.
+
+------------------------------------------------------------------------
+r354 | hanrot | 1999-07-07 15:52:58 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+sqrt3 now returns an exact/inexact flag.
+
+------------------------------------------------------------------------
+r353 | zimmerma | 1999-07-07 15:49:50 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+fix UMR (missing 0 terminating string)
+
+------------------------------------------------------------------------
+r352 | zimmerma | 1999-07-07 15:26:07 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/init.c
+
+put initialization of exponent back (avoids some UMRs)
+
+------------------------------------------------------------------------
+r351 | zimmerma | 1999-07-07 15:11:20 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed array bound write bug
+
+------------------------------------------------------------------------
+r350 | zimmerma | 1999-07-07 13:12:18 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one test
+
+------------------------------------------------------------------------
+r349 | zimmerma | 1999-07-07 13:10:57 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+added several tests, and does not print on stdout when no argument
+
+------------------------------------------------------------------------
+r348 | zimmerma | 1999-07-07 13:09:37 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+fixed several bugs
+
+------------------------------------------------------------------------
+r347 | hanrot | 1999-07-07 11:37:10 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+Added an example which causes an ABW in mpz_get_str.
+
+------------------------------------------------------------------------
+r346 | zimmerma | 1999-07-07 11:35:17 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+moved drand to mpfr-impl.h and added test in large precision
+
+------------------------------------------------------------------------
+r345 | zimmerma | 1999-07-07 11:24:34 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added tout_str
+
+------------------------------------------------------------------------
+r344 | hanrot | 1999-07-07 10:12:23 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt3.c
+
+Problem with the exponents in the destructive case.
+
+------------------------------------------------------------------------
+r343 | zimmerma | 1999-07-07 10:04:22 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+
+more changes from G. Hanrot
+
+------------------------------------------------------------------------
+r342 | zimmerma | 1999-07-07 10:00:45 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+use now drand48 instead of drand
+
+------------------------------------------------------------------------
+r341 | zimmerma | 1999-07-07 09:49:04 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+simply set to zero the non-significant bits, don't call mpfr_round_raw
+
+------------------------------------------------------------------------
+r340 | zimmerma | 1999-07-07 09:44:15 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+
+upgrade from bug fixes from Guillaume Hanrot
+
+------------------------------------------------------------------------
+r339 | zimmerma | 1999-07-07 09:38:44 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/pi.c
+
+stores now last computed value together with its rounding mode
+
+------------------------------------------------------------------------
+r338 | zimmerma | 1999-07-07 09:23:24 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+checks now destructive version
+
+------------------------------------------------------------------------
+r337 | boldo | 1999-07-07 08:07:16 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+ M /trunk/tests/tlog.c
+
+changes on random
+
+------------------------------------------------------------------------
+r336 | boldo | 1999-07-07 08:00:29 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+using div3
+
+------------------------------------------------------------------------
+r335 | boldo | 1999-07-07 08:00:09 +0000 (Wed, 07 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+using sqrt3
+
+------------------------------------------------------------------------
+r334 | hanrot | 1999-07-06 16:56:56 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+HPUX support, 2nd try.
+
+------------------------------------------------------------------------
+r333 | hanrot | 1999-07-06 15:24:27 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+ M /trunk/sqrt3.c
+
+Patch for the (very seldom encountered) case of even rounding.
+
+------------------------------------------------------------------------
+r332 | zimmerma | 1999-07-06 15:09:07 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+ M /trunk/tests/tset_si.c
+ M /trunk/tests/tset_str.c
+
+added def. for random/srandom, which do not exist under HPUX
+
+------------------------------------------------------------------------
+r331 | zimmerma | 1999-07-06 15:06:16 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/pi.c
+
+store now computed values
+
+------------------------------------------------------------------------
+r330 | zimmerma | 1999-07-06 15:05:42 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+
+_mpfr_log2_* -> __mpfr_log2_*
+
+------------------------------------------------------------------------
+r329 | zimmerma | 1999-07-06 14:48:33 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+merged machine rounding instructions for Sun and HP
+
+------------------------------------------------------------------------
+r328 | zimmerma | 1999-07-06 14:46:38 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+patch for HPUX (no random function)
+
+------------------------------------------------------------------------
+r327 | zimmerma | 1999-07-06 14:44:30 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added print_rnd_mode
+
+------------------------------------------------------------------------
+r326 | zimmerma | 1999-07-06 14:41:38 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+fixed prototype of mpfr_print_rnd_mode
+
+------------------------------------------------------------------------
+r325 | zimmerma | 1999-07-06 14:40:54 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+improved ulp to deal with case a=0.0
+
+------------------------------------------------------------------------
+r324 | zimmerma | 1999-07-06 14:40:13 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added return 0 to main
+
+------------------------------------------------------------------------
+r323 | hanrot | 1999-07-06 14:00:29 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+
+Forgotten casts.
+
+------------------------------------------------------------------------
+r322 | hanrot | 1999-07-06 12:55:14 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Added sqrt3 + tentative support for Alpha linux.
+
+------------------------------------------------------------------------
+r321 | hanrot | 1999-07-06 12:40:17 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt3.c
+
+The word added when the exponent is odd was sometimes unitialized.
+
+------------------------------------------------------------------------
+r320 | hanrot | 1999-07-06 09:39:42 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ A /trunk/sqrt3.c
+
+Initial version.
+
+------------------------------------------------------------------------
+r319 | hanrot | 1999-07-06 09:39:20 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Added mpfr_sqrt3.
+
+------------------------------------------------------------------------
+r318 | zimmerma | 1999-07-06 09:23:25 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added several functions, and updated others
+
+------------------------------------------------------------------------
+r317 | zimmerma | 1999-07-06 09:19:09 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed prototype of mpfr_log
+
+------------------------------------------------------------------------
+r316 | zimmerma | 1999-07-06 09:17:28 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+returns now an int instead of void
+
+------------------------------------------------------------------------
+r315 | zimmerma | 1999-07-06 09:16:41 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/init.c
+
+removed initialization of exponent
+
+------------------------------------------------------------------------
+r314 | zimmerma | 1999-07-06 09:16:03 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+
+special case for exp(0)
+
+------------------------------------------------------------------------
+r313 | zimmerma | 1999-07-06 09:15:40 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added test for exp(0)
+
+------------------------------------------------------------------------
+r312 | hanrot | 1999-07-06 08:31:45 +0000 (Tue, 06 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+config.in -> ./config.in
+
+------------------------------------------------------------------------
+r311 | boldo | 1999-07-05 18:55:08 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+new, quick & clean
+
+------------------------------------------------------------------------
+r310 | zimmerma | 1999-07-05 16:35:27 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added two tests and converted to double's
+
+------------------------------------------------------------------------
+r309 | boldo | 1999-07-05 16:27:31 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+more checking ways
+
+------------------------------------------------------------------------
+r308 | zimmerma | 1999-07-05 15:24:16 +0000 (Mon, 05 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+distinguishes now between true errors and differences with libm.a
+(which may fail too)
+
+------------------------------------------------------------------------
+r307 | zimmerma | 1999-07-05 14:55:12 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+removed mpf stuff in check
+
+------------------------------------------------------------------------
+r306 | zimmerma | 1999-07-05 14:49:59 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+added some mpfr_clear's
+
+------------------------------------------------------------------------
+r305 | zimmerma | 1999-07-05 14:45:58 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+changed defs of random/srandom to work on Alpha
+
+------------------------------------------------------------------------
+r304 | zimmerma | 1999-07-05 14:45:12 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+mpfr_init2 -> mpfr_set_prec in check64
+
+------------------------------------------------------------------------
+r303 | zimmerma | 1999-07-05 14:30:48 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+added function dbl
+
+------------------------------------------------------------------------
+r302 | zimmerma | 1999-07-05 14:30:19 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototypes for mpfr_cmp3 and mpfr_set4
+
+------------------------------------------------------------------------
+r301 | zimmerma | 1999-07-05 14:06:18 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/neg.c
+
+use mpfr_set4 now (no modification of const parameters any more)
+
+------------------------------------------------------------------------
+r300 | zimmerma | 1999-07-05 14:05:33 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+return 0 in mpfr_can_round_raw
+
+------------------------------------------------------------------------
+r299 | zimmerma | 1999-07-05 14:04:38 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+introduced auxiliary function mpfr_set4
+
+------------------------------------------------------------------------
+r298 | zimmerma | 1999-07-05 14:01:07 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+fixed possible bug (testing sign of unsigned long) in mpfr_mul_ui
+
+------------------------------------------------------------------------
+r297 | zimmerma | 1999-07-05 14:00:11 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+
+replaced PREC(r) by prec (which was defined but not used)
+
+------------------------------------------------------------------------
+r296 | zimmerma | 1999-07-05 13:59:08 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+moved drand and ulp to mpfr-impl
+
+------------------------------------------------------------------------
+r295 | zimmerma | 1999-07-05 13:55:23 +0000 (Mon, 05 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+moved ulp to mpfr-impl.h
+and used input routine 'dbl' in some tests
+
+------------------------------------------------------------------------
+r294 | zimmerma | 1999-07-05 13:32:55 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+modified one test to avoid rounding from double input routines
+
+------------------------------------------------------------------------
+r293 | zimmerma | 1999-07-05 13:18:06 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+introduced auxiliary function mpfr_cmp3(x,y,sign) to compare x and sign*y
+
+------------------------------------------------------------------------
+r292 | zimmerma | 1999-07-05 13:16:55 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+moved drand and ulp to mpfr-impl.h
+
+------------------------------------------------------------------------
+r291 | zimmerma | 1999-07-05 13:15:48 +0000 (Mon, 05 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+mpfr_sub now calls directly mpfr_add1/mpfr_sub1 (no modification of
+const parameters any more)
+
+------------------------------------------------------------------------
+r290 | zimmerma | 1999-07-05 13:14:13 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp.c
+
+moved drand to mpfr-implh.h
+
+------------------------------------------------------------------------
+r289 | zimmerma | 1999-07-05 13:12:55 +0000 (Mon, 05 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/add.c
+
+use mpfr_cmp3 instead of mpfr_cmp (avoids warning due to modification of
+const parameters)
+
+------------------------------------------------------------------------
+r288 | zimmerma | 1999-07-05 13:11:42 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+moved drand to mpfr-impl.h and removed warnings
+
+------------------------------------------------------------------------
+r287 | zimmerma | 1999-07-05 12:34:27 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/zeta.c
+
+use the result of mpfr_can_round
+
+------------------------------------------------------------------------
+r286 | zimmerma | 1999-07-05 11:05:32 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+moved drand and ulp to mpfr-impl.h
+
+------------------------------------------------------------------------
+r285 | zimmerma | 1999-07-05 11:03:46 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+moved drand to mpfr-impl.h
+
+------------------------------------------------------------------------
+r284 | zimmerma | 1999-07-05 10:56:30 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+moved drand to mpfr-impl and removed warnings
+
+------------------------------------------------------------------------
+r283 | zimmerma | 1999-07-05 10:55:30 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr-impl.h
+
+added include of math.h
+
+------------------------------------------------------------------------
+r282 | zimmerma | 1999-07-05 10:52:07 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+moved drand and ulp to mpfr-impl.h
+
+------------------------------------------------------------------------
+r281 | zimmerma | 1999-07-05 10:51:37 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ A /trunk/mpfr-impl.h
+
+include file for mpfr developers only
+
+------------------------------------------------------------------------
+r280 | zimmerma | 1999-07-05 10:45:52 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+long -> int in drand
+
+------------------------------------------------------------------------
+r279 | zimmerma | 1999-07-05 10:43:11 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+adapted drand to sizeof(long)=64
+
+------------------------------------------------------------------------
+r278 | zimmerma | 1999-07-05 10:12:44 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+config.in -> ./config.in (otherwise don't work under IRIX)
+
+------------------------------------------------------------------------
+r277 | zimmerma | 1999-07-05 09:42:53 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv_ui.c
+
+removed warnings
+
+------------------------------------------------------------------------
+r276 | zimmerma | 1999-07-05 09:42:20 +0000 (Mon, 05 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+patch for GMP bug when UDIV_NEEDS_NORMALIZATION=1
+
+------------------------------------------------------------------------
+r275 | hanrot | 1999-07-02 17:51:54 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+
+Correction of a typo.
+
+------------------------------------------------------------------------
+r274 | zimmerma | 1999-07-02 16:13:14 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div_ui.c
+
+fixed horrible hack yp[-1]
+
+------------------------------------------------------------------------
+r273 | hanrot | 1999-07-02 15:47:18 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Support of IRIX64 (n32/64 modes) plus cosmetic modifications.
+
+------------------------------------------------------------------------
+r272 | zimmerma | 1999-07-02 12:29:31 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added one test, and adapted to ANSI C
+
+------------------------------------------------------------------------
+r271 | hanrot | 1999-07-02 12:28:06 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Yet Another Backslash Forgotten...
+
+------------------------------------------------------------------------
+r270 | hanrot | 1999-07-02 12:26:33 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div3.c
+
+Bug le plus stupide de tous les temps corrige. Ca marchait sous Solaris...
+
+------------------------------------------------------------------------
+r269 | zimmerma | 1999-07-02 12:25:39 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+added one test and removed warnings
+
+------------------------------------------------------------------------
+r268 | hanrot | 1999-07-02 12:22:02 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Added mpfr_div3.
+
+------------------------------------------------------------------------
+r267 | hanrot | 1999-07-02 12:21:42 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Added div3.c
+
+------------------------------------------------------------------------
+r266 | zimmerma | 1999-07-02 12:19:59 +0000 (Fri, 02 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/add.c
+
+fixed bug when sizeof(long) <> sizeof(mp_limb_t)
+and removed DEBUG2 stuff
+
+------------------------------------------------------------------------
+r265 | zimmerma | 1999-07-02 12:19:03 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added one test, and removed warnings
+
+------------------------------------------------------------------------
+r264 | hanrot | 1999-07-02 12:18:47 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ A /trunk/div3.c
+
+Added div3.c, initial release.
+
+------------------------------------------------------------------------
+r263 | hanrot | 1999-07-02 11:45:22 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Patch of the patch :)
+
+------------------------------------------------------------------------
+r262 | hanrot | 1999-07-02 11:27:38 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Pattern matching rules in tests Makefile for non-GNU make (eg Solaris)
+
+------------------------------------------------------------------------
+r261 | zimmerma | 1999-07-02 11:24:09 +0000 (Fri, 02 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+adapted to enable denormalized numbers on IRIX64, added one test and
+removed warnings
+
+------------------------------------------------------------------------
+r260 | zimmerma | 1999-07-02 11:21:42 +0000 (Fri, 02 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/round.c
+
+changed type of 3rd arg. 'neg' of mpfr_can_round_raw from char to int
+(pb with signed char's on some machines, e.g. IRIX64)
+
+------------------------------------------------------------------------
+r259 | zimmerma | 1999-07-02 10:09:00 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+adapted to IRIX64 (enable denorm. numbers) and removed warnings
+
+------------------------------------------------------------------------
+r258 | zimmerma | 1999-07-02 10:06:05 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+adapted to IRIX64 (enable denormalized numbers) and removed warnings
+
+------------------------------------------------------------------------
+r257 | zimmerma | 1999-07-02 10:03:28 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+adapted to IRIX64 (no denormalized by default) and removed warnings
+
+------------------------------------------------------------------------
+r256 | zimmerma | 1999-07-02 09:55:41 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+unsigned long -> mp_limb_t
+
+------------------------------------------------------------------------
+r255 | boldo | 1999-07-02 09:51:06 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+unused variables
+
+------------------------------------------------------------------------
+r254 | boldo | 1999-07-02 09:50:16 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+unused variable
+
+------------------------------------------------------------------------
+r253 | zimmerma | 1999-07-02 09:43:38 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+added ifdef to avoid warning "unused variable" on 64-bit machine
+
+------------------------------------------------------------------------
+r252 | zimmerma | 1999-07-02 09:42:58 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/rnd_mode.c
+
+added def. of swapRM to avoid warning on IRIX64
+
+------------------------------------------------------------------------
+r251 | zimmerma | 1999-07-02 09:36:03 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+ M /trunk/round.c
+
+1UL -> ((mp_limb_t) 1)
+
+------------------------------------------------------------------------
+r250 | zimmerma | 1999-07-02 09:32:47 +0000 (Fri, 02 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+changed type of mask to mp_limb_t in mpfr_round_raw2
+
+------------------------------------------------------------------------
+r249 | zimmerma | 1999-07-02 09:26:13 +0000 (Fri, 02 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_d.c
+
+adapted for denormalized on IRIX64
+now test NaNs too
+
+------------------------------------------------------------------------
+r248 | hanrot | 1999-07-01 17:20:43 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+Due to the representation of 0 it might have happened that 0 != 0.
+
+------------------------------------------------------------------------
+r247 | hanrot | 1999-07-01 17:09:00 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+Patch mpfr_set -> MPN_COPY
+
+------------------------------------------------------------------------
+r246 | hanrot | 1999-07-01 17:08:12 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Patch when prec < 32.
+
+------------------------------------------------------------------------
+r245 | zimmerma | 1999-07-01 17:00:58 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+fixed bugs for 64-bit machines
+
+------------------------------------------------------------------------
+r244 | zimmerma | 1999-07-01 16:59:36 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+added casts to mp_limb_t
+
+------------------------------------------------------------------------
+r243 | zimmerma | 1999-07-01 16:54:40 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+added cast to mp_limb_t for shifts
+
+------------------------------------------------------------------------
+r242 | boldo | 1999-07-01 14:35:42 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+prints nothing is everything is allright
+
+------------------------------------------------------------------------
+r241 | boldo | 1999-07-01 14:20:32 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+memory gestion
+
+------------------------------------------------------------------------
+r240 | boldo | 1999-07-01 14:19:36 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+one single bug
+
+------------------------------------------------------------------------
+r239 | boldo | 1999-07-01 14:19:12 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+more bad cases
+
+------------------------------------------------------------------------
+r238 | zimmerma | 1999-07-01 14:08:04 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added some certified tests
+
+------------------------------------------------------------------------
+r237 | zimmerma | 1999-07-01 12:47:55 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added one test to check that 1*y = y
+
+------------------------------------------------------------------------
+r236 | hanrot | 1999-07-01 12:19:09 +0000 (Thu, 01 Jul 1999) | 3 lines
+Changed paths:
+ M /trunk/div.c
+
+Patch of an MLK due to multiple initialization of the same variables without
+freeing them inbetween.
+
+------------------------------------------------------------------------
+r235 | hanrot | 1999-07-01 12:09:49 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+Same as in sqrt (allocation problem).
+
+------------------------------------------------------------------------
+r234 | zimmerma | 1999-07-01 11:58:48 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+fixed bug due to shift=0 in mpn_rshift
+
+------------------------------------------------------------------------
+r233 | hanrot | 1999-07-01 10:43:19 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+(Temporary) patch for memory gestion in sqrt.c
+
+------------------------------------------------------------------------
+r232 | zimmerma | 1999-07-01 09:40:55 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+mpfr_init -> mpfr_init2
+
+------------------------------------------------------------------------
+r231 | zimmerma | 1999-07-01 09:39:56 +0000 (Thu, 01 Jul 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+initialize temporary variables with current precision
+
+------------------------------------------------------------------------
+r230 | hanrot | 1999-06-30 15:47:13 +0000 (Wed, 30 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/clear.c
+
+Unbelievably stupid bug fixed.
+
+------------------------------------------------------------------------
+r229 | hanrot | 1999-06-30 15:14:47 +0000 (Wed, 30 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/round.c
+
+Two patches : one for an UMR which actually had no effect, one for an FNH in
+old code..
+
+------------------------------------------------------------------------
+r228 | boldo | 1999-06-30 14:55:48 +0000 (Wed, 30 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+new bug
+
+------------------------------------------------------------------------
+r227 | boldo | 1999-06-30 13:30:46 +0000 (Wed, 30 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+there were some conflicts
+
+------------------------------------------------------------------------
+r226 | boldo | 1999-06-30 13:30:25 +0000 (Wed, 30 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+ther were some conflicts
+
+------------------------------------------------------------------------
+r225 | boldo | 1999-06-30 13:29:47 +0000 (Wed, 30 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/log.c
+
+memory gestion
+
+------------------------------------------------------------------------
+r224 | zimmerma | 1999-06-29 17:53:45 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tzeta.c
+
+replaced outputs by direct comparison when no argument
+
+------------------------------------------------------------------------
+r223 | zimmerma | 1999-06-29 17:46:38 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+modified to do only certified test when no argument
+
+------------------------------------------------------------------------
+r222 | zimmerma | 1999-06-29 17:27:34 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+modified to do only tests with precomputed values when no argument
+
+------------------------------------------------------------------------
+r221 | zimmerma | 1999-06-29 16:13:33 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+does exact rounding only for n=0
+
+------------------------------------------------------------------------
+r220 | remy | 1999-06-29 15:59:22 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added zeta/tzeta
+
+------------------------------------------------------------------------
+r219 | remy | 1999-06-29 15:58:51 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototypes for mpfr_exp and mpfr_zeta
+
+------------------------------------------------------------------------
+r218 | remy | 1999-06-29 15:58:05 +0000 (Tue, 29 Jun 1999) | 3 lines
+Changed paths:
+ A /trunk/zeta.c
+
+computes Riemann function Zeta(s)
+first version: only works for s=2 with PREC(result)=53 and rnd_mode=nearest
+
+------------------------------------------------------------------------
+r217 | remy | 1999-06-29 15:57:01 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tzeta.c
+
+test file for mpfr_zeta
+
+------------------------------------------------------------------------
+r216 | remy | 1999-06-29 15:49:15 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added prototype for mpfr_set_default_prec
+
+------------------------------------------------------------------------
+r215 | remy | 1999-06-29 15:40:28 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/zeta2.c
+
+file renamed zeta.c
+
+------------------------------------------------------------------------
+r214 | remy | 1999-06-29 15:26:33 +0000 (Tue, 29 Jun 1999) | 3 lines
+Changed paths:
+ A /trunk/zeta2.c
+
+first version: computes Zeta(2) with fixed precision 53 bits and round
+to nearest
+
+------------------------------------------------------------------------
+r213 | hanrot | 1999-06-29 14:48:29 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Patch in the case when the number of bits is a multiple of the word size.
+
+------------------------------------------------------------------------
+r212 | hanrot | 1999-06-29 14:47:58 +0000 (Tue, 29 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+Patch in the case when the low words of the product are zero.
+
+------------------------------------------------------------------------
+r211 | zimmerma | 1999-06-28 13:51:15 +0000 (Mon, 28 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+changed arguments of mpfr_round_raw (continued)
+
+------------------------------------------------------------------------
+r210 | zimmerma | 1999-06-28 13:48:44 +0000 (Mon, 28 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+ M /trunk/mpfr.texi
+ M /trunk/mul.c
+ M /trunk/mul_ui.c
+ M /trunk/random.c
+ M /trunk/round.c
+ M /trunk/set.c
+
+changed arguments of mpfr_round_raw (now uses precision instead of size)
+
+------------------------------------------------------------------------
+r209 | zimmerma | 1999-06-28 11:50:04 +0000 (Mon, 28 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tpi.c
+
+modified wrt warnings at compilation
+
+------------------------------------------------------------------------
+r208 | zimmerma | 1999-06-28 11:49:08 +0000 (Mon, 28 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+modified description of mpfr_get_str for n_digits=0
+
+------------------------------------------------------------------------
+r207 | zimmerma | 1999-06-28 11:48:15 +0000 (Mon, 28 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+now performs an exact output when n_digits=0
+
+------------------------------------------------------------------------
+r206 | hanrot | 1999-06-28 07:37:06 +0000 (Mon, 28 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+Yet another corrected prototype.
+
+------------------------------------------------------------------------
+r205 | hanrot | 1999-06-25 17:36:57 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/add_ulp.c
+ M /trunk/agm.c
+ M /trunk/cmp.c
+ M /trunk/cmp_ui.c
+ M /trunk/div.c
+ M /trunk/div_2exp.c
+ M /trunk/div_ui.c
+ M /trunk/exp.c
+ M /trunk/get_str.c
+ M /trunk/log.c
+ M /trunk/log2.c
+ M /trunk/mpfr.h
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/out_str.c
+ M /trunk/pi.c
+ M /trunk/pow.c
+ M /trunk/print_raw.c
+ M /trunk/print_rnd_mode.c
+ M /trunk/random.c
+ M /trunk/rnd_mode.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_d.c
+ M /trunk/set_f.c
+ M /trunk/set_si.c
+ M /trunk/set_str_raw.c
+ M /trunk/set_z.c
+ M /trunk/sqrt.c
+ M /trunk/sub.c
+
+Prototypes et quelques causes de warnings corriges.
+
+------------------------------------------------------------------------
+r204 | hanrot | 1999-06-25 17:20:06 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Modifs cosmetiques.
+
+------------------------------------------------------------------------
+r203 | hanrot | 1999-06-25 17:19:55 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/set_str.c
+
+Fichier vide.
+
+------------------------------------------------------------------------
+r202 | zimmerma | 1999-06-25 16:30:07 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog2.c
+
+do not print anything when no argument
+
+------------------------------------------------------------------------
+r201 | zimmerma | 1999-06-25 16:20:11 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/out_str.c
+
+use GMP allocate/free functions instead of malloc/free
+
+------------------------------------------------------------------------
+r200 | zimmerma | 1999-06-25 16:08:32 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcan_round.c
+
+do not print anything on stdout
+
+------------------------------------------------------------------------
+r199 | zimmerma | 1999-06-25 16:07:34 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+put correctly sign with macro CHANGE_SIGN
+
+------------------------------------------------------------------------
+r198 | hanrot | 1999-06-25 16:00:38 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Ajoute la dependance de libmpfr.a pour le Makefile des tests.
+
+------------------------------------------------------------------------
+r197 | zimmerma | 1999-06-25 15:54:04 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+correctly handle case sizer=1 in mpfr_set_d
+
+------------------------------------------------------------------------
+r196 | zimmerma | 1999-06-25 15:53:19 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+corrected allocated size in mpfr_round
+
+------------------------------------------------------------------------
+r195 | zimmerma | 1999-06-25 15:51:49 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+make clean does not remove config.in any more
+
+------------------------------------------------------------------------
+r194 | hanrot | 1999-06-25 15:16:10 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+Correction d'un UMR en inversant le while (sans incidence tres probablement).
+
+------------------------------------------------------------------------
+r193 | zimmerma | 1999-06-25 15:12:04 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added four tests
+
+------------------------------------------------------------------------
+r192 | zimmerma | 1999-06-25 15:07:31 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+adapted mpfr_set_d to case where allocated limbs > significant limbs
+
+------------------------------------------------------------------------
+r191 | zimmerma | 1999-06-25 15:05:10 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug for b=2^n and c very small
+
+------------------------------------------------------------------------
+r190 | hanrot | 1999-06-25 14:36:27 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Some limbs of the result where not set to zero as they should.
+
+------------------------------------------------------------------------
+r189 | zimmerma | 1999-06-25 13:32:39 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+added prototypes, and errors to stderr
+
+------------------------------------------------------------------------
+r188 | zimmerma | 1999-06-25 13:17:23 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/tests/tset_i
+
+binary file -> remove it
+
+------------------------------------------------------------------------
+r187 | zimmerma | 1999-06-25 13:16:04 +0000 (Fri, 25 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+use PREC(x) instead of ABSSIZE(x) to get number of significant limbs
+adapted to different numbers of significant limbs for x and y
+
+------------------------------------------------------------------------
+r186 | zimmerma | 1999-06-25 13:05:45 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+fixed pbs with ABSSIZE(x) wrt PREC(x) in mpfr_round
+
+------------------------------------------------------------------------
+r185 | zimmerma | 1999-06-25 13:01:20 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+added pointer to exponent, removed test with sprintf
+
+------------------------------------------------------------------------
+r184 | zimmerma | 1999-06-25 13:00:05 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+removed DEBUG stuff
+
+------------------------------------------------------------------------
+r183 | zimmerma | 1999-06-25 12:57:10 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+use PREC(x) instead of ABSSIZE(x) to get the number of significant limbs
+
+------------------------------------------------------------------------
+r182 | zimmerma | 1999-06-25 12:56:22 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_si.c
+
+do 10^6 tests if no argument
+
+------------------------------------------------------------------------
+r181 | hanrot | 1999-06-25 12:30:43 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+J'avais oublie -g...
+
+------------------------------------------------------------------------
+r180 | hanrot | 1999-06-25 12:23:51 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Ajoute des flags de paranoiaque schizophrene.
+
+------------------------------------------------------------------------
+r179 | zimmerma | 1999-06-25 11:43:25 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+now prints nothing with no argument
+
+------------------------------------------------------------------------
+r178 | zimmerma | 1999-06-25 11:22:28 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added texp and tdiv_ui
+
+------------------------------------------------------------------------
+r177 | zimmerma | 1999-06-25 11:21:30 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tdiv_ui.c
+
+test file for div_ui, initial revision
+
+------------------------------------------------------------------------
+r176 | zimmerma | 1999-06-25 10:19:42 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+commented out "avant arrondi..."
+
+------------------------------------------------------------------------
+r175 | zimmerma | 1999-06-25 10:17:40 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+clear res1/res2
+
+------------------------------------------------------------------------
+r174 | hanrot | 1999-06-25 10:17:26 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Patches an ABR.
+
+------------------------------------------------------------------------
+r173 | hanrot | 1999-06-25 10:15:54 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+Patch of an ABR.
+
+------------------------------------------------------------------------
+r172 | hanrot | 1999-06-25 10:15:21 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/pow.c
+
+Patch in the case n = 0.
+
+------------------------------------------------------------------------
+r171 | hanrot | 1999-06-25 10:14:45 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+Patch for a memory leak.
+
+------------------------------------------------------------------------
+r170 | zimmerma | 1999-06-25 10:13:14 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added two tests for exact roots
+
+------------------------------------------------------------------------
+r169 | zimmerma | 1999-06-25 10:12:11 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+removed DEBUG stuff and fixed pb with exact root and GMP_RNDZ
+
+------------------------------------------------------------------------
+r168 | hanrot | 1999-06-25 09:42:53 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+Correction d'un ABR.
+
+------------------------------------------------------------------------
+r167 | zimmerma | 1999-06-25 09:38:52 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tpi.c
+
+added test for prec=53 bits, removed output for argc==1
+
+------------------------------------------------------------------------
+r166 | hanrot | 1999-06-25 09:28:43 +0000 (Fri, 25 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tcan_round.c
+
+Initial revision.
+
+------------------------------------------------------------------------
+r165 | hanrot | 1999-06-24 12:22:57 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/sub.c
+
+Patched an Array Bound Read.
+
+------------------------------------------------------------------------
+r164 | hanrot | 1999-06-24 12:10:00 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Corrected an Array Bound Read when all the bits are significative.
+
+------------------------------------------------------------------------
+r163 | zimmerma | 1999-06-24 12:00:31 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp_ui.c
+
+i -> s in tests on mpfr_cmp_si
+
+------------------------------------------------------------------------
+r162 | zimmerma | 1999-06-24 11:59:05 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+
+fixed pb in mpfr_cmp_si_2exp (case b=0 or i=0)
+
+------------------------------------------------------------------------
+r161 | zimmerma | 1999-06-24 11:55:25 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+& -> &&
+
+------------------------------------------------------------------------
+r160 | zimmerma | 1999-06-24 11:40:48 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tcmp.c
+ M /trunk/tests/tset_str.c
+
+removed 3rd arg. of mpfr_set_prec
+
+------------------------------------------------------------------------
+r159 | zimmerma | 1999-06-24 11:37:54 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+treats case b=c in mpfr_sub(a,b,c)
+
+------------------------------------------------------------------------
+r158 | zimmerma | 1999-06-24 11:36:43 +0000 (Thu, 24 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+removed 3rd argument in mpfr_set_prec
+reallocates only when more limbs are needed
+
+------------------------------------------------------------------------
+r157 | zimmerma | 1999-06-24 11:34:22 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/exp.c
+ M /trunk/log2.c
+
+removed 3rd arg. of mpfr_set_prec
+
+------------------------------------------------------------------------
+r156 | zimmerma | 1999-06-24 11:32:11 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+added some mpfr_clear's that were missing
+
+------------------------------------------------------------------------
+r155 | zimmerma | 1999-06-24 10:16:54 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+removed 3rd argument from mpfr_set_prec
+
+------------------------------------------------------------------------
+r154 | zimmerma | 1999-06-24 10:12:43 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+ M /trunk/sqrt.c
+
+removed 3rd argument of mpfr_set_prec
+
+------------------------------------------------------------------------
+r153 | zimmerma | 1999-06-24 10:09:40 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed prototype of mpfr_set_prec (no rounding mode needed any more)
+
+------------------------------------------------------------------------
+r152 | zimmerma | 1999-06-24 07:57:30 +0000 (Thu, 24 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+added test for case of missing exponent
+and if one argument, print it as a double
+
+------------------------------------------------------------------------
+r151 | zimmerma | 1999-06-24 07:56:19 +0000 (Thu, 24 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+fixed bug when exponent was missing (wrong result when part before
+binary point is not zero)
+
+------------------------------------------------------------------------
+r150 | zimmerma | 1999-06-24 07:47:59 +0000 (Thu, 24 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added tests from JM Muller and V Lefevre
+
+------------------------------------------------------------------------
+r149 | zimmerma | 1999-06-23 16:37:03 +0000 (Wed, 23 Jun 1999) | 4 lines
+Changed paths:
+ M /trunk/round.c
+
+corrected bad case in mpfr_can_round_raw where rnd1=GMP_RNDN
+and err is a multiple of BITS_PER_MP_LIMB (was modifying an
+extra limb perhaps not allocated)
+
+------------------------------------------------------------------------
+r148 | boldo | 1999-06-23 16:02:24 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+qq bugs d'arrondis
+
+------------------------------------------------------------------------
+r147 | zimmerma | 1999-06-23 15:57:14 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added exp and div_ui
+
+------------------------------------------------------------------------
+r146 | zimmerma | 1999-06-23 15:56:35 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/texp.c
+
+added test of exp(Pi*sqrt(163)/3)-640320 [texp 0.0 prec]
+
+------------------------------------------------------------------------
+r145 | zimmerma | 1999-06-23 15:44:33 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/texp.c
+
+test file for mpfr_exp, initial revision
+
+------------------------------------------------------------------------
+r144 | zimmerma | 1999-06-23 13:02:11 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+added two tests
+
+------------------------------------------------------------------------
+r143 | zimmerma | 1999-06-23 12:57:56 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_str.c
+
+removed printf's and added one test for leading '+'
+
+------------------------------------------------------------------------
+r142 | zimmerma | 1999-06-23 12:56:26 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_str_raw.c
+
+now allows leading '+'
+
+------------------------------------------------------------------------
+r141 | boldo | 1999-06-23 11:34:03 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+nettoye
+
+------------------------------------------------------------------------
+r140 | zimmerma | 1999-06-23 10:00:37 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tset_f.c
+
+removed printf
+
+------------------------------------------------------------------------
+r139 | zimmerma | 1999-06-23 10:00:05 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+ M /trunk/tests/tmul_ui.c
+
+removed printf's
+
+------------------------------------------------------------------------
+r138 | zimmerma | 1999-06-23 09:59:31 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+added tests for large precision (tlog x prec rnd)
+
+------------------------------------------------------------------------
+r137 | zimmerma | 1999-06-23 09:58:29 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added test for exact division
+
+------------------------------------------------------------------------
+r136 | zimmerma | 1999-06-23 09:57:57 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tcmp2.c
+
+mpfr_cmp -> mpfr_cmp2
+
+------------------------------------------------------------------------
+r135 | zimmerma | 1999-06-23 09:57:23 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+removed printf, added exit on error
+
+------------------------------------------------------------------------
+r134 | zimmerma | 1999-06-23 09:55:43 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/exp.c
+
+initial revision
+
+------------------------------------------------------------------------
+r133 | zimmerma | 1999-06-23 09:50:41 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+cleaned local variables
+
+------------------------------------------------------------------------
+r132 | zimmerma | 1999-06-23 09:49:07 +0000 (Wed, 23 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed prototype of mpfr_div (now returns int)
+
+------------------------------------------------------------------------
+r131 | zimmerma | 1999-06-23 09:47:12 +0000 (Wed, 23 Jun 1999) | 4 lines
+Changed paths:
+ M /trunk/div.c
+
+now deals correctly with exact division
+removed DEBUG stuff
+returns 0/1 according to exact division
+
+------------------------------------------------------------------------
+r130 | zimmerma | 1999-06-22 17:12:20 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+fixed bug found by F. Rouillier: x * Z(2/x) -> 0 [carry from mpfr_round_raw]
+
+------------------------------------------------------------------------
+r129 | hanrot | 1999-06-22 13:33:35 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+Fill with 0 the part added in case of a larger reallocation.
+
+------------------------------------------------------------------------
+r128 | hanrot | 1999-06-22 12:39:01 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+Rajoute le bug report de Fabrice.
+
+------------------------------------------------------------------------
+r127 | zimmerma | 1999-06-22 12:18:25 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+fixed bug in mpfr_can_round when prec or err are multiples of BITS_PER_MP_LIMB
+
+------------------------------------------------------------------------
+r126 | zimmerma | 1999-06-22 12:16:28 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul.c
+
+added test to check sign of result
+
+------------------------------------------------------------------------
+r125 | zimmerma | 1999-06-22 12:14:44 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+fixed bug: wrong sign when SIGN(a)<0 at beginning
+
+------------------------------------------------------------------------
+r124 | boldo | 1999-06-22 09:51:16 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+avec plein de cas d'erreurs
+
+------------------------------------------------------------------------
+r123 | boldo | 1999-06-22 09:47:20 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/log.c
+
+marche bien
+
+------------------------------------------------------------------------
+r122 | boldo | 1999-06-22 09:47:04 +0000 (Tue, 22 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+Marche bien
+
+------------------------------------------------------------------------
+r121 | hanrot | 1999-06-21 16:00:30 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Corrected prototype of mpfr_can_round_raw.
+
+------------------------------------------------------------------------
+r120 | hanrot | 1999-06-21 16:00:11 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Various patches.
+
+------------------------------------------------------------------------
+r119 | hanrot | 1999-06-21 15:39:24 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Added prototype for mpfr_can_round_raw
+
+------------------------------------------------------------------------
+r118 | hanrot | 1999-06-21 15:34:57 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Added mpfr_can_round_raw ; mpfr_can_round just calls it.
+
+------------------------------------------------------------------------
+r117 | hanrot | 1999-06-21 15:26:56 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Declaration mpfr_print_rnd_mode.c
+
+------------------------------------------------------------------------
+r116 | hanrot | 1999-06-21 15:26:39 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/print_rnd_mode.c
+
+print_rnd_mode.c -> mpfr_print_rnd_mode.c
+
+------------------------------------------------------------------------
+r115 | hanrot | 1999-06-21 15:07:36 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/print_rnd_mode.c
+
+Print the rounding mode.
+
+------------------------------------------------------------------------
+r114 | hanrot | 1999-06-21 13:45:56 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_prec.c
+
+Changement de semantique (plus d'arrondi) et alloc + free -> realloc.
+
+------------------------------------------------------------------------
+r113 | zimmerma | 1999-06-21 11:28:36 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/div_ui.c
+
+initial revision
+
+------------------------------------------------------------------------
+r112 | zimmerma | 1999-06-21 11:27:29 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_ui.c
+
+added one test
+
+------------------------------------------------------------------------
+r111 | zimmerma | 1999-06-21 11:24:33 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set.c
+
+now deal with carry from mpfr_round_raw
+
+------------------------------------------------------------------------
+r110 | zimmerma | 1999-06-21 11:17:13 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+fixed problem with count_leading_zeros undefined for 0
+
+------------------------------------------------------------------------
+r109 | zimmerma | 1999-06-21 11:16:02 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+
+store computed value and try to reuse it for next calls
+
+------------------------------------------------------------------------
+r108 | zimmerma | 1999-06-21 11:14:46 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+added test cn>= in mpfr_cmp2
+
+------------------------------------------------------------------------
+r107 | zimmerma | 1999-06-21 11:12:33 +0000 (Mon, 21 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add_ulp.c
+
+added mpfr_sub_one_ulp
+
+------------------------------------------------------------------------
+r106 | boldo | 1999-06-18 11:53:03 +0000 (Fri, 18 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tagm.c
+
+tests par rapport aux doubles
+
+------------------------------------------------------------------------
+r105 | boldo | 1999-06-18 11:52:31 +0000 (Fri, 18 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tlog.c
+
+pour decouvrir les erreurs
+
+------------------------------------------------------------------------
+r104 | boldo | 1999-06-18 11:51:52 +0000 (Fri, 18 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/log.c
+
+version qui marche
+
+------------------------------------------------------------------------
+r103 | zimmerma | 1999-06-18 10:15:11 +0000 (Fri, 18 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul.c
+
+special cases NaN and 0
+
+------------------------------------------------------------------------
+r102 | zimmerma | 1999-06-18 09:56:15 +0000 (Fri, 18 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+fixed a few errors
+
+------------------------------------------------------------------------
+r101 | zimmerma | 1999-06-17 14:26:21 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+added tests for n=0 and d=0
+
+------------------------------------------------------------------------
+r100 | zimmerma | 1999-06-17 14:25:49 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added test for 0.0/1.0
+
+------------------------------------------------------------------------
+r99 | zimmerma | 1999-06-17 12:48:38 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+SET_NAN(q) -> SET_NAN(Q)
+
+------------------------------------------------------------------------
+r98 | zimmerma | 1999-06-17 12:48:05 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one exact root with rounding towards zero
+
+------------------------------------------------------------------------
+r97 | zimmerma | 1999-06-17 12:45:54 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tout_str.c
+
+added one test
+
+------------------------------------------------------------------------
+r96 | zimmerma | 1999-06-17 12:45:00 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added two tests
+
+------------------------------------------------------------------------
+r95 | zimmerma | 1999-06-17 12:36:52 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+patch to detect exact roots (otherwise problem with rounding to zero)
+
+------------------------------------------------------------------------
+r94 | zimmerma | 1999-06-17 10:14:11 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed way zero is represented : most sign. limb is zero
+
+------------------------------------------------------------------------
+r93 | zimmerma | 1999-06-17 09:56:49 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_si.c
+
+added special case for zero
+
+------------------------------------------------------------------------
+r92 | zimmerma | 1999-06-17 09:56:06 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+
+special case for zero
+
+------------------------------------------------------------------------
+r91 | zimmerma | 1999-06-17 09:55:24 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/out_str.c
+
+special cases for NaN and zero
+
+------------------------------------------------------------------------
+r90 | zimmerma | 1999-06-17 09:54:47 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+special case when one of the arguments is zero
+
+------------------------------------------------------------------------
+r89 | zimmerma | 1999-06-17 09:25:41 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added bug found by S. Boldo and fixed (pb in mpfr_round_raw2)
+
+------------------------------------------------------------------------
+r88 | zimmerma | 1999-06-17 09:24:51 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+fixed bug in mpfr_round_raw2 which was returning other values than 0 or 1
+
+------------------------------------------------------------------------
+r87 | hanrot | 1999-06-17 09:07:25 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+
+Corrected a potential problem in add(a, a, a);
+
+------------------------------------------------------------------------
+r86 | hanrot | 1999-06-17 09:06:26 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+Corrected a potential problem in sub(a, a, a);
+
+------------------------------------------------------------------------
+r85 | zimmerma | 1999-06-17 08:56:14 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+SET_NAN(x) -> SET_NAN(X)
+
+------------------------------------------------------------------------
+r84 | hanrot | 1999-06-17 08:49:43 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp.c
+
+Patch in cmp2 for some dirty cases (2^a + 2^b <-> 2^a + z, z << 2^a, b << a)
+
+------------------------------------------------------------------------
+r83 | zimmerma | 1999-06-17 08:23:06 +0000 (Thu, 17 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added test to check bug found by JL Remy
+
+------------------------------------------------------------------------
+r82 | zimmerma | 1999-06-17 08:22:11 +0000 (Thu, 17 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/sub.c
+
+added TMP_DECL/TMP_MARK/TMP_FREE in mpfr_sub1 to deal with case
+where destination=source
+
+------------------------------------------------------------------------
+r81 | hanrot | 1999-06-16 18:07:21 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+Bug dans set_d(0) ; la mantisse n'est pas initialisee a 0 correctement.
+
+------------------------------------------------------------------------
+r80 | hanrot | 1999-06-16 14:05:13 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/mul.c
+
+Gere differemment les problemes d'egalite entre destinations et arguments.
+
+------------------------------------------------------------------------
+r79 | hanrot | 1999-06-16 11:42:18 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Rajoute log.o et tlog
+
+------------------------------------------------------------------------
+r78 | hanrot | 1999-06-16 11:06:37 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/tests/mon_fichier
+
+Vire fichier inutile.
+
+------------------------------------------------------------------------
+r77 | zimmerma | 1999-06-16 10:56:24 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added new tests
+
+------------------------------------------------------------------------
+r76 | zimmerma | 1999-06-16 10:55:39 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+fixed bug for overlap=k*mp_bits_per_limb, k>=1
+
+------------------------------------------------------------------------
+r75 | hanrot | 1999-06-16 09:54:52 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/tests/Makefile
+
+Vire Makefile de CVS.
+
+------------------------------------------------------------------------
+r74 | hanrot | 1999-06-16 09:54:15 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/Makefile
+ D /trunk/Makefile.exp
+ D /trunk/Makefile.msb
+
+Vire les Makefile de CVS.
+
+------------------------------------------------------------------------
+r73 | zimmerma | 1999-06-16 09:48:59 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+added one test and random init.
+
+------------------------------------------------------------------------
+r72 | zimmerma | 1999-06-16 09:48:17 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tdiv.c
+
+added one test
+
+------------------------------------------------------------------------
+r71 | zimmerma | 1999-06-16 09:47:18 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tadd.c
+
+added tests for cases where destination = source
+
+------------------------------------------------------------------------
+r70 | zimmerma | 1999-06-16 09:46:10 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/sub.c
+
+cases NaN and destination=source
+
+------------------------------------------------------------------------
+r69 | zimmerma | 1999-06-16 09:45:22 +0000 (Wed, 16 Jun 1999) | 3 lines
+Changed paths:
+ M /trunk/sqrt.c
+
+now iterates if one cannot round after 1st try,
+and deals with case destination = source
+
+------------------------------------------------------------------------
+r68 | zimmerma | 1999-06-16 09:43:32 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+mpfr_can_round again and again
+
+------------------------------------------------------------------------
+r67 | zimmerma | 1999-06-16 09:42:45 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/print_raw.c
+
+added case of NaN
+
+------------------------------------------------------------------------
+r66 | zimmerma | 1999-06-16 09:41:54 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added macro SET_ZERO
+
+------------------------------------------------------------------------
+r65 | zimmerma | 1999-06-16 09:40:52 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/div.c
+
+now allows destination = source
+
+------------------------------------------------------------------------
+r64 | hanrot | 1999-06-16 08:05:44 +0000 (Wed, 16 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/tests/tget_str
+ D /trunk/tests/tmul
+ D /trunk/tests/tmul_2exp
+ D /trunk/tests/tmul_ui
+ D /trunk/tests/tround
+ D /trunk/tests/tset_d
+ D /trunk/tests/tset_f
+ D /trunk/tests/tset_str
+ D /trunk/tests/tsqrt
+
+Vire les tests de cvs.
+
+------------------------------------------------------------------------
+r63 | zimmerma | 1999-06-15 16:44:19 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/div.c
+
+printf -> fprintf
+
+------------------------------------------------------------------------
+r62 | zimmerma | 1999-06-15 16:32:41 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/add.c
+ M /trunk/div.c
+
+error message when destination equals source (case not yet treated)
+
+------------------------------------------------------------------------
+r61 | zimmerma | 1999-06-15 16:27:26 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+now uses the given rounding mode internally instead of always GMP_RNDZ
+
+------------------------------------------------------------------------
+r60 | zimmerma | 1999-06-15 16:26:06 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/pi.c
+
+now rounding to nearest should be correct
+
+------------------------------------------------------------------------
+r59 | hanrot | 1999-06-15 16:19:56 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Encore et toujours mpfr_can_round...
+
+------------------------------------------------------------------------
+r58 | hanrot | 1999-06-15 15:38:51 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ D /trunk/o.solaris
+ D /trunk/tests/tadd
+ D /trunk/tests/tagm
+ D /trunk/tests/tcmp
+ D /trunk/tests/tcmp2
+ D /trunk/tests/tcmp_ui
+ D /trunk/tests/tdiv
+
+Nettoyage.
+
+------------------------------------------------------------------------
+r57 | hanrot | 1999-06-15 14:43:14 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Patch pour mpfr_can_round.
+
+------------------------------------------------------------------------
+r56 | boldo | 1999-06-15 14:40:51 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+sans instructions de debuggage
+
+------------------------------------------------------------------------
+r55 | boldo | 1999-06-15 13:53:11 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Makefile
+
+rajout de log.o et tlog
+
+------------------------------------------------------------------------
+r54 | boldo | 1999-06-15 13:52:43 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile
+
+rajout de tlog
+
+------------------------------------------------------------------------
+r53 | boldo | 1999-06-15 13:41:24 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+ajout du log
+
+------------------------------------------------------------------------
+r52 | boldo | 1999-06-15 13:24:51 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tlog.c
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r51 | boldo | 1999-06-15 13:22:09 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/log.c
+
+premiere version du log
+
+------------------------------------------------------------------------
+r50 | zimmerma | 1999-06-15 13:11:10 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/div.c
+
+now recognizes division by exact power of 2
+
+------------------------------------------------------------------------
+r49 | zimmerma | 1999-06-15 13:10:21 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/cmp_ui.c
+
+added mpfr_cmp_[us]i_2exp
+
+------------------------------------------------------------------------
+r48 | zimmerma | 1999-06-15 12:53:07 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added mpfr_[us]i_2exp
+
+------------------------------------------------------------------------
+r47 | zimmerma | 1999-06-15 12:52:33 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added mpfr_cmp_[us]i_2exp
+
+------------------------------------------------------------------------
+r46 | hanrot | 1999-06-15 12:06:32 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/random.c
+
+Correction de bug (pas msb normalise).
+
+------------------------------------------------------------------------
+r45 | zimmerma | 1999-06-15 10:04:12 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/pi.c
+
+fixed mistake in error analysis (does not change code)
+
+------------------------------------------------------------------------
+r44 | hanrot | 1999-06-15 09:26:56 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+Ajout de random.o dans les objets.
+
+------------------------------------------------------------------------
+r43 | hanrot | 1999-06-15 09:26:26 +0000 (Tue, 15 Jun 1999) | 3 lines
+Changed paths:
+ A /trunk/random.c
+
+random.c : engendre un mpfr_t dans [0, 1[. GH, 15/06
+TODO : un random qui engendre un mpfr_t avec exposant gaussien centre.
+
+------------------------------------------------------------------------
+r42 | remy | 1999-06-15 09:17:44 +0000 (Tue, 15 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/log2.c
+ M /trunk/pi.c
+
+changed return value to void
+
+------------------------------------------------------------------------
+r41 | hanrot | 1999-06-14 16:35:25 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/round.c
+
+Ajoute les modes d'arrondi RNDN et RNDD.
+
+------------------------------------------------------------------------
+r40 | hanrot | 1999-06-14 13:14:43 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mul_ui.c
+
+Correction du prototype de mpfr_mul_ui
+
+------------------------------------------------------------------------
+r39 | hanrot | 1999-06-14 11:11:55 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+Correction du prototype de mpfr_mul_ui
+
+------------------------------------------------------------------------
+r38 | boldo | 1999-06-14 10:18:01 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r37 | zimmerma | 1999-06-14 07:51:59 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Configure
+
+added several files
+
+------------------------------------------------------------------------
+r36 | zimmerma | 1999-06-14 07:51:28 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added several prototypes
+
+------------------------------------------------------------------------
+r35 | zimmerma | 1999-06-14 07:50:36 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.texi
+
+added set_z, add_one_ulp
+
+------------------------------------------------------------------------
+r34 | zimmerma | 1999-06-14 07:49:06 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/set_d.c
+
+added mpfr_get_d2 which only considers the mantissa
+
+------------------------------------------------------------------------
+r33 | zimmerma | 1999-06-14 07:48:10 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+now uses mpfr_get_d2 (no side effect on arguments)
+
+------------------------------------------------------------------------
+r32 | zimmerma | 1999-06-14 07:46:10 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tlog2.c
+
+test file for mpfr_log2
+
+------------------------------------------------------------------------
+r31 | zimmerma | 1999-06-14 07:45:27 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tset_z.c
+
+test file for mpfr_set_z
+
+------------------------------------------------------------------------
+r30 | zimmerma | 1999-06-14 07:44:42 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tpi.c
+
+test file for mpfr_pi
+
+------------------------------------------------------------------------
+r29 | zimmerma | 1999-06-14 07:43:57 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/log2.c
+
+computes log(2)
+
+------------------------------------------------------------------------
+r28 | zimmerma | 1999-06-14 07:43:22 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/add_ulp.c
+
+add one ulp
+
+------------------------------------------------------------------------
+r27 | zimmerma | 1999-06-14 07:42:12 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/set_z.c
+
+set a mpfr from an integer
+
+------------------------------------------------------------------------
+r26 | zimmerma | 1999-06-14 07:41:33 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/pi.c
+
+computes Pi to n bits
+
+------------------------------------------------------------------------
+r25 | boldo | 1999-06-14 07:41:29 +0000 (Mon, 14 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r24 | zimmerma | 1999-06-11 08:08:35 +0000 (Fri, 11 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/mpfr.texi
+
+Initial revision of mpfr documentation
+
+------------------------------------------------------------------------
+r23 | hanrot | 1999-06-10 18:47:44 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tsqrt.c
+
+Patch d'un mpfr_set_d dans tsqrt.c ; GH, 100699
+
+------------------------------------------------------------------------
+r22 | hanrot | 1999-06-10 18:47:09 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tget_str.c
+
+Patch d'un mpfr_set_d dans get_str.c ; GH, 100699
+
+------------------------------------------------------------------------
+r21 | hanrot | 1999-06-10 18:46:03 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/Configure
+
+Tentative de configuration automatique, v. initiale. GH, 100699
+
+------------------------------------------------------------------------
+r20 | boldo | 1999-06-10 16:36:13 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/agm.c
+ M /trunk/tests/tagm.c
+
+*** empty log message ***
+
+------------------------------------------------------------------------
+r19 | zimmerma | 1999-06-10 09:20:04 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Makefile
+
+added tout_str
+
+------------------------------------------------------------------------
+r18 | zimmerma | 1999-06-10 09:19:38 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/tests/tout_str.c
+
+Initial revision.
+
+------------------------------------------------------------------------
+r17 | zimmerma | 1999-06-10 09:13:55 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/Makefile
+
+added out_str.c and pow.c
+
+------------------------------------------------------------------------
+r16 | zimmerma | 1999-06-10 09:13:26 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added proto for mpfr_pow_ui and mpfr_ui_pow_ui
+
+------------------------------------------------------------------------
+r15 | zimmerma | 1999-06-10 09:09:09 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/pow.c
+
+Initial revision.
+
+------------------------------------------------------------------------
+r14 | zimmerma | 1999-06-10 09:05:05 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/clear.c
+ M /trunk/div_2exp.c
+ M /trunk/mul.c
+ M /trunk/mul_2exp.c
+ M /trunk/mul_ui.c
+ M /trunk/neg.c
+ M /trunk/round.c
+ M /trunk/set.c
+ M /trunk/set_f.c
+ M /trunk/set_si.c
+
+added include <stdio.h> (needed for FILE in mpfr.h)
+
+------------------------------------------------------------------------
+r13 | zimmerma | 1999-06-10 08:59:38 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+added proto for mpfr_out_str
+
+------------------------------------------------------------------------
+r12 | zimmerma | 1999-06-10 08:58:23 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/out_str.c
+
+function to print a mpfr to a stream. Initial revision.
+
+------------------------------------------------------------------------
+r11 | zimmerma | 1999-06-10 08:56:27 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mpfr.h
+
+changed proto of mpfr_get_str: 2nd arg is mp_exp_t*, not char*
+
+------------------------------------------------------------------------
+r10 | zimmerma | 1999-06-10 08:53:22 +0000 (Thu, 10 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/get_str.c
+
+now conforms to the specification
+
+------------------------------------------------------------------------
+r9 | hanrot | 1999-06-09 18:37:25 +0000 (Wed, 09 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/Makefile
+
+tset_i -> tset_si dans le Makefile de tests.
+
+------------------------------------------------------------------------
+r8 | hanrot | 1999-06-09 18:36:50 +0000 (Wed, 09 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/mmpfr
+
+Version corrigee de mmpfr.
+
+------------------------------------------------------------------------
+r7 | hanrot | 1999-06-09 18:36:28 +0000 (Wed, 09 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/Makefile
+
+Makefile qui devrait fonctionner pour tous.
+
+------------------------------------------------------------------------
+r6 | hanrot | 1999-06-09 18:33:34 +0000 (Wed, 09 Jun 1999) | 2 lines
+Changed paths:
+ M /trunk/tests/tmul_2exp.c
+
+Correction de warnings dans tmul_2exp.c
+
+------------------------------------------------------------------------
+r2 | hanrot | 1999-06-09 18:03:33 +0000 (Wed, 09 Jun 1999) | 2 lines
+Changed paths:
+ A /trunk/.pure
+ A /trunk/BUGS
+ A /trunk/Makefile.exp
+ A /trunk/Makefile.msb
+ A /trunk/TODO
+ A /trunk/add.c
+ A /trunk/agm.c
+ A /trunk/clear.c
+ A /trunk/cmp.c
+ A /trunk/cmp_ui.c
+ A /trunk/div.c
+ A /trunk/div_2exp.c
+ A /trunk/from_Torbjorn
+ A /trunk/get_str.c
+ A /trunk/init.c
+ A /trunk/init_set.h
+ A /trunk/mmpfr
+ A /trunk/mpfr.h
+ A /trunk/mul.c
+ A /trunk/mul_2exp.c
+ A /trunk/mul_ui.c
+ A /trunk/neg.c
+ A /trunk/o.solaris
+ A /trunk/o.solaris/.pure
+ A /trunk/print_raw.c
+ A /trunk/rnd_mode.c
+ A /trunk/round.c
+ A /trunk/set.c
+ A /trunk/set_d.c
+ A /trunk/set_dfl_prec.c
+ A /trunk/set_dfl_rnd.c
+ A /trunk/set_f.c
+ A /trunk/set_prec.c
+ A /trunk/set_si.c
+ A /trunk/set_str.c
+ A /trunk/set_str_raw.c
+ A /trunk/sqrt.c
+ A /trunk/sub.c
+ A /trunk/tests
+ A /trunk/tests/Makefile
+ A /trunk/tests/mon_fichier
+ A /trunk/tests/tadd
+ A /trunk/tests/tadd.c
+ A /trunk/tests/tagm
+ A /trunk/tests/tagm.c
+ A /trunk/tests/tcmp
+ A /trunk/tests/tcmp.c
+ A /trunk/tests/tcmp2
+ A /trunk/tests/tcmp2.c
+ A /trunk/tests/tcmp_ui
+ A /trunk/tests/tcmp_ui.c
+ A /trunk/tests/tdiv
+ A /trunk/tests/tdiv.c
+ A /trunk/tests/tget_str
+ A /trunk/tests/tget_str.c
+ A /trunk/tests/tmul
+ A /trunk/tests/tmul.c
+ A /trunk/tests/tmul_2exp
+ A /trunk/tests/tmul_2exp.c
+ A /trunk/tests/tmul_ui
+ A /trunk/tests/tmul_ui.c
+ A /trunk/tests/tround
+ A /trunk/tests/tround.c
+ A /trunk/tests/tset_d
+ A /trunk/tests/tset_d.c
+ A /trunk/tests/tset_f
+ A /trunk/tests/tset_f.c
+ A /trunk/tests/tset_i
+ A /trunk/tests/tset_si.c
+ A /trunk/tests/tset_str
+ A /trunk/tests/tset_str.c
+ A /trunk/tests/tsqrt
+ A /trunk/tests/tsqrt.c
+
+Initial revision
+
+------------------------------------------------------------------------
+r1 | (no author) | 1999-06-09 18:03:33 +0000 (Wed, 09 Jun 1999) | 1 line
+Changed paths:
+ A /branches
+ A /tags
+ A /trunk
+
+New repository initialized by cvs2svn.
+------------------------------------------------------------------------
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..8806080
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,651 @@
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+
+ Installing GNU MPFR
+ ===================
+
+Note: In case of problem, please read this INSTALL file carefully before
+reporting a bug, in particular Section "In case of problem" below. Some
+problems are due to bad configuration on the user side (not specific to
+MPFR).
+
+0. You first need to install GMP. See <http://www.gnu.org/software/gmp/>.
+ MPFR requires GMP version 4.1 or later.
+
+1. Extract the files from the archive.
+
+2. It is strongly advised to apply the latest patches if this has
+ not been done yet and if patches are available. You can check
+ on the release page:
+
+ http://www.mpfr.org/mpfr-3.1.2/
+
+ which may have additional information. The patches can be applied
+ with commands like:
+
+ wget http://www.mpfr.org/mpfr-3.1.2/allpatches
+ patch -N -Z -p1 < allpatches
+
+ or
+
+ curl http://www.mpfr.org/mpfr-3.1.2/allpatches | patch -N -Z -p1
+
+ (Those instructions are for the GNU patch command, for example
+ /usr/bin/gpatch on Solaris.)
+
+3. In the MPFR directory, to detect your system, type:
+ ./configure
+ possibly with options (see below, in particular if this step or
+ one of the following fails). You should also check whether WARNING
+ lines have been output (such a problem may cause a failure in one
+ of the following steps).
+ Note: paths provided in configure options must always be absolute
+ (relative paths are not supported).
+
+4. To build the library, type:
+ make
+
+ [optional] if you want to tune MPFR for your specific architecture, see
+ the section "Tuning MPFR" below. Note that for most common architectures,
+ MPFR includes some default tuning parameters which should be near from
+ optimal.
+
+5. To check the built library (runs the test files), type:
+ make check
+
+6. To install it (default "/usr/local" | see "--prefix" option), type:
+ make install
+
+If you installed MPFR (header and library) in directories that are
+not searched by default by the compiler and/or linking tools, then,
+like with other libraries, you may need to set up some environment
+variables such as C_INCLUDE_PATH (to find the header mpfr.h),
+LIBRARY_PATH (to find the library), and if the shared library has
+been installed, LD_LIBRARY_PATH (before execution) or LD_RUN_PATH
+(before linking); this list is not exhaustive and some environment
+variables may be specific to your system. "make install" gives some
+instructions; please read them. You can also find more information
+in the manuals of your compiler and linker. The MPFR FAQ may also
+give some information.
+
+Remember that if you have several MPFR (or GMP) versions installed
+(e.g., one with the system, and one, newer, by you), you will not
+necessarily get a compilation/linking error if a wrong library is
+used (e.g., because LD_LIBRARY_PATH has not been set correctly).
+But unexpected results may occur.
+
+Under Mac OS X, if the shared library was not installed and you use
+Apple's linker (this is the default), you will also need to provide
+the -search_paths_first linker flag ("-Wl,-search_paths_first" when
+you link via gcc) to make sure that the right library is selected,
+as by default, Apple's linker selects a shared library preferably,
+even when it is farther in the library paths. We recall that if a
+wrong library is selected due to this behavior, unexpected results
+may occur.
+
+
+Building the documentation
+==========================
+
+To build the documentation in various formats, you may first need to
+install recent versions of some utilities such as texinfo.
+
+* Type "make info" to produce the documentation in the info format.
+
+* Type "make pdf" to produce the documentation in the PDF format.
+
+* Type "make dvi" to produce the documentation in the DVI format.
+
+* Type "make ps" to produce the documentation in the Postscript format.
+
+* Type "make html" to produce the documentation in the HTML format
+ (in several pages); if you want only one output HTML file, then
+ type "makeinfo --html --no-split mpfr.texi" from the doc directory
+ instead.
+
+
+Building MPFR with internal GMP header files
+============================================
+
+MPFR built with internal GMP header files is a bit faster, so you may want
+to build it with them. Just do this in step 1:
+
+ ./configure --with-gmp-build=GMPBUILD
+
+where GMPBUILD is the GMP build directory. The needed header files are:
+gmp-impl.h, longlong.h and all the necessary headers to use them, which
+may be located either in the GMP source directory or in the GMP build
+directory, in case they are different (MPFR takes care of that, as of
+MPFR 3.1.0).
+
+Warning: the library obtained in this way may use some internal GMP
+symbols, and thus dynamically linking your software with a different
+version of GMP might fail, even though it is declared as compatible
+by Libtool's versioning system.
+
+
+Tuning MPFR
+===========
+
+For this, you need to build MPFR with a GMP build directory (see above).
+In the GMP build directory, you also need to go into the "tune" subdirectory
+and type "make speed". This will build the GMP speed library, which is used
+by the MPFR tuning mechanism.
+
+Then go back to the MPFR build directory, go into the "tune" subdirectory and
+type "make tune". This will build an optimized file "mparam.h" for your
+specific architecture.
+
+
+./configure options
+===================
+
+--prefix=DIR installs MPFR headers and library in DIR/include and
+ DIR/lib respectively (the default is "/usr/local").
+
+--with-gmp-include=DIR assumes that DIR contains gmp.h
+--with-gmp-lib=DIR assumes that DIR contains the GMP library
+--with-gmp=DIR assumes that DIR is where you have installed GMP.
+ same as --with-gmp-lib=DIR/lib
+ and --with-gmp-include=DIR/include
+ (use either --with-gmp alone or one or both of
+ --with-gmp-lib/--with-gmp-include)
+ Warning! Do not use these options if you have
+ CPPFLAGS and/or LDFLAGS containing a -I or -L
+ option with a directory that contains a GMP
+ header or library file, as these options just
+ add -I and -L options to CPPFLAGS and LDFLAGS
+ *after* the ones that are currently declared,
+ so that DIR will have a lower precedence. Also,
+ this may not work if DIR is a system directory
+ (typically /usr or /usr/local); see below.
+
+--with-gmp-build=DIR assumes that DIR contains the GMP build directory,
+ and enables the use of GMP internals (see above).
+ Warning! This option and the group of options
+ --with-gmp are mutually exclusive.
+
+--enable-assert build MPFR with assertions.
+
+--enable-thread-safe build MPFR as thread safe, using compiler-level
+ Thread Local Storage (TLS). Note: TLS support is
+ roughly tested by configure. If configure detects
+ that TLS does not work (because of the compiler,
+ linker or system libraries), it will output an
+ error message, telling you to build MPFR without
+ thread safe. For instance, though Mac OS X uses
+ GCC, it may not currently support GCC's __thread
+ storage class.
+
+--disable-thread-safe build MPFR without TLS. By default, TLS support
+ is detected automatically, and MPFR is built as
+ thread safe if supported. However this detection
+ is only a heuristic: TLS can be detected as
+ supported while its support is incomplete or
+ buggy (MPFR tests may fail). In such a case,
+ this option is useful.
+
+--enable-gmp-internals allows the MPFR build to use GMP's undocumented
+ functions (not from the public API). Note that
+ library versioning is not guaranteed to work if
+ this option is used. Thus it must not be used in
+ binary distributions.
+
+Note: By default, the configure script tries to set CC/CFLAGS to GMP's
+ones (this feature needs GMP 4.3.0 or later, or the --with-gmp-build
+option). However this is not guaranteed to work as the configure script
+does some compiler tests earlier, and the change may be too late. Also,
+the values obtained from GMP may be incorrect if GMP has been built
+on a different machine. In such a case, the user may need to specify
+CC/CFLAGS as explained below.
+
+Run "./configure --help" to see the other options (autoconf default options).
+
+
+If 'gmp.h' and 'libgmp' do not match
+====================================
+
+Under some circumstances, the configure script may output a message
+saying:
+
+ 'gmp.h' and 'libgmp' seem to have different versions or
+ we cannot run a program linked with GMP (if you cannot
+ see the version numbers above). [...]
+
+Even though the configure script does not fail in such a case, this
+message most often indicates a real error, which needs to be avoided.
+Possible causes are:
+
+* The wanted GMP library does not have the same ABI as the one chosen
+ to build MPFR. The consequences may be:
+
+ - A different GMP library (with the correct ABI) has been found,
+ but does not have the same version as 'gmp.h'.
+
+ - No other GMP libraries have been found (in this case, no version
+ numbers should be printed above the warning message).
+
+ This is incorrect and one of the following steps (make, make check)
+ will probably fail. GMP (actually gmp.h) now provides CC and CFLAGS
+ information to select the correct ABI, so that this problem should
+ no longer occur; but if GMP was provided by a binary package, such
+ information may not be valid. See the
+
+ checking for CC and CFLAGS in gmp.h...
+
+ line in the configure output (about the 11th line) and the following
+ few ones for more information. You may need to reinstall GMP or to
+ provide your own CC and/or CFLAGS. See also the remaining of this
+ INSTALL file.
+
+* A configure option like --with-gmp or --with-gmp-include was used
+ with a system include directory, e.g. one of the following:
+
+ --with-gmp=/usr
+ --with-gmp=/usr/local
+ --with-gmp-include=/usr/include
+ --with-gmp-include=/usr/local/include
+
+ GCC (and possibly other compilers) will ignore such a directive for
+ include directories (but this rule is not applied for the library
+ itself!). This means that the library search paths will be reordered
+ as declared, but the specified include directory will still be near
+ the end of the include search paths (thus with a low precedence).
+ This is not a problem if only one GMP version is installed, but
+ otherwise, a wrong gmp.h may be chosen, so that the versions of
+ gmp.h and libgmp may not match. The suggestions are the following:
+
+ - If you want to use the GMP version under /usr, then you should
+ uninstall all the other GMP versions (header and library files)
+ that may be seen in the search paths, in particular those under
+ /usr/local.
+
+ - If you want to use the GMP version under /usr/local, then you
+ should uninstall all the other GMP versions (header and library
+ files) that may be seen in the search paths, but *NOT* the one
+ under /usr (the version under /usr is provided by the OS vendor,
+ and changing/removing anything related to it may break your
+ system, and /usr should have a lower precedence than /usr/local
+ anyway).
+
+ To find where GMP versions have been installed:
+
+ $ locate libgmp (if you have a locate database)
+
+ and if the compiler is GCC:
+
+ $ gcc -print-file-name=libgmp.so (under most systems)
+ $ gcc -print-file-name=libgmp.dylib (under Mac OS X)
+
+ and if this does not work, you may try:
+
+ $ gcc -print-search-dirs
+
+* An official GCC version was used under Debian GNU/Linux. Problems
+ may come from the fact that Debian chose a different convention
+ for library search paths concerning 32-bit and 64-bit libraries.
+ A possible problem can be, for instance:
+
+ [Debian's GCC, correct library path]
+ $ gcc -print-file-name=libgmp.so
+ /home/vlefevre/gmp/athlon64/lib/../lib/libgmp.so
+
+ [Official GCC, incorrect library path]
+ $ gcc-4.3.1 -print-file-name=libgmp.so
+ /usr/lib/../lib64/libgmp.so
+
+ The solution: use a GCC provided by Debian or add symbolic links
+ such as lib64 -> lib (on 64-bit machines) for your library paths.
+
+* The problem may also be temporary and only due to the fact that
+ libtool could not be used at this time. This is unlikely, though.
+
+
+In case of problem
+==================
+
+First, look for any warning message in the configure output.
+
+Several documents may help you to solve the problem:
+ * this INSTALL file, in particular information given below;
+ * the FAQ (either the FAQ.html file distributed with MPFR, or the
+ on-line version <http://www.mpfr.org/faq.html>, which may be more
+ up-to-date);
+ * the MPFR web page for this version <http://www.mpfr.org/mpfr-3.1.2/>,
+ which lists bugs found in this version and provides some patches.
+
+If the "configure" fails, please check that the C compiler and its
+options are the same as those for the GMP build (specially the ABI).
+You can see the latter with the following command:
+
+ grep "^CC\|^CFLAGS" GMPBUILD/Makefile
+
+if the GMP build directory is available. Then type:
+
+ ./configure <configure options> CC=<C compiler> CFLAGS="<compiler options>"
+
+(quotes are needed when there are spaces or other special characters
+in the CC/CFLAGS value) and continue the install. On some platforms,
+you should provide further options to match those used by GMP, or set
+some environment variables. For instance, see the "Notes on AIX/PowerPC"
+section below.
+
+Warning! Do NOT use optimization options that can change the semantics
+of math operations, such as GCC's -ffast-math or Sun CC's -fast.
+Otherwise conversions from/to double's may be incorrect on infinities,
+NaN's and signed zeros. Since native FP arithmetic is used in a few
+places only, such options would not make MPFR faster anyway.
+
+If some "make check" tests fail, you can try the --disable-thread-safe
+configure option (see the configure options above): it has been reported
+that some platforms have buggy TLS support. Before trying this option,
+you may want to check in the configure output whether MPFR was built
+with TLS support; if yes, you will have a line:
+ checking for TLS support... yes
+Alternatively "grep MPFR_USE_THREAD_SAFE config.log" will show that
+MPFR_USE_THREAD_SAFE is defined to 1. If it is "no" (or the variable
+is not defined), the --disable-thread-safe option would be useless.
+
+Some tests failure may be due to other compiler bugs, in particular
+in optimization code. You can try to build MPFR without compiler
+optimizations by giving -O0 (letter O, digit 0) in CFLAGS. If the
+MPFR tests no longer fail, this was probably due to a compiler bug,
+though we cannot exclude a bug in MPFR. You may want to contact us
+(see below), possibly after looking at:
+ http://www.loria.fr/~zimmerma/software/compilerbugs.html
+
+On some platforms, try with "gmake" (GNU make) instead of "make".
+Problems have been reported with the Tru64 make.
+
+If the configure script reports that gmp.h version and libgmp version
+are different, or if the build was OK, but the tests failed to link
+with GMP or gave an error like
+
+ undefined reference to `__gmp_get_memory_functions'
+
+meaning that the GMP library was not found or a wrong GMP library was
+selected by the linker, then your library search paths are probably
+not correctly set (some paths are missing or they are specified in an
+incorrect order).
+
+Such problems commonly occur under some GNU/Linux machines, where the
+default header and library search paths may be inconsistent: GCC is
+configured to search /usr/local/include and /usr/local/lib by default,
+while the dynamic linker ignores /usr/local/lib. If you have a GMP
+version installed in /usr (provided by the OS vendor) and a new one
+installed in /usr/local, then the header of the new GMP version and
+the library of the old GMP version will be used! The best solution
+is to make sure that the dynamic linker configuration is consistent
+with GCC's behavior, for instance by having /usr/local/lib in
+/etc/ld.so.conf or in some file from /etc/ld.so.conf.d (as Debian
+did: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395177). See
+also http://gcc.gnu.org/ml/gcc-help/2010-01/msg00171.html for more
+information. Alternatively you can use:
+ * environment variables. This may sometimes be necessary. If DIR
+ is the installation directory of GMP, add DIR/include to your
+ CPATH or C_INCLUDE_PATH (for compilers other than GCC, please
+ check the manual of your compiler), and add DIR/lib to your
+ LIBRARY_PATH and LD_LIBRARY_PATH (and/or LD_RUN_PATH);
+ * --with-gmp* configure options (described above), e.g.
+ --with-gmp=/opt/local (to use /opt/local/include for headers and
+ /opt/local/lib for libraries), but other software that uses GMP
+ and/or MPFR will need correct paths too, and environment variables
+ allow one to set such search paths in a global way.
+ Note about "--with-gmp=/usr/local". This option may appear to
+ solve the above inconsistency problem, but does not work as you
+ expect. Indeed it affects the library search path, in particular,
+ the one used by the dynamic linker (thus adding the missing
+ /usr/local/lib directory as wanted), but since /usr/local/include
+ is a "standard system include directory" for GCC, the include
+ search patch is not changed; this is often not a problem in this
+ particular case because usually, /usr/local/include is already
+ last in the include search patch, but this may fail under some
+ occasions and may trigger obscure errors.
+
+For instance, under Unix, where paths are separated by a colon:
+
+ * With POSIX sh-compatible shells (e.g. sh, ksh, bash, zsh):
+ export C_INCLUDE_PATH="/usr/local/include:/other/path/include"
+ export LIBRARY_PATH="/usr/local/lib:/other/path/lib"
+ export LD_LIBRARY_PATH="$LIBRARY_PATH"
+
+ * With csh or tcsh:
+ setenv C_INCLUDE_PATH "/usr/local/include:/other/path/include"
+ setenv LIBRARY_PATH "/usr/local/lib:/other/path/lib"
+ setenv LD_LIBRARY_PATH "$LIBRARY_PATH"
+
+If you can't solve your problem, you should contact us via the MPFR
+mailing-list <mpfr@inria.fr>, indicating the machine and operating system
+used (uname -a), the compiler and version used (gcc -v if you use gcc),
+the configure options used if any (including variables such as CC and
+CFLAGS), the version of GMP and MPFR used, and a description of the
+problem encountered. Please send us also the log of the "configure"
+(config.log).
+
+Note that even if you can build MPFR with a C++ compiler, you can't run
+the test suite: C and C++ are not the same language! You should use a C
+compiler instead.
+
+
+Notes about ABI
+===============
+
+On 64-bit computers, it may happen that the default ABI (Application Binary
+Interface) chosen by MPFR does not correspond to the default one chosen by
+the compiler.
+
+In particular, this kind of message may indicate the problem:
+/usr/bin/ld: skipping incompatible mpfr/src/.libs/libmpfr.a when searching for -lmpfr
+
+In fact, since MPFR relies on GMP, it uses the same ABI as GMP.
+To be sure that your program compiles and links correctly, use the same
+compiler flags as MPFR does (look for CFLAGS in config.log).
+
+You might also recompile GMP with a different ABI, with for example
+./configure ABI=32.
+
+
+Notes on Mac OS X
+=================
+
+If you get an error of the form
+
+ ld: pointer in read-only segment not allowed in slidable image...
+
+this can mean that the link is done against a static (GMP) library.
+In such a case, you should configure MPFR with --disable-shared to
+disable the build of the shared library.
+
+
+Notes on FreeBSD 4.3
+====================
+
+FreeBSD 4.3 is provided with an incorrect <float.h> header file, and
+MPFR tests related to long double's may fail. If you cannot upgrade
+the system, you can still use MPFR with FreeBSD 4.3, but you should
+not use conversions with the long double type.
+
+
+Notes on AIX/PowerPC
+====================
+
+The following has been tested on AIX 5.3 (powerpc-ibm-aix5.3.0.0) with
+gcc 3.3.2 and GMP 4.2.1.
+
+If GMP was built with the 64-bit ABI, before building and testing MPFR,
+you should set the OBJECT_MODE environment variable to 64, e.g., with:
+
+ export OBJECT_MODE=64
+
+(in a sh-compatible shell). But you should also provide a correct CFLAGS
+value to the "configure" script: using --with-gmp-build is not sufficient
+due to the early compiler tests, as gcc will not compile any program if
+OBJECT_MODE is 64 and the -maix64 option is not provided.
+
+
+MPFR for use with 32-bit Windows Applications (win32)
+=====================================================
+
+There are several ways of building MPFR on Windows, the most appropriate
+approach depending on how you intend to use the resulting libraries.
+
+a. Using MinGW
+==============
+
+1 - We advise to use MinGW (http://www.mingw.org/), which is simpler and
+ less demanding than Cygwin. Contrary to Cygwin, it also provides native
+ Windows code.
+
+2 - If you just want to make a binary with gcc, there is nothing to do:
+ GMP, MPFR and the program compile exactly as under Linux.
+ But if you want to generate a library for MinGW from a Cygwin
+ environment, you may need the -mno-cygwin gcc option (otherwise
+ a typical error is _P_WAIT being undeclared).
+
+3 - If you want to make libraries work under another Windows compiler
+ like Visual C / C++, since the unix-like *.a library files are compatible
+ with Windows *.lib files, you can simply rename all *.a libraries to *.lib.
+
+ With gmp-4.1.3, the only remaining problem seems to be the "alloca" calls
+ in GMP. Configuring GMP and MPFR with --enable-alloca=malloc-reentrant
+ should work (if you build MPFR with GMP internal files).
+
+ Or you could add the library
+ "$MINGWIN$/lib/gcc-lib/mingw32/$VERSION$/libgcc.a"
+ to your project: it contains all the extra-functions needed by a program
+ compiled by gcc (division of 64-bit integer, bcopy, alloca...).
+ Of course, include it if and only if your compiler is not gcc.
+
+4 - On Windows32 / MinGW, if all the tests fail, try to run the test suite
+ with "make check EXEEXT=".
+
+5 - To avoid using the Microsoft runtime (which might not be conform to ISO C),
+ you can use the MinGW runtime package (which is an integral part of MinGW).
+ For example, with MinGW versions 3.15 and later you can get an
+ ISO-compliant printf() if you compile your application with either
+ '-ansi', '-posix' or '-D__USE_MINGW_ANSI_STDIO'. For example, you can
+ compile and test MPFR with CC="gcc -D__USE_MINGW_ANSI_STDIO".
+
+ For example under Win32, the following problem has been experienced with
+ MPFR 2.4.0 RC1 and the MSVC runtime (msvcrt.dll):
+
+ Error in mpfr_vsprintf (s, "%.*Zi, %R*e, %Lf%n", ...);
+ expected: "00000010610209857723, -1.2345678875e+07, 0.032258"
+ got: "00000010610209857723, -1.2345678875e+07, -0.000000"
+ FAIL: tsprintf.exe
+
+ This error is due to the MSVC runtime not supporting the L length modifier
+ for formatted output (e.g. printf with %Lf). You can check this with the
+ following program:
+
+ #include <stdio.h>
+ int main (void)
+ {
+ long double d = 1. / 31.;
+ printf ("%Lf\n", d);
+ return 0;
+ }
+
+ The expected output is 0.032258.
+
+ Note: The L modifier has been standard for a long time (it was added
+ in ISO C89).
+
+ Note 2: this now works correctly with Visual C++ 2008 and 2010
+ (tested on Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
+ 15.00.21022.08 for 80x86, Microsoft (R) C/C++ Optimizing Compiler
+ Version 15.00.21022.08 for x64, Microsoft (R) 32-bit C/C++ Optimizing
+ Compiler Version 16.00.30319.01 for 80x86, Microsoft (R) C/C++ Optimizing
+ Compiler Version 16.00.30319.01 for x64).
+
+b. Using Cygwin
+===============
+
+This build should be similar to that for MinGW except that the resulting
+library depends on the Cygwin DLL and cannot therefore be used with
+Visual Studio as with MinGW. Indeed, the binaries compiled with Cygwin
+require a dynamic library (cygwin.dll) to work; there is a Cygwin option
+-mno-cygwin to build native code, but it may require some non-portable tricks.
+
+In case of failure, you may need to pass LDFLAGS='-shared-libgcc' at the
+end of the configure line due to a bug in GCC. Otherwise, if threading
+support is not needed, you can configure MPFR with --disable-thread-safe.
+
+c. Using Visual C++ 2008/2010
+=============================
+
+Win32 versions of the MPFR library can be built using Microsoft Visual
+C++ 2008 or 2010 using the build projects available here:
+
+http://gladman.plushost.co.uk/oldsite/computing/gmp4win.php
+
+These build projects contain both win32 and x64 builds but the latter
+will give errors if your version of Visual C++ lacks the 64-bit
+compiler and tools. The 32-bit build projects should however work
+on Visual C++ 2008, Visual C++ Express 2008 (SP1), Visual C++ 2010
+and Visual C++ Express 2010.
+
+MPFR for use with 64-bit Windows Applications (x64)
+===================================================
+
+There are two ways of building MPFR for use with 64-bit Windows
+applications.
+
+a. Using MinGW64
+================
+
+The MinGW64 version of the GCC compiler is now available here:
+
+http://sourceforge.net/projects/mingw-w64/
+
+It can build both GMP and MPFR for 64-bit Windows applications.
+
+b. Using Visual C++ 2008/2010
+=============================
+
+x64 versions of the MPFR library can be built using Microsoft Visual
+C++ 2008 or 2010 using the build projects available here:
+
+http://gladman.plushost.co.uk/oldsite/computing/gmp4win.php
+
+These build projects contain both win32 and x64 builds but the latter
+can only be built if your version of Visual C++ contains the 64-bit
+compiler and tools. On Visual C++ 2008, the 64-bit tools are an
+option during installation so if you don't have them you will need
+to start the Visual Studio installer and add them to your IDE
+configuration. On Visual C++ 2010 they are installed by default.
+
+As delivered, Visual C++ Express 2008 SP1 cannot build x64 projects
+but the Windows SDK can be added to it to allow this. The IDE then
+needs to be configured as described here:
+
+http://msdn.microsoft.com/en-us/library/9yb4317s(VS.80).aspx
+
+to allow x64 builds.
+
+Visual C++ Express 2010 requires the Windows 7 SDK to be installed
+in order to build x64 projects. This SDK is available here:
+
+http://tinyurl.com/25zz8r6
+
+In this case, once this SDK has been installed, Visual C++ Express 2010
+will build x64 projects without further changes.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..54e5c71
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,32 @@
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+
+AUTOMAKE_OPTIONS = gnu
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = doc src tests tune
+
+nobase_dist_doc_DATA = AUTHORS BUGS COPYING COPYING.LESSER NEWS TODO \
+ examples/ReadMe examples/divworst.c examples/rndo-add.c examples/sample.c \
+ examples/version.c
+
+EXTRA_DIST = PATCHES VERSION \
+ tools/ck-copyright-notice tools/ck-version-info tools/get_patches.sh \
+ $(DATAFILES)
+
+# Various checks for "make dist".
+# * Check consistency concerning -version-info. Moreover if the VERSION
+# file doesn't end with "-dev", check that the -version-info value is
+# up-to-date. Note: this is a heuristic, to detect some mistakes.
+# * Check that copyright notices exist and appear to be correct.
+dist-hook:
+ cd $(srcdir) && tools/ck-version-info
+ cd $(srcdir) && tools/ck-copyright-notice
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..508e029
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,844 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
+
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+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@
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(nobase_dist_doc_DATA) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/configure AUTHORS COPYING COPYING.LESSER \
+ ChangeLog INSTALL NEWS TODO compile config.guess config.sub \
+ depcomp install-sh ltmain.sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.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 = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+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__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(nobase_dist_doc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).tar.xz \
+ $(distdir).zip
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATAFILES = @DATAFILES@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+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@
+LIBMPFR_LDFLAGS = @LIBMPFR_LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MPFR_LDFLAGS = @MPFR_LDFLAGS@
+MPFR_LIBM = @MPFR_LIBM@
+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@
+TUNE_LIBS = @TUNE_LIBS@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+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@
+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@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = gnu
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = doc src tests tune
+nobase_dist_doc_DATA = AUTHORS BUGS COPYING COPYING.LESSER NEWS TODO \
+ examples/ReadMe examples/divworst.c examples/rndo-add.c examples/sample.c \
+ examples/version.c
+
+EXTRA_DIST = PATCHES VERSION \
+ tools/ck-copyright-notice tools/ck-version-info tools/get_patches.sh \
+ $(DATAFILES)
+
+all: all-recursive
+
+.SUFFIXES:
+am--refresh: Makefile
+ @:
+$(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) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu 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):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+install-nobase_dist_docDATA: $(nobase_dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(nobase_dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+ fi; \
+ $(am__nobase_list) | while read dir files; do \
+ xfiles=; for file in $$files; do \
+ if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+ test -z "$$xfiles" || { \
+ test "x$$dir" = x. || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)/$$dir'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)/$$dir"; }; \
+ echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(docdir)/$$dir'"; \
+ $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(docdir)/$$dir" || exit $$?; }; \
+ done
+
+uninstall-nobase_dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nobase_dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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; }; }'`; \
+ 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: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; }; }'`; \
+ 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
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+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)
+
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-nobase_dist_docDATA
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-nobase_dist_docDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-generic \
+ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+ dist-gzip dist-hook dist-lzip dist-lzma dist-shar dist-tarZ \
+ dist-xz dist-zip distcheck distclean distclean-generic \
+ distclean-libtool distclean-tags distcleancheck distdir \
+ distuninstallcheck 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-info install-info-am install-man \
+ install-nobase_dist_docDATA install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-nobase_dist_docDATA
+
+
+# Various checks for "make dist".
+# * Check consistency concerning -version-info. Moreover if the VERSION
+# file doesn't end with "-dev", check that the -version-info value is
+# up-to-date. Note: this is a heuristic, to detect some mistakes.
+# * Check that copyright notices exist and appear to be correct.
+dist-hook:
+ cd $(srcdir) && tools/ck-version-info
+ cd $(srcdir) && tools/ck-copyright-notice
+
+# 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:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..ce0faa3
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,314 @@
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+##############################################################################
+
+Changes from version 3.1.1 to version 3.1.2:
+- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.1/#fixed> or ChangeLog file).
+- Updated examples to the MPFR 3.x API.
+- Note: The official tarballs for MPFR up to 3.1.1 were affected by a
+ vulnerability for "make distcheck" due to a bug in old GNU Automake
+ versions: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3386
+
+Changes from version 3.1.0 to version 3.1.1:
+- Improved MPFR manual.
+- Test coverage: 96.5% lines of code.
+- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.0/#fixed> or ChangeLog file).
+
+Changes from versions 3.0.* to version 3.1.0:
+- The "canard à l'orange" release.
+- The MPFR source has been reorganized.
+- Dropped ansi2knr support.
+- TLS support is now detected automatically. If TLS is supported, MPFR is
+ built as thread safe by default. To disable TLS explicitly, configure
+ MPFR with --disable-thread-safe.
+- New --enable-gmp-internals configure option to use GMP's undocumented
+ functions (not from the public API). Note that library versioning is
+ not guaranteed to work if this option is used.
+- The mpfr_urandom and mpfr_urandomb functions now return identical values
+ on processors with different word size (assuming the same random seed, and
+ since the GMP random generator does not depend itself on the word size,
+ cf http://gmplib.org/list-archives/gmp-devel/2010-September/001642.html).
+- The mpfr_add_one_ulp and mpfr_sub_one_ulp macros (which are obsolete and
+ no more documented) will be removed in a future release.
+- Speed improvement for the mpfr_sqr and mpfr_div functions using Mulders'
+ algorithm. As a consequence, other functions using those routines are
+ also faster.
+- Much faster formatted output (mpfr_printf, etc.) with %Rg and similar.
+- The --with-gmp-build configure option can now be used when the GMP
+ source directory and the GMP build directory are different (without
+ having to copy header files manually as before).
+- New functions mpfr_buildopt_gmpinternals_p, mpfr_buildopt_tune_case,
+ mpfr_frexp, mpfr_grandom and mpfr_z_sub.
+- New divide-by-zero exception (flag) and associated functions.
+- The mpfr.h header can be included several times, while still supporting
+ optional functions (see Section "Headers and Libraries" in the manual).
+- Updated tuning parameters.
+- Improved MPFR manual.
+- MPFR tests: libtool no longer generates wrapper scripts with "make check"
+ (so that running the tests under valgrind or gdb is easier).
+- Internal change: the logging mechanism has been improved.
+- Test coverage: 95.2% lines of code.
+- Bug fixes, in particular a huge inefficiency in mpfr_exp (when the
+ target precision is less than MPFR_EXP_THRESHOLD) on hard-to-round
+ cases, which can take several minutes.
+ Note: The mpfr_subnormalize implementation up to MPFR 3.0.0 did not change
+ the flags. In particular, it did not follow the generic rule concerning
+ the inexact flag (and no special behavior was specified). The case of the
+ underflow flag was more a lack of specification.
+
+Changes from versions 2.4.* to version 3.0.0:
+- The "boudin aux pommes" release.
+- MPFR 3.0.0 is binary incompatible with previous versions but (almost)
+ API compatible. More precisely the obsolete functions mpfr_random
+ and mpfr_random2 have been removed, the meaning of the return type
+ of the function mpfr_get_f has changed, and the return type of the
+ function mpfr_get_z is now int instead of void. In practice, this
+ should not break any existing code.
+- MPFR is now distributed under the GNU Lesser General Public License
+ version 3 or later (LGPL v3+).
+- Rounding modes GMP_RNDx are now MPFR_RNDx (GMP_RNDx kept for
+ compatibility).
+- A new rounding mode (MPFR_RNDA) is available to round away from zero.
+- The rounding mode type is now mpfr_rnd_t (as in previous versions,
+ both mpfr_rnd_t and mp_rnd_t are accepted, but mp_rnd_t may be
+ removed in the future).
+- The precision type is now mpfr_prec_t (as in previous versions, both
+ mpfr_prec_t and mp_prec_t are accepted, but mp_prec_t may be removed
+ in the future) and it is now signed (it was unsigned in MPFR 2.*, but
+ this was not documented). In practice, this change should not affect
+ existing code that assumed nothing on the precision type.
+- MPFR now has its own exponent type mpfr_exp_t, which is currently
+ the same as GMP's mp_exp_t.
+- Functions mpfr_random and mpfr_random2 have been removed.
+- mpfr_get_f and mpfr_get_z now return a ternary value.
+- mpfr_strtofr now accepts bases from 37 to 62.
+- mpfr_custom_get_mantissa was renamed to mpfr_custom_get_significand
+ (mpfr_custom_get_mantissa is still available via a #define).
+- Functions mpfr_get_si, mpfr_get_ui, mpfr_get_sj, mpfr_get_uj,
+ mpfr_get_z and mpfr_get_z_2exp no longer have cases with undefined
+ behavior; in these cases, the behavior is now specified, and in
+ particular, the erange flag is set.
+- New functions mpfr_buildopt_tls_p and mpfr_buildopt_decimal_p giving
+ information about options used at MPFR build time.
+- New function mpfr_regular_p.
+- New function mpfr_set_zero.
+- New function mpfr_digamma.
+- New function mpfr_ai (incomplete, experimental).
+- New functions mpfr_set_flt and mpfr_get_flt to convert from/to the
+ float type.
+- New function mpfr_urandom.
+- New function mpfr_set_z_2exp (companion to mpfr_get_z_2exp, which
+ was renamed from mpfr_get_z_exp in previous versions).
+- New function mpfr_min_prec.
+- Speed improvement for large precisions in the trigonometric functions
+ (mpfr_sin, mpfr_cos, mpfr_tan, mpfr_sin_cos): speedup of about 2.5
+ for 10^5 digits, of about 5 for 10^6 digits.
+- Speed improvement for large precisions of the inverse trigonometric
+ functions (arcsin, arccos, arctan): about 2 for 10^3 digits, up to
+ 2.7 for 10^6 digits.
+- Some documentation files are installed in $docdir.
+- The detection of a GMP build directory (more precisely, the internal
+ header files of GMP) was previously done separately from the use of
+ the --with-gmp-build configure option. This was not consistent with
+ the documentation and with other parts of the configure script. So,
+ as of MPFR 3.0.0, the internal header files of GMP are now used if
+ and only if the --with-gmp-build configure option is given.
+- The configure script recognizes some extra "long double" formats
+ (double big endian, double little endian, double-double big endian).
+- MPFR manual: added "API Compatibility" section.
+- Test coverage: 97.1% lines of code.
+- Bug fixes.
+
+Changes from versions 2.3.* to version 2.4.0:
+- The "andouillette sauce moutarde" release.
+- MPFR is now a GNU package.
+- Changes in the behavior of mpfr_strtofr and in its documentation
+ concerning particular cases where the code and the documentation
+ did not match; this change is also present in MPFR 2.3.1.
+- Behavior of mpfr_check_range changed: if the value is an inexact
+ infinity, the overflow flag is set (in case it was lost); this
+ change is also present in MPFR 2.3.2.
+- Function mpfr_init_gmp_rand (only defined when building MPFR without
+ the --with-gmp-build configure option) is no longer defined at all.
+ This function was private and not documented, and was used only in
+ the MPFR test suite. User code that calls it is regarded as broken
+ and may fail as a consequence. Running the old test suite against
+ MPFR 2.4.0 may also fail.
+- New functions:
+ * between a MPFR number and a double: mpfr_add_d, mpfr_sub_d,
+ mpfr_d_sub, mpfr_mul_d, mpfr_div_d, mpfr_d_div,
+ * formatted input/output:
+ mpfr_printf, mpfr_fprintf, mpfr_vprintf, mpfr_vfprintf,
+ mpfr_sprintf, mpfr_snprintf, mpfr_vsprintf, mpfr_vsnprintf,
+ mpfr_asprintf, mpfr_vasprintf.
+ * mpfr_sinh_cosh, mpfr_li2, mpfr_modf, mpfr_fmod, mpfr_rec_sqrt.
+- Configure test for TLS support.
+- Get default $CC and $CFLAGS from gmp.h (__GMP_CC / __GMP_CFLAGS,
+ which are available as of GMP 4.2.3).
+- Documented the fact that mpfr_random and mpfr_random2 will be
+ suppressed in the next release, and that the specification of
+ mpfr_eq may change in the next release (for compatibility with
+ the mpf layer of GMP).
+- Test coverage: 96.7% lines of code.
+- Bug fixes.
+
+Changes from versions 2.2.* to version 2.3.0:
+- The mpfr.info file is now installed in the share subdirectory
+ (as required by the Filesystem Hierarchy Standard); see output
+ of "./configure --help".
+- The shared library is now enabled by default. If the MPFR build
+ fails on your platform, try the --disable-shared configure option
+ to disable the shared library.
+- Thread-safe support with Microsoft Visual compiler.
+- New functions mpfr_j0, mpfr_j1, mpfr_jn, mpfr_y0, mpfr_y1, mpfr_yn,
+ mpfr_lgamma, mpfr_remainder, mpfr_remquo, mpfr_fms, mpfr_signbit,
+ mpfr_setsign, mpfr_copysign, mpfr_get_patches.
+- Functions mpfr_sin, mpfr_cos and mpfr_sin_cos improved (argument
+ reduction).
+- More detailed MPFR manual.
+- Improved tests (make check).
+- Bug fixes.
+
+Changes from versions 2.1.* to version 2.2.0:
+- Bug fixes.
+- new functions mpfr_set_overflow, mpfr_set_underflow, mpfr_set_inexflag,
+ mpfr_set_erangeflag, mpfr_set_nanflag, mpfr_erfc, mpfr_atan2, mpfr_pow_z,
+ mpfr_subnormalize, mpfr_const_catalan, mpfr_sec, mpfr_csc, mpfr_cot,
+ mpfr_root, mpfr_eint, mpfr_get_f, mpfr_sech, mpfr_csch, mpfr_coth,
+ mpfr_lngamma.
+- new macro: MPFR_VERSION_STRING
+- Remove the exported MPFR variables from mpfr.h to mpfr-impl.h.
+ (They were undocumented, so programs which respect the API still work).
+- Grep CC and CFLAGS from GMP Makefile if possible.
+- Math functions are faster (both average and worst cases).
+- Better support for long double.
+- Shared library of MPFR.
+- Binary compatible with previous versions if you do not use undocumented
+ features.
+- Thread safe (if built with --enable-thread-safe).
+- Logging facility.
+- Change in the semantics of mpfr_out_str/mpfr_get_str when n_digits=0.
+- Better locale support.
+
+Changes from version 2.1.0 to version 2.1.1:
+- Better way to detect the GMP library.
+- Bug fixes.
+
+Changes from version 2.0.3 to version 2.1.0:
+- Bug fixes.
+- new functions mpfr_strtofr, mpfr_set_uj, mpfr_set_sj, mpfr_set_ui_2exp,
+ mpfr_set_si_2exp, mpfr_set_sj_2exp, mpfr_set_uj_2exp, mpfr_get_uj,
+ mpfr_get_sj, mpfr_get_z, mpfr_free_str, mpfr_si_sub, mpfr_sub_si,
+ mpfr_mul_si, mpfr_si_div, mpfr_div_si, mpfr_sqr, mpfr_cmp_z, mpfr_cmp_q,
+ mpfr_zero_p, mpfr_free_cache, mpfr_sum, mpfr_get_version,
+ mpfr_get_default_rounding_mode, mpfr_get_emin_min, mpfr_get_emin_max,
+ mpfr_get_emax_min, mpfr_get_emax_max, mpfr_inits, mpfr_inits2, mpfr_clears,
+ mpfr_fits_intmax_p, mpfr_fits_uintmax_p, mpfr_clear_erangeflag,
+ mpfr_erangeflag_p, mpfr_rint_round, mpfr_rint_trunc, mpfr_rint_ceil,
+ mpfr_rint_floor.
+- new macros MPFR_DECL_INIT, MPFR_VERSION, MPFR_VERSION_NUM,
+ MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL.
+- improved documentation.
+- improved configure.
+- improved portability (library and test suite).
+- It handles correctly non IEEE-754 double.
+- GMP internal files are not needed to install MPFR.
+- It is faster with low-precision floating point.
+- New global flag: ERANGE_FLAG.
+- Binary incompatible with previous versions, but API compatible.
+- mpfr_set_str doesn't allow anymore "@NAN@garbagechar" and "@INF@garbagechar",
+ allows base 0 (detection of the base), prefix (0x, 0b), leading whitespace.
+
+Changes from version 2.0.2 to version 2.0.3:
+- Bug fixes.
+- Support GMP as a shared library (not fully tested).
+
+Changes from version 2.0.1 to version 2.0.2:
+- many bug fixes and other improvements.
+- new functions mpfr_prec_round (replaces mpfr_round_prec), mpfr_get_exp,
+ mpfr_set_exp, mpfr_get_ld, mpfr_set_ld, mpfr_get_d_2exp, mpfr_get_si,
+ mpfr_get_ui, mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward, mpfr_frac,
+ mpfr_fits_*, mpfr_cmp_d, mpfr_cmpabs, mpfr_erf, mpfr_gamma, mpfr_zeta,
+ mpfr_greater_p, mpfr_greaterequal_p, mpfr_less_p, mpfr_lessequal_p,
+ mpfr_lessgreater_p, mpfr_equal_p, mpfr_unordered_p.
+- removed functions: mpfr_print_binary, mpfr_round_prec (replaced by
+ mpfr_prec_round), mpfr_set_str_raw, mpfr_set_machine_rnd_mode.
+- function mpfr_isinteger renamed mpfr_integer_p.
+- return type of some functions changed from void to int, for consistency.
+- return type of mpfr_set_prec changed from int to void.
+- new values for exponent range.
+- rename internal variables.
+
+Changes from version 2001 to version 2.0.1:
+- new mathematical functions: acos, acosh, asin, asinh, atan, atanh, cosh,
+ base-2 exponential and logarithm, base-10 logarithm, expm1, factorial,
+ pow, pow_si, pow_ui, sinh, tan, tanh, ui_pow, ui_pow_ui
+- other new functions: mpfr_const_euler, mpfr_dim, mpfr_fma, mpfr_hypot,
+ mpfr_min, mpfr_max, mpfr_rint, mpfr_set_inf, mpfr_set_nan
+- new operations with MPZ or MPQ: mpfr_{add,sub,mul,div}_[zq]
+- new predicates: mpfr_inf_p, mpfr_nan_p, mpfr_number_p, mpfr_isinteger,
+- add mechanism to set/check exponent range (overflow, underflow), partially
+ implemented in the mpfr functions.
+- efficiency: mpfr_div is now faster when the divisor has a few limbs
+- rounding: now mpfr_pow implements exact rounding, and most functions return a
+ ternary value indicating the position of the returned value wrt the exact one
+ (thus the return value is now 'int' instead of 'void')
+- complete rewrite of the configuration files
+- mpfr_get_d, mpfr_{add,sub}_one_ulp now get a rounding mode as 2nd argument
+- some function names did change: mpz_set_fr is now mpfr_get_z_exp,
+ mpfr_print_raw is now mpfr_print_binary.
+
+Changes from version 1.0 to version 2001:
+- the default installation does not provide any more access to machine
+ rounding mode, and as a consequence does not compare MPFR results with
+ precision=53 to machine results. Add option -DTEST if you want to have
+ access to machine rounding mode, and to check MPFR results against.
+- the MPFR files do not need <math.h> any more
+- the header file <mpfr.h> was split into <mpfr.h> for exported functions
+ and <mpfr-impl.h> for internal functions. The user should not use functions
+ or macros from <mpfr-impl.h>, since those may change in further releases.
+- <mpfr.h> was modified in order to make easy a C++ interface
+- MPFR now deals with infinities (+infinity and -infinity) and NaN
+- the missing function mpfr_swap is now available
+- mpfr_zeta was removed (was incomplete)
+- mpfr_init and mpfr_init2 now initialize the corresponding variable to 0
+ (like in other initialization functions from GNU MP)
+- in case memory allocation fails, an error message is output
+- several bugs of version 1.0 were fixed
+
+Changes from version 0.4 to version 1.0:
+
+- Version 1.0 now uses a standard configure/make installation.
+- Version 1.0 implements all functions that are available in the MPF class
+ from GMP 3.1 (except mpf_swap) and a header file mpf2mpfr.h is included in
+ the distribution for easy change from MPF to MPFR.
+- Version 1.0 implements new elementary functions: mpfr_sincos
+- Some functions and macros have been renamed: mpfr_log2 is now
+ mpfr_const_log2, mpfr_pi is now mpfr_const_pi, SIGN is now MPFR_SIGN.
+- Version 1.0 uses faster algorithms for mpfr_exp, mpfr_const_pi,
+ mpfr_const_log2. Compare the timings from version 1.0 and version 0.4.
+- Version 1.0 corrects some bugs of version 0.4.
+- The precision of MPFR variables is now named mpfr_prec, which makes it
+ easier to change it, to say unsigned long long. Same for the rounding mode
+ which is called mp_rnd_t.
+
+You'll find other news concerning the GNU MPFR library on the web
+page <http://www.mpfr.org/>.
diff --git a/PATCHES b/PATCHES
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/PATCHES
diff --git a/README b/README
new file mode 100644
index 0000000..6d10adb
--- /dev/null
+++ b/README
@@ -0,0 +1,84 @@
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+##############################################################################
+
+The GNU MPFR distribution contains the following files:
+(This does not apply to code retrieved by Subversion.)
+
+AUTHORS - the authors of the library
+BUGS - bugs in MPFR - please read this file!
+COPYING - the GNU General Public License, version 3
+COPYING.LESSER - the GNU Lesser General Public License, version 3
+ChangeLog - the log of changes
+INSTALL - how to install MPFR (see also mpfr.texi)
+Makefile* - files for building the library
+NEWS - new features with respect to previous versions
+PATCHES - empty file (until patches are applied)
+README - this file
+TODO - what remains to do (any help is welcome!)
+VERSION - version of MPFR (next release version if taken by Subversion)
+ac*.m4 - automatic configuration files
+compile - auxiliary installation file
+config.* - auxiliary installation files
+configure* - configuration files
+depcomp - auxiliary installation file
+doc/ - directory containing the documentation (manual, FAQ)
+examples/ - directory containing examples
+install-sh - installation file
+ltmain.sh - auxiliary installation file
+m4/ - directory containing additional configuration files
+missing - auxiliary installation file
+src/ - directory containing the MPFR source
+tests/ - directory containing the testsuite (for "make check")
+tools/ - directory containing various tools
+tune/ - directory containing files for tuning MPFR
+
+According to the special exception to the GNU General Public License,
+the autotools files compile, config.sub, config.guess, ltmain.sh,
+m4/libtool.m4 and missing are distributed under the same licence of
+GNU MPFR.
+
+
+You can get the latest source code by Subversion at INRIAGForge:
+
+ svn checkout svn://scm.gforge.inria.fr/svn/mpfr/trunk mpfr
+
+or
+
+ svn checkout https://scm.gforge.inria.fr/svn/mpfr/trunk mpfr
+
+(the last argument can be any directory name). You can use
+
+ svn ls svn://scm.gforge.inria.fr/svn/mpfr/branches
+ svn ls svn://scm.gforge.inria.fr/svn/mpfr/tags
+
+to get the list of branches or tags (releases), then checkout a
+particular branch or tag instead of the trunk. Alternatively, you
+can now use the "https:" scheme (a.k.a. DAV) instead of "svn:".
+For more information about Subversion, please see:
+
+ * http://svnbook.red-bean.com/ (the official Subversion book);
+ * http://gcc.gnu.org/wiki/SvnHelp (written for GCC developers,
+ but interesting general information can be found there);
+ * http://subversion.apache.org/faq.html (the Subversion FAQ).
+
+Subversion users should read the file "doc/README.dev" (provided via
+SVN only).
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..b707572
--- /dev/null
+++ b/TODO
@@ -0,0 +1,434 @@
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+Table of contents:
+1. Documentation
+2. Installation
+3. Changes in existing functions
+4. New functions to implement
+5. Efficiency
+6. Miscellaneous
+7. Portability
+
+##############################################################################
+1. Documentation
+##############################################################################
+
+- add a description of the algorithms used + proof of correctness
+
+##############################################################################
+2. Installation
+##############################################################################
+
+- if we want to distinguish GMP and MPIR, we can check at configure time
+ the following symbols which are only defined in MPIR:
+
+ #define __MPIR_VERSION 0
+ #define __MPIR_VERSION_MINOR 9
+ #define __MPIR_VERSION_PATCHLEVEL 0
+
+ There is also a library symbol mpir_version, which should match VERSION, set
+ by configure, for example 0.9.0.
+
+##############################################################################
+3. Changes in existing functions
+##############################################################################
+
+- export mpfr_overflow and mpfr_underflow as public functions
+
+- many functions currently taking into account the precision of the *input*
+ variable to set the initial working precison (acosh, asinh, cosh, ...).
+ This is nonsense since the "average" working precision should only depend
+ on the precision of the *output* variable (and maybe on the *value* of
+ the input in case of cancellation).
+ -> remove those dependencies from the input precision.
+
+- mpfr_can_round:
+ change the meaning of the 2nd argument (err). Currently the error is
+ at most 2^(MPFR_EXP(b)-err), i.e. err is the relative shift wrt the
+ most significant bit of the approximation. I propose that the error
+ is now at most 2^err ulps of the approximation, i.e.
+ 2^(MPFR_EXP(b)-MPFR_PREC(b)+err).
+
+- mpfr_set_q first tries to convert the numerator and the denominator
+ to mpfr_t. But this convertion may fail even if the correctly rounded
+ result is representable. New way to implement:
+ Function q = a/b. nq = PREC(q) na = PREC(a) nb = PREC(b)
+ If na < nb
+ a <- a*2^(nb-na)
+ n <- na-nb+ (HIGH(a,nb) >= b)
+ if (n >= nq)
+ bb <- b*2^(n-nq)
+ a = q*bb+r --> q has exactly n bits.
+ else
+ aa <- a*2^(nq-n)
+ aa = q*b+r --> q has exactly n bits.
+ If RNDN, takes nq+1 bits. (See also the new division function).
+
+
+##############################################################################
+4. New functions to implement
+##############################################################################
+
+- implement mpfr_q_sub, mpfr_z_div, mpfr_q_div?
+- implement functions for random distributions, see for example
+ https://sympa.inria.fr/sympa/arc/mpfr/2010-01/msg00034.html
+ (suggested by Charles Karney <ckarney@Sarnoff.com>, 18 Jan 2010):
+ * a Bernoulli distribution with prob p/q (exact)
+ * a general discrete distribution (i with prob w[i]/sum(w[i]) (Walker
+ algorithm, but make it exact)
+ * a uniform distribution in (a,b)
+ * exponential distribution (mean lambda) (von Neumann's method?)
+ * normal distribution (mean m, s.d. sigma) (ratio method?)
+- wanted for Magma [John Cannon <john@maths.usyd.edu.au>, Tue, 19 Apr 2005]:
+ HypergeometricU(a,b,s) = 1/gamma(a)*int(exp(-su)*u^(a-1)*(1+u)^(b-a-1),
+ u=0..infinity)
+ JacobiThetaNullK
+ PolylogP, PolylogD, PolylogDold: see http://arxiv.org/abs/math.CA/0702243
+ and the references herein.
+ JBessel(n, x) = BesselJ(n+1/2, x)
+ IncompleteGamma [also wanted by <keith.briggs@bt.com> 4 Feb 2008: Gamma(a,x),
+ gamma(a,x), P(a,x), Q(a,x); see A&S 6.5, ref. [Smith01] in algorithms.bib]
+ KBessel, KBessel2 [2nd kind]
+ JacobiTheta
+ LogIntegral
+ ExponentialIntegralE1
+ E1(z) = int(exp(-t)/t, t=z..infinity), |arg z| < Pi
+ mpfr_eint1: implement E1(x) for x > 0, and Ei(-x) for x < 0
+ E1(NaN) = NaN
+ E1(+Inf) = +0
+ E1(-Inf) = -Inf
+ E1(+0) = +Inf
+ E1(-0) = -Inf
+ DawsonIntegral
+ GammaD(x) = Gamma(x+1/2)
+- functions defined in the LIA-2 standard
+ + minimum and maximum (5.2.2): max, min, max_seq, min_seq, mmax_seq
+ and mmin_seq (mpfr_min and mpfr_max correspond to mmin and mmax);
+ + rounding_rest, floor_rest, ceiling_rest (5.2.4);
+ + remr (5.2.5): x - round(x/y) y;
+ + error functions from 5.2.7 (if useful in MPFR);
+ + power1pm1 (5.3.6.7): (1 + x)^y - 1;
+ + logbase (5.3.6.12): \log_x(y);
+ + logbase1p1p (5.3.6.13): \log_{1+x}(1+y);
+ + rad (5.3.9.1): x - round(x / (2 pi)) 2 pi = remr(x, 2 pi);
+ + axis_rad (5.3.9.1) if useful in MPFR;
+ + cycle (5.3.10.1): rad(2 pi x / u) u / (2 pi) = remr(x, u);
+ + axis_cycle (5.3.10.1) if useful in MPFR;
+ + sinu, cosu, tanu, cotu, secu, cscu, cossinu, arcsinu, arccosu,
+ arctanu, arccotu, arcsecu, arccscu (5.3.10.{2..14}):
+ sin(x 2 pi / u), etc.;
+ [from which sinpi(x) = sin(Pi*x), ... are trivial to implement, with u=2.]
+ + arcu (5.3.10.15): arctan2(y,x) u / (2 pi);
+ + rad_to_cycle, cycle_to_rad, cycle_to_cycle (5.3.11.{1..3}).
+- From GSL, missing special functions (if useful in MPFR):
+ (cf http://www.gnu.org/software/gsl/manual/gsl-ref.html#Special-Functions)
+ + The Airy functions Ai(x) and Bi(x) defined by the integral representations:
+ * Ai(x) = (1/\pi) \int_0^\infty \cos((1/3) t^3 + xt) dt
+ * Bi(x) = (1/\pi) \int_0^\infty (e^(-(1/3) t^3) + \sin((1/3) t^3 + xt)) dt
+ * Derivatives of Airy Functions
+ + The Bessel functions for n integer and n fractional:
+ * Regular Modified Cylindrical Bessel Functions I_n
+ * Irregular Modified Cylindrical Bessel Functions K_n
+ * Regular Spherical Bessel Functions j_n: j_0(x) = \sin(x)/x,
+ j_1(x)= (\sin(x)/x-\cos(x))/x & j_2(x)= ((3/x^2-1)\sin(x)-3\cos(x)/x)/x
+ Note: the "spherical" Bessel functions are solutions of
+ x^2 y'' + 2 x y' + [x^2 - n (n+1)] y = 0 and satisfy
+ j_n(x) = sqrt(Pi/(2x)) J_{n+1/2}(x). They should not be mixed with the
+ classical Bessel Functions, also noted j0, j1, jn, y0, y1, yn in C99
+ and mpfr.
+ Cf http://en.wikipedia.org/wiki/Bessel_function#Spherical_Bessel_functions
+ *Irregular Spherical Bessel Functions y_n: y_0(x) = -\cos(x)/x,
+ y_1(x)= -(\cos(x)/x+\sin(x))/x &
+ y_2(x)= (-3/x^3+1/x)\cos(x)-(3/x^2)\sin(x)
+ * Regular Modified Spherical Bessel Functions i_n:
+ i_l(x) = \sqrt{\pi/(2x)} I_{l+1/2}(x)
+ * Irregular Modified Spherical Bessel Functions:
+ k_l(x) = \sqrt{\pi/(2x)} K_{l+1/2}(x).
+ + Clausen Function:
+ Cl_2(x) = - \int_0^x dt \log(2 \sin(t/2))
+ Cl_2(\theta) = \Im Li_2(\exp(i \theta)) (dilogarithm).
+ + Dawson Function: \exp(-x^2) \int_0^x dt \exp(t^2).
+ + Debye Functions: D_n(x) = n/x^n \int_0^x dt (t^n/(e^t - 1))
+ + Elliptic Integrals:
+ * Definition of Legendre Forms:
+ F(\phi,k) = \int_0^\phi dt 1/\sqrt((1 - k^2 \sin^2(t)))
+ E(\phi,k) = \int_0^\phi dt \sqrt((1 - k^2 \sin^2(t)))
+ P(\phi,k,n) = \int_0^\phi dt 1/((1 + n \sin^2(t))\sqrt(1 - k^2 \sin^2(t)))
+ * Complete Legendre forms are denoted by
+ K(k) = F(\pi/2, k)
+ E(k) = E(\pi/2, k)
+ * Definition of Carlson Forms
+ RC(x,y) = 1/2 \int_0^\infty dt (t+x)^(-1/2) (t+y)^(-1)
+ RD(x,y,z) = 3/2 \int_0^\infty dt (t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-3/2)
+ RF(x,y,z) = 1/2 \int_0^\infty dt (t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2)
+ RJ(x,y,z,p) = 3/2 \int_0^\infty dt
+ (t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2) (t+p)^(-1)
+ + Elliptic Functions (Jacobi)
+ + N-relative exponential:
+ exprel_N(x) = N!/x^N (\exp(x) - \sum_{k=0}^{N-1} x^k/k!)
+ + exponential integral:
+ E_2(x) := \Re \int_1^\infty dt \exp(-xt)/t^2.
+ Ei_3(x) = \int_0^x dt \exp(-t^3) for x >= 0.
+ Ei(x) := - PV(\int_{-x}^\infty dt \exp(-t)/t)
+ + Hyperbolic/Trigonometric Integrals
+ Shi(x) = \int_0^x dt \sinh(t)/t
+ Chi(x) := Re[ \gamma_E + \log(x) + \int_0^x dt (\cosh[t]-1)/t]
+ Si(x) = \int_0^x dt \sin(t)/t
+ Ci(x) = -\int_x^\infty dt \cos(t)/t for x > 0
+ AtanInt(x) = \int_0^x dt \arctan(t)/t
+ [ \gamma_E is the Euler constant ]
+ + Fermi-Dirac Function:
+ F_j(x) := (1/r\Gamma(j+1)) \int_0^\infty dt (t^j / (\exp(t-x) + 1))
+ + Pochhammer symbol (a)_x := \Gamma(a + x)/\Gamma(a) : see [Smith01] in
+ algorithms.bib
+ logarithm of the Pochhammer symbol
+ + Gegenbauer Functions
+ + Laguerre Functions
+ + Eta Function: \eta(s) = (1-2^{1-s}) \zeta(s)
+ Hurwitz zeta function: \zeta(s,q) = \sum_0^\infty (k+q)^{-s}.
+ + Lambert W Functions, W(x) are defined to be solutions of the equation:
+ W(x) \exp(W(x)) = x.
+ This function has multiple branches for x < 0 (2 funcs W0(x) and Wm1(x))
+ + Trigamma Function psi'(x).
+ and Polygamma Function: psi^{(m)}(x) for m >= 0, x > 0.
+
+- from gnumeric (www.gnome.org/projects/gnumeric/doc/function-reference.html):
+ - beta
+ - betaln
+ - degrees
+ - radians
+ - sqrtpi
+
+- mpfr_inp_raw, mpfr_out_raw (cf mail "Serialization of mpfr_t" from Alexey
+ and answer from Granlund on mpfr list, May 2007)
+- [maybe useful for SAGE] implement companion frac_* functions to the rint_*
+ functions. For example mpfr_frac_floor(x) = x - floor(x). (The current
+ mpfr_frac function corresponds to mpfr_rint_trunc.)
+- scaled erfc (https://sympa.inria.fr/sympa/arc/mpfr/2009-05/msg00054.html)
+- asec, acsc, acot, asech, acsch and acoth (mail from Björn Terelius on mpfr
+ list, 18 June 2009)
+
+##############################################################################
+5. Efficiency
+##############################################################################
+
+- implement a mpfr_sqrthigh algorithm based on Mulders' algorithm, with a
+ basecase variant
+- use mpn_div_q to speed up mpfr_div. However mpn_div_q, which is new in
+ GMP 5, is not documented in the GMP manual, thus we are not sure it
+ guarantees to return the same quotient as mpn_tdiv_qr.
+ Also mpfr_div uses the remainder computed by mpn_divrem. A workaround would
+ be to first try with mpn_div_q, and if we cannot (easily) compute the
+ rounding, then use the current code with mpn_divrem.
+- compute exp by using the series for cosh or sinh, which has half the terms
+ (see Exercise 4.11 from Modern Computer Arithmetic, version 0.3)
+ The same method can be used for log, using the series for atanh, i.e.,
+ atanh(x) = 1/2*log((1+x)/(1-x)).
+- improve mpfr_gamma (see http://code.google.com/p/fastfunlib/). A possible
+ idea is to implement a fast algorithm for the argument reconstruction
+ gamma(x+k). One could also use the series for 1/gamma(x), see for example
+ http://dlmf.nist.gov/5/7/ or formula (36) from
+ http://mathworld.wolfram.com/GammaFunction.html
+- fix regression with mpfr_mpz_root (from Keith Briggs, 5 July 2006), for
+ example on 3Ghz P4 with gmp-4.2, x=12.345:
+ prec=50000 k=2 k=3 k=10 k=100
+ mpz_root 0.036 0.072 0.476 7.628
+ mpfr_mpz_root 0.004 0.004 0.036 12.20
+ See also mail from Carl Witty on mpfr list, 09 Oct 2007.
+- implement Mulders algorithm for squaring and division
+- for sparse input (say x=1 with 2 bits), mpfr_exp is not faster than for
+ full precision when precision <= MPFR_EXP_THRESHOLD. The reason is
+ that argument reduction kills sparsity. Maybe avoid argument reduction
+ for sparse input?
+- speed up const_euler for large precision [for x=1.1, prec=16610, it takes
+ 75% of the total time of eint(x)!]
+- speed up mpfr_atan for large arguments (to speed up mpc_log)
+ [from Mark Watkins on Fri, 18 Mar 2005]
+ Also mpfr_atan(x) seems slower (by a factor of 2) for x near from 1.
+ Example on a Athlon for 10^5 bits: x=1.1 takes 3s, whereas 2.1 takes 1.8s.
+ The current implementation does not give monotonous timing for the following:
+ mpfr_random (x); for (i = 0; i < k; i++) mpfr_atan (y, x, MPFR_RNDN);
+ for precision 300 and k=1000, we get 1070ms, and 500ms only for p=400!
+- improve mpfr_sin on values like ~pi (do not compute sin from cos, because
+ of the cancellation). For instance, reduce the input modulo pi/2 in
+ [-pi/4,pi/4], and define auxiliary functions for which the argument is
+ assumed to be already reduced (so that the sin function can avoid
+ unnecessary computations by calling the auxiliary cos function instead of
+ the full cos function). This will require a native code for sin, for
+ example using the reduction sin(3x)=3sin(x)-4sin(x)^3.
+ See https://sympa.inria.fr/sympa/arc/mpfr/2007-08/msg00001.html and
+ the following messages.
+- improve generic.c to work for number of terms <> 2^k
+- rewrite mpfr_greater_p... as native code.
+
+- mpf_t uses a scheme where the number of limbs actually present can
+ be less than the selected precision, thereby allowing low precision
+ values (for instance small integers) to be stored and manipulated in
+ an mpf_t efficiently.
+
+ Perhaps mpfr should get something similar, especially if looking to
+ replace mpf with mpfr, though it'd be a major change. Alternately
+ perhaps those mpfr routines like mpfr_mul where optimizations are
+ possible through stripping low zero bits or limbs could check for
+ that (this would be less efficient but easier).
+
+- try the idea of the paper "Reduced Cancellation in the Evaluation of Entire
+ Functions and Applications to the Error Function" by W. Gawronski, J. Mueller
+ and M. Reinhard, to be published in SIAM Journal on Numerical Analysis: to
+ avoid cancellation in say erfc(x) for x large, they compute the Taylor
+ expansion of erfc(x)*exp(x^2/2) instead (which has less cancellation),
+ and then divide by exp(x^2/2) (which is simpler to compute).
+
+- replace the *_THRESHOLD macros by global (TLS) variables that can be
+ changed at run time (via a function, like other variables)? One benefit
+ is that users could use a single MPFR binary on several machines (e.g.,
+ a library provided by binary packages or shared via NFS) with different
+ thresholds. On the default values, this would be a bit less efficient
+ than the current code, but this isn't probably noticeable (this should
+ be tested). Something like:
+ long *mpfr_tune_get(void) to get the current values (the first value
+ is the size of the array).
+ int mpfr_tune_set(long *array) to set the tune values.
+ int mpfr_tune_run(long level) to find the best values (the support
+ for this feature is optional, this can also be done with an
+ external function).
+
+- better distinguish different processors (for example Opteron and Core 2)
+ and use corresponding default tuning parameters (as in GMP). This could be
+ done in configure.ac to avoid hacking config.guess, for example define
+ MPFR_HAVE_CORE2.
+ Note (VL): the effect on cross-compilation (that can be a processor
+ with the same architecture, e.g. compilation on a Core 2 for an
+ Opteron) is not clear. The choice should be consistent with the
+ build target (e.g. -march or -mtune value with gcc).
+ Also choose better default values. For instance, the default value of
+ MPFR_MUL_THRESHOLD is 40, while the best values that have been found
+ are between 11 and 19 for 32 bits and between 4 and 10 for 64 bits!
+
+- during the Many Digits competition, we noticed that (our implantation of)
+ Mulders short product was slower than a full product for large sizes.
+ This should be precisely analyzed and fixed if needed.
+
+##############################################################################
+6. Miscellaneous
+##############################################################################
+
+- [suggested by Tobias Burnus <burnus(at)net-b.de> and
+ Asher Langton <langton(at)gcc.gnu.org>, Wed, 01 Aug 2007]
+ support quiet and signaling NaNs in mpfr:
+ * functions to set/test a quiet/signaling NaN: mpfr_set_snan, mpfr_snan_p,
+ mpfr_set_qnan, mpfr_qnan_p
+ * correctly convert to/from double (if encoding of s/qNaN is fixed in 754R)
+
+- check again coverage: on 2007-07-27, Patrick Pelissier reports that the
+ following files are not tested at 100%: add1.c, atan.c, atan2.c,
+ cache.c, cmp2.c, const_catalan.c, const_euler.c, const_log2.c, cos.c,
+ gen_inverse.h, div_ui.c, eint.c, exp3.c, exp_2.c, expm1.c, fma.c, fms.c,
+ lngamma.c, gamma.c, get_d.c, get_f.c, get_ld.c, get_str.c, get_z.c,
+ inp_str.c, jn.c, jyn_asympt.c, lngamma.c, mpfr-gmp.c, mul.c, mul_ui.c,
+ mulders.c, out_str.c, pow.c, print_raw.c, rint.c, root.c, round_near_x.c,
+ round_raw_generic.c, set_d.c, set_ld.c, set_q.c, set_uj.c, set_z.c, sin.c,
+ sin_cos.c, sinh.c, sqr.c, stack_interface.c, sub1.c, sub1sp.c, subnormal.c,
+ uceil_exp2.c, uceil_log2.c, ui_pow_ui.c, urandomb.c, yn.c, zeta.c, zeta_ui.c.
+
+- check the constants mpfr_set_emin (-16382-63) and mpfr_set_emax (16383) in
+ get_ld.c and the other constants, and provide a testcase for large and
+ small numbers.
+
+- from Kevin Ryde <user42@zip.com.au>:
+ Also for pi.c, a pre-calculated compiled-in pi to a few thousand
+ digits would be good value I think. After all, say 10000 bits using
+ 1250 bytes would still be small compared to the code size!
+ Store pi in round to zero mode (to recover other modes).
+
+- add a new rounding mode: round to nearest, with ties away from zero
+ (this is roundTiesToAway in 754-2008, could be used by mpfr_round)
+- add a new roundind mode: round to odd. If the result is not exactly
+ representable, then round to the odd mantissa. This rounding
+ has the nice property that for k > 1, if:
+ y = round(x, p+k, TO_ODD)
+ z = round(y, p, TO_NEAREST_EVEN), then
+ z = round(x, p, TO_NEAREST_EVEN)
+ so it avoids the double-rounding problem.
+
+- add tests of the ternary value for constants
+
+- When doing Extensive Check (--enable-assert=full), since all the
+ functions use a similar use of MACROS (ZivLoop, ROUND_P), it should
+ be possible to do such a scheme:
+ For the first call to ROUND_P when we can round.
+ Mark it as such and save the approximated rounding value in
+ a temporary variable.
+ Then after, if the mark is set, check if:
+ - we still can round.
+ - The rounded value is the same.
+ It should be a complement to tgeneric tests.
+
+- in div.c, try to find a case for which cy != 0 after the line
+ cy = mpn_sub_1 (sp + k, sp + k, qsize, cy);
+ (which should be added to the tests), e.g. by having {vp, k} = 0, or
+ prove that this cannot happen.
+
+- add a configure test for --enable-logging to ignore the option if
+ it cannot be supported. Modify the "configure --help" description
+ to say "on systems that support it".
+
+- add generic bad cases for functions that don't have an inverse
+ function that is implemented (use a single Newton iteration).
+
+- add bad cases for the internal error bound (by using a dichotomy
+ between a bad case for the correct rounding and some input value
+ with fewer Ziv iterations?).
+
+- add an option to use a 32-bit exponent type (int) on LP64 machines,
+ mainly for developers, in order to be able to test the case where the
+ extended exponent range is the same as the default exponent range, on
+ such platforms.
+ Tests can be done with the exp-int branch (added on 2010-12-17, and
+ many tests fail at this time).
+
+- test underflow/overflow detection of various functions (in particular
+ mpfr_exp) in reduced exponent ranges, including ranges that do not
+ contain 0.
+
+- add an internal macro that does the equivalent of the following?
+ MPFR_IS_ZERO(x) || MPFR_GET_EXP(x) <= value
+
+- check whether __gmpfr_emin and __gmpfr_emax could be replaced by
+ a constant (see README.dev). Also check the use of MPFR_EMIN_MIN
+ and MPFR_EMAX_MAX.
+
+
+##############################################################################
+7. Portability
+##############################################################################
+
+- add a web page with results of builds on different architectures
+
+- support the decimal64 function without requiring --with-gmp-build
+
+- [Kevin about texp.c long strings]
+ For strings longer than c99 guarantees, it might be cleaner to
+ introduce a "tests_strdupcat" or something to concatenate literal
+ strings into newly allocated memory. I thought I'd done that in a
+ couple of places already. Arrays of chars are not much fun.
+
+- use http://gcc.gnu.org/viewcvs/trunk/config/stdint.m4 for mpfr-gmp.h
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..ef538c2
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+3.1.2
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..d412273
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,918 @@
+dnl MPFR specific autoconf macros
+
+dnl Copyright 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+dnl Contributed by the AriC and Caramel projects, INRIA.
+dnl
+dnl This file is part of the GNU MPFR Library.
+dnl
+dnl The GNU MPFR Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
+dnl
+dnl The GNU MPFR Library is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+dnl http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+dnl 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+dnl autoconf 2.60 is necessary because of the use of AC_PROG_SED.
+dnl The following line allows the autoconf wrapper (when installed)
+dnl to work as expected.
+dnl If you change the required version, please update README.dev too!
+AC_PREREQ(2.60)
+
+dnl ------------------------------------------------------------
+dnl You must put in MPFR_CONFIGS everything which configure MPFR
+dnl except:
+dnl -everything dealing with CC and CFLAGS in particular the ABI
+dnl but the IEEE-754 specific flags must be set here.
+dnl -GMP's linkage.
+dnl -Libtool stuff.
+dnl -Handling of special arguments of MPFR's configure.
+AC_DEFUN([MPFR_CONFIGS],
+[
+AC_REQUIRE([AC_OBJEXT])
+AC_REQUIRE([MPFR_CHECK_LIBM])
+AC_REQUIRE([AC_HEADER_TIME])
+AC_REQUIRE([AC_CANONICAL_HOST])
+
+AC_CHECK_HEADER([limits.h],, AC_MSG_ERROR([limits.h not found]))
+AC_CHECK_HEADER([float.h],, AC_MSG_ERROR([float.h not found]))
+AC_CHECK_HEADER([string.h],, AC_MSG_ERROR([string.h not found]))
+
+dnl Check for locales
+AC_CHECK_HEADERS([locale.h])
+
+dnl Check for wide characters (wchar_t and wint_t)
+AC_CHECK_HEADERS([wchar.h])
+
+dnl Check for stdargs
+AC_CHECK_HEADER([stdarg.h],[AC_DEFINE([HAVE_STDARG],1,[Define if stdarg])],
+ [AC_CHECK_HEADER([varargs.h],,
+ AC_MSG_ERROR([stdarg.h or varargs.h not found]))])
+
+dnl sys/fpu.h - MIPS specific
+AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
+
+dnl Check how to get `alloca'
+AC_FUNC_ALLOCA
+
+dnl SIZE_MAX macro
+gl_SIZE_MAX
+
+dnl va_copy macro
+AC_MSG_CHECKING([how to copy va_list])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <stdarg.h>
+]], [[
+ va_list ap1, ap2;
+ va_copy(ap1, ap2);
+]])], [
+ AC_MSG_RESULT([va_copy])
+ AC_DEFINE(HAVE_VA_COPY)
+], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <stdarg.h>
+]], [[
+ va_list ap1, ap2;
+ __va_copy(ap1, ap2);
+]])], [AC_DEFINE([HAVE___VA_COPY]) AC_MSG_RESULT([__va_copy])],
+ [AC_MSG_RESULT([memcpy])])])
+
+dnl FIXME: The functions memmove, memset and strtol are really needed by
+dnl MPFR, but if they are implemented as macros, this is also OK (in our
+dnl case). So, we do not return an error, but their tests are currently
+dnl useless.
+dnl gettimeofday is not defined for MinGW
+AC_CHECK_FUNCS([memmove memset setlocale strtol gettimeofday])
+
+dnl Check for IEEE-754 switches on Alpha
+case $host in
+alpha*-*-*)
+ saved_CFLAGS="$CFLAGS"
+ AC_CACHE_CHECK([for IEEE-754 switches], mpfr_cv_ieee_switches, [
+ if test -n "$GCC"; then
+ mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact"
+ else
+ mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact"
+ fi
+ CFLAGS="$CFLAGS $mpfr_cv_ieee_switches"
+ AC_TRY_COMPILE(,,, mpfr_cv_ieee_switches="none")
+ ])
+ if test "$mpfr_cv_ieee_switches" = "none"; then
+ CFLAGS="$saved_CFLAGS"
+ else
+ CFLAGS="$saved_CFLAGS $mpfr_cv_ieee_switches"
+ fi
+esac
+
+dnl check for long long
+AC_CHECK_TYPE([long long int],
+ AC_DEFINE(HAVE_LONG_LONG, 1, [Define if compiler supports long long]),,)
+
+dnl intmax_t is C99
+AC_CHECK_TYPES([intmax_t])
+if test "$ac_cv_type_intmax_t" = yes; then
+ AC_CACHE_CHECK([for working INTMAX_MAX], mpfr_cv_have_intmax_max, [
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -I$srcdir/src"
+ AC_TRY_COMPILE([#include "mpfr-intmax.h"], [intmax_t x = INTMAX_MAX;],
+ mpfr_cv_have_intmax_max=yes, mpfr_cv_have_intmax_max=no)
+ CPPFLAGS="$saved_CPPFLAGS"
+ ])
+ if test "$mpfr_cv_have_intmax_max" = "yes"; then
+ AC_DEFINE(MPFR_HAVE_INTMAX_MAX,1,[Define if you have a working INTMAX_MAX.])
+ fi
+fi
+
+AC_CHECK_TYPE( [union fpc_csr],
+ AC_DEFINE(HAVE_FPC_CSR,1,[Define if union fpc_csr is available]), ,
+[
+#if HAVE_SYS_FPU_H
+# include <sys/fpu.h>
+#endif
+])
+
+dnl Check for fesetround
+AC_CACHE_CHECK([for fesetround], mpfr_cv_have_fesetround, [
+saved_LIBS="$LIBS"
+LIBS="$LIBS $MPFR_LIBM"
+AC_TRY_LINK([#include <fenv.h>], [fesetround(FE_TONEAREST);],
+ mpfr_cv_have_fesetround=yes, mpfr_cv_have_fesetround=no)
+LIBS="$saved_LIBS"
+])
+if test "$mpfr_cv_have_fesetround" = "yes"; then
+ AC_DEFINE(MPFR_HAVE_FESETROUND,1,[Define if you have the `fesetround' function via the <fenv.h> header file.])
+fi
+
+dnl Check for gcc float-conversion bug; if need be, -ffloat-store is used to
+dnl force the conversion to the destination type when a value is stored to
+dnl a variable (see ISO C99 standard 5.1.2.3#13, 6.3.1.5#2, 6.3.1.8#2). This
+dnl is important concerning the exponent range. Note that this doesn't solve
+dnl the double-rounding problem.
+if test -n "$GCC"; then
+ AC_CACHE_CHECK([for gcc float-conversion bug], mpfr_cv_gcc_floatconv_bug, [
+ saved_LIBS="$LIBS"
+ LIBS="$LIBS $MPFR_LIBM"
+ AC_TRY_RUN([
+#include <float.h>
+#ifdef MPFR_HAVE_FESETROUND
+#include <fenv.h>
+#endif
+static double get_max (void);
+int main() {
+ double x = 0.5;
+ double y;
+ int i;
+ for (i = 1; i <= 11; i++)
+ x *= x;
+ if (x != 0)
+ return 1;
+#ifdef MPFR_HAVE_FESETROUND
+ /* Useful test for the G4 PowerPC */
+ fesetround(FE_TOWARDZERO);
+ x = y = get_max ();
+ x *= 2.0;
+ if (x != y)
+ return 1;
+#endif
+ return 0;
+}
+static double get_max (void) { static volatile double d = DBL_MAX; return d; }
+ ], [mpfr_cv_gcc_floatconv_bug="no"],
+ [mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store"],
+ [mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store"])
+ LIBS="$saved_LIBS"
+ ])
+ if test "$mpfr_cv_gcc_floatconv_bug" != "no"; then
+ CFLAGS="$CFLAGS -ffloat-store"
+ fi
+fi
+
+dnl Check if denormalized numbers are supported
+AC_CACHE_CHECK([for denormalized numbers], mpfr_cv_have_denorms, [
+AC_TRY_RUN([
+#include <math.h>
+#include <stdio.h>
+int main() {
+ double x = 2.22507385850720138309e-308;
+ fprintf (stderr, "%e\n", x / 2.0);
+ return 2.0 * (x / 2.0) != x;
+}
+], mpfr_cv_have_denorms=yes, mpfr_cv_have_denorms=no, mpfr_cv_have_denorms=no)
+])
+if test "$mpfr_cv_have_denorms" = "yes"; then
+ AC_DEFINE(HAVE_DENORMS,1,[Define if denormalized floats work.])
+fi
+
+dnl Check the FP division by 0 fails (e.g. on a non-IEEE-754 platform).
+dnl In such a case, MPFR_ERRDIVZERO is defined to disable the tests
+dnl involving a FP division by 0.
+dnl For the developers: to check whether all these tests are disabled,
+dnl configure MPFR with "-DMPFR_TEST_DIVBYZERO=1 -DMPFR_ERRDIVZERO=1".
+AC_CACHE_CHECK([if the FP division by 0 fails], mpfr_cv_errdivzero, [
+AC_TRY_RUN([
+int main() {
+ volatile double d = 0.0, x;
+ x = 0.0 / d;
+ x = 1.0 / d;
+ return 0;
+}
+], [mpfr_cv_errdivzero="no"],
+ [mpfr_cv_errdivzero="yes"],
+ [mpfr_cv_errdivzero="cannot test, assume no"])
+])
+if test "$mpfr_cv_errdivzero" = "yes"; then
+ AC_DEFINE(MPFR_ERRDIVZERO,1,[Define if the FP division by 0 fails.])
+ AC_MSG_WARN([The floating-point division by 0 fails instead of])
+ AC_MSG_WARN([returning a special value: NaN or infinity. Tests])
+ AC_MSG_WARN([involving a FP division by 0 will be disabled.])
+fi
+
+dnl Check whether NAN != NAN (as required by the IEEE-754 standard,
+dnl but not by the ISO C standard). For instance, this is false with
+dnl MIPSpro 7.3.1.3m under IRIX64. By default, assume this is true.
+AC_CACHE_CHECK([if NAN == NAN], mpfr_cv_nanisnan, [
+AC_TRY_RUN([
+#include <stdio.h>
+#include <math.h>
+#ifndef NAN
+# define NAN (0.0/0.0)
+#endif
+int main() {
+ double d;
+ d = NAN;
+ return d != d;
+}
+], [mpfr_cv_nanisnan="yes"],
+ [mpfr_cv_nanisnan="no"],
+ [mpfr_cv_nanisnan="cannot test, assume no"])
+])
+if test "$mpfr_cv_nanisnan" = "yes"; then
+ AC_DEFINE(MPFR_NANISNAN,1,[Define if NAN == NAN.])
+ AC_MSG_WARN([The test NAN != NAN is false. The probable reason is that])
+ AC_MSG_WARN([your compiler optimizes floating-point expressions in an])
+ AC_MSG_WARN([unsafe way because some option, such as -ffast-math or])
+ AC_MSG_WARN([-fast (depending on the compiler), has been used. You])
+ AC_MSG_WARN([should NOT use such an option, otherwise MPFR functions])
+ AC_MSG_WARN([such as mpfr_get_d and mpfr_set_d may return incorrect])
+ AC_MSG_WARN([results on special FP numbers (e.g. NaN or signed zeros).])
+ AC_MSG_WARN([If you did not use such an option, please send us a bug])
+ AC_MSG_WARN([report so that we can try to find a workaround for your])
+ AC_MSG_WARN([platform and/or document the behavior.])
+fi
+
+dnl Check if the chars '0' to '9' are consecutive values
+AC_MSG_CHECKING([if charset has consecutive values])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+char *number = "0123456789";
+char *lower = "abcdefghijklmnopqrstuvwxyz";
+char *upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+]],[[
+ int i;
+ unsigned char *p;
+ for (p = (unsigned char*) number, i = 0; i < 9; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+ for (p = (unsigned char*) lower, i = 0; i < 25; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+ for (p = (unsigned char*) upper, i = 0; i < 25; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+]])], [AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_DEFINE(MPFR_NO_CONSECUTIVE_CHARSET,1,[Charset is not consecutive])
+], [AC_MSG_RESULT(cannot test)])
+
+dnl Must be checked with the LIBM
+dnl but we don't want to add the LIBM to MPFR dependency.
+dnl Can't use AC_CHECK_FUNCS since the function may be in LIBM but
+dnl not exported in math.h
+saved_LIBS="$LIBS"
+LIBS="$LIBS $MPFR_LIBM"
+dnl AC_CHECK_FUNCS([round trunc floor ceil nearbyint])
+AC_MSG_CHECKING(for math/round)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+]], [[
+ double a = 17.42;
+ a = f (round);
+ return 0;
+]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ROUND, 1,[Have ISO-C99 round function])
+],[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for math/trunc)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+]], [[
+ double a = 17.42;
+ a = f(trunc);
+ return 0;
+]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TRUNC, 1,[Have ISO-C99 trunc function])
+],[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for math/floor)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+]], [[
+ double a = 17.42;
+ a = f(floor);
+ return 0;
+]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FLOOR, 1,[Have ISO-C99 floor function])
+],[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for math/ceil)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+]], [[
+ double a = 17.42;
+ a = f(ceil);
+ return 0;
+]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_CEIL, 1,[Have ISO-C99 ceil function])
+],[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for math/rint)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+]], [[
+ double a = 17.42;
+ a = f(nearbyint);
+ return 0;
+]])], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NEARBYINT, 1,[Have ISO-C99 rint function])
+],[AC_MSG_RESULT(no)])
+
+LIBS="$saved_LIBS"
+
+dnl Now try to check the long double format
+MPFR_C_LONG_DOUBLE_FORMAT
+
+if test "$enable_logging" = yes; then
+ if test "$enable_thread_safe" = yes; then
+ AC_MSG_ERROR([Enable either `Logging' or `thread-safe', not both])
+ else
+ enable_thread_safe=no
+ fi
+fi
+
+dnl Check if thread-local variables are supported.
+dnl At least two problems can occur in practice:
+dnl 1. The compilation fails, e.g. because the compiler doesn't know
+dnl about the __thread keyword.
+dnl 2. The compilation succeeds, but the system doesn't support TLS or
+dnl there is some ld configuration problem. One of the effects can
+dnl be that thread-local variables always evaluate to 0. So, it is
+dnl important to run the test below.
+if test "$enable_thread_safe" != no; then
+AC_MSG_CHECKING(for TLS support)
+saved_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I$srcdir/src"
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#define MPFR_USE_THREAD_SAFE 1
+#include "mpfr-thread.h"
+MPFR_THREAD_ATTR int x = 17;
+int main() {
+ return x != 17;
+}
+ ]])],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE([MPFR_USE_THREAD_SAFE],1,[Build MPFR as thread safe])
+ ],
+ [AC_MSG_RESULT(no)
+ if test "$enable_thread_safe" = yes; then
+ AC_MSG_ERROR([please configure with --disable-thread-safe])
+ fi
+ ],
+ [if test "$enable_thread_safe" = yes; then
+ AC_MSG_RESULT([cannot test, assume yes])
+ AC_DEFINE([MPFR_USE_THREAD_SAFE],1,[Build MPFR as thread safe])
+ else
+ AC_MSG_RESULT([cannot test, assume no])
+ fi
+ ])
+CPPFLAGS="$saved_CPPFLAGS"
+fi
+])
+dnl end of MPFR_CONFIGS
+
+
+dnl MPFR_C_LONG_DOUBLE_FORMAT
+dnl -------------------------
+dnl Determine the format of a long double.
+dnl
+dnl The object file is grepped, so as to work when cross compiling. A
+dnl start and end sequence is included to avoid false matches, and
+dnl allowance is made for the desired data crossing an "od -b" line
+dnl boundary. The test number is a small integer so it should appear
+dnl exactly, no rounding or truncation etc.
+dnl
+dnl "od -b" is supported even by Unix V7, and the awk script used doesn't
+dnl have functions or anything, so even an "old" awk should suffice.
+dnl
+dnl The 10-byte IEEE extended format is generally padded to either 12 or 16
+dnl bytes for alignment purposes. The SVR4 i386 ABI is 12 bytes, or i386
+dnl gcc -m128bit-long-double selects 16 bytes. IA-64 is 16 bytes in LP64
+dnl mode, or 12 bytes in ILP32 mode. The first 10 bytes is the relevant
+dnl part in all cases (big and little endian).
+dnl
+dnl Enhancements:
+dnl
+dnl Could match more formats, but no need to worry until there's code
+dnl wanting to use them.
+dnl
+dnl Don't want to duplicate the double matching from GMP_C_DOUBLE_FORMAT,
+dnl perhaps we should merge with that macro, to match data formats
+dnl irrespective of the C type in question. Or perhaps just let the code
+dnl use DOUBLE macros when sizeof(double)==sizeof(long double).
+
+AC_DEFUN([MPFR_C_LONG_DOUBLE_FORMAT],
+[AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_AWK])
+AC_REQUIRE([AC_OBJEXT])
+AC_CHECK_TYPES([long double])
+AC_CACHE_CHECK([format of `long double' floating point],
+ mpfr_cv_c_long_double_format,
+[mpfr_cv_c_long_double_format=unknown
+if test "$ac_cv_type_long_double" != yes; then
+ mpfr_cv_c_long_double_format="not available"
+else
+ cat >conftest.c <<\EOF
+[
+/* "before" is 16 bytes to ensure there's no padding between it and "x".
+ We're not expecting any "long double" bigger than 16 bytes or with
+ alignment requirements stricter than 16 bytes. */
+struct {
+ char before[16];
+ long double x;
+ char after[8];
+} foo = {
+ { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
+ -123456789.0,
+ { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
+};
+]
+EOF
+ mpfr_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&AC_FD_CC 2>&1"
+ if AC_TRY_EVAL(mpfr_compile); then
+ cat >conftest.awk <<\EOF
+[
+BEGIN {
+ found = 0
+}
+
+# got[] holds a sliding window of bytes read the input. got[0] is the most
+# recent byte read, and got[31] the oldest byte read, so when looking to
+# match some data the indices are "reversed".
+#
+{
+ for (f = 2; f <= NF; f++)
+ {
+ # new byte, shift others up
+ for (i = 31; i >= 0; i--)
+ got[i+1] = got[i];
+ got[0] = $f;
+
+ # end sequence
+ if (got[7] != "376") continue
+ if (got[6] != "334") continue
+ if (got[5] != "272") continue
+ if (got[4] != "230") continue
+ if (got[3] != "166") continue
+ if (got[2] != "124") continue
+ if (got[1] != "062") continue
+ if (got[0] != "020") continue
+
+ # start sequence, with 8-byte body
+ if (got[23] == "001" && \
+ got[22] == "043" && \
+ got[21] == "105" && \
+ got[20] == "147" && \
+ got[19] == "211" && \
+ got[18] == "253" && \
+ got[17] == "315" && \
+ got[16] == "357")
+ {
+ saw = " (" got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[15] == "301" && \
+ got[14] == "235" && \
+ got[13] == "157" && \
+ got[12] == "064" && \
+ got[11] == "124" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ print "IEEE double, big endian"
+ found = 1
+ exit
+ }
+
+ if (got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "124" && \
+ got[11] == "064" && \
+ got[10] == "157" && \
+ got[9] == "235" && \
+ got[8] == "301")
+ {
+ print "IEEE double, little endian"
+ found = 1
+ exit
+ }
+ }
+
+ # start sequence, with 12-byte body
+ if (got[27] == "001" && \
+ got[26] == "043" && \
+ got[25] == "105" && \
+ got[24] == "147" && \
+ got[23] == "211" && \
+ got[22] == "253" && \
+ got[21] == "315" && \
+ got[20] == "357")
+ {
+ saw = " (" got[19] \
+ " " got[18] \
+ " " got[17] \
+ " " got[16] \
+ " " got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[19] == "000" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "240" && \
+ got[14] == "242" && \
+ got[13] == "171" && \
+ got[12] == "353" && \
+ got[11] == "031" && \
+ got[10] == "300")
+ {
+ print "IEEE extended, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[19] == "300" && \
+ got[18] == "031" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "353" && \
+ got[14] == "171" && \
+ got[13] == "242" && \
+ got[12] == "240" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[09] == "000" && \
+ got[08] == "000")
+ {
+ # format found on m68k
+ print "IEEE extended, big endian"
+ found = 1
+ exit
+ }
+ }
+
+ # start sequence, with 16-byte body
+ if (got[31] == "001" && \
+ got[30] == "043" && \
+ got[29] == "105" && \
+ got[28] == "147" && \
+ got[27] == "211" && \
+ got[26] == "253" && \
+ got[25] == "315" && \
+ got[24] == "357")
+ {
+ saw = " (" got[23] \
+ " " got[22] \
+ " " got[21] \
+ " " got[20] \
+ " " got[19] \
+ " " got[18] \
+ " " got[17] \
+ " " got[16] \
+ " " got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[23] == "000" && \
+ got[22] == "000" && \
+ got[21] == "000" && \
+ got[20] == "000" && \
+ got[19] == "240" && \
+ got[18] == "242" && \
+ got[17] == "171" && \
+ got[16] == "353" && \
+ got[15] == "031" && \
+ got[14] == "300")
+ {
+ print "IEEE extended, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "300" && \
+ got[22] == "031" && \
+ got[21] == "326" && \
+ got[20] == "363" && \
+ got[19] == "105" && \
+ got[18] == "100" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "000" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ # format used on HP 9000/785 under HP-UX
+ print "IEEE quad, big endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "000" && \
+ got[22] == "000" && \
+ got[21] == "000" && \
+ got[20] == "000" && \
+ got[19] == "000" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "100" && \
+ got[12] == "105" && \
+ got[11] == "363" && \
+ got[10] == "326" && \
+ got[9] == "031" && \
+ got[8] == "300")
+ {
+ print "IEEE quad, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "301" && \
+ got[22] == "235" && \
+ got[21] == "157" && \
+ got[20] == "064" && \
+ got[19] == "124" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "000" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ # format used on 32-bit PowerPC (Mac OS X and Debian GNU/Linux)
+ print "possibly double-double, big endian"
+ found = 1
+ exit
+ }
+ }
+ }
+}
+
+END {
+ if (! found)
+ print "unknown", saw
+}
+]
+EOF
+ mpfr_cv_c_long_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk`
+ case $mpfr_cv_c_long_double_format in
+ unknown*)
+ echo "cannot match anything, conftest.$OBJEXT contains" >&AC_FD_CC
+ od -b conftest.$OBJEXT >&AC_FD_CC
+ ;;
+ esac
+ else
+ AC_MSG_WARN([oops, cannot compile test program])
+ fi
+fi
+rm -f conftest*
+])
+
+AH_VERBATIM([HAVE_LDOUBLE],
+[/* Define one of the following to 1 for the format of a `long double'.
+ If your format is not among these choices, or you don't know what it is,
+ then leave all undefined.
+ IEEE_EXT is the 10-byte IEEE extended precision format.
+ IEEE_QUAD is the 16-byte IEEE quadruple precision format.
+ LITTLE or BIG is the endianness. */
+#undef HAVE_LDOUBLE_IEEE_EXT_LITTLE
+#undef HAVE_LDOUBLE_IEEE_QUAD_BIG])
+
+case $mpfr_cv_c_long_double_format in
+ "IEEE extended, little endian")
+ AC_DEFINE(HAVE_LDOUBLE_IEEE_EXT_LITTLE, 1)
+ ;;
+ "IEEE quad, big endian")
+ AC_DEFINE(HAVE_LDOUBLE_IEEE_QUAD_BIG, 1)
+ ;;
+ "IEEE quad, little endian")
+ AC_DEFINE(HAVE_LDOUBLE_IEEE_QUAD_LITTLE, 1)
+ ;;
+ "possibly double-double, big endian")
+ AC_MSG_WARN([This format is known on GCC/PowerPC platforms,])
+ AC_MSG_WARN([but due to GCC PR26374, we can't test further.])
+ AC_MSG_WARN([You can safely ignore this warning, though.])
+ # Since we are not sure, we do not want to define a macro.
+ ;;
+ unknown* | "not available")
+ ;;
+ *)
+ AC_MSG_WARN([oops, unrecognised float format: $mpfr_cv_c_long_double_format])
+ ;;
+esac
+])
+
+
+dnl MPFR_CHECK_LIBM
+dnl ---------------
+dnl Determine a math library -lm to use.
+
+AC_DEFUN([MPFR_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_SUBST(MPFR_LIBM,'')
+case $host in
+ *-*-beos* | *-*-cygwin* | *-*-pw32*)
+ # According to libtool AC CHECK LIBM, these systems don't have libm
+ ;;
+ *-*-solaris*)
+ # On Solaris the math functions new in C99 are in -lm9x.
+ # FIXME: Do we need -lm9x as well as -lm, or just instead of?
+ AC_CHECK_LIB(m9x, main, MPFR_LIBM="-lm9x")
+ AC_CHECK_LIB(m, main, MPFR_LIBM="$MPFR_LIBM -lm")
+ ;;
+ *-ncr-sysv4.3*)
+ # FIXME: What does -lmw mean? Libtool AC CHECK LIBM does it this way.
+ AC_CHECK_LIB(mw, _mwvalidcheckl, MPFR_LIBM="-lmw")
+ AC_CHECK_LIB(m, main, MPFR_LIBM="$MPFR_LIBM -lm")
+ ;;
+ *)
+ AC_CHECK_LIB(m, main, MPFR_LIBM="-lm")
+ ;;
+esac
+])
+
+
+dnl MPFR_LD_SEARCH_PATHS_FIRST
+dnl --------------------------
+
+AC_DEFUN([MPFR_LD_SEARCH_PATHS_FIRST],
+[case "$LD $LDFLAGS" in
+ *-Wl,-search_paths_first*) ;;
+ *) AC_MSG_CHECKING([if the compiler understands -Wl,-search_paths_first])
+ saved_LDFLAGS="$LDFLAGS"
+ LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)]
+ LDFLAGS="$saved_LDFLAGS")
+ ;;
+ esac
+])
+
+
+dnl GMP_C_ATTRIBUTE_MODE
+dnl --------------------
+dnl Introduced in gcc 2.2, but perhaps not in all Apple derived versions.
+dnl Needed for mpfr-longlong.h; this is currently necessary for s390.
+dnl
+dnl TODO: Replace this with a cleaner type size detection, as this
+dnl solution only works with gcc and assumes CHAR_BIT == 8. Probably use
+dnl <stdint.h>, and <http://gcc.gnu.org/viewcvs/trunk/config/stdint.m4>
+dnl as a fallback.
+
+AC_DEFUN([GMP_C_ATTRIBUTE_MODE],
+[AC_CACHE_CHECK([whether gcc __attribute__ ((mode (XX))) works],
+ gmp_cv_c_attribute_mode,
+[AC_TRY_COMPILE([typedef int SItype __attribute__ ((mode (SI)));], ,
+ gmp_cv_c_attribute_mode=yes, gmp_cv_c_attribute_mode=no)
+])
+if test $gmp_cv_c_attribute_mode = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_MODE, 1,
+ [Define to 1 if the compiler accepts gcc style __attribute__ ((mode (XX)))])
+fi
+])
+
+
+dnl MPFR_FUNC_GMP_PRINTF_SPEC
+dnl ------------------------------------
+dnl MPFR_FUNC_GMP_PRINTF_SPEC(spec, type, [includes], [if-true], [if-false])
+dnl Check if gmp_sprintf supports the conversion specification 'spec'
+dnl with type 'type'.
+dnl Expand 'if-true' if printf supports 'spec', 'if-false' otherwise.
+
+AC_DEFUN([MPFR_FUNC_GMP_PRINTF_SPEC],[
+AC_MSG_CHECKING(if gmp_printf supports "%$1")
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+$3
+#include <gmp.h>
+]], [[
+ char s[256];
+ $2 a = 17;
+
+ if (gmp_sprintf (s, "(%0.0$1)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+]])],
+ [AC_MSG_RESULT(yes)
+ $4],
+ [AC_MSG_RESULT(no)
+ $5])
+])
+
+
+dnl MPFR_CHECK_PRINTF_SPEC
+dnl ----------------------
+dnl Check if gmp_printf supports some optional length modifiers.
+dnl Defined symbols are negative to shorten the gcc command line.
+
+AC_DEFUN([MPFR_CHECK_PRINTF_SPEC], [
+AC_REQUIRE([MPFR_CONFIGS])dnl
+if test "$ac_cv_type_intmax_t" = yes; then
+ MPFR_FUNC_GMP_PRINTF_SPEC([jd], [intmax_t], [
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+ ],,
+ [AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
+fi
+
+MPFR_FUNC_GMP_PRINTF_SPEC([hhd], [char], [
+#include <gmp.h>
+ ],,
+ [AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use `hh' length modifier])])
+
+MPFR_FUNC_GMP_PRINTF_SPEC([lld], [long long int], [
+#include <gmp.h>
+ ],,
+ [AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
+
+MPFR_FUNC_GMP_PRINTF_SPEC([Lf], [long double], [
+#include <gmp.h>
+ ],,
+ [AC_DEFINE([NPRINTF_L], 1, [gmp_printf cannot read long double])])
+
+MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [
+#if defined (__cplusplus)
+#include <cstddef>
+#else
+#include <stddef.h>
+#endif
+#include "gmp.h"
+ ],,
+ [AC_DEFINE([NPRINTF_T], 1, [gmp_printf cannot read ptrdiff_t])])
+])
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..698f1dc
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,1053 @@
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
+# This file 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.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
+#
+# This file 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.
+
+# serial 1
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.11.6], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 1
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 12
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], UPC, [depcc="$UPC" am_compiler_list=],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 16
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
+#
+# This file 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.
+
+# serial 1
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 6
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
+#
+# This file 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.
+
+# serial 1
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 1
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 3
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])
+m4_include([m4/lt~obsolete.m4])
+m4_include([m4/size_max.m4])
+m4_include([acinclude.m4])
diff --git a/compile b/compile
new file mode 100755
index 0000000..862a14e
--- /dev/null
+++ b/compile
@@ -0,0 +1,343 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-03-05.13; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
+# Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program 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 2, or (at your option)
+# any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..d622a44
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1530 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-02-10'
+
+# This file 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..6205f84
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1782 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-04-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | be32 | be64 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | epiphany \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | open8 \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pyramid \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | we32k \
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pyramid-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i386-pc
+ os=-msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..89d3433
--- /dev/null
+++ b/configure
@@ -0,0 +1,17228 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for MPFR 3.1.2.
+#
+#
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# Contributed by the AriC and Caramel projects, INRIA.
+#
+# This file is part of the GNU MPFR Library.
+#
+# The GNU MPFR 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 3 of the License, or (at
+# your option) any later version.
+#
+# The GNU MPFR Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+# http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='MPFR'
+PACKAGE_TARNAME='mpfr'
+PACKAGE_VERSION='3.1.2'
+PACKAGE_STRING='MPFR 3.1.2'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+DATAFILES
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+LIBTOOL
+OBJDUMP
+DLLTOOL
+AS
+LIBMPFR_LDFLAGS
+MPFR_LDFLAGS
+TUNE_LIBS
+ALLOCA
+MPFR_LIBM
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+SED
+EGREP
+GREP
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+with_gmp_include
+with_gmp_lib
+with_gmp
+with_gmp_build
+with_mulhigh_size
+enable_gmp_internals
+enable_assert
+enable_logging
+enable_thread_safe
+enable_warnings
+enable_tests_timeout
+enable_dependency_tracking
+enable_decimal_float
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures MPFR 3.1.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/mpfr]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of MPFR 3.1.2:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-maintainer-mode disable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --enable-gmp-internals enable use of GMP undocumented functions [default=no]
+ --enable-assert enable ASSERT checking [default=no]
+ --enable-logging enable MPFR logging (the system must support it)
+ [default=no]
+ --disable-thread-safe explicitly disable TLS support
+ --enable-thread-safe build MPFR as thread safe, i.e. with TLS support
+ (the system must support it) [default=autodetect]
+ --enable-warnings allow MPFR to output warnings to stderr [default=no]
+ --enable-tests-timeout=NUM enable timeout (NUM seconds) for test programs
+ (NUM <= 9999) [default=no]; if enabled, env variable
+ $MPFR_TESTS_TIMEOUT overrides NUM (0: no timeout).
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-decimal-float build conversion functions from/to decimal floats
+ [default=no]
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gmp-include=DIR GMP include directory
+ --with-gmp-lib=DIR GMP lib directory
+ --with-gmp=DIR GMP install directory
+ --with-gmp-build=DIR GMP build directory (please read INSTALL file)
+ --with-mulhigh-size=NUM internal threshold table for mulhigh
+ --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-sysroot=DIR Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+MPFR configure 3.1.2
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at
+your option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by MPFR $as_me 3.1.2, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+am__api_version='1.11'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='mpfr'
+ VERSION='3.1.2'
+
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=yes
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+
+
+
+test_CFLAGS=${CFLAGS+set}
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+
+
+unset gmp_lib_path GMP_CFLAGS GMP_CC
+
+# Check whether --with-gmp_include was given.
+if test "${with_gmp_include+set}" = set; then :
+ withval=$with_gmp_include; CPPFLAGS="$CPPFLAGS -I$withval"
+fi
+
+
+# Check whether --with-gmp_lib was given.
+if test "${with_gmp_lib+set}" = set; then :
+ withval=$with_gmp_lib;
+ LDFLAGS="$LDFLAGS -L$withval"
+ gmp_lib_path="$withval"
+
+fi
+
+
+# Check whether --with-gmp was given.
+if test "${with_gmp+set}" = set; then :
+ withval=$with_gmp;
+ if test -z "$with_gmp_lib" && test -z "$with_gmp_include" ; then
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ LDFLAGS="$LDFLAGS -L$withval/lib"
+ gmp_lib_path="$withval/lib"
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Do not use --with-gmp and --with-gmp-include/--with-gmp-lib options simultaneously.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+
+fi
+
+
+
+# Check whether --with-gmp_build was given.
+if test "${with_gmp_build+set}" = set; then :
+ withval=$with_gmp_build;
+ if test -z "$gmp_lib_path" && test -z "$with_gmp_include" ; then
+ CPPFLAGS="$CPPFLAGS -I$withval -I$withval/tune"
+ LDFLAGS="$LDFLAGS -L$withval -L$withval/.libs -L$withval/tune"
+ gmp_lib_path="$withval$PATH_SEPARATOR$withval/.libs$PATH_SEPARATOR$withval/tune"
+ if test -r $withval/Makefile ; then
+ GMP_CFLAGS=`$SED -n 's/^CFLAGS = //p' $withval/Makefile`
+ GMP_CC=`$SED -n 's/^CC = //p' $withval/Makefile`
+ GMP_SOURCE=`$SED -n 's/^srcdir = *//p' $withval/Makefile`
+ case "$GMP_SOURCE" in
+ .) GMP_SOURCE="" ;;
+ /*) ;;
+ ?*) GMP_SOURCE="$withval/$GMP_SOURCE" ;;
+ esac
+ if test -d "$GMP_SOURCE" ; then
+ CPPFLAGS="$CPPFLAGS -I$GMP_SOURCE -I$GMP_SOURCE/tune"
+ fi
+ fi
+ use_gmp_build=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Do not use --with-gmp-build and other --with-gmp options simultaneously.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+
+fi
+
+
+
+# Check whether --with-mulhigh_size was given.
+if test "${with_mulhigh_size+set}" = set; then :
+ withval=$with_mulhigh_size;
+cat >>confdefs.h <<_ACEOF
+#define MPFR_MULHIGH_SIZE $withval
+_ACEOF
+
+fi
+
+
+# Check whether --enable-gmp-internals was given.
+if test "${enable_gmp_internals+set}" = set; then :
+ enableval=$enable_gmp_internals; case $enableval in
+ yes)
+$as_echo "#define WANT_GMP_INTERNALS 1" >>confdefs.h
+ ;;
+ no) ;;
+ *) as_fn_error $? "bad value for --enable-gmp-internals: yes or no" "$LINENO" 5 ;;
+ esac
+fi
+
+
+# Check whether --enable-assert was given.
+if test "${enable_assert+set}" = set; then :
+ enableval=$enable_assert; case $enableval in
+ yes)
+$as_echo "#define WANT_ASSERT 1" >>confdefs.h
+ ;;
+ no) ;;
+ full)
+$as_echo "#define WANT_ASSERT 2" >>confdefs.h
+ ;;
+ *) as_fn_error $? "bad value for --enable-assert: yes, no or full" "$LINENO" 5 ;;
+ esac
+fi
+
+# Check whether --enable-logging was given.
+if test "${enable_logging+set}" = set; then :
+ enableval=$enable_logging; case $enableval in
+ yes)
+$as_echo "#define MPFR_USE_LOGGING 1" >>confdefs.h
+ ;;
+ no) ;;
+ *) as_fn_error $? "bad value for --enable-logging: yes or no" "$LINENO" 5 ;;
+ esac
+fi
+
+# Check whether --enable-thread-safe was given.
+if test "${enable_thread_safe+set}" = set; then :
+ enableval=$enable_thread_safe; case $enableval in
+ yes) ;;
+ no) ;;
+ *) as_fn_error $? "bad value for --enable-thread-safe: yes or no" "$LINENO" 5 ;;
+ esac
+fi
+
+# Check whether --enable-warnings was given.
+if test "${enable_warnings+set}" = set; then :
+ enableval=$enable_warnings; case $enableval in
+ yes)
+$as_echo "#define MPFR_USE_WARNINGS 1" >>confdefs.h
+ ;;
+ no) ;;
+ *) as_fn_error $? "bad value for --enable-warnings: yes or no" "$LINENO" 5 ;;
+ esac
+fi
+
+
+# Check whether --enable-tests-timeout was given.
+if test "${enable_tests_timeout+set}" = set; then :
+ enableval=$enable_tests_timeout; case $enableval in
+ no) ;;
+ yes)
+$as_echo "#define MPFR_TESTS_TIMEOUT 0" >>confdefs.h
+ ;;
+ [0-9]|[0-9][0-9]|[0-9][0-9][0-9]|[0-9][0-9][0-9][0-9])
+
+cat >>confdefs.h <<_ACEOF
+#define MPFR_TESTS_TIMEOUT $enableval
+_ACEOF
+ ;;
+ *) as_fn_error $? "bad value for --enable-tests-timeout" "$LINENO" 5 ;;
+ esac
+fi
+
+
+
+
+if test -n "$CFLAGS" || test -n "$CC" ; then
+ user_redefine_cc=yes
+fi
+
+
+if test -z "$user_redefine_cc" && test "$cross_compiling" != yes ; then
+
+if test -z "$GMP_CC$GMP_CFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CC and CFLAGS in gmp.h" >&5
+$as_echo_n "checking for CC and CFLAGS in gmp.h... " >&6; }
+ GMP_CC=__GMP_CC
+ GMP_CFLAGS=__GMP_CFLAGS
+ for cpp in /lib/cpp gcc cc c99
+ do
+ test $cpp = /lib/cpp || cpp="$cpp -E"
+ echo foo > conftest.c
+ if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then
+ # Get CC
+ echo "#include \"gmp.h\"" > conftest.c
+ echo "MPFR_OPTION __GMP_CC" >> conftest.c
+ GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
+ # Get CFLAGS
+ echo "#include \"gmp.h\"" > conftest.c
+ echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c
+ unset rmpedantic
+ test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;'
+ GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'`
+ break
+ fi
+ done
+ rm -f conftest*
+ if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ GMP_CFLAGS=
+ GMP_CC=
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CC=$GMP_CC CFLAGS=$GMP_CFLAGS" >&5
+$as_echo "yes CC=$GMP_CC CFLAGS=$GMP_CFLAGS" >&6; }
+ fi
+fi
+
+if test -n "$GMP_CC$GMP_CFLAGS" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CC=$GMP_CC and CFLAGS=$GMP_CFLAGS" >&5
+$as_echo_n "checking for CC=$GMP_CC and CFLAGS=$GMP_CFLAGS... " >&6; }
+ echo "int main (void) { return 0; }" > conftest.c
+ if $GMP_CC $GMP_CFLAGS -o conftest conftest.c 2> /dev/null ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS=$GMP_CFLAGS
+ CC=$GMP_CC
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ rm -f conftest*
+fi
+
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Check whether --enable-decimal-float was given.
+if test "${enable_decimal_float+set}" = set; then :
+ enableval=$enable_decimal_float; case $enableval in
+ yes)
+$as_echo "#define MPFR_WANT_DECIMAL_FLOATS 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler knows _Decimal64" >&5
+$as_echo_n "checking if compiler knows _Decimal64... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+_Decimal64 x;
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ if test "$use_gmp_build" != yes ; then
+ as_fn_error $? "decimal float support requires --with-gmp-build" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _GMP_IEEE_FLOATS is defined" >&5
+$as_echo_n "checking if _GMP_IEEE_FLOATS is defined... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#ifndef _GMP_IEEE_FLOATS
+#error "_GMP_IEEE_FLOATS is not defined"
+#endif
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "decimal float support requires _GMP_IEEE_FLOATS" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+else
+ as_fn_error $? "Compiler doesn't know _Decimal64; try GCC >= 4.2, configured with --enable-decimal-float
+ " "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking decimal float format" >&5
+$as_echo_n "checking decimal float format... " >&6; }
+ if test "$cross_compiling" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming DPD" >&5
+$as_echo "assuming DPD" >&6; }
+ $as_echo "#define DPD_FORMAT 1" >>confdefs.h
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdlib.h>
+
+int
+main ()
+{
+
+union { double d; _Decimal64 d64; } y;
+y.d64 = 1234567890123456.0dd;
+return y.d == 0.14894469406741037E-123 ? 0 :
+ y.d == 0.59075095508629822E-68 ? 1 : 2;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: DPD" >&5
+$as_echo "DPD" >&6; }
+ $as_echo "#define DPD_FORMAT 1" >>confdefs.h
+
+else
+ if test "$?" != 1 ; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "neither DPD nor BID
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: BID" >&5
+$as_echo "BID" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ ;;
+ no) ;;
+ *) as_fn_error $? "bad value for --enable-decimal-float: yes or no" "$LINENO" 5 ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICC" >&5
+$as_echo_n "checking for ICC... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#if !defined(__ICC)
+# error "ICC Not Found"
+error
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test "$test_CFLAGS" != set && test -n "$GCC"; then
+ CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith $CFLAGS"
+fi
+
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
+else
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+
+
+
+case $host in
+ *-apple-darwin*)
+ case "$LD $LDFLAGS" in
+ *-Wl,-search_paths_first*) ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -Wl,-search_paths_first" >&5
+$as_echo_n "checking if the compiler understands -Wl,-search_paths_first... " >&6; }
+ saved_LDFLAGS="$LDFLAGS"
+ LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ LDFLAGS="$saved_LDFLAGS"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ;;
+ esac
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this sort of thing. */
+ typedef int charset[2];
+ const charset cs = { 0, 0 };
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this sort of thing. */
+ char tx;
+ char *t = &tx;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; } bx;
+ struct s *b = &bx; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
+$as_echo_n "checking for working volatile... " >&6; }
+if ${ac_cv_c_volatile+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+volatile int x;
+int * volatile y = (int *) 0;
+return !x && !y;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_volatile=yes
+else
+ ac_cv_c_volatile=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
+$as_echo "$ac_cv_c_volatile" >&6; }
+if test $ac_cv_c_volatile = no; then
+
+$as_echo "#define volatile /**/" >>confdefs.h
+
+fi
+
+
+
+MPFR_LIBM=''
+
+case $host in
+ *-*-beos* | *-*-cygwin* | *-*-pw32*)
+ # According to libtool AC CHECK LIBM, these systems don't have libm
+ ;;
+ *-*-solaris*)
+ # On Solaris the math functions new in C99 are in -lm9x.
+ # FIXME: Do we need -lm9x as well as -lm, or just instead of?
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm9x" >&5
+$as_echo_n "checking for main in -lm9x... " >&6; }
+if ${ac_cv_lib_m9x_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm9x $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m9x_main=yes
+else
+ ac_cv_lib_m9x_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m9x_main" >&5
+$as_echo "$ac_cv_lib_m9x_main" >&6; }
+if test "x$ac_cv_lib_m9x_main" = xyes; then :
+ MPFR_LIBM="-lm9x"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
+$as_echo_n "checking for main in -lm... " >&6; }
+if ${ac_cv_lib_m_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_main=yes
+else
+ ac_cv_lib_m_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
+$as_echo "$ac_cv_lib_m_main" >&6; }
+if test "x$ac_cv_lib_m_main" = xyes; then :
+ MPFR_LIBM="$MPFR_LIBM -lm"
+fi
+
+ ;;
+ *-ncr-sysv4.3*)
+ # FIXME: What does -lmw mean? Libtool AC CHECK LIBM does it this way.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
+$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
+if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmw $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _mwvalidcheckl ();
+int
+main ()
+{
+return _mwvalidcheckl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mw__mwvalidcheckl=yes
+else
+ ac_cv_lib_mw__mwvalidcheckl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+ MPFR_LIBM="-lmw"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
+$as_echo_n "checking for main in -lm... " >&6; }
+if ${ac_cv_lib_m_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_main=yes
+else
+ ac_cv_lib_m_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
+$as_echo "$ac_cv_lib_m_main" >&6; }
+if test "x$ac_cv_lib_m_main" = xyes; then :
+ MPFR_LIBM="$MPFR_LIBM -lm"
+fi
+
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
+$as_echo_n "checking for main in -lm... " >&6; }
+if ${ac_cv_lib_m_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_main=yes
+else
+ ac_cv_lib_m_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
+$as_echo "$ac_cv_lib_m_main" >&6; }
+if test "x$ac_cv_lib_m_main" = xyes; then :
+ MPFR_LIBM="-lm"
+fi
+
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if ${ac_cv_header_time+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_time=yes
+else
+ ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"
+if test "x$ac_cv_header_limits_h" = xyes; then :
+
+else
+ as_fn_error $? "limits.h not found" "$LINENO" 5
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default"
+if test "x$ac_cv_header_float_h" = xyes; then :
+
+else
+ as_fn_error $? "float.h not found" "$LINENO" 5
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"
+if test "x$ac_cv_header_string_h" = xyes; then :
+
+else
+ as_fn_error $? "string.h not found" "$LINENO" 5
+fi
+
+
+
+for ac_header in locale.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
+if test "x$ac_cv_header_locale_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LOCALE_H 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in wchar.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default"
+if test "x$ac_cv_header_wchar_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_WCHAR_H 1
+_ACEOF
+
+fi
+
+done
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdarg_h" = xyes; then :
+
+$as_echo "#define HAVE_STDARG 1" >>confdefs.h
+
+else
+ ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default"
+if test "x$ac_cv_header_varargs_h" = xyes; then :
+
+else
+ as_fn_error $? "stdarg.h or varargs.h not found" "$LINENO" 5
+fi
+
+
+fi
+
+
+
+for ac_header in sys/time.h sys/fpu.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if ${ac_cv_working_alloca_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_working_alloca_h=yes
+else
+ ac_cv_working_alloca_h=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: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if ${ac_cv_func_alloca_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+void *alloca (size_t);
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_func_alloca_works=yes
+else
+ ac_cv_func_alloca_works=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: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
+else
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble. Some versions do not even contain alloca or
+# contain a buggy version. If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if ${ac_cv_os_cray+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "webecray" >/dev/null 2>&1; then :
+ ac_cv_os_cray=yes
+else
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+ break
+fi
+
+ done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if ${ac_cv_c_stack_direction+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_c_stack_direction=0
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+find_stack_direction (int *addr, int depth)
+{
+ int dir, dummy = 0;
+ if (! addr)
+ addr = &dummy;
+ *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+ dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+ return dir + dummy;
+}
+
+int
+main (int argc, char **argv)
+{
+ return find_stack_direction (0, argc + !argv + 20) < 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_stack_direction=1
+else
+ ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+
+
+ for ac_header in stdint.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdint_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDINT_H 1
+_ACEOF
+
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SIZE_MAX" >&5
+$as_echo_n "checking for SIZE_MAX... " >&6; }
+ if ${gl_cv_size_max+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ gl_cv_size_max=
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <limits.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef SIZE_MAX
+Found it
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "Found it" >/dev/null 2>&1; then :
+ gl_cv_size_max=yes
+fi
+rm -f conftest*
+
+ if test -z "$gl_cv_size_max"; then
+ if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) * CHAR_BIT - 1" "size_t_bits_minus_1" "#include <stddef.h>
+#include <limits.h>"; then :
+
+else
+ size_t_bits_minus_1=
+fi
+
+ if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) <= sizeof (unsigned int)" "fits_in_uint" "#include <stddef.h>"; then :
+
+else
+ fits_in_uint=
+fi
+
+ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
+ if test $fits_in_uint = 1; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stddef.h>
+ extern size_t foo;
+ extern unsigned long foo;
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ fits_in_uint=0
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $fits_in_uint = 1; then
+ gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
+ else
+ gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
+ fi
+ else
+ gl_cv_size_max='((size_t)~(size_t)0)'
+ fi
+ fi
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_size_max" >&5
+$as_echo "$gl_cv_size_max" >&6; }
+ if test "$gl_cv_size_max" != yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define SIZE_MAX $gl_cv_size_max
+_ACEOF
+
+ fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to copy va_list" >&5
+$as_echo_n "checking how to copy va_list... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdarg.h>
+
+int
+main ()
+{
+
+ va_list ap1, ap2;
+ va_copy(ap1, ap2);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: va_copy" >&5
+$as_echo "va_copy" >&6; }
+ $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdarg.h>
+
+int
+main ()
+{
+
+ va_list ap1, ap2;
+ __va_copy(ap1, ap2);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ $as_echo "#define HAVE___VA_COPY 1" >>confdefs.h
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: __va_copy" >&5
+$as_echo "__va_copy" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: memcpy" >&5
+$as_echo "memcpy" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+for ac_func in memmove memset setlocale strtol gettimeofday
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+case $host in
+alpha*-*-*)
+ saved_CFLAGS="$CFLAGS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IEEE-754 switches" >&5
+$as_echo_n "checking for IEEE-754 switches... " >&6; }
+if ${mpfr_cv_ieee_switches+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test -n "$GCC"; then
+ mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact"
+ else
+ mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact"
+ fi
+ CFLAGS="$CFLAGS $mpfr_cv_ieee_switches"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ mpfr_cv_ieee_switches="none"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_ieee_switches" >&5
+$as_echo "$mpfr_cv_ieee_switches" >&6; }
+ if test "$mpfr_cv_ieee_switches" = "none"; then
+ CFLAGS="$saved_CFLAGS"
+ else
+ CFLAGS="$saved_CFLAGS $mpfr_cv_ieee_switches"
+ fi
+esac
+
+ac_fn_c_check_type "$LINENO" "long long int" "ac_cv_type_long_long_int" "$ac_includes_default"
+if test "x$ac_cv_type_long_long_int" = xyes; then :
+
+$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h
+
+fi
+
+
+ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default"
+if test "x$ac_cv_type_intmax_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INTMAX_T 1
+_ACEOF
+
+
+fi
+
+if test "$ac_cv_type_intmax_t" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working INTMAX_MAX" >&5
+$as_echo_n "checking for working INTMAX_MAX... " >&6; }
+if ${mpfr_cv_have_intmax_max+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -I$srcdir/src"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "mpfr-intmax.h"
+int
+main ()
+{
+intmax_t x = INTMAX_MAX;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ mpfr_cv_have_intmax_max=yes
+else
+ mpfr_cv_have_intmax_max=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="$saved_CPPFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_intmax_max" >&5
+$as_echo "$mpfr_cv_have_intmax_max" >&6; }
+ if test "$mpfr_cv_have_intmax_max" = "yes"; then
+
+$as_echo "#define MPFR_HAVE_INTMAX_MAX 1" >>confdefs.h
+
+ fi
+fi
+
+ac_fn_c_check_type "$LINENO" "union fpc_csr" "ac_cv_type_union_fpc_csr" "
+#if HAVE_SYS_FPU_H
+# include <sys/fpu.h>
+#endif
+
+"
+if test "x$ac_cv_type_union_fpc_csr" = xyes; then :
+
+$as_echo "#define HAVE_FPC_CSR 1" >>confdefs.h
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fesetround" >&5
+$as_echo_n "checking for fesetround... " >&6; }
+if ${mpfr_cv_have_fesetround+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+saved_LIBS="$LIBS"
+LIBS="$LIBS $MPFR_LIBM"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <fenv.h>
+int
+main ()
+{
+fesetround(FE_TONEAREST);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ mpfr_cv_have_fesetround=yes
+else
+ mpfr_cv_have_fesetround=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS="$saved_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_fesetround" >&5
+$as_echo "$mpfr_cv_have_fesetround" >&6; }
+if test "$mpfr_cv_have_fesetround" = "yes"; then
+
+$as_echo "#define MPFR_HAVE_FESETROUND 1" >>confdefs.h
+
+fi
+
+if test -n "$GCC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc float-conversion bug" >&5
+$as_echo_n "checking for gcc float-conversion bug... " >&6; }
+if ${mpfr_cv_gcc_floatconv_bug+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ saved_LIBS="$LIBS"
+ LIBS="$LIBS $MPFR_LIBM"
+ if test "$cross_compiling" = yes; then :
+ mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <float.h>
+#ifdef MPFR_HAVE_FESETROUND
+#include <fenv.h>
+#endif
+static double get_max (void);
+int main() {
+ double x = 0.5;
+ double y;
+ int i;
+ for (i = 1; i <= 11; i++)
+ x *= x;
+ if (x != 0)
+ return 1;
+#ifdef MPFR_HAVE_FESETROUND
+ /* Useful test for the G4 PowerPC */
+ fesetround(FE_TOWARDZERO);
+ x = y = get_max ();
+ x *= 2.0;
+ if (x != y)
+ return 1;
+#endif
+ return 0;
+}
+static double get_max (void) { static volatile double d = DBL_MAX; return d; }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ mpfr_cv_gcc_floatconv_bug="no"
+else
+ mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store"
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ LIBS="$saved_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_gcc_floatconv_bug" >&5
+$as_echo "$mpfr_cv_gcc_floatconv_bug" >&6; }
+ if test "$mpfr_cv_gcc_floatconv_bug" != "no"; then
+ CFLAGS="$CFLAGS -ffloat-store"
+ fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for denormalized numbers" >&5
+$as_echo_n "checking for denormalized numbers... " >&6; }
+if ${mpfr_cv_have_denorms+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+if test "$cross_compiling" = yes; then :
+ mpfr_cv_have_denorms=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+#include <stdio.h>
+int main() {
+ double x = 2.22507385850720138309e-308;
+ fprintf (stderr, "%e\n", x / 2.0);
+ return 2.0 * (x / 2.0) != x;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ mpfr_cv_have_denorms=yes
+else
+ mpfr_cv_have_denorms=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_have_denorms" >&5
+$as_echo "$mpfr_cv_have_denorms" >&6; }
+if test "$mpfr_cv_have_denorms" = "yes"; then
+
+$as_echo "#define HAVE_DENORMS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the FP division by 0 fails" >&5
+$as_echo_n "checking if the FP division by 0 fails... " >&6; }
+if ${mpfr_cv_errdivzero+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+if test "$cross_compiling" = yes; then :
+ mpfr_cv_errdivzero="cannot test, assume no"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int main() {
+ volatile double d = 0.0, x;
+ x = 0.0 / d;
+ x = 1.0 / d;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ mpfr_cv_errdivzero="no"
+else
+ mpfr_cv_errdivzero="yes"
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_errdivzero" >&5
+$as_echo "$mpfr_cv_errdivzero" >&6; }
+if test "$mpfr_cv_errdivzero" = "yes"; then
+
+$as_echo "#define MPFR_ERRDIVZERO 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The floating-point division by 0 fails instead of" >&5
+$as_echo "$as_me: WARNING: The floating-point division by 0 fails instead of" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: returning a special value: NaN or infinity. Tests" >&5
+$as_echo "$as_me: WARNING: returning a special value: NaN or infinity. Tests" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: involving a FP division by 0 will be disabled." >&5
+$as_echo "$as_me: WARNING: involving a FP division by 0 will be disabled." >&2;}
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if NAN == NAN" >&5
+$as_echo_n "checking if NAN == NAN... " >&6; }
+if ${mpfr_cv_nanisnan+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+if test "$cross_compiling" = yes; then :
+ mpfr_cv_nanisnan="cannot test, assume no"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+#include <math.h>
+#ifndef NAN
+# define NAN (0.0/0.0)
+#endif
+int main() {
+ double d;
+ d = NAN;
+ return d != d;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ mpfr_cv_nanisnan="yes"
+else
+ mpfr_cv_nanisnan="no"
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_nanisnan" >&5
+$as_echo "$mpfr_cv_nanisnan" >&6; }
+if test "$mpfr_cv_nanisnan" = "yes"; then
+
+$as_echo "#define MPFR_NANISNAN 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The test NAN != NAN is false. The probable reason is that" >&5
+$as_echo "$as_me: WARNING: The test NAN != NAN is false. The probable reason is that" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: your compiler optimizes floating-point expressions in an" >&5
+$as_echo "$as_me: WARNING: your compiler optimizes floating-point expressions in an" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unsafe way because some option, such as -ffast-math or" >&5
+$as_echo "$as_me: WARNING: unsafe way because some option, such as -ffast-math or" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -fast (depending on the compiler), has been used. You" >&5
+$as_echo "$as_me: WARNING: -fast (depending on the compiler), has been used. You" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: should NOT use such an option, otherwise MPFR functions" >&5
+$as_echo "$as_me: WARNING: should NOT use such an option, otherwise MPFR functions" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: such as mpfr_get_d and mpfr_set_d may return incorrect" >&5
+$as_echo "$as_me: WARNING: such as mpfr_get_d and mpfr_set_d may return incorrect" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: results on special FP numbers (e.g. NaN or signed zeros)." >&5
+$as_echo "$as_me: WARNING: results on special FP numbers (e.g. NaN or signed zeros)." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: If you did not use such an option, please send us a bug" >&5
+$as_echo "$as_me: WARNING: If you did not use such an option, please send us a bug" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: report so that we can try to find a workaround for your" >&5
+$as_echo "$as_me: WARNING: report so that we can try to find a workaround for your" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: platform and/or document the behavior." >&5
+$as_echo "$as_me: WARNING: platform and/or document the behavior." >&2;}
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if charset has consecutive values" >&5
+$as_echo_n "checking if charset has consecutive values... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test" >&5
+$as_echo "cannot test" >&6; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+char *number = "0123456789";
+char *lower = "abcdefghijklmnopqrstuvwxyz";
+char *upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+int
+main ()
+{
+
+ int i;
+ unsigned char *p;
+ for (p = (unsigned char*) number, i = 0; i < 9; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+ for (p = (unsigned char*) lower, i = 0; i < 25; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+ for (p = (unsigned char*) upper, i = 0; i < 25; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define MPFR_NO_CONSECUTIVE_CHARSET 1" >>confdefs.h
+
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+saved_LIBS="$LIBS"
+LIBS="$LIBS $MPFR_LIBM"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/round" >&5
+$as_echo_n "checking for math/round... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+
+int
+main ()
+{
+
+ double a = 17.42;
+ a = f (round);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_ROUND 1" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/trunc" >&5
+$as_echo_n "checking for math/trunc... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+
+int
+main ()
+{
+
+ double a = 17.42;
+ a = f(trunc);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_TRUNC 1" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/floor" >&5
+$as_echo_n "checking for math/floor... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+
+int
+main ()
+{
+
+ double a = 17.42;
+ a = f(floor);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_FLOOR 1" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/ceil" >&5
+$as_echo_n "checking for math/ceil... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+
+int
+main ()
+{
+
+ double a = 17.42;
+ a = f(ceil);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_CEIL 1" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math/rint" >&5
+$as_echo_n "checking for math/rint... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+int f (double (*func)(double)) { return 0;}
+
+int
+main ()
+{
+
+ double a = 17.42;
+ a = f(nearbyint);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_NEARBYINT 1" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+LIBS="$saved_LIBS"
+
+
+
+
+ac_fn_c_check_type "$LINENO" "long double" "ac_cv_type_long_double" "$ac_includes_default"
+if test "x$ac_cv_type_long_double" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_DOUBLE 1
+_ACEOF
+
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking format of \`long double' floating point" >&5
+$as_echo_n "checking format of \`long double' floating point... " >&6; }
+if ${mpfr_cv_c_long_double_format+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ mpfr_cv_c_long_double_format=unknown
+if test "$ac_cv_type_long_double" != yes; then
+ mpfr_cv_c_long_double_format="not available"
+else
+ cat >conftest.c <<\EOF
+
+/* "before" is 16 bytes to ensure there's no padding between it and "x".
+ We're not expecting any "long double" bigger than 16 bytes or with
+ alignment requirements stricter than 16 bytes. */
+struct {
+ char before[16];
+ long double x;
+ char after[8];
+} foo = {
+ { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
+ -123456789.0,
+ { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
+};
+
+EOF
+ mpfr_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&5 2>&1"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$mpfr_compile\""; } >&5
+ (eval $mpfr_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ cat >conftest.awk <<\EOF
+
+BEGIN {
+ found = 0
+}
+
+# got[] holds a sliding window of bytes read the input. got[0] is the most
+# recent byte read, and got[31] the oldest byte read, so when looking to
+# match some data the indices are "reversed".
+#
+{
+ for (f = 2; f <= NF; f++)
+ {
+ # new byte, shift others up
+ for (i = 31; i >= 0; i--)
+ got[i+1] = got[i];
+ got[0] = $f;
+
+ # end sequence
+ if (got[7] != "376") continue
+ if (got[6] != "334") continue
+ if (got[5] != "272") continue
+ if (got[4] != "230") continue
+ if (got[3] != "166") continue
+ if (got[2] != "124") continue
+ if (got[1] != "062") continue
+ if (got[0] != "020") continue
+
+ # start sequence, with 8-byte body
+ if (got[23] == "001" && \
+ got[22] == "043" && \
+ got[21] == "105" && \
+ got[20] == "147" && \
+ got[19] == "211" && \
+ got[18] == "253" && \
+ got[17] == "315" && \
+ got[16] == "357")
+ {
+ saw = " (" got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[15] == "301" && \
+ got[14] == "235" && \
+ got[13] == "157" && \
+ got[12] == "064" && \
+ got[11] == "124" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ print "IEEE double, big endian"
+ found = 1
+ exit
+ }
+
+ if (got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "124" && \
+ got[11] == "064" && \
+ got[10] == "157" && \
+ got[9] == "235" && \
+ got[8] == "301")
+ {
+ print "IEEE double, little endian"
+ found = 1
+ exit
+ }
+ }
+
+ # start sequence, with 12-byte body
+ if (got[27] == "001" && \
+ got[26] == "043" && \
+ got[25] == "105" && \
+ got[24] == "147" && \
+ got[23] == "211" && \
+ got[22] == "253" && \
+ got[21] == "315" && \
+ got[20] == "357")
+ {
+ saw = " (" got[19] \
+ " " got[18] \
+ " " got[17] \
+ " " got[16] \
+ " " got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[19] == "000" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "240" && \
+ got[14] == "242" && \
+ got[13] == "171" && \
+ got[12] == "353" && \
+ got[11] == "031" && \
+ got[10] == "300")
+ {
+ print "IEEE extended, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[19] == "300" && \
+ got[18] == "031" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "353" && \
+ got[14] == "171" && \
+ got[13] == "242" && \
+ got[12] == "240" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[09] == "000" && \
+ got[08] == "000")
+ {
+ # format found on m68k
+ print "IEEE extended, big endian"
+ found = 1
+ exit
+ }
+ }
+
+ # start sequence, with 16-byte body
+ if (got[31] == "001" && \
+ got[30] == "043" && \
+ got[29] == "105" && \
+ got[28] == "147" && \
+ got[27] == "211" && \
+ got[26] == "253" && \
+ got[25] == "315" && \
+ got[24] == "357")
+ {
+ saw = " (" got[23] \
+ " " got[22] \
+ " " got[21] \
+ " " got[20] \
+ " " got[19] \
+ " " got[18] \
+ " " got[17] \
+ " " got[16] \
+ " " got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[23] == "000" && \
+ got[22] == "000" && \
+ got[21] == "000" && \
+ got[20] == "000" && \
+ got[19] == "240" && \
+ got[18] == "242" && \
+ got[17] == "171" && \
+ got[16] == "353" && \
+ got[15] == "031" && \
+ got[14] == "300")
+ {
+ print "IEEE extended, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "300" && \
+ got[22] == "031" && \
+ got[21] == "326" && \
+ got[20] == "363" && \
+ got[19] == "105" && \
+ got[18] == "100" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "000" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ # format used on HP 9000/785 under HP-UX
+ print "IEEE quad, big endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "000" && \
+ got[22] == "000" && \
+ got[21] == "000" && \
+ got[20] == "000" && \
+ got[19] == "000" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "100" && \
+ got[12] == "105" && \
+ got[11] == "363" && \
+ got[10] == "326" && \
+ got[9] == "031" && \
+ got[8] == "300")
+ {
+ print "IEEE quad, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "301" && \
+ got[22] == "235" && \
+ got[21] == "157" && \
+ got[20] == "064" && \
+ got[19] == "124" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "000" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ # format used on 32-bit PowerPC (Mac OS X and Debian GNU/Linux)
+ print "possibly double-double, big endian"
+ found = 1
+ exit
+ }
+ }
+ }
+}
+
+END {
+ if (! found)
+ print "unknown", saw
+}
+
+EOF
+ mpfr_cv_c_long_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk`
+ case $mpfr_cv_c_long_double_format in
+ unknown*)
+ echo "cannot match anything, conftest.$OBJEXT contains" >&5
+ od -b conftest.$OBJEXT >&5
+ ;;
+ esac
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, cannot compile test program" >&5
+$as_echo "$as_me: WARNING: oops, cannot compile test program" >&2;}
+ fi
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpfr_cv_c_long_double_format" >&5
+$as_echo "$mpfr_cv_c_long_double_format" >&6; }
+
+
+
+case $mpfr_cv_c_long_double_format in
+ "IEEE extended, little endian")
+ $as_echo "#define HAVE_LDOUBLE_IEEE_EXT_LITTLE 1" >>confdefs.h
+
+ ;;
+ "IEEE quad, big endian")
+ $as_echo "#define HAVE_LDOUBLE_IEEE_QUAD_BIG 1" >>confdefs.h
+
+ ;;
+ "IEEE quad, little endian")
+ $as_echo "#define HAVE_LDOUBLE_IEEE_QUAD_LITTLE 1" >>confdefs.h
+
+ ;;
+ "possibly double-double, big endian")
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This format is known on GCC/PowerPC platforms," >&5
+$as_echo "$as_me: WARNING: This format is known on GCC/PowerPC platforms," >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: but due to GCC PR26374, we can't test further." >&5
+$as_echo "$as_me: WARNING: but due to GCC PR26374, we can't test further." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You can safely ignore this warning, though." >&5
+$as_echo "$as_me: WARNING: You can safely ignore this warning, though." >&2;}
+ # Since we are not sure, we do not want to define a macro.
+ ;;
+ unknown* | "not available")
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, unrecognised float format: $mpfr_cv_c_long_double_format" >&5
+$as_echo "$as_me: WARNING: oops, unrecognised float format: $mpfr_cv_c_long_double_format" >&2;}
+ ;;
+esac
+
+
+if test "$enable_logging" = yes; then
+ if test "$enable_thread_safe" = yes; then
+ as_fn_error $? "Enable either \`Logging' or \`thread-safe', not both" "$LINENO" 5
+ else
+ enable_thread_safe=no
+ fi
+fi
+
+if test "$enable_thread_safe" != no; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TLS support" >&5
+$as_echo_n "checking for TLS support... " >&6; }
+saved_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I$srcdir/src"
+if test "$cross_compiling" = yes; then :
+ if test "$enable_thread_safe" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume yes" >&5
+$as_echo "cannot test, assume yes" >&6; }
+
+$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot test, assume no" >&5
+$as_echo "cannot test, assume no" >&6; }
+ fi
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#define MPFR_USE_THREAD_SAFE 1
+#include "mpfr-thread.h"
+MPFR_THREAD_ATTR int x = 17;
+int main() {
+ return x != 17;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define MPFR_USE_THREAD_SAFE 1" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ if test "$enable_thread_safe" = yes; then
+ as_fn_error $? "please configure with --disable-thread-safe" "$LINENO" 5
+ fi
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+CPPFLAGS="$saved_CPPFLAGS"
+fi
+
+
+# (Based on GMP 5.1)
+# clock_gettime is in librt on *-*-osf5.1 and on glibc < 2.17, so add -lrt to
+# TUNE_LIBS if needed (e.g. if clock_gettime is not already in the C library).
+# On linux (tested on x86_32, 2.6.26), clock_getres reports ns accuracy,
+# while in a quick test on osf, clock_getres said only 1 millisecond.
+old_LIBS="$LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${ac_cv_search_clock_gettime+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' rt; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_clock_gettime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_clock_gettime+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_clock_gettime+:} false; then :
+
+else
+ ac_cv_search_clock_gettime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+
+$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+fi
+
+TUNE_LIBS="$LIBS"
+LIBS="$old_LIBS"
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp.h" >&5
+$as_echo_n "checking for gmp.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include "gmp.h"
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "gmp.h can't be found, or is unusable." "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
+$as_echo "$AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AS="as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
+$as_echo "$ac_ct_AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
+else
+ AS="$ac_cv_prog_AS"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+ ;;
+esac
+
+test -z "$AS" && AS=as
+
+
+
+
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLL/static GMP" >&5
+$as_echo_n "checking for DLL/static GMP... " >&6; }
+ if test "$enable_shared" = yes; then
+ MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined"
+ LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-4.dll.def"
+ dont_link_with_gmp="yes"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include "gmp.h"
+#if !__GMP_LIBGMP_DLL
+# error "Dead man"
+error
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: DLL" >&5
+$as_echo "DLL" >&6; }
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
+$as_echo "static" >&6; }
+ as_fn_error $? "gmp.h isn't a DLL: use --enable-static --disable-shared" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include "gmp.h"
+#if __GMP_LIBGMP_DLL
+# error "Dead man"
+error
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
+$as_echo "static" >&6; }
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: DLL" >&5
+$as_echo "DLL" >&6; }
+ as_fn_error $? "gmp.h is a DLL: use --disable-static --enable-shared" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ ;;
+esac
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len" && \
+ test undefined != "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in ar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AR" && break
+ done
+fi
+if test -z "$AR"; then
+ ac_ct_AR=$AR
+ for ac_prog in ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_AR" && break
+done
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ar_at_file=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+ withval=$with_sysroot;
+else
+ with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+ ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MANIFEST_TOOL"; then
+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+ # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_MANIFEST_TOOL"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
+ MANIFEST_TOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+ fi
+else
+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&5
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&5
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ echo "$RANLIB libconftest.a" >&5
+ $RANLIB libconftest.a 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&5
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ if test -n "$lt_prog_compiler_pic"; then
+ lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ lt_prog_compiler_wl='-Wl,-Wl,,'
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ tcc*)
+ # Fabrice Bellard et al's Tiny C Compiler
+ # When it learns to make shared objects, it will
+ # presumably use -fPIC.
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Intel*\ [CF]*Compiler*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ *Portland\ Group*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ link_all_deplibs=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ link_all_deplibs=no
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ file_list_spec='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+ enable_shared_with_static_runtimes=yes
+ exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ old_postinstall_cmds='chmod 644 $oldlib'
+ postlink_cmds='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ enable_shared_with_static_runtimes=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_irix_exported_symbol=yes
+else
+ lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsdelf*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='NetBSD ld.elf_so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc __attribute__ ((mode (XX))) works" >&5
+$as_echo_n "checking whether gcc __attribute__ ((mode (XX))) works... " >&6; }
+if ${gmp_cv_c_attribute_mode+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+typedef int SItype __attribute__ ((mode (SI)));
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gmp_cv_c_attribute_mode=yes
+else
+ gmp_cv_c_attribute_mode=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_c_attribute_mode" >&5
+$as_echo "$gmp_cv_c_attribute_mode" >&6; }
+if test $gmp_cv_c_attribute_mode = yes; then
+
+$as_echo "#define HAVE_ATTRIBUTE_MODE 1" >>confdefs.h
+
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent GMP" >&5
+$as_echo_n "checking for recent GMP... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include "gmp.h"
+#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410)
+# error "min GMP version is 4.1.0"
+error
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "GMP 4.1.0 min required" "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test "$use_gmp_build" = yes ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp internal files" >&5
+$as_echo_n "checking for gmp internal files... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include "gmp.h"
+ #include "gmp-impl.h"
+ #include "longlong.h"
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define MPFR_HAVE_GMP_IMPL 1" >>confdefs.h
+
+
+else
+
+ as_fn_error $? "header files gmp-impl.h and longlong.h not found" "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+if test "$use_gmp_build" = yes ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for valid GMP_NUMB_BITS" >&5
+$as_echo_n "checking for valid GMP_NUMB_BITS... " >&6; }
+ if test "$cross_compiling" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: can't test" >&5
+$as_echo "can't test" >&6; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <limits.h>
+#include "gmp.h"
+#include "gmp-impl.h"
+
+int
+main ()
+{
+
+ return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
+ && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "GMP_NUMB_BITS is incorrect.
+You probably need to change some of the GMP or MPFR compile options." "$LINENO" 5
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+
+
+if test "$dont_link_with_gmp" = yes ; then
+LIBS="-lgmp $LIBS"
+else
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __gmpz_init in -lgmp" >&5
+$as_echo_n "checking for __gmpz_init in -lgmp... " >&6; }
+if ${ac_cv_lib_gmp___gmpz_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgmp $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char __gmpz_init ();
+int
+main ()
+{
+return __gmpz_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_gmp___gmpz_init=yes
+else
+ ac_cv_lib_gmp___gmpz_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_init" >&5
+$as_echo "$ac_cv_lib_gmp___gmpz_init" >&6; }
+if test "x$ac_cv_lib_gmp___gmpz_init" = xyes; then :
+ LIBS="-lgmp $LIBS"
+else
+ as_fn_error $? "libgmp not found or uses a different ABI (including static vs shared).
+Please read the INSTALL file -- see \"In case of problem\"." "$LINENO" 5
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp.h version and libgmp version are the same" >&5
+$as_echo_n "checking if gmp.h version and libgmp version are the same... " >&6; }
+saved_LD_RUN_PATH="$LD_RUN_PATH"
+LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path"
+export LD_RUN_PATH
+if test "$cross_compiling" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: can not test" >&5
+$as_echo "can not test" >&6; }
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+#include <string.h>
+#include "gmp.h"
+
+int
+main ()
+{
+
+ char buffer[100];
+ sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
+ __GNU_MP_VERSION_PATCHLEVEL);
+ printf ("(%s/%s) ", buffer, gmp_version);
+ if (strcmp (buffer, gmp_version) == 0)
+ return 0;
+ if (__GNU_MP_VERSION_PATCHLEVEL != 0)
+ return 1;
+ sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR);
+ return (strcmp (buffer, gmp_version) != 0) ? 1 : 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+if test "$ac_cv_type_intmax_t" = yes; then
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp_printf supports \"%jd\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%jd\"... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#include <gmp.h>
+
+int
+main ()
+{
+
+ char s[256];
+ intmax_t a = 17;
+
+ if (gmp_sprintf (s, "(%0.0jd)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NPRINTF_J 1" >>confdefs.h
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp_printf supports \"%hhd\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%hhd\"... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#include <gmp.h>
+
+#include <gmp.h>
+
+int
+main ()
+{
+
+ char s[256];
+ char a = 17;
+
+ if (gmp_sprintf (s, "(%0.0hhd)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NPRINTF_HH 1" >>confdefs.h
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp_printf supports \"%lld\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%lld\"... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#include <gmp.h>
+
+#include <gmp.h>
+
+int
+main ()
+{
+
+ char s[256];
+ long long int a = 17;
+
+ if (gmp_sprintf (s, "(%0.0lld)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NPRINTF_LL 1" >>confdefs.h
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp_printf supports \"%Lf\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%Lf\"... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#include <gmp.h>
+
+#include <gmp.h>
+
+int
+main ()
+{
+
+ char s[256];
+ long double a = 17;
+
+ if (gmp_sprintf (s, "(%0.0Lf)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NPRINTF_L 1" >>confdefs.h
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmp_printf supports \"%td\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%td\"... " >&6; }
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#if defined (__cplusplus)
+#include <cstddef>
+#else
+#include <stddef.h>
+#endif
+#include "gmp.h"
+
+#include <gmp.h>
+
+int
+main ()
+{
+
+ char s[256];
+ ptrdiff_t a = 17;
+
+ if (gmp_sprintf (s, "(%0.0td)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NPRINTF_T 1" >>confdefs.h
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ==========================================================" >&5
+$as_echo "$as_me: WARNING: ==========================================================" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'gmp.h' and 'libgmp' seem to have different versions or" >&5
+$as_echo "$as_me: WARNING: 'gmp.h' and 'libgmp' seem to have different versions or" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: we cannot run a program linked with GMP (if you cannot" >&5
+$as_echo "$as_me: WARNING: we cannot run a program linked with GMP (if you cannot" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: see the version numbers above). A cause may be different" >&5
+$as_echo "$as_me: WARNING: see the version numbers above). A cause may be different" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GMP versions with different ABI's or the use of --with-gmp" >&5
+$as_echo "$as_me: WARNING: GMP versions with different ABI's or the use of --with-gmp" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: or --with-gmp-include with a system include directory" >&5
+$as_echo "$as_me: WARNING: or --with-gmp-include with a system include directory" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: (such as /usr/include or /usr/local/include)." >&5
+$as_echo "$as_me: WARNING: (such as /usr/include or /usr/local/include)." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: However since we can't use 'libtool' inside the configure," >&5
+$as_echo "$as_me: WARNING: However since we can't use 'libtool' inside the configure," >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: we can't be sure. See 'config.log' for details." >&5
+$as_echo "$as_me: WARNING: we can't be sure. See 'config.log' for details." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ==========================================================" >&5
+$as_echo "$as_me: WARNING: ==========================================================" >&2;}
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+LD_RUN_PATH="$saved_LD_RUN_PATH"
+
+for ac_func in __gmpn_rootrem __gmpn_sbpi1_divappr_q
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+fi
+
+if test -f confdefs.h; then
+ $SED '/#define PACKAGE_/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_STRING/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_ALLOCA /d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_DLFCN_H/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_MEM/d' <confdefs.h >confdefs.tmp
+ $SED '/#define STDC_HEADERS/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_STRTOL/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_STDLIB_H/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_UNISTD_H/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_STDC_HEADERS/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_LONG_DOUBLE/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_SYS_STAT_H/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_SYS_TYPES_H/d' <confdefs.h >confdefs.tmp
+ $SED '/#define PROTOTYPES/d' <confdefs.tmp >confdefs.h
+ $SED '/#define __PROTOTYPES/d' <confdefs.h >confdefs.tmp
+
+ mv confdefs.tmp confdefs.h
+fi
+
+if $EGREP -q -e '-dev$' $srcdir/VERSION; then
+ DATAFILES=`echo \`$SED -n \
+ 's/^ *data_check *("\(data\/[^"]*\)".*/tests\/\1/p' \
+ $srcdir/tests/*.c\``
+fi
+
+ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by MPFR $as_me 3.1.2, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+MPFR config.status 3.1.2
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in AS \
+DLLTOOL \
+OBJDUMP \
+SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+ "tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;;
+ "src/mparam.h") CONFIG_FILES="$CONFIG_FILES src/mparam.h:src/mparam_h.in" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Assembler program.
+AS=$lt_AS
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Object dumper program.
+OBJDUMP=$lt_OBJDUMP
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ if test x"$xsi_shell" = xyes; then
+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\ # positional parameters, so assign one to ordinary parameter first.\
+\ func_stripname_result=${3}\
+\ func_stripname_result=${func_stripname_result#"${1}"}\
+\ func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\ func_split_long_opt_name=${1%%=*}\
+\ func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\ func_split_short_opt_arg=${1#??}\
+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\ case ${1} in\
+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\ *) func_lo2o_result=${1} ;;\
+\ esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+ func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+ func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+ func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+ eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\ func_quote_for_eval "${2}"\
+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..48493d1
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,561 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_COPYRIGHT([
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at
+your option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+dnl Add check-news when it checks for more than 15 lines
+AC_INIT([MPFR],[3.1.2])
+
+AM_INIT_AUTOMAKE([1.11 no-define dist-bzip2 dist-xz dist-zip])
+AM_MAINTAINER_MODE(enable)
+
+AC_CONFIG_MACRO_DIR([m4])
+
+dnl FIXME: The AC_ARG_ENABLE(decimal-float...) part does things too
+dnl early, even when this option is not used. In particular, it must
+dnl be put after AC_PROG_CC; another problem is that the GMP CFLAGS
+dnl and CC check may modify the compiler.
+
+test_CFLAGS=${CFLAGS+set}
+
+AC_CANONICAL_HOST
+
+AC_PROG_EGREP
+AC_PROG_SED
+
+dnl To use a separate config header.
+dnl There is still some problem with GMP's HAVE_CONFIG
+dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in])
+
+dnl Extra arguments to configure
+unset gmp_lib_path GMP_CFLAGS GMP_CC
+AC_ARG_WITH(gmp_include,
+ [ --with-gmp-include=DIR GMP include directory ],
+ CPPFLAGS="$CPPFLAGS -I$withval")
+AC_ARG_WITH(gmp_lib,
+ [ --with-gmp-lib=DIR GMP lib directory ], [
+ LDFLAGS="$LDFLAGS -L$withval"
+ gmp_lib_path="$withval"
+ ])
+AC_ARG_WITH(gmp,
+ [ --with-gmp=DIR GMP install directory ], [
+ if test -z "$with_gmp_lib" && test -z "$with_gmp_include" ; then
+ CPPFLAGS="$CPPFLAGS -I$withval/include"
+ LDFLAGS="$LDFLAGS -L$withval/lib"
+ gmp_lib_path="$withval/lib"
+ else
+ AC_MSG_FAILURE([Do not use --with-gmp and --with-gmp-include/--with-gmp-lib options simultaneously.])
+ fi
+ ])
+
+AC_ARG_WITH(gmp_build,
+ [ --with-gmp-build=DIR GMP build directory (please read INSTALL file)],
+ [
+ if test -z "$gmp_lib_path" && test -z "$with_gmp_include" ; then
+ CPPFLAGS="$CPPFLAGS -I$withval -I$withval/tune"
+ LDFLAGS="$LDFLAGS -L$withval -L$withval/.libs -L$withval/tune"
+ gmp_lib_path="$withval$PATH_SEPARATOR$withval/.libs$PATH_SEPARATOR$withval/tune"
+ if test -r $withval/Makefile ; then
+ GMP_CFLAGS=`$SED -n 's/^CFLAGS = //p' $withval/Makefile`
+ GMP_CC=`$SED -n 's/^CC = //p' $withval/Makefile`
+ GMP_SOURCE=`$SED -n 's/^srcdir = *//p' $withval/Makefile`
+ case "$GMP_SOURCE" in
+ .) GMP_SOURCE="" ;;
+ /*) ;;
+ ?*) GMP_SOURCE="$withval/$GMP_SOURCE" ;;
+ esac
+ if test -d "$GMP_SOURCE" ; then
+ CPPFLAGS="$CPPFLAGS -I$GMP_SOURCE -I$GMP_SOURCE/tune"
+ fi
+ fi
+ use_gmp_build=yes
+ else
+ AC_MSG_FAILURE([Do not use --with-gmp-build and other --with-gmp options simultaneously.])
+ fi
+ ])
+
+AC_ARG_WITH(mulhigh_size,
+ [ --with-mulhigh-size=NUM internal threshold table for mulhigh],
+ AC_DEFINE_UNQUOTED([MPFR_MULHIGH_SIZE],$withval, [Mulhigh size]))
+
+AC_ARG_ENABLE(gmp-internals,
+ [ --enable-gmp-internals enable use of GMP undocumented functions [[default=no]]],
+ [ case $enableval in
+ yes) AC_DEFINE([WANT_GMP_INTERNALS],1,[Want GMP internals]) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-gmp-internals: yes or no]) ;;
+ esac])
+
+AC_ARG_ENABLE(assert,
+ [ --enable-assert enable ASSERT checking [[default=no]]],
+ [ case $enableval in
+ yes) AC_DEFINE([WANT_ASSERT],1,[Want assertion]) ;;
+ no) ;;
+ full) AC_DEFINE([WANT_ASSERT],2,[Want assertion]) ;;
+ *) AC_MSG_ERROR([bad value for --enable-assert: yes, no or full]) ;;
+ esac])
+AC_ARG_ENABLE(logging,
+ [ --enable-logging enable MPFR logging (the system must support it)
+ [[default=no]]],
+ [ case $enableval in
+ yes) AC_DEFINE([MPFR_USE_LOGGING],1,[Log what MPFR does]) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-logging: yes or no]) ;;
+ esac])
+AC_ARG_ENABLE(thread-safe,
+ [ --disable-thread-safe explicitly disable TLS support
+ --enable-thread-safe build MPFR as thread safe, i.e. with TLS support
+ (the system must support it) [[default=autodetect]]],
+ [ case $enableval in
+ yes) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-thread-safe: yes or no]) ;;
+ esac])
+AC_ARG_ENABLE(warnings,
+ [ --enable-warnings allow MPFR to output warnings to stderr [[default=no]]],
+ [ case $enableval in
+ yes) AC_DEFINE([MPFR_USE_WARNINGS],1,[Allow MPFR to output warnings to stderr]) ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-warnings: yes or no]) ;;
+ esac])
+
+AC_ARG_ENABLE(tests-timeout,
+ [ --enable-tests-timeout=NUM enable timeout (NUM seconds) for test programs
+ (NUM <= 9999) [[default=no]]; if enabled, env variable
+ $MPFR_TESTS_TIMEOUT overrides NUM (0: no timeout).],
+ [ case $enableval in
+ no) ;;
+ yes) AC_DEFINE([MPFR_TESTS_TIMEOUT], 0, [timeout limit]) ;;
+ [[0-9]]|[[0-9]][[0-9]]|[[0-9]][[0-9]][[0-9]]|[[0-9]][[0-9]][[0-9]][[0-9]])
+ AC_DEFINE_UNQUOTED([MPFR_TESTS_TIMEOUT], $enableval, [timeout limit]) ;;
+ *) AC_MSG_ERROR([bad value for --enable-tests-timeout]) ;;
+ esac])
+
+
+dnl
+dnl Setup CC and CFLAGS
+dnl
+
+dnl Check if user request its CC and CFLAGS
+if test -n "$CFLAGS" || test -n "$CC" ; then
+ user_redefine_cc=yes
+fi
+
+dnl ********************************************************************
+dnl Check for CC and CFLAGS in gmp.h
+
+if test -z "$user_redefine_cc" && test "$cross_compiling" != yes ; then
+
+dnl We need to guess the C preprocessor instead of using AC_PROG_CPP,
+dnl since AC_PROG_CPP implies AC_PROG_CC, which chooses a compiler
+dnl (before we have the chance to get it from gmp.h) and does some
+dnl checking related to this compiler (such as dependency tracking
+dnl options); if the compiler changes due to __GMP_CC in gmp.h, one
+dnl would have incorrect settings.
+dnl FIXME: Move this in aclocal ?
+if test -z "$GMP_CC$GMP_CFLAGS" ; then
+ AC_MSG_CHECKING(for CC and CFLAGS in gmp.h)
+ GMP_CC=__GMP_CC
+ GMP_CFLAGS=__GMP_CFLAGS
+ for cpp in /lib/cpp gcc cc c99
+ do
+ test $cpp = /lib/cpp || cpp="$cpp -E"
+ echo foo > conftest.c
+ if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then
+ # Get CC
+ echo "#include \"gmp.h\"" > conftest.c
+ echo "MPFR_OPTION __GMP_CC" >> conftest.c
+ GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
+ # Get CFLAGS
+ echo "#include \"gmp.h\"" > conftest.c
+ echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c
+ unset rmpedantic
+ [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;']
+ GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'`
+ break
+ fi
+ done
+ rm -f conftest*
+ if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then
+ AC_MSG_RESULT(no)
+ GMP_CFLAGS=
+ GMP_CC=
+ else
+ AC_MSG_RESULT(yes [CC=$GMP_CC CFLAGS=$GMP_CFLAGS])
+ fi
+fi
+
+dnl But these variables may be invalid, so we must check them first.
+dnl Note: we do not use AC_RUN_IFELSE, as it implies AC_PROG_CC.
+if test -n "$GMP_CC$GMP_CFLAGS" ; then
+ AC_MSG_CHECKING(for CC=$GMP_CC and CFLAGS=$GMP_CFLAGS)
+ echo "int main (void) { return 0; }" > conftest.c
+ if $GMP_CC $GMP_CFLAGS -o conftest conftest.c 2> /dev/null ; then
+ AC_MSG_RESULT(yes)
+ CFLAGS=$GMP_CFLAGS
+ CC=$GMP_CC
+ else
+ AC_MSG_RESULT(no)
+ fi
+ rm -f conftest*
+fi
+
+fi
+
+dnl ********************************************************************
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_LANG(C)
+
+AC_ARG_ENABLE(decimal-float,
+ [ --enable-decimal-float build conversion functions from/to decimal floats
+ [[default=no]]],
+ [ case $enableval in
+ yes) AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1,
+ [Build decimal float functions])
+ AC_MSG_CHECKING(if compiler knows _Decimal64)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[_Decimal64 x;]])],
+ [AC_MSG_RESULT(yes)
+ if test "$use_gmp_build" != yes ; then
+ AC_MSG_ERROR([decimal float support requires --with-gmp-build])
+ fi
+ AC_MSG_CHECKING(if _GMP_IEEE_FLOATS is defined)
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include "gmp.h"
+#include "gmp-impl.h"
+#ifndef _GMP_IEEE_FLOATS
+#error "_GMP_IEEE_FLOATS is not defined"
+#endif]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
+ AC_MSG_ERROR([decimal float support requires _GMP_IEEE_FLOATS])])
+ ],
+ [AC_MSG_ERROR([Compiler doesn't know _Decimal64; try GCC >= 4.2, configured with --enable-decimal-float]
+ )])
+ AC_MSG_CHECKING(decimal float format)
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdlib.h>
+]], [[
+union { double d; _Decimal64 d64; } y;
+y.d64 = 1234567890123456.0dd;
+return y.d == 0.14894469406741037E-123 ? 0 :
+ y.d == 0.59075095508629822E-68 ? 1 : 2;
+]])], [AC_MSG_RESULT(DPD)
+ AC_DEFINE([DPD_FORMAT],1,[])],
+ [if test "$?" != 1 ; then
+ AC_MSG_FAILURE(neither DPD nor BID)
+ fi
+ AC_MSG_RESULT(BID)],
+ [AC_MSG_RESULT(assuming DPD)
+ AC_DEFINE([DPD_FORMAT],1,[])])
+ ;;
+ no) ;;
+ *) AC_MSG_ERROR([bad value for --enable-decimal-float: yes or no]) ;;
+ esac])
+
+dnl Check if compiler is ICC, and if such a case, disable GCC
+dnl And add some specific flags.
+dnl Don't add Warnings Flags (Otherwise you'll get more than 20000 warnings).
+dnl Add -long_double flags? Don't use -pc64 !
+dnl Notes (VL):
+dnl * With icc 10.1 20080212 on itanium, the __ICC macro is not defined,
+dnl even when the -icc option is used (contrary to what is documented
+dnl on the icc man page).
+dnl * When ICC is correctly detected (__ICC macro defined), unsetting
+dnl the GCC variable confuses libtool. See:
+dnl http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485421
+dnl * If need be, the gcc predefined macros __GNUC_* can be disabled
+dnl thanks to the -no-gcc option.
+AC_MSG_CHECKING(for ICC)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(__ICC)
+# error "ICC Not Found"
+error
+#endif
+]], [[]])],[
+ AC_MSG_RESULT(yes)
+ CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
+],[AC_MSG_RESULT(no)])
+
+dnl If compiler is gcc, then use some specific flags.
+dnl But don't touch user other flags.
+if test "$test_CFLAGS" != set && test -n "$GCC"; then
+ CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith $CFLAGS"
+fi
+
+AM_PROG_CC_C_O
+
+case $host in
+ *-apple-darwin*)
+dnl This allows to take the first GMP library in the library paths,
+dnl whether it is dynamic or static. This behavior is more sensible,
+dnl in particular because it is the only way to link with a version
+dnl only available in static form when another version is available
+dnl in dynamic, and also for consistency, because the compiler will
+dnl take the first gmp.h found in the include paths (so, we need to
+dnl take a library that corresponds to this header file). This is a
+dnl common problem with darwin.
+ MPFR_LD_SEARCH_PATHS_FIRST ;;
+esac
+
+AC_C_CONST
+AC_C_VOLATILE
+MPFR_CONFIGS
+
+# (Based on GMP 5.1)
+# clock_gettime is in librt on *-*-osf5.1 and on glibc < 2.17, so add -lrt to
+# TUNE_LIBS if needed (e.g. if clock_gettime is not already in the C library).
+# On linux (tested on x86_32, 2.6.26), clock_getres reports ns accuracy,
+# while in a quick test on osf, clock_getres said only 1 millisecond.
+old_LIBS="$LIBS"
+AC_SEARCH_LIBS(clock_gettime, rt, [
+ AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])])
+TUNE_LIBS="$LIBS"
+LIBS="$old_LIBS"
+AC_SUBST(TUNE_LIBS)
+
+dnl
+dnl Setup GMP detection
+dnl
+
+dnl Check GMP Header
+AC_MSG_CHECKING(for gmp.h)
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include "gmp.h"
+]])],[AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([gmp.h can't be found, or is unusable.])
+])
+
+dnl Configs for Windows DLLs.
+dnl libtool requires "-no-undefined" for win32 dll
+dnl It also disables the tests involving the linking with LIBGMP if DLL
+dnl
+dnl "-Wl,output-def" is used to get a .def file for use by MS lib to make
+dnl a .lib import library, described in the manual.
+dnl
+dnl Incidentally, libtool does generate an import library libmpfr.dll.a,
+dnl but it's "ar" format and cannot be used by the MS linker. There
+dnl doesn't seem to be any GNU tool for generating or converting to .lib.
+AC_SUBST(MPFR_LDFLAGS)
+AC_SUBST(LIBMPFR_LDFLAGS)
+AC_LIBTOOL_WIN32_DLL
+case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ AC_MSG_CHECKING(for DLL/static GMP)
+ if test "$enable_shared" = yes; then
+ MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined"
+ LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-4.dll.def"
+ dont_link_with_gmp="yes"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include "gmp.h"
+#if !__GMP_LIBGMP_DLL
+# error "Dead man"
+error
+#endif
+ ]], [[]])],[AC_MSG_RESULT(DLL)],[
+ AC_MSG_RESULT(static)
+ AC_MSG_ERROR([gmp.h isn't a DLL: use --enable-static --disable-shared]) ])
+ else
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include "gmp.h"
+#if __GMP_LIBGMP_DLL
+# error "Dead man"
+error
+#endif
+ ]], [[]])],[AC_MSG_RESULT(static)],[
+ AC_MSG_RESULT(DLL)
+ AC_MSG_ERROR([gmp.h is a DLL: use --disable-static --enable-shared]) ])
+ fi
+ ;;
+esac
+dnl Finally set up LibTool
+AC_PROG_LIBTOOL
+
+
+dnl
+dnl For mpfr-longlong.h - TODO: should be replaced (see acinclude.m4).
+dnl
+
+GMP_C_ATTRIBUTE_MODE
+
+
+dnl
+dnl Setup GMP detection (continued)
+dnl
+
+dnl Check minimal GMP version
+dnl We only guarantee that with a *functional* and recent enough GMP version,
+dnl MPFR will compile; we do not guarantee that GMP will compile.
+dnl In particular fat builds are broken in GMP 4.3.2 and GMP 5.0.0
+dnl (at least on 64-bit Core 2 under Linux),
+dnl see http://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html.
+AC_MSG_CHECKING(for recent GMP)
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include "gmp.h"
+#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410)
+# error "min GMP version is 4.1.0"
+error
+#endif
+]])],[AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([GMP 4.1.0 min required])
+])
+
+dnl Check if we can use internal header files of GMP (only --with-gmp-build)
+if test "$use_gmp_build" = yes ; then
+ AC_MSG_CHECKING(for gmp internal files)
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ #include "gmp.h"
+ #include "gmp-impl.h"
+ #include "longlong.h"
+ ]])],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([MPFR_HAVE_GMP_IMPL],1,[Use GMP Internal Files])
+ ],[
+ AC_MSG_ERROR([header files gmp-impl.h and longlong.h not found])
+ ])
+fi
+
+dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB
+dnl This test doesn't need to link with libgmp (at least it shouldn't).
+if test "$use_gmp_build" = yes ; then
+ AC_MSG_CHECKING(for valid GMP_NUMB_BITS)
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <limits.h>
+#include "gmp.h"
+#include "gmp-impl.h"
+]], [[
+ return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
+ && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1;
+]])], [AC_MSG_RESULT(yes)], [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([GMP_NUMB_BITS is incorrect.
+You probably need to change some of the GMP or MPFR compile options.])],
+ [AC_MSG_RESULT([can't test])])
+fi
+
+
+dnl We really need to link using libtool. But it is impossible with the current
+dnl libtool.
+dnl The practical problems appear only under MS Windows since the library name
+dnl is libgmp-3 (due to libtool versionning). The best solution
+dnl is to believe it works under MS-Windows.
+if test "$dont_link_with_gmp" = yes ; then
+LIBS="-lgmp $LIBS"
+else
+
+dnl Check if we can link with GMP
+AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
+ [AC_MSG_ERROR(libgmp not found or uses a different ABI (including static vs shared).
+Please read the INSTALL file -- see "In case of problem".)])
+
+dnl Check for corresponding 'gmp.h' and libgmp.a
+AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)
+dnl We do not set LD_LIBRARY_PATH, as it is not possible to set it just
+dnl before the test program is run, and we do not want to affect other
+dnl programs (such as the compiler), because the behavior could be
+dnl incorrect and even have security implications.
+saved_LD_RUN_PATH="$LD_RUN_PATH"
+LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path"
+export LD_RUN_PATH
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+#include <string.h>
+#include "gmp.h"
+]], [[
+ char buffer[100];
+ sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
+ __GNU_MP_VERSION_PATCHLEVEL);
+ printf ("(%s/%s) ", buffer, gmp_version);
+ if (strcmp (buffer, gmp_version) == 0)
+ return 0;
+ if (__GNU_MP_VERSION_PATCHLEVEL != 0)
+ return 1;
+ sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR);
+ return (strcmp (buffer, gmp_version) != 0) ? 1 : 0;
+]])],
+ [AC_MSG_RESULT(yes)
+ MPFR_CHECK_PRINTF_SPEC],
+ [AC_MSG_RESULT(no)
+ AC_MSG_WARN([==========================================================])
+ AC_MSG_WARN(['gmp.h' and 'libgmp' seem to have different versions or])
+ AC_MSG_WARN([we cannot run a program linked with GMP (if you cannot])
+ AC_MSG_WARN([see the version numbers above). A cause may be different])
+ AC_MSG_WARN([GMP versions with different ABI's or the use of --with-gmp])
+ AC_MSG_WARN([or --with-gmp-include with a system include directory])
+ AC_MSG_WARN([(such as /usr/include or /usr/local/include).])
+ AC_MSG_WARN([However since we can't use 'libtool' inside the configure,])
+ AC_MSG_WARN([we can't be sure. See 'config.log' for details.])
+ AC_MSG_WARN([==========================================================])
+ ],AC_MSG_RESULT([can not test])
+)
+LD_RUN_PATH="$saved_LD_RUN_PATH"
+
+dnl Warning! __gmpn_rootrem is an internal GMP symbol; thus its behavior
+dnl may change or this symbol may be removed in the future (without being
+dnl handled by the library versioning system, which is even worse, as this
+dnl can mean undetected incompatibilities in case of GMP library upgrade,
+dnl without rebuilding MPFR). So, this symbol must not be used, unless
+dnl WANT_GMP_INTERNALS is defined. Only the GMP public API should be used
+dnl by default, in particular by binary distributions. Moreover the check
+dnl below may yield an incorrect result as libtool isn't used in configure
+dnl (see above).
+dnl Same for __gmpn_sbpi1_divappr_q.
+AC_CHECK_FUNCS([__gmpn_rootrem __gmpn_sbpi1_divappr_q])
+
+dnl End of tests which need to link with GMP.
+fi
+
+dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR
+dnl and polluate (and slow down because libtool has to parse them) the build.
+if test -f confdefs.h; then
+ $SED '/#define PACKAGE_/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_STRING/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_ALLOCA /d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_DLFCN_H/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_MEM/d' <confdefs.h >confdefs.tmp
+ $SED '/#define STDC_HEADERS/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_STRTOL/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_STDLIB_H/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_UNISTD_H/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_STDC_HEADERS/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_LONG_DOUBLE/d' <confdefs.h >confdefs.tmp
+ $SED '/#define HAVE_SYS_STAT_H/d' <confdefs.tmp >confdefs.h
+ $SED '/#define HAVE_SYS_TYPES_H/d' <confdefs.h >confdefs.tmp
+ $SED '/#define PROTOTYPES/d' <confdefs.tmp >confdefs.h
+ $SED '/#define __PROTOTYPES/d' <confdefs.h >confdefs.tmp
+
+ mv confdefs.tmp confdefs.h
+fi
+
+if $EGREP -q -e '-dev$' $srcdir/VERSION; then
+ AC_SUBST([DATAFILES])dnl
+ DATAFILES=`echo \`$SED -n \
+ 's/^ *data_check *("\(data\/[[^"]]*\)".*/tests\/\1/p' \
+ $srcdir/tests/*.c\``
+fi
+
+dnl Output
+AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in])
+AC_OUTPUT
+
+dnl NEWS README AUTHORS Changelog
diff --git a/depcomp b/depcomp
new file mode 100755
index 0000000..25a39e6
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,708 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2012-03-27.16; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+# This program 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 2, or (at your option)
+# any later version.
+
+# This program 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputting dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'. On the theory
+## that the space means something, we add a space to the output as
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like '#:fec' to the end of the
+ # dependency line.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr "$nl" ' ' >> "$depfile"
+ echo >> "$depfile"
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts '$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+ # However on
+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\':
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ # tcc 0.9.26 (FIXME still under development at the moment of writing)
+ # will emit a similar output, but also prepend the continuation lines
+ # with horizontal tabulation characters.
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form 'foo.o: dependent.h',
+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
+ < "$tmpdepfile" > "$depfile"
+ sed '
+ s/[ '"$tab"'][ '"$tab"']*/ /g
+ s/^ *//
+ s/ *\\*$//
+ s/^[^:]*: *//
+ /^$/d
+ /:$/d
+ s/$/ :/
+ ' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for ':'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' "$nl" < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/doc/FAQ.html b/doc/FAQ.html
new file mode 100644
index 0000000..447e797
--- /dev/null
+++ b/doc/FAQ.html
@@ -0,0 +1,389 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+
+<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>Frequently Asked Questions about GNU MPFR</title>
+<style type="text/css">/*<![CDATA[*/
+/* Global stylesheet for visual media */
+
+html, body
+{
+ background: white;
+ color: black;
+}
+
+div.logo { float: right }
+div.logo img { border: 0 }
+
+div.footer img { border: 0 }
+
+dt
+{
+ margin-top: 2ex;
+ margin-bottom: 1ex;
+ font-weight: bolder;
+}
+
+/* For testing: dd { background: #ddddff } */
+
+table { margin: 0.5ex auto }
+
+li { margin-top: 0.5ex; margin-bottom: 0.5ex }
+
+dd + dd
+{
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-top: 0.5ex;
+ padding-bottom: 0;
+}
+
+li > p, dd > p
+{
+ margin-top: 0;
+ margin-bottom: 0;
+ padding-top: 0.5ex;
+ padding-bottom: 0.5ex;
+}
+
+.block-code code, code.block-code,
+.block-code samp, samp.block-code
+{
+ display: block;
+ padding: 0.5ex 0;
+ margin-left: 2em;
+}
+
+.nowrap { white-space: nowrap }
+
+/*
+dl.faq { counter-reset: faq }
+
+dl.faq dt:before
+{
+ counter-increment: faq;
+ content: counter(faq) ". ";
+}
+*/
+
+dl.faq dt { background: #dddddd }
+
+dl.faq dd
+{
+ border-left: 4px solid;
+ border-color: transparent;
+ margin-left: 0em;
+ padding-left: 1.5em;
+}
+
+dl.faq dt:target + dd
+{
+ border-left-color: #aaaaaa;
+}
+
+var.env { font-style: normal }
+/*]]>*/</style>
+</head>
+
+<body>
+
+<h1>Frequently Asked Questions about <cite><acronym>GNU</acronym> <acronym>MPFR</acronym></cite></h1>
+
+<p><strong>Important notice: Problems with a particular version of
+<cite><acronym>MPFR</acronym></cite> are discussed in the corresponding
+bugs page.</strong></p>
+
+<p>The latest version of this <acronym>FAQ</acronym> is available at
+<a href="http://www.mpfr.org/faq.html">http://www.mpfr.org/faq.html</a>.
+Please look at this version if possible.</p>
+
+<ol>
+<li><a href="#mpfr_vs_mpf">What are the differences between
+<cite><acronym>MPF</acronym></cite> from <cite><acronym>GMP</acronym></cite>
+and <cite><acronym>MPFR</acronym></cite>?</a></li>
+<li><a href="#mpf2mpfr">How to convert my program written using
+<cite><acronym>MPF</acronym></cite> to
+<cite><acronym>MPFR</acronym></cite>?</a></li>
+<li><a href="#no_libgmp">At configure time, I get the error: <q>libgmp not found or uses a different ABI.</q></a></li>
+<li><a href="#undef_ref1">I get undefined reference to <code>__gmp_get_memory_functions</code>.</a></li>
+<li><a href="#undef_ref2">When I link my program with
+<cite><acronym>MPFR</acronym></cite>, I get undefined reference
+to <code>__gmpXXXX</code>.</a></li>
+<li><a href="#crash_high_prec">My program crashes with high precisions.</a></li>
+<li><a href="#accuracy">Though I have increased the precision, the results
+are not more accurate.</a></li>
+<li><a href="#detect_mpfr">How can I detect <cite><acronym>MPFR</acronym></cite>
+installation using <cite>autoconf</cite> or <cite>pkg-config</cite>?</a></li>
+<li><a href="#cite">How to cite <cite><acronym>MPFR</acronym></cite> in a
+scientific publication?</a></li>
+<li><a href="#fpic">When I build <cite><acronym>MPFR</acronym></cite>, I get
+an error asking me to recompile with <samp>-fPIC</samp>.</a></li>
+</ol>
+
+<dl class="faq">
+
+<dt id="mpfr_vs_mpf">1. What are the differences between
+<cite><acronym>MPF</acronym></cite> from <cite><acronym>GMP</acronym></cite>
+and <cite><acronym>MPFR</acronym></cite>?</dt>
+
+<dd><p>The main differences are:</p>
+<ul>
+<li><p>The precision of a <cite><acronym>MPFR</acronym></cite> variable
+is the <em>exact</em> number of bits used for its mantissa, whereas in
+<cite><acronym>MPF</acronym></cite>, the precision requested by the user
+is a minimum value (<cite><acronym>MPF</acronym></cite> generally uses a
+higher precision). With the additional difference below, this implies that
+the <cite><acronym>MPFR</acronym></cite> results do not depend on the
+number of bits (16, 32, 64 or more) of the underlying architecture.</p></li>
+<li><p>As a consequence, <cite><acronym>MPFR</acronym></cite> uses a
+base-2 exponent, whereas in <cite><acronym>MPF</acronym></cite>, this
+is a base-2<sup>32</sup> or base-2<sup>64</sup> exponent, depending on
+the limb size. For this reason (and other internal ones), the maximum
+exponent range in <cite><acronym>MPFR</acronym></cite> is different
+(and smaller, if the exponent is represented by the same type as in
+<cite><acronym>MPF</acronym></cite>).</p></li>
+<li><p><cite><acronym>MPFR</acronym></cite> provides an additional rounding
+mode argument to its functions; furthermore, it is guaranteed that the
+result of any operation is the nearest possible floating-point value from
+the exact result (considering the input variables as exact values), taking
+into account the precision of the destination variable and the rounding
+mode. <cite><acronym>MPFR</acronym></cite> also says whether the rounded
+result is above or below the exact result.</p></li>
+<li><p><cite><acronym>MPFR</acronym></cite> supports much more functions
+(in particular transcendental functions such as exponentials, logarithms,
+trigonometric functions and so on) and special values: signed zeros,
+infinities, not-a-number (NaN).</p></li>
+</ul></dd>
+
+<dt id="mpf2mpfr">2. How to convert my program written using
+<cite><acronym>MPF</acronym></cite> to
+<cite><acronym>MPFR</acronym></cite>?</dt>
+
+<dd><p>You need to add <q><code>r</code></q> to the function names, and to
+specify the rounding mode (<code>MPFR_RNDN</code> for rounding to nearest,
+<code>MPFR_RNDZ</code> for rounding toward zero, <code>MPFR_RNDU</code>
+for rounding toward plus infinity, <code>MPFR_RNDD</code> for rounding
+toward minus infinity). You can also define macros as follows:
+<code class="block-code">#define mpf_add(a, b, c) mpfr_add(a, b, c, MPFR_RNDN)</code></p>
+<p>The header file <samp>mpf2mpfr.h</samp> from the
+<cite><acronym>MPFR</acronym></cite> distribution automatically
+redefines all <cite><acronym>MPF</acronym></cite> functions in this
+way, using the default <cite><acronym>MPFR</acronym></cite> rounding
+mode. Thus you simply need to add the following line in all your files
+using <cite><acronym>MPF</acronym></cite> functions:
+<code class="block-code">#include &lt;mpf2mpfr.h&gt;</code>
+just after the <samp>gmp.h</samp> and <samp>mpfr.h</samp>
+header files. If the program uses <cite><acronym>MPF</acronym></cite>
+internals (such as direct access to <code>__mpf_struct</code> members),
+additional changes will be needed.</p></dd>
+
+<dt id="no_libgmp">3. At configure time, I get the error: <q>libgmp not found or uses a different ABI.</q></dt>
+
+<dd><p>This test (<samp>checking for __gmpz_init in -lgmp</samp>) comes
+after the <samp>gmp.h</samp> detection. The failure occurs either because
+the <cite><acronym>GMP</acronym></cite> library could not be found
+(as it is not in the provided library search paths) or because the
+<cite><acronym>GMP</acronym></cite> library that was found does not have
+the expected <acronym title="Application Binary Interface">ABI</acronym>
+(<abbr>e.g.</abbr> 32-bit <abbr>vs</abbr> 64-bit). The former problem can be
+due to the fact that a static build of <cite><acronym>MPFR</acronym></cite>
+was requested while only a shared <cite><acronym>GMP</acronym></cite> library
+is installed (or the opposite, but another error can also show up in this
+case, see the <a href="#fpic">question about <samp>-fPIC</samp></a>). The
+latter problem can have several causes:</p>
+<ul>
+<li>A wrong libgmp library has been picked up. This can occur if you have
+several <cite><acronym>GMP</acronym></cite> versions installed on the
+machine and something is wrong with the provided library search paths.</li>
+<li>Wrong compiler options (<samp>CFLAGS</samp>) were given. In general, the
+presence or absence of the <samp>-m64</samp> compiler option must match the
+library <acronym title="Application Binary Interface">ABI</acronym>.</li>
+<li>A wrong <samp>gmp.h</samp> file has been picked up (if you have several
+<cite><acronym>GMP</acronym></cite> versions installed). Indeed, by default,
+<cite><acronym>MPFR</acronym></cite> gets the compiler options from the
+<samp>gmp.h</samp> file (with <cite><acronym>GMP</acronym></cite> 4.2.3
+or later); this is needed because <cite><acronym>GMP</acronym></cite> does
+not necessarily use the default <acronym>ABI</acronym>. The consequence is
+that if the <samp>gmp.h</samp> file is associated with a library using a
+different <acronym>ABI</acronym>, the <acronym>ABI</acronym>-related options
+will be incorrect. Hence the failure.</li>
+</ul>
+<p>Note: The <samp>config.log</samp> output gives more information
+than the error message. In particular, see the output of the test:
+<samp>checking for CC and CFLAGS in gmp.h</samp>; it should give you
+the default compiler options (from <samp>gmp.h</samp>).</p>
+
+<p>See also the answer to the <a href="#undef_ref1">next question</a>.</p></dd>
+
+<dt id="undef_ref1">4. I get undefined reference to <code>__gmp_get_memory_functions</code>.</dt>
+
+<dd><p>Note: this was mainly a problem when upgrading from
+<cite><acronym>GMP</acronym></cite> 4.1.4 to a later version,
+but information given below may still be useful in other cases,
+when several <cite><acronym>GMP</acronym></cite> libraries are
+installed on the same machine.</p>
+
+<p>If you get such an error, in particular when running
+<samp>make check</samp>, then this probably means that you are using
+the header file from <cite><acronym>GMP</acronym></cite> 4.2.x but the
+<cite><acronym>GMP</acronym></cite> 4.1.4 library. This can happen if
+several <cite><acronym>GMP</acronym></cite> versions are installed on
+your machine (<abbr>e.g.</abbr>, one provided by the system in
+<samp>/usr/{include,lib}</samp> and a new one installed by the owner or
+administrator of the machine in <samp>/usr/local/{include,lib}</samp>)
+and your include and library search paths are inconsistent. On various
+<acronym>GNU</acronym>/Linux machines, this is unfortunately the case
+by default (<samp>/usr/local/include</samp> is in the default include
+search path, but <samp>/usr/local/lib</samp> is <em>not</em> in the
+default library search path). Typical errors are:
+<samp class="block-code">undefined reference to `__gmp_get_memory_functions'</samp>
+in <samp>make check</samp>. The best solution is to add
+<samp>/usr/local/include</samp> to your <var class="env">C_INCLUDE_PATH</var>
+environment variable and to add <samp>/usr/local/lib</samp> to your
+<var class="env">LIBRARY_PATH</var> and <var class="env">LD_LIBRARY_PATH</var>
+environment variables (and/or <var class="env">LD_RUN_PATH</var>).
+Alternatively, you can use <samp>--with-gmp*</samp> configure options,
+<abbr>e.g.</abbr> <samp>--with-gmp=/usr/local</samp>, but <strong>this is
+not guaranteed to work</strong> (in particular with <samp>gcc</samp> and
+system directories such as <samp>/usr</samp> or <samp>/usr/local</samp>),
+and other software that uses <cite><acronym>GMP</acronym></cite> and/or
+<cite><acronym>MPFR</acronym></cite> will need correct paths too;
+environment variables allow you to set them in a global way.</p>
+<p>Other information can be given in the <samp>INSTALL</samp> file and
+<samp>ld</samp> manual. Please look at them for more details. See also
+the <a href="#undef_ref2">next question</a>.</p></dd>
+
+<dt id="undef_ref2">5. When I link my program with
+<cite><acronym>MPFR</acronym></cite>, I get undefined reference
+to <code>__gmpXXXX</code>.</dt>
+
+<dd><p>Link your program with <cite><acronym>GMP</acronym></cite>. Assuming
+that your program is <samp>foo.c</samp>, you should link it using:
+<samp class="block-code">cc link.c -lmpfr -lgmp</samp>
+<cite><acronym>MPFR</acronym></cite> library reference (<samp>-lmpfr</samp>)
+should be before <cite><acronym>GMP</acronym></cite>'s one
+(<samp>-lgmp</samp>). Another solution is, with <acronym>GNU</acronym>
+<samp>ld</samp>, to give all the libraries inside a group:
+<samp class="block-code">gcc link.c -Wl,--start-group libgmp.a libmpfr.a -Wl,--end-group</samp>
+See <samp>INSTALL</samp> file and <samp>ld</samp> manual for more
+details.</p>
+<p>If you used correct link options, but still get an error, this may mean
+that your include and library search paths are inconsistent. Please see the
+<a href="#undef_ref1">previous question</a>.</p></dd>
+
+<dt id="crash_high_prec">6. My program crashes with high precisions.</dt>
+
+<dd><p>Your stack size limit may be too small; indeed, by default,
+<cite><acronym>GMP</acronym></cite> 4.1.4 and below allocates all
+temporary results on the stack, and in very high precisions, this
+limit may be reached. You can solve this problem in different ways:</p>
+<ul>
+<li><p>You can upgrade to <cite><acronym>GMP</acronym></cite> 4.2 (or above),
+which now makes temporary allocations on the stack only when they are
+small.</p></li>
+<li><p>You can increase the stack size limit with the <samp>limit</samp>,
+<samp>unlimit</samp> or <samp>ulimit</samp> command, depending on your
+shell. This may fail on some systems, where the maximum stack size cannot
+be increased above some value.</p></li>
+<li><p>You can rebuild both <cite><acronym>GMP</acronym></cite> and
+<cite><acronym>MPFR</acronym></cite> to use another allocation method.</p></li>
+</ul></dd>
+
+<dt id="accuracy">7. Though I have increased the precision, the results
+are not more accurate.</dt>
+
+<dd><p>The reason may be the use of C floating-point numbers. If you want
+to store a floating-point constant to a <code>mpfr_t</code>, you should use
+<code>mpfr_set_str</code> (or one of the <cite><acronym>MPFR</acronym></cite>
+constant functions, such as <code>mpfr_const_pi</code> for &#960;) instead
+of <code>mpfr_set_d</code> or <code>mpfr_set_ld</code>. Otherwise the
+floating-point constant will be first converted into a reduced-precision
+(<abbr>e.g.</abbr>, 53-bit) binary number before
+<cite><acronym>MPFR</acronym></cite> can work with it. This is the case
+in particular for most exact decimal numbers, such as 0.17, which are
+not exactly representable in binary.</p>
+<p>Also remember that <cite><acronym>MPFR</acronym></cite> does not track
+the accuracy of the results: copying a value <var>x</var> to <var>y</var>
+with <code>mpfr_set (y, x, MPFR_RNDN)</code> where the variable <var>y</var>
+is more precise than the variable <var>x</var> will not make it more
+accurate; the (binary) value will remain unchanged.</p></dd>
+
+<dt id="detect_mpfr">8. How can I detect <cite><acronym>MPFR</acronym></cite>
+installation using <cite>autoconf</cite> or <cite>pkg-config</cite>?</dt>
+
+<dd><p>The <cite><acronym>MPFR</acronym></cite> team does not currently
+recommend any <cite>autoconf</cite> code, but a section will later
+be added to the <cite><acronym>MPFR</acronym></cite> manual. The
+<cite><acronym>MPFR</acronym></cite> team does not wish to support
+<cite>pkg-config</cite> yet.</p></dd>
+
+<dt id="cite">9. How to cite <cite><acronym>MPFR</acronym></cite> in a
+scientific publication?</dt>
+
+<dd><p>To properly cite <cite><acronym>MPFR</acronym></cite> in a scientific
+publication, please cite the
+<a href="http://doi.acm.org/10.1145/1236463.1236468"><acronym title="Association for Computing Machinery">ACM</acronym>
+<acronym title="Transactions on Mathematical Software">TOMS</acronym>
+paper</a>
+(<a href="http://toms.acm.org/cgi/TOMSbibget.cgi?Fousse:2007:MMP">BibTeX</a>)
+and/or the library web page
+<a href="http://www.mpfr.org/">http://www.mpfr.org</a>. If your publication
+is related to a particular release of <cite><acronym>MPFR</acronym></cite>,
+for example if you report timings, please also indicate the release number
+for future reference.</p></dd>
+
+<dt id="fpic">10. When I build <cite><acronym>MPFR</acronym></cite>, I get
+an error asking me to recompile with <samp>-fPIC</samp>.</dt>
+
+<dd><p>A typical error looks like:</p>
+<p><tt>/usr/bin/ld: <em>/path/to/</em>libgmp.a(realloc.o): relocation
+R_X86_64_32 against `.rodata.str1.1' can not be used when making a
+shared object; recompile with -fPIC<br />
+<em>/path/to/</em>libgmp.a: could not read symbols: Bad value<br />
+collect2: ld returned 1 exit status</tt></p>
+<p>The probable reason is that you tried to build
+<cite><acronym>MPFR</acronym></cite> with the shared library enabled (this
+is the default), while only a static <cite><acronym>GMP</acronym></cite>
+library could be found. To solve this problem, either rebuild and reinstall
+<cite><acronym>GMP</acronym></cite> without the <samp>--disable-shared</samp>
+configure option, or configure <cite><acronym>MPFR</acronym></cite> with
+<samp>--disable-shared</samp>. If you did this and still get the above
+error, the cause may be conflicting <cite><acronym>GMP</acronym></cite>
+versions installed on your system; please check that your search path
+settings are correct.</p>
+<p>Additional note about the last sentence: Under <acronym>GNU</acronym>/Linux
+(for instance), the linker takes the first library found in the library search
+path, whether it is dynamic or static. The default behavior under darwin is
+different, but <cite><acronym>MPFR</acronym></cite> will change it.</p></dd>
+<!-- Reference concerning darwin: see MPFR_LD_SEARCH_PATHS_FIRST
+ in MPFR's configure.{ac,in} and acinclude.m4 -->
+
+</dl>
+
+</body>
+
+</html>
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..57af60e
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,18 @@
+# Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+
+dist_doc_DATA = FAQ.html
+
+info_TEXINFOS = mpfr.texi
+
+mpfr_TEXINFOS = fdl.texi
+
+MAKEINFOFLAGS = --enable-encoding
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..d091060
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,716 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
+
+# Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+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@
+subdir = doc
+DIST_COMMON = $(dist_doc_DATA) $(mpfr_TEXINFOS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in texinfo.tex
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+INFO_DEPS = $(srcdir)/mpfr.info
+am__TEXINFO_TEX_DIR = $(srcdir)
+DVIS = mpfr.dvi
+PDFS = mpfr.pdf
+PSS = mpfr.ps
+HTMLS = mpfr.html
+TEXINFOS = mpfr.texi
+TEXI2DVI = texi2dvi
+TEXI2PDF = $(TEXI2DVI) --pdf --batch
+MAKEINFOHTML = $(MAKEINFO) --html
+AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
+DVIPS = dvips
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(docdir)"
+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__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+DATA = $(dist_doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATAFILES = @DATAFILES@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+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@
+LIBMPFR_LDFLAGS = @LIBMPFR_LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MPFR_LDFLAGS = @MPFR_LDFLAGS@
+MPFR_LIBM = @MPFR_LIBM@
+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@
+TUNE_LIBS = @TUNE_LIBS@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+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@
+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@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_doc_DATA = FAQ.html
+info_TEXINFOS = mpfr.texi
+mpfr_TEXINFOS = fdl.texi
+MAKEINFOFLAGS = --enable-encoding
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .dvi .html .info .pdf .ps .texi
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+.texi.info:
+ restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+ am__cwd=`pwd` && $(am__cd) $(srcdir) && \
+ rm -rf $$backupdir && mkdir $$backupdir && \
+ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
+ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
+ done; \
+ else :; fi && \
+ cd "$$am__cwd"; \
+ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $@ $<; \
+ then \
+ rc=0; \
+ $(am__cd) $(srcdir); \
+ else \
+ rc=$$?; \
+ $(am__cd) $(srcdir) && \
+ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+ fi; \
+ rm -rf $$backupdir; exit $$rc
+
+.texi.dvi:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2DVI) $<
+
+.texi.pdf:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2PDF) $<
+
+.texi.html:
+ rm -rf $(@:.html=.htp)
+ if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $(@:.html=.htp) $<; \
+ then \
+ rm -rf $@; \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ else \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
+ exit 1; \
+ fi
+$(srcdir)/mpfr.info: mpfr.texi $(mpfr_TEXINFOS)
+mpfr.dvi: mpfr.texi $(mpfr_TEXINFOS)
+mpfr.pdf: mpfr.texi $(mpfr_TEXINFOS)
+mpfr.html: mpfr.texi $(mpfr_TEXINFOS)
+.dvi.ps:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ $(DVIPS) -o $@ $<
+
+uninstall-dvi-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dvidir)/$$f"; \
+ done
+
+uninstall-html-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
+ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
+ done
+
+uninstall-info-am:
+ @$(PRE_UNINSTALL)
+ @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
+ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
+ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
+ done; \
+ else :; fi
+ @$(NORMAL_UNINSTALL)
+ @list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
+ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
+ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
+ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
+ else :; fi); \
+ done
+
+uninstall-pdf-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+uninstall-ps-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(psdir)/$$f"; \
+ done
+
+dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; \
+ for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$base; then d=.; else d=$(srcdir); fi; \
+ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
+ if test -f $$file; then \
+ relfile=`expr "$$file" : "$$d/\(.*\)"`; \
+ test -f "$(distdir)/$$relfile" || \
+ cp -p $$file "$(distdir)/$$relfile"; \
+ else :; fi; \
+ done; \
+ done
+
+mostlyclean-aminfo:
+ -rm -rf mpfr.aux mpfr.cp mpfr.cps mpfr.fn mpfr.fns mpfr.ky mpfr.kys \
+ mpfr.log mpfr.pg mpfr.pgs mpfr.tmp mpfr.toc mpfr.tp mpfr.vr \
+ mpfr.vrs
+
+clean-aminfo:
+ -test -z "mpfr.dvi mpfr.pdf mpfr.ps mpfr.html" \
+ || rm -rf mpfr.dvi mpfr.pdf mpfr.ps mpfr.html
+
+maintainer-clean-aminfo:
+ @list='$(INFO_DEPS)'; for i in $$list; do \
+ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
+ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
+ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
+ done
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+ fi; \
+ 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)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-info
+check-am: all-am
+check: check-am
+all-am: Makefile $(INFO_DEPS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(docdir)"; 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:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+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)
+
+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-am: clean-aminfo clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am: $(DVIS)
+
+html: html-am
+
+html-am: $(HTMLS)
+
+info: info-am
+
+info-am: $(INFO_DEPS)
+
+install-data-am: install-dist_docDATA install-info-am
+
+install-dvi: install-dvi-am
+
+install-dvi-am: $(DVIS)
+ @$(NORMAL_INSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
+ fi; \
+ 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)$(dvidir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
+ done
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am: $(HTMLS)
+ @$(NORMAL_INSTALL)
+ @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ $(am__strip_dir) \
+ d2=$$d$$p; \
+ if test -d "$$d2"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+ else \
+ list2="$$list2 $$d2"; \
+ fi; \
+ done; \
+ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
+ done; }
+install-info: install-info-am
+
+install-info-am: $(INFO_DEPS)
+ @$(NORMAL_INSTALL)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
+ fi; \
+ for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
+ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
+ if test -f $$ifile; then \
+ echo "$$ifile"; \
+ else : ; fi; \
+ done; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
+ @$(POST_INSTALL)
+ @if $(am__can_run_installinfo); then \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
+ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
+ done; \
+ else : ; fi
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am: $(PDFS)
+ @$(NORMAL_INSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
+ fi; \
+ 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)$(pdfdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
+install-ps: install-ps-am
+
+install-ps-am: $(PSS)
+ @$(NORMAL_INSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
+ fi; \
+ 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)$(psdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-aminfo \
+ maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am: $(PDFS)
+
+ps: ps-am
+
+ps-am: $(PSS)
+
+uninstall-am: uninstall-dist_docDATA uninstall-dvi-am \
+ uninstall-html-am uninstall-info-am uninstall-pdf-am \
+ uninstall-ps-am
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-aminfo clean-generic \
+ clean-libtool dist-info distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-aminfo maintainer-clean-generic mostlyclean \
+ mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-dist_docDATA \
+ uninstall-dvi-am uninstall-html-am uninstall-info-am \
+ uninstall-pdf-am uninstall-ps-am
+
+
+# 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:
diff --git a/doc/fdl.texi b/doc/fdl.texi
new file mode 100644
index 0000000..694e23e
--- /dev/null
+++ b/doc/fdl.texi
@@ -0,0 +1,454 @@
+@c MPFR tweak: Have this in mpfr.texi to help texinfo-mode
+@c @node GNU Free Documentation License
+@c @appendixsec GNU Free Documentation License
+
+@cindex GNU Free Documentation License
+@center Version 1.2, November 2002
+
+@display
+Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, 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.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The ``Document'', below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as ``you''. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+@sc{ascii} without markup, Texinfo input format, La@TeX{} input
+format, @acronym{SGML} or @acronym{XML} using a publicly available
+@acronym{DTD}, and standard-conforming simple @acronym{HTML},
+PostScript or @acronym{PDF} designed for human modification. Examples
+of transparent image formats include @acronym{PNG}, @acronym{XCF} and
+@acronym{JPG}. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, @acronym{SGML} or
+@acronym{XML} for which the @acronym{DTD} and/or processing tools are
+not generally available, and the machine-generated @acronym{HTML},
+PostScript or @acronym{PDF} produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+@enumerate A
+@item
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+@item
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+@item
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+@item
+Preserve all the copyright notices of the Document.
+
+@item
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+@item
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+@item
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
+@item
+Include an unaltered copy of this License.
+
+@item
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+@item
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+@item
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+@item
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+@item
+Delete any section Entitled ``Endorsements''. Such a section
+may not be included in the Modified Version.
+
+@item
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
+@item
+Preserve any Warranty Disclaimers.
+@end enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''. You must delete all
+sections Entitled ``Endorsements.''
+
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document 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.
+
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation 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. See
+@uref{http://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+@end enumerate
+
+@page
+@c MPFR tweak: Use @appendixsec
+@c @appendixsubsec ADDENDUM: How to use this License for your documents
+@appendixsec ADDENDUM: How to Use This License For Your Documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+ Copyright (C) @var{year} @var{your name}.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+@end group
+@end smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the ``with...Texts.'' line with this:
+
+@smallexample
+@group
+ with the Invariant Sections being @var{list their titles}, with
+ the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+ being @var{list}.
+@end group
+@end smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+@c Local Variables:
+@c ispell-local-pdict: "ispell-dict"
+@c End:
+
diff --git a/doc/mpfr.info b/doc/mpfr.info
new file mode 100644
index 0000000..ef69621
--- /dev/null
+++ b/doc/mpfr.info
@@ -0,0 +1,4266 @@
+This is mpfr.info, produced by makeinfo version 4.13 from mpfr.texi.
+
+This manual documents how to install and use the Multiple Precision
+Floating-Point Reliable Library, version 3.1.2.
+
+ Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+2013 Free Software Foundation, Inc.
+
+ Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License, Version
+1.2 or any later version published by the Free Software Foundation;
+with no Invariant Sections, with no Front-Cover Texts, and with no
+Back-Cover Texts. A copy of the license is included in *note GNU Free
+Documentation License::.
+
+INFO-DIR-SECTION Software libraries
+START-INFO-DIR-ENTRY
+* mpfr: (mpfr). Multiple Precision Floating-Point Reliable Library.
+END-INFO-DIR-ENTRY
+
+
+File: mpfr.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir)
+
+GNU MPFR
+********
+
+ This manual documents how to install and use the Multiple Precision
+Floating-Point Reliable Library, version 3.1.2.
+
+ Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+2013 Free Software Foundation, Inc.
+
+ Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License, Version
+1.2 or any later version published by the Free Software Foundation;
+with no Invariant Sections, with no Front-Cover Texts, and with no
+Back-Cover Texts. A copy of the license is included in *note GNU Free
+Documentation License::.
+
+
+* Menu:
+
+* Copying:: MPFR Copying Conditions (LGPL).
+* Introduction to MPFR:: Brief introduction to GNU MPFR.
+* Installing MPFR:: How to configure and compile the MPFR library.
+* Reporting Bugs:: How to usefully report bugs.
+* MPFR Basics:: What every MPFR user should now.
+* MPFR Interface:: MPFR functions and macros.
+* API Compatibility:: API compatibility with previous MPFR versions.
+* Contributors::
+* References::
+* GNU Free Documentation License::
+* Concept Index::
+* Function and Type Index::
+
+
+File: mpfr.info, Node: Copying, Next: Introduction to MPFR, Prev: Top, Up: Top
+
+MPFR Copying Conditions
+***********************
+
+The GNU MPFR library (or MPFR for short) is "free"; this means that
+everyone is free to use it and free to redistribute it on a free basis.
+The library is not in the public domain; it is copyrighted and there
+are restrictions on its distribution, but these restrictions are
+designed to permit everything that a good cooperating citizen would
+want to do. What is not allowed is to try to prevent others from
+further sharing any version of this library that they might get from
+you.
+
+ Specifically, we want to make sure that you have the right to give
+away copies of the library, that you receive source code or else can
+get it if you want it, that you can change this library or use pieces
+of it in new free programs, and that you know you can do these things.
+
+ To make sure that everyone has such rights, we have to forbid you to
+deprive anyone else of these rights. For example, if you distribute
+copies of the GNU MPFR library, you must give the recipients all the
+rights that you have. You must make sure that they, too, receive or
+can get the source code. And you must tell them their rights.
+
+ Also, for our own protection, we must make certain that everyone
+finds out that there is no warranty for the GNU MPFR library. If it is
+modified by someone else and passed on, we want their recipients to
+know that what they have is not what we distributed, so that any
+problems introduced by others will not reflect on our reputation.
+
+ The precise conditions of the license for the GNU MPFR library are
+found in the Lesser General Public License that accompanies the source
+code. See the file COPYING.LESSER.
+
+
+File: mpfr.info, Node: Introduction to MPFR, Next: Installing MPFR, Prev: Copying, Up: Top
+
+1 Introduction to MPFR
+**********************
+
+MPFR is a portable library written in C for arbitrary precision
+arithmetic on floating-point numbers. It is based on the GNU MP library.
+It aims to provide a class of floating-point numbers with precise
+semantics. The main characteristics of MPFR, which make it differ from
+most arbitrary precision floating-point software tools, are:
+
+ * the MPFR code is portable, i.e., the result of any operation does
+ not depend on the machine word size `mp_bits_per_limb' (64 on most
+ current processors);
+
+ * the precision in bits can be set _exactly_ to any valid value for
+ each variable (including very small precision);
+
+ * MPFR provides the four rounding modes from the IEEE 754-1985
+ standard, plus away-from-zero, as well as for basic operations as
+ for other mathematical functions.
+
+ In particular, with a precision of 53 bits, MPFR is able to exactly
+reproduce all computations with double-precision machine floating-point
+numbers (e.g., `double' type in C, with a C implementation that
+rigorously follows Annex F of the ISO C99 standard and `FP_CONTRACT'
+pragma set to `OFF') on the four arithmetic operations and the square
+root, except the default exponent range is much wider and subnormal
+numbers are not implemented (but can be emulated).
+
+ This version of MPFR is released under the GNU Lesser General Public
+License, version 3 or any later version. It is permitted to link MPFR
+to most non-free programs, as long as when distributing them the MPFR
+source code and a means to re-link with a modified MPFR library is
+provided.
+
+1.1 How to Use This Manual
+==========================
+
+Everyone should read *note MPFR Basics::. If you need to install the
+library yourself, you need to read *note Installing MPFR::, too. To
+use the library you will need to refer to *note MPFR Interface::.
+
+ The rest of the manual can be used for later reference, although it
+is probably a good idea to glance through it.
+
+
+File: mpfr.info, Node: Installing MPFR, Next: Reporting Bugs, Prev: Introduction to MPFR, Up: Top
+
+2 Installing MPFR
+*****************
+
+The MPFR library is already installed on some GNU/Linux distributions,
+but the development files necessary to the compilation such as `mpfr.h'
+are not always present. To check that MPFR is fully installed on your
+computer, you can check the presence of the file `mpfr.h' in
+`/usr/include', or try to compile a small program having `#include
+<mpfr.h>' (since `mpfr.h' may be installed somewhere else). For
+instance, you can try to compile:
+
+ #include <stdio.h>
+ #include <mpfr.h>
+ int main (void)
+ {
+ printf ("MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n",
+ mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
+ MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
+ return 0;
+ }
+
+with
+
+ cc -o version version.c -lmpfr -lgmp
+
+and if you get errors whose first line looks like
+
+ version.c:2:19: error: mpfr.h: No such file or directory
+
+then MPFR is probably not installed. Running this program will give you
+the MPFR version.
+
+ If MPFR is not installed on your computer, or if you want to install
+a different version, please follow the steps below.
+
+2.1 How to Install
+==================
+
+Here are the steps needed to install the library on Unix systems (more
+details are provided in the `INSTALL' file):
+
+ 1. To build MPFR, you first have to install GNU MP (version 4.1 or
+ higher) on your computer. You need a C compiler, preferably GCC,
+ but any reasonable compiler should work. And you need the
+ standard Unix `make' command, plus some other standard Unix
+ utility commands.
+
+ Then, in the MPFR build directory, type the following commands.
+
+ 2. `./configure'
+
+ This will prepare the build and setup the options according to
+ your system. You can give options to specify the install
+ directories (instead of the default `/usr/local'), threading
+ support, and so on. See the `INSTALL' file and/or the output of
+ `./configure --help' for more information, in particular if you
+ get error messages.
+
+ 3. `make'
+
+ This will compile MPFR, and create a library archive file
+ `libmpfr.a'. On most platforms, a dynamic library will be
+ produced too.
+
+ 4. `make check'
+
+ This will make sure MPFR was built correctly. If you get error
+ messages, please report this to the MPFR mailing-list
+ `mpfr@inria.fr'. (*Note Reporting Bugs::, for information on what
+ to include in useful bug reports.)
+
+ 5. `make install'
+
+ This will copy the files `mpfr.h' and `mpf2mpfr.h' to the directory
+ `/usr/local/include', the library files (`libmpfr.a' and possibly
+ others) to the directory `/usr/local/lib', the file `mpfr.info' to
+ the directory `/usr/local/share/info', and some other documentation
+ files to the directory `/usr/local/share/doc/mpfr' (or if you
+ passed the `--prefix' option to `configure', using the prefix
+ directory given as argument to `--prefix' instead of `/usr/local').
+
+2.2 Other `make' Targets
+========================
+
+There are some other useful make targets:
+
+ * `mpfr.info' or `info'
+
+ Create or update an info version of the manual, in `mpfr.info'.
+
+ This file is already provided in the MPFR archives.
+
+ * `mpfr.pdf' or `pdf'
+
+ Create a PDF version of the manual, in `mpfr.pdf'.
+
+ * `mpfr.dvi' or `dvi'
+
+ Create a DVI version of the manual, in `mpfr.dvi'.
+
+ * `mpfr.ps' or `ps'
+
+ Create a Postscript version of the manual, in `mpfr.ps'.
+
+ * `mpfr.html' or `html'
+
+ Create a HTML version of the manual, in several pages in the
+ directory `doc/mpfr.html'; if you want only one output HTML file,
+ then type `makeinfo --html --no-split mpfr.texi' from the `doc'
+ directory instead.
+
+ * `clean'
+
+ Delete all object files and archive files, but not the
+ configuration files.
+
+ * `distclean'
+
+ Delete all generated files not included in the distribution.
+
+ * `uninstall'
+
+ Delete all files copied by `make install'.
+
+2.3 Build Problems
+==================
+
+In case of problem, please read the `INSTALL' file carefully before
+reporting a bug, in particular section "In case of problem". Some
+problems are due to bad configuration on the user side (not specific to
+MPFR). Problems are also mentioned in the FAQ
+`http://www.mpfr.org/faq.html'.
+
+ Please report problems to the MPFR mailing-list `mpfr@inria.fr'.
+*Note Reporting Bugs::. Some bug fixes are available on the MPFR 3.1.2
+web page `http://www.mpfr.org/mpfr-3.1.2/'.
+
+2.4 Getting the Latest Version of MPFR
+======================================
+
+The latest version of MPFR is available from
+`ftp://ftp.gnu.org/gnu/mpfr/' or `http://www.mpfr.org/'.
+
+
+File: mpfr.info, Node: Reporting Bugs, Next: MPFR Basics, Prev: Installing MPFR, Up: Top
+
+3 Reporting Bugs
+****************
+
+If you think you have found a bug in the MPFR library, first have a look
+on the MPFR 3.1.2 web page `http://www.mpfr.org/mpfr-3.1.2/' and the
+FAQ `http://www.mpfr.org/faq.html': perhaps this bug is already known,
+in which case you may find there a workaround for it. You might also
+look in the archives of the MPFR mailing-list:
+`https://sympa.inria.fr/sympa/arc/mpfr'. Otherwise, please investigate
+and report it. We have made this library available to you, and it is
+not to ask too much from you, to ask you to report the bugs that you
+find.
+
+ There are a few things you should think about when you put your bug
+report together.
+
+ You have to send us a test case that makes it possible for us to
+reproduce the bug, i.e., a small self-content program, using no other
+library than MPFR. Include instructions on how to run the test case.
+
+ You also have to explain what is wrong; if you get a crash, or if
+the results you get are incorrect and in that case, in what way.
+
+ Please include compiler version information in your bug report. This
+can be extracted using `cc -V' on some machines, or, if you're using
+GCC, `gcc -v'. Also, include the output from `uname -a' and the MPFR
+version (the GMP version may be useful too). If you get a failure
+while running `make' or `make check', please include the `config.log'
+file in your bug report.
+
+ If your bug report is good, we will do our best to help you to get a
+corrected version of the library; if the bug report is poor, we will
+not do anything about it (aside of chiding you to send better bug
+reports).
+
+ Send your bug report to the MPFR mailing-list `mpfr@inria.fr'.
+
+ If you think something in this manual is unclear, or downright
+incorrect, or if the language needs to be improved, please send a note
+to the same address.
+
+
+File: mpfr.info, Node: MPFR Basics, Next: MPFR Interface, Prev: Reporting Bugs, Up: Top
+
+4 MPFR Basics
+*************
+
+* Menu:
+
+* Headers and Libraries::
+* Nomenclature and Types::
+* MPFR Variable Conventions::
+* Rounding Modes::
+* Floating-Point Values on Special Numbers::
+* Exceptions::
+* Memory Handling::
+
+
+File: mpfr.info, Node: Headers and Libraries, Next: Nomenclature and Types, Prev: MPFR Basics, Up: MPFR Basics
+
+4.1 Headers and Libraries
+=========================
+
+All declarations needed to use MPFR are collected in the include file
+`mpfr.h'. It is designed to work with both C and C++ compilers. You
+should include that file in any program using the MPFR library:
+
+ #include <mpfr.h>
+
+ Note however that prototypes for MPFR functions with `FILE *'
+parameters are provided only if `<stdio.h>' is included too (before
+`mpfr.h'):
+
+ #include <stdio.h>
+ #include <mpfr.h>
+
+ Likewise `<stdarg.h>' (or `<varargs.h>') is required for prototypes
+with `va_list' parameters, such as `mpfr_vprintf'.
+
+ And for any functions using `intmax_t', you must include
+`<stdint.h>' or `<inttypes.h>' before `mpfr.h', to allow `mpfr.h' to
+define prototypes for these functions. Moreover, users of C++ compilers
+under some platforms may need to define `MPFR_USE_INTMAX_T' (and should
+do it for portability) before `mpfr.h' has been included; of course, it
+is possible to do that on the command line, e.g., with
+`-DMPFR_USE_INTMAX_T'.
+
+ Note: If `mpfr.h' and/or `gmp.h' (used by `mpfr.h') are included
+several times (possibly from another header file), `<stdio.h>' and/or
+`<stdarg.h>' (or `<varargs.h>') should be included *before the first
+inclusion* of `mpfr.h' or `gmp.h'. Alternatively, you can define
+`MPFR_USE_FILE' (for MPFR I/O functions) and/or `MPFR_USE_VA_LIST' (for
+MPFR functions with `va_list' parameters) anywhere before the last
+inclusion of `mpfr.h'. As a consequence, if your file is a public
+header that includes `mpfr.h', you need to use the latter method.
+
+ When calling a MPFR macro, it is not allowed to have previously
+defined a macro with the same name as some keywords (currently `do',
+`while' and `sizeof').
+
+ You can avoid the use of MPFR macros encapsulating functions by
+defining the `MPFR_USE_NO_MACRO' macro before `mpfr.h' is included. In
+general this should not be necessary, but this can be useful when
+debugging user code: with some macros, the compiler may emit spurious
+warnings with some warning options, and macros can prevent some
+prototype checking.
+
+ All programs using MPFR must link against both `libmpfr' and
+`libgmp' libraries. On a typical Unix-like system this can be done
+with `-lmpfr -lgmp' (in that order), for example:
+
+ gcc myprogram.c -lmpfr -lgmp
+
+ MPFR is built using Libtool and an application can use that to link
+if desired, *note GNU Libtool: (libtool.info)Top.
+
+ If MPFR has been installed to a non-standard location, then it may be
+necessary to set up environment variables such as `C_INCLUDE_PATH' and
+`LIBRARY_PATH', or use `-I' and `-L' compiler options, in order to
+point to the right directories. For a shared library, it may also be
+necessary to set up some sort of run-time library path (e.g.,
+`LD_LIBRARY_PATH') on some systems. Please read the `INSTALL' file for
+additional information.
+
+
+File: mpfr.info, Node: Nomenclature and Types, Next: MPFR Variable Conventions, Prev: Headers and Libraries, Up: MPFR Basics
+
+4.2 Nomenclature and Types
+==========================
+
+A "floating-point number", or "float" for short, is an arbitrary
+precision significand (also called mantissa) with a limited precision
+exponent. The C data type for such objects is `mpfr_t' (internally
+defined as a one-element array of a structure, and `mpfr_ptr' is the C
+data type representing a pointer to this structure). A floating-point
+number can have three special values: Not-a-Number (NaN) or plus or
+minus Infinity. NaN represents an uninitialized object, the result of
+an invalid operation (like 0 divided by 0), or a value that cannot be
+determined (like +Infinity minus +Infinity). Moreover, like in the IEEE
+754 standard, zero is signed, i.e., there are both +0 and -0; the
+behavior is the same as in the IEEE 754 standard and it is generalized
+to the other functions supported by MPFR. Unless documented otherwise,
+the sign bit of a NaN is unspecified.
+
+The "precision" is the number of bits used to represent the significand
+of a floating-point number; the corresponding C data type is
+`mpfr_prec_t'. The precision can be any integer between
+`MPFR_PREC_MIN' and `MPFR_PREC_MAX'. In the current implementation,
+`MPFR_PREC_MIN' is equal to 2.
+
+ Warning! MPFR needs to increase the precision internally, in order to
+provide accurate results (and in particular, correct rounding). Do not
+attempt to set the precision to any value near `MPFR_PREC_MAX',
+otherwise MPFR will abort due to an assertion failure. Moreover, you
+may reach some memory limit on your platform, in which case the program
+may abort, crash or have undefined behavior (depending on your C
+implementation).
+
+The "rounding mode" specifies the way to round the result of a
+floating-point operation, in case the exact result can not be
+represented exactly in the destination significand; the corresponding C
+data type is `mpfr_rnd_t'.
+
+
+File: mpfr.info, Node: MPFR Variable Conventions, Next: Rounding Modes, Prev: Nomenclature and Types, Up: MPFR Basics
+
+4.3 MPFR Variable Conventions
+=============================
+
+Before you can assign to an MPFR variable, you need to initialize it by
+calling one of the special initialization functions. When you're done
+with a variable, you need to clear it out, using one of the functions
+for that purpose. A variable should only be initialized once, or at
+least cleared out between each initialization. After a variable has
+been initialized, it may be assigned to any number of times. For
+efficiency reasons, avoid to initialize and clear out a variable in
+loops. Instead, initialize it before entering the loop, and clear it
+out after the loop has exited. You do not need to be concerned about
+allocating additional space for MPFR variables, since any variable has
+a significand of fixed size. Hence unless you change its precision, or
+clear and reinitialize it, a floating-point variable will have the same
+allocated space during all its life.
+
+ As a general rule, all MPFR functions expect output arguments before
+input arguments. This notation is based on an analogy with the
+assignment operator. MPFR allows you to use the same variable for both
+input and output in the same expression. For example, the main
+function for floating-point multiplication, `mpfr_mul', can be used
+like this: `mpfr_mul (x, x, x, rnd)'. This computes the square of X
+with rounding mode `rnd' and puts the result back in X.
+
+
+File: mpfr.info, Node: Rounding Modes, Next: Floating-Point Values on Special Numbers, Prev: MPFR Variable Conventions, Up: MPFR Basics
+
+4.4 Rounding Modes
+==================
+
+The following five rounding modes are supported:
+
+ * `MPFR_RNDN': round to nearest (roundTiesToEven in IEEE 754-2008),
+
+ * `MPFR_RNDZ': round toward zero (roundTowardZero in IEEE 754-2008),
+
+ * `MPFR_RNDU': round toward plus infinity (roundTowardPositive in
+ IEEE 754-2008),
+
+ * `MPFR_RNDD': round toward minus infinity (roundTowardNegative in
+ IEEE 754-2008),
+
+ * `MPFR_RNDA': round away from zero.
+
+ The `round to nearest' mode works as in the IEEE 754 standard: in
+case the number to be rounded lies exactly in the middle of two
+representable numbers, it is rounded to the one with the least
+significant bit set to zero. For example, the number 2.5, which is
+represented by (10.1) in binary, is rounded to (10.0)=2 with a
+precision of two bits, and not to (11.0)=3. This rule avoids the
+"drift" phenomenon mentioned by Knuth in volume 2 of The Art of
+Computer Programming (Section 4.2.2).
+
+ Most MPFR functions take as first argument the destination variable,
+as second and following arguments the input variables, as last argument
+a rounding mode, and have a return value of type `int', called the
+"ternary value". The value stored in the destination variable is
+correctly rounded, i.e., MPFR behaves as if it computed the result with
+an infinite precision, then rounded it to the precision of this
+variable. The input variables are regarded as exact (in particular,
+their precision does not affect the result).
+
+ As a consequence, in case of a non-zero real rounded result, the
+error on the result is less or equal to 1/2 ulp (unit in the last
+place) of that result in the rounding to nearest mode, and less than 1
+ulp of that result in the directed rounding modes (a ulp is the weight
+of the least significant represented bit of the result after rounding).
+
+ Unless documented otherwise, functions returning an `int' return a
+ternary value. If the ternary value is zero, it means that the value
+stored in the destination variable is the exact result of the
+corresponding mathematical function. If the ternary value is positive
+(resp. negative), it means the value stored in the destination variable
+is greater (resp. lower) than the exact result. For example with the
+`MPFR_RNDU' rounding mode, the ternary value is usually positive,
+except when the result is exact, in which case it is zero. In the case
+of an infinite result, it is considered as inexact when it was obtained
+by overflow, and exact otherwise. A NaN result (Not-a-Number) always
+corresponds to an exact return value. The opposite of a returned
+ternary value is guaranteed to be representable in an `int'.
+
+ Unless documented otherwise, functions returning as result the value
+`1' (or any other value specified in this manual) for special cases
+(like `acos(0)') yield an overflow or an underflow if that value is not
+representable in the current exponent range.
+
+
+File: mpfr.info, Node: Floating-Point Values on Special Numbers, Next: Exceptions, Prev: Rounding Modes, Up: MPFR Basics
+
+4.5 Floating-Point Values on Special Numbers
+============================================
+
+This section specifies the floating-point values (of type `mpfr_t')
+returned by MPFR functions (where by "returned" we mean here the
+modified value of the destination object, which should not be mixed
+with the ternary return value of type `int' of those functions). For
+functions returning several values (like `mpfr_sin_cos'), the rules
+apply to each result separately.
+
+ Functions can have one or several input arguments. An input point is
+a mapping from these input arguments to the set of the MPFR numbers.
+When none of its components are NaN, an input point can also be seen as
+a tuple in the extended real numbers (the set of the real numbers with
+both infinities).
+
+ When the input point is in the domain of the mathematical function,
+the result is rounded as described in Section "Rounding Modes" (but see
+below for the specification of the sign of an exact zero). Otherwise
+the general rules from this section apply unless stated otherwise in
+the description of the MPFR function (*note MPFR Interface::).
+
+ When the input point is not in the domain of the mathematical
+function but is in its closure in the extended real numbers and the
+function can be extended by continuity, the result is the obtained
+limit. Examples: `mpfr_hypot' on (+Inf,0) gives +Inf. But `mpfr_pow'
+cannot be defined on (1,+Inf) using this rule, as one can find
+sequences (X_N,Y_N) such that X_N goes to 1, Y_N goes to +Inf and X_N
+to the Y_N goes to any positive value when N goes to the infinity.
+
+ When the input point is in the closure of the domain of the
+mathematical function and an input argument is +0 (resp. -0), one
+considers the limit when the corresponding argument approaches 0 from
+above (resp. below). If the limit is not defined (e.g., `mpfr_log' on
+-0), the behavior is specified in the description of the MPFR function.
+
+ When the result is equal to 0, its sign is determined by considering
+the limit as if the input point were not in the domain: If one
+approaches 0 from above (resp. below), the result is +0 (resp. -0); for
+example, `mpfr_sin' on +0 gives +0. In the other cases, the sign is
+specified in the description of the MPFR function; for example
+`mpfr_max' on -0 and +0 gives +0.
+
+ When the input point is not in the closure of the domain of the
+function, the result is NaN. Example: `mpfr_sqrt' on -17 gives NaN.
+
+ When an input argument is NaN, the result is NaN, possibly except
+when a partial function is constant on the finite floating-point
+numbers; such a case is always explicitly specified in *note MPFR
+Interface::. Example: `mpfr_hypot' on (NaN,0) gives NaN, but
+`mpfr_hypot' on (NaN,+Inf) gives +Inf (as specified in *note Special
+Functions::), since for any finite input X, `mpfr_hypot' on (X,+Inf)
+gives +Inf.
+
+
+File: mpfr.info, Node: Exceptions, Next: Memory Handling, Prev: Floating-Point Values on Special Numbers, Up: MPFR Basics
+
+4.6 Exceptions
+==============
+
+MPFR supports 6 exception types:
+
+ * Underflow: An underflow occurs when the exact result of a function
+ is a non-zero real number and the result obtained after the
+ rounding, assuming an unbounded exponent range (for the rounding),
+ has an exponent smaller than the minimum value of the current
+ exponent range. (In the round-to-nearest mode, the halfway case is
+ rounded toward zero.)
+
+ Note: This is not the single possible definition of the underflow.
+ MPFR chooses to consider the underflow _after_ rounding. The
+ underflow before rounding can also be defined. For instance,
+ consider a function that has the exact result 7 multiplied by two
+ to the power E-4, where E is the smallest exponent (for a
+ significand between 1/2 and 1), with a 2-bit target precision and
+ rounding toward plus infinity. The exact result has the exponent
+ E-1. With the underflow before rounding, such a function call
+ would yield an underflow, as E-1 is outside the current exponent
+ range. However, MPFR first considers the rounded result assuming
+ an unbounded exponent range. The exact result cannot be
+ represented exactly in precision 2, and here, it is rounded to 0.5
+ times 2 to E, which is representable in the current exponent
+ range. As a consequence, this will not yield an underflow in MPFR.
+
+ * Overflow: An overflow occurs when the exact result of a function
+ is a non-zero real number and the result obtained after the
+ rounding, assuming an unbounded exponent range (for the rounding),
+ has an exponent larger than the maximum value of the current
+ exponent range. In the round-to-nearest mode, the result is
+ infinite. Note: unlike the underflow case, there is only one
+ possible definition of overflow here.
+
+ * Divide-by-zero: An exact infinite result is obtained from finite
+ inputs.
+
+ * NaN: A NaN exception occurs when the result of a function is NaN.
+
+ * Inexact: An inexact exception occurs when the result of a function
+ cannot be represented exactly and must be rounded.
+
+ * Range error: A range exception occurs when a function that does
+ not return a MPFR number (such as comparisons and conversions to
+ an integer) has an invalid result (e.g., an argument is NaN in
+ `mpfr_cmp', or a conversion to an integer cannot be represented in
+ the target type).
+
+
+ MPFR has a global flag for each exception, which can be cleared, set
+or tested by functions described in *note Exception Related Functions::.
+
+ Differences with the ISO C99 standard:
+
+ * In C, only quiet NaNs are specified, and a NaN propagation does not
+ raise an invalid exception. Unless explicitly stated otherwise,
+ MPFR sets the NaN flag whenever a NaN is generated, even when a
+ NaN is propagated (e.g., in NaN + NaN), as if all NaNs were
+ signaling.
+
+ * An invalid exception in C corresponds to either a NaN exception or
+ a range error in MPFR.
+
+
+
+File: mpfr.info, Node: Memory Handling, Prev: Exceptions, Up: MPFR Basics
+
+4.7 Memory Handling
+===================
+
+MPFR functions may create caches, e.g., when computing constants such
+as Pi, either because the user has called a function like
+`mpfr_const_pi' directly or because such a function was called
+internally by the MPFR library itself to compute some other function.
+
+ At any time, the user can free the various caches with
+`mpfr_free_cache'. It is strongly advised to do that before terminating
+a thread, or before exiting when using tools like `valgrind' (to avoid
+memory leaks being reported).
+
+ MPFR internal data such as flags, the exponent range, the default
+precision and rounding mode, and caches (i.e., data that are not
+accessed via parameters) are either global (if MPFR has not been
+compiled as thread safe) or per-thread (thread local storage, TLS).
+The initial values of TLS data after a thread is created entirely
+depend on the compiler and thread implementation (MPFR simply does a
+conventional variable initialization, the variables being declared with
+an implementation-defined TLS specifier).
+
+
+File: mpfr.info, Node: MPFR Interface, Next: API Compatibility, Prev: MPFR Basics, Up: Top
+
+5 MPFR Interface
+****************
+
+The floating-point functions expect arguments of type `mpfr_t'.
+
+ The MPFR floating-point functions have an interface that is similar
+to the GNU MP functions. The function prefix for floating-point
+operations is `mpfr_'.
+
+ The user has to specify the precision of each variable. A
+computation that assigns a variable will take place with the precision
+of the assigned variable; the cost of that computation should not
+depend on the precision of variables used as input (on average).
+
+ The semantics of a calculation in MPFR is specified as follows:
+Compute the requested operation exactly (with "infinite accuracy"), and
+round the result to the precision of the destination variable, with the
+given rounding mode. The MPFR floating-point functions are intended to
+be a smooth extension of the IEEE 754 arithmetic. The results obtained
+on a given computer are identical to those obtained on a computer with
+a different word size, or with a different compiler or operating system.
+
+ MPFR _does not keep track_ of the accuracy of a computation. This is
+left to the user or to a higher layer (for example the MPFI library for
+interval arithmetic). As a consequence, if two variables are used to
+store only a few significant bits, and their product is stored in a
+variable with large precision, then MPFR will still compute the result
+with full precision.
+
+ The value of the standard C macro `errno' may be set to non-zero by
+any MPFR function or macro, whether or not there is an error.
+
+* Menu:
+
+* Initialization Functions::
+* Assignment Functions::
+* Combined Initialization and Assignment Functions::
+* Conversion Functions::
+* Basic Arithmetic Functions::
+* Comparison Functions::
+* Special Functions::
+* Input and Output Functions::
+* Formatted Output Functions::
+* Integer Related Functions::
+* Rounding Related Functions::
+* Miscellaneous Functions::
+* Exception Related Functions::
+* Compatibility with MPF::
+* Custom Interface::
+* Internals::
+
+
+File: mpfr.info, Node: Initialization Functions, Next: Assignment Functions, Prev: MPFR Interface, Up: MPFR Interface
+
+5.1 Initialization Functions
+============================
+
+An `mpfr_t' object must be initialized before storing the first value in
+it. The functions `mpfr_init' and `mpfr_init2' are used for that
+purpose.
+
+ -- Function: void mpfr_init2 (mpfr_t X, mpfr_prec_t PREC)
+ Initialize X, set its precision to be *exactly* PREC bits and its
+ value to NaN. (Warning: the corresponding MPF function initializes
+ to zero instead.)
+
+ Normally, a variable should be initialized once only or at least
+ be cleared, using `mpfr_clear', between initializations. To
+ change the precision of a variable which has already been
+ initialized, use `mpfr_set_prec'. The precision PREC must be an
+ integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
+ behavior is undefined).
+
+ -- Function: void mpfr_inits2 (mpfr_prec_t PREC, mpfr_t X, ...)
+ Initialize all the `mpfr_t' variables of the given variable
+ argument `va_list', set their precision to be *exactly* PREC bits
+ and their value to NaN. See `mpfr_init2' for more details. The
+ `va_list' is assumed to be composed only of type `mpfr_t' (or
+ equivalently `mpfr_ptr'). It begins from X, and ends when it
+ encounters a null pointer (whose type must also be `mpfr_ptr').
+
+ -- Function: void mpfr_clear (mpfr_t X)
+ Free the space occupied by the significand of X. Make sure to
+ call this function for all `mpfr_t' variables when you are done
+ with them.
+
+ -- Function: void mpfr_clears (mpfr_t X, ...)
+ Free the space occupied by all the `mpfr_t' variables of the given
+ `va_list'. See `mpfr_clear' for more details. The `va_list' is
+ assumed to be composed only of type `mpfr_t' (or equivalently
+ `mpfr_ptr'). It begins from X, and ends when it encounters a null
+ pointer (whose type must also be `mpfr_ptr').
+
+ Here is an example of how to use multiple initialization functions
+(since `NULL' is not necessarily defined in this context, we use
+`(mpfr_ptr) 0' instead, but `(mpfr_ptr) NULL' is also correct).
+
+ {
+ mpfr_t x, y, z, t;
+ mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0);
+ ...
+ mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
+ }
+
+ -- Function: void mpfr_init (mpfr_t X)
+ Initialize X, set its precision to the default precision, and set
+ its value to NaN. The default precision can be changed by a call
+ to `mpfr_set_default_prec'.
+
+ Warning! In a given program, some other libraries might change the
+ default precision and not restore it. Thus it is safer to use
+ `mpfr_init2'.
+
+ -- Function: void mpfr_inits (mpfr_t X, ...)
+ Initialize all the `mpfr_t' variables of the given `va_list', set
+ their precision to the default precision and their value to NaN.
+ See `mpfr_init' for more details. The `va_list' is assumed to be
+ composed only of type `mpfr_t' (or equivalently `mpfr_ptr'). It
+ begins from X, and ends when it encounters a null pointer (whose
+ type must also be `mpfr_ptr').
+
+ Warning! In a given program, some other libraries might change the
+ default precision and not restore it. Thus it is safer to use
+ `mpfr_inits2'.
+
+ -- Macro: MPFR_DECL_INIT (NAME, PREC)
+ This macro declares NAME as an automatic variable of type `mpfr_t',
+ initializes it and sets its precision to be *exactly* PREC bits
+ and its value to NaN. NAME must be a valid identifier. You must
+ use this macro in the declaration section. This macro is much
+ faster than using `mpfr_init2' but has some drawbacks:
+
+ * You *must not* call `mpfr_clear' with variables created with
+ this macro (the storage is allocated at the point of
+ declaration and deallocated when the brace-level is exited).
+
+ * You *cannot* change their precision.
+
+ * You *should not* create variables with huge precision with
+ this macro.
+
+ * Your compiler must support `Non-Constant Initializers'
+ (standard in C++ and ISO C99) and `Token Pasting' (standard
+ in ISO C89). If PREC is not a constant expression, your
+ compiler must support `variable-length automatic arrays'
+ (standard in ISO C99). GCC 2.95.3 and above supports all
+ these features. If you compile your program with GCC in C89
+ mode and with `-pedantic', you may want to define the
+ `MPFR_USE_EXTENSION' macro to avoid warnings due to the
+ `MPFR_DECL_INIT' implementation.
+
+ -- Function: void mpfr_set_default_prec (mpfr_prec_t PREC)
+ Set the default precision to be *exactly* PREC bits, where PREC
+ can be any integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.
+ The precision of a variable means the number of bits used to store
+ its significand. All subsequent calls to `mpfr_init' or
+ `mpfr_inits' will use this precision, but previously initialized
+ variables are unaffected. The default precision is set to 53 bits
+ initially.
+
+ Note: when MPFR is built with the `--enable-thread-safe' configure
+ option, the default precision is local to each thread. *Note
+ Memory Handling::, for more information.
+
+ -- Function: mpfr_prec_t mpfr_get_default_prec (void)
+ Return the current default MPFR precision in bits. See the
+ documentation of `mpfr_set_default_prec'.
+
+ Here is an example on how to initialize floating-point variables:
+
+ {
+ mpfr_t x, y;
+ mpfr_init (x); /* use default precision */
+ mpfr_init2 (y, 256); /* precision _exactly_ 256 bits */
+ ...
+ /* When the program is about to exit, do ... */
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_free_cache (); /* free the cache for constants like pi */
+ }
+
+ The following functions are useful for changing the precision during
+a calculation. A typical use would be for adjusting the precision
+gradually in iterative algorithms like Newton-Raphson, making the
+computation precision closely match the actual accurate part of the
+numbers.
+
+ -- Function: void mpfr_set_prec (mpfr_t X, mpfr_prec_t PREC)
+ Reset the precision of X to be *exactly* PREC bits, and set its
+ value to NaN. The previous value stored in X is lost. It is
+ equivalent to a call to `mpfr_clear(x)' followed by a call to
+ `mpfr_init2(x, prec)', but more efficient as no allocation is done
+ in case the current allocated space for the significand of X is
+ enough. The precision PREC can be any integer between
+ `MPFR_PREC_MIN' and `MPFR_PREC_MAX'. In case you want to keep the
+ previous value stored in X, use `mpfr_prec_round' instead.
+
+ -- Function: mpfr_prec_t mpfr_get_prec (mpfr_t X)
+ Return the precision of X, i.e., the number of bits used to store
+ its significand.
+
+
+File: mpfr.info, Node: Assignment Functions, Next: Combined Initialization and Assignment Functions, Prev: Initialization Functions, Up: MPFR Interface
+
+5.2 Assignment Functions
+========================
+
+These functions assign new values to already initialized floats (*note
+Initialization Functions::).
+
+ -- Function: int mpfr_set (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_ui (mpfr_t ROP, unsigned long int OP,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_set_si (mpfr_t ROP, long int OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_uj (mpfr_t ROP, uintmax_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_sj (mpfr_t ROP, intmax_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_flt (mpfr_t ROP, float OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t
+ RND)
+ -- Function: int mpfr_set_decimal64 (mpfr_t ROP, _Decimal64 OP,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_q (mpfr_t ROP, mpq_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND)
+ Set the value of ROP from OP, rounded toward the given direction
+ RND. Note that the input 0 is converted to +0 by `mpfr_set_ui',
+ `mpfr_set_si', `mpfr_set_uj', `mpfr_set_sj', `mpfr_set_z',
+ `mpfr_set_q' and `mpfr_set_f', regardless of the rounding mode.
+ If the system does not support the IEEE 754 standard,
+ `mpfr_set_flt', `mpfr_set_d', `mpfr_set_ld' and
+ `mpfr_set_decimal64' might not preserve the signed zeros. The
+ `mpfr_set_decimal64' function is built only with the configure
+ option `--enable-decimal-float', which also requires
+ `--with-gmp-build', and when the compiler or system provides the
+ `_Decimal64' data type (recent versions of GCC support this data
+ type); to use `mpfr_set_decimal64', one should define the macro
+ `MPFR_WANT_DECIMAL_FLOATS' before including `mpfr.h'.
+ `mpfr_set_q' might fail if the numerator (or the denominator) can
+ not be represented as a `mpfr_t'.
+
+ Note: If you want to store a floating-point constant to a `mpfr_t',
+ you should use `mpfr_set_str' (or one of the MPFR constant
+ functions, such as `mpfr_const_pi' for Pi) instead of
+ `mpfr_set_flt', `mpfr_set_d', `mpfr_set_ld' or
+ `mpfr_set_decimal64'. Otherwise the floating-point constant will
+ be first converted into a reduced-precision (e.g., 53-bit) binary
+ (or decimal, for `mpfr_set_decimal64') number before MPFR can work
+ with it.
+
+ -- Function: int mpfr_set_ui_2exp (mpfr_t ROP, unsigned long int OP,
+ mpfr_exp_t E, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_si_2exp (mpfr_t ROP, long int OP, mpfr_exp_t
+ E, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_uj_2exp (mpfr_t ROP, uintmax_t OP, intmax_t
+ E, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_sj_2exp (mpfr_t ROP, intmax_t OP, intmax_t
+ E, mpfr_rnd_t RND)
+ -- Function: int mpfr_set_z_2exp (mpfr_t ROP, mpz_t OP, mpfr_exp_t E,
+ mpfr_rnd_t RND)
+ Set the value of ROP from OP multiplied by two to the power E,
+ rounded toward the given direction RND. Note that the input 0 is
+ converted to +0.
+
+ -- Function: int mpfr_set_str (mpfr_t ROP, const char *S, int BASE,
+ mpfr_rnd_t RND)
+ Set ROP to the value of the string S in base BASE, rounded in the
+ direction RND. See the documentation of `mpfr_strtofr' for a
+ detailed description of the valid string formats. Contrary to
+ `mpfr_strtofr', `mpfr_set_str' requires the _whole_ string to
+ represent a valid floating-point number.
+
+ The meaning of the return value differs from other MPFR functions:
+ it is 0 if the entire string up to the final null character is a
+ valid number in base BASE; otherwise it is -1, and ROP may have
+ changed (users interested in the *note ternary value:: should use
+ `mpfr_strtofr' instead).
+
+ Note: it is preferable to use `mpfr_set_str' if one wants to
+ distinguish between an infinite ROP value coming from an infinite
+ S or from an overflow.
+
+ -- Function: int mpfr_strtofr (mpfr_t ROP, const char *NPTR, char
+ **ENDPTR, int BASE, mpfr_rnd_t RND)
+ Read a floating-point number from a string NPTR in base BASE,
+ rounded in the direction RND; BASE must be either 0 (to detect the
+ base, as described below) or a number from 2 to 62 (otherwise the
+ behavior is undefined). If NPTR starts with valid data, the result
+ is stored in ROP and `*ENDPTR' points to the character just after
+ the valid data (if ENDPTR is not a null pointer); otherwise ROP is
+ set to zero (for consistency with `strtod') and the value of NPTR
+ is stored in the location referenced by ENDPTR (if ENDPTR is not a
+ null pointer). The usual ternary value is returned.
+
+ Parsing follows the standard C `strtod' function with some
+ extensions. After optional leading whitespace, one has a subject
+ sequence consisting of an optional sign (`+' or `-'), and either
+ numeric data or special data. The subject sequence is defined as
+ the longest initial subsequence of the input string, starting with
+ the first non-whitespace character, that is of the expected form.
+
+ The form of numeric data is a non-empty sequence of significand
+ digits with an optional decimal point, and an optional exponent
+ consisting of an exponent prefix followed by an optional sign and
+ a non-empty sequence of decimal digits. A significand digit is
+ either a decimal digit or a Latin letter (62 possible characters),
+ with `A' = 10, `B' = 11, ..., `Z' = 35; case is ignored in bases
+ less or equal to 36, in bases larger than 36, `a' = 36, `b' = 37,
+ ..., `z' = 61. The value of a significand digit must be strictly
+ less than the base. The decimal point can be either the one
+ defined by the current locale or the period (the first one is
+ accepted for consistency with the C standard and the practice, the
+ second one is accepted to allow the programmer to provide MPFR
+ numbers from strings in a way that does not depend on the current
+ locale). The exponent prefix can be `e' or `E' for bases up to
+ 10, or `@' in any base; it indicates a multiplication by a power
+ of the base. In bases 2 and 16, the exponent prefix can also be
+ `p' or `P', in which case the exponent, called _binary exponent_,
+ indicates a multiplication by a power of 2 instead of the base
+ (there is a difference only for base 16); in base 16 for example
+ `1p2' represents 4 whereas `1@2' represents 256. The value of an
+ exponent is always written in base 10.
+
+ If the argument BASE is 0, then the base is automatically detected
+ as follows. If the significand starts with `0b' or `0B', base 2 is
+ assumed. If the significand starts with `0x' or `0X', base 16 is
+ assumed. Otherwise base 10 is assumed.
+
+ Note: The exponent (if present) must contain at least a digit.
+ Otherwise the possible exponent prefix and sign are not part of
+ the number (which ends with the significand). Similarly, if `0b',
+ `0B', `0x' or `0X' is not followed by a binary/hexadecimal digit,
+ then the subject sequence stops at the character `0', thus 0 is
+ read.
+
+ Special data (for infinities and NaN) can be `@inf@' or
+ `@nan@(n-char-sequence-opt)', and if BASE <= 16, it can also be
+ `infinity', `inf', `nan' or `nan(n-char-sequence-opt)', all case
+ insensitive. A `n-char-sequence-opt' is a possibly empty string
+ containing only digits, Latin letters and the underscore (0, 1, 2,
+ ..., 9, a, b, ..., z, A, B, ..., Z, _). Note: one has an optional
+ sign for all data, even NaN. For example,
+ `-@nAn@(This_Is_Not_17)' is a valid representation for NaN in base
+ 17.
+
+
+ -- Function: void mpfr_set_nan (mpfr_t X)
+ -- Function: void mpfr_set_inf (mpfr_t X, int SIGN)
+ -- Function: void mpfr_set_zero (mpfr_t X, int SIGN)
+ Set the variable X to NaN (Not-a-Number), infinity or zero
+ respectively. In `mpfr_set_inf' or `mpfr_set_zero', X is set to
+ plus infinity or plus zero iff SIGN is nonnegative; in
+ `mpfr_set_nan', the sign bit of the result is unspecified.
+
+ -- Function: void mpfr_swap (mpfr_t X, mpfr_t Y)
+ Swap the values X and Y efficiently. Warning: the precisions are
+ exchanged too; in case the precisions are different, `mpfr_swap'
+ is thus not equivalent to three `mpfr_set' calls using a third
+ auxiliary variable.
+
+
+File: mpfr.info, Node: Combined Initialization and Assignment Functions, Next: Conversion Functions, Prev: Assignment Functions, Up: MPFR Interface
+
+5.3 Combined Initialization and Assignment Functions
+====================================================
+
+ -- Macro: int mpfr_init_set (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Macro: int mpfr_init_set_ui (mpfr_t ROP, unsigned long int OP,
+ mpfr_rnd_t RND)
+ -- Macro: int mpfr_init_set_si (mpfr_t ROP, long int OP, mpfr_rnd_t
+ RND)
+ -- Macro: int mpfr_init_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND)
+ -- Macro: int mpfr_init_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t
+ RND)
+ -- Macro: int mpfr_init_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND)
+ -- Macro: int mpfr_init_set_q (mpfr_t ROP, mpq_t OP, mpfr_rnd_t RND)
+ -- Macro: int mpfr_init_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND)
+ Initialize ROP and set its value from OP, rounded in the direction
+ RND. The precision of ROP will be taken from the active default
+ precision, as set by `mpfr_set_default_prec'.
+
+ -- Function: int mpfr_init_set_str (mpfr_t X, const char *S, int BASE,
+ mpfr_rnd_t RND)
+ Initialize X and set its value from the string S in base BASE,
+ rounded in the direction RND. See `mpfr_set_str'.
+
+
+File: mpfr.info, Node: Conversion Functions, Next: Basic Arithmetic Functions, Prev: Combined Initialization and Assignment Functions, Up: MPFR Interface
+
+5.4 Conversion Functions
+========================
+
+ -- Function: float mpfr_get_flt (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: double mpfr_get_d (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: long double mpfr_get_ld (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: _Decimal64 mpfr_get_decimal64 (mpfr_t OP, mpfr_rnd_t RND)
+ Convert OP to a `float' (respectively `double', `long double' or
+ `_Decimal64'), using the rounding mode RND. If OP is NaN, some
+ fixed NaN (either quiet or signaling) or the result of 0.0/0.0 is
+ returned. If OP is ±Inf, an infinity of the same sign or the
+ result of ±1.0/0.0 is returned. If OP is zero, these functions
+ return a zero, trying to preserve its sign, if possible. The
+ `mpfr_get_decimal64' function is built only under some conditions:
+ see the documentation of `mpfr_set_decimal64'.
+
+ -- Function: long mpfr_get_si (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: unsigned long mpfr_get_ui (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: intmax_t mpfr_get_sj (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: uintmax_t mpfr_get_uj (mpfr_t OP, mpfr_rnd_t RND)
+ Convert OP to a `long', an `unsigned long', an `intmax_t' or an
+ `uintmax_t' (respectively) after rounding it with respect to RND.
+ If OP is NaN, 0 is returned and the _erange_ flag is set. If OP
+ is too big for the return type, the function returns the maximum
+ or the minimum of the corresponding C type, depending on the
+ direction of the overflow; the _erange_ flag is set too. See also
+ `mpfr_fits_slong_p', `mpfr_fits_ulong_p', `mpfr_fits_intmax_p' and
+ `mpfr_fits_uintmax_p'.
+
+ -- Function: double mpfr_get_d_2exp (long *EXP, mpfr_t OP, mpfr_rnd_t
+ RND)
+ -- Function: long double mpfr_get_ld_2exp (long *EXP, mpfr_t OP,
+ mpfr_rnd_t RND)
+ Return D and set EXP (formally, the value pointed to by EXP) such
+ that 0.5<=abs(D)<1 and D times 2 raised to EXP equals OP rounded
+ to double (resp. long double) precision, using the given rounding
+ mode. If OP is zero, then a zero of the same sign (or an unsigned
+ zero, if the implementation does not have signed zeros) is
+ returned, and EXP is set to 0. If OP is NaN or an infinity, then
+ the corresponding double precision (resp. long-double precision)
+ value is returned, and EXP is undefined.
+
+ -- Function: int mpfr_frexp (mpfr_exp_t *EXP, mpfr_t Y, mpfr_t X,
+ mpfr_rnd_t RND)
+ Set EXP (formally, the value pointed to by EXP) and Y such that
+ 0.5<=abs(Y)<1 and Y times 2 raised to EXP equals X rounded to the
+ precision of Y, using the given rounding mode. If X is zero, then
+ Y is set to a zero of the same sign and EXP is set to 0. If X is
+ NaN or an infinity, then Y is set to the same value and EXP is
+ undefined.
+
+ -- Function: mpfr_exp_t mpfr_get_z_2exp (mpz_t ROP, mpfr_t OP)
+ Put the scaled significand of OP (regarded as an integer, with the
+ precision of OP) into ROP, and return the exponent EXP (which may
+ be outside the current exponent range) such that OP exactly equals
+ ROP times 2 raised to the power EXP. If OP is zero, the minimal
+ exponent `emin' is returned. If OP is NaN or an infinity, the
+ _erange_ flag is set, ROP is set to 0, and the the minimal
+ exponent `emin' is returned. The returned exponent may be less
+ than the minimal exponent `emin' of MPFR numbers in the current
+ exponent range; in case the exponent is not representable in the
+ `mpfr_exp_t' type, the _erange_ flag is set and the minimal value
+ of the `mpfr_exp_t' type is returned.
+
+ -- Function: int mpfr_get_z (mpz_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Convert OP to a `mpz_t', after rounding it with respect to RND. If
+ OP is NaN or an infinity, the _erange_ flag is set, ROP is set to
+ 0, and 0 is returned.
+
+ -- Function: int mpfr_get_f (mpf_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Convert OP to a `mpf_t', after rounding it with respect to RND.
+ The _erange_ flag is set if OP is NaN or an infinity, which do not
+ exist in MPF. If OP is NaN, then ROP is undefined. If OP is an
+ +Inf (resp. -Inf), then ROP is set to the maximum (resp. minimum)
+ value in the precision of the MPF number; if a future MPF version
+ supports infinities, this behavior will be considered incorrect
+ and will change (portable programs should assume that ROP is set
+ either to this finite number or to an infinite number). Note that
+ since MPFR currently has the same exponent type as MPF (but not
+ with the same radix), the range of values is much larger in MPF
+ than in MPFR, so that an overflow or underflow is not possible.
+
+ -- Function: char * mpfr_get_str (char *STR, mpfr_exp_t *EXPPTR, int
+ B, size_t N, mpfr_t OP, mpfr_rnd_t RND)
+ Convert OP to a string of digits in base B, with rounding in the
+ direction RND, where N is either zero (see below) or the number of
+ significant digits output in the string; in the latter case, N
+ must be greater or equal to 2. The base may vary from 2 to 62. If
+ the input number is an ordinary number, the exponent is written
+ through the pointer EXPPTR (for input 0, the current minimal
+ exponent is written).
+
+ The generated string is a fraction, with an implicit radix point
+ immediately to the left of the first digit. For example, the
+ number -3.1416 would be returned as "-31416" in the string and 1
+ written at EXPPTR. If RND is to nearest, and OP is exactly in the
+ middle of two consecutive possible outputs, the one with an even
+ significand is chosen, where both significands are considered with
+ the exponent of OP. Note that for an odd base, this may not
+ correspond to an even last digit: for example with 2 digits in
+ base 7, (14) and a half is rounded to (15) which is 12 in decimal,
+ (16) and a half is rounded to (20) which is 14 in decimal, and
+ (26) and a half is rounded to (26) which is 20 in decimal.
+
+ If N is zero, the number of digits of the significand is chosen
+ large enough so that re-reading the printed value with the same
+ precision, assuming both output and input use rounding to nearest,
+ will recover the original value of OP. More precisely, in most
+ cases, the chosen precision of STR is the minimal precision m
+ depending only on P = PREC(OP) and B that satisfies the above
+ property, i.e., m = 1 + ceil(P*log(2)/log(B)), with P replaced by
+ P-1 if B is a power of 2, but in some very rare cases, it might be
+ m+1 (the smallest case for bases up to 62 is when P equals
+ 186564318007 for bases 7 and 49).
+
+ If STR is a null pointer, space for the significand is allocated
+ using the current allocation function, and a pointer to the string
+ is returned. To free the returned string, you must use
+ `mpfr_free_str'.
+
+ If STR is not a null pointer, it should point to a block of storage
+ large enough for the significand, i.e., at least `max(N + 2, 7)'.
+ The extra two bytes are for a possible minus sign, and for the
+ terminating null character, and the value 7 accounts for `-@Inf@'
+ plus the terminating null character.
+
+ A pointer to the string is returned, unless there is an error, in
+ which case a null pointer is returned.
+
+ -- Function: void mpfr_free_str (char *STR)
+ Free a string allocated by `mpfr_get_str' using the current
+ unallocation function. The block is assumed to be `strlen(STR)+1'
+ bytes. For more information about how it is done: *note Custom
+ Allocation: (gmp.info)Custom Allocation.
+
+ -- Function: int mpfr_fits_ulong_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_slong_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_uint_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_sint_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_ushort_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_sshort_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_uintmax_p (mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_fits_intmax_p (mpfr_t OP, mpfr_rnd_t RND)
+ Return non-zero if OP would fit in the respective C data type,
+ respectively `unsigned long', `long', `unsigned int', `int',
+ `unsigned short', `short', `uintmax_t', `intmax_t', when rounded
+ to an integer in the direction RND.
+
+
+File: mpfr.info, Node: Basic Arithmetic Functions, Next: Comparison Functions, Prev: Conversion Functions, Up: MPFR Interface
+
+5.5 Basic Arithmetic Functions
+==============================
+
+ -- Function: int mpfr_add (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_add_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_add_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_add_d (mpfr_t ROP, mpfr_t OP1, double OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_add_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to OP1 + OP2 rounded in the direction RND. For types
+ having no signed zero, it is considered unsigned (i.e., (+0) + 0 =
+ (+0) and (-0) + 0 = (-0)). The `mpfr_add_d' function assumes that
+ the radix of the `double' type is a power of 2, with a precision
+ at most that declared by the C implementation (macro
+ `IEEE_DBL_MANT_DIG', and if not defined 53 bits).
+
+ -- Function: int mpfr_sub (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_ui_sub (mpfr_t ROP, unsigned long int OP1,
+ mpfr_t OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_sub_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_si_sub (mpfr_t ROP, long int OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_sub_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_d_sub (mpfr_t ROP, double OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_sub_d (mpfr_t ROP, mpfr_t OP1, double OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_z_sub (mpfr_t ROP, mpz_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_sub_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to OP1 - OP2 rounded in the direction RND. For types
+ having no signed zero, it is considered unsigned (i.e., (+0) - 0 =
+ (+0), (-0) - 0 = (-0), 0 - (+0) = (-0) and 0 - (-0) = (+0)). The
+ same restrictions than for `mpfr_add_d' apply to `mpfr_d_sub' and
+ `mpfr_sub_d'.
+
+ -- Function: int mpfr_mul (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_mul_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_mul_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_mul_d (mpfr_t ROP, mpfr_t OP1, double OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_mul_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_mul_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to OP1 times OP2 rounded in the direction RND. When a
+ result is zero, its sign is the product of the signs of the
+ operands (for types having no signed zero, it is considered
+ positive). The same restrictions than for `mpfr_add_d' apply to
+ `mpfr_mul_d'.
+
+ -- Function: int mpfr_sqr (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the square of OP rounded in the direction RND.
+
+ -- Function: int mpfr_div (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_ui_div (mpfr_t ROP, unsigned long int OP1,
+ mpfr_t OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_div_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_si_div (mpfr_t ROP, long int OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_div_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_d_div (mpfr_t ROP, double OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_div_d (mpfr_t ROP, mpfr_t OP1, double OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_div_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_div_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to OP1/OP2 rounded in the direction RND. When a result is
+ zero, its sign is the product of the signs of the operands (for
+ types having no signed zero, it is considered positive). The same
+ restrictions than for `mpfr_add_d' apply to `mpfr_d_div' and
+ `mpfr_div_d'.
+
+ -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP,
+ mpfr_rnd_t RND)
+ Set ROP to the square root of OP rounded in the direction RND (set
+ ROP to -0 if OP is -0, to be consistent with the IEEE 754
+ standard). Set ROP to NaN if OP is negative.
+
+ -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the reciprocal square root of OP rounded in the
+ direction RND. Set ROP to +Inf if OP is ±0, +0 if OP is +Inf, and
+ NaN if OP is negative.
+
+ -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int
+ K, mpfr_rnd_t RND)
+ Set ROP to the cubic root (resp. the Kth root) of OP rounded in
+ the direction RND. For K odd (resp. even) and OP negative
+ (including -Inf), set ROP to a negative number (resp. NaN). The
+ Kth root of -0 is defined to be -0, whatever the parity of K.
+
+ -- Function: int mpfr_pow (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_pow_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_pow_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_pow_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_ui_pow_ui (mpfr_t ROP, unsigned long int OP1,
+ unsigned long int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_ui_pow (mpfr_t ROP, unsigned long int OP1,
+ mpfr_t OP2, mpfr_rnd_t RND)
+ Set ROP to OP1 raised to OP2, rounded in the direction RND.
+ Special values are handled as described in the ISO C99 and IEEE
+ 754-2008 standards for the `pow' function:
+ * `pow(±0, Y)' returns plus or minus infinity for Y a negative
+ odd integer.
+
+ * `pow(±0, Y)' returns plus infinity for Y negative and not an
+ odd integer.
+
+ * `pow(±0, Y)' returns plus or minus zero for Y a positive odd
+ integer.
+
+ * `pow(±0, Y)' returns plus zero for Y positive and not an odd
+ integer.
+
+ * `pow(-1, ±Inf)' returns 1.
+
+ * `pow(+1, Y)' returns 1 for any Y, even a NaN.
+
+ * `pow(X, ±0)' returns 1 for any X, even a NaN.
+
+ * `pow(X, Y)' returns NaN for finite negative X and finite
+ non-integer Y.
+
+ * `pow(X, -Inf)' returns plus infinity for 0 < abs(x) < 1, and
+ plus zero for abs(x) > 1.
+
+ * `pow(X, +Inf)' returns plus zero for 0 < abs(x) < 1, and plus
+ infinity for abs(x) > 1.
+
+ * `pow(-Inf, Y)' returns minus zero for Y a negative odd
+ integer.
+
+ * `pow(-Inf, Y)' returns plus zero for Y negative and not an
+ odd integer.
+
+ * `pow(-Inf, Y)' returns minus infinity for Y a positive odd
+ integer.
+
+ * `pow(-Inf, Y)' returns plus infinity for Y positive and not
+ an odd integer.
+
+ * `pow(+Inf, Y)' returns plus zero for Y negative, and plus
+ infinity for Y positive.
+
+ -- Function: int mpfr_neg (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_abs (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to -OP and the absolute value of OP respectively, rounded
+ in the direction RND. Just changes or adjusts the sign if ROP and
+ OP are the same variable, otherwise a rounding might occur if the
+ precision of ROP is less than that of OP.
+
+ -- Function: int mpfr_dim (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to the positive difference of OP1 and OP2, i.e., OP1 - OP2
+ rounded in the direction RND if OP1 > OP2, +0 if OP1 <= OP2, and
+ NaN if OP1 or OP2 is NaN.
+
+ -- Function: int mpfr_mul_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_mul_2si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ Set ROP to OP1 times 2 raised to OP2 rounded in the direction RND.
+ Just increases the exponent by OP2 when ROP and OP1 are identical.
+
+ -- Function: int mpfr_div_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_div_2si (mpfr_t ROP, mpfr_t OP1, long int OP2,
+ mpfr_rnd_t RND)
+ Set ROP to OP1 divided by 2 raised to OP2 rounded in the direction
+ RND. Just decreases the exponent by OP2 when ROP and OP1 are
+ identical.
+
+
+File: mpfr.info, Node: Comparison Functions, Next: Special Functions, Prev: Basic Arithmetic Functions, Up: MPFR Interface
+
+5.6 Comparison Functions
+========================
+
+ -- Function: int mpfr_cmp (mpfr_t OP1, mpfr_t OP2)
+ -- Function: int mpfr_cmp_ui (mpfr_t OP1, unsigned long int OP2)
+ -- Function: int mpfr_cmp_si (mpfr_t OP1, long int OP2)
+ -- Function: int mpfr_cmp_d (mpfr_t OP1, double OP2)
+ -- Function: int mpfr_cmp_ld (mpfr_t OP1, long double OP2)
+ -- Function: int mpfr_cmp_z (mpfr_t OP1, mpz_t OP2)
+ -- Function: int mpfr_cmp_q (mpfr_t OP1, mpq_t OP2)
+ -- Function: int mpfr_cmp_f (mpfr_t OP1, mpf_t OP2)
+ Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero
+ if OP1 = OP2, and a negative value if OP1 < OP2. Both OP1 and OP2
+ are considered to their full own precision, which may differ. If
+ one of the operands is NaN, set the _erange_ flag and return zero.
+
+ Note: These functions may be useful to distinguish the three
+ possible cases. If you need to distinguish two cases only, it is
+ recommended to use the predicate functions (e.g., `mpfr_equal_p'
+ for the equality) described below; they behave like the IEEE 754
+ comparisons, in particular when one or both arguments are NaN. But
+ only floating-point numbers can be compared (you may need to do a
+ conversion first).
+
+ -- Function: int mpfr_cmp_ui_2exp (mpfr_t OP1, unsigned long int OP2,
+ mpfr_exp_t E)
+ -- Function: int mpfr_cmp_si_2exp (mpfr_t OP1, long int OP2,
+ mpfr_exp_t E)
+ Compare OP1 and OP2 multiplied by two to the power E. Similar as
+ above.
+
+ -- Function: int mpfr_cmpabs (mpfr_t OP1, mpfr_t OP2)
+ Compare |OP1| and |OP2|. Return a positive value if |OP1| >
+ |OP2|, zero if |OP1| = |OP2|, and a negative value if |OP1| <
+ |OP2|. If one of the operands is NaN, set the _erange_ flag and
+ return zero.
+
+ -- Function: int mpfr_nan_p (mpfr_t OP)
+ -- Function: int mpfr_inf_p (mpfr_t OP)
+ -- Function: int mpfr_number_p (mpfr_t OP)
+ -- Function: int mpfr_zero_p (mpfr_t OP)
+ -- Function: int mpfr_regular_p (mpfr_t OP)
+ Return non-zero if OP is respectively NaN, an infinity, an ordinary
+ number (i.e., neither NaN nor an infinity), zero, or a regular
+ number (i.e., neither NaN, nor an infinity nor zero). Return zero
+ otherwise.
+
+ -- Macro: int mpfr_sgn (mpfr_t OP)
+ Return a positive value if OP > 0, zero if OP = 0, and a negative
+ value if OP < 0. If the operand is NaN, set the _erange_ flag and
+ return zero. This is equivalent to `mpfr_cmp_ui (op, 0)', but
+ more efficient.
+
+ -- Function: int mpfr_greater_p (mpfr_t OP1, mpfr_t OP2)
+ -- Function: int mpfr_greaterequal_p (mpfr_t OP1, mpfr_t OP2)
+ -- Function: int mpfr_less_p (mpfr_t OP1, mpfr_t OP2)
+ -- Function: int mpfr_lessequal_p (mpfr_t OP1, mpfr_t OP2)
+ -- Function: int mpfr_equal_p (mpfr_t OP1, mpfr_t OP2)
+ Return non-zero if OP1 > OP2, OP1 >= OP2, OP1 < OP2, OP1 <= OP2,
+ OP1 = OP2 respectively, and zero otherwise. Those functions
+ return zero whenever OP1 and/or OP2 is NaN.
+
+ -- Function: int mpfr_lessgreater_p (mpfr_t OP1, mpfr_t OP2)
+ Return non-zero if OP1 < OP2 or OP1 > OP2 (i.e., neither OP1, nor
+ OP2 is NaN, and OP1 <> OP2), zero otherwise (i.e., OP1 and/or OP2
+ is NaN, or OP1 = OP2).
+
+ -- Function: int mpfr_unordered_p (mpfr_t OP1, mpfr_t OP2)
+ Return non-zero if OP1 or OP2 is a NaN (i.e., they cannot be
+ compared), zero otherwise.
+
+
+File: mpfr.info, Node: Special Functions, Next: Input and Output Functions, Prev: Comparison Functions, Up: MPFR Interface
+
+5.7 Special Functions
+=====================
+
+All those functions, except explicitly stated (for example
+`mpfr_sin_cos'), return a *note ternary value::, i.e., zero for an
+exact return value, a positive value for a return value larger than the
+exact result, and a negative value otherwise.
+
+ Important note: in some domains, computing special functions (either
+with correct or incorrect rounding) is expensive, even for small
+precision, for example the trigonometric and Bessel functions for large
+argument.
+
+ -- Function: int mpfr_log (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the natural logarithm of OP, log2(OP) or log10(OP),
+ respectively, rounded in the direction RND. Set ROP to -Inf if OP
+ is -0 (i.e., the sign of the zero has no influence on the result).
+
+ -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_exp10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the exponential of OP, to 2 power of OP or to 10 power
+ of OP, respectively, rounded in the direction RND.
+
+ -- Function: int mpfr_cos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_sin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_tan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the cosine of OP, sine of OP, tangent of OP, rounded in
+ the direction RND.
+
+ -- Function: int mpfr_sin_cos (mpfr_t SOP, mpfr_t COP, mpfr_t OP,
+ mpfr_rnd_t RND)
+ Set simultaneously SOP to the sine of OP and COP to the cosine of
+ OP, rounded in the direction RND with the corresponding precisions
+ of SOP and COP, which must be different variables. Return 0 iff
+ both results are exact, more precisely it returns s+4c where s=0
+ if SOP is exact, s=1 if SOP is larger than the sine of OP, s=2 if
+ SOP is smaller than the sine of OP, and similarly for c and the
+ cosine of OP.
+
+ -- Function: int mpfr_sec (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_csc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_cot (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the secant of OP, cosecant of OP, cotangent of OP,
+ rounded in the direction RND.
+
+ -- Function: int mpfr_acos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_asin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_atan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the arc-cosine, arc-sine or arc-tangent of OP, rounded
+ in the direction RND. Note that since `acos(-1)' returns the
+ floating-point number closest to Pi according to the given
+ rounding mode, this number might not be in the output range 0 <=
+ ROP < \pi of the arc-cosine function; still, the result lies in
+ the image of the output range by the rounding function. The same
+ holds for `asin(-1)', `asin(1)', `atan(-Inf)', `atan(+Inf)' or for
+ `atan(op)' with large OP and small precision of ROP.
+
+ -- Function: int mpfr_atan2 (mpfr_t ROP, mpfr_t Y, mpfr_t X,
+ mpfr_rnd_t RND)
+ Set ROP to the arc-tangent2 of Y and X, rounded in the direction
+ RND: if `x > 0', `atan2(y, x) = atan (y/x)'; if `x < 0', `atan2(y,
+ x) = sign(y)*(Pi - atan (abs(y/x)))', thus a number from -Pi to Pi.
+ As for `atan', in case the exact mathematical result is +Pi or -Pi,
+ its rounded result might be outside the function output range.
+
+ `atan2(y, 0)' does not raise any floating-point exception.
+ Special values are handled as described in the ISO C99 and IEEE
+ 754-2008 standards for the `atan2' function:
+ * `atan2(+0, -0)' returns +Pi.
+
+ * `atan2(-0, -0)' returns -Pi.
+
+ * `atan2(+0, +0)' returns +0.
+
+ * `atan2(-0, +0)' returns -0.
+
+ * `atan2(+0, x)' returns +Pi for x < 0.
+
+ * `atan2(-0, x)' returns -Pi for x < 0.
+
+ * `atan2(+0, x)' returns +0 for x > 0.
+
+ * `atan2(-0, x)' returns -0 for x > 0.
+
+ * `atan2(y, 0)' returns -Pi/2 for y < 0.
+
+ * `atan2(y, 0)' returns +Pi/2 for y > 0.
+
+ * `atan2(+Inf, -Inf)' returns +3*Pi/4.
+
+ * `atan2(-Inf, -Inf)' returns -3*Pi/4.
+
+ * `atan2(+Inf, +Inf)' returns +Pi/4.
+
+ * `atan2(-Inf, +Inf)' returns -Pi/4.
+
+ * `atan2(+Inf, x)' returns +Pi/2 for finite x.
+
+ * `atan2(-Inf, x)' returns -Pi/2 for finite x.
+
+ * `atan2(y, -Inf)' returns +Pi for finite y > 0.
+
+ * `atan2(y, -Inf)' returns -Pi for finite y < 0.
+
+ * `atan2(y, +Inf)' returns +0 for finite y > 0.
+
+ * `atan2(y, +Inf)' returns -0 for finite y < 0.
+
+ -- Function: int mpfr_cosh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_sinh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_tanh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the hyperbolic cosine, sine or tangent of OP, rounded
+ in the direction RND.
+
+ -- Function: int mpfr_sinh_cosh (mpfr_t SOP, mpfr_t COP, mpfr_t OP,
+ mpfr_rnd_t RND)
+ Set simultaneously SOP to the hyperbolic sine of OP and COP to the
+ hyperbolic cosine of OP, rounded in the direction RND with the
+ corresponding precision of SOP and COP, which must be different
+ variables. Return 0 iff both results are exact (see
+ `mpfr_sin_cos' for a more detailed description of the return
+ value).
+
+ -- Function: int mpfr_sech (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_csch (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_coth (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the hyperbolic secant of OP, cosecant of OP, cotangent
+ of OP, rounded in the direction RND.
+
+ -- Function: int mpfr_acosh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_asinh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_atanh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the inverse hyperbolic cosine, sine or tangent of OP,
+ rounded in the direction RND.
+
+ -- Function: int mpfr_fac_ui (mpfr_t ROP, unsigned long int OP,
+ mpfr_rnd_t RND)
+ Set ROP to the factorial of OP, rounded in the direction RND.
+
+ -- Function: int mpfr_log1p (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the logarithm of one plus OP, rounded in the direction
+ RND.
+
+ -- Function: int mpfr_expm1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the exponential of OP followed by a subtraction by one,
+ rounded in the direction RND.
+
+ -- Function: int mpfr_eint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the exponential integral of OP, rounded in the
+ direction RND. For positive OP, the exponential integral is the
+ sum of Euler's constant, of the logarithm of OP, and of the sum
+ for k from 1 to infinity of OP to the power k, divided by k and
+ factorial(k). For negative OP, ROP is set to NaN (this definition
+ for negative argument follows formula 5.1.2 from the Handbook of
+ Mathematical Functions from Abramowitz and Stegun, a future
+ version might use another definition).
+
+ -- Function: int mpfr_li2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to real part of the dilogarithm of OP, rounded in the
+ direction RND. MPFR defines the dilogarithm function as the
+ integral of -log(1-t)/t from 0 to OP.
+
+ -- Function: int mpfr_gamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the value of the Gamma function on OP, rounded in the
+ direction RND. When OP is a negative integer, ROP is set to NaN.
+
+ -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the value of the logarithm of the Gamma function on OP,
+ rounded in the direction RND. When -2K-1 <= OP <= -2K, K being a
+ non-negative integer, ROP is set to NaN. See also `mpfr_lgamma'.
+
+ -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP,
+ mpfr_rnd_t RND)
+ Set ROP to the value of the logarithm of the absolute value of the
+ Gamma function on OP, rounded in the direction RND. The sign (1 or
+ -1) of Gamma(OP) is returned in the object pointed to by SIGNP.
+ When OP is an infinity or a non-positive integer, set ROP to +Inf.
+ When OP is NaN, -Inf or a negative integer, *SIGNP is undefined,
+ and when OP is ±0, *SIGNP is the sign of the zero.
+
+ -- Function: int mpfr_digamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the value of the Digamma (sometimes also called Psi)
+ function on OP, rounded in the direction RND. When OP is a
+ negative integer, set ROP to NaN.
+
+ -- Function: int mpfr_zeta (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_zeta_ui (mpfr_t ROP, unsigned long OP,
+ mpfr_rnd_t RND)
+ Set ROP to the value of the Riemann Zeta function on OP, rounded
+ in the direction RND.
+
+ -- Function: int mpfr_erf (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_erfc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the value of the error function on OP (resp. the
+ complementary error function on OP) rounded in the direction RND.
+
+ -- Function: int mpfr_j0 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_j1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_jn (mpfr_t ROP, long N, mpfr_t OP, mpfr_rnd_t
+ RND)
+ Set ROP to the value of the first kind Bessel function of order 0,
+ (resp. 1 and N) on OP, rounded in the direction RND. When OP is
+ NaN, ROP is always set to NaN. When OP is plus or minus Infinity,
+ ROP is set to +0. When OP is zero, and N is not zero, ROP is set
+ to +0 or -0 depending on the parity and sign of N, and the sign of
+ OP.
+
+ -- Function: int mpfr_y0 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_y1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_yn (mpfr_t ROP, long N, mpfr_t OP, mpfr_rnd_t
+ RND)
+ Set ROP to the value of the second kind Bessel function of order 0
+ (resp. 1 and N) on OP, rounded in the direction RND. When OP is
+ NaN or negative, ROP is always set to NaN. When OP is +Inf, ROP is
+ set to +0. When OP is zero, ROP is set to +Inf or -Inf depending
+ on the parity and sign of N.
+
+ -- Function: int mpfr_fma (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
+ OP3, mpfr_rnd_t RND)
+ -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
+ OP3, mpfr_rnd_t RND)
+ Set ROP to (OP1 times OP2) + OP3 (resp. (OP1 times OP2) - OP3)
+ rounded in the direction RND.
+
+ -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to the arithmetic-geometric mean of OP1 and OP2, rounded
+ in the direction RND. The arithmetic-geometric mean is the common
+ limit of the sequences U_N and V_N, where U_0=OP1, V_0=OP2,
+ U_(N+1) is the arithmetic mean of U_N and V_N, and V_(N+1) is the
+ geometric mean of U_N and V_N. If any operand is negative, set
+ ROP to NaN.
+
+ -- Function: int mpfr_hypot (mpfr_t ROP, mpfr_t X, mpfr_t Y,
+ mpfr_rnd_t RND)
+ Set ROP to the Euclidean norm of X and Y, i.e., the square root of
+ the sum of the squares of X and Y, rounded in the direction RND.
+ Special values are handled as described in Section F.9.4.3 of the
+ ISO C99 and IEEE 754-2008 standards: If X or Y is an infinity,
+ then +Inf is returned in ROP, even if the other number is NaN.
+
+ -- Function: int mpfr_ai (mpfr_t ROP, mpfr_t X, mpfr_rnd_t RND)
+ Set ROP to the value of the Airy function Ai on X, rounded in the
+ direction RND. When X is NaN, ROP is always set to NaN. When X is
+ +Inf or -Inf, ROP is +0. The current implementation is not
+ intended to be used with large arguments. It works with abs(X)
+ typically smaller than 500. For larger arguments, other methods
+ should be used and will be implemented in a future version.
+
+ -- Function: int mpfr_const_log2 (mpfr_t ROP, mpfr_rnd_t RND)
+ -- Function: int mpfr_const_pi (mpfr_t ROP, mpfr_rnd_t RND)
+ -- Function: int mpfr_const_euler (mpfr_t ROP, mpfr_rnd_t RND)
+ -- Function: int mpfr_const_catalan (mpfr_t ROP, mpfr_rnd_t RND)
+ Set ROP to the logarithm of 2, the value of Pi, of Euler's
+ constant 0.577..., of Catalan's constant 0.915..., respectively,
+ rounded in the direction RND. These functions cache the computed
+ values to avoid other calculations if a lower or equal precision
+ is requested. To free these caches, use `mpfr_free_cache'.
+
+ -- Function: void mpfr_free_cache (void)
+ Free various caches used by MPFR internally, in particular the
+ caches used by the functions computing constants
+ (`mpfr_const_log2', `mpfr_const_pi', `mpfr_const_euler' and
+ `mpfr_const_catalan'). You should call this function before
+ terminating a thread, even if you did not call these functions
+ directly (they could have been called internally).
+
+ -- Function: int mpfr_sum (mpfr_t ROP, mpfr_ptr const TAB[], unsigned
+ long int N, mpfr_rnd_t RND)
+ Set ROP to the sum of all elements of TAB, whose size is N,
+ rounded in the direction RND. Warning: for efficiency reasons, TAB
+ is an array of pointers to `mpfr_t', not an array of `mpfr_t'. If
+ the returned `int' value is zero, ROP is guaranteed to be the
+ exact sum; otherwise ROP might be smaller than, equal to, or
+ larger than the exact sum (in accordance to the rounding mode).
+ However, `mpfr_sum' does guarantee the result is correctly rounded.
+
+
+File: mpfr.info, Node: Input and Output Functions, Next: Formatted Output Functions, Prev: Special Functions, Up: MPFR Interface
+
+5.8 Input and Output Functions
+==============================
+
+This section describes functions that perform input from an input/output
+stream, and functions that output to an input/output stream. Passing a
+null pointer for a `stream' to any of these functions will make them
+read from `stdin' and write to `stdout', respectively.
+
+ When using any of these functions, you must include the `<stdio.h>'
+standard header before `mpfr.h', to allow `mpfr.h' to define prototypes
+for these functions.
+
+ -- Function: size_t mpfr_out_str (FILE *STREAM, int BASE, size_t N,
+ mpfr_t OP, mpfr_rnd_t RND)
+ Output OP on stream STREAM, as a string of digits in base BASE,
+ rounded in the direction RND. The base may vary from 2 to 62.
+ Print N significant digits exactly, or if N is 0, enough digits so
+ that OP can be read back exactly (see `mpfr_get_str').
+
+ In addition to the significant digits, a decimal point (defined by
+ the current locale) at the right of the first digit and a trailing
+ exponent in base 10, in the form `eNNN', are printed. If BASE is
+ greater than 10, `@' will be used instead of `e' as exponent
+ delimiter.
+
+ Return the number of characters written, or if an error occurred,
+ return 0.
+
+ -- Function: size_t mpfr_inp_str (mpfr_t ROP, FILE *STREAM, int BASE,
+ mpfr_rnd_t RND)
+ Input a string in base BASE from stream STREAM, rounded in the
+ direction RND, and put the read float in ROP.
+
+ This function reads a word (defined as a sequence of characters
+ between whitespace) and parses it using `mpfr_set_str'. See the
+ documentation of `mpfr_strtofr' for a detailed description of the
+ valid string formats.
+
+ Return the number of bytes read, or if an error occurred, return 0.
+
+
+File: mpfr.info, Node: Formatted Output Functions, Next: Integer Related Functions, Prev: Input and Output Functions, Up: MPFR Interface
+
+5.9 Formatted Output Functions
+==============================
+
+5.9.1 Requirements
+------------------
+
+The class of `mpfr_printf' functions provides formatted output in a
+similar manner as the standard C `printf'. These functions are defined
+only if your system supports ISO C variadic functions and the
+corresponding argument access macros.
+
+ When using any of these functions, you must include the `<stdio.h>'
+standard header before `mpfr.h', to allow `mpfr.h' to define prototypes
+for these functions.
+
+5.9.2 Format String
+-------------------
+
+The format specification accepted by `mpfr_printf' is an extension of
+the `printf' one. The conversion specification is of the form:
+ % [flags] [width] [.[precision]] [type] [rounding] conv
+ `flags', `width', and `precision' have the same meaning as for the
+standard `printf' (in particular, notice that the `precision' is
+related to the number of digits displayed in the base chosen by `conv'
+and not related to the internal precision of the `mpfr_t' variable).
+`mpfr_printf' accepts the same `type' specifiers as GMP (except the
+non-standard and deprecated `q', use `ll' instead), namely the length
+modifiers defined in the C standard:
+
+ `h' `short'
+ `hh' `char'
+ `j' `intmax_t' or `uintmax_t'
+ `l' `long' or `wchar_t'
+ `ll' `long long'
+ `L' `long double'
+ `t' `ptrdiff_t'
+ `z' `size_t'
+
+ and the `type' specifiers defined in GMP plus `R' and `P' specific
+to MPFR (the second column in the table below shows the type of the
+argument read in the argument list and the kind of `conv' specifier to
+use after the `type' specifier):
+
+ `F' `mpf_t', float conversions
+ `Q' `mpq_t', integer conversions
+ `M' `mp_limb_t', integer conversions
+ `N' `mp_limb_t' array, integer conversions
+ `Z' `mpz_t', integer conversions
+ `P' `mpfr_prec_t', integer conversions
+ `R' `mpfr_t', float conversions
+
+ The `type' specifiers have the same restrictions as those mentioned
+in the GMP documentation: *note Formatted Output Strings:
+(gmp.info)Formatted Output Strings. In particular, the `type'
+specifiers (except `R' and `P') are supported only if they are
+supported by `gmp_printf' in your GMP build; this implies that the
+standard specifiers, such as `t', must _also_ be supported by your C
+library if you want to use them.
+
+ The `rounding' field is specific to `mpfr_t' arguments and should
+not be used with other types.
+
+ With conversion specification not involving `P' and `R' types,
+`mpfr_printf' behaves exactly as `gmp_printf'.
+
+ The `P' type specifies that a following `o', `u', `x', or `X'
+conversion specifier applies to a `mpfr_prec_t' argument. It is needed
+because the `mpfr_prec_t' type does not necessarily correspond to an
+`unsigned int' or any fixed standard type. The `precision' field
+specifies the minimum number of digits to appear. The default
+`precision' is 1. For example:
+ mpfr_t x;
+ mpfr_prec_t p;
+ mpfr_init (x);
+ ...
+ p = mpfr_get_prec (x);
+ mpfr_printf ("variable x with %Pu bits", p);
+
+ The `R' type specifies that a following `a', `A', `b', `e', `E',
+`f', `F', `g', `G', or `n' conversion specifier applies to a `mpfr_t'
+argument. The `R' type can be followed by a `rounding' specifier
+denoted by one of the following characters:
+
+ `U' round toward plus infinity
+ `D' round toward minus infinity
+ `Y' round away from zero
+ `Z' round toward zero
+ `N' round to nearest (with ties to even)
+ `*' rounding mode indicated by the
+ `mpfr_rnd_t' argument just before the
+ corresponding `mpfr_t' variable.
+
+ The default rounding mode is rounding to nearest. The following
+three examples are equivalent:
+ mpfr_t x;
+ mpfr_init (x);
+ ...
+ mpfr_printf ("%.128Rf", x);
+ mpfr_printf ("%.128RNf", x);
+ mpfr_printf ("%.128R*f", MPFR_RNDN, x);
+
+ Note that the rounding away from zero mode is specified with `Y'
+because ISO C reserves the `A' specifier for hexadecimal output (see
+below).
+
+ The output `conv' specifiers allowed with `mpfr_t' parameter are:
+
+ `a' `A' hex float, C99 style
+ `b' binary output
+ `e' `E' scientific format float
+ `f' `F' fixed point float
+ `g' `G' fixed or scientific float
+
+ The conversion specifier `b' which displays the argument in binary is
+specific to `mpfr_t' arguments and should not be used with other types.
+Other conversion specifiers have the same meaning as for a `double'
+argument.
+
+ In case of non-decimal output, only the significand is written in the
+specified base, the exponent is always displayed in decimal. Special
+values are always displayed as `nan', `-inf', and `inf' for `a', `b',
+`e', `f', and `g' specifiers and `NAN', `-INF', and `INF' for `A', `E',
+`F', and `G' specifiers.
+
+ If the `precision' field is not empty, the `mpfr_t' number is
+rounded to the given precision in the direction specified by the
+rounding mode. If the precision is zero with rounding to nearest mode
+and one of the following `conv' specifiers: `a', `A', `b', `e', `E',
+tie case is rounded to even when it lies between two consecutive values
+at the wanted precision which have the same exponent, otherwise, it is
+rounded away from zero. For instance, 85 is displayed as "8e+1" and 95
+is displayed as "1e+2" with the format specification `"%.0RNe"'. This
+also applies when the `g' (resp. `G') conversion specifier uses the `e'
+(resp. `E') style. If the precision is set to a value greater than the
+maximum value for an `int', it will be silently reduced down to
+`INT_MAX'.
+
+ If the `precision' field is empty (as in `%Re' or `%.RE') with
+`conv' specifier `e' and `E', the number is displayed with enough
+digits so that it can be read back exactly, assuming that the input and
+output variables have the same precision and that the input and output
+rounding modes are both rounding to nearest (as for `mpfr_get_str').
+The default precision for an empty `precision' field with `conv'
+specifiers `f', `F', `g', and `G' is 6.
+
+5.9.3 Functions
+---------------
+
+For all the following functions, if the number of characters which
+ought to be written appears to exceed the maximum limit for an `int',
+nothing is written in the stream (resp. to `stdout', to BUF, to STR),
+the function returns -1, sets the _erange_ flag, and (in POSIX system
+only) `errno' is set to `EOVERFLOW'.
+
+ -- Function: int mpfr_fprintf (FILE *STREAM, const char *TEMPLATE, ...)
+ -- Function: int mpfr_vfprintf (FILE *STREAM, const char *TEMPLATE,
+ va_list AP)
+ Print to the stream STREAM the optional arguments under the
+ control of the template string TEMPLATE. Return the number of
+ characters written or a negative value if an error occurred.
+
+ -- Function: int mpfr_printf (const char *TEMPLATE, ...)
+ -- Function: int mpfr_vprintf (const char *TEMPLATE, va_list AP)
+ Print to `stdout' the optional arguments under the control of the
+ template string TEMPLATE. Return the number of characters written
+ or a negative value if an error occurred.
+
+ -- Function: int mpfr_sprintf (char *BUF, const char *TEMPLATE, ...)
+ -- Function: int mpfr_vsprintf (char *BUF, const char *TEMPLATE,
+ va_list AP)
+ Form a null-terminated string corresponding to the optional
+ arguments under the control of the template string TEMPLATE, and
+ print it in BUF. No overlap is permitted between BUF and the other
+ arguments. Return the number of characters written in the array
+ BUF _not counting_ the terminating null character or a negative
+ value if an error occurred.
+
+ -- Function: int mpfr_snprintf (char *BUF, size_t N, const char
+ *TEMPLATE, ...)
+ -- Function: int mpfr_vsnprintf (char *BUF, size_t N, const char
+ *TEMPLATE, va_list AP)
+ Form a null-terminated string corresponding to the optional
+ arguments under the control of the template string TEMPLATE, and
+ print it in BUF. If N is zero, nothing is written and BUF may be a
+ null pointer, otherwise, the N-1 first characters are written in
+ BUF and the N-th is a null character. Return the number of
+ characters that would have been written had N be sufficiently
+ large, _not counting_ the terminating null character, or a
+ negative value if an error occurred.
+
+ -- Function: int mpfr_asprintf (char **STR, const char *TEMPLATE, ...)
+ -- Function: int mpfr_vasprintf (char **STR, const char *TEMPLATE,
+ va_list AP)
+ Write their output as a null terminated string in a block of
+ memory allocated using the current allocation function. A pointer
+ to the block is stored in STR. The block of memory must be freed
+ using `mpfr_free_str'. The return value is the number of
+ characters written in the string, excluding the null-terminator,
+ or a negative value if an error occurred.
+
+
+File: mpfr.info, Node: Integer Related Functions, Next: Rounding Related Functions, Prev: Formatted Output Functions, Up: MPFR Interface
+
+5.10 Integer and Remainder Related Functions
+============================================
+
+ -- Function: int mpfr_rint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_ceil (mpfr_t ROP, mpfr_t OP)
+ -- Function: int mpfr_floor (mpfr_t ROP, mpfr_t OP)
+ -- Function: int mpfr_round (mpfr_t ROP, mpfr_t OP)
+ -- Function: int mpfr_trunc (mpfr_t ROP, mpfr_t OP)
+ Set ROP to OP rounded to an integer. `mpfr_rint' rounds to the
+ nearest representable integer in the given direction RND,
+ `mpfr_ceil' rounds to the next higher or equal representable
+ integer, `mpfr_floor' to the next lower or equal representable
+ integer, `mpfr_round' to the nearest representable integer,
+ rounding halfway cases away from zero (as in the roundTiesToAway
+ mode of IEEE 754-2008), and `mpfr_trunc' to the next representable
+ integer toward zero.
+
+ The returned value is zero when the result is exact, positive when
+ it is greater than the original value of OP, and negative when it
+ is smaller. More precisely, the returned value is 0 when OP is an
+ integer representable in ROP, 1 or -1 when OP is an integer that
+ is not representable in ROP, 2 or -2 when OP is not an integer.
+
+ Note that `mpfr_round' is different from `mpfr_rint' called with
+ the rounding to nearest mode (where halfway cases are rounded to
+ an even integer or significand). Note also that no double rounding
+ is performed; for instance, 10.5 (1010.1 in binary) is rounded by
+ `mpfr_rint' with rounding to nearest to 12 (1100 in binary) in
+ 2-bit precision, because the two enclosing numbers representable
+ on two bits are 8 and 12, and the closest is 12. (If one first
+ rounded to an integer, one would round 10.5 to 10 with even
+ rounding, and then 10 would be rounded to 8 again with even
+ rounding.)
+
+ -- Function: int mpfr_rint_ceil (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ -- Function: int mpfr_rint_floor (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t
+ RND)
+ -- Function: int mpfr_rint_round (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t
+ RND)
+ -- Function: int mpfr_rint_trunc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t
+ RND)
+ Set ROP to OP rounded to an integer. `mpfr_rint_ceil' rounds to
+ the next higher or equal integer, `mpfr_rint_floor' to the next
+ lower or equal integer, `mpfr_rint_round' to the nearest integer,
+ rounding halfway cases away from zero, and `mpfr_rint_trunc' to
+ the next integer toward zero. If the result is not representable,
+ it is rounded in the direction RND. The returned value is the
+ ternary value associated with the considered round-to-integer
+ function (regarded in the same way as any other mathematical
+ function). Contrary to `mpfr_rint', those functions do perform a
+ double rounding: first OP is rounded to the nearest integer in the
+ direction given by the function name, then this nearest integer
+ (if not representable) is rounded in the given direction RND. For
+ example, `mpfr_rint_round' with rounding to nearest and a precision
+ of two bits rounds 6.5 to 7 (halfway cases away from zero), then 7
+ is rounded to 8 by the round-even rule, despite the fact that 6 is
+ also representable on two bits, and is closer to 6.5 than 8.
+
+ -- Function: int mpfr_frac (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
+ Set ROP to the fractional part of OP, having the same sign as OP,
+ rounded in the direction RND (unlike in `mpfr_rint', RND affects
+ only how the exact fractional part is rounded, not how the
+ fractional part is generated).
+
+ -- Function: int mpfr_modf (mpfr_t IOP, mpfr_t FOP, mpfr_t OP,
+ mpfr_rnd_t RND)
+ Set simultaneously IOP to the integral part of OP and FOP to the
+ fractional part of OP, rounded in the direction RND with the
+ corresponding precision of IOP and FOP (equivalent to
+ `mpfr_trunc(IOP, OP, RND)' and `mpfr_frac(FOP, OP, RND)'). The
+ variables IOP and FOP must be different. Return 0 iff both results
+ are exact (see `mpfr_sin_cos' for a more detailed description of
+ the return value).
+
+ -- Function: int mpfr_fmod (mpfr_t R, mpfr_t X, mpfr_t Y, mpfr_rnd_t
+ RND)
+ -- Function: int mpfr_remainder (mpfr_t R, mpfr_t X, mpfr_t Y,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_remquo (mpfr_t R, long* Q, mpfr_t X, mpfr_t Y,
+ mpfr_rnd_t RND)
+ Set R to the value of X - NY, rounded according to the direction
+ RND, where N is the integer quotient of X divided by Y, defined as
+ follows: N is rounded toward zero for `mpfr_fmod', and to the
+ nearest integer (ties rounded to even) for `mpfr_remainder' and
+ `mpfr_remquo'.
+
+ Special values are handled as described in Section F.9.7.1 of the
+ ISO C99 standard: If X is infinite or Y is zero, R is NaN. If Y
+ is infinite and X is finite, R is X rounded to the precision of R.
+ If R is zero, it has the sign of X. The return value is the
+ ternary value corresponding to R.
+
+ Additionally, `mpfr_remquo' stores the low significant bits from
+ the quotient N in *Q (more precisely the number of bits in a
+ `long' minus one), with the sign of X divided by Y (except if
+ those low bits are all zero, in which case zero is returned).
+ Note that X may be so large in magnitude relative to Y that an
+ exact representation of the quotient is not practical. The
+ `mpfr_remainder' and `mpfr_remquo' functions are useful for
+ additive argument reduction.
+
+ -- Function: int mpfr_integer_p (mpfr_t OP)
+ Return non-zero iff OP is an integer.
+
+
+File: mpfr.info, Node: Rounding Related Functions, Next: Miscellaneous Functions, Prev: Integer Related Functions, Up: MPFR Interface
+
+5.11 Rounding Related Functions
+===============================
+
+ -- Function: void mpfr_set_default_rounding_mode (mpfr_rnd_t RND)
+ Set the default rounding mode to RND. The default rounding mode
+ is to nearest initially.
+
+ -- Function: mpfr_rnd_t mpfr_get_default_rounding_mode (void)
+ Get the default rounding mode.
+
+ -- Function: int mpfr_prec_round (mpfr_t X, mpfr_prec_t PREC,
+ mpfr_rnd_t RND)
+ Round X according to RND with precision PREC, which must be an
+ integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
+ behavior is undefined). If PREC is greater or equal to the
+ precision of X, then new space is allocated for the significand,
+ and it is filled with zeros. Otherwise, the significand is
+ rounded to precision PREC with the given direction. In both cases,
+ the precision of X is changed to PREC.
+
+ Here is an example of how to use `mpfr_prec_round' to implement
+ Newton's algorithm to compute the inverse of A, assuming X is
+ already an approximation to N bits:
+ mpfr_set_prec (t, 2 * n);
+ mpfr_set (t, a, MPFR_RNDN); /* round a to 2n bits */
+ mpfr_mul (t, t, x, MPFR_RNDN); /* t is correct to 2n bits */
+ mpfr_ui_sub (t, 1, t, MPFR_RNDN); /* high n bits cancel with 1 */
+ mpfr_prec_round (t, n, MPFR_RNDN); /* t is correct to n bits */
+ mpfr_mul (t, t, x, MPFR_RNDN); /* t is correct to n bits */
+ mpfr_prec_round (x, 2 * n, MPFR_RNDN); /* exact */
+ mpfr_add (x, x, t, MPFR_RNDN); /* x is correct to 2n bits */
+
+ -- Function: int mpfr_can_round (mpfr_t B, mpfr_exp_t ERR, mpfr_rnd_t
+ RND1, mpfr_rnd_t RND2, mpfr_prec_t PREC)
+ Assuming B is an approximation of an unknown number X in the
+ direction RND1 with error at most two to the power E(b)-ERR where
+ E(b) is the exponent of B, return a non-zero value if one is able
+ to round correctly X to precision PREC with the direction RND2,
+ and 0 otherwise (including for NaN and Inf). This function *does
+ not modify* its arguments.
+
+ If RND1 is `MPFR_RNDN', then the sign of the error is unknown, but
+ its absolute value is the same, so that the possible range is
+ twice as large as with a directed rounding for RND1.
+
+ Note: if one wants to also determine the correct *note ternary
+ value:: when rounding B to precision PREC with rounding mode RND,
+ a useful trick is the following: if (mpfr_can_round (b, err, MPFR_RNDN, MPFR_RNDZ, prec + (rnd == MPFR_RNDN)))
+ ...
+ Indeed, if RND is `MPFR_RNDN', this will check if one can round
+ to PREC+1 bits with a directed rounding: if so, one can surely
+ round to nearest to PREC bits, and in addition one can determine
+ the correct ternary value, which would not be the case when B is
+ near from a value exactly representable on PREC bits.
+
+ -- Function: mpfr_prec_t mpfr_min_prec (mpfr_t X)
+ Return the minimal number of bits required to store the
+ significand of X, and 0 for special values, including 0. (Warning:
+ the returned value can be less than `MPFR_PREC_MIN'.)
+
+ The function name is subject to change.
+
+ -- Function: const char * mpfr_print_rnd_mode (mpfr_rnd_t RND)
+ Return a string ("MPFR_RNDD", "MPFR_RNDU", "MPFR_RNDN",
+ "MPFR_RNDZ", "MPFR_RNDA") corresponding to the rounding mode RND,
+ or a null pointer if RND is an invalid rounding mode.
+
+
+File: mpfr.info, Node: Miscellaneous Functions, Next: Exception Related Functions, Prev: Rounding Related Functions, Up: MPFR Interface
+
+5.12 Miscellaneous Functions
+============================
+
+ -- Function: void mpfr_nexttoward (mpfr_t X, mpfr_t Y)
+ If X or Y is NaN, set X to NaN. If X and Y are equal, X is
+ unchanged. Otherwise, if X is different from Y, replace X by the
+ next floating-point number (with the precision of X and the
+ current exponent range) in the direction of Y (the infinite values
+ are seen as the smallest and largest floating-point numbers). If
+ the result is zero, it keeps the same sign. No underflow or
+ overflow is generated.
+
+ -- Function: void mpfr_nextabove (mpfr_t X)
+ -- Function: void mpfr_nextbelow (mpfr_t X)
+ Equivalent to `mpfr_nexttoward' where Y is plus infinity (resp.
+ minus infinity).
+
+ -- Function: int mpfr_min (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ -- Function: int mpfr_max (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ Set ROP to the minimum (resp. maximum) of OP1 and OP2. If OP1 and
+ OP2 are both NaN, then ROP is set to NaN. If OP1 or OP2 is NaN,
+ then ROP is set to the numeric value. If OP1 and OP2 are zeros of
+ different signs, then ROP is set to -0 (resp. +0).
+
+ -- Function: int mpfr_urandomb (mpfr_t ROP, gmp_randstate_t STATE)
+ Generate a uniformly distributed random float in the interval 0 <=
+ ROP < 1. More precisely, the number can be seen as a float with a
+ random non-normalized significand and exponent 0, which is then
+ normalized (thus if E denotes the exponent after normalization,
+ then the least -E significant bits of the significand are always
+ 0).
+
+ Return 0, unless the exponent is not in the current exponent
+ range, in which case ROP is set to NaN and a non-zero value is
+ returned (this should never happen in practice, except in very
+ specific cases). The second argument is a `gmp_randstate_t'
+ structure which should be created using the GMP `gmp_randinit'
+ function (see the GMP manual).
+
+ Note: for a given version of MPFR, the returned value of ROP and
+ the new value of STATE (which controls further random values) do
+ not depend on the machine word size.
+
+ -- Function: int mpfr_urandom (mpfr_t ROP, gmp_randstate_t STATE,
+ mpfr_rnd_t RND)
+ Generate a uniformly distributed random float. The floating-point
+ number ROP can be seen as if a random real number is generated
+ according to the continuous uniform distribution on the interval
+ [0, 1] and then rounded in the direction RND.
+
+ The second argument is a `gmp_randstate_t' structure which should
+ be created using the GMP `gmp_randinit' function (see the GMP
+ manual).
+
+ Note: the note for `mpfr_urandomb' holds too. In addition, the
+ exponent range and the rounding mode might have a side effect on
+ the next random state.
+
+ -- Function: int mpfr_grandom (mpfr_t ROP1, mpfr_t ROP2,
+ gmp_randstate_t STATE, mpfr_rnd_t RND)
+ Generate two random floats according to a standard normal gaussian
+ distribution. If ROP2 is a null pointer, then only one value is
+ generated and stored in ROP1.
+
+ The floating-point number ROP1 (and ROP2) can be seen as if a
+ random real number were generated according to the standard normal
+ gaussian distribution and then rounded in the direction RND.
+
+ The third argument is a `gmp_randstate_t' structure, which should
+ be created using the GMP `gmp_randinit' function (see the GMP
+ manual).
+
+ The combination of the ternary values is returned like with
+ `mpfr_sin_cos'. If ROP2 is a null pointer, the second ternary
+ value is assumed to be 0 (note that the encoding of the only
+ ternary value is not the same as the usual encoding for functions
+ that return only one result). Otherwise the ternary value of a
+ random number is always non-zero.
+
+ Note: the note for `mpfr_urandomb' holds too. In addition, the
+ exponent range and the rounding mode might have a side effect on
+ the next random state.
+
+ -- Function: mpfr_exp_t mpfr_get_exp (mpfr_t X)
+ Return the exponent of X, assuming that X is a non-zero ordinary
+ number and the significand is considered in [1/2,1). The behavior
+ for NaN, infinity or zero is undefined.
+
+ -- Function: int mpfr_set_exp (mpfr_t X, mpfr_exp_t E)
+ Set the exponent of X if E is in the current exponent range, and
+ return 0 (even if X is not a non-zero ordinary number); otherwise,
+ return a non-zero value. The significand is assumed to be in
+ [1/2,1).
+
+ -- Function: int mpfr_signbit (mpfr_t OP)
+ Return a non-zero value iff OP has its sign bit set (i.e., if it is
+ negative, -0, or a NaN whose representation has its sign bit set).
+
+ -- Function: int mpfr_setsign (mpfr_t ROP, mpfr_t OP, int S,
+ mpfr_rnd_t RND)
+ Set the value of ROP from OP, rounded toward the given direction
+ RND, then set (resp. clear) its sign bit if S is non-zero (resp.
+ zero), even when OP is a NaN.
+
+ -- Function: int mpfr_copysign (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ Set the value of ROP from OP1, rounded toward the given direction
+ RND, then set its sign bit to that of OP2 (even when OP1 or OP2 is
+ a NaN). This function is equivalent to `mpfr_setsign (ROP, OP1,
+ mpfr_signbit (OP2), RND)'.
+
+ -- Function: const char * mpfr_get_version (void)
+ Return the MPFR version, as a null-terminated string.
+
+ -- Macro: MPFR_VERSION
+ -- Macro: MPFR_VERSION_MAJOR
+ -- Macro: MPFR_VERSION_MINOR
+ -- Macro: MPFR_VERSION_PATCHLEVEL
+ -- Macro: MPFR_VERSION_STRING
+ `MPFR_VERSION' is the version of MPFR as a preprocessing constant.
+ `MPFR_VERSION_MAJOR', `MPFR_VERSION_MINOR' and
+ `MPFR_VERSION_PATCHLEVEL' are respectively the major, minor and
+ patch level of MPFR version, as preprocessing constants.
+ `MPFR_VERSION_STRING' is the version (with an optional suffix, used
+ in development and pre-release versions) as a string constant,
+ which can be compared to the result of `mpfr_get_version' to check
+ at run time the header file and library used match:
+ if (strcmp (mpfr_get_version (), MPFR_VERSION_STRING))
+ fprintf (stderr, "Warning: header and library do not match\n");
+ Note: Obtaining different strings is not necessarily an error, as
+ in general, a program compiled with some old MPFR version can be
+ dynamically linked with a newer MPFR library version (if allowed
+ by the library versioning system).
+
+ -- Macro: long MPFR_VERSION_NUM (MAJOR, MINOR, PATCHLEVEL)
+ Create an integer in the same format as used by `MPFR_VERSION'
+ from the given MAJOR, MINOR and PATCHLEVEL. Here is an example of
+ how to check the MPFR version at compile time:
+ #if (!defined(MPFR_VERSION) || (MPFR_VERSION<MPFR_VERSION_NUM(3,0,0)))
+ # error "Wrong MPFR version."
+ #endif
+
+ -- Function: const char * mpfr_get_patches (void)
+ Return a null-terminated string containing the ids of the patches
+ applied to the MPFR library (contents of the `PATCHES' file),
+ separated by spaces. Note: If the program has been compiled with
+ an older MPFR version and is dynamically linked with a new MPFR
+ library version, the identifiers of the patches applied to the old
+ (compile-time) MPFR version are not available (however this
+ information should not have much interest in general).
+
+ -- Function: int mpfr_buildopt_tls_p (void)
+ Return a non-zero value if MPFR was compiled as thread safe using
+ compiler-level Thread Local Storage (that is, MPFR was built with
+ the `--enable-thread-safe' configure option, see `INSTALL' file),
+ return zero otherwise.
+
+ -- Function: int mpfr_buildopt_decimal_p (void)
+ Return a non-zero value if MPFR was compiled with decimal float
+ support (that is, MPFR was built with the `--enable-decimal-float'
+ configure option), return zero otherwise.
+
+ -- Function: int mpfr_buildopt_gmpinternals_p (void)
+ Return a non-zero value if MPFR was compiled with GMP internals
+ (that is, MPFR was built with either `--with-gmp-build' or
+ `--enable-gmp-internals' configure option), return zero otherwise.
+
+ -- Function: const char * mpfr_buildopt_tune_case (void)
+ Return a string saying which thresholds file has been used at
+ compile time. This file is normally selected from the processor
+ type.
+
+
+File: mpfr.info, Node: Exception Related Functions, Next: Compatibility with MPF, Prev: Miscellaneous Functions, Up: MPFR Interface
+
+5.13 Exception Related Functions
+================================
+
+ -- Function: mpfr_exp_t mpfr_get_emin (void)
+ -- Function: mpfr_exp_t mpfr_get_emax (void)
+ Return the (current) smallest and largest exponents allowed for a
+ floating-point variable. The smallest positive value of a
+ floating-point variable is one half times 2 raised to the smallest
+ exponent and the largest value has the form (1 - epsilon) times 2
+ raised to the largest exponent, where epsilon depends on the
+ precision of the considered variable.
+
+ -- Function: int mpfr_set_emin (mpfr_exp_t EXP)
+ -- Function: int mpfr_set_emax (mpfr_exp_t EXP)
+ Set the smallest and largest exponents allowed for a
+ floating-point variable. Return a non-zero value when EXP is not
+ in the range accepted by the implementation (in that case the
+ smallest or largest exponent is not changed), and zero otherwise.
+ If the user changes the exponent range, it is her/his
+ responsibility to check that all current floating-point variables
+ are in the new allowed range (for example using
+ `mpfr_check_range'), otherwise the subsequent behavior will be
+ undefined, in the sense of the ISO C standard.
+
+ -- Function: mpfr_exp_t mpfr_get_emin_min (void)
+ -- Function: mpfr_exp_t mpfr_get_emin_max (void)
+ -- Function: mpfr_exp_t mpfr_get_emax_min (void)
+ -- Function: mpfr_exp_t mpfr_get_emax_max (void)
+ Return the minimum and maximum of the exponents allowed for
+ `mpfr_set_emin' and `mpfr_set_emax' respectively. These values
+ are implementation dependent, thus a program using
+ `mpfr_set_emax(mpfr_get_emax_max())' or
+ `mpfr_set_emin(mpfr_get_emin_min())' may not be portable.
+
+ -- Function: int mpfr_check_range (mpfr_t X, int T, mpfr_rnd_t RND)
+ This function assumes that X is the correctly-rounded value of some
+ real value Y in the direction RND and some extended exponent
+ range, and that T is the corresponding *note ternary value::. For
+ example, one performed `t = mpfr_log (x, u, rnd)', and Y is the
+ exact logarithm of U. Thus T is negative if X is smaller than Y,
+ positive if X is larger than Y, and zero if X equals Y. This
+ function modifies X if needed to be in the current range of
+ acceptable values: It generates an underflow or an overflow if the
+ exponent of X is outside the current allowed range; the value of T
+ may be used to avoid a double rounding. This function returns zero
+ if the new value of X equals the exact one Y, a positive value if
+ that new value is larger than Y, and a negative value if it is
+ smaller than Y. Note that unlike most functions, the new result X
+ is compared to the (unknown) exact one Y, not the input value X,
+ i.e., the ternary value is propagated.
+
+ Note: If X is an infinity and T is different from zero (i.e., if
+ the rounded result is an inexact infinity), then the overflow flag
+ is set. This is useful because `mpfr_check_range' is typically
+ called (at least in MPFR functions) after restoring the flags that
+ could have been set due to internal computations.
+
+ -- Function: int mpfr_subnormalize (mpfr_t X, int T, mpfr_rnd_t RND)
+ This function rounds X emulating subnormal number arithmetic: if X
+ is outside the subnormal exponent range, it just propagates the
+ *note ternary value:: T; otherwise, it rounds X to precision
+ `EXP(x)-emin+1' according to rounding mode RND and previous
+ ternary value T, avoiding double rounding problems. More
+ precisely in the subnormal domain, denoting by E the value of
+ `emin', X is rounded in fixed-point arithmetic to an integer
+ multiple of two to the power E-1; as a consequence, 1.5 multiplied
+ by two to the power E-1 when T is zero is rounded to two to the
+ power E with rounding to nearest.
+
+ `PREC(x)' is not modified by this function. RND and T must be the
+ rounding mode and the returned ternary value used when computing X
+ (as in `mpfr_check_range'). The subnormal exponent range is from
+ `emin' to `emin+PREC(x)-1'. If the result cannot be represented
+ in the current exponent range (due to a too small `emax'), the
+ behavior is undefined. Note that unlike most functions, the
+ result is compared to the exact one, not the input value X, i.e.,
+ the ternary value is propagated.
+
+ As usual, if the returned ternary value is non zero, the inexact
+ flag is set. Moreover, if a second rounding occurred (because the
+ input X was in the subnormal range), the underflow flag is set.
+
+ This is an example of how to emulate binary double IEEE 754
+arithmetic (binary64 in IEEE 754-2008) using MPFR:
+
+ {
+ mpfr_t xa, xb; int i; volatile double a, b;
+
+ mpfr_set_default_prec (53);
+ mpfr_set_emin (-1073); mpfr_set_emax (1024);
+
+ mpfr_init (xa); mpfr_init (xb);
+
+ b = 34.3; mpfr_set_d (xb, b, MPFR_RNDN);
+ a = 0x1.1235P-1021; mpfr_set_d (xa, a, MPFR_RNDN);
+
+ a /= b;
+ i = mpfr_div (xa, xa, xb, MPFR_RNDN);
+ i = mpfr_subnormalize (xa, i, MPFR_RNDN); /* new ternary value */
+
+ mpfr_clear (xa); mpfr_clear (xb);
+ }
+
+ Warning: this emulates a double IEEE 754 arithmetic with correct
+rounding in the subnormal range, which may not be the case for your
+hardware.
+
+ -- Function: void mpfr_clear_underflow (void)
+ -- Function: void mpfr_clear_overflow (void)
+ -- Function: void mpfr_clear_divby0 (void)
+ -- Function: void mpfr_clear_nanflag (void)
+ -- Function: void mpfr_clear_inexflag (void)
+ -- Function: void mpfr_clear_erangeflag (void)
+ Clear the underflow, overflow, divide-by-zero, invalid, inexact
+ and _erange_ flags.
+
+ -- Function: void mpfr_set_underflow (void)
+ -- Function: void mpfr_set_overflow (void)
+ -- Function: void mpfr_set_divby0 (void)
+ -- Function: void mpfr_set_nanflag (void)
+ -- Function: void mpfr_set_inexflag (void)
+ -- Function: void mpfr_set_erangeflag (void)
+ Set the underflow, overflow, divide-by-zero, invalid, inexact and
+ _erange_ flags.
+
+ -- Function: void mpfr_clear_flags (void)
+ Clear all global flags (underflow, overflow, divide-by-zero,
+ invalid, inexact, _erange_).
+
+ -- Function: int mpfr_underflow_p (void)
+ -- Function: int mpfr_overflow_p (void)
+ -- Function: int mpfr_divby0_p (void)
+ -- Function: int mpfr_nanflag_p (void)
+ -- Function: int mpfr_inexflag_p (void)
+ -- Function: int mpfr_erangeflag_p (void)
+ Return the corresponding (underflow, overflow, divide-by-zero,
+ invalid, inexact, _erange_) flag, which is non-zero iff the flag
+ is set.
+
+
+File: mpfr.info, Node: Compatibility with MPF, Next: Custom Interface, Prev: Exception Related Functions, Up: MPFR Interface
+
+5.14 Compatibility With MPF
+===========================
+
+A header file `mpf2mpfr.h' is included in the distribution of MPFR for
+compatibility with the GNU MP class MPF. By inserting the following
+two lines after the `#include <gmp.h>' line,
+#include <mpfr.h>
+#include <mpf2mpfr.h>
+ any program written for MPF can be compiled directly with MPFR without
+any changes (except the `gmp_printf' functions will not work for
+arguments of type `mpfr_t'). All operations are then performed with
+the default MPFR rounding mode, which can be reset with
+`mpfr_set_default_rounding_mode'.
+
+ Warning: the `mpf_init' and `mpf_init2' functions initialize to
+zero, whereas the corresponding MPFR functions initialize to NaN: this
+is useful to detect uninitialized values, but is slightly incompatible
+with MPF.
+
+ -- Function: void mpfr_set_prec_raw (mpfr_t X, mpfr_prec_t PREC)
+ Reset the precision of X to be *exactly* PREC bits. The only
+ difference with `mpfr_set_prec' is that PREC is assumed to be
+ small enough so that the significand fits into the current
+ allocated memory space for X. Otherwise the behavior is undefined.
+
+ -- Function: int mpfr_eq (mpfr_t OP1, mpfr_t OP2, unsigned long int
+ OP3)
+ Return non-zero if OP1 and OP2 are both non-zero ordinary numbers
+ with the same exponent and the same first OP3 bits, both zero, or
+ both infinities of the same sign. Return zero otherwise. This
+ function is defined for compatibility with MPF, we do not recommend
+ to use it otherwise. Do not use it either if you want to know
+ whether two numbers are close to each other; for instance,
+ 1.011111 and 1.100000 are regarded as different for any value of
+ OP3 larger than 1.
+
+ -- Function: void mpfr_reldiff (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
+ mpfr_rnd_t RND)
+ Compute the relative difference between OP1 and OP2 and store the
+ result in ROP. This function does not guarantee the correct
+ rounding on the relative difference; it just computes
+ |OP1-OP2|/OP1, using the precision of ROP and the rounding mode
+ RND for all operations.
+
+ -- Function: int mpfr_mul_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ -- Function: int mpfr_div_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long
+ int OP2, mpfr_rnd_t RND)
+ These functions are identical to `mpfr_mul_2ui' and `mpfr_div_2ui'
+ respectively. These functions are only kept for compatibility
+ with MPF, one should prefer `mpfr_mul_2ui' and `mpfr_div_2ui'
+ otherwise.
+
+
+File: mpfr.info, Node: Custom Interface, Next: Internals, Prev: Compatibility with MPF, Up: MPFR Interface
+
+5.15 Custom Interface
+=====================
+
+Some applications use a stack to handle the memory and their objects.
+However, the MPFR memory design is not well suited for such a thing. So
+that such applications are able to use MPFR, an auxiliary memory
+interface has been created: the Custom Interface.
+
+ The following interface allows one to use MPFR in two ways:
+ * Either directly store a floating-point number as a `mpfr_t' on the
+ stack.
+
+ * Either store its own representation on the stack and construct a
+ new temporary `mpfr_t' each time it is needed.
+ Nothing has to be done to destroy the floating-point numbers except
+garbaging the used memory: all the memory management (allocating,
+destroying, garbaging) is left to the application.
+
+ Each function in this interface is also implemented as a macro for
+efficiency reasons: for example `mpfr_custom_init (s, p)' uses the
+macro, while `(mpfr_custom_init) (s, p)' uses the function.
+
+ Note 1: MPFR functions may still initialize temporary floating-point
+numbers using `mpfr_init' and similar functions. See Custom Allocation
+(GNU MP).
+
+ Note 2: MPFR functions may use the cached functions (`mpfr_const_pi'
+for example), even if they are not explicitly called. You have to call
+`mpfr_free_cache' each time you garbage the memory iff `mpfr_init',
+through GMP Custom Allocation, allocates its memory on the application
+stack.
+
+ -- Function: size_t mpfr_custom_get_size (mpfr_prec_t PREC)
+ Return the needed size in bytes to store the significand of a
+ floating-point number of precision PREC.
+
+ -- Function: void mpfr_custom_init (void *SIGNIFICAND, mpfr_prec_t
+ PREC)
+ Initialize a significand of precision PREC, where SIGNIFICAND must
+ be an area of `mpfr_custom_get_size (prec)' bytes at least and be
+ suitably aligned for an array of `mp_limb_t' (GMP type, *note
+ Internals::).
+
+ -- Function: void mpfr_custom_init_set (mpfr_t X, int KIND, mpfr_exp_t
+ EXP, mpfr_prec_t PREC, void *SIGNIFICAND)
+ Perform a dummy initialization of a `mpfr_t' and set it to:
+ * if `ABS(kind) == MPFR_NAN_KIND', X is set to NaN;
+
+ * if `ABS(kind) == MPFR_INF_KIND', X is set to the infinity of
+ sign `sign(kind)';
+
+ * if `ABS(kind) == MPFR_ZERO_KIND', X is set to the zero of
+ sign `sign(kind)';
+
+ * if `ABS(kind) == MPFR_REGULAR_KIND', X is set to a regular
+ number: `x = sign(kind)*significand*2^exp'.
+ In all cases, it uses SIGNIFICAND directly for further computing
+ involving X. It will not allocate anything. A floating-point
+ number initialized with this function cannot be resized using
+ `mpfr_set_prec' or `mpfr_prec_round', or cleared using
+ `mpfr_clear'! The SIGNIFICAND must have been initialized with
+ `mpfr_custom_init' using the same precision PREC.
+
+ -- Function: int mpfr_custom_get_kind (mpfr_t X)
+ Return the current kind of a `mpfr_t' as created by
+ `mpfr_custom_init_set'. The behavior of this function for any
+ `mpfr_t' not initialized with `mpfr_custom_init_set' is undefined.
+
+ -- Function: void * mpfr_custom_get_significand (mpfr_t X)
+ Return a pointer to the significand used by a `mpfr_t' initialized
+ with `mpfr_custom_init_set'. The behavior of this function for
+ any `mpfr_t' not initialized with `mpfr_custom_init_set' is
+ undefined.
+
+ -- Function: mpfr_exp_t mpfr_custom_get_exp (mpfr_t X)
+ Return the exponent of X, assuming that X is a non-zero ordinary
+ number. The return value for NaN, Infinity or zero is unspecified
+ but does not produce any trap. The behavior of this function for
+ any `mpfr_t' not initialized with `mpfr_custom_init_set' is
+ undefined.
+
+ -- Function: void mpfr_custom_move (mpfr_t X, void *NEW_POSITION)
+ Inform MPFR that the significand of X has moved due to a garbage
+ collect and update its new position to `new_position'. However
+ the application has to move the significand and the `mpfr_t'
+ itself. The behavior of this function for any `mpfr_t' not
+ initialized with `mpfr_custom_init_set' is undefined.
+
+
+File: mpfr.info, Node: Internals, Prev: Custom Interface, Up: MPFR Interface
+
+5.16 Internals
+==============
+
+A "limb" means the part of a multi-precision number that fits in a
+single word. Usually a limb contains 32 or 64 bits. The C data type
+for a limb is `mp_limb_t'.
+
+ The `mpfr_t' type is internally defined as a one-element array of a
+structure, and `mpfr_ptr' is the C data type representing a pointer to
+this structure. The `mpfr_t' type consists of four fields:
+
+ * The `_mpfr_prec' field is used to store the precision of the
+ variable (in bits); this is not less than `MPFR_PREC_MIN'.
+
+ * The `_mpfr_sign' field is used to store the sign of the variable.
+
+ * The `_mpfr_exp' field stores the exponent. An exponent of 0 means
+ a radix point just above the most significant limb. Non-zero
+ values n are a multiplier 2^n relative to that point. A NaN, an
+ infinity and a zero are indicated by special values of the exponent
+ field.
+
+ * Finally, the `_mpfr_d' field is a pointer to the limbs, least
+ significant limbs stored first. The number of limbs in use is
+ controlled by `_mpfr_prec', namely
+ ceil(`_mpfr_prec'/`mp_bits_per_limb'). Non-singular (i.e.,
+ different from NaN, Infinity or zero) values always have the most
+ significant bit of the most significant limb set to 1. When the
+ precision does not correspond to a whole number of limbs, the
+ excess bits at the low end of the data are zeros.
+
+
+
+File: mpfr.info, Node: API Compatibility, Next: Contributors, Prev: MPFR Interface, Up: Top
+
+6 API Compatibility
+*******************
+
+The goal of this section is to describe some API changes that occurred
+from one version of MPFR to another, and how to write code that can be
+compiled and run with older MPFR versions. The minimum MPFR version
+that is considered here is 2.2.0 (released on 20 September 2005).
+
+ API changes can only occur between major or minor versions. Thus the
+patchlevel (the third number in the MPFR version) will be ignored in
+the following. If a program does not use MPFR internals, changes in
+the behavior between two versions differing only by the patchlevel
+should only result from what was regarded as a bug or unspecified
+behavior.
+
+ As a general rule, a program written for some MPFR version should
+work with later versions, possibly except at a new major version, where
+some features (described as obsolete for some time) can be removed. In
+such a case, a failure should occur during compilation or linking. If
+a result becomes incorrect because of such a change, please look at the
+various changes below (they are minimal, and most software should be
+unaffected), at the FAQ and at the MPFR web page for your version (a
+bug could have been introduced and be already fixed); and if the
+problem is not mentioned, please send us a bug report (*note Reporting
+Bugs::).
+
+ However, a program written for the current MPFR version (as
+documented by this manual) may not necessarily work with previous
+versions of MPFR. This section should help developers to write
+portable code.
+
+ Note: Information given here may be incomplete. API changes are
+also described in the NEWS file (for each version, instead of being
+classified like here), together with other changes.
+
+* Menu:
+
+* Type and Macro Changes::
+* Added Functions::
+* Changed Functions::
+* Removed Functions::
+* Other Changes::
+
+
+File: mpfr.info, Node: Type and Macro Changes, Next: Added Functions, Prev: API Compatibility, Up: API Compatibility
+
+6.1 Type and Macro Changes
+==========================
+
+The official type for exponent values changed from `mp_exp_t' to
+`mpfr_exp_t' in MPFR 3.0. The type `mp_exp_t' will remain available as
+it comes from GMP (with a different meaning). These types are
+currently the same (`mpfr_exp_t' is defined as `mp_exp_t' with
+`typedef'), so that programs can still use `mp_exp_t'; but this may
+change in the future. Alternatively, using the following code after
+including `mpfr.h' will work with official MPFR versions, as
+`mpfr_exp_t' was never defined in MPFR 2.x:
+ #if MPFR_VERSION_MAJOR < 3
+ typedef mp_exp_t mpfr_exp_t;
+ #endif
+
+ The official types for precision values and for rounding modes
+respectively changed from `mp_prec_t' and `mp_rnd_t' to `mpfr_prec_t'
+and `mpfr_rnd_t' in MPFR 3.0. This change was actually done a long
+time ago in MPFR, at least since MPFR 2.2.0, with the following code in
+`mpfr.h':
+ #ifndef mp_rnd_t
+ # define mp_rnd_t mpfr_rnd_t
+ #endif
+ #ifndef mp_prec_t
+ # define mp_prec_t mpfr_prec_t
+ #endif
+ This means that it is safe to use the new official types
+`mpfr_prec_t' and `mpfr_rnd_t' in your programs. The types `mp_prec_t'
+and `mp_rnd_t' (defined in MPFR only) may be removed in the future, as
+the prefix `mp_' is reserved by GMP.
+
+ The precision type `mpfr_prec_t' (`mp_prec_t') was unsigned before
+MPFR 3.0; it is now signed. `MPFR_PREC_MAX' has not changed, though.
+Indeed the MPFR code requires that `MPFR_PREC_MAX' be representable in
+the exponent type, which may have the same size as `mpfr_prec_t' but
+has always been signed. The consequence is that valid code that does
+not assume anything about the signedness of `mpfr_prec_t' should work
+with past and new MPFR versions. This change was useful as the use of
+unsigned types tends to convert signed values to unsigned ones in
+expressions due to the usual arithmetic conversions, which can yield
+incorrect results if a negative value is converted in such a way.
+Warning! A program assuming (intentionally or not) that `mpfr_prec_t'
+is signed may be affected by this problem when it is built and run
+against MPFR 2.x.
+
+ The rounding modes `GMP_RNDx' were renamed to `MPFR_RNDx' in MPFR
+3.0. However the old names `GMP_RNDx' have been kept for compatibility
+(this might change in future versions), using:
+ #define GMP_RNDN MPFR_RNDN
+ #define GMP_RNDZ MPFR_RNDZ
+ #define GMP_RNDU MPFR_RNDU
+ #define GMP_RNDD MPFR_RNDD
+ The rounding mode "round away from zero" (`MPFR_RNDA') was added in
+MPFR 3.0 (however no rounding mode `GMP_RNDA' exists).
+
+
+File: mpfr.info, Node: Added Functions, Next: Changed Functions, Prev: Type and Macro Changes, Up: API Compatibility
+
+6.2 Added Functions
+===================
+
+We give here in alphabetical order the functions that were added after
+MPFR 2.2, and in which MPFR version.
+
+ * `mpfr_add_d' in MPFR 2.4.
+
+ * `mpfr_ai' in MPFR 3.0 (incomplete, experimental).
+
+ * `mpfr_asprintf' in MPFR 2.4.
+
+ * `mpfr_buildopt_decimal_p' and `mpfr_buildopt_tls_p' in MPFR 3.0.
+
+ * `mpfr_buildopt_gmpinternals_p' and `mpfr_buildopt_tune_case' in
+ MPFR 3.1.
+
+ * `mpfr_clear_divby0' in MPFR 3.1 (new divide-by-zero exception).
+
+ * `mpfr_copysign' in MPFR 2.3. Note: MPFR 2.2 had a `mpfr_copysign'
+ function that was available, but not documented, and with a slight
+ difference in the semantics (when the second input operand is a
+ NaN).
+
+ * `mpfr_custom_get_significand' in MPFR 3.0. This function was
+ named `mpfr_custom_get_mantissa' in previous versions;
+ `mpfr_custom_get_mantissa' is still available via a macro in
+ `mpfr.h':
+ #define mpfr_custom_get_mantissa mpfr_custom_get_significand
+ Thus code that needs to work with both MPFR 2.x and MPFR 3.x should
+ use `mpfr_custom_get_mantissa'.
+
+ * `mpfr_d_div' and `mpfr_d_sub' in MPFR 2.4.
+
+ * `mpfr_digamma' in MPFR 3.0.
+
+ * `mpfr_divby0_p' in MPFR 3.1 (new divide-by-zero exception).
+
+ * `mpfr_div_d' in MPFR 2.4.
+
+ * `mpfr_fmod' in MPFR 2.4.
+
+ * `mpfr_fms' in MPFR 2.3.
+
+ * `mpfr_fprintf' in MPFR 2.4.
+
+ * `mpfr_frexp' in MPFR 3.1.
+
+ * `mpfr_get_flt' in MPFR 3.0.
+
+ * `mpfr_get_patches' in MPFR 2.3.
+
+ * `mpfr_get_z_2exp' in MPFR 3.0. This function was named
+ `mpfr_get_z_exp' in previous versions; `mpfr_get_z_exp' is still
+ available via a macro in `mpfr.h':
+ #define mpfr_get_z_exp mpfr_get_z_2exp
+ Thus code that needs to work with both MPFR 2.x and MPFR 3.x should
+ use `mpfr_get_z_exp'.
+
+ * `mpfr_grandom' in MPFR 3.1.
+
+ * `mpfr_j0', `mpfr_j1' and `mpfr_jn' in MPFR 2.3.
+
+ * `mpfr_lgamma' in MPFR 2.3.
+
+ * `mpfr_li2' in MPFR 2.4.
+
+ * `mpfr_min_prec' in MPFR 3.0.
+
+ * `mpfr_modf' in MPFR 2.4.
+
+ * `mpfr_mul_d' in MPFR 2.4.
+
+ * `mpfr_printf' in MPFR 2.4.
+
+ * `mpfr_rec_sqrt' in MPFR 2.4.
+
+ * `mpfr_regular_p' in MPFR 3.0.
+
+ * `mpfr_remainder' and `mpfr_remquo' in MPFR 2.3.
+
+ * `mpfr_set_divby0' in MPFR 3.1 (new divide-by-zero exception).
+
+ * `mpfr_set_flt' in MPFR 3.0.
+
+ * `mpfr_set_z_2exp' in MPFR 3.0.
+
+ * `mpfr_set_zero' in MPFR 3.0.
+
+ * `mpfr_setsign' in MPFR 2.3.
+
+ * `mpfr_signbit' in MPFR 2.3.
+
+ * `mpfr_sinh_cosh' in MPFR 2.4.
+
+ * `mpfr_snprintf' and `mpfr_sprintf' in MPFR 2.4.
+
+ * `mpfr_sub_d' in MPFR 2.4.
+
+ * `mpfr_urandom' in MPFR 3.0.
+
+ * `mpfr_vasprintf', `mpfr_vfprintf', `mpfr_vprintf',
+ `mpfr_vsprintf' and `mpfr_vsnprintf' in MPFR 2.4.
+
+ * `mpfr_y0', `mpfr_y1' and `mpfr_yn' in MPFR 2.3.
+
+ * `mpfr_z_sub' in MPFR 3.1.
+
+
+
+File: mpfr.info, Node: Changed Functions, Next: Removed Functions, Prev: Added Functions, Up: API Compatibility
+
+6.3 Changed Functions
+=====================
+
+The following functions have changed after MPFR 2.2. Changes can affect
+the behavior of code written for some MPFR version when built and run
+against another MPFR version (older or newer), as described below.
+
+ * `mpfr_check_range' changed in MPFR 2.3.2 and MPFR 2.4. If the
+ value is an inexact infinity, the overflow flag is now set (in
+ case it was lost), while it was previously left unchanged. This
+ is really what is expected in practice (and what the MPFR code was
+ expecting), so that the previous behavior was regarded as a bug.
+ Hence the change in MPFR 2.3.2.
+
+ * `mpfr_get_f' changed in MPFR 3.0. This function was returning
+ zero, except for NaN and Inf, which do not exist in MPF. The
+ _erange_ flag is now set in these cases, and `mpfr_get_f' now
+ returns the usual ternary value.
+
+ * `mpfr_get_si', `mpfr_get_sj', `mpfr_get_ui' and `mpfr_get_uj'
+ changed in MPFR 3.0. In previous MPFR versions, the cases where
+ the _erange_ flag is set were unspecified.
+
+ * `mpfr_get_z' changed in MPFR 3.0. The return type was `void'; it
+ is now `int', and the usual ternary value is returned. Thus
+ programs that need to work with both MPFR 2.x and 3.x must not use
+ the return value. Even in this case, C code using `mpfr_get_z' as
+ the second or third term of a conditional operator may also be
+ affected. For instance, the following is correct with MPFR 3.0,
+ but not with MPFR 2.x:
+ bool ? mpfr_get_z(...) : mpfr_add(...);
+ On the other hand, the following is correct with MPFR 2.x, but not
+ with MPFR 3.0:
+ bool ? mpfr_get_z(...) : (void) mpfr_add(...);
+ Portable code should cast `mpfr_get_z(...)' to `void' to use the
+ type `void' for both terms of the conditional operator, as in:
+ bool ? (void) mpfr_get_z(...) : (void) mpfr_add(...);
+ Alternatively, `if ... else' can be used instead of the
+ conditional operator.
+
+ Moreover the cases where the _erange_ flag is set were unspecified
+ in MPFR 2.x.
+
+ * `mpfr_get_z_exp' changed in MPFR 3.0. In previous MPFR versions,
+ the cases where the _erange_ flag is set were unspecified. Note:
+ this function has been renamed to `mpfr_get_z_2exp' in MPFR 3.0,
+ but `mpfr_get_z_exp' is still available for compatibility reasons.
+
+ * `mpfr_strtofr' changed in MPFR 2.3.1 and MPFR 2.4. This was
+ actually a bug fix since the code and the documentation did not
+ match. But both were changed in order to have a more consistent
+ and useful behavior. The main changes in the code are as follows.
+ The binary exponent is now accepted even without the `0b' or `0x'
+ prefix. Data corresponding to NaN can now have an optional sign
+ (such data were previously invalid).
+
+ * `mpfr_strtofr' changed in MPFR 3.0. This function now accepts
+ bases from 37 to 62 (no changes for the other bases). Note: if an
+ unsupported base is provided to this function, the behavior is
+ undefined; more precisely, in MPFR 2.3.1 and later, providing an
+ unsupported base yields an assertion failure (this behavior may
+ change in the future).
+
+ * `mpfr_subnormalize' changed in MPFR 3.1. This was actually
+ regarded as a bug fix. The `mpfr_subnormalize' implementation up
+ to MPFR 3.0.0 did not change the flags. In particular, it did not
+ follow the generic rule concerning the inexact flag (and no
+ special behavior was specified). The case of the underflow flag
+ was more a lack of specification.
+
+ * `mpfr_urandom' and `mpfr_urandomb' changed in MPFR 3.1. Their
+ behavior no longer depends on the platform (assuming this is also
+ true for GMP's random generator, which is not the case between GMP
+ 4.1 and 4.2 if `gmp_randinit_default' is used). As a consequence,
+ the returned values can be different between MPFR 3.1 and previous
+ MPFR versions. Note: as the reproducibility of these functions
+ was not specified before MPFR 3.1, the MPFR 3.1 behavior is _not_
+ regarded as backward incompatible with previous versions.
+
+
+
+File: mpfr.info, Node: Removed Functions, Next: Other Changes, Prev: Changed Functions, Up: API Compatibility
+
+6.4 Removed Functions
+=====================
+
+Functions `mpfr_random' and `mpfr_random2' have been removed in MPFR
+3.0 (this only affects old code built against MPFR 3.0 or later). (The
+function `mpfr_random' had been deprecated since at least MPFR 2.2.0,
+and `mpfr_random2' since MPFR 2.4.0.)
+
+
+File: mpfr.info, Node: Other Changes, Prev: Removed Functions, Up: API Compatibility
+
+6.5 Other Changes
+=================
+
+For users of a C++ compiler, the way how the availability of `intmax_t'
+is detected has changed in MPFR 3.0. In MPFR 2.x, if a macro
+`INTMAX_C' or `UINTMAX_C' was defined (e.g. when the
+`__STDC_CONSTANT_MACROS' macro had been defined before `<stdint.h>' or
+`<inttypes.h>' has been included), `intmax_t' was assumed to be defined.
+However this was not always the case (more precisely, `intmax_t' can be
+defined only in the namespace `std', as with Boost), so that
+compilations could fail. Thus the check for `INTMAX_C' or `UINTMAX_C'
+is now disabled for C++ compilers, with the following consequences:
+
+ * Programs written for MPFR 2.x that need `intmax_t' may no longer
+ be compiled against MPFR 3.0: a `#define MPFR_USE_INTMAX_T' may be
+ necessary before `mpfr.h' is included.
+
+ * The compilation of programs that work with MPFR 3.0 may fail with
+ MPFR 2.x due to the problem described above. Workarounds are
+ possible, such as defining `intmax_t' and `uintmax_t' in the global
+ namespace, though this is not clean.
+
+
+ The divide-by-zero exception is new in MPFR 3.1. However it should
+not introduce incompatible changes for programs that strictly follow
+the MPFR API since the exception can only be seen via new functions.
+
+ As of MPFR 3.1, the `mpfr.h' header can be included several times,
+while still supporting optional functions (*note Headers and
+Libraries::).
+
+
+File: mpfr.info, Node: Contributors, Next: References, Prev: API Compatibility, Up: Top
+
+Contributors
+************
+
+The main developers of MPFR are Guillaume Hanrot, Vincent Lefèvre,
+Patrick Pélissier, Philippe Théveny and Paul Zimmermann.
+
+ Sylvie Boldo from ENS-Lyon, France, contributed the functions
+`mpfr_agm' and `mpfr_log'. Sylvain Chevillard contributed the
+`mpfr_ai' function. David Daney contributed the hyperbolic and inverse
+hyperbolic functions, the base-2 exponential, and the factorial
+function. Alain Delplanque contributed the new version of the
+`mpfr_get_str' function. Mathieu Dutour contributed the functions
+`mpfr_acos', `mpfr_asin' and `mpfr_atan', and a previous version of
+`mpfr_gamma'. Laurent Fousse contributed the `mpfr_sum' function.
+Emmanuel Jeandel, from ENS-Lyon too, contributed the generic
+hypergeometric code, as well as the internal function `mpfr_exp3', a
+first implementation of the sine and cosine, and improved versions of
+`mpfr_const_log2' and `mpfr_const_pi'. Ludovic Meunier helped in the
+design of the `mpfr_erf' code. Jean-Luc Rémy contributed the
+`mpfr_zeta' code. Fabrice Rouillier contributed the `mpfr_xxx_z' and
+`mpfr_xxx_q' functions, and helped to the Microsoft Windows porting.
+Damien Stehlé contributed the `mpfr_get_ld_2exp' function.
+
+ We would like to thank Jean-Michel Muller and Joris van der Hoeven
+for very fruitful discussions at the beginning of that project,
+Torbjörn Granlund and Kevin Ryde for their help about design issues,
+and Nathalie Revol for her careful reading of a previous version of
+this documentation. In particular Kevin Ryde did a tremendous job for
+the portability of MPFR in 2002-2004.
+
+ The development of the MPFR library would not have been possible
+without the continuous support of INRIA, and of the LORIA (Nancy,
+France) and LIP (Lyon, France) laboratories. In particular the main
+authors were or are members of the PolKA, Spaces, Cacao and Caramel
+project-teams at LORIA and of the Arénaire and AriC project-teams at
+LIP. This project was started during the Fiable (reliable in French)
+action supported by INRIA, and continued during the AOC action. The
+development of MPFR was also supported by a grant (202F0659 00 MPN 121)
+from the Conseil Régional de Lorraine in 2002, from INRIA by an
+"associate engineer" grant (2003-2005), an "opération de développement
+logiciel" grant (2007-2009), and the post-doctoral grant of Sylvain
+Chevillard in 2009-2010. The MPFR-MPC workshop in June 2012 was partly
+supported by the ERC grant ANTICS of Andreas Enge.
+
+
+File: mpfr.info, Node: References, Next: GNU Free Documentation License, Prev: Contributors, Up: Top
+
+References
+**********
+
+ * Richard Brent and Paul Zimmermann, "Modern Computer Arithmetic",
+ Cambridge University Press (to appear), also available from the
+ authors' web pages.
+
+ * Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick
+ Pélissier and Paul Zimmermann, "MPFR: A Multiple-Precision Binary
+ Floating-Point Library With Correct Rounding", ACM Transactions on
+ Mathematical Software, volume 33, issue 2, article 13, 15 pages,
+ 2007, `http://doi.acm.org/10.1145/1236463.1236468'.
+
+ * Torbjörn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic
+ Library", version 5.0.1, 2010, `http://gmplib.org'.
+
+ * IEEE standard for binary floating-point arithmetic, Technical
+ Report ANSI-IEEE Standard 754-1985, New York, 1985. Approved
+ March 21, 1985: IEEE Standards Board; approved July 26, 1985:
+ American National Standards Institute, 18 pages.
+
+ * IEEE Standard for Floating-Point Arithmetic, ANSI-IEEE Standard
+ 754-2008, 2008. Revision of ANSI-IEEE Standard 754-1985, approved
+ June 12, 2008: IEEE Standards Board, 70 pages.
+
+ * Donald E. Knuth, "The Art of Computer Programming", vol 2,
+ "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981.
+
+ * Jean-Michel Muller, "Elementary Functions, Algorithms and
+ Implementation", Birkhäuser, Boston, 2nd edition, 2006.
+
+ * Jean-Michel Muller, Nicolas Brisebarre, Florent de Dinechin,
+ Claude-Pierre Jeannerod, Vincent Lefèvre, Guillaume Melquiond,
+ Nathalie Revol, Damien Stehlé and Serge Torrès, "Handbook of
+ Floating-Point Arithmetic", Birkhäuser, Boston, 2009.
+
+
+
+File: mpfr.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: References, Up: Top
+
+Appendix A GNU Free Documentation License
+*****************************************
+
+ Version 1.2, November 2002
+
+ Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
+ 51 Franklin St, 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.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of "copyleft", which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book.
+ We recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it
+ can be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ "Document", below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as "you". You
+ accept the license if you copy, modify or distribute the work in a
+ way requiring permission under copyright law.
+
+ A "Modified Version" of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A "Secondary Section" is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document's overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The "Invariant Sections" are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in
+ the notice that says that the Document is released under this
+ License. If a section does not fit the above definition of
+ Secondary then it is not allowed to be designated as Invariant.
+ The Document may contain zero Invariant Sections. If the Document
+ does not identify any Invariant Sections then there are none.
+
+ The "Cover Texts" are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A "Transparent" copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images
+ composed of pixels) generic paint programs or (for drawings) some
+ widely available drawing editor, and that is suitable for input to
+ text formatters or for automatic translation to a variety of
+ formats suitable for input to text formatters. A copy made in an
+ otherwise Transparent file format whose markup, or absence of
+ markup, has been arranged to thwart or discourage subsequent
+ modification by readers is not Transparent. An image format is
+ not Transparent if used for any substantial amount of text. A
+ copy that is not "Transparent" is called "Opaque".
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and
+ standard-conforming simple HTML, PostScript or PDF designed for
+ human modification. Examples of transparent image formats include
+ PNG, XCF and JPG. Opaque formats include proprietary formats that
+ can be read and edited only by proprietary word processors, SGML or
+ XML for which the DTD and/or processing tools are not generally
+ available, and the machine-generated HTML, PostScript or PDF
+ produced by some word processors for output purposes only.
+
+ The "Title Page" means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, "Title
+ Page" means the text near the most prominent appearance of the
+ work's title, preceding the beginning of the body of the text.
+
+ A section "Entitled XYZ" means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ "Acknowledgements", "Dedications", "Endorsements", or "History".)
+ To "Preserve the Title" of such a section when you modify the
+ Document means that it remains a section "Entitled XYZ" according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow
+ the conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document's license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the
+ title equally prominent and visible. You may add other material
+ on the covers in addition. Copying with changes limited to the
+ covers, as long as they preserve the title of the Document and
+ satisfy these conditions, can be treated as verbatim copying in
+ other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a
+ machine-readable Transparent copy along with each Opaque copy, or
+ state in or with each Opaque copy a computer-network location from
+ which the general network-using public has access to download
+ using public-standard network protocols a complete Transparent
+ copy of the Document, free of added material. If you use the
+ latter option, you must take reasonably prudent steps, when you
+ begin distribution of Opaque copies in quantity, to ensure that
+ this Transparent copy will remain thus accessible at the stated
+ location until at least one year after the last time you
+ distribute an Opaque copy (directly or through your agents or
+ retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of
+ copies, to give them a chance to provide you with an updated
+ version of the Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with
+ the Modified Version filling the role of the Document, thus
+ licensing distribution and modification of the Modified Version to
+ whoever possesses a copy of it. In addition, you must do these
+ things in the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of
+ previous versions (which should, if there were any, be listed
+ in the History section of the Document). You may use the
+ same title as a previous version if the original publisher of
+ that version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document's
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled "History", Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on
+ the Title Page. If there is no section Entitled "History" in
+ the Document, create one stating the title, year, authors,
+ and publisher of the Document as given on its Title Page,
+ then add an item describing the Modified Version as stated in
+ the previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in
+ the "History" section. You may omit a network location for a
+ work that was published at least four years before the
+ Document itself, or if the original publisher of the version
+ it refers to gives permission.
+
+ K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the
+ section all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section
+ titles.
+
+ M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ "Endorsements" or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option
+ designate some or all of these sections as invariant. To do this,
+ add their titles to the list of Invariant Sections in the Modified
+ Version's license notice. These titles must be distinct from any
+ other section titles.
+
+ You may add a section Entitled "Endorsements", provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end
+ of the list of Cover Texts in the Modified Version. Only one
+ passage of Front-Cover Text and one of Back-Cover Text may be
+ added by (or through arrangements made by) any one entity. If the
+ Document already includes a cover text for the same cover,
+ previously added by you or by arrangement made by the same entity
+ you are acting on behalf of, you may not add another; but you may
+ replace the old one, on explicit permission from the previous
+ publisher that added the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination
+ all of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ "History" in the various original documents, forming one section
+ Entitled "History"; likewise combine any sections Entitled
+ "Acknowledgements", and any sections Entitled "Dedications". You
+ must delete all sections Entitled "Endorsements."
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the
+ documents in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow
+ this License in all other respects regarding verbatim copying of
+ that document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of
+ a storage or distribution medium, is called an "aggregate" if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation's users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document's Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled "Acknowledgements",
+ "Dedications", or "History", the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided for under this License. Any other
+ attempt to copy, modify, sublicense or distribute the Document 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.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation 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. See
+ `http://www.gnu.org/copyleft/'.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License "or any later version" applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If
+ the Document does not specify a version number of this License,
+ you may choose any version ever published (not as a draft) by the
+ Free Software Foundation.
+
+A.1 ADDENDUM: How to Use This License For Your Documents
+========================================================
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ Copyright (C) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License, to
+permit their use in free software.
+
+
+File: mpfr.info, Node: Concept Index, Next: Function and Type Index, Prev: GNU Free Documentation License, Up: Top
+
+Concept Index
+*************
+
+
+* Menu:
+
+* Accuracy: MPFR Interface. (line 25)
+* Arithmetic functions: Basic Arithmetic Functions.
+ (line 3)
+* Assignment functions: Assignment Functions. (line 3)
+* Basic arithmetic functions: Basic Arithmetic Functions.
+ (line 3)
+* Combined initialization and assignment functions: Combined Initialization and Assignment Functions.
+ (line 3)
+* Comparison functions: Comparison Functions. (line 3)
+* Compatibility with MPF: Compatibility with MPF.
+ (line 3)
+* Conditions for copying MPFR: Copying. (line 6)
+* Conversion functions: Conversion Functions. (line 3)
+* Copying conditions: Copying. (line 6)
+* Custom interface: Custom Interface. (line 3)
+* Exception related functions: Exception Related Functions.
+ (line 3)
+* Float arithmetic functions: Basic Arithmetic Functions.
+ (line 3)
+* Float comparisons functions: Comparison Functions. (line 3)
+* Float functions: MPFR Interface. (line 6)
+* Float input and output functions: Input and Output Functions.
+ (line 3)
+* Float output functions: Formatted Output Functions.
+ (line 3)
+* Floating-point functions: MPFR Interface. (line 6)
+* Floating-point number: Nomenclature and Types.
+ (line 6)
+* GNU Free Documentation License: GNU Free Documentation License.
+ (line 6)
+* I/O functions <1>: Formatted Output Functions.
+ (line 3)
+* I/O functions: Input and Output Functions.
+ (line 3)
+* Initialization functions: Initialization Functions.
+ (line 3)
+* Input functions: Input and Output Functions.
+ (line 3)
+* Installation: Installing MPFR. (line 6)
+* Integer related functions: Integer Related Functions.
+ (line 3)
+* Internals: Internals. (line 3)
+* intmax_t: Headers and Libraries.
+ (line 22)
+* inttypes.h: Headers and Libraries.
+ (line 22)
+* libmpfr: Headers and Libraries.
+ (line 50)
+* Libraries: Headers and Libraries.
+ (line 50)
+* Libtool: Headers and Libraries.
+ (line 56)
+* Limb: Internals. (line 6)
+* Linking: Headers and Libraries.
+ (line 50)
+* Miscellaneous float functions: Miscellaneous Functions.
+ (line 3)
+* mpfr.h: Headers and Libraries.
+ (line 6)
+* Output functions <1>: Formatted Output Functions.
+ (line 3)
+* Output functions: Input and Output Functions.
+ (line 3)
+* Precision <1>: MPFR Interface. (line 17)
+* Precision: Nomenclature and Types.
+ (line 20)
+* Reporting bugs: Reporting Bugs. (line 6)
+* Rounding mode related functions: Rounding Related Functions.
+ (line 3)
+* Rounding Modes: Nomenclature and Types.
+ (line 34)
+* Special functions: Special Functions. (line 3)
+* stdarg.h: Headers and Libraries.
+ (line 19)
+* stdint.h: Headers and Libraries.
+ (line 22)
+* stdio.h: Headers and Libraries.
+ (line 12)
+* Ternary value: Rounding Modes. (line 29)
+* uintmax_t: Headers and Libraries.
+ (line 22)
+
+
+File: mpfr.info, Node: Function and Type Index, Prev: Concept Index, Up: Top
+
+Function and Type Index
+***********************
+
+
+* Menu:
+
+* mpfr_abs: Basic Arithmetic Functions.
+ (line 175)
+* mpfr_acos: Special Functions. (line 52)
+* mpfr_acosh: Special Functions. (line 136)
+* mpfr_add: Basic Arithmetic Functions.
+ (line 8)
+* mpfr_add_d: Basic Arithmetic Functions.
+ (line 14)
+* mpfr_add_q: Basic Arithmetic Functions.
+ (line 18)
+* mpfr_add_si: Basic Arithmetic Functions.
+ (line 12)
+* mpfr_add_ui: Basic Arithmetic Functions.
+ (line 10)
+* mpfr_add_z: Basic Arithmetic Functions.
+ (line 16)
+* mpfr_agm: Special Functions. (line 232)
+* mpfr_ai: Special Functions. (line 248)
+* mpfr_asin: Special Functions. (line 53)
+* mpfr_asinh: Special Functions. (line 137)
+* mpfr_asprintf: Formatted Output Functions.
+ (line 194)
+* mpfr_atan: Special Functions. (line 54)
+* mpfr_atan2: Special Functions. (line 65)
+* mpfr_atanh: Special Functions. (line 138)
+* mpfr_buildopt_decimal_p: Miscellaneous Functions.
+ (line 163)
+* mpfr_buildopt_gmpinternals_p: Miscellaneous Functions.
+ (line 168)
+* mpfr_buildopt_tls_p: Miscellaneous Functions.
+ (line 157)
+* mpfr_buildopt_tune_case: Miscellaneous Functions.
+ (line 173)
+* mpfr_can_round: Rounding Related Functions.
+ (line 37)
+* mpfr_cbrt: Basic Arithmetic Functions.
+ (line 109)
+* mpfr_ceil: Integer Related Functions.
+ (line 8)
+* mpfr_check_range: Exception Related Functions.
+ (line 38)
+* mpfr_clear: Initialization Functions.
+ (line 31)
+* mpfr_clear_divby0: Exception Related Functions.
+ (line 113)
+* mpfr_clear_erangeflag: Exception Related Functions.
+ (line 116)
+* mpfr_clear_flags: Exception Related Functions.
+ (line 129)
+* mpfr_clear_inexflag: Exception Related Functions.
+ (line 115)
+* mpfr_clear_nanflag: Exception Related Functions.
+ (line 114)
+* mpfr_clear_overflow: Exception Related Functions.
+ (line 112)
+* mpfr_clear_underflow: Exception Related Functions.
+ (line 111)
+* mpfr_clears: Initialization Functions.
+ (line 36)
+* mpfr_cmp: Comparison Functions.
+ (line 7)
+* mpfr_cmp_d: Comparison Functions.
+ (line 10)
+* mpfr_cmp_f: Comparison Functions.
+ (line 14)
+* mpfr_cmp_ld: Comparison Functions.
+ (line 11)
+* mpfr_cmp_q: Comparison Functions.
+ (line 13)
+* mpfr_cmp_si: Comparison Functions.
+ (line 9)
+* mpfr_cmp_si_2exp: Comparison Functions.
+ (line 31)
+* mpfr_cmp_ui: Comparison Functions.
+ (line 8)
+* mpfr_cmp_ui_2exp: Comparison Functions.
+ (line 29)
+* mpfr_cmp_z: Comparison Functions.
+ (line 12)
+* mpfr_cmpabs: Comparison Functions.
+ (line 35)
+* mpfr_const_catalan: Special Functions. (line 259)
+* mpfr_const_euler: Special Functions. (line 258)
+* mpfr_const_log2: Special Functions. (line 256)
+* mpfr_const_pi: Special Functions. (line 257)
+* mpfr_copysign: Miscellaneous Functions.
+ (line 111)
+* mpfr_cos: Special Functions. (line 30)
+* mpfr_cosh: Special Functions. (line 115)
+* mpfr_cot: Special Functions. (line 48)
+* mpfr_coth: Special Functions. (line 132)
+* mpfr_csc: Special Functions. (line 47)
+* mpfr_csch: Special Functions. (line 131)
+* mpfr_custom_get_exp: Custom Interface. (line 78)
+* mpfr_custom_get_kind: Custom Interface. (line 67)
+* mpfr_custom_get_significand: Custom Interface. (line 72)
+* mpfr_custom_get_size: Custom Interface. (line 36)
+* mpfr_custom_init: Custom Interface. (line 41)
+* mpfr_custom_init_set: Custom Interface. (line 48)
+* mpfr_custom_move: Custom Interface. (line 85)
+* mpfr_d_div: Basic Arithmetic Functions.
+ (line 84)
+* mpfr_d_sub: Basic Arithmetic Functions.
+ (line 37)
+* MPFR_DECL_INIT: Initialization Functions.
+ (line 75)
+* mpfr_digamma: Special Functions. (line 187)
+* mpfr_dim: Basic Arithmetic Functions.
+ (line 182)
+* mpfr_div: Basic Arithmetic Functions.
+ (line 74)
+* mpfr_div_2exp: Compatibility with MPF.
+ (line 51)
+* mpfr_div_2si: Basic Arithmetic Functions.
+ (line 197)
+* mpfr_div_2ui: Basic Arithmetic Functions.
+ (line 195)
+* mpfr_div_d: Basic Arithmetic Functions.
+ (line 86)
+* mpfr_div_q: Basic Arithmetic Functions.
+ (line 90)
+* mpfr_div_si: Basic Arithmetic Functions.
+ (line 82)
+* mpfr_div_ui: Basic Arithmetic Functions.
+ (line 78)
+* mpfr_div_z: Basic Arithmetic Functions.
+ (line 88)
+* mpfr_divby0_p: Exception Related Functions.
+ (line 135)
+* mpfr_eint: Special Functions. (line 154)
+* mpfr_eq: Compatibility with MPF.
+ (line 30)
+* mpfr_equal_p: Comparison Functions.
+ (line 61)
+* mpfr_erangeflag_p: Exception Related Functions.
+ (line 138)
+* mpfr_erf: Special Functions. (line 198)
+* mpfr_erfc: Special Functions. (line 199)
+* mpfr_exp: Special Functions. (line 24)
+* mpfr_exp10: Special Functions. (line 26)
+* mpfr_exp2: Special Functions. (line 25)
+* mpfr_expm1: Special Functions. (line 150)
+* mpfr_fac_ui: Special Functions. (line 143)
+* mpfr_fits_intmax_p: Conversion Functions.
+ (line 146)
+* mpfr_fits_sint_p: Conversion Functions.
+ (line 142)
+* mpfr_fits_slong_p: Conversion Functions.
+ (line 140)
+* mpfr_fits_sshort_p: Conversion Functions.
+ (line 144)
+* mpfr_fits_uint_p: Conversion Functions.
+ (line 141)
+* mpfr_fits_uintmax_p: Conversion Functions.
+ (line 145)
+* mpfr_fits_ulong_p: Conversion Functions.
+ (line 139)
+* mpfr_fits_ushort_p: Conversion Functions.
+ (line 143)
+* mpfr_floor: Integer Related Functions.
+ (line 9)
+* mpfr_fma: Special Functions. (line 225)
+* mpfr_fmod: Integer Related Functions.
+ (line 79)
+* mpfr_fms: Special Functions. (line 227)
+* mpfr_fprintf: Formatted Output Functions.
+ (line 158)
+* mpfr_frac: Integer Related Functions.
+ (line 62)
+* mpfr_free_cache: Special Functions. (line 266)
+* mpfr_free_str: Conversion Functions.
+ (line 133)
+* mpfr_frexp: Conversion Functions.
+ (line 47)
+* mpfr_gamma: Special Functions. (line 169)
+* mpfr_get_d: Conversion Functions.
+ (line 8)
+* mpfr_get_d_2exp: Conversion Functions.
+ (line 34)
+* mpfr_get_decimal64: Conversion Functions.
+ (line 10)
+* mpfr_get_default_prec: Initialization Functions.
+ (line 114)
+* mpfr_get_default_rounding_mode: Rounding Related Functions.
+ (line 11)
+* mpfr_get_emax: Exception Related Functions.
+ (line 8)
+* mpfr_get_emax_max: Exception Related Functions.
+ (line 31)
+* mpfr_get_emax_min: Exception Related Functions.
+ (line 30)
+* mpfr_get_emin: Exception Related Functions.
+ (line 7)
+* mpfr_get_emin_max: Exception Related Functions.
+ (line 29)
+* mpfr_get_emin_min: Exception Related Functions.
+ (line 28)
+* mpfr_get_exp: Miscellaneous Functions.
+ (line 89)
+* mpfr_get_f: Conversion Functions.
+ (line 73)
+* mpfr_get_flt: Conversion Functions.
+ (line 7)
+* mpfr_get_ld: Conversion Functions.
+ (line 9)
+* mpfr_get_ld_2exp: Conversion Functions.
+ (line 36)
+* mpfr_get_patches: Miscellaneous Functions.
+ (line 148)
+* mpfr_get_prec: Initialization Functions.
+ (line 147)
+* mpfr_get_si: Conversion Functions.
+ (line 20)
+* mpfr_get_sj: Conversion Functions.
+ (line 22)
+* mpfr_get_str: Conversion Functions.
+ (line 87)
+* mpfr_get_ui: Conversion Functions.
+ (line 21)
+* mpfr_get_uj: Conversion Functions.
+ (line 23)
+* mpfr_get_version: Miscellaneous Functions.
+ (line 117)
+* mpfr_get_z: Conversion Functions.
+ (line 68)
+* mpfr_get_z_2exp: Conversion Functions.
+ (line 55)
+* mpfr_grandom: Miscellaneous Functions.
+ (line 65)
+* mpfr_greater_p: Comparison Functions.
+ (line 57)
+* mpfr_greaterequal_p: Comparison Functions.
+ (line 58)
+* mpfr_hypot: Special Functions. (line 241)
+* mpfr_inexflag_p: Exception Related Functions.
+ (line 137)
+* mpfr_inf_p: Comparison Functions.
+ (line 42)
+* mpfr_init: Initialization Functions.
+ (line 54)
+* mpfr_init2: Initialization Functions.
+ (line 11)
+* mpfr_init_set: Combined Initialization and Assignment Functions.
+ (line 7)
+* mpfr_init_set_d: Combined Initialization and Assignment Functions.
+ (line 12)
+* mpfr_init_set_f: Combined Initialization and Assignment Functions.
+ (line 17)
+* mpfr_init_set_ld: Combined Initialization and Assignment Functions.
+ (line 14)
+* mpfr_init_set_q: Combined Initialization and Assignment Functions.
+ (line 16)
+* mpfr_init_set_si: Combined Initialization and Assignment Functions.
+ (line 11)
+* mpfr_init_set_str: Combined Initialization and Assignment Functions.
+ (line 23)
+* mpfr_init_set_ui: Combined Initialization and Assignment Functions.
+ (line 9)
+* mpfr_init_set_z: Combined Initialization and Assignment Functions.
+ (line 15)
+* mpfr_inits: Initialization Functions.
+ (line 63)
+* mpfr_inits2: Initialization Functions.
+ (line 23)
+* mpfr_inp_str: Input and Output Functions.
+ (line 33)
+* mpfr_integer_p: Integer Related Functions.
+ (line 105)
+* mpfr_j0: Special Functions. (line 203)
+* mpfr_j1: Special Functions. (line 204)
+* mpfr_jn: Special Functions. (line 206)
+* mpfr_less_p: Comparison Functions.
+ (line 59)
+* mpfr_lessequal_p: Comparison Functions.
+ (line 60)
+* mpfr_lessgreater_p: Comparison Functions.
+ (line 66)
+* mpfr_lgamma: Special Functions. (line 179)
+* mpfr_li2: Special Functions. (line 164)
+* mpfr_lngamma: Special Functions. (line 173)
+* mpfr_log: Special Functions. (line 17)
+* mpfr_log10: Special Functions. (line 19)
+* mpfr_log1p: Special Functions. (line 146)
+* mpfr_log2: Special Functions. (line 18)
+* mpfr_max: Miscellaneous Functions.
+ (line 24)
+* mpfr_min: Miscellaneous Functions.
+ (line 22)
+* mpfr_min_prec: Rounding Related Functions.
+ (line 59)
+* mpfr_modf: Integer Related Functions.
+ (line 69)
+* mpfr_mul: Basic Arithmetic Functions.
+ (line 53)
+* mpfr_mul_2exp: Compatibility with MPF.
+ (line 49)
+* mpfr_mul_2si: Basic Arithmetic Functions.
+ (line 190)
+* mpfr_mul_2ui: Basic Arithmetic Functions.
+ (line 188)
+* mpfr_mul_d: Basic Arithmetic Functions.
+ (line 59)
+* mpfr_mul_q: Basic Arithmetic Functions.
+ (line 63)
+* mpfr_mul_si: Basic Arithmetic Functions.
+ (line 57)
+* mpfr_mul_ui: Basic Arithmetic Functions.
+ (line 55)
+* mpfr_mul_z: Basic Arithmetic Functions.
+ (line 61)
+* mpfr_nan_p: Comparison Functions.
+ (line 41)
+* mpfr_nanflag_p: Exception Related Functions.
+ (line 136)
+* mpfr_neg: Basic Arithmetic Functions.
+ (line 174)
+* mpfr_nextabove: Miscellaneous Functions.
+ (line 16)
+* mpfr_nextbelow: Miscellaneous Functions.
+ (line 17)
+* mpfr_nexttoward: Miscellaneous Functions.
+ (line 7)
+* mpfr_number_p: Comparison Functions.
+ (line 43)
+* mpfr_out_str: Input and Output Functions.
+ (line 17)
+* mpfr_overflow_p: Exception Related Functions.
+ (line 134)
+* mpfr_pow: Basic Arithmetic Functions.
+ (line 118)
+* mpfr_pow_si: Basic Arithmetic Functions.
+ (line 122)
+* mpfr_pow_ui: Basic Arithmetic Functions.
+ (line 120)
+* mpfr_pow_z: Basic Arithmetic Functions.
+ (line 124)
+* mpfr_prec_round: Rounding Related Functions.
+ (line 15)
+* mpfr_prec_t: Nomenclature and Types.
+ (line 20)
+* mpfr_print_rnd_mode: Rounding Related Functions.
+ (line 66)
+* mpfr_printf: Formatted Output Functions.
+ (line 165)
+* mpfr_rec_sqrt: Basic Arithmetic Functions.
+ (line 104)
+* mpfr_regular_p: Comparison Functions.
+ (line 45)
+* mpfr_reldiff: Compatibility with MPF.
+ (line 41)
+* mpfr_remainder: Integer Related Functions.
+ (line 81)
+* mpfr_remquo: Integer Related Functions.
+ (line 83)
+* mpfr_rint: Integer Related Functions.
+ (line 7)
+* mpfr_rint_ceil: Integer Related Functions.
+ (line 38)
+* mpfr_rint_floor: Integer Related Functions.
+ (line 40)
+* mpfr_rint_round: Integer Related Functions.
+ (line 42)
+* mpfr_rint_trunc: Integer Related Functions.
+ (line 44)
+* mpfr_rnd_t: Nomenclature and Types.
+ (line 34)
+* mpfr_root: Basic Arithmetic Functions.
+ (line 111)
+* mpfr_round: Integer Related Functions.
+ (line 10)
+* mpfr_sec: Special Functions. (line 46)
+* mpfr_sech: Special Functions. (line 130)
+* mpfr_set: Assignment Functions.
+ (line 10)
+* mpfr_set_d: Assignment Functions.
+ (line 17)
+* mpfr_set_decimal64: Assignment Functions.
+ (line 21)
+* mpfr_set_default_prec: Initialization Functions.
+ (line 101)
+* mpfr_set_default_rounding_mode: Rounding Related Functions.
+ (line 7)
+* mpfr_set_divby0: Exception Related Functions.
+ (line 122)
+* mpfr_set_emax: Exception Related Functions.
+ (line 17)
+* mpfr_set_emin: Exception Related Functions.
+ (line 16)
+* mpfr_set_erangeflag: Exception Related Functions.
+ (line 125)
+* mpfr_set_exp: Miscellaneous Functions.
+ (line 94)
+* mpfr_set_f: Assignment Functions.
+ (line 24)
+* mpfr_set_flt: Assignment Functions.
+ (line 16)
+* mpfr_set_inexflag: Exception Related Functions.
+ (line 124)
+* mpfr_set_inf: Assignment Functions.
+ (line 147)
+* mpfr_set_ld: Assignment Functions.
+ (line 19)
+* mpfr_set_nan: Assignment Functions.
+ (line 146)
+* mpfr_set_nanflag: Exception Related Functions.
+ (line 123)
+* mpfr_set_overflow: Exception Related Functions.
+ (line 121)
+* mpfr_set_prec: Initialization Functions.
+ (line 137)
+* mpfr_set_prec_raw: Compatibility with MPF.
+ (line 23)
+* mpfr_set_q: Assignment Functions.
+ (line 23)
+* mpfr_set_si: Assignment Functions.
+ (line 13)
+* mpfr_set_si_2exp: Assignment Functions.
+ (line 53)
+* mpfr_set_sj: Assignment Functions.
+ (line 15)
+* mpfr_set_sj_2exp: Assignment Functions.
+ (line 57)
+* mpfr_set_str: Assignment Functions.
+ (line 65)
+* mpfr_set_ui: Assignment Functions.
+ (line 12)
+* mpfr_set_ui_2exp: Assignment Functions.
+ (line 51)
+* mpfr_set_uj: Assignment Functions.
+ (line 14)
+* mpfr_set_uj_2exp: Assignment Functions.
+ (line 55)
+* mpfr_set_underflow: Exception Related Functions.
+ (line 120)
+* mpfr_set_z: Assignment Functions.
+ (line 22)
+* mpfr_set_z_2exp: Assignment Functions.
+ (line 59)
+* mpfr_set_zero: Assignment Functions.
+ (line 148)
+* mpfr_setsign: Miscellaneous Functions.
+ (line 105)
+* mpfr_sgn: Comparison Functions.
+ (line 51)
+* mpfr_si_div: Basic Arithmetic Functions.
+ (line 80)
+* mpfr_si_sub: Basic Arithmetic Functions.
+ (line 33)
+* mpfr_signbit: Miscellaneous Functions.
+ (line 100)
+* mpfr_sin: Special Functions. (line 31)
+* mpfr_sin_cos: Special Functions. (line 37)
+* mpfr_sinh: Special Functions. (line 116)
+* mpfr_sinh_cosh: Special Functions. (line 122)
+* mpfr_snprintf: Formatted Output Functions.
+ (line 182)
+* mpfr_sprintf: Formatted Output Functions.
+ (line 171)
+* mpfr_sqr: Basic Arithmetic Functions.
+ (line 70)
+* mpfr_sqrt: Basic Arithmetic Functions.
+ (line 97)
+* mpfr_sqrt_ui: Basic Arithmetic Functions.
+ (line 99)
+* mpfr_strtofr: Assignment Functions.
+ (line 83)
+* mpfr_sub: Basic Arithmetic Functions.
+ (line 27)
+* mpfr_sub_d: Basic Arithmetic Functions.
+ (line 39)
+* mpfr_sub_q: Basic Arithmetic Functions.
+ (line 45)
+* mpfr_sub_si: Basic Arithmetic Functions.
+ (line 35)
+* mpfr_sub_ui: Basic Arithmetic Functions.
+ (line 31)
+* mpfr_sub_z: Basic Arithmetic Functions.
+ (line 43)
+* mpfr_subnormalize: Exception Related Functions.
+ (line 61)
+* mpfr_sum: Special Functions. (line 275)
+* mpfr_swap: Assignment Functions.
+ (line 154)
+* mpfr_t: Nomenclature and Types.
+ (line 6)
+* mpfr_tan: Special Functions. (line 32)
+* mpfr_tanh: Special Functions. (line 117)
+* mpfr_trunc: Integer Related Functions.
+ (line 11)
+* mpfr_ui_div: Basic Arithmetic Functions.
+ (line 76)
+* mpfr_ui_pow: Basic Arithmetic Functions.
+ (line 128)
+* mpfr_ui_pow_ui: Basic Arithmetic Functions.
+ (line 126)
+* mpfr_ui_sub: Basic Arithmetic Functions.
+ (line 29)
+* mpfr_underflow_p: Exception Related Functions.
+ (line 133)
+* mpfr_unordered_p: Comparison Functions.
+ (line 71)
+* mpfr_urandom: Miscellaneous Functions.
+ (line 50)
+* mpfr_urandomb: Miscellaneous Functions.
+ (line 30)
+* mpfr_vasprintf: Formatted Output Functions.
+ (line 196)
+* MPFR_VERSION: Miscellaneous Functions.
+ (line 120)
+* MPFR_VERSION_MAJOR: Miscellaneous Functions.
+ (line 121)
+* MPFR_VERSION_MINOR: Miscellaneous Functions.
+ (line 122)
+* MPFR_VERSION_NUM: Miscellaneous Functions.
+ (line 140)
+* MPFR_VERSION_PATCHLEVEL: Miscellaneous Functions.
+ (line 123)
+* MPFR_VERSION_STRING: Miscellaneous Functions.
+ (line 124)
+* mpfr_vfprintf: Formatted Output Functions.
+ (line 160)
+* mpfr_vprintf: Formatted Output Functions.
+ (line 166)
+* mpfr_vsnprintf: Formatted Output Functions.
+ (line 184)
+* mpfr_vsprintf: Formatted Output Functions.
+ (line 173)
+* mpfr_y0: Special Functions. (line 214)
+* mpfr_y1: Special Functions. (line 215)
+* mpfr_yn: Special Functions. (line 217)
+* mpfr_z_sub: Basic Arithmetic Functions.
+ (line 41)
+* mpfr_zero_p: Comparison Functions.
+ (line 44)
+* mpfr_zeta: Special Functions. (line 192)
+* mpfr_zeta_ui: Special Functions. (line 194)
+
+
+
+Tag Table:
+Node: Top892
+Node: Copying2243
+Node: Introduction to MPFR4003
+Node: Installing MPFR6092
+Node: Reporting Bugs10914
+Node: MPFR Basics12843
+Node: Headers and Libraries13159
+Node: Nomenclature and Types16143
+Node: MPFR Variable Conventions18147
+Node: Rounding Modes19677
+Ref: ternary value20774
+Node: Floating-Point Values on Special Numbers22727
+Node: Exceptions25703
+Node: Memory Handling28855
+Node: MPFR Interface29987
+Node: Initialization Functions32083
+Node: Assignment Functions38997
+Node: Combined Initialization and Assignment Functions47651
+Node: Conversion Functions48944
+Node: Basic Arithmetic Functions57496
+Node: Comparison Functions66504
+Node: Special Functions69986
+Node: Input and Output Functions83739
+Node: Formatted Output Functions85662
+Node: Integer Related Functions94781
+Node: Rounding Related Functions100543
+Node: Miscellaneous Functions104157
+Node: Exception Related Functions112724
+Node: Compatibility with MPF119478
+Node: Custom Interface122166
+Node: Internals126411
+Node: API Compatibility127895
+Node: Type and Macro Changes129825
+Node: Added Functions132546
+Node: Changed Functions135489
+Node: Removed Functions139770
+Node: Other Changes140182
+Node: Contributors141711
+Node: References144285
+Node: GNU Free Documentation License146026
+Node: Concept Index168469
+Node: Function and Type Index174388
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
diff --git a/doc/mpfr.texi b/doc/mpfr.texi
new file mode 100644
index 0000000..e9b74b1
--- /dev/null
+++ b/doc/mpfr.texi
@@ -0,0 +1,3658 @@
+\input texinfo @c -*-texinfo-*-
+@c %**start of header
+@setfilename mpfr.info
+@documentencoding UTF-8
+@set VERSION 3.1.2
+@set UPDATED-MONTH March 2013
+@settitle GNU MPFR @value{VERSION}
+@synindex tp fn
+@iftex
+@afourpaper
+@end iftex
+@comment %**end of header
+
+@c Note: avoid using non-ASCII characters directly when possible,
+@c as the "info" utility cannot currently handle them.
+@c http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=212549
+
+@copying
+This manual documents how to install and use the Multiple Precision
+Floating-Point Reliable Library, version @value{VERSION}.
+
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.2 or any later
+version published by the Free Software Foundation; with no Invariant Sections,
+with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the
+license is included in @ref{GNU Free Documentation License}.
+@end copying
+
+
+@c Texinfo version 4.2 or up will be needed to process this file.
+@c
+@c A suitable texinfo.tex is supplied, a newer one should work
+@c equally well.
+@c
+@c The edition number is in the VERSION variable above and should be
+@c updated where appropriate. Also, update the month and year in
+@c UPDATED-MONTH.
+
+
+@dircategory Software libraries
+@direntry
+* mpfr: (mpfr). Multiple Precision Floating-Point Reliable Library.
+@end direntry
+
+@c html <meta name=description content="...">
+@documentdescription
+How to install and use GNU MPFR, a library for reliable multiple precision
+floating-point arithmetic, version @value{VERSION}.
+@end documentdescription
+
+@c smallbook
+@finalout
+@setchapternewpage on
+
+@ifnottex
+@node Top, Copying, (dir), (dir)
+@top GNU MPFR
+@end ifnottex
+
+@iftex
+@titlepage
+@title GNU MPFR
+@subtitle The Multiple Precision Floating-Point Reliable Library
+@subtitle Edition @value{VERSION}
+@subtitle @value{UPDATED-MONTH}
+
+@author The MPFR team
+@email{mpfr@@inria.fr}
+
+@c Include the Distribution inside the titlepage so
+@c that headings are turned off.
+
+@tex
+\global\parindent=0pt
+\global\parskip=8pt
+\global\baselineskip=13pt
+@end tex
+
+@page
+@vskip 0pt plus 1filll
+@end iftex
+
+@insertcopying
+@ifnottex
+@sp 1
+@end ifnottex
+
+@iftex
+@end titlepage
+@headings double
+@end iftex
+
+@c Don't bother with contents for html, the menus seem adequate.
+@ifnothtml
+@contents
+@end ifnothtml
+
+@menu
+* Copying:: MPFR Copying Conditions (LGPL).
+* Introduction to MPFR:: Brief introduction to GNU MPFR.
+* Installing MPFR:: How to configure and compile the MPFR library.
+* Reporting Bugs:: How to usefully report bugs.
+* MPFR Basics:: What every MPFR user should now.
+* MPFR Interface:: MPFR functions and macros.
+* API Compatibility:: API compatibility with previous MPFR versions.
+* Contributors::
+* References::
+* GNU Free Documentation License::
+* Concept Index::
+* Function and Type Index::
+@end menu
+
+
+@c @m{T,N} is $T$ in tex or @math{N} otherwise. This is an easy way to give
+@c different forms for math in tex and info. Commas in N or T don't work,
+@c but @C{} can be used instead. \, works in info but not in tex.
+@iftex
+@macro m {T,N}
+@tex$\T\$@end tex
+@end macro
+@end iftex
+@ifnottex
+@macro m {T,N}
+@math{\N\}
+@end macro
+@end ifnottex
+
+@c Usage: @GMPabs{x}
+@c Give either |x| in tex, or abs(x) in info or html.
+@tex
+\gdef\GMPabs#1{|#1|}
+@end tex
+@ifnottex
+@macro GMPabs {X}
+@abs{}(\X\)
+@end macro
+@end ifnottex
+
+@c Usage: @GMPtimes{}
+@c Give either \times or the word "times".
+@tex
+\gdef\GMPtimes{\times}
+@end tex
+@ifnottex
+@macro GMPtimes
+times
+@end macro
+@end ifnottex
+
+@c New math operators.
+@c @abs{} can be used in both tex and info, or just \abs in tex.
+@tex
+\gdef\abs{\mathop{\rm abs}}
+@end tex
+@ifnottex
+@macro abs
+abs
+@end macro
+@end ifnottex
+
+@c @times{} made available as a "*" in info and html (already works in tex).
+@ifnottex
+@macro times
+*
+@end macro
+@end ifnottex
+
+@c Math operators already available in tex, made available in info too.
+@c For example @log{} can be used in both tex and info.
+@ifnottex
+@macro le
+<=
+@end macro
+@macro ge
+>=
+@end macro
+@macro ne
+<>
+@end macro
+@macro log
+log
+@end macro
+@end ifnottex
+
+@c @pom{} definition
+@tex
+\gdef\pom{\ifmmode\pm\else$\pm$\fi}
+@end tex
+@ifnottex
+@macro pom
+@end macro
+@end ifnottex
+
+@c The following macro have been copied from gmp.texi
+@c
+@c Usage: @MPFRpxreftop{info,title}
+@c
+@c Like @pxref{}, but designed for a reference to the top of a document, not
+@c a particular section.
+@c
+@c The texinfo manual recommends putting a likely section name in references
+@c like this, eg. "Introduction", but it seems better to just give the title.
+@c
+@iftex
+@macro MPFRpxreftop{info,title}
+see @cite{\title\}.
+@end macro
+@end iftex
+@ifhtml
+@macro MPFRpxreftop{info,title}
+see @cite{\title\}.
+@end macro
+@end ifhtml
+@ifnottex
+@ifnothtml
+@macro MPFRpxreftop{info,title}
+@pxref{Top,\title\,\title\,\info\,\title\}
+@end macro
+@end ifnothtml
+@end ifnottex
+
+@node Copying, Introduction to MPFR, Top, Top
+@comment node-name, next, previous, up
+@unnumbered MPFR Copying Conditions
+@cindex Copying conditions
+@cindex Conditions for copying MPFR
+
+The GNU MPFR library (or MPFR for short)
+is @dfn{free}; this means that everyone is free to use it and
+free to redistribute it on a free basis. The library is not in the public
+domain; it is copyrighted and there are restrictions on its distribution, but
+these restrictions are designed to permit everything that a good cooperating
+citizen would want to do. What is not allowed is to try to prevent others
+from further sharing any version of this library that they might get from
+you.@refill
+
+Specifically, we want to make sure that you have the right to give away copies
+of the library, that you receive source code or else can get it if you want
+it, that you can change this library or use pieces of it in new free programs,
+and that you know you can do these things.@refill
+
+To make sure that everyone has such rights, we have to forbid you to deprive
+anyone else of these rights. For example, if you distribute copies of the
+GNU MPFR library, you must give the recipients all the rights that you have.
+You must make sure that they, too, receive or can get the source code. And you
+must tell them their rights.@refill
+
+Also, for our own protection, we must make certain that everyone finds out
+that there is no warranty for the GNU MPFR library. If it is modified by
+someone else and passed on, we want their recipients to know that what they
+have is not what we distributed, so that any problems introduced by others
+will not reflect on our reputation.@refill
+
+The precise conditions of the license for the GNU MPFR library are found in the
+Lesser General Public License that accompanies the source code.
+See the file COPYING.LESSER.@refill
+
+@node Introduction to MPFR, Installing MPFR, Copying, Top
+@comment node-name, next, previous, up
+@chapter Introduction to MPFR
+
+
+MPFR is a portable library written in C for arbitrary precision arithmetic
+on floating-point numbers. It is based on the GNU MP library.
+It aims to provide a class of floating-point numbers with
+precise semantics. The main characteristics of MPFR, which make it differ
+from most arbitrary precision floating-point software tools, are:
+
+@itemize @bullet
+@item the MPFR code is portable, i.e., the result of any operation
+does not depend on the machine word size
+@code{mp_bits_per_limb} (64 on most current processors);
+@item the precision in bits can be set @emph{exactly} to any valid value
+for each variable (including very small precision);
+@item MPFR provides the four rounding modes from the IEEE 754-1985
+standard, plus away-from-zero, as well as for basic operations as for other
+mathematical functions.
+@end itemize
+
+In particular, with a precision of 53 bits, MPFR is able to
+exactly reproduce all computations with double-precision machine
+floating-point numbers (e.g., @code{double} type in C, with a C
+implementation that rigorously follows Annex F of the ISO C99 standard
+and @code{FP_CONTRACT} pragma set to @code{OFF}) on the four arithmetic
+operations and the square root, except the default exponent range is much
+wider and subnormal numbers are not implemented (but can be emulated).
+
+This version of MPFR is released under the GNU Lesser General Public
+License, version 3 or any later version.
+It is permitted to link MPFR to most non-free programs, as long as when
+distributing them the MPFR source code and a means to re-link with a
+modified MPFR library is provided.
+
+@section How to Use This Manual
+
+Everyone should read @ref{MPFR Basics}. If you need to install the library
+yourself, you need to read @ref{Installing MPFR}, too.
+To use the library you will need to refer to @ref{MPFR Interface}.
+
+The rest of the manual can be used for later reference, although it is
+probably a good idea to glance through it.
+
+@node Installing MPFR, Reporting Bugs, Introduction to MPFR, Top
+@comment node-name, next, previous, up
+@chapter Installing MPFR
+@cindex Installation
+
+The MPFR library is already installed on some GNU/Linux distributions,
+but the development files necessary to the compilation such as
+@file{mpfr.h} are not always present. To check that MPFR is fully
+installed on your computer, you can check the presence of the file
+@file{mpfr.h} in @file{/usr/include}, or try to compile a small program
+having @code{#include <mpfr.h>} (since @file{mpfr.h} may be installed
+somewhere else). For instance, you can try to compile:
+
+@example
+#include <stdio.h>
+#include <mpfr.h>
+int main (void)
+@{
+ printf ("MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n",
+ mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
+ MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
+ return 0;
+@}
+@end example
+
+@noindent
+with
+
+@example
+cc -o version version.c -lmpfr -lgmp
+@end example
+
+@noindent
+and if you get errors whose first line looks like
+
+@example
+version.c:2:19: error: mpfr.h: No such file or directory
+@end example
+
+@noindent
+then MPFR is probably not installed. Running this program will give you
+the MPFR version.
+
+If MPFR is not installed on your computer, or if you want to install a
+different version, please follow the steps below.
+
+@section How to Install
+
+Here are the steps needed to install the library on Unix systems
+(more details are provided in the @file{INSTALL} file):
+
+@enumerate
+@item
+To build MPFR, you first have to install GNU MP
+(version 4.1 or higher) on your computer.
+You need a C compiler, preferably GCC, but any reasonable compiler should
+work. And you need the standard Unix @samp{make} command, plus some other
+standard Unix utility commands.
+
+Then, in the MPFR build directory, type the following commands.
+
+@item
+@samp{./configure}
+
+This will prepare the build and setup the options according to your system.
+You can give options to specify the install directories (instead of
+the default @file{/usr/local}), threading support, and so on. See
+the @file{INSTALL} file and/or the output of @samp{./configure --help}
+for more information, in particular if you get error messages.
+
+@item
+@samp{make}
+
+This will compile MPFR, and create a library archive file @file{libmpfr.a}.
+On most platforms, a dynamic library will be produced too.
+@item
+@samp{make check}
+
+This will make sure MPFR was built correctly.
+If you get error messages, please report this to the MPFR mailing-list
+@samp{mpfr@@inria.fr}. (@xref{Reporting Bugs}, for
+information on what to include in useful bug reports.)
+
+@item
+@samp{make install}
+
+This will copy the files @file{mpfr.h} and @file{mpf2mpfr.h} to the directory
+@file{/usr/local/include}, the library files (@file{libmpfr.a} and possibly
+others) to the directory @file{/usr/local/lib}, the file @file{mpfr.info}
+to the directory @file{/usr/local/share/info}, and some other documentation
+files to the directory @file{/usr/local/share/doc/mpfr} (or if you passed the
+@samp{--prefix} option to @file{configure}, using the prefix directory given
+as argument to @samp{--prefix} instead of @file{/usr/local}).
+@end enumerate
+
+@section Other `make' Targets
+
+There are some other useful make targets:
+
+@itemize @bullet
+@item
+@samp{mpfr.info} or @samp{info}
+
+Create or update an info version of the manual, in @file{mpfr.info}.
+
+This file is already provided in the MPFR archives.
+
+@item
+@samp{mpfr.pdf} or @samp{pdf}
+
+Create a PDF version of the manual, in @file{mpfr.pdf}.
+
+@item
+@samp{mpfr.dvi} or @samp{dvi}
+
+Create a DVI version of the manual, in @file{mpfr.dvi}.
+
+@item
+@samp{mpfr.ps} or @samp{ps}
+
+Create a Postscript version of the manual, in @file{mpfr.ps}.
+
+@item
+@samp{mpfr.html} or @samp{html}
+
+Create a HTML version of the manual, in several pages in the directory
+@file{doc/mpfr.html}; if you want only one output HTML file, then type
+@samp{makeinfo --html --no-split mpfr.texi} from the @samp{doc} directory
+instead.
+
+@item
+@samp{clean}
+
+Delete all object files and archive files, but not the configuration files.
+
+@item
+@samp{distclean}
+
+Delete all generated files not included in the distribution.
+
+@item
+@samp{uninstall}
+
+Delete all files copied by @samp{make install}.
+@end itemize
+
+
+@section Build Problems
+
+In case of problem, please read the @file{INSTALL} file carefully
+before reporting a bug, in particular section ``In case of problem''.
+Some problems are due to bad configuration on the user side (not
+specific to MPFR). Problems are also mentioned in the FAQ
+@url{http://www.mpfr.org/faq.html}.
+
+@comment Warning! Do not split "MPFR ... @url{...}" across several lines
+@comment as this needs to be updated with update-version.
+Please report problems to the MPFR mailing-list @samp{mpfr@@inria.fr}.
+@xref{Reporting Bugs}.
+Some bug fixes are available on the
+MPFR 3.1.2 web page @url{http://www.mpfr.org/mpfr-3.1.2/}.
+
+@section Getting the Latest Version of MPFR
+
+The latest version of MPFR is available from
+@url{ftp://ftp.gnu.org/gnu/mpfr/} or @url{http://www.mpfr.org/}.
+
+@node Reporting Bugs, MPFR Basics, Installing MPFR, Top
+@comment node-name, next, previous, up
+@chapter Reporting Bugs
+@cindex Reporting bugs
+
+@comment Warning! Do not split "MPFR ... @url{...}" across several lines
+@comment as this needs to be updated with update-version.
+If you think you have found a bug in the MPFR library, first have a look
+on the MPFR 3.1.2 web page @url{http://www.mpfr.org/mpfr-3.1.2/} and the
+FAQ @url{http://www.mpfr.org/faq.html}:
+perhaps this bug is already known, in which case you may find there
+a workaround for it.
+You might also look in the archives of the MPFR mailing-list:
+@url{https://sympa.inria.fr/sympa/arc/mpfr}.
+Otherwise, please investigate and report it.
+We have made this library available to you, and it is not to ask too
+much from you, to ask you to report the bugs that you find.
+
+There are a few things you should think about when you put your bug report
+together.
+
+You have to send us a test case that makes it possible for us to reproduce the
+bug, i.e., a small self-content program, using no other library than MPFR.
+Include instructions on how to run the test case.
+
+You also have to explain what is wrong; if you get a crash, or if the results
+you get are incorrect and in that case, in what way.
+
+Please include compiler version information in your bug report. This can
+be extracted using @samp{cc -V} on some machines, or, if you're using GCC,
+@samp{gcc -v}. Also, include the output from @samp{uname -a} and the MPFR
+version (the GMP version may be useful too).
+If you get a failure while running @samp{make} or @samp{make check}, please
+include the @samp{config.log} file in your bug report.
+
+If your bug report is good, we will do our best to help you to get a corrected
+version of the library; if the bug report is poor, we will not do anything
+about it (aside of chiding you to send better bug reports).
+
+Send your bug report to the MPFR mailing-list @samp{mpfr@@inria.fr}.
+
+If you think something in this manual is unclear, or downright incorrect, or if
+the language needs to be improved, please send a note to the same address.
+
+@node MPFR Basics, MPFR Interface, Reporting Bugs, Top
+@comment node-name, next, previous, up
+@chapter MPFR Basics
+
+@menu
+* Headers and Libraries::
+* Nomenclature and Types::
+* MPFR Variable Conventions::
+* Rounding Modes::
+* Floating-Point Values on Special Numbers::
+* Exceptions::
+* Memory Handling::
+@end menu
+
+@node Headers and Libraries, Nomenclature and Types, MPFR Basics, MPFR Basics
+@comment node-name, next, previous, up
+@section Headers and Libraries
+
+@cindex @file{mpfr.h}
+All declarations needed to use MPFR are collected in the include file
+@file{mpfr.h}. It is designed to work with both C and C++ compilers.
+You should include that file in any program using the MPFR library:
+
+@example
+#include <mpfr.h>
+@end example
+
+@cindex @code{stdio.h}
+Note however that prototypes for MPFR functions with @code{FILE *} parameters
+are provided only if @code{<stdio.h>} is included too (before @file{mpfr.h}):
+
+@example
+#include <stdio.h>
+#include <mpfr.h>
+@end example
+
+@cindex @code{stdarg.h}
+Likewise @code{<stdarg.h>} (or @code{<varargs.h>}) is required for prototypes
+with @code{va_list} parameters, such as @code{mpfr_vprintf}.
+
+@cindex @code{stdint.h}
+@cindex @code{inttypes.h}
+@cindex @code{intmax_t}
+@cindex @code{uintmax_t}
+And for any functions using @code{intmax_t}, you must include
+@code{<stdint.h>} or @code{<inttypes.h>} before @file{mpfr.h}, to
+allow @file{mpfr.h} to define prototypes for these functions. Moreover,
+users of C++ compilers under some platforms may need to define
+@code{MPFR_USE_INTMAX_T} (and should do it for portability) before
+@file{mpfr.h} has been included; of course, it is possible to do that
+on the command line, e.g., with @code{-DMPFR_USE_INTMAX_T}.
+
+Note: If @file{mpfr.h} and/or @file{gmp.h} (used by @file{mpfr.h})
+are included several times (possibly from another header file),
+@code{<stdio.h>} and/or @code{<stdarg.h>} (or @code{<varargs.h>})
+should be included @strong{before the first inclusion} of
+@file{mpfr.h} or @file{gmp.h}. Alternatively, you can define
+@code{MPFR_USE_FILE} (for MPFR I/O functions) and/or
+@code{MPFR_USE_VA_LIST} (for MPFR functions with @code{va_list}
+parameters) anywhere before the last inclusion of @file{mpfr.h}.
+As a consequence, if your file is a public header that includes
+@file{mpfr.h}, you need to use the latter method.
+
+When calling a MPFR macro, it is not allowed to have previously defined
+a macro with the same name as some keywords (currently @code{do},
+@code{while} and @code{sizeof}).
+
+You can avoid the use of MPFR macros encapsulating functions by defining
+the @code{MPFR_USE_NO_MACRO} macro before @file{mpfr.h} is included. In
+general this should not be necessary, but this can be useful when debugging
+user code: with some macros, the compiler may emit spurious warnings with
+some warning options, and macros can prevent some prototype checking.
+
+@cindex Libraries
+@cindex Linking
+@cindex @code{libmpfr}
+All programs using MPFR must link against both @file{libmpfr} and
+@file{libgmp} libraries. On a typical Unix-like system this can be
+done with @samp{-lmpfr -lgmp} (in that order), for example:
+
+@example
+gcc myprogram.c -lmpfr -lgmp
+@end example
+
+@cindex Libtool
+MPFR is built using Libtool and an application can use that to link if
+desired, @MPFRpxreftop{libtool.info, GNU Libtool}
+@c Note: the .info extension has been added to avoid the following bug:
+@c http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484740
+@c which occurs when reading the info file from the build directory:
+@c info ./mpfr or info -f ./mpfr.info
+@c Due to a poor design, the "info" utility will not find the correct
+@c libtool info file if the .info extension is not provided, because of
+@c the "libtool" script in MPFR's directory!
+
+If MPFR has been installed to a non-standard location, then it may be
+necessary to set up environment variables such as @samp{C_INCLUDE_PATH}
+and @samp{LIBRARY_PATH}, or use @samp{-I} and @samp{-L} compiler options,
+in order to point to the right directories. For a shared library, it may
+also be necessary to set up some sort of run-time library path (e.g.,
+@samp{LD_LIBRARY_PATH}) on some systems. Please read the @file{INSTALL}
+file for additional information.
+
+@node Nomenclature and Types, MPFR Variable Conventions, Headers and Libraries, MPFR Basics
+@comment node-name, next, previous, up
+@section Nomenclature and Types
+
+@cindex Floating-point number
+@tindex @code{mpfr_t}
+@noindent
+A @dfn{floating-point number}, or @dfn{float} for short, is an arbitrary
+precision significand (also called mantissa) with a limited precision
+exponent. The C data type
+for such objects is @code{mpfr_t} (internally defined as a one-element
+array of a structure, and @code{mpfr_ptr} is the C data type representing
+a pointer to this structure). A floating-point number can have
+three special values: Not-a-Number (NaN) or plus or minus Infinity. NaN
+represents an uninitialized object, the result of an invalid operation
+(like 0 divided by 0), or a value that cannot be determined (like
++Infinity minus +Infinity). Moreover, like in the IEEE 754 standard,
+zero is signed, i.e., there are both +0 and @minus{}0; the behavior
+is the same as in the IEEE 754 standard and it is generalized to
+the other functions supported by MPFR. Unless documented otherwise,
+the sign bit of a NaN is unspecified.
+@c VL: re-added how mpfr_t is defined, due to some questions from users
+@c in the past (the fact that the result was returned in an argument
+@c seemed strange); also, mpfr_ptr needs to be defined here, as it is
+@c used in the API.
+
+@cindex Precision
+@tindex @code{mpfr_prec_t}
+@noindent
+The @dfn{precision} is the number of bits used to represent the significand
+of a floating-point number;
+the corresponding C data type is @code{mpfr_prec_t}.
+The precision can be any integer between @code{MPFR_PREC_MIN} and
+@code{MPFR_PREC_MAX}. In the current implementation, @code{MPFR_PREC_MIN}
+is equal to 2.
+
+Warning! MPFR needs to increase the precision internally, in order to
+provide accurate results (and in particular, correct rounding). Do not
+attempt to set the precision to any value near @code{MPFR_PREC_MAX},
+otherwise MPFR will abort due to an assertion failure. Moreover, you
+may reach some memory limit on your platform, in which case the program
+may abort, crash or have undefined behavior (depending on your C
+implementation).
+
+@cindex Rounding Modes
+@tindex @code{mpfr_rnd_t}
+@noindent
+The @dfn{rounding mode} specifies the way to round the result of a
+floating-point operation, in case the exact result can not be represented
+exactly in the destination significand;
+the corresponding C data type is @code{mpfr_rnd_t}.
+
+@node MPFR Variable Conventions, Rounding Modes, Nomenclature and Types, MPFR Basics
+@comment node-name, next, previous, up
+@section MPFR Variable Conventions
+
+Before you can assign to an MPFR variable, you need to initialize it by calling
+one of the special initialization functions. When you're done with a
+variable, you need to clear it out, using one of the functions for that
+purpose.
+A variable should only be initialized once, or at least cleared out between
+each initialization. After a variable has been initialized, it may be
+assigned to any number of times.
+For efficiency reasons, avoid to initialize and clear out a variable in loops.
+Instead, initialize it before entering the loop, and clear it out after the
+loop has exited.
+You do not need to be concerned about allocating additional space for MPFR
+variables, since any variable has a significand of fixed size.
+Hence unless you change its precision, or clear and reinitialize it,
+a floating-point variable will have the same allocated space during all its
+life.
+
+As a general rule, all MPFR functions expect output arguments before input
+arguments. This notation is based on an analogy with the assignment operator.
+MPFR allows you to use the same variable for both input and output in the same
+expression. For example, the main function for floating-point multiplication,
+@code{mpfr_mul}, can be used like this: @code{mpfr_mul (x, x, x, rnd)}.
+This
+computes the square of @var{x} with rounding mode @code{rnd}
+and puts the result back in @var{x}.
+
+@node Rounding Modes, Floating-Point Values on Special Numbers, MPFR Variable Conventions, MPFR Basics
+@comment node-name, next, previous, up
+@section Rounding Modes
+
+The following five rounding modes are supported:
+
+@itemize @bullet
+@item @code{MPFR_RNDN}: round to nearest (roundTiesToEven in IEEE 754-2008),
+@item @code{MPFR_RNDZ}: round toward zero (roundTowardZero in IEEE 754-2008),
+@item @code{MPFR_RNDU}: round toward plus infinity (roundTowardPositive in IEEE 754-2008),
+@item @code{MPFR_RNDD}: round toward minus infinity (roundTowardNegative in IEEE 754-2008),
+@item @code{MPFR_RNDA}: round away from zero.
+@end itemize
+
+The @samp{round to nearest} mode works as in the IEEE 754 standard: in
+case the number to be rounded lies exactly in the middle of two representable
+numbers, it is rounded to the one with the least significant bit set to zero.
+For example, the number 2.5, which is represented by (10.1) in binary, is
+rounded to (10.0)=2 with a precision of two bits, and not to (11.0)=3.
+This rule avoids the @dfn{drift} phenomenon mentioned by Knuth in volume 2
+of The Art of Computer Programming (Section 4.2.2).
+
+@anchor{ternary value}@cindex Ternary value
+Most MPFR functions take as first argument the destination variable, as
+second and following arguments the input variables, as last argument a
+rounding mode, and have a return value of type @code{int}, called the
+@dfn{ternary value}. The value stored in the destination variable is
+correctly rounded, i.e., MPFR behaves as if it computed the result with
+an infinite precision, then rounded it to the precision of this variable.
+The input variables are regarded as exact (in particular, their precision
+does not affect the result).
+
+As a consequence, in case of a non-zero real rounded result, the error
+on the result is less or equal to 1/2 ulp (unit in the last place) of
+that result in the rounding to nearest mode, and less than 1 ulp of that
+result in the directed rounding modes (a ulp is the weight of the least
+significant represented bit of the result after rounding).
+@c Since subnormals are not supported, we must take into account the ulp of
+@c the rounded result, not the one of the exact result, for full generality.
+
+Unless documented otherwise, functions returning an @code{int} return
+a ternary value.
+If the ternary value is zero, it means that the value stored in the
+destination variable is the exact result of the corresponding mathematical
+function. If the ternary value is positive (resp.@: negative), it means
+the value stored in the destination variable is greater (resp.@: lower)
+than the exact result. For example with the @code{MPFR_RNDU} rounding mode,
+the ternary value is usually positive, except when the result is exact, in
+which case it is zero. In the case of an infinite result, it is considered
+as inexact when it was obtained by overflow, and exact otherwise. A NaN
+result (Not-a-Number) always corresponds to an exact return value.
+The opposite of a returned ternary value is guaranteed to be representable
+in an @code{int}.
+
+Unless documented otherwise, functions returning as result the value @code{1}
+(or any other value specified in this manual)
+for special cases (like @code{acos(0)}) yield an overflow or
+an underflow if that value is not representable in the current exponent range.
+
+@node Floating-Point Values on Special Numbers, Exceptions, Rounding Modes, MPFR Basics
+@comment node-name, next, previous, up
+@section Floating-Point Values on Special Numbers
+
+This section specifies the floating-point values (of type @code{mpfr_t})
+returned by MPFR functions (where by ``returned'' we mean here the modified
+value of the destination object, which should not be mixed with the ternary
+return value of type @code{int} of those functions).
+For functions returning several values (like
+@code{mpfr_sin_cos}), the rules apply to each result separately.
+
+Functions can have one or several input arguments. An input point is
+a mapping from these input arguments to the set of the MPFR numbers.
+When none of its components are NaN, an input point can also be seen
+as a tuple in the extended real numbers (the set of the real numbers
+with both infinities).
+
+When the input point is in the domain of the mathematical function, the
+result is rounded as described in Section ``Rounding Modes'' (but see
+below for the specification of the sign of an exact zero). Otherwise
+the general rules from this section apply unless stated otherwise in
+the description of the MPFR function (@ref{MPFR Interface}).
+
+When the input point is not in the domain of the mathematical function
+but is in its closure in the extended real numbers and the function can
+be extended by continuity, the result is the obtained limit.
+Examples: @code{mpfr_hypot} on (+Inf,0) gives +Inf. But @code{mpfr_pow}
+cannot be defined on (1,+Inf) using this rule, as one can find
+sequences (@m{x_n,@var{x}_@var{n}},@m{y_n,@var{y}_@var{n}}) such that
+@m{x_n,@var{x}_@var{n}} goes to 1, @m{y_n,@var{y}_@var{n}} goes to +Inf
+and @m{(x_n)^{y_n},@var{x}_@var{n} to the @var{y}_@var{n}} goes to any
+positive value when @var{n} goes to the infinity.
+
+When the input point is in the closure of the domain of the mathematical
+function and an input argument is +0 (resp.@: @minus{}0), one considers
+the limit when the corresponding argument approaches 0 from above
+(resp.@: below). If the limit is not defined (e.g., @code{mpfr_log} on
+@minus{}0), the behavior is specified in the description of the MPFR function.
+
+When the result is equal to 0, its sign is determined by considering the
+limit as if the input point were not in the domain: If one approaches 0
+from above (resp.@: below), the result is +0 (resp.@: @minus{}0);
+for example, @code{mpfr_sin} on +0 gives +0.
+In the other cases, the sign is specified in the description of the MPFR
+function; for example @code{mpfr_max} on @minus{}0 and +0 gives +0.
+
+When the input point is not in the closure of the domain of the function,
+the result is NaN. Example: @code{mpfr_sqrt} on @minus{}17 gives NaN.
+
+When an input argument is NaN, the result is NaN, possibly except when
+a partial function is constant on the finite floating-point numbers;
+such a case is always explicitly specified in @ref{MPFR Interface}.
+@c Said otherwise, if such a case is not specified, this is a bug, thus
+@c we may change the returned value after documenting it without having
+@c to change the libtool interface number (this would have more drawbacks
+@c that advantages in practice), like for any bug fix.
+Example: @code{mpfr_hypot} on (NaN,0) gives NaN, but @code{mpfr_hypot}
+on (NaN,+Inf) gives +Inf (as specified in @ref{Special Functions}),
+since for any finite input @var{x}, @code{mpfr_hypot} on (@var{x},+Inf)
+gives +Inf.
+
+@node Exceptions, Memory Handling, Floating-Point Values on Special Numbers, MPFR Basics
+@comment node-name, next, previous, up
+@section Exceptions
+
+MPFR supports 6 exception types:
+
+@itemize @bullet
+
+@item Underflow:
+An underflow occurs when the exact result of a function is a non-zero
+real number and the result obtained after the rounding, assuming an
+unbounded exponent range (for the rounding), has an exponent smaller
+than the minimum value of the current exponent range. (In the round-to-nearest
+mode, the halfway case is rounded toward zero.)
+
+Note: This is not the single possible definition of the underflow. MPFR chooses
+to consider the underflow @emph{after} rounding. The underflow before rounding
+can also be defined. For instance, consider a function that has the
+exact result @m{7 \times 2^{e-4}, 7 multiplied by two to the power
+@var{e}@minus{}4}, where @var{e} is the smallest exponent (for a
+significand between 1/2 and 1),
+with a 2-bit target precision and rounding toward plus infinity.
+The exact result has the exponent @var{e}@minus{}1. With the underflow
+before rounding, such a function call would yield an underflow, as
+@var{e}@minus{}1 is outside the current exponent range. However, MPFR
+first considers the rounded result assuming an unbounded exponent range.
+The exact result cannot be represented exactly in precision 2, and here,
+it is rounded to @m{0.5 @times 2^e, 0.5 times 2 to @var{e}}, which is
+representable in the current exponent range. As a consequence, this will
+not yield an underflow in MPFR.
+
+@item Overflow:
+An overflow occurs when the exact result of a function is a non-zero
+real number and the result obtained after the rounding, assuming an
+unbounded exponent range (for the rounding), has an exponent larger
+than the maximum value of the current exponent range. In the round-to-nearest
+mode, the result is infinite.
+Note: unlike the underflow case, there is only one possible definition of
+overflow here.
+
+@item Divide-by-zero:
+An exact infinite result is obtained from finite inputs.
+
+@item NaN:
+A NaN exception occurs when the result of a function is NaN.
+@c NaN is defined above. So, we don't say anything more.
+
+@item Inexact:
+An inexact exception occurs when the result of a function cannot be
+represented exactly and must be rounded.
+
+@item Range error:
+A range exception occurs when a function that does not return a MPFR
+number (such as comparisons and conversions to an integer) has an
+invalid result (e.g., an argument is NaN in @code{mpfr_cmp}, or a
+conversion to an integer cannot be represented in the target type).
+
+@end itemize
+
+MPFR has a global flag for each exception, which can be cleared, set
+or tested by functions described in @ref{Exception Related Functions}.
+
+Differences with the ISO C99 standard:
+
+@itemize @bullet
+
+@item In C, only quiet NaNs are specified, and a NaN propagation does not
+raise an invalid exception. Unless explicitly stated otherwise, MPFR sets
+the NaN flag whenever a NaN is generated, even when a NaN is propagated
+(e.g., in NaN + NaN), as if all NaNs were signaling.
+
+@item An invalid exception in C corresponds to either a NaN exception or
+a range error in MPFR.
+
+@end itemize
+
+@node Memory Handling, , Exceptions, MPFR Basics
+@comment node-name, next, previous, up
+@section Memory Handling
+
+MPFR functions may create caches, e.g., when computing constants such
+as @m{\pi,Pi}, either because the user has called a function like
+@code{mpfr_const_pi} directly or because such a function was called
+internally by the MPFR library itself to compute some other function.
+
+At any time, the user can free the various caches with
+@code{mpfr_free_cache}. It is strongly advised to do that before
+terminating a thread, or before exiting when using tools like
+@samp{valgrind} (to avoid memory leaks being reported).
+
+MPFR internal data such as flags, the exponent range, the default
+precision and rounding mode, and caches (i.e., data that are not
+accessed via parameters) are either global (if MPFR has not been
+compiled as thread safe) or per-thread (thread local storage, TLS).
+The initial values of TLS data after a thread is created entirely
+depend on the compiler and thread implementation (MPFR simply does
+a conventional variable initialization, the variables being declared
+with an implementation-defined TLS specifier).
+@c References to TLS specification or documentation can be given here.
+@c Concerning some thread implementations under Unix, POSIX specifies
+@c the thread interface only; TLS variables (with the __thread specifier)
+@c is just a GCC extension. There is currently no clear documentation
+@c about TLS variable initialization.
+
+@node MPFR Interface, API Compatibility, MPFR Basics, Top
+@comment node-name, next, previous, up
+@chapter MPFR Interface
+@cindex Floating-point functions
+@cindex Float functions
+
+The floating-point functions expect arguments of type @code{mpfr_t}.
+
+The MPFR floating-point functions have an interface that is similar to the
+GNU MP
+functions. The function prefix for floating-point operations is @code{mpfr_}.
+
+The user has
+to specify the precision of each variable. A computation that assigns a
+variable will take place with the precision of the assigned variable; the
+cost of that computation should not depend on the
+precision of variables used as input (on average).
+
+@cindex Precision
+The semantics of a calculation in MPFR is specified as follows: Compute the
+requested operation exactly (with ``infinite accuracy''), and round the result
+to the precision of the destination variable, with the given rounding mode.
+The MPFR floating-point functions are intended to be a smooth extension
+of the IEEE 754 arithmetic. The results obtained on a given computer are
+identical to those obtained on a computer with a different word size,
+or with a different compiler or operating system.
+
+@cindex Accuracy
+MPFR @emph{does not keep track} of the accuracy of a computation. This is left
+to the user or to a higher layer (for example the MPFI library for interval
+arithmetic).
+As a consequence, if two variables are used to store
+only a few significant bits, and their product is stored in a variable with large
+precision, then MPFR will still compute the result with full precision.
+
+The value of the standard C macro @code{errno} may be set to non-zero by
+any MPFR function or macro, whether or not there is an error.
+
+@menu
+* Initialization Functions::
+* Assignment Functions::
+* Combined Initialization and Assignment Functions::
+* Conversion Functions::
+* Basic Arithmetic Functions::
+* Comparison Functions::
+* Special Functions::
+* Input and Output Functions::
+* Formatted Output Functions::
+* Integer Related Functions::
+* Rounding Related Functions::
+* Miscellaneous Functions::
+* Exception Related Functions::
+* Compatibility with MPF::
+* Custom Interface::
+* Internals::
+@end menu
+
+@node Initialization Functions, Assignment Functions, MPFR Interface, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Initialization functions
+@section Initialization Functions
+
+An @code{mpfr_t} object must be initialized before storing the first value in
+it. The functions @code{mpfr_init} and @code{mpfr_init2} are used for that
+purpose.
+
+@deftypefun void mpfr_init2 (mpfr_t @var{x}, mpfr_prec_t @var{prec})
+Initialize @var{x}, set its precision to be @strong{exactly}
+@var{prec} bits and its value to NaN. (Warning: the corresponding
+MPF function initializes to zero instead.)
+
+Normally, a variable should be initialized once only or at
+least be cleared, using @code{mpfr_clear}, between initializations.
+To change the precision of a variable which has already been initialized,
+use @code{mpfr_set_prec}.
+The precision @var{prec} must be an integer between @code{MPFR_PREC_MIN} and
+@code{MPFR_PREC_MAX} (otherwise the behavior is undefined).
+@end deftypefun
+
+@deftypefun void mpfr_inits2 (mpfr_prec_t @var{prec}, mpfr_t @var{x}, ...)
+Initialize all the @code{mpfr_t} variables of the given variable
+argument @code{va_list}, set their precision to be @strong{exactly}
+@var{prec} bits and their value to NaN.
+See @code{mpfr_init2} for more details.
+The @code{va_list} is assumed to be composed only of type @code{mpfr_t}
+(or equivalently @code{mpfr_ptr}).
+It begins from @var{x}, and ends when it encounters a null pointer (whose
+type must also be @code{mpfr_ptr}).
+@end deftypefun
+
+@deftypefun void mpfr_clear (mpfr_t @var{x})
+Free the space occupied by the significand of
+@var{x}. Make sure to call this function for all
+@code{mpfr_t} variables when you are done with them.
+@end deftypefun
+
+@deftypefun void mpfr_clears (mpfr_t @var{x}, ...)
+Free the space occupied by all the @code{mpfr_t} variables of the given
+@code{va_list}. See @code{mpfr_clear} for more details.
+The @code{va_list} is assumed to be composed only of type @code{mpfr_t}
+(or equivalently @code{mpfr_ptr}).
+It begins from @var{x}, and ends when it encounters a null pointer (whose
+type must also be @code{mpfr_ptr}).
+@end deftypefun
+
+Here is an example of how to use multiple initialization functions
+(since @code{NULL} is not necessarily defined in this context, we use
+@code{(mpfr_ptr) 0} instead, but @code{(mpfr_ptr) NULL} is also correct).
+
+@example
+@{
+ mpfr_t x, y, z, t;
+ mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0);
+ @dots{}
+ mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
+@}
+@end example
+
+@deftypefun void mpfr_init (mpfr_t @var{x})
+Initialize @var{x}, set its precision to the default precision,
+and set its value to NaN.
+The default precision can be changed by a call to @code{mpfr_set_default_prec}.
+
+Warning! In a given program, some other libraries might change the default
+precision and not restore it. Thus it is safer to use @code{mpfr_init2}.
+@end deftypefun
+
+@deftypefun void mpfr_inits (mpfr_t @var{x}, ...)
+Initialize all the @code{mpfr_t} variables of the given @code{va_list},
+set their precision to the default precision and their value to NaN.
+See @code{mpfr_init} for more details.
+The @code{va_list} is assumed to be composed only of type @code{mpfr_t}
+(or equivalently @code{mpfr_ptr}).
+It begins from @var{x}, and ends when it encounters a null pointer (whose
+type must also be @code{mpfr_ptr}).
+
+Warning! In a given program, some other libraries might change the default
+precision and not restore it. Thus it is safer to use @code{mpfr_inits2}.
+@end deftypefun
+
+@defmac MPFR_DECL_INIT (@var{name}, @var{prec})
+This macro declares @var{name} as an automatic variable of type @code{mpfr_t},
+initializes it and sets its precision to be @strong{exactly} @var{prec} bits
+and its value to NaN. @var{name} must be a valid identifier.
+You must use this macro in the declaration section.
+This macro is much faster than using @code{mpfr_init2} but has some
+drawbacks:
+
+@itemize @bullet
+@item You @strong{must not} call @code{mpfr_clear} with variables
+created with this macro (the storage is allocated at the point of declaration
+and deallocated when the brace-level is exited).
+@item You @strong{cannot} change their precision.
+@item You @strong{should not} create variables with huge precision with this
+macro.
+@item Your compiler must support @samp{Non-Constant Initializers} (standard
+in C++ and ISO C99) and @samp{Token Pasting}
+(standard in ISO C89). If @var{prec} is not a constant expression, your
+compiler must support @samp{variable-length automatic arrays} (standard
+in ISO C99). GCC 2.95.3 and above supports all these features.
+If you compile your program with GCC in C89 mode and with @samp{-pedantic},
+you may want to define the @code{MPFR_USE_EXTENSION} macro to avoid warnings
+due to the @code{MPFR_DECL_INIT} implementation.
+@end itemize
+@end defmac
+
+@deftypefun void mpfr_set_default_prec (mpfr_prec_t @var{prec})
+Set the default precision to be @strong{exactly} @var{prec} bits, where
+@var{prec} can be any integer between @code{MPFR_PREC_MIN} and
+@code{MPFR_PREC_MAX}.
+The
+precision of a variable means the number of bits used to store its significand.
+All
+subsequent calls to @code{mpfr_init} or @code{mpfr_inits}
+will use this precision, but previously
+initialized variables are unaffected.
+The default precision is set to 53 bits initially.
+
+Note: when MPFR is built with the @code{--enable-thread-safe} configure option,
+the default precision is local to each thread. @xref{Memory Handling}, for
+more information.
+@end deftypefun
+
+@deftypefun mpfr_prec_t mpfr_get_default_prec (void)
+Return the current default MPFR precision in bits.
+See the documentation of @code{mpfr_set_default_prec}.
+@end deftypefun
+
+@need 2000
+Here is an example on how to initialize floating-point variables:
+
+@example
+@{
+ mpfr_t x, y;
+ mpfr_init (x); /* use default precision */
+ mpfr_init2 (y, 256); /* precision @emph{exactly} 256 bits */
+ @dots{}
+ /* When the program is about to exit, do ... */
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_free_cache (); /* free the cache for constants like pi */
+@}
+@end example
+
+The following functions are useful for changing the precision during a
+calculation. A typical use would be for adjusting the precision gradually in
+iterative algorithms like Newton-Raphson, making the computation precision
+closely match the actual accurate part of the numbers.
+
+@deftypefun void mpfr_set_prec (mpfr_t @var{x}, mpfr_prec_t @var{prec})
+Reset the precision of @var{x} to be @strong{exactly} @var{prec} bits,
+and set its value to NaN.
+The previous value stored in @var{x} is lost. It is equivalent to
+a call to @code{mpfr_clear(x)} followed by a call to
+@code{mpfr_init2(x, prec)}, but more efficient as no allocation is done in
+case the current allocated space for the significand of @var{x} is enough.
+The precision @var{prec} can be any integer between @code{MPFR_PREC_MIN} and
+@code{MPFR_PREC_MAX}.
+In case you want to keep the previous value stored in @var{x},
+use @code{mpfr_prec_round} instead.
+@end deftypefun
+
+@deftypefun mpfr_prec_t mpfr_get_prec (mpfr_t @var{x})
+Return the precision of @var{x}, i.e., the
+number of bits used to store its significand.
+@end deftypefun
+
+@node Assignment Functions, Combined Initialization and Assignment Functions, Initialization Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Assignment functions
+@section Assignment Functions
+
+These functions assign new values to already initialized floats
+(@pxref{Initialization Functions}).
+
+@deftypefun int mpfr_set (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_si (mpfr_t @var{rop}, long int @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_uj (mpfr_t @var{rop}, uintmax_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_sj (mpfr_t @var{rop}, intmax_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_flt (mpfr_t @var{rop}, float @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_d (mpfr_t @var{rop}, double @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_ld (mpfr_t @var{rop}, long double @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_decimal64 (mpfr_t @var{rop}, _Decimal64 @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_z (mpfr_t @var{rop}, mpz_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_q (mpfr_t @var{rop}, mpq_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_f (mpfr_t @var{rop}, mpf_t @var{op}, mpfr_rnd_t @var{rnd})
+Set the value of @var{rop} from @var{op}, rounded
+toward the given direction @var{rnd}.
+Note that the input 0 is converted to +0 by @code{mpfr_set_ui},
+@code{mpfr_set_si}, @code{mpfr_set_uj}, @code{mpfr_set_sj},
+@code{mpfr_set_z}, @code{mpfr_set_q} and
+@code{mpfr_set_f}, regardless of the rounding mode.
+If the system does not support the IEEE 754 standard,
+@code{mpfr_set_flt}, @code{mpfr_set_d}, @code{mpfr_set_ld} and
+@code{mpfr_set_decimal64} might not preserve the signed zeros.
+The @code{mpfr_set_decimal64} function is built only with the configure
+option @samp{--enable-decimal-float}, which also requires
+@samp{--with-gmp-build}, and when the compiler or
+system provides the @samp{_Decimal64} data type
+(recent versions of GCC support this data type);
+to use @code{mpfr_set_decimal64}, one should define the macro
+@code{MPFR_WANT_DECIMAL_FLOATS} before including @file{mpfr.h}.
+@c GCC 4.2.0 required to be configured with --enable-decimal-float
+@c but GCC 4.4.3 seems to have decimal support by default
+@code{mpfr_set_q} might fail if the numerator (or the
+denominator) can not be represented as a @code{mpfr_t}.
+
+Note: If you want to store a floating-point constant to a @code{mpfr_t},
+you should use @code{mpfr_set_str} (or one of the MPFR constant functions,
+such as @code{mpfr_const_pi} for @m{\pi,Pi}) instead of
+@code{mpfr_set_flt}, @code{mpfr_set_d},
+@code{mpfr_set_ld} or @code{mpfr_set_decimal64}.
+Otherwise the floating-point constant will be first
+converted into a reduced-precision (e.g., 53-bit) binary
+(or decimal, for @code{mpfr_set_decimal64}) number before
+MPFR can work with it.
+@end deftypefun
+
+@deftypefun int mpfr_set_ui_2exp (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_exp_t @var{e}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_si_2exp (mpfr_t @var{rop}, long int @var{op}, mpfr_exp_t @var{e}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_uj_2exp (mpfr_t @var{rop}, uintmax_t @var{op}, intmax_t @var{e}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_sj_2exp (mpfr_t @var{rop}, intmax_t @var{op}, intmax_t @var{e}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_set_z_2exp (mpfr_t @var{rop}, mpz_t @var{op}, mpfr_exp_t @var{e}, mpfr_rnd_t @var{rnd})
+Set the value of @var{rop} from @m{@var{op} \times 2^e, @var{op} multiplied by
+two to the power @var{e}}, rounded toward the given direction @var{rnd}.
+Note that the input 0 is converted to +0.
+@end deftypefun
+
+@deftypefun int mpfr_set_str (mpfr_t @var{rop}, const char *@var{s}, int @var{base}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the string @var{s} in base @var{base},
+rounded in the direction @var{rnd}.
+See the documentation of @code{mpfr_strtofr} for a detailed description
+of the valid string formats.
+Contrary to @code{mpfr_strtofr}, @code{mpfr_set_str} requires the
+@emph{whole} string to represent a valid floating-point number.
+@c Additionally, special values
+@c @code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@},
+@c all case insensitive, without leading whitespace and possibly followed by
+@c other characters, are accepted too (it may change).
+
+The meaning of the return value differs from other MPFR functions:
+it is 0 if the entire string up to the final null character
+is a valid number in base @var{base}; otherwise it is @minus{}1, and
+@var{rop} may have changed (users interested in the @ref{ternary value}
+should use @code{mpfr_strtofr} instead).
+
+Note: it is preferable to use @code{mpfr_set_str} if one wants to distinguish
+between an infinite @var{rop} value coming from an infinite @var{s} or from
+an overflow.
+@end deftypefun
+
+@deftypefun int mpfr_strtofr (mpfr_t @var{rop}, const char *@var{nptr}, char **@var{endptr}, int @var{base}, mpfr_rnd_t @var{rnd})
+
+Read a floating-point number from a string @var{nptr} in base @var{base},
+rounded in the direction @var{rnd}; @var{base} must be either 0 (to
+detect the base, as described below) or a number from 2 to 62 (otherwise
+the behavior is undefined). If @var{nptr} starts with valid data, the
+result is stored in @var{rop} and @code{*@var{endptr}} points to the
+character just after the valid data (if @var{endptr} is not a null pointer);
+otherwise @var{rop} is set to zero (for consistency with @code{strtod})
+and the value of @var{nptr} is stored
+in the location referenced by @var{endptr} (if @var{endptr} is not a null
+pointer). The usual ternary value is returned.
+
+Parsing follows the standard C @code{strtod} function with some extensions.
+After optional leading whitespace, one has a subject sequence consisting of an
+optional sign (@code{+} or @code{-}), and either numeric data or special
+data. The subject sequence is defined as the longest initial subsequence of
+the input string, starting with the first non-whitespace character, that is of
+the expected form.
+
+The form of numeric data is a non-empty sequence of significand digits with an
+optional decimal point, and an optional exponent consisting of an exponent
+prefix followed by an optional sign and a non-empty sequence of decimal
+digits. A significand digit is either a decimal digit or a Latin letter (62
+possible characters), with @code{A} = 10, @code{B} = 11, @dots{}, @code{Z} =
+35; case is ignored in bases less or equal to 36, in bases larger than 36,
+@code{a} = 36, @code{b} = 37, @dots{}, @code{z} = 61.
+The value of a
+significand digit must be strictly less than the base. The decimal point can
+be either the one defined by the current locale or the period (the first one
+is accepted for consistency with the C standard and the practice, the second
+one is accepted to allow the programmer to provide MPFR numbers from strings
+in a way that does not depend on the current locale).
+The exponent prefix can be @code{e} or @code{E} for bases up to 10, or
+@code{@@} in any base; it indicates a multiplication by a power of the
+base. In bases 2 and 16, the exponent prefix can also be @code{p} or @code{P},
+in which case the exponent, called @emph{binary exponent}, indicates a
+multiplication by a power of 2 instead of the base (there is a difference
+only for base 16); in base 16 for example @code{1p2} represents 4 whereas
+@code{1@@2} represents 256. The value of an exponent is always written in
+base 10.
+
+If the argument @var{base} is 0, then the base is automatically detected
+as follows. If the significand starts with @code{0b} or @code{0B}, base 2
+is assumed. If the significand starts with @code{0x} or @code{0X}, base 16
+is assumed. Otherwise base 10 is assumed.
+
+Note: The exponent (if present)
+must contain at least a digit. Otherwise the possible
+exponent prefix and sign are not part of the number (which ends with the
+significand). Similarly, if @code{0b}, @code{0B}, @code{0x} or @code{0X}
+is not followed by a binary/hexadecimal digit, then the subject sequence
+stops at the character @code{0}, thus 0 is read.
+
+Special data (for infinities and NaN) can be @code{@@inf@@} or
+@code{@@nan@@(n-char-sequence-opt)}, and if @math{@var{base} @le{} 16},
+it can also be @code{infinity}, @code{inf}, @code{nan} or
+@code{nan(n-char-sequence-opt)}, all case insensitive.
+A @code{n-char-sequence-opt} is a possibly empty string containing only digits,
+Latin letters and the underscore (0, 1, 2, @dots{}, 9, a, b, @dots{}, z,
+A, B, @dots{}, Z, _). Note: one has an optional sign for all data, even
+NaN.
+For example, @code{-@@nAn@@(This_Is_Not_17)} is a valid representation for NaN
+in base 17.
+
+@end deftypefun
+
+@deftypefun void mpfr_set_nan (mpfr_t @var{x})
+@deftypefunx void mpfr_set_inf (mpfr_t @var{x}, int @var{sign})
+@deftypefunx void mpfr_set_zero (mpfr_t @var{x}, int @var{sign})
+Set the variable @var{x} to NaN (Not-a-Number), infinity or zero respectively.
+In @code{mpfr_set_inf} or @code{mpfr_set_zero}, @var{x} is set to plus
+infinity or plus zero iff @var{sign} is nonnegative;
+in @code{mpfr_set_nan}, the sign bit of the result is unspecified.
+@end deftypefun
+
+@deftypefun void mpfr_swap (mpfr_t @var{x}, mpfr_t @var{y})
+Swap the values @var{x} and @var{y} efficiently. Warning: the
+precisions are exchanged too; in case the precisions are different,
+@code{mpfr_swap} is thus not equivalent to three @code{mpfr_set} calls
+using a third auxiliary variable.
+@end deftypefun
+
+@node Combined Initialization and Assignment Functions, Conversion Functions, Assignment Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Combined initialization and assignment functions
+@section Combined Initialization and Assignment Functions
+
+@deftypefn Macro int mpfr_init_set (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_si (mpfr_t @var{rop}, long int @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_d (mpfr_t @var{rop}, double @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_ld (mpfr_t @var{rop}, long double @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_z (mpfr_t @var{rop}, mpz_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_q (mpfr_t @var{rop}, mpq_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_f (mpfr_t @var{rop}, mpf_t @var{op}, mpfr_rnd_t @var{rnd})
+Initialize @var{rop} and set its value from @var{op}, rounded in the direction
+@var{rnd}.
+The precision of @var{rop} will be taken from the active default precision,
+as set by @code{mpfr_set_default_prec}.
+@end deftypefn
+
+@deftypefun int mpfr_init_set_str (mpfr_t @var{x}, const char *@var{s}, int @var{base}, mpfr_rnd_t @var{rnd})
+Initialize @var{x} and set its value from
+the string @var{s} in base @var{base},
+rounded in the direction @var{rnd}.
+See @code{mpfr_set_str}.
+@end deftypefun
+
+@node Conversion Functions, Basic Arithmetic Functions, Combined Initialization and Assignment Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Conversion functions
+@section Conversion Functions
+
+@deftypefun float mpfr_get_flt (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx double mpfr_get_d (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx {long double} mpfr_get_ld (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx _Decimal64 mpfr_get_decimal64 (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Convert @var{op} to a @code{float} (respectively @code{double},
+@code{long double} or @code{_Decimal64}), using the rounding mode @var{rnd}.
+If @var{op} is NaN, some fixed NaN (either quiet or signaling) or the result
+of 0.0/0.0 is returned. If @var{op} is @pom{}Inf, an infinity of the same
+sign or the result of @pom{}1.0/0.0 is returned. If @var{op} is zero, these
+functions return a zero, trying to preserve its sign, if possible.
+The @code{mpfr_get_decimal64} function is built only under some conditions:
+see the documentation of @code{mpfr_set_decimal64}.
+@end deftypefun
+
+@deftypefun long mpfr_get_si (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx {unsigned long} mpfr_get_ui (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx intmax_t mpfr_get_sj (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx uintmax_t mpfr_get_uj (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Convert @var{op} to a @code{long}, an @code{unsigned long},
+an @code{intmax_t} or an @code{uintmax_t} (respectively) after rounding
+it with respect to @var{rnd}.
+If @var{op} is NaN, 0 is returned and the @emph{erange} flag is set.
+If @var{op} is too big for the return type, the function returns the maximum
+or the minimum of the corresponding C type, depending on the direction
+of the overflow; the @emph{erange} flag is set too.
+See also @code{mpfr_fits_slong_p}, @code{mpfr_fits_ulong_p},
+@code{mpfr_fits_intmax_p} and @code{mpfr_fits_uintmax_p}.
+@end deftypefun
+
+@deftypefun double mpfr_get_d_2exp (long *@var{exp}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx {long double} mpfr_get_ld_2exp (long *@var{exp}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Return @var{d} and set @var{exp}
+(formally, the value pointed to by @var{exp})
+such that @math{0.5@le{}@GMPabs{@var{d}}<1}
+and @m{@var{d}\times 2^{exp}, @var{d} times 2 raised to @var{exp}} equals
+@var{op} rounded to double (resp.@: long double)
+precision, using the given rounding mode.
+@comment See ISO C standard, frexp function.
+If @var{op} is zero, then a zero of the same sign (or an unsigned zero,
+if the implementation does not have signed zeros) is returned, and
+@var{exp} is set to 0.
+If @var{op} is NaN or an infinity, then the corresponding double precision
+(resp.@: long-double precision)
+value is returned, and @var{exp} is undefined.
+@end deftypefun
+
+@deftypefun int mpfr_frexp (mpfr_exp_t *@var{exp}, mpfr_t @var{y}, mpfr_t @var{x}, mpfr_rnd_t @var{rnd})
+Set @var{exp}
+(formally, the value pointed to by @var{exp}) and @var{y}
+such that @math{0.5@le{}@GMPabs{@var{y}}<1}
+and @m{@var{y}\times 2^{exp}, @var{y} times 2 raised to @var{exp}} equals
+@var{x} rounded to the precision of @var{y}, using the given rounding mode.
+@comment See ISO C standard, frexp function.
+If @var{x} is zero, then @var{y} is set to a zero of the same sign and
+@var{exp} is set to 0.
+If @var{x} is NaN or an infinity, then @var{y} is set to the same value
+and @var{exp} is undefined.
+@end deftypefun
+
+@deftypefun mpfr_exp_t mpfr_get_z_2exp (mpz_t @var{rop}, mpfr_t @var{op})
+Put the scaled significand of @var{op} (regarded as an integer, with the
+precision of @var{op}) into @var{rop}, and return the exponent @var{exp}
+(which may be outside the current exponent range) such that @var{op}
+exactly equals
+@ifnottex
+@var{rop} times 2 raised to the power @var{exp}.
+@end ifnottex
+@tex
+$rop \times 2^{\rm exp}$.
+@end tex
+If @var{op} is zero, the minimal exponent @code{emin} is returned.
+If @var{op} is NaN or an infinity, the @emph{erange} flag is set, @var{rop}
+is set to 0, and the the minimal exponent @code{emin} is returned.
+The returned exponent may be less than the minimal exponent @code{emin}
+of MPFR numbers in the current exponent range; in case the exponent is
+not representable in the @code{mpfr_exp_t} type, the @emph{erange} flag
+is set and the minimal value of the @code{mpfr_exp_t} type is returned.
+@end deftypefun
+
+@deftypefun int mpfr_get_z (mpz_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Convert @var{op} to a @code{mpz_t}, after rounding it with respect to
+@var{rnd}. If @var{op} is NaN or an infinity, the @emph{erange} flag is
+set, @var{rop} is set to 0, and 0 is returned.
+@end deftypefun
+
+@deftypefun int mpfr_get_f (mpf_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Convert @var{op} to a @code{mpf_t}, after rounding it with respect to
+@var{rnd}.
+The @emph{erange} flag is set if @var{op} is NaN or an infinity, which
+do not exist in MPF. If @var{op} is NaN, then @var{rop} is undefined.
+If @var{op} is an +Inf (resp.@: @minus{}Inf), then @var{rop} is set to
+the maximum (resp.@: minimum) value in the precision of the MPF number;
+if a future MPF version supports infinities, this behavior will be
+considered incorrect and will change (portable programs should assume
+that @var{rop} is set either to this finite number or to an infinite
+number).
+Note that since MPFR currently has the same exponent type as MPF (but
+not with the same radix), the range of values is much larger in MPF
+than in MPFR, so that an overflow or underflow is not possible.
+@end deftypefun
+
+@deftypefun {char *} mpfr_get_str (char *@var{str}, mpfr_exp_t *@var{expptr}, int @var{b}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Convert @var{op} to a string of digits in base @var{b}, with rounding in
+the direction @var{rnd}, where @var{n} is either zero (see below) or the
+number of significant digits output in the string;
+in the latter case, @var{n} must be greater
+or equal to 2. The base may vary from 2 to 62.
+If the input number is an ordinary number, the exponent is written through
+the pointer @var{expptr} (for input 0, the current minimal exponent is
+written).
+
+The generated string is a fraction, with an implicit radix point immediately
+to the left of the first digit. For example, the number @minus{}3.1416 would
+be returned as "@minus{}31416" in the string and 1 written at @var{expptr}.
+If @var{rnd} is to nearest, and @var{op} is exactly in the middle of two
+consecutive possible outputs, the one with an even significand is chosen,
+where both significands are considered with the exponent of @var{op}.
+Note that for an odd base, this may not correspond to an even last digit:
+for example with 2 digits in base 7, (14) and a half is rounded to (15)
+which is 12 in decimal, (16) and a half is rounded to
+(20) which is 14 in decimal,
+@c The following example duplicates (16) and a half
+@c (36) and a half is rounded to (40) which is 28 in decimal,
+and (26) and a half is rounded to (26) which is 20 in decimal.
+
+If @var{n} is zero, the number of digits of the significand is chosen
+large enough so that re-reading the printed value with the same precision,
+assuming both output and input use rounding to nearest, will recover
+the original value of @var{op}.
+More precisely, in most cases, the chosen precision of @var{str} is the
+minimal precision @math{m} depending only on @var{p} = PREC(@var{op}) and
+@var{b} that satisfies the above property, i.e.,
+@ifnottex
+m = 1 + ceil(@var{p}*log(2)/log(@var{b})),
+@end ifnottex
+@tex
+$m = 1 + \lceil p {\log 2 \over \log b} \rceil$,
+@end tex
+with @var{p} replaced by @var{p}@minus{}1 if @var{b} is a power of 2,
+but in some very rare cases, it might be @math{m+1}
+(the smallest case for bases up to 62 is when @var{p} equals 186564318007
+for bases 7 and 49).
+
+If @var{str} is a null pointer, space for the significand is allocated using
+the current allocation function, and a pointer to the string is returned.
+To free the returned string, you must use @code{mpfr_free_str}.
+
+If @var{str} is not a null pointer, it should point to a block of storage
+large enough for the significand, i.e., at least @code{max(@var{n} + 2, 7)}.
+The extra two bytes are for a possible minus sign, and for the terminating null
+character, and the value 7 accounts for @code{-@@Inf@@}
+plus the terminating null character.
+
+A pointer to the string is returned, unless there is an error, in which
+case a null pointer is returned.
+@end deftypefun
+
+@deftypefun void mpfr_free_str (char *@var{str})
+Free a string allocated by @code{mpfr_get_str} using the current unallocation
+function.
+The block is assumed to be @code{strlen(@var{str})+1} bytes.
+For more information about how it is done:
+@ifinfo
+@pxref{Custom Allocation,,, gmp.info,GNU MP}.
+@end ifinfo
+@ifnotinfo
+see Section ``Custom Allocation'' in @cite{GNU MP}.
+@end ifnotinfo
+@end deftypefun
+
+@deftypefun int mpfr_fits_ulong_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_slong_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_uint_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_sint_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_ushort_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_sshort_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_uintmax_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fits_intmax_p (mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Return non-zero if @var{op} would fit in the respective C data type,
+respectively @code{unsigned long}, @code{long}, @code{unsigned int},
+@code{int}, @code{unsigned short}, @code{short}, @code{uintmax_t},
+@code{intmax_t}, when rounded to an integer in the direction @var{rnd}.
+@end deftypefun
+
+@node Basic Arithmetic Functions, Comparison Functions, Conversion Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Basic arithmetic functions
+@cindex Float arithmetic functions
+@cindex Arithmetic functions
+@section Basic Arithmetic Functions
+
+@deftypefun int mpfr_add (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_add_ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_add_si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_add_d (mpfr_t @var{rop}, mpfr_t @var{op1}, double @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_add_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_add_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @math{@var{op1} + @var{op2}} rounded in the direction
+@var{rnd}. For types having no signed zero, it is considered unsigned
+(i.e., (+0) + 0 = (+0) and (@minus{}0) + 0 = (@minus{}0)).
+The @code{mpfr_add_d} function assumes that the radix of the @code{double} type
+is a power of 2, with a precision at most that declared by the C implementation
+(macro @code{IEEE_DBL_MANT_DIG}, and if not defined 53 bits).
+@end deftypefun
+
+@deftypefun int mpfr_sub (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_ui_sub (mpfr_t @var{rop}, unsigned long int @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sub_ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_si_sub (mpfr_t @var{rop}, long int @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sub_si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_d_sub (mpfr_t @var{rop}, double @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sub_d (mpfr_t @var{rop}, mpfr_t @var{op1}, double @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_z_sub (mpfr_t @var{rop}, mpz_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sub_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sub_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @math{@var{op1} - @var{op2}} rounded in the direction
+@var{rnd}. For types having no signed zero, it is considered unsigned
+(i.e., (+0) @minus{} 0 = (+0), (@minus{}0) @minus{} 0 = (@minus{}0),
+0 @minus{} (+0) = (@minus{}0) and 0 @minus{} (@minus{}0) = (+0)).
+The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_sub}
+and @code{mpfr_sub_d}.
+@end deftypefun
+
+@deftypefun int mpfr_mul (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_d (mpfr_t @var{rop}, mpfr_t @var{op1}, double @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}} rounded in the
+direction @var{rnd}.
+When a result is zero, its sign is the product of the signs of the operands
+(for types having no signed zero, it is considered positive).
+The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_mul_d}.
+@end deftypefun
+
+@deftypefun int mpfr_sqr (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{@var{op}^{2}, the square of @var{op}}
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_div (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_ui_div (mpfr_t @var{rop}, unsigned long int @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_si_div (mpfr_t @var{rop}, long int @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_d_div (mpfr_t @var{rop}, double @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_d (mpfr_t @var{rop}, mpfr_t @var{op1}, double @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @math{@var{op1}/@var{op2}} rounded in the direction @var{rnd}.
+When a result is zero, its sign is the product of the signs of the operands
+(for types having no signed zero, it is considered positive).
+The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_div}
+and @code{mpfr_div_d}.
+@end deftypefun
+
+@deftypefun int mpfr_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sqrt_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{\sqrt{@var{op}}, the square root of @var{op}}
+rounded in the direction @var{rnd} (set @var{rop} to @minus{}0 if @var{op} is
+@minus{}0, to be consistent with the IEEE 754 standard).
+Set @var{rop} to NaN if @var{op} is negative.
+@end deftypefun
+
+@deftypefun int mpfr_rec_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{1/\sqrt{@var{op}}, the reciprocal square root of @var{op}}
+rounded in the direction @var{rnd}. Set @var{rop} to +Inf if @var{op} is
+@pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative.
+@end deftypefun
+
+@deftypefun int mpfr_cbrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_root (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long int @var{k}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the cubic root (resp.@: the @var{k}th root)
+of @var{op} rounded in the direction @var{rnd}.
+For @var{k} odd (resp.@: even) and @var{op} negative (including @minus{}Inf),
+set @var{rop} to a negative number (resp.@: NaN).
+The @var{k}th root of @minus{}0 is defined to be @minus{}0,
+whatever the parity of @var{k}.
+@end deftypefun
+
+@deftypefun int mpfr_pow (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_pow_ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_pow_si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_pow_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_ui_pow_ui (mpfr_t @var{rop}, unsigned long int @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_ui_pow (mpfr_t @var{rop}, unsigned long int @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{@var{op1}^{op2}, @var{op1} raised to @var{op2}},
+rounded in the direction @var{rnd}.
+Special values are handled as described in the ISO C99 and IEEE 754-2008
+standards for the @code{pow} function:
+@itemize @bullet
+@item @code{pow(@pom{}0, @var{y})} returns plus or minus infinity for @var{y} a negative odd integer.
+@item @code{pow(@pom{}0, @var{y})} returns plus infinity for @var{y} negative and not an odd integer.
+@item @code{pow(@pom{}0, @var{y})} returns plus or minus zero for @var{y} a positive odd integer.
+@item @code{pow(@pom{}0, @var{y})} returns plus zero for @var{y} positive and not an odd integer.
+@item @code{pow(-1, @pom{}Inf)} returns 1.
+@item @code{pow(+1, @var{y})} returns 1 for any @var{y}, even a NaN.
+@item @code{pow(@var{x}, @pom{}0)} returns 1 for any @var{x}, even a NaN.
+@item @code{pow(@var{x}, @var{y})} returns NaN for finite negative @var{x} and finite non-integer @var{y}.
+@item @code{pow(@var{x}, -Inf)} returns plus infinity for @math{0 < @GMPabs{x} < 1}, and plus zero for @math{@GMPabs{x} > 1}.
+@item @code{pow(@var{x}, +Inf)} returns plus zero for @math{0 < @GMPabs{x} < 1}, and plus infinity for @math{@GMPabs{x} > 1}.
+@item @code{pow(-Inf, @var{y})} returns minus zero for @var{y} a negative odd integer.
+@item @code{pow(-Inf, @var{y})} returns plus zero for @var{y} negative and not an odd integer.
+@item @code{pow(-Inf, @var{y})} returns minus infinity for @var{y} a positive odd integer.
+@item @code{pow(-Inf, @var{y})} returns plus infinity for @var{y} positive and not an odd integer.
+@item @code{pow(+Inf, @var{y})} returns plus zero for @var{y} negative, and plus infinity for @var{y} positive.
+@end itemize
+@end deftypefun
+
+@deftypefun int mpfr_neg (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_abs (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @math{-@var{op}} and the absolute value of @var{op}
+respectively, rounded in the direction @var{rnd}.
+Just changes or adjusts
+the sign if @var{rop} and @var{op} are the same variable,
+otherwise a rounding might occur if the precision of @var{rop} is less than
+that of @var{op}.
+@end deftypefun
+
+@deftypefun int mpfr_dim (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the positive difference of @var{op1} and @var{op2}, i.e.,
+@math{@var{op1} - @var{op2}} rounded in the direction @var{rnd}
+if @math{@var{op1} > @var{op2}}, +0 if @math{@var{op1} @le{} @var{op2}},
+and NaN if @var{op1} or @var{op2} is NaN.
+@end deftypefun
+
+@deftypefun int mpfr_mul_2ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_mul_2si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised
+to @var{op2}}
+rounded in the direction @var{rnd}. Just increases the exponent by @var{op2}
+when @var{rop} and @var{op1} are identical.
+@end deftypefun
+
+@deftypefun int mpfr_div_2ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_2si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised
+to @var{op2}}
+rounded in the direction @var{rnd}. Just decreases the exponent by @var{op2}
+when @var{rop} and @var{op1} are identical.
+@end deftypefun
+
+@node Comparison Functions, Special Functions, Basic Arithmetic Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Float comparisons functions
+@cindex Comparison functions
+@section Comparison Functions
+
+@deftypefun int mpfr_cmp (mpfr_t @var{op1}, mpfr_t @var{op2})
+@deftypefunx int mpfr_cmp_ui (mpfr_t @var{op1}, unsigned long int @var{op2})
+@deftypefunx int mpfr_cmp_si (mpfr_t @var{op1}, long int @var{op2})
+@deftypefunx int mpfr_cmp_d (mpfr_t @var{op1}, double @var{op2})
+@deftypefunx int mpfr_cmp_ld (mpfr_t @var{op1}, long double @var{op2})
+@deftypefunx int mpfr_cmp_z (mpfr_t @var{op1}, mpz_t @var{op2})
+@deftypefunx int mpfr_cmp_q (mpfr_t @var{op1}, mpq_t @var{op2})
+@deftypefunx int mpfr_cmp_f (mpfr_t @var{op1}, mpf_t @var{op2})
+Compare @var{op1} and @var{op2}. Return a positive value if @math{@var{op1} >
+@var{op2}}, zero if @math{@var{op1} = @var{op2}}, and a negative value if
+@math{@var{op1} < @var{op2}}.
+Both @var{op1} and @var{op2} are considered to their full own precision,
+which may differ.
+If one of the operands is NaN, set the @emph{erange} flag and return zero.
+
+Note: These functions may be useful to distinguish the three possible cases.
+If you need to distinguish two cases only, it is recommended to use the
+predicate functions (e.g., @code{mpfr_equal_p} for the equality) described
+below; they behave like the IEEE 754 comparisons, in particular when one
+or both arguments are NaN. But only floating-point numbers can be compared
+(you may need to do a conversion first).
+@end deftypefun
+
+@deftypefun int mpfr_cmp_ui_2exp (mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_exp_t @var{e})
+@deftypefunx int mpfr_cmp_si_2exp (mpfr_t @var{op1}, long int @var{op2}, mpfr_exp_t @var{e})
+Compare @var{op1} and @m{@var{op2} \times 2^e, @var{op2} multiplied by two to
+the power @var{e}}. Similar as above.
+@end deftypefun
+
+@deftypefun int mpfr_cmpabs (mpfr_t @var{op1}, mpfr_t @var{op2})
+Compare @math{|@var{op1}|} and @math{|@var{op2}|}. Return a positive value if
+@math{|@var{op1}| > |@var{op2}|}, zero if @math{|@var{op1}| = |@var{op2}|}, and
+a negative value if @math{|@var{op1}| < |@var{op2}|}.
+If one of the operands is NaN, set the @emph{erange} flag and return zero.
+@end deftypefun
+
+@deftypefun int mpfr_nan_p (mpfr_t @var{op})
+@deftypefunx int mpfr_inf_p (mpfr_t @var{op})
+@deftypefunx int mpfr_number_p (mpfr_t @var{op})
+@deftypefunx int mpfr_zero_p (mpfr_t @var{op})
+@deftypefunx int mpfr_regular_p (mpfr_t @var{op})
+Return non-zero if @var{op} is respectively NaN, an infinity, an ordinary
+number (i.e., neither NaN nor an infinity), zero, or a regular number
+(i.e., neither NaN, nor an infinity nor zero). Return zero otherwise.
+@end deftypefun
+
+@deftypefn Macro int mpfr_sgn (mpfr_t @var{op})
+Return a positive value if @math{@var{op} > 0}, zero if @math{@var{op} = 0},
+and a negative value if @math{@var{op} < 0}.
+If the operand is NaN, set the @emph{erange} flag and return zero.
+This is equivalent to @code{mpfr_cmp_ui (op, 0)}, but more efficient.
+@end deftypefn
+
+@deftypefun int mpfr_greater_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+@deftypefunx int mpfr_greaterequal_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+@deftypefunx int mpfr_less_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+@deftypefunx int mpfr_lessequal_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+@deftypefunx int mpfr_equal_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+Return non-zero if
+@math{@var{op1} > @var{op2}},
+@math{@var{op1} @ge{} @var{op2}},
+@math{@var{op1} < @var{op2}},
+@math{@var{op1} @le{} @var{op2}},
+@math{@var{op1} = @var{op2}} respectively,
+and zero otherwise.
+Those functions return zero whenever @var{op1} and/or @var{op2} is NaN.
+@end deftypefun
+
+@deftypefun int mpfr_lessgreater_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+Return non-zero if @math{@var{op1} < @var{op2}} or
+@math{@var{op1} > @var{op2}} (i.e., neither @var{op1}, nor @var{op2} is
+NaN, and @math{@var{op1} @ne{} @var{op2}}), zero otherwise (i.e., @var{op1}
+and/or @var{op2} is NaN, or @math{@var{op1} = @var{op2}}).
+@end deftypefun
+
+@deftypefun int mpfr_unordered_p (mpfr_t @var{op1}, mpfr_t @var{op2})
+Return non-zero if @var{op1} or @var{op2} is a NaN (i.e., they cannot be
+compared), zero otherwise.
+@end deftypefun
+
+@node Special Functions, Input and Output Functions, Comparison Functions, MPFR Interface
+@cindex Special functions
+@section Special Functions
+
+All those functions, except explicitly stated (for example
+@code{mpfr_sin_cos}), return a @ref{ternary value}, i.e., zero for an
+exact return value, a positive value for a return value larger than the
+exact result, and a negative value otherwise.
+
+Important note: in some domains, computing special functions (either with
+correct or incorrect rounding) is expensive, even for small precision,
+for example the trigonometric and Bessel functions for large argument.
+
+@deftypefun int mpfr_log (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_log2 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_log10 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the natural logarithm of @var{op},
+@m{\log_2 @var{op}, log2(@var{op})} or
+@m{\log_{10} @var{op}, log10(@var{op})}, respectively,
+rounded in the direction @var{rnd}.
+Set @var{rop} to @minus{}Inf if @var{op} is @minus{}0
+(i.e., the sign of the zero has no influence on the result).
+@end deftypefun
+
+@deftypefun int mpfr_exp (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_exp2 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_exp10 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the exponential of @var{op},
+ to @m{2^{op}, 2 power of @var{op}}
+or to @m{10^{op}, 10 power of @var{op}}, respectively,
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_cos (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sin (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_tan (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the cosine of @var{op}, sine of @var{op},
+tangent of @var{op}, rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_sin_cos (mpfr_t @var{sop}, mpfr_t @var{cop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set simultaneously @var{sop} to the sine of @var{op} and @var{cop} to the
+cosine of @var{op}, rounded in the direction @var{rnd} with the corresponding
+precisions of @var{sop} and @var{cop}, which must be different variables.
+Return 0 iff both results are exact, more precisely it returns @math{s+4c}
+where @math{s=0} if @var{sop} is exact, @math{s=1} if @var{sop} is larger
+than the sine of @var{op}, @math{s=2} if @var{sop} is smaller than the sine
+of @var{op}, and similarly for @math{c} and the cosine of @var{op}.
+@end deftypefun
+
+@deftypefun int mpfr_sec (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_csc (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_cot (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the secant of @var{op}, cosecant of @var{op},
+cotangent of @var{op}, rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_acos (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_asin (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_atan (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the arc-cosine, arc-sine or arc-tangent of @var{op},
+rounded in the direction @var{rnd}.
+Note that since @code{acos(-1)} returns the floating-point number closest to
+@m{\pi,Pi} according to the given rounding mode, this number might not be
+in the output range @math{0 @le{} @var{rop} < \pi}
+of the arc-cosine function;
+still, the result lies in the image of the output range
+by the rounding function.
+The same holds for @code{asin(-1)}, @code{asin(1)}, @code{atan(-Inf)},
+@code{atan(+Inf)} or for @code{atan(op)} with large @var{op} and
+small precision of @var{rop}.
+@c PZ: check the above is correct
+@end deftypefun
+
+@deftypefun int mpfr_atan2 (mpfr_t @var{rop}, mpfr_t @var{y}, mpfr_t @var{x}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the arc-tangent2 of @var{y} and @var{x},
+rounded in the direction @var{rnd}:
+if @code{x > 0}, @code{atan2(y, x) = atan (y/x)};
+if @code{x < 0}, @code{atan2(y, x) = sign(y)*(Pi - atan (@GMPabs{y/x}))},
+thus a number from @m{-\pi,-Pi} to @m{\pi,Pi}.
+As for @code{atan}, in case the exact mathematical result is @m{+\pi,+Pi} or
+@m{-\pi,-Pi},
+its rounded result might be outside the function output range.
+
+@code{atan2(y, 0)} does not raise any floating-point exception.
+Special values are handled as described in the ISO C99 and IEEE 754-2008
+standards for the @code{atan2} function:
+@itemize @bullet
+@item @code{atan2(+0, -0)} returns @m{+\pi,+Pi}.
+@item @code{atan2(-0, -0)} returns @m{-\pi,-Pi}.
+@item @code{atan2(+0, +0)} returns +0.
+@item @code{atan2(-0, +0)} returns @minus{}0.
+@item @code{atan2(+0, x)} returns @m{+\pi,+Pi} for @math{x < 0}.
+@item @code{atan2(-0, x)} returns @m{-\pi,-Pi} for @math{x < 0}.
+@item @code{atan2(+0, x)} returns +0 for @math{x > 0}.
+@item @code{atan2(-0, x)} returns @minus{}0 for @math{x > 0}.
+@item @code{atan2(y, 0)} returns @m{-\pi/2,-Pi/2} for @math{y < 0}.
+@item @code{atan2(y, 0)} returns @m{+\pi/2,+Pi/2} for @math{y > 0}.
+@item @code{atan2(+Inf, -Inf)} returns @m{+3\pi/4,+3*Pi/4}.
+@item @code{atan2(-Inf, -Inf)} returns @m{-3\pi/4,-3*Pi/4}.
+@item @code{atan2(+Inf, +Inf)} returns @m{+\pi/4,+Pi/4}.
+@item @code{atan2(-Inf, +Inf)} returns @m{-\pi/4,-Pi/4}.
+@item @code{atan2(+Inf, x)} returns @m{+\pi/2,+Pi/2} for finite @math{x}.
+@item @code{atan2(-Inf, x)} returns @m{-\pi/2,-Pi/2} for finite @math{x}.
+@item @code{atan2(y, -Inf)} returns @m{+\pi,+Pi} for finite @math{y > 0}.
+@item @code{atan2(y, -Inf)} returns @m{-\pi,-Pi} for finite @math{y < 0}.
+@item @code{atan2(y, +Inf)} returns +0 for finite @math{y > 0}.
+@item @code{atan2(y, +Inf)} returns @minus{}0 for finite @math{y < 0}.
+@end itemize
+@end deftypefun
+
+@deftypefun int mpfr_cosh (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sinh (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_tanh (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the hyperbolic cosine, sine or tangent of @var{op},
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_sinh_cosh (mpfr_t @var{sop}, mpfr_t @var{cop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set simultaneously @var{sop} to the hyperbolic sine of @var{op} and
+@var{cop} to the hyperbolic cosine of @var{op},
+rounded in the direction @var{rnd} with the corresponding precision of
+@var{sop} and @var{cop}, which must be different variables.
+Return 0 iff both results are exact (see @code{mpfr_sin_cos} for a more
+detailed description of the return value).
+@end deftypefun
+
+@deftypefun int mpfr_sech (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_csch (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_coth (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the hyperbolic secant of @var{op}, cosecant of @var{op},
+cotangent of @var{op}, rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_acosh (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_asinh (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_atanh (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the inverse hyperbolic cosine, sine or tangent of @var{op},
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_fac_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the factorial of @var{op}, rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_log1p (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the logarithm of one plus @var{op},
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_expm1 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @m{e^{op}-1,the exponential of @var{op} followed by a
+subtraction by one}, rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_eint (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the exponential integral of @var{op},
+rounded in the direction @var{rnd}.
+For positive @var{op},
+the exponential integral is the sum of Euler's constant, of the logarithm
+of @var{op}, and of the sum for k from 1 to infinity of
+@ifnottex
+@var{op} to the power k, divided by k and factorial(k).
+@end ifnottex
+@tex
+$@var{op}^k/(k \cdot k!)$.
+@end tex
+For negative @var{op}, @var{rop} is set to NaN
+(this definition for negative argument follows formula 5.1.2 from the
+Handbook of Mathematical Functions from Abramowitz and Stegun, a future
+version might use another definition).
+@end deftypefun
+
+@deftypefun int mpfr_li2 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to real part of the dilogarithm of @var{op}, rounded in the
+direction @var{rnd}. MPFR defines the dilogarithm function as
+@m{-\int_{t=0}^{op} \log(1-t)/t\ dt,the integral of -log(1-t)/t from 0
+to @var{op}}.
+@c FIXME: It should be {@var{op}} instead of {op} above, but pdftex fails
+@c on the correct form.
+@end deftypefun
+
+@deftypefun int mpfr_gamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the Gamma function on @var{op}, rounded in the
+direction @var{rnd}. When @var{op} is a negative integer, @var{rop} is set
+to NaN.
+@end deftypefun
+
+@deftypefun int mpfr_lngamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the logarithm of the Gamma function on @var{op},
+rounded in the direction @var{rnd}.
+When @math{@minus{}2@var{k}@minus{}1 @le{} @var{op} @le{} @minus{}2@var{k}},
+@var{k} being a non-negative integer, @var{rop} is set to NaN.
+See also @code{mpfr_lgamma}.
+@end deftypefun
+
+@deftypefun int mpfr_lgamma (mpfr_t @var{rop}, int *@var{signp}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the logarithm of the absolute value of the
+Gamma function on @var{op}, rounded in the direction @var{rnd}. The sign
+(1 or @minus{}1) of Gamma(@var{op}) is returned in the object pointed to
+by @var{signp}. When @var{op} is an infinity or a non-positive integer, set
+@var{rop} to +Inf. When @var{op} is NaN, @minus{}Inf or a negative integer,
+*@var{signp} is undefined, and when @var{op} is @pom{}0, *@var{signp} is
+the sign of the zero.
+@end deftypefun
+
+@deftypefun int mpfr_digamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the Digamma (sometimes also called Psi)
+function on @var{op}, rounded in the direction @var{rnd}.
+When @var{op} is a negative integer, set @var{rop} to NaN.
+@end deftypefun
+
+@deftypefun int mpfr_zeta (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_zeta_ui (mpfr_t @var{rop}, unsigned long @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the Riemann Zeta function on @var{op},
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_erf (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_erfc (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the error function on @var{op}
+(resp.@: the complementary error function on @var{op})
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_j0 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_j1 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_jn (mpfr_t @var{rop}, long @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the first kind Bessel function of order 0,
+(resp.@: 1 and @var{n})
+on @var{op}, rounded in the direction @var{rnd}. When @var{op} is
+NaN, @var{rop} is always set to NaN. When @var{op} is plus or minus Infinity,
+@var{rop} is set to +0. When @var{op} is zero, and @var{n} is not zero,
+@var{rop} is set to +0 or @minus{}0 depending on the parity and sign of @var{n},
+and the sign of @var{op}.
+@end deftypefun
+
+@deftypefun int mpfr_y0 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_y1 (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_yn (mpfr_t @var{rop}, long @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the second kind Bessel function of order 0
+(resp.@: 1 and @var{n})
+on @var{op}, rounded in the direction @var{rnd}. When @var{op} is
+NaN or negative, @var{rop} is always set to NaN. When @var{op} is +Inf,
+@var{rop} is set to +0. When @var{op} is zero, @var{rop} is set to +Inf
+or @minus{}Inf depending on the parity and sign of @var{n}.
+@end deftypefun
+
+@deftypefun int mpfr_fma (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_t @var{op3}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_fms (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_t @var{op3}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @math{(@var{op1} @GMPtimes{} @var{op2}) + @var{op3}}
+(resp.@: @math{(@var{op1} @GMPtimes{} @var{op2}) - @var{op3}})
+rounded in the direction @var{rnd}.
+@end deftypefun
+
+@deftypefun int mpfr_agm (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the arithmetic-geometric mean of @var{op1} and @var{op2},
+rounded in the direction @var{rnd}.
+The arithmetic-geometric mean is the common limit of the sequences
+@m{u_n,@var{u}_@var{n}} and @m{v_n,@var{v}_@var{n}},
+where @m{u_0,@var{u}_@var{0}}=@var{op1}, @m{v_0,@var{v}_@var{0}}=@var{op2},
+@m{u_{n+1},@var{u}_(@var{n}+1)} is the
+arithmetic mean of @m{u_n,@var{u}_@var{n}} and @m{v_n,@var{v}_@var{n}},
+and @m{v_{n+1},@var{v}_(@var{n}+1)} is the geometric mean of
+@m{u_n,@var{u}_@var{n}} and @m{v_n,@var{v}_@var{n}}.
+If any operand is negative, set @var{rop} to NaN.
+@end deftypefun
+
+@deftypefun int mpfr_hypot (mpfr_t @var{rop}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the Euclidean norm of @var{x} and @var{y},
+@ifnottex
+i.e., the square root of the sum of the squares of @var{x} and @var{y},
+@end ifnottex
+@tex
+i.e., $\sqrt{x^2+y^2}$,
+@end tex
+rounded in the direction @var{rnd}.
+Special values are handled as described in Section F.9.4.3 of
+the ISO C99 and IEEE 754-2008 standards:
+If @var{x} or @var{y} is an infinity, then +Inf is returned in @var{rop},
+even if the other number is NaN.
+@end deftypefun
+
+@deftypefun int mpfr_ai (mpfr_t @var{rop}, mpfr_t @var{x}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the value of the Airy function Ai
+ on @var{x}, rounded in the direction @var{rnd}.
+When @var{x} is
+NaN,
+@var{rop} is always set to NaN. When @var{x} is +Inf or @minus{}Inf,
+@var{rop} is +0.
+The current implementation is not intended to be used with large arguments.
+It works with @GMPabs{@var{x}} typically smaller than 500. For larger arguments,
+other methods should be used and will be implemented in a future version.
+@end deftypefun
+
+@deftypefun int mpfr_const_log2 (mpfr_t @var{rop}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_const_pi (mpfr_t @var{rop}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_const_euler (mpfr_t @var{rop}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_const_catalan (mpfr_t @var{rop}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the logarithm of 2, the value of @m{\pi,Pi},
+of Euler's constant 0.577@dots{}, of Catalan's constant 0.915@dots{},
+respectively, rounded in the direction
+@var{rnd}. These functions cache the computed values to avoid other
+calculations if a lower or equal precision is requested. To free these caches,
+use @code{mpfr_free_cache}.
+@end deftypefun
+
+@deftypefun void mpfr_free_cache (void)
+Free various caches used by MPFR internally, in particular the
+caches used by the functions computing constants (@code{mpfr_const_log2},
+@code{mpfr_const_pi},
+@code{mpfr_const_euler} and @code{mpfr_const_catalan}).
+You should call this function before terminating a thread, even if you did
+not call these functions directly (they could have been called internally).
+@end deftypefun
+
+@deftypefun int mpfr_sum (mpfr_t @var{rop}, mpfr_ptr const @var{tab}[], unsigned long int @var{n}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the sum of all elements of @var{tab}, whose size is @var{n},
+rounded in the direction @var{rnd}. Warning: for efficiency reasons,
+@var{tab} is an array of pointers
+to @code{mpfr_t}, not an array of @code{mpfr_t}.
+If the returned @code{int} value is zero, @var{rop} is guaranteed to be the
+exact sum; otherwise @var{rop} might be smaller than, equal to, or larger than
+the exact sum (in accordance to the rounding mode).
+However, @code{mpfr_sum} does guarantee the result is correctly rounded.
+@end deftypefun
+
+@node Input and Output Functions, Formatted Output Functions, Special Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Float input and output functions
+@cindex Input functions
+@cindex Output functions
+@cindex I/O functions
+@section Input and Output Functions
+
+This section describes functions that perform input from an input/output
+stream, and functions that output to an input/output stream.
+Passing a null pointer for a @code{stream} to any of these functions will make
+them read from @code{stdin} and write to @code{stdout}, respectively.
+
+When using any of these functions, you must include the @code{<stdio.h>}
+standard header before @file{mpfr.h}, to allow @file{mpfr.h} to define
+prototypes for these functions.
+
+@deftypefun size_t mpfr_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Output @var{op} on stream @var{stream}, as a string of digits in
+base @var{base}, rounded in the direction @var{rnd}.
+The base may vary from 2 to 62. Print @var{n} significant digits exactly,
+or if @var{n} is 0, enough digits so that @var{op} can be read back
+exactly (see @code{mpfr_get_str}).
+
+In addition to the significant digits, a decimal point (defined by the
+current locale) at the right of the
+first digit and a trailing exponent in base 10, in the form @samp{eNNN},
+are printed. If @var{base} is greater than 10, @samp{@@} will be used
+instead of @samp{e} as exponent delimiter.
+
+Return the number of characters written, or if an error occurred, return 0.
+@end deftypefun
+
+@deftypefun size_t mpfr_inp_str (mpfr_t @var{rop}, FILE *@var{stream}, int @var{base}, mpfr_rnd_t @var{rnd})
+Input a string in base @var{base} from stream @var{stream},
+rounded in the direction @var{rnd}, and put the
+read float in @var{rop}.
+@c The argument @var{base} must be in the range 2 to 62.
+
+@c The string is of the form @samp{M@@N} or, if the
+@c base is 10 or less, alternatively @samp{MeN} or @samp{MEN}, or, if the base
+@c is 16, alternatively @samp{MpB} or @samp{MPB}.
+@c @samp{M} is the significand in the specified base, @samp{N} is the exponent
+@c written in decimal for the specified base, and in base 16, @samp{B} is the
+@c binary exponent written in decimal (i.e., it indicates the power of 2 by
+@c which the significand is to be scaled).
+This function reads a word (defined as a sequence of characters between
+whitespace) and parses it using @code{mpfr_set_str}.
+See the documentation of @code{mpfr_strtofr} for a detailed description
+of the valid string formats.
+@c Special values can be read as follows (the case does not matter):
+@c @code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@},
+@c possibly followed by other characters; if the base is smaller or equal
+@c to 16, the following strings are accepted too: @code{NaN}, @code{Inf},
+@c @code{+Inf} and @code{-Inf}.
+
+Return the number of bytes read, or if an error occurred, return 0.
+@end deftypefun
+
+@c @deftypefun void mpfr_inp_raw (mpfr_t @var{float}, FILE *@var{stream})
+@c Input from stdio stream @var{stream} in the format written by
+@c @code{mpfr_out_raw}, and put the result in @var{float}.
+@c @end deftypefun
+
+@node Formatted Output Functions, Integer Related Functions, Input and Output Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Float output functions
+@cindex Output functions
+@cindex I/O functions
+@section Formatted Output Functions
+
+@subsection Requirements
+The class of @code{mpfr_printf} functions provides formatted output in a
+similar manner as the standard C @code{printf}. These functions are defined
+only if your system supports ISO C variadic functions and the corresponding
+argument access macros.
+
+When using any of these functions, you must include the @code{<stdio.h>}
+standard header before @file{mpfr.h}, to allow @file{mpfr.h} to define
+prototypes for these functions.
+
+@subsection Format String
+The format specification accepted by @code{mpfr_printf} is an extension of the
+@code{printf} one. The conversion specification is of the form:
+@example
+% [flags] [width] [.[precision]] [type] [rounding] conv
+@end example
+@samp{flags}, @samp{width}, and @samp{precision} have the same meaning as for
+the standard @code{printf} (in particular, notice that the @samp{precision} is
+related to the number of digits displayed in the base chosen by @samp{conv}
+and not related to the internal precision of the @code{mpfr_t} variable).
+@code{mpfr_printf} accepts the same @samp{type} specifiers as GMP (except the
+non-standard and deprecated @samp{q}, use @samp{ll} instead), namely the
+length modifiers defined in the C standard:
+
+@quotation
+@multitable {(space)} {MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM}
+@item @samp{h} @tab @code{short}
+@item @samp{hh} @tab @code{char}
+@item @samp{j} @tab @code{intmax_t} or @code{uintmax_t}
+@item @samp{l} @tab @code{long} or @code{wchar_t}
+@item @samp{ll} @tab @code{long long}
+@item @samp{L} @tab @code{long double}
+@item @samp{t} @tab @code{ptrdiff_t}
+@item @samp{z} @tab @code{size_t}
+@end multitable
+@end quotation
+
+and the @samp{type} specifiers defined in GMP plus @samp{R} and @samp{P}
+specific to MPFR (the second column in the table below shows the type of the
+argument read in the argument list and the kind of @samp{conv} specifier to
+use after the @samp{type} specifier):
+
+@quotation
+@multitable {(space)} {MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM}
+@item @samp{F} @tab @code{mpf_t}, float conversions
+@item @samp{Q} @tab @code{mpq_t}, integer conversions
+@item @samp{M} @tab @code{mp_limb_t}, integer conversions
+@item @samp{N} @tab @code{mp_limb_t} array, integer conversions
+@item @samp{Z} @tab @code{mpz_t}, integer conversions
+
+@item @samp{P} @tab @code{mpfr_prec_t}, integer conversions
+@item @samp{R} @tab @code{mpfr_t}, float conversions
+@end multitable
+@end quotation
+
+The @samp{type} specifiers have the same restrictions as those
+mentioned in the GMP documentation:
+@ifinfo
+@pxref{Formatted Output Strings,,, gmp.info,GNU MP}.
+@end ifinfo
+@ifnotinfo
+see Section ``Formatted Output Strings'' in @cite{GNU MP}.
+@end ifnotinfo
+In particular, the @samp{type} specifiers (except @samp{R} and @samp{P}) are
+supported only if they are supported by @code{gmp_printf} in your GMP build;
+this implies that the standard specifiers, such as @samp{t}, must @emph{also}
+be supported by your C library if you want to use them.
+
+The @samp{rounding} field is specific to @code{mpfr_t} arguments and should
+not be used with other types.
+
+With conversion specification not involving @samp{P} and @samp{R} types,
+@code{mpfr_printf} behaves exactly as @code{gmp_printf}.
+
+The @samp{P} type specifies that a following @samp{o}, @samp{u}, @samp{x}, or
+@samp{X} conversion specifier applies to a @code{mpfr_prec_t} argument.
+It is needed because the @code{mpfr_prec_t} type does not necessarily
+correspond to an @code{unsigned int} or any fixed standard type.
+The @samp{precision} field specifies the minimum number of digits to
+appear. The default @samp{precision} is 1.
+For example:
+@example
+mpfr_t x;
+mpfr_prec_t p;
+mpfr_init (x);
+@dots{}
+p = mpfr_get_prec (x);
+mpfr_printf ("variable x with %Pu bits", p);
+@end example
+
+The @samp{R} type specifies that a following @samp{a}, @samp{A}, @samp{b},
+@samp{e}, @samp{E}, @samp{f}, @samp{F}, @samp{g}, @samp{G}, or @samp{n}
+conversion specifier applies to a @code{mpfr_t} argument.
+The @samp{R} type can be followed by a @samp{rounding} specifier denoted by
+one of the following characters:
+
+@quotation
+@multitable {(space)} {MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM}
+@item @samp{U} @tab round toward plus infinity
+@item @samp{D} @tab round toward minus infinity
+@item @samp{Y} @tab round away from zero
+@item @samp{Z} @tab round toward zero
+@item @samp{N} @tab round to nearest (with ties to even)
+@item @samp{*} @tab rounding mode indicated by the @code{mpfr_rnd_t} argument
+just before the corresponding @code{mpfr_t} variable.
+@end multitable
+@end quotation
+
+The default rounding mode is rounding to nearest.
+The following three examples are equivalent:
+@example
+mpfr_t x;
+mpfr_init (x);
+@dots{}
+mpfr_printf ("%.128Rf", x);
+mpfr_printf ("%.128RNf", x);
+mpfr_printf ("%.128R*f", MPFR_RNDN, x);
+@end example
+
+Note that the rounding away from zero mode is specified with @samp{Y}
+because ISO C reserves the @samp{A} specifier for hexadecimal output (see
+below).
+
+The output @samp{conv} specifiers allowed with @code{mpfr_t} parameter are:
+
+@quotation
+@multitable {(space)} {MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM}
+@item @samp{a} @samp{A} @tab hex float, C99 style
+@item @samp{b} @tab binary output
+@item @samp{e} @samp{E} @tab scientific format float
+@item @samp{f} @samp{F} @tab fixed point float
+@item @samp{g} @samp{G} @tab fixed or scientific float
+@end multitable
+@end quotation
+
+The conversion specifier @samp{b} which displays the argument in binary is
+specific to @code{mpfr_t} arguments and should not be used with other types.
+Other conversion specifiers have the same meaning as for a @code{double}
+argument.
+
+In case of non-decimal output, only the significand is written in the
+specified base, the exponent is always displayed in decimal.
+Special values are always displayed as @code{nan}, @code{-inf}, and @code{inf}
+for @samp{a}, @samp{b}, @samp{e}, @samp{f}, and @samp{g} specifiers and
+@code{NAN}, @code{-INF}, and @code{INF} for @samp{A}, @samp{E}, @samp{F}, and
+@samp{G} specifiers.
+
+If the @samp{precision} field is not empty, the @code{mpfr_t} number is
+rounded to the given precision in the direction specified by the rounding
+mode.
+If the precision is zero with rounding to nearest mode and one of the
+following @samp{conv} specifiers: @samp{a}, @samp{A}, @samp{b}, @samp{e},
+@samp{E}, tie case is rounded to even when it lies between two consecutive
+values at the
+wanted precision which have the same exponent, otherwise, it is rounded away
+from zero.
+For instance, 85 is displayed as "8e+1" and 95 is displayed as "1e+2" with the
+format specification @code{"%.0RNe"}.
+This also applies when the @samp{g} (resp. @samp{G}) conversion specifier uses
+the @samp{e} (resp. @samp{E}) style.
+If the precision is set to a value greater than the maximum value for an
+@code{int}, it will be silently reduced down to @code{INT_MAX}.
+
+If the @samp{precision} field is empty (as in @code{%Re} or @code{%.RE}) with
+@samp{conv} specifier @samp{e} and @samp{E}, the number is displayed with
+enough digits so that it can be read back exactly, assuming that the input and
+output variables have the same precision and that the input and output
+rounding modes are both rounding to nearest (as for @code{mpfr_get_str}).
+The default precision for an empty @samp{precision} field with @samp{conv}
+specifiers @samp{f}, @samp{F}, @samp{g}, and @samp{G} is 6.
+
+
+@subsection Functions
+
+For all the following functions, if the number of characters which ought to be
+written appears to exceed the maximum limit for an @code{int}, nothing is
+written in the stream (resp.@: to @code{stdout}, to @var{buf}, to @var{str}),
+the function returns @minus{}1, sets the @emph{erange} flag, and (in
+POSIX system only) @code{errno} is set to @code{EOVERFLOW}.
+
+@deftypefun int mpfr_fprintf (FILE *@var{stream}, const char *@var{template}, @dots{})
+@deftypefunx int mpfr_vfprintf (FILE *@var{stream}, const char *@var{template}, va_list @var{ap})
+Print to the stream @var{stream} the optional arguments under the control of
+the template string @var{template}.
+Return the number of characters written or a negative value if an error
+occurred.
+@c If the number of characters which ought to be written appears
+@c to exceed the maximum limit for an @code{int}, nothing is written in the
+@c stream, the function returns @minus{}1, sets the @emph{erange} flag, and (in
+@c POSIX system only) @code{errno} is set to @code{EOVERFLOW}.
+@end deftypefun
+
+@deftypefun int mpfr_printf (const char *@var{template}, @dots{})
+@deftypefunx int mpfr_vprintf (const char *@var{template}, va_list @var{ap})
+Print to @code{stdout} the optional arguments under the control of the
+template string @var{template}.
+Return the number of characters written or a negative value if an error
+occurred.
+@c If the number of characters which ought to be written appears
+@c to exceed the maximum limit for an @code{int}, nothing is written in
+@c @code{stdout}, the function returns @minus{}1, sets the @emph{erange} flag,
+@c and (in POSIX system only) @code{errno} is set to @code{EOVERFLOW}.
+@end deftypefun
+
+@deftypefun int mpfr_sprintf (char *@var{buf}, const char *@var{template}, @dots{})
+@deftypefunx int mpfr_vsprintf (char *@var{buf}, const char *@var{template}, va_list @var{ap})
+Form a null-terminated string corresponding to the optional arguments under
+the control of the template string @var{template}, and print it in
+@var{buf}. No overlap is permitted between
+@var{buf} and the other arguments.
+Return the number of characters written in the array @var{buf}
+@emph{not counting}
+the terminating null character or a negative value if an error occurred.
+@c If the number of characters which ought to be written appears to exceed the
+@c maximum limit for an @code{int}, nothing is written in @var{buf}, the function
+@c returns @minus{}1, sets the @emph{erange} flag, and (in POSIX system only)
+@c code{errno} is set to @code{EOVERFLOW}.
+@end deftypefun
+
+@deftypefun int mpfr_snprintf (char *@var{buf}, size_t @var{n}, const char *@var{template}, @dots{})
+@deftypefunx int mpfr_vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{template}, va_list @var{ap})
+Form a null-terminated string corresponding to the optional arguments under
+the control of the template string @var{template}, and print it in
+@var{buf}. If @var{n} is zero, nothing is
+written and @var{buf} may be a null pointer, otherwise, the @var{n}@minus{}1
+first characters are written in @var{buf} and the @var{n}-th is a null character.
+Return the number of characters that would have been written had @var{n} be
+sufficiently large, @emph{not counting}
+the terminating null character, or a negative value if an error occurred.
+@c If the number of characters produced by the
+@c optional arguments under the control of the template string @var{template}
+@c appears to exceed the maximum limit for an @code{int}, nothing is written in
+@c @var{buf}, the function returns @minus{}1, sets the @emph{erange} flag, and
+@c (in POSIX system only) @code{errno} is set to @code{EOVERFLOW}.
+@end deftypefun
+
+@deftypefun int mpfr_asprintf (char **@var{str}, const char *@var{template}, @dots{})
+@deftypefunx int mpfr_vasprintf (char **@var{str}, const char *@var{template}, va_list @var{ap})
+Write their output as a null terminated string in a block of memory allocated
+using the current allocation function. A pointer to the block is stored in
+@var{str}. The block of memory must be freed using @code{mpfr_free_str}.
+The return value is the number of characters written in the string, excluding
+the null-terminator, or a negative value if an error occurred.
+@c If the number of
+@c characters produced by the optional arguments under the control of the
+@c template string @var{template} appears to exceed the maximum limit for an
+@c @code{int}, @var{str} is a null pointer, the function returns @minus{}1, sets
+@c the @emph{erange} flag, and (in POSIX system only) @code{errno} is set to
+@c @code{EOVERFLOW}.
+@end deftypefun
+
+@node Integer Related Functions, Rounding Related Functions, Formatted Output Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Integer related functions
+@section Integer and Remainder Related Functions
+
+@deftypefun int mpfr_rint (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_ceil (mpfr_t @var{rop}, mpfr_t @var{op})
+@deftypefunx int mpfr_floor (mpfr_t @var{rop}, mpfr_t @var{op})
+@deftypefunx int mpfr_round (mpfr_t @var{rop}, mpfr_t @var{op})
+@deftypefunx int mpfr_trunc (mpfr_t @var{rop}, mpfr_t @var{op})
+Set @var{rop} to @var{op} rounded to an integer.
+@code{mpfr_rint} rounds to the nearest representable integer in the
+given direction @var{rnd}, @code{mpfr_ceil} rounds
+to the next higher or equal representable integer, @code{mpfr_floor} to
+the next lower or equal representable integer, @code{mpfr_round} to the
+nearest representable integer, rounding halfway cases away from zero
+(as in the roundTiesToAway mode of IEEE 754-2008),
+and @code{mpfr_trunc} to the next representable integer toward zero.
+
+The returned value is zero when the result is exact, positive when it is
+greater than the original value of @var{op}, and negative when it is smaller.
+More precisely, the returned value is 0 when @var{op} is an integer
+representable in @var{rop}, 1 or @minus{}1 when @var{op} is an integer
+that is not representable in @var{rop}, 2 or @minus{}2 when @var{op} is
+not an integer.
+
+Note that @code{mpfr_round} is different from @code{mpfr_rint} called with
+the rounding to nearest mode (where halfway cases are rounded to an even
+integer or significand). Note also that no double rounding is performed; for
+instance, 10.5 (1010.1 in binary) is rounded by @code{mpfr_rint} with
+rounding to nearest to 12 (1100
+in binary) in 2-bit precision, because the two enclosing numbers representable
+on two bits are 8 and 12, and the closest is 12.
+(If one first rounded to an integer, one would round 10.5 to 10 with
+even rounding, and then 10 would be rounded to 8 again with even rounding.)
+@end deftypefun
+
+@deftypefun int mpfr_rint_ceil (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_rint_floor (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_rint_round (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_rint_trunc (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to @var{op} rounded to an integer.
+@code{mpfr_rint_ceil} rounds to the next higher or equal integer,
+@code{mpfr_rint_floor} to the next lower or equal integer,
+@code{mpfr_rint_round} to the nearest integer, rounding halfway cases away
+from zero, and @code{mpfr_rint_trunc} to the next integer toward zero.
+If the result is not representable, it is rounded in the direction @var{rnd}.
+The returned value is the ternary value associated with the considered
+round-to-integer function (regarded in the same way as any other
+mathematical function).
+Contrary to @code{mpfr_rint}, those functions do perform a double rounding:
+first @var{op} is rounded to the nearest integer in the direction given by
+the function name, then this nearest integer (if not representable) is
+rounded in the given direction @var{rnd}.
+For example, @code{mpfr_rint_round} with rounding to nearest and a precision
+of two bits rounds 6.5 to 7 (halfway cases away from zero), then 7 is
+rounded to 8 by the round-even rule, despite the fact that 6 is also
+representable on two bits, and is closer to 6.5 than 8.
+@end deftypefun
+
+@deftypefun int mpfr_frac (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the fractional part of @var{op}, having the same sign as
+@var{op}, rounded in the direction @var{rnd} (unlike in @code{mpfr_rint},
+@var{rnd} affects only how the exact fractional part is rounded, not how
+the fractional part is generated).
+@end deftypefun
+
+@deftypefun int mpfr_modf (mpfr_t @var{iop}, mpfr_t @var{fop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
+Set simultaneously @var{iop} to the integral part of @var{op} and @var{fop} to
+the fractional part of @var{op}, rounded in the direction @var{rnd} with the
+corresponding precision of @var{iop} and @var{fop} (equivalent to
+@code{mpfr_trunc(@var{iop}, @var{op}, @var{rnd})} and
+@code{mpfr_frac(@var{fop}, @var{op}, @var{rnd})}). The variables @var{iop} and
+@var{fop} must be different. Return 0 iff both results are exact (see
+@code{mpfr_sin_cos} for a more detailed description of the return value).
+@end deftypefun
+
+@deftypefun int mpfr_fmod (mpfr_t @var{r}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_remainder (mpfr_t @var{r}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_remquo (mpfr_t @var{r}, long* @var{q}, mpfr_t @var{x}, mpfr_t @var{y}, mpfr_rnd_t @var{rnd})
+Set @var{r} to the value of @math{@var{x} - @var{n}@var{y}}, rounded
+according to the direction @var{rnd}, where @var{n} is the integer quotient
+of @var{x} divided by @var{y}, defined as follows: @var{n} is rounded
+toward zero for @code{mpfr_fmod}, and to the nearest integer (ties rounded
+to even) for @code{mpfr_remainder} and @code{mpfr_remquo}.
+
+Special values are handled as described in Section F.9.7.1 of
+the ISO C99 standard:
+If @var{x} is infinite or @var{y} is zero, @var{r} is NaN.
+If @var{y} is infinite and @var{x} is finite, @var{r} is @var{x} rounded
+to the precision of @var{r}.
+If @var{r} is zero, it has the sign of @var{x}.
+The return value is the ternary value corresponding to @var{r}.
+
+Additionally, @code{mpfr_remquo} stores
+the low significant bits from the quotient @var{n} in @var{*q}
+(more precisely the number of bits in a @code{long} minus one),
+with the sign of @var{x} divided by @var{y}
+(except if those low bits are all zero, in which case zero is returned).
+Note that @var{x} may be so large in magnitude relative to @var{y} that an
+exact representation of the quotient is not practical.
+The @code{mpfr_remainder} and @code{mpfr_remquo} functions are useful for
+additive argument reduction.
+@end deftypefun
+
+@deftypefun int mpfr_integer_p (mpfr_t @var{op})
+Return non-zero iff @var{op} is an integer.
+@end deftypefun
+
+@node Rounding Related Functions, Miscellaneous Functions, Integer Related Functions, MPFR Interface
+@cindex Rounding mode related functions
+@section Rounding Related Functions
+
+@deftypefun void mpfr_set_default_rounding_mode (mpfr_rnd_t @var{rnd})
+Set the default rounding mode to @var{rnd}.
+The default rounding mode is to nearest initially.
+@end deftypefun
+
+@deftypefun mpfr_rnd_t mpfr_get_default_rounding_mode (void)
+Get the default rounding mode.
+@end deftypefun
+
+@deftypefun int mpfr_prec_round (mpfr_t @var{x}, mpfr_prec_t @var{prec}, mpfr_rnd_t @var{rnd})
+Round @var{x} according to @var{rnd} with precision @var{prec}, which
+must be an integer between @code{MPFR_PREC_MIN} and @code{MPFR_PREC_MAX}
+(otherwise the behavior is undefined).
+If @var{prec} is greater or equal to the precision of @var{x}, then new
+space is allocated for the significand, and it is filled with zeros.
+Otherwise, the significand is rounded to precision @var{prec} with the given
+direction. In both cases, the precision of @var{x} is changed to @var{prec}.
+
+Here is an example of how to use @code{mpfr_prec_round} to implement
+Newton's algorithm to compute the inverse of @var{a}, assuming @var{x} is
+already an approximation to @var{n} bits:
+@example
+ mpfr_set_prec (t, 2 * n);
+ mpfr_set (t, a, MPFR_RNDN); /* round a to 2n bits */
+ mpfr_mul (t, t, x, MPFR_RNDN); /* t is correct to 2n bits */
+ mpfr_ui_sub (t, 1, t, MPFR_RNDN); /* high n bits cancel with 1 */
+ mpfr_prec_round (t, n, MPFR_RNDN); /* t is correct to n bits */
+ mpfr_mul (t, t, x, MPFR_RNDN); /* t is correct to n bits */
+ mpfr_prec_round (x, 2 * n, MPFR_RNDN); /* exact */
+ mpfr_add (x, x, t, MPFR_RNDN); /* x is correct to 2n bits */
+@end example
+@end deftypefun
+
+@deftypefun int mpfr_can_round (mpfr_t @var{b}, mpfr_exp_t @var{err}, mpfr_rnd_t @var{rnd1}, mpfr_rnd_t @var{rnd2}, mpfr_prec_t @var{prec})
+Assuming @var{b} is an approximation of an unknown number
+@var{x} in the direction @var{rnd1} with error at most two to the power
+E(b)-@var{err} where E(b) is the exponent of @var{b}, return a non-zero
+value if one is able to round correctly @var{x} to precision
+@var{prec} with the direction @var{rnd2},
+and 0 otherwise (including for NaN and Inf).
+This function @strong{does not modify} its arguments.
+
+If @var{rnd1} is @code{MPFR_RNDN}, then the sign of the error is
+unknown, but its absolute value is the same, so that the possible range
+is twice as large as with a directed rounding for @var{rnd1}.
+
+Note: if one wants to also determine the correct @ref{ternary value} when
+rounding @var{b} to precision @var{prec} with rounding mode @var{rnd},
+a useful trick is the following:
+@verbatim
+if (mpfr_can_round (b, err, MPFR_RNDN, MPFR_RNDZ, prec + (rnd == MPFR_RNDN)))
+ ...
+@end verbatim
+Indeed, if @var{rnd} is @code{MPFR_RNDN}, this will check if one can
+round to @var{prec}+1 bits with a directed rounding:
+if so, one can surely round to nearest to @var{prec} bits,
+and in addition one can determine the correct ternary value, which would not
+be the case when @var{b} is near from a value exactly representable on
+@var{prec} bits.
+@end deftypefun
+
+@deftypefun mpfr_prec_t mpfr_min_prec (mpfr_t @var{x})
+Return the minimal number of bits required to store the significand of
+@var{x}, and 0 for special values, including 0. (Warning: the returned
+value can be less than @code{MPFR_PREC_MIN}.)
+
+The function name is subject to change.
+@end deftypefun
+
+@deftypefun {const char *} mpfr_print_rnd_mode (mpfr_rnd_t @var{rnd})
+Return a string ("MPFR_RNDD", "MPFR_RNDU", "MPFR_RNDN", "MPFR_RNDZ",
+"MPFR_RNDA") corresponding to the rounding mode @var{rnd}, or a null pointer
+if @var{rnd} is an invalid rounding mode.
+@end deftypefun
+
+@node Miscellaneous Functions, Exception Related Functions, Rounding Related Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Miscellaneous float functions
+@section Miscellaneous Functions
+
+@deftypefun void mpfr_nexttoward (mpfr_t @var{x}, mpfr_t @var{y})
+If @var{x} or @var{y} is NaN, set @var{x} to NaN. If @var{x} and @var{y}
+are equal, @var{x} is unchanged. Otherwise, if @var{x}
+is different from @var{y}, replace @var{x} by the next floating-point
+number (with the precision of @var{x} and the current exponent range)
+in the direction of @var{y}
+(the infinite values are seen as the smallest and largest floating-point
+numbers). If the result is zero, it keeps the same sign. No underflow or
+overflow is generated.
+@end deftypefun
+
+@deftypefun void mpfr_nextabove (mpfr_t @var{x})
+@deftypefunx void mpfr_nextbelow (mpfr_t @var{x})
+Equivalent to @code{mpfr_nexttoward} where @var{y} is plus infinity
+(resp.@: minus infinity).
+@end deftypefun
+
+@deftypefun int mpfr_min (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_max (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the minimum (resp.@: maximum)
+of @var{op1} and @var{op2}. If @var{op1}
+and @var{op2} are both NaN, then @var{rop} is set to NaN. If @var{op1}
+or @var{op2} is NaN, then @var{rop} is set to the numeric value. If
+@var{op1} and @var{op2} are zeros of different signs, then @var{rop}
+is set to @minus{}0 (resp.@: +0).
+@end deftypefun
+
+@deftypefun int mpfr_urandomb (mpfr_t @var{rop}, gmp_randstate_t @var{state})
+Generate a uniformly distributed random float in the interval
+@math{0 @le{} @var{rop} < 1}. More precisely, the number can be seen as a
+float with a random non-normalized significand and exponent 0, which is then
+normalized (thus if @var{e} denotes the exponent after normalization, then
+the least @math{-@var{e}} significant bits of the significand are always 0).
+
+Return 0, unless the exponent is not in the current exponent range, in
+which case @var{rop} is set to NaN and a non-zero value is returned (this
+should never happen in practice, except in very specific cases). The
+second argument is a @code{gmp_randstate_t} structure which should be
+created using the GMP @code{gmp_randinit} function (see the GMP manual).
+
+Note: for a given version of MPFR, the returned value of @var{rop} and the
+new value of @var{state} (which controls further random values) do not depend
+on the machine word size.
+@end deftypefun
+
+@deftypefun int mpfr_urandom (mpfr_t @var{rop}, gmp_randstate_t @var{state}, mpfr_rnd_t @var{rnd})
+Generate a uniformly distributed random float.
+The floating-point number @var{rop} can be seen as if a random real number is
+generated according to the continuous uniform distribution on the interval
+[0, 1] and then rounded in the direction @var{rnd}.
+
+The second argument is a @code{gmp_randstate_t} structure which should be
+created using the GMP @code{gmp_randinit} function (see the GMP manual).
+
+Note: the note for @code{mpfr_urandomb} holds too. In addition, the exponent
+range and the rounding mode might have a side effect on the next random state.
+@end deftypefun
+
+@deftypefun int mpfr_grandom (mpfr_t @var{rop1}, mpfr_t @var{rop2}, gmp_randstate_t @var{state}, mpfr_rnd_t @var{rnd})
+Generate two random floats according to a standard normal gaussian
+distribution. If @var{rop2} is a null pointer, then only one value is generated
+and stored in @var{rop1}.
+
+The floating-point number @var{rop1} (and @var{rop2}) can be seen as if a
+random real number were generated according to the standard normal gaussian
+distribution and then rounded in the direction @var{rnd}.
+
+The third argument is a @code{gmp_randstate_t} structure, which should be
+created using the GMP @code{gmp_randinit} function (see the GMP manual).
+
+The combination of the ternary values is returned like with
+@code{mpfr_sin_cos}. If @var{rop2} is a null pointer, the second ternary
+value is assumed to be 0 (note that the encoding of the only ternary value
+is not the same as the usual encoding for functions that return only one
+result). Otherwise the ternary value of a random number is always non-zero.
+
+Note: the note for @code{mpfr_urandomb} holds too. In addition, the exponent
+range and the rounding mode might have a side effect on the next random state.
+@end deftypefun
+
+@deftypefun mpfr_exp_t mpfr_get_exp (mpfr_t @var{x})
+Return the exponent of @var{x}, assuming that @var{x} is a non-zero ordinary
+number and the significand is considered in [1/2,1). The behavior for NaN,
+infinity or zero is undefined.
+@end deftypefun
+
+@deftypefun int mpfr_set_exp (mpfr_t @var{x}, mpfr_exp_t @var{e})
+Set the exponent of @var{x} if @var{e} is in the current exponent range,
+and return 0 (even if @var{x} is not a non-zero ordinary number);
+otherwise, return a non-zero value.
+The significand is assumed to be in [1/2,1).
+@end deftypefun
+
+@deftypefun int mpfr_signbit (mpfr_t @var{op})
+Return a non-zero value iff @var{op} has its sign bit set (i.e., if it is
+negative, @minus{}0, or a NaN whose representation has its sign bit set).
+@end deftypefun
+
+@deftypefun int mpfr_setsign (mpfr_t @var{rop}, mpfr_t @var{op}, int @var{s}, mpfr_rnd_t @var{rnd})
+Set the value of @var{rop} from @var{op}, rounded toward the given
+direction @var{rnd}, then set (resp.@: clear) its sign bit if @var{s}
+is non-zero (resp.@: zero), even when @var{op} is a NaN.
+@end deftypefun
+
+@deftypefun int mpfr_copysign (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+Set the value of @var{rop} from @var{op1}, rounded toward the given
+direction @var{rnd}, then set its sign bit to that of @var{op2} (even
+when @var{op1} or @var{op2} is a NaN). This function is equivalent to
+@code{mpfr_setsign (@var{rop}, @var{op1}, mpfr_signbit (@var{op2}), @var{rnd})}.
+@end deftypefun
+
+@c By definition, a C string is always null-terminated, so that we
+@c could just say "string" or "null-terminated character array",
+@c but "null-terminated string" is not an error and probably better
+@c for most users.
+@deftypefun {const char *} mpfr_get_version (void)
+Return the MPFR version, as a null-terminated string.
+@end deftypefun
+
+@defmac MPFR_VERSION
+@defmacx MPFR_VERSION_MAJOR
+@defmacx MPFR_VERSION_MINOR
+@defmacx MPFR_VERSION_PATCHLEVEL
+@defmacx MPFR_VERSION_STRING
+@code{MPFR_VERSION} is the version of MPFR as a preprocessing constant.
+@code{MPFR_VERSION_MAJOR}, @code{MPFR_VERSION_MINOR} and
+@code{MPFR_VERSION_PATCHLEVEL} are respectively the major, minor and patch
+level of MPFR version, as preprocessing constants.
+@code{MPFR_VERSION_STRING} is the version (with an optional suffix, used
+in development and pre-release versions) as a string constant, which can
+be compared to the result of @code{mpfr_get_version} to check at run time
+the header file and library used match:
+@example
+if (strcmp (mpfr_get_version (), MPFR_VERSION_STRING))
+ fprintf (stderr, "Warning: header and library do not match\n");
+@end example
+Note: Obtaining different strings is not necessarily an error, as
+in general, a program compiled with some old MPFR version can be
+dynamically linked with a newer MPFR library version (if allowed
+by the library versioning system).
+@end defmac
+
+@deftypefn Macro long MPFR_VERSION_NUM (@var{major}, @var{minor}, @var{patchlevel})
+Create an integer in the same format as used by @code{MPFR_VERSION} from the
+given @var{major}, @var{minor} and @var{patchlevel}.
+Here is an example of how to check the MPFR version at compile time:
+@example
+#if (!defined(MPFR_VERSION) || (MPFR_VERSION<MPFR_VERSION_NUM(3,0,0)))
+# error "Wrong MPFR version."
+#endif
+@end example
+@end deftypefn
+
+@deftypefun {const char *} mpfr_get_patches (void)
+Return a null-terminated string containing the ids of the patches applied to
+the MPFR library (contents of the @file{PATCHES} file), separated by spaces.
+Note: If the program has been compiled with an older MPFR version and is
+dynamically linked with a new MPFR library version, the identifiers of the
+patches applied to the old (compile-time) MPFR version are not available
+(however this information should not have much interest in general).
+@end deftypefun
+
+@deftypefun int mpfr_buildopt_tls_p (void)
+Return a non-zero value if MPFR was compiled as thread safe using
+compiler-level Thread Local Storage (that is, MPFR was built with the
+@code{--enable-thread-safe} configure option, see @code{INSTALL} file), return
+zero otherwise.
+@end deftypefun
+
+@deftypefun int mpfr_buildopt_decimal_p (void)
+Return a non-zero value if MPFR was compiled with decimal float support (that
+is, MPFR was built with the @code{--enable-decimal-float} configure option),
+return zero otherwise.
+@end deftypefun
+
+@deftypefun int mpfr_buildopt_gmpinternals_p (void)
+Return a non-zero value if MPFR was compiled with GMP internals
+(that is, MPFR was built with either @code{--with-gmp-build} or
+@code{--enable-gmp-internals} configure option), return zero otherwise.
+@end deftypefun
+
+@deftypefun {const char *} mpfr_buildopt_tune_case (void)
+Return a string saying which thresholds file has been used at compile time.
+This file is normally selected from the processor type.
+@end deftypefun
+
+@node Exception Related Functions, Compatibility with MPF, Miscellaneous Functions, MPFR Interface
+@comment node-name, next, previous, up
+@cindex Exception related functions
+@section Exception Related Functions
+
+@deftypefun mpfr_exp_t mpfr_get_emin (void)
+@deftypefunx mpfr_exp_t mpfr_get_emax (void)
+Return the (current) smallest and largest exponents allowed for a
+floating-point variable. The smallest positive value of a floating-point
+variable is @m{1/2 \times 2^{\rm emin}, one half times 2 raised to the
+smallest exponent} and the largest value has the form @m{(1 - \varepsilon)
+\times 2^{\rm emax}, (1 - epsilon) times 2 raised to the largest exponent},
+where @m{\varepsilon,epsilon} depends on the precision of the considered
+variable.
+@end deftypefun
+
+@deftypefun int mpfr_set_emin (mpfr_exp_t @var{exp})
+@deftypefunx int mpfr_set_emax (mpfr_exp_t @var{exp})
+Set the smallest and largest exponents allowed for a floating-point variable.
+Return a non-zero value when @var{exp} is not in the range accepted by the
+implementation (in that case the smallest or largest exponent is not changed),
+and zero otherwise.
+If the user changes the exponent range, it is her/his responsibility to check
+that all current floating-point variables are in the new allowed range
+(for example using @code{mpfr_check_range}), otherwise the subsequent
+behavior will be undefined, in the sense of the ISO C standard.
+@c It is also her/his responsibility to check that @m {emin <= emax}.
+@end deftypefun
+
+@deftypefun mpfr_exp_t mpfr_get_emin_min (void)
+@deftypefunx mpfr_exp_t mpfr_get_emin_max (void)
+@deftypefunx mpfr_exp_t mpfr_get_emax_min (void)
+@deftypefunx mpfr_exp_t mpfr_get_emax_max (void)
+Return the minimum and maximum of the exponents
+allowed for @code{mpfr_set_emin} and @code{mpfr_set_emax} respectively.
+These values are implementation dependent, thus a program using
+@code{mpfr_set_emax(mpfr_get_emax_max())}
+or @code{mpfr_set_emin(mpfr_get_emin_min())} may not be portable.
+@end deftypefun
+
+@deftypefun int mpfr_check_range (mpfr_t @var{x}, int @var{t}, mpfr_rnd_t @var{rnd})
+This function assumes that @var{x} is the correctly-rounded value of some
+real value @var{y} in the direction @var{rnd} and some extended exponent
+range, and that @var{t} is the corresponding @ref{ternary value}.
+For example, one performed @code{t = mpfr_log (x, u, rnd)}, and @var{y} is the
+exact logarithm of @var{u}.
+Thus @var{t} is negative if @var{x} is smaller than @var{y},
+positive if @var{x} is larger than @var{y}, and zero if @var{x} equals @var{y}.
+This function modifies @var{x} if needed
+to be in the current range of acceptable values: It
+generates an underflow or an overflow if the exponent of @var{x} is
+outside the current allowed range; the value of @var{t} may be used
+to avoid a double rounding. This function returns zero if the new value of
+@var{x} equals the exact one @var{y}, a positive value if that new value
+is larger than @var{y}, and a negative value if it is smaller than @var{y}.
+Note that unlike most functions,
+the new result @var{x} is compared to the (unknown) exact one @var{y},
+not the input value @var{x}, i.e., the ternary value is propagated.
+
+Note: If @var{x} is an infinity and @var{t} is different from zero (i.e.,
+if the rounded result is an inexact infinity), then the overflow flag is
+set. This is useful because @code{mpfr_check_range} is typically called
+(at least in MPFR functions) after restoring the flags that could have
+been set due to internal computations.
+@end deftypefun
+
+@deftypefun int mpfr_subnormalize (mpfr_t @var{x}, int @var{t}, mpfr_rnd_t @var{rnd})
+This function rounds @var{x} emulating subnormal number arithmetic:
+if @var{x} is outside the subnormal exponent range, it just propagates the
+@ref{ternary value} @var{t}; otherwise, it rounds @var{x} to precision
+@code{EXP(x)-emin+1} according to rounding mode @var{rnd} and previous
+ternary value @var{t}, avoiding double rounding problems.
+More precisely in the subnormal domain, denoting by @var{e} the value of
+@code{emin}, @var{x} is rounded in fixed-point
+arithmetic to an integer multiple of @m{2^{e-1}, two to the power
+@var{e}@minus{}1}; as a consequence, @m{1.5 \times 2^{e-1},
+1.5 multiplied by two to the power @var{e}@minus{}1} when @var{t} is zero
+is rounded to @m{2^e, two to the power @var{e}} with rounding to nearest.
+
+@code{PREC(x)} is not modified by this function.
+@var{rnd} and @var{t} must be the rounding mode
+and the returned ternary value used when computing @var{x}
+(as in @code{mpfr_check_range}).
+The subnormal exponent range is from @code{emin} to @code{emin+PREC(x)-1}.
+If the result cannot be represented in the current exponent range
+(due to a too small @code{emax}), the behavior is undefined.
+Note that unlike most functions, the result is compared to the exact one,
+not the input value @var{x}, i.e., the ternary value is propagated.
+
+As usual, if the returned ternary value is non zero, the inexact flag is set.
+Moreover, if a second rounding occurred (because the input @var{x} was in the
+subnormal range), the underflow flag is set.
+@end deftypefun
+
+This is an example of how to emulate binary double IEEE 754 arithmetic
+(binary64 in IEEE 754-2008) using MPFR:
+
+@example
+@{
+ mpfr_t xa, xb; int i; volatile double a, b;
+
+ mpfr_set_default_prec (53);
+ mpfr_set_emin (-1073); mpfr_set_emax (1024);
+
+ mpfr_init (xa); mpfr_init (xb);
+
+ b = 34.3; mpfr_set_d (xb, b, MPFR_RNDN);
+ a = 0x1.1235P-1021; mpfr_set_d (xa, a, MPFR_RNDN);
+
+ a /= b;
+ i = mpfr_div (xa, xa, xb, MPFR_RNDN);
+ i = mpfr_subnormalize (xa, i, MPFR_RNDN); /* new ternary value */
+
+ mpfr_clear (xa); mpfr_clear (xb);
+@}
+@end example
+
+Warning: this emulates a double IEEE 754 arithmetic with correct rounding
+in the subnormal range, which may not be the case for your hardware.
+
+@deftypefun void mpfr_clear_underflow (void)
+@deftypefunx void mpfr_clear_overflow (void)
+@deftypefunx void mpfr_clear_divby0 (void)
+@deftypefunx void mpfr_clear_nanflag (void)
+@deftypefunx void mpfr_clear_inexflag (void)
+@deftypefunx void mpfr_clear_erangeflag (void)
+Clear the underflow, overflow, divide-by-zero, invalid,
+inexact and @emph{erange} flags.
+@end deftypefun
+
+@deftypefun void mpfr_set_underflow (void)
+@deftypefunx void mpfr_set_overflow (void)
+@deftypefunx void mpfr_set_divby0 (void)
+@deftypefunx void mpfr_set_nanflag (void)
+@deftypefunx void mpfr_set_inexflag (void)
+@deftypefunx void mpfr_set_erangeflag (void)
+Set the underflow, overflow, divide-by-zero, invalid,
+inexact and @emph{erange} flags.
+@end deftypefun
+
+@deftypefun void mpfr_clear_flags (void)
+Clear all global flags (underflow, overflow, divide-by-zero, invalid,
+inexact, @emph{erange}).
+@end deftypefun
+
+@deftypefun int mpfr_underflow_p (void)
+@deftypefunx int mpfr_overflow_p (void)
+@deftypefunx int mpfr_divby0_p (void)
+@deftypefunx int mpfr_nanflag_p (void)
+@deftypefunx int mpfr_inexflag_p (void)
+@deftypefunx int mpfr_erangeflag_p (void)
+Return the corresponding (underflow, overflow, divide-by-zero, invalid,
+inexact, @emph{erange}) flag, which is non-zero iff the flag is set.
+@end deftypefun
+
+@node Compatibility with MPF, Custom Interface, Exception Related Functions, MPFR Interface
+@cindex Compatibility with MPF
+@section Compatibility With MPF
+
+A header file @file{mpf2mpfr.h} is included in the distribution of MPFR for
+compatibility with the GNU MP class MPF.
+By inserting the following two lines after the @code{#include <gmp.h>} line,
+@verbatim
+#include <mpfr.h>
+#include <mpf2mpfr.h>
+@end verbatim
+@noindent
+any program written for
+MPF can be compiled directly with MPFR without any changes
+(except the @code{gmp_printf} functions will not work for arguments of type
+@code{mpfr_t}).
+All operations are then performed with the default MPFR rounding mode,
+which can be reset with @code{mpfr_set_default_rounding_mode}.
+
+Warning: the @code{mpf_init} and @code{mpf_init2} functions initialize
+to zero, whereas the corresponding MPFR functions initialize to NaN:
+this is useful to detect uninitialized values, but is slightly incompatible
+with MPF.
+
+@deftypefun void mpfr_set_prec_raw (mpfr_t @var{x}, mpfr_prec_t @var{prec})
+Reset the precision of @var{x} to be @strong{exactly} @var{prec} bits.
+The only difference with @code{mpfr_set_prec} is that @var{prec} is assumed to
+be small enough so that the significand fits into the current allocated memory
+space for @var{x}. Otherwise the behavior is undefined.
+@end deftypefun
+
+@deftypefun int mpfr_eq (mpfr_t @var{op1}, mpfr_t @var{op2}, unsigned long int @var{op3})
+Return non-zero if @var{op1} and @var{op2} are both non-zero ordinary
+numbers with the same exponent and the same first @var{op3} bits, both
+zero, or both infinities of the same sign. Return zero otherwise.
+This function is defined for compatibility with MPF, we do not recommend
+to use it otherwise.
+Do not use it either if
+you want to know whether two numbers are close to each other; for instance,
+1.011111 and 1.100000 are regarded as different for any value of
+@var{op3} larger than 1.
+@end deftypefun
+
+@deftypefun void mpfr_reldiff (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
+Compute the relative difference between @var{op1} and @var{op2}
+and store the result in @var{rop}.
+This function does not guarantee the correct rounding on the relative
+difference; it just computes @math{|@var{op1}-@var{op2}|/@var{op1}}, using the
+precision of @var{rop} and the rounding mode @var{rnd} for all operations.
+@c VL: say that if op1 and op2 have the same precision and are close to
+@c each other, then one gets correct rounding?
+@end deftypefun
+
+@deftypefun int mpfr_mul_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mpfr_rnd_t @var{rnd})
+These functions are identical to @code{mpfr_mul_2ui} and @code{mpfr_div_2ui}
+respectively.
+These functions are only kept for compatibility with MPF, one should
+prefer @code{mpfr_mul_2ui} and @code{mpfr_div_2ui} otherwise.
+@end deftypefun
+
+
+@node Custom Interface, Internals, Compatibility with MPF, MPFR Interface
+@cindex Custom interface
+@section Custom Interface
+
+Some applications use a stack to handle the memory and their objects.
+However, the MPFR memory design is not well suited for such a thing. So that
+such applications are able to use MPFR, an auxiliary memory interface has
+been created: the Custom Interface.
+
+The following interface allows one to use MPFR in two ways:
+@itemize
+@item Either directly store a floating-point number as a @code{mpfr_t}
+on the stack.
+@item Either store its own representation on the
+stack and construct a new temporary @code{mpfr_t} each time it is needed.
+@end itemize
+Nothing has to be done to destroy the floating-point
+numbers except garbaging the used
+memory: all the memory management (allocating, destroying, garbaging) is left
+to the application.
+
+Each function in this interface is also implemented as a macro for
+efficiency reasons: for example @code{mpfr_custom_init (s, p)}
+uses the macro, while @code{(mpfr_custom_init) (s, p)} uses the function.
+
+Note 1: MPFR functions may still initialize temporary floating-point numbers
+using @code{mpfr_init} and similar functions. See Custom Allocation (GNU MP).
+
+Note 2: MPFR functions may use the cached functions (@code{mpfr_const_pi} for
+example), even if they are not explicitly called. You have to call
+@code{mpfr_free_cache} each time you garbage the memory iff @code{mpfr_init},
+through GMP Custom Allocation, allocates its memory on the application stack.
+
+@deftypefun size_t mpfr_custom_get_size (mpfr_prec_t @var{prec})
+Return the needed size in bytes to store the significand of a floating-point
+number of precision @var{prec}.
+@end deftypefun
+
+@deftypefun void mpfr_custom_init (void *@var{significand}, mpfr_prec_t @var{prec})
+Initialize a significand of precision @var{prec}, where
+@var{significand} must be an area of @code{mpfr_custom_get_size (prec)} bytes
+at least and be suitably aligned for an array of @code{mp_limb_t} (GMP type,
+@pxref{Internals}).
+@c PZ: give an example how to align?
+@end deftypefun
+
+@deftypefun void mpfr_custom_init_set (mpfr_t @var{x}, int @var{kind}, mpfr_exp_t @var{exp}, mpfr_prec_t @var{prec}, void *@var{significand})
+Perform a dummy initialization of a @code{mpfr_t} and set it to:
+@itemize
+@item if @code{ABS(kind) == MPFR_NAN_KIND}, @var{x} is set to NaN;
+@item if @code{ABS(kind) == MPFR_INF_KIND}, @var{x} is set to the infinity
+of sign @code{sign(kind)};
+@item if @code{ABS(kind) == MPFR_ZERO_KIND}, @var{x} is set to the zero of
+sign @code{sign(kind)};
+@item if @code{ABS(kind) == MPFR_REGULAR_KIND}, @var{x} is set to a regular
+number: @code{x = sign(kind)*significand*2^exp}.
+@end itemize
+In all cases, it uses @var{significand} directly for further computing
+involving @var{x}. It will not allocate anything.
+A floating-point number initialized with this function cannot be resized using
+@code{mpfr_set_prec} or @code{mpfr_prec_round},
+or cleared using @code{mpfr_clear}!
+The @var{significand} must have been initialized with @code{mpfr_custom_init}
+using the same precision @var{prec}.
+@end deftypefun
+
+@deftypefun int mpfr_custom_get_kind (mpfr_t @var{x})
+Return the current kind of a @code{mpfr_t} as created by
+@code{mpfr_custom_init_set}.
+The behavior of this function for any @code{mpfr_t} not initialized
+with @code{mpfr_custom_init_set} is undefined.
+@end deftypefun
+
+@deftypefun {void *} mpfr_custom_get_significand (mpfr_t @var{x})
+Return a pointer to the significand used by a @code{mpfr_t} initialized with
+@code{mpfr_custom_init_set}.
+The behavior of this function for any @code{mpfr_t} not initialized
+with @code{mpfr_custom_init_set} is undefined.
+@end deftypefun
+
+@deftypefun mpfr_exp_t mpfr_custom_get_exp (mpfr_t @var{x})
+Return the exponent of @var{x}, assuming that @var{x} is a non-zero ordinary
+number. The return value for NaN, Infinity or zero is unspecified but does not
+produce any trap.
+The behavior of this function for any @code{mpfr_t} not initialized
+with @code{mpfr_custom_init_set} is undefined.
+@end deftypefun
+
+@deftypefun void mpfr_custom_move (mpfr_t @var{x}, void *@var{new_position})
+Inform MPFR that the significand of @var{x} has moved due to a garbage collect
+and update its new position to @code{new_position}.
+However the application has to move the significand and the @code{mpfr_t}
+itself.
+The behavior of this function for any @code{mpfr_t} not initialized
+with @code{mpfr_custom_init_set} is undefined.
+@end deftypefun
+
+@node Internals, , Custom Interface, MPFR Interface
+@cindex Internals
+@section Internals
+
+@cindex Limb
+@c @tindex @code{mp_limb_t}
+@noindent
+A @dfn{limb} means the part of a multi-precision number that fits in a single
+word. Usually a limb contains
+32 or 64 bits. The C data type for a limb is @code{mp_limb_t}.
+
+The @code{mpfr_t} type is internally defined as a one-element
+array of a structure, and @code{mpfr_ptr} is the C data type representing
+a pointer to this structure.
+The @code{mpfr_t} type consists of four fields:
+
+@itemize @bullet
+
+@item The @code{_mpfr_prec} field is used to store the precision of
+the variable (in bits); this is not less than @code{MPFR_PREC_MIN}.
+
+@item The @code{_mpfr_sign} field is used to store the sign of the variable.
+
+@item The @code{_mpfr_exp} field stores the exponent.
+An exponent of 0 means a radix point just above the most significant
+limb. Non-zero values @math{n} are a multiplier @math{2^n} relative to that
+point.
+A NaN, an infinity and a zero are indicated by special values of the exponent
+field.
+
+@item Finally, the @code{_mpfr_d} field is a pointer to the limbs, least
+significant limbs stored first.
+The number of limbs in use is controlled by @code{_mpfr_prec}, namely
+ceil(@code{_mpfr_prec}/@code{mp_bits_per_limb}).
+Non-singular (i.e., different from NaN, Infinity or zero)
+values always have the most significant bit of the most
+significant limb set to 1. When the precision does not correspond to a
+whole number of limbs, the excess bits at the low end of the data are zeros.
+
+@end itemize
+
+@node API Compatibility, Contributors, MPFR Interface, Top
+@chapter API Compatibility
+
+The goal of this section is to describe some API changes that occurred
+from one version of MPFR to another, and how to write code that can be compiled
+and run with older MPFR versions. The minimum MPFR version that is
+considered here is 2.2.0 (released on 20 September 2005).
+
+API changes can only occur between major or minor versions. Thus the
+patchlevel (the third number in the MPFR version) will be ignored in
+the following. If a program does not use MPFR internals, changes in
+the behavior between two versions differing only by the patchlevel
+should only result from what was regarded as a bug or unspecified behavior.
+@comment This includes undefined behavior.
+
+As a general rule, a program written for some MPFR version should work
+with later versions, possibly except at a new major version, where
+some features (described as obsolete for some time) can be removed.
+In such a case, a failure should occur during compilation or linking.
+If a result becomes incorrect because of such a change, please look
+at the various changes below (they are minimal, and most software
+should be unaffected), at the FAQ and at the MPFR web page for your
+version (a bug could have been introduced and be already fixed);
+and if the problem is not mentioned, please send us a bug report
+(@pxref{Reporting Bugs}).
+
+However, a program written for the current MPFR version (as documented
+by this manual) may not necessarily work with previous versions of
+MPFR. This section should help developers to write portable code.
+
+Note: Information given here may be incomplete. API changes are
+also described in the NEWS file (for each version, instead of being
+classified like here), together with other changes.
+
+@menu
+* Type and Macro Changes::
+* Added Functions::
+* Changed Functions::
+* Removed Functions::
+* Other Changes::
+@end menu
+
+@node Type and Macro Changes, Added Functions, API Compatibility, API Compatibility
+@section Type and Macro Changes
+
+@comment r6789
+The official type for exponent values changed from @code{mp_exp_t} to
+@code{mpfr_exp_t} in MPFR 3.0. The type @code{mp_exp_t} will remain
+available as it comes from GMP (with a different meaning). These types
+are currently the same (@code{mpfr_exp_t} is defined as @code{mp_exp_t}
+with @code{typedef}), so that programs can still use @code{mp_exp_t};
+but this may change in the future.
+Alternatively, using the following code after including @file{mpfr.h}
+will work with official MPFR versions, as @code{mpfr_exp_t} was never
+defined in MPFR 2.x:
+@example
+#if MPFR_VERSION_MAJOR < 3
+typedef mp_exp_t mpfr_exp_t;
+#endif
+@end example
+
+The official types for precision values and for rounding modes
+respectively changed from @code{mp_prec_t} and @code{mp_rnd_t}
+to @code{mpfr_prec_t} and @code{mpfr_rnd_t} in MPFR 3.0. This
+change was actually done a long time ago in MPFR, at least since
+MPFR 2.2.0, with the following code in @file{mpfr.h}:
+@example
+#ifndef mp_rnd_t
+# define mp_rnd_t mpfr_rnd_t
+#endif
+#ifndef mp_prec_t
+# define mp_prec_t mpfr_prec_t
+#endif
+@end example
+This means that it is safe to use the new official types
+@code{mpfr_prec_t} and @code{mpfr_rnd_t} in your programs.
+The types @code{mp_prec_t} and @code{mp_rnd_t} (defined
+in MPFR only) may be removed in the future, as the prefix
+@code{mp_} is reserved by GMP.
+
+@comment r6787
+The precision type @code{mpfr_prec_t} (@code{mp_prec_t}) was unsigned
+before MPFR 3.0; it is now signed. @code{MPFR_PREC_MAX} has not changed,
+though. Indeed the MPFR code requires that @code{MPFR_PREC_MAX} be
+representable in the exponent type, which may have the same size as
+@code{mpfr_prec_t} but has always been signed.
+The consequence is that valid code that does not assume anything about
+the signedness of @code{mpfr_prec_t} should work with past and new MPFR
+versions.
+This change was useful as the use of unsigned types tends to convert
+signed values to unsigned ones in expressions due to the usual arithmetic
+conversions, which can yield incorrect results if a negative value is
+converted in such a way.
+Warning! A program assuming (intentionally or not) that
+@code{mpfr_prec_t} is signed may be affected by this problem when
+it is built and run against MPFR 2.x.
+
+The rounding modes @code{GMP_RNDx} were renamed to @code{MPFR_RNDx}
+in MPFR 3.0. However the old names @code{GMP_RNDx} have been kept for
+compatibility (this might change in future versions), using:
+@example
+#define GMP_RNDN MPFR_RNDN
+#define GMP_RNDZ MPFR_RNDZ
+#define GMP_RNDU MPFR_RNDU
+#define GMP_RNDD MPFR_RNDD
+@end example
+The rounding mode ``round away from zero'' (@code{MPFR_RNDA}) was added in
+MPFR 3.0 (however no rounding mode @code{GMP_RNDA} exists).
+
+@node Added Functions, Changed Functions, Type and Macro Changes, API Compatibility
+@section Added Functions
+
+We give here in alphabetical order
+the functions that were added after MPFR 2.2, and in which
+MPFR version.
+
+@comment The functions are listed in such a way that if a developer wonders
+@comment whether some function existed in some previous version, then he can
+@comment find this very quickly.
+
+@itemize @bullet
+
+@item @code{mpfr_add_d} in MPFR 2.4.
+
+@item @code{mpfr_ai} in MPFR 3.0 (incomplete, experimental).
+
+@item @code{mpfr_asprintf} in MPFR 2.4.
+
+@item @code{mpfr_buildopt_decimal_p} and @code{mpfr_buildopt_tls_p} in MPFR 3.0.
+
+@item @code{mpfr_buildopt_gmpinternals_p} and @code{mpfr_buildopt_tune_case}
+in MPFR 3.1.
+
+@item @code{mpfr_clear_divby0} in MPFR 3.1 (new divide-by-zero exception).
+
+@item @code{mpfr_copysign} in MPFR 2.3.
+Note: MPFR 2.2 had a @code{mpfr_copysign} function that was available,
+but not documented,
+and with a slight difference in the semantics (when
+the second input operand is a NaN).
+
+@item @code{mpfr_custom_get_significand} in MPFR 3.0.
+This function was named @code{mpfr_custom_get_mantissa} in previous
+versions; @code{mpfr_custom_get_mantissa} is still available via a
+macro in @file{mpfr.h}:
+@example
+#define mpfr_custom_get_mantissa mpfr_custom_get_significand
+@end example
+Thus code that needs to work with both MPFR 2.x and MPFR 3.x should
+use @code{mpfr_custom_get_mantissa}.
+
+@item @code{mpfr_d_div} and @code{mpfr_d_sub} in MPFR 2.4.
+
+@item @code{mpfr_digamma} in MPFR 3.0.
+
+@item @code{mpfr_divby0_p} in MPFR 3.1 (new divide-by-zero exception).
+
+@item @code{mpfr_div_d} in MPFR 2.4.
+
+@item @code{mpfr_fmod} in MPFR 2.4.
+
+@item @code{mpfr_fms} in MPFR 2.3.
+
+@item @code{mpfr_fprintf} in MPFR 2.4.
+
+@item @code{mpfr_frexp} in MPFR 3.1.
+
+@item @code{mpfr_get_flt} in MPFR 3.0.
+
+@item @code{mpfr_get_patches} in MPFR 2.3.
+
+@item @code{mpfr_get_z_2exp} in MPFR 3.0.
+This function was named @code{mpfr_get_z_exp} in previous versions;
+@code{mpfr_get_z_exp} is still available via a macro in @file{mpfr.h}:
+@example
+#define mpfr_get_z_exp mpfr_get_z_2exp
+@end example
+Thus code that needs to work with both MPFR 2.x and MPFR 3.x should
+use @code{mpfr_get_z_exp}.
+
+@item @code{mpfr_grandom} in MPFR 3.1.
+
+@item @code{mpfr_j0}, @code{mpfr_j1} and @code{mpfr_jn} in MPFR 2.3.
+
+@item @code{mpfr_lgamma} in MPFR 2.3.
+
+@item @code{mpfr_li2} in MPFR 2.4.
+
+@item @code{mpfr_min_prec} in MPFR 3.0.
+
+@item @code{mpfr_modf} in MPFR 2.4.
+
+@item @code{mpfr_mul_d} in MPFR 2.4.
+
+@item @code{mpfr_printf} in MPFR 2.4.
+
+@item @code{mpfr_rec_sqrt} in MPFR 2.4.
+
+@item @code{mpfr_regular_p} in MPFR 3.0.
+
+@item @code{mpfr_remainder} and @code{mpfr_remquo} in MPFR 2.3.
+
+@item @code{mpfr_set_divby0} in MPFR 3.1 (new divide-by-zero exception).
+
+@item @code{mpfr_set_flt} in MPFR 3.0.
+
+@item @code{mpfr_set_z_2exp} in MPFR 3.0.
+
+@item @code{mpfr_set_zero} in MPFR 3.0.
+
+@item @code{mpfr_setsign} in MPFR 2.3.
+
+@item @code{mpfr_signbit} in MPFR 2.3.
+
+@item @code{mpfr_sinh_cosh} in MPFR 2.4.
+
+@item @code{mpfr_snprintf} and @code{mpfr_sprintf} in MPFR 2.4.
+
+@item @code{mpfr_sub_d} in MPFR 2.4.
+
+@item @code{mpfr_urandom} in MPFR 3.0.
+
+@item @code{mpfr_vasprintf}, @code{mpfr_vfprintf}, @code{mpfr_vprintf},
+ @code{mpfr_vsprintf} and @code{mpfr_vsnprintf} in MPFR 2.4.
+
+@item @code{mpfr_y0}, @code{mpfr_y1} and @code{mpfr_yn} in MPFR 2.3.
+
+@item @code{mpfr_z_sub} in MPFR 3.1.
+
+@end itemize
+
+@node Changed Functions, Removed Functions, Added Functions, API Compatibility
+@section Changed Functions
+
+The following functions have changed after MPFR 2.2. Changes can affect
+the behavior of code written for some MPFR version when built and run
+against another MPFR version (older or newer), as described below.
+
+@itemize @bullet
+
+@item @code{mpfr_check_range} changed in MPFR 2.3.2 and MPFR 2.4.
+If the value is an inexact infinity, the overflow flag is now set
+(in case it was lost), while it was previously left unchanged.
+This is really what is expected in practice (and what the MPFR code
+was expecting), so that the previous behavior was regarded as a bug.
+Hence the change in MPFR 2.3.2.
+
+@item @code{mpfr_get_f} changed in MPFR 3.0.
+This function was returning zero, except for NaN and Inf, which do not
+exist in MPF. The @emph{erange} flag is now set in these cases,
+and @code{mpfr_get_f} now returns the usual ternary value.
+
+@item @code{mpfr_get_si}, @code{mpfr_get_sj}, @code{mpfr_get_ui}
+and @code{mpfr_get_uj} changed in MPFR 3.0.
+In previous MPFR versions, the cases where the @emph{erange} flag
+is set were unspecified.
+
+@item @code{mpfr_get_z} changed in MPFR 3.0.
+The return type was @code{void}; it is now @code{int}, and the usual
+ternary value is returned. Thus programs that need to work with both
+MPFR 2.x and 3.x must not use the return value. Even in this case,
+C code using @code{mpfr_get_z} as the second or third term of
+a conditional operator may also be affected. For instance, the
+following is correct with MPFR 3.0, but not with MPFR 2.x:
+@example
+ bool ? mpfr_get_z(...) : mpfr_add(...);
+@end example
+On the other hand, the following is correct with MPFR 2.x, but not
+with MPFR 3.0:
+@example
+ bool ? mpfr_get_z(...) : (void) mpfr_add(...);
+@end example
+Portable code should cast @code{mpfr_get_z(...)} to @code{void} to
+use the type @code{void} for both terms of the conditional operator,
+as in:
+@example
+ bool ? (void) mpfr_get_z(...) : (void) mpfr_add(...);
+@end example
+Alternatively, @code{if ... else} can be used instead of the
+conditional operator.
+
+Moreover the cases where the @emph{erange} flag is set were unspecified
+in MPFR 2.x.
+
+@item @code{mpfr_get_z_exp} changed in MPFR 3.0.
+In previous MPFR versions, the cases where the @emph{erange} flag
+is set were unspecified.
+Note: this function has been renamed to @code{mpfr_get_z_2exp}
+in MPFR 3.0, but @code{mpfr_get_z_exp} is still available for
+compatibility reasons.
+
+@item @code{mpfr_strtofr} changed in MPFR 2.3.1 and MPFR 2.4.
+This was actually a bug fix since the code and the documentation did
+not match. But both were changed in order to have a more consistent
+and useful behavior. The main changes in the code are as follows.
+The binary exponent is now accepted even without the @code{0b} or
+@code{0x} prefix. Data corresponding to NaN can now have an optional
+sign (such data were previously invalid).
+
+@item @code{mpfr_strtofr} changed in MPFR 3.0.
+This function now accepts bases from 37 to 62 (no changes for the other
+bases). Note: if an unsupported base is provided to this function,
+the behavior is undefined; more precisely, in MPFR 2.3.1 and later,
+providing an unsupported base yields an assertion failure (this
+behavior may change in the future).
+
+@item @code{mpfr_subnormalize} changed in MPFR 3.1.
+This was actually regarded as a bug fix. The @code{mpfr_subnormalize}
+implementation up to MPFR 3.0.0 did not change the flags. In particular,
+it did not follow the generic rule concerning the inexact flag (and no
+special behavior was specified). The case of the underflow flag was more
+a lack of specification.
+
+@item @code{mpfr_urandom} and @code{mpfr_urandomb} changed in MPFR 3.1.
+Their behavior no longer depends on the platform (assuming this is also true
+for GMP's random generator, which is not the case between GMP 4.1 and 4.2 if
+@code{gmp_randinit_default} is used). As a consequence, the returned values
+can be different between MPFR 3.1 and previous MPFR versions.
+Note: as the reproducibility of these functions was not specified
+before MPFR 3.1, the MPFR 3.1 behavior is @emph{not} regarded as
+backward incompatible with previous versions.
+
+@end itemize
+
+@node Removed Functions, Other Changes, Changed Functions, API Compatibility
+@section Removed Functions
+
+Functions @code{mpfr_random} and @code{mpfr_random2} have been
+removed in MPFR 3.0 (this only affects old code built against
+MPFR 3.0 or later).
+(The function @code{mpfr_random} had been deprecated since at least MPFR 2.2.0,
+and @code{mpfr_random2} since MPFR 2.4.0.)
+
+@node Other Changes, , Removed Functions, API Compatibility
+@section Other Changes
+
+@comment r6699
+For users of a C++ compiler, the way how the availability of @code{intmax_t}
+is detected has changed in MPFR 3.0.
+In MPFR 2.x, if a macro @code{INTMAX_C} or @code{UINTMAX_C} was defined
+(e.g. when the @code{__STDC_CONSTANT_MACROS} macro had been defined
+before @code{<stdint.h>} or @code{<inttypes.h>} has been included),
+@code{intmax_t} was assumed to be defined.
+However this was not always the case (more precisely, @code{intmax_t}
+can be defined only in the namespace @code{std}, as with Boost), so
+that compilations could fail.
+Thus the check for @code{INTMAX_C} or @code{UINTMAX_C} is now disabled for
+C++ compilers, with the following consequences:
+
+@itemize
+
+@item Programs written for MPFR 2.x that need @code{intmax_t} may no longer
+be compiled against MPFR 3.0: a @code{#define MPFR_USE_INTMAX_T} may be
+necessary before @file{mpfr.h} is included.
+
+@item The compilation of programs that work with MPFR 3.0 may fail with
+MPFR 2.x due to the problem described above. Workarounds are possible,
+such as defining @code{intmax_t} and @code{uintmax_t} in the global
+namespace, though this is not clean.
+
+@end itemize
+
+The divide-by-zero exception is new in MPFR 3.1. However it should
+not introduce incompatible changes for programs that strictly follow
+the MPFR API since the exception can only be seen via new functions.
+
+As of MPFR 3.1, the @file{mpfr.h} header can be included several times,
+while still supporting optional functions (@pxref{Headers and Libraries}).
+
+@node Contributors, References, API Compatibility, Top
+@comment node-name, next, previous, up
+@unnumbered Contributors
+
+The main developers of MPFR are Guillaume Hanrot, Vincent Lef@`evre,
+Patrick P@'elissier, Philippe Th@'eveny and Paul Zimmermann.
+
+Sylvie Boldo from ENS-Lyon, France,
+contributed the functions @code{mpfr_agm} and @code{mpfr_log}.
+Sylvain Chevillard contributed the @code{mpfr_ai} function.
+David Daney contributed the hyperbolic and inverse hyperbolic functions,
+the base-2 exponential, and the factorial function.
+Alain Delplanque contributed the new version of the @code{mpfr_get_str}
+function.
+Mathieu Dutour contributed the functions @code{mpfr_acos}, @code{mpfr_asin}
+and @code{mpfr_atan}, and a previous version of @code{mpfr_gamma}.
+Laurent Fousse contributed the @code{mpfr_sum} function.
+Emmanuel Jeandel, from ENS-Lyon too,
+contributed the generic hypergeometric code,
+as well as the internal function @code{mpfr_exp3},
+a first implementation of the sine and cosine,
+and improved versions of
+@code{mpfr_const_log2} and @code{mpfr_const_pi}.
+Ludovic Meunier helped in the design of the @code{mpfr_erf} code.
+Jean-Luc R@'emy contributed the @code{mpfr_zeta} code.
+Fabrice Rouillier contributed the @code{mpfr_xxx_z} and @code{mpfr_xxx_q}
+functions, and helped to the Microsoft Windows porting.
+Damien Stehl@'e contributed the @code{mpfr_get_ld_2exp} function.
+
+We would like to thank Jean-Michel Muller and Joris van der Hoeven for very
+fruitful discussions at the beginning of that project, Torbj@"orn Granlund
+and Kevin Ryde for their help about design issues,
+and Nathalie Revol for her careful reading of a previous version of
+this documentation. In particular
+Kevin Ryde did a tremendous job for the portability of MPFR in 2002-2004.
+
+The development of the MPFR library would not have been possible without
+the continuous support of INRIA, and of the LORIA (Nancy, France) and LIP
+(Lyon, France) laboratories. In particular the main authors were or are
+members of the PolKA, Spaces, Cacao and Caramel
+project-teams at LORIA and of the
+Ar@'enaire and AriC project-teams at LIP.
+This project was started during the Fiable (reliable in French) action
+supported by INRIA, and continued during the AOC action.
+The development of MPFR was also supported by a grant
+(202F0659 00 MPN 121) from the Conseil R@'egional de Lorraine in 2002,
+from INRIA by an "associate engineer" grant (2003-2005),
+an "op@'eration de d@'eveloppement logiciel" grant (2007-2009),
+and the post-doctoral grant of Sylvain Chevillard in 2009-2010.
+The MPFR-MPC workshop in June 2012 was partly supported by the ERC
+grant ANTICS of Andreas Enge.
+
+@node References, GNU Free Documentation License, Contributors, Top
+@comment node-name, next, previous, up
+@unnumbered References
+
+@itemize @bullet
+
+@item
+Richard Brent and Paul Zimmermann,
+"Modern Computer Arithmetic",
+Cambridge University Press (to appear),
+also available from the authors' web pages.
+
+@item
+Laurent Fousse, Guillaume Hanrot, Vincent Lef@`evre,
+Patrick P@'elissier and Paul Zimmermann,
+"MPFR: A Multiple-Precision Binary Floating-Point Library With Correct Rounding",
+ACM Transactions on Mathematical Software,
+volume 33, issue 2, article 13, 15 pages, 2007,
+@url{http://doi.acm.org/10.1145/1236463.1236468}.
+
+@item
+Torbj@"orn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic Library",
+ version 5.0.1, 2010, @url{http://gmplib.org}.
+
+@item
+IEEE standard for binary floating-point arithmetic, Technical Report
+ANSI-IEEE Standard 754-1985, New York, 1985.
+Approved March 21, 1985: IEEE Standards Board; approved July 26,
+ 1985: American National Standards Institute, 18 pages.
+
+@item
+IEEE Standard for Floating-Point Arithmetic,
+ANSI-IEEE Standard 754-2008, 2008.
+Revision of ANSI-IEEE Standard 754-1985,
+approved June 12, 2008: IEEE Standards Board, 70 pages.
+
+@item
+Donald E. Knuth, "The Art of Computer Programming", vol 2,
+"Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981.
+
+@item
+Jean-Michel Muller, "Elementary Functions, Algorithms and Implementation",
+Birkh@"auser, Boston, 2nd edition, 2006.
+
+@item
+Jean-Michel Muller, Nicolas Brisebarre, Florent de Dinechin,
+Claude-Pierre Jeannerod, Vincent Lef@`evre, Guillaume Melquiond,
+Nathalie Revol, Damien Stehl@'e and Serge Torr@`es,
+"Handbook of Floating-Point Arithmetic",
+Birkh@"auser, Boston, 2009.
+
+@end itemize
+
+
+@node GNU Free Documentation License, Concept Index, References, Top
+@appendix GNU Free Documentation License
+@cindex GNU Free Documentation License
+@include fdl.texi
+
+
+@node Concept Index, Function and Type Index, GNU Free Documentation License, Top
+@comment node-name, next, previous, up
+@unnumbered Concept Index
+@printindex cp
+
+@node Function and Type Index, , Concept Index, Top
+@comment node-name, next, previous, up
+@unnumbered Function and Type Index
+@printindex fn
+
+@bye
+
+@c Local variables:
+@c fill-column: 78
+@c End:
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
new file mode 100644
index 0000000..85b68e7
--- /dev/null
+++ b/doc/texinfo.tex
@@ -0,0 +1,9977 @@
+% texinfo.tex -- TeX macros to handle Texinfo files.
+%
+% Load plain if necessary, i.e., if running under initex.
+\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
+%
+\def\texinfoversion{2012-03-11.15}
+%
+% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+%
+% This texinfo.tex file 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.
+%
+% This texinfo.tex file 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.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+% As a special exception, when this file is read by TeX when processing
+% a Texinfo source document, you may use the result without
+% restriction. (This has been our intent since Texinfo was invented.)
+%
+% Please try the latest version of texinfo.tex before submitting bug
+% reports; you can get the latest version from:
+% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
+% ftp://tug.org/tex/texinfo.tex
+% (and all CTAN mirrors, see http://www.ctan.org).
+% The texinfo.tex in any given distribution could well be out
+% of date, so if that's what you're using, please check.
+%
+% Send bug reports to bug-texinfo@gnu.org. Please include including a
+% complete document in each bug report with which we can reproduce the
+% problem. Patches are, of course, greatly appreciated.
+%
+% To process a Texinfo manual with TeX, it's most reliable to use the
+% texi2dvi shell script that comes with the distribution. For a simple
+% manual foo.texi, however, you can get away with this:
+% tex foo.texi
+% texindex foo.??
+% tex foo.texi
+% tex foo.texi
+% dvips foo.dvi -o # or whatever; this makes foo.ps.
+% The extra TeX runs get the cross-reference information correct.
+% Sometimes one run after texindex suffices, and sometimes you need more
+% than two; texi2dvi does it as many times as necessary.
+%
+% It is possible to adapt texinfo.tex for other languages, to some
+% extent. You can get the existing language-specific files from the
+% full Texinfo distribution.
+%
+% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
+
+
+\message{Loading texinfo [version \texinfoversion]:}
+
+% If in a .fmt file, print the version number
+% and turn on active characters that we couldn't do earlier because
+% they might have appeared in the input file name.
+\everyjob{\message{[Texinfo version \texinfoversion]}%
+ \catcode`+=\active \catcode`\_=\active}
+
+\chardef\other=12
+
+% We never want plain's \outer definition of \+ in Texinfo.
+% For @tex, we can use \tabalign.
+\let\+ = \relax
+
+% Save some plain tex macros whose names we will redefine.
+\let\ptexb=\b
+\let\ptexbullet=\bullet
+\let\ptexc=\c
+\let\ptexcomma=\,
+\let\ptexdot=\.
+\let\ptexdots=\dots
+\let\ptexend=\end
+\let\ptexequiv=\equiv
+\let\ptexexclam=\!
+\let\ptexfootnote=\footnote
+\let\ptexgtr=>
+\let\ptexhat=^
+\let\ptexi=\i
+\let\ptexindent=\indent
+\let\ptexinsert=\insert
+\let\ptexlbrace=\{
+\let\ptexless=<
+\let\ptexnewwrite\newwrite
+\let\ptexnoindent=\noindent
+\let\ptexplus=+
+\let\ptexraggedright=\raggedright
+\let\ptexrbrace=\}
+\let\ptexslash=\/
+\let\ptexstar=\*
+\let\ptext=\t
+\let\ptextop=\top
+{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
+
+% If this character appears in an error message or help string, it
+% starts a new line in the output.
+\newlinechar = `^^J
+
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+ \let\linenumber = \empty % Pre-3.0.
+\else
+ \def\linenumber{l.\the\inputlineno:\space}
+\fi
+
+% Set up fixed words for English if not already set.
+\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
+\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
+\ifx\putworderror\undefined \gdef\putworderror{error}\fi
+\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
+\ifx\putwordin\undefined \gdef\putwordin{in}\fi
+\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
+\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
+\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
+\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
+\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
+\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
+\ifx\putwordof\undefined \gdef\putwordof{of}\fi
+\ifx\putwordon\undefined \gdef\putwordon{on}\fi
+\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
+\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
+\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
+\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
+\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
+\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
+\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
+%
+\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
+\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
+\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
+\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
+\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
+\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
+\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
+\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
+\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
+\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
+\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
+\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
+%
+\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
+\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
+\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
+\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
+\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
+
+% Since the category of space is not known, we have to be careful.
+\chardef\spacecat = 10
+\def\spaceisspace{\catcode`\ =\spacecat}
+
+% sometimes characters are active, so we need control sequences.
+\chardef\ampChar = `\&
+\chardef\colonChar = `\:
+\chardef\commaChar = `\,
+\chardef\dashChar = `\-
+\chardef\dotChar = `\.
+\chardef\exclamChar= `\!
+\chardef\hashChar = `\#
+\chardef\lquoteChar= `\`
+\chardef\questChar = `\?
+\chardef\rquoteChar= `\'
+\chardef\semiChar = `\;
+\chardef\slashChar = `\/
+\chardef\underChar = `\_
+
+% Ignore a token.
+%
+\def\gobble#1{}
+
+% The following is used inside several \edef's.
+\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
+
+% Hyphenation fixes.
+\hyphenation{
+ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
+ ap-pen-dix bit-map bit-maps
+ data-base data-bases eshell fall-ing half-way long-est man-u-script
+ man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
+ par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
+ spell-ing spell-ings
+ stand-alone strong-est time-stamp time-stamps which-ever white-space
+ wide-spread wrap-around
+}
+
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen\bindingoffset
+\newdimen\normaloffset
+\newdimen\pagewidth \newdimen\pageheight
+
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt }
+
+% Sometimes it is convenient to have everything in the transcript file
+% and nothing on the terminal. We don't just call \tracingall here,
+% since that produces some useless output on the terminal. We also make
+% some effort to order the tracing commands to reduce output in the log
+% file; cf. trace.sty in LaTeX.
+%
+\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
+\def\loggingall{%
+ \tracingstats2
+ \tracingpages1
+ \tracinglostchars2 % 2 gives us more in etex
+ \tracingparagraphs1
+ \tracingoutput1
+ \tracingmacros2
+ \tracingrestores1
+ \showboxbreadth\maxdimen \showboxdepth\maxdimen
+ \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
+ \tracingscantokens1
+ \tracingifs1
+ \tracinggroups1
+ \tracingnesting2
+ \tracingassigns1
+ \fi
+ \tracingcommands3 % 3 gives us more in etex
+ \errorcontextlines16
+}%
+
+% @errormsg{MSG}. Do the index-like expansions on MSG, but if things
+% aren't perfect, it's not the end of the world, being an error message,
+% after all.
+%
+\def\errormsg{\begingroup \indexnofonts \doerrormsg}
+\def\doerrormsg#1{\errmessage{#1}}
+
+% add check for \lastpenalty to plain's definitions. If the last thing
+% we did was a \nobreak, we don't want to insert more space.
+%
+\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
+ \removelastskip\penalty-50\smallskip\fi\fi}
+\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
+ \removelastskip\penalty-100\medskip\fi\fi}
+\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
+ \removelastskip\penalty-200\bigskip\fi\fi}
+
+% Do @cropmarks to get crop marks.
+%
+\newif\ifcropmarks
+\let\cropmarks = \cropmarkstrue
+%
+% Dimensions to add cropmarks at corners.
+% Added by P. A. MacKay, 12 Nov. 1986
+%
+\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
+\newdimen\cornerlong \cornerlong=1pc
+\newdimen\cornerthick \cornerthick=.3pt
+\newdimen\topandbottommargin \topandbottommargin=.75in
+
+% Output a mark which sets \thischapter, \thissection and \thiscolor.
+% We dump everything together because we only have one kind of mark.
+% This works because we only use \botmark / \topmark, not \firstmark.
+%
+% A mark contains a subexpression of the \ifcase ... \fi construct.
+% \get*marks macros below extract the needed part using \ifcase.
+%
+% Another complication is to let the user choose whether \thischapter
+% (\thissection) refers to the chapter (section) in effect at the top
+% of a page, or that at the bottom of a page. The solution is
+% described on page 260 of The TeXbook. It involves outputting two
+% marks for the sectioning macros, one before the section break, and
+% one after. I won't pretend I can describe this better than DEK...
+\def\domark{%
+ \toks0=\expandafter{\lastchapterdefs}%
+ \toks2=\expandafter{\lastsectiondefs}%
+ \toks4=\expandafter{\prevchapterdefs}%
+ \toks6=\expandafter{\prevsectiondefs}%
+ \toks8=\expandafter{\lastcolordefs}%
+ \mark{%
+ \the\toks0 \the\toks2
+ \noexpand\or \the\toks4 \the\toks6
+ \noexpand\else \the\toks8
+ }%
+}
+% \topmark doesn't work for the very first chapter (after the title
+% page or the contents), so we use \firstmark there -- this gets us
+% the mark with the chapter defs, unless the user sneaks in, e.g.,
+% @setcolor (or @url, or @link, etc.) between @contents and the very
+% first @chapter.
+\def\gettopheadingmarks{%
+ \ifcase0\topmark\fi
+ \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
+}
+\def\getbottomheadingmarks{\ifcase1\botmark\fi}
+\def\getcolormarks{\ifcase2\topmark\fi}
+
+% Avoid "undefined control sequence" errors.
+\def\lastchapterdefs{}
+\def\lastsectiondefs{}
+\def\prevchapterdefs{}
+\def\prevsectiondefs{}
+\def\lastcolordefs{}
+
+% Main output routine.
+\chardef\PAGE = 255
+\output = {\onepageout{\pagecontents\PAGE}}
+
+\newbox\headlinebox
+\newbox\footlinebox
+
+% \onepageout takes a vbox as an argument. Note that \pagecontents
+% does insertions, but you have to call it yourself.
+\def\onepageout#1{%
+ \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
+ %
+ \ifodd\pageno \advance\hoffset by \bindingoffset
+ \else \advance\hoffset by -\bindingoffset\fi
+ %
+ % Do this outside of the \shipout so @code etc. will be expanded in
+ % the headline as they should be, not taken literally (outputting ''code).
+ \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
+ \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
+ \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
+ \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
+ %
+ {%
+ % Have to do this stuff outside the \shipout because we want it to
+ % take effect in \write's, yet the group defined by the \vbox ends
+ % before the \shipout runs.
+ %
+ \indexdummies % don't expand commands in the output.
+ \normalturnoffactive % \ in index entries must not stay \, e.g., if
+ % the page break happens to be in the middle of an example.
+ % We don't want .vr (or whatever) entries like this:
+ % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
+ % "\acronym" won't work when it's read back in;
+ % it needs to be
+ % {\code {{\tt \backslashcurfont }acronym}
+ \shipout\vbox{%
+ % Do this early so pdf references go to the beginning of the page.
+ \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
+ %
+ \ifcropmarks \vbox to \outervsize\bgroup
+ \hsize = \outerhsize
+ \vskip-\topandbottommargin
+ \vtop to0pt{%
+ \line{\ewtop\hfil\ewtop}%
+ \nointerlineskip
+ \line{%
+ \vbox{\moveleft\cornerthick\nstop}%
+ \hfill
+ \vbox{\moveright\cornerthick\nstop}%
+ }%
+ \vss}%
+ \vskip\topandbottommargin
+ \line\bgroup
+ \hfil % center the page within the outer (page) hsize.
+ \ifodd\pageno\hskip\bindingoffset\fi
+ \vbox\bgroup
+ \fi
+ %
+ \unvbox\headlinebox
+ \pagebody{#1}%
+ \ifdim\ht\footlinebox > 0pt
+ % Only leave this space if the footline is nonempty.
+ % (We lessened \vsize for it in \oddfootingyyy.)
+ % The \baselineskip=24pt in plain's \makefootline has no effect.
+ \vskip 24pt
+ \unvbox\footlinebox
+ \fi
+ %
+ \ifcropmarks
+ \egroup % end of \vbox\bgroup
+ \hfil\egroup % end of (centering) \line\bgroup
+ \vskip\topandbottommargin plus1fill minus1fill
+ \boxmaxdepth = \cornerthick
+ \vbox to0pt{\vss
+ \line{%
+ \vbox{\moveleft\cornerthick\nsbot}%
+ \hfill
+ \vbox{\moveright\cornerthick\nsbot}%
+ }%
+ \nointerlineskip
+ \line{\ewbot\hfil\ewbot}%
+ }%
+ \egroup % \vbox from first cropmarks clause
+ \fi
+ }% end of \shipout\vbox
+ }% end of group with \indexdummies
+ \advancepageno
+ \ifnum\outputpenalty>-20000 \else\dosupereject\fi
+}
+
+\newinsert\margin \dimen\margin=\maxdimen
+
+\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+{\catcode`\@ =11
+\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
+% marginal hacks, juha@viisa.uucp (Juha Takala)
+\ifvoid\margin\else % marginal info is present
+ \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
+\dimen@=\dp#1\relax \unvbox#1\relax
+\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
+\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
+}
+
+% Here are the rules for the cropmarks. Note that they are
+% offset so that the space between them is truly \outerhsize or \outervsize
+% (P. A. MacKay, 12 November, 1986)
+%
+\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
+\def\nstop{\vbox
+ {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
+\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
+\def\nsbot{\vbox
+ {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
+
+% Parse an argument, then pass it to #1. The argument is the rest of
+% the input line (except we remove a trailing comment). #1 should be a
+% macro which expects an ordinary undelimited TeX argument.
+%
+\def\parsearg{\parseargusing{}}
+\def\parseargusing#1#2{%
+ \def\argtorun{#2}%
+ \begingroup
+ \obeylines
+ \spaceisspace
+ #1%
+ \parseargline\empty% Insert the \empty token, see \finishparsearg below.
+}
+
+{\obeylines %
+ \gdef\parseargline#1^^M{%
+ \endgroup % End of the group started in \parsearg.
+ \argremovecomment #1\comment\ArgTerm%
+ }%
+}
+
+% First remove any @comment, then any @c comment.
+\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+
+% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
+%
+% \argremovec might leave us with trailing space, e.g.,
+% @end itemize @c foo
+% This space token undergoes the same procedure and is eventually removed
+% by \finishparsearg.
+%
+\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
+\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
+\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
+ \def\temp{#3}%
+ \ifx\temp\empty
+ % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
+ \let\temp\finishparsearg
+ \else
+ \let\temp\argcheckspaces
+ \fi
+ % Put the space token in:
+ \temp#1 #3\ArgTerm
+}
+
+% If a _delimited_ argument is enclosed in braces, they get stripped; so
+% to get _exactly_ the rest of the line, we had to prevent such situation.
+% We prepended an \empty token at the very beginning and we expand it now,
+% just before passing the control to \argtorun.
+% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
+% either the null string, or it ends with \^^M---thus there is no danger
+% that a pair of braces would be stripped.
+%
+% But first, we have to remove the trailing space token.
+%
+\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
+
+% \parseargdef\foo{...}
+% is roughly equivalent to
+% \def\foo{\parsearg\Xfoo}
+% \def\Xfoo#1{...}
+%
+% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
+% favourite TeX trick. --kasal, 16nov03
+
+\def\parseargdef#1{%
+ \expandafter \doparseargdef \csname\string#1\endcsname #1%
+}
+\def\doparseargdef#1#2{%
+ \def#2{\parsearg#1}%
+ \def#1##1%
+}
+
+% Several utility definitions with active space:
+{
+ \obeyspaces
+ \gdef\obeyedspace{ }
+
+ % Make each space character in the input produce a normal interword
+ % space in the output. Don't allow a line break at this space, as this
+ % is used only in environments like @example, where each line of input
+ % should produce a line of output anyway.
+ %
+ \gdef\sepspaces{\obeyspaces\let =\tie}
+
+ % If an index command is used in an @example environment, any spaces
+ % therein should become regular spaces in the raw index file, not the
+ % expansion of \tie (\leavevmode \penalty \@M \ ).
+ \gdef\unsepspaces{\let =\space}
+}
+
+
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+
+% Define the framework for environments in texinfo.tex. It's used like this:
+%
+% \envdef\foo{...}
+% \def\Efoo{...}
+%
+% It's the responsibility of \envdef to insert \begingroup before the
+% actual body; @end closes the group after calling \Efoo. \envdef also
+% defines \thisenv, so the current environment is known; @end checks
+% whether the environment name matches. The \checkenv macro can also be
+% used to check whether the current environment is the one expected.
+%
+% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
+% are not treated as environments; they don't open a group. (The
+% implementation of @end takes care not to call \endgroup in this
+% special case.)
+
+
+% At run-time, environments start with this:
+\def\startenvironment#1{\begingroup\def\thisenv{#1}}
+% initialize
+\let\thisenv\empty
+
+% ... but they get defined via ``\envdef\foo{...}'':
+\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
+\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
+
+% Check whether we're in the right environment:
+\def\checkenv#1{%
+ \def\temp{#1}%
+ \ifx\thisenv\temp
+ \else
+ \badenverr
+ \fi
+}
+
+% Environment mismatch, #1 expected:
+\def\badenverr{%
+ \errhelp = \EMsimple
+ \errmessage{This command can appear only \inenvironment\temp,
+ not \inenvironment\thisenv}%
+}
+\def\inenvironment#1{%
+ \ifx#1\empty
+ outside of any environment%
+ \else
+ in environment \expandafter\string#1%
+ \fi
+}
+
+% @end foo executes the definition of \Efoo.
+% But first, it executes a specialized version of \checkenv
+%
+\parseargdef\end{%
+ \if 1\csname iscond.#1\endcsname
+ \else
+ % The general wording of \badenverr may not be ideal.
+ \expandafter\checkenv\csname#1\endcsname
+ \csname E#1\endcsname
+ \endgroup
+ \fi
+}
+
+\newhelp\EMsimple{Press RETURN to continue.}
+
+
+% Be sure we're in horizontal mode when doing a tie, since we make space
+% equivalent to this in @example-like environments. Otherwise, a space
+% at the beginning of a line will start with \penalty -- and
+% since \penalty is valid in vertical mode, we'd end up putting the
+% penalty on the vertical list instead of in the new paragraph.
+{\catcode`@ = 11
+ % Avoid using \@M directly, because that causes trouble
+ % if the definition is written into an index file.
+ \global\let\tiepenalty = \@M
+ \gdef\tie{\leavevmode\penalty\tiepenalty\ }
+}
+
+% @: forces normal size whitespace following.
+\def\:{\spacefactor=1000 }
+
+% @* forces a line break.
+\def\*{\hfil\break\hbox{}\ignorespaces}
+
+% @/ allows a line break.
+\let\/=\allowbreak
+
+% @. is an end-of-sentence period.
+\def\.{.\spacefactor=\endofsentencespacefactor\space}
+
+% @! is an end-of-sentence bang.
+\def\!{!\spacefactor=\endofsentencespacefactor\space}
+
+% @? is an end-of-sentence query.
+\def\?{?\spacefactor=\endofsentencespacefactor\space}
+
+% @frenchspacing on|off says whether to put extra space after punctuation.
+%
+\def\onword{on}
+\def\offword{off}
+%
+\parseargdef\frenchspacing{%
+ \def\temp{#1}%
+ \ifx\temp\onword \plainfrenchspacing
+ \else\ifx\temp\offword \plainnonfrenchspacing
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
+ \fi\fi
+}
+
+% @w prevents a word break. Without the \leavevmode, @w at the
+% beginning of a paragraph, when TeX is still in vertical mode, would
+% produce a whole line of output instead of starting the paragraph.
+\def\w#1{\leavevmode\hbox{#1}}
+
+% @group ... @end group forces ... to be all on one page, by enclosing
+% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
+% to keep its height that of a normal line. According to the rules for
+% \topskip (p.114 of the TeXbook), the glue inserted is
+% max (\topskip - \ht (first item), 0). If that height is large,
+% therefore, no glue is inserted, and the space between the headline and
+% the text is small, which looks bad.
+%
+% Another complication is that the group might be very large. This can
+% cause the glue on the previous page to be unduly stretched, because it
+% does not have much material. In this case, it's better to add an
+% explicit \vfill so that the extra space is at the bottom. The
+% threshold for doing this is if the group is more than \vfilllimit
+% percent of a page (\vfilllimit can be changed inside of @tex).
+%
+\newbox\groupbox
+\def\vfilllimit{0.7}
+%
+\envdef\group{%
+ \ifnum\catcode`\^^M=\active \else
+ \errhelp = \groupinvalidhelp
+ \errmessage{@group invalid in context where filling is enabled}%
+ \fi
+ \startsavinginserts
+ %
+ \setbox\groupbox = \vtop\bgroup
+ % Do @comment since we are called inside an environment such as
+ % @example, where each end-of-line in the input causes an
+ % end-of-line in the output. We don't want the end-of-line after
+ % the `@group' to put extra space in the output. Since @group
+ % should appear on a line by itself (according to the Texinfo
+ % manual), we don't worry about eating any user text.
+ \comment
+}
+%
+% The \vtop produces a box with normal height and large depth; thus, TeX puts
+% \baselineskip glue before it, and (when the next line of text is done)
+% \lineskip glue after it. Thus, space below is not quite equal to space
+% above. But it's pretty close.
+\def\Egroup{%
+ % To get correct interline space between the last line of the group
+ % and the first line afterwards, we have to propagate \prevdepth.
+ \endgraf % Not \par, as it may have been set to \lisppar.
+ \global\dimen1 = \prevdepth
+ \egroup % End the \vtop.
+ % \dimen0 is the vertical size of the group's box.
+ \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
+ % \dimen2 is how much space is left on the page (more or less).
+ \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
+ % if the group doesn't fit on the current page, and it's a big big
+ % group, force a page break.
+ \ifdim \dimen0 > \dimen2
+ \ifdim \pagetotal < \vfilllimit\pageheight
+ \page
+ \fi
+ \fi
+ \box\groupbox
+ \prevdepth = \dimen1
+ \checkinserts
+}
+%
+% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
+% message, so this ends up printing `@group can only ...'.
+%
+\newhelp\groupinvalidhelp{%
+group can only be used in environments such as @example,^^J%
+where each line of input produces a line of output.}
+
+% @need space-in-mils
+% forces a page break if there is not space-in-mils remaining.
+
+\newdimen\mil \mil=0.001in
+
+\parseargdef\need{%
+ % Ensure vertical mode, so we don't make a big box in the middle of a
+ % paragraph.
+ \par
+ %
+ % If the @need value is less than one line space, it's useless.
+ \dimen0 = #1\mil
+ \dimen2 = \ht\strutbox
+ \advance\dimen2 by \dp\strutbox
+ \ifdim\dimen0 > \dimen2
+ %
+ % Do a \strut just to make the height of this box be normal, so the
+ % normal leading is inserted relative to the preceding line.
+ % And a page break here is fine.
+ \vtop to #1\mil{\strut\vfil}%
+ %
+ % TeX does not even consider page breaks if a penalty added to the
+ % main vertical list is 10000 or more. But in order to see if the
+ % empty box we just added fits on the page, we must make it consider
+ % page breaks. On the other hand, we don't want to actually break the
+ % page after the empty box. So we use a penalty of 9999.
+ %
+ % There is an extremely small chance that TeX will actually break the
+ % page at this \penalty, if there are no other feasible breakpoints in
+ % sight. (If the user is using lots of big @group commands, which
+ % almost-but-not-quite fill up a page, TeX will have a hard time doing
+ % good page breaking, for example.) However, I could not construct an
+ % example where a page broke at this \penalty; if it happens in a real
+ % document, then we can reconsider our strategy.
+ \penalty9999
+ %
+ % Back up by the size of the box, whether we did a page break or not.
+ \kern -#1\mil
+ %
+ % Do not allow a page break right after this kern.
+ \nobreak
+ \fi
+}
+
+% @br forces paragraph break (and is undocumented).
+
+\let\br = \par
+
+% @page forces the start of a new page.
+%
+\def\page{\par\vfill\supereject}
+
+% @exdent text....
+% outputs text on separate line in roman font, starting at standard page margin
+
+% This records the amount of indent in the innermost environment.
+% That's how much \exdent should take out.
+\newskip\exdentamount
+
+% This defn is used inside fill environments such as @defun.
+\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
+
+% This defn is used inside nofill environments such as @example.
+\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
+ \leftline{\hskip\leftskip{\rm#1}}}}
+
+% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
+% paragraph. For more general purposes, use the \margin insertion
+% class. WHICH is `l' or `r'. Not documented, written for gawk manual.
+%
+\newskip\inmarginspacing \inmarginspacing=1cm
+\def\strutdepth{\dp\strutbox}
+%
+\def\doinmargin#1#2{\strut\vadjust{%
+ \nobreak
+ \kern-\strutdepth
+ \vtop to \strutdepth{%
+ \baselineskip=\strutdepth
+ \vss
+ % if you have multiple lines of stuff to put here, you'll need to
+ % make the vbox yourself of the appropriate size.
+ \ifx#1l%
+ \llap{\ignorespaces #2\hskip\inmarginspacing}%
+ \else
+ \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
+ \fi
+ \null
+ }%
+}}
+\def\inleftmargin{\doinmargin l}
+\def\inrightmargin{\doinmargin r}
+%
+% @inmargin{TEXT [, RIGHT-TEXT]}
+% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
+% else use TEXT for both).
+%
+\def\inmargin#1{\parseinmargin #1,,\finish}
+\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \def\lefttext{#1}% have both texts
+ \def\righttext{#2}%
+ \else
+ \def\lefttext{#1}% have only one text
+ \def\righttext{#1}%
+ \fi
+ %
+ \ifodd\pageno
+ \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
+ \else
+ \def\temp{\inleftmargin\lefttext}%
+ \fi
+ \temp
+}
+
+% @| inserts a changebar to the left of the current line. It should
+% surround any changed text. This approach does *not* work if the
+% change spans more than two lines of output. To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change). This command
+% is not documented, not supported, and doesn't work.
+%
+\def\|{%
+ % \vadjust can only be used in horizontal mode.
+ \leavevmode
+ %
+ % Append this vertical mode material after the current line in the output.
+ \vadjust{%
+ % We want to insert a rule with the height and depth of the current
+ % leading; that is exactly what \strutbox is supposed to record.
+ \vskip-\baselineskip
+ %
+ % \vadjust-items are inserted at the left edge of the type. So
+ % the \llap here moves out into the left-hand margin.
+ \llap{%
+ %
+ % For a thicker or thinner bar, change the `1pt'.
+ \vrule height\baselineskip width1pt
+ %
+ % This is the space between the bar and the text.
+ \hskip 12pt
+ }%
+ }%
+}
+
+% @include FILE -- \input text of FILE.
+%
+\def\include{\parseargusing\filenamecatcodes\includezzz}
+\def\includezzz#1{%
+ \pushthisfilestack
+ \def\thisfile{#1}%
+ {%
+ \makevalueexpandable % we want to expand any @value in FILE.
+ \turnoffactive % and allow special characters in the expansion
+ \indexnofonts % Allow `@@' and other weird things in file names.
+ \wlog{texinfo.tex: doing @include of #1^^J}%
+ \edef\temp{\noexpand\input #1 }%
+ %
+ % This trickery is to read FILE outside of a group, in case it makes
+ % definitions, etc.
+ \expandafter
+ }\temp
+ \popthisfilestack
+}
+\def\filenamecatcodes{%
+ \catcode`\\=\other
+ \catcode`~=\other
+ \catcode`^=\other
+ \catcode`_=\other
+ \catcode`|=\other
+ \catcode`<=\other
+ \catcode`>=\other
+ \catcode`+=\other
+ \catcode`-=\other
+ \catcode`\`=\other
+ \catcode`\'=\other
+}
+
+\def\pushthisfilestack{%
+ \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
+}
+\def\pushthisfilestackX{%
+ \expandafter\pushthisfilestackY\thisfile\StackTerm
+}
+\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
+ \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
+}
+
+\def\popthisfilestack{\errthisfilestackempty}
+\def\errthisfilestackempty{\errmessage{Internal error:
+ the stack of filenames is empty.}}
+%
+\def\thisfile{}
+
+% @center line
+% outputs that line, centered.
+%
+\parseargdef\center{%
+ \ifhmode
+ \let\centersub\centerH
+ \else
+ \let\centersub\centerV
+ \fi
+ \centersub{\hfil \ignorespaces#1\unskip \hfil}%
+ \let\centersub\relax % don't let the definition persist, just in case
+}
+\def\centerH#1{{%
+ \hfil\break
+ \advance\hsize by -\leftskip
+ \advance\hsize by -\rightskip
+ \line{#1}%
+ \break
+}}
+%
+\newcount\centerpenalty
+\def\centerV#1{%
+ % The idea here is the same as in \startdefun, \cartouche, etc.: if
+ % @center is the first thing after a section heading, we need to wipe
+ % out the negative parskip inserted by \sectionheading, but still
+ % prevent a page break here.
+ \centerpenalty = \lastpenalty
+ \ifnum\centerpenalty>10000 \vskip\parskip \fi
+ \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
+ \line{\kern\leftskip #1\kern\rightskip}%
+}
+
+% @sp n outputs n lines of vertical space
+%
+\parseargdef\sp{\vskip #1\baselineskip}
+
+% @comment ...line which is ignored...
+% @c is the same as @comment
+% @ignore ... @end ignore is another way to write a comment
+%
+\def\comment{\begingroup \catcode`\^^M=\other%
+\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
+\commentxxx}
+{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
+%
+\let\c=\comment
+
+% @paragraphindent NCHARS
+% We'll use ems for NCHARS, close enough.
+% NCHARS can also be the word `asis' or `none'.
+% We cannot feasibly implement @paragraphindent asis, though.
+%
+\def\asisword{asis} % no translation, these are keywords
+\def\noneword{none}
+%
+\parseargdef\paragraphindent{%
+ \def\temp{#1}%
+ \ifx\temp\asisword
+ \else
+ \ifx\temp\noneword
+ \defaultparindent = 0pt
+ \else
+ \defaultparindent = #1em
+ \fi
+ \fi
+ \parindent = \defaultparindent
+}
+
+% @exampleindent NCHARS
+% We'll use ems for NCHARS like @paragraphindent.
+% It seems @exampleindent asis isn't necessary, but
+% I preserve it to make it similar to @paragraphindent.
+\parseargdef\exampleindent{%
+ \def\temp{#1}%
+ \ifx\temp\asisword
+ \else
+ \ifx\temp\noneword
+ \lispnarrowing = 0pt
+ \else
+ \lispnarrowing = #1em
+ \fi
+ \fi
+}
+
+% @firstparagraphindent WORD
+% If WORD is `none', then suppress indentation of the first paragraph
+% after a section heading. If WORD is `insert', then do indent at such
+% paragraphs.
+%
+% The paragraph indentation is suppressed or not by calling
+% \suppressfirstparagraphindent, which the sectioning commands do.
+% We switch the definition of this back and forth according to WORD.
+% By default, we suppress indentation.
+%
+\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
+\def\insertword{insert}
+%
+\parseargdef\firstparagraphindent{%
+ \def\temp{#1}%
+ \ifx\temp\noneword
+ \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
+ \else\ifx\temp\insertword
+ \let\suppressfirstparagraphindent = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @firstparagraphindent option `\temp'}%
+ \fi\fi
+}
+
+% Here is how we actually suppress indentation. Redefine \everypar to
+% \kern backwards by \parindent, and then reset itself to empty.
+%
+% We also make \indent itself not actually do anything until the next
+% paragraph.
+%
+\gdef\dosuppressfirstparagraphindent{%
+ \gdef\indent{%
+ \restorefirstparagraphindent
+ \indent
+ }%
+ \gdef\noindent{%
+ \restorefirstparagraphindent
+ \noindent
+ }%
+ \global\everypar = {%
+ \kern -\parindent
+ \restorefirstparagraphindent
+ }%
+}
+
+\gdef\restorefirstparagraphindent{%
+ \global \let \indent = \ptexindent
+ \global \let \noindent = \ptexnoindent
+ \global \everypar = {}%
+}
+
+
+% @refill is a no-op.
+\let\refill=\relax
+
+% If working on a large document in chapters, it is convenient to
+% be able to disable indexing, cross-referencing, and contents, for test runs.
+% This is done with @novalidate (before @setfilename).
+%
+\newif\iflinks \linkstrue % by default we want the aux files.
+\let\novalidate = \linksfalse
+
+% @setfilename is done at the beginning of every texinfo file.
+% So open here the files we need to have open while reading the input.
+% This makes it possible to make a .fmt file for texinfo.
+\def\setfilename{%
+ \fixbackslash % Turn off hack to swallow `\input texinfo'.
+ \iflinks
+ \tryauxfile
+ % Open the new aux file. TeX will close it automatically at exit.
+ \immediate\openout\auxfile=\jobname.aux
+ \fi % \openindices needs to do some work in any case.
+ \openindices
+ \let\setfilename=\comment % Ignore extra @setfilename cmds.
+ %
+ % If texinfo.cnf is present on the system, read it.
+ % Useful for site-wide @afourpaper, etc.
+ \openin 1 texinfo.cnf
+ \ifeof 1 \else \input texinfo.cnf \fi
+ \closein 1
+ %
+ \comment % Ignore the actual filename.
+}
+
+% Called from \setfilename.
+%
+\def\openindices{%
+ \newindex{cp}%
+ \newcodeindex{fn}%
+ \newcodeindex{vr}%
+ \newcodeindex{tp}%
+ \newcodeindex{ky}%
+ \newcodeindex{pg}%
+}
+
+% @bye.
+\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
+
+
+\message{pdf,}
+% adobe `portable' document format
+\newcount\tempnum
+\newcount\lnkcount
+\newtoks\filename
+\newcount\filenamelength
+\newcount\pgn
+\newtoks\toksA
+\newtoks\toksB
+\newtoks\toksC
+\newtoks\toksD
+\newbox\boxA
+\newcount\countA
+\newif\ifpdf
+\newif\ifpdfmakepagedest
+
+% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
+% can be set). So we test for \relax and 0 as well as being undefined.
+\ifx\pdfoutput\thisisundefined
+\else
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+\fi
+
+% PDF uses PostScript string constants for the names of xref targets,
+% for display in the outlines, and in other places. Thus, we have to
+% double any backslashes. Otherwise, a name like "\node" will be
+% interpreted as a newline (\n), followed by o, d, e. Not good.
+%
+% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
+% related messages. The final outcome is that it is up to the TeX user
+% to double the backslashes and otherwise make the string valid, so
+% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
+% do this reliably, so we use it.
+
+% #1 is a control sequence in which to do the replacements,
+% which we \xdef.
+\def\txiescapepdf#1{%
+ \ifx\pdfescapestring\relax
+ % No primitive available; should we give a warning or log?
+ % Many times it won't matter.
+ \else
+ % The expandable \pdfescapestring primitive escapes parentheses,
+ % backslashes, and other special chars.
+ \xdef#1{\pdfescapestring{#1}}%
+ \fi
+}
+
+\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
+with PDF output, and none of those formats could be found. (.eps cannot
+be supported due to the design of the PDF format; use regular TeX (DVI
+output) for that.)}
+
+\ifpdf
+ %
+ % Color manipulation macros based on pdfcolor.tex,
+ % except using rgb instead of cmyk; the latter is said to render as a
+ % very dark gray on-screen and a very dark halftone in print, instead
+ % of actual black.
+ \def\rgbDarkRed{0.50 0.09 0.12}
+ \def\rgbBlack{0 0 0}
+ %
+ % k sets the color for filling (usual text, etc.);
+ % K sets the color for stroking (thin rules, e.g., normal _'s).
+ \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
+ %
+ % Set color, and create a mark which defines \thiscolor accordingly,
+ % so that \makeheadline knows which color to restore.
+ \def\setcolor#1{%
+ \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+ \domark
+ \pdfsetcolor{#1}%
+ }
+ %
+ \def\maincolor{\rgbBlack}
+ \pdfsetcolor{\maincolor}
+ \edef\thiscolor{\maincolor}
+ \def\lastcolordefs{}
+ %
+ \def\makefootline{%
+ \baselineskip24pt
+ \line{\pdfsetcolor{\maincolor}\the\footline}%
+ }
+ %
+ \def\makeheadline{%
+ \vbox to 0pt{%
+ \vskip-22.5pt
+ \line{%
+ \vbox to8.5pt{}%
+ % Extract \thiscolor definition from the marks.
+ \getcolormarks
+ % Typeset the headline with \maincolor, then restore the color.
+ \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
+ }%
+ \vss
+ }%
+ \nointerlineskip
+ }
+ %
+ %
+ \pdfcatalog{/PageMode /UseOutlines}
+ %
+ % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
+ \def\dopdfimage#1#2#3{%
+ \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
+ \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
+ %
+ % pdftex (and the PDF format) support .pdf, .png, .jpg (among
+ % others). Let's try in that order, PDF first since if
+ % someone has a scalable image, presumably better to use that than a
+ % bitmap.
+ \let\pdfimgext=\empty
+ \begingroup
+ \openin 1 #1.pdf \ifeof 1
+ \openin 1 #1.PDF \ifeof 1
+ \openin 1 #1.png \ifeof 1
+ \openin 1 #1.jpg \ifeof 1
+ \openin 1 #1.jpeg \ifeof 1
+ \openin 1 #1.JPG \ifeof 1
+ \errhelp = \nopdfimagehelp
+ \errmessage{Could not find image file #1 for pdf}%
+ \else \gdef\pdfimgext{JPG}%
+ \fi
+ \else \gdef\pdfimgext{jpeg}%
+ \fi
+ \else \gdef\pdfimgext{jpg}%
+ \fi
+ \else \gdef\pdfimgext{png}%
+ \fi
+ \else \gdef\pdfimgext{PDF}%
+ \fi
+ \else \gdef\pdfimgext{pdf}%
+ \fi
+ \closein 1
+ \endgroup
+ %
+ % without \immediate, ancient pdftex seg faults when the same image is
+ % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
+ \ifnum\pdftexversion < 14
+ \immediate\pdfimage
+ \else
+ \immediate\pdfximage
+ \fi
+ \ifdim \wd0 >0pt width \pdfimagewidth \fi
+ \ifdim \wd2 >0pt height \pdfimageheight \fi
+ \ifnum\pdftexversion<13
+ #1.\pdfimgext
+ \else
+ {#1.\pdfimgext}%
+ \fi
+ \ifnum\pdftexversion < 14 \else
+ \pdfrefximage \pdflastximage
+ \fi}
+ %
+ \def\pdfmkdest#1{{%
+ % We have to set dummies so commands such as @code, and characters
+ % such as \, aren't expanded when present in a section title.
+ \indexnofonts
+ \turnoffactive
+ \makevalueexpandable
+ \def\pdfdestname{#1}%
+ \txiescapepdf\pdfdestname
+ \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
+ }}
+ %
+ % used to mark target names; must be expandable.
+ \def\pdfmkpgn#1{#1}
+ %
+ % by default, use a color that is dark enough to print on paper as
+ % nearly black, but still distinguishable for online viewing.
+ \def\urlcolor{\rgbDarkRed}
+ \def\linkcolor{\rgbDarkRed}
+ \def\endlink{\setcolor{\maincolor}\pdfendlink}
+ %
+ % Adding outlines to PDF; macros for calculating structure of outlines
+ % come from Petr Olsak
+ \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
+ \else \csname#1\endcsname \fi}
+ \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
+ \advance\tempnum by 1
+ \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
+ %
+ % #1 is the section text, which is what will be displayed in the
+ % outline by the pdf viewer. #2 is the pdf expression for the number
+ % of subentries (or empty, for subsubsections). #3 is the node text,
+ % which might be empty if this toc entry had no corresponding node.
+ % #4 is the page number
+ %
+ \def\dopdfoutline#1#2#3#4{%
+ % Generate a link to the node text if that exists; else, use the
+ % page number. We could generate a destination for the section
+ % text in the case where a section has no node, but it doesn't
+ % seem worth the trouble, since most documents are normally structured.
+ \edef\pdfoutlinedest{#3}%
+ \ifx\pdfoutlinedest\empty
+ \def\pdfoutlinedest{#4}%
+ \else
+ \txiescapepdf\pdfoutlinedest
+ \fi
+ %
+ % Also escape PDF chars in the display string.
+ \edef\pdfoutlinetext{#1}%
+ \txiescapepdf\pdfoutlinetext
+ %
+ \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
+ }
+ %
+ \def\pdfmakeoutlines{%
+ \begingroup
+ % Read toc silently, to get counts of subentries for \pdfoutline.
+ \def\partentry##1##2##3##4{}% ignore parts in the outlines
+ \def\numchapentry##1##2##3##4{%
+ \def\thischapnum{##2}%
+ \def\thissecnum{0}%
+ \def\thissubsecnum{0}%
+ }%
+ \def\numsecentry##1##2##3##4{%
+ \advancenumber{chap\thischapnum}%
+ \def\thissecnum{##2}%
+ \def\thissubsecnum{0}%
+ }%
+ \def\numsubsecentry##1##2##3##4{%
+ \advancenumber{sec\thissecnum}%
+ \def\thissubsecnum{##2}%
+ }%
+ \def\numsubsubsecentry##1##2##3##4{%
+ \advancenumber{subsec\thissubsecnum}%
+ }%
+ \def\thischapnum{0}%
+ \def\thissecnum{0}%
+ \def\thissubsecnum{0}%
+ %
+ % use \def rather than \let here because we redefine \chapentry et
+ % al. a second time, below.
+ \def\appentry{\numchapentry}%
+ \def\appsecentry{\numsecentry}%
+ \def\appsubsecentry{\numsubsecentry}%
+ \def\appsubsubsecentry{\numsubsubsecentry}%
+ \def\unnchapentry{\numchapentry}%
+ \def\unnsecentry{\numsecentry}%
+ \def\unnsubsecentry{\numsubsecentry}%
+ \def\unnsubsubsecentry{\numsubsubsecentry}%
+ \readdatafile{toc}%
+ %
+ % Read toc second time, this time actually producing the outlines.
+ % The `-' means take the \expnumber as the absolute number of
+ % subentries, which we calculated on our first read of the .toc above.
+ %
+ % We use the node names as the destinations.
+ \def\numchapentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
+ \def\numsecentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
+ \def\numsubsecentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
+ \def\numsubsubsecentry##1##2##3##4{% count is always zero
+ \dopdfoutline{##1}{}{##3}{##4}}%
+ %
+ % PDF outlines are displayed using system fonts, instead of
+ % document fonts. Therefore we cannot use special characters,
+ % since the encoding is unknown. For example, the eogonek from
+ % Latin 2 (0xea) gets translated to a | character. Info from
+ % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
+ %
+ % TODO this right, we have to translate 8-bit characters to
+ % their "best" equivalent, based on the @documentencoding. Too
+ % much work for too little return. Just use the ASCII equivalents
+ % we use for the index sort strings.
+ %
+ \indexnofonts
+ \setupdatafile
+ % We can have normal brace characters in the PDF outlines, unlike
+ % Texinfo index files. So set that up.
+ \def\{{\lbracecharliteral}%
+ \def\}{\rbracecharliteral}%
+ \catcode`\\=\active \otherbackslash
+ \input \tocreadfilename
+ \endgroup
+ }
+ {\catcode`[=1 \catcode`]=2
+ \catcode`{=\other \catcode`}=\other
+ \gdef\lbracecharliteral[{]%
+ \gdef\rbracecharliteral[}]%
+ ]
+ %
+ \def\skipspaces#1{\def\PP{#1}\def\D{|}%
+ \ifx\PP\D\let\nextsp\relax
+ \else\let\nextsp\skipspaces
+ \ifx\p\space\else\addtokens{\filename}{\PP}%
+ \advance\filenamelength by 1
+ \fi
+ \fi
+ \nextsp}
+ \def\getfilename#1{%
+ \filenamelength=0
+ % If we don't expand the argument now, \skipspaces will get
+ % snagged on things like "@value{foo}".
+ \edef\temp{#1}%
+ \expandafter\skipspaces\temp|\relax
+ }
+ \ifnum\pdftexversion < 14
+ \let \startlink \pdfannotlink
+ \else
+ \let \startlink \pdfstartlink
+ \fi
+ % make a live url in pdf output.
+ \def\pdfurl#1{%
+ \begingroup
+ % it seems we really need yet another set of dummies; have not
+ % tried to figure out what each command should do in the context
+ % of @url. for now, just make @/ a no-op, that's the only one
+ % people have actually reported a problem with.
+ %
+ \normalturnoffactive
+ \def\@{@}%
+ \let\/=\empty
+ \makevalueexpandable
+ % do we want to go so far as to use \indexnofonts instead of just
+ % special-casing \var here?
+ \def\var##1{##1}%
+ %
+ \leavevmode\setcolor{\urlcolor}%
+ \startlink attr{/Border [0 0 0]}%
+ user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
+ \endgroup}
+ \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
+ \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+ \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
+ \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
+ \def\maketoks{%
+ \expandafter\poptoks\the\toksA|ENDTOKS|\relax
+ \ifx\first0\adn0
+ \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
+ \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
+ \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
+ \else
+ \ifnum0=\countA\else\makelink\fi
+ \ifx\first.\let\next=\done\else
+ \let\next=\maketoks
+ \addtokens{\toksB}{\the\toksD}
+ \ifx\first,\addtokens{\toksB}{\space}\fi
+ \fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \next}
+ \def\makelink{\addtokens{\toksB}%
+ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
+ \def\pdflink#1{%
+ \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
+ \setcolor{\linkcolor}#1\endlink}
+ \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\else
+ % non-pdf mode
+ \let\pdfmkdest = \gobble
+ \let\pdfurl = \gobble
+ \let\endlink = \relax
+ \let\setcolor = \gobble
+ \let\pdfsetcolor = \gobble
+ \let\pdfmakeoutlines = \relax
+\fi % \ifx\pdfoutput
+
+
+\message{fonts,}
+
+% Change the current font style to #1, remembering it in \curfontstyle.
+% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
+% italics, not bold italics.
+%
+\def\setfontstyle#1{%
+ \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
+ \csname ten#1\endcsname % change the current font
+}
+
+% Select #1 fonts with the current style.
+%
+\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
+
+\def\rm{\fam=0 \setfontstyle{rm}}
+\def\it{\fam=\itfam \setfontstyle{it}}
+\def\sl{\fam=\slfam \setfontstyle{sl}}
+\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}
+
+% Unfortunately, we have to override this for titles and the like, since
+% in those cases "rm" is bold. Sigh.
+\def\rmisbold{\rm\def\curfontstyle{bf}}
+
+% Texinfo sort of supports the sans serif font style, which plain TeX does not.
+% So we set up a \sf.
+\newfam\sffam
+\def\sf{\fam=\sffam \setfontstyle{sf}}
+\let\li = \sf % Sometimes we call it \li, not \sf.
+
+% We don't need math for this font style.
+\def\ttsl{\setfontstyle{ttsl}}
+
+
+% Default leading.
+\newdimen\textleading \textleading = 13.2pt
+
+% Set the baselineskip to #1, and the lineskip and strut size
+% correspondingly. There is no deep meaning behind these magic numbers
+% used as factors; they just match (closely enough) what Knuth defined.
+%
+\def\lineskipfactor{.08333}
+\def\strutheightpercent{.70833}
+\def\strutdepthpercent {.29167}
+%
+% can get a sort of poor man's double spacing by redefining this.
+\def\baselinefactor{1}
+%
+\def\setleading#1{%
+ \dimen0 = #1\relax
+ \normalbaselineskip = \baselinefactor\dimen0
+ \normallineskip = \lineskipfactor\normalbaselineskip
+ \normalbaselines
+ \setbox\strutbox =\hbox{%
+ \vrule width0pt height\strutheightpercent\baselineskip
+ depth \strutdepthpercent \baselineskip
+ }%
+}
+
+% PDF CMaps. See also LaTeX's t1.cmap.
+%
+% do nothing with this by default.
+\expandafter\let\csname cmapOT1\endcsname\gobble
+\expandafter\let\csname cmapOT1IT\endcsname\gobble
+\expandafter\let\csname cmapOT1TT\endcsname\gobble
+
+% if we are producing pdf, and we have \pdffontattr, then define cmaps.
+% (\pdffontattr was introduced many years ago, but people still run
+% older pdftex's; it's easy to conditionalize, so we do.)
+\ifpdf \ifx\pdffontattr\thisisundefined \else
+ \begingroup
+ \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
+ \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-OT1-0)
+%%Title: (TeX-OT1-0 TeX OT1 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (OT1)
+/Supplement 0
+>> def
+/CMapName /TeX-OT1-0 def
+/CMapType 2 def
+1 begincodespacerange
+<00> <7F>
+endcodespacerange
+8 beginbfrange
+<00> <01> <0393>
+<09> <0A> <03A8>
+<23> <26> <0023>
+<28> <3B> <0028>
+<3F> <5B> <003F>
+<5D> <5E> <005D>
+<61> <7A> <0061>
+<7B> <7C> <2013>
+endbfrange
+40 beginbfchar
+<02> <0398>
+<03> <039B>
+<04> <039E>
+<05> <03A0>
+<06> <03A3>
+<07> <03D2>
+<08> <03A6>
+<0B> <00660066>
+<0C> <00660069>
+<0D> <0066006C>
+<0E> <006600660069>
+<0F> <00660066006C>
+<10> <0131>
+<11> <0237>
+<12> <0060>
+<13> <00B4>
+<14> <02C7>
+<15> <02D8>
+<16> <00AF>
+<17> <02DA>
+<18> <00B8>
+<19> <00DF>
+<1A> <00E6>
+<1B> <0153>
+<1C> <00F8>
+<1D> <00C6>
+<1E> <0152>
+<1F> <00D8>
+<21> <0021>
+<22> <201D>
+<27> <2019>
+<3C> <00A1>
+<3D> <003D>
+<3E> <00BF>
+<5C> <201C>
+<5F> <02D9>
+<60> <2018>
+<7D> <02DD>
+<7E> <007E>
+<7F> <00A8>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+ }\endgroup
+ \expandafter\edef\csname cmapOT1\endcsname#1{%
+ \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
+ }%
+%
+% \cmapOT1IT
+ \begingroup
+ \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
+ \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-OT1IT-0)
+%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (OT1IT)
+/Supplement 0
+>> def
+/CMapName /TeX-OT1IT-0 def
+/CMapType 2 def
+1 begincodespacerange
+<00> <7F>
+endcodespacerange
+8 beginbfrange
+<00> <01> <0393>
+<09> <0A> <03A8>
+<25> <26> <0025>
+<28> <3B> <0028>
+<3F> <5B> <003F>
+<5D> <5E> <005D>
+<61> <7A> <0061>
+<7B> <7C> <2013>
+endbfrange
+42 beginbfchar
+<02> <0398>
+<03> <039B>
+<04> <039E>
+<05> <03A0>
+<06> <03A3>
+<07> <03D2>
+<08> <03A6>
+<0B> <00660066>
+<0C> <00660069>
+<0D> <0066006C>
+<0E> <006600660069>
+<0F> <00660066006C>
+<10> <0131>
+<11> <0237>
+<12> <0060>
+<13> <00B4>
+<14> <02C7>
+<15> <02D8>
+<16> <00AF>
+<17> <02DA>
+<18> <00B8>
+<19> <00DF>
+<1A> <00E6>
+<1B> <0153>
+<1C> <00F8>
+<1D> <00C6>
+<1E> <0152>
+<1F> <00D8>
+<21> <0021>
+<22> <201D>
+<23> <0023>
+<24> <00A3>
+<27> <2019>
+<3C> <00A1>
+<3D> <003D>
+<3E> <00BF>
+<5C> <201C>
+<5F> <02D9>
+<60> <2018>
+<7D> <02DD>
+<7E> <007E>
+<7F> <00A8>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+ }\endgroup
+ \expandafter\edef\csname cmapOT1IT\endcsname#1{%
+ \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
+ }%
+%
+% \cmapOT1TT
+ \begingroup
+ \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
+ \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-OT1TT-0)
+%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (OT1TT)
+/Supplement 0
+>> def
+/CMapName /TeX-OT1TT-0 def
+/CMapType 2 def
+1 begincodespacerange
+<00> <7F>
+endcodespacerange
+5 beginbfrange
+<00> <01> <0393>
+<09> <0A> <03A8>
+<21> <26> <0021>
+<28> <5F> <0028>
+<61> <7E> <0061>
+endbfrange
+32 beginbfchar
+<02> <0398>
+<03> <039B>
+<04> <039E>
+<05> <03A0>
+<06> <03A3>
+<07> <03D2>
+<08> <03A6>
+<0B> <2191>
+<0C> <2193>
+<0D> <0027>
+<0E> <00A1>
+<0F> <00BF>
+<10> <0131>
+<11> <0237>
+<12> <0060>
+<13> <00B4>
+<14> <02C7>
+<15> <02D8>
+<16> <00AF>
+<17> <02DA>
+<18> <00B8>
+<19> <00DF>
+<1A> <00E6>
+<1B> <0153>
+<1C> <00F8>
+<1D> <00C6>
+<1E> <0152>
+<1F> <00D8>
+<20> <2423>
+<27> <2019>
+<60> <2018>
+<7F> <00A8>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+ }\endgroup
+ \expandafter\edef\csname cmapOT1TT\endcsname#1{%
+ \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
+ }%
+\fi\fi
+
+
+% Set the font macro #1 to the font named #2, adding on the
+% specified font prefix (normally `cm').
+% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
+% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
+% empty to omit).
+\def\setfont#1#2#3#4#5{%
+ \font#1=\fontprefix#2#3 scaled #4
+ \csname cmap#5\endcsname#1%
+}
+% This is what gets called when #5 of \setfont is empty.
+\let\cmap\gobble
+% emacs-page end of cmaps
+
+% Use cm as the default font prefix.
+% To specify the font prefix, you must define \fontprefix
+% before you read in texinfo.tex.
+\ifx\fontprefix\thisisundefined
+\def\fontprefix{cm}
+\fi
+% Support font families that don't use the same naming scheme as CM.
+\def\rmshape{r}
+\def\rmbshape{bx} %where the normal face is bold
+\def\bfshape{b}
+\def\bxshape{bx}
+\def\ttshape{tt}
+\def\ttbshape{tt}
+\def\ttslshape{sltt}
+\def\itshape{ti}
+\def\itbshape{bxti}
+\def\slshape{sl}
+\def\slbshape{bxsl}
+\def\sfshape{ss}
+\def\sfbshape{ss}
+\def\scshape{csc}
+\def\scbshape{csc}
+
+% Definitions for a main text size of 11pt. This is the default in
+% Texinfo.
+%
+\def\definetextfontsizexi{%
+% Text fonts (11.2pt, magstep1).
+\def\textnominalsize{11pt}
+\edef\mainmagstep{\magstephalf}
+\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
+\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
+\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
+\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
+\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
+\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
+\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+\def\textecsize{1095}
+
+% A few fonts for @defun names and args.
+\setfont\defbf\bfshape{10}{\magstep1}{OT1}
+\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
+\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+
+% Fonts for indices, footnotes, small examples (9pt).
+\def\smallnominalsize{9pt}
+\setfont\smallrm\rmshape{9}{1000}{OT1}
+\setfont\smalltt\ttshape{9}{1000}{OT1TT}
+\setfont\smallbf\bfshape{10}{900}{OT1}
+\setfont\smallit\itshape{9}{1000}{OT1IT}
+\setfont\smallsl\slshape{9}{1000}{OT1}
+\setfont\smallsf\sfshape{9}{1000}{OT1}
+\setfont\smallsc\scshape{10}{900}{OT1}
+\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
+\font\smalli=cmmi9
+\font\smallsy=cmsy9
+\def\smallecsize{0900}
+
+% Fonts for small examples (8pt).
+\def\smallernominalsize{8pt}
+\setfont\smallerrm\rmshape{8}{1000}{OT1}
+\setfont\smallertt\ttshape{8}{1000}{OT1TT}
+\setfont\smallerbf\bfshape{10}{800}{OT1}
+\setfont\smallerit\itshape{8}{1000}{OT1IT}
+\setfont\smallersl\slshape{8}{1000}{OT1}
+\setfont\smallersf\sfshape{8}{1000}{OT1}
+\setfont\smallersc\scshape{10}{800}{OT1}
+\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
+\font\smalleri=cmmi8
+\font\smallersy=cmsy8
+\def\smallerecsize{0800}
+
+% Fonts for title page (20.4pt):
+\def\titlenominalsize{20pt}
+\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
+\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
+\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
+\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
+\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
+\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\titleecsize{2074}
+
+% Chapter (and unnumbered) fonts (17.28pt).
+\def\chapnominalsize{17pt}
+\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
+\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
+\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
+\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
+\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
+\setfont\chapsf\sfbshape{17}{1000}{OT1}
+\let\chapbf=\chaprm
+\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
+\font\chapi=cmmi12 scaled \magstep2
+\font\chapsy=cmsy10 scaled \magstep3
+\def\chapecsize{1728}
+
+% Section fonts (14.4pt).
+\def\secnominalsize{14pt}
+\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
+\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
+\setfont\secsl\slbshape{10}{\magstep2}{OT1}
+\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
+\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
+\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
+\let\secbf\secrm
+\setfont\secsc\scbshape{10}{\magstep2}{OT1}
+\font\seci=cmmi12 scaled \magstep1
+\font\secsy=cmsy10 scaled \magstep2
+\def\sececsize{1440}
+
+% Subsection fonts (13.15pt).
+\def\ssecnominalsize{13pt}
+\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
+\setfont\ssecit\itbshape{10}{1315}{OT1IT}
+\setfont\ssecsl\slbshape{10}{1315}{OT1}
+\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
+\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
+\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
+\let\ssecbf\ssecrm
+\setfont\ssecsc\scbshape{10}{1315}{OT1}
+\font\sseci=cmmi12 scaled \magstephalf
+\font\ssecsy=cmsy10 scaled 1315
+\def\ssececsize{1200}
+
+% Reduced fonts for @acro in text (10pt).
+\def\reducednominalsize{10pt}
+\setfont\reducedrm\rmshape{10}{1000}{OT1}
+\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
+\setfont\reducedbf\bfshape{10}{1000}{OT1}
+\setfont\reducedit\itshape{10}{1000}{OT1IT}
+\setfont\reducedsl\slshape{10}{1000}{OT1}
+\setfont\reducedsf\sfshape{10}{1000}{OT1}
+\setfont\reducedsc\scshape{10}{1000}{OT1}
+\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
+\font\reducedi=cmmi10
+\font\reducedsy=cmsy10
+\def\reducedecsize{1000}
+
+\textleading = 13.2pt % line spacing for 11pt CM
+\textfonts % reset the current fonts
+\rm
+} % end of 11pt text font size definitions
+
+
+% Definitions to make the main text be 10pt Computer Modern, with
+% section, chapter, etc., sizes following suit. This is for the GNU
+% Press printing of the Emacs 22 manual. Maybe other manuals in the
+% future. Used with @smallbook, which sets the leading to 12pt.
+%
+\def\definetextfontsizex{%
+% Text fonts (10pt).
+\def\textnominalsize{10pt}
+\edef\mainmagstep{1000}
+\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
+\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
+\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
+\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
+\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
+\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
+\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+\def\textecsize{1000}
+
+% A few fonts for @defun names and args.
+\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
+\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
+\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+
+% Fonts for indices, footnotes, small examples (9pt).
+\def\smallnominalsize{9pt}
+\setfont\smallrm\rmshape{9}{1000}{OT1}
+\setfont\smalltt\ttshape{9}{1000}{OT1TT}
+\setfont\smallbf\bfshape{10}{900}{OT1}
+\setfont\smallit\itshape{9}{1000}{OT1IT}
+\setfont\smallsl\slshape{9}{1000}{OT1}
+\setfont\smallsf\sfshape{9}{1000}{OT1}
+\setfont\smallsc\scshape{10}{900}{OT1}
+\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
+\font\smalli=cmmi9
+\font\smallsy=cmsy9
+\def\smallecsize{0900}
+
+% Fonts for small examples (8pt).
+\def\smallernominalsize{8pt}
+\setfont\smallerrm\rmshape{8}{1000}{OT1}
+\setfont\smallertt\ttshape{8}{1000}{OT1TT}
+\setfont\smallerbf\bfshape{10}{800}{OT1}
+\setfont\smallerit\itshape{8}{1000}{OT1IT}
+\setfont\smallersl\slshape{8}{1000}{OT1}
+\setfont\smallersf\sfshape{8}{1000}{OT1}
+\setfont\smallersc\scshape{10}{800}{OT1}
+\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
+\font\smalleri=cmmi8
+\font\smallersy=cmsy8
+\def\smallerecsize{0800}
+
+% Fonts for title page (20.4pt):
+\def\titlenominalsize{20pt}
+\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
+\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
+\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
+\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
+\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
+\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\titleecsize{2074}
+
+% Chapter fonts (14.4pt).
+\def\chapnominalsize{14pt}
+\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
+\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
+\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
+\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
+\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
+\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
+\let\chapbf\chaprm
+\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
+\font\chapi=cmmi12 scaled \magstep1
+\font\chapsy=cmsy10 scaled \magstep2
+\def\chapecsize{1440}
+
+% Section fonts (12pt).
+\def\secnominalsize{12pt}
+\setfont\secrm\rmbshape{12}{1000}{OT1}
+\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
+\setfont\secsl\slbshape{10}{\magstep1}{OT1}
+\setfont\sectt\ttbshape{12}{1000}{OT1TT}
+\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
+\setfont\secsf\sfbshape{12}{1000}{OT1}
+\let\secbf\secrm
+\setfont\secsc\scbshape{10}{\magstep1}{OT1}
+\font\seci=cmmi12
+\font\secsy=cmsy10 scaled \magstep1
+\def\sececsize{1200}
+
+% Subsection fonts (10pt).
+\def\ssecnominalsize{10pt}
+\setfont\ssecrm\rmbshape{10}{1000}{OT1}
+\setfont\ssecit\itbshape{10}{1000}{OT1IT}
+\setfont\ssecsl\slbshape{10}{1000}{OT1}
+\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
+\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
+\setfont\ssecsf\sfbshape{10}{1000}{OT1}
+\let\ssecbf\ssecrm
+\setfont\ssecsc\scbshape{10}{1000}{OT1}
+\font\sseci=cmmi10
+\font\ssecsy=cmsy10
+\def\ssececsize{1000}
+
+% Reduced fonts for @acro in text (9pt).
+\def\reducednominalsize{9pt}
+\setfont\reducedrm\rmshape{9}{1000}{OT1}
+\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
+\setfont\reducedbf\bfshape{10}{900}{OT1}
+\setfont\reducedit\itshape{9}{1000}{OT1IT}
+\setfont\reducedsl\slshape{9}{1000}{OT1}
+\setfont\reducedsf\sfshape{9}{1000}{OT1}
+\setfont\reducedsc\scshape{10}{900}{OT1}
+\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
+\font\reducedi=cmmi9
+\font\reducedsy=cmsy9
+\def\reducedecsize{0900}
+
+\divide\parskip by 2 % reduce space between paragraphs
+\textleading = 12pt % line spacing for 10pt CM
+\textfonts % reset the current fonts
+\rm
+} % end of 10pt text font size definitions
+
+
+% We provide the user-level command
+% @fonttextsize 10
+% (or 11) to redefine the text font size. pt is assumed.
+%
+\def\xiword{11}
+\def\xword{10}
+\def\xwordpt{10pt}
+%
+\parseargdef\fonttextsize{%
+ \def\textsizearg{#1}%
+ %\wlog{doing @fonttextsize \textsizearg}%
+ %
+ % Set \globaldefs so that documents can use this inside @tex, since
+ % makeinfo 4.8 does not support it, but we need it nonetheless.
+ %
+ \begingroup \globaldefs=1
+ \ifx\textsizearg\xword \definetextfontsizex
+ \else \ifx\textsizearg\xiword \definetextfontsizexi
+ \else
+ \errhelp=\EMsimple
+ \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
+ \fi\fi
+ \endgroup
+}
+
+
+% In order for the font changes to affect most math symbols and letters,
+% we have to define the \textfont of the standard families. Since
+% texinfo doesn't allow for producing subscripts and superscripts except
+% in the main text, we don't bother to reset \scriptfont and
+% \scriptscriptfont (which would also require loading a lot more fonts).
+%
+\def\resetmathfonts{%
+ \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
+ \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
+ \textfont\ttfam=\tentt \textfont\sffam=\tensf
+}
+
+% The font-changing commands redefine the meanings of \tenSTYLE, instead
+% of just \STYLE. We do this because \STYLE needs to also set the
+% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
+% \tenSTYLE to set the current font.
+%
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower). These relative commands are used in
+% the LaTeX logo and acronyms.
+%
+% This all needs generalizing, badly.
+%
+\def\textfonts{%
+ \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
+ \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
+ \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
+ \let\tenttsl=\textttsl
+ \def\curfontsize{text}%
+ \def\lsize{reduced}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{\textleading}}
+\def\titlefonts{%
+ \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
+ \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
+ \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
+ \let\tenttsl=\titlettsl
+ \def\curfontsize{title}%
+ \def\lsize{chap}\def\lllsize{subsec}%
+ \resetmathfonts \setleading{27pt}}
+\def\titlefont#1{{\titlefonts\rmisbold #1}}
+\def\chapfonts{%
+ \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
+ \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
+ \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
+ \let\tenttsl=\chapttsl
+ \def\curfontsize{chap}%
+ \def\lsize{sec}\def\lllsize{text}%
+ \resetmathfonts \setleading{19pt}}
+\def\secfonts{%
+ \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
+ \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
+ \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
+ \let\tenttsl=\secttsl
+ \def\curfontsize{sec}%
+ \def\lsize{subsec}\def\lllsize{reduced}%
+ \resetmathfonts \setleading{16pt}}
+\def\subsecfonts{%
+ \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
+ \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
+ \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
+ \let\tenttsl=\ssecttsl
+ \def\curfontsize{ssec}%
+ \def\lsize{text}\def\lllsize{small}%
+ \resetmathfonts \setleading{15pt}}
+\let\subsubsecfonts = \subsecfonts
+\def\reducedfonts{%
+ \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
+ \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
+ \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
+ \let\tenttsl=\reducedttsl
+ \def\curfontsize{reduced}%
+ \def\lsize{small}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{10.5pt}}
+\def\smallfonts{%
+ \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
+ \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
+ \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
+ \let\tenttsl=\smallttsl
+ \def\curfontsize{small}%
+ \def\lsize{smaller}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{10.5pt}}
+\def\smallerfonts{%
+ \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
+ \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
+ \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
+ \let\tenttsl=\smallerttsl
+ \def\curfontsize{smaller}%
+ \def\lsize{smaller}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{9.5pt}}
+
+% Fonts for short table of contents.
+\setfont\shortcontrm\rmshape{12}{1000}{OT1}
+\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
+\setfont\shortcontsl\slshape{12}{1000}{OT1}
+\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+
+% Define these just so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
+
+% Set the fonts to use with the @small... environments.
+\let\smallexamplefonts = \smallfonts
+
+% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
+% can fit this many characters:
+% 8.5x11=86 smallbook=72 a4=90 a5=69
+% If we use \scriptfonts (8pt), then we can fit this many characters:
+% 8.5x11=90+ smallbook=80 a4=90+ a5=77
+% For me, subjectively, the few extra characters that fit aren't worth
+% the additional smallness of 8pt. So I'm making the default 9pt.
+%
+% By the way, for comparison, here's what fits with @example (10pt):
+% 8.5x11=71 smallbook=60 a4=75 a5=58
+% --karl, 24jan03.
+
+% Set up the default fonts, so we can use them for creating boxes.
+%
+\definetextfontsizexi
+
+
+\message{markup,}
+
+% Check if we are currently using a typewriter font. Since all the
+% Computer Modern typewriter fonts have zero interword stretch (and
+% shrink), and it is reasonable to expect all typewriter fonts to have
+% this property, we can check that font parameter.
+%
+\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+
+% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
+% define and register \INITMACRO to be called on markup style changes.
+% \INITMACRO can check \currentmarkupstyle for the innermost
+% style and the set of \ifmarkupSTYLE switches for all styles
+% currently in effect.
+\newif\ifmarkupvar
+\newif\ifmarkupsamp
+\newif\ifmarkupkey
+%\newif\ifmarkupfile % @file == @samp.
+%\newif\ifmarkupoption % @option == @samp.
+\newif\ifmarkupcode
+\newif\ifmarkupkbd
+%\newif\ifmarkupenv % @env == @code.
+%\newif\ifmarkupcommand % @command == @code.
+\newif\ifmarkuptex % @tex (and part of @math, for now).
+\newif\ifmarkupexample
+\newif\ifmarkupverb
+\newif\ifmarkupverbatim
+
+\let\currentmarkupstyle\empty
+
+\def\setupmarkupstyle#1{%
+ \csname markup#1true\endcsname
+ \def\currentmarkupstyle{#1}%
+ \markupstylesetup
+}
+
+\let\markupstylesetup\empty
+
+\def\defmarkupstylesetup#1{%
+ \expandafter\def\expandafter\markupstylesetup
+ \expandafter{\markupstylesetup #1}%
+ \def#1%
+}
+
+% Markup style setup for left and right quotes.
+\defmarkupstylesetup\markupsetuplq{%
+ \expandafter\let\expandafter \temp
+ \csname markupsetuplq\currentmarkupstyle\endcsname
+ \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
+}
+
+\defmarkupstylesetup\markupsetuprq{%
+ \expandafter\let\expandafter \temp
+ \csname markupsetuprq\currentmarkupstyle\endcsname
+ \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
+}
+
+{
+\catcode`\'=\active
+\catcode`\`=\active
+
+\gdef\markupsetuplqdefault{\let`\lq}
+\gdef\markupsetuprqdefault{\let'\rq}
+
+\gdef\markupsetcodequoteleft{\let`\codequoteleft}
+\gdef\markupsetcodequoteright{\let'\codequoteright}
+
+\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
+}
+
+\let\markupsetuplqcode \markupsetcodequoteleft
+\let\markupsetuprqcode \markupsetcodequoteright
+%
+\let\markupsetuplqexample \markupsetcodequoteleft
+\let\markupsetuprqexample \markupsetcodequoteright
+%
+\let\markupsetuplqsamp \markupsetcodequoteleft
+\let\markupsetuprqsamp \markupsetcodequoteright
+%
+\let\markupsetuplqverb \markupsetcodequoteleft
+\let\markupsetuprqverb \markupsetcodequoteright
+%
+\let\markupsetuplqverbatim \markupsetcodequoteleft
+\let\markupsetuprqverbatim \markupsetcodequoteright
+
+\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
+
+% Allow an option to not use regular directed right quote/apostrophe
+% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
+% The undirected quote is ugly, so don't make it the default, but it
+% works for pasting with more pdf viewers (at least evince), the
+% lilypond developers report. xpdf does work with the regular 0x27.
+%
+\def\codequoteright{%
+ \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
+ \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
+ '%
+ \else \char'15 \fi
+ \else \char'15 \fi
+}
+%
+% and a similar option for the left quote char vs. a grave accent.
+% Modern fonts display ASCII 0x60 as a grave accent, so some people like
+% the code environments to do likewise.
+%
+\def\codequoteleft{%
+ \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
+ \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
+ % [Knuth] pp. 380,381,391
+ % \relax disables Spanish ligatures ?` and !` of \tt font.
+ \relax`%
+ \else \char'22 \fi
+ \else \char'22 \fi
+}
+
+% Commands to set the quote options.
+%
+\parseargdef\codequoteundirected{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETtxicodequoteundirected\endcsname
+ = t%
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETtxicodequoteundirected\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
+ \fi\fi
+}
+%
+\parseargdef\codequotebacktick{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETtxicodequotebacktick\endcsname
+ = t%
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETtxicodequotebacktick\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
+ \fi\fi
+}
+
+% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
+\def\noligaturesquoteleft{\relax\lq}
+
+% Count depth in font-changes, for error checks
+\newcount\fontdepth \fontdepth=0
+
+% Font commands.
+
+% #1 is the font command (\sl or \it), #2 is the text to slant.
+% If we are in a monospaced environment, however, 1) always use \ttsl,
+% and 2) do not add an italic correction.
+\def\dosmartslant#1#2{%
+ \ifusingtt
+ {{\ttsl #2}\let\next=\relax}%
+ {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
+ \next
+}
+\def\smartslanted{\dosmartslant\sl}
+\def\smartitalic{\dosmartslant\it}
+
+% Output an italic correction unless \next (presumed to be the following
+% character) is such as not to need one.
+\def\smartitaliccorrection{%
+ \ifx\next,%
+ \else\ifx\next-%
+ \else\ifx\next.%
+ \else\ptexslash
+ \fi\fi\fi
+ \aftersmartic
+}
+
+% like \smartslanted except unconditionally uses \ttsl, and no ic.
+% @var is set to this for defun arguments.
+\def\ttslanted#1{{\ttsl #1}}
+
+% @cite is like \smartslanted except unconditionally use \sl. We never want
+% ttsl for book titles, do we?
+\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
+
+\def\aftersmartic{}
+\def\var#1{%
+ \let\saveaftersmartic = \aftersmartic
+ \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
+ \smartslanted{#1}%
+}
+
+\let\i=\smartitalic
+\let\slanted=\smartslanted
+\let\dfn=\smartslanted
+\let\emph=\smartitalic
+
+% Explicit font changes: @r, @sc, undocumented @ii.
+\def\r#1{{\rm #1}} % roman font
+\def\sc#1{{\smallcaps#1}} % smallcaps font
+\def\ii#1{{\it #1}} % italic font
+
+% @b, explicit bold. Also @strong.
+\def\b#1{{\bf #1}}
+\let\strong=\b
+
+% @sansserif, explicit sans.
+\def\sansserif#1{{\sf #1}}
+
+% We can't just use \exhyphenpenalty, because that only has effect at
+% the end of a paragraph. Restore normal hyphenation at the end of the
+% group within which \nohyphenation is presumably called.
+%
+\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
+\def\restorehyphenation{\hyphenchar\font = `- }
+
+% Set sfcode to normal for the chars that usually have another value.
+% Can't use plain's \frenchspacing because it uses the `\x notation, and
+% sometimes \x has an active definition that messes things up.
+%
+\catcode`@=11
+ \def\plainfrenchspacing{%
+ \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
+ \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
+ \def\endofsentencespacefactor{1000}% for @. and friends
+ }
+ \def\plainnonfrenchspacing{%
+ \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
+ \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
+ \def\endofsentencespacefactor{3000}% for @. and friends
+ }
+\catcode`@=\other
+\def\endofsentencespacefactor{3000}% default
+
+% @t, explicit typewriter.
+\def\t#1{%
+ {\tt \rawbackslash \plainfrenchspacing #1}%
+ \null
+}
+
+% @samp.
+\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
+
+% definition of @key that produces a lozenge. Doesn't adjust to text size.
+%\setfont\keyrm\rmshape{8}{1000}{OT1}
+%\font\keysy=cmsy9
+%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
+% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
+% \vbox{\hrule\kern-0.4pt
+% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
+% \kern-0.4pt\hrule}%
+% \kern-.06em\raise0.4pt\hbox{\angleright}}}}
+
+% definition of @key with no lozenge. If the current font is already
+% monospace, don't change it; that way, we respect @kbdinputstyle. But
+% if it isn't monospace, then use \tt.
+%
+\def\key#1{{\setupmarkupstyle{key}%
+ \nohyphenation
+ \ifmonospace\else\tt\fi
+ #1}\null}
+
+% ctrl is no longer a Texinfo command.
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+% @file, @option are the same as @samp.
+\let\file=\samp
+\let\option=\samp
+
+% @code is a modification of @t,
+% which makes spaces the same size as normal in the surrounding text.
+\def\tclose#1{%
+ {%
+ % Change normal interword space to be same as for the current font.
+ \spaceskip = \fontdimen2\font
+ %
+ % Switch to typewriter.
+ \tt
+ %
+ % But `\ ' produces the large typewriter interword space.
+ \def\ {{\spaceskip = 0pt{} }}%
+ %
+ % Turn off hyphenation.
+ \nohyphenation
+ %
+ \rawbackslash
+ \plainfrenchspacing
+ #1%
+ }%
+ \null % reset spacefactor to 1000
+}
+
+% We *must* turn on hyphenation at `-' and `_' in @code.
+% Otherwise, it is too hard to avoid overfull hboxes
+% in the Emacs manual, the Library manual, etc.
+
+% Unfortunately, TeX uses one parameter (\hyphenchar) to control
+% both hyphenation at - and hyphenation within words.
+% We must therefore turn them both off (\tclose does that)
+% and arrange explicitly to hyphenate at a dash.
+% -- rms.
+{
+ \catcode`\-=\active \catcode`\_=\active
+ \catcode`\'=\active \catcode`\`=\active
+ \global\let'=\rq \global\let`=\lq % default definitions
+ %
+ \global\def\code{\begingroup
+ \setupmarkupstyle{code}%
+ % The following should really be moved into \setupmarkupstyle handlers.
+ \catcode\dashChar=\active \catcode\underChar=\active
+ \ifallowcodebreaks
+ \let-\codedash
+ \let_\codeunder
+ \else
+ \let-\realdash
+ \let_\realunder
+ \fi
+ \codex
+ }
+}
+
+\def\codex #1{\tclose{#1}\endgroup}
+
+\def\realdash{-}
+\def\codedash{-\discretionary{}{}{}}
+\def\codeunder{%
+ % this is all so @math{@code{var_name}+1} can work. In math mode, _
+ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
+ % will therefore expand the active definition of _, which is us
+ % (inside @code that is), therefore an endless loop.
+ \ifusingtt{\ifmmode
+ \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
+ \else\normalunderscore \fi
+ \discretionary{}{}{}}%
+ {\_}%
+}
+
+% An additional complication: the above will allow breaks after, e.g.,
+% each of the four underscores in __typeof__. This is undesirable in
+% some manuals, especially if they don't have long identifiers in
+% general. @allowcodebreaks provides a way to control this.
+%
+\newif\ifallowcodebreaks \allowcodebreakstrue
+
+\def\keywordtrue{true}
+\def\keywordfalse{false}
+
+\parseargdef\allowcodebreaks{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\keywordtrue
+ \allowcodebreakstrue
+ \else\ifx\txiarg\keywordfalse
+ \allowcodebreaksfalse
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
+ \fi\fi
+}
+
+% @uref (abbreviation for `urlref') takes an optional (comma-separated)
+% second argument specifying the text to display and an optional third
+% arg as text to display instead of (rather than in addition to) the url
+% itself. First (mandatory) arg is the url.
+% (This \urefnobreak definition isn't used now, leaving it for a while
+% for comparison.)
+\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
+\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
+ \unsepspaces
+ \pdfurl{#1}%
+ \setbox0 = \hbox{\ignorespaces #3}%
+ \ifdim\wd0 > 0pt
+ \unhbox0 % third arg given, show only that
+ \else
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \ifpdf
+ \unhbox0 % PDF: 2nd arg given, show only it
+ \else
+ \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
+ \fi
+ \else
+ \code{#1}% only url given, so show it
+ \fi
+ \fi
+ \endlink
+\endgroup}
+
+% This \urefbreak definition is the active one.
+\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
+\let\uref=\urefbreak
+\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
+\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
+ \unsepspaces
+ \pdfurl{#1}%
+ \setbox0 = \hbox{\ignorespaces #3}%
+ \ifdim\wd0 > 0pt
+ \unhbox0 % third arg given, show only that
+ \else
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \ifpdf
+ \unhbox0 % PDF: 2nd arg given, show only it
+ \else
+ \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
+ \fi
+ \else
+ \urefcode{#1}% only url given, so show it
+ \fi
+ \fi
+ \endlink
+\endgroup}
+
+% Allow line breaks around only a few characters (only).
+\def\urefcatcodes{%
+ \catcode\ampChar=\active \catcode\dotChar=\active
+ \catcode\hashChar=\active \catcode\questChar=\active
+ \catcode\slashChar=\active
+}
+{
+ \urefcatcodes
+ %
+ \global\def\urefcode{\begingroup
+ \setupmarkupstyle{code}%
+ \urefcatcodes
+ \let&\urefcodeamp
+ \let.\urefcodedot
+ \let#\urefcodehash
+ \let?\urefcodequest
+ \let/\urefcodeslash
+ \codex
+ }
+ %
+ % By default, they are just regular characters.
+ \global\def&{\normalamp}
+ \global\def.{\normaldot}
+ \global\def#{\normalhash}
+ \global\def?{\normalquest}
+ \global\def/{\normalslash}
+}
+
+% we put a little stretch before and after the breakable chars, to help
+% line breaking of long url's. The unequal skips make look better in
+% cmtt at least, especially for dots.
+\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
+\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
+%
+\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
+\def\urefcodedot{\urefprestretch .\urefpoststretch}
+\def\urefcodehash{\urefprestretch \#\urefpoststretch}
+\def\urefcodequest{\urefprestretch ?\urefpoststretch}
+\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
+{
+ \catcode`\/=\active
+ \global\def\urefcodeslashfinish{%
+ \urefprestretch \slashChar
+ % Allow line break only after the final / in a sequence of
+ % slashes, to avoid line break between the slashes in http://.
+ \ifx\next/\else \urefpoststretch \fi
+ }
+}
+
+% One more complication: by default we'll break after the special
+% characters, but some people like to break before the special chars, so
+% allow that. Also allow no breaking at all, for manual control.
+%
+\parseargdef\urefbreakstyle{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\wordnone
+ \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
+ \else\ifx\txiarg\wordbefore
+ \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
+ \else\ifx\txiarg\wordafter
+ \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
+ \fi\fi\fi
+}
+\def\wordafter{after}
+\def\wordbefore{before}
+\def\wordnone{none}
+
+\urefbreakstyle after
+
+% @url synonym for @uref, since that's how everyone uses it.
+%
+\let\url=\uref
+
+% rms does not like angle brackets --karl, 17may97.
+% So now @email is just like @uref, unless we are pdf.
+%
+%\def\email#1{\angleleft{\tt #1}\angleright}
+\ifpdf
+ \def\email#1{\doemail#1,,\finish}
+ \def\doemail#1,#2,#3\finish{\begingroup
+ \unsepspaces
+ \pdfurl{mailto:#1}%
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
+ \endlink
+ \endgroup}
+\else
+ \let\email=\uref
+\fi
+
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
+
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+% `example' (@kbd uses ttsl only inside of @example and friends),
+% or `code' (@kbd uses normal tty font always).
+\parseargdef\kbdinputstyle{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\worddistinct
+ \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+ \else\ifx\txiarg\wordexample
+ \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+ \else\ifx\txiarg\wordcode
+ \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
+ \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is `distinct'.
+\kbdinputstyle distinct
+
+\def\xkey{\key}
+\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
+\ifx\one\xkey\ifx\threex\three \key{#2}%
+\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
+
+% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
+\let\indicateurl=\code
+\let\env=\code
+\let\command=\code
+
+% @clicksequence{File @click{} Open ...}
+\def\clicksequence#1{\begingroup #1\endgroup}
+
+% @clickstyle @arrow (by default)
+\parseargdef\clickstyle{\def\click{#1}}
+\def\click{\arrow}
+
+% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
+% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
+%
+\def\dmn#1{\thinspace #1}
+
+% @l was never documented to mean ``switch to the Lisp font'',
+% and it is not used as such in any manual I can find. We need it for
+% Polish suppressed-l. --karl, 22sep96.
+%\def\l#1{{\li #1}\null}
+
+% @acronym for "FBI", "NATO", and the like.
+% We print this one point size smaller, since it's intended for
+% all-uppercase.
+%
+\def\acronym#1{\doacronym #1,,\finish}
+\def\doacronym#1,#2,#3\finish{%
+ {\selectfonts\lsize #1}%
+ \def\temp{#2}%
+ \ifx\temp\empty \else
+ \space ({\unsepspaces \ignorespaces \temp \unskip})%
+ \fi
+ \null % reset \spacefactor=1000
+}
+
+% @abbr for "Comput. J." and the like.
+% No font change, but don't do end-of-sentence spacing.
+%
+\def\abbr#1{\doabbr #1,,\finish}
+\def\doabbr#1,#2,#3\finish{%
+ {\plainfrenchspacing #1}%
+ \def\temp{#2}%
+ \ifx\temp\empty \else
+ \space ({\unsepspaces \ignorespaces \temp \unskip})%
+ \fi
+ \null % reset \spacefactor=1000
+}
+
+% @asis just yields its argument. Used with @table, for example.
+%
+\def\asis#1{#1}
+
+% @math outputs its argument in math mode.
+%
+% One complication: _ usually means subscripts, but it could also mean
+% an actual _ character, as in @math{@var{some_variable} + 1}. So make
+% _ active, and distinguish by seeing if the current family is \slfam,
+% which is what @var uses.
+{
+ \catcode`\_ = \active
+ \gdef\mathunderscore{%
+ \catcode`\_=\active
+ \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
+ }
+}
+% Another complication: we want \\ (and @\) to output a math (or tt) \.
+% FYI, plain.tex uses \\ as a temporary control sequence (for no
+% particular reason), but this is not advertised and we don't care.
+%
+% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
+\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
+%
+\def\math{%
+ \tex
+ \mathunderscore
+ \let\\ = \mathbackslash
+ \mathactive
+ % make the texinfo accent commands work in math mode
+ \let\"=\ddot
+ \let\'=\acute
+ \let\==\bar
+ \let\^=\hat
+ \let\`=\grave
+ \let\u=\breve
+ \let\v=\check
+ \let\~=\tilde
+ \let\dotaccent=\dot
+ $\finishmath
+}
+\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
+
+% Some active characters (such as <) are spaced differently in math.
+% We have to reset their definitions in case the @math was an argument
+% to a command which sets the catcodes (such as @item or @section).
+%
+{
+ \catcode`^ = \active
+ \catcode`< = \active
+ \catcode`> = \active
+ \catcode`+ = \active
+ \catcode`' = \active
+ \gdef\mathactive{%
+ \let^ = \ptexhat
+ \let< = \ptexless
+ \let> = \ptexgtr
+ \let+ = \ptexplus
+ \let' = \ptexquoteright
+ }
+}
+
+% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
+% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
+% except specified as a normal braced arg, so no newlines to worry about.
+%
+\def\outfmtnametex{tex}
+%
+\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
+\long\def\doinlinefmt#1,#2,\finish{%
+ \def\inlinefmtname{#1}%
+ \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
+}
+% For raw, must switch into @tex before parsing the argument, to avoid
+% setting catcodes prematurely. Doing it this way means that, for
+% example, @inlineraw{html, foo{bar} gets a parse error instead of being
+% ignored. But this isn't important because if people want a literal
+% *right* brace they would have to use a command anyway, so they may as
+% well use a command to get a left brace too. We could re-use the
+% delimiter character idea from \verb, but it seems like overkill.
+%
+\long\def\inlineraw{\tex \doinlineraw}
+\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
+\def\doinlinerawtwo#1,#2,\finish{%
+ \def\inlinerawname{#1}%
+ \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
+ \endgroup % close group opened by \tex.
+}
+
+
+\message{glyphs,}
+% and logos.
+
+% @@ prints an @, as does @atchar{}.
+\def\@{\char64 }
+\let\atchar=\@
+
+% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
+% Unless we're in typewriter, use \ecfont because the CM text fonts do
+% not have braces, and we don't want to switch into math.
+\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
+\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
+\let\{=\mylbrace \let\lbracechar=\{
+\let\}=\myrbrace \let\rbracechar=\}
+\begingroup
+ % Definitions to produce \{ and \} commands for indices,
+ % and @{ and @} for the aux/toc files.
+ \catcode`\{ = \other \catcode`\} = \other
+ \catcode`\[ = 1 \catcode`\] = 2
+ \catcode`\! = 0 \catcode`\\ = \other
+ !gdef!lbracecmd[\{]%
+ !gdef!rbracecmd[\}]%
+ !gdef!lbraceatcmd[@{]%
+ !gdef!rbraceatcmd[@}]%
+!endgroup
+
+% @comma{} to avoid , parsing problems.
+\let\comma = ,
+
+% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
+\let\, = \ptexc
+\let\dotaccent = \ptexdot
+\def\ringaccent#1{{\accent23 #1}}
+\let\tieaccent = \ptext
+\let\ubaraccent = \ptexb
+\let\udotaccent = \d
+
+% Other special characters: @questiondown @exclamdown @ordf @ordm
+% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
+\def\questiondown{?`}
+\def\exclamdown{!`}
+\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
+
+% Dotless i and dotless j, used for accents.
+\def\imacro{i}
+\def\jmacro{j}
+\def\dotless#1{%
+ \def\temp{#1}%
+ \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
+ \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
+ \else \errmessage{@dotless can be used only with i or j}%
+ \fi\fi
+}
+
+% The \TeX{} logo, as in plain, but resetting the spacing so that a
+% period following counts as ending a sentence. (Idea found in latex.)
+%
+\edef\TeX{\TeX \spacefactor=1000 }
+
+% @LaTeX{} logo. Not quite the same results as the definition in
+% latex.ltx, since we use a different font for the raised A; it's most
+% convenient for us to use an explicitly smaller font, rather than using
+% the \scriptstyle font (since we don't reset \scriptstyle and
+% \scriptscriptstyle).
+%
+\def\LaTeX{%
+ L\kern-.36em
+ {\setbox0=\hbox{T}%
+ \vbox to \ht0{\hbox{%
+ \ifx\textnominalsize\xwordpt
+ % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
+ % Revert to plain's \scriptsize, which is 7pt.
+ \count255=\the\fam $\fam\count255 \scriptstyle A$%
+ \else
+ % For 11pt, we can use our lllsize.
+ \selectfonts\lllsize A%
+ \fi
+ }%
+ \vss
+ }}%
+ \kern-.15em
+ \TeX
+}
+
+% Some math mode symbols.
+\def\bullet{$\ptexbullet$}
+\def\geq{\ifmmode \ge\else $\ge$\fi}
+\def\leq{\ifmmode \le\else $\le$\fi}
+\def\minus{\ifmmode -\else $-$\fi}
+
+% @dots{} outputs an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in the cm
+% typewriter fonts as three actual period characters; on the other hand,
+% in other typewriter fonts three periods are wider than 1.5em. So do
+% whichever is larger.
+%
+\def\dots{%
+ \leavevmode
+ \setbox0=\hbox{...}% get width of three periods
+ \ifdim\wd0 > 1.5em
+ \dimen0 = \wd0
+ \else
+ \dimen0 = 1.5em
+ \fi
+ \hbox to \dimen0{%
+ \hskip 0pt plus.25fil
+ .\hskip 0pt plus1fil
+ .\hskip 0pt plus1fil
+ .\hskip 0pt plus.5fil
+ }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+ \dots
+ \spacefactor=\endofsentencespacefactor
+}
+
+% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
+%
+% Since these characters are used in examples, they should be an even number of
+% \tt widths. Each \tt character is 1en, so two makes it 1em.
+%
+\def\point{$\star$}
+\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
+\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
+\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
+\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
+\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
+
+% The @error{} command.
+% Adapted from the TeXbook's \boxit.
+%
+\newbox\errorbox
+%
+{\tentt \global\dimen0 = 3em}% Width of the box.
+\dimen2 = .55pt % Thickness of rules
+% The text. (`r' is open on the right, `e' somewhat less so on the left.)
+\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
+%
+\setbox\errorbox=\hbox to \dimen0{\hfil
+ \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
+ \advance\hsize by -2\dimen2 % Rules.
+ \vbox{%
+ \hrule height\dimen2
+ \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
+ \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
+ \kern3pt\vrule width\dimen2}% Space to right.
+ \hrule height\dimen2}
+ \hfil}
+%
+\def\error{\leavevmode\lower.7ex\copy\errorbox}
+
+% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
+%
+\def\pounds{{\it\$}}
+
+% @euro{} comes from a separate font, depending on the current style.
+% We use the free feym* fonts from the eurosym package by Henrik
+% Theiling, which support regular, slanted, bold and bold slanted (and
+% "outlined" (blackboard board, sort of) versions, which we don't need).
+% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
+%
+% Although only regular is the truly official Euro symbol, we ignore
+% that. The Euro is designed to be slightly taller than the regular
+% font height.
+%
+% feymr - regular
+% feymo - slanted
+% feybr - bold
+% feybo - bold slanted
+%
+% There is no good (free) typewriter version, to my knowledge.
+% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
+% Hmm.
+%
+% Also doesn't work in math. Do we need to do math with euro symbols?
+% Hope not.
+%
+%
+\def\euro{{\eurofont e}}
+\def\eurofont{%
+ % We set the font at each command, rather than predefining it in
+ % \textfonts and the other font-switching commands, so that
+ % installations which never need the symbol don't have to have the
+ % font installed.
+ %
+ % There is only one designed size (nominal 10pt), so we always scale
+ % that to the current nominal size.
+ %
+ % By the way, simply using "at 1em" works for cmr10 and the like, but
+ % does not work for cmbx10 and other extended/shrunken fonts.
+ %
+ \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
+ %
+ \ifx\curfontstyle\bfstylename
+ % bold:
+ \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
+ \else
+ % regular:
+ \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
+ \fi
+ \thiseurofont
+}
+
+% Glyphs from the EC fonts. We don't use \let for the aliases, because
+% sometimes we redefine the original macro, and the alias should reflect
+% the redefinition.
+%
+% Use LaTeX names for the Icelandic letters.
+\def\DH{{\ecfont \char"D0}} % Eth
+\def\dh{{\ecfont \char"F0}} % eth
+\def\TH{{\ecfont \char"DE}} % Thorn
+\def\th{{\ecfont \char"FE}} % thorn
+%
+\def\guillemetleft{{\ecfont \char"13}}
+\def\guillemotleft{\guillemetleft}
+\def\guillemetright{{\ecfont \char"14}}
+\def\guillemotright{\guillemetright}
+\def\guilsinglleft{{\ecfont \char"0E}}
+\def\guilsinglright{{\ecfont \char"0F}}
+\def\quotedblbase{{\ecfont \char"12}}
+\def\quotesinglbase{{\ecfont \char"0D}}
+%
+% This positioning is not perfect (see the ogonek LaTeX package), but
+% we have the precomposed glyphs for the most common cases. We put the
+% tests to use those glyphs in the single \ogonek macro so we have fewer
+% dummy definitions to worry about for index entries, etc.
+%
+% ogonek is also used with other letters in Lithuanian (IOU), but using
+% the precomposed glyphs for those is not so easy since they aren't in
+% the same EC font.
+\def\ogonek#1{{%
+ \def\temp{#1}%
+ \ifx\temp\macrocharA\Aogonek
+ \else\ifx\temp\macrochara\aogonek
+ \else\ifx\temp\macrocharE\Eogonek
+ \else\ifx\temp\macrochare\eogonek
+ \else
+ \ecfont \setbox0=\hbox{#1}%
+ \ifdim\ht0=1ex\accent"0C #1%
+ \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
+ \fi
+ \fi\fi\fi\fi
+ }%
+}
+\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
+\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
+\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
+\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
+%
+% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
+\def\ecfont{%
+ % We can't distinguish serif/sans and italic/slanted, but this
+ % is used for crude hacks anyway (like adding French and German
+ % quotes to documents typeset with CM, where we lose kerning), so
+ % hopefully nobody will notice/care.
+ \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
+ \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
+ \ifx\curfontstyle\bfstylename
+ % bold:
+ \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
+ \else
+ % regular:
+ \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+ \fi
+ \thisecfont
+}
+
+% @registeredsymbol - R in a circle. The font for the R should really
+% be smaller yet, but lllsize is the best we can do for now.
+% Adapted from the plain.tex definition of \copyright.
+%
+\def\registeredsymbol{%
+ $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
+ \hfil\crcr\Orb}}%
+ }$%
+}
+
+% @textdegree - the normal degrees sign.
+%
+\def\textdegree{$^\circ$}
+
+% Laurent Siebenmann reports \Orb undefined with:
+% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
+% so we'll define it if necessary.
+%
+\ifx\Orb\thisisundefined
+\def\Orb{\mathhexbox20D}
+\fi
+
+% Quotes.
+\chardef\quotedblleft="5C
+\chardef\quotedblright=`\"
+\chardef\quoteleft=`\`
+\chardef\quoteright=`\'
+
+
+\message{page headings,}
+
+\newskip\titlepagetopglue \titlepagetopglue = 1.5in
+\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
+
+% First the title page. Must do @settitle before @titlepage.
+\newif\ifseenauthor
+\newif\iffinishedtitlepage
+
+% Do an implicit @contents or @shortcontents after @end titlepage if the
+% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
+%
+\newif\ifsetcontentsaftertitlepage
+ \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
+\newif\ifsetshortcontentsaftertitlepage
+ \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
+
+\parseargdef\shorttitlepage{%
+ \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+ \endgroup\page\hbox{}\page}
+
+\envdef\titlepage{%
+ % Open one extra group, as we want to close it in the middle of \Etitlepage.
+ \begingroup
+ \parindent=0pt \textfonts
+ % Leave some space at the very top of the page.
+ \vglue\titlepagetopglue
+ % No rule at page bottom unless we print one at the top with @title.
+ \finishedtitlepagetrue
+ %
+ % Most title ``pages'' are actually two pages long, with space
+ % at the top of the second. We don't want the ragged left on the second.
+ \let\oldpage = \page
+ \def\page{%
+ \iffinishedtitlepage\else
+ \finishtitlepage
+ \fi
+ \let\page = \oldpage
+ \page
+ \null
+ }%
+}
+
+\def\Etitlepage{%
+ \iffinishedtitlepage\else
+ \finishtitlepage
+ \fi
+ % It is important to do the page break before ending the group,
+ % because the headline and footline are only empty inside the group.
+ % If we use the new definition of \page, we always get a blank page
+ % after the title page, which we certainly don't want.
+ \oldpage
+ \endgroup
+ %
+ % Need this before the \...aftertitlepage checks so that if they are
+ % in effect the toc pages will come out with page numbers.
+ \HEADINGSon
+ %
+ % If they want short, they certainly want long too.
+ \ifsetshortcontentsaftertitlepage
+ \shortcontents
+ \contents
+ \global\let\shortcontents = \relax
+ \global\let\contents = \relax
+ \fi
+ %
+ \ifsetcontentsaftertitlepage
+ \contents
+ \global\let\contents = \relax
+ \global\let\shortcontents = \relax
+ \fi
+}
+
+\def\finishtitlepage{%
+ \vskip4pt \hrule height 2pt width \hsize
+ \vskip\titlepagebottomglue
+ \finishedtitlepagetrue
+}
+
+% Macros to be used within @titlepage:
+
+\let\subtitlerm=\tenrm
+\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
+
+\parseargdef\title{%
+ \checkenv\titlepage
+ \leftline{\titlefonts\rmisbold #1}
+ % print a rule at the page bottom also.
+ \finishedtitlepagefalse
+ \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+}
+
+\parseargdef\subtitle{%
+ \checkenv\titlepage
+ {\subtitlefont \rightline{#1}}%
+}
+
+% @author should come last, but may come many times.
+% It can also be used inside @quotation.
+%
+\parseargdef\author{%
+ \def\temp{\quotation}%
+ \ifx\thisenv\temp
+ \def\quotationauthor{#1}% printed in \Equotation.
+ \else
+ \checkenv\titlepage
+ \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
+ {\secfonts\rmisbold \leftline{#1}}%
+ \fi
+}
+
+
+% Set up page headings and footings.
+
+\let\thispage=\folio
+
+\newtoks\evenheadline % headline on even pages
+\newtoks\oddheadline % headline on odd pages
+\newtoks\evenfootline % footline on even pages
+\newtoks\oddfootline % footline on odd pages
+
+% Now make TeX use those variables
+\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
+ \else \the\evenheadline \fi}}
+\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
+ \else \the\evenfootline \fi}\HEADINGShook}
+\let\HEADINGShook=\relax
+
+% Commands to set those variables.
+% For example, this is what @headings on does
+% @evenheading @thistitle|@thispage|@thischapter
+% @oddheading @thischapter|@thispage|@thistitle
+% @evenfooting @thisfile||
+% @oddfooting ||@thisfile
+
+
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
+\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
+\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
+\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
+\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
+ \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
+ %
+ % Leave some space for the footline. Hopefully ok to assume
+ % @evenfooting will not be used by itself.
+ \global\advance\pageheight by -12pt
+ \global\advance\vsize by -12pt
+}
+
+\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
+
+% @evenheadingmarks top \thischapter <- chapter at the top of a page
+% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
+%
+% The same set of arguments for:
+%
+% @oddheadingmarks
+% @evenfootingmarks
+% @oddfootingmarks
+% @everyheadingmarks
+% @everyfootingmarks
+
+\def\evenheadingmarks{\headingmarks{even}{heading}}
+\def\oddheadingmarks{\headingmarks{odd}{heading}}
+\def\evenfootingmarks{\headingmarks{even}{footing}}
+\def\oddfootingmarks{\headingmarks{odd}{footing}}
+\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
+ \headingmarks{odd}{heading}{#1} }
+\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
+ \headingmarks{odd}{footing}{#1} }
+% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
+\def\headingmarks#1#2#3 {%
+ \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
+ \global\expandafter\let\csname get#1#2marks\endcsname \temp
+}
+
+\everyheadingmarks bottom
+\everyfootingmarks bottom
+
+% @headings double turns headings on for double-sided printing.
+% @headings single turns headings on for single-sided printing.
+% @headings off turns them off.
+% @headings on same as @headings double, retained for compatibility.
+% @headings after turns on double-sided headings after this page.
+% @headings doubleafter turns on double-sided headings after this page.
+% @headings singleafter turns on single-sided headings after this page.
+% By default, they are off at the start of a document,
+% and turned `on' after @end titlepage.
+
+\def\headings #1 {\csname HEADINGS#1\endcsname}
+
+\def\headingsoff{% non-global headings elimination
+ \evenheadline={\hfil}\evenfootline={\hfil}%
+ \oddheadline={\hfil}\oddfootline={\hfil}%
+}
+
+\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
+\HEADINGSoff % it's the default
+
+% When we turn headings on, set the page number to 1.
+% For double-sided printing, put current file name in lower left corner,
+% chapter name on inside top of right hand pages, document
+% title on inside top of left hand pages, and page numbers on outside top
+% edge of all pages.
+\def\HEADINGSdouble{%
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+\let\contentsalignmacro = \chappager
+
+% For single-sided printing, chapter title goes across top left of page,
+% page number on top right.
+\def\HEADINGSsingle{%
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+\def\HEADINGSon{\HEADINGSdouble}
+
+\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
+\let\HEADINGSdoubleafter=\HEADINGSafter
+\def\HEADINGSdoublex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+
+\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
+\def\HEADINGSsinglex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+
+% Subroutines used in generating headings
+% This produces Day Month Year style of output.
+% Only define if not already defined, in case a txi-??.tex file has set
+% up a different format (e.g., txi-cs.tex does this).
+\ifx\today\thisisundefined
+\def\today{%
+ \number\day\space
+ \ifcase\month
+ \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
+ \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
+ \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
+ \fi
+ \space\number\year}
+\fi
+
+% @settitle line... specifies the title of the document, for headings.
+% It generates no output of its own.
+\def\thistitle{\putwordNoTitle}
+\def\settitle{\parsearg{\gdef\thistitle}}
+
+
+\message{tables,}
+% Tables -- @table, @ftable, @vtable, @item(x).
+
+% default indentation of table text
+\newdimen\tableindent \tableindent=.8in
+% default indentation of @itemize and @enumerate text
+\newdimen\itemindent \itemindent=.3in
+% margin between end of table item and start of table text.
+\newdimen\itemmargin \itemmargin=.1in
+
+% used internally for \itemindent minus \itemmargin
+\newdimen\itemmax
+
+% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
+% these defs.
+% They also define \itemindex
+% to index the item name in whatever manner is desired (perhaps none).
+
+\newif\ifitemxneedsnegativevskip
+
+\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
+
+\def\internalBitem{\smallbreak \parsearg\itemzzz}
+\def\internalBitemx{\itemxpar \parsearg\itemzzz}
+
+\def\itemzzz #1{\begingroup %
+ \advance\hsize by -\rightskip
+ \advance\hsize by -\tableindent
+ \setbox0=\hbox{\itemindicate{#1}}%
+ \itemindex{#1}%
+ \nobreak % This prevents a break before @itemx.
+ %
+ % If the item text does not fit in the space we have, put it on a line
+ % by itself, and do not allow a page break either before or after that
+ % line. We do not start a paragraph here because then if the next
+ % command is, e.g., @kindex, the whatsit would get put into the
+ % horizontal list on a line by itself, resulting in extra blank space.
+ \ifdim \wd0>\itemmax
+ %
+ % Make this a paragraph so we get the \parskip glue and wrapping,
+ % but leave it ragged-right.
+ \begingroup
+ \advance\leftskip by-\tableindent
+ \advance\hsize by\tableindent
+ \advance\rightskip by0pt plus1fil\relax
+ \leavevmode\unhbox0\par
+ \endgroup
+ %
+ % We're going to be starting a paragraph, but we don't want the
+ % \parskip glue -- logically it's part of the @item we just started.
+ \nobreak \vskip-\parskip
+ %
+ % Stop a page break at the \parskip glue coming up. However, if
+ % what follows is an environment such as @example, there will be no
+ % \parskip glue; then the negative vskip we just inserted would
+ % cause the example and the item to crash together. So we use this
+ % bizarre value of 10001 as a signal to \aboveenvbreak to insert
+ % \parskip glue after all. Section titles are handled this way also.
+ %
+ \penalty 10001
+ \endgroup
+ \itemxneedsnegativevskipfalse
+ \else
+ % The item text fits into the space. Start a paragraph, so that the
+ % following text (if any) will end up on the same line.
+ \noindent
+ % Do this with kerns and \unhbox so that if there is a footnote in
+ % the item text, it can migrate to the main vertical list and
+ % eventually be printed.
+ \nobreak\kern-\tableindent
+ \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
+ \unhbox0
+ \nobreak\kern\dimen0
+ \endgroup
+ \itemxneedsnegativevskiptrue
+ \fi
+}
+
+\def\item{\errmessage{@item while not in a list environment}}
+\def\itemx{\errmessage{@itemx while not in a list environment}}
+
+% @table, @ftable, @vtable.
+\envdef\table{%
+ \let\itemindex\gobble
+ \tablecheck{table}%
+}
+\envdef\ftable{%
+ \def\itemindex ##1{\doind {fn}{\code{##1}}}%
+ \tablecheck{ftable}%
+}
+\envdef\vtable{%
+ \def\itemindex ##1{\doind {vr}{\code{##1}}}%
+ \tablecheck{vtable}%
+}
+\def\tablecheck#1{%
+ \ifnum \the\catcode`\^^M=\active
+ \endgroup
+ \errmessage{This command won't work in this context; perhaps the problem is
+ that we are \inenvironment\thisenv}%
+ \def\next{\doignore{#1}}%
+ \else
+ \let\next\tablex
+ \fi
+ \next
+}
+\def\tablex#1{%
+ \def\itemindicate{#1}%
+ \parsearg\tabley
+}
+\def\tabley#1{%
+ {%
+ \makevalueexpandable
+ \edef\temp{\noexpand\tablez #1\space\space\space}%
+ \expandafter
+ }\temp \endtablez
+}
+\def\tablez #1 #2 #3 #4\endtablez{%
+ \aboveenvbreak
+ \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
+ \ifnum 0#2>0 \tableindent=#2\mil \fi
+ \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
+ \itemmax=\tableindent
+ \advance \itemmax by -\itemmargin
+ \advance \leftskip by \tableindent
+ \exdentamount=\tableindent
+ \parindent = 0pt
+ \parskip = \smallskipamount
+ \ifdim \parskip=0pt \parskip=2pt \fi
+ \let\item = \internalBitem
+ \let\itemx = \internalBitemx
+}
+\def\Etable{\endgraf\afterenvbreak}
+\let\Eftable\Etable
+\let\Evtable\Etable
+\let\Eitemize\Etable
+\let\Eenumerate\Etable
+
+% This is the counter used by @enumerate, which is really @itemize
+
+\newcount \itemno
+
+\envdef\itemize{\parsearg\doitemize}
+
+\def\doitemize#1{%
+ \aboveenvbreak
+ \itemmax=\itemindent
+ \advance\itemmax by -\itemmargin
+ \advance\leftskip by \itemindent
+ \exdentamount=\itemindent
+ \parindent=0pt
+ \parskip=\smallskipamount
+ \ifdim\parskip=0pt \parskip=2pt \fi
+ %
+ % Try typesetting the item mark that if the document erroneously says
+ % something like @itemize @samp (intending @table), there's an error
+ % right away at the @itemize. It's not the best error message in the
+ % world, but it's better than leaving it to the @item. This means if
+ % the user wants an empty mark, they have to say @w{} not just @w.
+ \def\itemcontents{#1}%
+ \setbox0 = \hbox{\itemcontents}%
+ %
+ % @itemize with no arg is equivalent to @itemize @bullet.
+ \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
+ %
+ \let\item=\itemizeitem
+}
+
+% Definition of @item while inside @itemize and @enumerate.
+%
+\def\itemizeitem{%
+ \advance\itemno by 1 % for enumerations
+ {\let\par=\endgraf \smallbreak}% reasonable place to break
+ {%
+ % If the document has an @itemize directly after a section title, a
+ % \nobreak will be last on the list, and \sectionheading will have
+ % done a \vskip-\parskip. In that case, we don't want to zero
+ % parskip, or the item text will crash with the heading. On the
+ % other hand, when there is normal text preceding the item (as there
+ % usually is), we do want to zero parskip, or there would be too much
+ % space. In that case, we won't have a \nobreak before. At least
+ % that's the theory.
+ \ifnum\lastpenalty<10000 \parskip=0in \fi
+ \noindent
+ \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
+ %
+ \vadjust{\penalty 1200}}% not good to break after first line of item.
+ \flushcr
+}
+
+% \splitoff TOKENS\endmark defines \first to be the first token in
+% TOKENS, and \rest to be the remainder.
+%
+\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
+
+% Allow an optional argument of an uppercase letter, lowercase letter,
+% or number, to specify the first label in the enumerated list. No
+% argument is the same as `1'.
+%
+\envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
+\def\enumeratey #1 #2\endenumeratey{%
+ % If we were given no argument, pretend we were given `1'.
+ \def\thearg{#1}%
+ \ifx\thearg\empty \def\thearg{1}\fi
+ %
+ % Detect if the argument is a single token. If so, it might be a
+ % letter. Otherwise, the only valid thing it can be is a number.
+ % (We will always have one token, because of the test we just made.
+ % This is a good thing, since \splitoff doesn't work given nothing at
+ % all -- the first parameter is undelimited.)
+ \expandafter\splitoff\thearg\endmark
+ \ifx\rest\empty
+ % Only one token in the argument. It could still be anything.
+ % A ``lowercase letter'' is one whose \lccode is nonzero.
+ % An ``uppercase letter'' is one whose \lccode is both nonzero, and
+ % not equal to itself.
+ % Otherwise, we assume it's a number.
+ %
+ % We need the \relax at the end of the \ifnum lines to stop TeX from
+ % continuing to look for a <number>.
+ %
+ \ifnum\lccode\expandafter`\thearg=0\relax
+ \numericenumerate % a number (we hope)
+ \else
+ % It's a letter.
+ \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
+ \lowercaseenumerate % lowercase letter
+ \else
+ \uppercaseenumerate % uppercase letter
+ \fi
+ \fi
+ \else
+ % Multiple tokens in the argument. We hope it's a number.
+ \numericenumerate
+ \fi
+}
+
+% An @enumerate whose labels are integers. The starting integer is
+% given in \thearg.
+%
+\def\numericenumerate{%
+ \itemno = \thearg
+ \startenumeration{\the\itemno}%
+}
+
+% The starting (lowercase) letter is in \thearg.
+\def\lowercaseenumerate{%
+ \itemno = \expandafter`\thearg
+ \startenumeration{%
+ % Be sure we're not beyond the end of the alphabet.
+ \ifnum\itemno=0
+ \errmessage{No more lowercase letters in @enumerate; get a bigger
+ alphabet}%
+ \fi
+ \char\lccode\itemno
+ }%
+}
+
+% The starting (uppercase) letter is in \thearg.
+\def\uppercaseenumerate{%
+ \itemno = \expandafter`\thearg
+ \startenumeration{%
+ % Be sure we're not beyond the end of the alphabet.
+ \ifnum\itemno=0
+ \errmessage{No more uppercase letters in @enumerate; get a bigger
+ alphabet}
+ \fi
+ \char\uccode\itemno
+ }%
+}
+
+% Call \doitemize, adding a period to the first argument and supplying the
+% common last two arguments. Also subtract one from the initial value in
+% \itemno, since @item increments \itemno.
+%
+\def\startenumeration#1{%
+ \advance\itemno by -1
+ \doitemize{#1.}\flushcr
+}
+
+% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
+% to @enumerate.
+%
+\def\alphaenumerate{\enumerate{a}}
+\def\capsenumerate{\enumerate{A}}
+\def\Ealphaenumerate{\Eenumerate}
+\def\Ecapsenumerate{\Eenumerate}
+
+
+% @multitable macros
+% Amy Hendrickson, 8/18/94, 3/6/96
+%
+% @multitable ... @end multitable will make as many columns as desired.
+% Contents of each column will wrap at width given in preamble. Width
+% can be specified either with sample text given in a template line,
+% or in percent of \hsize, the current width of text on page.
+
+% Table can continue over pages but will only break between lines.
+
+% To make preamble:
+%
+% Either define widths of columns in terms of percent of \hsize:
+% @multitable @columnfractions .25 .3 .45
+% @item ...
+%
+% Numbers following @columnfractions are the percent of the total
+% current hsize to be used for each column. You may use as many
+% columns as desired.
+
+
+% Or use a template:
+% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+% @item ...
+% using the widest term desired in each column.
+
+% Each new table line starts with @item, each subsequent new column
+% starts with @tab. Empty columns may be produced by supplying @tab's
+% with nothing between them for as many times as empty columns are needed,
+% ie, @tab@tab@tab will produce two empty columns.
+
+% @item, @tab do not need to be on their own lines, but it will not hurt
+% if they are.
+
+% Sample multitable:
+
+% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+% @item first col stuff @tab second col stuff @tab third col
+% @item
+% first col stuff
+% @tab
+% second col stuff
+% @tab
+% third col
+% @item first col stuff @tab second col stuff
+% @tab Many paragraphs of text may be used in any column.
+%
+% They will wrap at the width determined by the template.
+% @item@tab@tab This will be in third column.
+% @end multitable
+
+% Default dimensions may be reset by user.
+% @multitableparskip is vertical space between paragraphs in table.
+% @multitableparindent is paragraph indent in table.
+% @multitablecolmargin is horizontal space to be left between columns.
+% @multitablelinespace is space to leave between table items, baseline
+% to baseline.
+% 0pt means it depends on current normal line spacing.
+%
+\newskip\multitableparskip
+\newskip\multitableparindent
+\newdimen\multitablecolspace
+\newskip\multitablelinespace
+\multitableparskip=0pt
+\multitableparindent=6pt
+\multitablecolspace=12pt
+\multitablelinespace=0pt
+
+% Macros used to set up halign preamble:
+%
+\let\endsetuptable\relax
+\def\xendsetuptable{\endsetuptable}
+\let\columnfractions\relax
+\def\xcolumnfractions{\columnfractions}
+\newif\ifsetpercent
+
+% #1 is the @columnfraction, usually a decimal number like .5, but might
+% be just 1. We just use it, whatever it is.
+%
+\def\pickupwholefraction#1 {%
+ \global\advance\colcount by 1
+ \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
+ \setuptable
+}
+
+\newcount\colcount
+\def\setuptable#1{%
+ \def\firstarg{#1}%
+ \ifx\firstarg\xendsetuptable
+ \let\go = \relax
+ \else
+ \ifx\firstarg\xcolumnfractions
+ \global\setpercenttrue
+ \else
+ \ifsetpercent
+ \let\go\pickupwholefraction
+ \else
+ \global\advance\colcount by 1
+ \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
+ % separator; typically that is always in the input, anyway.
+ \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
+ \fi
+ \fi
+ \ifx\go\pickupwholefraction
+ % Put the argument back for the \pickupwholefraction call, so
+ % we'll always have a period there to be parsed.
+ \def\go{\pickupwholefraction#1}%
+ \else
+ \let\go = \setuptable
+ \fi%
+ \fi
+ \go
+}
+
+% multitable-only commands.
+%
+% @headitem starts a heading row, which we typeset in bold.
+% Assignments have to be global since we are inside the implicit group
+% of an alignment entry. \everycr resets \everytab so we don't have to
+% undo it ourselves.
+\def\headitemfont{\b}% for people to use in the template row; not changeable
+\def\headitem{%
+ \checkenv\multitable
+ \crcr
+ \global\everytab={\bf}% can't use \headitemfont since the parsing differs
+ \the\everytab % for the first item
+}%
+%
+% A \tab used to include \hskip1sp. But then the space in a template
+% line is not enough. That is bad. So let's go back to just `&' until
+% we again encounter the problem the 1sp was intended to solve.
+% --karl, nathan@acm.org, 20apr99.
+\def\tab{\checkenv\multitable &\the\everytab}%
+
+% @multitable ... @end multitable definitions:
+%
+\newtoks\everytab % insert after every tab.
+%
+\envdef\multitable{%
+ \vskip\parskip
+ \startsavinginserts
+ %
+ % @item within a multitable starts a normal row.
+ % We use \def instead of \let so that if one of the multitable entries
+ % contains an @itemize, we don't choke on the \item (seen as \crcr aka
+ % \endtemplate) expanding \doitemize.
+ \def\item{\crcr}%
+ %
+ \tolerance=9500
+ \hbadness=9500
+ \setmultitablespacing
+ \parskip=\multitableparskip
+ \parindent=\multitableparindent
+ \overfullrule=0pt
+ \global\colcount=0
+ %
+ \everycr = {%
+ \noalign{%
+ \global\everytab={}%
+ \global\colcount=0 % Reset the column counter.
+ % Check for saved footnotes, etc.
+ \checkinserts
+ % Keeps underfull box messages off when table breaks over pages.
+ %\filbreak
+ % Maybe so, but it also creates really weird page breaks when the
+ % table breaks over pages. Wouldn't \vfil be better? Wait until the
+ % problem manifests itself, so it can be fixed for real --karl.
+ }%
+ }%
+ %
+ \parsearg\domultitable
+}
+\def\domultitable#1{%
+ % To parse everything between @multitable and @item:
+ \setuptable#1 \endsetuptable
+ %
+ % This preamble sets up a generic column definition, which will
+ % be used as many times as user calls for columns.
+ % \vtop will set a single line and will also let text wrap and
+ % continue for many paragraphs if desired.
+ \halign\bgroup &%
+ \global\advance\colcount by 1
+ \multistrut
+ \vtop{%
+ % Use the current \colcount to find the correct column width:
+ \hsize=\expandafter\csname col\the\colcount\endcsname
+ %
+ % In order to keep entries from bumping into each other
+ % we will add a \leftskip of \multitablecolspace to all columns after
+ % the first one.
+ %
+ % If a template has been used, we will add \multitablecolspace
+ % to the width of each template entry.
+ %
+ % If the user has set preamble in terms of percent of \hsize we will
+ % use that dimension as the width of the column, and the \leftskip
+ % will keep entries from bumping into each other. Table will start at
+ % left margin and final column will justify at right margin.
+ %
+ % Make sure we don't inherit \rightskip from the outer environment.
+ \rightskip=0pt
+ \ifnum\colcount=1
+ % The first column will be indented with the surrounding text.
+ \advance\hsize by\leftskip
+ \else
+ \ifsetpercent \else
+ % If user has not set preamble in terms of percent of \hsize
+ % we will advance \hsize by \multitablecolspace.
+ \advance\hsize by \multitablecolspace
+ \fi
+ % In either case we will make \leftskip=\multitablecolspace:
+ \leftskip=\multitablecolspace
+ \fi
+ % Ignoring space at the beginning and end avoids an occasional spurious
+ % blank line, when TeX decides to break the line at the space before the
+ % box from the multistrut, so the strut ends up on a line by itself.
+ % For example:
+ % @multitable @columnfractions .11 .89
+ % @item @code{#}
+ % @tab Legal holiday which is valid in major parts of the whole country.
+ % Is automatically provided with highlighting sequences respectively
+ % marking characters.
+ \noindent\ignorespaces##\unskip\multistrut
+ }\cr
+}
+\def\Emultitable{%
+ \crcr
+ \egroup % end the \halign
+ \global\setpercentfalse
+}
+
+\def\setmultitablespacing{%
+ \def\multistrut{\strut}% just use the standard line spacing
+ %
+ % Compute \multitablelinespace (if not defined by user) for use in
+ % \multitableparskip calculation. We used define \multistrut based on
+ % this, but (ironically) that caused the spacing to be off.
+ % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
+\ifdim\multitablelinespace=0pt
+\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
+\global\advance\multitablelinespace by-\ht0
+\fi
+% Test to see if parskip is larger than space between lines of
+% table. If not, do nothing.
+% If so, set to same dimension as multitablelinespace.
+\ifdim\multitableparskip>\multitablelinespace
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
+ % than skip between lines in the table.
+\fi%
+\ifdim\multitableparskip=0pt
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
+ % than skip between lines in the table.
+\fi}
+
+
+\message{conditionals,}
+
+% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
+% @ifnotxml always succeed. They currently do nothing; we don't
+% attempt to check whether the conditionals are properly nested. But we
+% have to remember that they are conditionals, so that @end doesn't
+% attempt to close an environment group.
+%
+\def\makecond#1{%
+ \expandafter\let\csname #1\endcsname = \relax
+ \expandafter\let\csname iscond.#1\endcsname = 1
+}
+\makecond{iftex}
+\makecond{ifnotdocbook}
+\makecond{ifnothtml}
+\makecond{ifnotinfo}
+\makecond{ifnotplaintext}
+\makecond{ifnotxml}
+
+% Ignore @ignore, @ifhtml, @ifinfo, and the like.
+%
+\def\direntry{\doignore{direntry}}
+\def\documentdescription{\doignore{documentdescription}}
+\def\docbook{\doignore{docbook}}
+\def\html{\doignore{html}}
+\def\ifdocbook{\doignore{ifdocbook}}
+\def\ifhtml{\doignore{ifhtml}}
+\def\ifinfo{\doignore{ifinfo}}
+\def\ifnottex{\doignore{ifnottex}}
+\def\ifplaintext{\doignore{ifplaintext}}
+\def\ifxml{\doignore{ifxml}}
+\def\ignore{\doignore{ignore}}
+\def\menu{\doignore{menu}}
+\def\xml{\doignore{xml}}
+
+% Ignore text until a line `@end #1', keeping track of nested conditionals.
+%
+% A count to remember the depth of nesting.
+\newcount\doignorecount
+
+\def\doignore#1{\begingroup
+ % Scan in ``verbatim'' mode:
+ \obeylines
+ \catcode`\@ = \other
+ \catcode`\{ = \other
+ \catcode`\} = \other
+ %
+ % Make sure that spaces turn into tokens that match what \doignoretext wants.
+ \spaceisspace
+ %
+ % Count number of #1's that we've seen.
+ \doignorecount = 0
+ %
+ % Swallow text until we reach the matching `@end #1'.
+ \dodoignore{#1}%
+}
+
+{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
+ \obeylines %
+ %
+ \gdef\dodoignore#1{%
+ % #1 contains the command name as a string, e.g., `ifinfo'.
+ %
+ % Define a command to find the next `@end #1'.
+ \long\def\doignoretext##1^^M@end #1{%
+ \doignoretextyyy##1^^M@#1\_STOP_}%
+ %
+ % And this command to find another #1 command, at the beginning of a
+ % line. (Otherwise, we would consider a line `@c @ifset', for
+ % example, to count as an @ifset for nesting.)
+ \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
+ %
+ % And now expand that command.
+ \doignoretext ^^M%
+ }%
+}
+
+\def\doignoreyyy#1{%
+ \def\temp{#1}%
+ \ifx\temp\empty % Nothing found.
+ \let\next\doignoretextzzz
+ \else % Found a nested condition, ...
+ \advance\doignorecount by 1
+ \let\next\doignoretextyyy % ..., look for another.
+ % If we're here, #1 ends with ^^M\ifinfo (for example).
+ \fi
+ \next #1% the token \_STOP_ is present just after this macro.
+}
+
+% We have to swallow the remaining "\_STOP_".
+%
+\def\doignoretextzzz#1{%
+ \ifnum\doignorecount = 0 % We have just found the outermost @end.
+ \let\next\enddoignore
+ \else % Still inside a nested condition.
+ \advance\doignorecount by -1
+ \let\next\doignoretext % Look for the next @end.
+ \fi
+ \next
+}
+
+% Finish off ignored text.
+{ \obeylines%
+ % Ignore anything after the last `@end #1'; this matters in verbatim
+ % environments, where otherwise the newline after an ignored conditional
+ % would result in a blank line in the output.
+ \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
+}
+
+
+% @set VAR sets the variable VAR to an empty value.
+% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
+%
+% Since we want to separate VAR from REST-OF-LINE (which might be
+% empty), we can't just use \parsearg; we have to insert a space of our
+% own to delimit the rest of the line, and then take it out again if we
+% didn't need it.
+% We rely on the fact that \parsearg sets \catcode`\ =10.
+%
+\parseargdef\set{\setyyy#1 \endsetyyy}
+\def\setyyy#1 #2\endsetyyy{%
+ {%
+ \makevalueexpandable
+ \def\temp{#2}%
+ \edef\next{\gdef\makecsname{SET#1}}%
+ \ifx\temp\empty
+ \next{}%
+ \else
+ \setzzz#2\endsetzzz
+ \fi
+ }%
+}
+% Remove the trailing space \setxxx inserted.
+\def\setzzz#1 \endsetzzz{\next{#1}}
+
+% @clear VAR clears (i.e., unsets) the variable VAR.
+%
+\parseargdef\clear{%
+ {%
+ \makevalueexpandable
+ \global\expandafter\let\csname SET#1\endcsname=\relax
+ }%
+}
+
+% @value{foo} gets the text saved in variable foo.
+\def\value{\begingroup\makevalueexpandable\valuexxx}
+\def\valuexxx#1{\expandablevalue{#1}\endgroup}
+{
+ \catcode`\- = \active \catcode`\_ = \active
+ %
+ \gdef\makevalueexpandable{%
+ \let\value = \expandablevalue
+ % We don't want these characters active, ...
+ \catcode`\-=\other \catcode`\_=\other
+ % ..., but we might end up with active ones in the argument if
+ % we're called from @code, as @code{@value{foo-bar_}}, though.
+ % So \let them to their normal equivalents.
+ \let-\realdash \let_\normalunderscore
+ }
+}
+
+% We have this subroutine so that we can handle at least some @value's
+% properly in indexes (we call \makevalueexpandable in \indexdummies).
+% The command has to be fully expandable (if the variable is set), since
+% the result winds up in the index file. This means that if the
+% variable's value contains other Texinfo commands, it's almost certain
+% it will fail (although perhaps we could fix that with sufficient work
+% to do a one-level expansion on the result, instead of complete).
+%
+\def\expandablevalue#1{%
+ \expandafter\ifx\csname SET#1\endcsname\relax
+ {[No value for ``#1'']}%
+ \message{Variable `#1', used in @value, is not set.}%
+ \else
+ \csname SET#1\endcsname
+ \fi
+}
+
+% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
+% with @set.
+%
+% To get special treatment of `@end ifset,' call \makeond and the redefine.
+%
+\makecond{ifset}
+\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
+\def\doifset#1#2{%
+ {%
+ \makevalueexpandable
+ \let\next=\empty
+ \expandafter\ifx\csname SET#2\endcsname\relax
+ #1% If not set, redefine \next.
+ \fi
+ \expandafter
+ }\next
+}
+\def\ifsetfail{\doignore{ifset}}
+
+% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% defined with @set, or has been undefined with @clear.
+%
+% The `\else' inside the `\doifset' parameter is a trick to reuse the
+% above code: if the variable is not set, do nothing, if it is set,
+% then redefine \next to \ifclearfail.
+%
+\makecond{ifclear}
+\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
+\def\ifclearfail{\doignore{ifclear}}
+
+% @dircategory CATEGORY -- specify a category of the dir file
+% which this file should belong to. Ignore this in TeX.
+\let\dircategory=\comment
+
+% @defininfoenclose.
+\let\definfoenclose=\comment
+
+
+\message{indexing,}
+% Index generation facilities
+
+% Define \newwrite to be identical to plain tex's \newwrite
+% except not \outer, so it can be used within macros and \if's.
+\edef\newwrite{\makecsname{ptexnewwrite}}
+
+% \newindex {foo} defines an index named foo.
+% It automatically defines \fooindex such that
+% \fooindex ...rest of line... puts an entry in the index foo.
+% It also defines \fooindfile to be the number of the output channel for
+% the file that accumulates this index. The file's extension is foo.
+% The name of an index should be no more than 2 characters long
+% for the sake of vms.
+%
+\def\newindex#1{%
+ \iflinks
+ \expandafter\newwrite \csname#1indfile\endcsname
+ \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
+ \fi
+ \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
+ \noexpand\doindex{#1}}
+}
+
+% @defindex foo == \newindex{foo}
+%
+\def\defindex{\parsearg\newindex}
+
+% Define @defcodeindex, like @defindex except put all entries in @code.
+%
+\def\defcodeindex{\parsearg\newcodeindex}
+%
+\def\newcodeindex#1{%
+ \iflinks
+ \expandafter\newwrite \csname#1indfile\endcsname
+ \openout \csname#1indfile\endcsname \jobname.#1
+ \fi
+ \expandafter\xdef\csname#1index\endcsname{%
+ \noexpand\docodeindex{#1}}%
+}
+
+
+% @synindex foo bar makes index foo feed into index bar.
+% Do this instead of @defindex foo if you don't want it as a separate index.
+%
+% @syncodeindex foo bar similar, but put all entries made for index foo
+% inside @code.
+%
+\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
+\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
+
+% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
+% #3 the target index (bar).
+\def\dosynindex#1#2#3{%
+ % Only do \closeout if we haven't already done it, else we'll end up
+ % closing the target index.
+ \expandafter \ifx\csname donesynindex#2\endcsname \relax
+ % The \closeout helps reduce unnecessary open files; the limit on the
+ % Acorn RISC OS is a mere 16 files.
+ \expandafter\closeout\csname#2indfile\endcsname
+ \expandafter\let\csname donesynindex#2\endcsname = 1
+ \fi
+ % redefine \fooindfile:
+ \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
+ \expandafter\let\csname#2indfile\endcsname=\temp
+ % redefine \fooindex:
+ \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
+}
+
+% Define \doindex, the driver for all \fooindex macros.
+% Argument #1 is generated by the calling \fooindex macro,
+% and it is "foo", the name of the index.
+
+% \doindex just uses \parsearg; it calls \doind for the actual work.
+% This is because \doind is more useful to call from other macros.
+
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+
+\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
+\def\singleindexer #1{\doind{\indexname}{#1}}
+
+% like the previous two, but they put @code around the argument.
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
+\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+
+% Take care of Texinfo commands that can appear in an index entry.
+% Since there are some commands we want to expand, and others we don't,
+% we have to laboriously prevent expansion for those that we don't.
+%
+\def\indexdummies{%
+ \escapechar = `\\ % use backslash in output files.
+ \def\@{@}% change to @@ when we switch to @ as escape char in index files.
+ \def\ {\realbackslash\space }%
+ %
+ % Need these unexpandable (because we define \tt as a dummy)
+ % definitions when @{ or @} appear in index entry text. Also, more
+ % complicated, when \tex is in effect and \{ is a \delimiter again.
+ % We can't use \lbracecmd and \rbracecmd because texindex assumes
+ % braces and backslashes are used only as delimiters. Perhaps we
+ % should define @lbrace and @rbrace commands a la @comma.
+ \def\{{{\tt\char123}}%
+ \def\}{{\tt\char125}}%
+ %
+ % I don't entirely understand this, but when an index entry is
+ % generated from a macro call, the \endinput which \scanmacro inserts
+ % causes processing to be prematurely terminated. This is,
+ % apparently, because \indexsorttmp is fully expanded, and \endinput
+ % is an expandable command. The redefinition below makes \endinput
+ % disappear altogether for that purpose -- although logging shows that
+ % processing continues to some further point. On the other hand, it
+ % seems \endinput does not hurt in the printed index arg, since that
+ % is still getting written without apparent harm.
+ %
+ % Sample source (mac-idx3.tex, reported by Graham Percival to
+ % help-texinfo, 22may06):
+ % @macro funindex {WORD}
+ % @findex xyz
+ % @end macro
+ % ...
+ % @funindex commtest
+ %
+ % The above is not enough to reproduce the bug, but it gives the flavor.
+ %
+ % Sample whatsit resulting:
+ % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
+ %
+ % So:
+ \let\endinput = \empty
+ %
+ % Do the redefinitions.
+ \commondummies
+}
+
+% For the aux and toc files, @ is the escape character. So we want to
+% redefine everything using @ as the escape character (instead of
+% \realbackslash, still used for index files). When everything uses @,
+% this will be simpler.
+%
+\def\atdummies{%
+ \def\@{@@}%
+ \def\ {@ }%
+ \let\{ = \lbraceatcmd
+ \let\} = \rbraceatcmd
+ %
+ % Do the redefinitions.
+ \commondummies
+ \otherbackslash
+}
+
+% Called from \indexdummies and \atdummies.
+%
+\def\commondummies{%
+ %
+ % \definedummyword defines \#1 as \string\#1\space, thus effectively
+ % preventing its expansion. This is used only for control words,
+ % not control letters, because the \space would be incorrect for
+ % control characters, but is needed to separate the control word
+ % from whatever follows.
+ %
+ % For control letters, we have \definedummyletter, which omits the
+ % space.
+ %
+ % These can be used both for control words that take an argument and
+ % those that do not. If it is followed by {arg} in the input, then
+ % that will dutifully get written to the index (or wherever).
+ %
+ \def\definedummyword ##1{\def##1{\string##1\space}}%
+ \def\definedummyletter##1{\def##1{\string##1}}%
+ \let\definedummyaccent\definedummyletter
+ %
+ \commondummiesnofonts
+ %
+ \definedummyletter\_%
+ \definedummyletter\-%
+ %
+ % Non-English letters.
+ \definedummyword\AA
+ \definedummyword\AE
+ \definedummyword\DH
+ \definedummyword\L
+ \definedummyword\O
+ \definedummyword\OE
+ \definedummyword\TH
+ \definedummyword\aa
+ \definedummyword\ae
+ \definedummyword\dh
+ \definedummyword\exclamdown
+ \definedummyword\l
+ \definedummyword\o
+ \definedummyword\oe
+ \definedummyword\ordf
+ \definedummyword\ordm
+ \definedummyword\questiondown
+ \definedummyword\ss
+ \definedummyword\th
+ %
+ % Although these internal commands shouldn't show up, sometimes they do.
+ \definedummyword\bf
+ \definedummyword\gtr
+ \definedummyword\hat
+ \definedummyword\less
+ \definedummyword\sf
+ \definedummyword\sl
+ \definedummyword\tclose
+ \definedummyword\tt
+ %
+ \definedummyword\LaTeX
+ \definedummyword\TeX
+ %
+ % Assorted special characters.
+ \definedummyword\arrow
+ \definedummyword\bullet
+ \definedummyword\comma
+ \definedummyword\copyright
+ \definedummyword\registeredsymbol
+ \definedummyword\dots
+ \definedummyword\enddots
+ \definedummyword\entrybreak
+ \definedummyword\equiv
+ \definedummyword\error
+ \definedummyword\euro
+ \definedummyword\expansion
+ \definedummyword\geq
+ \definedummyword\guillemetleft
+ \definedummyword\guillemetright
+ \definedummyword\guilsinglleft
+ \definedummyword\guilsinglright
+ \definedummyword\leq
+ \definedummyword\minus
+ \definedummyword\ogonek
+ \definedummyword\pounds
+ \definedummyword\point
+ \definedummyword\print
+ \definedummyword\quotedblbase
+ \definedummyword\quotedblleft
+ \definedummyword\quotedblright
+ \definedummyword\quoteleft
+ \definedummyword\quoteright
+ \definedummyword\quotesinglbase
+ \definedummyword\result
+ \definedummyword\textdegree
+ %
+ % We want to disable all macros so that they are not expanded by \write.
+ \macrolist
+ %
+ \normalturnoffactive
+ %
+ % Handle some cases of @value -- where it does not contain any
+ % (non-fully-expandable) commands.
+ \makevalueexpandable
+}
+
+% \commondummiesnofonts: common to \commondummies and \indexnofonts.
+%
+\def\commondummiesnofonts{%
+ % Control letters and accents.
+ \definedummyletter\!%
+ \definedummyaccent\"%
+ \definedummyaccent\'%
+ \definedummyletter\*%
+ \definedummyaccent\,%
+ \definedummyletter\.%
+ \definedummyletter\/%
+ \definedummyletter\:%
+ \definedummyaccent\=%
+ \definedummyletter\?%
+ \definedummyaccent\^%
+ \definedummyaccent\`%
+ \definedummyaccent\~%
+ \definedummyword\u
+ \definedummyword\v
+ \definedummyword\H
+ \definedummyword\dotaccent
+ \definedummyword\ogonek
+ \definedummyword\ringaccent
+ \definedummyword\tieaccent
+ \definedummyword\ubaraccent
+ \definedummyword\udotaccent
+ \definedummyword\dotless
+ %
+ % Texinfo font commands.
+ \definedummyword\b
+ \definedummyword\i
+ \definedummyword\r
+ \definedummyword\sansserif
+ \definedummyword\sc
+ \definedummyword\slanted
+ \definedummyword\t
+ %
+ % Commands that take arguments.
+ \definedummyword\acronym
+ \definedummyword\anchor
+ \definedummyword\cite
+ \definedummyword\code
+ \definedummyword\command
+ \definedummyword\dfn
+ \definedummyword\dmn
+ \definedummyword\email
+ \definedummyword\emph
+ \definedummyword\env
+ \definedummyword\file
+ \definedummyword\indicateurl
+ \definedummyword\kbd
+ \definedummyword\key
+ \definedummyword\math
+ \definedummyword\option
+ \definedummyword\pxref
+ \definedummyword\ref
+ \definedummyword\samp
+ \definedummyword\strong
+ \definedummyword\tie
+ \definedummyword\uref
+ \definedummyword\url
+ \definedummyword\var
+ \definedummyword\verb
+ \definedummyword\w
+ \definedummyword\xref
+}
+
+% \indexnofonts is used when outputting the strings to sort the index
+% by, and when constructing control sequence names. It eliminates all
+% control sequences and just writes whatever the best ASCII sort string
+% would be for a given command (usually its argument).
+%
+\def\indexnofonts{%
+ % Accent commands should become @asis.
+ \def\definedummyaccent##1{\let##1\asis}%
+ % We can just ignore other control letters.
+ \def\definedummyletter##1{\let##1\empty}%
+ % All control words become @asis by default; overrides below.
+ \let\definedummyword\definedummyaccent
+ %
+ \commondummiesnofonts
+ %
+ % Don't no-op \tt, since it isn't a user-level command
+ % and is used in the definitions of the active chars like <, >, |, etc.
+ % Likewise with the other plain tex font commands.
+ %\let\tt=\asis
+ %
+ \def\ { }%
+ \def\@{@}%
+ \def\_{\normalunderscore}%
+ \def\-{}% @- shouldn't affect sorting
+ %
+ % Unfortunately, texindex is not prepared to handle braces in the
+ % content at all. So for index sorting, we map @{ and @} to strings
+ % starting with |, since that ASCII character is between ASCII { and }.
+ \def\{{|a}%
+ \def\}{|b}%
+ %
+ % Non-English letters.
+ \def\AA{AA}%
+ \def\AE{AE}%
+ \def\DH{DZZ}%
+ \def\L{L}%
+ \def\OE{OE}%
+ \def\O{O}%
+ \def\TH{ZZZ}%
+ \def\aa{aa}%
+ \def\ae{ae}%
+ \def\dh{dzz}%
+ \def\exclamdown{!}%
+ \def\l{l}%
+ \def\oe{oe}%
+ \def\ordf{a}%
+ \def\ordm{o}%
+ \def\o{o}%
+ \def\questiondown{?}%
+ \def\ss{ss}%
+ \def\th{zzz}%
+ %
+ \def\LaTeX{LaTeX}%
+ \def\TeX{TeX}%
+ %
+ % Assorted special characters.
+ % (The following {} will end up in the sort string, but that's ok.)
+ \def\arrow{->}%
+ \def\bullet{bullet}%
+ \def\comma{,}%
+ \def\copyright{copyright}%
+ \def\dots{...}%
+ \def\enddots{...}%
+ \def\equiv{==}%
+ \def\error{error}%
+ \def\euro{euro}%
+ \def\expansion{==>}%
+ \def\geq{>=}%
+ \def\guillemetleft{<<}%
+ \def\guillemetright{>>}%
+ \def\guilsinglleft{<}%
+ \def\guilsinglright{>}%
+ \def\leq{<=}%
+ \def\minus{-}%
+ \def\point{.}%
+ \def\pounds{pounds}%
+ \def\print{-|}%
+ \def\quotedblbase{"}%
+ \def\quotedblleft{"}%
+ \def\quotedblright{"}%
+ \def\quoteleft{`}%
+ \def\quoteright{'}%
+ \def\quotesinglbase{,}%
+ \def\registeredsymbol{R}%
+ \def\result{=>}%
+ \def\textdegree{o}%
+ %
+ \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
+ \else \indexlquoteignore \fi
+ %
+ % We need to get rid of all macros, leaving only the arguments (if present).
+ % Of course this is not nearly correct, but it is the best we can do for now.
+ % makeinfo does not expand macros in the argument to @deffn, which ends up
+ % writing an index entry, and texindex isn't prepared for an index sort entry
+ % that starts with \.
+ %
+ % Since macro invocations are followed by braces, we can just redefine them
+ % to take a single TeX argument. The case of a macro invocation that
+ % goes to end-of-line is not handled.
+ %
+ \macrolist
+}
+
+% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
+% ignore left quotes in the sort term.
+{\catcode`\`=\active
+ \gdef\indexlquoteignore{\let`=\empty}}
+
+\let\indexbackslash=0 %overridden during \printindex.
+\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
+
+% Most index entries go through here, but \dosubind is the general case.
+% #1 is the index name, #2 is the entry text.
+\def\doind#1#2{\dosubind{#1}{#2}{}}
+
+% Workhorse for all \fooindexes.
+% #1 is name of index, #2 is stuff to put there, #3 is subentry --
+% empty if called from \doind, as we usually are (the main exception
+% is with most defuns, which call us directly).
+%
+\def\dosubind#1#2#3{%
+ \iflinks
+ {%
+ % Store the main index entry text (including the third arg).
+ \toks0 = {#2}%
+ % If third arg is present, precede it with a space.
+ \def\thirdarg{#3}%
+ \ifx\thirdarg\empty \else
+ \toks0 = \expandafter{\the\toks0 \space #3}%
+ \fi
+ %
+ \edef\writeto{\csname#1indfile\endcsname}%
+ %
+ \safewhatsit\dosubindwrite
+ }%
+ \fi
+}
+
+% Write the entry in \toks0 to the index file:
+%
+\def\dosubindwrite{%
+ % Put the index entry in the margin if desired.
+ \ifx\SETmarginindex\relax\else
+ \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
+ \fi
+ %
+ % Remember, we are within a group.
+ \indexdummies % Must do this here, since \bf, etc expand at this stage
+ \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
+ % so it will be output as is; and it will print as backslash.
+ %
+ % Process the index entry with all font commands turned off, to
+ % get the string to sort by.
+ {\indexnofonts
+ \edef\temp{\the\toks0}% need full expansion
+ \xdef\indexsorttmp{\temp}%
+ }%
+ %
+ % Set up the complete index entry, with both the sort key and
+ % the original text, including any font commands. We write
+ % three arguments to \entry to the .?? file (four in the
+ % subentry case), texindex reduces to two when writing the .??s
+ % sorted result.
+ \edef\temp{%
+ \write\writeto{%
+ \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
+ }%
+ \temp
+}
+
+% Take care of unwanted page breaks/skips around a whatsit:
+%
+% If a skip is the last thing on the list now, preserve it
+% by backing up by \lastskip, doing the \write, then inserting
+% the skip again. Otherwise, the whatsit generated by the
+% \write or \pdfdest will make \lastskip zero. The result is that
+% sequences like this:
+% @end defun
+% @tindex whatever
+% @defun ...
+% will have extra space inserted, because the \medbreak in the
+% start of the @defun won't see the skip inserted by the @end of
+% the previous defun.
+%
+% But don't do any of this if we're not in vertical mode. We
+% don't want to do a \vskip and prematurely end a paragraph.
+%
+% Avoid page breaks due to these extra skips, too.
+%
+% But wait, there is a catch there:
+% We'll have to check whether \lastskip is zero skip. \ifdim is not
+% sufficient for this purpose, as it ignores stretch and shrink parts
+% of the skip. The only way seems to be to check the textual
+% representation of the skip.
+%
+% The following is almost like \def\zeroskipmacro{0.0pt} except that
+% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
+%
+\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
+%
+\newskip\whatsitskip
+\newcount\whatsitpenalty
+%
+% ..., ready, GO:
+%
+\def\safewhatsit#1{\ifhmode
+ #1%
+ \else
+ % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
+ \whatsitskip = \lastskip
+ \edef\lastskipmacro{\the\lastskip}%
+ \whatsitpenalty = \lastpenalty
+ %
+ % If \lastskip is nonzero, that means the last item was a
+ % skip. And since a skip is discardable, that means this
+ % -\whatsitskip glue we're inserting is preceded by a
+ % non-discardable item, therefore it is not a potential
+ % breakpoint, therefore no \nobreak needed.
+ \ifx\lastskipmacro\zeroskipmacro
+ \else
+ \vskip-\whatsitskip
+ \fi
+ %
+ #1%
+ %
+ \ifx\lastskipmacro\zeroskipmacro
+ % If \lastskip was zero, perhaps the last item was a penalty, and
+ % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
+ % to re-insert the same penalty (values >10000 are used for various
+ % signals); since we just inserted a non-discardable item, any
+ % following glue (such as a \parskip) would be a breakpoint. For example:
+ % @deffn deffn-whatever
+ % @vindex index-whatever
+ % Description.
+ % would allow a break between the index-whatever whatsit
+ % and the "Description." paragraph.
+ \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
+ \else
+ % On the other hand, if we had a nonzero \lastskip,
+ % this make-up glue would be preceded by a non-discardable item
+ % (the whatsit from the \write), so we must insert a \nobreak.
+ \nobreak\vskip\whatsitskip
+ \fi
+\fi}
+
+% The index entry written in the file actually looks like
+% \entry {sortstring}{page}{topic}
+% or
+% \entry {sortstring}{page}{topic}{subtopic}
+% The texindex program reads in these files and writes files
+% containing these kinds of lines:
+% \initial {c}
+% before the first topic whose initial is c
+% \entry {topic}{pagelist}
+% for a topic that is used without subtopics
+% \primary {topic}
+% for the beginning of a topic that is used with subtopics
+% \secondary {subtopic}{pagelist}
+% for each subtopic.
+
+% Define the user-accessible indexing commands
+% @findex, @vindex, @kindex, @cindex.
+
+\def\findex {\fnindex}
+\def\kindex {\kyindex}
+\def\cindex {\cpindex}
+\def\vindex {\vrindex}
+\def\tindex {\tpindex}
+\def\pindex {\pgindex}
+
+\def\cindexsub {\begingroup\obeylines\cindexsub}
+{\obeylines %
+\gdef\cindexsub "#1" #2^^M{\endgroup %
+\dosubind{cp}{#2}{#1}}}
+
+% Define the macros used in formatting output of the sorted index material.
+
+% @printindex causes a particular index (the ??s file) to get printed.
+% It does not print any chapter heading (usually an @unnumbered).
+%
+\parseargdef\printindex{\begingroup
+ \dobreak \chapheadingskip{10000}%
+ %
+ \smallfonts \rm
+ \tolerance = 9500
+ \plainfrenchspacing
+ \everypar = {}% don't want the \kern\-parindent from indentation suppression.
+ %
+ % See if the index file exists and is nonempty.
+ % Change catcode of @ here so that if the index file contains
+ % \initial {@}
+ % as its first line, TeX doesn't complain about mismatched braces
+ % (because it thinks @} is a control sequence).
+ \catcode`\@ = 11
+ \openin 1 \jobname.#1s
+ \ifeof 1
+ % \enddoublecolumns gets confused if there is no text in the index,
+ % and it loses the chapter title and the aux file entries for the
+ % index. The easiest way to prevent this problem is to make sure
+ % there is some text.
+ \putwordIndexNonexistent
+ \else
+ %
+ % If the index file exists but is empty, then \openin leaves \ifeof
+ % false. We have to make TeX try to read something from the file, so
+ % it can discover if there is anything in it.
+ \read 1 to \temp
+ \ifeof 1
+ \putwordIndexIsEmpty
+ \else
+ % Index files are almost Texinfo source, but we use \ as the escape
+ % character. It would be better to use @, but that's too big a change
+ % to make right now.
+ \def\indexbackslash{\backslashcurfont}%
+ \catcode`\\ = 0
+ \escapechar = `\\
+ \begindoublecolumns
+ \input \jobname.#1s
+ \enddoublecolumns
+ \fi
+ \fi
+ \closein 1
+\endgroup}
+
+% These macros are used by the sorted index file itself.
+% Change them to control the appearance of the index.
+
+\def\initial#1{{%
+ % Some minor font changes for the special characters.
+ \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+ %
+ % Remove any glue we may have, we'll be inserting our own.
+ \removelastskip
+ %
+ % We like breaks before the index initials, so insert a bonus.
+ \nobreak
+ \vskip 0pt plus 3\baselineskip
+ \penalty 0
+ \vskip 0pt plus -3\baselineskip
+ %
+ % Typeset the initial. Making this add up to a whole number of
+ % baselineskips increases the chance of the dots lining up from column
+ % to column. It still won't often be perfect, because of the stretch
+ % we need before each entry, but it's better.
+ %
+ % No shrink because it confuses \balancecolumns.
+ \vskip 1.67\baselineskip plus .5\baselineskip
+ \leftline{\secbf #1}%
+ % Do our best not to break after the initial.
+ \nobreak
+ \vskip .33\baselineskip plus .1\baselineskip
+}}
+
+% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
+% then page number (#2) flushed to the right margin. It is used for index
+% and table of contents entries. The paragraph is indented by \leftskip.
+%
+% A straightforward implementation would start like this:
+% \def\entry#1#2{...
+% But this freezes the catcodes in the argument, and can cause problems to
+% @code, which sets - active. This problem was fixed by a kludge---
+% ``-'' was active throughout whole index, but this isn't really right.
+% The right solution is to prevent \entry from swallowing the whole text.
+% --kasal, 21nov03
+\def\entry{%
+ \begingroup
+ %
+ % Start a new paragraph if necessary, so our assignments below can't
+ % affect previous text.
+ \par
+ %
+ % Do not fill out the last line with white space.
+ \parfillskip = 0in
+ %
+ % No extra space above this paragraph.
+ \parskip = 0in
+ %
+ % Do not prefer a separate line ending with a hyphen to fewer lines.
+ \finalhyphendemerits = 0
+ %
+ % \hangindent is only relevant when the entry text and page number
+ % don't both fit on one line. In that case, bob suggests starting the
+ % dots pretty far over on the line. Unfortunately, a large
+ % indentation looks wrong when the entry text itself is broken across
+ % lines. So we use a small indentation and put up with long leaders.
+ %
+ % \hangafter is reset to 1 (which is the value we want) at the start
+ % of each paragraph, so we need not do anything with that.
+ \hangindent = 2em
+ %
+ % When the entry text needs to be broken, just fill out the first line
+ % with blank space.
+ \rightskip = 0pt plus1fil
+ %
+ % A bit of stretch before each entry for the benefit of balancing
+ % columns.
+ \vskip 0pt plus1pt
+ %
+ % When reading the text of entry, convert explicit line breaks
+ % from @* into spaces. The user might give these in long section
+ % titles, for instance.
+ \def\*{\unskip\space\ignorespaces}%
+ \def\entrybreak{\hfil\break}%
+ %
+ % Swallow the left brace of the text (first parameter):
+ \afterassignment\doentry
+ \let\temp =
+}
+\def\entrybreak{\unskip\space\ignorespaces}%
+\def\doentry{%
+ \bgroup % Instead of the swallowed brace.
+ \noindent
+ \aftergroup\finishentry
+ % And now comes the text of the entry.
+}
+\def\finishentry#1{%
+ % #1 is the page number.
+ %
+ % The following is kludged to not output a line of dots in the index if
+ % there are no page numbers. The next person who breaks this will be
+ % cursed by a Unix daemon.
+ \setbox\boxA = \hbox{#1}%
+ \ifdim\wd\boxA = 0pt
+ \ %
+ \else
+ %
+ % If we must, put the page number on a line of its own, and fill out
+ % this line with blank space. (The \hfil is overwhelmed with the
+ % fill leaders glue in \indexdotfill if the page number does fit.)
+ \hfil\penalty50
+ \null\nobreak\indexdotfill % Have leaders before the page number.
+ %
+ % The `\ ' here is removed by the implicit \unskip that TeX does as
+ % part of (the primitive) \par. Without it, a spurious underfull
+ % \hbox ensues.
+ \ifpdf
+ \pdfgettoks#1.%
+ \ \the\toksA
+ \else
+ \ #1%
+ \fi
+ \fi
+ \par
+ \endgroup
+}
+
+% Like plain.tex's \dotfill, except uses up at least 1 em.
+\def\indexdotfill{\cleaders
+ \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
+
+\def\primary #1{\line{#1\hfil}}
+
+\newskip\secondaryindent \secondaryindent=0.5cm
+\def\secondary#1#2{{%
+ \parfillskip=0in
+ \parskip=0in
+ \hangindent=1in
+ \hangafter=1
+ \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
+ \ifpdf
+ \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+ \else
+ #2
+ \fi
+ \par
+}}
+
+% Define two-column mode, which we use to typeset indexes.
+% Adapted from the TeXbook, page 416, which is to say,
+% the manmac.tex format used to print the TeXbook itself.
+\catcode`\@=11
+
+\newbox\partialpage
+\newdimen\doublecolumnhsize
+
+\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
+ % Grab any single-column material above us.
+ \output = {%
+ %
+ % Here is a possibility not foreseen in manmac: if we accumulate a
+ % whole lot of material, we might end up calling this \output
+ % routine twice in a row (see the doublecol-lose test, which is
+ % essentially a couple of indexes with @setchapternewpage off). In
+ % that case we just ship out what is in \partialpage with the normal
+ % output routine. Generally, \partialpage will be empty when this
+ % runs and this will be a no-op. See the indexspread.tex test case.
+ \ifvoid\partialpage \else
+ \onepageout{\pagecontents\partialpage}%
+ \fi
+ %
+ \global\setbox\partialpage = \vbox{%
+ % Unvbox the main output page.
+ \unvbox\PAGE
+ \kern-\topskip \kern\baselineskip
+ }%
+ }%
+ \eject % run that output routine to set \partialpage
+ %
+ % Use the double-column output routine for subsequent pages.
+ \output = {\doublecolumnout}%
+ %
+ % Change the page size parameters. We could do this once outside this
+ % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
+ % format, but then we repeat the same computation. Repeating a couple
+ % of assignments once per index is clearly meaningless for the
+ % execution time, so we may as well do it in one place.
+ %
+ % First we halve the line length, less a little for the gutter between
+ % the columns. We compute the gutter based on the line length, so it
+ % changes automatically with the paper format. The magic constant
+ % below is chosen so that the gutter has the same value (well, +-<1pt)
+ % as it did when we hard-coded it.
+ %
+ % We put the result in a separate register, \doublecolumhsize, so we
+ % can restore it in \pagesofar, after \hsize itself has (potentially)
+ % been clobbered.
+ %
+ \doublecolumnhsize = \hsize
+ \advance\doublecolumnhsize by -.04154\hsize
+ \divide\doublecolumnhsize by 2
+ \hsize = \doublecolumnhsize
+ %
+ % Double the \vsize as well. (We don't need a separate register here,
+ % since nobody clobbers \vsize.)
+ \vsize = 2\vsize
+}
+
+% The double-column output routine for all double-column pages except
+% the last.
+%
+\def\doublecolumnout{%
+ \splittopskip=\topskip \splitmaxdepth=\maxdepth
+ % Get the available space for the double columns -- the normal
+ % (undoubled) page height minus any material left over from the
+ % previous page.
+ \dimen@ = \vsize
+ \divide\dimen@ by 2
+ \advance\dimen@ by -\ht\partialpage
+ %
+ % box0 will be the left-hand column, box2 the right.
+ \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
+ \onepageout\pagesofar
+ \unvbox255
+ \penalty\outputpenalty
+}
+%
+% Re-output the contents of the output page -- any previous material,
+% followed by the two boxes we just split, in box0 and box2.
+\def\pagesofar{%
+ \unvbox\partialpage
+ %
+ \hsize = \doublecolumnhsize
+ \wd0=\hsize \wd2=\hsize
+ \hbox to\pagewidth{\box0\hfil\box2}%
+}
+%
+% All done with double columns.
+\def\enddoublecolumns{%
+ % The following penalty ensures that the page builder is exercised
+ % _before_ we change the output routine. This is necessary in the
+ % following situation:
+ %
+ % The last section of the index consists only of a single entry.
+ % Before this section, \pagetotal is less than \pagegoal, so no
+ % break occurs before the last section starts. However, the last
+ % section, consisting of \initial and the single \entry, does not
+ % fit on the page and has to be broken off. Without the following
+ % penalty the page builder will not be exercised until \eject
+ % below, and by that time we'll already have changed the output
+ % routine to the \balancecolumns version, so the next-to-last
+ % double-column page will be processed with \balancecolumns, which
+ % is wrong: The two columns will go to the main vertical list, with
+ % the broken-off section in the recent contributions. As soon as
+ % the output routine finishes, TeX starts reconsidering the page
+ % break. The two columns and the broken-off section both fit on the
+ % page, because the two columns now take up only half of the page
+ % goal. When TeX sees \eject from below which follows the final
+ % section, it invokes the new output routine that we've set after
+ % \balancecolumns below; \onepageout will try to fit the two columns
+ % and the final section into the vbox of \pageheight (see
+ % \pagebody), causing an overfull box.
+ %
+ % Note that glue won't work here, because glue does not exercise the
+ % page builder, unlike penalties (see The TeXbook, pp. 280-281).
+ \penalty0
+ %
+ \output = {%
+ % Split the last of the double-column material. Leave it on the
+ % current page, no automatic page break.
+ \balancecolumns
+ %
+ % If we end up splitting too much material for the current page,
+ % though, there will be another page break right after this \output
+ % invocation ends. Having called \balancecolumns once, we do not
+ % want to call it again. Therefore, reset \output to its normal
+ % definition right away. (We hope \balancecolumns will never be
+ % called on to balance too much material, but if it is, this makes
+ % the output somewhat more palatable.)
+ \global\output = {\onepageout{\pagecontents\PAGE}}%
+ }%
+ \eject
+ \endgroup % started in \begindoublecolumns
+ %
+ % \pagegoal was set to the doubled \vsize above, since we restarted
+ % the current page. We're now back to normal single-column
+ % typesetting, so reset \pagegoal to the normal \vsize (after the
+ % \endgroup where \vsize got restored).
+ \pagegoal = \vsize
+}
+%
+% Called at the end of the double column material.
+\def\balancecolumns{%
+ \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
+ \dimen@ = \ht0
+ \advance\dimen@ by \topskip
+ \advance\dimen@ by-\baselineskip
+ \divide\dimen@ by 2 % target to split to
+ %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
+ \splittopskip = \topskip
+ % Loop until we get a decent breakpoint.
+ {%
+ \vbadness = 10000
+ \loop
+ \global\setbox3 = \copy0
+ \global\setbox1 = \vsplit3 to \dimen@
+ \ifdim\ht3>\dimen@
+ \global\advance\dimen@ by 1pt
+ \repeat
+ }%
+ %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
+ \setbox0=\vbox to\dimen@{\unvbox1}%
+ \setbox2=\vbox to\dimen@{\unvbox3}%
+ %
+ \pagesofar
+}
+\catcode`\@ = \other
+
+
+\message{sectioning,}
+% Chapters, sections, etc.
+
+% Let's start with @part.
+\outer\parseargdef\part{\partzzz{#1}}
+\def\partzzz#1{%
+ \chapoddpage
+ \null
+ \vskip.3\vsize % move it down on the page a bit
+ \begingroup
+ \noindent \titlefonts\rmisbold #1\par % the text
+ \let\lastnode=\empty % no node to associate with
+ \writetocentry{part}{#1}{}% but put it in the toc
+ \headingsoff % no headline or footline on the part page
+ \chapoddpage
+ \endgroup
+}
+
+% \unnumberedno is an oxymoron. But we count the unnumbered
+% sections so that we can refer to them unambiguously in the pdf
+% outlines by their "section number". We avoid collisions with chapter
+% numbers by starting them at 10000. (If a document ever has 10000
+% chapters, we're in trouble anyway, I'm sure.)
+\newcount\unnumberedno \unnumberedno = 10000
+\newcount\chapno
+\newcount\secno \secno=0
+\newcount\subsecno \subsecno=0
+\newcount\subsubsecno \subsubsecno=0
+
+% This counter is funny since it counts through charcodes of letters A, B, ...
+\newcount\appendixno \appendixno = `\@
+%
+% \def\appendixletter{\char\the\appendixno}
+% We do the following ugly conditional instead of the above simple
+% construct for the sake of pdftex, which needs the actual
+% letter in the expansion, not just typeset.
+%
+\def\appendixletter{%
+ \ifnum\appendixno=`A A%
+ \else\ifnum\appendixno=`B B%
+ \else\ifnum\appendixno=`C C%
+ \else\ifnum\appendixno=`D D%
+ \else\ifnum\appendixno=`E E%
+ \else\ifnum\appendixno=`F F%
+ \else\ifnum\appendixno=`G G%
+ \else\ifnum\appendixno=`H H%
+ \else\ifnum\appendixno=`I I%
+ \else\ifnum\appendixno=`J J%
+ \else\ifnum\appendixno=`K K%
+ \else\ifnum\appendixno=`L L%
+ \else\ifnum\appendixno=`M M%
+ \else\ifnum\appendixno=`N N%
+ \else\ifnum\appendixno=`O O%
+ \else\ifnum\appendixno=`P P%
+ \else\ifnum\appendixno=`Q Q%
+ \else\ifnum\appendixno=`R R%
+ \else\ifnum\appendixno=`S S%
+ \else\ifnum\appendixno=`T T%
+ \else\ifnum\appendixno=`U U%
+ \else\ifnum\appendixno=`V V%
+ \else\ifnum\appendixno=`W W%
+ \else\ifnum\appendixno=`X X%
+ \else\ifnum\appendixno=`Y Y%
+ \else\ifnum\appendixno=`Z Z%
+ % The \the is necessary, despite appearances, because \appendixletter is
+ % expanded while writing the .toc file. \char\appendixno is not
+ % expandable, thus it is written literally, thus all appendixes come out
+ % with the same letter (or @) in the toc without it.
+ \else\char\the\appendixno
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
+% Each @chapter defines these (using marks) as the number+name, number
+% and name of the chapter. Page headings and footings can use
+% these. @section does likewise.
+\def\thischapter{}
+\def\thischapternum{}
+\def\thischaptername{}
+\def\thissection{}
+\def\thissectionnum{}
+\def\thissectionname{}
+
+\newcount\absseclevel % used to calculate proper heading level
+\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
+
+% @raisesections: treat @section as chapter, @subsection as section, etc.
+\def\raisesections{\global\advance\secbase by -1}
+\let\up=\raisesections % original BFox name
+
+% @lowersections: treat @chapter as section, @section as subsection, etc.
+\def\lowersections{\global\advance\secbase by 1}
+\let\down=\lowersections % original BFox name
+
+% we only have subsub.
+\chardef\maxseclevel = 3
+%
+% A numbered section within an unnumbered changes to unnumbered too.
+% To achieve this, remember the "biggest" unnum. sec. we are currently in:
+\chardef\unnlevel = \maxseclevel
+%
+% Trace whether the current chapter is an appendix or not:
+% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
+\def\chapheadtype{N}
+
+% Choose a heading macro
+% #1 is heading type
+% #2 is heading level
+% #3 is text for heading
+\def\genhead#1#2#3{%
+ % Compute the abs. sec. level:
+ \absseclevel=#2
+ \advance\absseclevel by \secbase
+ % Make sure \absseclevel doesn't fall outside the range:
+ \ifnum \absseclevel < 0
+ \absseclevel = 0
+ \else
+ \ifnum \absseclevel > 3
+ \absseclevel = 3
+ \fi
+ \fi
+ % The heading type:
+ \def\headtype{#1}%
+ \if \headtype U%
+ \ifnum \absseclevel < \unnlevel
+ \chardef\unnlevel = \absseclevel
+ \fi
+ \else
+ % Check for appendix sections:
+ \ifnum \absseclevel = 0
+ \edef\chapheadtype{\headtype}%
+ \else
+ \if \headtype A\if \chapheadtype N%
+ \errmessage{@appendix... within a non-appendix chapter}%
+ \fi\fi
+ \fi
+ % Check for numbered within unnumbered:
+ \ifnum \absseclevel > \unnlevel
+ \def\headtype{U}%
+ \else
+ \chardef\unnlevel = 3
+ \fi
+ \fi
+ % Now print the heading:
+ \if \headtype U%
+ \ifcase\absseclevel
+ \unnumberedzzz{#3}%
+ \or \unnumberedseczzz{#3}%
+ \or \unnumberedsubseczzz{#3}%
+ \or \unnumberedsubsubseczzz{#3}%
+ \fi
+ \else
+ \if \headtype A%
+ \ifcase\absseclevel
+ \appendixzzz{#3}%
+ \or \appendixsectionzzz{#3}%
+ \or \appendixsubseczzz{#3}%
+ \or \appendixsubsubseczzz{#3}%
+ \fi
+ \else
+ \ifcase\absseclevel
+ \chapterzzz{#3}%
+ \or \seczzz{#3}%
+ \or \numberedsubseczzz{#3}%
+ \or \numberedsubsubseczzz{#3}%
+ \fi
+ \fi
+ \fi
+ \suppressfirstparagraphindent
+}
+
+% an interface:
+\def\numhead{\genhead N}
+\def\apphead{\genhead A}
+\def\unnmhead{\genhead U}
+
+% @chapter, @appendix, @unnumbered. Increment top-level counter, reset
+% all lower-level sectioning counters to zero.
+%
+% Also set \chaplevelprefix, which we prepend to @float sequence numbers
+% (e.g., figures), q.v. By default (before any chapter), that is empty.
+\let\chaplevelprefix = \empty
+%
+\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\def\chapterzzz#1{%
+ % section resetting is \global in case the chapter is in a group, such
+ % as an @include file.
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\chapno by 1
+ %
+ % Used for \float.
+ \gdef\chaplevelprefix{\the\chapno.}%
+ \resetallfloatnos
+ %
+ % \putwordChapter can contain complex things in translations.
+ \toks0=\expandafter{\putwordChapter}%
+ \message{\the\toks0 \space \the\chapno}%
+ %
+ % Write the actual heading.
+ \chapmacro{#1}{Ynumbered}{\the\chapno}%
+ %
+ % So @section and the like are numbered underneath this chapter.
+ \global\let\section = \numberedsec
+ \global\let\subsection = \numberedsubsec
+ \global\let\subsubsection = \numberedsubsubsec
+}
+
+\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
+%
+\def\appendixzzz#1{%
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\appendixno by 1
+ \gdef\chaplevelprefix{\appendixletter.}%
+ \resetallfloatnos
+ %
+ % \putwordAppendix can contain complex things in translations.
+ \toks0=\expandafter{\putwordAppendix}%
+ \message{\the\toks0 \space \appendixletter}%
+ %
+ \chapmacro{#1}{Yappendix}{\appendixletter}%
+ %
+ \global\let\section = \appendixsec
+ \global\let\subsection = \appendixsubsec
+ \global\let\subsubsection = \appendixsubsubsec
+}
+
+% normally unnmhead0 calls unnumberedzzz:
+\outer\parseargdef\unnumbered{\unnmhead0{#1}}
+\def\unnumberedzzz#1{%
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\unnumberedno by 1
+ %
+ % Since an unnumbered has no number, no prefix for figures.
+ \global\let\chaplevelprefix = \empty
+ \resetallfloatnos
+ %
+ % This used to be simply \message{#1}, but TeX fully expands the
+ % argument to \message. Therefore, if #1 contained @-commands, TeX
+ % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
+ % expanded @cite (which turns out to cause errors because \cite is meant
+ % to be executed, not expanded).
+ %
+ % Anyway, we don't want the fully-expanded definition of @cite to appear
+ % as a result of the \message, we just want `@cite' itself. We use
+ % \the<toks register> to achieve this: TeX expands \the<toks> only once,
+ % simply yielding the contents of <toks register>. (We also do this for
+ % the toc entries.)
+ \toks0 = {#1}%
+ \message{(\the\toks0)}%
+ %
+ \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
+ %
+ \global\let\section = \unnumberedsec
+ \global\let\subsection = \unnumberedsubsec
+ \global\let\subsubsection = \unnumberedsubsubsec
+}
+
+% @centerchap is like @unnumbered, but the heading is centered.
+\outer\parseargdef\centerchap{%
+ % Well, we could do the following in a group, but that would break
+ % an assumption that \chapmacro is called at the outermost level.
+ % Thus we are safer this way: --kasal, 24feb04
+ \let\centerparametersmaybe = \centerparameters
+ \unnmhead0{#1}%
+ \let\centerparametersmaybe = \relax
+}
+
+% @top is like @unnumbered.
+\let\top\unnumbered
+
+% Sections.
+%
+\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
+\def\seczzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
+}
+
+% normally calls appendixsectionzzz:
+\outer\parseargdef\appendixsection{\apphead1{#1}}
+\def\appendixsectionzzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
+}
+\let\appendixsec\appendixsection
+
+% normally calls unnumberedseczzz:
+\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
+\def\unnumberedseczzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
+}
+
+% Subsections.
+%
+% normally calls numberedsubseczzz:
+\outer\parseargdef\numberedsubsec{\numhead2{#1}}
+\def\numberedsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
+}
+
+% normally calls appendixsubseczzz:
+\outer\parseargdef\appendixsubsec{\apphead2{#1}}
+\def\appendixsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Yappendix}%
+ {\appendixletter.\the\secno.\the\subsecno}%
+}
+
+% normally calls unnumberedsubseczzz:
+\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
+\def\unnumberedsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Ynothing}%
+ {\the\unnumberedno.\the\secno.\the\subsecno}%
+}
+
+% Subsubsections.
+%
+% normally numberedsubsubseczzz:
+\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
+\def\numberedsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Ynumbered}%
+ {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+% normally appendixsubsubseczzz:
+\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
+\def\appendixsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Yappendix}%
+ {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+% normally unnumberedsubsubseczzz:
+\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
+\def\unnumberedsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Ynothing}%
+ {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+% These macros control what the section commands do, according
+% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
+% Define them by default for a numbered chapter.
+\let\section = \numberedsec
+\let\subsection = \numberedsubsec
+\let\subsubsection = \numberedsubsubsec
+
+% Define @majorheading, @heading and @subheading
+
+% NOTE on use of \vbox for chapter headings, section headings, and such:
+% 1) We use \vbox rather than the earlier \line to permit
+% overlong headings to fold.
+% 2) \hyphenpenalty is set to 10000 because hyphenation in a
+% heading is obnoxious; this forbids it.
+% 3) Likewise, headings look best if no \parindent is used, and
+% if justification is not attempted. Hence \raggedright.
+
+\def\majorheading{%
+ {\advance\chapheadingskip by 10pt \chapbreak }%
+ \parsearg\chapheadingzzz
+}
+
+\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
+\def\chapheadingzzz#1{%
+ {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\ptexraggedright
+ \rmisbold #1\hfill}}%
+ \bigskip \par\penalty 200\relax
+ \suppressfirstparagraphindent
+}
+
+% @heading, @subheading, @subsubheading.
+\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+
+% These macros generate a chapter, section, etc. heading only
+% (including whitespace, linebreaking, etc. around it),
+% given all the information in convenient, parsed form.
+
+% Args are the skip and penalty (usually negative)
+\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
+
+% Parameter controlling skip before chapter headings (if needed)
+\newskip\chapheadingskip
+
+% Define plain chapter starts, and page on/off switching for it.
+\def\chapbreak{\dobreak \chapheadingskip {-4000}}
+\def\chappager{\par\vfill\supereject}
+% Because \domark is called before \chapoddpage, the filler page will
+% get the headings for the next chapter, which is wrong. But we don't
+% care -- we just disable all headings on the filler page.
+\def\chapoddpage{%
+ \chappager
+ \ifodd\pageno \else
+ \begingroup
+ \headingsoff
+ \null
+ \chappager
+ \endgroup
+ \fi
+}
+
+\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+
+\def\CHAPPAGoff{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chapbreak
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGon{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chappager
+\global\let\pagealignmacro=\chappager
+\global\def\HEADINGSon{\HEADINGSsingle}}
+
+\def\CHAPPAGodd{%
+\global\let\contentsalignmacro = \chapoddpage
+\global\let\pchapsepmacro=\chapoddpage
+\global\let\pagealignmacro=\chapoddpage
+\global\def\HEADINGSon{\HEADINGSdouble}}
+
+\CHAPPAGon
+
+% Chapter opening.
+%
+% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
+% Yappendix, Yomitfromtoc), #3 the chapter number.
+%
+% To test against our argument.
+\def\Ynothingkeyword{Ynothing}
+\def\Yomitfromtockeyword{Yomitfromtoc}
+\def\Yappendixkeyword{Yappendix}
+%
+\def\chapmacro#1#2#3{%
+ % Insert the first mark before the heading break (see notes for \domark).
+ \let\prevchapterdefs=\lastchapterdefs
+ \let\prevsectiondefs=\lastsectiondefs
+ \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
+ \gdef\thissection{}}%
+ %
+ \def\temptype{#2}%
+ \ifx\temptype\Ynothingkeyword
+ \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+ \gdef\thischapter{\thischaptername}}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+ \gdef\thischapter{}}%
+ \else\ifx\temptype\Yappendixkeyword
+ \toks0={#1}%
+ \xdef\lastchapterdefs{%
+ \gdef\noexpand\thischaptername{\the\toks0}%
+ \gdef\noexpand\thischapternum{\appendixletter}%
+ % \noexpand\putwordAppendix avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
+ \noexpand\thischapternum:
+ \noexpand\thischaptername}%
+ }%
+ \else
+ \toks0={#1}%
+ \xdef\lastchapterdefs{%
+ \gdef\noexpand\thischaptername{\the\toks0}%
+ \gdef\noexpand\thischapternum{\the\chapno}%
+ % \noexpand\putwordChapter avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
+ \noexpand\thischapternum:
+ \noexpand\thischaptername}%
+ }%
+ \fi\fi\fi
+ %
+ % Output the mark. Pass it through \safewhatsit, to take care of
+ % the preceding space.
+ \safewhatsit\domark
+ %
+ % Insert the chapter heading break.
+ \pchapsepmacro
+ %
+ % Now the second mark, after the heading break. No break points
+ % between here and the heading.
+ \let\prevchapterdefs=\lastchapterdefs
+ \let\prevsectiondefs=\lastsectiondefs
+ \domark
+ %
+ {%
+ \chapfonts \rmisbold
+ %
+ % Have to define \lastsection before calling \donoderef, because the
+ % xref code eventually uses it. On the other hand, it has to be called
+ % after \pchapsepmacro, or the headline will change too soon.
+ \gdef\lastsection{#1}%
+ %
+ % Only insert the separating space if we have a chapter/appendix
+ % number, and don't print the unnumbered ``number''.
+ \ifx\temptype\Ynothingkeyword
+ \setbox0 = \hbox{}%
+ \def\toctype{unnchap}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
+ \def\toctype{omit}%
+ \else\ifx\temptype\Yappendixkeyword
+ \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
+ \def\toctype{app}%
+ \else
+ \setbox0 = \hbox{#3\enspace}%
+ \def\toctype{numchap}%
+ \fi\fi\fi
+ %
+ % Write the toc entry for this chapter. Must come before the
+ % \donoderef, because we include the current node name in the toc
+ % entry, and \donoderef resets it to empty.
+ \writetocentry{\toctype}{#1}{#3}%
+ %
+ % For pdftex, we have to write out the node definition (aka, make
+ % the pdfdest) after any page break, but before the actual text has
+ % been typeset. If the destination for the pdf outline is after the
+ % text, then jumping from the outline may wind up with the text not
+ % being visible, for instance under high magnification.
+ \donoderef{#2}%
+ %
+ % Typeset the actual heading.
+ \nobreak % Avoid page breaks at the interline glue.
+ \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
+ \hangindent=\wd0 \centerparametersmaybe
+ \unhbox0 #1\par}%
+ }%
+ \nobreak\bigskip % no page break after a chapter title
+ \nobreak
+}
+
+% @centerchap -- centered and unnumbered.
+\let\centerparametersmaybe = \relax
+\def\centerparameters{%
+ \advance\rightskip by 3\rightskip
+ \leftskip = \rightskip
+ \parfillskip = 0pt
+}
+
+
+% I don't think this chapter style is supported any more, so I'm not
+% updating it with the new noderef stuff. We'll see. --karl, 11aug03.
+%
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+%
+\def\unnchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\ptexraggedright
+ \rmisbold #1\hfill}}\bigskip \par\nobreak
+}
+\def\chfopen #1#2{\chapoddpage {\chapfonts
+\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
+\par\penalty 5000 %
+}
+\def\centerchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt
+ \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
+}
+\def\CHAPFopen{%
+ \global\let\chapmacro=\chfopen
+ \global\let\centerchapmacro=\centerchfopen}
+
+
+% Section titles. These macros combine the section number parts and
+% call the generic \sectionheading to do the printing.
+%
+\newskip\secheadingskip
+\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
+
+% Subsection titles.
+\newskip\subsecheadingskip
+\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
+
+% Subsubsection titles.
+\def\subsubsecheadingskip{\subsecheadingskip}
+\def\subsubsecheadingbreak{\subsecheadingbreak}
+
+
+% Print any size, any type, section title.
+%
+% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
+% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
+% section number.
+%
+\def\seckeyword{sec}
+%
+\def\sectionheading#1#2#3#4{%
+ {%
+ \checkenv{}% should not be in an environment.
+ %
+ % Switch to the right set of fonts.
+ \csname #2fonts\endcsname \rmisbold
+ %
+ \def\sectionlevel{#2}%
+ \def\temptype{#3}%
+ %
+ % Insert first mark before the heading break (see notes for \domark).
+ \let\prevsectiondefs=\lastsectiondefs
+ \ifx\temptype\Ynothingkeyword
+ \ifx\sectionlevel\seckeyword
+ \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
+ \gdef\thissection{\thissectionname}}%
+ \fi
+ \else\ifx\temptype\Yomitfromtockeyword
+ % Don't redefine \thissection.
+ \else\ifx\temptype\Yappendixkeyword
+ \ifx\sectionlevel\seckeyword
+ \toks0={#1}%
+ \xdef\lastsectiondefs{%
+ \gdef\noexpand\thissectionname{\the\toks0}%
+ \gdef\noexpand\thissectionnum{#4}%
+ % \noexpand\putwordSection avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thissection{\noexpand\putwordSection{}
+ \noexpand\thissectionnum:
+ \noexpand\thissectionname}%
+ }%
+ \fi
+ \else
+ \ifx\sectionlevel\seckeyword
+ \toks0={#1}%
+ \xdef\lastsectiondefs{%
+ \gdef\noexpand\thissectionname{\the\toks0}%
+ \gdef\noexpand\thissectionnum{#4}%
+ % \noexpand\putwordSection avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thissection{\noexpand\putwordSection{}
+ \noexpand\thissectionnum:
+ \noexpand\thissectionname}%
+ }%
+ \fi
+ \fi\fi\fi
+ %
+ % Go into vertical mode. Usually we'll already be there, but we
+ % don't want the following whatsit to end up in a preceding paragraph
+ % if the document didn't happen to have a blank line.
+ \par
+ %
+ % Output the mark. Pass it through \safewhatsit, to take care of
+ % the preceding space.
+ \safewhatsit\domark
+ %
+ % Insert space above the heading.
+ \csname #2headingbreak\endcsname
+ %
+ % Now the second mark, after the heading break. No break points
+ % between here and the heading.
+ \let\prevsectiondefs=\lastsectiondefs
+ \domark
+ %
+ % Only insert the space after the number if we have a section number.
+ \ifx\temptype\Ynothingkeyword
+ \setbox0 = \hbox{}%
+ \def\toctype{unn}%
+ \gdef\lastsection{#1}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ % for @headings -- no section number, don't include in toc,
+ % and don't redefine \lastsection.
+ \setbox0 = \hbox{}%
+ \def\toctype{omit}%
+ \let\sectionlevel=\empty
+ \else\ifx\temptype\Yappendixkeyword
+ \setbox0 = \hbox{#4\enspace}%
+ \def\toctype{app}%
+ \gdef\lastsection{#1}%
+ \else
+ \setbox0 = \hbox{#4\enspace}%
+ \def\toctype{num}%
+ \gdef\lastsection{#1}%
+ \fi\fi\fi
+ %
+ % Write the toc entry (before \donoderef). See comments in \chapmacro.
+ \writetocentry{\toctype\sectionlevel}{#1}{#4}%
+ %
+ % Write the node reference (= pdf destination for pdftex).
+ % Again, see comments in \chapmacro.
+ \donoderef{#3}%
+ %
+ % Interline glue will be inserted when the vbox is completed.
+ % That glue will be a valid breakpoint for the page, since it'll be
+ % preceded by a whatsit (usually from the \donoderef, or from the
+ % \writetocentry if there was no node). We don't want to allow that
+ % break, since then the whatsits could end up on page n while the
+ % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
+ \nobreak
+ %
+ % Output the actual section heading.
+ \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
+ \hangindent=\wd0 % zero if no section number
+ \unhbox0 #1}%
+ }%
+ % Add extra space after the heading -- half of whatever came above it.
+ % Don't allow stretch, though.
+ \kern .5 \csname #2headingskip\endcsname
+ %
+ % Do not let the kern be a potential breakpoint, as it would be if it
+ % was followed by glue.
+ \nobreak
+ %
+ % We'll almost certainly start a paragraph next, so don't let that
+ % glue accumulate. (Not a breakpoint because it's preceded by a
+ % discardable item.) However, when a paragraph is not started next
+ % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
+ % or the negative glue will cause weirdly wrong output, typically
+ % obscuring the section heading with something else.
+ \vskip-\parskip
+ %
+ % This is so the last item on the main vertical list is a known
+ % \penalty > 10000, so \startdefun, etc., can recognize the situation
+ % and do the needful.
+ \penalty 10001
+}
+
+
+\message{toc,}
+% Table of contents.
+\newwrite\tocfile
+
+% Write an entry to the toc file, opening it if necessary.
+% Called from @chapter, etc.
+%
+% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
+% We append the current node name (if any) and page number as additional
+% arguments for the \{chap,sec,...}entry macros which will eventually
+% read this. The node name is used in the pdf outlines as the
+% destination to jump to.
+%
+% We open the .toc file for writing here instead of at @setfilename (or
+% any other fixed time) so that @contents can be anywhere in the document.
+% But if #1 is `omit', then we don't do anything. This is used for the
+% table of contents chapter openings themselves.
+%
+\newif\iftocfileopened
+\def\omitkeyword{omit}%
+%
+\def\writetocentry#1#2#3{%
+ \edef\writetoctype{#1}%
+ \ifx\writetoctype\omitkeyword \else
+ \iftocfileopened\else
+ \immediate\openout\tocfile = \jobname.toc
+ \global\tocfileopenedtrue
+ \fi
+ %
+ \iflinks
+ {\atdummies
+ \edef\temp{%
+ \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
+ \temp
+ }%
+ \fi
+ \fi
+ %
+ % Tell \shipout to create a pdf destination on each page, if we're
+ % writing pdf. These are used in the table of contents. We can't
+ % just write one on every page because the title pages are numbered
+ % 1 and 2 (the page numbers aren't printed), and so are the first
+ % two pages of the document. Thus, we'd have two destinations named
+ % `1', and two named `2'.
+ \ifpdf \global\pdfmakepagedesttrue \fi
+}
+
+
+% These characters do not print properly in the Computer Modern roman
+% fonts, so we must take special care. This is more or less redundant
+% with the Texinfo input format setup at the end of this file.
+%
+\def\activecatcodes{%
+ \catcode`\"=\active
+ \catcode`\$=\active
+ \catcode`\<=\active
+ \catcode`\>=\active
+ \catcode`\\=\active
+ \catcode`\^=\active
+ \catcode`\_=\active
+ \catcode`\|=\active
+ \catcode`\~=\active
+}
+
+
+% Read the toc file, which is essentially Texinfo input.
+\def\readtocfile{%
+ \setupdatafile
+ \activecatcodes
+ \input \tocreadfilename
+}
+
+\newskip\contentsrightmargin \contentsrightmargin=1in
+\newcount\savepageno
+\newcount\lastnegativepageno \lastnegativepageno = -1
+
+% Prepare to read what we've written to \tocfile.
+%
+\def\startcontents#1{%
+ % If @setchapternewpage on, and @headings double, the contents should
+ % start on an odd page, unlike chapters. Thus, we maintain
+ % \contentsalignmacro in parallel with \pagealignmacro.
+ % From: Torbjorn Granlund <tege@matematik.su.se>
+ \contentsalignmacro
+ \immediate\closeout\tocfile
+ %
+ % Don't need to put `Contents' or `Short Contents' in the headline.
+ % It is abundantly clear what they are.
+ \chapmacro{#1}{Yomitfromtoc}{}%
+ %
+ \savepageno = \pageno
+ \begingroup % Set up to handle contents files properly.
+ \raggedbottom % Worry more about breakpoints than the bottom.
+ \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+ %
+ % Roman numerals for page numbers.
+ \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
+}
+
+% redefined for the two-volume lispref. We always output on
+% \jobname.toc even if this is redefined.
+%
+\def\tocreadfilename{\jobname.toc}
+
+% Normal (long) toc.
+%
+\def\contents{%
+ \startcontents{\putwordTOC}%
+ \openin 1 \tocreadfilename\space
+ \ifeof 1 \else
+ \readtocfile
+ \fi
+ \vfill \eject
+ \contentsalignmacro % in case @setchapternewpage odd is in effect
+ \ifeof 1 \else
+ \pdfmakeoutlines
+ \fi
+ \closein 1
+ \endgroup
+ \lastnegativepageno = \pageno
+ \global\pageno = \savepageno
+}
+
+% And just the chapters.
+\def\summarycontents{%
+ \startcontents{\putwordShortTOC}%
+ %
+ \let\partentry = \shortpartentry
+ \let\numchapentry = \shortchapentry
+ \let\appentry = \shortchapentry
+ \let\unnchapentry = \shortunnchapentry
+ % We want a true roman here for the page numbers.
+ \secfonts
+ \let\rm=\shortcontrm \let\bf=\shortcontbf
+ \let\sl=\shortcontsl \let\tt=\shortconttt
+ \rm
+ \hyphenpenalty = 10000
+ \advance\baselineskip by 1pt % Open it up a little.
+ \def\numsecentry##1##2##3##4{}
+ \let\appsecentry = \numsecentry
+ \let\unnsecentry = \numsecentry
+ \let\numsubsecentry = \numsecentry
+ \let\appsubsecentry = \numsecentry
+ \let\unnsubsecentry = \numsecentry
+ \let\numsubsubsecentry = \numsecentry
+ \let\appsubsubsecentry = \numsecentry
+ \let\unnsubsubsecentry = \numsecentry
+ \openin 1 \tocreadfilename\space
+ \ifeof 1 \else
+ \readtocfile
+ \fi
+ \closein 1
+ \vfill \eject
+ \contentsalignmacro % in case @setchapternewpage odd is in effect
+ \endgroup
+ \lastnegativepageno = \pageno
+ \global\pageno = \savepageno
+}
+\let\shortcontents = \summarycontents
+
+% Typeset the label for a chapter or appendix for the short contents.
+% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
+%
+\def\shortchaplabel#1{%
+ % This space should be enough, since a single number is .5em, and the
+ % widest letter (M) is 1em, at least in the Computer Modern fonts.
+ % But use \hss just in case.
+ % (This space doesn't include the extra space that gets added after
+ % the label; that gets put in by \shortchapentry above.)
+ %
+ % We'd like to right-justify chapter numbers, but that looks strange
+ % with appendix letters. And right-justifying numbers and
+ % left-justifying letters looks strange when there is less than 10
+ % chapters. Have to read the whole toc once to know how many chapters
+ % there are before deciding ...
+ \hbox to 1em{#1\hss}%
+}
+
+% These macros generate individual entries in the table of contents.
+% The first argument is the chapter or section name.
+% The last argument is the page number.
+% The arguments in between are the chapter number, section number, ...
+
+% Parts, in the main contents. Replace the part number, which doesn't
+% exist, with an empty box. Let's hope all the numbers have the same width.
+% Also ignore the page number, which is conventionally not printed.
+\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
+\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
+%
+% Parts, in the short toc.
+\def\shortpartentry#1#2#3#4{%
+ \penalty-300
+ \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
+ \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
+}
+
+% Chapters, in the main contents.
+\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
+%
+% Chapters, in the short toc.
+% See comments in \dochapentry re vbox and related settings.
+\def\shortchapentry#1#2#3#4{%
+ \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
+}
+
+% Appendices, in the main contents.
+% Need the word Appendix, and a fixed-size box.
+%
+\def\appendixbox#1{%
+ % We use M since it's probably the widest letter.
+ \setbox0 = \hbox{\putwordAppendix{} M}%
+ \hbox to \wd0{\putwordAppendix{} #1\hss}}
+%
+\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
+
+% Unnumbered chapters.
+\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
+\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
+
+% Sections.
+\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
+\let\appsecentry=\numsecentry
+\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
+
+% Subsections.
+\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
+\let\appsubsecentry=\numsubsecentry
+\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
+
+% And subsubsections.
+\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
+\let\appsubsubsecentry=\numsubsubsecentry
+\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
+
+% This parameter controls the indentation of the various levels.
+% Same as \defaultparindent.
+\newdimen\tocindent \tocindent = 15pt
+
+% Now for the actual typesetting. In all these, #1 is the text and #2 is the
+% page number.
+%
+% If the toc has to be broken over pages, we want it to be at chapters
+% if at all possible; hence the \penalty.
+\def\dochapentry#1#2{%
+ \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
+ \begingroup
+ \chapentryfonts
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+ \endgroup
+ \nobreak\vskip .25\baselineskip plus.1\baselineskip
+}
+
+\def\dosecentry#1#2{\begingroup
+ \secentryfonts \leftskip=\tocindent
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+\def\dosubsecentry#1#2{\begingroup
+ \subsecentryfonts \leftskip=2\tocindent
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+\def\dosubsubsecentry#1#2{\begingroup
+ \subsubsecentryfonts \leftskip=3\tocindent
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+% We use the same \entry macro as for the index entries.
+\let\tocentry = \entry
+
+% Space between chapter (or whatever) number and the title.
+\def\labelspace{\hskip1em \relax}
+
+\def\dopageno#1{{\rm #1}}
+\def\doshortpageno#1{{\rm #1}}
+
+\def\chapentryfonts{\secfonts \rm}
+\def\secentryfonts{\textfonts}
+\def\subsecentryfonts{\textfonts}
+\def\subsubsecentryfonts{\textfonts}
+
+
+\message{environments,}
+% @foo ... @end foo.
+
+% @tex ... @end tex escapes into raw TeX temporarily.
+% One exception: @ is still an escape character, so that @end tex works.
+% But \@ or @@ will get a plain @ character.
+
+\envdef\tex{%
+ \setupmarkupstyle{tex}%
+ \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+ \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+ \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
+ \catcode `\%=14
+ \catcode `\+=\other
+ \catcode `\"=\other
+ \catcode `\|=\other
+ \catcode `\<=\other
+ \catcode `\>=\other
+ \catcode`\`=\other
+ \catcode`\'=\other
+ \escapechar=`\\
+ %
+ % ' is active in math mode (mathcode"8000). So reset it, and all our
+ % other math active characters (just in case), to plain's definitions.
+ \mathactive
+ %
+ \let\b=\ptexb
+ \let\bullet=\ptexbullet
+ \let\c=\ptexc
+ \let\,=\ptexcomma
+ \let\.=\ptexdot
+ \let\dots=\ptexdots
+ \let\equiv=\ptexequiv
+ \let\!=\ptexexclam
+ \let\i=\ptexi
+ \let\indent=\ptexindent
+ \let\noindent=\ptexnoindent
+ \let\{=\ptexlbrace
+ \let\+=\tabalign
+ \let\}=\ptexrbrace
+ \let\/=\ptexslash
+ \let\*=\ptexstar
+ \let\t=\ptext
+ \expandafter \let\csname top\endcsname=\ptextop % outer
+ \let\frenchspacing=\plainfrenchspacing
+ %
+ \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
+ \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
+ \def\@{@}%
+}
+% There is no need to define \Etex.
+
+% Define @lisp ... @end lisp.
+% @lisp environment forms a group so it can rebind things,
+% including the definition of @end lisp (which normally is erroneous).
+
+% Amount to narrow the margins by for @lisp.
+\newskip\lispnarrowing \lispnarrowing=0.4in
+
+% This is the definition that ^^M gets inside @lisp, @example, and other
+% such environments. \null is better than a space, since it doesn't
+% have any width.
+\def\lisppar{\null\endgraf}
+
+% This space is always present above and below environments.
+\newskip\envskipamount \envskipamount = 0pt
+
+% Make spacing and below environment symmetrical. We use \parskip here
+% to help in doing that, since in @example-like environments \parskip
+% is reset to zero; thus the \afterenvbreak inserts no space -- but the
+% start of the next paragraph will insert \parskip.
+%
+\def\aboveenvbreak{{%
+ % =10000 instead of <10000 because of a special case in \itemzzz and
+ % \sectionheading, q.v.
+ \ifnum \lastpenalty=10000 \else
+ \advance\envskipamount by \parskip
+ \endgraf
+ \ifdim\lastskip<\envskipamount
+ \removelastskip
+ % it's not a good place to break if the last penalty was \nobreak
+ % or better ...
+ \ifnum\lastpenalty<10000 \penalty-50 \fi
+ \vskip\envskipamount
+ \fi
+ \fi
+}}
+
+\let\afterenvbreak = \aboveenvbreak
+
+% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
+% also clear it, so that its embedded environments do the narrowing again.
+\let\nonarrowing=\relax
+
+% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
+% environment contents.
+\font\circle=lcircle10
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+\circthick=\fontdimen8\circle
+%
+\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
+\def\ctr{{\hskip 6pt\circle\char'010}}
+\def\cbl{{\circle\char'012\hskip -6pt}}
+\def\cbr{{\hskip 6pt\circle\char'011}}
+\def\carttop{\hbox to \cartouter{\hskip\lskip
+ \ctl\leaders\hrule height\circthick\hfil\ctr
+ \hskip\rskip}}
+\def\cartbot{\hbox to \cartouter{\hskip\lskip
+ \cbl\leaders\hrule height\circthick\hfil\cbr
+ \hskip\rskip}}
+%
+\newskip\lskip\newskip\rskip
+
+\envdef\cartouche{%
+ \ifhmode\par\fi % can't be in the midst of a paragraph.
+ \startsavinginserts
+ \lskip=\leftskip \rskip=\rightskip
+ \leftskip=0pt\rightskip=0pt % we want these *outside*.
+ \cartinner=\hsize \advance\cartinner by-\lskip
+ \advance\cartinner by-\rskip
+ \cartouter=\hsize
+ \advance\cartouter by 18.4pt % allow for 3pt kerns on either
+ % side, and for 6pt waste from
+ % each corner char, and rule thickness
+ \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
+ % Flag to tell @lisp, etc., not to narrow margin.
+ \let\nonarrowing = t%
+ %
+ % If this cartouche directly follows a sectioning command, we need the
+ % \parskip glue (backspaced over by default) or the cartouche can
+ % collide with the section heading.
+ \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
+ %
+ \vbox\bgroup
+ \baselineskip=0pt\parskip=0pt\lineskip=0pt
+ \carttop
+ \hbox\bgroup
+ \hskip\lskip
+ \vrule\kern3pt
+ \vbox\bgroup
+ \kern3pt
+ \hsize=\cartinner
+ \baselineskip=\normbskip
+ \lineskip=\normlskip
+ \parskip=\normpskip
+ \vskip -\parskip
+ \comment % For explanation, see the end of def\group.
+}
+\def\Ecartouche{%
+ \ifhmode\par\fi
+ \kern3pt
+ \egroup
+ \kern3pt\vrule
+ \hskip\rskip
+ \egroup
+ \cartbot
+ \egroup
+ \checkinserts
+}
+
+
+% This macro is called at the beginning of all the @example variants,
+% inside a group.
+\newdimen\nonfillparindent
+\def\nonfillstart{%
+ \aboveenvbreak
+ \hfuzz = 12pt % Don't be fussy
+ \sepspaces % Make spaces be word-separators rather than space tokens.
+ \let\par = \lisppar % don't ignore blank lines
+ \obeylines % each line of input is a line of output
+ \parskip = 0pt
+ % Turn off paragraph indentation but redefine \indent to emulate
+ % the normal \indent.
+ \nonfillparindent=\parindent
+ \parindent = 0pt
+ \let\indent\nonfillindent
+ %
+ \emergencystretch = 0pt % don't try to avoid overfull boxes
+ \ifx\nonarrowing\relax
+ \advance \leftskip by \lispnarrowing
+ \exdentamount=\lispnarrowing
+ \else
+ \let\nonarrowing = \relax
+ \fi
+ \let\exdent=\nofillexdent
+}
+
+\begingroup
+\obeyspaces
+% We want to swallow spaces (but not other tokens) after the fake
+% @indent in our nonfill-environments, where spaces are normally
+% active and set to @tie, resulting in them not being ignored after
+% @indent.
+\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
+\gdef\nonfillindentcheck{%
+\ifx\temp %
+\expandafter\nonfillindentgobble%
+\else%
+\leavevmode\nonfillindentbox%
+\fi%
+}%
+\endgroup
+\def\nonfillindentgobble#1{\nonfillindent}
+\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
+
+% If you want all examples etc. small: @set dispenvsize small.
+% If you want even small examples the full size: @set dispenvsize nosmall.
+% This affects the following displayed environments:
+% @example, @display, @format, @lisp
+%
+\def\smallword{small}
+\def\nosmallword{nosmall}
+\let\SETdispenvsize\relax
+\def\setnormaldispenv{%
+ \ifx\SETdispenvsize\smallword
+ % end paragraph for sake of leading, in case document has no blank
+ % line. This is redundant with what happens in \aboveenvbreak, but
+ % we need to do it before changing the fonts, and it's inconvenient
+ % to change the fonts afterward.
+ \ifnum \lastpenalty=10000 \else \endgraf \fi
+ \smallexamplefonts \rm
+ \fi
+}
+\def\setsmalldispenv{%
+ \ifx\SETdispenvsize\nosmallword
+ \else
+ \ifnum \lastpenalty=10000 \else \endgraf \fi
+ \smallexamplefonts \rm
+ \fi
+}
+
+% We often define two environments, @foo and @smallfoo.
+% Let's do it in one command. #1 is the env name, #2 the definition.
+\def\makedispenvdef#1#2{%
+ \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
+ \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
+ \expandafter\let\csname E#1\endcsname \afterenvbreak
+ \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
+}
+
+% Define two environment synonyms (#1 and #2) for an environment.
+\def\maketwodispenvdef#1#2#3{%
+ \makedispenvdef{#1}{#3}%
+ \makedispenvdef{#2}{#3}%
+}
+%
+% @lisp: indented, narrowed, typewriter font;
+% @example: same as @lisp.
+%
+% @smallexample and @smalllisp: use smaller fonts.
+% Originally contributed by Pavel@xerox.
+%
+\maketwodispenvdef{lisp}{example}{%
+ \nonfillstart
+ \tt\setupmarkupstyle{example}%
+ \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
+ \gobble % eat return
+}
+% @display/@smalldisplay: same as @lisp except keep current font.
+%
+\makedispenvdef{display}{%
+ \nonfillstart
+ \gobble
+}
+
+% @format/@smallformat: same as @display except don't narrow margins.
+%
+\makedispenvdef{format}{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \gobble
+}
+
+% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
+\envdef\flushleft{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \gobble
+}
+\let\Eflushleft = \afterenvbreak
+
+% @flushright.
+%
+\envdef\flushright{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \advance\leftskip by 0pt plus 1fill\relax
+ \gobble
+}
+\let\Eflushright = \afterenvbreak
+
+
+% @raggedright does more-or-less normal line breaking but no right
+% justification. From plain.tex.
+\envdef\raggedright{%
+ \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
+}
+\let\Eraggedright\par
+
+\envdef\raggedleft{%
+ \parindent=0pt \leftskip0pt plus2em
+ \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
+ \hbadness=10000 % Last line will usually be underfull, so turn off
+ % badness reporting.
+}
+\let\Eraggedleft\par
+
+\envdef\raggedcenter{%
+ \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
+ \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
+ \hbadness=10000 % Last line will usually be underfull, so turn off
+ % badness reporting.
+}
+\let\Eraggedcenter\par
+
+
+% @quotation does normal linebreaking (hence we can't use \nonfillstart)
+% and narrows the margins. We keep \parskip nonzero in general, since
+% we're doing normal filling. So, when using \aboveenvbreak and
+% \afterenvbreak, temporarily make \parskip 0.
+%
+\makedispenvdef{quotation}{\quotationstart}
+%
+\def\quotationstart{%
+ {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
+ \parindent=0pt
+ %
+ % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
+ \ifx\nonarrowing\relax
+ \advance\leftskip by \lispnarrowing
+ \advance\rightskip by \lispnarrowing
+ \exdentamount = \lispnarrowing
+ \else
+ \let\nonarrowing = \relax
+ \fi
+ \parsearg\quotationlabel
+}
+
+% We have retained a nonzero parskip for the environment, since we're
+% doing normal filling.
+%
+\def\Equotation{%
+ \par
+ \ifx\quotationauthor\thisisundefined\else
+ % indent a bit.
+ \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
+ \fi
+ {\parskip=0pt \afterenvbreak}%
+}
+\def\Esmallquotation{\Equotation}
+
+% If we're given an argument, typeset it in bold with a colon after.
+\def\quotationlabel#1{%
+ \def\temp{#1}%
+ \ifx\temp\empty \else
+ {\bf #1: }%
+ \fi
+}
+
+
+% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
+% If we want to allow any <char> as delimiter,
+% we need the curly braces so that makeinfo sees the @verb command, eg:
+% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
+%
+% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
+%
+% [Knuth] p.344; only we need to do the other characters Texinfo sets
+% active too. Otherwise, they get lost as the first character on a
+% verbatim line.
+\def\dospecials{%
+ \do\ \do\\\do\{\do\}\do\$\do\&%
+ \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
+ \do\<\do\>\do\|\do\@\do+\do\"%
+ % Don't do the quotes -- if we do, @set txicodequoteundirected and
+ % @set txicodequotebacktick will not have effect on @verb and
+ % @verbatim, and ?` and !` ligatures won't get disabled.
+ %\do\`\do\'%
+}
+%
+% [Knuth] p. 380
+\def\uncatcodespecials{%
+ \def\do##1{\catcode`##1=\other}\dospecials}
+%
+% Setup for the @verb command.
+%
+% Eight spaces for a tab
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
+\endgroup
+%
+\def\setupverb{%
+ \tt % easiest (and conventionally used) font for verbatim
+ \def\par{\leavevmode\endgraf}%
+ \setupmarkupstyle{verb}%
+ \tabeightspaces
+ % Respect line breaks,
+ % print special symbols as themselves, and
+ % make each space count
+ % must do in this order:
+ \obeylines \uncatcodespecials \sepspaces
+}
+
+% Setup for the @verbatim environment
+%
+% Real tab expansion.
+\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
+%
+% We typeset each line of the verbatim in an \hbox, so we can handle
+% tabs. The \global is in case the verbatim line starts with an accent,
+% or some other command that starts with a begin-group. Otherwise, the
+% entire \verbbox would disappear at the corresponding end-group, before
+% it is typeset. Meanwhile, we can't have nested verbatim commands
+% (can we?), so the \global won't be overwriting itself.
+\newbox\verbbox
+\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
+%
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\tabexpand{%
+ \catcode`\^^I=\active
+ \def^^I{\leavevmode\egroup
+ \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
+ \divide\dimen\verbbox by\tabw
+ \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
+ \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
+ \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
+ }%
+ }
+\endgroup
+
+% start the verbatim environment.
+\def\setupverbatim{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \tt % easiest (and conventionally used) font for verbatim
+ % The \leavevmode here is for blank lines. Otherwise, we would
+ % never \starttabox and the \egroup would end verbatim mode.
+ \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
+ \tabexpand
+ \setupmarkupstyle{verbatim}%
+ % Respect line breaks,
+ % print special symbols as themselves, and
+ % make each space count.
+ % Must do in this order:
+ \obeylines \uncatcodespecials \sepspaces
+ \everypar{\starttabbox}%
+}
+
+% Do the @verb magic: verbatim text is quoted by unique
+% delimiter characters. Before first delimiter expect a
+% right brace, after last delimiter expect closing brace:
+%
+% \def\doverb'{'<char>#1<char>'}'{#1}
+%
+% [Knuth] p. 382; only eat outer {}
+\begingroup
+ \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
+ \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
+\endgroup
+%
+\def\verb{\begingroup\setupverb\doverb}
+%
+%
+% Do the @verbatim magic: define the macro \doverbatim so that
+% the (first) argument ends when '@end verbatim' is reached, ie:
+%
+% \def\doverbatim#1@end verbatim{#1}
+%
+% For Texinfo it's a lot easier than for LaTeX,
+% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
+% we need not redefine '\', '{' and '}'.
+%
+% Inspired by LaTeX's verbatim command set [latex.ltx]
+%
+\begingroup
+ \catcode`\ =\active
+ \obeylines %
+ % ignore everything up to the first ^^M, that's the newline at the end
+ % of the @verbatim input line itself. Otherwise we get an extra blank
+ % line in the output.
+ \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
+ % We really want {...\end verbatim} in the body of the macro, but
+ % without the active space; thus we have to use \xdef and \gobble.
+\endgroup
+%
+\envdef\verbatim{%
+ \setupverbatim\doverbatim
+}
+\let\Everbatim = \afterenvbreak
+
+
+% @verbatiminclude FILE - insert text of file in verbatim environment.
+%
+\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
+%
+\def\doverbatiminclude#1{%
+ {%
+ \makevalueexpandable
+ \setupverbatim
+ \indexnofonts % Allow `@@' and other weird things in file names.
+ \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
+ \input #1
+ \afterenvbreak
+ }%
+}
+
+% @copying ... @end copying.
+% Save the text away for @insertcopying later.
+%
+% We save the uninterpreted tokens, rather than creating a box.
+% Saving the text in a box would be much easier, but then all the
+% typesetting commands (@smallbook, font changes, etc.) have to be done
+% beforehand -- and a) we want @copying to be done first in the source
+% file; b) letting users define the frontmatter in as flexible order as
+% possible is very desirable.
+%
+\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
+\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
+%
+\def\insertcopying{%
+ \begingroup
+ \parindent = 0pt % paragraph indentation looks wrong on title page
+ \scanexp\copyingtext
+ \endgroup
+}
+
+
+\message{defuns,}
+% @defun etc.
+
+\newskip\defbodyindent \defbodyindent=.4in
+\newskip\defargsindent \defargsindent=50pt
+\newskip\deflastargmargin \deflastargmargin=18pt
+\newcount\defunpenalty
+
+% Start the processing of @deffn:
+\def\startdefun{%
+ \ifnum\lastpenalty<10000
+ \medbreak
+ \defunpenalty=10003 % Will keep this @deffn together with the
+ % following @def command, see below.
+ \else
+ % If there are two @def commands in a row, we'll have a \nobreak,
+ % which is there to keep the function description together with its
+ % header. But if there's nothing but headers, we need to allow a
+ % break somewhere. Check specifically for penalty 10002, inserted
+ % by \printdefunline, instead of 10000, since the sectioning
+ % commands also insert a nobreak penalty, and we don't want to allow
+ % a break between a section heading and a defun.
+ %
+ % As a further refinement, we avoid "club" headers by signalling
+ % with penalty of 10003 after the very first @deffn in the
+ % sequence (see above), and penalty of 10002 after any following
+ % @def command.
+ \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
+ %
+ % Similarly, after a section heading, do not allow a break.
+ % But do insert the glue.
+ \medskip % preceded by discardable penalty, so not a breakpoint
+ \fi
+ %
+ \parindent=0in
+ \advance\leftskip by \defbodyindent
+ \exdentamount=\defbodyindent
+}
+
+\def\dodefunx#1{%
+ % First, check whether we are in the right environment:
+ \checkenv#1%
+ %
+ % As above, allow line break if we have multiple x headers in a row.
+ % It's not a great place, though.
+ \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
+ %
+ % And now, it's time to reuse the body of the original defun:
+ \expandafter\gobbledefun#1%
+}
+\def\gobbledefun#1\startdefun{}
+
+% \printdefunline \deffnheader{text}
+%
+\def\printdefunline#1#2{%
+ \begingroup
+ % call \deffnheader:
+ #1#2 \endheader
+ % common ending:
+ \interlinepenalty = 10000
+ \advance\rightskip by 0pt plus 1fil\relax
+ \endgraf
+ \nobreak\vskip -\parskip
+ \penalty\defunpenalty % signal to \startdefun and \dodefunx
+ % Some of the @defun-type tags do not enable magic parentheses,
+ % rendering the following check redundant. But we don't optimize.
+ \checkparencounts
+ \endgroup
+}
+
+\def\Edefun{\endgraf\medbreak}
+
+% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
+% the only thing remaining is to define \deffnheader.
+%
+\def\makedefun#1{%
+ \expandafter\let\csname E#1\endcsname = \Edefun
+ \edef\temp{\noexpand\domakedefun
+ \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
+ \temp
+}
+
+% \domakedefun \deffn \deffnx \deffnheader
+%
+% Define \deffn and \deffnx, without parameters.
+% \deffnheader has to be defined explicitly.
+%
+\def\domakedefun#1#2#3{%
+ \envdef#1{%
+ \startdefun
+ \doingtypefnfalse % distinguish typed functions from all else
+ \parseargusing\activeparens{\printdefunline#3}%
+ }%
+ \def#2{\dodefunx#1}%
+ \def#3%
+}
+
+\newif\ifdoingtypefn % doing typed function?
+\newif\ifrettypeownline % typeset return type on its own line?
+
+% @deftypefnnewline on|off says whether the return type of typed functions
+% are printed on their own line. This affects @deftypefn, @deftypefun,
+% @deftypeop, and @deftypemethod.
+%
+\parseargdef\deftypefnnewline{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETtxideftypefnnl\endcsname
+ = \empty
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETtxideftypefnnl\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @txideftypefnnl value `\temp',
+ must be on|off}%
+ \fi\fi
+}
+
+% Untyped functions:
+
+% @deffn category name args
+\makedefun{deffn}{\deffngeneral{}}
+
+% @deffn category class name args
+\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
+
+% \defopon {category on}class name args
+\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+
+% \deffngeneral {subind}category name args
+%
+\def\deffngeneral#1#2 #3 #4\endheader{%
+ % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
+ \dosubind{fn}{\code{#3}}{#1}%
+ \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
+}
+
+% Typed functions:
+
+% @deftypefn category type name args
+\makedefun{deftypefn}{\deftypefngeneral{}}
+
+% @deftypeop category class type name args
+\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
+
+% \deftypeopon {category on}class type name args
+\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+
+% \deftypefngeneral {subind}category type name args
+%
+\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
+ \dosubind{fn}{\code{#4}}{#1}%
+ \doingtypefntrue
+ \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+}
+
+% Typed variables:
+
+% @deftypevr category type var args
+\makedefun{deftypevr}{\deftypecvgeneral{}}
+
+% @deftypecv category class type var args
+\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
+
+% \deftypecvof {category of}class type var args
+\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
+
+% \deftypecvgeneral {subind}category type var args
+%
+\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
+ \dosubind{vr}{\code{#4}}{#1}%
+ \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+}
+
+% Untyped variables:
+
+% @defvr category var args
+\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
+
+% @defcv category class var args
+\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
+
+% \defcvof {category of}class var args
+\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
+
+% Types:
+
+% @deftp category name args
+\makedefun{deftp}#1 #2 #3\endheader{%
+ \doind{tp}{\code{#2}}%
+ \defname{#1}{}{#2}\defunargs{#3\unskip}%
+}
+
+% Remaining @defun-like shortcuts:
+\makedefun{defun}{\deffnheader{\putwordDeffunc} }
+\makedefun{defmac}{\deffnheader{\putwordDefmac} }
+\makedefun{defspec}{\deffnheader{\putwordDefspec} }
+\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
+\makedefun{defvar}{\defvrheader{\putwordDefvar} }
+\makedefun{defopt}{\defvrheader{\putwordDefopt} }
+\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
+\makedefun{defmethod}{\defopon\putwordMethodon}
+\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
+\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
+\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
+
+% \defname, which formats the name of the @def (not the args).
+% #1 is the category, such as "Function".
+% #2 is the return type, if any.
+% #3 is the function name.
+%
+% We are followed by (but not passed) the arguments, if any.
+%
+\def\defname#1#2#3{%
+ \par
+ % Get the values of \leftskip and \rightskip as they were outside the @def...
+ \advance\leftskip by -\defbodyindent
+ %
+ % Determine if we are typesetting the return type of a typed function
+ % on a line by itself.
+ \rettypeownlinefalse
+ \ifdoingtypefn % doing a typed function specifically?
+ % then check user option for putting return type on its own line:
+ \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
+ \rettypeownlinetrue
+ \fi
+ \fi
+ %
+ % How we'll format the category name. Putting it in brackets helps
+ % distinguish it from the body text that may end up on the next line
+ % just below it.
+ \def\temp{#1}%
+ \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
+ %
+ % Figure out line sizes for the paragraph shape. We'll always have at
+ % least two.
+ \tempnum = 2
+ %
+ % The first line needs space for \box0; but if \rightskip is nonzero,
+ % we need only space for the part of \box0 which exceeds it:
+ \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
+ %
+ % If doing a return type on its own line, we'll have another line.
+ \ifrettypeownline
+ \advance\tempnum by 1
+ \def\maybeshapeline{0in \hsize}%
+ \else
+ \def\maybeshapeline{}%
+ \fi
+ %
+ % The continuations:
+ \dimen2=\hsize \advance\dimen2 by -\defargsindent
+ %
+ % The final paragraph shape:
+ \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
+ %
+ % Put the category name at the right margin.
+ \noindent
+ \hbox to 0pt{%
+ \hfil\box0 \kern-\hsize
+ % \hsize has to be shortened this way:
+ \kern\leftskip
+ % Intentionally do not respect \rightskip, since we need the space.
+ }%
+ %
+ % Allow all lines to be underfull without complaint:
+ \tolerance=10000 \hbadness=10000
+ \exdentamount=\defbodyindent
+ {%
+ % defun fonts. We use typewriter by default (used to be bold) because:
+ % . we're printing identifiers, they should be in tt in principle.
+ % . in languages with many accents, such as Czech or French, it's
+ % common to leave accents off identifiers. The result looks ok in
+ % tt, but exceedingly strange in rm.
+ % . we don't want -- and --- to be treated as ligatures.
+ % . this still does not fix the ?` and !` ligatures, but so far no
+ % one has made identifiers using them :).
+ \df \tt
+ \def\temp{#2}% text of the return type
+ \ifx\temp\empty\else
+ \tclose{\temp}% typeset the return type
+ \ifrettypeownline
+ % put return type on its own line; prohibit line break following:
+ \hfil\vadjust{\nobreak}\break
+ \else
+ \space % type on same line, so just followed by a space
+ \fi
+ \fi % no return type
+ #3% output function name
+ }%
+ {\rm\enskip}% hskip 0.5 em of \tenrm
+ %
+ \boldbrax
+ % arguments will be output next, if any.
+}
+
+% Print arguments in slanted roman (not ttsl), inconsistently with using
+% tt for the name. This is because literal text is sometimes needed in
+% the argument list (groff manual), and ttsl and tt are not very
+% distinguishable. Prevent hyphenation at `-' chars.
+%
+\def\defunargs#1{%
+ % use sl by default (not ttsl),
+ % tt for the names.
+ \df \sl \hyphenchar\font=0
+ %
+ % On the other hand, if an argument has two dashes (for instance), we
+ % want a way to get ttsl. Let's try @var for that.
+ \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
+ #1%
+ \sl\hyphenchar\font=45
+}
+
+% We want ()&[] to print specially on the defun line.
+%
+\def\activeparens{%
+ \catcode`\(=\active \catcode`\)=\active
+ \catcode`\[=\active \catcode`\]=\active
+ \catcode`\&=\active
+}
+
+% Make control sequences which act like normal parenthesis chars.
+\let\lparen = ( \let\rparen = )
+
+% Be sure that we always have a definition for `(', etc. For example,
+% if the fn name has parens in it, \boldbrax will not be in effect yet,
+% so TeX would otherwise complain about undefined control sequence.
+{
+ \activeparens
+ \global\let(=\lparen \global\let)=\rparen
+ \global\let[=\lbrack \global\let]=\rbrack
+ \global\let& = \&
+
+ \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+ \gdef\magicamp{\let&=\amprm}
+}
+
+\newcount\parencount
+
+% If we encounter &foo, then turn on ()-hacking afterwards
+\newif\ifampseen
+\def\amprm#1 {\ampseentrue{\bf\&#1 }}
+
+\def\parenfont{%
+ \ifampseen
+ % At the first level, print parens in roman,
+ % otherwise use the default font.
+ \ifnum \parencount=1 \rm \fi
+ \else
+ % The \sf parens (in \boldbrax) actually are a little bolder than
+ % the contained text. This is especially needed for [ and ] .
+ \sf
+ \fi
+}
+\def\infirstlevel#1{%
+ \ifampseen
+ \ifnum\parencount=1
+ #1%
+ \fi
+ \fi
+}
+\def\bfafterword#1 {#1 \bf}
+
+\def\opnr{%
+ \global\advance\parencount by 1
+ {\parenfont(}%
+ \infirstlevel \bfafterword
+}
+\def\clnr{%
+ {\parenfont)}%
+ \infirstlevel \sl
+ \global\advance\parencount by -1
+}
+
+\newcount\brackcount
+\def\lbrb{%
+ \global\advance\brackcount by 1
+ {\bf[}%
+}
+\def\rbrb{%
+ {\bf]}%
+ \global\advance\brackcount by -1
+}
+
+\def\checkparencounts{%
+ \ifnum\parencount=0 \else \badparencount \fi
+ \ifnum\brackcount=0 \else \badbrackcount \fi
+}
+% these should not use \errmessage; the glibc manual, at least, actually
+% has such constructs (when documenting function pointers).
+\def\badparencount{%
+ \message{Warning: unbalanced parentheses in @def...}%
+ \global\parencount=0
+}
+\def\badbrackcount{%
+ \message{Warning: unbalanced square brackets in @def...}%
+ \global\brackcount=0
+}
+
+
+\message{macros,}
+% @macro.
+
+% To do this right we need a feature of e-TeX, \scantokens,
+% which we arrange to emulate with a temporary file in ordinary TeX.
+\ifx\eTeXversion\thisisundefined
+ \newwrite\macscribble
+ \def\scantokens#1{%
+ \toks0={#1}%
+ \immediate\openout\macscribble=\jobname.tmp
+ \immediate\write\macscribble{\the\toks0}%
+ \immediate\closeout\macscribble
+ \input \jobname.tmp
+ }
+\fi
+
+\def\scanmacro#1{\begingroup
+ \newlinechar`\^^M
+ \let\xeatspaces\eatspaces
+ %
+ % Undo catcode changes of \startcontents and \doprintindex
+ % When called from @insertcopying or (short)caption, we need active
+ % backslash to get it printed correctly. Previously, we had
+ % \catcode`\\=\other instead. We'll see whether a problem appears
+ % with macro expansion. --kasal, 19aug04
+ \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
+ %
+ % ... and for \example:
+ \spaceisspace
+ %
+ % The \empty here causes a following catcode 5 newline to be eaten as
+ % part of reading whitespace after a control sequence. It does not
+ % eat a catcode 13 newline. There's no good way to handle the two
+ % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
+ % would then have different behavior). See the Macro Details node in
+ % the manual for the workaround we recommend for macros and
+ % line-oriented commands.
+ %
+ \scantokens{#1\empty}%
+\endgroup}
+
+\def\scanexp#1{%
+ \edef\temp{\noexpand\scanmacro{#1}}%
+ \temp
+}
+
+\newcount\paramno % Count of parameters
+\newtoks\macname % Macro name
+\newif\ifrecursive % Is it recursive?
+
+% List of all defined macros in the form
+% \definedummyword\macro1\definedummyword\macro2...
+% Currently is also contains all @aliases; the list can be split
+% if there is a need.
+\def\macrolist{}
+
+% Add the macro to \macrolist
+\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
+\def\addtomacrolistxxx#1{%
+ \toks0 = \expandafter{\macrolist\definedummyword#1}%
+ \xdef\macrolist{\the\toks0}%
+}
+
+% Utility routines.
+% This does \let #1 = #2, with \csnames; that is,
+% \let \csname#1\endcsname = \csname#2\endcsname
+% (except of course we have to play expansion games).
+%
+\def\cslet#1#2{%
+ \expandafter\let
+ \csname#1\expandafter\endcsname
+ \csname#2\endcsname
+}
+
+% Trim leading and trailing spaces off a string.
+% Concepts from aro-bend problem 15 (see CTAN).
+{\catcode`\@=11
+\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
+\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
+\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
+\def\unbrace#1{#1}
+\unbrace{\gdef\trim@@@ #1 } #2@{#1}
+}
+
+% Trim a single trailing ^^M off a string.
+{\catcode`\^^M=\other \catcode`\Q=3%
+\gdef\eatcr #1{\eatcra #1Q^^MQ}%
+\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
+\gdef\eatcrb#1Q#2Q{#1}%
+}
+
+% Macro bodies are absorbed as an argument in a context where
+% all characters are catcode 10, 11 or 12, except \ which is active
+% (as in normal texinfo). It is necessary to change the definition of \
+% to recognize macro arguments; this is the job of \mbodybackslash.
+%
+% Non-ASCII encodings make 8-bit characters active, so un-activate
+% them to avoid their expansion. Must do this non-globally, to
+% confine the change to the current group.
+%
+% It's necessary to have hard CRs when the macro is executed. This is
+% done by making ^^M (\endlinechar) catcode 12 when reading the macro
+% body, and then making it the \newlinechar in \scanmacro.
+%
+\def\scanctxt{% used as subroutine
+ \catcode`\"=\other
+ \catcode`\+=\other
+ \catcode`\<=\other
+ \catcode`\>=\other
+ \catcode`\@=\other
+ \catcode`\^=\other
+ \catcode`\_=\other
+ \catcode`\|=\other
+ \catcode`\~=\other
+ \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
+}
+
+\def\scanargctxt{% used for copying and captions, not macros.
+ \scanctxt
+ \catcode`\\=\other
+ \catcode`\^^M=\other
+}
+
+\def\macrobodyctxt{% used for @macro definitions
+ \scanctxt
+ \catcode`\{=\other
+ \catcode`\}=\other
+ \catcode`\^^M=\other
+ \usembodybackslash
+}
+
+\def\macroargctxt{% used when scanning invocations
+ \scanctxt
+ \catcode`\\=0
+}
+% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes"
+% for the single characters \ { }. Thus, we end up with the "commands"
+% that would be written @\ @{ @} in a Texinfo document.
+%
+% We already have @{ and @}. For @\, we define it here, and only for
+% this purpose, to produce a typewriter backslash (so, the @\ that we
+% define for @math can't be used with @macro calls):
+%
+\def\\{\normalbackslash}%
+%
+% We would like to do this for \, too, since that is what makeinfo does.
+% But it is not possible, because Texinfo already has a command @, for a
+% cedilla accent. Documents must use @comma{} instead.
+%
+% \anythingelse will almost certainly be an error of some kind.
+
+
+% \mbodybackslash is the definition of \ in @macro bodies.
+% It maps \foo\ => \csname macarg.foo\endcsname => #N
+% where N is the macro parameter number.
+% We define \csname macarg.\endcsname to be \realbackslash, so
+% \\ in macro replacement text gets you a backslash.
+%
+{\catcode`@=0 @catcode`@\=@active
+ @gdef@usembodybackslash{@let\=@mbodybackslash}
+ @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
+}
+\expandafter\def\csname macarg.\endcsname{\realbackslash}
+
+\def\margbackslash#1{\char`\#1 }
+
+\def\macro{\recursivefalse\parsearg\macroxxx}
+\def\rmacro{\recursivetrue\parsearg\macroxxx}
+
+\def\macroxxx#1{%
+ \getargs{#1}% now \macname is the macname and \argl the arglist
+ \ifx\argl\empty % no arguments
+ \paramno=0\relax
+ \else
+ \expandafter\parsemargdef \argl;%
+ \if\paramno>256\relax
+ \ifx\eTeXversion\thisisundefined
+ \errhelp = \EMsimple
+ \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
+ \fi
+ \fi
+ \fi
+ \if1\csname ismacro.\the\macname\endcsname
+ \message{Warning: redefining \the\macname}%
+ \else
+ \expandafter\ifx\csname \the\macname\endcsname \relax
+ \else \errmessage{Macro name \the\macname\space already defined}\fi
+ \global\cslet{macsave.\the\macname}{\the\macname}%
+ \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
+ \addtomacrolist{\the\macname}%
+ \fi
+ \begingroup \macrobodyctxt
+ \ifrecursive \expandafter\parsermacbody
+ \else \expandafter\parsemacbody
+ \fi}
+
+\parseargdef\unmacro{%
+ \if1\csname ismacro.#1\endcsname
+ \global\cslet{#1}{macsave.#1}%
+ \global\expandafter\let \csname ismacro.#1\endcsname=0%
+ % Remove the macro name from \macrolist:
+ \begingroup
+ \expandafter\let\csname#1\endcsname \relax
+ \let\definedummyword\unmacrodo
+ \xdef\macrolist{\macrolist}%
+ \endgroup
+ \else
+ \errmessage{Macro #1 not defined}%
+ \fi
+}
+
+% Called by \do from \dounmacro on each macro. The idea is to omit any
+% macro definitions that have been changed to \relax.
+%
+\def\unmacrodo#1{%
+ \ifx #1\relax
+ % remove this
+ \else
+ \noexpand\definedummyword \noexpand#1%
+ \fi
+}
+
+% This makes use of the obscure feature that if the last token of a
+% <parameter list> is #, then the preceding argument is delimited by
+% an opening brace, and that opening brace is not consumed.
+\def\getargs#1{\getargsxxx#1{}}
+\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
+\def\getmacname#1 #2\relax{\macname={#1}}
+\def\getmacargs#1{\def\argl{#1}}
+
+% For macro processing make @ a letter so that we can make Texinfo private macro names.
+\edef\texiatcatcode{\the\catcode`\@}
+\catcode `@=11\relax
+
+% Parse the optional {params} list. Set up \paramno and \paramlist
+% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH
+% in the params list to some hook where the argument si to be expanded. If
+% there are less than 10 arguments that hook is to be replaced by ##N where N
+% is the position in that list, that is to say the macro arguments are to be
+% defined `a la TeX in the macro body.
+%
+% That gets used by \mbodybackslash (above).
+%
+% We need to get `macro parameter char #' into several definitions.
+% The technique used is stolen from LaTeX: let \hash be something
+% unexpandable, insert that wherever you need a #, and then redefine
+% it to # just before using the token list produced.
+%
+% The same technique is used to protect \eatspaces till just before
+% the macro is used.
+%
+% If there are 10 or more arguments, a different technique is used, where the
+% hook remains in the body, and when macro is to be expanded the body is
+% processed again to replace the arguments.
+%
+% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
+% argument N value and then \edef the body (nothing else will expand because of
+% the catcode regime underwhich the body was input).
+%
+% If you compile with TeX (not eTeX), and you have macros with 10 or more
+% arguments, you need that no macro has more than 256 arguments, otherwise an
+% error is produced.
+\def\parsemargdef#1;{%
+ \paramno=0\def\paramlist{}%
+ \let\hash\relax
+ \let\xeatspaces\relax
+ \parsemargdefxxx#1,;,%
+ % In case that there are 10 or more arguments we parse again the arguments
+ % list to set new definitions for the \macarg.BLAH macros corresponding to
+ % each BLAH argument. It was anyhow needed to parse already once this list
+ % in order to count the arguments, and as macros with at most 9 arguments
+ % are by far more frequent than macro with 10 or more arguments, defining
+ % twice the \macarg.BLAH macros does not cost too much processing power.
+ \ifnum\paramno<10\relax\else
+ \paramno0\relax
+ \parsemmanyargdef@@#1,;,% 10 or more arguments
+ \fi
+}
+\def\parsemargdefxxx#1,{%
+ \if#1;\let\next=\relax
+ \else \let\next=\parsemargdefxxx
+ \advance\paramno by 1
+ \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
+ {\xeatspaces{\hash\the\paramno}}%
+ \edef\paramlist{\paramlist\hash\the\paramno,}%
+ \fi\next}
+
+\def\parsemmanyargdef@@#1,{%
+ \if#1;\let\next=\relax
+ \else
+ \let\next=\parsemmanyargdef@@
+ \edef\tempb{\eatspaces{#1}}%
+ \expandafter\def\expandafter\tempa
+ \expandafter{\csname macarg.\tempb\endcsname}%
+ % Note that we need some extra \noexpand\noexpand, this is because we
+ % don't want \the to be expanded in the \parsermacbody as it uses an
+ % \xdef .
+ \expandafter\edef\tempa
+ {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
+ \advance\paramno by 1\relax
+ \fi\next}
+
+% These two commands read recursive and nonrecursive macro bodies.
+% (They're different since rec and nonrec macros end differently.)
+%
+
+\catcode `\@\texiatcatcode
+\long\def\parsemacbody#1@end macro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\long\def\parsermacbody#1@end rmacro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\catcode `\@=11\relax
+
+\let\endargs@\relax
+\let\nil@\relax
+\def\nilm@{\nil@}%
+\long\def\nillm@{\nil@}%
+
+% This macro is expanded during the Texinfo macro expansion, not during its
+% definition. It gets all the arguments values and assigns them to macros
+% macarg.ARGNAME
+%
+% #1 is the macro name
+% #2 is the list of argument names
+% #3 is the list of argument values
+\def\getargvals@#1#2#3{%
+ \def\macargdeflist@{}%
+ \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
+ \def\paramlist{#2,\nil@}%
+ \def\macroname{#1}%
+ \begingroup
+ \macroargctxt
+ \def\argvaluelist{#3,\nil@}%
+ \def\@tempa{#3}%
+ \ifx\@tempa\empty
+ \setemptyargvalues@
+ \else
+ \getargvals@@
+ \fi
+}
+
+%
+\def\getargvals@@{%
+ \ifx\paramlist\nilm@
+ % Some sanity check needed here that \argvaluelist is also empty.
+ \ifx\argvaluelist\nillm@
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Too many arguments in macro `\macroname'!}%
+ \fi
+ \let\next\macargexpandinbody@
+ \else
+ \ifx\argvaluelist\nillm@
+ % No more arguments values passed to macro. Set remaining named-arg
+ % macros to empty.
+ \let\next\setemptyargvalues@
+ \else
+ % pop current arg name into \@tempb
+ \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
+ \expandafter\@tempa\expandafter{\paramlist}%
+ % pop current argument value into \@tempc
+ \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
+ \expandafter\@tempa\expandafter{\argvaluelist}%
+ % Here \@tempb is the current arg name and \@tempc is the current arg value.
+ % First place the new argument macro definition into \@tempd
+ \expandafter\macname\expandafter{\@tempc}%
+ \expandafter\let\csname macarg.\@tempb\endcsname\relax
+ \expandafter\def\expandafter\@tempe\expandafter{%
+ \csname macarg.\@tempb\endcsname}%
+ \edef\@tempd{\long\def\@tempe{\the\macname}}%
+ \push@\@tempd\macargdeflist@
+ \let\next\getargvals@@
+ \fi
+ \fi
+ \next
+}
+
+\def\push@#1#2{%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter#2%
+ \expandafter\expandafter\expandafter{%
+ \expandafter#1#2}%
+}
+
+% Replace arguments by their values in the macro body, and place the result
+% in macro \@tempa
+\def\macvalstoargs@{%
+ % To do this we use the property that token registers that are \the'ed
+ % within an \edef expand only once. So we are going to place all argument
+ % values into respective token registers.
+ %
+ % First we save the token context, and initialize argument numbering.
+ \begingroup
+ \paramno0\relax
+ % Then, for each argument number #N, we place the corresponding argument
+ % value into a new token list register \toks#N
+ \expandafter\putargsintokens@\saveparamlist@,;,%
+ % Then, we expand the body so that argument are replaced by their
+ % values. The trick for values not to be expanded themselves is that they
+ % are within tokens and that tokens expand only once in an \edef .
+ \edef\@tempc{\csname mac.\macroname .body\endcsname}%
+ % Now we restore the token stack pointer to free the token list registers
+ % which we have used, but we make sure that expanded body is saved after
+ % group.
+ \expandafter
+ \endgroup
+ \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
+ }
+
+\def\macargexpandinbody@{%
+ %% Define the named-macro outside of this group and then close this group.
+ \expandafter
+ \endgroup
+ \macargdeflist@
+ % First the replace in body the macro arguments by their values, the result
+ % is in \@tempa .
+ \macvalstoargs@
+ % Then we point at the \norecurse or \gobble (for recursive) macro value
+ % with \@tempb .
+ \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
+ % Depending on whether it is recursive or not, we need some tailing
+ % \egroup .
+ \ifx\@tempb\gobble
+ \let\@tempc\relax
+ \else
+ \let\@tempc\egroup
+ \fi
+ % And now we do the real job:
+ \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
+ \@tempd
+}
+
+\def\putargsintokens@#1,{%
+ \if#1;\let\next\relax
+ \else
+ \let\next\putargsintokens@
+ % First we allocate the new token list register, and give it a temporary
+ % alias \@tempb .
+ \toksdef\@tempb\the\paramno
+ % Then we place the argument value into that token list register.
+ \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \advance\paramno by 1\relax
+ \fi
+ \next
+}
+
+% Save the token stack pointer into macro #1
+\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
+% Restore the token stack pointer from number in macro #1
+\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
+% newtoks that can be used non \outer .
+\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
+
+% Tailing missing arguments are set to empty
+\def\setemptyargvalues@{%
+ \ifx\paramlist\nilm@
+ \let\next\macargexpandinbody@
+ \else
+ \expandafter\setemptyargvaluesparser@\paramlist\endargs@
+ \let\next\setemptyargvalues@
+ \fi
+ \next
+}
+
+\def\setemptyargvaluesparser@#1,#2\endargs@{%
+ \expandafter\def\expandafter\@tempa\expandafter{%
+ \expandafter\def\csname macarg.#1\endcsname{}}%
+ \push@\@tempa\macargdeflist@
+ \def\paramlist{#2}%
+}
+
+% #1 is the element target macro
+% #2 is the list macro
+% #3,#4\endargs@ is the list value
+\def\pop@#1#2#3,#4\endargs@{%
+ \def#1{#3}%
+ \def#2{#4}%
+}
+\long\def\longpop@#1#2#3,#4\endargs@{%
+ \long\def#1{#3}%
+ \long\def#2{#4}%
+}
+
+% This defines a Texinfo @macro. There are eight cases: recursive and
+% nonrecursive macros of zero, one, up to nine, and many arguments.
+% Much magic with \expandafter here.
+% \xdef is used so that macro definitions will survive the file
+% they're defined in; @include reads the file inside a group.
+%
+\def\defmacro{%
+ \let\hash=##% convert placeholders to macro parameter chars
+ \ifrecursive
+ \ifcase\paramno
+ % 0
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\scanmacro{\temp}}%
+ \or % 1
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \noexpand\braceorline
+ \expandafter\noexpand\csname\the\macname xxx\endcsname}%
+ \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+ \egroup\noexpand\scanmacro{\temp}}%
+ \else
+ \ifnum\paramno<10\relax % at most 9
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \noexpand\csname\the\macname xx\endcsname}%
+ \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+ \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+ \expandafter\expandafter
+ \expandafter\xdef
+ \expandafter\expandafter
+ \csname\the\macname xxx\endcsname
+ \paramlist{\egroup\noexpand\scanmacro{\temp}}%
+ \else % 10 or more
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\getargvals@{\the\macname}{\argl}%
+ }%
+ \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
+ \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
+ \fi
+ \fi
+ \else
+ \ifcase\paramno
+ % 0
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\norecurse{\the\macname}%
+ \noexpand\scanmacro{\temp}\egroup}%
+ \or % 1
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \noexpand\braceorline
+ \expandafter\noexpand\csname\the\macname xxx\endcsname}%
+ \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+ \egroup
+ \noexpand\norecurse{\the\macname}%
+ \noexpand\scanmacro{\temp}\egroup}%
+ \else % at most 9
+ \ifnum\paramno<10\relax
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \expandafter\noexpand\csname\the\macname xx\endcsname}%
+ \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+ \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+ \expandafter\expandafter
+ \expandafter\xdef
+ \expandafter\expandafter
+ \csname\the\macname xxx\endcsname
+ \paramlist{%
+ \egroup
+ \noexpand\norecurse{\the\macname}%
+ \noexpand\scanmacro{\temp}\egroup}%
+ \else % 10 or more:
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\getargvals@{\the\macname}{\argl}%
+ }%
+ \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
+ \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
+ \fi
+ \fi
+ \fi}
+
+\catcode `\@\texiatcatcode\relax
+
+\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
+
+% \braceorline decides whether the next nonwhitespace character is a
+% {. If so it reads up to the closing }, if not, it reads the whole
+% line. Whatever was read is then fed to the next control sequence
+% as an argument (by \parsebrace or \parsearg).
+%
+\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
+\def\braceorlinexxx{%
+ \ifx\nchar\bgroup\else
+ \expandafter\parsearg
+ \fi \macnamexxx}
+
+
+% @alias.
+% We need some trickery to remove the optional spaces around the equal
+% sign. Make them active and then expand them all to nothing.
+%
+\def\alias{\parseargusing\obeyspaces\aliasxxx}
+\def\aliasxxx #1{\aliasyyy#1\relax}
+\def\aliasyyy #1=#2\relax{%
+ {%
+ \expandafter\let\obeyedspace=\empty
+ \addtomacrolist{#1}%
+ \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
+ }%
+ \next
+}
+
+
+\message{cross references,}
+
+\newwrite\auxfile
+\newif\ifhavexrefs % True if xref values are known.
+\newif\ifwarnedxrefs % True if we warned once that they aren't known.
+
+% @inforef is relatively simple.
+\def\inforef #1{\inforefzzz #1,,,,**}
+\def\inforefzzz #1,#2,#3,#4**{%
+ \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
+ node \samp{\ignorespaces#1{}}}
+
+% @node's only job in TeX is to define \lastnode, which is used in
+% cross-references. The @node line might or might not have commas, and
+% might or might not have spaces before the first comma, like:
+% @node foo , bar , ...
+% We don't want such trailing spaces in the node name.
+%
+\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
+%
+% also remove a trailing comma, in case of something like this:
+% @node Help-Cross, , , Cross-refs
+\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
+\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
+
+\let\nwnode=\node
+\let\lastnode=\empty
+
+% Write a cross-reference definition for the current node. #1 is the
+% type (Ynumbered, Yappendix, Ynothing).
+%
+\def\donoderef#1{%
+ \ifx\lastnode\empty\else
+ \setref{\lastnode}{#1}%
+ \global\let\lastnode=\empty
+ \fi
+}
+
+% @anchor{NAME} -- define xref target at arbitrary point.
+%
+\newcount\savesfregister
+%
+\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
+\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
+\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
+
+% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
+% anchor), which consists of three parts:
+% 1) NAME-title - the current sectioning name taken from \lastsection,
+% or the anchor name.
+% 2) NAME-snt - section number and type, passed as the SNT arg, or
+% empty for anchors.
+% 3) NAME-pg - the page number.
+%
+% This is called from \donoderef, \anchor, and \dofloat. In the case of
+% floats, there is an additional part, which is not written here:
+% 4) NAME-lof - the text as it should appear in a @listoffloats.
+%
+\def\setref#1#2{%
+ \pdfmkdest{#1}%
+ \iflinks
+ {%
+ \atdummies % preserve commands, but don't expand them
+ \edef\writexrdef##1##2{%
+ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
+ ##1}{##2}}% these are parameters of \writexrdef
+ }%
+ \toks0 = \expandafter{\lastsection}%
+ \immediate \writexrdef{title}{\the\toks0 }%
+ \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
+ \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
+ }%
+ \fi
+}
+
+% @xrefautosectiontitle on|off says whether @section(ing) names are used
+% automatically in xrefs, if the third arg is not explicitly specified.
+% This was provided as a "secret" @set xref-automatic-section-title
+% variable, now it's official.
+%
+\parseargdef\xrefautomaticsectiontitle{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETxref-automatic-section-title\endcsname
+ = \empty
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETxref-automatic-section-title\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
+ must be on|off}%
+ \fi\fi
+}
+
+
+% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
+% the node name, #2 the name of the Info cross-reference, #3 the printed
+% node name, #4 the name of the Info file, #5 the name of the printed
+% manual. All but the node name can be omitted.
+%
+\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
+\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
+\def\ref#1{\xrefX[#1,,,,,,,]}
+%
+\newbox\topbox
+\newbox\printedrefnamebox
+\newbox\printedmanualbox
+%
+\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
+ \unsepspaces
+ %
+ \def\printedrefname{\ignorespaces #3}%
+ \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
+ %
+ \def\printedmanual{\ignorespaces #5}%
+ \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
+ %
+ % If the printed reference name (arg #3) was not explicitly given in
+ % the @xref, figure out what we want to use.
+ \ifdim \wd\printedrefnamebox = 0pt
+ % No printed node name was explicitly given.
+ \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
+ % Not auto section-title: use node name inside the square brackets.
+ \def\printedrefname{\ignorespaces #1}%
+ \else
+ % Auto section-title: use chapter/section title inside
+ % the square brackets if we have it.
+ \ifdim \wd\printedmanualbox > 0pt
+ % It is in another manual, so we don't have it; use node name.
+ \def\printedrefname{\ignorespaces #1}%
+ \else
+ \ifhavexrefs
+ % We (should) know the real title if we have the xref values.
+ \def\printedrefname{\refx{#1-title}{}}%
+ \else
+ % Otherwise just copy the Info node name.
+ \def\printedrefname{\ignorespaces #1}%
+ \fi%
+ \fi
+ \fi
+ \fi
+ %
+ % Make link in pdf output.
+ \ifpdf
+ {\indexnofonts
+ \turnoffactive
+ \makevalueexpandable
+ % This expands tokens, so do it after making catcode changes, so _
+ % etc. don't get their TeX definitions.
+ \getfilename{#4}%
+ %
+ \edef\pdfxrefdest{#1}%
+ \txiescapepdf\pdfxrefdest
+ %
+ \leavevmode
+ \startlink attr{/Border [0 0 0]}%
+ \ifnum\filenamelength>0
+ goto file{\the\filename.pdf} name{\pdfxrefdest}%
+ \else
+ goto name{\pdfmkpgn{\pdfxrefdest}}%
+ \fi
+ }%
+ \setcolor{\linkcolor}%
+ \fi
+ %
+ % Float references are printed completely differently: "Figure 1.2"
+ % instead of "[somenode], p.3". We distinguish them by the
+ % LABEL-title being set to a magic string.
+ {%
+ % Have to otherify everything special to allow the \csname to
+ % include an _ in the xref name, etc.
+ \indexnofonts
+ \turnoffactive
+ \expandafter\global\expandafter\let\expandafter\Xthisreftitle
+ \csname XR#1-title\endcsname
+ }%
+ \iffloat\Xthisreftitle
+ % If the user specified the print name (third arg) to the ref,
+ % print it instead of our usual "Figure 1.2".
+ \ifdim\wd\printedrefnamebox = 0pt
+ \refx{#1-snt}{}%
+ \else
+ \printedrefname
+ \fi
+ %
+ % if the user also gave the printed manual name (fifth arg), append
+ % "in MANUALNAME".
+ \ifdim \wd\printedmanualbox > 0pt
+ \space \putwordin{} \cite{\printedmanual}%
+ \fi
+ \else
+ % node/anchor (non-float) references.
+ %
+ % If we use \unhbox to print the node names, TeX does not insert
+ % empty discretionaries after hyphens, which means that it will not
+ % find a line break at a hyphen in a node names. Since some manuals
+ % are best written with fairly long node names, containing hyphens,
+ % this is a loss. Therefore, we give the text of the node name
+ % again, so it is as if TeX is seeing it for the first time.
+ %
+ % Cross-manual reference. Only include the "Section ``foo'' in" if
+ % the foo is neither missing or Top. Thus, @xref{,,,foo,The Foo Manual}
+ % outputs simply "see The Foo Manual".
+ \ifdim \wd\printedmanualbox > 0pt
+ % What is the 7sp about? The idea is that we also want to omit
+ % the Section part if we would be printing "Top", since they are
+ % clearly trying to refer to the whole manual. But, this being
+ % TeX, we can't easily compare strings while ignoring the possible
+ % spaces before and after in the input. By adding the arbitrary
+ % 7sp, we make it much less likely that a real node name would
+ % happen to have the same width as "Top" (e.g., in a monospaced font).
+ % I hope it will never happen in practice.
+ %
+ % For the same basic reason, we retypeset the "Top" at every
+ % reference, since the current font is indeterminate.
+ %
+ \setbox\topbox = \hbox{Top\kern7sp}%
+ \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
+ \ifdim \wd2 > 7sp
+ \ifdim \wd2 = \wd\topbox \else
+ \putwordSection{} ``\printedrefname'' \putwordin{}\space
+ \fi
+ \fi
+ \cite{\printedmanual}%
+ \else
+ % Reference in this manual.
+ %
+ % _ (for example) has to be the character _ for the purposes of the
+ % control sequence corresponding to the node, but it has to expand
+ % into the usual \leavevmode...\vrule stuff for purposes of
+ % printing. So we \turnoffactive for the \refx-snt, back on for the
+ % printing, back off for the \refx-pg.
+ {\turnoffactive
+ % Only output a following space if the -snt ref is nonempty; for
+ % @unnumbered and @anchor, it won't be.
+ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+ \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+ }%
+ % output the `[mynode]' via the macro below so it can be overridden.
+ \xrefprintnodename\printedrefname
+ %
+ % But we always want a comma and a space:
+ ,\space
+ %
+ % output the `page 3'.
+ \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+ \fi
+ \fi
+ \endlink
+\endgroup}
+
+% This macro is called from \xrefX for the `[nodename]' part of xref
+% output. It's a separate macro only so it can be changed more easily,
+% since square brackets don't work well in some documents. Particularly
+% one that Bob is working on :).
+%
+\def\xrefprintnodename#1{[#1]}
+
+% Things referred to by \setref.
+%
+\def\Ynothing{}
+\def\Yomitfromtoc{}
+\def\Ynumbered{%
+ \ifnum\secno=0
+ \putwordChapter@tie \the\chapno
+ \else \ifnum\subsecno=0
+ \putwordSection@tie \the\chapno.\the\secno
+ \else \ifnum\subsubsecno=0
+ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
+ \else
+ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
+ \fi\fi\fi
+}
+\def\Yappendix{%
+ \ifnum\secno=0
+ \putwordAppendix@tie @char\the\appendixno{}%
+ \else \ifnum\subsecno=0
+ \putwordSection@tie @char\the\appendixno.\the\secno
+ \else \ifnum\subsubsecno=0
+ \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
+ \else
+ \putwordSection@tie
+ @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
+ \fi\fi\fi
+}
+
+% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
+% If its value is nonempty, SUFFIX is output afterward.
+%
+\def\refx#1#2{%
+ {%
+ \indexnofonts
+ \otherbackslash
+ \expandafter\global\expandafter\let\expandafter\thisrefX
+ \csname XR#1\endcsname
+ }%
+ \ifx\thisrefX\relax
+ % If not defined, say something at least.
+ \angleleft un\-de\-fined\angleright
+ \iflinks
+ \ifhavexrefs
+ {\toks0 = {#1}% avoid expansion of possibly-complex value
+ \message{\linenumber Undefined cross reference `\the\toks0'.}}%
+ \else
+ \ifwarnedxrefs\else
+ \global\warnedxrefstrue
+ \message{Cross reference values unknown; you must run TeX again.}%
+ \fi
+ \fi
+ \fi
+ \else
+ % It's defined, so just use it.
+ \thisrefX
+ \fi
+ #2% Output the suffix in any case.
+}
+
+% This is the macro invoked by entries in the aux file. Usually it's
+% just a \def (we prepend XR to the control sequence name to avoid
+% collisions). But if this is a float type, we have more work to do.
+%
+\def\xrdef#1#2{%
+ {% The node name might contain 8-bit characters, which in our current
+ % implementation are changed to commands like @'e. Don't let these
+ % mess up the control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safexrefname{#1}%
+ }%
+ %
+ \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
+ %
+ % Was that xref control sequence that we just defined for a float?
+ \expandafter\iffloat\csname XR\safexrefname\endcsname
+ % it was a float, and we have the (safe) float type in \iffloattype.
+ \expandafter\let\expandafter\floatlist
+ \csname floatlist\iffloattype\endcsname
+ %
+ % Is this the first time we've seen this float type?
+ \expandafter\ifx\floatlist\relax
+ \toks0 = {\do}% yes, so just \do
+ \else
+ % had it before, so preserve previous elements in list.
+ \toks0 = \expandafter{\floatlist\do}%
+ \fi
+ %
+ % Remember this xref in the control sequence \floatlistFLOATTYPE,
+ % for later use in \listoffloats.
+ \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
+ {\safexrefname}}%
+ \fi
+}
+
+% Read the last existing aux file, if any. No error if none exists.
+%
+\def\tryauxfile{%
+ \openin 1 \jobname.aux
+ \ifeof 1 \else
+ \readdatafile{aux}%
+ \global\havexrefstrue
+ \fi
+ \closein 1
+}
+
+\def\setupdatafile{%
+ \catcode`\^^@=\other
+ \catcode`\^^A=\other
+ \catcode`\^^B=\other
+ \catcode`\^^C=\other
+ \catcode`\^^D=\other
+ \catcode`\^^E=\other
+ \catcode`\^^F=\other
+ \catcode`\^^G=\other
+ \catcode`\^^H=\other
+ \catcode`\^^K=\other
+ \catcode`\^^L=\other
+ \catcode`\^^N=\other
+ \catcode`\^^P=\other
+ \catcode`\^^Q=\other
+ \catcode`\^^R=\other
+ \catcode`\^^S=\other
+ \catcode`\^^T=\other
+ \catcode`\^^U=\other
+ \catcode`\^^V=\other
+ \catcode`\^^W=\other
+ \catcode`\^^X=\other
+ \catcode`\^^Z=\other
+ \catcode`\^^[=\other
+ \catcode`\^^\=\other
+ \catcode`\^^]=\other
+ \catcode`\^^^=\other
+ \catcode`\^^_=\other
+ % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
+ % in xref tags, i.e., node names. But since ^^e4 notation isn't
+ % supported in the main text, it doesn't seem desirable. Furthermore,
+ % that is not enough: for node names that actually contain a ^
+ % character, we would end up writing a line like this: 'xrdef {'hat
+ % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
+ % argument, and \hat is not an expandable control sequence. It could
+ % all be worked out, but why? Either we support ^^ or we don't.
+ %
+ % The other change necessary for this was to define \auxhat:
+ % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
+ % and then to call \auxhat in \setq.
+ %
+ \catcode`\^=\other
+ %
+ % Special characters. Should be turned off anyway, but...
+ \catcode`\~=\other
+ \catcode`\[=\other
+ \catcode`\]=\other
+ \catcode`\"=\other
+ \catcode`\_=\other
+ \catcode`\|=\other
+ \catcode`\<=\other
+ \catcode`\>=\other
+ \catcode`\$=\other
+ \catcode`\#=\other
+ \catcode`\&=\other
+ \catcode`\%=\other
+ \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
+ %
+ % This is to support \ in node names and titles, since the \
+ % characters end up in a \csname. It's easier than
+ % leaving it active and making its active definition an actual \
+ % character. What I don't understand is why it works in the *value*
+ % of the xrdef. Seems like it should be a catcode12 \, and that
+ % should not typeset properly. But it works, so I'm moving on for
+ % now. --karl, 15jan04.
+ \catcode`\\=\other
+ %
+ % Make the characters 128-255 be printing characters.
+ {%
+ \count1=128
+ \def\loop{%
+ \catcode\count1=\other
+ \advance\count1 by 1
+ \ifnum \count1<256 \loop \fi
+ }%
+ }%
+ %
+ % @ is our escape character in .aux files, and we need braces.
+ \catcode`\{=1
+ \catcode`\}=2
+ \catcode`\@=0
+}
+
+\def\readdatafile#1{%
+\begingroup
+ \setupdatafile
+ \input\jobname.#1
+\endgroup}
+
+
+\message{insertions,}
+% including footnotes.
+
+\newcount \footnoteno
+
+% The trailing space in the following definition for supereject is
+% vital for proper filling; pages come out unaligned when you do a
+% pagealignmacro call if that space before the closing brace is
+% removed. (Generally, numeric constants should always be followed by a
+% space to prevent strange expansion errors.)
+\def\supereject{\par\penalty -20000\footnoteno =0 }
+
+% @footnotestyle is meaningful for Info output only.
+\let\footnotestyle=\comment
+
+{\catcode `\@=11
+%
+% Auto-number footnotes. Otherwise like plain.
+\gdef\footnote{%
+ \let\indent=\ptexindent
+ \let\noindent=\ptexnoindent
+ \global\advance\footnoteno by \@ne
+ \edef\thisfootno{$^{\the\footnoteno}$}%
+ %
+ % In case the footnote comes at the end of a sentence, preserve the
+ % extra spacing after we do the footnote number.
+ \let\@sf\empty
+ \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
+ %
+ % Remove inadvertent blank space before typesetting the footnote number.
+ \unskip
+ \thisfootno\@sf
+ \dofootnote
+}%
+
+% Don't bother with the trickery in plain.tex to not require the
+% footnote text as a parameter. Our footnotes don't need to be so general.
+%
+% Oh yes, they do; otherwise, @ifset (and anything else that uses
+% \parseargline) fails inside footnotes because the tokens are fixed when
+% the footnote is read. --karl, 16nov96.
+%
+\gdef\dofootnote{%
+ \insert\footins\bgroup
+ % We want to typeset this text as a normal paragraph, even if the
+ % footnote reference occurs in (for example) a display environment.
+ % So reset some parameters.
+ \hsize=\pagewidth
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\ht\strutbox % top baseline for broken footnotes
+ \splitmaxdepth\dp\strutbox
+ \floatingpenalty\@MM
+ \leftskip\z@skip
+ \rightskip\z@skip
+ \spaceskip\z@skip
+ \xspaceskip\z@skip
+ \parindent\defaultparindent
+ %
+ \smallfonts \rm
+ %
+ % Because we use hanging indentation in footnotes, a @noindent appears
+ % to exdent this text, so make it be a no-op. makeinfo does not use
+ % hanging indentation so @noindent can still be needed within footnote
+ % text after an @example or the like (not that this is good style).
+ \let\noindent = \relax
+ %
+ % Hang the footnote text off the number. Use \everypar in case the
+ % footnote extends for more than one paragraph.
+ \everypar = {\hang}%
+ \textindent{\thisfootno}%
+ %
+ % Don't crash into the line above the footnote text. Since this
+ % expands into a box, it must come within the paragraph, lest it
+ % provide a place where TeX can split the footnote.
+ \footstrut
+ %
+ % Invoke rest of plain TeX footnote routine.
+ \futurelet\next\fo@t
+}
+}%end \catcode `\@=11
+
+% In case a @footnote appears in a vbox, save the footnote text and create
+% the real \insert just after the vbox finished. Otherwise, the insertion
+% would be lost.
+% Similarly, if a @footnote appears inside an alignment, save the footnote
+% text to a box and make the \insert when a row of the table is finished.
+% And the same can be done for other insert classes. --kasal, 16nov03.
+
+% Replace the \insert primitive by a cheating macro.
+% Deeper inside, just make sure that the saved insertions are not spilled
+% out prematurely.
+%
+\def\startsavinginserts{%
+ \ifx \insert\ptexinsert
+ \let\insert\saveinsert
+ \else
+ \let\checkinserts\relax
+ \fi
+}
+
+% This \insert replacement works for both \insert\footins{foo} and
+% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
+%
+\def\saveinsert#1{%
+ \edef\next{\noexpand\savetobox \makeSAVEname#1}%
+ \afterassignment\next
+ % swallow the left brace
+ \let\temp =
+}
+\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
+\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
+
+\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
+
+\def\placesaveins#1{%
+ \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
+ {\box#1}%
+}
+
+% eat @SAVE -- beware, all of them have catcode \other:
+{
+ \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
+ \gdef\gobblesave @SAVE{}
+}
+
+% initialization:
+\def\newsaveins #1{%
+ \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
+ \next
+}
+\def\newsaveinsX #1{%
+ \csname newbox\endcsname #1%
+ \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
+ \checksaveins #1}%
+}
+
+% initialize:
+\let\checkinserts\empty
+\newsaveins\footins
+\newsaveins\margin
+
+
+% @image. We use the macros from epsf.tex to support this.
+% If epsf.tex is not installed and @image is used, we complain.
+%
+% Check for and read epsf.tex up front. If we read it only at @image
+% time, we might be inside a group, and then its definitions would get
+% undone and the next image would fail.
+\openin 1 = epsf.tex
+\ifeof 1 \else
+ % Do not bother showing banner with epsf.tex v2.7k (available in
+ % doc/epsf.tex and on ctan).
+ \def\epsfannounce{\toks0 = }%
+ \input epsf.tex
+\fi
+\closein 1
+%
+% We will only complain once about lack of epsf.tex.
+\newif\ifwarnednoepsf
+\newhelp\noepsfhelp{epsf.tex must be installed for images to
+ work. It is also included in the Texinfo distribution, or you can get
+ it from ftp://tug.org/tex/epsf.tex.}
+%
+\def\image#1{%
+ \ifx\epsfbox\thisisundefined
+ \ifwarnednoepsf \else
+ \errhelp = \noepsfhelp
+ \errmessage{epsf.tex not found, images will be ignored}%
+ \global\warnednoepsftrue
+ \fi
+ \else
+ \imagexxx #1,,,,,\finish
+ \fi
+}
+%
+% Arguments to @image:
+% #1 is (mandatory) image filename; we tack on .eps extension.
+% #2 is (optional) width, #3 is (optional) height.
+% #4 is (ignored optional) html alt text.
+% #5 is (ignored optional) extension.
+% #6 is just the usual extra ignored arg for parsing stuff.
+\newif\ifimagevmode
+\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
+ \catcode`\^^M = 5 % in case we're inside an example
+ \normalturnoffactive % allow _ et al. in names
+ % If the image is by itself, center it.
+ \ifvmode
+ \imagevmodetrue
+ \else \ifx\centersub\centerV
+ % for @center @image, we need a vbox so we can have our vertical space
+ \imagevmodetrue
+ \vbox\bgroup % vbox has better behavior than vtop herev
+ \fi\fi
+ %
+ \ifimagevmode
+ \nobreak\medskip
+ % Usually we'll have text after the image which will insert
+ % \parskip glue, so insert it here too to equalize the space
+ % above and below.
+ \nobreak\vskip\parskip
+ \nobreak
+ \fi
+ %
+ % Leave vertical mode so that indentation from an enclosing
+ % environment such as @quotation is respected.
+ % However, if we're at the top level, we don't want the
+ % normal paragraph indentation.
+ % On the other hand, if we are in the case of @center @image, we don't
+ % want to start a paragraph, which will create a hsize-width box and
+ % eradicate the centering.
+ \ifx\centersub\centerV\else \noindent \fi
+ %
+ % Output the image.
+ \ifpdf
+ \dopdfimage{#1}{#2}{#3}%
+ \else
+ % \epsfbox itself resets \epsf?size at each figure.
+ \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
+ \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
+ \epsfbox{#1.eps}%
+ \fi
+ %
+ \ifimagevmode
+ \medskip % space after a standalone image
+ \fi
+ \ifx\centersub\centerV \egroup \fi
+\endgroup}
+
+
+% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
+% etc. We don't actually implement floating yet, we always include the
+% float "here". But it seemed the best name for the future.
+%
+\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
+
+% There may be a space before second and/or third parameter; delete it.
+\def\eatcommaspace#1, {#1,}
+
+% #1 is the optional FLOATTYPE, the text label for this float, typically
+% "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
+% this float will not be numbered and cannot be referred to.
+%
+% #2 is the optional xref label. Also must be present for the float to
+% be referable.
+%
+% #3 is the optional positioning argument; for now, it is ignored. It
+% will somehow specify the positions allowed to float to (here, top, bottom).
+%
+% We keep a separate counter for each FLOATTYPE, which we reset at each
+% chapter-level command.
+\let\resetallfloatnos=\empty
+%
+\def\dofloat#1,#2,#3,#4\finish{%
+ \let\thiscaption=\empty
+ \let\thisshortcaption=\empty
+ %
+ % don't lose footnotes inside @float.
+ %
+ % BEWARE: when the floats start float, we have to issue warning whenever an
+ % insert appears inside a float which could possibly float. --kasal, 26may04
+ %
+ \startsavinginserts
+ %
+ % We can't be used inside a paragraph.
+ \par
+ %
+ \vtop\bgroup
+ \def\floattype{#1}%
+ \def\floatlabel{#2}%
+ \def\floatloc{#3}% we do nothing with this yet.
+ %
+ \ifx\floattype\empty
+ \let\safefloattype=\empty
+ \else
+ {%
+ % the floattype might have accents or other special characters,
+ % but we need to use it in a control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safefloattype{\floattype}%
+ }%
+ \fi
+ %
+ % If label is given but no type, we handle that as the empty type.
+ \ifx\floatlabel\empty \else
+ % We want each FLOATTYPE to be numbered separately (Figure 1,
+ % Table 1, Figure 2, ...). (And if no label, no number.)
+ %
+ \expandafter\getfloatno\csname\safefloattype floatno\endcsname
+ \global\advance\floatno by 1
+ %
+ {%
+ % This magic value for \lastsection is output by \setref as the
+ % XREFLABEL-title value. \xrefX uses it to distinguish float
+ % labels (which have a completely different output format) from
+ % node and anchor labels. And \xrdef uses it to construct the
+ % lists of floats.
+ %
+ \edef\lastsection{\floatmagic=\safefloattype}%
+ \setref{\floatlabel}{Yfloat}%
+ }%
+ \fi
+ %
+ % start with \parskip glue, I guess.
+ \vskip\parskip
+ %
+ % Don't suppress indentation if a float happens to start a section.
+ \restorefirstparagraphindent
+}
+
+% we have these possibilities:
+% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
+% @float Foo,lbl & no caption: Foo 1.1
+% @float Foo & @caption{Cap}: Foo: Cap
+% @float Foo & no caption: Foo
+% @float ,lbl & Caption{Cap}: 1.1: Cap
+% @float ,lbl & no caption: 1.1
+% @float & @caption{Cap}: Cap
+% @float & no caption:
+%
+\def\Efloat{%
+ \let\floatident = \empty
+ %
+ % In all cases, if we have a float type, it comes first.
+ \ifx\floattype\empty \else \def\floatident{\floattype}\fi
+ %
+ % If we have an xref label, the number comes next.
+ \ifx\floatlabel\empty \else
+ \ifx\floattype\empty \else % if also had float type, need tie first.
+ \appendtomacro\floatident{\tie}%
+ \fi
+ % the number.
+ \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
+ \fi
+ %
+ % Start the printed caption with what we've constructed in
+ % \floatident, but keep it separate; we need \floatident again.
+ \let\captionline = \floatident
+ %
+ \ifx\thiscaption\empty \else
+ \ifx\floatident\empty \else
+ \appendtomacro\captionline{: }% had ident, so need a colon between
+ \fi
+ %
+ % caption text.
+ \appendtomacro\captionline{\scanexp\thiscaption}%
+ \fi
+ %
+ % If we have anything to print, print it, with space before.
+ % Eventually this needs to become an \insert.
+ \ifx\captionline\empty \else
+ \vskip.5\parskip
+ \captionline
+ %
+ % Space below caption.
+ \vskip\parskip
+ \fi
+ %
+ % If have an xref label, write the list of floats info. Do this
+ % after the caption, to avoid chance of it being a breakpoint.
+ \ifx\floatlabel\empty \else
+ % Write the text that goes in the lof to the aux file as
+ % \floatlabel-lof. Besides \floatident, we include the short
+ % caption if specified, else the full caption if specified, else nothing.
+ {%
+ \atdummies
+ %
+ % since we read the caption text in the macro world, where ^^M
+ % is turned into a normal character, we have to scan it back, so
+ % we don't write the literal three characters "^^M" into the aux file.
+ \scanexp{%
+ \xdef\noexpand\gtemp{%
+ \ifx\thisshortcaption\empty
+ \thiscaption
+ \else
+ \thisshortcaption
+ \fi
+ }%
+ }%
+ \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
+ \ifx\gtemp\empty \else : \gtemp \fi}}%
+ }%
+ \fi
+ \egroup % end of \vtop
+ %
+ % place the captured inserts
+ %
+ % BEWARE: when the floats start floating, we have to issue warning
+ % whenever an insert appears inside a float which could possibly
+ % float. --kasal, 26may04
+ %
+ \checkinserts
+}
+
+% Append the tokens #2 to the definition of macro #1, not expanding either.
+%
+\def\appendtomacro#1#2{%
+ \expandafter\def\expandafter#1\expandafter{#1#2}%
+}
+
+% @caption, @shortcaption
+%
+\def\caption{\docaption\thiscaption}
+\def\shortcaption{\docaption\thisshortcaption}
+\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
+\def\defcaption#1#2{\egroup \def#1{#2}}
+
+% The parameter is the control sequence identifying the counter we are
+% going to use. Create it if it doesn't exist and assign it to \floatno.
+\def\getfloatno#1{%
+ \ifx#1\relax
+ % Haven't seen this figure type before.
+ \csname newcount\endcsname #1%
+ %
+ % Remember to reset this floatno at the next chap.
+ \expandafter\gdef\expandafter\resetallfloatnos
+ \expandafter{\resetallfloatnos #1=0 }%
+ \fi
+ \let\floatno#1%
+}
+
+% \setref calls this to get the XREFLABEL-snt value. We want an @xref
+% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
+% first read the @float command.
+%
+\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
+
+% Magic string used for the XREFLABEL-title value, so \xrefX can
+% distinguish floats from other xref types.
+\def\floatmagic{!!float!!}
+
+% #1 is the control sequence we are passed; we expand into a conditional
+% which is true if #1 represents a float ref. That is, the magic
+% \lastsection value which we \setref above.
+%
+\def\iffloat#1{\expandafter\doiffloat#1==\finish}
+%
+% #1 is (maybe) the \floatmagic string. If so, #2 will be the
+% (safe) float type for this float. We set \iffloattype to #2.
+%
+\def\doiffloat#1=#2=#3\finish{%
+ \def\temp{#1}%
+ \def\iffloattype{#2}%
+ \ifx\temp\floatmagic
+}
+
+% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
+%
+\parseargdef\listoffloats{%
+ \def\floattype{#1}% floattype
+ {%
+ % the floattype might have accents or other special characters,
+ % but we need to use it in a control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safefloattype{\floattype}%
+ }%
+ %
+ % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
+ \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
+ \ifhavexrefs
+ % if the user said @listoffloats foo but never @float foo.
+ \message{\linenumber No `\safefloattype' floats to list.}%
+ \fi
+ \else
+ \begingroup
+ \leftskip=\tocindent % indent these entries like a toc
+ \let\do=\listoffloatsdo
+ \csname floatlist\safefloattype\endcsname
+ \endgroup
+ \fi
+}
+
+% This is called on each entry in a list of floats. We're passed the
+% xref label, in the form LABEL-title, which is how we save it in the
+% aux file. We strip off the -title and look up \XRLABEL-lof, which
+% has the text we're supposed to typeset here.
+%
+% Figures without xref labels will not be included in the list (since
+% they won't appear in the aux file).
+%
+\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
+\def\listoffloatsdoentry#1-title\finish{{%
+ % Can't fully expand XR#1-lof because it can contain anything. Just
+ % pass the control sequence. On the other hand, XR#1-pg is just the
+ % page number, and we want to fully expand that so we can get a link
+ % in pdf output.
+ \toksA = \expandafter{\csname XR#1-lof\endcsname}%
+ %
+ % use the same \entry macro we use to generate the TOC and index.
+ \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
+ \writeentry
+}}
+
+
+\message{localization,}
+
+% For single-language documents, @documentlanguage is usually given very
+% early, just after @documentencoding. Single argument is the language
+% (de) or locale (de_DE) abbreviation.
+%
+{
+ \catcode`\_ = \active
+ \globaldefs=1
+\parseargdef\documentlanguage{\begingroup
+ \let_=\normalunderscore % normal _ character for filenames
+ \tex % read txi-??.tex file in plain TeX.
+ % Read the file by the name they passed if it exists.
+ \openin 1 txi-#1.tex
+ \ifeof 1
+ \documentlanguagetrywithoutunderscore{#1_\finish}%
+ \else
+ \globaldefs = 1 % everything in the txi-LL files needs to persist
+ \input txi-#1.tex
+ \fi
+ \closein 1
+ \endgroup % end raw TeX
+\endgroup}
+%
+% If they passed de_DE, and txi-de_DE.tex doesn't exist,
+% try txi-de.tex.
+%
+\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
+ \openin 1 txi-#1.tex
+ \ifeof 1
+ \errhelp = \nolanghelp
+ \errmessage{Cannot read language file txi-#1.tex}%
+ \else
+ \globaldefs = 1 % everything in the txi-LL files needs to persist
+ \input txi-#1.tex
+ \fi
+ \closein 1
+}
+}% end of special _ catcode
+%
+\newhelp\nolanghelp{The given language definition file cannot be found or
+is empty. Maybe you need to install it? Putting it in the current
+directory should work if nowhere else does.}
+
+% This macro is called from txi-??.tex files; the first argument is the
+% \language name to set (without the "\lang@" prefix), the second and
+% third args are \{left,right}hyphenmin.
+%
+% The language names to pass are determined when the format is built.
+% See the etex.log file created at that time, e.g.,
+% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
+%
+% With TeX Live 2008, etex now includes hyphenation patterns for all
+% available languages. This means we can support hyphenation in
+% Texinfo, at least to some extent. (This still doesn't solve the
+% accented characters problem.)
+%
+\catcode`@=11
+\def\txisetlanguage#1#2#3{%
+ % do not set the language if the name is undefined in the current TeX.
+ \expandafter\ifx\csname lang@#1\endcsname \relax
+ \message{no patterns for #1}%
+ \else
+ \global\language = \csname lang@#1\endcsname
+ \fi
+ % but there is no harm in adjusting the hyphenmin values regardless.
+ \global\lefthyphenmin = #2\relax
+ \global\righthyphenmin = #3\relax
+}
+
+% Helpers for encodings.
+% Set the catcode of characters 128 through 255 to the specified number.
+%
+\def\setnonasciicharscatcode#1{%
+ \count255=128
+ \loop\ifnum\count255<256
+ \global\catcode\count255=#1\relax
+ \advance\count255 by 1
+ \repeat
+}
+
+\def\setnonasciicharscatcodenonglobal#1{%
+ \count255=128
+ \loop\ifnum\count255<256
+ \catcode\count255=#1\relax
+ \advance\count255 by 1
+ \repeat
+}
+
+% @documentencoding sets the definition of non-ASCII characters
+% according to the specified encoding.
+%
+\parseargdef\documentencoding{%
+ % Encoding being declared for the document.
+ \def\declaredencoding{\csname #1.enc\endcsname}%
+ %
+ % Supported encodings: names converted to tokens in order to be able
+ % to compare them with \ifx.
+ \def\ascii{\csname US-ASCII.enc\endcsname}%
+ \def\latnine{\csname ISO-8859-15.enc\endcsname}%
+ \def\latone{\csname ISO-8859-1.enc\endcsname}%
+ \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
+ \def\utfeight{\csname UTF-8.enc\endcsname}%
+ %
+ \ifx \declaredencoding \ascii
+ \asciichardefs
+ %
+ \else \ifx \declaredencoding \lattwo
+ \setnonasciicharscatcode\active
+ \lattwochardefs
+ %
+ \else \ifx \declaredencoding \latone
+ \setnonasciicharscatcode\active
+ \latonechardefs
+ %
+ \else \ifx \declaredencoding \latnine
+ \setnonasciicharscatcode\active
+ \latninechardefs
+ %
+ \else \ifx \declaredencoding \utfeight
+ \setnonasciicharscatcode\active
+ \utfeightchardefs
+ %
+ \else
+ \message{Unknown document encoding #1, ignoring.}%
+ %
+ \fi % utfeight
+ \fi % latnine
+ \fi % latone
+ \fi % lattwo
+ \fi % ascii
+}
+
+% A message to be logged when using a character that isn't available
+% the default font encoding (OT1).
+%
+\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
+
+% Take account of \c (plain) vs. \, (Texinfo) difference.
+\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
+
+% First, make active non-ASCII characters in order for them to be
+% correctly categorized when TeX reads the replacement text of
+% macros containing the character definitions.
+\setnonasciicharscatcode\active
+%
+% Latin1 (ISO-8859-1) character definitions.
+\def\latonechardefs{%
+ \gdef^^a0{\tie}
+ \gdef^^a1{\exclamdown}
+ \gdef^^a2{\missingcharmsg{CENT SIGN}}
+ \gdef^^a3{{\pounds}}
+ \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
+ \gdef^^a5{\missingcharmsg{YEN SIGN}}
+ \gdef^^a6{\missingcharmsg{BROKEN BAR}}
+ \gdef^^a7{\S}
+ \gdef^^a8{\"{}}
+ \gdef^^a9{\copyright}
+ \gdef^^aa{\ordf}
+ \gdef^^ab{\guillemetleft}
+ \gdef^^ac{$\lnot$}
+ \gdef^^ad{\-}
+ \gdef^^ae{\registeredsymbol}
+ \gdef^^af{\={}}
+ %
+ \gdef^^b0{\textdegree}
+ \gdef^^b1{$\pm$}
+ \gdef^^b2{$^2$}
+ \gdef^^b3{$^3$}
+ \gdef^^b4{\'{}}
+ \gdef^^b5{$\mu$}
+ \gdef^^b6{\P}
+ %
+ \gdef^^b7{$^.$}
+ \gdef^^b8{\cedilla\ }
+ \gdef^^b9{$^1$}
+ \gdef^^ba{\ordm}
+ %
+ \gdef^^bb{\guillemetright}
+ \gdef^^bc{$1\over4$}
+ \gdef^^bd{$1\over2$}
+ \gdef^^be{$3\over4$}
+ \gdef^^bf{\questiondown}
+ %
+ \gdef^^c0{\`A}
+ \gdef^^c1{\'A}
+ \gdef^^c2{\^A}
+ \gdef^^c3{\~A}
+ \gdef^^c4{\"A}
+ \gdef^^c5{\ringaccent A}
+ \gdef^^c6{\AE}
+ \gdef^^c7{\cedilla C}
+ \gdef^^c8{\`E}
+ \gdef^^c9{\'E}
+ \gdef^^ca{\^E}
+ \gdef^^cb{\"E}
+ \gdef^^cc{\`I}
+ \gdef^^cd{\'I}
+ \gdef^^ce{\^I}
+ \gdef^^cf{\"I}
+ %
+ \gdef^^d0{\DH}
+ \gdef^^d1{\~N}
+ \gdef^^d2{\`O}
+ \gdef^^d3{\'O}
+ \gdef^^d4{\^O}
+ \gdef^^d5{\~O}
+ \gdef^^d6{\"O}
+ \gdef^^d7{$\times$}
+ \gdef^^d8{\O}
+ \gdef^^d9{\`U}
+ \gdef^^da{\'U}
+ \gdef^^db{\^U}
+ \gdef^^dc{\"U}
+ \gdef^^dd{\'Y}
+ \gdef^^de{\TH}
+ \gdef^^df{\ss}
+ %
+ \gdef^^e0{\`a}
+ \gdef^^e1{\'a}
+ \gdef^^e2{\^a}
+ \gdef^^e3{\~a}
+ \gdef^^e4{\"a}
+ \gdef^^e5{\ringaccent a}
+ \gdef^^e6{\ae}
+ \gdef^^e7{\cedilla c}
+ \gdef^^e8{\`e}
+ \gdef^^e9{\'e}
+ \gdef^^ea{\^e}
+ \gdef^^eb{\"e}
+ \gdef^^ec{\`{\dotless i}}
+ \gdef^^ed{\'{\dotless i}}
+ \gdef^^ee{\^{\dotless i}}
+ \gdef^^ef{\"{\dotless i}}
+ %
+ \gdef^^f0{\dh}
+ \gdef^^f1{\~n}
+ \gdef^^f2{\`o}
+ \gdef^^f3{\'o}
+ \gdef^^f4{\^o}
+ \gdef^^f5{\~o}
+ \gdef^^f6{\"o}
+ \gdef^^f7{$\div$}
+ \gdef^^f8{\o}
+ \gdef^^f9{\`u}
+ \gdef^^fa{\'u}
+ \gdef^^fb{\^u}
+ \gdef^^fc{\"u}
+ \gdef^^fd{\'y}
+ \gdef^^fe{\th}
+ \gdef^^ff{\"y}
+}
+
+% Latin9 (ISO-8859-15) encoding character definitions.
+\def\latninechardefs{%
+ % Encoding is almost identical to Latin1.
+ \latonechardefs
+ %
+ \gdef^^a4{\euro}
+ \gdef^^a6{\v S}
+ \gdef^^a8{\v s}
+ \gdef^^b4{\v Z}
+ \gdef^^b8{\v z}
+ \gdef^^bc{\OE}
+ \gdef^^bd{\oe}
+ \gdef^^be{\"Y}
+}
+
+% Latin2 (ISO-8859-2) character definitions.
+\def\lattwochardefs{%
+ \gdef^^a0{\tie}
+ \gdef^^a1{\ogonek{A}}
+ \gdef^^a2{\u{}}
+ \gdef^^a3{\L}
+ \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
+ \gdef^^a5{\v L}
+ \gdef^^a6{\'S}
+ \gdef^^a7{\S}
+ \gdef^^a8{\"{}}
+ \gdef^^a9{\v S}
+ \gdef^^aa{\cedilla S}
+ \gdef^^ab{\v T}
+ \gdef^^ac{\'Z}
+ \gdef^^ad{\-}
+ \gdef^^ae{\v Z}
+ \gdef^^af{\dotaccent Z}
+ %
+ \gdef^^b0{\textdegree}
+ \gdef^^b1{\ogonek{a}}
+ \gdef^^b2{\ogonek{ }}
+ \gdef^^b3{\l}
+ \gdef^^b4{\'{}}
+ \gdef^^b5{\v l}
+ \gdef^^b6{\'s}
+ \gdef^^b7{\v{}}
+ \gdef^^b8{\cedilla\ }
+ \gdef^^b9{\v s}
+ \gdef^^ba{\cedilla s}
+ \gdef^^bb{\v t}
+ \gdef^^bc{\'z}
+ \gdef^^bd{\H{}}
+ \gdef^^be{\v z}
+ \gdef^^bf{\dotaccent z}
+ %
+ \gdef^^c0{\'R}
+ \gdef^^c1{\'A}
+ \gdef^^c2{\^A}
+ \gdef^^c3{\u A}
+ \gdef^^c4{\"A}
+ \gdef^^c5{\'L}
+ \gdef^^c6{\'C}
+ \gdef^^c7{\cedilla C}
+ \gdef^^c8{\v C}
+ \gdef^^c9{\'E}
+ \gdef^^ca{\ogonek{E}}
+ \gdef^^cb{\"E}
+ \gdef^^cc{\v E}
+ \gdef^^cd{\'I}
+ \gdef^^ce{\^I}
+ \gdef^^cf{\v D}
+ %
+ \gdef^^d0{\DH}
+ \gdef^^d1{\'N}
+ \gdef^^d2{\v N}
+ \gdef^^d3{\'O}
+ \gdef^^d4{\^O}
+ \gdef^^d5{\H O}
+ \gdef^^d6{\"O}
+ \gdef^^d7{$\times$}
+ \gdef^^d8{\v R}
+ \gdef^^d9{\ringaccent U}
+ \gdef^^da{\'U}
+ \gdef^^db{\H U}
+ \gdef^^dc{\"U}
+ \gdef^^dd{\'Y}
+ \gdef^^de{\cedilla T}
+ \gdef^^df{\ss}
+ %
+ \gdef^^e0{\'r}
+ \gdef^^e1{\'a}
+ \gdef^^e2{\^a}
+ \gdef^^e3{\u a}
+ \gdef^^e4{\"a}
+ \gdef^^e5{\'l}
+ \gdef^^e6{\'c}
+ \gdef^^e7{\cedilla c}
+ \gdef^^e8{\v c}
+ \gdef^^e9{\'e}
+ \gdef^^ea{\ogonek{e}}
+ \gdef^^eb{\"e}
+ \gdef^^ec{\v e}
+ \gdef^^ed{\'{\dotless{i}}}
+ \gdef^^ee{\^{\dotless{i}}}
+ \gdef^^ef{\v d}
+ %
+ \gdef^^f0{\dh}
+ \gdef^^f1{\'n}
+ \gdef^^f2{\v n}
+ \gdef^^f3{\'o}
+ \gdef^^f4{\^o}
+ \gdef^^f5{\H o}
+ \gdef^^f6{\"o}
+ \gdef^^f7{$\div$}
+ \gdef^^f8{\v r}
+ \gdef^^f9{\ringaccent u}
+ \gdef^^fa{\'u}
+ \gdef^^fb{\H u}
+ \gdef^^fc{\"u}
+ \gdef^^fd{\'y}
+ \gdef^^fe{\cedilla t}
+ \gdef^^ff{\dotaccent{}}
+}
+
+% UTF-8 character definitions.
+%
+% This code to support UTF-8 is based on LaTeX's utf8.def, with some
+% changes for Texinfo conventions. It is included here under the GPL by
+% permission from Frank Mittelbach and the LaTeX team.
+%
+\newcount\countUTFx
+\newcount\countUTFy
+\newcount\countUTFz
+
+\gdef\UTFviiiTwoOctets#1#2{\expandafter
+ \UTFviiiDefined\csname u8:#1\string #2\endcsname}
+%
+\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
+ \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
+%
+\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
+ \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
+
+\gdef\UTFviiiDefined#1{%
+ \ifx #1\relax
+ \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
+ \else
+ \expandafter #1%
+ \fi
+}
+
+\begingroup
+ \catcode`\~13
+ \catcode`\"12
+
+ \def\UTFviiiLoop{%
+ \global\catcode\countUTFx\active
+ \uccode`\~\countUTFx
+ \uppercase\expandafter{\UTFviiiTmp}%
+ \advance\countUTFx by 1
+ \ifnum\countUTFx < \countUTFy
+ \expandafter\UTFviiiLoop
+ \fi}
+
+ \countUTFx = "C2
+ \countUTFy = "E0
+ \def\UTFviiiTmp{%
+ \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
+ \UTFviiiLoop
+
+ \countUTFx = "E0
+ \countUTFy = "F0
+ \def\UTFviiiTmp{%
+ \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
+ \UTFviiiLoop
+
+ \countUTFx = "F0
+ \countUTFy = "F4
+ \def\UTFviiiTmp{%
+ \xdef~{\noexpand\UTFviiiFourOctets\string~}}
+ \UTFviiiLoop
+\endgroup
+
+\begingroup
+ \catcode`\"=12
+ \catcode`\<=12
+ \catcode`\.=12
+ \catcode`\,=12
+ \catcode`\;=12
+ \catcode`\!=12
+ \catcode`\~=13
+
+ \gdef\DeclareUnicodeCharacter#1#2{%
+ \countUTFz = "#1\relax
+ %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
+ \begingroup
+ \parseXMLCharref
+ \def\UTFviiiTwoOctets##1##2{%
+ \csname u8:##1\string ##2\endcsname}%
+ \def\UTFviiiThreeOctets##1##2##3{%
+ \csname u8:##1\string ##2\string ##3\endcsname}%
+ \def\UTFviiiFourOctets##1##2##3##4{%
+ \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \gdef\UTFviiiTmp{#2}%
+ \endgroup}
+
+ \gdef\parseXMLCharref{%
+ \ifnum\countUTFz < "A0\relax
+ \errhelp = \EMsimple
+ \errmessage{Cannot define Unicode char value < 00A0}%
+ \else\ifnum\countUTFz < "800\relax
+ \parseUTFviiiA,%
+ \parseUTFviiiB C\UTFviiiTwoOctets.,%
+ \else\ifnum\countUTFz < "10000\relax
+ \parseUTFviiiA;%
+ \parseUTFviiiA,%
+ \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
+ \else
+ \parseUTFviiiA;%
+ \parseUTFviiiA,%
+ \parseUTFviiiA!%
+ \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
+ \fi\fi\fi
+ }
+
+ \gdef\parseUTFviiiA#1{%
+ \countUTFx = \countUTFz
+ \divide\countUTFz by 64
+ \countUTFy = \countUTFz
+ \multiply\countUTFz by 64
+ \advance\countUTFx by -\countUTFz
+ \advance\countUTFx by 128
+ \uccode `#1\countUTFx
+ \countUTFz = \countUTFy}
+
+ \gdef\parseUTFviiiB#1#2#3#4{%
+ \advance\countUTFz by "#10\relax
+ \uccode `#3\countUTFz
+ \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
+\endgroup
+
+\def\utfeightchardefs{%
+ \DeclareUnicodeCharacter{00A0}{\tie}
+ \DeclareUnicodeCharacter{00A1}{\exclamdown}
+ \DeclareUnicodeCharacter{00A3}{\pounds}
+ \DeclareUnicodeCharacter{00A8}{\"{ }}
+ \DeclareUnicodeCharacter{00A9}{\copyright}
+ \DeclareUnicodeCharacter{00AA}{\ordf}
+ \DeclareUnicodeCharacter{00AB}{\guillemetleft}
+ \DeclareUnicodeCharacter{00AD}{\-}
+ \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
+ \DeclareUnicodeCharacter{00AF}{\={ }}
+
+ \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
+ \DeclareUnicodeCharacter{00B4}{\'{ }}
+ \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
+ \DeclareUnicodeCharacter{00BA}{\ordm}
+ \DeclareUnicodeCharacter{00BB}{\guillemetright}
+ \DeclareUnicodeCharacter{00BF}{\questiondown}
+
+ \DeclareUnicodeCharacter{00C0}{\`A}
+ \DeclareUnicodeCharacter{00C1}{\'A}
+ \DeclareUnicodeCharacter{00C2}{\^A}
+ \DeclareUnicodeCharacter{00C3}{\~A}
+ \DeclareUnicodeCharacter{00C4}{\"A}
+ \DeclareUnicodeCharacter{00C5}{\AA}
+ \DeclareUnicodeCharacter{00C6}{\AE}
+ \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
+ \DeclareUnicodeCharacter{00C8}{\`E}
+ \DeclareUnicodeCharacter{00C9}{\'E}
+ \DeclareUnicodeCharacter{00CA}{\^E}
+ \DeclareUnicodeCharacter{00CB}{\"E}
+ \DeclareUnicodeCharacter{00CC}{\`I}
+ \DeclareUnicodeCharacter{00CD}{\'I}
+ \DeclareUnicodeCharacter{00CE}{\^I}
+ \DeclareUnicodeCharacter{00CF}{\"I}
+
+ \DeclareUnicodeCharacter{00D0}{\DH}
+ \DeclareUnicodeCharacter{00D1}{\~N}
+ \DeclareUnicodeCharacter{00D2}{\`O}
+ \DeclareUnicodeCharacter{00D3}{\'O}
+ \DeclareUnicodeCharacter{00D4}{\^O}
+ \DeclareUnicodeCharacter{00D5}{\~O}
+ \DeclareUnicodeCharacter{00D6}{\"O}
+ \DeclareUnicodeCharacter{00D8}{\O}
+ \DeclareUnicodeCharacter{00D9}{\`U}
+ \DeclareUnicodeCharacter{00DA}{\'U}
+ \DeclareUnicodeCharacter{00DB}{\^U}
+ \DeclareUnicodeCharacter{00DC}{\"U}
+ \DeclareUnicodeCharacter{00DD}{\'Y}
+ \DeclareUnicodeCharacter{00DE}{\TH}
+ \DeclareUnicodeCharacter{00DF}{\ss}
+
+ \DeclareUnicodeCharacter{00E0}{\`a}
+ \DeclareUnicodeCharacter{00E1}{\'a}
+ \DeclareUnicodeCharacter{00E2}{\^a}
+ \DeclareUnicodeCharacter{00E3}{\~a}
+ \DeclareUnicodeCharacter{00E4}{\"a}
+ \DeclareUnicodeCharacter{00E5}{\aa}
+ \DeclareUnicodeCharacter{00E6}{\ae}
+ \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
+ \DeclareUnicodeCharacter{00E8}{\`e}
+ \DeclareUnicodeCharacter{00E9}{\'e}
+ \DeclareUnicodeCharacter{00EA}{\^e}
+ \DeclareUnicodeCharacter{00EB}{\"e}
+ \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
+ \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
+ \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
+ \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
+
+ \DeclareUnicodeCharacter{00F0}{\dh}
+ \DeclareUnicodeCharacter{00F1}{\~n}
+ \DeclareUnicodeCharacter{00F2}{\`o}
+ \DeclareUnicodeCharacter{00F3}{\'o}
+ \DeclareUnicodeCharacter{00F4}{\^o}
+ \DeclareUnicodeCharacter{00F5}{\~o}
+ \DeclareUnicodeCharacter{00F6}{\"o}
+ \DeclareUnicodeCharacter{00F8}{\o}
+ \DeclareUnicodeCharacter{00F9}{\`u}
+ \DeclareUnicodeCharacter{00FA}{\'u}
+ \DeclareUnicodeCharacter{00FB}{\^u}
+ \DeclareUnicodeCharacter{00FC}{\"u}
+ \DeclareUnicodeCharacter{00FD}{\'y}
+ \DeclareUnicodeCharacter{00FE}{\th}
+ \DeclareUnicodeCharacter{00FF}{\"y}
+
+ \DeclareUnicodeCharacter{0100}{\=A}
+ \DeclareUnicodeCharacter{0101}{\=a}
+ \DeclareUnicodeCharacter{0102}{\u{A}}
+ \DeclareUnicodeCharacter{0103}{\u{a}}
+ \DeclareUnicodeCharacter{0104}{\ogonek{A}}
+ \DeclareUnicodeCharacter{0105}{\ogonek{a}}
+ \DeclareUnicodeCharacter{0106}{\'C}
+ \DeclareUnicodeCharacter{0107}{\'c}
+ \DeclareUnicodeCharacter{0108}{\^C}
+ \DeclareUnicodeCharacter{0109}{\^c}
+ \DeclareUnicodeCharacter{0118}{\ogonek{E}}
+ \DeclareUnicodeCharacter{0119}{\ogonek{e}}
+ \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
+ \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
+ \DeclareUnicodeCharacter{010C}{\v{C}}
+ \DeclareUnicodeCharacter{010D}{\v{c}}
+ \DeclareUnicodeCharacter{010E}{\v{D}}
+
+ \DeclareUnicodeCharacter{0112}{\=E}
+ \DeclareUnicodeCharacter{0113}{\=e}
+ \DeclareUnicodeCharacter{0114}{\u{E}}
+ \DeclareUnicodeCharacter{0115}{\u{e}}
+ \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
+ \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
+ \DeclareUnicodeCharacter{011A}{\v{E}}
+ \DeclareUnicodeCharacter{011B}{\v{e}}
+ \DeclareUnicodeCharacter{011C}{\^G}
+ \DeclareUnicodeCharacter{011D}{\^g}
+ \DeclareUnicodeCharacter{011E}{\u{G}}
+ \DeclareUnicodeCharacter{011F}{\u{g}}
+
+ \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
+ \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
+ \DeclareUnicodeCharacter{0124}{\^H}
+ \DeclareUnicodeCharacter{0125}{\^h}
+ \DeclareUnicodeCharacter{0128}{\~I}
+ \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
+ \DeclareUnicodeCharacter{012A}{\=I}
+ \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
+ \DeclareUnicodeCharacter{012C}{\u{I}}
+ \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
+
+ \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
+ \DeclareUnicodeCharacter{0131}{\dotless{i}}
+ \DeclareUnicodeCharacter{0132}{IJ}
+ \DeclareUnicodeCharacter{0133}{ij}
+ \DeclareUnicodeCharacter{0134}{\^J}
+ \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
+ \DeclareUnicodeCharacter{0139}{\'L}
+ \DeclareUnicodeCharacter{013A}{\'l}
+
+ \DeclareUnicodeCharacter{0141}{\L}
+ \DeclareUnicodeCharacter{0142}{\l}
+ \DeclareUnicodeCharacter{0143}{\'N}
+ \DeclareUnicodeCharacter{0144}{\'n}
+ \DeclareUnicodeCharacter{0147}{\v{N}}
+ \DeclareUnicodeCharacter{0148}{\v{n}}
+ \DeclareUnicodeCharacter{014C}{\=O}
+ \DeclareUnicodeCharacter{014D}{\=o}
+ \DeclareUnicodeCharacter{014E}{\u{O}}
+ \DeclareUnicodeCharacter{014F}{\u{o}}
+
+ \DeclareUnicodeCharacter{0150}{\H{O}}
+ \DeclareUnicodeCharacter{0151}{\H{o}}
+ \DeclareUnicodeCharacter{0152}{\OE}
+ \DeclareUnicodeCharacter{0153}{\oe}
+ \DeclareUnicodeCharacter{0154}{\'R}
+ \DeclareUnicodeCharacter{0155}{\'r}
+ \DeclareUnicodeCharacter{0158}{\v{R}}
+ \DeclareUnicodeCharacter{0159}{\v{r}}
+ \DeclareUnicodeCharacter{015A}{\'S}
+ \DeclareUnicodeCharacter{015B}{\'s}
+ \DeclareUnicodeCharacter{015C}{\^S}
+ \DeclareUnicodeCharacter{015D}{\^s}
+ \DeclareUnicodeCharacter{015E}{\cedilla{S}}
+ \DeclareUnicodeCharacter{015F}{\cedilla{s}}
+
+ \DeclareUnicodeCharacter{0160}{\v{S}}
+ \DeclareUnicodeCharacter{0161}{\v{s}}
+ \DeclareUnicodeCharacter{0162}{\cedilla{t}}
+ \DeclareUnicodeCharacter{0163}{\cedilla{T}}
+ \DeclareUnicodeCharacter{0164}{\v{T}}
+
+ \DeclareUnicodeCharacter{0168}{\~U}
+ \DeclareUnicodeCharacter{0169}{\~u}
+ \DeclareUnicodeCharacter{016A}{\=U}
+ \DeclareUnicodeCharacter{016B}{\=u}
+ \DeclareUnicodeCharacter{016C}{\u{U}}
+ \DeclareUnicodeCharacter{016D}{\u{u}}
+ \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
+ \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
+
+ \DeclareUnicodeCharacter{0170}{\H{U}}
+ \DeclareUnicodeCharacter{0171}{\H{u}}
+ \DeclareUnicodeCharacter{0174}{\^W}
+ \DeclareUnicodeCharacter{0175}{\^w}
+ \DeclareUnicodeCharacter{0176}{\^Y}
+ \DeclareUnicodeCharacter{0177}{\^y}
+ \DeclareUnicodeCharacter{0178}{\"Y}
+ \DeclareUnicodeCharacter{0179}{\'Z}
+ \DeclareUnicodeCharacter{017A}{\'z}
+ \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
+ \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
+ \DeclareUnicodeCharacter{017D}{\v{Z}}
+ \DeclareUnicodeCharacter{017E}{\v{z}}
+
+ \DeclareUnicodeCharacter{01C4}{D\v{Z}}
+ \DeclareUnicodeCharacter{01C5}{D\v{z}}
+ \DeclareUnicodeCharacter{01C6}{d\v{z}}
+ \DeclareUnicodeCharacter{01C7}{LJ}
+ \DeclareUnicodeCharacter{01C8}{Lj}
+ \DeclareUnicodeCharacter{01C9}{lj}
+ \DeclareUnicodeCharacter{01CA}{NJ}
+ \DeclareUnicodeCharacter{01CB}{Nj}
+ \DeclareUnicodeCharacter{01CC}{nj}
+ \DeclareUnicodeCharacter{01CD}{\v{A}}
+ \DeclareUnicodeCharacter{01CE}{\v{a}}
+ \DeclareUnicodeCharacter{01CF}{\v{I}}
+
+ \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
+ \DeclareUnicodeCharacter{01D1}{\v{O}}
+ \DeclareUnicodeCharacter{01D2}{\v{o}}
+ \DeclareUnicodeCharacter{01D3}{\v{U}}
+ \DeclareUnicodeCharacter{01D4}{\v{u}}
+
+ \DeclareUnicodeCharacter{01E2}{\={\AE}}
+ \DeclareUnicodeCharacter{01E3}{\={\ae}}
+ \DeclareUnicodeCharacter{01E6}{\v{G}}
+ \DeclareUnicodeCharacter{01E7}{\v{g}}
+ \DeclareUnicodeCharacter{01E8}{\v{K}}
+ \DeclareUnicodeCharacter{01E9}{\v{k}}
+
+ \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
+ \DeclareUnicodeCharacter{01F1}{DZ}
+ \DeclareUnicodeCharacter{01F2}{Dz}
+ \DeclareUnicodeCharacter{01F3}{dz}
+ \DeclareUnicodeCharacter{01F4}{\'G}
+ \DeclareUnicodeCharacter{01F5}{\'g}
+ \DeclareUnicodeCharacter{01F8}{\`N}
+ \DeclareUnicodeCharacter{01F9}{\`n}
+ \DeclareUnicodeCharacter{01FC}{\'{\AE}}
+ \DeclareUnicodeCharacter{01FD}{\'{\ae}}
+ \DeclareUnicodeCharacter{01FE}{\'{\O}}
+ \DeclareUnicodeCharacter{01FF}{\'{\o}}
+
+ \DeclareUnicodeCharacter{021E}{\v{H}}
+ \DeclareUnicodeCharacter{021F}{\v{h}}
+
+ \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
+ \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
+ \DeclareUnicodeCharacter{0228}{\cedilla{E}}
+ \DeclareUnicodeCharacter{0229}{\cedilla{e}}
+ \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
+ \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
+
+ \DeclareUnicodeCharacter{0232}{\=Y}
+ \DeclareUnicodeCharacter{0233}{\=y}
+ \DeclareUnicodeCharacter{0237}{\dotless{j}}
+
+ \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
+
+ \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
+ \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
+ \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
+ \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
+ \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
+ \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
+ \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
+ \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
+ \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
+ \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
+ \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
+ \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
+
+ \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
+ \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
+
+ \DeclareUnicodeCharacter{1E20}{\=G}
+ \DeclareUnicodeCharacter{1E21}{\=g}
+ \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
+ \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
+ \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
+ \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
+ \DeclareUnicodeCharacter{1E26}{\"H}
+ \DeclareUnicodeCharacter{1E27}{\"h}
+
+ \DeclareUnicodeCharacter{1E30}{\'K}
+ \DeclareUnicodeCharacter{1E31}{\'k}
+ \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
+ \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
+ \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
+ \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
+ \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
+ \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
+ \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
+ \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
+ \DeclareUnicodeCharacter{1E3E}{\'M}
+ \DeclareUnicodeCharacter{1E3F}{\'m}
+
+ \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
+ \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
+ \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
+ \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
+ \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
+ \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
+ \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
+ \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
+ \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
+ \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
+
+ \DeclareUnicodeCharacter{1E54}{\'P}
+ \DeclareUnicodeCharacter{1E55}{\'p}
+ \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
+ \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
+ \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
+ \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
+ \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
+ \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
+ \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
+ \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
+
+ \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
+ \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
+ \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
+ \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
+ \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
+ \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
+ \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
+ \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
+ \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
+ \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
+
+ \DeclareUnicodeCharacter{1E7C}{\~V}
+ \DeclareUnicodeCharacter{1E7D}{\~v}
+ \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
+ \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
+
+ \DeclareUnicodeCharacter{1E80}{\`W}
+ \DeclareUnicodeCharacter{1E81}{\`w}
+ \DeclareUnicodeCharacter{1E82}{\'W}
+ \DeclareUnicodeCharacter{1E83}{\'w}
+ \DeclareUnicodeCharacter{1E84}{\"W}
+ \DeclareUnicodeCharacter{1E85}{\"w}
+ \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
+ \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
+ \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
+ \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
+ \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
+ \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
+ \DeclareUnicodeCharacter{1E8C}{\"X}
+ \DeclareUnicodeCharacter{1E8D}{\"x}
+ \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
+ \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
+
+ \DeclareUnicodeCharacter{1E90}{\^Z}
+ \DeclareUnicodeCharacter{1E91}{\^z}
+ \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
+ \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
+ \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
+ \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
+ \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
+ \DeclareUnicodeCharacter{1E97}{\"t}
+ \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
+ \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
+
+ \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
+ \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
+
+ \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
+ \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
+ \DeclareUnicodeCharacter{1EBC}{\~E}
+ \DeclareUnicodeCharacter{1EBD}{\~e}
+
+ \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
+ \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
+ \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
+ \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
+
+ \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
+ \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
+
+ \DeclareUnicodeCharacter{1EF2}{\`Y}
+ \DeclareUnicodeCharacter{1EF3}{\`y}
+ \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
+
+ \DeclareUnicodeCharacter{1EF8}{\~Y}
+ \DeclareUnicodeCharacter{1EF9}{\~y}
+
+ \DeclareUnicodeCharacter{2013}{--}
+ \DeclareUnicodeCharacter{2014}{---}
+ \DeclareUnicodeCharacter{2018}{\quoteleft}
+ \DeclareUnicodeCharacter{2019}{\quoteright}
+ \DeclareUnicodeCharacter{201A}{\quotesinglbase}
+ \DeclareUnicodeCharacter{201C}{\quotedblleft}
+ \DeclareUnicodeCharacter{201D}{\quotedblright}
+ \DeclareUnicodeCharacter{201E}{\quotedblbase}
+ \DeclareUnicodeCharacter{2022}{\bullet}
+ \DeclareUnicodeCharacter{2026}{\dots}
+ \DeclareUnicodeCharacter{2039}{\guilsinglleft}
+ \DeclareUnicodeCharacter{203A}{\guilsinglright}
+ \DeclareUnicodeCharacter{20AC}{\euro}
+
+ \DeclareUnicodeCharacter{2192}{\expansion}
+ \DeclareUnicodeCharacter{21D2}{\result}
+
+ \DeclareUnicodeCharacter{2212}{\minus}
+ \DeclareUnicodeCharacter{2217}{\point}
+ \DeclareUnicodeCharacter{2261}{\equiv}
+}% end of \utfeightchardefs
+
+
+% US-ASCII character definitions.
+\def\asciichardefs{% nothing need be done
+ \relax
+}
+
+% Make non-ASCII characters printable again for compatibility with
+% existing Texinfo documents that may use them, even without declaring a
+% document encoding.
+%
+\setnonasciicharscatcode \other
+
+
+\message{formatting,}
+
+\newdimen\defaultparindent \defaultparindent = 15pt
+
+\chapheadingskip = 15pt plus 4pt minus 2pt
+\secheadingskip = 12pt plus 3pt minus 2pt
+\subsecheadingskip = 9pt plus 2pt minus 2pt
+
+% Prevent underfull vbox error messages.
+\vbadness = 10000
+
+% Don't be very finicky about underfull hboxes, either.
+\hbadness = 6666
+
+% Following George Bush, get rid of widows and orphans.
+\widowpenalty=10000
+\clubpenalty=10000
+
+% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
+% using an old version of TeX, don't do anything. We want the amount of
+% stretch added to depend on the line length, hence the dependence on
+% \hsize. We call this whenever the paper size is set.
+%
+\def\setemergencystretch{%
+ \ifx\emergencystretch\thisisundefined
+ % Allow us to assign to \emergencystretch anyway.
+ \def\emergencystretch{\dimen0}%
+ \else
+ \emergencystretch = .15\hsize
+ \fi
+}
+
+% Parameters in order: 1) textheight; 2) textwidth;
+% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
+% 7) physical page height; 8) physical page width.
+%
+% We also call \setleading{\textleading}, so the caller should define
+% \textleading. The caller should also set \parskip.
+%
+\def\internalpagesizes#1#2#3#4#5#6#7#8{%
+ \voffset = #3\relax
+ \topskip = #6\relax
+ \splittopskip = \topskip
+ %
+ \vsize = #1\relax
+ \advance\vsize by \topskip
+ \outervsize = \vsize
+ \advance\outervsize by 2\topandbottommargin
+ \pageheight = \vsize
+ %
+ \hsize = #2\relax
+ \outerhsize = \hsize
+ \advance\outerhsize by 0.5in
+ \pagewidth = \hsize
+ %
+ \normaloffset = #4\relax
+ \bindingoffset = #5\relax
+ %
+ \ifpdf
+ \pdfpageheight #7\relax
+ \pdfpagewidth #8\relax
+ % if we don't reset these, they will remain at "1 true in" of
+ % whatever layout pdftex was dumped with.
+ \pdfhorigin = 1 true in
+ \pdfvorigin = 1 true in
+ \fi
+ %
+ \setleading{\textleading}
+ %
+ \parindent = \defaultparindent
+ \setemergencystretch
+}
+
+% @letterpaper (the default).
+\def\letterpaper{{\globaldefs = 1
+ \parskip = 3pt plus 2pt minus 1pt
+ \textleading = 13.2pt
+ %
+ % If page is nothing but text, make it come out even.
+ \internalpagesizes{607.2pt}{6in}% that's 46 lines
+ {\voffset}{.25in}%
+ {\bindingoffset}{36pt}%
+ {11in}{8.5in}%
+}}
+
+% Use @smallbook to reset parameters for 7x9.25 trim size.
+\def\smallbook{{\globaldefs = 1
+ \parskip = 2pt plus 1pt
+ \textleading = 12pt
+ %
+ \internalpagesizes{7.5in}{5in}%
+ {-.2in}{0in}%
+ {\bindingoffset}{16pt}%
+ {9.25in}{7in}%
+ %
+ \lispnarrowing = 0.3in
+ \tolerance = 700
+ \hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = .5cm
+}}
+
+% Use @smallerbook to reset parameters for 6x9 trim size.
+% (Just testing, parameters still in flux.)
+\def\smallerbook{{\globaldefs = 1
+ \parskip = 1.5pt plus 1pt
+ \textleading = 12pt
+ %
+ \internalpagesizes{7.4in}{4.8in}%
+ {-.2in}{-.4in}%
+ {0pt}{14pt}%
+ {9in}{6in}%
+ %
+ \lispnarrowing = 0.25in
+ \tolerance = 700
+ \hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = .4cm
+}}
+
+% Use @afourpaper to print on European A4 paper.
+\def\afourpaper{{\globaldefs = 1
+ \parskip = 3pt plus 2pt minus 1pt
+ \textleading = 13.2pt
+ %
+ % Double-side printing via postscript on Laserjet 4050
+ % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
+ % To change the settings for a different printer or situation, adjust
+ % \normaloffset until the front-side and back-side texts align. Then
+ % do the same for \bindingoffset. You can set these for testing in
+ % your texinfo source file like this:
+ % @tex
+ % \global\normaloffset = -6mm
+ % \global\bindingoffset = 10mm
+ % @end tex
+ \internalpagesizes{673.2pt}{160mm}% that's 51 lines
+ {\voffset}{\hoffset}%
+ {\bindingoffset}{44pt}%
+ {297mm}{210mm}%
+ %
+ \tolerance = 700
+ \hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = 5mm
+}}
+
+% Use @afivepaper to print on European A5 paper.
+% From romildo@urano.iceb.ufop.br, 2 July 2000.
+% He also recommends making @example and @lisp be small.
+\def\afivepaper{{\globaldefs = 1
+ \parskip = 2pt plus 1pt minus 0.1pt
+ \textleading = 12.5pt
+ %
+ \internalpagesizes{160mm}{120mm}%
+ {\voffset}{\hoffset}%
+ {\bindingoffset}{8pt}%
+ {210mm}{148mm}%
+ %
+ \lispnarrowing = 0.2in
+ \tolerance = 800
+ \hfuzz = 1.2pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = 2mm
+ \tableindent = 12mm
+}}
+
+% A specific text layout, 24x15cm overall, intended for A4 paper.
+\def\afourlatex{{\globaldefs = 1
+ \afourpaper
+ \internalpagesizes{237mm}{150mm}%
+ {\voffset}{4.6mm}%
+ {\bindingoffset}{7mm}%
+ {297mm}{210mm}%
+ %
+ % Must explicitly reset to 0 because we call \afourpaper.
+ \globaldefs = 0
+}}
+
+% Use @afourwide to print on A4 paper in landscape format.
+\def\afourwide{{\globaldefs = 1
+ \afourpaper
+ \internalpagesizes{241mm}{165mm}%
+ {\voffset}{-2.95mm}%
+ {\bindingoffset}{7mm}%
+ {297mm}{210mm}%
+ \globaldefs = 0
+}}
+
+% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
+% Perhaps we should allow setting the margins, \topskip, \parskip,
+% and/or leading, also. Or perhaps we should compute them somehow.
+%
+\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
+\def\pagesizesyyy#1,#2,#3\finish{{%
+ \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
+ \globaldefs = 1
+ %
+ \parskip = 3pt plus 2pt minus 1pt
+ \setleading{\textleading}%
+ %
+ \dimen0 = #1\relax
+ \advance\dimen0 by \voffset
+ %
+ \dimen2 = \hsize
+ \advance\dimen2 by \normaloffset
+ %
+ \internalpagesizes{#1}{\hsize}%
+ {\voffset}{\normaloffset}%
+ {\bindingoffset}{44pt}%
+ {\dimen0}{\dimen2}%
+}}
+
+% Set default to letter.
+%
+\letterpaper
+
+
+\message{and turning on texinfo input format.}
+
+\def^^L{\par} % remove \outer, so ^L can appear in an @comment
+
+% DEL is a comment character, in case @c does not suffice.
+\catcode`\^^? = 14
+
+% Define macros to output various characters with catcode for normal text.
+\catcode`\"=\other \def\normaldoublequote{"}
+\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
+\catcode`\+=\other \def\normalplus{+}
+\catcode`\<=\other \def\normalless{<}
+\catcode`\>=\other \def\normalgreater{>}
+\catcode`\^=\other \def\normalcaret{^}
+\catcode`\_=\other \def\normalunderscore{_}
+\catcode`\|=\other \def\normalverticalbar{|}
+\catcode`\~=\other \def\normaltilde{~}
+
+% This macro is used to make a character print one way in \tt
+% (where it can probably be output as-is), and another way in other fonts,
+% where something hairier probably needs to be done.
+%
+% #1 is what to print if we are indeed using \tt; #2 is what to print
+% otherwise. Since all the Computer Modern typewriter fonts have zero
+% interword stretch (and shrink), and it is reasonable to expect all
+% typewriter fonts to have this, we can check that font parameter.
+%
+\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
+
+% Same as above, but check for italic font. Actually this also catches
+% non-italic slanted fonts since it is impossible to distinguish them from
+% italic fonts. But since this is only used by $ and it uses \sl anyway
+% this is not a problem.
+\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
+
+% Turn off all special characters except @
+% (and those which the user can use as if they were ordinary).
+% Most of these we simply print from the \tt font, but for some, we can
+% use math or other variants that look better in normal text.
+
+\catcode`\"=\active
+\def\activedoublequote{{\tt\char34}}
+\let"=\activedoublequote
+\catcode`\~=\active
+\def~{{\tt\char126}}
+\chardef\hat=`\^
+\catcode`\^=\active
+\def^{{\tt \hat}}
+
+\catcode`\_=\active
+\def_{\ifusingtt\normalunderscore\_}
+\let\realunder=_
+% Subroutine for the previous macro.
+\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
+
+\catcode`\|=\active
+\def|{{\tt\char124}}
+\chardef \less=`\<
+\catcode`\<=\active
+\def<{{\tt \less}}
+\chardef \gtr=`\>
+\catcode`\>=\active
+\def>{{\tt \gtr}}
+\catcode`\+=\active
+\def+{{\tt \char 43}}
+\catcode`\$=\active
+\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
+
+% If a .fmt file is being used, characters that might appear in a file
+% name cannot be active until we have parsed the command line.
+% So turn them off again, and have \everyjob (or @setfilename) turn them on.
+% \otherifyactive is called near the end of this file.
+\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
+
+% Used sometimes to turn off (effectively) the active characters even after
+% parsing them.
+\def\turnoffactive{%
+ \normalturnoffactive
+ \otherbackslash
+}
+
+\catcode`\@=0
+
+% \backslashcurfont outputs one backslash character in current font,
+% as in \char`\\.
+\global\chardef\backslashcurfont=`\\
+\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
+
+% \realbackslash is an actual character `\' with catcode other, and
+% \doublebackslash is two of them (for the pdf outlines).
+{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
+
+% In texinfo, backslash is an active character; it prints the backslash
+% in fixed width font.
+\catcode`\\=\active % @ for escape char from now on.
+
+% The story here is that in math mode, the \char of \backslashcurfont
+% ends up printing the roman \ from the math symbol font (because \char
+% in math mode uses the \mathcode, and plain.tex sets
+% \mathcode`\\="026E). It seems better for @backslashchar{} to always
+% print a typewriter backslash, hence we use an explicit \mathchar,
+% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
+% ignored family value; char position "5C). We can't use " for the
+% usual hex value because it has already been made active.
+@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
+@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
+
+% On startup, @fixbackslash assigns:
+% @let \ = @normalbackslash
+% \rawbackslash defines an active \ to do \backslashcurfont.
+% \otherbackslash defines an active \ to be a literal `\' character with
+% catcode other. We switch back and forth between these.
+@gdef@rawbackslash{@let\=@backslashcurfont}
+@gdef@otherbackslash{@let\=@realbackslash}
+
+% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
+% the literal character `\'.
+%
+@def@normalturnoffactive{%
+ @let"=@normaldoublequote
+ @let$=@normaldollar %$ font-lock fix
+ @let+=@normalplus
+ @let<=@normalless
+ @let>=@normalgreater
+ @let\=@normalbackslash
+ @let^=@normalcaret
+ @let_=@normalunderscore
+ @let|=@normalverticalbar
+ @let~=@normaltilde
+ @markupsetuplqdefault
+ @markupsetuprqdefault
+ @unsepspaces
+}
+
+% Make _ and + \other characters, temporarily.
+% This is canceled by @fixbackslash.
+@otherifyactive
+
+% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
+% That is what \eatinput is for; after that, the `\' should revert to printing
+% a backslash.
+%
+@gdef@eatinput input texinfo{@fixbackslash}
+@global@let\ = @eatinput
+
+% On the other hand, perhaps the file did not have a `\input texinfo'. Then
+% the first `\' in the file would cause an error. This macro tries to fix
+% that, assuming it is called before the first `\' could plausibly occur.
+% Also turn back on active characters that might appear in the input
+% file name, in case not using a pre-dumped format.
+%
+@gdef@fixbackslash{%
+ @ifx\@eatinput @let\ = @normalbackslash @fi
+ @catcode`+=@active
+ @catcode`@_=@active
+}
+
+% Say @foo, not \foo, in error messages.
+@escapechar = `@@
+
+% These (along with & and #) are made active for url-breaking, so need
+% active definitions as the normal characters.
+@def@normaldot{.}
+@def@normalquest{?}
+@def@normalslash{/}
+
+% These look ok in all fonts, so just make them not special.
+% @hashchar{} gets its own user-level command, because of #line.
+@catcode`@& = @other @def@normalamp{&}
+@catcode`@# = @other @def@normalhash{#}
+@catcode`@% = @other @def@normalpercent{%}
+
+@let @hashchar = @normalhash
+
+@c Finally, make ` and ' active, so that txicodequoteundirected and
+@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
+@c don't make ` and ' active, @code will not get them as active chars.
+@c Do this last of all since we use ` in the previous @catcode assignments.
+@catcode`@'=@active
+@catcode`@`=@active
+@markupsetuplqdefault
+@markupsetuprqdefault
+
+@c Local variables:
+@c eval: (add-hook 'write-file-hooks 'time-stamp)
+@c page-delimiter: "^\\\\message"
+@c time-stamp-start: "def\\\\texinfoversion{"
+@c time-stamp-format: "%:y-%02m-%02d.%02H"
+@c time-stamp-end: "}"
+@c End:
+
+@c vim:sw=2:
+
+@ignore
+ arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
+@end ignore
diff --git a/examples/ReadMe b/examples/ReadMe
new file mode 100644
index 0000000..2e2af32
--- /dev/null
+++ b/examples/ReadMe
@@ -0,0 +1 @@
+This directory contains simple examples.
diff --git a/examples/divworst.c b/examples/divworst.c
new file mode 100644
index 0000000..bb5c9fe
--- /dev/null
+++ b/examples/divworst.c
@@ -0,0 +1,97 @@
+/* Test of the double rounding effect.
+ *
+ * This example was presented at the CNC'2 summer school on MPFR and MPC
+ * at LORIA, Nancy, France.
+ *
+ * Arguments: max difference of exponents dmax, significand size n.
+ * Optional argument: extended precision p (with double rounding).
+ *
+ * Return all the couples of positive machine numbers (x,y) such that
+ * 1/2 <= y < 1, 0 <= Ex - Ey <= dmax, x - y is exactly representable
+ * in precision n and the results of floor(x/y) in the rounding modes
+ * toward 0 and to nearest are different.
+ */
+
+/*
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpfr.h>
+
+#define PRECN x, y, z
+#define VARS PRECN, t
+
+static unsigned long
+eval (mpfr_t x, mpfr_t y, mpfr_t z, mpfr_t t, mpfr_rnd_t rnd)
+{
+ mpfr_div (t, x, y, rnd); /* the division x/y in precision p */
+ mpfr_set (z, t, rnd); /* the rounding to the precision n */
+ mpfr_rint_floor (z, z, rnd);
+ return mpfr_get_ui (z, rnd);
+}
+
+int main (int argc, char *argv[])
+{
+ int dmax, n, p;
+ mpfr_t VARS;
+
+ if (argc != 3 && argc != 4)
+ {
+ fprintf (stderr, "Usage: divworst <dmax> <n> [ <p> ]\n");
+ exit (EXIT_FAILURE);
+ }
+
+ dmax = atoi (argv[1]);
+ n = atoi (argv[2]);
+ p = argc == 3 ? n : atoi (argv[3]);
+ if (p < n)
+ {
+ fprintf (stderr, "divworst: p must be greater or equal to n\n");
+ exit (EXIT_FAILURE);
+ }
+
+ mpfr_inits2 (n, PRECN, (mpfr_ptr) 0);
+ mpfr_init2 (t, p);
+
+ for (mpfr_set_ui_2exp (x, 1, -1, MPFR_RNDN);
+ mpfr_get_exp (x) <= dmax;
+ mpfr_nextabove (x))
+ for (mpfr_set_ui_2exp (y, 1, -1, MPFR_RNDN);
+ mpfr_get_exp (y) == 0;
+ mpfr_nextabove (y))
+ {
+ unsigned long rz, rn;
+
+ if (mpfr_sub (z, x, y, MPFR_RNDZ) != 0)
+ continue; /* x - y is not representable in precision n */
+ rz = eval (x, y, z, t, MPFR_RNDZ);
+ rn = eval (x, y, z, t, MPFR_RNDN);
+ if (rz == rn)
+ continue;
+ mpfr_printf ("x = %.*Rb ; y = %.*Rb ; Z: %lu ; N: %lu\n",
+ n - 1, x, n - 1, y, rz, rn);
+ }
+
+ mpfr_clears (VARS, (mpfr_ptr) 0);
+ return 0;
+}
diff --git a/examples/rndo-add.c b/examples/rndo-add.c
new file mode 100644
index 0000000..73b8a80
--- /dev/null
+++ b/examples/rndo-add.c
@@ -0,0 +1,91 @@
+/* This example was presented at the CNC'2 summer school on MPFR and MPC at
+ * LORIA, Nancy, France. It shows how one can use different rounding modes.
+ * This example implements the OddRoundedAdd algorithm, which returns the
+ * sum z = x + y rounded-to-odd:
+ * * RO(z) = z if z is exactly representable;
+ * * otherwise RO(z) is the value among RD(z) and RU(z) whose
+ * least significant bit is a one.
+ */
+
+/*
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gmp.h>
+#include <mpfr.h>
+
+#define LIST x, y, d, u, e, z
+
+int main (int argc, char **argv)
+{
+ mpfr_t LIST;
+ mpfr_prec_t prec;
+ int pprec; /* will be prec - 1 for mpfr_printf */
+
+ if (argc != 4)
+ {
+ fprintf (stderr, "Usage: rndo-add <prec> <x> <y>\n");
+ exit (1);
+ }
+
+ prec = atoi (argv[1]);
+ if (prec < 2)
+ {
+ fprintf (stderr, "rndo-add: bad precision\n");
+ exit (1);
+ }
+ pprec = prec - 1;
+
+ mpfr_inits2 (prec, LIST, (mpfr_ptr) 0);
+
+ if (mpfr_set_str (x, argv[2], 0, MPFR_RNDN))
+ {
+ fprintf (stderr, "rndo-add: bad x value\n");
+ exit (1);
+ }
+ mpfr_printf ("x = %.*Rb\n", pprec, x);
+
+ if (mpfr_set_str (y, argv[3], 0, MPFR_RNDN))
+ {
+ fprintf (stderr, "rndo-add: bad y value\n");
+ exit (1);
+ }
+ mpfr_printf ("y = %.*Rb\n", pprec, y);
+
+ mpfr_add (d, x, y, MPFR_RNDD);
+ mpfr_printf ("d = %.*Rb\n", pprec, d);
+
+ mpfr_add (u, x, y, MPFR_RNDU);
+ mpfr_printf ("u = %.*Rb\n", pprec, u);
+
+ mpfr_add (e, d, u, MPFR_RNDN);
+ mpfr_div_2ui (e, e, 1, MPFR_RNDN);
+ mpfr_printf ("e = %.*Rb\n", pprec, e);
+
+ mpfr_sub (z, u, e, MPFR_RNDN);
+ mpfr_add (z, z, d, MPFR_RNDN);
+ mpfr_printf ("z = %.*Rb\n", pprec, z);
+
+ mpfr_clears (LIST, (mpfr_ptr) 0);
+ return 0;
+}
diff --git a/examples/sample.c b/examples/sample.c
new file mode 100644
index 0000000..d6a0de3
--- /dev/null
+++ b/examples/sample.c
@@ -0,0 +1,56 @@
+/* This is the example given and commented on the MPFR web site:
+ * http://www.mpfr.org/sample.html
+ */
+
+/*
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <stdio.h>
+
+#include <gmp.h>
+#include <mpfr.h>
+
+int main (void)
+{
+ unsigned int i;
+ mpfr_t s, t, u;
+
+ mpfr_init2 (t, 200);
+ mpfr_set_d (t, 1.0, MPFR_RNDD);
+ mpfr_init2 (s, 200);
+ mpfr_set_d (s, 1.0, MPFR_RNDD);
+ mpfr_init2 (u, 200);
+ for (i = 1; i <= 100; i++)
+ {
+ mpfr_mul_ui (t, t, i, MPFR_RNDU);
+ mpfr_set_d (u, 1.0, MPFR_RNDD);
+ mpfr_div (u, u, t, MPFR_RNDD);
+ mpfr_add (s, s, u, MPFR_RNDD);
+ }
+ printf ("Sum is ");
+ mpfr_out_str (stdout, 10, 0, s, MPFR_RNDD);
+ putchar ('\n');
+ mpfr_clear (s);
+ mpfr_clear (t);
+ mpfr_clear (u);
+ return 0;
+}
diff --git a/examples/version.c b/examples/version.c
new file mode 100644
index 0000000..3773dcd
--- /dev/null
+++ b/examples/version.c
@@ -0,0 +1,111 @@
+/*
+ * Output various information about GMP and MPFR.
+ */
+
+/*
+Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <stdio.h>
+#include <limits.h>
+#include <gmp.h>
+#include <mpfr.h>
+
+/* The following failure can occur if GMP has been rebuilt with
+ * a different ABI, e.g.
+ * 1. GMP built with ABI=mode32.
+ * 2. MPFR built against this GMP version.
+ * 3. GMP rebuilt with ABI=32.
+ */
+static void failure_test (void)
+{
+ mpfr_t x;
+
+ mpfr_init2 (x, 128);
+ mpfr_set_str (x, "17", 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 17) != 0)
+ printf ("\nFailure in mpfr_set_str! Probably an unmatched ABI!\n");
+ mpfr_clear (x);
+}
+
+int main (void)
+{
+ unsigned long c;
+ mp_limb_t t[4] = { -1, -1, -1, -1 };
+
+#if defined(__cplusplus)
+ printf ("A C++ compiler is used.\n");
+#endif
+
+ printf ("GMP ..... Library: %-12s Header: %d.%d.%d\n",
+ gmp_version, __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
+ __GNU_MP_VERSION_PATCHLEVEL);
+
+ printf ("MPFR .... Library: %-12s Header: %s (based on %d.%d.%d)\n",
+ mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
+ MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
+
+#if MPFR_VERSION_MAJOR >= 3
+ printf ("MPFR features: TLS = %s, decimal = %s",
+ mpfr_buildopt_tls_p () ? "yes" : "no",
+ mpfr_buildopt_decimal_p () ? "yes" : "no");
+# if MPFR_VERSION_MAJOR > 3 || MPFR_VERSION_MINOR >= 1
+ printf (", GMP internals = %s\nMPFR tuning: %s",
+ mpfr_buildopt_gmpinternals_p () ? "yes" : "no",
+ mpfr_buildopt_tune_case ());
+# endif
+ printf ("\n");
+#endif
+
+ printf ("MPFR patches: %s\n\n", mpfr_get_patches ());
+
+#ifdef __GMP_CC
+ printf ("__GMP_CC = \"%s\"\n", __GMP_CC);
+#endif
+#ifdef __GMP_CFLAGS
+ printf ("__GMP_CFLAGS = \"%s\"\n", __GMP_CFLAGS);
+#endif
+ printf ("GMP_LIMB_BITS = %d\n", (int) GMP_LIMB_BITS);
+ printf ("GMP_NAIL_BITS = %d\n", (int) GMP_NAIL_BITS);
+ printf ("GMP_NUMB_BITS = %d\n", (int) GMP_NUMB_BITS);
+ printf ("mp_bits_per_limb = %d\n", (int) mp_bits_per_limb);
+ printf ("sizeof(mp_limb_t) = %d\n", (int) sizeof(mp_limb_t));
+ if (mp_bits_per_limb != GMP_LIMB_BITS)
+ printf ("Warning! mp_bits_per_limb != GMP_LIMB_BITS\n");
+ if (GMP_LIMB_BITS != sizeof(mp_limb_t) * CHAR_BIT)
+ printf ("Warning! GMP_LIMB_BITS != sizeof(mp_limb_t) * CHAR_BIT\n");
+
+ c = mpn_popcount (t, 1);
+ printf ("The GMP library expects %lu bits in a mp_limb_t.\n", c);
+ if (c != GMP_LIMB_BITS)
+ printf ("Warning! This is different from GMP_LIMB_BITS!\n"
+ "Different ABI caused by a GMP library upgrade?\n");
+
+#if MPFR_VERSION_MAJOR >= 3
+ printf ("\n");
+ printf ("sizeof(mpfr_prec_t) = %d\n", (int) sizeof(mpfr_prec_t));
+ printf ("sizeof(mpfr_exp_t) = %d\n", (int) sizeof(mpfr_exp_t));
+#endif
+
+ failure_test ();
+
+ return 0;
+}
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..a9244eb
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-01-19.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ # Protect names problematic for `test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for `test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for `test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/ltmain.sh b/ltmain.sh
new file mode 100644
index 0000000..a22775b
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,9661 @@
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool 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 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+# --config show all configuration variables
+# --debug enable verbose shell tracing
+# -n, --dry-run display commands without modifying any files
+# --features display basic configuration information and exit
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --no-quiet, --no-silent
+# print informational messages (default)
+# --no-warn don't display warning messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print more informational messages than default
+# --no-verbose don't print the extra informational messages
+# --version print version information
+# -h, --help, --help-all print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+# clean remove files from the build directory
+# compile compile a source file into a libtool object
+# execute automatically set library path, then run a program
+# finish complete the installation of libtool libraries
+# install install libraries or executables
+# link create a library or an executable
+# uninstall remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE. When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2+local1
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION="2.4.2 Debian-2.4.2-1.2+local1"
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+ fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+ s@/\./@/@g
+ t dotsl
+ s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+# value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+ # Start from root dir and reassemble the path.
+ func_normal_abspath_result=
+ func_normal_abspath_tpath=$1
+ func_normal_abspath_altnamespace=
+ case $func_normal_abspath_tpath in
+ "")
+ # Empty path, that just means $cwd.
+ func_stripname '' '/' "`pwd`"
+ func_normal_abspath_result=$func_stripname_result
+ return
+ ;;
+ # The next three entries are used to spot a run of precisely
+ # two leading slashes without using negated character classes;
+ # we take advantage of case's first-match behaviour.
+ ///*)
+ # Unusual form of absolute path, do nothing.
+ ;;
+ //*)
+ # Not necessarily an ordinary path; POSIX reserves leading '//'
+ # and for example Cygwin uses it to access remote file shares
+ # over CIFS/SMB, so we conserve a leading double slash if found.
+ func_normal_abspath_altnamespace=/
+ ;;
+ /*)
+ # Absolute path, do nothing.
+ ;;
+ *)
+ # Relative path, prepend $cwd.
+ func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+ ;;
+ esac
+ # Cancel out all the simple stuff to save iterations. We also want
+ # the path to end with a slash for ease of parsing, so make sure
+ # there is one (and only one) here.
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+ while :; do
+ # Processed it all yet?
+ if test "$func_normal_abspath_tpath" = / ; then
+ # If we ascended to the root using ".." the result may be empty now.
+ if test -z "$func_normal_abspath_result" ; then
+ func_normal_abspath_result=/
+ fi
+ break
+ fi
+ func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcar"`
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcdr"`
+ # Figure out what to do with it
+ case $func_normal_abspath_tcomponent in
+ "")
+ # Trailing empty path component, ignore it.
+ ;;
+ ..)
+ # Parent dir; strip last assembled component from result.
+ func_dirname "$func_normal_abspath_result"
+ func_normal_abspath_result=$func_dirname_result
+ ;;
+ *)
+ # Actual path component, append it.
+ func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+ ;;
+ esac
+ done
+ # Restore leading double-slash if one was found on entry.
+ func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+# value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+ func_relative_path_result=
+ func_normal_abspath "$1"
+ func_relative_path_tlibdir=$func_normal_abspath_result
+ func_normal_abspath "$2"
+ func_relative_path_tbindir=$func_normal_abspath_result
+
+ # Ascend the tree starting from libdir
+ while :; do
+ # check if we have found a prefix of bindir
+ case $func_relative_path_tbindir in
+ $func_relative_path_tlibdir)
+ # found an exact match
+ func_relative_path_tcancelled=
+ break
+ ;;
+ $func_relative_path_tlibdir*)
+ # found a matching prefix
+ func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+ func_relative_path_tcancelled=$func_stripname_result
+ if test -z "$func_relative_path_result"; then
+ func_relative_path_result=.
+ fi
+ break
+ ;;
+ *)
+ func_dirname $func_relative_path_tlibdir
+ func_relative_path_tlibdir=${func_dirname_result}
+ if test "x$func_relative_path_tlibdir" = x ; then
+ # Have to descend all the way to the root!
+ func_relative_path_result=../$func_relative_path_result
+ func_relative_path_tcancelled=$func_relative_path_tbindir
+ break
+ fi
+ func_relative_path_result=../$func_relative_path_result
+ ;;
+ esac
+ done
+
+ # Now calculate path; take care to avoid doubling-up slashes.
+ func_stripname '' '/' "$func_relative_path_result"
+ func_relative_path_result=$func_stripname_result
+ func_stripname '/' '/' "$func_relative_path_tcancelled"
+ if test "x$func_stripname_result" != x ; then
+ func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+ fi
+
+ # Normalisation. If bindir is libdir, return empty string,
+ # else relative path ending with a slash; either way, target
+ # file name can be directly appended.
+ if test ! -z "$func_relative_path_result"; then
+ func_stripname './' '' "$func_relative_path_result/"
+ func_relative_path_result=$func_stripname_result
+ fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=${PATH_SEPARATOR-:}
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes. A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$opt_dry_run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+ fi
+
+ $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+ esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "$1" | $SED \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+ *)
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result. All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+ case $1 in
+ [0-9]* | *[!a-zA-Z0-9_]*)
+ func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+ ;;
+ * )
+ func_tr_sh_result=$1
+ ;;
+ esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $opt_debug
+
+ $SED -n '/(C)/!b go
+ :more
+ /\./!{
+ N
+ s/\n# / /
+ b more
+ }
+ :go
+ /^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/^# *.*--help/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ echo
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ :print
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+ p
+ d
+ }
+ /^# .* home page:/b print
+ /^# General help using/b print
+ ' < "$progpath"
+ ret=$?
+ if test -z "$1"; then
+ exit $ret
+ fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ $opt_debug
+
+ func_error "missing argument for $1."
+ exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+ my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+ my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+ func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+ func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
+
+ func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+ func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+ func_quote_for_eval "${2}"
+ eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+ done
+
+ exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+
+ exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
+
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
+
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ fi
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
+ ;;
+compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
+ ;;
+execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
+ ;;
+finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
+ ;;
+install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
+ ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly. This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+ # this just eases exit handling
+ while test $# -gt 0; do
+ opt="$1"
+ shift
+ case $opt in
+ --debug|-x) opt_debug='set -x'
+ func_echo "enabling shell trace mode"
+ $opt_debug
+ ;;
+ --dry-run|--dryrun|-n)
+ opt_dry_run=:
+ ;;
+ --config)
+ opt_config=:
+func_config
+ ;;
+ --dlopen|-dlopen)
+ optarg="$1"
+ opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+ shift
+ ;;
+ --preserve-dup-deps)
+ opt_preserve_dup_deps=:
+ ;;
+ --features)
+ opt_features=:
+func_features
+ ;;
+ --finish)
+ opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+ ;;
+ --help)
+ opt_help=:
+ ;;
+ --help-all)
+ opt_help_all=:
+opt_help=': help-all'
+ ;;
+ --mode)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_mode="$optarg"
+case $optarg in
+ # Valid mode arguments:
+ clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+esac
+ shift
+ ;;
+ --no-silent|--no-quiet)
+ opt_silent=false
+func_append preserve_args " $opt"
+ ;;
+ --no-warning|--no-warn)
+ opt_warning=false
+func_append preserve_args " $opt"
+ ;;
+ --no-verbose)
+ opt_verbose=false
+func_append preserve_args " $opt"
+ ;;
+ --silent|--quiet)
+ opt_silent=:
+func_append preserve_args " $opt"
+ opt_verbose=false
+ ;;
+ --verbose|-v)
+ opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+ ;;
+ --tag)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+
+ # Separate optargs to long options:
+ --*=*)
+ func_split_long_opt "$opt"
+ set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ # Separate non-argument short options:
+ -\?*|-h*|-n*|-v*)
+ func_split_short_opt "$opt"
+ set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set dummy "$opt" ${1+"$@"}; shift; break ;;
+ esac
+ done
+
+ # Validate options:
+
+ # save first non-option argument
+ if test "$#" -gt 0; then
+ nonopt="$opt"
+ shift
+ fi
+
+ # preserve --debug
+ test "$opt_debug" = : || func_append preserve_args " --debug"
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+ *)
+ opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+ ;;
+ esac
+
+ $opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
+ fi
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+ func_error "unrecognized option \`-dlopen'"
+ $ECHO "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$progname --help --mode=$opt_mode' for more information."
+ }
+
+
+ # Bail if the options were screwed
+ $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot. Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+ func_resolve_sysroot_result=$1
+ case $func_resolve_sysroot_result in
+ =*)
+ func_stripname '=' '' "$func_resolve_sysroot_result"
+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+ ;;
+ esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+ case "$lt_sysroot:$1" in
+ ?*:"$lt_sysroot"*)
+ func_stripname "$lt_sysroot" '' "$1"
+ func_replace_sysroot_result="=$func_stripname_result"
+ ;;
+ *)
+ # Including no sysroot.
+ func_replace_sysroot_result=$1
+ ;;
+ esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case "$@ " in
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+ $opt_debug
+ func_convert_core_file_wine_to_w32_result="$1"
+ if test -n "$1"; then
+ # Unfortunately, winepath does not exit with a non-zero error code, so we
+ # are forced to check the contents of stdout. On the other hand, if the
+ # command is not found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both error code of
+ # zero AND non-empty stdout, which explains the odd construction:
+ func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+ func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ func_convert_core_file_wine_to_w32_result=
+ fi
+ fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+ $opt_debug
+ # unfortunately, winepath doesn't convert paths, only file names
+ func_convert_core_path_wine_to_w32_result=""
+ if test -n "$1"; then
+ oldIFS=$IFS
+ IFS=:
+ for func_convert_core_path_wine_to_w32_f in $1; do
+ IFS=$oldIFS
+ func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+ if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+ if test -z "$func_convert_core_path_wine_to_w32_result"; then
+ func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+ else
+ func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+ fi
+ fi
+ done
+ IFS=$oldIFS
+ fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+ $opt_debug
+ if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+ func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+ if test "$?" -ne 0; then
+ # on failure, ensure result is empty
+ func_cygpath_result=
+ fi
+ else
+ func_cygpath_result=
+ func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+ fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format. Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+ $opt_debug
+ # awkward: cmd appends spaces to result
+ func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+ $opt_debug
+ if test -z "$2" && test -n "$1" ; then
+ func_error "Could not determine host file name corresponding to"
+ func_error " \`$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_file_result="$1"
+ fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+ $opt_debug
+ if test -z "$4" && test -n "$3"; then
+ func_error "Could not determine the host path corresponding to"
+ func_error " \`$3'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This is a deliberately simplistic "conversion" and
+ # should not be "improved". See libtool.info.
+ if test "x$1" != "x$2"; then
+ lt_replace_pathsep_chars="s|$1|$2|g"
+ func_to_host_path_result=`echo "$3" |
+ $SED -e "$lt_replace_pathsep_chars"`
+ else
+ func_to_host_path_result="$3"
+ fi
+ fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+ $opt_debug
+ case $4 in
+ $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+ ;;
+ esac
+ case $4 in
+ $2 ) func_append func_to_host_path_result "$3"
+ ;;
+ esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+ $opt_debug
+ $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result. If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+ $opt_debug
+ case ,$2, in
+ *,"$to_tool_file_cmd",*)
+ func_to_tool_file_result=$1
+ ;;
+ *)
+ $to_tool_file_cmd "$1"
+ func_to_tool_file_result=$func_to_host_file_result
+ ;;
+ esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+ func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+ # LT_CYGPATH in this case.
+ func_to_host_file_result=`cygpath -m "$1"`
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format. Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_file_wine_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_msys_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+ func_convert_core_file_wine_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format. If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+# file name conversion function : func_convert_file_X_to_Y ()
+# path conversion function : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same. If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+ $opt_debug
+ if test -z "$to_host_path_cmd"; then
+ func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+ to_host_path_cmd="func_convert_path_${func_stripname_result}"
+ fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+ $opt_debug
+ func_init_to_host_path_cmd
+ $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+ func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from ARG. MSYS
+ # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+ # and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format. Requires a wine environment and
+# a working winepath. Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+ pie_flag=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
+ arg_mode=target
+ continue
+ ;;
+
+ -pie | -fpie | -fPIE)
+ func_append pie_flag " $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
+ func_append later " $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+ func_append_quoted lastarg "$arg"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
+
+ # Add the arguments to base_compile.
+ func_append base_compile " $lastarg"
+ continue
+ ;;
+
+ *)
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ func_append_quoted base_compile "$lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ func_fatal_error "you must specify an argument for -Xcompile"
+ ;;
+ target)
+ func_fatal_error "you must specify a target with \`-o'"
+ ;;
+ *)
+ # Get the name of the library object.
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ case $libobj in
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
+ esac
+
+ case $libobj in
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+ *)
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
+ -static)
+ build_libtool_libs=no
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
+ lobj=${xdir}$objdir/$objname
+
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+ func_append removelist " $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
+ fi
+
+ $opt_dry_run || $RM $removelist
+ func_append removelist " $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+ func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+ srcfile=$func_to_tool_file_result
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ func_mkdir_p "$xdir$objdir"
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ func_append command " -o $lobj"
+ fi
+
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile$pie_flag"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ func_append command " -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ func_append command "$suppress_output"
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+ test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $opt_mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ compile)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to build PIC objects only
+ -prefer-non-pic try to build non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only build a \`.o' file suitable for static linking
+ -Wc,FLAG pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+ execute)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+ finish)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+ install)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -bindir BINDIR specify path to binaries directory (for systems where
+ libraries must be found in the PATH setting at runtime)
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+ -Wc,FLAG
+ -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
+ -Wl,FLAG
+ -Xlinker FLAG pass linker-specific FLAG directly to the linker
+ -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+ uninstall)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+ ;;
+ esac
+
+ echo
+ $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+ if test "$opt_help" = :; then
+ func_mode_help
+ else
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ func_mode_help
+ done
+ } | sed -n '1p; 2,$s/^Usage:/ or: /p'
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ echo
+ func_mode_help
+ done
+ } |
+ sed '1d
+ /^When reporting/,/^Report/{
+ H
+ d
+ }
+ $x
+ /information about other modes/d
+ /more detailed .*MODE/d
+ s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+ fi
+ exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $opt_dlopen; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ func_append dir "/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -* | *.la | *.lo ) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_append_quoted args "$file"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+ echo "export $shlibpath_var"
+ fi
+ $ECHO "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ libs=
+ libdirs=
+ admincmds=
+
+ for opt in "$nonopt" ${1+"$@"}
+ do
+ if test -d "$opt"; then
+ func_append libdirs " $opt"
+
+ elif test -f "$opt"; then
+ if func_lalib_unsafe_p "$opt"; then
+ func_append libs " $opt"
+ else
+ func_warning "\`$opt' is not a valid libtool archive"
+ fi
+
+ else
+ func_fatal_error "invalid argument \`$opt'"
+ fi
+ done
+
+ if test -n "$libs"; then
+ if test -n "$lt_sysroot"; then
+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+ sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+ else
+ sysroot_cmd=
+ fi
+
+ # Remove sysroot references
+ if $opt_dry_run; then
+ for lib in $libs; do
+ echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+ done
+ else
+ tmpdir=`func_mktempdir`
+ for lib in $libs; do
+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+ > $tmpdir/tmp-la
+ mv -f $tmpdir/tmp-la $lib
+ done
+ ${RM}r "$tmpdir"
+ fi
+ fi
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || func_append admincmds "
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $ECHO " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $ECHO " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+
+ echo "See any operating system documentation about shared libraries for"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ echo "pages."
+ ;;
+ *)
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ echo "----------------------------------------------------------------------"
+ fi
+ exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ case $nonopt in *shtool*) :;; *) false;; esac; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ func_append install_prog "$func_quote_for_eval_result"
+ install_shared_prog=$install_prog
+ case " $install_prog " in
+ *[\\\ /]cp\ *) install_cp=: ;;
+ *) install_cp=false ;;
+ esac
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ no_mode=:
+ for arg
+ do
+ arg2=
+ if test -n "$dest"; then
+ func_append files " $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ if $install_cp; then :; else
+ prev=$arg
+ fi
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ if test "x$prev" = x-m && test -n "$install_override_mode"; then
+ arg2=$install_override_mode
+ no_mode=false
+ fi
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ func_quote_for_eval "$arg"
+ func_append install_prog " $func_quote_for_eval_result"
+ if test -n "$arg2"; then
+ func_quote_for_eval "$arg2"
+ fi
+ func_append install_shared_prog " $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -n "$install_override_mode" && $no_mode; then
+ if $install_cp; then :; else
+ func_quote_for_eval "$install_override_mode"
+ func_append install_shared_prog " -m $func_quote_for_eval_result"
+ fi
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ func_append staticlibs " $file"
+ ;;
+
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append current_libdirs " $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append future_libdirs " $libdir" ;;
+ esac
+ fi
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ func_append dir "$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ fi
+ }
+ else
+ # Install the binary that we compiled earlier.
+ file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ for progfile in $progfiles; do
+ func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+ func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+ $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ # if an import library, we need to obtain dlname
+ if func_win32_import_lib_p "$dlprefile"; then
+ func_tr_sh "$dlprefile"
+ eval "curr_lafile=\$libfile_$func_tr_sh_result"
+ dlprefile_dlbasename=""
+ if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+ # Use subshell, to avoid clobbering current variable values
+ dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+ if test -n "$dlprefile_dlname" ; then
+ func_basename "$dlprefile_dlname"
+ dlprefile_dlbasename="$func_basename_result"
+ else
+ # no lafile. user explicitly requested -dlpreopen <import library>.
+ $sharedlib_from_linklib_cmd "$dlprefile"
+ dlprefile_dlbasename=$sharedlib_from_linklib_result
+ fi
+ fi
+ $opt_dry_run || {
+ if test -n "$dlprefile_dlbasename" ; then
+ eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+ else
+ func_warning "Could not compute DLL name from $name"
+ eval '$ECHO ": $name " >> "$nlist"'
+ fi
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+ $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+ }
+ else # not an import lib
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ fi
+ ;;
+ *)
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ ;;
+ esac
+ done
+
+ $opt_dry_run || {
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $MV "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if $GREP -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ $GREP -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ echo >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) func_append symtab_cflags " $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+ fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+ $opt_debug
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+ $opt_debug
+ sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+ $opt_debug
+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+ $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+ $SED '/^Contents of section '"$match_literal"':/{
+ # Place marker at beginning of archive member dllname section
+ s/.*/====MARK====/
+ p
+ d
+ }
+ # These lines can sometimes be longer than 43 characters, but
+ # are always uninteresting
+ /:[ ]*file format pe[i]\{,1\}-/d
+ /^In archive [^:]*:/d
+ # Ensure marker is printed
+ /^====MARK====/p
+ # Remove all lines with less than 43 characters
+ /^.\{43\}/!d
+ # From remaining lines, remove first 43 characters
+ s/^.\{43\}//' |
+ $SED -n '
+ # Join marker and all lines until next marker into a single line
+ /^====MARK====/ b para
+ H
+ $ b para
+ b
+ :para
+ x
+ s/\n//g
+ # Remove the marker
+ s/^====MARK====//
+ # Remove trailing dots and whitespace
+ s/[\. \t]*$//
+ # Print
+ /./p' |
+ # we now have a list, one entry per line, of the stringified
+ # contents of the appropriate section of all members of the
+ # archive which possess that section. Heuristic: eliminate
+ # all those which have a first or second character that is
+ # a '.' (that is, objdump's representation of an unprintable
+ # character.) This should work for all archives with less than
+ # 0x302f exports -- but will fail for DLLs whose name actually
+ # begins with a literal '.' or a single character followed by
+ # a '.'.
+ #
+ # Of those that remain, print the first one.
+ $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+ test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+ test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+ $opt_debug
+ if func_cygming_gnu_implib_p "$1" ; then
+ # binutils import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+ elif func_cygming_ms_implib_p "$1" ; then
+ # ms-generated import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+ else
+ # unknown
+ sharedlib_from_linklib_result=""
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ if test "$lock_old_archive_extraction" = yes; then
+ lockfile=$f_ex_an_ar_oldlib.lock
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ fi
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+ 'stat=$?; rm -f "$lockfile"; exit $stat'
+ if test "$lock_old_archive_extraction" = yes; then
+ $opt_dry_run || rm -f "$lockfile"
+ fi
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`basename "$darwin_archive"`
+ darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ $LIPO -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ $RM -rf unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd $darwin_orig_dir
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ done
+
+ func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=${1-no}
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='$macro_version'
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$ECHO are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ file=\"\$0\""
+
+ qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+ $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+ ECHO=\"$qECHO\"
+ fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+ lt_script_arg0=\$0
+ shift
+ for lt_opt
+ do
+ case \"\$lt_opt\" in
+ --lt-debug) lt_option_debug=1 ;;
+ --lt-dump-script)
+ lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+ test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+ lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+ cat \"\$lt_dump_D/\$lt_dump_F\"
+ exit 0
+ ;;
+ --lt-*)
+ \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ # Print the debug banner immediately:
+ if test -n \"\$lt_option_debug\"; then
+ echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+ fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+ lt_dump_args_N=1;
+ for lt_arg
+ do
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+ lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+ done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2* | *-cegcc*)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+ case \" \$* \" in
+ *\\ --lt-*)
+ for lt_wr_arg
+ do
+ case \$lt_wr_arg in
+ --lt-*) ;;
+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+ esac
+ shift
+ done ;;
+ esac
+ func_exec_program_core \${1+\"\$@\"}
+}
+
+ # Parse options
+ func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+ done
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" ||
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $MKDIR \"\$progdir\"
+ else
+ $RM \"\$progdir/\$file\"
+ fi"
+
+ $ECHO "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $RM \"\$progdir/\$program\";
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $RM \"\$progdir/\$file\"
+ fi"
+ else
+ $ECHO "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # fixup the dll searchpath if we need to.
+ #
+ # Fix the DLL searchpath if we need to. Do this before prepending
+ # to shlibpath, because on Windows, both are PATH and uninstalled
+ # libraries must come first.
+ if test -n "$dllsearchpath"; then
+ $ECHO "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $ECHO "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ $ECHO "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+ func_exec_program \${1+\"\$@\"}
+ fi
+ else
+ # The program doesn't exist.
+ \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+ \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+*/
+EOF
+ cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+ cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_path "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_path "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ newargz = XMALLOC (char *, argc + 1);
+
+ /* very simple arg parsing; don't want to rely on getopt
+ * also, copy all non cwrapper options to newargz, except
+ * argz[0], which is handled differently
+ */
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ lt_dump_script (stdout);
+ return 0;
+ }
+ if (strcmp (argv[i], debug_opt) == 0)
+ {
+ lt_debug = 1;
+ continue;
+ }
+ if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal (__FILE__, __LINE__,
+ "unrecognized %s option: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+EOF
+ cat <<EOF
+ /* The GNU banner must be the first non-error debug message */
+ lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+ cat <<"EOF"
+ lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (before symlink chase) at: %s\n",
+ tmp_pathspec);
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (after symlink chase) at: %s\n",
+ actual_cwrapper_path);
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) libtool target name: %s\n",
+ target_name);
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
+ be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+ because on Windows, both *_VARNAMEs are PATH but uninstalled
+ libraries must come first. */
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+ lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+ nonnull (lt_argv_zero));
+ for (i = 0; i < newargc; i++)
+ {
+ lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+ i, nonnull (newargz[i]));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ newargz = prepare_spawn (newargz);
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) failed to launch target \"%s\": %s\n",
+ lt_argv_zero, nonnull (strerror (errno)));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+ void *p = (void *) malloc (num);
+ if (!p)
+ lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+ string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+ nonempty (wrapper));
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char *path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char *q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR (*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name =
+ XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name =
+ XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ lt_debugprintf (__FILE__, __LINE__,
+ "checking path component for symlinks: %s\n",
+ tmp_pathspec);
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "error accessing file \"%s\": %s",
+ tmp_pathspec, nonnull (strerror (errno)));
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert (str != NULL);
+ assert (pat != NULL);
+
+ len = strlen (str);
+ patlen = strlen (pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp (str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ if (lt_debug)
+ {
+ (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+ int line, const char *mode,
+ const char *message, va_list ap)
+{
+ fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+ va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+ return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+ return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_setenv) setting '%s' to '%s'\n",
+ nonnull (name), nonnull (value));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+EOF
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+ Note that spawn() does not by itself call the command interpreter
+ (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+ ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&v);
+ v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+ }) ? "cmd.exe" : "command.com").
+ Instead it simply concatenates the arguments, separated by ' ', and calls
+ CreateProcess(). We must quote the arguments since Win32 CreateProcess()
+ interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+ special way:
+ - Space and tab are interpreted as delimiters. They are not treated as
+ delimiters if they are surrounded by double quotes: "...".
+ - Unescaped double quotes are removed from the input. Their only effect is
+ that within double quotes, space and tab are treated like normal
+ characters.
+ - Backslashes not followed by double quotes are not special.
+ - But 2*n+1 backslashes followed by a double quote become
+ n backslashes followed by a double quote (n >= 0):
+ \" -> "
+ \\\" -> \"
+ \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+ size_t argc;
+ char **new_argv;
+ size_t i;
+
+ /* Count number of arguments. */
+ for (argc = 0; argv[argc] != NULL; argc++)
+ ;
+
+ /* Allocate new argument vector. */
+ new_argv = XMALLOC (char *, argc + 1);
+
+ /* Put quoted arguments into the new argument vector. */
+ for (i = 0; i < argc; i++)
+ {
+ const char *string = argv[i];
+
+ if (string[0] == '\0')
+ new_argv[i] = xstrdup ("\"\"");
+ else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+ {
+ int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+ size_t length;
+ unsigned int backslashes;
+ const char *s;
+ char *quoted_string;
+ char *p;
+
+ length = 0;
+ backslashes = 0;
+ if (quote_around)
+ length++;
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ length += backslashes + 1;
+ length++;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ length += backslashes + 1;
+
+ quoted_string = XMALLOC (char, length + 1);
+
+ p = quoted_string;
+ backslashes = 0;
+ if (quote_around)
+ *p++ = '"';
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ {
+ unsigned int j;
+ for (j = backslashes + 1; j > 0; j--)
+ *p++ = '\\';
+ }
+ *p++ = c;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ {
+ unsigned int j;
+ for (j = backslashes; j > 0; j--)
+ *p++ = '\\';
+ *p++ = '"';
+ }
+ *p = '\0';
+
+ new_argv[i] = quoted_string;
+ }
+ else
+ new_argv[i] = (char *) string;
+ }
+ new_argv[argc] = NULL;
+
+ return new_argv;
+}
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+ func_emit_wrapper yes |
+ $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/ fputs ("\1", f);/p
+g
+D'
+ cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+ $opt_debug
+ case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+ *import*) : ;;
+ *) false ;;
+ esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args=$nonopt
+ base_compile="$nonopt $@"
+ compile_command=$nonopt
+ finalize_command=$nonopt
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+ new_inherited_linker_flags=
+
+ avoid_version=no
+ bindir=
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+ weak_libs=
+ single_module="${wl}-single_module"
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ func_warning "complete static linking is impossible in this configuration"
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ bindir)
+ bindir="$arg"
+ prev=
+ continue
+ ;;
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ func_append dlfiles " $arg"
+ else
+ func_append dlprefiles " $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) func_append deplibs " $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat "$save_arg"`
+ do
+# func_append moreargs " $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ done
+ else
+ func_fatal_error "link input file \`$arg' does not exist"
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) func_append rpath " $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) func_append xrpath " $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ weak)
+ func_append weak_libs " $arg"
+ prev=
+ continue
+ ;;
+ xcclinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xcompiler)
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xlinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $wl$qarg"
+ prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append finalize_command " $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -bindir)
+ prev=bindir
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework)
+ prev=framework
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ func_stripname "-L" '' "$arg"
+ if test -z "$func_stripname_result"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "* | *" $arg "*)
+ # Will only happen for absolute or sysroot arguments
+ ;;
+ *)
+ # Preserve sysroot, but never include relative directories
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+ *) func_append deplibs " -L$dir" ;;
+ esac
+ func_append lib_search_path " $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
+ *) func_append dllsearchpath ":$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ func_append deplibs " System.ltframework"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ func_append deplibs " $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot|--sysroot)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) func_append new_inherited_linker_flags " $arg" ;;
+ esac
+ continue
+ ;;
+
+ -multi_module)
+ single_module="${wl}-multi_module"
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # and Darwin in order for the loader to find any dlls it needs.
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ continue
+ ;;
+
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -static | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -weak)
+ prev=weak
+ continue
+ ;;
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $func_quote_for_eval_result"
+ func_append compiler_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $wl$func_quote_for_eval_result"
+ func_append compiler_flags " $wl$func_quote_for_eval_result"
+ func_append linker_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # Flags to be passed through unchanged, with rationale:
+ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
+ # -r[0-9][0-9]* specify processor for the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+ # +DA*, +DD* enable 64-bit mode for the HP compiler
+ # -q* compiler args for the IBM compiler
+ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+ # -F/path path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
+ # @file GCC response files
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ func_append compiler_flags " $arg"
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ *.$objext)
+ # A standard object.
+ func_append objs " $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ func_append deplibs " $arg"
+ func_append old_deplibs " $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ func_resolve_sysroot "$arg"
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ func_append dlfiles " $func_resolve_sysroot_result"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ func_append dlprefiles " $func_resolve_sysroot_result"
+ prev=
+ else
+ func_append deplibs " $func_resolve_sysroot_result"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+ done # argument parsing loop
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ func_basename "$output"
+ outputname="$func_basename_result"
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
+ func_to_tool_file "$output_objdir/"
+ tool_output_objdir=$func_to_tool_file_result
+ # Create the object directory.
+ func_mkdir_p "$output_objdir"
+
+ # Determine the type of output
+ case $output in
+ "")
+ func_fatal_help "you must specify an output file"
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if $opt_preserve_dup_deps ; then
+ case "$libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append libs " $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if $opt_duplicate_compiler_generated_deps; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ esac
+ func_append pre_post_deps " $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+
+ case $linkmode in
+ lib)
+ passes="conv dlpreopen link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+
+ for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
+ esac
+ fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ func_resolve_sysroot "$lib"
+ case $lib in
+ *.la) func_source "$func_resolve_sysroot_result" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ func_basename "$deplib"
+ deplib_base=$func_basename_result
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) func_append deplibs " $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append compiler_flags " $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ func_warning "\`-l' is ignored for archives/objects"
+ continue
+ fi
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
+ if test "$linkmode" = lib; then
+ searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+ else
+ searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+ fi
+ for searchdir in $searchdirs; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if func_lalib_p "$lib"; then
+ library_names=
+ old_library=
+ func_source "$lib"
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ *)
+ func_warning "\`-L' is ignored for archives/objects"
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ func_stripname '-R' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ lib=$func_resolve_sysroot_result
+ ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ echo
+ $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not use here."
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ func_append newdlprefiles " $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append newdlfiles " $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+ fi
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ inherited_linker_flags=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && func_append dlfiles " $dlopen"
+ test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ func_append convenience " $ladir/$objdir/$old_library"
+ func_append old_convenience " $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ func_fatal_error "\`$lib' is not a convenience library"
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ if test -n "$old_library" &&
+ { test "$prefer_static_libs" = yes ||
+ test "$prefer_static_libs,$installed" = "built,no"; }; then
+ linklib=$old_library
+ else
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ fi
+ if test -z "$linklib"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ func_append dlprefiles " $lib $dependency_libs"
+ else
+ func_append newdlfiles " $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ func_basename "$lib"
+ laname="$func_basename_result"
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ func_warning "library \`$lib' was moved."
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$lt_sysroot$libdir"
+ absdir="$lt_sysroot$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ fi
+ fi # $installed = yes
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+ fi
+ case "$host" in
+ # special handling for platforms with PE-DLLs.
+ *cygwin* | *mingw* | *cegcc* )
+ # Linker will automatically link against shared library if both
+ # static and shared are present. Therefore, ensure we extract
+ # symbols from the import library if a shared library is present
+ # (otherwise, the dlopen module name will be incorrect). We do
+ # this by putting the import library name into $newdlprefiles.
+ # We recover the dlopen module name by 'saving' the la file
+ # name in a special purpose variable, and (later) extracting the
+ # dlname from the la file.
+ if test -n "$dlname"; then
+ func_tr_sh "$dir/$linklib"
+ eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+ func_append newdlprefiles " $dir/$linklib"
+ else
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ fi
+ ;;
+ * )
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ func_append newdlprefiles " $dir/$dlname"
+ else
+ func_append newdlprefiles " $dir/$linklib"
+ fi
+ ;;
+ esac
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ func_append newlib_search_path " $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) func_append temp_rpath "$absdir:" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ func_append notinst_deplibs " $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ func_append notinst_deplibs " $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ echo
+ if test "$linkmode" = prog; then
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $ECHO "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.a
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
+ if /usr/bin/file -L $add 2> /dev/null |
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; then
+ $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ echo
+ echo "*** And there doesn't seem to be a static archive available"
+ echo "*** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$absdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ func_fatal_configuration "unsupported hardcode properties"
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ $ECHO "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) func_append xrpath " $temp_xrpath";;
+ esac;;
+ *) func_append temp_deplibs " $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ func_append newlib_search_path " $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result";;
+ *) func_resolve_sysroot "$deplib" ;;
+ esac
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $func_resolve_sysroot_result "*)
+ func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ esac
+ fi
+ func_append tmp_libs " $func_resolve_sysroot_result"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ path=
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
+ func_dirname "$deplib" "" "."
+ dir=$func_dirname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ func_warning "cannot determine absolute directory name of \`$dir'"
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if $GREP "^installed=no" $deplib > /dev/null; then
+ case $host in
+ *-*-darwin*)
+ depdepl=
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
+ fi
+ fi
+ ;;
+ *)
+ path="-L$absdir/$objdir"
+ ;;
+ esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
+ ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test "$pass" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) func_append lib_search_path " $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ func_append tmp_libs " $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
+
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ func_append objs "$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+ $ECHO "*** objects $objs is not portable!"
+ func_append libobjs " $objs"
+ fi
+ fi
+
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+ set dummy $rpath
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ shift
+ IFS="$save_ifs"
+
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ # correct linux to gnu/linux during the next big refactor
+ darwin|linux|osf|windows|none)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|qnx|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_minor"
+ lt_irix_increment=no
+ ;;
+ *)
+ func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+ ;;
+ esac
+ ;;
+ no)
+ current="$1"
+ revision="$2"
+ age="$3"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ func_arith $current + 1
+ minor_current=$func_arith_result
+ xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ irix | nonstopux)
+ if test "X$lt_irix_increment" = "Xno"; then
+ func_arith $current - $age
+ else
+ func_arith $current - $age + 1
+ fi
+ major=$func_arith_result
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux) # correct to gnu/linux during the next big refactor
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ func_append verstring ":${current}.0"
+ ;;
+
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+
+ *)
+ func_fatal_configuration "unknown library version type \`$version_type'"
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ func_warning "undefined symbols not allowed in $host shared libraries"
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ fi
+
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ func_append libobjs " $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
+ if test "$opt_mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$ECHO "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext | *.gcno)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ func_append removelist " $p"
+ ;;
+ *) ;;
+ esac
+ done
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ func_append oldlibs " $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ #for path in $notinst_path; do
+ # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+ # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ #done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ func_replace_sysroot "$libdir"
+ func_append temp_xrpath " -R$func_replace_sysroot_result"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) func_append dlfiles " $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) func_append dlprefiles " $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ func_append deplibs " System.ltframework"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ func_append deplibs " -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $opt_dry_run || $RM conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ if test -n "$file_magic_glob"; then
+ libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+ else
+ libnameglob=$libname
+ fi
+ test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ if test "$want_nocaseglob" = yes; then
+ shopt -s nocaseglob
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ $nocaseglob
+ else
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ fi
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ done
+ fi
+ case $tmp_deplibs in
+ *[!\ \ ]*)
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ ;;
+ esac
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Remove ${wl} instances when linking with ld.
+ # FIXME: should test the right _cmds variable.
+ case $archive_cmds in
+ *\$LD\ *) wl= ;;
+ esac
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ func_append linknames " $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ func_append delfiles " $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd1 in $cmds; do
+ IFS="$save_ifs"
+ # Take the normal branch if the nm_file_list_spec branch
+ # doesn't work or if tool conversion is not needed.
+ case $nm_file_list_spec~$to_tool_file_cmd in
+ *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+ try_normal_branch=yes
+ eval cmd=\"$cmd1\"
+ func_len " $cmd"
+ len=$func_len_result
+ ;;
+ *)
+ try_normal_branch=no
+ ;;
+ esac
+ if test "$try_normal_branch" = yes \
+ && { test "$len" -lt "$max_cmd_len" \
+ || test "$max_cmd_len" -le -1; }
+ then
+ func_show_eval "$cmd" 'exit $?'
+ skipped_export=false
+ elif test -n "$nm_file_list_spec"; then
+ func_basename "$output"
+ output_la=$func_basename_result
+ save_libobjs=$libobjs
+ save_output=$output
+ output=${output_objdir}/${output_la}.nm
+ func_to_tool_file "$output"
+ libobjs=$nm_file_list_spec$func_to_tool_file_result
+ func_append delfiles " $output"
+ func_verbose "creating $NM input file list: $output"
+ for obj in $save_libobjs; do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > "$output"
+ eval cmd=\"$cmd1\"
+ func_show_eval "$cmd" 'exit $?'
+ output=$save_output
+ libobjs=$save_libobjs
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ func_append tmp_deplibs " $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ else
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ func_append linker_flags " $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ func_basename "$output"
+ output_la=$func_basename_result
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ last_robj=
+ k=1
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ echo 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ echo ')' >> $output
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$func_to_tool_file_result
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append objlist " $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ reload_objs=$objlist
+ eval concat_cmds=\"$reload_cmds\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=" $obj"
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ func_append delfiles " $output"
+
+ else
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+ fi
+ fi
+
+ test -n "$save_libobjs" &&
+ func_verbose "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+ fi
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
+ fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
+
+ case $output in
+ *.lo)
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $opt_dry_run || $RM $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # If we're not building shared, we need to use non_pic_objs
+ test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+ fi
+
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
+ esac
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
+
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ case $host in
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ func_append compile_command " ${wl}-bind_at_load"
+ func_append finalize_command " ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ func_append compile_command " $compile_deplibs"
+ func_append finalize_command " $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
+ *) func_append dllsearchpath ":$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ fi
+
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
+ fi
+
+ wrappers_required=yes
+ case $host in
+ *cegcc* | *mingw32ce*)
+ # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
+ # Replace the output file specification.
+ compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Delete the generated files.
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $opt_dry_run || $RM $output
+ # Link the executable and exit
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output_objdir/$outputname"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Now create the wrapper script.
+ func_verbose "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
+
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
+ ;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_wrapper no > $output
+ chmod +x $output
+ ;;
+ esac
+ }
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save $symfileobj"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ func_append oldobjs " $symfileobj"
+ fi
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $addlibs
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ echo "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+ func_mkdir_p "$gentop"
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ func_basename "$obj"
+ objbase="$func_basename_result"
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ func_arith $counter + 1
+ counter=$func_arith_result
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ func_append oldobjs " $gentop/$newobj"
+ ;;
+ *) func_append oldobjs " $obj" ;;
+ esac
+ done
+ fi
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+ eval cmds=\"$old_archive_cmds\"
+
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ elif test -n "$archiver_list_spec"; then
+ func_verbose "using command file archive linking..."
+ for obj in $oldobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > $output_objdir/$libname.libcmd
+ func_to_tool_file "$output_objdir/$libname.libcmd"
+ oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ func_verbose "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ oldobjs=
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+ for obj in $save_oldobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ len=$len0
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ func_execute_cmds "$cmds" 'exit $?'
+ done
+
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ func_verbose "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+ # Only create the output if not a dry run.
+ $opt_dry_run || {
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ func_basename "$deplib"
+ name="$func_basename_result"
+ func_resolve_sysroot "$deplib"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ -L*)
+ func_stripname -L '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -L$func_replace_sysroot_result"
+ ;;
+ -R*)
+ func_stripname -R '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -R$func_replace_sysroot_result"
+ ;;
+ *) func_append newdependency_libs " $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+
+ for lib in $dlfiles; do
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ *) func_append newdlfiles " $lib" ;;
+ esac
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ esac
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlfiles " $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlprefiles " $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $RM $output
+ # place dlname in correct position for cygwin
+ # In fact, it would be nice if we could use this code for all target
+ # systems that can't hard-code library paths into their executables
+ # and that have no shared library path variable independent of PATH,
+ # but it turns out we can't easily determine that from inspecting
+ # libtool variables, so we have to hard-code the OSs to which it
+ # applies here; at the moment, that means platforms that use the PE
+ # object format with DLL files. See the long comment at the top of
+ # tests/bindir.at for full details.
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+ # If a -bindir argument was supplied, place the dll there.
+ if test "x$bindir" != x ;
+ then
+ func_relative_path "$install_libdir" "$bindir"
+ tdlname=$func_relative_path_result$dlname
+ else
+ # Otherwise fall back on heuristic.
+ tdlname=../bin/$dlname
+ fi
+ ;;
+ esac
+ $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $ECHO >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ }
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+ func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) func_append RM " $arg"; rmforce=yes ;;
+ -*) func_append RM " $arg" ;;
+ *) func_append files " $arg" ;;
+ esac
+ done
+
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
+
+ rmdirs=
+
+ for file in $files; do
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
+ odir="$objdir"
+ else
+ odir="$dir/$objdir"
+ fi
+ func_basename "$file"
+ name="$func_basename_result"
+ test "$opt_mode" = uninstall && odir="$dir"
+
+ # Remember odir for removal later, being careful to avoid duplicates
+ if test "$opt_mode" = clean; then
+ case " $rmdirs " in
+ *" $odir "*) ;;
+ *) func_append rmdirs " $odir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if { test -L "$file"; } >/dev/null 2>&1 ||
+ { test -h "$file"; } >/dev/null 2>&1 ||
+ test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ func_append rmfiles " $odir/$n"
+ done
+ test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+ case "$opt_mode" in
+ clean)
+ case " $library_names " in
+ *" $dlname "*) ;;
+ *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ esac
+ test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if func_lalib_p "$file"; then
+
+ # Read the .lo file
+ func_source $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" &&
+ test "$pic_object" != none; then
+ func_append rmfiles " $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
+ func_append rmfiles " $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$opt_mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ func_append rmfiles " $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ func_append rmfiles " $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ func_append rmfiles " $odir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ func_append rmfiles " $odir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ func_show_eval "$RM $rmfiles" 'exit_status=1'
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ func_show_eval "rmdir $dir >/dev/null 2>&1"
+ fi
+ done
+
+ exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+ eval exec "$exec_cmd"
+ exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/m4/libtool.m4 b/m4/libtool.m4
new file mode 100644
index 0000000..d288c50
--- /dev/null
+++ b/m4/libtool.m4
@@ -0,0 +1,7999 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file 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.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable. If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins. After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script. The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars. Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_REPLACE_SHELLFNS
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Go], [_LT_LANG(GO)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_GO. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC], [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+ fi
+fi
+if test -z "$GOC"; then
+ AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+ [LT_LANG(GO)],
+ [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+
+ AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+ [lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+ echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+ $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+ echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+ $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+ [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+ lt_aix_libpath_sed='[
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }]'
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi],[])
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+ fi
+ ])
+ aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+case "$ECHO" in
+ printf*) AC_MSG_RESULT([printf]) ;;
+ print*) AC_MSG_RESULT([print -r]) ;;
+ *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test "X`printf %s $ECHO`" = "X$ECHO" \
+ || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[ --with-sysroot[=DIR] Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted. We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ AC_MSG_RESULT([${with_sysroot}])
+ AC_MSG_ERROR([The sysroot must be an absolute path.])
+ ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+ [lt_cv_ar_at_file=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+ ])
+ ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+ [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+ [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len" && \
+ test undefined != "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[23]].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+ [lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [lt_cv_shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+ ])
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsdelf*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='NetBSD ld.elf_so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[List of archive names. First name is the real one, the rest are links.
+ The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+ [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="m4_if([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+ [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+ [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+ [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+ [lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+ esac
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT@&t@_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+ [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd* | netbsdelf*-gnu)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+ if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ tcc*)
+ # Fabrice Bellard et al's Tiny C Compiler
+ # When it learns to make shared objects, it will
+ # presumably use -fPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Intel*\ [[CF]]*Compiler*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ *Portland\ Group*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ case $host_os in
+ aix[[4-9]]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ case $cc_basename in
+ cl*)
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
+ esac
+
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+ *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ m4_if($1, [], [
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ _LT_LINKER_OPTION([if $CC understands -b],
+ _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+ [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+ [lt_cv_irix_exported_symbol],
+ [save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+ [C++], [[int foo (void) { return 0; }]],
+ [Fortran 77], [[
+ subroutine foo
+ end]],
+ [Fortran], [[
+ subroutine foo
+ end]])])],
+ [lt_cv_irix_exported_symbol=yes],
+ [lt_cv_irix_exported_symbol=no])
+ LDFLAGS="$save_LDFLAGS"])
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+ [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+ [$RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ ])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+ [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will actually be built
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+else
+ _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_CFLAGS=$CFLAGS
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ CFLAGS=$CXXFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $GXX,$cc_basename in
+ ,cl* | no,cl*)
+ # Native MSVC
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ func_to_tool_file "$lt_outputfile"~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # g++
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+ '"$_LT_TAGVAR(old_archive_cmds, $1)"
+ _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+ '"$_LT_TAGVAR(reload_cmds, $1)"
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case ${prev}${p} in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ fi
+
+ # Expand the sysroot to ease extracting the directories later.
+ if test -z "$prev"; then
+ case $p in
+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+ esac
+ fi
+ case $p in
+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+ esac
+ if test "$pre_test_object_deps_done" = no; then
+ case ${prev} in
+ -L | -R)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ prev=
+ ;;
+
+ *.lto.$objext) ;; # Ignore GCC LTO objects
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${F77-"f77"}
+ CFLAGS=$FFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+ CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${FC-"f95"}
+ CFLAGS=$FCFLAGS
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+ func_split_long_opt_name=${1%%=*}
+ func_split_long_opt_arg=${1#*=}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+ func_split_short_opt_arg=${1#??}
+ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
+
+ _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
+
+ _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+ func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+ eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+ [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+ [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
new file mode 100644
index 0000000..5d9acd8
--- /dev/null
+++ b/m4/ltoptions.m4
@@ -0,0 +1,384 @@
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file 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.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/m4/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file 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.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
new file mode 100644
index 0000000..07a8602
--- /dev/null
+++ b/m4/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# This file 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.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
new file mode 100644
index 0000000..c573da9
--- /dev/null
+++ b/m4/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# This file 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.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/m4/size_max.m4 b/m4/size_max.m4
new file mode 100644
index 0000000..e44618e
--- /dev/null
+++ b/m4/size_max.m4
@@ -0,0 +1,72 @@
+# size_max.m4 serial 6
+dnl Copyright (C) 2003, 2005-2006, 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Change by Vincent Lefevre: added <inttypes.h> for consistency with MPFR
+
+AC_DEFUN([gl_SIZE_MAX],
+[
+ AC_CHECK_HEADERS(stdint.h)
+ dnl First test whether the system already has SIZE_MAX.
+ AC_MSG_CHECKING([for SIZE_MAX])
+ AC_CACHE_VAL([gl_cv_size_max], [
+ gl_cv_size_max=
+ AC_EGREP_CPP([Found it], [
+#include <limits.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef SIZE_MAX
+Found it
+#endif
+], gl_cv_size_max=yes)
+ if test -z "$gl_cv_size_max"; then
+ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
+ dnl than the type 'unsigned long'. Try hard to find a definition that can
+ dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
+ AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
+ [#include <stddef.h>
+#include <limits.h>], size_t_bits_minus_1=)
+ AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
+ [#include <stddef.h>], fits_in_uint=)
+ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
+ if test $fits_in_uint = 1; then
+ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
+ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
+ AC_TRY_COMPILE([#include <stddef.h>
+ extern size_t foo;
+ extern unsigned long foo;
+ ], [], fits_in_uint=0)
+ fi
+ dnl We cannot use 'expr' to simplify this expression, because 'expr'
+ dnl works only with 'long' integers in the host environment, while we
+ dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
+ if test $fits_in_uint = 1; then
+ gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
+ else
+ gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
+ fi
+ else
+ dnl Shouldn't happen, but who knows...
+ gl_cv_size_max='((size_t)~(size_t)0)'
+ fi
+ fi
+ ])
+ AC_MSG_RESULT([$gl_cv_size_max])
+ if test "$gl_cv_size_max" != yes; then
+ AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
+ [Define as the maximum value of type 'size_t', if the system doesn't define it.])
+ fi
+])
+
+dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
+dnl Remove this when we can assume autoconf >= 2.61.
+m4_ifdef([AC_COMPUTE_INT], [], [
+ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
+])
diff --git a/missing b/missing
new file mode 100755
index 0000000..86a8fc3
--- /dev/null
+++ b/missing
@@ -0,0 +1,331 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2012-01-06.13; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program 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 2, or (at your option)
+# any later version.
+
+# This program 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..7644cda
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,93 @@
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+
+EXTRA_DIST = round_raw_generic.c jyn_asympt.c x86/core2/mparam.h \
+ x86/mparam.h x86_64/core2/mparam.h x86_64/pentium4/mparam.h \
+ ia64/mparam.h arm/mparam.h powerpc64/mparam.h sparc64/mparam.h \
+ generic/mparam.h amd/athlon/mparam.h amd/k8/mparam.h \
+ amd/amdfam10/mparam.h powerpc32/mparam.h hppa/mparam.h
+
+include_HEADERS = mpfr.h mpf2mpfr.h
+
+BUILT_SOURCES = mparam.h
+
+
+lib_LTLIBRARIES = libmpfr.la
+
+libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-gmp.h mpfr-impl.h mpfr-intmax.h \
+mpfr-longlong.h mpfr-thread.h exceptions.c extract.c uceil_exp2.c \
+uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c \
+cmp_abs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c \
+div_2ui.c div.c div_ui.c dump.c eq.c exp10.c exp2.c exp3.c exp.c \
+frac.c frexp.c get_d.c get_exp.c get_str.c init.c inp_str.c isinteger.c \
+isinf.c isnan.c isnum.c const_log2.c log.c modf.c mul_2exp.c mul_2si.c \
+mul_2ui.c mul.c mul_ui.c neg.c next.c out_str.c printf.c vasprintf.c \
+const_pi.c pow.c pow_si.c pow_ui.c print_raw.c print_rnd_mode.c \
+reldiff.c round_prec.c set.c setmax.c setmin.c set_d.c set_dfl_prec.c \
+set_exp.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c \
+set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c \
+sub_ui.c rint.c ui_div.c ui_sub.c urandom.c urandomb.c get_z_exp.c \
+swap.c factorial.c cosh.c sinh.c tanh.c sinh_cosh.c acosh.c asinh.c \
+atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c \
+fma.c fms.c hypot.c log1p.c expm1.c log2.c log10.c ui_pow.c \
+ui_pow_ui.c minmax.c dim.c signbit.c copysign.c setsign.c gmp_op.c \
+init2.c acos.c sin_cos.c set_nan.c set_inf.c set_zero.c powerof2.c \
+gamma.c set_ld.c get_ld.c cbrt.c volatile.c fits_s.h fits_sshort.c \
+fits_sint.c fits_slong.c fits_u.h fits_ushort.c fits_uint.c \
+fits_ulong.c fits_uintmax.c fits_intmax.c get_si.c get_ui.c zeta.c \
+cmp_d.c erf.c inits.c inits2.c clears.c sgn.c check.c sub1sp.c \
+version.c mpn_exp.c mpfr-gmp.c mp_clz_tab.c sum.c add1sp.c \
+free_cache.c si_op.c cmp_ld.c set_ui_2exp.c set_si_2exp.c set_uj.c \
+set_sj.c get_sj.c get_uj.c get_z.c iszero.c cache.c sqr.c \
+int_ceil_log2.c isqrt.c strtofr.c pow_z.c logging.c mulders.c get_f.c \
+round_p.c erfc.c atan2.c subnormal.c const_catalan.c root.c \
+gen_inverse.h sec.c csc.c cot.c eint.c sech.c csch.c coth.c \
+round_near_x.c constant.c abort_prec_max.c stack_interface.c lngamma.c \
+zeta_ui.c set_d64.c get_d64.c jn.c yn.c rem1.c get_patches.c add_d.c \
+sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c \
+buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c \
+scale2.c set_z_exp.c ai.c gammaonethird.c ieee_floats.h \
+grandom.c
+
+libmpfr_la_LIBADD = @LIBOBJS@
+
+# Libtool -version-info CURRENT[:REVISION[:AGE]] for libmpfr.la
+#
+# 1. No interfaces changed, only implementations (good):
+# ==> Increment REVISION.
+# 2. Interfaces added, none removed (good):
+# ==> Increment CURRENT, increment AGE, set REVISION to 0.
+# 3. Interfaces removed or changed (BAD, breaks upward compatibility):
+# ==> Increment CURRENT, set AGE and REVISION to 0.
+#
+# MPFR -version-info
+# 2.1.x -
+# 2.2.x 1:x:0
+# 2.3.x 2:x:1
+# 2.4.x 3:x:2
+# 3.0.x 4:x:0
+# 3.1.x 5:x:1
+libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 5:2:1
+
+# Important note: If for some reason, srcdir is read-only at build time
+# (and you use objdir != srcdir), then you need to rebuild get_patches.c
+# (with "make get_patches.c") just after patching the MPFR source. This
+# should not be a problem in practice, in particular because "make dist"
+# automatically rebuilds get_patches.c before generating the archives.
+$(srcdir)/get_patches.c: $(top_srcdir)/PATCHES $(top_srcdir)/tools/get_patches.sh
+ (cd $(top_srcdir) && ./tools/get_patches.sh) > $@ || rm -f $@
+
+# Do not add get_patches.c to CLEANFILES so that this file doesn't
+# need to be (re)built as long as no patches are applied. Anyway the
+# update of this file should be regarded as part of the patch process,
+# and "make clean" shouldn't remove it, just like it doesn't remove
+# what has been changed by "patch".
+#CLEANFILES = get_patches.c
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..f07dd8c
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,935 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
+
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+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@
+subdir = src
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/mparam_h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES = mparam.h
+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__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libmpfr_la_DEPENDENCIES = @LIBOBJS@
+am_libmpfr_la_OBJECTS = exceptions.lo extract.lo uceil_exp2.lo \
+ uceil_log2.lo ufloor_log2.lo add.lo add1.lo add_ui.lo agm.lo \
+ clear.lo cmp.lo cmp_abs.lo cmp_si.lo cmp_ui.lo comparisons.lo \
+ div_2exp.lo div_2si.lo div_2ui.lo div.lo div_ui.lo dump.lo \
+ eq.lo exp10.lo exp2.lo exp3.lo exp.lo frac.lo frexp.lo \
+ get_d.lo get_exp.lo get_str.lo init.lo inp_str.lo isinteger.lo \
+ isinf.lo isnan.lo isnum.lo const_log2.lo log.lo modf.lo \
+ mul_2exp.lo mul_2si.lo mul_2ui.lo mul.lo mul_ui.lo neg.lo \
+ next.lo out_str.lo printf.lo vasprintf.lo const_pi.lo pow.lo \
+ pow_si.lo pow_ui.lo print_raw.lo print_rnd_mode.lo reldiff.lo \
+ round_prec.lo set.lo setmax.lo setmin.lo set_d.lo \
+ set_dfl_prec.lo set_exp.lo set_rnd.lo set_f.lo set_prc_raw.lo \
+ set_prec.lo set_q.lo set_si.lo set_str.lo set_str_raw.lo \
+ set_ui.lo set_z.lo sqrt.lo sqrt_ui.lo sub.lo sub1.lo sub_ui.lo \
+ rint.lo ui_div.lo ui_sub.lo urandom.lo urandomb.lo \
+ get_z_exp.lo swap.lo factorial.lo cosh.lo sinh.lo tanh.lo \
+ sinh_cosh.lo acosh.lo asinh.lo atanh.lo atan.lo cmp2.lo \
+ exp_2.lo asin.lo const_euler.lo cos.lo sin.lo tan.lo fma.lo \
+ fms.lo hypot.lo log1p.lo expm1.lo log2.lo log10.lo ui_pow.lo \
+ ui_pow_ui.lo minmax.lo dim.lo signbit.lo copysign.lo \
+ setsign.lo gmp_op.lo init2.lo acos.lo sin_cos.lo set_nan.lo \
+ set_inf.lo set_zero.lo powerof2.lo gamma.lo set_ld.lo \
+ get_ld.lo cbrt.lo volatile.lo fits_sshort.lo fits_sint.lo \
+ fits_slong.lo fits_ushort.lo fits_uint.lo fits_ulong.lo \
+ fits_uintmax.lo fits_intmax.lo get_si.lo get_ui.lo zeta.lo \
+ cmp_d.lo erf.lo inits.lo inits2.lo clears.lo sgn.lo check.lo \
+ sub1sp.lo version.lo mpn_exp.lo mpfr-gmp.lo mp_clz_tab.lo \
+ sum.lo add1sp.lo free_cache.lo si_op.lo cmp_ld.lo \
+ set_ui_2exp.lo set_si_2exp.lo set_uj.lo set_sj.lo get_sj.lo \
+ get_uj.lo get_z.lo iszero.lo cache.lo sqr.lo int_ceil_log2.lo \
+ isqrt.lo strtofr.lo pow_z.lo logging.lo mulders.lo get_f.lo \
+ round_p.lo erfc.lo atan2.lo subnormal.lo const_catalan.lo \
+ root.lo sec.lo csc.lo cot.lo eint.lo sech.lo csch.lo coth.lo \
+ round_near_x.lo constant.lo abort_prec_max.lo \
+ stack_interface.lo lngamma.lo zeta_ui.lo set_d64.lo get_d64.lo \
+ jn.lo yn.lo rem1.lo get_patches.lo add_d.lo sub_d.lo d_sub.lo \
+ mul_d.lo div_d.lo d_div.lo li2.lo rec_sqrt.lo min_prec.lo \
+ buildopt.lo digamma.lo bernoulli.lo isregular.lo set_flt.lo \
+ get_flt.lo scale2.lo set_z_exp.lo ai.lo gammaonethird.lo \
+ grandom.lo
+libmpfr_la_OBJECTS = $(am_libmpfr_la_OBJECTS)
+libmpfr_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libmpfr_la_LDFLAGS) $(LDFLAGS) -o $@
+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 = $(libmpfr_la_SOURCES)
+DIST_SOURCES = $(libmpfr_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATAFILES = @DATAFILES@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+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@
+LIBMPFR_LDFLAGS = @LIBMPFR_LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MPFR_LDFLAGS = @MPFR_LDFLAGS@
+MPFR_LIBM = @MPFR_LIBM@
+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@
+TUNE_LIBS = @TUNE_LIBS@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+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@
+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@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = round_raw_generic.c jyn_asympt.c x86/core2/mparam.h \
+ x86/mparam.h x86_64/core2/mparam.h x86_64/pentium4/mparam.h \
+ ia64/mparam.h arm/mparam.h powerpc64/mparam.h sparc64/mparam.h \
+ generic/mparam.h amd/athlon/mparam.h amd/k8/mparam.h \
+ amd/amdfam10/mparam.h powerpc32/mparam.h hppa/mparam.h
+
+include_HEADERS = mpfr.h mpf2mpfr.h
+BUILT_SOURCES = mparam.h
+lib_LTLIBRARIES = libmpfr.la
+libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-gmp.h mpfr-impl.h mpfr-intmax.h \
+mpfr-longlong.h mpfr-thread.h exceptions.c extract.c uceil_exp2.c \
+uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c \
+cmp_abs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c \
+div_2ui.c div.c div_ui.c dump.c eq.c exp10.c exp2.c exp3.c exp.c \
+frac.c frexp.c get_d.c get_exp.c get_str.c init.c inp_str.c isinteger.c \
+isinf.c isnan.c isnum.c const_log2.c log.c modf.c mul_2exp.c mul_2si.c \
+mul_2ui.c mul.c mul_ui.c neg.c next.c out_str.c printf.c vasprintf.c \
+const_pi.c pow.c pow_si.c pow_ui.c print_raw.c print_rnd_mode.c \
+reldiff.c round_prec.c set.c setmax.c setmin.c set_d.c set_dfl_prec.c \
+set_exp.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c \
+set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c \
+sub_ui.c rint.c ui_div.c ui_sub.c urandom.c urandomb.c get_z_exp.c \
+swap.c factorial.c cosh.c sinh.c tanh.c sinh_cosh.c acosh.c asinh.c \
+atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c \
+fma.c fms.c hypot.c log1p.c expm1.c log2.c log10.c ui_pow.c \
+ui_pow_ui.c minmax.c dim.c signbit.c copysign.c setsign.c gmp_op.c \
+init2.c acos.c sin_cos.c set_nan.c set_inf.c set_zero.c powerof2.c \
+gamma.c set_ld.c get_ld.c cbrt.c volatile.c fits_s.h fits_sshort.c \
+fits_sint.c fits_slong.c fits_u.h fits_ushort.c fits_uint.c \
+fits_ulong.c fits_uintmax.c fits_intmax.c get_si.c get_ui.c zeta.c \
+cmp_d.c erf.c inits.c inits2.c clears.c sgn.c check.c sub1sp.c \
+version.c mpn_exp.c mpfr-gmp.c mp_clz_tab.c sum.c add1sp.c \
+free_cache.c si_op.c cmp_ld.c set_ui_2exp.c set_si_2exp.c set_uj.c \
+set_sj.c get_sj.c get_uj.c get_z.c iszero.c cache.c sqr.c \
+int_ceil_log2.c isqrt.c strtofr.c pow_z.c logging.c mulders.c get_f.c \
+round_p.c erfc.c atan2.c subnormal.c const_catalan.c root.c \
+gen_inverse.h sec.c csc.c cot.c eint.c sech.c csch.c coth.c \
+round_near_x.c constant.c abort_prec_max.c stack_interface.c lngamma.c \
+zeta_ui.c set_d64.c get_d64.c jn.c yn.c rem1.c get_patches.c add_d.c \
+sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c \
+buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c \
+scale2.c set_z_exp.c ai.c gammaonethird.c ieee_floats.h \
+grandom.c
+
+libmpfr_la_LIBADD = @LIBOBJS@
+
+# Libtool -version-info CURRENT[:REVISION[:AGE]] for libmpfr.la
+#
+# 1. No interfaces changed, only implementations (good):
+# ==> Increment REVISION.
+# 2. Interfaces added, none removed (good):
+# ==> Increment CURRENT, increment AGE, set REVISION to 0.
+# 3. Interfaces removed or changed (BAD, breaks upward compatibility):
+# ==> Increment CURRENT, set AGE and REVISION to 0.
+#
+# MPFR -version-info
+# 2.1.x -
+# 2.2.x 1:x:0
+# 2.3.x 2:x:1
+# 2.4.x 3:x:2
+# 3.0.x 4:x:0
+# 3.1.x 5:x:1
+libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 5:2:1
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+mparam.h: $(top_builddir)/config.status $(srcdir)/mparam_h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_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
+libmpfr.la: $(libmpfr_la_OBJECTS) $(libmpfr_la_DEPENDENCIES) $(EXTRA_libmpfr_la_DEPENDENCIES)
+ $(libmpfr_la_LINK) -rpath $(libdir) $(libmpfr_la_OBJECTS) $(libmpfr_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abort_prec_max.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acos.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acosh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add1sp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asinh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atanh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bernoulli.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buildopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cbrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clear.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clears.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_abs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_ld.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_si.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comparisons.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_catalan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_euler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_log2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_pi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constant.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copysign.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cos.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cosh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cot.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coth.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_div.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_sub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/digamma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dim.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2si.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_2ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erfc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exceptions.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exp_2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expm1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factorial.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_intmax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_sint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_slong.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_sshort.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_uint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_uintmax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_ulong.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fits_ushort.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fms.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frac.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free_cache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gammaonethird.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_d64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_f.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_flt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_ld.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_patches.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_si.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_sj.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_str.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_uj.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_z.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_z_exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gmp_op.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grandom.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hypot.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inits.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inits2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inp_str.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/int_ceil_log2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinteger.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnum.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isqrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isregular.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iszero.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jn.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/li2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lngamma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log1p.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logging.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/min_prec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minmax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp_clz_tab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr-gmp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpn_exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2si.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_2ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mulders.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/next.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/out_str.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_si.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_z.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerof2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_raw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_rnd_mode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rec_sqrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reldiff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rem1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_near_x.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_p.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round_prec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sech.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_d64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_dfl_prec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_f.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_flt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_inf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ld.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_nan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prc_raw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_prec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_q.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_rnd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_si.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_si_2exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_sj.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_str_raw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_ui_2exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_uj.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_z.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_z_exp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_zero.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setmin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setsign.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgn.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/si_op.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sin_cos.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinh_cosh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqrt_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack_interface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtofr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub1sp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_d.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subnormal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sum.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tanh.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_exp2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uceil_log2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufloor_log2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_div.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_pow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_pow_ui.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_sub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandom.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urandomb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volatile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yn.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeta.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeta_ui.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ 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|^.*/||'`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+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) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ 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; }; }'`; \
+ 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) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; }; }'`; \
+ 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
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) 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:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+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)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ 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-libLTLIBRARIES
+
+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
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir 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-libLTLIBRARIES install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-includeHEADERS \
+ uninstall-libLTLIBRARIES
+
+
+# Important note: If for some reason, srcdir is read-only at build time
+# (and you use objdir != srcdir), then you need to rebuild get_patches.c
+# (with "make get_patches.c") just after patching the MPFR source. This
+# should not be a problem in practice, in particular because "make dist"
+# automatically rebuilds get_patches.c before generating the archives.
+$(srcdir)/get_patches.c: $(top_srcdir)/PATCHES $(top_srcdir)/tools/get_patches.sh
+ (cd $(top_srcdir) && ./tools/get_patches.sh) > $@ || rm -f $@
+
+# Do not add get_patches.c to CLEANFILES so that this file doesn't
+# need to be (re)built as long as no patches are applied. Anyway the
+# update of this file should be regarded as part of the patch process,
+# and "make clean" shouldn't remove it, just like it doesn't remove
+# what has been changed by "patch".
+#CLEANFILES = get_patches.c
+
+# 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:
diff --git a/src/abort_prec_max.c b/src/abort_prec_max.c
new file mode 100644
index 0000000..a747e72
--- /dev/null
+++ b/src/abort_prec_max.c
@@ -0,0 +1,32 @@
+/* mpfr_abort_prec_max -- Abort due to maximal precision overflow.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-impl.h"
+
+void mpfr_abort_prec_max (void)
+{
+ fprintf (stderr, "MPFR: Maximal precision overflow\n");
+ abort ();
+}
+
diff --git a/src/acos.c b/src/acos.c
new file mode 100644
index 0000000..63eddf5
--- /dev/null
+++ b/src/acos.c
@@ -0,0 +1,146 @@
+/* mpfr_acos -- arc-cosinus of a floating-point number
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xp, arcc, tmp;
+ mpfr_exp_t supplement;
+ mpfr_prec_t prec;
+ int sign, compared, inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("acos[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(acos), mpfr_log_prec, acos, inexact));
+
+ /* Singular cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (acos);
+ MPFR_RET_NAN;
+ }
+ else /* necessarily x=0 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ /* acos(0)=Pi/2 */
+ MPFR_SAVE_EXPO_MARK (expo);
+ inexact = mpfr_const_pi (acos, rnd_mode);
+ mpfr_div_2ui (acos, acos, 1, rnd_mode); /* exact */
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (acos, inexact, rnd_mode);
+ }
+ }
+
+ /* Set x_p=|x| */
+ sign = MPFR_SIGN (x);
+ mpfr_init2 (xp, MPFR_PREC (x));
+ mpfr_abs (xp, x, MPFR_RNDN); /* Exact */
+
+ compared = mpfr_cmp_ui (xp, 1);
+
+ if (MPFR_UNLIKELY (compared >= 0))
+ {
+ mpfr_clear (xp);
+ if (compared > 0) /* acos(x) = NaN for x > 1 */
+ {
+ MPFR_SET_NAN(acos);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ if (MPFR_IS_POS_SIGN (sign)) /* acos(+1) = 0 */
+ return mpfr_set_ui (acos, 0, rnd_mode);
+ else /* acos(-1) = Pi */
+ return mpfr_const_pi (acos, rnd_mode);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Compute the supplement */
+ mpfr_ui_sub (xp, 1, xp, MPFR_RNDD);
+ if (MPFR_IS_POS_SIGN (sign))
+ supplement = 2 - 2 * MPFR_GET_EXP (xp);
+ else
+ supplement = 2 - MPFR_GET_EXP (xp);
+ mpfr_clear (xp);
+
+ prec = MPFR_PREC (acos);
+ prec += MPFR_INT_CEIL_LOG2(prec) + 10 + supplement;
+
+ /* VL: The following change concerning prec comes from r3145
+ "Optimize mpfr_acos by choosing a better initial precision."
+ but it doesn't seem to be correct and leads to problems (assertion
+ failure or very important inefficiency) with tiny arguments.
+ Therefore, I've disabled it. */
+ /* If x ~ 2^-N, acos(x) ~ PI/2 - x - x^3/6
+ If Prec < 2*N, we can't round since x^3/6 won't be counted. */
+#if 0
+ if (MPFR_PREC (acos) >= MPFR_PREC (x) && MPFR_GET_EXP (x) < 0)
+ {
+ mpfr_uexp_t pmin = (mpfr_uexp_t) (-2 * MPFR_GET_EXP (x)) + 5;
+ MPFR_ASSERTN (pmin <= MPFR_PREC_MAX);
+ if (prec < pmin)
+ prec = pmin;
+ }
+#endif
+
+ mpfr_init2 (tmp, prec);
+ mpfr_init2 (arcc, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ /* acos(x) = Pi/2 - asin(x) = Pi/2 - atan(x/sqrt(1-x^2)) */
+ mpfr_sqr (tmp, x, MPFR_RNDN);
+ mpfr_ui_sub (tmp, 1, tmp, MPFR_RNDN);
+ mpfr_sqrt (tmp, tmp, MPFR_RNDN);
+ mpfr_div (tmp, x, tmp, MPFR_RNDN);
+ mpfr_atan (arcc, tmp, MPFR_RNDN);
+ mpfr_const_pi (tmp, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN);
+ mpfr_sub (arcc, tmp, arcc, MPFR_RNDN);
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (arcc, prec - supplement,
+ MPFR_PREC (acos), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (arcc, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (acos, arcc, rnd_mode);
+ mpfr_clear (tmp);
+ mpfr_clear (arcc);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (acos, inexact, rnd_mode);
+}
diff --git a/src/acosh.c b/src/acosh.c
new file mode 100644
index 0000000..75e931d
--- /dev/null
+++ b/src/acosh.c
@@ -0,0 +1,158 @@
+/* mpfr_acosh -- inverse hyperbolic cosine
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of acosh is done by *
+ * acosh= ln(x + sqrt(x^2-1)) */
+
+int
+mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode)
+{
+ MPFR_SAVE_EXPO_DECL (expo);
+ int inexact;
+ int comp;
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ /* Deal with special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ /* Nan, or zero or -Inf */
+ if (MPFR_IS_INF (x) && MPFR_IS_POS (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ else /* Nan, or zero or -Inf */
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ }
+ comp = mpfr_cmp_ui (x, 1);
+ if (MPFR_UNLIKELY (comp < 0))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_UNLIKELY (comp == 0))
+ {
+ MPFR_SET_ZERO (y); /* acosh(1) = 0 */
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variables */
+ mpfr_t t;
+ /* Declaration of the size variables */
+ mpfr_prec_t Ny = MPFR_PREC(y); /* Precision of output variable */
+ mpfr_prec_t Nt; /* Precision of the intermediary variable */
+ mpfr_exp_t err, exp_te, d; /* Precision of error */
+ MPFR_ZIV_DECL (loop);
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + 4 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ /* initialization of intermediary variables */
+ mpfr_init2 (t, Nt);
+
+ /* First computation of acosh */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* compute acosh */
+ MPFR_BLOCK (flags, mpfr_mul (t, x, x, MPFR_RNDD)); /* x^2 */
+ if (MPFR_OVERFLOW (flags))
+ {
+ mpfr_t ln2;
+ mpfr_prec_t pln2;
+
+ /* As x is very large and the precision is not too large, we
+ assume that we obtain the same result by evaluating ln(2x).
+ We need to compute ln(x) + ln(2) as 2x can overflow. TODO:
+ write a proof and add an MPFR_ASSERTN. */
+ mpfr_log (t, x, MPFR_RNDN); /* err(log) < 1/2 ulp(t) */
+ pln2 = Nt - MPFR_PREC_MIN < MPFR_GET_EXP (t) ?
+ MPFR_PREC_MIN : Nt - MPFR_GET_EXP (t);
+ mpfr_init2 (ln2, pln2);
+ mpfr_const_log2 (ln2, MPFR_RNDN); /* err(ln2) < 1/2 ulp(t) */
+ mpfr_add (t, t, ln2, MPFR_RNDN); /* err <= 3/2 ulp(t) */
+ mpfr_clear (ln2);
+ err = 1;
+ }
+ else
+ {
+ exp_te = MPFR_GET_EXP (t);
+ mpfr_sub_ui (t, t, 1, MPFR_RNDD); /* x^2-1 */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (t)))
+ {
+ /* This means that x is very close to 1: x = 1 + t with
+ t < 2^(-Nt). We have: acosh(x) = sqrt(2t) (1 - eps(t))
+ with 0 < eps(t) < t / 12. */
+ mpfr_sub_ui (t, x, 1, MPFR_RNDD); /* t = x - 1 */
+ mpfr_mul_2ui (t, t, 1, MPFR_RNDN); /* 2t */
+ mpfr_sqrt (t, t, MPFR_RNDN); /* sqrt(2t) */
+ err = 1;
+ }
+ else
+ {
+ d = exp_te - MPFR_GET_EXP (t);
+ mpfr_sqrt (t, t, MPFR_RNDN); /* sqrt(x^2-1) */
+ mpfr_add (t, t, x, MPFR_RNDN); /* sqrt(x^2-1)+x */
+ mpfr_log (t, t, MPFR_RNDN); /* ln(sqrt(x^2-1)+x) */
+
+ /* error estimate -- see algorithms.tex */
+ err = 3 + MAX (1, d) - MPFR_GET_EXP (t);
+ /* error is bounded by 1/2 + 2^err <= 2^(max(0,1+err)) */
+ err = MAX (0, 1 + err);
+ }
+ }
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - err, Ny, rnd_mode)))
+ break;
+
+ /* reactualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ mpfr_clear (t);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/add.c b/src/add.c
new file mode 100644
index 0000000..4b938dc
--- /dev/null
+++ b/src/add.c
@@ -0,0 +1,111 @@
+/* mpfr_add -- add two floating-point numbers
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ MPFR_LOG_FUNC
+ (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (b), mpfr_log_prec, b,
+ mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+
+ if (MPFR_ARE_SINGULAR(b,c))
+ {
+ if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c))
+ {
+ MPFR_SET_NAN(a);
+ MPFR_RET_NAN;
+ }
+ /* neither b nor c is NaN here */
+ else if (MPFR_IS_INF(b))
+ {
+ if (!MPFR_IS_INF(c) || MPFR_SIGN(b) == MPFR_SIGN(c))
+ {
+ MPFR_SET_INF(a);
+ MPFR_SET_SAME_SIGN(a, b);
+ MPFR_RET(0); /* exact */
+ }
+ else
+ {
+ MPFR_SET_NAN(a);
+ MPFR_RET_NAN;
+ }
+ }
+ else if (MPFR_IS_INF(c))
+ {
+ MPFR_SET_INF(a);
+ MPFR_SET_SAME_SIGN(a, c);
+ MPFR_RET(0); /* exact */
+ }
+ /* now either b or c is zero */
+ else if (MPFR_IS_ZERO(b))
+ {
+ if (MPFR_IS_ZERO(c))
+ {
+ /* for round away, we take the same convention for 0 + 0
+ as for round to zero or to nearest: it always gives +0,
+ except (-0) + (-0) = -0. */
+ MPFR_SET_SIGN(a,
+ (rnd_mode != MPFR_RNDD ?
+ ((MPFR_IS_NEG(b) && MPFR_IS_NEG(c)) ? -1 : 1) :
+ ((MPFR_IS_POS(b) && MPFR_IS_POS(c)) ? 1 : -1)));
+ MPFR_SET_ZERO(a);
+ MPFR_RET(0); /* 0 + 0 is exact */
+ }
+ return mpfr_set (a, c, rnd_mode);
+ }
+ else
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(c));
+ return mpfr_set (a, b, rnd_mode);
+ }
+ }
+
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (b));
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (c));
+
+ if (MPFR_UNLIKELY(MPFR_SIGN(b) != MPFR_SIGN(c)))
+ { /* signs differ, it is a subtraction */
+ if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b)
+ && MPFR_PREC(b) == MPFR_PREC(c)))
+ return mpfr_sub1sp(a, b, c, rnd_mode);
+ else
+ return mpfr_sub1(a, b, c, rnd_mode);
+ }
+ else
+ { /* signs are equal, it's an addition */
+ if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b)
+ && MPFR_PREC(b) == MPFR_PREC(c)))
+ if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
+ return mpfr_add1sp(a, c, b, rnd_mode);
+ else
+ return mpfr_add1sp(a, b, c, rnd_mode);
+ else
+ if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
+ return mpfr_add1(a, c, b, rnd_mode);
+ else
+ return mpfr_add1(a, b, c, rnd_mode);
+ }
+}
diff --git a/src/add1.c b/src/add1.c
new file mode 100644
index 0000000..e77f752
--- /dev/null
+++ b/src/add1.c
@@ -0,0 +1,538 @@
+/* mpfr_add1 -- internal function to perform a "real" addition
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* compute sign(b) * (|b| + |c|), assuming b and c have same sign,
+ and are not NaN, Inf, nor zero. */
+int
+mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mp_limb_t *ap, *bp, *cp;
+ mpfr_prec_t aq, bq, cq, aq2;
+ mp_size_t an, bn, cn;
+ mpfr_exp_t difw, exp;
+ int sh, rb, fb, inex;
+ mpfr_uexp_t diff_exp;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_ASSERTD(MPFR_IS_PURE_FP(b));
+ MPFR_ASSERTD(MPFR_IS_PURE_FP(c));
+
+ MPFR_TMP_MARK(marker);
+
+ aq = MPFR_PREC(a);
+ bq = MPFR_PREC(b);
+ cq = MPFR_PREC(c);
+
+ an = MPFR_PREC2LIMBS (aq); /* number of limbs of a */
+ aq2 = (mpfr_prec_t) an * GMP_NUMB_BITS;
+ sh = aq2 - aq; /* non-significant bits in low limb */
+
+ bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */
+ cn = MPFR_PREC2LIMBS (cq); /* number of limbs of c */
+
+ ap = MPFR_MANT(a);
+ bp = MPFR_MANT(b);
+ cp = MPFR_MANT(c);
+
+ if (MPFR_UNLIKELY(ap == bp))
+ {
+ bp = MPFR_TMP_LIMBS_ALLOC (bn);
+ MPN_COPY (bp, ap, bn);
+ if (ap == cp)
+ { cp = bp; }
+ }
+ else if (MPFR_UNLIKELY(ap == cp))
+ {
+ cp = MPFR_TMP_LIMBS_ALLOC (cn);
+ MPN_COPY(cp, ap, cn);
+ }
+
+ exp = MPFR_GET_EXP (b);
+ MPFR_SET_SAME_SIGN(a, b);
+ MPFR_UPDATE2_RND_MODE(rnd_mode, MPFR_SIGN(b));
+ /* now rnd_mode is either MPFR_RNDN, MPFR_RNDZ or MPFR_RNDA */
+ /* Note: exponents can be negative, but the unsigned subtraction is
+ a modular subtraction, so that one gets the correct result. */
+ diff_exp = (mpfr_uexp_t) exp - MPFR_GET_EXP(c);
+
+ /*
+ * 1. Compute the significant part A', the non-significant bits of A
+ * are taken into account.
+ *
+ * 2. Perform the rounding. At each iteration, we remember:
+ * _ r = rounding bit
+ * _ f = following bits (same value)
+ * where the result has the form: [number A]rfff...fff + a remaining
+ * value in the interval [0,2) ulp. We consider the most significant
+ * bits of the remaining value to update the result; a possible carry
+ * is immediately taken into account and A is updated accordingly. As
+ * soon as the bits f don't have the same value, A can be rounded.
+ * Variables:
+ * _ rb = rounding bit (0 or 1).
+ * _ fb = following bits (0 or 1), then sticky bit.
+ * If fb == 0, the only thing that can change is the sticky bit.
+ */
+
+ rb = fb = -1; /* means: not initialized */
+
+ if (MPFR_UNLIKELY (MPFR_UEXP (aq2) <= diff_exp))
+ { /* c does not overlap with a' */
+ if (MPFR_UNLIKELY(an > bn))
+ { /* a has more limbs than b */
+ /* copy b to the most significant limbs of a */
+ MPN_COPY(ap + (an - bn), bp, bn);
+ /* zero the least significant limbs of a */
+ MPN_ZERO(ap, an - bn);
+ }
+ else /* an <= bn */
+ {
+ /* copy the most significant limbs of b to a */
+ MPN_COPY(ap, bp + (bn - an), an);
+ }
+ }
+ else /* aq2 > diff_exp */
+ { /* c overlaps with a' */
+ mp_limb_t *a2p;
+ mp_limb_t cc;
+ mpfr_prec_t dif;
+ mp_size_t difn, k;
+ int shift;
+
+ /* copy c (shifted) into a */
+
+ dif = aq2 - diff_exp;
+ /* dif is the number of bits of c which overlap with a' */
+
+ difn = MPFR_PREC2LIMBS (dif);
+ /* only the highest difn limbs from c have to be considered */
+ if (MPFR_UNLIKELY(difn > cn))
+ {
+ /* c doesn't have enough limbs; take into account the virtual
+ zero limbs now by zeroing the least significant limbs of a' */
+ MPFR_ASSERTD(difn - cn <= an);
+ MPN_ZERO(ap, difn - cn);
+ difn = cn;
+ }
+ k = diff_exp / GMP_NUMB_BITS;
+
+ /* zero the most significant k limbs of a */
+ a2p = ap + (an - k);
+ MPN_ZERO(a2p, k);
+
+ shift = diff_exp % GMP_NUMB_BITS;
+
+ if (MPFR_LIKELY(shift))
+ {
+ MPFR_ASSERTD(a2p - difn >= ap);
+ cc = mpn_rshift(a2p - difn, cp + (cn - difn), difn, shift);
+ if (MPFR_UNLIKELY(a2p - difn > ap))
+ *(a2p - difn - 1) = cc;
+ }
+ else
+ MPN_COPY(a2p - difn, cp + (cn - difn), difn);
+
+ /* add b to a */
+ cc = MPFR_UNLIKELY(an > bn)
+ ? mpn_add_n(ap + (an - bn), ap + (an - bn), bp, bn)
+ : mpn_add_n(ap, ap, bp + (bn - an), an);
+
+ if (MPFR_UNLIKELY(cc)) /* carry */
+ {
+ if (MPFR_UNLIKELY(exp == __gmpfr_emax))
+ {
+ inex = mpfr_overflow (a, rnd_mode, MPFR_SIGN(a));
+ goto end_of_add;
+ }
+ exp++;
+ rb = (ap[0] >> sh) & 1; /* LSB(a) --> rounding bit after the shift */
+ if (MPFR_LIKELY(sh))
+ {
+ mp_limb_t mask, bb;
+
+ mask = MPFR_LIMB_MASK (sh);
+ bb = ap[0] & mask;
+ ap[0] &= (~mask) << 1;
+ if (bb == 0)
+ fb = 0;
+ else if (bb == mask)
+ fb = 1;
+ }
+ mpn_rshift(ap, ap, an, 1);
+ ap[an-1] += MPFR_LIMB_HIGHBIT;
+ if (sh && fb < 0)
+ goto rounding;
+ } /* cc */
+ } /* aq2 > diff_exp */
+
+ /* non-significant bits of a */
+ if (MPFR_LIKELY(rb < 0 && sh))
+ {
+ mp_limb_t mask, bb;
+
+ mask = MPFR_LIMB_MASK (sh);
+ bb = ap[0] & mask;
+ ap[0] &= ~mask;
+ rb = bb >> (sh - 1);
+ if (MPFR_LIKELY(sh > 1))
+ {
+ mask >>= 1;
+ bb &= mask;
+ if (bb == 0)
+ fb = 0;
+ else if (bb == mask)
+ fb = 1;
+ else
+ goto rounding;
+ }
+ }
+
+ /* determine rounding and sticky bits (and possible carry) */
+
+ difw = (mpfr_exp_t) an - (mpfr_exp_t) (diff_exp / GMP_NUMB_BITS);
+ /* difw is the number of limbs from b (regarded as having an infinite
+ precision) that have already been combined with c; -n if the next
+ n limbs from b won't be combined with c. */
+
+ if (MPFR_UNLIKELY(bn > an))
+ { /* there are still limbs from b that haven't been taken into account */
+ mp_size_t bk;
+
+ if (fb == 0 && difw <= 0)
+ {
+ fb = 1; /* c hasn't been taken into account ==> sticky bit != 0 */
+ goto rounding;
+ }
+
+ bk = bn - an; /* index of lowest considered limb from b, > 0 */
+ while (difw < 0)
+ { /* ulp(next limb from b) > msb(c) */
+ mp_limb_t bb;
+
+ bb = bp[--bk];
+
+ MPFR_ASSERTD(fb != 0);
+ if (fb > 0)
+ {
+ if (bb != MP_LIMB_T_MAX)
+ {
+ fb = 1; /* c hasn't been taken into account
+ ==> sticky bit != 0 */
+ goto rounding;
+ }
+ }
+ else /* fb not initialized yet */
+ {
+ if (rb < 0) /* rb not initialized yet */
+ {
+ rb = bb >> (GMP_NUMB_BITS - 1);
+ bb |= MPFR_LIMB_HIGHBIT;
+ }
+ fb = 1;
+ if (bb != MP_LIMB_T_MAX)
+ goto rounding;
+ }
+
+ if (bk == 0)
+ { /* b has entirely been read */
+ fb = 1; /* c hasn't been taken into account
+ ==> sticky bit != 0 */
+ goto rounding;
+ }
+
+ difw++;
+ } /* while */
+ MPFR_ASSERTD(bk > 0 && difw >= 0);
+
+ if (difw <= cn)
+ {
+ mp_size_t ck;
+ mp_limb_t cprev;
+ int difs;
+
+ ck = cn - difw;
+ difs = diff_exp % GMP_NUMB_BITS;
+
+ if (difs == 0 && ck == 0)
+ goto c_read;
+
+ cprev = ck == cn ? 0 : cp[ck];
+
+ if (fb < 0)
+ {
+ mp_limb_t bb, cc;
+
+ if (difs)
+ {
+ cc = cprev << (GMP_NUMB_BITS - difs);
+ if (--ck >= 0)
+ {
+ cprev = cp[ck];
+ cc += cprev >> difs;
+ }
+ }
+ else
+ cc = cp[--ck];
+
+ bb = bp[--bk] + cc;
+
+ if (bb < cc /* carry */
+ && (rb < 0 || (rb ^= 1) == 0)
+ && mpn_add_1(ap, ap, an, MPFR_LIMB_ONE << sh))
+ {
+ if (exp == __gmpfr_emax)
+ {
+ inex = mpfr_overflow (a, rnd_mode, MPFR_SIGN(a));
+ goto end_of_add;
+ }
+ exp++;
+ ap[an-1] = MPFR_LIMB_HIGHBIT;
+ rb = 0;
+ }
+
+ if (rb < 0) /* rb not initialized yet */
+ {
+ rb = bb >> (GMP_NUMB_BITS - 1);
+ bb <<= 1;
+ bb |= bb >> (GMP_NUMB_BITS - 1);
+ }
+
+ fb = bb != 0;
+ if (fb && bb != MP_LIMB_T_MAX)
+ goto rounding;
+ } /* fb < 0 */
+
+ while (bk > 0)
+ {
+ mp_limb_t bb, cc;
+
+ if (difs)
+ {
+ if (ck < 0)
+ goto c_read;
+ cc = cprev << (GMP_NUMB_BITS - difs);
+ if (--ck >= 0)
+ {
+ cprev = cp[ck];
+ cc += cprev >> difs;
+ }
+ }
+ else
+ {
+ if (ck == 0)
+ goto c_read;
+ cc = cp[--ck];
+ }
+
+ bb = bp[--bk] + cc;
+ if (bb < cc) /* carry */
+ {
+ fb ^= 1;
+ if (fb)
+ goto rounding;
+ rb ^= 1;
+ if (rb == 0 && mpn_add_1(ap, ap, an, MPFR_LIMB_ONE << sh))
+ {
+ if (MPFR_UNLIKELY(exp == __gmpfr_emax))
+ {
+ inex = mpfr_overflow (a, rnd_mode, MPFR_SIGN(a));
+ goto end_of_add;
+ }
+ exp++;
+ ap[an-1] = MPFR_LIMB_HIGHBIT;
+ }
+ } /* bb < cc */
+
+ if (!fb && bb != 0)
+ {
+ fb = 1;
+ goto rounding;
+ }
+ if (fb && bb != MP_LIMB_T_MAX)
+ goto rounding;
+ } /* while */
+
+ /* b has entirely been read */
+
+ if (fb || ck < 0)
+ goto rounding;
+ if (difs && cprev << (GMP_NUMB_BITS - difs))
+ {
+ fb = 1;
+ goto rounding;
+ }
+ while (ck)
+ {
+ if (cp[--ck])
+ {
+ fb = 1;
+ goto rounding;
+ }
+ } /* while */
+ } /* difw <= cn */
+ else
+ { /* c has entirely been read */
+ c_read:
+ if (fb < 0) /* fb not initialized yet */
+ {
+ mp_limb_t bb;
+
+ MPFR_ASSERTD(bk > 0);
+ bb = bp[--bk];
+ if (rb < 0) /* rb not initialized yet */
+ {
+ rb = bb >> (GMP_NUMB_BITS - 1);
+ bb &= ~MPFR_LIMB_HIGHBIT;
+ }
+ fb = bb != 0;
+ } /* fb < 0 */
+ if (fb)
+ goto rounding;
+ while (bk)
+ {
+ if (bp[--bk])
+ {
+ fb = 1;
+ goto rounding;
+ }
+ } /* while */
+ } /* difw > cn */
+ } /* bn > an */
+ else if (fb != 1) /* if fb == 1, the sticky bit is 1 (no possible carry) */
+ { /* b has entirely been read */
+ if (difw > cn)
+ { /* c has entirely been read */
+ if (rb < 0)
+ rb = 0;
+ fb = 0;
+ }
+ else if (diff_exp > MPFR_UEXP (aq2))
+ { /* b is followed by at least a zero bit, then by c */
+ if (rb < 0)
+ rb = 0;
+ fb = 1;
+ }
+ else
+ {
+ mp_size_t ck;
+ int difs;
+
+ MPFR_ASSERTD(difw >= 0 && cn >= difw);
+ ck = cn - difw;
+ difs = diff_exp % GMP_NUMB_BITS;
+
+ if (difs == 0 && ck == 0)
+ { /* c has entirely been read */
+ if (rb < 0)
+ rb = 0;
+ fb = 0;
+ }
+ else
+ {
+ mp_limb_t cc;
+
+ cc = difs ? (MPFR_ASSERTD(ck < cn),
+ cp[ck] << (GMP_NUMB_BITS - difs)) : cp[--ck];
+ if (rb < 0)
+ {
+ rb = cc >> (GMP_NUMB_BITS - 1);
+ cc &= ~MPFR_LIMB_HIGHBIT;
+ }
+ while (cc == 0)
+ {
+ if (ck == 0)
+ {
+ fb = 0;
+ goto rounding;
+ }
+ cc = cp[--ck];
+ } /* while */
+ fb = 1;
+ }
+ }
+ } /* fb != 1 */
+
+ rounding:
+ /* rnd_mode should be one of MPFR_RNDN, MPFR_RNDZ or MPFR_RNDA */
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ if (fb == 0)
+ {
+ if (rb == 0)
+ {
+ inex = 0;
+ goto set_exponent;
+ }
+ /* round to even */
+ if (ap[0] & (MPFR_LIMB_ONE << sh))
+ goto rndn_away;
+ else
+ goto rndn_zero;
+ }
+ if (rb == 0)
+ {
+ rndn_zero:
+ inex = MPFR_IS_NEG(a) ? 1 : -1;
+ goto set_exponent;
+ }
+ else
+ {
+ rndn_away:
+ inex = MPFR_IS_POS(a) ? 1 : -1;
+ goto add_one_ulp;
+ }
+ }
+ else if (rnd_mode == MPFR_RNDZ)
+ {
+ inex = rb || fb ? (MPFR_IS_NEG(a) ? 1 : -1) : 0;
+ goto set_exponent;
+ }
+ else
+ {
+ MPFR_ASSERTN (rnd_mode == MPFR_RNDA);
+ inex = rb || fb ? (MPFR_IS_POS(a) ? 1 : -1) : 0;
+ if (inex)
+ goto add_one_ulp;
+ else
+ goto set_exponent;
+ }
+
+ add_one_ulp: /* add one unit in last place to a */
+ if (MPFR_UNLIKELY(mpn_add_1 (ap, ap, an, MPFR_LIMB_ONE << sh)))
+ {
+ if (MPFR_UNLIKELY(exp == __gmpfr_emax))
+ {
+ inex = mpfr_overflow (a, rnd_mode, MPFR_SIGN(a));
+ goto end_of_add;
+ }
+ exp++;
+ ap[an-1] = MPFR_LIMB_HIGHBIT;
+ }
+
+ set_exponent:
+ MPFR_SET_EXP (a, exp);
+
+ end_of_add:
+ MPFR_TMP_FREE(marker);
+ MPFR_RET (inex);
+}
diff --git a/src/add1sp.c b/src/add1sp.c
new file mode 100644
index 0000000..91aa303
--- /dev/null
+++ b/src/add1sp.c
@@ -0,0 +1,387 @@
+/* mpfr_add1sp -- internal function to perform a "real" addition
+ All the op must have the same precision
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Check if we have to check the result of mpfr_add1sp with mpfr_add1 */
+#ifdef WANT_ASSERT
+# if WANT_ASSERT >= 2
+
+int mpfr_add1sp2 (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+int mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmpa, tmpb, tmpc;
+ int inexb, inexc, inexact, inexact2;
+
+ mpfr_init2 (tmpa, MPFR_PREC (a));
+ mpfr_init2 (tmpb, MPFR_PREC (b));
+ mpfr_init2 (tmpc, MPFR_PREC (c));
+
+ inexb = mpfr_set (tmpb, b, MPFR_RNDN);
+ MPFR_ASSERTN (inexb == 0);
+
+ inexc = mpfr_set (tmpc, c, MPFR_RNDN);
+ MPFR_ASSERTN (inexc == 0);
+
+ inexact2 = mpfr_add1 (tmpa, tmpb, tmpc, rnd_mode);
+ inexact = mpfr_add1sp2 (a, b, c, rnd_mode);
+
+ if (mpfr_cmp (tmpa, a) || inexact != inexact2)
+ {
+ fprintf (stderr, "add1 & add1sp return different values for %s\n"
+ "Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ",
+ mpfr_print_rnd_mode (rnd_mode),
+ (unsigned long) MPFR_PREC (a),
+ (unsigned long) MPFR_PREC (b),
+ (unsigned long) MPFR_PREC (c));
+ mpfr_fprint_binary (stderr, tmpb);
+ fprintf (stderr, "\nC = ");
+ mpfr_fprint_binary (stderr, tmpc);
+ fprintf (stderr, "\n\nadd1 : ");
+ mpfr_fprint_binary (stderr, tmpa);
+ fprintf (stderr, "\nadd1sp: ");
+ mpfr_fprint_binary (stderr, a);
+ fprintf (stderr, "\nInexact sp = %d | Inexact = %d\n",
+ inexact, inexact2);
+ MPFR_ASSERTN (0);
+ }
+ mpfr_clears (tmpa, tmpb, tmpc, (mpfr_ptr) 0);
+ return inexact;
+}
+# define mpfr_add1sp mpfr_add1sp2
+# endif
+#endif
+
+/* Debugging support */
+#ifdef DEBUG
+# undef DEBUG
+# define DEBUG(x) (x)
+#else
+# define DEBUG(x) /**/
+#endif
+
+/* compute sign(b) * (|b| + |c|)
+ Returns 0 iff result is exact,
+ a negative value when the result is less than the exact value,
+ a positive value otherwise. */
+int
+mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_uexp_t d;
+ mpfr_prec_t p;
+ unsigned int sh;
+ mp_size_t n;
+ mp_limb_t *ap, *cp;
+ mpfr_exp_t bx;
+ mp_limb_t limb;
+ int inexact;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_TMP_MARK(marker);
+
+ MPFR_ASSERTD(MPFR_PREC(a) == MPFR_PREC(b) && MPFR_PREC(b) == MPFR_PREC(c));
+ MPFR_ASSERTD(MPFR_IS_PURE_FP(b));
+ MPFR_ASSERTD(MPFR_IS_PURE_FP(c));
+ MPFR_ASSERTD(MPFR_GET_EXP(b) >= MPFR_GET_EXP(c));
+
+ /* Read prec and num of limbs */
+ p = MPFR_PREC(b);
+ n = MPFR_PREC2LIMBS (p);
+ MPFR_UNSIGNED_MINUS_MODULO(sh, p);
+ bx = MPFR_GET_EXP(b);
+ d = (mpfr_uexp_t) (bx - MPFR_GET_EXP(c));
+
+ DEBUG (printf ("New add1sp with diff=%lu\n", (unsigned long) d));
+
+ if (MPFR_UNLIKELY(d == 0))
+ {
+ /* d==0 */
+ DEBUG( mpfr_print_mant_binary("C= ", MPFR_MANT(c), p) );
+ DEBUG( mpfr_print_mant_binary("B= ", MPFR_MANT(b), p) );
+ bx++; /* exp + 1 */
+ ap = MPFR_MANT(a);
+ limb = mpn_add_n(ap, MPFR_MANT(b), MPFR_MANT(c), n);
+ DEBUG( mpfr_print_mant_binary("A= ", ap, p) );
+ MPFR_ASSERTD(limb != 0); /* There must be a carry */
+ limb = ap[0]; /* Get LSB (In fact, LSW) */
+ mpn_rshift(ap, ap, n, 1); /* Shift mantissa A */
+ ap[n-1] |= MPFR_LIMB_HIGHBIT; /* Set MSB */
+ ap[0] &= ~MPFR_LIMB_MASK(sh); /* Clear LSB bit */
+ if (MPFR_LIKELY((limb&(MPFR_LIMB_ONE<<sh)) == 0)) /* Check exact case */
+ { inexact = 0; goto set_exponent; }
+ /* Zero: Truncate
+ Nearest: Even Rule => truncate or add 1
+ Away: Add 1 */
+ if (MPFR_LIKELY(rnd_mode==MPFR_RNDN))
+ {
+ if (MPFR_LIKELY((ap[0]&(MPFR_LIMB_ONE<<sh))==0))
+ { inexact = -1; goto set_exponent; }
+ else
+ goto add_one_ulp;
+ }
+ MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(b));
+ if (rnd_mode==MPFR_RNDZ)
+ { inexact = -1; goto set_exponent; }
+ else
+ goto add_one_ulp;
+ }
+ else if (MPFR_UNLIKELY (d >= p))
+ {
+ if (MPFR_LIKELY (d > p))
+ {
+ /* d > p : Copy B in A */
+ /* Away: Add 1
+ Nearest: Trunc
+ Zero: Trunc */
+ if (MPFR_LIKELY (rnd_mode==MPFR_RNDN
+ || MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (b))))
+ {
+ copy_set_exponent:
+ ap = MPFR_MANT (a);
+ MPN_COPY (ap, MPFR_MANT(b), n);
+ inexact = -1;
+ goto set_exponent;
+ }
+ else
+ {
+ copy_add_one_ulp:
+ ap = MPFR_MANT(a);
+ MPN_COPY (ap, MPFR_MANT(b), n);
+ goto add_one_ulp;
+ }
+ }
+ else
+ {
+ /* d==p : Copy B in A */
+ /* Away: Add 1
+ Nearest: Even Rule if C is a power of 2, else Add 1
+ Zero: Trunc */
+ if (MPFR_LIKELY(rnd_mode==MPFR_RNDN))
+ {
+ /* Check if C was a power of 2 */
+ cp = MPFR_MANT(c);
+ if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT))
+ {
+ mp_size_t k = n-1;
+ do {
+ k--;
+ } while (k>=0 && cp[k]==0);
+ if (MPFR_UNLIKELY(k<0))
+ /* Power of 2: Even rule */
+ if ((MPFR_MANT (b)[0]&(MPFR_LIMB_ONE<<sh))==0)
+ goto copy_set_exponent;
+ }
+ /* Not a Power of 2 */
+ goto copy_add_one_ulp;
+ }
+ else if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (b)))
+ goto copy_set_exponent;
+ else
+ goto copy_add_one_ulp;
+ }
+ }
+ else
+ {
+ mp_limb_t mask;
+ mp_limb_t bcp, bcp1; /* Cp and C'p+1 */
+
+ /* General case: 1 <= d < p */
+ cp = MPFR_TMP_LIMBS_ALLOC (n);
+
+ /* Shift c in temporary allocated place */
+ {
+ mpfr_uexp_t dm;
+ mp_size_t m;
+
+ dm = d % GMP_NUMB_BITS;
+ m = d / GMP_NUMB_BITS;
+ if (MPFR_UNLIKELY(dm == 0))
+ {
+ /* dm = 0 and m > 0: Just copy */
+ MPFR_ASSERTD(m!=0);
+ MPN_COPY(cp, MPFR_MANT(c)+m, n-m);
+ MPN_ZERO(cp+n-m, m);
+ }
+ else if (MPFR_LIKELY(m == 0))
+ {
+ /* dm >=1 and m == 0: just shift */
+ MPFR_ASSERTD(dm >= 1);
+ mpn_rshift(cp, MPFR_MANT(c), n, dm);
+ }
+ else
+ {
+ /* dm > 0 and m > 0: shift and zero */
+ mpn_rshift(cp, MPFR_MANT(c)+m, n-m, dm);
+ MPN_ZERO(cp+n-m, m);
+ }
+ }
+
+ DEBUG( mpfr_print_mant_binary("Before", MPFR_MANT(c), p) );
+ DEBUG( mpfr_print_mant_binary("B= ", MPFR_MANT(b), p) );
+ DEBUG( mpfr_print_mant_binary("After ", cp, p) );
+
+ /* Compute bcp=Cp and bcp1=C'p+1 */
+ if (MPFR_LIKELY (sh > 0))
+ {
+ /* Try to compute them from C' rather than C */
+ bcp = (cp[0] & (MPFR_LIMB_ONE<<(sh-1))) ;
+ if (MPFR_LIKELY(cp[0]&MPFR_LIMB_MASK(sh-1)))
+ bcp1 = 1;
+ else
+ {
+ /* We can't compute C'p+1 from C'. Compute it from C */
+ /* Start from bit x=p-d+sh in mantissa C
+ (+sh since we have already looked sh bits in C'!) */
+ mpfr_prec_t x = p-d+sh-1;
+ if (MPFR_LIKELY(x>p))
+ /* We are already looked at all the bits of c, so C'p+1 = 0*/
+ bcp1 = 0;
+ else
+ {
+ mp_limb_t *tp = MPFR_MANT(c);
+ mp_size_t kx = n-1 - (x / GMP_NUMB_BITS);
+ mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS);
+ DEBUG (printf ("(First) x=%lu Kx=%ld Sx=%lu\n",
+ (unsigned long) x, (long) kx,
+ (unsigned long) sx));
+ /* Looks at the last bits of limb kx (if sx=0 does nothing)*/
+ if (tp[kx] & MPFR_LIMB_MASK(sx))
+ bcp1 = 1;
+ else
+ {
+ /*kx += (sx==0);*/
+ /*If sx==0, tp[kx] hasn't been checked*/
+ do {
+ kx--;
+ } while (kx>=0 && tp[kx]==0);
+ bcp1 = (kx >= 0);
+ }
+ }
+ }
+ }
+ else /* sh == 0 */
+ {
+ /* Compute Cp and C'p+1 from C with sh=0 */
+ mp_limb_t *tp = MPFR_MANT(c);
+ /* Start from bit x=p-d in mantissa C */
+ mpfr_prec_t x = p-d;
+ mp_size_t kx = n-1 - (x / GMP_NUMB_BITS);
+ mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS);
+ MPFR_ASSERTD(p >= d);
+ bcp = tp[kx] & (MPFR_LIMB_ONE<<sx);
+ /* Looks at the last bits of limb kx (If sx=0, does nothing)*/
+ if (tp[kx]&MPFR_LIMB_MASK(sx))
+ bcp1 = 1;
+ else
+ {
+ do {
+ kx--;
+ } while (kx>=0 && tp[kx]==0);
+ bcp1 = (kx>=0);
+ }
+ }
+ DEBUG (printf("sh=%u Cp=%lu C'p+1=%lu\n", sh,
+ (unsigned long) bcp, (unsigned long) bcp1));
+
+ /* Clean shifted C' */
+ mask = ~MPFR_LIMB_MASK(sh);
+ cp[0] &= mask;
+
+ /* Add the mantissa c from b in a */
+ ap = MPFR_MANT(a);
+ limb = mpn_add_n (ap, MPFR_MANT(b), cp, n);
+ DEBUG( mpfr_print_mant_binary("Add= ", ap, p) );
+
+ /* Check for overflow */
+ if (MPFR_UNLIKELY (limb))
+ {
+ limb = ap[0] & (MPFR_LIMB_ONE<<sh); /* Get LSB */
+ mpn_rshift (ap, ap, n, 1); /* Shift mantissa*/
+ bx++; /* Fix exponent */
+ ap[n-1] |= MPFR_LIMB_HIGHBIT; /* Set MSB */
+ ap[0] &= mask; /* Clear LSB bit */
+ bcp1 |= bcp; /* Recompute C'p+1 */
+ bcp = limb; /* Recompute Cp */
+ DEBUG (printf ("(Overflow) Cp=%lu C'p+1=%lu\n",
+ (unsigned long) bcp, (unsigned long) bcp1));
+ DEBUG (mpfr_print_mant_binary ("Add= ", ap, p));
+ }
+
+ /* Round:
+ Zero: Truncate but could be exact.
+ Away: Add 1 if Cp or C'p+1 !=0
+ Nearest: Truncate but could be exact if Cp==0
+ Add 1 if C'p+1 !=0,
+ Even rule else */
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ if (MPFR_LIKELY(bcp == 0))
+ { inexact = MPFR_LIKELY(bcp1) ? -1 : 0; goto set_exponent; }
+ else if (MPFR_UNLIKELY(bcp1==0) && (ap[0]&(MPFR_LIMB_ONE<<sh))==0)
+ { inexact = -1; goto set_exponent; }
+ else
+ goto add_one_ulp;
+ }
+ MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(b));
+ if (rnd_mode == MPFR_RNDZ)
+ {
+ inexact = MPFR_LIKELY(bcp || bcp1) ? -1 : 0;
+ goto set_exponent;
+ }
+ else
+ {
+ if (MPFR_UNLIKELY(bcp==0 && bcp1==0))
+ { inexact = 0; goto set_exponent; }
+ else
+ goto add_one_ulp;
+ }
+ }
+ MPFR_ASSERTN(0);
+
+ add_one_ulp:
+ /* add one unit in last place to a */
+ DEBUG( printf("AddOneUlp\n") );
+ if (MPFR_UNLIKELY( mpn_add_1(ap, ap, n, MPFR_LIMB_ONE<<sh) ))
+ {
+ /* Case 100000x0 = 0x1111x1 + 1*/
+ DEBUG( printf("Pow of 2\n") );
+ bx++;
+ ap[n-1] = MPFR_LIMB_HIGHBIT;
+ }
+ inexact = 1;
+
+ set_exponent:
+ if (MPFR_UNLIKELY(bx > __gmpfr_emax)) /* Check for overflow */
+ {
+ DEBUG( printf("Overflow\n") );
+ MPFR_TMP_FREE(marker);
+ MPFR_SET_SAME_SIGN(a,b);
+ return mpfr_overflow(a, rnd_mode, MPFR_SIGN(a));
+ }
+ MPFR_SET_EXP (a, bx);
+ MPFR_SET_SAME_SIGN(a,b);
+
+ MPFR_TMP_FREE(marker);
+ MPFR_RET (inexact * MPFR_INT_SIGN (a));
+}
diff --git a/src/add_d.c b/src/add_d.c
new file mode 100644
index 0000000..888511a
--- /dev/null
+++ b/src/add_d.c
@@ -0,0 +1,52 @@
+/* mpfr_add_d -- add a multiple precision floating-point number
+ to a machine double precision float
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_add_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t d;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("b[%Pu]=%.*Rg c=%.20g rnd=%d",
+ mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode),
+ ("a[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (a), mpfr_log_prec, a, inexact));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (d, IEEE_DBL_MANT_DIG);
+ inexact = mpfr_set_d (d, c, rnd_mode);
+ MPFR_ASSERTN (inexact == 0);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_add (a, b, d, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
+ mpfr_clear (d);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (a, inexact, rnd_mode);
+}
diff --git a/src/add_ui.c b/src/add_ui.c
new file mode 100644
index 0000000..aff6c67
--- /dev/null
+++ b/src/add_ui.c
@@ -0,0 +1,58 @@
+/* mpfr_add_ui -- add a floating-point number with a machine integer
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_add_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode)
+{
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg u=%d rnd=%d",
+ mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
+ ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+
+ if (MPFR_LIKELY(u != 0) ) /* if u=0, do nothing */
+ {
+ mpfr_t uu;
+ mp_limb_t up[1];
+ unsigned long cnt;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS);
+ MPFR_ASSERTD (u == (mp_limb_t) u);
+ count_leading_zeros(cnt, (mp_limb_t) u);
+ up[0] = (mp_limb_t) u << cnt;
+
+ /* Optimization note: Exponent save/restore operations may be
+ removed if mpfr_add works even when uu is out-of-range. */
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
+ inex = mpfr_add(y, x, uu, rnd_mode);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range(y, inex, rnd_mode);
+ }
+ else
+ /* (unsigned long) 0 is assumed to be a real 0 (unsigned) */
+ return mpfr_set (y, x, rnd_mode);
+}
diff --git a/src/agm.c b/src/agm.c
new file mode 100644
index 0000000..567bc46
--- /dev/null
+++ b/src/agm.c
@@ -0,0 +1,319 @@
+/* mpfr_agm -- arithmetic-geometric mean of two floating-point numbers
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* agm(x,y) is between x and y, so we don't need to save exponent range */
+int
+mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mpfr_rnd_t rnd_mode)
+{
+ int compare, inexact;
+ mp_size_t s;
+ mpfr_prec_t p, q;
+ mp_limb_t *up, *vp, *ufp, *vfp;
+ mpfr_t u, v, uf, vf, sc1, sc2;
+ mpfr_exp_t scaleop = 0, scaleit;
+ unsigned long n; /* number of iterations */
+ MPFR_ZIV_DECL (loop);
+ MPFR_TMP_DECL(marker);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("op2[%Pu]=%.*Rg op1[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (op2), mpfr_log_prec, op2,
+ mpfr_get_prec (op1), mpfr_log_prec, op1, rnd_mode),
+ ("r[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (r), mpfr_log_prec, r, inexact));
+
+ /* Deal with special values */
+ if (MPFR_ARE_SINGULAR (op1, op2))
+ {
+ /* If a or b is NaN, the result is NaN */
+ if (MPFR_IS_NAN(op1) || MPFR_IS_NAN(op2))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ /* now one of a or b is Inf or 0 */
+ /* If a and b is +Inf, the result is +Inf.
+ Otherwise if a or b is -Inf or 0, the result is NaN */
+ else if (MPFR_IS_INF(op1) || MPFR_IS_INF(op2))
+ {
+ if (MPFR_IS_STRICTPOS(op1) && MPFR_IS_STRICTPOS(op2))
+ {
+ MPFR_SET_INF(r);
+ MPFR_SET_SAME_SIGN(r, op1);
+ MPFR_RET(0); /* exact */
+ }
+ else
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ }
+ else /* a and b are neither NaN nor Inf, and one is zero */
+ { /* If a or b is 0, the result is +0 since a sqrt is positive */
+ MPFR_ASSERTD (MPFR_IS_ZERO (op1) || MPFR_IS_ZERO (op2));
+ MPFR_SET_POS (r);
+ MPFR_SET_ZERO (r);
+ MPFR_RET (0); /* exact */
+ }
+ }
+
+ /* If a or b is negative (excluding -Infinity), the result is NaN */
+ if (MPFR_UNLIKELY(MPFR_IS_NEG(op1) || MPFR_IS_NEG(op2)))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+
+ /* Precision of the following calculus */
+ q = MPFR_PREC(r);
+ p = q + MPFR_INT_CEIL_LOG2(q) + 15;
+ MPFR_ASSERTD (p >= 7); /* see algorithms.tex */
+ s = MPFR_PREC2LIMBS (p);
+
+ /* b (op2) and a (op1) are the 2 operands but we want b >= a */
+ compare = mpfr_cmp (op1, op2);
+ if (MPFR_UNLIKELY( compare == 0 ))
+ {
+ mpfr_set (r, op1, rnd_mode);
+ MPFR_RET (0); /* exact */
+ }
+ else if (compare > 0)
+ {
+ mpfr_srcptr t = op1;
+ op1 = op2;
+ op2 = t;
+ }
+
+ /* Now b (=op2) > a (=op1) */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ MPFR_TMP_MARK(marker);
+
+ /* Main loop */
+ MPFR_ZIV_INIT (loop, p);
+ for (;;)
+ {
+ mpfr_prec_t eq;
+ unsigned long err = 0; /* must be set to 0 at each Ziv iteration */
+ MPFR_BLOCK_DECL (flags);
+
+ /* Init temporary vars */
+ MPFR_TMP_INIT (up, u, p, s);
+ MPFR_TMP_INIT (vp, v, p, s);
+ MPFR_TMP_INIT (ufp, uf, p, s);
+ MPFR_TMP_INIT (vfp, vf, p, s);
+
+ /* Calculus of un and vn */
+ retry:
+ MPFR_BLOCK (flags,
+ mpfr_mul (u, op1, op2, MPFR_RNDN);
+ /* mpfr_mul(...): faster since PREC(op) < PREC(u) */
+ mpfr_add (v, op1, op2, MPFR_RNDN);
+ /* mpfr_add with !=prec is still good */);
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags) || MPFR_UNDERFLOW (flags)))
+ {
+ mpfr_exp_t e1 , e2;
+
+ MPFR_ASSERTN (scaleop == 0);
+ e1 = MPFR_GET_EXP (op1);
+ e2 = MPFR_GET_EXP (op2);
+
+ /* Let's determine scaleop to avoid an overflow/underflow. */
+ if (MPFR_OVERFLOW (flags))
+ {
+ /* Let's recall that emin <= e1 <= e2 <= emax.
+ There has been an overflow. Thus e2 >= emax/2.
+ If the mpfr_mul overflowed, then e1 + e2 > emax.
+ If the mpfr_add overflowed, then e2 = emax.
+ We want: (e1 + scale) + (e2 + scale) <= emax,
+ i.e. scale <= (emax - e1 - e2) / 2. Let's take
+ scale = min(floor((emax - e1 - e2) / 2), -1).
+ This is OK, as:
+ 1. emin <= scale <= -1.
+ 2. e1 + scale >= emin. Indeed:
+ * If e1 + e2 > emax, then
+ e1 + scale >= e1 + (emax - e1 - e2) / 2 - 1
+ >= (emax + e1 - emax) / 2 - 1
+ >= e1 / 2 - 1 >= emin.
+ * Otherwise, mpfr_mul didn't overflow, therefore
+ mpfr_add overflowed and e2 = emax, so that
+ e1 > emin (see restriction below).
+ e1 + scale > emin - 1, thus e1 + scale >= emin.
+ 3. e2 + scale <= emax, since scale < 0. */
+ if (e1 + e2 > MPFR_EXT_EMAX)
+ {
+ scaleop = - (((e1 + e2) - MPFR_EXT_EMAX + 1) / 2);
+ MPFR_ASSERTN (scaleop < 0);
+ }
+ else
+ {
+ /* The addition necessarily overflowed. */
+ MPFR_ASSERTN (e2 == MPFR_EXT_EMAX);
+ /* The case where e1 = emin and e2 = emax is not supported
+ here. This would mean that the precision of e2 would be
+ huge (and possibly not supported in practice anyway). */
+ MPFR_ASSERTN (e1 > MPFR_EXT_EMIN);
+ scaleop = -1;
+ }
+
+ }
+ else /* underflow only (in the multiplication) */
+ {
+ /* We have e1 + e2 <= emin (so, e1 <= e2 <= 0).
+ We want: (e1 + scale) + (e2 + scale) >= emin + 1,
+ i.e. scale >= (emin + 1 - e1 - e2) / 2. let's take
+ scale = ceil((emin + 1 - e1 - e2) / 2). This is OK, as:
+ 1. 1 <= scale <= emax.
+ 2. e1 + scale >= emin + 1 >= emin.
+ 3. e2 + scale <= scale <= emax. */
+ MPFR_ASSERTN (e1 <= e2 && e2 <= 0);
+ scaleop = (MPFR_EXT_EMIN + 2 - e1 - e2) / 2;
+ MPFR_ASSERTN (scaleop > 0);
+ }
+
+ MPFR_ALIAS (sc1, op1, MPFR_SIGN (op1), e1 + scaleop);
+ MPFR_ALIAS (sc2, op2, MPFR_SIGN (op2), e2 + scaleop);
+ op1 = sc1;
+ op2 = sc2;
+ MPFR_LOG_MSG (("Exception in pre-iteration, scale = %"
+ MPFR_EXP_FSPEC "d\n", scaleop));
+ goto retry;
+ }
+
+ mpfr_clear_flags ();
+ mpfr_sqrt (u, u, MPFR_RNDN);
+ mpfr_div_2ui (v, v, 1, MPFR_RNDN);
+
+ scaleit = 0;
+ n = 1;
+ while (mpfr_cmp2 (u, v, &eq) != 0 && eq <= p - 2)
+ {
+ MPFR_BLOCK_DECL (flags2);
+
+ MPFR_LOG_MSG (("Iteration n = %lu\n", n));
+
+ retry2:
+ mpfr_add (vf, u, v, MPFR_RNDN); /* No overflow? */
+ mpfr_div_2ui (vf, vf, 1, MPFR_RNDN);
+ /* See proof in algorithms.tex */
+ if (4*eq > p)
+ {
+ mpfr_t w;
+ MPFR_BLOCK_DECL (flags3);
+
+ MPFR_LOG_MSG (("4*eq > p\n", 0));
+
+ /* vf = V(k) */
+ mpfr_init2 (w, (p + 1) / 2);
+ MPFR_BLOCK
+ (flags3,
+ mpfr_sub (w, v, u, MPFR_RNDN); /* e = V(k-1)-U(k-1) */
+ mpfr_sqr (w, w, MPFR_RNDN); /* e = e^2 */
+ mpfr_div_2ui (w, w, 4, MPFR_RNDN); /* e*= (1/2)^2*1/4 */
+ mpfr_div (w, w, vf, MPFR_RNDN); /* 1/4*e^2/V(k) */
+ );
+ if (MPFR_LIKELY (! MPFR_UNDERFLOW (flags3)))
+ {
+ mpfr_sub (v, vf, w, MPFR_RNDN);
+ err = MPFR_GET_EXP (vf) - MPFR_GET_EXP (v); /* 0 or 1 */
+ mpfr_clear (w);
+ break;
+ }
+ /* There has been an underflow because of the cancellation
+ between V(k-1) and U(k-1). Let's use the conventional
+ method. */
+ MPFR_LOG_MSG (("4*eq > p -> underflow\n", 0));
+ mpfr_clear (w);
+ mpfr_clear_underflow ();
+ }
+ /* U(k) increases, so that U.V can overflow (but not underflow). */
+ MPFR_BLOCK (flags2, mpfr_mul (uf, u, v, MPFR_RNDN););
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags2)))
+ {
+ mpfr_exp_t scale2;
+
+ scale2 = - (((MPFR_GET_EXP (u) + MPFR_GET_EXP (v))
+ - MPFR_EXT_EMAX + 1) / 2);
+ MPFR_EXP (u) += scale2;
+ MPFR_EXP (v) += scale2;
+ scaleit += scale2;
+ MPFR_LOG_MSG (("Overflow in iteration n = %lu, scaleit = %"
+ MPFR_EXP_FSPEC "d (%" MPFR_EXP_FSPEC "d)\n",
+ n, scaleit, scale2));
+ mpfr_clear_overflow ();
+ goto retry2;
+ }
+ mpfr_sqrt (u, uf, MPFR_RNDN);
+ mpfr_swap (v, vf);
+ n ++;
+ }
+
+ MPFR_LOG_MSG (("End of iterations (n = %lu)\n", n));
+
+ /* the error on v is bounded by (18n+51) ulps, or twice if there
+ was an exponent loss in the final subtraction */
+ err += MPFR_INT_CEIL_LOG2(18 * n + 51); /* 18n+51 should not overflow
+ since n is about log(p) */
+ /* we should have n+2 <= 2^(p/4) [see algorithms.tex] */
+ if (MPFR_LIKELY (MPFR_INT_CEIL_LOG2(n + 2) <= p / 4 &&
+ MPFR_CAN_ROUND (v, p - err, q, rnd_mode)))
+ break; /* Stop the loop */
+
+ /* Next iteration */
+ MPFR_ZIV_NEXT (loop, p);
+ s = MPFR_PREC2LIMBS (p);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ if (MPFR_UNLIKELY ((__gmpfr_flags & (MPFR_FLAGS_ALL ^ MPFR_FLAGS_INEXACT))
+ != 0))
+ {
+ MPFR_ASSERTN (! mpfr_overflow_p ()); /* since mpfr_clear_flags */
+ MPFR_ASSERTN (! mpfr_underflow_p ()); /* since mpfr_clear_flags */
+ MPFR_ASSERTN (! mpfr_divby0_p ()); /* since mpfr_clear_flags */
+ MPFR_ASSERTN (! mpfr_nanflag_p ()); /* since mpfr_clear_flags */
+ }
+
+ /* Setting of the result */
+ inexact = mpfr_set (r, v, rnd_mode);
+ MPFR_EXP (r) -= scaleop + scaleit;
+
+ /* Let's clean */
+ MPFR_TMP_FREE(marker);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ /* From the definition of the AGM, underflow and overflow
+ are not possible. */
+ return mpfr_check_range (r, inexact, rnd_mode);
+ /* agm(u,v) can be exact for u, v rational only for u=v.
+ Proof (due to Nicolas Brisebarre): it suffices to consider
+ u=1 and v<1. Then 1/AGM(1,v) = 2F1(1/2,1/2,1;1-v^2),
+ and a theorem due to G.V. Chudnovsky states that for x a
+ non-zero algebraic number with |x|<1, then
+ 2F1(1/2,1/2,1;x) and 2F1(-1/2,1/2,1;x) are algebraically
+ independent over Q. */
+}
diff --git a/src/ai.c b/src/ai.c
new file mode 100644
index 0000000..19d9eb5
--- /dev/null
+++ b/src/ai.c
@@ -0,0 +1,664 @@
+/* mpfr_ai -- Airy function Ai
+
+Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Reminder and notations:
+ -----------------------
+
+ Ai is the solution of:
+ / y'' - x*y = 0
+ { Ai(0) = 1/ ( 9^(1/3)*Gamma(2/3) )
+ \ Ai'(0) = -1/ ( 3^(1/3)*Gamma(1/3) )
+
+ Series development:
+ Ai(x) = sum (a_i*x^i)
+ = sum (t_i)
+
+ Recurrences:
+ a_(i+3) = a_i / ((i+2)*(i+3))
+ t_(i+3) = t_i * x^3 / ((i+2)*(i+3))
+
+ Values:
+ a_0 = Ai(0) ~ 0.355
+ a_1 = Ai'(0) ~ -0.259
+*/
+
+
+/* Airy function Ai evaluated by the most naive algorithm */
+static int
+mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ mpfr_prec_t wprec; /* working precision */
+ mpfr_prec_t prec; /* target precision */
+ mpfr_prec_t err; /* used to estimate the evaluation error */
+ mpfr_prec_t correct_bits; /* estimates the number of correct bits*/
+ unsigned long int k;
+ unsigned long int cond; /* condition number of the series */
+ unsigned long int assumed_exponent; /* used as a lowerbound of |EXP(Ai(x))| */
+ int r;
+ mpfr_t s; /* used to store the partial sum */
+ mpfr_t ti, tip1; /* used to store successive values of t_i */
+ mpfr_t x3; /* used to store x^3 */
+ mpfr_t tmp_sp, tmp2_sp; /* small precision variables */
+ unsigned long int x3u; /* used to store ceil(x^3) */
+ mpfr_t temp1, temp2;
+ int test1, test2;
+
+ /* Logging */
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y) );
+
+ /* Special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ return mpfr_set_ui (y, 0, rnd);
+ }
+
+
+ /* Save current exponents range */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (x)))
+ {
+ mpfr_t y1, y2;
+ prec = MPFR_PREC (y) + 3;
+ mpfr_init2 (y1, prec);
+ mpfr_init2 (y2, prec);
+ MPFR_ZIV_INIT (loop, prec);
+
+ /* ZIV loop */
+ for (;;)
+ {
+ mpfr_gamma_one_and_two_third (y1, y2, prec); /* y2 = Gamma(2/3)(1 + delta1), |delta1| <= 2^{1-prec}. */
+
+ r = mpfr_set_ui (y1, 9, MPFR_RNDN);
+ MPFR_ASSERTD (r == 0);
+ mpfr_cbrt (y1, y1, MPFR_RNDN); /* y1 = cbrt(9)(1 + delta2), |delta2| <= 2^{-prec}. */
+ mpfr_mul (y1, y1, y2, MPFR_RNDN);
+ mpfr_ui_div (y1, 1, y1, MPFR_RNDN);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (y1, prec - 3, MPFR_PREC (y), rnd)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ r = mpfr_set (y, y1, rnd);
+ MPFR_ZIV_FREE (loop);
+ MPFR_SAVE_EXPO_FREE (expo);
+ mpfr_clear (y1);
+ mpfr_clear (y2);
+ return mpfr_check_range (y, r, rnd);
+ }
+
+ /* FIXME: underflow for large values of |x| ? */
+
+
+ /* Set initial precision */
+ /* If we compute sum(i=0, N-1, t_i), the relative error is bounded by */
+ /* 2*(4N)*2^(1-wprec)*C(|x|)/Ai(x) */
+ /* where C(|x|) = 1 if 0<=x<=1 */
+ /* and C(|x|) = (1/2)*x^(-1/4)*exp(2/3 x^(3/2)) if x >= 1 */
+
+ /* A priori, we do not know N, so we estimate it to ~ prec */
+ /* If 0<=x<=1, we estimate Ai(x) ~ 1/8 */
+ /* if 1<=x, we estimate Ai(x) ~ (1/4)*x^(-1/4)*exp(-2/3 * x^(3/2)) */
+ /* if x<=0, ????? */
+
+ /* We begin with 11 guard bits */
+ prec = MPFR_PREC (y)+11;
+ MPFR_ZIV_INIT (loop, prec);
+
+ /* The working precision is heuristically chosen in order to obtain */
+ /* approximately prec correct bits in the sum. To sum up: the sum */
+ /* is stopped when the *exact* sum gives ~ prec correct bit. And */
+ /* when it is stopped, the accuracy of the computed sum, with respect*/
+ /* to the exact one should be ~prec bits. */
+ mpfr_init2 (tmp_sp, MPFR_SMALL_PRECISION);
+ mpfr_init2 (tmp2_sp, MPFR_SMALL_PRECISION);
+ mpfr_abs (tmp_sp, x, MPFR_RNDU);
+ mpfr_pow_ui (tmp_sp, tmp_sp, 3, MPFR_RNDU);
+ mpfr_sqrt (tmp_sp, tmp_sp, MPFR_RNDU); /* tmp_sp ~ x^3/2 */
+
+ /* 0.96179669392597567 >~ 2/3 * log2(e). See algorithms.tex */
+ mpfr_set_str (tmp2_sp, "0.96179669392597567", 10, MPFR_RNDU);
+ mpfr_mul (tmp2_sp, tmp_sp, tmp2_sp, MPFR_RNDU);
+
+ /* cond represents the number of lost bits in the evaluation of the sum */
+ if ( (MPFR_IS_ZERO (x)) || (MPFR_GET_EXP (x) <= 0) )
+ cond = 0;
+ else
+ cond = mpfr_get_ui (tmp2_sp, MPFR_RNDU) - (MPFR_GET_EXP (x)-1)/4 - 1;
+
+ /* The variable assumed_exponent is used to store the maximal assumed */
+ /* exponent of Ai(x). More precisely, we assume that |Ai(x)| will be */
+ /* greater than 2^{-assumed_exponent}. */
+ if (MPFR_IS_ZERO (x))
+ assumed_exponent = 2;
+ else
+ {
+ if (MPFR_IS_POS (x))
+ {
+ if (MPFR_GET_EXP (x) <= 0)
+ assumed_exponent = 3;
+ else
+ assumed_exponent = (2 + (MPFR_GET_EXP (x)/4 + 1)
+ + mpfr_get_ui (tmp2_sp, MPFR_RNDU));
+ }
+ /* We do not know Ai (x) yet */
+ /* We cover the case when EXP (Ai (x))>=-10 */
+ else
+ assumed_exponent = 10;
+ }
+
+ wprec = prec + MPFR_INT_CEIL_LOG2 (prec) + 5 + cond + assumed_exponent;
+
+ mpfr_init (ti);
+ mpfr_init (tip1);
+ mpfr_init (temp1);
+ mpfr_init (temp2);
+ mpfr_init (x3);
+ mpfr_init (s);
+
+ /* ZIV loop */
+ for (;;)
+ {
+ MPFR_LOG_MSG (("Working precision: %Pu\n", wprec));
+ mpfr_set_prec (ti, wprec);
+ mpfr_set_prec (tip1, wprec);
+ mpfr_set_prec (x3, wprec);
+ mpfr_set_prec (s, wprec);
+
+ mpfr_sqr (x3, x, MPFR_RNDU);
+ mpfr_mul (x3, x3, x, (MPFR_IS_POS (x)?MPFR_RNDU:MPFR_RNDD)); /* x3=x^3 */
+ if (MPFR_IS_NEG (x))
+ MPFR_CHANGE_SIGN (x3);
+ x3u = mpfr_get_ui (x3, MPFR_RNDU); /* x3u >= ceil(x^3) */
+ if (MPFR_IS_NEG (x))
+ MPFR_CHANGE_SIGN (x3);
+
+ mpfr_gamma_one_and_two_third (temp1, temp2, wprec);
+ mpfr_set_ui (ti, 9, MPFR_RNDN);
+ mpfr_cbrt (ti, ti, MPFR_RNDN);
+ mpfr_mul (ti, ti, temp2, MPFR_RNDN);
+ mpfr_ui_div (ti, 1, ti , MPFR_RNDN); /* ti = 1/( Gamma (2/3)*9^(1/3) ) */
+
+ mpfr_set_ui (tip1, 3, MPFR_RNDN);
+ mpfr_cbrt (tip1, tip1, MPFR_RNDN);
+ mpfr_mul (tip1, tip1, temp1, MPFR_RNDN);
+ mpfr_neg (tip1, tip1, MPFR_RNDN);
+ mpfr_div (tip1, x, tip1, MPFR_RNDN); /* tip1 = -x/(Gamma (1/3)*3^(1/3)) */
+
+ mpfr_add (s, ti, tip1, MPFR_RNDN);
+
+
+ /* Evaluation of the series */
+ k = 2;
+ for (;;)
+ {
+ mpfr_mul (ti, ti, x3, MPFR_RNDN);
+ mpfr_mul (tip1, tip1, x3, MPFR_RNDN);
+
+ mpfr_div_ui2 (ti, ti, k, (k+1), MPFR_RNDN);
+ mpfr_div_ui2 (tip1, tip1, (k+1), (k+2), MPFR_RNDN);
+
+ k += 3;
+ mpfr_add (s, s, ti, MPFR_RNDN);
+ mpfr_add (s, s, tip1, MPFR_RNDN);
+
+ /* FIXME: if s==0 */
+ test1 = MPFR_IS_ZERO (ti)
+ || (MPFR_GET_EXP (ti) + (mpfr_exp_t)prec + 3 <= MPFR_GET_EXP (s));
+ test2 = MPFR_IS_ZERO (tip1)
+ || (MPFR_GET_EXP (tip1) + (mpfr_exp_t)prec + 3 <= MPFR_GET_EXP (s));
+
+ if ( test1 && test2 && (x3u <= k*(k+1)/2) )
+ break; /* FIXME: if k*(k+1) overflows */
+ }
+
+ MPFR_LOG_MSG (("Truncation rank: %lu\n", k));
+
+ err = 4 + MPFR_INT_CEIL_LOG2 (k) + cond - MPFR_GET_EXP (s);
+
+ /* err is the number of bits lost due to the evaluation error */
+ /* wprec-(prec+1): number of bits lost due to the approximation error */
+ MPFR_LOG_MSG (("Roundoff error: %Pu\n", err));
+ MPFR_LOG_MSG (("Approxim error: %Pu\n", wprec-prec-1));
+
+ if (wprec < err+1)
+ correct_bits=0;
+ else
+ {
+ if (wprec < err+prec+1)
+ correct_bits = wprec - err - 1;
+ else
+ correct_bits = prec;
+ }
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, correct_bits, MPFR_PREC (y), rnd)))
+ break;
+
+ if (correct_bits == 0)
+ {
+ assumed_exponent *= 2;
+ MPFR_LOG_MSG (("Not a single bit correct (assumed_exponent=%lu)\n",
+ assumed_exponent));
+ wprec = prec + 5 + MPFR_INT_CEIL_LOG2 (k) + cond + assumed_exponent;
+ }
+ else
+ {
+ if (correct_bits < prec)
+ { /* The precision was badly chosen */
+ MPFR_LOG_MSG (("Bad assumption on the exponent of Ai(x)", 0));
+ MPFR_LOG_MSG ((" (E=%ld)\n", (long) MPFR_GET_EXP (s)));
+ wprec = prec + err + 1;
+ }
+ else
+ { /* We are really in a bad case of the TMD */
+ MPFR_ZIV_NEXT (loop, prec);
+
+ /* We update wprec */
+ /* We assume that K will not be multiplied by more than 4 */
+ wprec = prec + (MPFR_INT_CEIL_LOG2 (k)+2) + 5 + cond
+ - MPFR_GET_EXP (s);
+ }
+ }
+
+ } /* End of ZIV loop */
+
+ MPFR_ZIV_FREE (loop);
+
+ r = mpfr_set (y, s, rnd);
+
+ mpfr_clear (ti);
+ mpfr_clear (tip1);
+ mpfr_clear (temp1);
+ mpfr_clear (temp2);
+ mpfr_clear (x3);
+ mpfr_clear (s);
+ mpfr_clear (tmp_sp);
+ mpfr_clear (tmp2_sp);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, r, rnd);
+}
+
+
+/* Airy function Ai evaluated by Smith algorithm */
+static int
+mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ mpfr_prec_t wprec; /* working precision */
+ mpfr_prec_t prec; /* target precision */
+ mpfr_prec_t err; /* used to estimate the evaluation error */
+ mpfr_prec_t correctBits; /* estimates the number of correct bits*/
+ unsigned long int i, j, L, t;
+ unsigned long int cond; /* condition number of the series */
+ unsigned long int assumed_exponent; /* used as a lowerbound of |EXP(Ai(x))| */
+ int r; /* returned ternary value */
+ mpfr_t s; /* used to store the partial sum */
+ mpfr_t u0, u1;
+ mpfr_t *z; /* used to store the (x^3j) */
+ mpfr_t result;
+ mpfr_t tmp_sp, tmp2_sp; /* small precision variables */
+ unsigned long int x3u; /* used to store ceil (x^3) */
+ mpfr_t temp1, temp2;
+ int test0, test1;
+
+ /* Logging */
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+
+ /* Special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ return mpfr_set_ui (y, 0, rnd);
+ }
+
+ /* Save current exponents range */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* FIXME: underflow for large values of |x| */
+
+
+ /* Set initial precision */
+ /* See the analysis for the naive evaluation */
+
+ /* We begin with 11 guard bits */
+ prec = MPFR_PREC (y) + 11;
+ MPFR_ZIV_INIT (loop, prec);
+
+ mpfr_init2 (tmp_sp, MPFR_SMALL_PRECISION);
+ mpfr_init2 (tmp2_sp, MPFR_SMALL_PRECISION);
+ mpfr_abs (tmp_sp, x, MPFR_RNDU);
+ mpfr_pow_ui (tmp_sp, tmp_sp, 3, MPFR_RNDU);
+ mpfr_sqrt (tmp_sp, tmp_sp, MPFR_RNDU); /* tmp_sp ~ x^3/2 */
+
+ /* 0.96179669392597567 >~ 2/3 * log2(e). See algorithms.tex */
+ mpfr_set_str (tmp2_sp, "0.96179669392597567", 10, MPFR_RNDU);
+ mpfr_mul (tmp2_sp, tmp_sp, tmp2_sp, MPFR_RNDU);
+
+ /* cond represents the number of lost bits in the evaluation of the sum */
+ if ( (MPFR_IS_ZERO (x)) || (MPFR_GET_EXP (x) <= 0) )
+ cond = 0;
+ else
+ cond = mpfr_get_ui (tmp2_sp, MPFR_RNDU) - (MPFR_GET_EXP (x) - 1)/4 - 1;
+
+ /* This variable is used to store the maximal assumed exponent of */
+ /* Ai (x). More precisely, we assume that |Ai (x)| will be greater than */
+ /* 2^{-assumedExp}. */
+ if (MPFR_IS_ZERO (x))
+ assumed_exponent = 2;
+ else
+ {
+ if (MPFR_IS_POS (x))
+ {
+ if (MPFR_GET_EXP (x) <= 0)
+ assumed_exponent = 3;
+ else
+ assumed_exponent = (2 + (MPFR_GET_EXP (x)/4 + 1)
+ + mpfr_get_ui (tmp2_sp, MPFR_RNDU));
+ }
+ /* We do not know Ai (x) yet */
+ /* We cover the case when EXP (Ai (x))>=-10 */
+ else
+ assumed_exponent = 10;
+ }
+
+ wprec = prec + MPFR_INT_CEIL_LOG2 (prec) + 6 + cond + assumed_exponent;
+
+ /* We assume that the truncation rank will be ~ prec */
+ L = __gmpfr_isqrt (prec);
+ MPFR_LOG_MSG (("size of blocks L = %lu\n", L));
+
+ z = (mpfr_t *) (*__gmp_allocate_func) ( (L + 1) * sizeof (mpfr_t) );
+ MPFR_ASSERTN (z != NULL);
+ for (j=0; j<=L; j++)
+ mpfr_init (z[j]);
+
+ mpfr_init (s);
+ mpfr_init (u0); mpfr_init (u1);
+ mpfr_init (result);
+ mpfr_init (temp1);
+ mpfr_init (temp2);
+
+ /* ZIV loop */
+ for (;;)
+ {
+ MPFR_LOG_MSG (("working precision: %Pu\n", wprec));
+
+ for (j=0; j<=L; j++)
+ mpfr_set_prec (z[j], wprec);
+ mpfr_set_prec (s, wprec);
+ mpfr_set_prec (u0, wprec); mpfr_set_prec (u1, wprec);
+ mpfr_set_prec (result, wprec);
+
+ mpfr_set_ui (u0, 1, MPFR_RNDN);
+ mpfr_set (u1, x, MPFR_RNDN);
+
+ mpfr_set_ui (z[0], 1, MPFR_RNDU);
+ mpfr_sqr (z[1], u1, MPFR_RNDU);
+ mpfr_mul (z[1], z[1], x, (MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD) );
+
+ if (MPFR_IS_NEG (x))
+ MPFR_CHANGE_SIGN (z[1]);
+ x3u = mpfr_get_ui (z[1], MPFR_RNDU); /* x3u >= ceil (x^3) */
+ if (MPFR_IS_NEG (x))
+ MPFR_CHANGE_SIGN (z[1]);
+
+ for (j=2; j<=L ;j++)
+ {
+ if (j%2 == 0)
+ mpfr_sqr (z[j], z[j/2], MPFR_RNDN);
+ else
+ mpfr_mul (z[j], z[j-1], z[1], MPFR_RNDN);
+ }
+
+ mpfr_gamma_one_and_two_third (temp1, temp2, wprec);
+ mpfr_set_ui (u0, 9, MPFR_RNDN);
+ mpfr_cbrt (u0, u0, MPFR_RNDN);
+ mpfr_mul (u0, u0, temp2, MPFR_RNDN);
+ mpfr_ui_div (u0, 1, u0 , MPFR_RNDN); /* u0 = 1/( Gamma (2/3)*9^(1/3) ) */
+
+ mpfr_set_ui (u1, 3, MPFR_RNDN);
+ mpfr_cbrt (u1, u1, MPFR_RNDN);
+ mpfr_mul (u1, u1, temp1, MPFR_RNDN);
+ mpfr_neg (u1, u1, MPFR_RNDN);
+ mpfr_div (u1, x, u1, MPFR_RNDN); /* u1 = -x/(Gamma (1/3)*3^(1/3)) */
+
+ mpfr_set_ui (result, 0, MPFR_RNDN);
+ t = 0;
+
+ /* Evaluation of the series by Smith' method */
+ for (i=0; ; i++)
+ {
+ t += 3 * L;
+
+ /* k = 0 */
+ t -= 3;
+ mpfr_set (s, z[L-1], MPFR_RNDN);
+ for (j=L-2; ; j--)
+ {
+ t -= 3;
+ mpfr_div_ui2 (s, s, (t+2), (t+3), MPFR_RNDN);
+ mpfr_add (s, s, z[j], MPFR_RNDN);
+ if (j==0)
+ break;
+ }
+ mpfr_mul (s, s, u0, MPFR_RNDN);
+ mpfr_add (result, result, s, MPFR_RNDN);
+
+ mpfr_mul (u0, u0, z[L], MPFR_RNDN);
+ for (j=0; j<=L-1; j++)
+ {
+ mpfr_div_ui2 (u0, u0, (t + 2), (t + 3), MPFR_RNDN);
+ t += 3;
+ }
+
+ t++;
+
+ /* k = 1 */
+ t -= 3;
+ mpfr_set (s, z[L-1], MPFR_RNDN);
+ for (j=L-2; ; j--)
+ {
+ t -= 3;
+ mpfr_div_ui2 (s, s, (t + 2), (t + 3), MPFR_RNDN);
+ mpfr_add (s, s, z[j], MPFR_RNDN);
+ if (j==0)
+ break;
+ }
+ mpfr_mul (s, s, u1, MPFR_RNDN);
+ mpfr_add (result, result, s, MPFR_RNDN);
+
+ mpfr_mul (u1, u1, z[L], MPFR_RNDN);
+ for (j=0; j<=L-1; j++)
+ {
+ mpfr_div_ui2 (u1, u1, (t + 2), (t + 3), MPFR_RNDN);
+ t += 3;
+ }
+
+ t++;
+
+ /* k = 2 */
+ t++;
+
+ /* End of the loop over k */
+ t -= 3;
+
+ test0 = MPFR_IS_ZERO (u0) ||
+ MPFR_GET_EXP (u0) + (mpfr_exp_t)prec + 4 <= MPFR_GET_EXP (result);
+ test1 = MPFR_IS_ZERO (u1) ||
+ MPFR_GET_EXP (u1) + (mpfr_exp_t)prec + 4 <= MPFR_GET_EXP (result);
+
+ if ( test0 && test1 && (x3u <= (t + 2) * (t + 3) / 2) )
+ break;
+ }
+
+ MPFR_LOG_MSG (("Truncation rank: %lu\n", t));
+
+ err = (5 + MPFR_INT_CEIL_LOG2 (L+1) + MPFR_INT_CEIL_LOG2 (i+1)
+ + cond - MPFR_GET_EXP (result));
+
+ /* err is the number of bits lost due to the evaluation error */
+ /* wprec-(prec+1): number of bits lost due to the approximation error */
+ MPFR_LOG_MSG (("Roundoff error: %Pu\n", err));
+ MPFR_LOG_MSG (("Approxim error: %Pu\n", wprec - prec - 1));
+
+ if (wprec < err+1)
+ correctBits = 0;
+ else
+ {
+ if (wprec < err+prec+1)
+ correctBits = wprec - err - 1;
+ else
+ correctBits = prec;
+ }
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (result, correctBits,
+ MPFR_PREC (y), rnd)))
+ break;
+
+ for (j=0; j<=L; j++)
+ mpfr_clear (z[j]);
+ (*__gmp_free_func) (z, (L + 1) * sizeof (mpfr_t));
+ L = __gmpfr_isqrt (t);
+ MPFR_LOG_MSG (("size of blocks L = %lu\n", L));
+ z = (mpfr_t *) (*__gmp_allocate_func) ( (L + 1) * sizeof (mpfr_t));
+ MPFR_ASSERTN (z != NULL);
+ for (j=0; j<=L; j++)
+ mpfr_init (z[j]);
+
+ if (correctBits == 0)
+ {
+ assumed_exponent *= 2;
+ MPFR_LOG_MSG (("Not a single bit correct (assumed_exponent=%lu)\n",
+ assumed_exponent));
+ wprec = prec + 6 + MPFR_INT_CEIL_LOG2 (t) + cond + assumed_exponent;
+ }
+ else
+ {
+ if (correctBits < prec)
+ { /* The precision was badly chosen */
+ MPFR_LOG_MSG (("Bad assumption on the exponent of Ai (x)", 0));
+ MPFR_LOG_MSG ((" (E=%ld)\n", (long) (MPFR_GET_EXP (result))));
+ wprec = prec + err + 1;
+ }
+ else
+ { /* We are really in a bad case of the TMD */
+ MPFR_ZIV_NEXT (loop, prec);
+
+ /* We update wprec */
+ /* We assume that t will not be multiplied by more than 4 */
+ wprec = (prec + (MPFR_INT_CEIL_LOG2 (t) + 2) + 6 + cond
+ - MPFR_GET_EXP (result));
+ }
+ }
+ } /* End of ZIV loop */
+
+ MPFR_ZIV_FREE (loop);
+ MPFR_SAVE_EXPO_FREE (expo);
+
+ r = mpfr_set (y, result, rnd);
+
+ mpfr_clear (tmp_sp);
+ mpfr_clear (tmp2_sp);
+ for (j=0; j<=L; j++)
+ mpfr_clear (z[j]);
+ (*__gmp_free_func) (z, (L + 1) * sizeof (mpfr_t));
+
+ mpfr_clear (s);
+ mpfr_clear (u0); mpfr_clear (u1);
+ mpfr_clear (result);
+ mpfr_clear (temp1);
+ mpfr_clear (temp2);
+
+ return r;
+}
+
+/* We consider that the boundary between the area where the naive method
+ should preferably be used and the area where Smith' method should preferably
+ be used has the following form:
+ it is a triangle defined by two lines (one for the negative values of x, and
+ one for the positive values of x) crossing at x=0.
+
+ More precisely,
+
+ * If x<0 and MPFR_AI_THRESHOLD1*x + MPFR_AI_THRESHOLD2*prec > MPFR_AI_SCALE,
+ use Smith' algorithm;
+ * If x>0 and MPFR_AI_THRESHOLD3*x + MPFR_AI_THRESHOLD2*prec > MPFR_AI_SCALE,
+ use Smith' algorithm;
+ * otherwise, use the naive method.
+*/
+
+#define MPFR_AI_SCALE 1048576
+
+int
+mpfr_ai (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ mpfr_t temp1, temp2;
+ int use_ai2;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ /* The exponent range must be large enough for the computation of temp1. */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (temp1, MPFR_SMALL_PRECISION);
+ mpfr_init2 (temp2, MPFR_SMALL_PRECISION);
+
+ mpfr_set (temp1, x, MPFR_RNDN);
+ mpfr_set_si (temp2, MPFR_AI_THRESHOLD2, MPFR_RNDN);
+ mpfr_mul_ui (temp2, temp2, MPFR_PREC (y) > ULONG_MAX ?
+ ULONG_MAX : (unsigned long) MPFR_PREC (y), MPFR_RNDN);
+
+ if (MPFR_IS_NEG (x))
+ mpfr_mul_si (temp1, temp1, MPFR_AI_THRESHOLD1, MPFR_RNDN);
+ else
+ mpfr_mul_si (temp1, temp1, MPFR_AI_THRESHOLD3, MPFR_RNDN);
+
+ mpfr_add (temp1, temp1, temp2, MPFR_RNDN);
+ mpfr_clear (temp2);
+
+ use_ai2 = mpfr_cmp_si (temp1, MPFR_AI_SCALE) > 0;
+ mpfr_clear (temp1);
+
+ MPFR_SAVE_EXPO_FREE (expo); /* Ignore all previous exceptions. */
+
+ return use_ai2 ? mpfr_ai2 (y, x, rnd) : mpfr_ai1 (y, x, rnd);
+}
diff --git a/src/amd/amdfam10/mparam.h b/src/amd/amdfam10/mparam.h
new file mode 100644
index 0000000..b5b1d81
--- /dev/null
+++ b/src/amd/amdfam10/mparam.h
@@ -0,0 +1,236 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.6.1 */
+/* contributed by Jim Cloos <cloos at jhcloos dot com> with GMP 5.0.2 on a
+ "2009 or 2010 vintage phenom-II", where __amd64, __amd64__,
+ __k8, __k8__, __x86_64 and __x86_64__ are also defined.
+*/
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,9,10,11, \
+ 12,12,12,14,14,14,16,16,18,18,19,20,18,22,20,20, \
+ 20,20,20,20,22,22,22,24,28,28,28,28,28,28,32,32, \
+ 30,32,32,32,32,32,32,38,38,38,38,40,40,40,40,40, \
+ 40,40,44,44,48,48,44,46,48,48,56,56,56,56,56,56, \
+ 56,56,56,60,64,60,64,64,64,64,64,64,64,64,64,64, \
+ 60,64,64,72,64,64,72,72,64,64,64,72,80,72,80,76, \
+ 76,80,76,80,80,80,80,76,80,79,80,80,80,80,80,80, \
+ 81,80,86,93,90,87,93,93,93,93,92,93,93,92,93,92, \
+ 93,93,93,93,102,105,105,104,105,105,105,105,105,105,111,116, \
+ 111,110,111,117,117,111,114,116,117,117,117,117,117,116,116,117, \
+ 116,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117, \
+ 117,117,117,117,117,117,117,117,117,148,148,156,148,148,148,148, \
+ 148,156,156,156,155,156,156,156,156,156,156,156,156,156,155,156, \
+ 156,156,156,156,172,156,172,172,172,156,172,156,172,172,172,172, \
+ 172,172,172,172,172,172,172,180,172,180,172,172,172,188,188,172, \
+ 188,188,188,188,188,188,179,188,188,188,188,188,188,188,188,188, \
+ 188,220,220,220,220,188,220,220,220,220,220,220,220,220,220,220, \
+ 220,220,220,220,220,220,220,220,220,220,220,220,220,219,220,220, \
+ 220,220,220,220,236,220,220,220,252,252,236,252,252,252,252,236, \
+ 236,236,252,236,252,252,236,252,236,252,252,252,252,251,250,252, \
+ 252,252,252,252,252,252,252,252,252,252,252,252,251,252,252,251, \
+ 252,252,252,252,252,252,252,252,252,252,252,252,252,252,284,284, \
+ 252,284,284,284,284,284,284,284,284,284,284,284,284,284,283,284, \
+ 284,283,284,284,300,300,300,284,284,300,284,284,298,300,316,316, \
+ 300,284,300,316,300,316,300,284,316,316,316,316,300,316,300,316, \
+ 316,300,316,300,316,316,315,316,316,316,316,316,316,316,316,316, \
+ 316,316,316,316,313,316,316,316,316,316,316,316,320,316,320,368, \
+ 316,316,316,368,368,368,367,368,368,368,368,368,368,368,368,368, \
+ 367,367,368,368,368,368,368,368,368,368,368,368,368,368,368,368, \
+ 368,368,368,366,368,368,367,368,368,367,368,368,368,368,368,368, \
+ 367,366,367,368,368,367,368,368,368,368,368,368,368,368,368,368, \
+ 368,368,368,368,368,368,368,368,416,368,368,368,368,368,368,416, \
+ 368,416,415,416,416,368,416,416,416,415,415,416,416,416,416,416, \
+ 416,416,415,416,416,415,416,416,440,416,415,416,416,415,416,415, \
+ 416,416,416,474,415,416,416,415,416,416,416,416,416,416,474,474, \
+ 488,474,440,440,488,488,504,473,504,474,504,504,503,503,503,503, \
+ 503,504,501,504,504,503,474,474,503,504,504,503,504,488,488,488, \
+ 503,503,504,504,504,504,504,504,501,503,504,503,504,504,499,504, \
+ 504,503,504,504,504,504,503,504,504,504,488,504,504,504,474,504, \
+ 501,504,504,501,504,503,504,504,504,504,504,504,504,504,503,504, \
+ 504,503,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,503,568,568,568,504,504,504,504,568,504, \
+ 568,567,568,568,568,568,567,568,567,568,567,600,568,600,568,568, \
+ 568,568,568,567,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,567,568,568,568,568,568,568,568,568, \
+ 568,568,568,632,600,568,568,568,565,568,568,568,632,568,568,600, \
+ 600,631,600,632,600,632,632,600,600,632,600,600,632,600,600,600, \
+ 632,616,600,632,600,632,632,600,600,600,600,600,600,632,600,632, \
+ 632,616,632,632,632,616,632,632,632,627,631,629,632,632,631,632, \
+ 632,632,632,632,632,632,632,632,632,632,632,632,632,632,632,632, \
+ 632,632,632,632,687,629,688,632,632,632,632,632,632,632,632,632, \
+ 688,712,632,688,712,688,712,712,688,688,688,711,712,712,680,736, \
+ 712,712,712,688,688,712,712,712,712,712,712,728,712,736,736,711, \
+ 733,736,735,711,728,728,736,728,712,736,736,710,734,736,736,712, \
+ 712,736,712,712,719,728,712,712,712,734,733,726,736,736,736,735, \
+ 736,736,736,712,736,736,736,736,736,736,727,736,736,736,735,736, \
+ 731,736,736,736,736,736,736,736,733,712,736,736,736,736,736,712, \
+ 712,736,736,784,712,712,736,725,760,760,736,727,736,830,736,784, \
+ 728,736,727,783,832,736,734,830,736,736,831,736,736,830,829,832, \
+ 832,832,831,736,782,784,832,828,736,824,736,832,832,831,736,824, \
+ 824,832,832,832,832,832,832,825,832,832,832,824,832,832,832,828, \
+ 822,824,831,829,832,827,832,832,832,831,832,829,829,832,824,832, \
+ 830,832,832,832,832,832,830,832,832,832,832,828,855,832,830,830 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,-1,-1,-1,-1,-1,-1,7,8,9,8,9,9, \
+ 11,11,11,13,13,14,15,16,17,17,19,19,16,19,17,19, \
+ 19,18,19,19,21,21,21,23,23,25,25,23,25,25,25,25, \
+ 28,27,27,29,29,28,31,31,34,34,34,34,38,36,38,38, \
+ 42,42,42,42,42,42,44,46,42,46,44,50,46,50,42,50, \
+ 44,44,46,50,50,50,50,50,50,50,50,50,50,50,50,50, \
+ 52,50,54,54,54,54,56,56,56,56,58,56,56,58,58,60, \
+ 60,62,62,67,62,68,72,68,68,72,68,76,72,72,72,76, \
+ 76,76,76,76,84,72,84,76,76,76,84,76,76,84,84,84, \
+ 92,84,84,84,84,84,92,92,92,92,92,92,92,92,92,100, \
+ 92,92,100,100,92,100,100,100,100,100,100,92,100,100,92,100, \
+ 100,100,92,92,100,92,100,104,100,108,100,100,100,108,104,100, \
+ 100,104,100,108,108,108,112,108,112,112,112,123,112,123,112,135, \
+ 116,123,123,135,123,135,135,135,135,135,135,135,135,135,135,135, \
+ 135,135,147,135,135,135,135,147,147,147,147,147,147,147,147,147, \
+ 147,147,147,147,147,147,147,147,147,147,147,159,147,147,147,147, \
+ 165,147,147,159,153,147,147,147,165,159,147,147,165,153,147,159, \
+ 165,165,165,165,165,171,171,159,165,159,165,165,165,165,165,165, \
+ 171,165,171,171,165,177,171,171,189,183,171,165,165,165,183,165, \
+ 165,165,183,183,186,189,165,189,165,171,165,165,189,165,183,183, \
+ 183,189,183,201,201,189,189,183,189,183,195,189,189,189,183,213, \
+ 183,183,195,195,213,189,189,189,201,201,189,195,213,225,225,201, \
+ 201,213,213,195,213,201,225,225,225,225,225,224,225,225,213,225, \
+ 225,225,225,225,225,225,225,225,225,225,225,225,225,225,249,225, \
+ 249,249,248,225,249,249,249,249,249,249,225,249,249,248,249,249, \
+ 249,249,249,248,249,249,249,249,249,249,249,249,249,249,249,249, \
+ 249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249, \
+ 273,273,273,273,273,273,273,273,273,273,273,273,273,273,273,273, \
+ 273,273,273,273,273,273,273,273,273,273,297,297,297,297,297,296, \
+ 297,297,297,297,297,297,297,297,297,297,297,297,297,297,297,297, \
+ 297,297,297,297,297,297,297,297,297,273,273,273,273,273,273,296, \
+ 273,309,297,321,321,297,297,297,297,297,297,296,297,297,297,296, \
+ 297,296,297,297,297,297,297,297,297,297,297,297,297,297,309,297, \
+ 297,297,309,297,297,297,297,297,297,297,321,297,321,333,297,366, \
+ 333,333,333,366,333,296,333,333,333,297,333,333,333,297,297,321, \
+ 321,345,402,345,402,402,402,402,402,402,402,402,402,402,402,402, \
+ 401,401,402,402,402,402,402,402,402,402,402,402,401,402,402,401, \
+ 402,402,402,402,401,402,402,402,402,402,401,402,402,401,401,402, \
+ 401,401,393,402,402,438,401,402,402,401,401,402,401,402,402,402, \
+ 402,401,402,402,402,402,402,402,402,402,402,401,402,401,402,401, \
+ 402,402,400,402,402,402,402,402,402,402,438,438,438,438,438,438, \
+ 438,438,402,438,402,402,402,402,438,438,402,438,401,402,438,438, \
+ 438,438,438,438,438,438,401,437,438,402,401,402,438,401,402,402, \
+ 402,402,402,402,401,437,438,438,438,437,438,438,401,402,402,438, \
+ 438,438,402,402,402,402,401,402,402,437,438,438,438,438,438,438, \
+ 438,438,438,438,437,437,438,438,438,438,438,438,438,437,437,438, \
+ 437,438,438,438,438,402,438,402,438,438,438,438,438,438,437,438, \
+ 456,438,438,438,438,437,438,438,438,438,437,438,438,438,437,438, \
+ 438,438,438,473,437,456,438,438,438,438,438,437,438,438,438,438, \
+ 438,438,437,438,438,438,438,438,456,474,455,456,456,474,473,492, \
+ 456,474,456,474,474,474,474,474,536,512,474,512,474,536,474,474, \
+ 536,474,536,536,474,474,536,536,536,536,536,536,536,536,536,536, \
+ 536,534,536,536,536,535,536,536,536,536,535,536,536,536,536,536, \
+ 536,535,536,535,536,536,512,536,536,536,536,536,536,535,536,534, \
+ 535,584,536,536,536,534,535,536,536,536,536,536,536,536,536,534, \
+ 536,536,536,536,535,536,584,535,536,584,536,536,536,536,584,584, \
+ 584,584,536,584,584,584,584,584,584,584,583,584,582,584,584,584, \
+ 584,584,584,584,584,582,583,584,584,584,584,584,584,584,584,584, \
+ 584,583,584,584,696,584,584,583,584,584,696,726,696,584,584,584, \
+ 728,696,696,696,584,728,696,584,696,696,694,696,696,696,727,584, \
+ 695,694,584,696,696,695,728,696,696,696,696,696,694,696,727,695, \
+ 696,695,695,696,696,728,696,696,695,696,696,696,696,696,696,696, \
+ 727,696,696,696,696,695,696,728,727,696,695,727,696,726,727,726, \
+ 727,728,728,727,694,727,728,728,728,727,727,728,727,728,727,728 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,9,10,11,10,13,14,15, \
+ 14,15,18,19,18,14,15,18,18,18,19,17,18,19,18,19, \
+ 22,21,23,21,22,22,23,25,26,27,26,27,27,27,30,30, \
+ 30,34,30,34,32,33,34,31,30,34,37,34,38,38,38,38, \
+ 38,38,42,43,42,42,39,38,42,44,43,42,40,45,46,46, \
+ 46,45,46,43,44,50,48,48,48,46,53,51,50,50,50,50, \
+ 53,51,53,53,53,53,55,55,55,55,55,55,60,64,60,60, \
+ 62,63,64,65,60,64,68,72,64,68,68,64,64,68,72,66, \
+ 67,69,71,72,76,80,71,72,76,74,74,76,76,77,76,80, \
+ 79,84,84,84,78,84,88,88,92,84,80,92,92,80,88,84, \
+ 92,88,91,92,92,92,93,95,92,90,92,92,92,92,92,96, \
+ 96,96,92,92,92,92,96,96,102,96,95,110,96,96,100,100, \
+ 112,100,100,106,106,110,112,110,110,111,110,120,110,110,112,120, \
+ 110,120,120,120,112,120,128,128,128,128,124,128,128,120,128,128, \
+ 127,128,124,128,128,128,128,126,128,128,128,128,136,140,128,128, \
+ 128,128,136,144,128,128,144,144,128,144,144,144,144,128,152,152, \
+ 152,152,152,160,160,152,144,144,152,151,144,143,152,144,144,152, \
+ 152,144,152,152,152,152,151,152,160,158,144,160,160,160,160,160, \
+ 152,160,152,152,152,160,152,160,160,156,158,160,160,160,160,160, \
+ 160,160,160,160,168,160,160,160,160,160,159,160,160,160,176,176, \
+ 180,176,176,184,184,186,184,184,184,184,186,184,186,172,176,192, \
+ 184,184,184,184,185,176,176,185,184,185,186,183,184,184,181,191, \
+ 192,184,184,185,192,192,192,186,192,192,192,192,192,191,196,192, \
+ 192,192,192,192,196,190,192,192,200,192,198,220,222,204,200,222, \
+ 220,220,222,222,224,222,222,219,222,222,224,224,220,222,220,224, \
+ 220,221,222,220,232,222,221,232,222,220,224,232,220,232,222,232, \
+ 224,220,220,222,222,222,221,222,220,220,222,222,224,224,224,222, \
+ 220,224,224,232,224,222,222,232,224,222,223,224,224,224,231,232, \
+ 256,232,231,232,239,232,239,234,238,238,239,232,239,232,256,256, \
+ 288,288,248,256,256,256,256,256,256,239,255,256,256,256,256,256, \
+ 256,256,256,256,256,256,296,256,254,256,256,272,272,272,256,256, \
+ 288,272,256,256,280,296,288,280,288,288,296,280,288,288,288,294, \
+ 296,296,294,304,288,287,288,296,304,304,288,303,304,296,288,312, \
+ 312,312,312,288,288,312,288,288,312,320,305,288,320,320,288,312, \
+ 311,312,312,312,304,304,312,304,319,296,288,310,312,288,288,320, \
+ 304,304,304,288,300,312,309,304,304,311,288,296,296,320,312,311, \
+ 296,320,312,304,304,312,312,320,296,320,312,296,305,312,304,303, \
+ 304,312,303,312,304,311,312,312,320,312,311,320,320,320,320,320, \
+ 312,320,312,312,312,320,312,312,320,320,319,320,320,320,320,320, \
+ 320,320,320,320,320,320,320,320,320,320,320,320,320,320,352,336, \
+ 344,352,352,344,360,360,343,336,352,366,370,352,360,368,376,360, \
+ 360,360,367,368,360,352,371,360,368,368,372,352,352,352,352,352, \
+ 384,370,360,368,384,372,375,360,368,368,368,368,368,368,384,372, \
+ 352,372,352,368,366,376,352,367,384,368,360,368,360,384,371,376, \
+ 360,366,368,368,360,369,371,367,368,369,384,376,368,372,372,384, \
+ 440,368,376,384,372,376,440,440,376,440,368,369,384,370,440,440, \
+ 440,392,440,440,384,384,440,440,448,440,440,440,440,440,440,440, \
+ 440,440,384,440,439,440,384,384,440,440,440,440,440,440,439,448, \
+ 440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, \
+ 440,440,440,440,440,440,439,440,440,440,440,440,440,440,440,440, \
+ 440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,480, \
+ 440,440,440,440,468,480,440,440,440,440,440,464,440,440,440,440, \
+ 480,440,440,440,440,448,439,440,440,440,440,440,440,448,440,448, \
+ 512,439,440,448,440,440,440,438,440,440,440,440,496,440,465,440, \
+ 440,466,440,440,440,440,512,440,440,440,440,464,440,440,448,466, \
+ 512,496,512,512,512,448,512,447,448,468,472,448,480,464,480,512, \
+ 466,466,496,468,512,468,496,480,512,512,496,467,472,512,512,512, \
+ 512,468,512,512,512,512,512,478,512,472,512,512,512,496,512,512, \
+ 512,512,512,512,496,480,496,496,512,512,512,496,480,512,544,480, \
+ 576,512,512,576,512,512,512,576,512,512,496,496,512,480,576,576, \
+ 512,510,496,568,576,576,496,560,576,511,512,576,576,512,512,576, \
+ 560,496,576,512,512,512,512,512,512,576,576,512,512,576,512,512, \
+ 512,512,576,512,512,512,508,512,576,512,576,576,512,576,592,512, \
+ 568,512,576,568,576,576,576,512,576,576,592,576,592,512,608,576 \
+
+#define MPFR_MUL_THRESHOLD 17 /* limbs */
+#define MPFR_SQR_THRESHOLD 19 /* limbs */
+#define MPFR_DIV_THRESHOLD 28 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 1031 /* bits */
+#define MPFR_EXP_THRESHOLD 10625 /* bits */
+#define MPFR_SINCOS_THRESHOLD 26682 /* bits */
+#define MPFR_AI_THRESHOLD1 -11328 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 1045
+#define MPFR_AI_THRESHOLD3 17871
+/* Tuneup completed successfully, took 562 seconds */
diff --git a/src/amd/athlon/mparam.h b/src/amd/athlon/mparam.h
new file mode 100644
index 0000000..3a48522
--- /dev/null
+++ b/src/amd/athlon/mparam.h
@@ -0,0 +1,90 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,-1,0,-1,0,-1,-1,0,-1,-1,0,0,0,0,10, \
+ 0,12,13,14,15,16,0,0,0,0,0,19,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32, \
+ 30,32,30,34,32,32,36,34,36,36,38,38,42,38,38,42, \
+ 40,38,42,46,42,42,42,44,44,44,44,44,48,50,46,46, \
+ 60,50,50,48,50,56,56,56,56,56,56,56,60,60,64,60, \
+ 64,64,60,60,60,72,64,64,68,72,76,72,76,72,72,76, \
+ 75,76,76,72,76,72,75,72,72,72,84,76,84,75,72,76, \
+ 84,80,76,84,84,76,76,76,76,88,84,88,80,84,83,96, \
+ 84,96,92,84,88,91,92,88,92,90,96,96,92,91,92,96, \
+ 96,120,95,100,112,120,100,119,112,120,120,112,119,112,119,119, \
+ 120,118,119,119,119,118,119,120,128,127,120,128,128,120,120,127, \
+ 120,128,128,128,128,120,128,127,120,128,128,127,128,127,144,136, \
+ 128,144,152,152,152,136,144,144,144,136,151,152,144,152,128,151, \
+ 144,152,144,144,151,144,150,150,136,151,152,143,143,143,142,168, \
+ 144,144,168,151,168,144,152,151,152,152,160,152,151,152,160,151, \
+ 152,151,152,167,152,152,166,152,167,160,168,204,160,160,168,168, \
+ 204,176,202,167,168,166,167,168,204,184,202,204,204,204,204,192, \
+ 184,192,204,202,202,216,204,227,202,204,216,203,203,204,203,227, \
+ 202,204,202,202,202,203,202,215,204,202,203,202,202,215,228,214, \
+ 226,214,228,214,228,215,228,216,226,214,228,225,226,228,226,226, \
+ 226,215,216,216,226,225,226,227,216,227,240,216,252,252,226,227, \
+ 228,239,227,250,227,226,227,227,252,238,228,239,252,227,228,228, \
+ 252,226,246,228,227,227,252,247,250,263,262,250,252,250,250,252, \
+ 250,288,288,250,250,250,251,264,264,271,287,276,250,288,252,286, \
+ 251,287,288,251,276,274,288,262,263,263,282,252,288,252,276,284, \
+ 287,274,264,274,288,275,275,274,274,288,276,264,273,286,274,276, \
+ 300,287,288,286,286,276,288,285,275,300,275,273,275,299,300,299, \
+ 279,336,336,286,287,284,360,359,336,335,288,360,333,359,334,335, \
+ 335,287,359,335,336,336,359,333,334,359,360,288,360,332,335,336, \
+ 335,336,336,333,336,335,336,359,334,334,335,360,336,334,356,357, \
+ 335,336,358,359,359,336,335,336,334,355,384,356,354,384,334,357, \
+ 336,359,384,359,360,356,384,382,336,383,384,384,354,355,383,384, \
+ 382,359,384,382,382,383,383,359,381,382,383,356,384,382,381,384, \
+ 357,384,358,357,358,358,380,383,382,382,383,360,360,381,382,360, \
+ 377,360,378,360,360,381,382,383,381,380,383,383,360,382,383,380, \
+ 383,383,384,381,379,360,381,381,382,431,380,380,378,380,384,381, \
+ 382,382,384,407,384,382,379,384,430,431,383,384,408,384,456,431, \
+ 431,455,431,428,384,454,455,403,432,383,407,430,430,456,408,427, \
+ 455,455,456,455,432,431,431,429,455,432,432,424,430,427,427,429, \
+ 452,454,426,455,456,431,430,454,452,454,431,456,431,428,455,430, \
+ 454,430,432,455,454,442,443,432,443,431,451,452,456,430,451,456, \
+ 444,455,449,456,432,454,449,454,502,432,448,504,450,503,503,453, \
+ 454,502,446,452,453,454,455,499,504,453,456,504,454,453,503,455, \
+ 456,456,500,478,502,454,456,499,478,454,480,499,501,496,502,455, \
+ 499,502,503,456,478,500,501,500,479,503,504,451,452,479,454,455, \
+ 502,503,504,504,454,499,503,501,454,503,456,503,504,501,455,502, \
+ 503,503,502,504,610,503,504,574,480,551,528,504,609,576,480,503, \
+ 496,502,503,552,551,552,551,503,504,503,610,608,609,610,611,608, \
+ 608,551,648,611,612,550,576,572,608,611,610,606,608,611,610,574, \
+ 575,576,606,607,606,606,608,606,606,575,576,604,604,604,608,609, \
+ 606,606,606,608,604,604,611,604,604,576,610,606,610,606,604,610, \
+ 606,612,604,608,610,609,604,608,606,647,612,610,604,606,648,610, \
+ 610,606,646,608,604,647,606,647,606,609,610,647,648,609,641,611, \
+ 643,611,643,648,643,640,646,611,644,644,645,611,642,646,611,612, \
+ 640,647,610,611,610,611,606,647,648,647,648,644,682,642,682,683, \
+ 610,611,680,678,642,681,682,647,682,612,682,648,611,665,680,683, \
+ 609,646,666,676,680,646,679,647,646,646,648,679,684,611,612,643, \
+ 684,645,646,647,683,647,608,645,682,647,682,646,610,648,682,610, \
+ 684,612,612,683,684,647,647,646,680,646,646,745,648,646,644,647, \
+ 648,647,678,646,647,683,642,682,682,684,646,645,642,647,646,677, \
+ 646,647,683,678,680,646,646,643,681,647,683,645,666,755,756,645, \
+ 643,647,646,647,647,648,674,755,756,674,647,643,680,682,684,680, \
+ 680,682,682,675,682,677,666,683,680,682,682,684,680,681,674,674 \
+
+#define MPFR_MUL_THRESHOLD 19
+#define MPFR_EXP_2_THRESHOLD 411 /* bits */
+#define MPFR_EXP_THRESHOLD 45200 /* bits */
diff --git a/src/amd/k8/mparam.h b/src/amd/k8/mparam.h
new file mode 100644
index 0000000..4f6b348
--- /dev/null
+++ b/src/amd/k8/mparam.h
@@ -0,0 +1,236 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */
+/* gcc11.fsffrance.org (Dual-Core AMD Opteron(tm) Processor 2212)
+ with gmp 5.0.2.
+ Keith Briggs sent similar parameters obtained on a AMD Athlon
+ (__tune_k8__, __x86_64, __amd64, __k8) */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,11,11, \
+ 12,12,11,15,14,14,15,16,18,18,19,20,18,19,19,20, \
+ 22,22,23,24,26,30,28,28,32,30,30,32,32,30,32,32, \
+ 32,30,30,32,32,38,32,32,36,40,40,40,36,38,40,38, \
+ 40,44,40,44,44,44,44,48,48,46,48,48,56,56,56,56, \
+ 56,56,56,60,64,60,60,64,64,64,64,64,64,64,64,64, \
+ 72,72,72,72,72,72,72,72,72,72,72,72,80,80,80,80, \
+ 80,80,80,80,80,80,80,80,80,80,80,80,93,80,93,93, \
+ 93,76,80,93,80,93,93,90,93,93,93,93,93,93,93,93, \
+ 93,93,111,105,93,117,105,105,117,117,111,117,117,105,117,117, \
+ 117,105,117,117,117,117,117,117,117,117,117,117,117,117,117,117, \
+ 117,117,117,117,116,117,116,117,117,117,117,117,117,117,117,117, \
+ 117,117,140,117,140,140,140,140,140,148,148,147,140,156,156,156, \
+ 148,148,156,148,156,156,156,156,156,155,156,155,156,155,156,156, \
+ 156,156,156,156,156,156,156,156,172,172,172,156,172,172,172,172, \
+ 172,172,172,172,180,180,180,180,180,180,180,188,188,188,188,188, \
+ 180,188,188,188,188,187,188,188,188,188,188,188,188,188,188,188, \
+ 188,188,188,188,188,188,188,188,188,188,188,188,188,220,220,204, \
+ 220,220,220,219,220,220,220,220,220,219,220,219,220,219,220,220, \
+ 220,236,236,220,236,219,233,236,233,252,236,252,236,252,252,236, \
+ 235,236,236,252,252,236,236,252,252,236,252,252,236,251,250,251, \
+ 252,252,251,252,252,252,252,252,252,252,252,252,252,252,252,252, \
+ 252,252,284,252,284,284,284,284,284,252,284,284,284,284,284,284, \
+ 283,284,284,284,284,284,284,284,284,284,284,283,284,284,284,284, \
+ 284,284,283,284,284,284,284,284,284,284,284,284,284,300,284,300, \
+ 300,316,300,300,300,316,300,300,316,316,316,316,316,316,316,316, \
+ 316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, \
+ 316,315,316,316,315,316,316,316,315,316,316,316,316,316,316,316, \
+ 316,316,316,368,316,316,367,368,368,368,368,368,368,368,368,368, \
+ 368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,368, \
+ 368,368,368,368,368,368,367,368,368,368,368,367,368,367,367,368, \
+ 368,367,367,368,367,368,368,367,368,368,368,367,368,368,368,368, \
+ 367,368,416,415,416,416,416,416,416,416,415,416,416,416,416,416, \
+ 416,416,416,416,416,416,415,416,415,416,415,416,416,416,416,416, \
+ 416,415,416,416,415,416,416,415,416,416,440,416,416,416,440,416, \
+ 415,416,415,416,464,464,464,464,464,464,463,464,464,464,463,464, \
+ 464,464,464,464,464,463,464,464,474,474,464,464,473,474,474,504, \
+ 474,474,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,503,504,504,504,504,504,504, \
+ 503,504,504,504,504,504,503,504,504,504,504,504,503,504,504,503, \
+ 504,504,504,504,504,504,504,504,503,504,504,504,504,504,503,504, \
+ 504,504,504,504,568,568,568,504,568,568,568,568,568,568,568,568, \
+ 568,567,568,568,568,567,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,567,567,568,566,568,568,568,567, \
+ 568,568,568,568,568,568,568,568,568,568,567,568,568,567,568,568, \
+ 568,568,568,568,567,568,568,566,567,568,568,568,568,568,568,568, \
+ 568,567,568,568,567,568,567,568,567,568,567,568,567,568,632,568, \
+ 600,632,632,600,631,632,632,632,632,631,600,600,632,632,600,631, \
+ 632,632,632,632,632,632,631,632,632,632,631,632,631,632,632,632, \
+ 632,632,631,632,632,631,632,632,632,631,632,632,632,632,631,632, \
+ 632,632,632,632,630,632,632,632,632,632,631,632,631,632,631,632, \
+ 632,632,632,632,632,632,632,632,631,632,632,632,632,632,632,631, \
+ 632,632,632,631,632,632,632,736,632,631,632,736,632,632,632,632, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,734,736,736,735,736,736,735,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,735,736,736,736,736,736,736,736,735,736, \
+ 736,736,735,736,735,736,736,736,735,736,736,736,736,736,736,736, \
+ 736,736,736,735,736,736,736,735,736,736,736,736,736,735,736,736, \
+ 736,736,736,736,736,736,736,736,736,735,736,735,736,832,736,832, \
+ 832,832,832,832,831,832,832,831,832,832,832,832,832,832,831,832, \
+ 831,832,831,832,832,831,832,832,832,832,832,832,831,832,832,832, \
+ 831,832,832,832,832,832,831,832,832,832,832,832,831,832,831,832, \
+ 832,832,831,832,831,832,831,832,832,832,832,832,832,832,831,832 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,-1,-1,-1,-1,-1,7,7,8,9,9,11, \
+ 11,11,11,11,13,13,15,15,17,17,18,17,17,17,18,20, \
+ 20,21,23,23,20,21,23,23,24,25,23,23,24,25,26,25, \
+ 28,27,28,29,28,31,34,31,34,34,34,34,34,34,34,34, \
+ 40,34,40,36,40,42,40,42,40,40,42,42,48,48,46,46, \
+ 42,46,48,48,46,50,46,52,54,54,48,56,54,50,54,52, \
+ 50,54,54,52,54,54,58,58,62,64,58,58,58,64,62,64, \
+ 58,64,66,72,68,68,68,68,68,62,66,72,72,72,68,68, \
+ 72,72,68,72,72,72,72,72,80,84,80,80,80,84,80,80, \
+ 80,84,84,84,84,84,92,80,80,84,92,84,92,92,92,96, \
+ 100,92,100,92,96,92,92,96,100,100,96,96,96,100,100,96, \
+ 96,96,92,92,96,96,108,100,96,100,100,112,112,112,112,112, \
+ 112,112,108,112,100,104,112,116,104,116,116,108,112,112,112,116, \
+ 112,112,112,112,112,141,135,141,116,135,135,135,141,141,141,141, \
+ 141,141,141,141,141,141,135,135,141,141,147,141,141,141,140,141, \
+ 141,141,147,147,141,147,147,147,147,147,147,147,147,147,147,159, \
+ 153,147,147,159,159,159,159,159,159,159,159,159,165,171,171,171, \
+ 165,170,171,171,165,171,171,171,165,171,171,171,183,171,171,171, \
+ 183,183,171,183,171,183,183,183,183,183,183,183,189,189,183,195, \
+ 171,171,188,171,171,195,171,171,171,195,195,182,195,177,182,183, \
+ 183,181,182,183,183,189,183,194,195,195,194,195,195,195,195,195, \
+ 195,195,213,195,195,195,195,195,189,195,195,195,195,195,195,195, \
+ 212,195,213,195,195,195,213,195,195,195,195,195,195,213,213,201, \
+ 195,195,195,213,213,213,213,213,212,213,213,213,213,213,213,213, \
+ 237,212,213,213,213,213,213,225,213,213,213,249,213,249,237,237, \
+ 237,237,237,249,237,237,237,237,249,237,249,237,237,237,249,249, \
+ 249,236,237,249,249,249,249,249,249,249,249,249,249,249,249,249, \
+ 249,273,273,273,273,273,273,272,273,273,273,273,273,273,273,273, \
+ 273,273,273,273,273,273,273,285,273,284,285,285,285,285,297,284, \
+ 285,297,285,297,297,297,297,297,297,297,297,296,297,296,297,296, \
+ 297,297,297,297,297,297,297,273,297,273,309,273,273,273,273,320, \
+ 321,321,321,285,285,285,285,285,284,285,297,285,297,297,297,297, \
+ 297,297,333,297,297,297,296,297,309,297,297,297,297,285,309,348, \
+ 297,297,348,348,285,321,297,321,321,297,320,321,321,297,297,321, \
+ 297,321,333,366,333,333,309,333,333,333,332,333,297,321,321,321, \
+ 321,348,321,345,348,348,348,366,348,347,348,365,366,365,333,366, \
+ 402,366,333,366,366,366,366,402,366,365,366,366,366,366,366,366, \
+ 366,348,420,420,348,420,419,420,419,420,420,420,366,366,420,366, \
+ 366,365,366,402,366,366,366,366,402,402,402,401,402,402,402,401, \
+ 420,401,402,402,420,420,420,420,402,420,420,420,420,419,420,419, \
+ 420,419,420,420,402,401,420,402,402,420,402,420,402,401,420,420, \
+ 420,420,420,420,420,402,420,420,402,420,420,420,420,420,420,420, \
+ 420,420,420,420,420,420,420,420,420,419,420,420,438,420,420,438, \
+ 420,420,420,420,420,420,438,420,437,438,438,420,438,438,420,420, \
+ 438,420,420,438,438,420,420,420,438,420,420,420,420,419,420,420, \
+ 420,420,420,420,474,419,420,420,420,438,419,456,438,474,438,437, \
+ 438,438,438,438,438,420,438,420,438,438,438,420,420,419,420,420, \
+ 438,420,438,419,420,420,420,420,420,419,420,474,420,420,438,420, \
+ 438,473,474,474,474,473,438,474,474,438,438,437,438,438,438,438, \
+ 438,438,474,437,437,474,560,456,473,474,535,536,474,560,536,536, \
+ 560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560, \
+ 560,560,559,560,560,560,560,560,560,560,560,560,560,560,560,560, \
+ 559,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560, \
+ 560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560, \
+ 559,560,560,560,560,560,560,560,559,560,559,560,560,560,560,559, \
+ 559,560,559,560,560,560,560,560,560,559,560,560,559,560,559,560, \
+ 560,560,559,560,560,560,560,559,560,560,560,560,560,560,560,560, \
+ 560,560,560,560,560,560,560,560,560,560,559,584,560,560,560,560, \
+ 559,560,560,559,560,560,560,560,560,560,559,559,560,560,560,560, \
+ 560,560,559,560,560,560,560,560,560,583,560,560,584,560,584,584, \
+ 584,560,583,583,584,584,582,584,584,584,583,584,584,584,584,584, \
+ 727,584,728,632,728,560,727,728,728,560,584,560,560,727,728,728, \
+ 727,728,728,728,608,728,728,724,728,728,760,727,728,727,728,728, \
+ 728,759,728,696,728,728,728,728,728,727,759,760,727,760,760,727 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, \
+ 14,15,18,19,18,14,22,18,18,18,18,20,18,18,20,22, \
+ 22,22,23,24,26,26,26,28,24,30,28,28,28,30,30,32, \
+ 32,34,32,34,32,34,34,31,32,37,32,37,32,33,34,35, \
+ 39,37,37,39,39,37,39,39,39,39,39,39,43,44,46,46, \
+ 47,45,46,48,52,48,50,50,48,46,50,50,52,56,54,50, \
+ 60,60,60,56,56,64,61,60,56,64,60,64,64,64,64,60, \
+ 64,64,64,63,64,64,64,64,64,64,70,64,64,68,78,66, \
+ 74,69,70,74,70,69,74,78,78,74,74,74,74,78,78,79, \
+ 78,78,78,78,78,78,78,78,78,78,88,88,88,88,88,88, \
+ 92,92,88,91,92,88,95,96,96,96,96,92,92,88,92,112, \
+ 112,112,112,108,112,112,112,112,120,112,112,112,120,112,120,112, \
+ 112,120,120,120,104,112,112,128,112,112,112,120,112,112,120,120, \
+ 128,120,120,120,112,120,128,128,128,120,128,128,128,128,128,128, \
+ 128,128,120,128,128,128,128,128,120,128,128,128,128,128,128,128, \
+ 128,128,128,128,128,128,126,128,128,128,127,128,128,128,144,148, \
+ 136,136,144,144,140,141,140,148,148,151,144,148,148,160,156,148, \
+ 160,160,160,160,156,156,156,148,148,156,148,160,160,160,148,156, \
+ 148,148,148,156,156,156,156,160,156,156,158,156,156,157,160,156, \
+ 156,160,160,158,156,156,158,158,159,160,159,160,160,160,184,183, \
+ 184,184,180,184,184,176,184,184,184,184,186,184,184,184,184,184, \
+ 184,184,186,186,192,184,184,186,184,184,186,183,184,185,186,184, \
+ 184,184,186,185,216,184,192,186,208,192,192,184,208,216,224,209, \
+ 208,216,224,222,224,216,208,224,224,224,208,224,210,224,216,234, \
+ 208,216,216,208,224,216,216,224,224,222,224,224,224,216,224,224, \
+ 224,221,224,216,232,224,224,224,224,224,224,224,208,224,222,224, \
+ 224,224,216,224,232,224,224,216,224,256,224,256,224,248,224,224, \
+ 224,224,224,224,224,222,224,232,222,224,224,224,224,224,230,232, \
+ 256,234,232,240,240,233,240,233,248,240,240,240,240,238,240,256, \
+ 248,240,248,256,256,256,256,256,256,248,256,256,256,256,256,256, \
+ 256,256,256,256,256,256,248,256,248,256,248,248,256,256,256,256, \
+ 256,256,256,256,280,296,280,280,256,288,296,280,256,280,280,296, \
+ 296,296,280,280,280,296,296,296,280,280,280,296,280,296,295,312, \
+ 312,312,312,296,312,311,312,312,312,296,296,312,296,296,312,312, \
+ 312,296,312,312,296,311,312,312,312,312,312,312,312,312,312,296, \
+ 296,312,311,296,312,312,312,312,312,312,312,312,296,312,312,312, \
+ 312,312,312,312,312,312,312,312,296,312,312,312,312,312,312,312, \
+ 312,312,312,312,311,311,312,312,312,312,312,312,312,312,312,312, \
+ 312,312,312,312,312,312,312,312,312,312,312,312,312,312,320,316, \
+ 320,319,319,320,320,320,319,320,319,320,360,320,320,320,352,360, \
+ 368,352,368,368,369,372,344,370,372,366,369,352,370,370,370,360, \
+ 360,360,360,368,360,372,372,360,370,368,372,367,368,360,370,368, \
+ 372,371,370,372,372,372,371,368,368,368,370,370,368,368,368,372, \
+ 370,372,367,368,368,370,368,368,360,368,360,368,370,368,368,367, \
+ 360,368,368,368,372,368,372,368,368,368,372,371,368,416,368,367, \
+ 372,368,372,372,372,370,440,372,368,416,368,368,368,433,448,369, \
+ 440,416,415,416,440,448,440,440,448,448,440,448,440,440,448,416, \
+ 416,416,415,440,417,416,416,418,432,418,417,448,416,432,416,432, \
+ 416,420,440,448,408,416,432,448,416,448,448,448,440,440,440,440, \
+ 448,440,440,440,440,448,416,448,440,416,448,416,448,448,440,448, \
+ 416,440,416,419,417,448,416,420,416,432,433,420,417,432,416,424, \
+ 440,440,440,440,448,437,440,440,448,440,440,448,448,448,448,432, \
+ 480,440,440,440,448,448,448,448,448,448,440,448,445,432,448,448, \
+ 448,439,448,448,468,448,448,440,440,440,448,448,468,496,480,448, \
+ 440,448,440,468,440,496,440,466,448,448,448,468,448,440,448,448, \
+ 448,496,496,496,496,448,448,496,448,468,468,448,448,468,480,467, \
+ 468,512,496,512,512,496,496,480,512,480,496,512,512,512,496,512, \
+ 512,496,496,496,512,512,512,512,512,496,512,512,496,496,496,496, \
+ 512,512,496,512,496,496,496,496,512,512,512,496,480,496,496,496, \
+ 496,496,512,512,512,512,496,496,512,496,496,496,512,480,496,544, \
+ 512,496,496,496,576,512,496,560,496,496,512,561,496,560,496,560, \
+ 560,496,512,512,512,496,512,512,512,576,512,512,512,512,512,512, \
+ 512,512,512,512,560,512,560,512,576,512,576,592,512,560,591,512, \
+ 592,512,576,512,576,592,592,624,592,576,560,512,592,576,592,592 \
+
+#define MPFR_MUL_THRESHOLD 19 /* limbs */
+#define MPFR_SQR_THRESHOLD 18 /* limbs */
+#define MPFR_DIV_THRESHOLD 34 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 1031 /* bits */
+#define MPFR_EXP_THRESHOLD 11014 /* bits */
+#define MPFR_SINCOS_THRESHOLD 26907 /* bits */
+#define MPFR_AI_THRESHOLD1 -12404 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 1024
+#define MPFR_AI_THRESHOLD3 19611
+/* Tuneup completed successfully, took 759 seconds */
diff --git a/src/arm/mparam.h b/src/arm/mparam.h
new file mode 100644
index 0000000..d3037d5
--- /dev/null
+++ b/src/arm/mparam.h
@@ -0,0 +1,232 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2010-10-15, gcc 4.4.4 */
+/* gcc57.fsffrance.org (Feroceon 88FR131 rev 1 (v5l)) with gmp 5.0.1 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 62,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76, \
+ 76,76,76,84,84,84,88,88,88,92,88,92,92,92,92,92, \
+ 92,92,92,92,92,92,92,92,92,92,92,92,92,92,100,100, \
+ 104,108,104,108,108,108,108,108,108,108,108,108,108,108,108,108, \
+ 108,108,108,108,108,108,108,108,120,116,120,120,129,129,129,135, \
+ 135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135, \
+ 135,135,135,135,135,135,135,147,147,147,147,147,147,153,153,153, \
+ 159,159,159,159,159,159,159,159,159,159,159,159,159,159,159,159, \
+ 159,159,159,159,159,159,159,159,159,171,171,171,171,177,177,177, \
+ 183,177,183,183,183,183,183,183,183,183,183,183,183,183,183,183, \
+ 183,183,183,183,183,183,183,183,204,204,204,204,204,204,212,212, \
+ 212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212, \
+ 212,212,212,212,212,212,212,212,212,212,212,228,228,228,228,228, \
+ 228,228,236,236,236,236,236,244,244,244,244,244,244,244,244,244, \
+ 244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244, \
+ 244,244,244,244,260,260,244,244,243,244,244,244,244,244,244,244, \
+ 244,244,244,244,244,284,284,284,284,284,284,284,284,300,300,300, \
+ 300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300, \
+ 300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300, \
+ 300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300, \
+ 300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300, \
+ 300,332,332,332,332,332,332,332,332,332,332,332,332,332,332,348, \
+ 348,348,348,348,348,348,348,348,348,348,348,348,348,348,348,348, \
+ 348,364,364,364,364,364,364,364,348,364,364,364,364,348,364,364, \
+ 364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364, \
+ 364,364,364,364,364,364,364,364,366,364,364,364,364,364,364,364, \
+ 364,364,390,364,390,390,390,390,390,390,390,390,390,390,390,426, \
+ 426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, \
+ 426,426,426,426,426,426,426,450,426,450,450,450,450,450,450,450, \
+ 450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450, \
+ 450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450, \
+ 450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450, \
+ 450,450,450,450,474,450,474,498,498,498,498,498,498,498,498,498, \
+ 498,498,498,498,498,498,498,498,497,498,497,498,498,498,498,498, \
+ 498,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522, \
+ 522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522, \
+ 546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546, \
+ 546,546,546,546,545,546,568,568,568,546,568,568,568,568,568,568, \
+ 568,568,568,568,568,600,600,600,600,568,600,600,600,568,568,600, \
+ 600,600,600,600,600,600,600,598,600,600,600,600,600,600,600,600, \
+ 599,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,600,632,600,600,600,600, \
+ 632,632,600,600,632,632,600,632,664,664,664,664,664,664,664,664, \
+ 664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,664, \
+ 664,664,664,664,664,664,664,664,664,664,664,664,696,696,696,696, \
+ 696,696,696,696,696,696,696,696,696,696,696,696,696,696,696,696, \
+ 696,696,696,696,696,696,696,696,695,696,728,696,728,728,727,728, \
+ 728,728,728,728,728,727,728,728,727,728,728,728,728,728,727,728, \
+ 728,727,728,727,728,728,728,728,728,728,727,728,728,727,727,728, \
+ 728,727,728,728,728,728,727,728,728,728,728,728,728,728,728,728, \
+ 728,728,728,728,728,727,728,728,727,728,728,728,728,728,728,728, \
+ 728,728,728,727,727,728,728,728,728,727,728,728,728,728,728,728, \
+ 728,728,728,727,728,728,728,728,728,728,727,728,728,728,728,792, \
+ 792,792,792,792,728,728,760,760,760,728,792,792,760,792,792,760, \
+ 760,760,824,792,824,792,824,792,824,792,824,824,824,824,824,824, \
+ 823,824,824,824,792,792,824,792,824,792,792,792,824,824,792,856 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,12,12,13,13,14,14,15,15,16,16,17,17, \
+ 18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25, \
+ 26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33, \
+ 34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41, \
+ 42,42,43,43,44,44,47,45,46,46,47,47,48,48,49,49, \
+ 50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57, \
+ 58,58,59,59,60,60,61,61,62,62,63,63,64,64,67,65, \
+ 66,66,67,67,68,68,69,69,70,70,71,71,73,72,75,73, \
+ 74,74,75,77,76,76,82,77,82,82,82,82,82,82,82,82, \
+ 82,82,86,86,90,90,90,85,90,90,90,90,90,90,90,94, \
+ 90,94,98,94,98,98,98,98,98,98,98,98,98,98,98,102, \
+ 106,106,106,102,106,106,106,106,106,106,106,110,106,114,114,110, \
+ 110,114,114,114,114,114,114,118,114,114,114,118,122,122,122,118, \
+ 122,122,122,122,122,122,122,126,130,130,126,119,130,120,130,121, \
+ 122,122,123,123,124,124,125,125,126,126,127,128,128,128,130,130, \
+ 130,132,131,132,134,132,141,136,141,138,147,144,147,144,147,144, \
+ 147,150,147,150,153,150,153,156,153,156,159,156,159,156,147,145, \
+ 147,150,147,150,148,150,153,156,153,156,159,156,159,156,159,162, \
+ 159,162,159,162,159,162,165,168,165,168,165,168,171,174,171,174, \
+ 171,174,177,174,171,180,177,174,177,180,183,180,183,180,183,186, \
+ 183,186,183,186,183,180,189,180,195,180,183,180,183,180,183,186, \
+ 183,186,183,186,189,192,195,192,189,192,195,192,195,198,195,198, \
+ 195,198,195,198,201,204,201,204,207,204,207,204,207,210,207,210, \
+ 207,210,207,210,207,220,224,220,223,228,224,224,224,228,204,228, \
+ 204,228,232,228,204,228,232,236,232,236,240,236,240,240,240,244, \
+ 240,240,243,244,240,244,228,244,228,248,228,252,228,252,228,256, \
+ 228,256,236,256,236,240,240,239,244,240,240,240,240,243,244,248, \
+ 244,243,248,248,248,248,252,248,252,256,256,256,256,256,256,256, \
+ 256,256,260,259,260,264,260,264,260,267,268,272,268,272,276,248, \
+ 252,256,256,256,260,259,256,256,256,255,260,264,260,264,260,267, \
+ 260,267,272,272,264,272,272,272,272,272,276,272,276,272,276,275, \
+ 276,280,276,280,284,280,284,288,284,280,292,288,288,291,292,287, \
+ 288,288,292,296,292,291,292,308,308,304,300,308,300,308,308,308, \
+ 308,308,304,308,316,308,316,315,324,324,324,323,324,324,324,324, \
+ 324,323,324,323,324,328,324,323,324,323,336,336,342,336,342,336, \
+ 342,336,342,348,342,348,348,348,348,323,348,353,348,360,354,360, \
+ 360,360,360,360,354,360,366,360,360,360,366,360,366,360,366,372, \
+ 366,372,366,372,378,372,372,372,378,384,378,360,378,384,390,384, \
+ 384,384,384,384,384,384,384,384,390,396,366,372,372,372,372,372, \
+ 378,396,378,384,384,384,384,384,384,384,390,384,424,384,424,423, \
+ 424,423,424,423,424,423,424,432,424,432,424,432,432,432,424,432, \
+ 432,432,432,448,432,432,440,448,440,432,440,448,424,448,448,448, \
+ 448,448,448,432,424,432,432,432,456,432,432,432,432,432,432,432, \
+ 440,432,440,448,448,448,448,448,448,448,448,448,456,448,456,448, \
+ 456,448,456,464,456,464,456,464,464,464,464,464,472,464,464,464, \
+ 464,472,480,464,472,464,480,480,472,480,480,480,480,480,480,480, \
+ 480,480,480,480,488,480,488,464,488,487,496,496,504,496,488,496, \
+ 496,472,504,496,504,512,512,512,512,512,504,512,512,512,512,512, \
+ 512,512,512,512,512,512,512,496,520,488,496,496,496,496,496,496, \
+ 503,504,536,504,496,504,511,504,512,504,512,512,512,512,512,512, \
+ 544,512,512,512,544,528,552,520,528,520,528,520,528,528,528,520, \
+ 528,528,528,536,528,528,528,544,544,536,512,544,544,528,544,544, \
+ 544,552,512,552,512,520,512,520,519,520,528,528,528,528,560,520, \
+ 528,528,528,520,528,536,528,536,528,544,528,536,544,536,544,544, \
+ 544,552,544,552,544,544,544,544,544,544,544,544,560,552,551,560, \
+ 560,552,560,552,560,560,560,560,560,568,576,568,576,568,560,568, \
+ 576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,584, \
+ 576,592,592,584,592,584,592,592,592,544,592,592,592,544,608,600, \
+ 616,600,608,608,616,600,616,552,616,616,616,616,608,616,648,616, \
+ 616,616,648,632,648,632,576,664,631,632,648,632,648,632,648,648, \
+ 647,648,647,648,647,648,647,648,648,648,648,648,647,648,648,648, \
+ 648,648,648,648,648,664,648,648,648,664,616,664,663,664,663,664, \
+ 608,664,616,664,616,664,616,664,608,632,616,616,680,632,616,632 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, \
+ 16,17,18,17,18,17,13,16,16,16,19,18,19,19,20,20, \
+ 23,24,21,24,25,24,27,25,24,26,25,28,27,29,31,31, \
+ 29,31,32,32,32,33,29,34,33,33,34,37,32,36,37,37, \
+ 39,36,36,38,41,41,41,42,42,43,43,45,44,44,44,43, \
+ 45,45,48,44,47,48,47,52,47,49,51,52,49,52,53,49, \
+ 55,57,53,56,57,57,57,59,58,62,56,59,56,63,63,60, \
+ 58,65,64,66,64,60,67,67,62,68,66,66,67,69,65,71, \
+ 70,73,69,68,73,72,73,69,75,75,71,74,75,73,73,78, \
+ 76,75,77,81,80,80,77,77,81,84,85,84,84,80,81,86, \
+ 83,85,85,86,88,88,85,91,87,89,89,93,91,89,89,95, \
+ 96,95,91,91,92,92,96,93,99,99,96,96,97,96,101,100, \
+ 98,107,100,106,104,101,101,101,105,107,109,103,110,107,105,108, \
+ 106,109,111,112,114,109,116,109,116,114,113,117,116,114,115,113, \
+ 114,116,120,120,121,118,117,122,125,118,120,119,125,120,121,121, \
+ 125,125,123,124,125,125,125,125,127,126,127,128,128,131,129,129, \
+ 130,130,131,131,132,132,133,133,134,134,135,144,136,143,145,148, \
+ 143,144,152,152,152,148,149,152,152,152,151,149,160,152,152,152, \
+ 151,151,152,152,168,152,152,150,152,151,152,159,152,160,160,153, \
+ 167,176,159,160,168,160,159,168,167,167,167,168,175,160,178,166, \
+ 165,168,176,168,167,176,168,176,179,168,184,184,180,176,184,169, \
+ 175,175,182,174,175,176,183,184,184,176,192,178,184,183,182,183, \
+ 183,183,184,191,183,186,184,192,184,184,191,199,199,200,200,192, \
+ 192,192,200,208,199,197,200,202,207,208,208,198,210,208,199,209, \
+ 215,208,208,216,208,216,204,215,200,208,211,200,206,207,216,208, \
+ 202,207,208,208,216,208,208,207,214,209,216,216,212,208,218,215, \
+ 214,216,216,211,216,215,216,216,216,224,216,224,218,216,224,218, \
+ 230,224,224,238,222,232,224,226,236,222,228,232,232,238,240,240, \
+ 226,240,230,239,240,239,240,239,240,232,240,231,232,240,233,240, \
+ 240,239,238,240,240,240,246,258,240,238,239,239,240,255,241,258, \
+ 242,254,258,252,253,257,257,252,258,258,252,258,248,254,252,264, \
+ 263,257,262,266,256,266,253,258,264,258,258,270,266,262,258,257, \
+ 258,258,272,259,264,265,284,304,263,266,264,288,304,304,270,282, \
+ 300,304,288,288,288,294,288,292,302,300,286,304,302,288,300,304, \
+ 302,298,304,288,304,304,304,300,288,304,316,304,300,314,288,300, \
+ 312,302,304,304,306,302,303,300,304,304,311,304,316,300,336,318, \
+ 304,318,304,312,316,300,304,308,304,312,320,318,320,336,304,316, \
+ 299,336,318,318,318,304,340,336,320,304,304,336,324,348,305,316, \
+ 334,316,352,336,336,336,318,336,340,336,354,318,320,352,352,352, \
+ 318,336,328,318,352,336,358,330,342,360,366,366,350,334,348,336, \
+ 354,350,348,340,336,352,352,352,336,352,332,350,366,336,351,366, \
+ 352,366,352,352,352,336,336,348,353,336,351,366,366,360,366,346, \
+ 350,362,366,352,366,366,352,364,353,356,348,366,368,352,365,348, \
+ 353,366,350,366,352,352,364,372,354,352,372,352,362,352,368,365, \
+ 354,354,366,372,366,368,364,370,368,368,366,372,368,368,366,366, \
+ 368,405,374,364,366,384,372,366,366,368,367,390,368,400,372,400, \
+ 371,392,413,399,380,400,404,417,415,386,384,400,392,400,405,407, \
+ 399,421,408,400,406,408,415,421,416,400,419,415,406,416,412,408, \
+ 422,408,416,431,416,421,404,416,400,416,417,431,415,392,424,424, \
+ 415,432,421,416,432,432,408,399,415,416,400,424,422,408,420,431, \
+ 423,432,417,416,415,432,413,414,432,424,424,416,416,432,415,409, \
+ 416,424,416,430,415,431,423,432,423,424,424,420,416,431,417,436, \
+ 420,430,424,430,428,420,421,424,428,431,464,430,424,439,428,448, \
+ 432,431,432,433,436,440,464,469,468,453,431,440,448,440,449,463, \
+ 464,439,440,468,480,447,448,463,468,440,472,470,480,464,470,480, \
+ 464,471,471,464,479,460,464,461,488,478,468,480,479,464,488,463, \
+ 450,478,464,469,464,471,488,465,478,488,477,480,481,472,480,488, \
+ 496,468,480,479,488,480,488,469,463,488,480,480,464,477,480,481, \
+ 504,472,480,516,504,504,504,478,480,479,488,516,480,483,485,516, \
+ 488,488,488,516,504,488,481,484,480,516,512,528,504,480,532,503, \
+ 488,504,516,536,488,528,516,488,532,516,528,501,512,504,516,504, \
+ 528,492,520,516,516,504,525,496,516,520,516,512,520,532,528,516, \
+ 516,524,512,508,520,528,516,532,532,516,533,516,528,504,528,516, \
+ 532,576,532,515,516,600,528,517,516,600,600,532,516,600,600,524 \
+
+#define MPFR_MUL_THRESHOLD 16 /* limbs */
+#define MPFR_SQR_THRESHOLD 31 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 469 /* bits */
+#define MPFR_EXP_THRESHOLD 5484 /* bits */
+#define MPFR_SINCOS_THRESHOLD 23806 /* bits */
+#define MPFR_AI_THRESHOLD1 -24060 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 2314
+#define MPFR_AI_THRESHOLD3 40340
+/* Tuneup completed successfully, took 8148 seconds */
diff --git a/src/asin.c b/src/asin.c
new file mode 100644
index 0000000..e243dcd
--- /dev/null
+++ b/src/asin.c
@@ -0,0 +1,125 @@
+/* mpfr_asin -- arc-sinus of a floating-point number
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xp;
+ int compared, inexact;
+ mpfr_prec_t prec;
+ mpfr_exp_t xp_exp;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("asin[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (asin), mpfr_log_prec, asin,
+ inexact));
+
+ /* Special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (asin);
+ MPFR_RET_NAN;
+ }
+ else /* x = 0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (asin);
+ MPFR_SET_SAME_SIGN (asin, x);
+ MPFR_RET (0); /* exact result */
+ }
+ }
+
+ /* asin(x) = x + x^3/6 + ... so the error is < 2^(3*EXP(x)-2) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (asin, x, -2 * MPFR_GET_EXP (x), 2, 1,
+ rnd_mode, {});
+
+ /* Set x_p=|x| (x is a normal number) */
+ mpfr_init2 (xp, MPFR_PREC (x));
+ inexact = mpfr_abs (xp, x, MPFR_RNDN);
+ MPFR_ASSERTD (inexact == 0);
+
+ compared = mpfr_cmp_ui (xp, 1);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ if (MPFR_UNLIKELY (compared >= 0))
+ {
+ mpfr_clear (xp);
+ if (compared > 0) /* asin(x) = NaN for |x| > 1 */
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ MPFR_SET_NAN (asin);
+ MPFR_RET_NAN;
+ }
+ else /* x = 1 or x = -1 */
+ {
+ if (MPFR_IS_POS (x)) /* asin(+1) = Pi/2 */
+ inexact = mpfr_const_pi (asin, rnd_mode);
+ else /* asin(-1) = -Pi/2 */
+ {
+ inexact = -mpfr_const_pi (asin, MPFR_INVERT_RND(rnd_mode));
+ MPFR_CHANGE_SIGN (asin);
+ }
+ mpfr_div_2ui (asin, asin, 1, rnd_mode);
+ }
+ }
+ else
+ {
+ /* Compute exponent of 1 - ABS(x) */
+ mpfr_ui_sub (xp, 1, xp, MPFR_RNDD);
+ MPFR_ASSERTD (MPFR_GET_EXP (xp) <= 0);
+ MPFR_ASSERTD (MPFR_GET_EXP (x) <= 0);
+ xp_exp = 2 - MPFR_GET_EXP (xp);
+
+ /* Set up initial prec */
+ prec = MPFR_PREC (asin) + 10 + xp_exp;
+
+ /* use asin(x) = atan(x/sqrt(1-x^2)) */
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ mpfr_set_prec (xp, prec);
+ mpfr_sqr (xp, x, MPFR_RNDN);
+ mpfr_ui_sub (xp, 1, xp, MPFR_RNDN);
+ mpfr_sqrt (xp, xp, MPFR_RNDN);
+ mpfr_div (xp, x, xp, MPFR_RNDN);
+ mpfr_atan (xp, xp, MPFR_RNDN);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (xp, prec - xp_exp,
+ MPFR_PREC (asin), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (asin, xp, rnd_mode);
+
+ mpfr_clear (xp);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (asin, inexact, rnd_mode);
+}
diff --git a/src/asinh.c b/src/asinh.c
new file mode 100644
index 0000000..2741bf9
--- /dev/null
+++ b/src/asinh.c
@@ -0,0 +1,119 @@
+/* mpfr_asinh -- inverse hyperbolic sine
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of asinh is done by *
+ * asinh = ln(x + sqrt(x^2 + 1)) */
+
+int
+mpfr_asinh (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ int signx, neg;
+ mpfr_prec_t Ny, Nt;
+ mpfr_t t; /* auxiliary variables */
+ mpfr_exp_t err;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ else /* x is necessarily 0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y); /* asinh(0) = 0 */
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ /* asinh(x) = x - x^3/6 + ... so the error is < 2^(3*EXP(x)-2) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2 * MPFR_GET_EXP (x), 2, 0,
+ rnd_mode, {});
+
+ Ny = MPFR_PREC (y); /* Precision of output variable */
+
+ signx = MPFR_SIGN (x);
+ neg = MPFR_IS_NEG (x);
+
+ /* General case */
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + 4 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* initialize intermediary variables */
+ mpfr_init2 (t, Nt);
+
+ /* First computation of asinh */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute asinh */
+ mpfr_mul (t, x, x, MPFR_RNDD); /* x^2 */
+ mpfr_add_ui (t, t, 1, MPFR_RNDD); /* x^2+1 */
+ mpfr_sqrt (t, t, MPFR_RNDN); /* sqrt(x^2+1) */
+ (neg ? mpfr_sub : mpfr_add) (t, t, x, MPFR_RNDN); /* sqrt(x^2+1)+x */
+ mpfr_log (t, t, MPFR_RNDN); /* ln(sqrt(x^2+1)+x)*/
+
+ if (MPFR_LIKELY (MPFR_IS_PURE_FP (t)))
+ {
+ /* error estimate -- see algorithms.tex */
+ err = Nt - (MAX (4 - MPFR_GET_EXP (t), 0) + 1);
+ if (MPFR_LIKELY (MPFR_IS_ZERO (t)
+ || MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ break;
+ }
+
+ /* actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set4 (y, t, rnd_mode, signx);
+
+ mpfr_clear (t);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/atan.c b/src/atan.c
new file mode 100644
index 0000000..45e8e75
--- /dev/null
+++ b/src/atan.c
@@ -0,0 +1,437 @@
+/* mpfr_atan -- arc-tangent of a floating-point number
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* If x = p/2^r, put in y an approximation of atan(x)/x using 2^m terms
+ for the series expansion, with an error of at most 1 ulp.
+ Assumes |x| < 1.
+
+ If X=x^2, we want 1 - X/3 + X^2/5 - ... + (-1)^k*X^k/(2k+1) + ...
+
+ Assume p is non-zero.
+
+ When we sum terms up to x^k/(2k+1), the denominator Q[0] is
+ 3*5*7*...*(2k+1) ~ (2k/e)^k.
+*/
+static void
+mpfr_atan_aux (mpfr_ptr y, mpz_ptr p, long r, int m, mpz_t *tab)
+{
+ mpz_t *S, *Q, *ptoj;
+ unsigned long n, i, k, j, l;
+ mpfr_exp_t diff, expo;
+ int im, done;
+ mpfr_prec_t mult, *accu, *log2_nb_terms;
+ mpfr_prec_t precy = MPFR_PREC(y);
+
+ MPFR_ASSERTD(mpz_cmp_ui (p, 0) != 0);
+
+ accu = (mpfr_prec_t*) (*__gmp_allocate_func) ((2 * m + 2) * sizeof (mpfr_prec_t));
+ log2_nb_terms = accu + m + 1;
+
+ /* Set Tables */
+ S = tab; /* S */
+ ptoj = S + 1*(m+1); /* p^2^j Precomputed table */
+ Q = S + 2*(m+1); /* Product of Odd integer table */
+
+ /* From p to p^2, and r to 2r */
+ mpz_mul (p, p, p);
+ MPFR_ASSERTD (2 * r > r);
+ r = 2 * r;
+
+ /* Normalize p */
+ n = mpz_scan1 (p, 0);
+ mpz_tdiv_q_2exp (p, p, n); /* exact */
+ MPFR_ASSERTD (r > n);
+ r -= n;
+ /* since |p/2^r| < 1, and p is a non-zero integer, necessarily r > 0 */
+
+ MPFR_ASSERTD (mpz_sgn (p) > 0);
+ MPFR_ASSERTD (m > 0);
+
+ /* check if p=1 (special case) */
+ l = 0;
+ /*
+ We compute by binary splitting, with X = x^2 = p/2^r:
+ P(a,b) = p if a+1=b, P(a,c)*P(c,b) otherwise
+ Q(a,b) = (2a+1)*2^r if a+1=b [except Q(0,1)=1], Q(a,c)*Q(c,b) otherwise
+ S(a,b) = p*(2a+1) if a+1=b, Q(c,b)*S(a,c)+Q(a,c)*P(a,c)*S(c,b) otherwise
+ Then atan(x)/x ~ S(0,i)/Q(0,i) for i so that (p/2^r)^i/i is small enough.
+ The factor 2^(r*(b-a)) in Q(a,b) is implicit, thus we have to take it
+ into account when we compute with Q.
+ */
+ accu[0] = 0; /* accu[k] = Mult[0] + ... + Mult[k], where Mult[j] is the
+ number of bits of the corresponding term S[j]/Q[j] */
+ if (mpz_cmp_ui (p, 1) != 0)
+ {
+ /* p <> 1: precompute ptoj table */
+ mpz_set (ptoj[0], p);
+ for (im = 1 ; im <= m ; im ++)
+ mpz_mul (ptoj[im], ptoj[im - 1], ptoj[im - 1]);
+ /* main loop */
+ n = 1UL << m;
+ /* the ith term being X^i/(2i+1) with X=p/2^r, we can stop when
+ p^i/2^(r*i) < 2^(-precy), i.e. r*i > precy + log2(p^i) */
+ for (i = k = done = 0; (i < n) && (done == 0); i += 2, k ++)
+ {
+ /* initialize both S[k],Q[k] and S[k+1],Q[k+1] */
+ mpz_set_ui (Q[k+1], 2 * i + 3); /* Q(i+1,i+2) */
+ mpz_mul_ui (S[k+1], p, 2 * i + 1); /* S(i+1,i+2) */
+ mpz_mul_2exp (S[k], Q[k+1], r);
+ mpz_sub (S[k], S[k], S[k+1]); /* S(i,i+2) */
+ mpz_mul_ui (Q[k], Q[k+1], 2 * i + 1); /* Q(i,i+2) */
+ log2_nb_terms[k] = 1; /* S[k]/Q[k] corresponds to 2 terms */
+ for (j = (i + 2) >> 1, l = 1; (j & 1) == 0; l ++, j >>= 1, k --)
+ {
+ /* invariant: S[k-1]/Q[k-1] and S[k]/Q[k] correspond
+ to 2^l terms each. We combine them into S[k-1]/Q[k-1] */
+ MPFR_ASSERTD (k > 0);
+ mpz_mul (S[k], S[k], Q[k-1]);
+ mpz_mul (S[k], S[k], ptoj[l]);
+ mpz_mul (S[k-1], S[k-1], Q[k]);
+ mpz_mul_2exp (S[k-1], S[k-1], r << l);
+ mpz_add (S[k-1], S[k-1], S[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ log2_nb_terms[k-1] = l + 1;
+ /* now S[k-1]/Q[k-1] corresponds to 2^(l+1) terms */
+ MPFR_MPZ_SIZEINBASE2(mult, ptoj[l+1]);
+ /* FIXME: precompute bits(ptoj[l+1]) outside the loop? */
+ mult = (r << (l + 1)) - mult - 1;
+ accu[k-1] = (k == 1) ? mult : accu[k-2] + mult;
+ if (accu[k-1] > precy)
+ done = 1;
+ }
+ }
+ }
+ else /* special case p=1: the ith term being X^i/(2i+1) with X=1/2^r,
+ we can stop when r*i > precy i.e. i > precy/r */
+ {
+ n = 1UL << m;
+ for (i = k = 0; (i < n) && (i <= precy / r); i += 2, k ++)
+ {
+ mpz_set_ui (Q[k + 1], 2 * i + 3);
+ mpz_mul_2exp (S[k], Q[k+1], r);
+ mpz_sub_ui (S[k], S[k], 1 + 2 * i);
+ mpz_mul_ui (Q[k], Q[k + 1], 1 + 2 * i);
+ log2_nb_terms[k] = 1; /* S[k]/Q[k] corresponds to 2 terms */
+ for (j = (i + 2) >> 1, l = 1; (j & 1) == 0; l++, j >>= 1, k --)
+ {
+ MPFR_ASSERTD (k > 0);
+ mpz_mul (S[k], S[k], Q[k-1]);
+ mpz_mul (S[k-1], S[k-1], Q[k]);
+ mpz_mul_2exp (S[k-1], S[k-1], r << l);
+ mpz_add (S[k-1], S[k-1], S[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ log2_nb_terms[k-1] = l + 1;
+ }
+ }
+ }
+
+ /* we need to combine S[0]/Q[0]...S[k-1]/Q[k-1] */
+ l = 0; /* number of terms accumulated in S[k]/Q[k] */
+ while (k > 1)
+ {
+ k --;
+ /* combine S[k-1]/Q[k-1] and S[k]/Q[k] */
+ j = log2_nb_terms[k-1];
+ mpz_mul (S[k], S[k], Q[k-1]);
+ if (mpz_cmp_ui (p, 1) != 0)
+ mpz_mul (S[k], S[k], ptoj[j]);
+ mpz_mul (S[k-1], S[k-1], Q[k]);
+ l += 1 << log2_nb_terms[k];
+ mpz_mul_2exp (S[k-1], S[k-1], r * l);
+ mpz_add (S[k-1], S[k-1], S[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ }
+ (*__gmp_free_func) (accu, (2 * m + 2) * sizeof (mpfr_prec_t));
+
+ MPFR_MPZ_SIZEINBASE2 (diff, S[0]);
+ diff -= 2 * precy;
+ expo = diff;
+ if (diff >= 0)
+ mpz_tdiv_q_2exp (S[0], S[0], diff);
+ else
+ mpz_mul_2exp (S[0], S[0], -diff);
+
+ MPFR_MPZ_SIZEINBASE2 (diff, Q[0]);
+ diff -= precy;
+ expo -= diff;
+ if (diff >= 0)
+ mpz_tdiv_q_2exp (Q[0], Q[0], diff);
+ else
+ mpz_mul_2exp (Q[0], Q[0], -diff);
+
+ mpz_tdiv_q (S[0], S[0], Q[0]);
+ mpfr_set_z (y, S[0], MPFR_RNDD);
+ MPFR_SET_EXP (y, MPFR_EXP(y) + expo - r * (i - 1));
+}
+
+int
+mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xp, arctgt, sk, tmp, tmp2;
+ mpz_t ukz;
+ mpz_t *tabz;
+ mpfr_exp_t exptol;
+ mpfr_prec_t prec, realprec, est_lost, lost;
+ unsigned long twopoweri, log2p, red;
+ int comparaison, inexact;
+ int i, n0, oldn0;
+ MPFR_GROUP_DECL (group);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("atan[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (atan), mpfr_log_prec, atan, inexact));
+
+ /* Singular cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (atan);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ MPFR_SAVE_EXPO_MARK (expo);
+ if (MPFR_IS_POS (x)) /* arctan(+inf) = Pi/2 */
+ inexact = mpfr_const_pi (atan, rnd_mode);
+ else /* arctan(-inf) = -Pi/2 */
+ {
+ inexact = -mpfr_const_pi (atan,
+ MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (atan);
+ }
+ mpfr_div_2ui (atan, atan, 1, rnd_mode); /* exact (no exceptions) */
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (atan, inexact, rnd_mode);
+ }
+ else /* x is necessarily 0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (atan);
+ MPFR_SET_SAME_SIGN (atan, x);
+ MPFR_RET (0);
+ }
+ }
+
+ /* atan(x) = x - x^3/3 + x^5/5...
+ so the error is < 2^(3*EXP(x)-1)
+ so `EXP(x)-(3*EXP(x)-1)` = -2*EXP(x)+1 */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (atan, x, -2 * MPFR_GET_EXP (x), 1, 0,
+ rnd_mode, {});
+
+ /* Set x_p=|x| */
+ MPFR_TMP_INIT_ABS (xp, x);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Other simple case arctan(-+1)=-+pi/4 */
+ comparaison = mpfr_cmp_ui (xp, 1);
+ if (MPFR_UNLIKELY (comparaison == 0))
+ {
+ int neg = MPFR_IS_NEG (x);
+ inexact = mpfr_const_pi (atan, MPFR_IS_POS (x) ? rnd_mode
+ : MPFR_INVERT_RND (rnd_mode));
+ if (neg)
+ {
+ inexact = -inexact;
+ MPFR_CHANGE_SIGN (atan);
+ }
+ mpfr_div_2ui (atan, atan, 2, rnd_mode); /* exact (no exceptions) */
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (atan, inexact, rnd_mode);
+ }
+
+ realprec = MPFR_PREC (atan) + MPFR_INT_CEIL_LOG2 (MPFR_PREC (atan)) + 4;
+ prec = realprec + GMP_NUMB_BITS;
+
+ /* Initialisation */
+ mpz_init (ukz);
+ MPFR_GROUP_INIT_4 (group, prec, sk, tmp, tmp2, arctgt);
+ oldn0 = 0;
+ tabz = (mpz_t *) 0;
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ /* First, if |x| < 1, we need to have more prec to be able to round (sup)
+ n0 = ceil(log(prec_requested + 2 + 1+ln(2.4)/ln(2))/log(2)) */
+ mpfr_prec_t sup;
+ sup = MPFR_GET_EXP (xp) < 0 ? 2 - MPFR_GET_EXP (xp) : 1; /* sup >= 1 */
+
+ n0 = MPFR_INT_CEIL_LOG2 ((realprec + sup) + 3);
+ /* since realprec >= 4, n0 >= ceil(log2(8)) >= 3, thus 3*n0 > 2 */
+ prec = (realprec + sup) + 1 + MPFR_INT_CEIL_LOG2 (3*n0-2);
+
+ /* the number of lost bits due to argument reduction is
+ 9 - 2 * EXP(sk), which we estimate by 9 + 2*ceil(log2(p))
+ since we manage that sk < 1/p */
+ if (MPFR_PREC (atan) > 100)
+ {
+ log2p = MPFR_INT_CEIL_LOG2(prec) / 2 - 3;
+ est_lost = 9 + 2 * log2p;
+ prec += est_lost;
+ }
+ else
+ log2p = est_lost = 0; /* don't reduce the argument */
+
+ /* Initialisation */
+ MPFR_GROUP_REPREC_4 (group, prec, sk, tmp, tmp2, arctgt);
+ if (MPFR_LIKELY (oldn0 == 0))
+ {
+ oldn0 = 3 * (n0 + 1);
+ tabz = (mpz_t *) (*__gmp_allocate_func) (oldn0 * sizeof (mpz_t));
+ for (i = 0; i < oldn0; i++)
+ mpz_init (tabz[i]);
+ }
+ else if (MPFR_UNLIKELY (oldn0 < 3 * (n0 + 1)))
+ {
+ tabz = (mpz_t *) (*__gmp_reallocate_func)
+ (tabz, oldn0 * sizeof (mpz_t), 3 * (n0 + 1)*sizeof (mpz_t));
+ for (i = oldn0; i < 3 * (n0 + 1); i++)
+ mpz_init (tabz[i]);
+ oldn0 = 3 * (n0 + 1);
+ }
+
+ /* The mpfr_ui_div below mustn't underflow. This is guaranteed by
+ MPFR_SAVE_EXPO_MARK, but let's check that for maintainability. */
+ MPFR_ASSERTD (__gmpfr_emax <= 1 - __gmpfr_emin);
+
+ if (comparaison > 0) /* use atan(xp) = Pi/2 - atan(1/xp) */
+ mpfr_ui_div (sk, 1, xp, MPFR_RNDN);
+ else
+ mpfr_set (sk, xp, MPFR_RNDN);
+
+ /* now 0 < sk <= 1 */
+
+ /* Argument reduction: atan(x) = 2 atan((sqrt(1+x^2)-1)/x).
+ We want |sk| < k/sqrt(p) where p is the target precision. */
+ lost = 0;
+ for (red = 0; MPFR_GET_EXP(sk) > - (mpfr_exp_t) log2p; red ++)
+ {
+ lost = 9 - 2 * MPFR_EXP(sk);
+ mpfr_mul (tmp, sk, sk, MPFR_RNDN);
+ mpfr_add_ui (tmp, tmp, 1, MPFR_RNDN);
+ mpfr_sqrt (tmp, tmp, MPFR_RNDN);
+ mpfr_sub_ui (tmp, tmp, 1, MPFR_RNDN);
+ if (red == 0 && comparaison > 0)
+ /* use xp = 1/sk */
+ mpfr_mul (sk, tmp, xp, MPFR_RNDN);
+ else
+ mpfr_div (sk, tmp, sk, MPFR_RNDN);
+ }
+
+ /* we started from x0 = 1/|x| if |x| > 1, and |x| otherwise, thus
+ we had x0 = min(|x|, 1/|x|) <= 1, and applied 'red' times the
+ argument reduction x -> (sqrt(1+x^2)-1)/x, which keeps 0 < x < 1,
+ thus 0 < sk <= 1, and sk=1 can occur only if red=0 */
+
+ /* If sk=1, then if |x| < 1, we have 1 - 2^(-prec-1) <= |x| < 1,
+ or if |x| > 1, we have 1 - 2^(-prec-1) <= 1/|x| < 1, thus in all
+ cases ||x| - 1| <= 2^(-prec), from which it follows
+ |atan|x| - Pi/4| <= 2^(-prec), given the Taylor expansion
+ atan(1+x) = Pi/4 + x/2 - x^2/4 + ...
+ Since Pi/4 = 0.785..., the error is at most one ulp.
+ */
+ if (MPFR_UNLIKELY(mpfr_cmp_ui (sk, 1) == 0))
+ {
+ mpfr_const_pi (arctgt, MPFR_RNDN); /* 1/2 ulp extra error */
+ mpfr_div_2ui (arctgt, arctgt, 2, MPFR_RNDN); /* exact */
+ realprec = prec - 2;
+ goto can_round;
+ }
+
+ /* Assignation */
+ MPFR_SET_ZERO (arctgt);
+ twopoweri = 1 << 0;
+ MPFR_ASSERTD (n0 >= 4);
+ for (i = 0 ; i < n0; i++)
+ {
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (sk)))
+ break;
+ /* Calculation of trunc(tmp) --> mpz */
+ mpfr_mul_2ui (tmp, sk, twopoweri, MPFR_RNDN);
+ mpfr_trunc (tmp, tmp);
+ if (!MPFR_IS_ZERO (tmp))
+ {
+ /* tmp = ukz*2^exptol */
+ exptol = mpfr_get_z_2exp (ukz, tmp);
+ /* since the s_k are decreasing (see algorithms.tex),
+ and s_0 = min(|x|, 1/|x|) < 1, we have sk < 1,
+ thus exptol < 0 */
+ MPFR_ASSERTD (exptol < 0);
+ mpz_tdiv_q_2exp (ukz, ukz, (unsigned long int) (-exptol));
+ /* since tmp is a non-zero integer, and tmp = ukzold*2^exptol,
+ we now have ukz = tmp, thus ukz is non-zero */
+ /* Calculation of arctan(Ak) */
+ mpfr_set_z (tmp, ukz, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, twopoweri, MPFR_RNDN);
+ mpfr_atan_aux (tmp2, ukz, twopoweri, n0 - i, tabz);
+ mpfr_mul (tmp2, tmp2, tmp, MPFR_RNDN);
+ /* Addition */
+ mpfr_add (arctgt, arctgt, tmp2, MPFR_RNDN);
+ /* Next iteration */
+ mpfr_sub (tmp2, sk, tmp, MPFR_RNDN);
+ mpfr_mul (sk, sk, tmp, MPFR_RNDN);
+ mpfr_add_ui (sk, sk, 1, MPFR_RNDN);
+ mpfr_div (sk, tmp2, sk, MPFR_RNDN);
+ }
+ twopoweri <<= 1;
+ }
+ /* Add last step (Arctan(sk) ~= sk */
+ mpfr_add (arctgt, arctgt, sk, MPFR_RNDN);
+
+ /* argument reduction */
+ mpfr_mul_2exp (arctgt, arctgt, red, MPFR_RNDN);
+
+ if (comparaison > 0)
+ { /* atan(x) = Pi/2-atan(1/x) for x > 0 */
+ mpfr_const_pi (tmp, MPFR_RNDN);
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN);
+ mpfr_sub (arctgt, tmp, arctgt, MPFR_RNDN);
+ }
+ MPFR_SET_POS (arctgt);
+
+ can_round:
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (arctgt, realprec + est_lost - lost,
+ MPFR_PREC (atan), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, realprec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set4 (atan, arctgt, rnd_mode, MPFR_SIGN (x));
+
+ for (i = 0 ; i < oldn0 ; i++)
+ mpz_clear (tabz[i]);
+ mpz_clear (ukz);
+ (*__gmp_free_func) (tabz, oldn0 * sizeof (mpz_t));
+ MPFR_GROUP_CLEAR (group);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (atan, inexact, rnd_mode);
+}
diff --git a/src/atan2.c b/src/atan2.c
new file mode 100644
index 0000000..8631bee
--- /dev/null
+++ b/src/atan2.c
@@ -0,0 +1,281 @@
+/* mpfr_atan2 -- arc-tan 2 of a floating-point number
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+static int
+pi_div_2ui (mpfr_ptr dest, int i, int neg, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ if (neg) /* -PI/2^i */
+ {
+ inexact = - mpfr_const_pi (dest, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (dest);
+ }
+ else /* PI/2^i */
+ {
+ inexact = mpfr_const_pi (dest, rnd_mode);
+ }
+ mpfr_div_2ui (dest, dest, i, rnd_mode); /* exact */
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (dest, inexact, rnd_mode);
+}
+
+int
+mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmp, pi;
+ int inexact;
+ mpfr_prec_t prec;
+ mpfr_exp_t e;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("y[%Pu]=%.*Rg x[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y,
+ mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("atan[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (dest), mpfr_log_prec, dest, inexact));
+
+ /* Special cases */
+ if (MPFR_ARE_SINGULAR (x, y))
+ {
+ /* atan2(0, 0) does not raise the "invalid" floating-point
+ exception, nor does atan2(y, 0) raise the "divide-by-zero"
+ floating-point exception.
+ -- atan2(±0, -0) returns ±pi.313)
+ -- atan2(±0, +0) returns ±0.
+ -- atan2(±0, x) returns ±pi, for x < 0.
+ -- atan2(±0, x) returns ±0, for x > 0.
+ -- atan2(y, ±0) returns -pi/2 for y < 0.
+ -- atan2(y, ±0) returns pi/2 for y > 0.
+ -- atan2(±oo, -oo) returns ±3pi/4.
+ -- atan2(±oo, +oo) returns ±pi/4.
+ -- atan2(±oo, x) returns ±pi/2, for finite x.
+ -- atan2(±y, -oo) returns ±pi, for finite y > 0.
+ -- atan2(±y, +oo) returns ±0, for finite y > 0.
+ */
+ if (MPFR_IS_NAN (x) || MPFR_IS_NAN (y))
+ {
+ MPFR_SET_NAN (dest);
+ MPFR_RET_NAN;
+ }
+ if (MPFR_IS_ZERO (y))
+ {
+ if (MPFR_IS_NEG (x)) /* +/- PI */
+ {
+ set_pi:
+ if (MPFR_IS_NEG (y))
+ {
+ inexact = mpfr_const_pi (dest, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (dest);
+ return -inexact;
+ }
+ else
+ return mpfr_const_pi (dest, rnd_mode);
+ }
+ else /* +/- 0 */
+ {
+ set_zero:
+ MPFR_SET_ZERO (dest);
+ MPFR_SET_SAME_SIGN (dest, y);
+ return 0;
+ }
+ }
+ if (MPFR_IS_ZERO (x))
+ {
+ return pi_div_2ui (dest, 1, MPFR_IS_NEG (y), rnd_mode);
+ }
+ if (MPFR_IS_INF (y))
+ {
+ if (!MPFR_IS_INF (x)) /* +/- PI/2 */
+ return pi_div_2ui (dest, 1, MPFR_IS_NEG (y), rnd_mode);
+ else if (MPFR_IS_POS (x)) /* +/- PI/4 */
+ return pi_div_2ui (dest, 2, MPFR_IS_NEG (y), rnd_mode);
+ else /* +/- 3*PI/4: Ugly since we have to round properly */
+ {
+ mpfr_t tmp2;
+ MPFR_ZIV_DECL (loop2);
+ mpfr_prec_t prec2 = MPFR_PREC (dest) + 10;
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp2, prec2);
+ MPFR_ZIV_INIT (loop2, prec2);
+ for (;;)
+ {
+ mpfr_const_pi (tmp2, MPFR_RNDN);
+ mpfr_mul_ui (tmp2, tmp2, 3, MPFR_RNDN); /* Error <= 2 */
+ mpfr_div_2ui (tmp2, tmp2, 2, MPFR_RNDN);
+ if (mpfr_round_p (MPFR_MANT (tmp2), MPFR_LIMB_SIZE (tmp2),
+ MPFR_PREC (tmp2) - 2,
+ MPFR_PREC (dest) + (rnd_mode == MPFR_RNDN)))
+ break;
+ MPFR_ZIV_NEXT (loop2, prec2);
+ mpfr_set_prec (tmp2, prec2);
+ }
+ MPFR_ZIV_FREE (loop2);
+ if (MPFR_IS_NEG (y))
+ MPFR_CHANGE_SIGN (tmp2);
+ inexact = mpfr_set (dest, tmp2, rnd_mode);
+ mpfr_clear (tmp2);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (dest, inexact, rnd_mode);
+ }
+ }
+ MPFR_ASSERTD (MPFR_IS_INF (x));
+ if (MPFR_IS_NEG (x))
+ goto set_pi;
+ else
+ goto set_zero;
+ }
+
+ /* When x is a power of two, we call directly atan(y/x) since y/x is
+ exact. */
+ if (MPFR_UNLIKELY (MPFR_IS_POWER_OF_2 (x)))
+ {
+ int r;
+ mpfr_t yoverx;
+ unsigned int saved_flags = __gmpfr_flags;
+
+ mpfr_init2 (yoverx, MPFR_PREC (y));
+ if (MPFR_LIKELY (mpfr_div_2si (yoverx, y, MPFR_GET_EXP (x) - 1,
+ MPFR_RNDN) == 0))
+ {
+ /* Here the flags have not changed due to mpfr_div_2si. */
+ r = mpfr_atan (dest, yoverx, rnd_mode);
+ mpfr_clear (yoverx);
+ return r;
+ }
+ else
+ {
+ /* Division is inexact because of a small exponent range */
+ mpfr_clear (yoverx);
+ __gmpfr_flags = saved_flags;
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Set up initial prec */
+ prec = MPFR_PREC (dest) + 3 + MPFR_INT_CEIL_LOG2 (MPFR_PREC (dest));
+ mpfr_init2 (tmp, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ if (MPFR_IS_POS (x))
+ /* use atan2(y,x) = atan(y/x) */
+ for (;;)
+ {
+ int div_inex;
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_BLOCK (flags, div_inex = mpfr_div (tmp, y, x, MPFR_RNDN));
+ if (div_inex == 0)
+ {
+ /* Result is exact. */
+ inexact = mpfr_atan (dest, tmp, rnd_mode);
+ goto end;
+ }
+
+ /* Error <= ulp (tmp) except in case of underflow or overflow. */
+
+ /* If the division underflowed, since |atan(z)/z| < 1, we have
+ an underflow. */
+ if (MPFR_UNDERFLOW (flags))
+ {
+ int sign;
+
+ /* In the case MPFR_RNDN with 2^(emin-2) < |y/x| < 2^(emin-1):
+ The smallest significand value S > 1 of |y/x| is:
+ * 1 / (1 - 2^(-px)) if py <= px,
+ * (1 - 2^(-px) + 2^(-py)) / (1 - 2^(-px)) if py >= px.
+ Therefore S - 1 > 2^(-pz), where pz = max(px,py). We have:
+ atan(|y/x|) > atan(z), where z = 2^(emin-2) * (1 + 2^(-pz)).
+ > z - z^3 / 3.
+ > 2^(emin-2) * (1 + 2^(-pz) - 2^(2 emin - 5))
+ Assuming pz <= -2 emin + 5, we can round away from zero
+ (this is what mpfr_underflow always does on MPFR_RNDN).
+ In the case MPFR_RNDN with |y/x| <= 2^(emin-2), we round
+ toward zero, as |atan(z)/z| < 1. */
+ MPFR_ASSERTN (MPFR_PREC_MAX <=
+ 2 * (mpfr_uexp_t) - MPFR_EMIN_MIN + 5);
+ if (rnd_mode == MPFR_RNDN && MPFR_IS_ZERO (tmp))
+ rnd_mode = MPFR_RNDZ;
+ sign = MPFR_SIGN (tmp);
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (dest, rnd_mode, sign);
+ }
+
+ mpfr_atan (tmp, tmp, MPFR_RNDN); /* Error <= 2*ulp (tmp) since
+ abs(D(arctan)) <= 1 */
+ /* TODO: check that the error bound is correct in case of overflow. */
+ /* FIXME: Error <= ulp(tmp) ? */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - 2, MPFR_PREC (dest),
+ rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ }
+ else /* x < 0 */
+ /* Use sign(y)*(PI - atan (|y/x|)) */
+ {
+ mpfr_init2 (pi, prec);
+ for (;;)
+ {
+ mpfr_div (tmp, y, x, MPFR_RNDN); /* Error <= ulp (tmp) */
+ /* If tmp is 0, we have |y/x| <= 2^(-emin-2), thus
+ atan|y/x| < 2^(-emin-2). */
+ MPFR_SET_POS (tmp); /* no error */
+ mpfr_atan (tmp, tmp, MPFR_RNDN); /* Error <= 2*ulp (tmp) since
+ abs(D(arctan)) <= 1 */
+ mpfr_const_pi (pi, MPFR_RNDN); /* Error <= ulp(pi) /2 */
+ e = MPFR_NOTZERO(tmp) ? MPFR_GET_EXP (tmp) : __gmpfr_emin - 1;
+ mpfr_sub (tmp, pi, tmp, MPFR_RNDN); /* see above */
+ if (MPFR_IS_NEG (y))
+ MPFR_CHANGE_SIGN (tmp);
+ /* Error(tmp) <= (1/2+2^(EXP(pi)-EXP(tmp)-1)+2^(e-EXP(tmp)+1))*ulp
+ <= 2^(MAX (MAX (EXP(PI)-EXP(tmp)-1, e-EXP(tmp)+1),
+ -1)+2)*ulp(tmp) */
+ e = MAX (MAX (MPFR_GET_EXP (pi)-MPFR_GET_EXP (tmp) - 1,
+ e - MPFR_GET_EXP (tmp) + 1), -1) + 2;
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - e, MPFR_PREC (dest),
+ rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (pi, prec);
+ }
+ mpfr_clear (pi);
+ }
+ inexact = mpfr_set (dest, tmp, rnd_mode);
+
+ end:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (dest, inexact, rnd_mode);
+}
diff --git a/src/atanh.c b/src/atanh.c
new file mode 100644
index 0000000..078ffc6
--- /dev/null
+++ b/src/atanh.c
@@ -0,0 +1,130 @@
+/* mpfr_atanh -- Inverse Hyperbolic Tangente
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of atanh is done by
+ atanh= 1/2*ln(x+1)-1/2*ln(1-x) */
+
+int
+mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt , mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t x, t, te;
+ mpfr_prec_t Nx, Ny, Nt;
+ mpfr_exp_t err;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ /* Special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (xt)))
+ {
+ /* atanh(NaN) = NaN, and atanh(+/-Inf) = NaN since tanh gives a result
+ between -1 and 1 */
+ if (MPFR_IS_NAN (xt) || MPFR_IS_INF (xt))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* necessarily xt is 0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (xt));
+ MPFR_SET_ZERO (y); /* atanh(0) = 0 */
+ MPFR_SET_SAME_SIGN (y,xt);
+ MPFR_RET (0);
+ }
+ }
+
+ /* atanh (x) = NaN as soon as |x| > 1, and arctanh(+/-1) = +/-Inf */
+ if (MPFR_UNLIKELY (MPFR_GET_EXP (xt) > 0))
+ {
+ if (MPFR_GET_EXP (xt) == 1 && mpfr_powerof2_raw (xt))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, xt);
+ mpfr_set_divby0 ();
+ MPFR_RET (0);
+ }
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ /* atanh(x) = x + x^3/3 + ... so the error is < 2^(3*EXP(x)-1) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, xt, -2 * MPFR_GET_EXP (xt), 1, 1,
+ rnd_mode, {});
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Compute initial precision */
+ Nx = MPFR_PREC (xt);
+ MPFR_TMP_INIT_ABS (x, xt);
+ Ny = MPFR_PREC (y);
+ Nt = MAX (Nx, Ny);
+ /* the optimal number of bits : see algorithms.ps */
+ Nt = Nt + MPFR_INT_CEIL_LOG2 (Nt) + 4;
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+ mpfr_init2 (te, Nt);
+
+ /* First computation of cosh */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute atanh */
+ mpfr_ui_sub (te, 1, x, MPFR_RNDU); /* (1-xt)*/
+ mpfr_add_ui (t, x, 1, MPFR_RNDD); /* (xt+1)*/
+ mpfr_div (t, t, te, MPFR_RNDN); /* (1+xt)/(1-xt)*/
+ mpfr_log (t, t, MPFR_RNDN); /* ln((1+xt)/(1-xt))*/
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* (1/2)*ln((1+xt)/(1-xt))*/
+
+ /* error estimate: see algorithms.tex */
+ /* FIXME: this does not correspond to the value in algorithms.tex!!! */
+ /* err=Nt-__gmpfr_ceil_log2(1+5*pow(2,1-MPFR_EXP(t)));*/
+ err = Nt - (MAX (4 - MPFR_GET_EXP (t), 0) + 1);
+
+ if (MPFR_LIKELY (MPFR_IS_ZERO (t)
+ || MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ break;
+
+ /* reactualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ mpfr_set_prec (te, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set4 (y, t, rnd_mode, MPFR_SIGN (xt));
+
+ mpfr_clear(t);
+ mpfr_clear(te);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
+
diff --git a/src/bernoulli.c b/src/bernoulli.c
new file mode 100644
index 0000000..8538155
--- /dev/null
+++ b/src/bernoulli.c
@@ -0,0 +1,80 @@
+/* bernoulli -- internal function to compute Bernoulli numbers.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* assuming b[0]...b[2(n-1)] are computed, computes and stores B[2n]*(2n+1)!
+
+ t/(exp(t)-1) = sum(B[j]*t^j/j!, j=0..infinity)
+ thus t = (exp(t)-1) * sum(B[j]*t^j/j!, n=0..infinity).
+ Taking the coefficient of degree n+1 > 1, we get:
+ 0 = sum(1/(n+1-k)!*B[k]/k!, k=0..n)
+ which gives:
+ B[n] = -sum(binomial(n+1,k)*B[k], k=0..n-1)/(n+1).
+
+ Let C[n] = B[n]*(n+1)!.
+ Then C[n] = -sum(binomial(n+1,k)*C[k]*n!/(k+1)!, k=0..n-1),
+ which proves that the C[n] are integers.
+*/
+mpz_t*
+mpfr_bernoulli_internal (mpz_t *b, unsigned long n)
+{
+ if (n == 0)
+ {
+ b = (mpz_t *) (*__gmp_allocate_func) (sizeof (mpz_t));
+ mpz_init_set_ui (b[0], 1);
+ }
+ else
+ {
+ mpz_t t;
+ unsigned long k;
+
+ b = (mpz_t *) (*__gmp_reallocate_func)
+ (b, n * sizeof (mpz_t), (n + 1) * sizeof (mpz_t));
+ mpz_init (b[n]);
+ /* b[n] = -sum(binomial(2n+1,2k)*C[k]*(2n)!/(2k+1)!, k=0..n-1) */
+ mpz_init_set_ui (t, 2 * n + 1);
+ mpz_mul_ui (t, t, 2 * n - 1);
+ mpz_mul_ui (t, t, 2 * n);
+ mpz_mul_ui (t, t, n);
+ mpz_fdiv_q_ui (t, t, 3); /* exact: t=binomial(2*n+1,2*k)*(2*n)!/(2*k+1)!
+ for k=n-1 */
+ mpz_mul (b[n], t, b[n-1]);
+ for (k = n - 1; k-- > 0;)
+ {
+ mpz_mul_ui (t, t, 2 * k + 1);
+ mpz_mul_ui (t, t, 2 * k + 2);
+ mpz_mul_ui (t, t, 2 * k + 2);
+ mpz_mul_ui (t, t, 2 * k + 3);
+ mpz_fdiv_q_ui (t, t, 2 * (n - k) + 1);
+ mpz_fdiv_q_ui (t, t, 2 * (n - k));
+ mpz_addmul (b[n], t, b[k]);
+ }
+ /* take into account C[1] */
+ mpz_mul_ui (t, t, 2 * n + 1);
+ mpz_fdiv_q_2exp (t, t, 1);
+ mpz_sub (b[n], b[n], t);
+ mpz_neg (b[n], b[n]);
+ mpz_clear (t);
+ }
+ return b;
+}
diff --git a/src/buildopt.c b/src/buildopt.c
new file mode 100644
index 0000000..67dd025
--- /dev/null
+++ b/src/buildopt.c
@@ -0,0 +1,63 @@
+/* buildopt.c -- functions giving information about options used during the
+ mpfr library compilation
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_buildopt_tls_p (void)
+{
+#ifdef MPFR_USE_THREAD_SAFE
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+int
+mpfr_buildopt_decimal_p (void)
+{
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+int
+mpfr_buildopt_gmpinternals_p (void)
+{
+#if defined(MPFR_HAVE_GMP_IMPL) || defined(WANT_GMP_INTERNALS)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+const char *mpfr_buildopt_tune_case (void)
+{
+#ifdef MPFR_TUNE_CASE
+ return MPFR_TUNE_CASE;
+#else
+ return "Generic thresholds";
+#endif
+}
diff --git a/src/cache.c b/src/cache.c
new file mode 100644
index 0000000..359ac42
--- /dev/null
+++ b/src/cache.c
@@ -0,0 +1,145 @@
+/* mpfr_cache -- cache interface for multiple-precision constants in MPFR.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#if 0 /* this function is not used/documented/tested so far, it could be
+ useful if some user wants to add a new constant to mpfr, and
+ implement a cache mechanism for that constant */
+void
+mpfr_init_cache (mpfr_cache_t cache, int (*func)(mpfr_ptr, mpfr_rnd_t))
+{
+ MPFR_PREC (cache->x) = 0; /* Invalid prec to detect that the cache is not
+ valid. Maybe add a flag? */
+ cache->func = func;
+}
+#endif
+
+void
+mpfr_clear_cache (mpfr_cache_t cache)
+{
+ if (MPFR_PREC (cache->x) != 0)
+ mpfr_clear (cache->x);
+ MPFR_PREC (cache->x) = 0;
+}
+
+int
+mpfr_cache (mpfr_ptr dest, mpfr_cache_t cache, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t prec = MPFR_PREC (dest);
+ mpfr_prec_t pold = MPFR_PREC (cache->x);
+ int inexact, sign;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ if (MPFR_UNLIKELY (prec > pold))
+ {
+ /* No previous result in the cache or the precision of the
+ previous result is not sufficient. */
+
+ if (MPFR_UNLIKELY (pold == 0)) /* No previous result. */
+ mpfr_init2 (cache->x, prec);
+
+ /* Update the cache. */
+ pold = prec;
+ /* no need to keep the previous value */
+ mpfr_set_prec (cache->x, pold);
+ cache->inexact = (*cache->func) (cache->x, MPFR_RNDN);
+ }
+
+ /* now pold >= prec is the precision of cache->x */
+
+ /* First, check if the cache has the exact value (unlikely).
+ Else the exact value is between (assuming x=cache->x > 0):
+ x and x+ulp(x) if cache->inexact < 0,
+ x-ulp(x) and x if cache->inexact > 0,
+ and abs(x-exact) <= ulp(x)/2. */
+
+ /* we assume all cached constants are positive */
+ MPFR_ASSERTN (MPFR_IS_POS (cache->x)); /* TODO... */
+ sign = MPFR_SIGN (cache->x);
+ MPFR_SET_EXP (dest, MPFR_GET_EXP (cache->x));
+ MPFR_SET_SIGN (dest, sign);
+
+ /* round cache->x from precision pold down to precision prec */
+ MPFR_RNDRAW_GEN (inexact, dest,
+ MPFR_MANT (cache->x), pold, rnd, sign,
+ if (MPFR_UNLIKELY (cache->inexact == 0))
+ {
+ if ((_sp[0] & _ulp) == 0)
+ {
+ inexact = -sign;
+ goto trunc_doit;
+ }
+ else
+ goto addoneulp;
+ }
+ else if (cache->inexact < 0)
+ goto addoneulp;
+ else /* cache->inexact > 0 */
+ {
+ inexact = -sign;
+ goto trunc_doit;
+ },
+ if (MPFR_UNLIKELY (++MPFR_EXP (dest) > __gmpfr_emax))
+ mpfr_overflow (dest, rnd, sign);
+ );
+
+ if (MPFR_LIKELY (cache->inexact != 0))
+ {
+ switch (rnd)
+ {
+ case MPFR_RNDZ:
+ case MPFR_RNDD:
+ if (MPFR_UNLIKELY (inexact == 0))
+ {
+ inexact = cache->inexact;
+ if (inexact > 0)
+ {
+ mpfr_nextbelow (dest);
+ inexact = -inexact;
+ }
+ }
+ break;
+ case MPFR_RNDU:
+ case MPFR_RNDA:
+ if (MPFR_UNLIKELY (inexact == 0))
+ {
+ inexact = cache->inexact;
+ if (inexact < 0)
+ {
+ mpfr_nextabove (dest);
+ inexact = -inexact;
+ }
+ }
+ break;
+ default: /* MPFR_RNDN */
+ if (MPFR_UNLIKELY(inexact == 0))
+ inexact = cache->inexact;
+ break;
+ }
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (dest, inexact, rnd);
+}
diff --git a/src/cbrt.c b/src/cbrt.c
new file mode 100644
index 0000000..8c7abcf
--- /dev/null
+++ b/src/cbrt.c
@@ -0,0 +1,153 @@
+/* mpfr_cbrt -- cube root function.
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of y = x^(1/3) is done as follows:
+
+ Let x = sign * m * 2^(3*e) where m is an integer
+
+ with 2^(3n-3) <= m < 2^(3n) where n = PREC(y)
+
+ and m = s^3 + r where 0 <= r and m < (s+1)^3
+
+ we want that s has n bits i.e. s >= 2^(n-1), or m >= 2^(3n-3)
+ i.e. m must have at least 3n-2 bits
+
+ then x^(1/3) = s * 2^e if r=0
+ x^(1/3) = (s+1) * 2^e if round up
+ x^(1/3) = (s-1) * 2^e if round down
+ x^(1/3) = s * 2^e if nearest and r < 3/2*s^2+3/4*s+1/8
+ (s+1) * 2^e otherwise
+ */
+
+int
+mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpz_t m;
+ mpfr_exp_t e, r, sh;
+ mpfr_prec_t n, size_m, tmp;
+ int inexact, negative;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ /* special values */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ /* case 0: cbrt(+/- 0) = +/- 0 */
+ else /* x is necessarily 0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ /* General case */
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpz_init (m);
+
+ e = mpfr_get_z_2exp (m, x); /* x = m * 2^e */
+ if ((negative = MPFR_IS_NEG(x)))
+ mpz_neg (m, m);
+ r = e % 3;
+ if (r < 0)
+ r += 3;
+ /* x = (m*2^r) * 2^(e-r) = (m*2^r) * 2^(3*q) */
+
+ MPFR_MPZ_SIZEINBASE2 (size_m, m);
+ n = MPFR_PREC (y) + (rnd_mode == MPFR_RNDN);
+
+ /* we want 3*n-2 <= size_m + 3*sh + r <= 3*n
+ i.e. 3*sh + size_m + r <= 3*n */
+ sh = (3 * (mpfr_exp_t) n - (mpfr_exp_t) size_m - r) / 3;
+ sh = 3 * sh + r;
+ if (sh >= 0)
+ {
+ mpz_mul_2exp (m, m, sh);
+ e = e - sh;
+ }
+ else if (r > 0)
+ {
+ mpz_mul_2exp (m, m, r);
+ e = e - r;
+ }
+
+ /* invariant: x = m*2^e, with e divisible by 3 */
+
+ /* we reuse the variable m to store the cube root, since it is not needed
+ any more: we just need to know if the root is exact */
+ inexact = mpz_root (m, m, 3) == 0;
+
+ MPFR_MPZ_SIZEINBASE2 (tmp, m);
+ sh = tmp - n;
+ if (sh > 0) /* we have to flush to 0 the last sh bits from m */
+ {
+ inexact = inexact || ((mpfr_exp_t) mpz_scan1 (m, 0) < sh);
+ mpz_fdiv_q_2exp (m, m, sh);
+ e += 3 * sh;
+ }
+
+ if (inexact)
+ {
+ if (negative)
+ rnd_mode = MPFR_INVERT_RND (rnd_mode);
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (rnd_mode == MPFR_RNDN && mpz_tstbit (m, 0)))
+ inexact = 1, mpz_add_ui (m, m, 1);
+ else
+ inexact = -1;
+ }
+
+ /* either inexact is not zero, and the conversion is exact, i.e. inexact
+ is not changed; or inexact=0, and inexact is set only when
+ rnd_mode=MPFR_RNDN and bit (n+1) from m is 1 */
+ inexact += mpfr_set_z (y, m, MPFR_RNDN);
+ MPFR_SET_EXP (y, MPFR_GET_EXP (y) + e / 3);
+
+ if (negative)
+ {
+ MPFR_CHANGE_SIGN (y);
+ inexact = -inexact;
+ }
+
+ mpz_clear (m);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/check.c b/src/check.c
new file mode 100644
index 0000000..97c9541
--- /dev/null
+++ b/src/check.c
@@ -0,0 +1,80 @@
+/* mpfr_check -- Check if a floating-point number has not been corrupted.
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/*
+ * Check if x is a valid mpfr_t initializes by mpfr_init
+ * Returns 0 if isn't valid
+ */
+int
+mpfr_check (mpfr_srcptr x)
+{
+ mp_size_t s, i;
+ mp_limb_t tmp;
+ volatile mp_limb_t *xm;
+ int rw;
+
+ /* Check Sign */
+ if (MPFR_SIGN(x) != MPFR_SIGN_POS && MPFR_SIGN(x) != MPFR_SIGN_NEG)
+ return 0;
+ /* Check Precision */
+ if ( (MPFR_PREC(x) < MPFR_PREC_MIN) || (MPFR_PREC(x) > MPFR_PREC_MAX))
+ return 0;
+ /* Check Mantissa */
+ xm = MPFR_MANT(x);
+ if (!xm)
+ return 0;
+ /* Check size of mantissa */
+ s = MPFR_GET_ALLOC_SIZE(x);
+ if (s<=0 || s > MP_SIZE_T_MAX ||
+ MPFR_PREC(x) > ((mpfr_prec_t)s*GMP_NUMB_BITS))
+ return 0;
+ /* Acces all the mp_limb of the mantissa: may do a seg fault */
+ for(i = 0 ; i < s ; i++)
+ tmp = xm[i];
+ /* Check if it isn't singular*/
+ if (! MPFR_IS_SINGULAR (x))
+ {
+ /* Check first mp_limb of mantissa (Must start with a 1 bit) */
+ if ( ((xm[MPFR_LIMB_SIZE(x)-1])>>(GMP_NUMB_BITS-1)) == 0)
+ return 0;
+ /* Check last mp_limb of mantissa */
+ rw = (MPFR_PREC(x) % GMP_NUMB_BITS);
+ if (rw != 0)
+ {
+ tmp = MPFR_LIMB_MASK (GMP_NUMB_BITS - rw);
+ if ((xm[0] & tmp) != 0)
+ return 0;
+ }
+ /* Check exponent range */
+ if ((MPFR_EXP (x) < __gmpfr_emin) || (MPFR_EXP (x) > __gmpfr_emax))
+ return 0;
+ }
+ else
+ {
+ /* Singular value is zero, inf or nan */
+ MPFR_ASSERTD(MPFR_IS_ZERO(x) || MPFR_IS_NAN(x) || MPFR_IS_INF(x));
+ }
+ return 1;
+}
+
diff --git a/src/clear.c b/src/clear.c
new file mode 100644
index 0000000..0db60c1
--- /dev/null
+++ b/src/clear.c
@@ -0,0 +1,31 @@
+/* mpfr_clear -- free the memory space allocated for a floating-point number
+
+Copyright 1999, 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_clear (mpfr_ptr m)
+{
+ (*__gmp_free_func) (MPFR_GET_REAL_PTR (m),
+ MPFR_MALLOC_SIZE (MPFR_GET_ALLOC_SIZE (m)));
+ MPFR_MANT (m) = (mp_limb_t *) 0;
+}
diff --git a/src/clears.c b/src/clears.c
new file mode 100644
index 0000000..bb49e0b
--- /dev/null
+++ b/src/clears.c
@@ -0,0 +1,61 @@
+/* mpfr_clears -- free the memory space allocated for several
+ floating-point numbers
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+#undef HAVE_STDARG
+#include "config.h" /* for a build within gmp */
+#endif
+
+#if HAVE_STDARG
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#include "mpfr-impl.h"
+
+void
+#if HAVE_STDARG
+mpfr_clears (mpfr_ptr x, ...)
+#else
+mpfr_clears (va_alist)
+ va_dcl
+#endif
+{
+ va_list arg;
+
+#if HAVE_STDARG
+ va_start (arg, x);
+#else
+ mpfr_ptr x;
+ va_start(arg);
+ x = va_arg (arg, mpfr_ptr);
+#endif
+
+ while (x != 0)
+ {
+ mpfr_clear (x);
+ x = (mpfr_ptr) va_arg (arg, mpfr_ptr);
+ }
+ va_end (arg);
+}
diff --git a/src/cmp.c b/src/cmp.c
new file mode 100644
index 0000000..d6a4268
--- /dev/null
+++ b/src/cmp.c
@@ -0,0 +1,104 @@
+/* mpfr_cmp -- compare two floating-point numbers
+
+Copyright 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* returns 0 iff b = sign(s) * c
+ a positive value iff b > sign(s) * c
+ a negative value iff b < sign(s) * c
+ returns 0 and sets erange flag if b and/or c is NaN.
+*/
+
+int
+mpfr_cmp3 (mpfr_srcptr b, mpfr_srcptr c, int s)
+{
+ mpfr_exp_t be, ce;
+ mp_size_t bn, cn;
+ mp_limb_t *bp, *cp;
+
+ s = MPFR_MULT_SIGN( s , MPFR_SIGN(c) );
+
+ if (MPFR_ARE_SINGULAR(b, c))
+ {
+ if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c))
+ {
+ MPFR_SET_ERANGE ();
+ return 0;
+ }
+ else if (MPFR_IS_INF(b))
+ {
+ if (MPFR_IS_INF(c) && s == MPFR_SIGN(b) )
+ return 0;
+ else
+ return MPFR_SIGN(b);
+ }
+ else if (MPFR_IS_INF(c))
+ return -s;
+ else if (MPFR_IS_ZERO(b))
+ return MPFR_IS_ZERO(c) ? 0 : -s;
+ else /* necessarily c=0 */
+ return MPFR_SIGN(b);
+ }
+ /* b and c are real numbers */
+ if (s != MPFR_SIGN(b))
+ return MPFR_SIGN(b);
+
+ /* now signs are equal */
+
+ be = MPFR_GET_EXP (b);
+ ce = MPFR_GET_EXP (c);
+ if (be > ce)
+ return s;
+ if (be < ce)
+ return -s;
+
+ /* both signs and exponents are equal */
+
+ bn = (MPFR_PREC(b)-1)/GMP_NUMB_BITS;
+ cn = (MPFR_PREC(c)-1)/GMP_NUMB_BITS;
+
+ bp = MPFR_MANT(b);
+ cp = MPFR_MANT(c);
+
+ for ( ; bn >= 0 && cn >= 0; bn--, cn--)
+ {
+ if (bp[bn] > cp[cn])
+ return s;
+ if (bp[bn] < cp[cn])
+ return -s;
+ }
+ for ( ; bn >= 0; bn--)
+ if (bp[bn])
+ return s;
+ for ( ; cn >= 0; cn--)
+ if (cp[cn])
+ return -s;
+
+ return 0;
+}
+
+#undef mpfr_cmp
+int
+mpfr_cmp (mpfr_srcptr b, mpfr_srcptr c)
+{
+ return mpfr_cmp3 (b, c, 1);
+}
diff --git a/src/cmp2.c b/src/cmp2.c
new file mode 100644
index 0000000..70e40fe
--- /dev/null
+++ b/src/cmp2.c
@@ -0,0 +1,243 @@
+/* mpfr_cmp2 -- exponent shift when subtracting two numbers.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* If |b| != |c|, puts the number of canceled bits when one subtracts |c|
+ from |b| in *cancel. Returns the sign of the difference (-1, 0, 1).
+
+ Assumes neither of b or c is NaN, +/- infinity, or +/- 0.
+
+ In other terms, if |b| != |c|, mpfr_cmp2 (b, c) returns
+ EXP(max(|b|,|c|)) - EXP(|b| - |c|).
+*/
+
+int
+mpfr_cmp2 (mpfr_srcptr b, mpfr_srcptr c, mpfr_prec_t *cancel)
+{
+ mp_limb_t *bp, *cp, bb, cc = 0, lastc = 0, dif, high_dif = 0;
+ mp_size_t bn, cn;
+ mpfr_uexp_t diff_exp;
+ mpfr_prec_t res = 0;
+ int sign;
+
+ /* b=c should not happen, since cmp2 is called only from agm (with
+ different variables) and from sub1 (if b=c, then sub1sp would be
+ called instead). So, no need for a particular optimization here. */
+
+ /* the cases b=0 or c=0 are also treated apart in agm and sub
+ (which calls sub1) */
+ MPFR_ASSERTD (MPFR_IS_PURE_FP(b));
+ MPFR_ASSERTD (MPFR_IS_PURE_FP(c));
+
+ if (MPFR_GET_EXP (b) >= MPFR_GET_EXP (c))
+ {
+ sign = 1;
+ diff_exp = (mpfr_uexp_t) MPFR_GET_EXP (b) - MPFR_GET_EXP (c);
+
+ bp = MPFR_MANT(b);
+ cp = MPFR_MANT(c);
+
+ bn = (MPFR_PREC(b) - 1) / GMP_NUMB_BITS;
+ cn = (MPFR_PREC(c) - 1) / GMP_NUMB_BITS; /* # of limbs of c minus 1 */
+
+ if (MPFR_UNLIKELY( diff_exp == 0 ))
+ {
+ while (bn >= 0 && cn >= 0 && bp[bn] == cp[cn])
+ {
+ bn--;
+ cn--;
+ res += GMP_NUMB_BITS;
+ }
+
+ if (MPFR_UNLIKELY (bn < 0))
+ {
+ if (MPFR_LIKELY (cn < 0)) /* b = c */
+ return 0;
+
+ bp = cp;
+ bn = cn;
+ cn = -1;
+ sign = -1;
+ }
+
+ if (MPFR_UNLIKELY (cn < 0))
+ /* c discards exactly the upper part of b */
+ {
+ unsigned int z;
+
+ MPFR_ASSERTD (bn >= 0);
+
+ while (bp[bn] == 0)
+ {
+ if (--bn < 0) /* b = c */
+ return 0;
+ res += GMP_NUMB_BITS;
+ }
+
+ count_leading_zeros(z, bp[bn]); /* bp[bn] <> 0 */
+ *cancel = res + z;
+ return sign;
+ }
+
+ MPFR_ASSERTD (bn >= 0);
+ MPFR_ASSERTD (cn >= 0);
+ MPFR_ASSERTD (bp[bn] != cp[cn]);
+ if (bp[bn] < cp[cn])
+ {
+ mp_limb_t *tp;
+ mp_size_t tn;
+
+ tp = bp; bp = cp; cp = tp;
+ tn = bn; bn = cn; cn = tn;
+ sign = -1;
+ }
+ }
+ } /* MPFR_EXP(b) >= MPFR_EXP(c) */
+ else /* MPFR_EXP(b) < MPFR_EXP(c) */
+ {
+ sign = -1;
+ diff_exp = (mpfr_uexp_t) MPFR_GET_EXP (c) - MPFR_GET_EXP (b);
+
+ bp = MPFR_MANT(c);
+ cp = MPFR_MANT(b);
+
+ bn = (MPFR_PREC(c) - 1) / GMP_NUMB_BITS;
+ cn = (MPFR_PREC(b) - 1) / GMP_NUMB_BITS;
+ }
+
+ /* now we have removed the identical upper limbs of b and c
+ (can happen only when diff_exp = 0), and after the possible
+ swap, we have |b| > |c|: bp[bn] > cc, bn >= 0, cn >= 0,
+ diff_exp = EXP(b) - EXP(c).
+ */
+
+ if (MPFR_LIKELY (diff_exp < GMP_NUMB_BITS))
+ {
+ cc = cp[cn] >> diff_exp;
+ /* warning: a shift by GMP_NUMB_BITS may give wrong results */
+ if (diff_exp)
+ lastc = cp[cn] << (GMP_NUMB_BITS - diff_exp);
+ cn--;
+ }
+ else
+ diff_exp -= GMP_NUMB_BITS; /* cc = 0 */
+
+ dif = bp[bn--] - cc; /* necessarily dif >= 1 */
+ MPFR_ASSERTD(dif >= 1);
+
+ /* now high_dif = 0, dif >= 1, lastc is the neglected part of cp[cn+1] */
+
+ while (MPFR_UNLIKELY ((cn >= 0 || lastc != 0)
+ && (high_dif == 0) && (dif == 1)))
+ { /* dif=1 implies diff_exp = 0 or 1 */
+ bb = (bn >= 0) ? bp[bn] : 0;
+ cc = lastc;
+ if (cn >= 0)
+ {
+ if (diff_exp == 0)
+ {
+ cc += cp[cn];
+ }
+ else /* diff_exp = 1 */
+ {
+ cc += cp[cn] >> 1;
+ lastc = cp[cn] << (GMP_NUMB_BITS - 1);
+ }
+ }
+ else
+ lastc = 0;
+ high_dif = 1 - mpn_sub_n (&dif, &bb, &cc, 1);
+ bn--;
+ cn--;
+ res += GMP_NUMB_BITS;
+ }
+
+ /* (cn<0 and lastc=0) or (high_dif,dif)<>(0,1) */
+
+ if (MPFR_UNLIKELY (high_dif != 0)) /* high_dif == 1 */
+ {
+ res--;
+ MPFR_ASSERTD (res >= 0);
+ if (dif != 0)
+ {
+ *cancel = res;
+ return sign;
+ }
+ }
+ else /* high_dif == 0 */
+ {
+ unsigned int z;
+
+ count_leading_zeros(z, dif); /* dif > 1 here */
+ res += z;
+ if (MPFR_LIKELY(dif != (MPFR_LIMB_ONE << (GMP_NUMB_BITS - z - 1))))
+ { /* dif is not a power of two */
+ *cancel = res;
+ return sign;
+ }
+ }
+
+ /* now result is res + (low(b) < low(c)) */
+ while (MPFR_UNLIKELY (bn >= 0 && (cn >= 0 || lastc != 0)))
+ {
+ if (diff_exp >= GMP_NUMB_BITS)
+ diff_exp -= GMP_NUMB_BITS;
+ else
+ {
+ cc = lastc;
+ if (cn >= 0)
+ {
+ cc += cp[cn] >> diff_exp;
+ if (diff_exp != 0)
+ lastc = cp[cn] << (GMP_NUMB_BITS - diff_exp);
+ }
+ else
+ lastc = 0;
+ cn--;
+ }
+ if (bp[bn] != cc)
+ {
+ *cancel = res + (bp[bn] < cc);
+ return sign;
+ }
+ bn--;
+ }
+
+ if (bn < 0)
+ {
+ if (lastc != 0)
+ res++;
+ else
+ {
+ while (cn >= 0 && cp[cn] == 0)
+ cn--;
+ if (cn >= 0)
+ res++;
+ }
+ }
+
+ *cancel = res;
+ return sign;
+}
diff --git a/src/cmp_abs.c b/src/cmp_abs.c
new file mode 100644
index 0000000..a6e6d9e
--- /dev/null
+++ b/src/cmp_abs.c
@@ -0,0 +1,94 @@
+/* mpfr_cmpabs -- compare the absolute values of two FP numbers
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Return a positive value if abs(b) > abs(c), 0 if abs(b) = abs(c), and
+ a negative value if abs(b) < abs(c). Neither b nor c may be NaN. */
+
+int
+mpfr_cmpabs (mpfr_srcptr b, mpfr_srcptr c)
+{
+ mpfr_exp_t be, ce;
+ mp_size_t bn, cn;
+ mp_limb_t *bp, *cp;
+
+ if (MPFR_ARE_SINGULAR (b, c))
+ {
+ if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c))
+ {
+ MPFR_SET_ERANGE ();
+ return 0;
+ }
+ else if (MPFR_IS_INF (b))
+ return ! MPFR_IS_INF (c);
+ else if (MPFR_IS_INF (c))
+ return -1;
+ else if (MPFR_IS_ZERO (c))
+ return ! MPFR_IS_ZERO (b);
+ else /* b == 0 */
+ return -1;
+ }
+
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (b));
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (c));
+
+ /* Now that we know that b and c are pure FP numbers (i.e. they have
+ a meaningful exponent), we use MPFR_EXP instead of MPFR_GET_EXP to
+ allow exponents outside the current exponent range. For instance,
+ this is useful for mpfr_pow, which compares values to __gmpfr_one.
+ This is for internal use only! For compatibility with other MPFR
+ versions, the user must still provide values that are representable
+ in the current exponent range. */
+ be = MPFR_EXP (b);
+ ce = MPFR_EXP (c);
+ if (be > ce)
+ return 1;
+ if (be < ce)
+ return -1;
+
+ /* exponents are equal */
+
+ bn = MPFR_LIMB_SIZE(b)-1;
+ cn = MPFR_LIMB_SIZE(c)-1;
+
+ bp = MPFR_MANT(b);
+ cp = MPFR_MANT(c);
+
+ for ( ; bn >= 0 && cn >= 0; bn--, cn--)
+ {
+ if (bp[bn] > cp[cn])
+ return 1;
+ if (bp[bn] < cp[cn])
+ return -1;
+ }
+
+ for ( ; bn >= 0; bn--)
+ if (bp[bn])
+ return 1;
+
+ for ( ; cn >= 0; cn--)
+ if (cp[cn])
+ return -1;
+
+ return 0;
+}
diff --git a/src/cmp_d.c b/src/cmp_d.c
new file mode 100644
index 0000000..1341a18
--- /dev/null
+++ b/src/cmp_d.c
@@ -0,0 +1,38 @@
+/* mpfr_cmp_d -- compare a floating-point number with a double
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_cmp_d (mpfr_srcptr b, double d)
+{
+ mpfr_t tmp;
+ int res;
+
+ mpfr_init2 (tmp, IEEE_DBL_MANT_DIG);
+ res = mpfr_set_d (tmp, d, MPFR_RNDN);
+ MPFR_ASSERTD (res == 0);
+ res = mpfr_cmp (b, tmp);
+ mpfr_clear (tmp);
+
+ return res;
+}
diff --git a/src/cmp_ld.c b/src/cmp_ld.c
new file mode 100644
index 0000000..c09bea6
--- /dev/null
+++ b/src/cmp_ld.c
@@ -0,0 +1,38 @@
+/* mpfr_cmp_d -- compare a floating-point number with a long double
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_cmp_ld (mpfr_srcptr b, long double d)
+{
+ mpfr_t tmp;
+ int res;
+
+ mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG);
+ res = mpfr_set_ld (tmp, d, MPFR_RNDN);
+ MPFR_ASSERTD (res == 0);
+ res = mpfr_cmp (b, tmp);
+ mpfr_clear (tmp);
+
+ return res;
+}
diff --git a/src/cmp_si.c b/src/cmp_si.c
new file mode 100644
index 0000000..ac104a6
--- /dev/null
+++ b/src/cmp_si.c
@@ -0,0 +1,101 @@
+/* mpfr_cmp_si_2exp -- compare a floating-point number with a signed
+machine integer multiplied by a power of 2
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* returns a positive value if b > i*2^f,
+ a negative value if b < i*2^f,
+ zero if b = i*2^f.
+ b must not be NaN.
+*/
+
+int
+mpfr_cmp_si_2exp (mpfr_srcptr b, long int i, mpfr_exp_t f)
+{
+ int si;
+
+ si = i < 0 ? -1 : 1; /* sign of i */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (b)))
+ {
+ if (MPFR_IS_INF(b))
+ return MPFR_INT_SIGN(b);
+ else if (MPFR_IS_ZERO(b))
+ return i != 0 ? -si : 0;
+ /* NAN */
+ MPFR_SET_ERANGE ();
+ return 0;
+ }
+ else if (MPFR_SIGN(b) != si || i == 0)
+ return MPFR_INT_SIGN (b);
+ else /* b and i are of same sign si */
+ {
+ mpfr_exp_t e;
+ unsigned long ai;
+ int k;
+ mp_size_t bn;
+ mp_limb_t c, *bp;
+
+ ai = SAFE_ABS(unsigned long, i);
+
+ /* ai must be representable in a mp_limb_t */
+ MPFR_ASSERTN(ai == (mp_limb_t) ai);
+
+ e = MPFR_GET_EXP (b); /* 2^(e-1) <= b < 2^e */
+ if (e <= f)
+ return -si;
+ if (f < MPFR_EMAX_MAX - GMP_NUMB_BITS &&
+ e > f + GMP_NUMB_BITS)
+ return si;
+
+ /* now f < e <= f + GMP_NUMB_BITS */
+ c = (mp_limb_t) ai;
+ count_leading_zeros(k, c);
+ if ((int) (e - f) > GMP_NUMB_BITS - k)
+ return si;
+ if ((int) (e - f) < GMP_NUMB_BITS - k)
+ return -si;
+
+ /* now b and i*2^f have the same exponent */
+ c <<= k;
+ bn = (MPFR_PREC(b) - 1) / GMP_NUMB_BITS;
+ bp = MPFR_MANT(b);
+ if (bp[bn] > c)
+ return si;
+ if (bp[bn] < c)
+ return -si;
+
+ /* most significant limbs agree, check remaining limbs from b */
+ while (bn > 0)
+ if (bp[--bn])
+ return si;
+ return 0;
+ }
+}
+
+#undef mpfr_cmp_si
+int
+mpfr_cmp_si (mpfr_srcptr b, long int i)
+{
+ return mpfr_cmp_si_2exp (b, i, 0);
+}
diff --git a/src/cmp_ui.c b/src/cmp_ui.c
new file mode 100644
index 0000000..1e094ab
--- /dev/null
+++ b/src/cmp_ui.c
@@ -0,0 +1,101 @@
+/* mpfr_cmp_ui_2exp -- compare a floating-point number with an unsigned
+machine integer multiplied by a power of 2
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* returns a positive value if b > i*2^f,
+ a negative value if b < i*2^f,
+ zero if b = i*2^f.
+ b must not be NaN
+*/
+
+int
+mpfr_cmp_ui_2exp (mpfr_srcptr b, unsigned long int i, mpfr_exp_t f)
+{
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(b) ))
+ {
+ if (MPFR_IS_NAN (b))
+ {
+ MPFR_SET_ERANGE ();
+ return 0;
+ }
+ else if (MPFR_IS_INF(b))
+ return MPFR_INT_SIGN (b);
+ else /* since b cannot be NaN, b=0 here */
+ return i != 0 ? -1 : 0;
+ }
+
+ if (MPFR_IS_NEG (b))
+ return -1;
+ /* now b > 0 */
+ else if (MPFR_UNLIKELY(i == 0))
+ return 1;
+ else /* b > 0, i > 0 */
+ {
+ mpfr_exp_t e;
+ int k;
+ mp_size_t bn;
+ mp_limb_t c, *bp;
+
+ /* i must be representable in a mp_limb_t */
+ MPFR_ASSERTN(i == (mp_limb_t) i);
+
+ e = MPFR_GET_EXP (b); /* 2^(e-1) <= b < 2^e */
+ if (e <= f)
+ return -1;
+ if (f < MPFR_EMAX_MAX - GMP_NUMB_BITS &&
+ e > f + GMP_NUMB_BITS)
+ return 1;
+
+ /* now f < e <= f + GMP_NUMB_BITS */
+ c = (mp_limb_t) i;
+ count_leading_zeros(k, c);
+ if ((int) (e - f) > GMP_NUMB_BITS - k)
+ return 1;
+ if ((int) (e - f) < GMP_NUMB_BITS - k)
+ return -1;
+
+ /* now b and i*2^f have the same exponent */
+ c <<= k;
+ bn = (MPFR_PREC(b) - 1) / GMP_NUMB_BITS;
+ bp = MPFR_MANT(b);
+ if (bp[bn] > c)
+ return 1;
+ if (bp[bn] < c)
+ return -1;
+
+ /* most significant limbs agree, check remaining limbs from b */
+ while (bn > 0)
+ if (bp[--bn] != 0)
+ return 1;
+ return 0;
+ }
+}
+
+#undef mpfr_cmp_ui
+int
+mpfr_cmp_ui (mpfr_srcptr b, unsigned long int i)
+{
+ return mpfr_cmp_ui_2exp (b, i, 0);
+}
diff --git a/src/comparisons.c b/src/comparisons.c
new file mode 100644
index 0000000..584667e
--- /dev/null
+++ b/src/comparisons.c
@@ -0,0 +1,78 @@
+/* comparison predicates
+
+Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Note: these functions currently use mpfr_cmp; they could have their
+ own code to be faster. */
+
+/* = < > unordered
+ * mpfr_greater_p 0 0 1 0
+ * mpfr_greaterequal_p 1 0 1 0
+ * mpfr_less_p 0 1 0 0
+ * mpfr_lessequal_p 1 1 0 0
+ * mpfr_lessgreater_p 0 1 1 0
+ * mpfr_equal_p 1 0 0 0
+ * mpfr_unordered_p 0 0 0 1
+ */
+
+int
+mpfr_greater_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) > 0);
+}
+
+int
+mpfr_greaterequal_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) >= 0);
+}
+
+int
+mpfr_less_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) < 0);
+}
+
+int
+mpfr_lessequal_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) <= 0);
+}
+
+int
+mpfr_lessgreater_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) != 0);
+}
+
+int
+mpfr_equal_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y) ? 0 : (mpfr_cmp (x, y) == 0);
+}
+
+int
+mpfr_unordered_p (mpfr_srcptr x, mpfr_srcptr y)
+{
+ return MPFR_IS_NAN(x) || MPFR_IS_NAN(y);
+}
diff --git a/src/const_catalan.c b/src/const_catalan.c
new file mode 100644
index 0000000..c8929c1
--- /dev/null
+++ b/src/const_catalan.c
@@ -0,0 +1,153 @@
+/* mpfr_const_catalan -- compute Catalan's constant.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Declare the cache */
+MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_catalan, mpfr_const_catalan_internal);
+
+/* Set User Interface */
+#undef mpfr_const_catalan
+int
+mpfr_const_catalan (mpfr_ptr x, mpfr_rnd_t rnd_mode) {
+ return mpfr_cache (x, __gmpfr_cache_const_catalan, rnd_mode);
+}
+
+/* return T, Q such that T/Q = sum(k!^2/(2k)!/(2k+1)^2, k=n1..n2-1) */
+static void
+S (mpz_t T, mpz_t P, mpz_t Q, unsigned long n1, unsigned long n2)
+{
+ if (n2 == n1 + 1)
+ {
+ if (n1 == 0)
+ {
+ mpz_set_ui (P, 1);
+ mpz_set_ui (Q, 1);
+ }
+ else
+ {
+ mpz_set_ui (P, 2 * n1 - 1);
+ mpz_mul_ui (P, P, n1);
+ mpz_ui_pow_ui (Q, 2 * n1 + 1, 2);
+ mpz_mul_2exp (Q, Q, 1);
+ }
+ mpz_set (T, P);
+ }
+ else
+ {
+ unsigned long m = (n1 + n2) / 2;
+ mpz_t T2, P2, Q2;
+ S (T, P, Q, n1, m);
+ mpz_init (T2);
+ mpz_init (P2);
+ mpz_init (Q2);
+ S (T2, P2, Q2, m, n2);
+ mpz_mul (T, T, Q2);
+ mpz_mul (T2, T2, P);
+ mpz_add (T, T, T2);
+ mpz_mul (P, P, P2);
+ mpz_mul (Q, Q, Q2);
+ mpz_clear (T2);
+ mpz_clear (P2);
+ mpz_clear (Q2);
+ }
+}
+
+/* Don't need to save/restore exponent range: the cache does it.
+ Catalan's constant is G = sum((-1)^k/(2*k+1)^2, k=0..infinity).
+ We compute it using formula (31) of Victor Adamchik's page
+ "33 representations for Catalan's constant"
+ http://www-2.cs.cmu.edu/~adamchik/articles/catalan/catalan.htm
+
+ G = Pi/8*log(2+sqrt(3)) + 3/8*sum(k!^2/(2k)!/(2k+1)^2,k=0..infinity)
+*/
+int
+mpfr_const_catalan_internal (mpfr_ptr g, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t x, y, z;
+ mpz_t T, P, Q;
+ mpfr_prec_t pg, p;
+ int inex;
+ MPFR_ZIV_DECL (loop);
+ MPFR_GROUP_DECL (group);
+
+ MPFR_LOG_FUNC (("rnd_mode=%d", rnd_mode),
+ ("g[%Pu]=%.*Rg inex=%d", mpfr_get_prec (g), mpfr_log_prec, g, inex));
+
+ /* Here are the WC (max prec = 100.000.000)
+ Once we have found a chain of 11, we only look for bigger chain.
+ Found 3 '1' at 0
+ Found 5 '1' at 9
+ Found 6 '0' at 34
+ Found 9 '1' at 176
+ Found 11 '1' at 705
+ Found 12 '0' at 913
+ Found 14 '1' at 12762
+ Found 15 '1' at 152561
+ Found 16 '0' at 171725
+ Found 18 '0' at 525355
+ Found 20 '0' at 529245
+ Found 21 '1' at 6390133
+ Found 22 '0' at 7806417
+ Found 25 '1' at 11936239
+ Found 27 '1' at 51752950
+ */
+ pg = MPFR_PREC (g);
+ p = pg + MPFR_INT_CEIL_LOG2 (pg) + 7;
+
+ MPFR_GROUP_INIT_3 (group, p, x, y, z);
+ mpz_init (T);
+ mpz_init (P);
+ mpz_init (Q);
+
+ MPFR_ZIV_INIT (loop, p);
+ for (;;) {
+ mpfr_sqrt_ui (x, 3, MPFR_RNDU);
+ mpfr_add_ui (x, x, 2, MPFR_RNDU);
+ mpfr_log (x, x, MPFR_RNDU);
+ mpfr_const_pi (y, MPFR_RNDU);
+ mpfr_mul (x, x, y, MPFR_RNDN);
+ S (T, P, Q, 0, (p - 1) / 2);
+ mpz_mul_ui (T, T, 3);
+ mpfr_set_z (y, T, MPFR_RNDU);
+ mpfr_set_z (z, Q, MPFR_RNDD);
+ mpfr_div (y, y, z, MPFR_RNDN);
+ mpfr_add (x, x, y, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 3, MPFR_RNDN);
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (x, p - 5, pg, rnd_mode)))
+ break;
+
+ MPFR_ZIV_NEXT (loop, p);
+ MPFR_GROUP_REPREC_3 (group, p, x, y, z);
+ }
+ MPFR_ZIV_FREE (loop);
+ inex = mpfr_set (g, x, rnd_mode);
+
+ MPFR_GROUP_CLEAR (group);
+ mpz_clear (T);
+ mpz_clear (P);
+ mpz_clear (Q);
+
+ return inex;
+}
diff --git a/src/const_euler.c b/src/const_euler.c
new file mode 100644
index 0000000..2257634
--- /dev/null
+++ b/src/const_euler.c
@@ -0,0 +1,221 @@
+/* mpfr_const_euler -- Euler's constant
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Declare the cache */
+MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_euler, mpfr_const_euler_internal);
+
+/* Set User Interface */
+#undef mpfr_const_euler
+int
+mpfr_const_euler (mpfr_ptr x, mpfr_rnd_t rnd_mode) {
+ return mpfr_cache (x, __gmpfr_cache_const_euler, rnd_mode);
+}
+
+
+static void mpfr_const_euler_S2 (mpfr_ptr, unsigned long);
+static void mpfr_const_euler_R (mpfr_ptr, unsigned long);
+
+int
+mpfr_const_euler_internal (mpfr_t x, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t prec = MPFR_PREC(x), m, log2m;
+ mpfr_t y, z;
+ unsigned long n;
+ int inexact;
+ MPFR_ZIV_DECL (loop);
+
+ log2m = MPFR_INT_CEIL_LOG2 (prec);
+ m = prec + 2 * log2m + 23;
+
+ mpfr_init2 (y, m);
+ mpfr_init2 (z, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_exp_t exp_S, err;
+ /* since prec >= 1, we have m >= 24 here, which ensures n >= 9 below */
+ n = 1 + (unsigned long) ((double) m * LOG2 / 2.0);
+ MPFR_ASSERTD (n >= 9);
+ mpfr_const_euler_S2 (y, n); /* error <= 3 ulps */
+ exp_S = MPFR_EXP(y);
+ mpfr_set_ui (z, n, MPFR_RNDN);
+ mpfr_log (z, z, MPFR_RNDD); /* error <= 1 ulp */
+ mpfr_sub (y, y, z, MPFR_RNDN); /* S'(n) - log(n) */
+ /* the error is less than 1/2 + 3*2^(exp_S-EXP(y)) + 2^(EXP(z)-EXP(y))
+ <= 1/2 + 2^(exp_S+2-EXP(y)) + 2^(EXP(z)-EXP(y))
+ <= 1/2 + 2^(1+MAX(exp_S+2,EXP(z))-EXP(y)) */
+ err = 1 + MAX(exp_S + 2, MPFR_EXP(z)) - MPFR_EXP(y);
+ err = (err >= -1) ? err + 1 : 0; /* error <= 2^err ulp(y) */
+ exp_S = MPFR_EXP(y);
+ mpfr_const_euler_R (z, n); /* err <= ulp(1/2) = 2^(-m) */
+ mpfr_sub (y, y, z, MPFR_RNDN);
+ /* err <= 1/2 ulp(y) + 2^(-m) + 2^(err + exp_S - EXP(y)) ulp(y).
+ Since the result is between 0.5 and 1, ulp(y) = 2^(-m).
+ So we get 3/2*ulp(y) + 2^(err + exp_S - EXP(y)) ulp(y).
+ 3/2 + 2^e <= 2^(e+1) for e>=1, and <= 2^2 otherwise */
+ err = err + exp_S - MPFR_EXP(y);
+ err = (err >= 1) ? err + 1 : 2;
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (y, m - err, prec, rnd)))
+ break;
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (y, m);
+ mpfr_set_prec (z, m);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (x, y, rnd);
+
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ return inexact; /* always inexact */
+}
+
+static void
+mpfr_const_euler_S2_aux (mpz_t P, mpz_t Q, mpz_t T, unsigned long n,
+ unsigned long a, unsigned long b, int need_P)
+{
+ if (a + 1 == b)
+ {
+ mpz_set_ui (P, n);
+ if (a > 1)
+ mpz_mul_si (P, P, 1 - (long) a);
+ mpz_set (T, P);
+ mpz_set_ui (Q, a);
+ mpz_mul_ui (Q, Q, a);
+ }
+ else
+ {
+ unsigned long c = (a + b) / 2;
+ mpz_t P2, Q2, T2;
+ mpfr_const_euler_S2_aux (P, Q, T, n, a, c, 1);
+ mpz_init (P2);
+ mpz_init (Q2);
+ mpz_init (T2);
+ mpfr_const_euler_S2_aux (P2, Q2, T2, n, c, b, 1);
+ mpz_mul (T, T, Q2);
+ mpz_mul (T2, T2, P);
+ mpz_add (T, T, T2);
+ if (need_P)
+ mpz_mul (P, P, P2);
+ mpz_mul (Q, Q, Q2);
+ mpz_clear (P2);
+ mpz_clear (Q2);
+ mpz_clear (T2);
+ /* divide by 2 if possible */
+ {
+ unsigned long v2;
+ v2 = mpz_scan1 (P, 0);
+ c = mpz_scan1 (Q, 0);
+ if (c < v2)
+ v2 = c;
+ c = mpz_scan1 (T, 0);
+ if (c < v2)
+ v2 = c;
+ if (v2)
+ {
+ mpz_tdiv_q_2exp (P, P, v2);
+ mpz_tdiv_q_2exp (Q, Q, v2);
+ mpz_tdiv_q_2exp (T, T, v2);
+ }
+ }
+ }
+}
+
+/* computes S(n) = sum(n^k*(-1)^(k-1)/k!/k, k=1..ceil(4.319136566 * n))
+ using binary splitting.
+ We have S(n) = sum(f(k), k=1..N) with N=ceil(4.319136566 * n)
+ and f(k) = n^k*(-1)*(k-1)/k!/k,
+ thus f(k)/f(k-1) = -n*(k-1)/k^2
+*/
+static void
+mpfr_const_euler_S2 (mpfr_t x, unsigned long n)
+{
+ mpz_t P, Q, T;
+ unsigned long N = (unsigned long) (ALPHA * (double) n + 1.0);
+ mpz_init (P);
+ mpz_init (Q);
+ mpz_init (T);
+ mpfr_const_euler_S2_aux (P, Q, T, n, 1, N + 1, 0);
+ mpfr_set_z (x, T, MPFR_RNDN);
+ mpfr_div_z (x, x, Q, MPFR_RNDN);
+ mpz_clear (P);
+ mpz_clear (Q);
+ mpz_clear (T);
+}
+
+/* computes R(n) = exp(-n)/n * sum(k!/(-n)^k, k=0..n-2)
+ with error at most 4*ulp(x). Assumes n>=2.
+ Since x <= exp(-n)/n <= 1/8, then 4*ulp(x) <= ulp(1).
+*/
+static void
+mpfr_const_euler_R (mpfr_t x, unsigned long n)
+{
+ unsigned long k, m;
+ mpz_t a, s;
+ mpfr_t y;
+
+ MPFR_ASSERTN (n >= 2); /* ensures sum(k!/(-n)^k, k=0..n-2) >= 2/3 */
+
+ /* as we multiply the sum by exp(-n), we need only PREC(x) - n/LOG2 bits */
+ m = MPFR_PREC(x) - (unsigned long) ((double) n / LOG2);
+
+ mpz_init_set_ui (a, 1);
+ mpz_mul_2exp (a, a, m);
+ mpz_init_set (s, a);
+
+ for (k = 1; k <= n; k++)
+ {
+ mpz_mul_ui (a, a, k);
+ mpz_fdiv_q_ui (a, a, n);
+ /* the error e(k) on a is e(k) <= 1 + k/n*e(k-1) with e(0)=0,
+ i.e. e(k) <= k */
+ if (k % 2)
+ mpz_sub (s, s, a);
+ else
+ mpz_add (s, s, a);
+ }
+ /* the error on s is at most 1+2+...+n = n*(n+1)/2 */
+ mpz_fdiv_q_ui (s, s, n); /* err <= 1 + (n+1)/2 */
+ MPFR_ASSERTN (MPFR_PREC(x) >= mpz_sizeinbase(s, 2));
+ mpfr_set_z (x, s, MPFR_RNDD); /* exact */
+ mpfr_div_2ui (x, x, m, MPFR_RNDD);
+ /* now x = 1/n * sum(k!/(-n)^k, k=0..n-2) <= 1/n */
+ /* err(x) <= (n+1)/2^m <= (n+1)*exp(n)/2^PREC(x) */
+
+ mpfr_init2 (y, m);
+ mpfr_set_si (y, -(long)n, MPFR_RNDD); /* assumed exact */
+ mpfr_exp (y, y, MPFR_RNDD); /* err <= ulp(y) <= exp(-n)*2^(1-m) */
+ mpfr_mul (x, x, y, MPFR_RNDD);
+ /* err <= ulp(x) + (n + 1 + 2/n) / 2^prec(x)
+ <= ulp(x) + (n + 1 + 2/n) ulp(x)/x since x*2^(-prec(x)) < ulp(x)
+ <= ulp(x) + (n + 1 + 2/n) 3/(2n) ulp(x) since x >= 2/3*n for n >= 2
+ <= 4 * ulp(x) for n >= 2 */
+ mpfr_clear (y);
+
+ mpz_clear (a);
+ mpz_clear (s);
+}
diff --git a/src/const_log2.c b/src/const_log2.c
new file mode 100644
index 0000000..7e6333f
--- /dev/null
+++ b/src/const_log2.c
@@ -0,0 +1,200 @@
+/* mpfr_const_log2 -- compute natural logarithm of 2
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Declare the cache */
+#ifndef MPFR_USE_LOGGING
+MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_log2, mpfr_const_log2_internal);
+#else
+MPFR_DECL_INIT_CACHE(__gmpfr_normal_log2, mpfr_const_log2_internal);
+MPFR_DECL_INIT_CACHE(__gmpfr_logging_log2, mpfr_const_log2_internal);
+mpfr_cache_ptr MPFR_THREAD_ATTR __gmpfr_cache_const_log2 = __gmpfr_normal_log2;
+#endif
+
+/* Set User interface */
+#undef mpfr_const_log2
+int
+mpfr_const_log2 (mpfr_ptr x, mpfr_rnd_t rnd_mode) {
+ return mpfr_cache (x, __gmpfr_cache_const_log2, rnd_mode);
+}
+
+/* Auxiliary function: Compute the terms from n1 to n2 (excluded)
+ 3/4*sum((-1)^n*n!^2/2^n/(2*n+1)!, n = n1..n2-1).
+ Numerator is T[0], denominator is Q[0],
+ Compute P[0] only when need_P is non-zero.
+ Need 1+ceil(log(n2-n1)/log(2)) cells in T[],P[],Q[].
+*/
+static void
+S (mpz_t *T, mpz_t *P, mpz_t *Q, unsigned long n1, unsigned long n2, int need_P)
+{
+ if (n2 == n1 + 1)
+ {
+ if (n1 == 0)
+ mpz_set_ui (P[0], 3);
+ else
+ {
+ mpz_set_ui (P[0], n1);
+ mpz_neg (P[0], P[0]);
+ }
+ if (n1 <= (ULONG_MAX / 4 - 1) / 2)
+ mpz_set_ui (Q[0], 4 * (2 * n1 + 1));
+ else /* to avoid overflow in 4 * (2 * n1 + 1) */
+ {
+ mpz_set_ui (Q[0], n1);
+ mpz_mul_2exp (Q[0], Q[0], 1);
+ mpz_add_ui (Q[0], Q[0], 1);
+ mpz_mul_2exp (Q[0], Q[0], 2);
+ }
+ mpz_set (T[0], P[0]);
+ }
+ else
+ {
+ unsigned long m = (n1 / 2) + (n2 / 2) + (n1 & 1UL & n2);
+ unsigned long v, w;
+
+ S (T, P, Q, n1, m, 1);
+ S (T + 1, P + 1, Q + 1, m, n2, need_P);
+ mpz_mul (T[0], T[0], Q[1]);
+ mpz_mul (T[1], T[1], P[0]);
+ mpz_add (T[0], T[0], T[1]);
+ if (need_P)
+ mpz_mul (P[0], P[0], P[1]);
+ mpz_mul (Q[0], Q[0], Q[1]);
+
+ /* remove common trailing zeroes if any */
+ v = mpz_scan1 (T[0], 0);
+ if (v > 0)
+ {
+ w = mpz_scan1 (Q[0], 0);
+ if (w < v)
+ v = w;
+ if (need_P)
+ {
+ w = mpz_scan1 (P[0], 0);
+ if (w < v)
+ v = w;
+ }
+ /* now v = min(val(T), val(Q), val(P)) */
+ if (v > 0)
+ {
+ mpz_fdiv_q_2exp (T[0], T[0], v);
+ mpz_fdiv_q_2exp (Q[0], Q[0], v);
+ if (need_P)
+ mpz_fdiv_q_2exp (P[0], P[0], v);
+ }
+ }
+ }
+}
+
+/* Don't need to save / restore exponent range: the cache does it */
+int
+mpfr_const_log2_internal (mpfr_ptr x, mpfr_rnd_t rnd_mode)
+{
+ unsigned long n = MPFR_PREC (x);
+ mpfr_prec_t w; /* working precision */
+ unsigned long N;
+ mpz_t *T, *P, *Q;
+ mpfr_t t, q;
+ int inexact;
+ int ok = 1; /* ensures that the 1st try will give correct rounding */
+ unsigned long lgN, i;
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC (
+ ("rnd_mode=%d", rnd_mode),
+ ("x[%Pu]=%.*Rg inex=%d", mpfr_get_prec(x), mpfr_log_prec, x, inexact));
+
+ mpfr_init2 (t, MPFR_PREC_MIN);
+ mpfr_init2 (q, MPFR_PREC_MIN);
+
+ if (n < 1253)
+ w = n + 10; /* ensures correct rounding for the four rounding modes,
+ together with N = w / 3 + 1 (see below). */
+ else if (n < 2571)
+ w = n + 11; /* idem */
+ else if (n < 3983)
+ w = n + 12;
+ else if (n < 4854)
+ w = n + 13;
+ else if (n < 26248)
+ w = n + 14;
+ else
+ {
+ w = n + 15;
+ ok = 0;
+ }
+
+ MPFR_ZIV_INIT (loop, w);
+ for (;;)
+ {
+ N = w / 3 + 1; /* Warning: do not change that (even increasing N!)
+ without checking correct rounding in the above
+ ranges for n. */
+
+ /* the following are needed for error analysis (see algorithms.tex) */
+ MPFR_ASSERTD(w >= 3 && N >= 2);
+
+ lgN = MPFR_INT_CEIL_LOG2 (N) + 1;
+ T = (mpz_t *) (*__gmp_allocate_func) (3 * lgN * sizeof (mpz_t));
+ P = T + lgN;
+ Q = T + 2*lgN;
+ for (i = 0; i < lgN; i++)
+ {
+ mpz_init (T[i]);
+ mpz_init (P[i]);
+ mpz_init (Q[i]);
+ }
+
+ S (T, P, Q, 0, N, 0);
+
+ mpfr_set_prec (t, w);
+ mpfr_set_prec (q, w);
+
+ mpfr_set_z (t, T[0], MPFR_RNDN);
+ mpfr_set_z (q, Q[0], MPFR_RNDN);
+ mpfr_div (t, t, q, MPFR_RNDN);
+
+ for (i = 0; i < lgN; i++)
+ {
+ mpz_clear (T[i]);
+ mpz_clear (P[i]);
+ mpz_clear (Q[i]);
+ }
+ (*__gmp_free_func) (T, 3 * lgN * sizeof (mpz_t));
+
+ if (MPFR_LIKELY (ok != 0
+ || mpfr_can_round (t, w - 2, MPFR_RNDN, rnd_mode, n)))
+ break;
+
+ MPFR_ZIV_NEXT (loop, w);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (x, t, rnd_mode);
+
+ mpfr_clear (t);
+ mpfr_clear (q);
+
+ return inexact;
+}
diff --git a/src/const_pi.c b/src/const_pi.c
new file mode 100644
index 0000000..046ccc4
--- /dev/null
+++ b/src/const_pi.c
@@ -0,0 +1,128 @@
+/* mpfr_const_pi -- compute Pi
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Declare the cache */
+#ifndef MPFR_USE_LOGGING
+MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_pi, mpfr_const_pi_internal);
+#else
+MPFR_DECL_INIT_CACHE(__gmpfr_normal_pi, mpfr_const_pi_internal);
+MPFR_DECL_INIT_CACHE(__gmpfr_logging_pi, mpfr_const_pi_internal);
+mpfr_cache_ptr MPFR_THREAD_ATTR __gmpfr_cache_const_pi = __gmpfr_normal_pi;
+#endif
+
+/* Set User Interface */
+#undef mpfr_const_pi
+int
+mpfr_const_pi (mpfr_ptr x, mpfr_rnd_t rnd_mode) {
+ return mpfr_cache (x, __gmpfr_cache_const_pi, rnd_mode);
+}
+
+/* Don't need to save/restore exponent range: the cache does it */
+int
+mpfr_const_pi_internal (mpfr_ptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t a, A, B, D, S;
+ mpfr_prec_t px, p, cancel, k, kmax;
+ MPFR_ZIV_DECL (loop);
+ int inex;
+
+ MPFR_LOG_FUNC
+ (("rnd_mode=%d", rnd_mode),
+ ("x[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(x), mpfr_log_prec, x, inex));
+
+ px = MPFR_PREC (x);
+
+ /* we need 9*2^kmax - 4 >= px+2*kmax+8 */
+ for (kmax = 2; ((px + 2 * kmax + 12) / 9) >> kmax; kmax ++);
+
+ p = px + 3 * kmax + 14; /* guarantees no recomputation for px <= 10000 */
+
+ mpfr_init2 (a, p);
+ mpfr_init2 (A, p);
+ mpfr_init2 (B, p);
+ mpfr_init2 (D, p);
+ mpfr_init2 (S, p);
+
+ MPFR_ZIV_INIT (loop, p);
+ for (;;) {
+ mpfr_set_ui (a, 1, MPFR_RNDN); /* a = 1 */
+ mpfr_set_ui (A, 1, MPFR_RNDN); /* A = a^2 = 1 */
+ mpfr_set_ui_2exp (B, 1, -1, MPFR_RNDN); /* B = b^2 = 1/2 */
+ mpfr_set_ui_2exp (D, 1, -2, MPFR_RNDN); /* D = 1/4 */
+
+#define b B
+#define ap a
+#define Ap A
+#define Bp B
+ for (k = 0; ; k++)
+ {
+ /* invariant: 1/2 <= B <= A <= a < 1 */
+ mpfr_add (S, A, B, MPFR_RNDN); /* 1 <= S <= 2 */
+ mpfr_div_2ui (S, S, 2, MPFR_RNDN); /* exact, 1/4 <= S <= 1/2 */
+ mpfr_sqrt (b, B, MPFR_RNDN); /* 1/2 <= b <= 1 */
+ mpfr_add (ap, a, b, MPFR_RNDN); /* 1 <= ap <= 2 */
+ mpfr_div_2ui (ap, ap, 1, MPFR_RNDN); /* exact, 1/2 <= ap <= 1 */
+ mpfr_mul (Ap, ap, ap, MPFR_RNDN); /* 1/4 <= Ap <= 1 */
+ mpfr_sub (Bp, Ap, S, MPFR_RNDN); /* -1/4 <= Bp <= 3/4 */
+ mpfr_mul_2ui (Bp, Bp, 1, MPFR_RNDN); /* -1/2 <= Bp <= 3/2 */
+ mpfr_sub (S, Ap, Bp, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (S, 1) < 0);
+ cancel = mpfr_cmp_ui (S, 0) ? (mpfr_uexp_t) -mpfr_get_exp(S) : p;
+ /* MPFR_ASSERTN (cancel >= px || cancel >= 9 * (1 << k) - 4); */
+ mpfr_mul_2ui (S, S, k, MPFR_RNDN);
+ mpfr_sub (D, D, S, MPFR_RNDN);
+ /* stop when |A_k - B_k| <= 2^(k-p) i.e. cancel >= p-k */
+ if (cancel + k >= p)
+ break;
+ }
+#undef b
+#undef ap
+#undef Ap
+#undef Bp
+
+ mpfr_div (A, B, D, MPFR_RNDN);
+
+ /* MPFR_ASSERTN(p >= 2 * k + 8); */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (A, p - 2 * k - 8, px, rnd_mode)))
+ break;
+
+ p += kmax;
+ MPFR_ZIV_NEXT (loop, p);
+ mpfr_set_prec (a, p);
+ mpfr_set_prec (A, p);
+ mpfr_set_prec (B, p);
+ mpfr_set_prec (D, p);
+ mpfr_set_prec (S, p);
+ }
+ MPFR_ZIV_FREE (loop);
+ inex = mpfr_set (x, A, rnd_mode);
+
+ mpfr_clear (a);
+ mpfr_clear (A);
+ mpfr_clear (B);
+ mpfr_clear (D);
+ mpfr_clear (S);
+
+ return inex;
+}
diff --git a/src/constant.c b/src/constant.c
new file mode 100644
index 0000000..25ea40e
--- /dev/null
+++ b/src/constant.c
@@ -0,0 +1,28 @@
+/* MPFR internal constant FP numbers
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+static const mp_limb_t __gmpfr_limb1[1] = {MPFR_LIMB_HIGHBIT};
+const mpfr_t __gmpfr_one = {{2, MPFR_SIGN_POS, 1, (mp_limb_t*)__gmpfr_limb1}};
+const mpfr_t __gmpfr_two = {{2, MPFR_SIGN_POS, 2, (mp_limb_t*)__gmpfr_limb1}};
+const mpfr_t __gmpfr_four ={{2, MPFR_SIGN_POS, 3, (mp_limb_t*)__gmpfr_limb1}};
diff --git a/src/copysign.c b/src/copysign.c
new file mode 100644
index 0000000..e6e1281
--- /dev/null
+++ b/src/copysign.c
@@ -0,0 +1,38 @@
+/* mpfr_copysign -- Produce a value with the magnitude of x and sign bit of y
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+ /*
+ The computation of z with magnitude of x and sign of y:
+ z = (-1)^signbit(y) * abs(x), i.e. with the same sign bit as y,
+ even if z is a NaN.
+ Note: This function implements copysign from the IEEE-754 standard
+ when no rounding occurs (e.g. if PREC(z) >= PREC(x)).
+ */
+
+#undef mpfr_copysign
+int
+mpfr_copysign (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set4 (z, x, rnd_mode, MPFR_SIGN (y));
+}
diff --git a/src/cos.c b/src/cos.c
new file mode 100644
index 0000000..aeb9efa
--- /dev/null
+++ b/src/cos.c
@@ -0,0 +1,298 @@
+/* mpfr_cos -- cosine of a floating-point number
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+static int
+mpfr_cos_fast (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inex;
+
+ inex = mpfr_sincos_fast (NULL, y, x, rnd_mode);
+ inex = inex >> 2; /* 0: exact, 1: rounded up, 2: rounded down */
+ return (inex == 2) ? -1 : inex;
+}
+
+/* f <- 1 - r/2! + r^2/4! + ... + (-1)^l r^l/(2l)! + ...
+ Assumes |r| < 1/2, and f, r have the same precision.
+ Returns e such that the error on f is bounded by 2^e ulps.
+*/
+static int
+mpfr_cos2_aux (mpfr_ptr f, mpfr_srcptr r)
+{
+ mpz_t x, t, s;
+ mpfr_exp_t ex, l, m;
+ mpfr_prec_t p, q;
+ unsigned long i, maxi, imax;
+
+ MPFR_ASSERTD(mpfr_get_exp (r) <= -1);
+
+ /* compute minimal i such that i*(i+1) does not fit in an unsigned long,
+ assuming that there are no padding bits. */
+ maxi = 1UL << (CHAR_BIT * sizeof(unsigned long) / 2);
+ if (maxi * (maxi / 2) == 0) /* test checked at compile time */
+ {
+ /* can occur only when there are padding bits. */
+ /* maxi * (maxi-1) is representable iff maxi * (maxi / 2) != 0 */
+ do
+ maxi /= 2;
+ while (maxi * (maxi / 2) == 0);
+ }
+
+ mpz_init (x);
+ mpz_init (s);
+ mpz_init (t);
+ ex = mpfr_get_z_2exp (x, r); /* r = x*2^ex */
+
+ /* remove trailing zeroes */
+ l = mpz_scan1 (x, 0);
+ ex += l;
+ mpz_fdiv_q_2exp (x, x, l);
+
+ /* since |r| < 1, r = x*2^ex, and x is an integer, necessarily ex < 0 */
+
+ p = mpfr_get_prec (f); /* same than r */
+ /* bound for number of iterations */
+ imax = p / (-mpfr_get_exp (r));
+ imax += (imax == 0);
+ q = 2 * MPFR_INT_CEIL_LOG2(imax) + 4; /* bound for (3l)^2 */
+
+ mpz_set_ui (s, 1); /* initialize sum with 1 */
+ mpz_mul_2exp (s, s, p + q); /* scale all values by 2^(p+q) */
+ mpz_set (t, s); /* invariant: t is previous term */
+ for (i = 1; (m = mpz_sizeinbase (t, 2)) >= q; i += 2)
+ {
+ /* adjust precision of x to that of t */
+ l = mpz_sizeinbase (x, 2);
+ if (l > m)
+ {
+ l -= m;
+ mpz_fdiv_q_2exp (x, x, l);
+ ex += l;
+ }
+ /* multiply t by r */
+ mpz_mul (t, t, x);
+ mpz_fdiv_q_2exp (t, t, -ex);
+ /* divide t by i*(i+1) */
+ if (i < maxi)
+ mpz_fdiv_q_ui (t, t, i * (i + 1));
+ else
+ {
+ mpz_fdiv_q_ui (t, t, i);
+ mpz_fdiv_q_ui (t, t, i + 1);
+ }
+ /* if m is the (current) number of bits of t, we can consider that
+ all operations on t so far had precision >= m, so we can prove
+ by induction that the relative error on t is of the form
+ (1+u)^(3l)-1, where |u| <= 2^(-m), and l=(i+1)/2 is the # of loops.
+ Since |(1+x^2)^(1/x) - 1| <= 4x/3 for |x| <= 1/2,
+ for |u| <= 1/(3l)^2, the absolute error is bounded by
+ 4/3*(3l)*2^(-m)*t <= 4*l since |t| < 2^m.
+ Therefore the error on s is bounded by 2*l*(l+1). */
+ /* add or subtract to s */
+ if (i % 4 == 1)
+ mpz_sub (s, s, t);
+ else
+ mpz_add (s, s, t);
+ }
+
+ mpfr_set_z (f, s, MPFR_RNDN);
+ mpfr_div_2ui (f, f, p + q, MPFR_RNDN);
+
+ mpz_clear (x);
+ mpz_clear (s);
+ mpz_clear (t);
+
+ l = (i - 1) / 2; /* number of iterations */
+ return 2 * MPFR_INT_CEIL_LOG2 (l + 1) + 1; /* bound is 2l(l+1) */
+}
+
+int
+mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t K0, K, precy, m, k, l;
+ int inexact, reduce = 0;
+ mpfr_t r, s, xr, c;
+ mpfr_exp_t exps, cancel = 0, expx;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_GROUP_DECL (group);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%*.Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%*.Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* cos(x) = 1-x^2/2 + ..., so error < 2^(2*EXP(x)-1) */
+ expx = MPFR_GET_EXP (x);
+ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, -2 * expx,
+ 1, 0, rnd_mode, expo, {});
+
+ /* Compute initial precision */
+ precy = MPFR_PREC (y);
+
+ if (precy >= MPFR_SINCOS_THRESHOLD)
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_cos_fast (y, x, rnd_mode);
+ }
+
+ K0 = __gmpfr_isqrt (precy / 3);
+ m = precy + 2 * MPFR_INT_CEIL_LOG2 (precy) + 2 * K0;
+
+ if (expx >= 3)
+ {
+ reduce = 1;
+ /* As expx + m - 1 will silently be converted into mpfr_prec_t
+ in the mpfr_init2 call, the assert below may be useful to
+ avoid undefined behavior. */
+ MPFR_ASSERTN (expx + m - 1 <= MPFR_PREC_MAX);
+ mpfr_init2 (c, expx + m - 1);
+ mpfr_init2 (xr, m);
+ }
+
+ MPFR_GROUP_INIT_2 (group, m, r, s);
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ /* If |x| >= 4, first reduce x cmod (2*Pi) into xr, using mpfr_remainder:
+ let e = EXP(x) >= 3, and m the target precision:
+ (1) c <- 2*Pi [precision e+m-1, nearest]
+ (2) xr <- remainder (x, c) [precision m, nearest]
+ We have |c - 2*Pi| <= 1/2ulp(c) = 2^(3-e-m)
+ |xr - x - k c| <= 1/2ulp(xr) <= 2^(1-m)
+ |k| <= |x|/(2*Pi) <= 2^(e-2)
+ Thus |xr - x - 2kPi| <= |k| |c - 2Pi| + 2^(1-m) <= 2^(2-m).
+ It follows |cos(xr) - cos(x)| <= 2^(2-m). */
+ if (reduce)
+ {
+ mpfr_const_pi (c, MPFR_RNDN);
+ mpfr_mul_2ui (c, c, 1, MPFR_RNDN); /* 2Pi */
+ mpfr_remainder (xr, x, c, MPFR_RNDN);
+ if (MPFR_IS_ZERO(xr))
+ goto ziv_next;
+ /* now |xr| <= 4, thus r <= 16 below */
+ mpfr_mul (r, xr, xr, MPFR_RNDU); /* err <= 1 ulp */
+ }
+ else
+ mpfr_mul (r, x, x, MPFR_RNDU); /* err <= 1 ulp */
+
+ /* now |x| < 4 (or xr if reduce = 1), thus |r| <= 16 */
+
+ /* we need |r| < 1/2 for mpfr_cos2_aux, i.e., EXP(r) - 2K <= -1 */
+ K = K0 + 1 + MAX(0, MPFR_GET_EXP(r)) / 2;
+ /* since K0 >= 0, if EXP(r) < 0, then K >= 1, thus EXP(r) - 2K <= -3;
+ otherwise if EXP(r) >= 0, then K >= 1/2 + EXP(r)/2, thus
+ EXP(r) - 2K <= -1 */
+
+ MPFR_SET_EXP (r, MPFR_GET_EXP (r) - 2 * K); /* Can't overflow! */
+
+ /* s <- 1 - r/2! + ... + (-1)^l r^l/(2l)! */
+ l = mpfr_cos2_aux (s, r);
+ /* l is the error bound in ulps on s */
+ MPFR_SET_ONE (r);
+ for (k = 0; k < K; k++)
+ {
+ mpfr_sqr (s, s, MPFR_RNDU); /* err <= 2*olderr */
+ MPFR_SET_EXP (s, MPFR_GET_EXP (s) + 1); /* Can't overflow */
+ mpfr_sub (s, s, r, MPFR_RNDN); /* err <= 4*olderr */
+ if (MPFR_IS_ZERO(s))
+ goto ziv_next;
+ MPFR_ASSERTD (MPFR_GET_EXP (s) <= 1);
+ }
+
+ /* The absolute error on s is bounded by (2l+1/3)*2^(2K-m)
+ 2l+1/3 <= 2l+1.
+ If |x| >= 4, we need to add 2^(2-m) for the argument reduction
+ by 2Pi: if K = 0, this amounts to add 4 to 2l+1/3, i.e., to add
+ 2 to l; if K >= 1, this amounts to add 1 to 2*l+1/3. */
+ l = 2 * l + 1;
+ if (reduce)
+ l += (K == 0) ? 4 : 1;
+ k = MPFR_INT_CEIL_LOG2 (l) + 2*K;
+ /* now the error is bounded by 2^(k-m) = 2^(EXP(s)-err) */
+
+ exps = MPFR_GET_EXP (s);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, exps + m - k, precy, rnd_mode)))
+ break;
+
+ if (MPFR_UNLIKELY (exps == 1))
+ /* s = 1 or -1, and except x=0 which was already checked above,
+ cos(x) cannot be 1 or -1, so we can round if the error is less
+ than 2^(-precy) for directed rounding, or 2^(-precy-1) for rounding
+ to nearest. */
+ {
+ if (m > k && (m - k >= precy + (rnd_mode == MPFR_RNDN)))
+ {
+ /* If round to nearest or away, result is s = 1 or -1,
+ otherwise it is round(nexttoward (s, 0)). However in order to
+ have the inexact flag correctly set below, we set |s| to
+ 1 - 2^(-m) in all cases. */
+ mpfr_nexttozero (s);
+ break;
+ }
+ }
+
+ if (exps < cancel)
+ {
+ m += cancel - exps;
+ cancel = exps;
+ }
+
+ ziv_next:
+ MPFR_ZIV_NEXT (loop, m);
+ MPFR_GROUP_REPREC_2 (group, m, r, s);
+ if (reduce)
+ {
+ mpfr_set_prec (xr, m);
+ mpfr_set_prec (c, expx + m - 1);
+ }
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+ MPFR_GROUP_CLEAR (group);
+ if (reduce)
+ {
+ mpfr_clear (xr);
+ mpfr_clear (c);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/cosh.c b/src/cosh.c
new file mode 100644
index 0000000..dbef5aa
--- /dev/null
+++ b/src/cosh.c
@@ -0,0 +1,128 @@
+/* mpfr_cosh -- hyperbolic cosine
+
+Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of cosh is done by *
+ * cosh= 1/2[e^(x)+e^(-x)] */
+
+int
+mpfr_cosh (mpfr_ptr y, mpfr_srcptr xt , mpfr_rnd_t rnd_mode)
+{
+ mpfr_t x;
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%*.Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pu]=%*.Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(xt)))
+ {
+ if (MPFR_IS_NAN(xt))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(xt))
+ {
+ MPFR_SET_INF(y);
+ MPFR_SET_POS(y);
+ MPFR_RET(0);
+ }
+ else
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(xt));
+ return mpfr_set_ui (y, 1, rnd_mode); /* cosh(0) = 1 */
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* cosh(x) = 1+x^2/2 + ... <= 1+x^2 for x <= 2.9828...,
+ thus the error < 2^(2*EXP(x)). If x >= 1, then EXP(x) >= 1,
+ thus the following will always fail. */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, __gmpfr_one, -2 * MPFR_GET_EXP (xt), 0,
+ 1, rnd_mode, inexact = _inexact; goto end);
+
+ MPFR_TMP_INIT_ABS(x, xt);
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t, te;
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(y); /* Precision of output variable */
+ mpfr_prec_t Nt; /* Precision of the intermediary variable */
+ long int err; /* Precision of error */
+ MPFR_ZIV_DECL (loop);
+ MPFR_GROUP_DECL (group);
+
+ /* compute the precision of intermediary variable */
+ /* The optimal number of bits : see algorithms.tex */
+ Nt = Ny + 3 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ /* initialise of intermediary variables */
+ MPFR_GROUP_INIT_2 (group, Nt, t, te);
+
+ /* First computation of cosh */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* Compute cosh */
+ MPFR_BLOCK (flags, mpfr_exp (te, x, MPFR_RNDD)); /* exp(x) */
+ /* exp can overflow (but not underflow since x>0) */
+ if (MPFR_OVERFLOW (flags))
+ /* cosh(x) > exp(x), cosh(x) underflows too */
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+ mpfr_ui_div (t, 1, te, MPFR_RNDU); /* 1/exp(x) */
+ mpfr_add (t, te, t, MPFR_RNDU); /* exp(x) + 1/exp(x)*/
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* 1/2(exp(x) + 1/exp(x))*/
+
+ /* Estimation of the error */
+ err = Nt - 3;
+ /* Check if we can round */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ {
+ inexact = mpfr_set (y, t, rnd_mode);
+ break;
+ }
+
+ /* Actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ MPFR_GROUP_REPREC_2 (group, Nt, t, te);
+ }
+ MPFR_ZIV_FREE (loop);
+ MPFR_GROUP_CLEAR (group);
+ }
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/cot.c b/src/cot.c
new file mode 100644
index 0000000..21b786e
--- /dev/null
+++ b/src/cot.c
@@ -0,0 +1,96 @@
+/* mpfr_cot - cotangent function.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* the cotangent is defined by cot(x) = 1/tan(x) = cos(x)/sin(x).
+ cot (NaN) = NaN.
+ cot (+Inf) = csc (-Inf) = NaN.
+ cot (+0) = +Inf.
+ cot (-0) = -Inf.
+*/
+
+#define FUNCTION mpfr_cot
+#define INVERSE mpfr_tan
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \
+ mpfr_set_divby0 (); MPFR_RET(0); } while (1)
+
+/* (This analysis is adapted from that for mpfr_coth.)
+ Near x=0, cot(x) = 1/x - x/3 + ..., more precisely we have
+ |cot(x) - 1/x| <= 0.36 for |x| <= 1. The error term has
+ the opposite sign as 1/x, thus |cot(x)| <= |1/x|. Then:
+ (i) either x is a power of two, then 1/x is exactly representable, and
+ as long as 1/2*ulp(1/x) > 0.36, we can conclude;
+ (ii) otherwise assume x has <= n bits, and y has <= n+1 bits, then
+ |y - 1/x| >= 2^(-2n) ufp(y), where ufp means unit in first place.
+ Since |cot(x) - 1/x| <= 0.36, if 2^(-2n) ufp(y) >= 0.72, then
+ |y - cot(x)| >= 2^(-2n-1) ufp(y), and rounding 1/x gives the correct
+ result. If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1).
+ A sufficient condition is thus EXP(x) + 1 <= -2 MAX(PREC(x),PREC(Y)).
+ The division can be inexact in case of underflow or overflow; but
+ an underflow is not possible as emin = - emax. The overflow is a
+ real overflow possibly except when |x| = 2^emin. */
+#define ACTION_TINY(y,x,r) \
+ if (MPFR_EXP(x) + 1 <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \
+ { \
+ int two2emin; \
+ int signx = MPFR_SIGN(x); \
+ MPFR_ASSERTN (MPFR_EMIN_MIN + MPFR_EMAX_MAX == 0); \
+ if ((two2emin = mpfr_get_exp (x) == __gmpfr_emin + 1 && \
+ mpfr_powerof2_raw (x))) \
+ { \
+ /* Case |x| = 2^emin. 1/x is not representable; so, compute \
+ 1/(2x) instead (exact), and correct the result later. */ \
+ mpfr_set_si_2exp (y, signx, __gmpfr_emax, MPFR_RNDN); \
+ inexact = 0; \
+ } \
+ else \
+ inexact = mpfr_ui_div (y, 1, x, r); \
+ if (inexact == 0) /* x is a power of two */ \
+ { /* result always 1/x, except when rounding to zero */ \
+ if (rnd_mode == MPFR_RNDA) \
+ rnd_mode = (signx > 0) ? MPFR_RNDU : MPFR_RNDD; \
+ if (rnd_mode == MPFR_RNDU || (rnd_mode == MPFR_RNDZ && signx < 0)) \
+ { \
+ if (signx < 0) \
+ mpfr_nextabove (y); /* -2^k + epsilon */ \
+ inexact = 1; \
+ } \
+ else if (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ) \
+ { \
+ if (signx > 0) \
+ mpfr_nextbelow (y); /* 2^k - epsilon */ \
+ inexact = -1; \
+ } \
+ else /* round to nearest */ \
+ inexact = signx; \
+ if (two2emin) \
+ mpfr_mul_2ui (y, y, 1, r); /* overflow in MPFR_RNDN */ \
+ } \
+ /* Underflow is not possible with emin = - emax, but we cannot */ \
+ /* add an assert as the underflow flag could have already been */ \
+ /* set before the call to mpfr_cot. */ \
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); \
+ goto end; \
+ }
+
+#include "gen_inverse.h"
diff --git a/src/coth.c b/src/coth.c
new file mode 100644
index 0000000..5cc093b
--- /dev/null
+++ b/src/coth.c
@@ -0,0 +1,93 @@
+/* mpfr_coth - Hyperbolic cotangent function.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* the hyperbolic cotangent is defined by coth(x) = 1/tanh(x)
+ coth (NaN) = NaN.
+ coth (+Inf) = 1
+ coth (-Inf) = -1
+ coth (+0) = +Inf.
+ coth (-0) = -Inf.
+*/
+
+#define FUNCTION mpfr_coth
+#define INVERSE mpfr_tanh
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) return mpfr_set_si (y, MPFR_IS_POS(x) ? 1 : -1, rnd_mode)
+#define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \
+ mpfr_set_divby0 (); MPFR_RET(0); } while (1)
+
+/* We know |coth(x)| > 1, thus if the approximation z is such that
+ 1 <= z <= 1 + 2^(-p) where p is the target precision, then the
+ result is either 1 or nextabove(1) = 1 + 2^(1-p). */
+#define ACTION_SPECIAL \
+ if (MPFR_GET_EXP(z) == 1) /* 1 <= |z| < 2 */ \
+ { \
+ /* the following is exact by Sterbenz theorem */ \
+ mpfr_sub_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \
+ if (MPFR_IS_ZERO(z) || MPFR_GET_EXP(z) <= - (mpfr_exp_t) precy) \
+ { \
+ mpfr_add_si (z, z, MPFR_SIGN(z) > 0 ? 1 : -1, MPFR_RNDN); \
+ break; \
+ } \
+ }
+
+/* The analysis is adapted from that for mpfr_csc:
+ near x=0, coth(x) = 1/x + x/3 + ..., more precisely we have
+ |coth(x) - 1/x| <= 0.32 for |x| <= 1. Like for csc, the error term has
+ the same sign as 1/x, thus |coth(x)| >= |1/x|. Then:
+ (i) either x is a power of two, then 1/x is exactly representable, and
+ as long as 1/2*ulp(1/x) > 0.32, we can conclude;
+ (ii) otherwise assume x has <= n bits, and y has <= n+1 bits, then
+ |y - 1/x| >= 2^(-2n) ufp(y), where ufp means unit in first place.
+ Since |coth(x) - 1/x| <= 0.32, if 2^(-2n) ufp(y) >= 0.64, then
+ |y - coth(x)| >= 2^(-2n-1) ufp(y), and rounding 1/x gives the correct
+ result. If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1).
+ A sufficient condition is thus EXP(x) + 1 <= -2 MAX(PREC(x),PREC(Y)). */
+#define ACTION_TINY(y,x,r) \
+ if (MPFR_EXP(x) + 1 <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \
+ { \
+ int signx = MPFR_SIGN(x); \
+ inexact = mpfr_ui_div (y, 1, x, r); \
+ if (inexact == 0) /* x is a power of two */ \
+ { /* result always 1/x, except when rounding away from zero */ \
+ if (rnd_mode == MPFR_RNDA) \
+ rnd_mode = (signx > 0) ? MPFR_RNDU : MPFR_RNDD; \
+ if (rnd_mode == MPFR_RNDU) \
+ { \
+ if (signx > 0) \
+ mpfr_nextabove (y); /* 2^k + epsilon */ \
+ inexact = 1; \
+ } \
+ else if (rnd_mode == MPFR_RNDD) \
+ { \
+ if (signx < 0) \
+ mpfr_nextbelow (y); /* -2^k - epsilon */ \
+ inexact = -1; \
+ } \
+ else /* round to zero, or nearest */ \
+ inexact = -signx; \
+ } \
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); \
+ goto end; \
+ }
+
+#include "gen_inverse.h"
diff --git a/src/csc.c b/src/csc.c
new file mode 100644
index 0000000..c9cc236
--- /dev/null
+++ b/src/csc.c
@@ -0,0 +1,76 @@
+/* mpfr_csc - cosecant function.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* the cosecant is defined by csc(x) = 1/sin(x).
+ csc (NaN) = NaN.
+ csc (+Inf) = csc (-Inf) = NaN.
+ csc (+0) = +Inf.
+ csc (-0) = -Inf.
+*/
+
+#define FUNCTION mpfr_csc
+#define INVERSE mpfr_sin
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \
+ mpfr_set_divby0 (); MPFR_RET(0); } while (1)
+/* near x=0, we have csc(x) = 1/x + x/6 + ..., more precisely we have
+ |csc(x) - 1/x| <= 0.2 for |x| <= 1. The analysis is similar to that for
+ gamma(x) near x=0 (see gamma.c), except here the error term has the same
+ sign as 1/x, thus |csc(x)| >= |1/x|. Then:
+ (i) either x is a power of two, then 1/x is exactly representable, and
+ as long as 1/2*ulp(1/x) > 0.2, we can conclude;
+ (ii) otherwise assume x has <= n bits, and y has <= n+1 bits, then
+ |y - 1/x| >= 2^(-2n) ufp(y), where ufp means unit in first place.
+ Since |csc(x) - 1/x| <= 0.2, if 2^(-2n) ufp(y) >= 0.4, then
+ |y - csc(x)| >= 2^(-2n-1) ufp(y), and rounding 1/x gives the correct result.
+ If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1).
+ A sufficient condition is thus EXP(x) <= -2 MAX(PREC(x),PREC(Y)). */
+#define ACTION_TINY(y,x,r) \
+ if (MPFR_EXP(x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \
+ { \
+ int signx = MPFR_SIGN(x); \
+ inexact = mpfr_ui_div (y, 1, x, r); \
+ if (inexact == 0) /* x is a power of two */ \
+ { /* result always 1/x, except when rounding away from zero */ \
+ if (rnd_mode == MPFR_RNDA) \
+ rnd_mode = (signx > 0) ? MPFR_RNDU : MPFR_RNDD; \
+ if (rnd_mode == MPFR_RNDU) \
+ { \
+ if (signx > 0) \
+ mpfr_nextabove (y); /* 2^k + epsilon */ \
+ inexact = 1; \
+ } \
+ else if (rnd_mode == MPFR_RNDD) \
+ { \
+ if (signx < 0) \
+ mpfr_nextbelow (y); /* -2^k - epsilon */ \
+ inexact = -1; \
+ } \
+ else /* round to zero, or nearest */ \
+ inexact = -signx; \
+ } \
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); \
+ goto end; \
+ }
+
+#include "gen_inverse.h"
diff --git a/src/csch.c b/src/csch.c
new file mode 100644
index 0000000..2eecaf7
--- /dev/null
+++ b/src/csch.c
@@ -0,0 +1,79 @@
+/* mpfr_csch - Hyperbolic cosecant function.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* the hyperbolic cosecant is defined by csch(x) = 1/sinh(x).
+ csch (NaN) = NaN.
+ csch (+Inf) = +0.
+ csch (-Inf) = -0.
+ csch (+0) = +Inf.
+ csch (-0) = -Inf.
+*/
+
+#define FUNCTION mpfr_csch
+#define INVERSE mpfr_sinh
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_ZERO (y); \
+ MPFR_RET(0); } while (1)
+#define ACTION_ZERO(y,x) do { MPFR_SET_SAME_SIGN(y,x); MPFR_SET_INF(y); \
+ mpfr_set_divby0 (); MPFR_RET(0); } while (1)
+
+/* (This analysis is adapted from that for mpfr_csc.)
+ Near x=0, we have csch(x) = 1/x - x/6 + ..., more precisely we have
+ |csch(x) - 1/x| <= 0.2 for |x| <= 1. The error term has the opposite
+ sign as 1/x, thus |csch(x)| <= |1/x|. Then:
+ (i) either x is a power of two, then 1/x is exactly representable, and
+ as long as 1/2*ulp(1/x) > 0.2, we can conclude;
+ (ii) otherwise assume x has <= n bits, and y has <= n+1 bits, then
+ |y - 1/x| >= 2^(-2n) ufp(y), where ufp means unit in first place.
+ Since |csch(x) - 1/x| <= 0.2, if 2^(-2n) ufp(y) >= 0.4, then
+ |y - csch(x)| >= 2^(-2n-1) ufp(y), and rounding 1/x gives the correct
+ result. If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1).
+ A sufficient condition is thus EXP(x) <= -2 MAX(PREC(x),PREC(Y)). */
+#define ACTION_TINY(y,x,r) \
+ if (MPFR_EXP(x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y))) \
+ { \
+ int signx = MPFR_SIGN(x); \
+ inexact = mpfr_ui_div (y, 1, x, r); \
+ if (inexact == 0) /* x is a power of two */ \
+ { /* result always 1/x, except when rounding to zero */ \
+ if (rnd_mode == MPFR_RNDA) \
+ rnd_mode = (signx > 0) ? MPFR_RNDU : MPFR_RNDD; \
+ if (rnd_mode == MPFR_RNDU || (rnd_mode == MPFR_RNDZ && signx < 0)) \
+ { \
+ if (signx < 0) \
+ mpfr_nextabove (y); /* -2^k + epsilon */ \
+ inexact = 1; \
+ } \
+ else if (rnd_mode == MPFR_RNDD || rnd_mode == MPFR_RNDZ) \
+ { \
+ if (signx > 0) \
+ mpfr_nextbelow (y); /* 2^k - epsilon */ \
+ inexact = -1; \
+ } \
+ else /* round to nearest */ \
+ inexact = signx; \
+ } \
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); \
+ goto end; \
+ }
+
+#include "gen_inverse.h"
diff --git a/src/d_div.c b/src/d_div.c
new file mode 100644
index 0000000..4ddac9d
--- /dev/null
+++ b/src/d_div.c
@@ -0,0 +1,50 @@
+/* mpfr_d_div -- divide a machine double precision float
+ by a multiple precision floating-point number
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_d_div (mpfr_ptr a, double b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t d;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("b=%.20g c[%Pu]=%*.Rg rnd=%d", b, mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pu]=%*.Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (d, IEEE_DBL_MANT_DIG);
+ inexact = mpfr_set_d (d, b, rnd_mode);
+ MPFR_ASSERTN (inexact == 0);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_div (a, d, c, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
+ mpfr_clear(d);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (a, inexact, rnd_mode);
+}
diff --git a/src/d_sub.c b/src/d_sub.c
new file mode 100644
index 0000000..59d810f
--- /dev/null
+++ b/src/d_sub.c
@@ -0,0 +1,50 @@
+/* mpfr_d_sub -- subtract a multiple precision floating-point number
+ from a machine double precision float
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_d_sub (mpfr_ptr a, double b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t d;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("b=%.20g c[%Pu]=%*.Rg rnd=%d", b, mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pu]=%*.Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (d, IEEE_DBL_MANT_DIG);
+ inexact = mpfr_set_d (d, b, rnd_mode);
+ MPFR_ASSERTN (inexact == 0);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_sub (a, d, c, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
+ mpfr_clear(d);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (a, inexact, rnd_mode);
+}
diff --git a/src/digamma.c b/src/digamma.c
new file mode 100644
index 0000000..9eb971c
--- /dev/null
+++ b/src/digamma.c
@@ -0,0 +1,378 @@
+/* mpfr_digamma -- digamma function of a floating-point number
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Put in s an approximation of digamma(x).
+ Assumes x >= 2.
+ Assumes s does not overlap with x.
+ Returns an integer e such that the error is bounded by 2^e ulps
+ of the result s.
+*/
+static mpfr_exp_t
+mpfr_digamma_approx (mpfr_ptr s, mpfr_srcptr x)
+{
+ mpfr_prec_t p = MPFR_PREC (s);
+ mpfr_t t, u, invxx;
+ mpfr_exp_t e, exps, f, expu;
+ mpz_t *INITIALIZED(B); /* variable B declared as initialized */
+ unsigned long n0, n; /* number of allocated B[] */
+
+ MPFR_ASSERTN(MPFR_IS_POS(x) && (MPFR_EXP(x) >= 2));
+
+ mpfr_init2 (t, p);
+ mpfr_init2 (u, p);
+ mpfr_init2 (invxx, p);
+
+ mpfr_log (s, x, MPFR_RNDN); /* error <= 1/2 ulp */
+ mpfr_ui_div (t, 1, x, MPFR_RNDN); /* error <= 1/2 ulp */
+ mpfr_div_2exp (t, t, 1, MPFR_RNDN); /* exact */
+ mpfr_sub (s, s, t, MPFR_RNDN);
+ /* error <= 1/2 + 1/2*2^(EXP(olds)-EXP(s)) + 1/2*2^(EXP(t)-EXP(s)).
+ For x >= 2, log(x) >= 2*(1/(2x)), thus olds >= 2t, and olds - t >= olds/2,
+ thus 0 <= EXP(olds)-EXP(s) <= 1, and EXP(t)-EXP(s) <= 0, thus
+ error <= 1/2 + 1/2*2 + 1/2 <= 2 ulps. */
+ e = 2; /* initial error */
+ mpfr_mul (invxx, x, x, MPFR_RNDZ); /* invxx = x^2 * (1 + theta)
+ for |theta| <= 2^(-p) */
+ mpfr_ui_div (invxx, 1, invxx, MPFR_RNDU); /* invxx = 1/x^2 * (1 + theta)^2 */
+
+ /* in the following we note err=xxx when the ratio between the approximation
+ and the exact result can be written (1 + theta)^xxx for |theta| <= 2^(-p),
+ following Higham's method */
+ B = mpfr_bernoulli_internal ((mpz_t *) 0, 0);
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* err = 0 */
+ for (n = 1;; n++)
+ {
+ /* compute next Bernoulli number */
+ B = mpfr_bernoulli_internal (B, n);
+ /* The main term is Bernoulli[2n]/(2n)/x^(2n) = B[n]/(2n+1)!(2n)/x^(2n)
+ = B[n]*t[n]/(2n) where t[n]/t[n-1] = 1/(2n)/(2n+1)/x^2. */
+ mpfr_mul (t, t, invxx, MPFR_RNDU); /* err = err + 3 */
+ mpfr_div_ui (t, t, 2 * n, MPFR_RNDU); /* err = err + 1 */
+ mpfr_div_ui (t, t, 2 * n + 1, MPFR_RNDU); /* err = err + 1 */
+ /* we thus have err = 5n here */
+ mpfr_div_ui (u, t, 2 * n, MPFR_RNDU); /* err = 5n+1 */
+ mpfr_mul_z (u, u, B[n], MPFR_RNDU); /* err = 5n+2, and the
+ absolute error is bounded
+ by 10n+4 ulp(u) [Rule 11] */
+ /* if the terms 'u' are decreasing by a factor two at least,
+ then the error coming from those is bounded by
+ sum((10n+4)/2^n, n=1..infinity) = 24 */
+ exps = mpfr_get_exp (s);
+ expu = mpfr_get_exp (u);
+ if (expu < exps - (mpfr_exp_t) p)
+ break;
+ mpfr_sub (s, s, u, MPFR_RNDN); /* error <= 24 + n/2 */
+ if (mpfr_get_exp (s) < exps)
+ e <<= exps - mpfr_get_exp (s);
+ e ++; /* error in mpfr_sub */
+ f = 10 * n + 4;
+ while (expu < exps)
+ {
+ f = (1 + f) / 2;
+ expu ++;
+ }
+ e += f; /* total rouding error coming from 'u' term */
+ }
+
+ n0 = ++n;
+ while (n--)
+ mpz_clear (B[n]);
+ (*__gmp_free_func) (B, n0 * sizeof (mpz_t));
+
+ mpfr_clear (t);
+ mpfr_clear (u);
+ mpfr_clear (invxx);
+
+ f = 0;
+ while (e > 1)
+ {
+ f++;
+ e = (e + 1) / 2;
+ /* Invariant: 2^f * e does not decrease */
+ }
+ return f;
+}
+
+/* Use the reflection formula Digamma(1-x) = Digamma(x) + Pi * cot(Pi*x),
+ i.e., Digamma(x) = Digamma(1-x) - Pi * cot(Pi*x).
+ Assume x < 1/2. */
+static int
+mpfr_digamma_reflection (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t p = MPFR_PREC(y) + 10, q;
+ mpfr_t t, u, v;
+ mpfr_exp_t e1, expv;
+ int inex;
+ MPFR_ZIV_DECL (loop);
+
+ /* we want that 1-x is exact with precision q: if 0 < x < 1/2, then
+ q = PREC(x)-EXP(x) is ok, otherwise if -1 <= x < 0, q = PREC(x)-EXP(x)
+ is ok, otherwise for x < -1, PREC(x) is ok if EXP(x) <= PREC(x),
+ otherwise we need EXP(x) */
+ if (MPFR_EXP(x) < 0)
+ q = MPFR_PREC(x) + 1 - MPFR_EXP(x);
+ else if (MPFR_EXP(x) <= MPFR_PREC(x))
+ q = MPFR_PREC(x) + 1;
+ else
+ q = MPFR_EXP(x);
+ mpfr_init2 (u, q);
+ MPFR_ASSERTN(mpfr_ui_sub (u, 1, x, MPFR_RNDN) == 0);
+
+ /* if x is half an integer, cot(Pi*x) = 0, thus Digamma(x) = Digamma(1-x) */
+ mpfr_mul_2exp (u, u, 1, MPFR_RNDN);
+ inex = mpfr_integer_p (u);
+ mpfr_div_2exp (u, u, 1, MPFR_RNDN);
+ if (inex)
+ {
+ inex = mpfr_digamma (y, u, rnd_mode);
+ goto end;
+ }
+
+ mpfr_init2 (t, p);
+ mpfr_init2 (v, p);
+
+ MPFR_ZIV_INIT (loop, p);
+ for (;;)
+ {
+ mpfr_const_pi (v, MPFR_RNDN); /* v = Pi*(1+theta) for |theta|<=2^(-p) */
+ mpfr_mul (t, v, x, MPFR_RNDN); /* (1+theta)^2 */
+ e1 = MPFR_EXP(t) - (mpfr_exp_t) p + 1; /* bound for t: err(t) <= 2^e1 */
+ mpfr_cot (t, t, MPFR_RNDN);
+ /* cot(t * (1+h)) = cot(t) - theta * (1 + cot(t)^2) with |theta|<=t*h */
+ if (MPFR_EXP(t) > 0)
+ e1 = e1 + 2 * MPFR_EXP(t) + 1;
+ else
+ e1 = e1 + 1;
+ /* now theta * (1 + cot(t)^2) <= 2^e1 */
+ e1 += (mpfr_exp_t) p - MPFR_EXP(t); /* error is now 2^e1 ulps */
+ mpfr_mul (t, t, v, MPFR_RNDN);
+ e1 ++;
+ mpfr_digamma (v, u, MPFR_RNDN); /* error <= 1/2 ulp */
+ expv = MPFR_EXP(v);
+ mpfr_sub (v, v, t, MPFR_RNDN);
+ if (MPFR_EXP(v) < MPFR_EXP(t))
+ e1 += MPFR_EXP(t) - MPFR_EXP(v); /* scale error for t wrt new v */
+ /* now take into account the 1/2 ulp error for v */
+ if (expv - MPFR_EXP(v) - 1 > e1)
+ e1 = expv - MPFR_EXP(v) - 1;
+ else
+ e1 ++;
+ e1 ++; /* rounding error for mpfr_sub */
+ if (MPFR_CAN_ROUND (v, p - e1, MPFR_PREC(y), rnd_mode))
+ break;
+ MPFR_ZIV_NEXT (loop, p);
+ mpfr_set_prec (t, p);
+ mpfr_set_prec (v, p);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inex = mpfr_set (y, v, rnd_mode);
+
+ mpfr_clear (t);
+ mpfr_clear (v);
+ end:
+ mpfr_clear (u);
+
+ return inex;
+}
+
+/* we have x >= 1/2 here */
+static int
+mpfr_digamma_positive (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t p = MPFR_PREC(y) + 10, q;
+ mpfr_t t, u, x_plus_j;
+ int inex;
+ mpfr_exp_t errt, erru, expt;
+ unsigned long j = 0, min;
+ MPFR_ZIV_DECL (loop);
+
+ /* compute a precision q such that x+1 is exact */
+ if (MPFR_PREC(x) < MPFR_EXP(x))
+ q = MPFR_EXP(x);
+ else
+ q = MPFR_PREC(x) + 1;
+ mpfr_init2 (x_plus_j, q);
+
+ mpfr_init2 (t, p);
+ mpfr_init2 (u, p);
+ MPFR_ZIV_INIT (loop, p);
+ for(;;)
+ {
+ /* Lower bound for x+j in mpfr_digamma_approx call: since the smallest
+ term of the divergent series for Digamma(x) is about exp(-2*Pi*x), and
+ we want it to be less than 2^(-p), this gives x > p*log(2)/(2*Pi)
+ i.e., x >= 0.1103 p.
+ To be safe, we ensure x >= 0.25 * p.
+ */
+ min = (p + 3) / 4;
+ if (min < 2)
+ min = 2;
+
+ mpfr_set (x_plus_j, x, MPFR_RNDN);
+ mpfr_set_ui (u, 0, MPFR_RNDN);
+ j = 0;
+ while (mpfr_cmp_ui (x_plus_j, min) < 0)
+ {
+ j ++;
+ mpfr_ui_div (t, 1, x_plus_j, MPFR_RNDN); /* err <= 1/2 ulp */
+ mpfr_add (u, u, t, MPFR_RNDN);
+ inex = mpfr_add_ui (x_plus_j, x_plus_j, 1, MPFR_RNDZ);
+ if (inex != 0) /* we lost one bit */
+ {
+ q ++;
+ mpfr_prec_round (x_plus_j, q, MPFR_RNDZ);
+ mpfr_nextabove (x_plus_j);
+ }
+ /* since all terms are positive, the error is bounded by j ulps */
+ }
+ for (erru = 0; j > 1; erru++, j = (j + 1) / 2);
+ errt = mpfr_digamma_approx (t, x_plus_j);
+ expt = MPFR_EXP(t);
+ mpfr_sub (t, t, u, MPFR_RNDN);
+ if (MPFR_EXP(t) < expt)
+ errt += expt - MPFR_EXP(t);
+ if (MPFR_EXP(t) < MPFR_EXP(u))
+ erru += MPFR_EXP(u) - MPFR_EXP(t);
+ if (errt > erru)
+ errt = errt + 1;
+ else if (errt == erru)
+ errt = errt + 2;
+ else
+ errt = erru + 1;
+ if (MPFR_CAN_ROUND (t, p - errt, MPFR_PREC(y), rnd_mode))
+ break;
+ MPFR_ZIV_NEXT (loop, p);
+ mpfr_set_prec (t, p);
+ mpfr_set_prec (u, p);
+ }
+ MPFR_ZIV_FREE (loop);
+ inex = mpfr_set (y, t, rnd_mode);
+ mpfr_clear (t);
+ mpfr_clear (u);
+ mpfr_clear (x_plus_j);
+ return inex;
+}
+
+int
+mpfr_digamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
+
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
+ {
+ if (MPFR_IS_NAN(x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(x))
+ {
+ if (MPFR_IS_POS(x)) /* Digamma(+Inf) = +Inf */
+ {
+ MPFR_SET_SAME_SIGN(y, x);
+ MPFR_SET_INF(y);
+ MPFR_RET(0);
+ }
+ else /* Digamma(-Inf) = NaN */
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ }
+ else /* Zero case */
+ {
+ /* the following works also in case of overlap */
+ MPFR_SET_INF(y);
+ MPFR_SET_OPPOSITE_SIGN(y, x);
+ mpfr_set_divby0 ();
+ MPFR_RET(0);
+ }
+ }
+
+ /* Digamma is undefined for negative integers */
+ if (MPFR_IS_NEG(x) && mpfr_integer_p (x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+
+ /* now x is a normal number */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ /* for x very small, we have Digamma(x) = -1/x - gamma + O(x), more precisely
+ -1 < Digamma(x) + 1/x < 0 for -0.2 < x < 0.2, thus:
+ (i) either x is a power of two, then 1/x is exactly representable, and
+ as long as 1/2*ulp(1/x) > 1, we can conclude;
+ (ii) otherwise assume x has <= n bits, and y has <= n+1 bits, then
+ |y + 1/x| >= 2^(-2n) ufp(y), where ufp means unit in first place.
+ Since |Digamma(x) + 1/x| <= 1, if 2^(-2n) ufp(y) >= 2, then
+ |y - Digamma(x)| >= 2^(-2n-1)ufp(y), and rounding -1/x gives the correct result.
+ If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1).
+ A sufficient condition is thus EXP(x) <= -2 MAX(PREC(x),PREC(Y)). */
+ if (MPFR_EXP(x) < -2)
+ {
+ if (MPFR_EXP(x) <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(y)))
+ {
+ int signx = MPFR_SIGN(x);
+ inex = mpfr_si_div (y, -1, x, rnd_mode);
+ if (inex == 0) /* x is a power of two */
+ { /* result always -1/x, except when rounding down */
+ if (rnd_mode == MPFR_RNDA)
+ rnd_mode = (signx > 0) ? MPFR_RNDD : MPFR_RNDU;
+ if (rnd_mode == MPFR_RNDZ)
+ rnd_mode = (signx > 0) ? MPFR_RNDU : MPFR_RNDD;
+ if (rnd_mode == MPFR_RNDU)
+ inex = 1;
+ else if (rnd_mode == MPFR_RNDD)
+ {
+ mpfr_nextbelow (y);
+ inex = -1;
+ }
+ else /* nearest */
+ inex = 1;
+ }
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ goto end;
+ }
+ }
+
+ if (MPFR_IS_NEG(x))
+ inex = mpfr_digamma_reflection (y, x, rnd_mode);
+ /* if x < 1/2 we use the reflection formula */
+ else if (MPFR_EXP(x) < 0)
+ inex = mpfr_digamma_reflection (y, x, rnd_mode);
+ else
+ inex = mpfr_digamma_positive (y, x, rnd_mode);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex, rnd_mode);
+}
diff --git a/src/dim.c b/src/dim.c
new file mode 100644
index 0000000..29cab12
--- /dev/null
+++ b/src/dim.c
@@ -0,0 +1,48 @@
+/* mpfr_dim -- positive difference
+
+Copyright 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* dim (x,y) is defined as:
+
+ x-y if x > y
+ +0 if x <= y
+*/
+
+int
+mpfr_dim (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y))
+ {
+ MPFR_SET_NAN(z);
+ MPFR_RET_NAN;
+ }
+
+ if (mpfr_cmp (x,y) > 0)
+ return mpfr_sub (z, x, y, rnd_mode);
+ else
+ {
+ MPFR_SET_ZERO(z);
+ MPFR_SET_POS(z);
+ MPFR_RET(0);
+ }
+}
diff --git a/src/div.c b/src/div.c
new file mode 100644
index 0000000..e683482
--- /dev/null
+++ b/src/div.c
@@ -0,0 +1,790 @@
+/* mpfr_div -- divide two floating-point numbers
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* References:
+ [1] Short Division of Long Integers, David Harvey and Paul Zimmermann,
+ Proceedings of the 20th Symposium on Computer Arithmetic (ARITH-20),
+ July 25-27, 2011, pages 7-14.
+*/
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#ifdef DEBUG2
+#define mpfr_mpn_print(ap,n) mpfr_mpn_print3 (ap,n,MPFR_LIMB_ZERO)
+static void
+mpfr_mpn_print3 (mpfr_limb_ptr ap, mp_size_t n, mp_limb_t cy)
+{
+ mp_size_t i;
+ for (i = 0; i < n; i++)
+ printf ("+%lu*2^%lu", (unsigned long) ap[i], (unsigned long)
+ (GMP_NUMB_BITS * i));
+ if (cy)
+ printf ("+2^%lu", (unsigned long) (GMP_NUMB_BITS * n));
+ printf ("\n");
+}
+#endif
+
+/* check if {ap, an} is zero */
+static int
+mpfr_mpn_cmpzero (mpfr_limb_ptr ap, mp_size_t an)
+{
+ while (an > 0)
+ if (MPFR_LIKELY(ap[--an] != MPFR_LIMB_ZERO))
+ return 1;
+ return 0;
+}
+
+/* compare {ap, an} and {bp, bn} >> extra,
+ aligned by the more significant limbs.
+ Takes into account bp[0] for extra=1.
+*/
+static int
+mpfr_mpn_cmp_aux (mpfr_limb_ptr ap, mp_size_t an,
+ mpfr_limb_ptr bp, mp_size_t bn, int extra)
+{
+ int cmp = 0;
+ mp_size_t k;
+ mp_limb_t bb;
+
+ if (an >= bn)
+ {
+ k = an - bn;
+ while (cmp == 0 && bn > 0)
+ {
+ bn --;
+ bb = (extra) ? ((bp[bn+1] << (GMP_NUMB_BITS - 1)) | (bp[bn] >> 1))
+ : bp[bn];
+ cmp = (ap[k + bn] > bb) ? 1 : ((ap[k + bn] < bb) ? -1 : 0);
+ }
+ bb = (extra) ? bp[0] << (GMP_NUMB_BITS - 1) : MPFR_LIMB_ZERO;
+ while (cmp == 0 && k > 0)
+ {
+ k--;
+ cmp = (ap[k] > bb) ? 1 : ((ap[k] < bb) ? -1 : 0);
+ bb = MPFR_LIMB_ZERO; /* ensure we consider only once bp[0] & 1 */
+ }
+ if (cmp == 0 && bb != MPFR_LIMB_ZERO)
+ cmp = -1;
+ }
+ else /* an < bn */
+ {
+ k = bn - an;
+ while (cmp == 0 && an > 0)
+ {
+ an --;
+ bb = (extra) ? ((bp[k+an+1] << (GMP_NUMB_BITS - 1)) | (bp[k+an] >> 1))
+ : bp[k+an];
+ if (ap[an] > bb)
+ cmp = 1;
+ else if (ap[an] < bb)
+ cmp = -1;
+ }
+ while (cmp == 0 && k > 0)
+ {
+ k--;
+ bb = (extra) ? ((bp[k+1] << (GMP_NUMB_BITS - 1)) | (bp[k] >> 1))
+ : bp[k];
+ cmp = (bb != MPFR_LIMB_ZERO) ? -1 : 0;
+ }
+ if (cmp == 0 && extra && (bp[0] & MPFR_LIMB_ONE))
+ cmp = -1;
+ }
+ return cmp;
+}
+
+/* {ap, n} <- {ap, n} - {bp, n} >> extra - cy, with cy = 0 or 1.
+ Return borrow out.
+*/
+static mp_limb_t
+mpfr_mpn_sub_aux (mpfr_limb_ptr ap, mpfr_limb_ptr bp, mp_size_t n,
+ mp_limb_t cy, int extra)
+{
+ mp_limb_t bb, rp;
+
+ MPFR_ASSERTD (cy <= 1);
+ while (n--)
+ {
+ bb = (extra) ? ((bp[1] << (GMP_NUMB_BITS-1)) | (bp[0] >> 1)) : bp[0];
+ rp = ap[0] - bb - cy;
+ cy = (ap[0] < bb) || (cy && ~rp == MPFR_LIMB_ZERO) ?
+ MPFR_LIMB_ONE : MPFR_LIMB_ZERO;
+ ap[0] = rp;
+ ap ++;
+ bp ++;
+ }
+ MPFR_ASSERTD (cy <= 1);
+ return cy;
+}
+
+int
+mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode)
+{
+ mp_size_t q0size = MPFR_LIMB_SIZE(q); /* number of limbs of destination */
+ mp_size_t usize = MPFR_LIMB_SIZE(u);
+ mp_size_t vsize = MPFR_LIMB_SIZE(v);
+ mp_size_t qsize; /* number of limbs wanted for the computed quotient */
+ mp_size_t qqsize;
+ mp_size_t k;
+ mpfr_limb_ptr q0p = MPFR_MANT(q), qp;
+ mpfr_limb_ptr up = MPFR_MANT(u);
+ mpfr_limb_ptr vp = MPFR_MANT(v);
+ mpfr_limb_ptr ap;
+ mpfr_limb_ptr bp;
+ mp_limb_t qh;
+ mp_limb_t sticky_u = MPFR_LIMB_ZERO;
+ mp_limb_t low_u;
+ mp_limb_t sticky_v = MPFR_LIMB_ZERO;
+ mp_limb_t sticky;
+ mp_limb_t sticky3;
+ mp_limb_t round_bit = MPFR_LIMB_ZERO;
+ mpfr_exp_t qexp;
+ int sign_quotient;
+ int extra_bit;
+ int sh, sh2;
+ int inex;
+ int like_rndz;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_LOG_FUNC (
+ ("u[%Pu]=%.*Rg v[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec(u), mpfr_log_prec, u,
+ mpfr_get_prec (v),mpfr_log_prec, v, rnd_mode),
+ ("q[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(q), mpfr_log_prec, q, inex));
+
+ /**************************************************************************
+ * *
+ * This part of the code deals with special cases *
+ * *
+ **************************************************************************/
+
+ if (MPFR_UNLIKELY(MPFR_ARE_SINGULAR(u,v)))
+ {
+ if (MPFR_IS_NAN(u) || MPFR_IS_NAN(v))
+ {
+ MPFR_SET_NAN(q);
+ MPFR_RET_NAN;
+ }
+ sign_quotient = MPFR_MULT_SIGN( MPFR_SIGN(u) , MPFR_SIGN(v) );
+ MPFR_SET_SIGN(q, sign_quotient);
+ if (MPFR_IS_INF(u))
+ {
+ if (MPFR_IS_INF(v))
+ {
+ MPFR_SET_NAN(q);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_SET_INF(q);
+ MPFR_RET(0);
+ }
+ }
+ else if (MPFR_IS_INF(v))
+ {
+ MPFR_SET_ZERO (q);
+ MPFR_RET (0);
+ }
+ else if (MPFR_IS_ZERO (v))
+ {
+ if (MPFR_IS_ZERO (u))
+ {
+ MPFR_SET_NAN(q);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_ASSERTD (! MPFR_IS_INF (u));
+ MPFR_SET_INF(q);
+ mpfr_set_divby0 ();
+ MPFR_RET(0);
+ }
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (u));
+ MPFR_SET_ZERO (q);
+ MPFR_RET (0);
+ }
+ }
+
+ /**************************************************************************
+ * *
+ * End of the part concerning special values. *
+ * *
+ **************************************************************************/
+
+ MPFR_TMP_MARK(marker);
+
+ /* set sign */
+ sign_quotient = MPFR_MULT_SIGN( MPFR_SIGN(u) , MPFR_SIGN(v) );
+ MPFR_SET_SIGN(q, sign_quotient);
+
+ /* determine if an extra bit comes from the division, i.e. if the
+ significand of u (as a fraction in [1/2, 1[) is larger than that
+ of v */
+ if (MPFR_LIKELY(up[usize - 1] != vp[vsize - 1]))
+ extra_bit = (up[usize - 1] > vp[vsize - 1]) ? 1 : 0;
+ else /* most significant limbs are equal, must look at further limbs */
+ {
+ mp_size_t l;
+
+ k = usize - 1;
+ l = vsize - 1;
+ while (k != 0 && l != 0 && up[--k] == vp[--l]);
+ /* now k=0 or l=0 or up[k] != vp[l] */
+ if (up[k] > vp[l])
+ extra_bit = 1;
+ else if (up[k] < vp[l])
+ extra_bit = 0;
+ /* now up[k] = vp[l], thus either k=0 or l=0 */
+ else if (l == 0) /* no more divisor limb */
+ extra_bit = 1;
+ else /* k=0: no more dividend limb */
+ extra_bit = mpfr_mpn_cmpzero (vp, l) == 0;
+ }
+#ifdef DEBUG
+ printf ("extra_bit=%d\n", extra_bit);
+#endif
+
+ /* set exponent */
+ qexp = MPFR_GET_EXP (u) - MPFR_GET_EXP (v) + extra_bit;
+
+ /* sh is the number of zero bits in the low limb of the quotient */
+ MPFR_UNSIGNED_MINUS_MODULO(sh, MPFR_PREC(q));
+
+ like_rndz = rnd_mode == MPFR_RNDZ ||
+ rnd_mode == (sign_quotient < 0 ? MPFR_RNDU : MPFR_RNDD);
+
+ /**************************************************************************
+ * *
+ * We first try Mulders' short division (for large operands) *
+ * *
+ **************************************************************************/
+
+ if (MPFR_UNLIKELY(q0size >= MPFR_DIV_THRESHOLD &&
+ vsize >= MPFR_DIV_THRESHOLD))
+ {
+ mp_size_t n = q0size + 1; /* we will perform a short (2n)/n division */
+ mpfr_limb_ptr ap, bp, qp;
+ mpfr_prec_t p;
+
+ /* since Mulders' short division clobbers the dividend, we have to
+ copy it */
+ ap = MPFR_TMP_LIMBS_ALLOC (n + n);
+ if (usize >= n + n) /* truncate the dividend */
+ MPN_COPY(ap, up + usize - (n + n), n + n);
+ else /* zero-pad the dividend */
+ {
+ MPN_COPY(ap + (n + n) - usize, up, usize);
+ MPN_ZERO(ap, (n + n) - usize);
+ }
+
+ if (vsize >= n) /* truncate the divisor */
+ bp = vp + vsize - n;
+ else /* zero-pad the divisor */
+ {
+ bp = MPFR_TMP_LIMBS_ALLOC (n);
+ MPN_COPY(bp + n - vsize, vp, vsize);
+ MPN_ZERO(bp, n - vsize);
+ }
+
+ qp = MPFR_TMP_LIMBS_ALLOC (n);
+ qh = mpfr_divhigh_n (qp, ap, bp, n);
+ /* in all cases, the error is at most (2n+2) ulps on qh*B^n+{qp,n},
+ cf algorithms.tex */
+
+ p = n * GMP_NUMB_BITS - MPFR_INT_CEIL_LOG2 (2 * n + 2);
+ /* if qh is 1, then we need only PREC(q)-1 bits of {qp,n},
+ if rnd=RNDN, we need to be able to round with a directed rounding
+ and one more bit */
+ if (MPFR_LIKELY (mpfr_round_p (qp, n, p,
+ MPFR_PREC(q) + (rnd_mode == MPFR_RNDN) - qh)))
+ {
+ /* we can round correctly whatever the rounding mode */
+ if (qh == 0)
+ MPN_COPY (q0p, qp + 1, q0size);
+ else
+ {
+ mpn_rshift (q0p, qp + 1, q0size, 1);
+ q0p[q0size - 1] ^= MPFR_LIMB_HIGHBIT;
+ }
+ q0p[0] &= ~MPFR_LIMB_MASK(sh); /* put to zero low sh bits */
+
+ if (rnd_mode == MPFR_RNDN) /* round to nearest */
+ {
+ /* we know we can round, thus we are never in the even rule case:
+ if the round bit is 0, we truncate
+ if the round bit is 1, we add 1 */
+ if (qh == 0)
+ {
+ if (sh > 0)
+ round_bit = (qp[1] >> (sh - 1)) & 1;
+ else
+ round_bit = qp[0] >> (GMP_NUMB_BITS - 1);
+ }
+ else /* qh = 1 */
+ round_bit = (qp[1] >> sh) & 1;
+ if (round_bit == 0)
+ {
+ inex = -1;
+ goto truncate;
+ }
+ else /* round_bit = 1 */
+ goto add_one_ulp;
+ }
+ else if (like_rndz == 0) /* round away */
+ goto add_one_ulp;
+ /* else round to zero: nothing to do */
+ else
+ {
+ inex = -1;
+ goto truncate;
+ }
+ }
+ }
+
+ /**************************************************************************
+ * *
+ * Mulders' short division failed: we revert to integer division *
+ * *
+ **************************************************************************/
+
+ if (MPFR_UNLIKELY(rnd_mode == MPFR_RNDN && sh == 0))
+ { /* we compute the quotient with one more limb, in order to get
+ the round bit in the quotient, and the remainder only contains
+ sticky bits */
+ qsize = q0size + 1;
+ /* need to allocate memory for the quotient */
+ qp = MPFR_TMP_LIMBS_ALLOC (qsize);
+ }
+ else
+ {
+ qsize = q0size;
+ qp = q0p; /* directly put the quotient in the destination */
+ }
+ qqsize = qsize + qsize;
+
+ /* prepare the dividend */
+ ap = MPFR_TMP_LIMBS_ALLOC (qqsize);
+ if (MPFR_LIKELY(qqsize > usize)) /* use the full dividend */
+ {
+ k = qqsize - usize; /* k > 0 */
+ MPN_ZERO(ap, k);
+ if (extra_bit)
+ ap[k - 1] = mpn_rshift (ap + k, up, usize, 1);
+ else
+ MPN_COPY(ap + k, up, usize);
+ }
+ else /* truncate the dividend */
+ {
+ k = usize - qqsize;
+ if (extra_bit)
+ sticky_u = mpn_rshift (ap, up + k, qqsize, 1);
+ else
+ MPN_COPY(ap, up + k, qqsize);
+ sticky_u = sticky_u || mpfr_mpn_cmpzero (up, k);
+ }
+ low_u = sticky_u;
+
+ /* now sticky_u is non-zero iff the truncated part of u is non-zero */
+
+ /* prepare the divisor */
+ if (MPFR_LIKELY(vsize >= qsize))
+ {
+ k = vsize - qsize;
+ if (qp != vp)
+ bp = vp + k; /* avoid copying the divisor */
+ else /* need to copy, since mpn_divrem doesn't allow overlap
+ between quotient and divisor, necessarily k = 0
+ since quotient and divisor are the same mpfr variable */
+ {
+ bp = MPFR_TMP_LIMBS_ALLOC (qsize);
+ MPN_COPY(bp, vp, vsize);
+ }
+ sticky_v = sticky_v || mpfr_mpn_cmpzero (vp, k);
+ k = 0;
+ }
+ else /* vsize < qsize: small divisor case */
+ {
+ bp = vp;
+ k = qsize - vsize;
+ }
+
+ /**************************************************************************
+ * *
+ * Here we perform the real division of {ap+k,qqsize-k} by {bp,qsize-k} *
+ * *
+ **************************************************************************/
+
+ /* if Mulders' short division failed, we revert to division with remainder */
+ qh = mpn_divrem (qp, 0, ap + k, qqsize - k, bp, qsize - k);
+ /* warning: qh may be 1 if u1 == v1, but u < v */
+#ifdef DEBUG2
+ printf ("q="); mpfr_mpn_print (qp, qsize);
+ printf ("r="); mpfr_mpn_print (ap, qsize);
+#endif
+
+ k = qsize;
+ sticky_u = sticky_u || mpfr_mpn_cmpzero (ap, k);
+
+ sticky = sticky_u | sticky_v;
+
+ /* now sticky is non-zero iff one of the following holds:
+ (a) the truncated part of u is non-zero
+ (b) the truncated part of v is non-zero
+ (c) the remainder from division is non-zero */
+
+ if (MPFR_LIKELY(qsize == q0size))
+ {
+ sticky3 = qp[0] & MPFR_LIMB_MASK(sh); /* does nothing when sh=0 */
+ sh2 = sh;
+ }
+ else /* qsize = q0size + 1: only happens when rnd_mode=MPFR_RNDN and sh=0 */
+ {
+ MPN_COPY (q0p, qp + 1, q0size);
+ sticky3 = qp[0];
+ sh2 = GMP_NUMB_BITS;
+ }
+ qp[0] ^= sticky3;
+ /* sticky3 contains the truncated bits from the quotient,
+ including the round bit, and 1 <= sh2 <= GMP_NUMB_BITS
+ is the number of bits in sticky3 */
+ inex = (sticky != MPFR_LIMB_ZERO) || (sticky3 != MPFR_LIMB_ZERO);
+#ifdef DEBUG
+ printf ("sticky=%lu sticky3=%lu inex=%d\n",
+ (unsigned long) sticky, (unsigned long) sticky3, inex);
+#endif
+
+ /* to round, we distinguish two cases:
+ (a) vsize <= qsize: we used the full divisor
+ (b) vsize > qsize: the divisor was truncated
+ */
+
+#ifdef DEBUG
+ printf ("vsize=%lu qsize=%lu\n",
+ (unsigned long) vsize, (unsigned long) qsize);
+#endif
+ if (MPFR_LIKELY(vsize <= qsize)) /* use the full divisor */
+ {
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ round_bit = sticky3 & (MPFR_LIMB_ONE << (sh2 - 1));
+ sticky = (sticky3 ^ round_bit) | sticky_u;
+ }
+ else if (like_rndz || inex == 0)
+ sticky = (inex == 0) ? MPFR_LIMB_ZERO : MPFR_LIMB_ONE;
+ else /* round away from zero */
+ sticky = MPFR_LIMB_ONE;
+ goto case_1;
+ }
+ else /* vsize > qsize: need to truncate the divisor */
+ {
+ if (inex == 0)
+ goto truncate;
+ else
+ {
+ /* We know the estimated quotient is an upper bound of the exact
+ quotient (with rounding toward zero), with a difference of at
+ most 2 in qp[0].
+ Thus we can round except when sticky3 is 000...000 or 000...001
+ for directed rounding, and 100...000 or 100...001 for rounding
+ to nearest. (For rounding to nearest, we cannot determine the
+ inexact flag for 000...000 or 000...001.)
+ */
+ mp_limb_t sticky3orig = sticky3;
+ if (rnd_mode == MPFR_RNDN)
+ {
+ round_bit = sticky3 & (MPFR_LIMB_ONE << (sh2 - 1));
+ sticky3 = sticky3 ^ round_bit;
+#ifdef DEBUG
+ printf ("rb=%lu sb=%lu\n",
+ (unsigned long) round_bit, (unsigned long) sticky3);
+#endif
+ }
+ if (sticky3 != MPFR_LIMB_ZERO && sticky3 != MPFR_LIMB_ONE)
+ {
+ sticky = sticky3;
+ goto case_1;
+ }
+ else /* hard case: we have to compare q1 * v0 and r + low(u),
+ where q1 * v0 has qsize + (vsize-qsize) = vsize limbs, and
+ r + low(u) has qsize + (usize-2*qsize) = usize-qsize limbs */
+ {
+ mp_size_t l;
+ mpfr_limb_ptr sp;
+ int cmp_s_r;
+ mp_limb_t qh2;
+
+ sp = MPFR_TMP_LIMBS_ALLOC (vsize);
+ k = vsize - qsize;
+ /* sp <- {qp, qsize} * {vp, vsize-qsize} */
+ qp[0] ^= sticky3orig; /* restore original quotient */
+ if (qsize >= k)
+ mpn_mul (sp, qp, qsize, vp, k);
+ else
+ mpn_mul (sp, vp, k, qp, qsize);
+ if (qh)
+ qh2 = mpn_add_n (sp + qsize, sp + qsize, vp, k);
+ else
+ qh2 = (mp_limb_t) 0;
+ qp[0] ^= sticky3orig; /* restore truncated quotient */
+
+ /* compare qh2 + {sp, k + qsize} to {ap, qsize} + low(u) */
+ cmp_s_r = (qh2 != 0) ? 1 : mpn_cmp (sp + k, ap, qsize);
+ if (cmp_s_r == 0) /* compare {sp, k} and low(u) */
+ {
+ cmp_s_r = (usize >= qqsize) ?
+ mpfr_mpn_cmp_aux (sp, k, up, usize - qqsize, extra_bit) :
+ mpfr_mpn_cmpzero (sp, k);
+ }
+#ifdef DEBUG
+ printf ("cmp(q*v0,r+u0)=%d\n", cmp_s_r);
+#endif
+ /* now cmp_s_r > 0 if {sp, vsize} > {ap, qsize} + low(u)
+ cmp_s_r = 0 if {sp, vsize} = {ap, qsize} + low(u)
+ cmp_s_r < 0 if {sp, vsize} < {ap, qsize} + low(u) */
+ if (cmp_s_r <= 0) /* quotient is in [q1, q1+1) */
+ {
+ sticky = (cmp_s_r == 0) ? sticky3 : MPFR_LIMB_ONE;
+ goto case_1;
+ }
+ else /* cmp_s_r > 0, quotient is < q1: to determine if it is
+ in [q1-2,q1-1] or in [q1-1,q1], we need to subtract
+ the low part u0 of the dividend u0 from q*v0 */
+ {
+ mp_limb_t cy = MPFR_LIMB_ZERO;
+
+ /* subtract low(u)>>extra_bit if non-zero */
+ if (qh2 != 0) /* whatever the value of {up, m + k}, it
+ will be smaller than qh2 + {sp, k} */
+ cmp_s_r = 1;
+ else
+ {
+ if (low_u != MPFR_LIMB_ZERO)
+ {
+ mp_size_t m;
+ l = usize - qqsize; /* number of low limbs in u */
+ m = (l > k) ? l - k : 0;
+ cy = (extra_bit) ?
+ (up[m] & MPFR_LIMB_ONE) : MPFR_LIMB_ZERO;
+ if (l >= k) /* u0 has more limbs than s:
+ first look if {up, m} is not zero,
+ and compare {sp, k} and {up + m, k} */
+ {
+ cy = cy || mpfr_mpn_cmpzero (up, m);
+ low_u = cy;
+ cy = mpfr_mpn_sub_aux (sp, up + m, k,
+ cy, extra_bit);
+ }
+ else /* l < k: s has more limbs than u0 */
+ {
+ low_u = MPFR_LIMB_ZERO;
+ if (cy != MPFR_LIMB_ZERO)
+ cy = mpn_sub_1 (sp + k - l - 1, sp + k - l - 1,
+ 1, MPFR_LIMB_HIGHBIT);
+ cy = mpfr_mpn_sub_aux (sp + k - l, up, l,
+ cy, extra_bit);
+ }
+ }
+ MPFR_ASSERTD (cy <= 1);
+ cy = mpn_sub_1 (sp + k, sp + k, qsize, cy);
+ /* subtract r */
+ cy += mpn_sub_n (sp + k, sp + k, ap, qsize);
+ MPFR_ASSERTD (cy <= 1);
+ /* now compare {sp, ssize} to v */
+ cmp_s_r = mpn_cmp (sp, vp, vsize);
+ if (cmp_s_r == 0 && low_u != MPFR_LIMB_ZERO)
+ cmp_s_r = 1; /* since in fact we subtracted
+ less than 1 */
+ }
+#ifdef DEBUG
+ printf ("cmp(q*v0-(r+u0),v)=%d\n", cmp_s_r);
+#endif
+ if (cmp_s_r <= 0) /* q1-1 <= u/v < q1 */
+ {
+ if (sticky3 == MPFR_LIMB_ONE)
+ { /* q1-1 is either representable (directed rounding),
+ or the middle of two numbers (nearest) */
+ sticky = (cmp_s_r) ? MPFR_LIMB_ONE : MPFR_LIMB_ZERO;
+ goto case_1;
+ }
+ /* now necessarily sticky3=0 */
+ else if (round_bit == MPFR_LIMB_ZERO)
+ { /* round_bit=0, sticky3=0: q1-1 is exact only
+ when sh=0 */
+ inex = (cmp_s_r || sh) ? -1 : 0;
+ if (rnd_mode == MPFR_RNDN ||
+ (! like_rndz && inex != 0))
+ {
+ inex = 1;
+ goto truncate_check_qh;
+ }
+ else /* round down */
+ goto sub_one_ulp;
+ }
+ else /* sticky3=0, round_bit=1 ==> rounding to nearest */
+ {
+ inex = cmp_s_r;
+ goto truncate;
+ }
+ }
+ else /* q1-2 < u/v < q1-1 */
+ {
+ /* if rnd=MPFR_RNDN, the result is q1 when
+ q1-2 >= q1-2^(sh-1), i.e. sh >= 2,
+ otherwise (sh=1) it is q1-2 */
+ if (rnd_mode == MPFR_RNDN) /* sh > 0 */
+ {
+ /* Case sh=1: sb=0 always, and q1-rb is exactly
+ representable, like q1-rb-2.
+ rb action
+ 0 subtract two ulps, inex=-1
+ 1 truncate, inex=1
+
+ Case sh>1: one ulp is 2^(sh-1) >= 2
+ rb sb action
+ 0 0 truncate, inex=1
+ 0 1 truncate, inex=1
+ 1 x truncate, inex=-1
+ */
+ if (sh == 1)
+ {
+ if (round_bit == MPFR_LIMB_ZERO)
+ {
+ inex = -1;
+ sh = 0;
+ goto sub_two_ulp;
+ }
+ else
+ {
+ inex = 1;
+ goto truncate_check_qh;
+ }
+ }
+ else /* sh > 1 */
+ {
+ inex = (round_bit == MPFR_LIMB_ZERO) ? 1 : -1;
+ goto truncate_check_qh;
+ }
+ }
+ else if (like_rndz)
+ {
+ /* the result is down(q1-2), i.e. subtract one
+ ulp if sh > 0, and two ulps if sh=0 */
+ inex = -1;
+ if (sh > 0)
+ goto sub_one_ulp;
+ else
+ goto sub_two_ulp;
+ }
+ /* if round away from zero, the result is up(q1-1),
+ which is q1 unless sh = 0, where it is q1-1 */
+ else
+ {
+ inex = 1;
+ if (sh > 0)
+ goto truncate_check_qh;
+ else /* sh = 0 */
+ goto sub_one_ulp;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ case_1: /* quotient is in [q1, q1+1),
+ round_bit is the round_bit (0 for directed rounding),
+ sticky the sticky bit */
+ if (like_rndz || (round_bit == MPFR_LIMB_ZERO && sticky == MPFR_LIMB_ZERO))
+ {
+ inex = round_bit == MPFR_LIMB_ZERO && sticky == MPFR_LIMB_ZERO ? 0 : -1;
+ goto truncate;
+ }
+ else if (rnd_mode == MPFR_RNDN) /* sticky <> 0 or round <> 0 */
+ {
+ if (round_bit == MPFR_LIMB_ZERO) /* necessarily sticky <> 0 */
+ {
+ inex = -1;
+ goto truncate;
+ }
+ /* round_bit = 1 */
+ else if (sticky != MPFR_LIMB_ZERO)
+ goto add_one_ulp; /* inex=1 */
+ else /* round_bit=1, sticky=0 */
+ goto even_rule;
+ }
+ else /* round away from zero, sticky <> 0 */
+ goto add_one_ulp; /* with inex=1 */
+
+ sub_two_ulp:
+ /* we cannot subtract MPFR_LIMB_MPFR_LIMB_ONE << (sh+1) since this is
+ undefined for sh = GMP_NUMB_BITS */
+ qh -= mpn_sub_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh);
+ /* go through */
+
+ sub_one_ulp:
+ qh -= mpn_sub_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh);
+ /* go through truncate_check_qh */
+
+ truncate_check_qh:
+ if (qh)
+ {
+ qexp ++;
+ q0p[q0size - 1] = MPFR_LIMB_HIGHBIT;
+ }
+ goto truncate;
+
+ even_rule: /* has to set inex */
+ inex = (q0p[0] & (MPFR_LIMB_ONE << sh)) ? 1 : -1;
+ if (inex < 0)
+ goto truncate;
+ /* else go through add_one_ulp */
+
+ add_one_ulp:
+ inex = 1; /* always here */
+ if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh))
+ {
+ qexp ++;
+ q0p[q0size - 1] = MPFR_LIMB_HIGHBIT;
+ }
+
+ truncate: /* inex already set */
+
+ MPFR_TMP_FREE(marker);
+
+ /* check for underflow/overflow */
+ if (MPFR_UNLIKELY(qexp > __gmpfr_emax))
+ return mpfr_overflow (q, rnd_mode, sign_quotient);
+ else if (MPFR_UNLIKELY(qexp < __gmpfr_emin))
+ {
+ if (rnd_mode == MPFR_RNDN && ((qexp < __gmpfr_emin - 1) ||
+ (inex >= 0 && mpfr_powerof2_raw (q))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (q, rnd_mode, sign_quotient);
+ }
+ MPFR_SET_EXP(q, qexp);
+
+ inex *= sign_quotient;
+ MPFR_RET (inex);
+}
diff --git a/src/div_2exp.c b/src/div_2exp.c
new file mode 100644
index 0000000..1dedd3b
--- /dev/null
+++ b/src/div_2exp.c
@@ -0,0 +1,33 @@
+/* mpfr_div_2exp -- divide a floating-point number by a power of two
+
+Copyright 1999, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Obsolete function, use mpfr_div_2ui or mpfr_div_2si instead. */
+
+#undef mpfr_div_2exp
+
+int
+mpfr_div_2exp (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_div_2ui (y, x, n, rnd_mode);
+}
diff --git a/src/div_2si.c b/src/div_2si.c
new file mode 100644
index 0000000..5de15b9
--- /dev/null
+++ b/src/div_2si.c
@@ -0,0 +1,60 @@
+/* mpfr_div_2si -- divide a floating-point number by a power of two
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ mpfr_get_prec(x), mpfr_log_prec, x, n, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_set (y, x, rnd_mode);
+ else
+ {
+ mpfr_exp_t exp = MPFR_GET_EXP (x);
+ MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
+ if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emin > MPFR_EMAX_MAX - n ||
+ exp < __gmpfr_emin + n)) )
+ {
+ if (rnd_mode == MPFR_RNDN &&
+ (__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) ||
+ exp < __gmpfr_emin + (n - 1) ||
+ (inexact >= 0 && mpfr_powerof2_raw (y))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
+ }
+ else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
+ exp > __gmpfr_emax + n)) )
+ return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
+
+ MPFR_SET_EXP (y, exp - n);
+ }
+
+ MPFR_RET (inexact);
+}
diff --git a/src/div_2ui.c b/src/div_2ui.c
new file mode 100644
index 0000000..89e0488
--- /dev/null
+++ b/src/div_2ui.c
@@ -0,0 +1,61 @@
+/* mpfr_div_2ui -- divide a floating-point number by a power of two
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg n=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, n,
+ rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_set (y, x, rnd_mode);
+ else
+ {
+ mpfr_exp_t exp = MPFR_GET_EXP (x);
+ mpfr_uexp_t diffexp;
+
+ MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
+ diffexp = (mpfr_uexp_t) exp - (mpfr_uexp_t) (__gmpfr_emin - 1);
+ if (MPFR_UNLIKELY (n >= diffexp)) /* exp - n <= emin - 1 */
+ {
+ if (rnd_mode == MPFR_RNDN &&
+ (n > diffexp || (inexact >= 0 && mpfr_powerof2_raw (y))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (y, rnd_mode, MPFR_SIGN (y));
+ }
+ /* exp - n >= emin (no underflow, no integer overflow) */
+ while (n > LONG_MAX)
+ {
+ n -= LONG_MAX;
+ exp -= LONG_MAX; /* note: signed values */
+ }
+ MPFR_SET_EXP (y, exp - (long) n);
+ }
+
+ MPFR_RET (inexact);
+}
diff --git a/src/div_d.c b/src/div_d.c
new file mode 100644
index 0000000..e2f6c9f
--- /dev/null
+++ b/src/div_d.c
@@ -0,0 +1,51 @@
+/* mpfr_div_d -- divide a multiple precision floating-point number
+ by a machine double precision float
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_div_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t d;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("b[%Pu]=%.*Rg c%.20g rnd=%d", mpfr_get_prec (b), mpfr_log_prec, b, c,
+ rnd_mode),
+ ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (d, IEEE_DBL_MANT_DIG);
+ inexact = mpfr_set_d (d, c, rnd_mode);
+ MPFR_ASSERTN (inexact == 0);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_div (a, b, d, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
+ mpfr_clear(d);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (a, inexact, rnd_mode);
+}
diff --git a/src/div_ui.c b/src/div_ui.c
new file mode 100644
index 0000000..8688411
--- /dev/null
+++ b/src/div_ui.c
@@ -0,0 +1,281 @@
+/* mpfr_div_{ui,si} -- divide a floating-point number by a machine integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* returns 0 if result exact, non-zero otherwise */
+int
+mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode)
+{
+ long i;
+ int sh;
+ mp_size_t xn, yn, dif;
+ mp_limb_t *xp, *yp, *tmp, c, d;
+ mpfr_exp_t exp;
+ int inexact, middle = 1, nexttoinf;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg u=%lu rnd=%d",
+ mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO(x));
+ if (u == 0) /* 0/0 is NaN */
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_SET_ZERO(y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET(0);
+ }
+ }
+ }
+ else if (MPFR_UNLIKELY (u <= 1))
+ {
+ if (u < 1)
+ {
+ /* x/0 is Inf since x != 0*/
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ mpfr_set_divby0 ();
+ MPFR_RET (0);
+ }
+ else /* y = x/1 = x */
+ return mpfr_set (y, x, rnd_mode);
+ }
+ else if (MPFR_UNLIKELY (IS_POW2 (u)))
+ return mpfr_div_2si (y, x, MPFR_INT_CEIL_LOG2 (u), rnd_mode);
+
+ MPFR_SET_SAME_SIGN (y, x);
+
+ MPFR_TMP_MARK (marker);
+ xn = MPFR_LIMB_SIZE (x);
+ yn = MPFR_LIMB_SIZE (y);
+
+ xp = MPFR_MANT (x);
+ yp = MPFR_MANT (y);
+ exp = MPFR_GET_EXP (x);
+
+ dif = yn + 1 - xn;
+
+ /* we need to store yn+1 = xn + dif limbs of the quotient */
+ /* don't use tmp=yp since the mpn_lshift call below requires yp >= tmp+1 */
+ tmp = MPFR_TMP_LIMBS_ALLOC (yn + 1);
+
+ c = (mp_limb_t) u;
+ MPFR_ASSERTN (u == c);
+ if (dif >= 0)
+ c = mpn_divrem_1 (tmp, dif, xp, xn, c); /* used all the dividend */
+ else /* dif < 0 i.e. xn > yn, don't use the (-dif) low limbs from x */
+ c = mpn_divrem_1 (tmp, 0, xp - dif, yn + 1, c);
+
+ inexact = (c != 0);
+
+ /* First pass in estimating next bit of the quotient, in case of RNDN *
+ * In case we just have the right number of bits (postpone this ?), *
+ * we need to check whether the remainder is more or less than half *
+ * the divisor. The test must be performed with a subtraction, so as *
+ * to prevent carries. */
+
+ if (MPFR_LIKELY (rnd_mode == MPFR_RNDN))
+ {
+ if (c < (mp_limb_t) u - c) /* We have u > c */
+ middle = -1;
+ else if (c > (mp_limb_t) u - c)
+ middle = 1;
+ else
+ middle = 0; /* exactly in the middle */
+ }
+
+ /* If we believe that we are right in the middle or exact, we should check
+ that we did not neglect any word of x (division large / 1 -> small). */
+
+ for (i=0; ((inexact == 0) || (middle == 0)) && (i < -dif); i++)
+ if (xp[i])
+ inexact = middle = 1; /* larger than middle */
+
+ /*
+ If the high limb of the result is 0 (xp[xn-1] < u), remove it.
+ Otherwise, compute the left shift to be performed to normalize.
+ In the latter case, we discard some low bits computed. They
+ contain information useful for the rounding, hence the updating
+ of middle and inexact.
+ */
+
+ if (tmp[yn] == 0)
+ {
+ MPN_COPY(yp, tmp, yn);
+ exp -= GMP_NUMB_BITS;
+ }
+ else
+ {
+ int shlz;
+
+ count_leading_zeros (shlz, tmp[yn]);
+
+ /* shift left to normalize */
+ if (MPFR_LIKELY (shlz != 0))
+ {
+ mp_limb_t w = tmp[0] << shlz;
+
+ mpn_lshift (yp, tmp + 1, yn, shlz);
+ yp[0] += tmp[0] >> (GMP_NUMB_BITS - shlz);
+
+ if (w > (MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1)))
+ { middle = 1; }
+ else if (w < (MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1)))
+ { middle = -1; }
+ else
+ { middle = (c != 0); }
+
+ inexact = inexact || (w != 0);
+ exp -= shlz;
+ }
+ else
+ { /* this happens only if u == 1 and xp[xn-1] >=
+ 1<<(GMP_NUMB_BITS-1). It might be better to handle the
+ u == 1 case seperately ?
+ */
+
+ MPN_COPY (yp, tmp + 1, yn);
+ }
+ }
+
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (y));
+ /* it remains sh bits in less significant limb of y */
+
+ d = *yp & MPFR_LIMB_MASK (sh);
+ *yp ^= d; /* set to zero lowest sh bits */
+
+ MPFR_TMP_FREE (marker);
+
+ if (exp < __gmpfr_emin - 1)
+ return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
+ MPFR_SIGN (y));
+
+ if (MPFR_UNLIKELY (d == 0 && inexact == 0))
+ nexttoinf = 0; /* result is exact */
+ else
+ {
+ MPFR_UPDATE2_RND_MODE(rnd_mode, MPFR_SIGN (y));
+ switch (rnd_mode)
+ {
+ case MPFR_RNDZ:
+ inexact = - MPFR_INT_SIGN (y); /* result is inexact */
+ nexttoinf = 0;
+ break;
+
+ case MPFR_RNDA:
+ inexact = MPFR_INT_SIGN (y);
+ nexttoinf = 1;
+ break;
+
+ default: /* should be MPFR_RNDN */
+ MPFR_ASSERTD (rnd_mode == MPFR_RNDN);
+ /* We have one more significant bit in yn. */
+ if (sh && d < (MPFR_LIMB_ONE << (sh - 1)))
+ {
+ inexact = - MPFR_INT_SIGN (y);
+ nexttoinf = 0;
+ }
+ else if (sh && d > (MPFR_LIMB_ONE << (sh - 1)))
+ {
+ inexact = MPFR_INT_SIGN (y);
+ nexttoinf = 1;
+ }
+ else /* sh = 0 or d = 1 << (sh-1) */
+ {
+ /* The first case is "false" even rounding (significant bits
+ indicate even rounding, but the result is inexact, so up) ;
+ The second case is the case where middle should be used to
+ decide the direction of rounding (no further bit computed) ;
+ The third is the true even rounding.
+ */
+ if ((sh && inexact) || (!sh && middle > 0) ||
+ (!inexact && *yp & (MPFR_LIMB_ONE << sh)))
+ {
+ inexact = MPFR_INT_SIGN (y);
+ nexttoinf = 1;
+ }
+ else
+ {
+ inexact = - MPFR_INT_SIGN (y);
+ nexttoinf = 0;
+ }
+ }
+ }
+ }
+
+ if (nexttoinf &&
+ MPFR_UNLIKELY (mpn_add_1 (yp, yp, yn, MPFR_LIMB_ONE << sh)))
+ {
+ exp++;
+ yp[yn-1] = MPFR_LIMB_HIGHBIT;
+ }
+
+ /* Set the exponent. Warning! One may still have an underflow. */
+ MPFR_EXP (y) = exp;
+
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
+
+int
+mpfr_div_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
+{
+ int res;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(y), mpfr_log_prec, y, res));
+
+ if (u >= 0)
+ res = mpfr_div_ui (y, x, u, rnd_mode);
+ else
+ {
+ res = -mpfr_div_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ }
+ return res;
+}
diff --git a/src/dump.c b/src/dump.c
new file mode 100644
index 0000000..9c5fda6
--- /dev/null
+++ b/src/dump.c
@@ -0,0 +1,30 @@
+/* mpfr_dump -- Dump a float to stdout.
+
+Copyright 1999, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_dump (mpfr_srcptr u)
+{
+ mpfr_print_binary(u);
+ putchar('\n');
+}
diff --git a/src/eint.c b/src/eint.c
new file mode 100644
index 0000000..05bf0ce
--- /dev/null
+++ b/src/eint.c
@@ -0,0 +1,319 @@
+/* mpfr_eint, mpfr_eint1 -- the exponential integral
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* eint1(x) = -gamma - log(x) - sum((-1)^k*z^k/k/k!, k=1..infinity) for x > 0
+ = - eint(-x) for x < 0
+ where
+ eint (x) = gamma + log(x) + sum(z^k/k/k!, k=1..infinity) for x > 0
+ eint (x) is undefined for x < 0.
+*/
+
+/* compute in y an approximation of sum(x^k/k/k!, k=1..infinity),
+ and return e such that the absolute error is bound by 2^e ulp(y) */
+static mpfr_exp_t
+mpfr_eint_aux (mpfr_t y, mpfr_srcptr x)
+{
+ mpfr_t eps; /* dynamic (absolute) error bound on t */
+ mpfr_t erru, errs;
+ mpz_t m, s, t, u;
+ mpfr_exp_t e, sizeinbase;
+ mpfr_prec_t w = MPFR_PREC(y);
+ unsigned long k;
+ MPFR_GROUP_DECL (group);
+
+ /* for |x| <= 1, we have S := sum(x^k/k/k!, k=1..infinity) = x + R(x)
+ where |R(x)| <= (x/2)^2/(1-x/2) <= 2*(x/2)^2
+ thus |R(x)/x| <= |x|/2
+ thus if |x| <= 2^(-PREC(y)) we have |S - o(x)| <= ulp(y) */
+
+ if (MPFR_GET_EXP(x) <= - (mpfr_exp_t) w)
+ {
+ mpfr_set (y, x, MPFR_RNDN);
+ return 0;
+ }
+
+ mpz_init (s); /* initializes to 0 */
+ mpz_init (t);
+ mpz_init (u);
+ mpz_init (m);
+ MPFR_GROUP_INIT_3 (group, 31, eps, erru, errs);
+ e = mpfr_get_z_2exp (m, x); /* x = m * 2^e */
+ MPFR_ASSERTD (mpz_sizeinbase (m, 2) == MPFR_PREC (x));
+ if (MPFR_PREC (x) > w)
+ {
+ e += MPFR_PREC (x) - w;
+ mpz_tdiv_q_2exp (m, m, MPFR_PREC (x) - w);
+ }
+ /* remove trailing zeroes from m: this will speed up much cases where
+ x is a small integer divided by a power of 2 */
+ k = mpz_scan1 (m, 0);
+ mpz_tdiv_q_2exp (m, m, k);
+ e += k;
+ /* initialize t to 2^w */
+ mpz_set_ui (t, 1);
+ mpz_mul_2exp (t, t, w);
+ mpfr_set_ui (eps, 0, MPFR_RNDN); /* eps[0] = 0 */
+ mpfr_set_ui (errs, 0, MPFR_RNDN);
+ for (k = 1;; k++)
+ {
+ /* let eps[k] be the absolute error on t[k]:
+ since t[k] = trunc(t[k-1]*m*2^e/k), we have
+ eps[k+1] <= 1 + eps[k-1]*m*2^e/k + t[k-1]*m*2^(1-w)*2^e/k
+ = 1 + (eps[k-1] + t[k-1]*2^(1-w))*m*2^e/k
+ = 1 + (eps[k-1]*2^(w-1) + t[k-1])*2^(1-w)*m*2^e/k */
+ mpfr_mul_2ui (eps, eps, w - 1, MPFR_RNDU);
+ mpfr_add_z (eps, eps, t, MPFR_RNDU);
+ MPFR_MPZ_SIZEINBASE2 (sizeinbase, m);
+ mpfr_mul_2si (eps, eps, sizeinbase - (w - 1) + e, MPFR_RNDU);
+ mpfr_div_ui (eps, eps, k, MPFR_RNDU);
+ mpfr_add_ui (eps, eps, 1, MPFR_RNDU);
+ mpz_mul (t, t, m);
+ if (e < 0)
+ mpz_tdiv_q_2exp (t, t, -e);
+ else
+ mpz_mul_2exp (t, t, e);
+ mpz_tdiv_q_ui (t, t, k);
+ mpz_tdiv_q_ui (u, t, k);
+ mpz_add (s, s, u);
+ /* the absolute error on u is <= 1 + eps[k]/k */
+ mpfr_div_ui (erru, eps, k, MPFR_RNDU);
+ mpfr_add_ui (erru, erru, 1, MPFR_RNDU);
+ /* and that on s is the sum of all errors on u */
+ mpfr_add (errs, errs, erru, MPFR_RNDU);
+ /* we are done when t is smaller than errs */
+ if (mpz_sgn (t) == 0)
+ sizeinbase = 0;
+ else
+ MPFR_MPZ_SIZEINBASE2 (sizeinbase, t);
+ if (sizeinbase < MPFR_GET_EXP (errs))
+ break;
+ }
+ /* the truncation error is bounded by (|t|+eps)/k*(|x|/k + |x|^2/k^2 + ...)
+ <= (|t|+eps)/k*|x|/(k-|x|) */
+ mpz_abs (t, t);
+ mpfr_add_z (eps, eps, t, MPFR_RNDU);
+ mpfr_div_ui (eps, eps, k, MPFR_RNDU);
+ mpfr_abs (erru, x, MPFR_RNDU); /* |x| */
+ mpfr_mul (eps, eps, erru, MPFR_RNDU);
+ mpfr_ui_sub (erru, k, erru, MPFR_RNDD);
+ if (MPFR_IS_NEG (erru))
+ {
+ /* the truncated series does not converge, return fail */
+ e = w;
+ }
+ else
+ {
+ mpfr_div (eps, eps, erru, MPFR_RNDU);
+ mpfr_add (errs, errs, eps, MPFR_RNDU);
+ mpfr_set_z (y, s, MPFR_RNDN);
+ mpfr_div_2ui (y, y, w, MPFR_RNDN);
+ /* errs was an absolute error bound on s. We must convert it to an error
+ in terms of ulp(y). Since ulp(y) = 2^(EXP(y)-PREC(y)), we must
+ divide the error by 2^(EXP(y)-PREC(y)), but since we divided also
+ y by 2^w = 2^PREC(y), we must simply divide by 2^EXP(y). */
+ e = MPFR_GET_EXP (errs) - MPFR_GET_EXP (y);
+ }
+ MPFR_GROUP_CLEAR (group);
+ mpz_clear (s);
+ mpz_clear (t);
+ mpz_clear (u);
+ mpz_clear (m);
+ return e;
+}
+
+/* Return in y an approximation of Ei(x) using the asymptotic expansion:
+ Ei(x) = exp(x)/x * (1 + 1/x + 2/x^2 + ... + k!/x^k + ...)
+ Assumes x >= PREC(y) * log(2).
+ Returns the error bound in terms of ulp(y).
+*/
+static mpfr_exp_t
+mpfr_eint_asympt (mpfr_ptr y, mpfr_srcptr x)
+{
+ mpfr_prec_t p = MPFR_PREC(y);
+ mpfr_t invx, t, err;
+ unsigned long k;
+ mpfr_exp_t err_exp;
+
+ mpfr_init2 (t, p);
+ mpfr_init2 (invx, p);
+ mpfr_init2 (err, 31); /* error in ulps on y */
+ mpfr_ui_div (invx, 1, x, MPFR_RNDN); /* invx = 1/x*(1+u) with |u|<=2^(1-p) */
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* exact */
+ mpfr_set (y, t, MPFR_RNDN);
+ mpfr_set_ui (err, 0, MPFR_RNDN);
+ for (k = 1; MPFR_GET_EXP(t) + (mpfr_exp_t) p > MPFR_GET_EXP(y); k++)
+ {
+ mpfr_mul (t, t, invx, MPFR_RNDN); /* 2 more roundings */
+ mpfr_mul_ui (t, t, k, MPFR_RNDN); /* 1 more rounding: t = k!/x^k*(1+u)^e
+ with u=2^{-p} and |e| <= 3*k */
+ /* we use the fact that |(1+u)^n-1| <= 2*|n*u| for |n*u| <= 1, thus
+ the error on t is less than 6*k*2^{-p}*t <= 6*k*ulp(t) */
+ /* err is in terms of ulp(y): transform it in terms of ulp(t) */
+ mpfr_mul_2si (err, err, MPFR_GET_EXP(y) - MPFR_GET_EXP(t), MPFR_RNDU);
+ mpfr_add_ui (err, err, 6 * k, MPFR_RNDU);
+ /* transform back in terms of ulp(y) */
+ mpfr_div_2si (err, err, MPFR_GET_EXP(y) - MPFR_GET_EXP(t), MPFR_RNDU);
+ mpfr_add (y, y, t, MPFR_RNDN);
+ }
+ /* add the truncation error bounded by ulp(y): 1 ulp */
+ mpfr_mul (y, y, invx, MPFR_RNDN); /* err <= 2*err + 3/2 */
+ mpfr_exp (t, x, MPFR_RNDN); /* err(t) <= 1/2*ulp(t) */
+ mpfr_mul (y, y, t, MPFR_RNDN); /* again: err <= 2*err + 3/2 */
+ mpfr_mul_2ui (err, err, 2, MPFR_RNDU);
+ mpfr_add_ui (err, err, 8, MPFR_RNDU);
+ err_exp = MPFR_GET_EXP(err);
+ mpfr_clear (t);
+ mpfr_clear (invx);
+ mpfr_clear (err);
+ return err_exp;
+}
+
+int
+mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inex;
+ mpfr_t tmp, ump;
+ mpfr_exp_t err, te;
+ mpfr_prec_t prec;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ /* exp(NaN) = exp(-Inf) = NaN */
+ if (MPFR_IS_NAN (x) || (MPFR_IS_INF (x) && MPFR_IS_NEG(x)))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ /* eint(+inf) = +inf */
+ else if (MPFR_IS_INF (x))
+ {
+ MPFR_SET_INF(y);
+ MPFR_SET_POS(y);
+ MPFR_RET(0);
+ }
+ else /* eint(+/-0) = -Inf */
+ {
+ MPFR_SET_INF(y);
+ MPFR_SET_NEG(y);
+ mpfr_set_divby0 ();
+ MPFR_RET(0);
+ }
+ }
+
+ /* eint(x) = NaN for x < 0 */
+ if (MPFR_IS_NEG(x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Since eint(x) >= exp(x)/x, we have log2(eint(x)) >= (x-log(x))/log(2).
+ Let's compute k <= (x-log(x))/log(2) in a low precision. If k >= emax,
+ then log2(eint(x)) >= emax, and eint(x) >= 2^emax, i.e. it overflows. */
+ mpfr_init2 (tmp, 64);
+ mpfr_init2 (ump, 64);
+ mpfr_log (tmp, x, MPFR_RNDU);
+ mpfr_sub (ump, x, tmp, MPFR_RNDD);
+ mpfr_const_log2 (tmp, MPFR_RNDU);
+ mpfr_div (ump, ump, tmp, MPFR_RNDD);
+ /* FIXME: We really need mpfr_set_exp_t and mpfr_cmpfr_exp_t functions. */
+ MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX);
+ if (mpfr_cmp_ui (ump, __gmpfr_emax) >= 0)
+ {
+ mpfr_clear (tmp);
+ mpfr_clear (ump);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_overflow (y, rnd, 1);
+ }
+
+ /* Init stuff */
+ prec = MPFR_PREC (y) + 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC (y)) + 6;
+
+ /* eint() has a root 0.37250741078136663446..., so if x is near,
+ already take more bits */
+ /* FIXME: do not use native floating-point here. */
+ if (MPFR_GET_EXP(x) == -1) /* 1/4 <= x < 1/2 */
+ {
+ double d;
+ d = mpfr_get_d (x, MPFR_RNDN) - 0.37250741078136663;
+ d = (d == 0.0) ? -53 : __gmpfr_ceil_log2 (d);
+ prec += -d;
+ }
+
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (ump, prec);
+
+ MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controler */
+ for (;;) /* Infinite loop */
+ {
+ /* We need that the smallest value of k!/x^k is smaller than 2^(-p).
+ The minimum is obtained for x=k, and it is smaller than e*sqrt(x)/e^x
+ for x>=1. */
+ if (MPFR_GET_EXP (x) > 0 && mpfr_cmp_d (x, ((double) prec +
+ 0.5 * (double) MPFR_GET_EXP (x)) * LOG2 + 1.0) > 0)
+ err = mpfr_eint_asympt (tmp, x);
+ else
+ {
+ err = mpfr_eint_aux (tmp, x); /* error <= 2^err ulp(tmp) */
+ te = MPFR_GET_EXP(tmp);
+ mpfr_const_euler (ump, MPFR_RNDN); /* 0.577 -> EXP(ump)=0 */
+ mpfr_add (tmp, tmp, ump, MPFR_RNDN);
+ /* error <= 1/2 + 1/2*2^(EXP(ump)-EXP(tmp)) + 2^(te-EXP(tmp)+err)
+ <= 1/2 + 2^(MAX(EXP(ump), te+err+1) - EXP(tmp))
+ <= 2^(MAX(0, 1 + MAX(EXP(ump), te+err+1) - EXP(tmp))) */
+ err = MAX(1, te + err + 2) - MPFR_GET_EXP(tmp);
+ err = MAX(0, err);
+ te = MPFR_GET_EXP(tmp);
+ mpfr_log (ump, x, MPFR_RNDN);
+ mpfr_add (tmp, tmp, ump, MPFR_RNDN);
+ /* same formula as above, except now EXP(ump) is not 0 */
+ err += te + 1;
+ if (MPFR_LIKELY (!MPFR_IS_ZERO (ump)))
+ err = MAX (MPFR_GET_EXP (ump), err);
+ err = MAX(0, err - MPFR_GET_EXP (tmp));
+ }
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - err, MPFR_PREC (y), rnd)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec); /* Increase used precision */
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (ump, prec);
+ }
+ MPFR_ZIV_FREE (loop); /* Free the ZivLoop Controler */
+
+ inex = mpfr_set (y, tmp, rnd); /* Set y to the computed value */
+ mpfr_clear (tmp);
+ mpfr_clear (ump);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex, rnd);
+}
diff --git a/src/eq.c b/src/eq.c
new file mode 100644
index 0000000..7589070
--- /dev/null
+++ b/src/eq.c
@@ -0,0 +1,141 @@
+/* mpfr_eq -- Compare two floats up to a specified bit #.
+
+Copyright 1999, 2001, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#include "mpfr-impl.h"
+
+/* return non-zero if the first n_bits bits of u, v are equal,
+ 0 otherwise */
+int
+mpfr_eq (mpfr_srcptr u, mpfr_srcptr v, unsigned long int n_bits)
+{
+ mpfr_limb_srcptr up, vp;
+ mp_size_t usize, vsize, size, i;
+ mpfr_exp_t uexp, vexp;
+ int k;
+
+ if (MPFR_ARE_SINGULAR(u, v))
+ {
+ if (MPFR_IS_NAN(u) || MPFR_IS_NAN(v))
+ return 0; /* non equal */
+ else if (MPFR_IS_INF(u) && MPFR_IS_INF(v))
+ return (MPFR_SIGN(u) == MPFR_SIGN(v));
+ else if (MPFR_IS_ZERO(u) && MPFR_IS_ZERO(v))
+ return 1;
+ else
+ return 0;
+ }
+
+ /* 1. Are the signs different? */
+ if (MPFR_SIGN(u) != MPFR_SIGN(v))
+ return 0;
+
+ uexp = MPFR_GET_EXP (u);
+ vexp = MPFR_GET_EXP (v);
+
+ /* 2. Are the exponents different? */
+ if (uexp != vexp)
+ return 0; /* no bit agree */
+
+ usize = MPFR_LIMB_SIZE (u);
+ vsize = MPFR_LIMB_SIZE (v);
+
+ if (vsize > usize) /* exchange u and v */
+ {
+ up = MPFR_MANT(v);
+ vp = MPFR_MANT(u);
+ size = vsize;
+ vsize = usize;
+ usize = size;
+ }
+ else
+ {
+ up = MPFR_MANT(u);
+ vp = MPFR_MANT(v);
+ }
+
+ /* now usize >= vsize */
+ MPFR_ASSERTD(usize >= vsize);
+
+ if (usize > vsize)
+ {
+ if ((unsigned long) vsize * GMP_NUMB_BITS < n_bits)
+ {
+ /* check if low min(PREC(u), n_bits) - (vsize * GMP_NUMB_BITS)
+ bits from u are non-zero */
+ unsigned long remains = n_bits - (vsize * GMP_NUMB_BITS);
+ k = usize - vsize - 1;
+ while (k >= 0 && remains >= GMP_NUMB_BITS && !up[k])
+ {
+ k--;
+ remains -= GMP_NUMB_BITS;
+ }
+ /* now either k < 0: all low bits from u are zero
+ or remains < GMP_NUMB_BITS: check high bits from up[k]
+ or up[k] <> 0: different */
+ if (k >= 0 && (((remains < GMP_NUMB_BITS) &&
+ (up[k] >> (GMP_NUMB_BITS - remains))) ||
+ (remains >= GMP_NUMB_BITS && up[k])))
+ return 0; /* surely too different */
+ }
+ size = vsize;
+ }
+ else
+ {
+ size = usize;
+ }
+
+ /* now size = min (usize, vsize) */
+
+ /* If size is too large wrt n_bits, reduce it to look only at the
+ high n_bits bits.
+ Otherwise, if n_bits > size * GMP_NUMB_BITS, reduce n_bits to
+ size * GMP_NUMB_BITS, since the extra low bits of one of the
+ operands have already been check above. */
+ if ((unsigned long) size > 1 + (n_bits - 1) / GMP_NUMB_BITS)
+ size = 1 + (n_bits - 1) / GMP_NUMB_BITS;
+ else if (n_bits > (unsigned long) size * GMP_NUMB_BITS)
+ n_bits = size * GMP_NUMB_BITS;
+
+ up += usize - size;
+ vp += vsize - size;
+
+ for (i = size - 1; i > 0 && n_bits >= GMP_NUMB_BITS; i--)
+ {
+ if (up[i] != vp[i])
+ return 0;
+ n_bits -= GMP_NUMB_BITS;
+ }
+
+ /* now either i=0 or n_bits<GMP_NUMB_BITS */
+
+ /* since n_bits <= size * GMP_NUMB_BITS before the above for-loop,
+ we have the invariant n_bits <= (i+1) * GMP_NUMB_BITS, thus
+ we always have n_bits <= GMP_NUMB_BITS here */
+ MPFR_ASSERTD(n_bits <= GMP_NUMB_BITS);
+
+ if (n_bits & (GMP_NUMB_BITS - 1))
+ return (up[i] >> (GMP_NUMB_BITS - (n_bits & (GMP_NUMB_BITS - 1))) ==
+ vp[i] >> (GMP_NUMB_BITS - (n_bits & (GMP_NUMB_BITS - 1))));
+ else
+ return (up[i] == vp[i]);
+}
diff --git a/src/erf.c b/src/erf.c
new file mode 100644
index 0000000..0b5a221
--- /dev/null
+++ b/src/erf.c
@@ -0,0 +1,262 @@
+/* mpfr_erf -- error function of a floating-point number
+
+Copyright 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define EXP1 2.71828182845904523536 /* exp(1) */
+
+static int mpfr_erf_0 (mpfr_ptr, mpfr_srcptr, double, mpfr_rnd_t);
+
+int
+mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xf;
+ int inex, large;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x)) /* erf(+inf) = +1, erf(-inf) = -1 */
+ return mpfr_set_si (y, MPFR_INT_SIGN (x), MPFR_RNDN);
+ else /* erf(+0) = +0, erf(-0) = -0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ return mpfr_set (y, x, MPFR_RNDN); /* should keep the sign of x */
+ }
+ }
+
+ /* now x is neither NaN, Inf nor 0 */
+
+ /* first try expansion at x=0 when x is small, or asymptotic expansion
+ where x is large */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* around x=0, we have erf(x) = 2x/sqrt(Pi) (1 - x^2/3 + ...),
+ with 1 - x^2/3 <= sqrt(Pi)*erf(x)/2/x <= 1 for x >= 0. This means that
+ if x^2/3 < 2^(-PREC(y)-1) we can decide of the correct rounding,
+ unless we have a worst-case for 2x/sqrt(Pi). */
+ if (MPFR_EXP(x) < - (mpfr_exp_t) (MPFR_PREC(y) / 2))
+ {
+ /* we use 2x/sqrt(Pi) (1 - x^2/3) <= erf(x) <= 2x/sqrt(Pi) for x > 0
+ and 2x/sqrt(Pi) <= erf(x) <= 2x/sqrt(Pi) (1 - x^2/3) for x < 0.
+ In both cases |2x/sqrt(Pi) (1 - x^2/3)| <= |erf(x)| <= |2x/sqrt(Pi)|.
+ We will compute l and h such that l <= |2x/sqrt(Pi) (1 - x^2/3)|
+ and |2x/sqrt(Pi)| <= h. If l and h round to the same value to
+ precision PREC(y) and rounding rnd_mode, then we are done. */
+ mpfr_t l, h; /* lower and upper bounds for erf(x) */
+ int ok, inex2;
+
+ mpfr_init2 (l, MPFR_PREC(y) + 17);
+ mpfr_init2 (h, MPFR_PREC(y) + 17);
+ /* first compute l */
+ mpfr_mul (l, x, x, MPFR_RNDU);
+ mpfr_div_ui (l, l, 3, MPFR_RNDU); /* upper bound on x^2/3 */
+ mpfr_ui_sub (l, 1, l, MPFR_RNDZ); /* lower bound on 1 - x^2/3 */
+ mpfr_const_pi (h, MPFR_RNDU); /* upper bound of Pi */
+ mpfr_sqrt (h, h, MPFR_RNDU); /* upper bound on sqrt(Pi) */
+ mpfr_div (l, l, h, MPFR_RNDZ); /* lower bound on 1/sqrt(Pi) (1 - x^2/3) */
+ mpfr_mul_2ui (l, l, 1, MPFR_RNDZ); /* 2/sqrt(Pi) (1 - x^2/3) */
+ mpfr_mul (l, l, x, MPFR_RNDZ); /* |l| is a lower bound on
+ |2x/sqrt(Pi) (1 - x^2/3)| */
+ /* now compute h */
+ mpfr_const_pi (h, MPFR_RNDD); /* lower bound on Pi */
+ mpfr_sqrt (h, h, MPFR_RNDD); /* lower bound on sqrt(Pi) */
+ mpfr_div_2ui (h, h, 1, MPFR_RNDD); /* lower bound on sqrt(Pi)/2 */
+ /* since sqrt(Pi)/2 < 1, the following should not underflow */
+ mpfr_div (h, x, h, MPFR_IS_POS(x) ? MPFR_RNDU : MPFR_RNDD);
+ /* round l and h to precision PREC(y) */
+ inex = mpfr_prec_round (l, MPFR_PREC(y), rnd_mode);
+ inex2 = mpfr_prec_round (h, MPFR_PREC(y), rnd_mode);
+ /* Caution: we also need inex=inex2 (inex might be 0). */
+ ok = SAME_SIGN (inex, inex2) && mpfr_cmp (l, h) == 0;
+ if (ok)
+ mpfr_set (y, h, rnd_mode);
+ mpfr_clear (l);
+ mpfr_clear (h);
+ if (ok)
+ goto end;
+ /* this test can still fail for small precision, for example
+ for x=-0.100E-2 with a target precision of 3 bits, since
+ the error term x^2/3 is not that small. */
+ }
+
+ mpfr_init2 (xf, 53);
+ mpfr_const_log2 (xf, MPFR_RNDU);
+ mpfr_div (xf, x, xf, MPFR_RNDZ); /* round to zero ensures we get a lower
+ bound of |x/log(2)| */
+ mpfr_mul (xf, xf, x, MPFR_RNDZ);
+ large = mpfr_cmp_ui (xf, MPFR_PREC (y) + 1) > 0;
+ mpfr_clear (xf);
+
+ /* when x goes to infinity, we have erf(x) = 1 - 1/sqrt(Pi)/exp(x^2)/x + ...
+ and |erf(x) - 1| <= exp(-x^2) is true for any x >= 0, thus if
+ exp(-x^2) < 2^(-PREC(y)-1) the result is 1 or 1-epsilon.
+ This rewrites as x^2/log(2) > p+1. */
+ if (MPFR_UNLIKELY (large))
+ /* |erf x| = 1 or 1- */
+ {
+ mpfr_rnd_t rnd2 = MPFR_IS_POS (x) ? rnd_mode : MPFR_INVERT_RND(rnd_mode);
+ if (rnd2 == MPFR_RNDN || rnd2 == MPFR_RNDU || rnd2 == MPFR_RNDA)
+ {
+ inex = MPFR_INT_SIGN (x);
+ mpfr_set_si (y, inex, rnd2);
+ }
+ else /* round to zero */
+ {
+ inex = -MPFR_INT_SIGN (x);
+ mpfr_setmax (y, 0); /* warning: setmax keeps the old sign of y */
+ MPFR_SET_SAME_SIGN (y, x);
+ }
+ }
+ else /* use Taylor */
+ {
+ double xf2;
+
+ /* FIXME: get rid of doubles/mpfr_get_d here */
+ xf2 = mpfr_get_d (x, MPFR_RNDN);
+ xf2 = xf2 * xf2; /* xf2 ~ x^2 */
+ inex = mpfr_erf_0 (y, x, xf2, rnd_mode);
+ }
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex, rnd_mode);
+}
+
+/* return x*2^e */
+static double
+mul_2exp (double x, mpfr_exp_t e)
+{
+ if (e > 0)
+ {
+ while (e--)
+ x *= 2.0;
+ }
+ else
+ {
+ while (e++)
+ x /= 2.0;
+ }
+
+ return x;
+}
+
+/* evaluates erf(x) using the expansion at x=0:
+
+ erf(x) = 2/sqrt(Pi) * sum((-1)^k*x^(2k+1)/k!/(2k+1), k=0..infinity)
+
+ Assumes x is neither NaN nor infinite nor zero.
+ Assumes also that e*x^2 <= n (target precision).
+ */
+static int
+mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, double xf2, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t n, m;
+ mpfr_exp_t nuk, sigmak;
+ double tauk;
+ mpfr_t y, s, t, u;
+ unsigned int k;
+ int log2tauk;
+ int inex;
+ MPFR_ZIV_DECL (loop);
+
+ n = MPFR_PREC (res); /* target precision */
+
+ /* initial working precision */
+ m = n + (mpfr_prec_t) (xf2 / LOG2) + 8 + MPFR_INT_CEIL_LOG2 (n);
+
+ mpfr_init2 (y, m);
+ mpfr_init2 (s, m);
+ mpfr_init2 (t, m);
+ mpfr_init2 (u, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_mul (y, x, x, MPFR_RNDU); /* err <= 1 ulp */
+ mpfr_set_ui (s, 1, MPFR_RNDN);
+ mpfr_set_ui (t, 1, MPFR_RNDN);
+ tauk = 0.0;
+
+ for (k = 1; ; k++)
+ {
+ mpfr_mul (t, y, t, MPFR_RNDU);
+ mpfr_div_ui (t, t, k, MPFR_RNDU);
+ mpfr_div_ui (u, t, 2 * k + 1, MPFR_RNDU);
+ sigmak = MPFR_GET_EXP (s);
+ if (k % 2)
+ mpfr_sub (s, s, u, MPFR_RNDN);
+ else
+ mpfr_add (s, s, u, MPFR_RNDN);
+ sigmak -= MPFR_GET_EXP(s);
+ nuk = MPFR_GET_EXP(u) - MPFR_GET_EXP(s);
+
+ if ((nuk < - (mpfr_exp_t) m) && ((double) k >= xf2))
+ break;
+
+ /* tauk <- 1/2 + tauk * 2^sigmak + (1+8k)*2^nuk */
+ tauk = 0.5 + mul_2exp (tauk, sigmak)
+ + mul_2exp (1.0 + 8.0 * (double) k, nuk);
+ }
+
+ mpfr_mul (s, x, s, MPFR_RNDU);
+ MPFR_SET_EXP (s, MPFR_GET_EXP (s) + 1);
+
+ mpfr_const_pi (t, MPFR_RNDZ);
+ mpfr_sqrt (t, t, MPFR_RNDZ);
+ mpfr_div (s, s, t, MPFR_RNDN);
+ tauk = 4.0 * tauk + 11.0; /* final ulp-error on s */
+ log2tauk = __gmpfr_ceil_log2 (tauk);
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, m - log2tauk, n, rnd_mode)))
+ break;
+
+ /* Actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (y, m);
+ mpfr_set_prec (s, m);
+ mpfr_set_prec (t, m);
+ mpfr_set_prec (u, m);
+
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inex = mpfr_set (res, s, rnd_mode);
+
+ mpfr_clear (y);
+ mpfr_clear (t);
+ mpfr_clear (u);
+ mpfr_clear (s);
+
+ return inex;
+}
diff --git a/src/erfc.c b/src/erfc.c
new file mode 100644
index 0000000..653bf2f
--- /dev/null
+++ b/src/erfc.c
@@ -0,0 +1,277 @@
+/* mpfr_erfc -- The Complementary Error Function of a floating-point number
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* erfc(x) = 1 - erf(x) */
+
+/* Put in y an approximation of erfc(x) for large x, using formulae 7.1.23 and
+ 7.1.24 from Abramowitz and Stegun.
+ Returns e such that the error is bounded by 2^e ulp(y),
+ or returns 0 in case of underflow.
+*/
+static mpfr_exp_t
+mpfr_erfc_asympt (mpfr_ptr y, mpfr_srcptr x)
+{
+ mpfr_t t, xx, err;
+ unsigned long k;
+ mpfr_prec_t prec = MPFR_PREC(y);
+ mpfr_exp_t exp_err;
+
+ mpfr_init2 (t, prec);
+ mpfr_init2 (xx, prec);
+ mpfr_init2 (err, 31);
+ /* let u = 2^(1-p), and let us represent the error as (1+u)^err
+ with a bound for err */
+ mpfr_mul (xx, x, x, MPFR_RNDD); /* err <= 1 */
+ mpfr_ui_div (xx, 1, xx, MPFR_RNDU); /* upper bound for 1/(2x^2), err <= 2 */
+ mpfr_div_2ui (xx, xx, 1, MPFR_RNDU); /* exact */
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* current term, exact */
+ mpfr_set (y, t, MPFR_RNDN); /* current sum */
+ mpfr_set_ui (err, 0, MPFR_RNDN);
+ for (k = 1; ; k++)
+ {
+ mpfr_mul_ui (t, t, 2 * k - 1, MPFR_RNDU); /* err <= 4k-3 */
+ mpfr_mul (t, t, xx, MPFR_RNDU); /* err <= 4k */
+ /* for -1 < x < 1, and |nx| < 1, we have |(1+x)^n| <= 1+7/4|nx|.
+ Indeed, for x>=0: log((1+x)^n) = n*log(1+x) <= n*x. Let y=n*x < 1,
+ then exp(y) <= 1+7/4*y.
+ For x<=0, let x=-x, we can prove by induction that (1-x)^n >= 1-n*x.*/
+ mpfr_mul_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), MPFR_RNDU);
+ mpfr_add_ui (err, err, 14 * k, MPFR_RNDU); /* 2^(1-p) * t <= 2 ulp(t) */
+ mpfr_div_2si (err, err, MPFR_GET_EXP (y) - MPFR_GET_EXP (t), MPFR_RNDU);
+ if (MPFR_GET_EXP (t) + (mpfr_exp_t) prec <= MPFR_GET_EXP (y))
+ {
+ /* the truncation error is bounded by |t| < ulp(y) */
+ mpfr_add_ui (err, err, 1, MPFR_RNDU);
+ break;
+ }
+ if (k & 1)
+ mpfr_sub (y, y, t, MPFR_RNDN);
+ else
+ mpfr_add (y, y, t, MPFR_RNDN);
+ }
+ /* the error on y is bounded by err*ulp(y) */
+ mpfr_mul (t, x, x, MPFR_RNDU); /* rel. err <= 2^(1-p) */
+ mpfr_div_2ui (err, err, 3, MPFR_RNDU); /* err/8 */
+ mpfr_add (err, err, t, MPFR_RNDU); /* err/8 + xx */
+ mpfr_mul_2ui (err, err, 3, MPFR_RNDU); /* err + 8*xx */
+ mpfr_exp (t, t, MPFR_RNDU); /* err <= 1/2*ulp(t) + err(x*x)*t
+ <= 1/2*ulp(t)+2*|x*x|*ulp(t)
+ <= (2*|x*x|+1/2)*ulp(t) */
+ mpfr_mul (t, t, x, MPFR_RNDN); /* err <= 1/2*ulp(t) + (4*|x*x|+1)*ulp(t)
+ <= (4*|x*x|+3/2)*ulp(t) */
+ mpfr_const_pi (xx, MPFR_RNDZ); /* err <= ulp(Pi) */
+ mpfr_sqrt (xx, xx, MPFR_RNDN); /* err <= 1/2*ulp(xx) + ulp(Pi)/2/sqrt(Pi)
+ <= 3/2*ulp(xx) */
+ mpfr_mul (t, t, xx, MPFR_RNDN); /* err <= (8 |xx| + 13/2) * ulp(t) */
+ mpfr_div (y, y, t, MPFR_RNDN); /* the relative error on input y is bounded
+ by (1+u)^err with u = 2^(1-p), that on
+ t is bounded by (1+u)^(8 |xx| + 13/2),
+ thus that on output y is bounded by
+ 8 |xx| + 7 + err. */
+
+ if (MPFR_IS_ZERO(y))
+ {
+ /* If y is zero, most probably we have underflow. We check it directly
+ using the fact that erfc(x) <= exp(-x^2)/sqrt(Pi)/x for x >= 0.
+ We compute an upper approximation of exp(-x^2)/sqrt(Pi)/x.
+ */
+ mpfr_mul (t, x, x, MPFR_RNDD); /* t <= x^2 */
+ mpfr_neg (t, t, MPFR_RNDU); /* -x^2 <= t */
+ mpfr_exp (t, t, MPFR_RNDU); /* exp(-x^2) <= t */
+ mpfr_const_pi (xx, MPFR_RNDD); /* xx <= sqrt(Pi), cached */
+ mpfr_mul (xx, xx, x, MPFR_RNDD); /* xx <= sqrt(Pi)*x */
+ mpfr_div (y, t, xx, MPFR_RNDN); /* if y is zero, this means that the upper
+ approximation of exp(-x^2)/sqrt(Pi)/x
+ is nearer from 0 than from 2^(-emin-1),
+ thus we have underflow. */
+ exp_err = 0;
+ }
+ else
+ {
+ mpfr_add_ui (err, err, 7, MPFR_RNDU);
+ exp_err = MPFR_GET_EXP (err);
+ }
+
+ mpfr_clear (t);
+ mpfr_clear (xx);
+ mpfr_clear (err);
+ return exp_err;
+}
+
+int
+mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inex;
+ mpfr_t tmp;
+ mpfr_exp_t te, err;
+ mpfr_prec_t prec;
+ mpfr_exp_t emin = mpfr_get_emin ();
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ /* erfc(+inf) = 0+, erfc(-inf) = 2 erfc (0) = 1 */
+ else if (MPFR_IS_INF (x))
+ return mpfr_set_ui (y, MPFR_IS_POS (x) ? 0 : 2, rnd);
+ else
+ return mpfr_set_ui (y, 1, rnd);
+ }
+
+ if (MPFR_SIGN (x) > 0)
+ {
+ /* by default, emin = 1-2^30, thus the smallest representable
+ number is 1/2*2^emin = 2^(-2^30):
+ for x >= 27282, erfc(x) < 2^(-2^30-1), and
+ for x >= 1787897414, erfc(x) < 2^(-2^62-1).
+ */
+ if ((emin >= -1073741823 && mpfr_cmp_ui (x, 27282) >= 0) ||
+ mpfr_cmp_ui (x, 1787897414) >= 0)
+ {
+ /* May be incorrect if MPFR_EMAX_MAX >= 2^62. */
+ MPFR_ASSERTN ((MPFR_EMAX_MAX >> 31) >> 31 == 0);
+ return mpfr_underflow (y, (rnd == MPFR_RNDN) ? MPFR_RNDZ : rnd, 1);
+ }
+ }
+
+ /* Init stuff */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ if (MPFR_SIGN (x) < 0)
+ {
+ mpfr_exp_t e = MPFR_EXP(x);
+ /* For x < 0 going to -infinity, erfc(x) tends to 2 by below.
+ More precisely, we have 2 + 1/sqrt(Pi)/x/exp(x^2) < erfc(x) < 2.
+ Thus log2 |2 - erfc(x)| <= -log2|x| - x^2 / log(2).
+ If |2 - erfc(x)| < 2^(-PREC(y)) then the result is either 2 or
+ nextbelow(2).
+ For x <= -27282, -log2|x| - x^2 / log(2) <= -2^30.
+ */
+ if ((MPFR_PREC(y) <= 7 && e >= 2) || /* x <= -2 */
+ (MPFR_PREC(y) <= 25 && e >= 3) || /* x <= -4 */
+ (MPFR_PREC(y) <= 120 && mpfr_cmp_si (x, -9) <= 0) ||
+ mpfr_cmp_si (x, -27282) <= 0)
+ {
+ near_two:
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_set_inexflag ();
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ mpfr_nextbelow (y);
+ inex = -1;
+ }
+ else
+ inex = 1;
+ goto end;
+ }
+ else if (e >= 3) /* more accurate test */
+ {
+ mpfr_t t, u;
+ int near_2;
+ mpfr_init2 (t, 32);
+ mpfr_init2 (u, 32);
+ /* the following is 1/log(2) rounded to zero on 32 bits */
+ mpfr_set_str_binary (t, "1.0111000101010100011101100101001");
+ mpfr_sqr (u, x, MPFR_RNDZ);
+ mpfr_mul (t, t, u, MPFR_RNDZ); /* t <= x^2/log(2) */
+ mpfr_neg (u, x, MPFR_RNDZ); /* 0 <= u <= |x| */
+ mpfr_log2 (u, u, MPFR_RNDZ); /* u <= log2(|x|) */
+ mpfr_add (t, t, u, MPFR_RNDZ); /* t <= log2|x| + x^2 / log(2) */
+ /* Taking into account that mpfr_exp_t >= mpfr_prec_t */
+ mpfr_set_exp_t (u, MPFR_PREC (y), MPFR_RNDU);
+ near_2 = mpfr_cmp (t, u) >= 0; /* 1 if PREC(y) <= u <= t <= ... */
+ mpfr_clear (t);
+ mpfr_clear (u);
+ if (near_2)
+ goto near_two;
+ }
+ }
+
+ /* erfc(x) ~ 1, with error < 2^(EXP(x)+1) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, __gmpfr_one, - MPFR_GET_EXP (x) - 1,
+ 0, MPFR_SIGN(x) < 0,
+ rnd, inex = _inexact; goto end);
+
+ prec = MPFR_PREC (y) + MPFR_INT_CEIL_LOG2 (MPFR_PREC (y)) + 3;
+ if (MPFR_GET_EXP (x) > 0)
+ prec += 2 * MPFR_GET_EXP(x);
+
+ mpfr_init2 (tmp, prec);
+
+ MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controler */
+ for (;;) /* Infinite loop */
+ {
+ /* use asymptotic formula only whenever x^2 >= p*log(2),
+ otherwise it will not converge */
+ if (MPFR_SIGN (x) > 0 &&
+ 2 * MPFR_GET_EXP (x) - 2 >= MPFR_INT_CEIL_LOG2 (prec))
+ /* we have x^2 >= p in that case */
+ {
+ err = mpfr_erfc_asympt (tmp, x);
+ if (err == 0) /* underflow case */
+ {
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, (rnd == MPFR_RNDN) ? MPFR_RNDZ : rnd, 1);
+ }
+ }
+ else
+ {
+ mpfr_erf (tmp, x, MPFR_RNDN);
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (tmp)); /* FIXME: 0 only for x=0 ? */
+ te = MPFR_GET_EXP (tmp);
+ mpfr_ui_sub (tmp, 1, tmp, MPFR_RNDN);
+ /* See error analysis in algorithms.tex for details */
+ if (MPFR_IS_ZERO (tmp))
+ {
+ prec *= 2;
+ err = prec; /* ensures MPFR_CAN_ROUND fails */
+ }
+ else
+ err = MAX (te - MPFR_GET_EXP (tmp), 0) + 1;
+ }
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - err, MPFR_PREC (y), rnd)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec); /* Increase used precision */
+ mpfr_set_prec (tmp, prec);
+ }
+ MPFR_ZIV_FREE (loop); /* Free the ZivLoop Controler */
+
+ inex = mpfr_set (y, tmp, rnd); /* Set y to the computed value */
+ mpfr_clear (tmp);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex, rnd);
+}
diff --git a/src/exceptions.c b/src/exceptions.c
new file mode 100644
index 0000000..2bd89dc
--- /dev/null
+++ b/src/exceptions.c
@@ -0,0 +1,360 @@
+/* Exception flags and utilities.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+unsigned int MPFR_THREAD_ATTR __gmpfr_flags = 0;
+
+mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emin = MPFR_EMIN_DEFAULT;
+mpfr_exp_t MPFR_THREAD_ATTR __gmpfr_emax = MPFR_EMAX_DEFAULT;
+
+#undef mpfr_get_emin
+
+mpfr_exp_t
+mpfr_get_emin (void)
+{
+ return __gmpfr_emin;
+}
+
+#undef mpfr_set_emin
+
+int
+mpfr_set_emin (mpfr_exp_t exponent)
+{
+ if (exponent >= MPFR_EMIN_MIN && exponent <= MPFR_EMIN_MAX)
+ {
+ __gmpfr_emin = exponent;
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+mpfr_exp_t
+mpfr_get_emin_min (void)
+{
+ return MPFR_EMIN_MIN;
+}
+
+mpfr_exp_t
+mpfr_get_emin_max (void)
+{
+ return MPFR_EMIN_MAX;
+}
+
+#undef mpfr_get_emax
+
+mpfr_exp_t
+mpfr_get_emax (void)
+{
+ return __gmpfr_emax;
+}
+
+#undef mpfr_set_emax
+
+int
+mpfr_set_emax (mpfr_exp_t exponent)
+{
+ if (exponent >= MPFR_EMAX_MIN && exponent <= MPFR_EMAX_MAX)
+ {
+ __gmpfr_emax = exponent;
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+mpfr_exp_t
+mpfr_get_emax_min (void)
+{
+ return MPFR_EMAX_MIN;
+}
+mpfr_exp_t
+mpfr_get_emax_max (void)
+{
+ return MPFR_EMAX_MAX;
+}
+
+
+#undef mpfr_clear_flags
+
+void
+mpfr_clear_flags (void)
+{
+ __gmpfr_flags = 0;
+}
+
+#undef mpfr_clear_underflow
+
+void
+mpfr_clear_underflow (void)
+{
+ __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_UNDERFLOW;
+}
+
+#undef mpfr_clear_overflow
+
+void
+mpfr_clear_overflow (void)
+{
+ __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_OVERFLOW;
+}
+
+#undef mpfr_clear_divby0
+
+void
+mpfr_clear_divby0 (void)
+{
+ __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_DIVBY0;
+}
+
+#undef mpfr_clear_nanflag
+
+void
+mpfr_clear_nanflag (void)
+{
+ __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_NAN;
+}
+
+#undef mpfr_clear_inexflag
+
+void
+mpfr_clear_inexflag (void)
+{
+ __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_INEXACT;
+}
+
+#undef mpfr_clear_erangeflag
+
+void
+mpfr_clear_erangeflag (void)
+{
+ __gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE;
+}
+
+#undef mpfr_set_underflow
+
+void
+mpfr_set_underflow (void)
+{
+ __gmpfr_flags |= MPFR_FLAGS_UNDERFLOW;
+}
+
+#undef mpfr_set_overflow
+
+void
+mpfr_set_overflow (void)
+{
+ __gmpfr_flags |= MPFR_FLAGS_OVERFLOW;
+}
+
+#undef mpfr_set_divby0
+
+void
+mpfr_set_divby0 (void)
+{
+ __gmpfr_flags |= MPFR_FLAGS_DIVBY0;
+}
+
+#undef mpfr_set_nanflag
+
+void
+mpfr_set_nanflag (void)
+{
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+}
+
+#undef mpfr_set_inexflag
+
+void
+mpfr_set_inexflag (void)
+{
+ __gmpfr_flags |= MPFR_FLAGS_INEXACT;
+}
+
+#undef mpfr_set_erangeflag
+
+void
+mpfr_set_erangeflag (void)
+{
+ __gmpfr_flags |= MPFR_FLAGS_ERANGE;
+}
+
+
+#undef mpfr_check_range
+
+int
+mpfr_check_range (mpfr_ptr x, int t, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_LIKELY( MPFR_IS_PURE_FP(x)) )
+ { /* x is a non-zero FP */
+ mpfr_exp_t exp = MPFR_EXP (x); /* Do not use MPFR_GET_EXP */
+ if (MPFR_UNLIKELY( exp < __gmpfr_emin) )
+ {
+ /* The following test is necessary because in the rounding to the
+ * nearest mode, mpfr_underflow always rounds away from 0. In
+ * this rounding mode, we need to round to 0 if:
+ * _ |x| < 2^(emin-2), or
+ * _ |x| = 2^(emin-2) and the absolute value of the exact
+ * result is <= 2^(emin-2).
+ */
+ if (rnd_mode == MPFR_RNDN &&
+ (exp + 1 < __gmpfr_emin ||
+ (mpfr_powerof2_raw(x) &&
+ (MPFR_IS_NEG(x) ? t <= 0 : t >= 0))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow(x, rnd_mode, MPFR_SIGN(x));
+ }
+ if (MPFR_UNLIKELY( exp > __gmpfr_emax) )
+ return mpfr_overflow (x, rnd_mode, MPFR_SIGN(x));
+ }
+ else if (MPFR_UNLIKELY (t != 0 && MPFR_IS_INF (x)))
+ {
+ /* We need to do the following because most MPFR functions are
+ * implemented in the following way:
+ * Ziv's loop:
+ * | Compute an approximation to the result and an error bound.
+ * | Possible underflow/overflow detection -> return.
+ * | If can_round, break (exit the loop).
+ * | Otherwise, increase the working precision and loop.
+ * Round the approximation in the target precision. <== See below
+ * Restore the flags (that could have been set due to underflows
+ * or overflows during the internal computations).
+ * Execute: return mpfr_check_range (...).
+ * The problem is that an overflow could be generated when rounding the
+ * approximation (in general, such an overflow could not be detected
+ * earlier), and the overflow flag is lost when the flags are restored.
+ * This can occur only when the rounding yields an exponent change
+ * and the new exponent is larger than the maximum exponent, so that
+ * an infinity is necessarily obtained.
+ * So, the simplest solution is to detect this overflow case here in
+ * mpfr_check_range, which is easy to do since the rounded result is
+ * necessarily an inexact infinity.
+ */
+ __gmpfr_flags |= MPFR_FLAGS_OVERFLOW;
+ }
+ MPFR_RET (t); /* propagate inexact ternary value, unlike most functions */
+}
+
+#undef mpfr_underflow_p
+
+int
+mpfr_underflow_p (void)
+{
+ return __gmpfr_flags & MPFR_FLAGS_UNDERFLOW;
+}
+
+#undef mpfr_overflow_p
+
+int
+mpfr_overflow_p (void)
+{
+ return __gmpfr_flags & MPFR_FLAGS_OVERFLOW;
+}
+
+#undef mpfr_divby0_p
+
+int
+mpfr_divby0_p (void)
+{
+ return __gmpfr_flags & MPFR_FLAGS_DIVBY0;
+}
+
+#undef mpfr_nanflag_p
+
+int
+mpfr_nanflag_p (void)
+{
+ return __gmpfr_flags & MPFR_FLAGS_NAN;
+}
+
+#undef mpfr_inexflag_p
+
+int
+mpfr_inexflag_p (void)
+{
+ return __gmpfr_flags & MPFR_FLAGS_INEXACT;
+}
+
+#undef mpfr_erangeflag_p
+
+int
+mpfr_erangeflag_p (void)
+{
+ return __gmpfr_flags & MPFR_FLAGS_ERANGE;
+}
+
+/* #undef mpfr_underflow */
+
+/* Note: In the rounding to the nearest mode, mpfr_underflow
+ always rounds away from 0. In this rounding mode, you must call
+ mpfr_underflow with rnd_mode = MPFR_RNDZ if the exact result
+ is <= 2^(emin-2) in absolute value. */
+
+int
+mpfr_underflow (mpfr_ptr x, mpfr_rnd_t rnd_mode, int sign)
+{
+ int inex;
+
+ MPFR_ASSERT_SIGN (sign);
+
+ if (MPFR_IS_LIKE_RNDZ(rnd_mode, sign < 0))
+ {
+ MPFR_SET_ZERO(x);
+ inex = -1;
+ }
+ else
+ {
+ mpfr_setmin (x, __gmpfr_emin);
+ inex = 1;
+ }
+ MPFR_SET_SIGN(x, sign);
+ __gmpfr_flags |= MPFR_FLAGS_INEXACT | MPFR_FLAGS_UNDERFLOW;
+ return sign > 0 ? inex : -inex;
+}
+
+/* #undef mpfr_overflow */
+
+int
+mpfr_overflow (mpfr_ptr x, mpfr_rnd_t rnd_mode, int sign)
+{
+ int inex;
+
+ MPFR_ASSERT_SIGN(sign);
+ if (MPFR_IS_LIKE_RNDZ(rnd_mode, sign < 0))
+ {
+ mpfr_setmax (x, __gmpfr_emax);
+ inex = -1;
+ }
+ else
+ {
+ MPFR_SET_INF(x);
+ inex = 1;
+ }
+ MPFR_SET_SIGN(x,sign);
+ __gmpfr_flags |= MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW;
+ return sign > 0 ? inex : -inex;
+}
diff --git a/src/exp.c b/src/exp.c
new file mode 100644
index 0000000..82e6d4b
--- /dev/null
+++ b/src/exp.c
@@ -0,0 +1,164 @@
+/* mpfr_exp -- exponential of a floating-point number
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* #define DEBUG */
+
+int
+mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_exp_t expx;
+ mpfr_prec_t precy;
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) ))
+ {
+ if (MPFR_IS_NAN(x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(x))
+ {
+ if (MPFR_IS_POS(x))
+ MPFR_SET_INF(y);
+ else
+ MPFR_SET_ZERO(y);
+ MPFR_SET_POS(y);
+ MPFR_RET(0);
+ }
+ else
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
+ }
+
+ /* First, let's detect most overflow and underflow cases. */
+ {
+ mpfr_t e, bound;
+
+ /* We must extended the exponent range and save the flags now. */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (e, sizeof (mpfr_exp_t) * CHAR_BIT);
+ mpfr_init2 (bound, 32);
+
+ inexact = mpfr_set_exp_t (e, expo.saved_emax, MPFR_RNDN);
+ MPFR_ASSERTD (inexact == 0);
+ mpfr_const_log2 (bound, expo.saved_emax < 0 ? MPFR_RNDD : MPFR_RNDU);
+ mpfr_mul (bound, bound, e, MPFR_RNDU);
+ if (MPFR_UNLIKELY (mpfr_cmp (x, bound) >= 0))
+ {
+ /* x > log(2^emax), thus exp(x) > 2^emax */
+ mpfr_clears (e, bound, (mpfr_ptr) 0);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_overflow (y, rnd_mode, 1);
+ }
+
+ inexact = mpfr_set_exp_t (e, expo.saved_emin, MPFR_RNDN);
+ MPFR_ASSERTD (inexact == 0);
+ inexact = mpfr_sub_ui (e, e, 2, MPFR_RNDN);
+ MPFR_ASSERTD (inexact == 0);
+ mpfr_const_log2 (bound, expo.saved_emin < 0 ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_mul (bound, bound, e, MPFR_RNDD);
+ if (MPFR_UNLIKELY (mpfr_cmp (x, bound) <= 0))
+ {
+ /* x < log(2^(emin - 2)), thus exp(x) < 2^(emin - 2) */
+ mpfr_clears (e, bound, (mpfr_ptr) 0);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
+ 1);
+ }
+
+ /* Other overflow/underflow cases must be detected
+ by the generic routines. */
+ mpfr_clears (e, bound, (mpfr_ptr) 0);
+ MPFR_SAVE_EXPO_FREE (expo);
+ }
+
+ expx = MPFR_GET_EXP (x);
+ precy = MPFR_PREC (y);
+
+ /* if x < 2^(-precy), then exp(x) i.e. gives 1 +/- 1 ulp(1) */
+ if (MPFR_UNLIKELY (expx < 0 && (mpfr_uexp_t) (-expx) > precy))
+ {
+ mpfr_exp_t emin = __gmpfr_emin;
+ mpfr_exp_t emax = __gmpfr_emax;
+ int signx = MPFR_SIGN (x);
+
+ MPFR_SET_POS (y);
+ if (MPFR_IS_NEG_SIGN (signx) && (rnd_mode == MPFR_RNDD ||
+ rnd_mode == MPFR_RNDZ))
+ {
+ __gmpfr_emin = 0;
+ __gmpfr_emax = 0;
+ mpfr_setmax (y, 0); /* y = 1 - epsilon */
+ inexact = -1;
+ }
+ else
+ {
+ __gmpfr_emin = 1;
+ __gmpfr_emax = 1;
+ mpfr_setmin (y, 1); /* y = 1 */
+ if (MPFR_IS_POS_SIGN (signx) && (rnd_mode == MPFR_RNDU ||
+ rnd_mode == MPFR_RNDA))
+ {
+ mp_size_t yn;
+ int sh;
+
+ yn = MPFR_LIMB_SIZE (y);
+ sh = (mpfr_prec_t) yn * GMP_NUMB_BITS - MPFR_PREC(y);
+ MPFR_MANT(y)[0] += MPFR_LIMB_ONE << sh;
+ inexact = 1;
+ }
+ else
+ inexact = -MPFR_FROM_SIGN_TO_INT(signx);
+ }
+
+ __gmpfr_emin = emin;
+ __gmpfr_emax = emax;
+ }
+ else /* General case */
+ {
+ if (MPFR_UNLIKELY (precy >= MPFR_EXP_THRESHOLD))
+ /* mpfr_exp_3 saves the exponent range and flags itself, otherwise
+ the flag changes in mpfr_exp_3 are lost */
+ inexact = mpfr_exp_3 (y, x, rnd_mode); /* O(M(n) log(n)^2) */
+ else
+ {
+ MPFR_SAVE_EXPO_MARK (expo);
+ inexact = mpfr_exp_2 (y, x, rnd_mode); /* O(n^(1/3) M(n)) */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ MPFR_SAVE_EXPO_FREE (expo);
+ }
+ }
+
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/exp10.c b/src/exp10.c
new file mode 100644
index 0000000..3540cb9
--- /dev/null
+++ b/src/exp10.c
@@ -0,0 +1,29 @@
+/* mpfr_exp10 -- power of 10 function 10^y
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_exp10 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_ui_pow (y, 10, x, rnd_mode);
+}
diff --git a/src/exp2.c b/src/exp2.c
new file mode 100644
index 0000000..a107d8a
--- /dev/null
+++ b/src/exp2.c
@@ -0,0 +1,151 @@
+/* mpfr_exp2 -- power of 2 function 2^y
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of y = 2^z is done by *
+ * y = exp(z*log(2)). The result is exact iff z is an integer. */
+
+int
+mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ long xint;
+ mpfr_t xfrac;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ if (MPFR_IS_POS (x))
+ MPFR_SET_INF (y);
+ else
+ MPFR_SET_ZERO (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ else /* 2^0 = 1 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO(x));
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
+ }
+
+ /* since the smallest representable non-zero float is 1/2*2^__gmpfr_emin,
+ if x < __gmpfr_emin - 1, the result is either 1/2*2^__gmpfr_emin or 0 */
+ MPFR_ASSERTN (MPFR_EMIN_MIN >= LONG_MIN + 2);
+ if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emin - 1) < 0))
+ {
+ mpfr_rnd_t rnd2 = rnd_mode;
+ /* in round to nearest mode, round to zero when x <= __gmpfr_emin-2 */
+ if (rnd_mode == MPFR_RNDN &&
+ mpfr_cmp_si_2exp (x, __gmpfr_emin - 2, 0) <= 0)
+ rnd2 = MPFR_RNDZ;
+ return mpfr_underflow (y, rnd2, 1);
+ }
+
+ MPFR_ASSERTN (MPFR_EMAX_MAX <= LONG_MAX);
+ if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emax) >= 0))
+ return mpfr_overflow (y, rnd_mode, 1);
+
+ /* We now know that emin - 1 <= x < emax. */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* 2^x = 1 + x*log(2) + O(x^2) for x near zero, and for |x| <= 1 we have
+ |2^x - 1| <= x < 2^EXP(x). If x > 0 we must round away from 0 (dir=1);
+ if x < 0 we must round toward 0 (dir=0). */
+ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, - MPFR_GET_EXP (x), 0,
+ MPFR_SIGN(x) > 0, rnd_mode, expo, {});
+
+ xint = mpfr_get_si (x, MPFR_RNDZ);
+ mpfr_init2 (xfrac, MPFR_PREC (x));
+ mpfr_sub_si (xfrac, x, xint, MPFR_RNDN); /* exact */
+
+ if (MPFR_IS_ZERO (xfrac))
+ {
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ inexact = 0;
+ }
+ else
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t;
+
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err; /* error */
+ MPFR_ZIV_DECL (loop);
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + 5 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+
+ /* First computation */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute exp(x*ln(2))*/
+ mpfr_const_log2 (t, MPFR_RNDU); /* ln(2) */
+ mpfr_mul (t, xfrac, t, MPFR_RNDU); /* xfrac * ln(2) */
+ err = Nt - (MPFR_GET_EXP (t) + 2); /* Estimate of the error */
+ mpfr_exp (t, t, MPFR_RNDN); /* exp(xfrac * ln(2)) */
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ break;
+
+ /* Actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ mpfr_clear (t);
+ }
+
+ mpfr_clear (xfrac);
+ mpfr_clear_flags ();
+ mpfr_mul_2si (y, y, xint, MPFR_RNDN); /* exact or overflow */
+ /* Note: We can have an overflow only when t was rounded up to 2. */
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (y) || inexact > 0);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/exp3.c b/src/exp3.c
new file mode 100644
index 0000000..57fd0a4
--- /dev/null
+++ b/src/exp3.c
@@ -0,0 +1,335 @@
+/* mpfr_exp -- exponential of a floating-point number
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H /* for MPFR_MPZ_SIZEINBASE2 */
+#include "mpfr-impl.h"
+
+/* y <- exp(p/2^r) within 1 ulp, using 2^m terms from the series
+ Assume |p/2^r| < 1.
+ We use the following binary splitting formula:
+ P(a,b) = p if a+1=b, P(a,c)*P(c,b) otherwise
+ Q(a,b) = a*2^r if a+1=b [except Q(0,1)=1], Q(a,c)*Q(c,b) otherwise
+ T(a,b) = P(a,b) if a+1=b, Q(c,b)*T(a,c)+P(a,c)*T(c,b) otherwise
+ Then exp(p/2^r) ~ T(0,i)/Q(0,i) for i so that (p/2^r)^i/i! is small enough.
+
+ Since P(a,b) = p^(b-a), and we consider only values of b-a of the form 2^j,
+ we don't need to compute P(), we only precompute p^(2^j) in the ptoj[] array
+ below.
+
+ Since Q(a,b) is divisible by 2^(r*(b-a-1)), we don't compute the power of
+ two part.
+*/
+static void
+mpfr_exp_rational (mpfr_ptr y, mpz_ptr p, long r, int m,
+ mpz_t *Q, mpfr_prec_t *mult)
+{
+ unsigned long n, i, j;
+ mpz_t *S, *ptoj;
+ mpfr_prec_t *log2_nb_terms;
+ mpfr_exp_t diff, expo;
+ mpfr_prec_t precy = MPFR_PREC(y), prec_i_have, prec_ptoj;
+ int k, l;
+
+ MPFR_ASSERTN ((size_t) m < sizeof (long) * CHAR_BIT - 1);
+
+ S = Q + (m+1);
+ ptoj = Q + 2*(m+1); /* ptoj[i] = mantissa^(2^i) */
+ log2_nb_terms = mult + (m+1);
+
+ /* Normalize p */
+ MPFR_ASSERTD (mpz_cmp_ui (p, 0) != 0);
+ n = mpz_scan1 (p, 0); /* number of trailing zeros in p */
+ mpz_tdiv_q_2exp (p, p, n);
+ r -= n; /* since |p/2^r| < 1 and p >= 1, r >= 1 */
+
+ /* Set initial var */
+ mpz_set (ptoj[0], p);
+ for (k = 1; k < m; k++)
+ mpz_mul (ptoj[k], ptoj[k-1], ptoj[k-1]); /* ptoj[k] = p^(2^k) */
+ mpz_set_ui (Q[0], 1);
+ mpz_set_ui (S[0], 1);
+ k = 0;
+ mult[0] = 0; /* the multiplier P[k]/Q[k] for the remaining terms
+ satisfies P[k]/Q[k] <= 2^(-mult[k]) */
+ log2_nb_terms[0] = 0; /* log2(#terms) [exact in 1st loop where 2^k] */
+ prec_i_have = 0;
+
+ /* Main Loop */
+ n = 1UL << m;
+ for (i = 1; (prec_i_have < precy) && (i < n); i++)
+ {
+ /* invariant: Q[0]*Q[1]*...*Q[k] equals i! */
+ k++;
+ log2_nb_terms[k] = 0; /* 1 term */
+ mpz_set_ui (Q[k], i + 1);
+ mpz_set_ui (S[k], i + 1);
+ j = i + 1; /* we have computed j = i+1 terms so far */
+ l = 0;
+ while ((j & 1) == 0) /* combine and reduce */
+ {
+ /* invariant: S[k] corresponds to 2^l consecutive terms */
+ mpz_mul (S[k], S[k], ptoj[l]);
+ mpz_mul (S[k-1], S[k-1], Q[k]);
+ /* Q[k] corresponds to 2^l consecutive terms too.
+ Since it does not contains the factor 2^(r*2^l),
+ when going from l to l+1 we need to multiply
+ by 2^(r*2^(l+1))/2^(r*2^l) = 2^(r*2^l) */
+ mpz_mul_2exp (S[k-1], S[k-1], r << l);
+ mpz_add (S[k-1], S[k-1], S[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ log2_nb_terms[k-1] ++; /* number of terms in S[k-1]
+ is a power of 2 by construction */
+ MPFR_MPZ_SIZEINBASE2 (prec_i_have, Q[k]);
+ MPFR_MPZ_SIZEINBASE2 (prec_ptoj, ptoj[l]);
+ mult[k-1] += prec_i_have + (r << l) - prec_ptoj - 1;
+ prec_i_have = mult[k] = mult[k-1];
+ /* since mult[k] >= mult[k-1] + nbits(Q[k]),
+ we have Q[0]*...*Q[k] <= 2^mult[k] = 2^prec_i_have */
+ l ++;
+ j >>= 1;
+ k --;
+ }
+ }
+
+ /* accumulate all products in S[0] and Q[0]. Warning: contrary to above,
+ here we do not have log2_nb_terms[k-1] = log2_nb_terms[k]+1. */
+ l = 0; /* number of accumulated terms in the right part S[k]/Q[k] */
+ while (k > 0)
+ {
+ j = log2_nb_terms[k-1];
+ mpz_mul (S[k], S[k], ptoj[j]);
+ mpz_mul (S[k-1], S[k-1], Q[k]);
+ l += 1 << log2_nb_terms[k];
+ mpz_mul_2exp (S[k-1], S[k-1], r * l);
+ mpz_add (S[k-1], S[k-1], S[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ k--;
+ }
+
+ /* Q[0] now equals i! */
+ MPFR_MPZ_SIZEINBASE2 (prec_i_have, S[0]);
+ diff = (mpfr_exp_t) prec_i_have - 2 * (mpfr_exp_t) precy;
+ expo = diff;
+ if (diff >= 0)
+ mpz_fdiv_q_2exp (S[0], S[0], diff);
+ else
+ mpz_mul_2exp (S[0], S[0], -diff);
+
+ MPFR_MPZ_SIZEINBASE2 (prec_i_have, Q[0]);
+ diff = (mpfr_exp_t) prec_i_have - (mpfr_prec_t) precy;
+ expo -= diff;
+ if (diff > 0)
+ mpz_fdiv_q_2exp (Q[0], Q[0], diff);
+ else
+ mpz_mul_2exp (Q[0], Q[0], -diff);
+
+ mpz_tdiv_q (S[0], S[0], Q[0]);
+ mpfr_set_z (y, S[0], MPFR_RNDD);
+ MPFR_SET_EXP (y, MPFR_GET_EXP (y) + expo - r * (i - 1) );
+}
+
+#define shift (GMP_NUMB_BITS/2)
+
+int
+mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t, x_copy, tmp;
+ mpz_t uk;
+ mpfr_exp_t ttt, shift_x;
+ unsigned long twopoweri;
+ mpz_t *P;
+ mpfr_prec_t *mult;
+ int i, k, loop;
+ int prec_x;
+ mpfr_prec_t realprec, Prec;
+ int iter;
+ int inexact = 0;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (ziv_loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
+ inexact));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* decompose x */
+ /* we first write x = 1.xxxxxxxxxxxxx
+ ----- k bits -- */
+ prec_x = MPFR_INT_CEIL_LOG2 (MPFR_PREC (x)) - MPFR_LOG2_GMP_NUMB_BITS;
+ if (prec_x < 0)
+ prec_x = 0;
+
+ ttt = MPFR_GET_EXP (x);
+ mpfr_init2 (x_copy, MPFR_PREC(x));
+ mpfr_set (x_copy, x, MPFR_RNDD);
+
+ /* we shift to get a number less than 1 */
+ if (ttt > 0)
+ {
+ shift_x = ttt;
+ mpfr_div_2ui (x_copy, x, ttt, MPFR_RNDN);
+ ttt = MPFR_GET_EXP (x_copy);
+ }
+ else
+ shift_x = 0;
+ MPFR_ASSERTD (ttt <= 0);
+
+ /* Init prec and vars */
+ realprec = MPFR_PREC (y) + MPFR_INT_CEIL_LOG2 (prec_x + MPFR_PREC (y));
+ Prec = realprec + shift + 2 + shift_x;
+ mpfr_init2 (t, Prec);
+ mpfr_init2 (tmp, Prec);
+ mpz_init (uk);
+
+ /* Main loop */
+ MPFR_ZIV_INIT (ziv_loop, realprec);
+ for (;;)
+ {
+ int scaled = 0;
+ MPFR_BLOCK_DECL (flags);
+
+ k = MPFR_INT_CEIL_LOG2 (Prec) - MPFR_LOG2_GMP_NUMB_BITS;
+
+ /* now we have to extract */
+ twopoweri = GMP_NUMB_BITS;
+
+ /* Allocate tables */
+ P = (mpz_t*) (*__gmp_allocate_func) (3*(k+2)*sizeof(mpz_t));
+ for (i = 0; i < 3*(k+2); i++)
+ mpz_init (P[i]);
+ mult = (mpfr_prec_t*) (*__gmp_allocate_func) (2*(k+2)*sizeof(mpfr_prec_t));
+
+ /* Particular case for i==0 */
+ mpfr_extract (uk, x_copy, 0);
+ MPFR_ASSERTD (mpz_cmp_ui (uk, 0) != 0);
+ mpfr_exp_rational (tmp, uk, shift + twopoweri - ttt, k + 1, P, mult);
+ for (loop = 0; loop < shift; loop++)
+ mpfr_sqr (tmp, tmp, MPFR_RNDD);
+ twopoweri *= 2;
+
+ /* General case */
+ iter = (k <= prec_x) ? k : prec_x;
+ for (i = 1; i <= iter; i++)
+ {
+ mpfr_extract (uk, x_copy, i);
+ if (MPFR_LIKELY (mpz_cmp_ui (uk, 0) != 0))
+ {
+ mpfr_exp_rational (t, uk, twopoweri - ttt, k - i + 1, P, mult);
+ mpfr_mul (tmp, tmp, t, MPFR_RNDD);
+ }
+ MPFR_ASSERTN (twopoweri <= LONG_MAX/2);
+ twopoweri *=2;
+ }
+
+ /* Clear tables */
+ for (i = 0; i < 3*(k+2); i++)
+ mpz_clear (P[i]);
+ (*__gmp_free_func) (P, 3*(k+2)*sizeof(mpz_t));
+ (*__gmp_free_func) (mult, 2*(k+2)*sizeof(mpfr_prec_t));
+
+ if (shift_x > 0)
+ {
+ MPFR_BLOCK (flags, {
+ for (loop = 0; loop < shift_x - 1; loop++)
+ mpfr_sqr (tmp, tmp, MPFR_RNDD);
+ mpfr_sqr (t, tmp, MPFR_RNDD);
+ } );
+
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
+ {
+ /* tmp <= exact result, so that it is a real overflow. */
+ inexact = mpfr_overflow (y, rnd_mode, 1);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+
+ if (MPFR_UNLIKELY (MPFR_UNDERFLOW (flags)))
+ {
+ /* This may be a spurious underflow. So, let's scale
+ the result. */
+ mpfr_mul_2ui (tmp, tmp, 1, MPFR_RNDD); /* no overflow, exact */
+ mpfr_sqr (t, tmp, MPFR_RNDD);
+ if (MPFR_IS_ZERO (t))
+ {
+ /* approximate result < 2^(emin - 3), thus
+ exact result < 2^(emin - 2). */
+ inexact = mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ?
+ MPFR_RNDZ : rnd_mode, 1);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
+ break;
+ }
+ scaled = 1;
+ }
+ }
+
+ if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDD, MPFR_RNDZ,
+ MPFR_PREC(y) + (rnd_mode == MPFR_RNDN)))
+ {
+ inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode);
+ if (MPFR_UNLIKELY (scaled && MPFR_IS_PURE_FP (y)))
+ {
+ int inex2;
+ mpfr_exp_t ey;
+
+ /* The result has been scaled and needs to be corrected. */
+ ey = MPFR_GET_EXP (y);
+ inex2 = mpfr_mul_2si (y, y, -2, rnd_mode);
+ if (inex2) /* underflow */
+ {
+ if (rnd_mode == MPFR_RNDN && inexact < 0 &&
+ MPFR_IS_ZERO (y) && ey == __gmpfr_emin + 1)
+ {
+ /* Double rounding case: in MPFR_RNDN, the scaled
+ result has been rounded downward to 2^emin.
+ As the exact result is > 2^(emin - 2), correct
+ rounding must be done upward. */
+ /* TODO: make sure in coverage tests that this line
+ is reached. */
+ inexact = mpfr_underflow (y, MPFR_RNDU, 1);
+ }
+ else
+ {
+ /* No double rounding. */
+ inexact = inex2;
+ }
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
+ }
+ }
+ break;
+ }
+
+ MPFR_ZIV_NEXT (ziv_loop, realprec);
+ Prec = realprec + shift + 2 + shift_x;
+ mpfr_set_prec (t, Prec);
+ mpfr_set_prec (tmp, Prec);
+ }
+ MPFR_ZIV_FREE (ziv_loop);
+
+ mpz_clear (uk);
+ mpfr_clear (tmp);
+ mpfr_clear (t);
+ mpfr_clear (x_copy);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return inexact;
+}
diff --git a/src/exp_2.c b/src/exp_2.c
new file mode 100644
index 0000000..7f9ef6f
--- /dev/null
+++ b/src/exp_2.c
@@ -0,0 +1,421 @@
+/* mpfr_exp_2 -- exponential of a floating-point number
+ using algorithms in O(n^(1/2)*M(n)) and O(n^(1/3)*M(n))
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* #define DEBUG */
+#define MPFR_NEED_LONGLONG_H /* for count_leading_zeros */
+#include "mpfr-impl.h"
+
+static unsigned long
+mpfr_exp2_aux (mpz_t, mpfr_srcptr, mpfr_prec_t, mpfr_exp_t *);
+static unsigned long
+mpfr_exp2_aux2 (mpz_t, mpfr_srcptr, mpfr_prec_t, mpfr_exp_t *);
+static mpfr_exp_t
+mpz_normalize (mpz_t, mpz_t, mpfr_exp_t);
+static mpfr_exp_t
+mpz_normalize2 (mpz_t, mpz_t, mpfr_exp_t, mpfr_exp_t);
+
+/* if k = the number of bits of z > q, divides z by 2^(k-q) and returns k-q.
+ Otherwise do nothing and return 0.
+ */
+static mpfr_exp_t
+mpz_normalize (mpz_t rop, mpz_t z, mpfr_exp_t q)
+{
+ size_t k;
+
+ MPFR_MPZ_SIZEINBASE2 (k, z);
+ MPFR_ASSERTD (k == (mpfr_uexp_t) k);
+ if (q < 0 || (mpfr_uexp_t) k > (mpfr_uexp_t) q)
+ {
+ mpz_fdiv_q_2exp (rop, z, (unsigned long) ((mpfr_uexp_t) k - q));
+ return (mpfr_exp_t) k - q;
+ }
+ if (MPFR_UNLIKELY(rop != z))
+ mpz_set (rop, z);
+ return 0;
+}
+
+/* if expz > target, shift z by (expz-target) bits to the left.
+ if expz < target, shift z by (target-expz) bits to the right.
+ Returns target.
+*/
+static mpfr_exp_t
+mpz_normalize2 (mpz_t rop, mpz_t z, mpfr_exp_t expz, mpfr_exp_t target)
+{
+ if (target > expz)
+ mpz_fdiv_q_2exp (rop, z, target - expz);
+ else
+ mpz_mul_2exp (rop, z, expz - target);
+ return target;
+}
+
+/* use Brent's formula exp(x) = (1+r+r^2/2!+r^3/3!+...)^(2^K)*2^n
+ where x = n*log(2)+(2^K)*r
+ together with the Paterson-Stockmeyer O(t^(1/2)) algorithm for the
+ evaluation of power series. The resulting complexity is O(n^(1/3)*M(n)).
+ This function returns with the exact flags due to exp.
+*/
+int
+mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ long n;
+ unsigned long K, k, l, err; /* FIXME: Which type ? */
+ int error_r;
+ mpfr_exp_t exps, expx;
+ mpfr_prec_t q, precy;
+ int inexact;
+ mpfr_t r, s;
+ mpz_t ss;
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
+ inexact));
+
+ expx = MPFR_GET_EXP (x);
+ precy = MPFR_PREC(y);
+
+ /* Warning: we cannot use the 'double' type here, since on 64-bit machines
+ x may be as large as 2^62*log(2) without overflow, and then x/log(2)
+ is about 2^62: not every integer of that size can be represented as a
+ 'double', thus the argument reduction would fail. */
+ if (expx <= -2)
+ /* |x| <= 0.25, thus n = round(x/log(2)) = 0 */
+ n = 0;
+ else
+ {
+ mpfr_init2 (r, sizeof (long) * CHAR_BIT);
+ mpfr_const_log2 (r, MPFR_RNDZ);
+ mpfr_div (r, x, r, MPFR_RNDN);
+ n = mpfr_get_si (r, MPFR_RNDN);
+ mpfr_clear (r);
+ }
+ /* we have |x| <= (|n|+1)*log(2) */
+ MPFR_LOG_MSG (("d(x)=%1.30e n=%ld\n", mpfr_get_d1(x), n));
+
+ /* error_r bounds the cancelled bits in x - n*log(2) */
+ if (MPFR_UNLIKELY (n == 0))
+ error_r = 0;
+ else
+ {
+ count_leading_zeros (error_r, (mp_limb_t) SAFE_ABS (unsigned long, n) + 1);
+ error_r = GMP_NUMB_BITS - error_r;
+ /* we have |x| <= 2^error_r * log(2) */
+ }
+
+ /* for the O(n^(1/2)*M(n)) method, the Taylor series computation of
+ n/K terms costs about n/(2K) multiplications when computed in fixed
+ point */
+ K = (precy < MPFR_EXP_2_THRESHOLD) ? __gmpfr_isqrt ((precy + 1) / 2)
+ : __gmpfr_cuberoot (4*precy);
+ l = (precy - 1) / K + 1;
+ err = K + MPFR_INT_CEIL_LOG2 (2 * l + 18);
+ /* add K extra bits, i.e. failure probability <= 1/2^K = O(1/precy) */
+ q = precy + err + K + 8;
+ /* if |x| >> 1, take into account the cancelled bits */
+ if (expx > 0)
+ q += expx;
+
+ /* Note: due to the mpfr_prec_round below, it is not possible to use
+ the MPFR_GROUP_* macros here. */
+
+ mpfr_init2 (r, q + error_r);
+ mpfr_init2 (s, q + error_r);
+
+ /* the algorithm consists in computing an upper bound of exp(x) using
+ a precision of q bits, and see if we can round to MPFR_PREC(y) taking
+ into account the maximal error. Otherwise we increase q. */
+ MPFR_ZIV_INIT (loop, q);
+ for (;;)
+ {
+ MPFR_LOG_MSG (("n=%ld K=%lu l=%lu q=%lu error_r=%d\n",
+ n, K, l, (unsigned long) q, error_r));
+
+ /* First reduce the argument to r = x - n * log(2),
+ so that r is small in absolute value. We want an upper
+ bound on r to get an upper bound on exp(x). */
+
+ /* if n<0, we have to get an upper bound of log(2)
+ in order to get an upper bound of r = x-n*log(2) */
+ mpfr_const_log2 (s, (n >= 0) ? MPFR_RNDZ : MPFR_RNDU);
+ /* s is within 1 ulp(s) of log(2) */
+
+ mpfr_mul_ui (r, s, (n < 0) ? -n : n, (n >= 0) ? MPFR_RNDZ : MPFR_RNDU);
+ /* r is within 3 ulps of |n|*log(2) */
+ if (n < 0)
+ MPFR_CHANGE_SIGN (r);
+ /* r <= n*log(2), within 3 ulps */
+
+ MPFR_LOG_VAR (x);
+ MPFR_LOG_VAR (r);
+
+ mpfr_sub (r, x, r, MPFR_RNDU);
+
+ if (MPFR_IS_PURE_FP (r))
+ {
+ while (MPFR_IS_NEG (r))
+ { /* initial approximation n was too large */
+ n--;
+ mpfr_add (r, r, s, MPFR_RNDU);
+ }
+
+ /* since there was a cancellation in x - n*log(2), the low error_r
+ bits from r are zero and thus non significant, thus we can reduce
+ the working precision */
+ if (error_r > 0)
+ mpfr_prec_round (r, q, MPFR_RNDU);
+ /* the error on r is at most 3 ulps (3 ulps if error_r = 0,
+ and 1 + 3/2 if error_r > 0) */
+ MPFR_LOG_VAR (r);
+ MPFR_ASSERTD (MPFR_IS_POS (r));
+ mpfr_div_2ui (r, r, K, MPFR_RNDU); /* r = (x-n*log(2))/2^K, exact */
+
+ mpz_init (ss);
+ exps = mpfr_get_z_2exp (ss, s);
+ /* s <- 1 + r/1! + r^2/2! + ... + r^l/l! */
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (r) && MPFR_EXP (r) < 0);
+ l = (precy < MPFR_EXP_2_THRESHOLD)
+ ? mpfr_exp2_aux (ss, r, q, &exps) /* naive method */
+ : mpfr_exp2_aux2 (ss, r, q, &exps); /* Paterson/Stockmeyer meth */
+
+ MPFR_LOG_MSG (("l=%lu q=%lu (K+l)*q^2=%1.3e\n",
+ l, (unsigned long) q, (K + l) * (double) q * q));
+
+ for (k = 0; k < K; k++)
+ {
+ mpz_mul (ss, ss, ss);
+ exps <<= 1;
+ exps += mpz_normalize (ss, ss, q);
+ }
+ mpfr_set_z (s, ss, MPFR_RNDN);
+
+ MPFR_SET_EXP(s, MPFR_GET_EXP (s) + exps);
+ mpz_clear (ss);
+
+ /* error is at most 2^K*l, plus 2 to take into account of
+ the error of 3 ulps on r */
+ err = K + MPFR_INT_CEIL_LOG2 (l) + 2;
+
+ MPFR_LOG_MSG (("before mult. by 2^n:\n", 0));
+ MPFR_LOG_VAR (s);
+ MPFR_LOG_MSG (("err=%lu bits\n", K));
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, q - err, precy, rnd_mode)))
+ {
+ mpfr_clear_flags ();
+ inexact = mpfr_mul_2si (y, s, n, rnd_mode);
+ break;
+ }
+ }
+
+ MPFR_ZIV_NEXT (loop, q);
+ mpfr_set_prec (r, q + error_r);
+ mpfr_set_prec (s, q + error_r);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ mpfr_clear (r);
+ mpfr_clear (s);
+
+ return inexact;
+}
+
+/* s <- 1 + r/1! + r^2/2! + ... + r^l/l! while MPFR_EXP(r^l/l!)+MPFR_EXPR(r)>-q
+ using naive method with O(l) multiplications.
+ Return the number of iterations l.
+ The absolute error on s is less than 3*l*(l+1)*2^(-q).
+ Version using fixed-point arithmetic with mpz instead
+ of mpfr for internal computations.
+ NOTE[VL]: the following sentence seems to be obsolete since MY_INIT_MPZ
+ is no longer used (r6919); qn was the number of limbs of q.
+ s must have at least qn+1 limbs (qn should be enough, but currently fails
+ since mpz_mul_2exp(s, s, q-1) reallocates qn+1 limbs)
+*/
+static unsigned long
+mpfr_exp2_aux (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mpfr_exp_t *exps)
+{
+ unsigned long l;
+ mpfr_exp_t dif, expt, expr;
+ mpz_t t, rr;
+ mp_size_t sbit, tbit;
+
+ MPFR_ASSERTN (MPFR_IS_PURE_FP (r));
+
+ expt = 0;
+ *exps = 1 - (mpfr_exp_t) q; /* s = 2^(q-1) */
+ mpz_init (t);
+ mpz_init (rr);
+ mpz_set_ui(t, 1);
+ mpz_set_ui(s, 1);
+ mpz_mul_2exp(s, s, q-1);
+ expr = mpfr_get_z_2exp(rr, r); /* no error here */
+
+ l = 0;
+ for (;;) {
+ l++;
+ mpz_mul(t, t, rr);
+ expt += expr;
+ MPFR_MPZ_SIZEINBASE2 (sbit, s);
+ MPFR_MPZ_SIZEINBASE2 (tbit, t);
+ dif = *exps + sbit - expt - tbit;
+ /* truncates the bits of t which are < ulp(s) = 2^(1-q) */
+ expt += mpz_normalize(t, t, (mpfr_exp_t) q-dif); /* error at most 2^(1-q) */
+ mpz_fdiv_q_ui (t, t, l); /* error at most 2^(1-q) */
+ /* the error wrt t^l/l! is here at most 3*l*ulp(s) */
+ MPFR_ASSERTD (expt == *exps);
+ if (mpz_sgn (t) == 0)
+ break;
+ mpz_add(s, s, t); /* no error here: exact */
+ /* ensures rr has the same size as t: after several shifts, the error
+ on rr is still at most ulp(t)=ulp(s) */
+ MPFR_MPZ_SIZEINBASE2 (tbit, t);
+ expr += mpz_normalize(rr, rr, tbit);
+ }
+
+ mpz_clear (t);
+ mpz_clear (rr);
+
+ return 3 * l * (l + 1);
+}
+
+/* s <- 1 + r/1! + r^2/2! + ... + r^l/l! while MPFR_EXP(r^l/l!)+MPFR_EXPR(r)>-q
+ using Paterson-Stockmeyer algorithm with O(sqrt(l)) multiplications.
+ Return l.
+ Uses m multiplications of full size and 2l/m of decreasing size,
+ i.e. a total equivalent to about m+l/m full multiplications,
+ i.e. 2*sqrt(l) for m=sqrt(l).
+ NOTE[VL]: The following sentence seems to be obsolete since MY_INIT_MPZ
+ is no longer used (r6919); sizer was the number of limbs of r.
+ Version using mpz. ss must have at least (sizer+1) limbs.
+ The error is bounded by (l^2+4*l) ulps where l is the return value.
+*/
+static unsigned long
+mpfr_exp2_aux2 (mpz_t s, mpfr_srcptr r, mpfr_prec_t q, mpfr_exp_t *exps)
+{
+ mpfr_exp_t expr, *expR, expt;
+ mpfr_prec_t ql;
+ unsigned long l, m, i;
+ mpz_t t, *R, rr, tmp;
+ mp_size_t sbit, rrbit;
+ MPFR_TMP_DECL(marker);
+
+ /* estimate value of l */
+ MPFR_ASSERTD (MPFR_GET_EXP (r) < 0);
+ l = q / (- MPFR_GET_EXP (r));
+ m = __gmpfr_isqrt (l);
+ /* we access R[2], thus we need m >= 2 */
+ if (m < 2)
+ m = 2;
+
+ MPFR_TMP_MARK(marker);
+ R = (mpz_t*) MPFR_TMP_ALLOC ((m + 1) * sizeof (mpz_t)); /* R[i] is r^i */
+ expR = (mpfr_exp_t*) MPFR_TMP_ALLOC((m + 1) * sizeof (mpfr_exp_t));
+ /* expR[i] is the exponent for R[i] */
+ mpz_init (tmp);
+ mpz_init (rr);
+ mpz_init (t);
+ mpz_set_ui (s, 0);
+ *exps = 1 - q; /* 1 ulp = 2^(1-q) */
+ for (i = 0 ; i <= m ; i++)
+ mpz_init (R[i]);
+ expR[1] = mpfr_get_z_2exp (R[1], r); /* exact operation: no error */
+ expR[1] = mpz_normalize2 (R[1], R[1], expR[1], 1 - q); /* error <= 1 ulp */
+ mpz_mul (t, R[1], R[1]); /* err(t) <= 2 ulps */
+ mpz_fdiv_q_2exp (R[2], t, q - 1); /* err(R[2]) <= 3 ulps */
+ expR[2] = 1 - q;
+ for (i = 3 ; i <= m ; i++)
+ {
+ if ((i & 1) == 1)
+ mpz_mul (t, R[i-1], R[1]); /* err(t) <= 2*i-2 */
+ else
+ mpz_mul (t, R[i/2], R[i/2]);
+ mpz_fdiv_q_2exp (R[i], t, q - 1); /* err(R[i]) <= 2*i-1 ulps */
+ expR[i] = 1 - q;
+ }
+ mpz_set_ui (R[0], 1);
+ mpz_mul_2exp (R[0], R[0], q-1);
+ expR[0] = 1-q; /* R[0]=1 */
+ mpz_set_ui (rr, 1);
+ expr = 0; /* rr contains r^l/l! */
+ /* by induction: err(rr) <= 2*l ulps */
+
+ l = 0;
+ ql = q; /* precision used for current giant step */
+ do
+ {
+ /* all R[i] must have exponent 1-ql */
+ if (l != 0)
+ for (i = 0 ; i < m ; i++)
+ expR[i] = mpz_normalize2 (R[i], R[i], expR[i], 1 - ql);
+ /* the absolute error on R[i]*rr is still 2*i-1 ulps */
+ expt = mpz_normalize2 (t, R[m-1], expR[m-1], 1 - ql);
+ /* err(t) <= 2*m-1 ulps */
+ /* computes t = 1 + r/(l+1) + ... + r^(m-1)*l!/(l+m-1)!
+ using Horner's scheme */
+ for (i = m-1 ; i-- != 0 ; )
+ {
+ mpz_fdiv_q_ui (t, t, l+i+1); /* err(t) += 1 ulp */
+ mpz_add (t, t, R[i]);
+ }
+ /* now err(t) <= (3m-2) ulps */
+
+ /* now multiplies t by r^l/l! and adds to s */
+ mpz_mul (t, t, rr);
+ expt += expr;
+ expt = mpz_normalize2 (t, t, expt, *exps);
+ /* err(t) <= (3m-1) + err_rr(l) <= (3m-2) + 2*l */
+ MPFR_ASSERTD (expt == *exps);
+ mpz_add (s, s, t); /* no error here */
+
+ /* updates rr, the multiplication of the factors l+i could be done
+ using binary splitting too, but it is not sure it would save much */
+ mpz_mul (t, rr, R[m]); /* err(t) <= err(rr) + 2m-1 */
+ expr += expR[m];
+ mpz_set_ui (tmp, 1);
+ for (i = 1 ; i <= m ; i++)
+ mpz_mul_ui (tmp, tmp, l + i);
+ mpz_fdiv_q (t, t, tmp); /* err(t) <= err(rr) + 2m */
+ l += m;
+ if (MPFR_UNLIKELY (mpz_sgn (t) == 0))
+ break;
+ expr += mpz_normalize (rr, t, ql); /* err_rr(l+1) <= err_rr(l) + 2m+1 */
+ if (MPFR_UNLIKELY (mpz_sgn (rr) == 0))
+ rrbit = 1;
+ else
+ MPFR_MPZ_SIZEINBASE2 (rrbit, rr);
+ MPFR_MPZ_SIZEINBASE2 (sbit, s);
+ ql = q - *exps - sbit + expr + rrbit;
+ /* TODO: Wrong cast. I don't want what is right, but this is
+ certainly wrong */
+ }
+ while ((size_t) expr + rrbit > (size_t) -q);
+
+ for (i = 0 ; i <= m ; i++)
+ mpz_clear (R[i]);
+ MPFR_TMP_FREE(marker);
+ mpz_clear (rr);
+ mpz_clear (t);
+ mpz_clear (tmp);
+
+ return l * (l + 4);
+}
diff --git a/src/expm1.c b/src/expm1.c
new file mode 100644
index 0000000..1961dd4
--- /dev/null
+++ b/src/expm1.c
@@ -0,0 +1,179 @@
+/* mpfr_expm1 -- Compute exp(x)-1
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of expm1 is done by
+ expm1(x)=exp(x)-1
+ */
+
+int
+mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x , mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_exp_t ex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ /* check for inf or -inf (expm1(-inf)=-1) */
+ else if (MPFR_IS_INF (x))
+ {
+ if (MPFR_IS_POS (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ else
+ return mpfr_set_si (y, -1, rnd_mode);
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y); /* expm1(+/- 0) = +/- 0 */
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ ex = MPFR_GET_EXP (x);
+ if (ex < 0)
+ {
+ /* For -1 < x < 0, abs(expm1(x)-x) < x^2/2.
+ For 0 < x < 1, abs(expm1(x)-x) < x^2. */
+ if (MPFR_IS_POS (x))
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, - ex, 0, 1, rnd_mode, {});
+ else
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, - ex, 1, 0, rnd_mode, {});
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ if (MPFR_IS_NEG (x) && ex > 5) /* x <= -32 */
+ {
+ mpfr_t minus_one, t;
+ mpfr_exp_t err;
+
+ mpfr_init2 (minus_one, 2);
+ mpfr_init2 (t, 64);
+ mpfr_set_si (minus_one, -1, MPFR_RNDN);
+ mpfr_const_log2 (t, MPFR_RNDU); /* round upward since x is negative */
+ mpfr_div (t, x, t, MPFR_RNDU); /* > x / ln(2) */
+ err = mpfr_cmp_si (t, MPFR_EMIN_MIN >= -LONG_MAX ?
+ MPFR_EMIN_MIN : -LONG_MAX) <= 0 ?
+ - (MPFR_EMIN_MIN >= -LONG_MAX ? MPFR_EMIN_MIN : -LONG_MAX) :
+ - mpfr_get_si (t, MPFR_RNDU);
+ /* exp(x) = 2^(x/ln(2))
+ <= 2^max(MPFR_EMIN_MIN,-LONG_MAX,ceil(x/ln(2)+epsilon))
+ with epsilon > 0 */
+ mpfr_clear (t);
+ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, minus_one, err, 0, 0, rnd_mode,
+ expo, { mpfr_clear (minus_one); });
+ mpfr_clear (minus_one);
+ }
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t;
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err, exp_te; /* error */
+ MPFR_ZIV_DECL (loop);
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 6;
+
+ /* if |x| is smaller than 2^(-e), we will loose about e bits in the
+ subtraction exp(x) - 1 */
+ if (ex < 0)
+ Nt += - ex;
+
+ /* initialize auxiliary variable */
+ mpfr_init2 (t, Nt);
+
+ /* First computation of expm1 */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* exp(x) may overflow and underflow */
+ MPFR_BLOCK (flags, mpfr_exp (t, x, MPFR_RNDN));
+ if (MPFR_OVERFLOW (flags))
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+ else if (MPFR_UNDERFLOW (flags))
+ {
+ inexact = mpfr_set_si (y, -1, rnd_mode);
+ MPFR_ASSERTD (inexact == 0);
+ inexact = -1;
+ if (MPFR_IS_LIKE_RNDZ (rnd_mode, 1))
+ {
+ inexact = 1;
+ mpfr_nexttozero (y);
+ }
+ break;
+ }
+
+ exp_te = MPFR_GET_EXP (t); /* FIXME: exp(x) may overflow! */
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN); /* exp(x)-1 */
+
+ /* error estimate */
+ /*err=Nt-(__gmpfr_ceil_log2(1+pow(2,MPFR_EXP(te)-MPFR_EXP(t))));*/
+ err = Nt - (MAX (exp_te - MPFR_GET_EXP (t), 0) + 1);
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ {
+ inexact = mpfr_set (y, t, rnd_mode);
+ break;
+ }
+
+ /* increase the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ mpfr_clear (t);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/extract.c b/src/extract.c
new file mode 100644
index 0000000..0338932
--- /dev/null
+++ b/src/extract.c
@@ -0,0 +1,55 @@
+/* mpfr_extract -- bit-extraction function for the binary splitting algorithm
+
+Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* given 0 <= |p| < 1, this function extracts limbs of p and puts them in y.
+ It is mainly designed for the "binary splitting" algorithm.
+
+ More precisely, if B = 2^GMP_NUMB_BITS:
+ - for i=0, y = floor(p * B)
+ - for i>0, y = (p * B^(2^i)) mod B^(2^(i-1))
+ */
+
+void
+mpfr_extract (mpz_ptr y, mpfr_srcptr p, unsigned int i)
+{
+ unsigned long two_i = 1UL << i;
+ unsigned long two_i_2 = i ? two_i / 2 : 1;
+ mp_size_t size_p = MPFR_LIMB_SIZE (p);
+
+ /* as 0 <= |p| < 1, we don't have to care with infinities, NaN, ... */
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (p));
+
+ _mpz_realloc (y, two_i_2);
+ if ((mpfr_uexp_t) size_p < two_i)
+ {
+ MPN_ZERO (PTR(y), two_i_2);
+ if ((mpfr_uexp_t) size_p >= two_i_2)
+ MPN_COPY (PTR(y) + two_i - size_p, MPFR_MANT(p), size_p - two_i_2);
+ }
+ else
+ MPN_COPY (PTR(y), MPFR_MANT(p) + size_p - two_i, two_i_2);
+
+ MPN_NORMALIZE (PTR(y), two_i_2);
+ SIZ(y) = (MPFR_IS_NEG (p)) ? -two_i_2 : two_i_2;
+}
diff --git a/src/factorial.c b/src/factorial.c
new file mode 100644
index 0000000..a4fee01
--- /dev/null
+++ b/src/factorial.c
@@ -0,0 +1,113 @@
+/* mpfr_fac_ui -- factorial of a non-negative integer
+
+Copyright 2001, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of n! is done by
+
+ n!=prod^{n}_{i=1}i
+ */
+
+/* FIXME: efficient problems with large arguments; see comments in gamma.c. */
+
+int
+mpfr_fac_ui (mpfr_ptr y, unsigned long int x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t; /* Variable of Intermediary Calculation*/
+ unsigned long i;
+ int round, inexact;
+
+ mpfr_prec_t Ny; /* Precision of output variable */
+ mpfr_prec_t Nt; /* Precision of Intermediary Calculation variable */
+ mpfr_prec_t err; /* Precision of error */
+
+ mpfr_rnd_t rnd;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ /***** test x = 0 and x == 1******/
+ if (MPFR_UNLIKELY (x <= 1))
+ return mpfr_set_ui (y, 1, rnd_mode); /* 0! = 1 and 1! = 1 */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Initialisation of the Precision */
+ Ny = MPFR_PREC (y);
+
+ /* compute the size of intermediary variable */
+ Nt = Ny + 2 * MPFR_INT_CEIL_LOG2 (x) + 7;
+
+ mpfr_init2 (t, Nt); /* initialise of intermediary variable */
+
+ rnd = MPFR_RNDZ;
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute factorial */
+ inexact = mpfr_set_ui (t, 1, rnd);
+ for (i = 2 ; i <= x ; i++)
+ {
+ round = mpfr_mul_ui (t, t, i, rnd);
+ /* assume the first inexact product gives the sign
+ of difference: is that always correct? */
+ if (inexact == 0)
+ inexact = round;
+ }
+
+ err = Nt - 1 - MPFR_INT_CEIL_LOG2 (Nt);
+
+ round = !inexact || mpfr_can_round (t, err, rnd, MPFR_RNDZ,
+ Ny + (rnd_mode == MPFR_RNDN));
+
+ if (MPFR_LIKELY (round))
+ {
+ /* If inexact = 0, then t is exactly x!, so round is the
+ correct inexact flag.
+ Otherwise, t != x! since we rounded to zero or away. */
+ round = mpfr_set (y, t, rnd_mode);
+ if (inexact == 0)
+ {
+ inexact = round;
+ break;
+ }
+ else if ((inexact < 0 && round <= 0)
+ || (inexact > 0 && round >= 0))
+ break;
+ else /* inexact and round have opposite signs: we cannot
+ compute the inexact flag. Restart using the
+ symmetric rounding. */
+ rnd = (rnd == MPFR_RNDZ) ? MPFR_RNDU : MPFR_RNDZ;
+ }
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
+
+
+
+
diff --git a/src/fits_intmax.c b/src/fits_intmax.c
new file mode 100644
index 0000000..260338e
--- /dev/null
+++ b/src/fits_intmax.c
@@ -0,0 +1,107 @@
+/* mpfr_fits_intmax_p -- test whether an mpfr fits an intmax_t.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+/* We can't use fits_s.h <= mpfr_cmp_ui */
+int
+mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ mpfr_exp_t e;
+ int prec;
+ mpfr_t x, y;
+ int neg;
+ int res;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
+ /* Zero always fit */
+ return MPFR_IS_ZERO (f) ? 1 : 0;
+
+ /* now it fits if either
+ (a) MINIMUM <= f <= MAXIMUM
+ (b) or MINIMUM <= round(f, prec(slong), rnd) <= MAXIMUM */
+
+ e = MPFR_EXP (f);
+ if (e < 1)
+ return 1; /* |f| < 1: always fits */
+
+ neg = MPFR_IS_NEG (f);
+
+ /* let EXTREMUM be MAXIMUM if f > 0, and MINIMUM if f < 0 */
+
+ /* first compute prec(EXTREMUM), this could be done at configure time,
+ but the result can depend on neg (the loop is moved inside the "if"
+ to give the compiler a better chance to compute prec statically) */
+ if (neg)
+ {
+ uintmax_t s;
+ /* In C89, the division on negative integers isn't well-defined. */
+ s = SAFE_ABS (uintmax_t, MPFR_INTMAX_MIN);
+ for (prec = 0; s != 0; s /= 2, prec ++);
+ }
+ else
+ {
+ intmax_t s;
+ s = MPFR_INTMAX_MAX;
+ for (prec = 0; s != 0; s /= 2, prec ++);
+ }
+
+ /* EXTREMUM needs prec bits, i.e. 2^(prec-1) <= |EXTREMUM| < 2^prec */
+
+ /* if e <= prec - 1, then f < 2^(prec-1) <= |EXTREMUM| */
+ if (e <= prec - 1)
+ return 1;
+
+ /* if e >= prec + 1, then f >= 2^prec > |EXTREMUM| */
+ if (e >= prec + 1)
+ return 0;
+
+ MPFR_ASSERTD (e == prec);
+
+ /* hard case: first round to prec bits, then check */
+ mpfr_init2 (x, prec);
+ mpfr_set (x, f, rnd);
+
+ if (neg)
+ {
+ mpfr_init2 (y, prec);
+ mpfr_set_sj (y, MPFR_INTMAX_MIN, MPFR_RNDN);
+ res = mpfr_cmp (x, y) >= 0;
+ mpfr_clear (y);
+ }
+ else
+ {
+ res = MPFR_GET_EXP (x) == e;
+ }
+
+ mpfr_clear (x);
+ return res;
+}
+
+#endif
diff --git a/src/fits_s.h b/src/fits_s.h
new file mode 100644
index 0000000..83ebc2c
--- /dev/null
+++ b/src/fits_s.h
@@ -0,0 +1,89 @@
+/* mpfr_fits_*_p -- test whether an mpfr fits a C signed type.
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* The original version of this file came from GMP's mpf/fits_s.h;
+ it has been adapted for MPFR. In particular, the result can be
+ rounded away from zero. */
+
+int
+FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ mpfr_exp_t e;
+ int prec;
+ mpfr_t x;
+ int neg;
+ int res;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
+ /* Zero always fit */
+ return MPFR_IS_ZERO (f) ? 1 : 0;
+
+ /* now it fits if either
+ (a) MINIMUM <= f <= MAXIMUM
+ (b) or MINIMUM <= round(f, prec(slong), rnd) <= MAXIMUM */
+
+ e = MPFR_GET_EXP (f);
+ if (e < 1)
+ return 1; /* |f| < 1: always fits */
+
+ neg = MPFR_IS_NEG (f);
+
+ /* let EXTREMUM be MAXIMUM if f > 0, and MINIMUM if f < 0 */
+
+ /* first compute prec(EXTREMUM), this could be done at configure time,
+ but the result can depend on neg (the loop is moved inside the "if"
+ to give the compiler a better chance to compute prec statically) */
+ if (neg)
+ {
+ unsigned TYPE s;
+ /* In C89, the division on negative integers isn't well-defined. */
+ s = SAFE_ABS (unsigned TYPE, MINIMUM);
+ for (prec = 0; s != 0; s /= 2, prec ++);
+ }
+ else
+ {
+ TYPE s;
+ s = MAXIMUM;
+ for (prec = 0; s != 0; s /= 2, prec ++);
+ }
+
+ /* EXTREMUM needs prec bits, i.e. 2^(prec-1) <= |EXTREMUM| < 2^prec */
+
+ /* if e <= prec - 1, then f < 2^(prec-1) <= |EXTREMUM| */
+ if (e <= prec - 1)
+ return 1;
+
+ /* if e >= prec + 1, then f >= 2^prec > |EXTREMUM| */
+ if (e >= prec + 1)
+ return 0;
+
+ MPFR_ASSERTD (e == prec);
+
+ /* hard case: first round to prec bits, then check */
+ mpfr_init2 (x, prec);
+ mpfr_set (x, f, rnd);
+ res = neg ? (mpfr_cmp_si (x, MINIMUM) >= 0) : (MPFR_GET_EXP (x) == e);
+ mpfr_clear (x);
+ return res;
+}
diff --git a/src/fits_sint.c b/src/fits_sint.c
new file mode 100644
index 0000000..111b05c
--- /dev/null
+++ b/src/fits_sint.c
@@ -0,0 +1,28 @@
+/* mpfr_fits_sint_p -- test whether an mpfr fits an int.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_fits_sint_p
+#define MAXIMUM INT_MAX
+#define MINIMUM INT_MIN
+#define TYPE int
+
+#include "fits_s.h"
diff --git a/src/fits_slong.c b/src/fits_slong.c
new file mode 100644
index 0000000..2e37f0d
--- /dev/null
+++ b/src/fits_slong.c
@@ -0,0 +1,28 @@
+/* mpfr_fits_slong_p -- test whether an mpfr fits a long.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_fits_slong_p
+#define MAXIMUM LONG_MAX
+#define MINIMUM LONG_MIN
+#define TYPE long
+
+#include "fits_s.h"
diff --git a/src/fits_sshort.c b/src/fits_sshort.c
new file mode 100644
index 0000000..85e31fb
--- /dev/null
+++ b/src/fits_sshort.c
@@ -0,0 +1,28 @@
+/* mpfr_fits_sshort_p -- test whether an mpfr fits a short.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_fits_sshort_p
+#define MAXIMUM SHRT_MAX
+#define MINIMUM SHRT_MIN
+#define TYPE short
+
+#include "fits_s.h"
diff --git a/src/fits_u.h b/src/fits_u.h
new file mode 100644
index 0000000..ab4715f
--- /dev/null
+++ b/src/fits_u.h
@@ -0,0 +1,67 @@
+/* mpfr_fits_*_p -- test whether an mpfr fits a C unsigned type.
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ mpfr_exp_t e;
+ int prec;
+ TYPE s;
+ mpfr_t x;
+ int res;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
+ /* Zero always fit */
+ return MPFR_IS_ZERO (f) ? 1 : 0;
+ else if (MPFR_IS_NEG (f))
+ /* Negative numbers don't fit */
+ return 0;
+ /* now it fits if
+ (a) f <= MAXIMUM
+ (b) round(f, prec(slong), rnd) <= MAXIMUM */
+
+ e = MPFR_GET_EXP (f);
+
+ /* first compute prec(MAXIMUM); fits in an int */
+ for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++);
+
+ /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */
+
+ /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */
+ if (e <= prec - 1)
+ return 1;
+
+ /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */
+ if (e >= prec + 1)
+ return 0;
+
+ MPFR_ASSERTD (e == prec);
+
+ /* hard case: first round to prec bits, then check */
+ mpfr_init2 (x, prec);
+ mpfr_set (x, f, rnd);
+ res = MPFR_GET_EXP (x) == e;
+ mpfr_clear (x);
+ return res;
+}
diff --git a/src/fits_uint.c b/src/fits_uint.c
new file mode 100644
index 0000000..6c6d3bb
--- /dev/null
+++ b/src/fits_uint.c
@@ -0,0 +1,27 @@
+/* mpfr_fits_uint_p -- test whether an mpfr fits an unsigned int.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_fits_uint_p
+#define MAXIMUM UINT_MAX
+#define TYPE unsigned int
+
+#include "fits_u.h"
diff --git a/src/fits_uintmax.c b/src/fits_uintmax.c
new file mode 100644
index 0000000..43a9ca9
--- /dev/null
+++ b/src/fits_uintmax.c
@@ -0,0 +1,77 @@
+/* mpfr_fits_uintmax_p -- test whether an mpfr fits an uintmax_t.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+/* We can't use fits_u.h <= mpfr_cmp_ui */
+int
+mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ mpfr_exp_t e;
+ int prec;
+ uintmax_t s;
+ mpfr_t x;
+ int res;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
+ /* Zero always fit */
+ return MPFR_IS_ZERO (f) ? 1 : 0;
+ else if (MPFR_IS_NEG (f))
+ /* Negative numbers don't fit */
+ return 0;
+ /* now it fits if
+ (a) f <= MAXIMUM
+ (b) round(f, prec(slong), rnd) <= MAXIMUM */
+
+ e = MPFR_GET_EXP (f);
+
+ /* first compute prec(MAXIMUM); fits in an int */
+ for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++);
+
+ /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */
+
+ /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */
+ if (e <= prec - 1)
+ return 1;
+
+ /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */
+ if (e >= prec + 1)
+ return 0;
+
+ MPFR_ASSERTD (e == prec);
+
+ /* hard case: first round to prec bits, then check */
+ mpfr_init2 (x, prec);
+ mpfr_set (x, f, rnd);
+ res = MPFR_GET_EXP (x) == e;
+ mpfr_clear (x);
+ return res;
+}
+
+#endif
diff --git a/src/fits_ulong.c b/src/fits_ulong.c
new file mode 100644
index 0000000..d311e7e
--- /dev/null
+++ b/src/fits_ulong.c
@@ -0,0 +1,27 @@
+/* mpfr_fits_ulong_p -- test whether an mpfr fits an unsigned long.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_fits_ulong_p
+#define MAXIMUM ULONG_MAX
+#define TYPE unsigned long
+
+#include "fits_u.h"
diff --git a/src/fits_ushort.c b/src/fits_ushort.c
new file mode 100644
index 0000000..25c74b1
--- /dev/null
+++ b/src/fits_ushort.c
@@ -0,0 +1,27 @@
+/* mpfr_fits_ushort_p -- test whether an mpfr fits an unsigned short.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_fits_ushort_p
+#define MAXIMUM USHRT_MAX
+#define TYPE unsigned short
+
+#include "fits_u.h"
diff --git a/src/fma.c b/src/fma.c
new file mode 100644
index 0000000..8454e8d
--- /dev/null
+++ b/src/fma.c
@@ -0,0 +1,302 @@
+/* mpfr_fma -- Floating multiply-add
+
+Copyright 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* The fused-multiply-add (fma) of x, y and z is defined by:
+ fma(x,y,z)= x*y + z
+*/
+
+int
+mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
+ mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t u;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_GROUP_DECL(group);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg z[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x,
+ mpfr_get_prec (y), mpfr_log_prec, y,
+ mpfr_get_prec (z), mpfr_log_prec, z, rnd_mode),
+ ("s[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (s), mpfr_log_prec, s, inexact));
+
+ /* particular cases */
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) ||
+ MPFR_IS_SINGULAR(y) ||
+ MPFR_IS_SINGULAR(z) ))
+ {
+ if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y) || MPFR_IS_NAN(z))
+ {
+ MPFR_SET_NAN(s);
+ MPFR_RET_NAN;
+ }
+ /* now neither x, y or z is NaN */
+ else if (MPFR_IS_INF(x) || MPFR_IS_INF(y))
+ {
+ /* cases Inf*0+z, 0*Inf+z, Inf-Inf */
+ if ((MPFR_IS_ZERO(y)) ||
+ (MPFR_IS_ZERO(x)) ||
+ (MPFR_IS_INF(z) &&
+ ((MPFR_MULT_SIGN(MPFR_SIGN(x), MPFR_SIGN(y))) != MPFR_SIGN(z))))
+ {
+ MPFR_SET_NAN(s);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(z)) /* case Inf-Inf already checked above */
+ {
+ MPFR_SET_INF(s);
+ MPFR_SET_SAME_SIGN(s, z);
+ MPFR_RET(0);
+ }
+ else /* z is finite */
+ {
+ MPFR_SET_INF(s);
+ MPFR_SET_SIGN(s, MPFR_MULT_SIGN(MPFR_SIGN(x) , MPFR_SIGN(y)));
+ MPFR_RET(0);
+ }
+ }
+ /* now x and y are finite */
+ else if (MPFR_IS_INF(z))
+ {
+ MPFR_SET_INF(s);
+ MPFR_SET_SAME_SIGN(s, z);
+ MPFR_RET(0);
+ }
+ else if (MPFR_IS_ZERO(x) || MPFR_IS_ZERO(y))
+ {
+ if (MPFR_IS_ZERO(z))
+ {
+ int sign_p;
+ sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) );
+ MPFR_SET_SIGN(s,(rnd_mode != MPFR_RNDD ?
+ ((MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_NEG(z))
+ ? -1 : 1) :
+ ((MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_POS(z))
+ ? 1 : -1)));
+ MPFR_SET_ZERO(s);
+ MPFR_RET(0);
+ }
+ else
+ return mpfr_set (s, z, rnd_mode);
+ }
+ else /* necessarily z is zero here */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(z));
+ return mpfr_mul (s, x, y, rnd_mode);
+ }
+ }
+
+ /* If we take prec(u) >= prec(x) + prec(y), the product u <- x*y
+ is exact, except in case of overflow or underflow. */
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_GROUP_INIT_1 (group, MPFR_PREC(x) + MPFR_PREC(y), u);
+
+ if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN)))
+ {
+ /* overflow or underflow - this case is regarded as rare, thus
+ does not need to be very efficient (even if some tests below
+ could have been done earlier).
+ It is an overflow iff u is an infinity (since MPFR_RNDN was used).
+ Alternatively, we could test the overflow flag, but in this case,
+ mpfr_clear_flags would have been necessary. */
+ if (MPFR_IS_INF (u)) /* overflow */
+ {
+ /* Let's eliminate the obvious case where x*y and z have the
+ same sign. No possible cancellation -> real overflow.
+ Also, we know that |z| < 2^emax. If E(x) + E(y) >= emax+3,
+ then |x*y| >= 2^(emax+1), and |x*y + z| >= 2^emax. This case
+ is also an overflow. */
+ if (MPFR_SIGN (u) == MPFR_SIGN (z) ||
+ MPFR_GET_EXP (x) + MPFR_GET_EXP (y) >= __gmpfr_emax + 3)
+ {
+ MPFR_GROUP_CLEAR (group);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_overflow (s, rnd_mode, MPFR_SIGN (z));
+ }
+
+ /* E(x) + E(y) <= emax+2, therefore |x*y| < 2^(emax+2), and
+ (x/4)*y does not overflow (let's recall that the result
+ is exact with an unbounded exponent range). It does not
+ underflow either, because x*y overflows and the exponent
+ range is large enough. */
+ inexact = mpfr_div_2ui (u, x, 2, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_mul (u, u, y, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+
+ /* Now, we need to add z/4... But it may underflow! */
+ {
+ mpfr_t zo4;
+ mpfr_srcptr zz;
+ MPFR_BLOCK_DECL (flags);
+
+ if (MPFR_GET_EXP (u) > MPFR_GET_EXP (z) &&
+ MPFR_GET_EXP (u) - MPFR_GET_EXP (z) > MPFR_PREC (u))
+ {
+ /* |z| < ulp(u)/2, therefore one can use z instead of z/4. */
+ zz = z;
+ }
+ else
+ {
+ mpfr_init2 (zo4, MPFR_PREC (z));
+ if (mpfr_div_2ui (zo4, z, 2, MPFR_RNDZ))
+ {
+ /* The division by 4 underflowed! */
+ MPFR_ASSERTN (0); /* TODO... */
+ }
+ zz = zo4;
+ }
+
+ /* Let's recall that u = x*y/4 and zz = z/4 (or z if the
+ following addition would give the same result). */
+ MPFR_BLOCK (flags, inexact = mpfr_add (s, u, zz, rnd_mode));
+ /* u and zz have different signs, so that an overflow
+ is not possible. But an underflow is theoretically
+ possible! */
+ if (MPFR_UNDERFLOW (flags))
+ {
+ MPFR_ASSERTN (zz != z);
+ MPFR_ASSERTN (0); /* TODO... */
+ mpfr_clears (zo4, u, (mpfr_ptr) 0);
+ }
+ else
+ {
+ int inex2;
+
+ if (zz != z)
+ mpfr_clear (zo4);
+ MPFR_GROUP_CLEAR (group);
+ MPFR_ASSERTN (! MPFR_OVERFLOW (flags));
+ inex2 = mpfr_mul_2ui (s, s, 2, rnd_mode);
+ if (inex2) /* overflow */
+ {
+ inexact = inex2;
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ }
+ goto end;
+ }
+ }
+ }
+ else /* underflow: one has |xy| < 2^(emin-1). */
+ {
+ unsigned long scale = 0;
+ mpfr_t scaled_z;
+ mpfr_srcptr new_z;
+ mpfr_exp_t diffexp;
+ mpfr_prec_t pzs;
+ int xy_underflows;
+
+ /* Let's scale z so that ulp(z) > 2^emin and ulp(s) > 2^emin
+ (the + 1 on MPFR_PREC (s) is necessary because the exponent
+ of the result can be EXP(z) - 1). */
+ diffexp = MPFR_GET_EXP (z) - __gmpfr_emin;
+ pzs = MAX (MPFR_PREC (z), MPFR_PREC (s) + 1);
+ if (diffexp <= pzs)
+ {
+ mpfr_uexp_t uscale;
+ mpfr_t scaled_v;
+ MPFR_BLOCK_DECL (flags);
+
+ uscale = (mpfr_uexp_t) pzs - diffexp + 1;
+ MPFR_ASSERTN (uscale > 0);
+ MPFR_ASSERTN (uscale <= ULONG_MAX);
+ scale = uscale;
+ mpfr_init2 (scaled_z, MPFR_PREC (z));
+ inexact = mpfr_mul_2ui (scaled_z, z, scale, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0); /* TODO: overflow case */
+ new_z = scaled_z;
+ /* Now we need to recompute u = xy * 2^scale. */
+ MPFR_BLOCK (flags,
+ if (MPFR_GET_EXP (x) < MPFR_GET_EXP (y))
+ {
+ mpfr_init2 (scaled_v, MPFR_PREC (x));
+ mpfr_mul_2ui (scaled_v, x, scale, MPFR_RNDN);
+ mpfr_mul (u, scaled_v, y, MPFR_RNDN);
+ }
+ else
+ {
+ mpfr_init2 (scaled_v, MPFR_PREC (y));
+ mpfr_mul_2ui (scaled_v, y, scale, MPFR_RNDN);
+ mpfr_mul (u, x, scaled_v, MPFR_RNDN);
+ });
+ mpfr_clear (scaled_v);
+ MPFR_ASSERTN (! MPFR_OVERFLOW (flags));
+ xy_underflows = MPFR_UNDERFLOW (flags);
+ }
+ else
+ {
+ new_z = z;
+ xy_underflows = 1;
+ }
+
+ if (xy_underflows)
+ {
+ /* Let's replace xy by sign(xy) * 2^(emin-1). */
+ MPFR_PREC (u) = MPFR_PREC_MIN;
+ mpfr_setmin (u, __gmpfr_emin);
+ MPFR_SET_SIGN (u, MPFR_MULT_SIGN (MPFR_SIGN (x),
+ MPFR_SIGN (y)));
+ }
+
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_BLOCK (flags, inexact = mpfr_add (s, u, new_z, rnd_mode));
+ MPFR_GROUP_CLEAR (group);
+ if (scale != 0)
+ {
+ int inex2;
+
+ mpfr_clear (scaled_z);
+ /* Here an overflow is theoretically possible, in which case
+ the result may be wrong, hence the assert. An underflow
+ is not possible, but let's check that anyway. */
+ MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); /* TODO... */
+ MPFR_ASSERTN (! MPFR_UNDERFLOW (flags)); /* not possible */
+ inex2 = mpfr_div_2ui (s, s, scale, MPFR_RNDN);
+ /* FIXME: this seems incorrect. MPFR_RNDN -> rnd_mode?
+ Also, handle the double rounding case:
+ s / 2^scale = 2^(emin - 2) in MPFR_RNDN. */
+ if (inex2) /* underflow */
+ inexact = inex2;
+ }
+ }
+
+ /* FIXME/TODO: I'm not sure that the following is correct.
+ Check for possible spurious exceptions due to intermediate
+ computations. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ goto end;
+ }
+ }
+
+ inexact = mpfr_add (s, u, z, rnd_mode);
+ MPFR_GROUP_CLEAR (group);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (s, inexact, rnd_mode);
+}
diff --git a/src/fms.c b/src/fms.c
new file mode 100644
index 0000000..2c0fd53
--- /dev/null
+++ b/src/fms.c
@@ -0,0 +1,304 @@
+/* mpfr_fms -- Floating multiply-subtract
+
+Copyright 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* The fused-multiply-subtract (fms) of x, y and z is defined by:
+ fms(x,y,z)= x*y - z
+ Note: this is neither in IEEE754R, nor in LIA-2, but both the
+ PowerPC and the Itanium define fms as x*y - z.
+*/
+
+int
+mpfr_fms (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
+ mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t u;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_GROUP_DECL(group);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg z[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x,
+ mpfr_get_prec (y), mpfr_log_prec, y,
+ mpfr_get_prec (z), mpfr_log_prec, z, rnd_mode),
+ ("s[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (s), mpfr_log_prec, s, inexact));
+
+ /* particular cases */
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) ||
+ MPFR_IS_SINGULAR(y) ||
+ MPFR_IS_SINGULAR(z) ))
+ {
+ if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y) || MPFR_IS_NAN(z))
+ {
+ MPFR_SET_NAN(s);
+ MPFR_RET_NAN;
+ }
+ /* now neither x, y or z is NaN */
+ else if (MPFR_IS_INF(x) || MPFR_IS_INF(y))
+ {
+ /* cases Inf*0-z, 0*Inf-z, Inf-Inf */
+ if ((MPFR_IS_ZERO(y)) ||
+ (MPFR_IS_ZERO(x)) ||
+ (MPFR_IS_INF(z) &&
+ ((MPFR_MULT_SIGN(MPFR_SIGN(x), MPFR_SIGN(y))) == MPFR_SIGN(z))))
+ {
+ MPFR_SET_NAN(s);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(z)) /* case Inf-Inf already checked above */
+ {
+ MPFR_SET_INF(s);
+ MPFR_SET_OPPOSITE_SIGN(s, z);
+ MPFR_RET(0);
+ }
+ else /* z is finite */
+ {
+ MPFR_SET_INF(s);
+ MPFR_SET_SIGN(s, MPFR_MULT_SIGN(MPFR_SIGN(x) , MPFR_SIGN(y)));
+ MPFR_RET(0);
+ }
+ }
+ /* now x and y are finite */
+ else if (MPFR_IS_INF(z))
+ {
+ MPFR_SET_INF(s);
+ MPFR_SET_OPPOSITE_SIGN(s, z);
+ MPFR_RET(0);
+ }
+ else if (MPFR_IS_ZERO(x) || MPFR_IS_ZERO(y))
+ {
+ if (MPFR_IS_ZERO(z))
+ {
+ int sign_p;
+ sign_p = MPFR_MULT_SIGN( MPFR_SIGN(x) , MPFR_SIGN(y) );
+ MPFR_SET_SIGN(s,(rnd_mode != MPFR_RNDD ?
+ ((MPFR_IS_NEG_SIGN(sign_p) && MPFR_IS_POS(z))
+ ? -1 : 1) :
+ ((MPFR_IS_POS_SIGN(sign_p) && MPFR_IS_NEG(z))
+ ? 1 : -1)));
+ MPFR_SET_ZERO(s);
+ MPFR_RET(0);
+ }
+ else
+ return mpfr_neg (s, z, rnd_mode);
+ }
+ else /* necessarily z is zero here */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(z));
+ return mpfr_mul (s, x, y, rnd_mode);
+ }
+ }
+
+ /* If we take prec(u) >= prec(x) + prec(y), the product u <- x*y
+ is exact, except in case of overflow or underflow. */
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_GROUP_INIT_1 (group, MPFR_PREC(x) + MPFR_PREC(y), u);
+
+ if (MPFR_UNLIKELY (mpfr_mul (u, x, y, MPFR_RNDN)))
+ {
+ /* overflow or underflow - this case is regarded as rare, thus
+ does not need to be very efficient (even if some tests below
+ could have been done earlier).
+ It is an overflow iff u is an infinity (since MPFR_RNDN was used).
+ Alternatively, we could test the overflow flag, but in this case,
+ mpfr_clear_flags would have been necessary. */
+ if (MPFR_IS_INF (u)) /* overflow */
+ {
+ /* Let's eliminate the obvious case where x*y and z have the
+ same sign. No possible cancellation -> real overflow.
+ Also, we know that |z| < 2^emax. If E(x) + E(y) >= emax+3,
+ then |x*y| >= 2^(emax+1), and |x*y - z| >= 2^emax. This case
+ is also an overflow. */
+ if (MPFR_SIGN (u) != MPFR_SIGN (z) ||
+ MPFR_GET_EXP (x) + MPFR_GET_EXP (y) >= __gmpfr_emax + 3)
+ {
+ MPFR_GROUP_CLEAR (group);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_overflow (s, rnd_mode, - MPFR_SIGN (z));
+ }
+
+ /* E(x) + E(y) <= emax+2, therefore |x*y| < 2^(emax+2), and
+ (x/4)*y does not overflow (let's recall that the result
+ is exact with an unbounded exponent range). It does not
+ underflow either, because x*y overflows and the exponent
+ range is large enough. */
+ inexact = mpfr_div_2ui (u, x, 2, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_mul (u, u, y, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+
+ /* Now, we need to subtract z/4... But it may underflow! */
+ {
+ mpfr_t zo4;
+ mpfr_srcptr zz;
+ MPFR_BLOCK_DECL (flags);
+
+ if (MPFR_GET_EXP (u) > MPFR_GET_EXP (z) &&
+ MPFR_GET_EXP (u) - MPFR_GET_EXP (z) > MPFR_PREC (u))
+ {
+ /* |z| < ulp(u)/2, therefore one can use z instead of z/4. */
+ zz = z;
+ }
+ else
+ {
+ mpfr_init2 (zo4, MPFR_PREC (z));
+ if (mpfr_div_2ui (zo4, z, 2, MPFR_RNDZ))
+ {
+ /* The division by 4 underflowed! */
+ MPFR_ASSERTN (0); /* TODO... */
+ }
+ zz = zo4;
+ }
+
+ /* Let's recall that u = x*y/4 and zz = z/4 (or z if the
+ following subtraction would give the same result). */
+ MPFR_BLOCK (flags, inexact = mpfr_sub (s, u, zz, rnd_mode));
+ /* u and zz have the same sign, so that an overflow
+ is not possible. But an underflow is theoretically
+ possible! */
+ if (MPFR_UNDERFLOW (flags))
+ {
+ MPFR_ASSERTN (zz != z);
+ MPFR_ASSERTN (0); /* TODO... */
+ mpfr_clears (zo4, u, (mpfr_ptr) 0);
+ }
+ else
+ {
+ int inex2;
+
+ if (zz != z)
+ mpfr_clear (zo4);
+ MPFR_GROUP_CLEAR (group);
+ MPFR_ASSERTN (! MPFR_OVERFLOW (flags));
+ inex2 = mpfr_mul_2ui (s, s, 2, rnd_mode);
+ if (inex2) /* overflow */
+ {
+ inexact = inex2;
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ }
+ goto end;
+ }
+ }
+ }
+ else /* underflow: one has |xy| < 2^(emin-1). */
+ {
+ unsigned long scale = 0;
+ mpfr_t scaled_z;
+ mpfr_srcptr new_z;
+ mpfr_exp_t diffexp;
+ mpfr_prec_t pzs;
+ int xy_underflows;
+
+ /* Let's scale z so that ulp(z) > 2^emin and ulp(s) > 2^emin
+ (the + 1 on MPFR_PREC (s) is necessary because the exponent
+ of the result can be EXP(z) - 1). */
+ diffexp = MPFR_GET_EXP (z) - __gmpfr_emin;
+ pzs = MAX (MPFR_PREC (z), MPFR_PREC (s) + 1);
+ if (diffexp <= pzs)
+ {
+ mpfr_uexp_t uscale;
+ mpfr_t scaled_v;
+ MPFR_BLOCK_DECL (flags);
+
+ uscale = (mpfr_uexp_t) pzs - diffexp + 1;
+ MPFR_ASSERTN (uscale > 0);
+ MPFR_ASSERTN (uscale <= ULONG_MAX);
+ scale = uscale;
+ mpfr_init2 (scaled_z, MPFR_PREC (z));
+ inexact = mpfr_mul_2ui (scaled_z, z, scale, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0); /* TODO: overflow case */
+ new_z = scaled_z;
+ /* Now we need to recompute u = xy * 2^scale. */
+ MPFR_BLOCK (flags,
+ if (MPFR_GET_EXP (x) < MPFR_GET_EXP (y))
+ {
+ mpfr_init2 (scaled_v, MPFR_PREC (x));
+ mpfr_mul_2ui (scaled_v, x, scale, MPFR_RNDN);
+ mpfr_mul (u, scaled_v, y, MPFR_RNDN);
+ }
+ else
+ {
+ mpfr_init2 (scaled_v, MPFR_PREC (y));
+ mpfr_mul_2ui (scaled_v, y, scale, MPFR_RNDN);
+ mpfr_mul (u, x, scaled_v, MPFR_RNDN);
+ });
+ mpfr_clear (scaled_v);
+ MPFR_ASSERTN (! MPFR_OVERFLOW (flags));
+ xy_underflows = MPFR_UNDERFLOW (flags);
+ }
+ else
+ {
+ new_z = z;
+ xy_underflows = 1;
+ }
+
+ if (xy_underflows)
+ {
+ /* Let's replace xy by sign(xy) * 2^(emin-1). */
+ MPFR_PREC (u) = MPFR_PREC_MIN;
+ mpfr_setmin (u, __gmpfr_emin);
+ MPFR_SET_SIGN (u, MPFR_MULT_SIGN (MPFR_SIGN (x),
+ MPFR_SIGN (y)));
+ }
+
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_BLOCK (flags, inexact = mpfr_sub (s, u, new_z, rnd_mode));
+ MPFR_GROUP_CLEAR (group);
+ if (scale != 0)
+ {
+ int inex2;
+
+ mpfr_clear (scaled_z);
+ /* Here an overflow is theoretically possible, in which case
+ the result may be wrong, hence the assert. An underflow
+ is not possible, but let's check that anyway. */
+ MPFR_ASSERTN (! MPFR_OVERFLOW (flags)); /* TODO... */
+ MPFR_ASSERTN (! MPFR_UNDERFLOW (flags)); /* not possible */
+ inex2 = mpfr_div_2ui (s, s, scale, MPFR_RNDN);
+ /* FIXME: this seems incorrect. MPFR_RNDN -> rnd_mode?
+ Also, handle the double rounding case:
+ s / 2^scale = 2^(emin - 2) in MPFR_RNDN. */
+ if (inex2) /* underflow */
+ inexact = inex2;
+ }
+ }
+
+ /* FIXME/TODO: I'm not sure that the following is correct.
+ Check for possible spurious exceptions due to intermediate
+ computations. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ goto end;
+ }
+ }
+
+ inexact = mpfr_sub (s, u, z, rnd_mode);
+ MPFR_GROUP_CLEAR (group);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (s, inexact, rnd_mode);
+}
diff --git a/src/frac.c b/src/frac.c
new file mode 100644
index 0000000..b857e3a
--- /dev/null
+++ b/src/frac.c
@@ -0,0 +1,144 @@
+/* mpfr_frac -- Fractional part of a floating-point number.
+
+Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Optimization note: it is not a good idea to call mpfr_integer_p,
+ as some cases will take longer (the number may be parsed twice). */
+
+int
+mpfr_frac (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_exp_t re, ue;
+ mpfr_prec_t uq;
+ mp_size_t un, tn, t0;
+ mp_limb_t *up, *tp, k;
+ int sh;
+ mpfr_t tmp;
+ mpfr_ptr t;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ /* Special cases */
+ if (MPFR_UNLIKELY(MPFR_IS_NAN(u)))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_UNLIKELY(MPFR_IS_INF(u) || mpfr_integer_p (u)))
+ {
+ MPFR_SET_SAME_SIGN(r, u);
+ MPFR_SET_ZERO(r);
+ MPFR_RET(0); /* zero is exact */
+ }
+
+ ue = MPFR_GET_EXP (u);
+ if (ue <= 0) /* |u| < 1 */
+ return mpfr_set (r, u, rnd_mode);
+
+ /* Now |u| >= 1, meaning that an overflow is not possible. */
+
+ uq = MPFR_PREC(u);
+ un = (uq - 1) / GMP_NUMB_BITS; /* index of most significant limb */
+ un -= (mp_size_t) (ue / GMP_NUMB_BITS);
+ /* now the index of the MSL containing bits of the fractional part */
+
+ up = MPFR_MANT(u);
+ sh = ue % GMP_NUMB_BITS;
+ k = up[un] << sh;
+ /* the first bit of the fractional part is the MSB of k */
+
+ if (k != 0)
+ {
+ int cnt;
+
+ count_leading_zeros(cnt, k);
+ /* first bit 1 of the fractional part -> MSB of the number */
+ re = -cnt;
+ sh += cnt;
+ MPFR_ASSERTN (sh < GMP_NUMB_BITS);
+ k <<= cnt;
+ }
+ else
+ {
+ re = sh - GMP_NUMB_BITS;
+ /* searching for the first bit 1 (exists since u isn't an integer) */
+ while (up[--un] == 0)
+ re -= GMP_NUMB_BITS;
+ MPFR_ASSERTN(un >= 0);
+ k = up[un];
+ count_leading_zeros(sh, k);
+ re -= sh;
+ k <<= sh;
+ }
+ /* The exponent of r will be re */
+ /* un: index of the limb of u that contains the first bit 1 of the FP */
+
+ t = (mp_size_t) (MPFR_PREC(r) - 1) / GMP_NUMB_BITS < un ?
+ (mpfr_init2 (tmp, (un + 1) * GMP_NUMB_BITS), tmp) : r;
+ /* t has enough precision to contain the fractional part of u */
+ /* If we use a temporary variable, we take the non-significant bits
+ of u into account, because of the mpn_lshift below. */
+ MPFR_SET_SAME_SIGN(t, u);
+
+ /* Put the fractional part of u into t */
+ tn = (MPFR_PREC(t) - 1) / GMP_NUMB_BITS;
+ MPFR_ASSERTN(tn >= un);
+ t0 = tn - un;
+ tp = MPFR_MANT(t);
+ if (sh == 0)
+ MPN_COPY_DECR(tp + t0, up, un + 1);
+ else /* warning: un may be 0 here */
+ tp[tn] = k | ((un) ? mpn_lshift (tp + t0, up, un, sh) : (mp_limb_t) 0);
+ if (t0 > 0)
+ MPN_ZERO(tp, t0);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ if (t != r)
+ { /* t is tmp */
+ MPFR_EXP (t) = 0; /* should be re, but not necessarily in the range */
+ inex = mpfr_set (r, t, rnd_mode); /* no underflow */
+ mpfr_clear (t);
+ MPFR_EXP (r) += re;
+ }
+ else
+ { /* There may be remaining non-significant bits in t (= r). */
+ int carry;
+
+ MPFR_EXP (r) = re;
+ carry = mpfr_round_raw (tp, tp,
+ (mpfr_prec_t) (tn + 1) * GMP_NUMB_BITS,
+ MPFR_IS_NEG (r), MPFR_PREC (r), rnd_mode,
+ &inex);
+ if (carry)
+ {
+ tp[tn] = MPFR_LIMB_HIGHBIT;
+ MPFR_EXP (r) ++;
+ }
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inex, rnd_mode);
+}
diff --git a/src/free_cache.c b/src/free_cache.c
new file mode 100644
index 0000000..990f999
--- /dev/null
+++ b/src/free_cache.c
@@ -0,0 +1,59 @@
+/* mpfr_free_cache - Free the cache used by MPFR for internal consts.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#if 0
+static void
+free_l2b (void)
+{
+ int i, b;
+
+ for (b = 2; b <= BASE_MAX; b++)
+ for (i = 0; i < 2; i++)
+ {
+ mpfr_ptr p = __gmpfr_l2b[b-2][i];
+ if (p != NULL)
+ {
+ mpfr_clear (p);
+ (*__gmp_free_func) (p, sizeof (mpfr_t));
+ }
+ }
+}
+#endif
+
+void
+mpfr_free_cache (void)
+{
+#ifndef MPFR_USE_LOGGING
+ mpfr_clear_cache (__gmpfr_cache_const_pi);
+ mpfr_clear_cache (__gmpfr_cache_const_log2);
+#else
+ mpfr_clear_cache (__gmpfr_normal_pi);
+ mpfr_clear_cache (__gmpfr_normal_log2);
+ mpfr_clear_cache (__gmpfr_logging_pi);
+ mpfr_clear_cache (__gmpfr_logging_log2);
+#endif
+ mpfr_clear_cache (__gmpfr_cache_const_euler);
+ mpfr_clear_cache (__gmpfr_cache_const_catalan);
+ /* free_l2b (); */
+}
diff --git a/src/frexp.c b/src/frexp.c
new file mode 100644
index 0000000..0aea130
--- /dev/null
+++ b/src/frexp.c
@@ -0,0 +1,56 @@
+/* mpfr_frexp -- convert to integral and fractional parts
+
+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inex;
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
+ {
+ if (MPFR_IS_NAN(x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN; /* exp is unspecified */
+ }
+ else if (MPFR_IS_INF(x))
+ {
+ MPFR_SET_INF(y);
+ MPFR_SET_SAME_SIGN(y,x);
+ MPFR_RET(0); /* exp is unspecified */
+ }
+ else
+ {
+ MPFR_SET_ZERO(y);
+ MPFR_SET_SAME_SIGN(y,x);
+ *exp = 0;
+ MPFR_RET(0);
+ }
+ }
+
+ inex = mpfr_set (y, x, rnd);
+ *exp = MPFR_GET_EXP (y);
+ MPFR_SET_EXP (y, 0);
+ return mpfr_check_range (y, inex, rnd);
+}
diff --git a/src/gamma.c b/src/gamma.c
new file mode 100644
index 0000000..dbfacec
--- /dev/null
+++ b/src/gamma.c
@@ -0,0 +1,439 @@
+/* mpfr_gamma -- gamma function
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define IS_GAMMA
+#include "lngamma.c"
+#undef IS_GAMMA
+
+/* return a sufficient precision such that 2-x is exact, assuming x < 0 */
+static mpfr_prec_t
+mpfr_gamma_2_minus_x_exact (mpfr_srcptr x)
+{
+ /* Since x < 0, 2-x = 2+y with y := -x.
+ If y < 2, a precision w >= PREC(y) + EXP(2)-EXP(y) = PREC(y) + 2 - EXP(y)
+ is enough, since no overlap occurs in 2+y, so no carry happens.
+ If y >= 2, either ULP(y) <= 2, and we need w >= PREC(y)+1 since a
+ carry can occur, or ULP(y) > 2, and we need w >= EXP(y)-1:
+ (a) if EXP(y) <= 1, w = PREC(y) + 2 - EXP(y)
+ (b) if EXP(y) > 1 and EXP(y)-PREC(y) <= 1, w = PREC(y) + 1
+ (c) if EXP(y) > 1 and EXP(y)-PREC(y) > 1, w = EXP(y) - 1 */
+ return (MPFR_GET_EXP(x) <= 1) ? MPFR_PREC(x) + 2 - MPFR_GET_EXP(x)
+ : ((MPFR_GET_EXP(x) <= MPFR_PREC(x) + 1) ? MPFR_PREC(x) + 1
+ : MPFR_GET_EXP(x) - 1);
+}
+
+/* return a sufficient precision such that 1-x is exact, assuming x < 1 */
+static mpfr_prec_t
+mpfr_gamma_1_minus_x_exact (mpfr_srcptr x)
+{
+ if (MPFR_IS_POS(x))
+ return MPFR_PREC(x) - MPFR_GET_EXP(x);
+ else if (MPFR_GET_EXP(x) <= 0)
+ return MPFR_PREC(x) + 1 - MPFR_GET_EXP(x);
+ else if (MPFR_PREC(x) >= MPFR_GET_EXP(x))
+ return MPFR_PREC(x) + 1;
+ else
+ return MPFR_GET_EXP(x);
+}
+
+/* returns a lower bound of the number of significant bits of n!
+ (not counting the low zero bits).
+ We know n! >= (n/e)^n*sqrt(2*Pi*n) for n >= 1, and the number of zero bits
+ is floor(n/2) + floor(n/4) + floor(n/8) + ...
+ This approximation is exact for n <= 500000, except for n = 219536, 235928,
+ 298981, 355854, 464848, 493725, 498992 where it returns a value 1 too small.
+*/
+static unsigned long
+bits_fac (unsigned long n)
+{
+ mpfr_t x, y;
+ unsigned long r, k;
+ mpfr_init2 (x, 38);
+ mpfr_init2 (y, 38);
+ mpfr_set_ui (x, n, MPFR_RNDZ);
+ mpfr_set_str_binary (y, "10.101101111110000101010001011000101001"); /* upper bound of e */
+ mpfr_div (x, x, y, MPFR_RNDZ);
+ mpfr_pow_ui (x, x, n, MPFR_RNDZ);
+ mpfr_const_pi (y, MPFR_RNDZ);
+ mpfr_mul_ui (y, y, 2 * n, MPFR_RNDZ);
+ mpfr_sqrt (y, y, MPFR_RNDZ);
+ mpfr_mul (x, x, y, MPFR_RNDZ);
+ mpfr_log2 (x, x, MPFR_RNDZ);
+ r = mpfr_get_ui (x, MPFR_RNDU);
+ for (k = 2; k <= n; k *= 2)
+ r -= n / k;
+ mpfr_clear (x);
+ mpfr_clear (y);
+ return r;
+}
+
+/* We use the reflection formula
+ Gamma(1+t) Gamma(1-t) = - Pi t / sin(Pi (1 + t))
+ in order to treat the case x <= 1,
+ i.e. with x = 1-t, then Gamma(x) = -Pi*(1-x)/sin(Pi*(2-x))/GAMMA(2-x)
+*/
+int
+mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xp, GammaTrial, tmp, tmp2;
+ mpz_t fact;
+ mpfr_prec_t realprec;
+ int compared, is_integer;
+ int inex = 0; /* 0 means: result gamma not set yet */
+ MPFR_GROUP_DECL (group);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("gamma[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (gamma), mpfr_log_prec, gamma, inex));
+
+ /* Trivial cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (gamma);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ if (MPFR_IS_NEG (x))
+ {
+ MPFR_SET_NAN (gamma);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_SET_INF (gamma);
+ MPFR_SET_POS (gamma);
+ MPFR_RET (0); /* exact */
+ }
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ MPFR_SET_INF(gamma);
+ MPFR_SET_SAME_SIGN(gamma, x);
+ mpfr_set_divby0 ();
+ MPFR_RET (0); /* exact */
+ }
+ }
+
+ /* Check for tiny arguments, where gamma(x) ~ 1/x - euler + ....
+ We know from "Bound on Runs of Zeros and Ones for Algebraic Functions",
+ Proceedings of Arith15, T. Lang and J.-M. Muller, 2001, that the maximal
+ number of consecutive zeroes or ones after the round bit is n-1 for an
+ input of n bits. But we need a more precise lower bound. Assume x has
+ n bits, and 1/x is near a floating-point number y of n+1 bits. We can
+ write x = X*2^e, y = Y/2^f with X, Y integers of n and n+1 bits.
+ Thus X*Y^2^(e-f) is near from 1, i.e., X*Y is near from 2^(f-e).
+ Two cases can happen:
+ (i) either X*Y is exactly 2^(f-e), but this can happen only if X and Y
+ are themselves powers of two, i.e., x is a power of two;
+ (ii) or X*Y is at distance at least one from 2^(f-e), thus
+ |xy-1| >= 2^(e-f), or |y-1/x| >= 2^(e-f)/x = 2^(-f)/X >= 2^(-f-n).
+ Since ufp(y) = 2^(n-f) [ufp = unit in first place], this means
+ that the distance |y-1/x| >= 2^(-2n) ufp(y).
+ Now assuming |gamma(x)-1/x| <= 1, which is true for x <= 1,
+ if 2^(-2n) ufp(y) >= 2, the error is at most 2^(-2n-1) ufp(y),
+ and round(1/x) with precision >= 2n+2 gives the correct result.
+ If x < 2^E, then y > 2^(-E), thus ufp(y) > 2^(-E-1).
+ A sufficient condition is thus EXP(x) + 2 <= -2 MAX(PREC(x),PREC(Y)).
+ */
+ if (MPFR_GET_EXP (x) + 2
+ <= -2 * (mpfr_exp_t) MAX(MPFR_PREC(x), MPFR_PREC(gamma)))
+ {
+ int sign = MPFR_SIGN (x); /* retrieve sign before possible override */
+ int special;
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* for overflow cases, see below; this needs to be done
+ before x possibly gets overridden. */
+ special =
+ MPFR_GET_EXP (x) == 1 - MPFR_EMAX_MAX &&
+ MPFR_IS_POS_SIGN (sign) &&
+ MPFR_IS_LIKE_RNDD (rnd_mode, sign) &&
+ mpfr_powerof2_raw (x);
+
+ MPFR_BLOCK (flags, inex = mpfr_ui_div (gamma, 1, x, rnd_mode));
+ if (inex == 0) /* x is a power of two */
+ {
+ /* return RND(1/x - euler) = RND(+/- 2^k - eps) with eps > 0 */
+ if (rnd_mode == MPFR_RNDN || MPFR_IS_LIKE_RNDU (rnd_mode, sign))
+ inex = 1;
+ else
+ {
+ mpfr_nextbelow (gamma);
+ inex = -1;
+ }
+ }
+ else if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
+ {
+ /* Overflow in the division 1/x. This is a real overflow, except
+ in RNDZ or RNDD when 1/x = 2^emax, i.e. x = 2^(-emax): due to
+ the "- euler", the rounded value in unbounded exponent range
+ is 0.111...11 * 2^emax (not an overflow). */
+ if (!special)
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, flags);
+ }
+ MPFR_SAVE_EXPO_FREE (expo);
+ /* Note: an overflow is possible with an infinite result;
+ in this case, the overflow flag will automatically be
+ restored by mpfr_check_range. */
+ return mpfr_check_range (gamma, inex, rnd_mode);
+ }
+
+ is_integer = mpfr_integer_p (x);
+ /* gamma(x) for x a negative integer gives NaN */
+ if (is_integer && MPFR_IS_NEG(x))
+ {
+ MPFR_SET_NAN (gamma);
+ MPFR_RET_NAN;
+ }
+
+ compared = mpfr_cmp_ui (x, 1);
+ if (compared == 0)
+ return mpfr_set_ui (gamma, 1, rnd_mode);
+
+ /* if x is an integer that fits into an unsigned long, use mpfr_fac_ui
+ if argument is not too large.
+ If precision is p, fac_ui costs O(u*p), whereas gamma costs O(p*M(p)),
+ so for u <= M(p), fac_ui should be faster.
+ We approximate here M(p) by p*log(p)^2, which is not a bad guess.
+ Warning: since the generic code does not handle exact cases,
+ we want all cases where gamma(x) is exact to be treated here.
+ */
+ if (is_integer && mpfr_fits_ulong_p (x, MPFR_RNDN))
+ {
+ unsigned long int u;
+ mpfr_prec_t p = MPFR_PREC(gamma);
+ u = mpfr_get_ui (x, MPFR_RNDN);
+ if (u < 44787929UL && bits_fac (u - 1) <= p + (rnd_mode == MPFR_RNDN))
+ /* bits_fac: lower bound on the number of bits of m,
+ where gamma(x) = (u-1)! = m*2^e with m odd. */
+ return mpfr_fac_ui (gamma, u - 1, rnd_mode);
+ /* if bits_fac(...) > p (resp. p+1 for rounding to nearest),
+ then gamma(x) cannot be exact in precision p (resp. p+1).
+ FIXME: remove the test u < 44787929UL after changing bits_fac
+ to return a mpz_t or mpfr_t. */
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* check for overflow: according to (6.1.37) in Abramowitz & Stegun,
+ gamma(x) >= exp(-x) * x^(x-1/2) * sqrt(2*Pi)
+ >= 2 * (x/e)^x / x for x >= 1 */
+ if (compared > 0)
+ {
+ mpfr_t yp;
+ mpfr_exp_t expxp;
+ MPFR_BLOCK_DECL (flags);
+
+ /* 1/e rounded down to 53 bits */
+#define EXPM1_STR "0.010111100010110101011000110110001011001110111100111"
+ mpfr_init2 (xp, 53);
+ mpfr_init2 (yp, 53);
+ mpfr_set_str_binary (xp, EXPM1_STR);
+ mpfr_mul (xp, x, xp, MPFR_RNDZ);
+ mpfr_sub_ui (yp, x, 2, MPFR_RNDZ);
+ mpfr_pow (xp, xp, yp, MPFR_RNDZ); /* (x/e)^(x-2) */
+ mpfr_set_str_binary (yp, EXPM1_STR);
+ mpfr_mul (xp, xp, yp, MPFR_RNDZ); /* x^(x-2) / e^(x-1) */
+ mpfr_mul (xp, xp, yp, MPFR_RNDZ); /* x^(x-2) / e^x */
+ mpfr_mul (xp, xp, x, MPFR_RNDZ); /* lower bound on x^(x-1) / e^x */
+ MPFR_BLOCK (flags, mpfr_mul_2ui (xp, xp, 1, MPFR_RNDZ));
+ expxp = MPFR_GET_EXP (xp);
+ mpfr_clear (xp);
+ mpfr_clear (yp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return MPFR_OVERFLOW (flags) || expxp > __gmpfr_emax ?
+ mpfr_overflow (gamma, rnd_mode, 1) :
+ mpfr_gamma_aux (gamma, x, rnd_mode);
+ }
+
+ /* now compared < 0 */
+
+ /* check for underflow: for x < 1,
+ gamma(x) = Pi*(x-1)/sin(Pi*(2-x))/gamma(2-x).
+ Since gamma(2-x) >= 2 * ((2-x)/e)^(2-x) / (2-x), we have
+ |gamma(x)| <= Pi*(1-x)*(2-x)/2/((2-x)/e)^(2-x) / |sin(Pi*(2-x))|
+ <= 12 * ((2-x)/e)^x / |sin(Pi*(2-x))|.
+ To avoid an underflow in ((2-x)/e)^x, we compute the logarithm.
+ */
+ if (MPFR_IS_NEG(x))
+ {
+ int underflow = 0, sgn, ck;
+ mpfr_prec_t w;
+
+ mpfr_init2 (xp, 53);
+ mpfr_init2 (tmp, 53);
+ mpfr_init2 (tmp2, 53);
+ /* we want an upper bound for x * [log(2-x)-1].
+ since x < 0, we need a lower bound on log(2-x) */
+ mpfr_ui_sub (xp, 2, x, MPFR_RNDD);
+ mpfr_log (xp, xp, MPFR_RNDD);
+ mpfr_sub_ui (xp, xp, 1, MPFR_RNDD);
+ mpfr_mul (xp, xp, x, MPFR_RNDU);
+
+ /* we need an upper bound on 1/|sin(Pi*(2-x))|,
+ thus a lower bound on |sin(Pi*(2-x))|.
+ If 2-x is exact, then the error of Pi*(2-x) is (1+u)^2 with u = 2^(-p)
+ thus the error on sin(Pi*(2-x)) is less than 1/2ulp + 3Pi(2-x)u,
+ assuming u <= 1, thus <= u + 3Pi(2-x)u */
+
+ w = mpfr_gamma_2_minus_x_exact (x); /* 2-x is exact for prec >= w */
+ w += 17; /* to get tmp2 small enough */
+ mpfr_set_prec (tmp, w);
+ mpfr_set_prec (tmp2, w);
+ ck = mpfr_ui_sub (tmp, 2, x, MPFR_RNDN);
+ MPFR_ASSERTD (ck == 0); (void) ck; /* use ck to avoid a warning */
+ mpfr_const_pi (tmp2, MPFR_RNDN);
+ mpfr_mul (tmp2, tmp2, tmp, MPFR_RNDN); /* Pi*(2-x) */
+ mpfr_sin (tmp, tmp2, MPFR_RNDN); /* sin(Pi*(2-x)) */
+ sgn = mpfr_sgn (tmp);
+ mpfr_abs (tmp, tmp, MPFR_RNDN);
+ mpfr_mul_ui (tmp2, tmp2, 3, MPFR_RNDU); /* 3Pi(2-x) */
+ mpfr_add_ui (tmp2, tmp2, 1, MPFR_RNDU); /* 3Pi(2-x)+1 */
+ mpfr_div_2ui (tmp2, tmp2, mpfr_get_prec (tmp), MPFR_RNDU);
+ /* if tmp2<|tmp|, we get a lower bound */
+ if (mpfr_cmp (tmp2, tmp) < 0)
+ {
+ mpfr_sub (tmp, tmp, tmp2, MPFR_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
+ mpfr_ui_div (tmp, 12, tmp, MPFR_RNDU); /* upper bound */
+ mpfr_log2 (tmp, tmp, MPFR_RNDU);
+ mpfr_add (xp, tmp, xp, MPFR_RNDU);
+ /* The assert below checks that expo.saved_emin - 2 always
+ fits in a long. FIXME if we want to allow mpfr_exp_t to
+ be a long long, for instance. */
+ MPFR_ASSERTN (MPFR_EMIN_MIN - 2 >= LONG_MIN);
+ underflow = mpfr_cmp_si (xp, expo.saved_emin - 2) <= 0;
+ }
+
+ mpfr_clear (xp);
+ mpfr_clear (tmp);
+ mpfr_clear (tmp2);
+ if (underflow) /* the sign is the opposite of that of sin(Pi*(2-x)) */
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (gamma, (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode, -sgn);
+ }
+ }
+
+ realprec = MPFR_PREC (gamma);
+ /* we want both 1-x and 2-x to be exact */
+ {
+ mpfr_prec_t w;
+ w = mpfr_gamma_1_minus_x_exact (x);
+ if (realprec < w)
+ realprec = w;
+ w = mpfr_gamma_2_minus_x_exact (x);
+ if (realprec < w)
+ realprec = w;
+ }
+ realprec = realprec + MPFR_INT_CEIL_LOG2 (realprec) + 20;
+ MPFR_ASSERTD(realprec >= 5);
+
+ MPFR_GROUP_INIT_4 (group, realprec + MPFR_INT_CEIL_LOG2 (realprec) + 20,
+ xp, tmp, tmp2, GammaTrial);
+ mpz_init (fact);
+ MPFR_ZIV_INIT (loop, realprec);
+ for (;;)
+ {
+ mpfr_exp_t err_g;
+ int ck;
+ MPFR_GROUP_REPREC_4 (group, realprec, xp, tmp, tmp2, GammaTrial);
+
+ /* reflection formula: gamma(x) = Pi*(x-1)/sin(Pi*(2-x))/gamma(2-x) */
+
+ ck = mpfr_ui_sub (xp, 2, x, MPFR_RNDN); /* 2-x, exact */
+ MPFR_ASSERTD(ck == 0); (void) ck; /* use ck to avoid a warning */
+ mpfr_gamma (tmp, xp, MPFR_RNDN); /* gamma(2-x), error (1+u) */
+ mpfr_const_pi (tmp2, MPFR_RNDN); /* Pi, error (1+u) */
+ mpfr_mul (GammaTrial, tmp2, xp, MPFR_RNDN); /* Pi*(2-x), error (1+u)^2 */
+ err_g = MPFR_GET_EXP(GammaTrial);
+ mpfr_sin (GammaTrial, GammaTrial, MPFR_RNDN); /* sin(Pi*(2-x)) */
+ /* If tmp is +Inf, we compute exp(lngamma(x)). */
+ if (mpfr_inf_p (tmp))
+ {
+ inex = mpfr_explgamma (gamma, x, &expo, tmp, tmp2, rnd_mode);
+ if (inex)
+ goto end;
+ else
+ goto ziv_next;
+ }
+ err_g = err_g + 1 - MPFR_GET_EXP(GammaTrial);
+ /* let g0 the true value of Pi*(2-x), g the computed value.
+ We have g = g0 + h with |h| <= |(1+u^2)-1|*g.
+ Thus sin(g) = sin(g0) + h' with |h'| <= |(1+u^2)-1|*g.
+ The relative error is thus bounded by |(1+u^2)-1|*g/sin(g)
+ <= |(1+u^2)-1|*2^err_g. <= 2.25*u*2^err_g for |u|<=1/4.
+ With the rounding error, this gives (0.5 + 2.25*2^err_g)*u. */
+ ck = mpfr_sub_ui (xp, x, 1, MPFR_RNDN); /* x-1, exact */
+ MPFR_ASSERTD(ck == 0); (void) ck; /* use ck to avoid a warning */
+ mpfr_mul (xp, tmp2, xp, MPFR_RNDN); /* Pi*(x-1), error (1+u)^2 */
+ mpfr_mul (GammaTrial, GammaTrial, tmp, MPFR_RNDN);
+ /* [1 + (0.5 + 2.25*2^err_g)*u]*(1+u)^2 = 1 + (2.5 + 2.25*2^err_g)*u
+ + (0.5 + 2.25*2^err_g)*u*(2u+u^2) + u^2.
+ For err_g <= realprec-2, we have (0.5 + 2.25*2^err_g)*u <=
+ 0.5*u + 2.25/4 <= 0.6875 and u^2 <= u/4, thus
+ (0.5 + 2.25*2^err_g)*u*(2u+u^2) + u^2 <= 0.6875*(2u+u/4) + u/4
+ <= 1.8*u, thus the rel. error is bounded by (4.5 + 2.25*2^err_g)*u. */
+ mpfr_div (GammaTrial, xp, GammaTrial, MPFR_RNDN);
+ /* the error is of the form (1+u)^3/[1 + (4.5 + 2.25*2^err_g)*u].
+ For realprec >= 5 and err_g <= realprec-2, [(4.5 + 2.25*2^err_g)*u]^2
+ <= 0.71, and for |y|<=0.71, 1/(1-y) can be written 1+a*y with a<=4.
+ (1+u)^3 * (1+4*(4.5 + 2.25*2^err_g)*u)
+ = 1 + (21 + 9*2^err_g)*u + (57+27*2^err_g)*u^2 + (55+27*2^err_g)*u^3
+ + (18+9*2^err_g)*u^4
+ <= 1 + (21 + 9*2^err_g)*u + (57+27*2^err_g)*u^2 + (56+28*2^err_g)*u^3
+ <= 1 + (21 + 9*2^err_g)*u + (59+28*2^err_g)*u^2
+ <= 1 + (23 + 10*2^err_g)*u.
+ The final error is thus bounded by (23 + 10*2^err_g) ulps,
+ which is <= 2^6 for err_g<=2, and <= 2^(err_g+4) for err_g >= 2. */
+ err_g = (err_g <= 2) ? 6 : err_g + 4;
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (GammaTrial, realprec - err_g,
+ MPFR_PREC(gamma), rnd_mode)))
+ break;
+
+ ziv_next:
+ MPFR_ZIV_NEXT (loop, realprec);
+ }
+
+ end:
+ MPFR_ZIV_FREE (loop);
+
+ if (inex == 0)
+ inex = mpfr_set (gamma, GammaTrial, rnd_mode);
+ MPFR_GROUP_CLEAR (group);
+ mpz_clear (fact);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (gamma, inex, rnd_mode);
+}
diff --git a/src/gammaonethird.c b/src/gammaonethird.c
new file mode 100644
index 0000000..93fda9c
--- /dev/null
+++ b/src/gammaonethird.c
@@ -0,0 +1,191 @@
+/* Functions for evaluating Gamma(1/3) and Gamma(2/3). Used by mpfr_ai.
+
+Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define MPFR_ACC_OR_MUL(v) \
+ do \
+ { \
+ if (v <= ULONG_MAX / acc) \
+ acc *= v; \
+ else \
+ { \
+ mpfr_mul_ui (y, y, acc, mode); acc = v; \
+ } \
+ } \
+ while (0)
+
+#define MPFR_ACC_OR_DIV(v) \
+ do \
+ { \
+ if (v <= ULONG_MAX / acc) \
+ acc *= v; \
+ else \
+ { \
+ mpfr_div_ui (y, y, acc, mode); acc = v; \
+ } \
+ } \
+ while (0)
+
+static void
+mpfr_mul_ui5 (mpfr_ptr y, mpfr_srcptr x,
+ unsigned long int v1, unsigned long int v2,
+ unsigned long int v3, unsigned long int v4,
+ unsigned long int v5, mpfr_rnd_t mode)
+{
+ unsigned long int acc = v1;
+ mpfr_set (y, x, mode);
+ MPFR_ACC_OR_MUL (v2);
+ MPFR_ACC_OR_MUL (v3);
+ MPFR_ACC_OR_MUL (v4);
+ MPFR_ACC_OR_MUL (v5);
+ mpfr_mul_ui (y, y, acc, mode);
+}
+
+void
+mpfr_div_ui2 (mpfr_ptr y, mpfr_srcptr x,
+ unsigned long int v1, unsigned long int v2, mpfr_rnd_t mode)
+{
+ unsigned long int acc = v1;
+ mpfr_set (y, x, mode);
+ MPFR_ACC_OR_DIV (v2);
+ mpfr_div_ui (y, y, acc, mode);
+}
+
+static void
+mpfr_div_ui8 (mpfr_ptr y, mpfr_srcptr x,
+ unsigned long int v1, unsigned long int v2,
+ unsigned long int v3, unsigned long int v4,
+ unsigned long int v5, unsigned long int v6,
+ unsigned long int v7, unsigned long int v8, mpfr_rnd_t mode)
+{
+ unsigned long int acc = v1;
+ mpfr_set (y, x, mode);
+ MPFR_ACC_OR_DIV (v2);
+ MPFR_ACC_OR_DIV (v3);
+ MPFR_ACC_OR_DIV (v4);
+ MPFR_ACC_OR_DIV (v5);
+ MPFR_ACC_OR_DIV (v6);
+ MPFR_ACC_OR_DIV (v7);
+ MPFR_ACC_OR_DIV (v8);
+ mpfr_div_ui (y, y, acc, mode);
+}
+
+
+/* Gives an approximation of omega = Gamma(1/3)^6 * sqrt(10) / (12pi^4) */
+/* using C. H. Brown's formula. */
+/* The computed value s satisfies |s-omega| <= 2^{1-prec}*omega */
+/* As usual, the variable s is supposed to be initialized. */
+static void
+mpfr_Browns_const (mpfr_ptr s, mpfr_prec_t prec)
+{
+ mpfr_t uk;
+ unsigned long int k;
+
+ mpfr_prec_t working_prec = prec + 10 + MPFR_INT_CEIL_LOG2 (2 + prec / 10);
+
+ mpfr_init2 (uk, working_prec);
+ mpfr_set_prec (s, working_prec);
+
+ mpfr_set_ui (uk, 1, MPFR_RNDN);
+ mpfr_set (s, uk, MPFR_RNDN);
+ k = 1;
+
+ /* Invariants: uk ~ u(k-1) and s ~ sum(i=0..k-1, u(i)) */
+ for (;;)
+ {
+ mpfr_mul_ui5 (uk, uk, 6 * k - 5, 6 * k - 4, 6 * k - 3, 6 * k - 2,
+ 6 * k - 1, MPFR_RNDN);
+ mpfr_div_ui8 (uk, uk, k, k, 3 * k - 2, 3 * k - 1, 3 * k, 80, 160, 160,
+ MPFR_RNDN);
+ MPFR_CHANGE_SIGN (uk);
+
+ mpfr_add (s, s, uk, MPFR_RNDN);
+ k++;
+ if (MPFR_GET_EXP (uk) + prec <= MPFR_GET_EXP (s) + 7)
+ break;
+ }
+
+ mpfr_clear (uk);
+ return;
+}
+
+/* Returns y such that |Gamma(1/3)-y| <= 2^{1-prec}*Gamma(1/3) */
+static void
+mpfr_gamma_one_third (mpfr_ptr y, mpfr_prec_t prec)
+{
+ mpfr_t tmp, tmp2, tmp3;
+
+ mpfr_init2 (tmp, prec + 9);
+ mpfr_init2 (tmp2, prec + 9);
+ mpfr_init2 (tmp3, prec + 4);
+ mpfr_set_prec (y, prec + 2);
+
+ mpfr_const_pi (tmp, MPFR_RNDN);
+ mpfr_sqr (tmp, tmp, MPFR_RNDN);
+ mpfr_sqr (tmp, tmp, MPFR_RNDN);
+ mpfr_mul_ui (tmp, tmp, 12, MPFR_RNDN);
+
+ mpfr_Browns_const (tmp2, prec + 9);
+ mpfr_mul (tmp, tmp, tmp2, MPFR_RNDN);
+
+ mpfr_set_ui (tmp2, 10, MPFR_RNDN);
+ mpfr_sqrt (tmp2, tmp2, MPFR_RNDN);
+ mpfr_div (tmp, tmp, tmp2, MPFR_RNDN);
+
+ mpfr_sqrt (tmp3, tmp, MPFR_RNDN);
+ mpfr_cbrt (y, tmp3, MPFR_RNDN);
+
+ mpfr_clear (tmp);
+ mpfr_clear (tmp2);
+ mpfr_clear (tmp3);
+ return;
+}
+
+/* Computes y1 and y2 such that: */
+/* |y1-Gamma(1/3)| <= 2^{1-prec}Gamma(1/3) */
+/* and |y2-Gamma(2/3)| <= 2^{1-prec}Gamma(2/3) */
+/* */
+/* Uses the formula Gamma(z)Gamma(1-z) = pi / sin(pi*z) */
+/* to compute Gamma(2/3) from Gamma(1/3). */
+void
+mpfr_gamma_one_and_two_third (mpfr_ptr y1, mpfr_ptr y2, mpfr_prec_t prec)
+{
+ mpfr_t temp;
+
+ mpfr_init2 (temp, prec + 4);
+ mpfr_set_prec (y2, prec + 4);
+
+ mpfr_gamma_one_third (y1, prec + 4);
+
+ mpfr_set_ui (temp, 3, MPFR_RNDN);
+ mpfr_sqrt (temp, temp, MPFR_RNDN);
+ mpfr_mul (temp, y1, temp, MPFR_RNDN);
+
+ mpfr_const_pi (y2, MPFR_RNDN);
+ mpfr_mul_2ui (y2, y2, 1, MPFR_RNDN);
+
+ mpfr_div (y2, y2, temp, MPFR_RNDN);
+
+ mpfr_clear (temp);
+}
diff --git a/src/gen_inverse.h b/src/gen_inverse.h
new file mode 100644
index 0000000..49f8ed0
--- /dev/null
+++ b/src/gen_inverse.h
@@ -0,0 +1,106 @@
+/* generic inverse of a function.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#ifndef ACTION_SPECIAL
+#define ACTION_SPECIAL
+#endif
+
+#ifndef ACTION_TINY
+#define ACTION_TINY
+#endif
+
+/* example of use:
+#define FUNCTION mpfr_sec
+#define INVERSE mpfr_cos
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_ZERO(y) return mpfr_set_ui (y, 1, MPFR_RNDN)
+#include "gen_inverse.h"
+*/
+
+int
+FUNCTION (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t precy; /* target precision */
+ mpfr_prec_t m; /* working precision */
+ mpfr_t z; /* temporary variable to store INVERSE(x) */
+ int inexact; /* inexact flag */
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
+ {
+ if (MPFR_IS_NAN(x))
+ ACTION_NAN(y);
+ else if (MPFR_IS_INF(x))
+ ACTION_INF(y);
+ else /* x = 0 */
+ ACTION_ZERO(y,x);
+ }
+
+ /* x is neither NaN, Inf nor zero */
+ MPFR_SAVE_EXPO_MARK (expo);
+ ACTION_TINY (y, x, rnd_mode); /* special case for very small input x */
+ precy = MPFR_PREC(y);
+ m = precy + MPFR_INT_CEIL_LOG2 (precy) + 3;
+ mpfr_init2 (z, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for(;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_BLOCK (flags, INVERSE (z, x, MPFR_RNDZ)); /* error k_u < 1 ulp */
+ /* FIXME: the following assumes that if an overflow happens with
+ MPFR_EMAX_MAX, then necessarily an underflow happens with
+ __gmpfr_emin */
+ if (MPFR_OVERFLOW (flags))
+ {
+ int s = MPFR_SIGN(z);
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (z);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ?
+ MPFR_RNDZ : rnd_mode, s);
+ }
+ mpfr_ui_div (z, 1, z, MPFR_RNDN);
+ /* the error is less than c_w + 2*c_u*k_u (see algorithms.tex),
+ where c_w = 1/2, c_u = 1 since z was rounded toward zero,
+ thus 1/2 + 2 < 4 */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (z, m - 2, precy, rnd_mode)))
+ break;
+ ACTION_SPECIAL;
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (z, m);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, z, rnd_mode);
+ mpfr_clear (z);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/generic/mparam.h b/src/generic/mparam.h
new file mode 100644
index 0000000..c0ff603
--- /dev/null
+++ b/src/generic/mparam.h
@@ -0,0 +1,69 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef MPFR_MULHIGH_TAB
+# define MPFR_MULHIGH_TAB -1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0
+#endif
+
+#ifndef MPFR_SQRHIGH_TAB
+# define MPFR_SQRHIGH_TAB -1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0
+#endif
+
+#ifndef MPFR_DIVHIGH_TAB
+# define MPFR_DIVHIGH_TAB 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
+#endif
+
+#ifndef MPFR_MUL_THRESHOLD
+# define MPFR_MUL_THRESHOLD 20 /* limbs */
+#endif
+
+#ifndef MPFR_SQR_THRESHOLD
+# define MPFR_SQR_THRESHOLD 20 /* limbs */
+#endif
+
+#ifndef MPFR_DIV_THRESHOLD
+# define MPFR_DIV_THRESHOLD 25 /* limbs */
+#endif
+
+#ifndef MPFR_EXP_2_THRESHOLD
+# define MPFR_EXP_2_THRESHOLD 100 /* bits */
+#endif
+
+#ifndef MPFR_EXP_THRESHOLD
+# define MPFR_EXP_THRESHOLD 25000 /* bits */
+#endif
+
+#ifndef MPFR_SINCOS_THRESHOLD
+# define MPFR_SINCOS_THRESHOLD 30000 /* bits */
+#endif
+
+#ifndef MPFR_AI_THRESHOLD1
+# define MPFR_AI_THRESHOLD1 -13107 /* threshold for negative input of mpfr_ai */
+#endif
+
+#ifndef MPFR_AI_THRESHOLD2
+# define MPFR_AI_THRESHOLD2 1311
+#endif
+
+#ifndef MPFR_AI_THRESHOLD3
+# define MPFR_AI_THRESHOLD3 19661
+#endif
+
diff --git a/src/get_d.c b/src/get_d.c
new file mode 100644
index 0000000..307148a
--- /dev/null
+++ b/src/get_d.c
@@ -0,0 +1,183 @@
+/* mpfr_get_d, mpfr_get_d_2exp -- convert a multiple precision floating-point
+ number to a machine double precision float
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h>
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#include "ieee_floats.h"
+
+/* Assumes IEEE-754 double precision; otherwise, only an approximated
+ result will be returned, without any guaranty (and special cases
+ such as NaN must be avoided if not supported). */
+
+double
+mpfr_get_d (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
+{
+ double d;
+ int negative;
+ mpfr_exp_t e;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
+ {
+ if (MPFR_IS_NAN (src))
+ return MPFR_DBL_NAN;
+
+ negative = MPFR_IS_NEG (src);
+
+ if (MPFR_IS_INF (src))
+ return negative ? MPFR_DBL_INFM : MPFR_DBL_INFP;
+
+ MPFR_ASSERTD (MPFR_IS_ZERO(src));
+ return negative ? DBL_NEG_ZERO : 0.0;
+ }
+
+ e = MPFR_GET_EXP (src);
+ negative = MPFR_IS_NEG (src);
+
+ if (MPFR_UNLIKELY(rnd_mode == MPFR_RNDA))
+ rnd_mode = negative ? MPFR_RNDD : MPFR_RNDU;
+
+ /* the smallest normalized number is 2^(-1022)=0.1e-1021, and the smallest
+ subnormal is 2^(-1074)=0.1e-1073 */
+ if (MPFR_UNLIKELY (e < -1073))
+ {
+ /* Note: Avoid using a constant expression DBL_MIN * DBL_EPSILON
+ as this gives 0 instead of the correct result with gcc on some
+ Alpha machines. */
+ d = negative ?
+ (rnd_mode == MPFR_RNDD ||
+ (rnd_mode == MPFR_RNDN && mpfr_cmp_si_2exp(src, -1, -1075) < 0)
+ ? -DBL_MIN : DBL_NEG_ZERO) :
+ (rnd_mode == MPFR_RNDU ||
+ (rnd_mode == MPFR_RNDN && mpfr_cmp_si_2exp(src, 1, -1075) > 0)
+ ? DBL_MIN : 0.0);
+ if (d != 0.0) /* we multiply DBL_MIN = 2^(-1022) by DBL_EPSILON = 2^(-52)
+ to get +-2^(-1074) */
+ d *= DBL_EPSILON;
+ }
+ /* the largest normalized number is 2^1024*(1-2^(-53))=0.111...111e1024 */
+ else if (MPFR_UNLIKELY (e > 1024))
+ {
+ d = negative ?
+ (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDU ?
+ -DBL_MAX : MPFR_DBL_INFM) :
+ (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDD ?
+ DBL_MAX : MPFR_DBL_INFP);
+ }
+ else
+ {
+ int nbits;
+ mp_size_t np, i;
+ mp_limb_t tp[ MPFR_LIMBS_PER_DOUBLE ];
+ int carry;
+
+ nbits = IEEE_DBL_MANT_DIG; /* 53 */
+ if (MPFR_UNLIKELY (e < -1021))
+ /*In the subnormal case, compute the exact number of significant bits*/
+ {
+ nbits += (1021 + e);
+ MPFR_ASSERTD (nbits >= 1);
+ }
+ np = MPFR_PREC2LIMBS (nbits);
+ MPFR_ASSERTD ( np <= MPFR_LIMBS_PER_DOUBLE );
+ carry = mpfr_round_raw_4 (tp, MPFR_MANT(src), MPFR_PREC(src), negative,
+ nbits, rnd_mode);
+ if (MPFR_UNLIKELY(carry))
+ d = 1.0;
+ else
+ {
+ /* The following computations are exact thanks to the previous
+ mpfr_round_raw. */
+ d = (double) tp[0] / MP_BASE_AS_DOUBLE;
+ for (i = 1 ; i < np ; i++)
+ d = (d + tp[i]) / MP_BASE_AS_DOUBLE;
+ /* d is the mantissa (between 1/2 and 1) of the argument rounded
+ to 53 bits */
+ }
+ d = mpfr_scale2 (d, e);
+ if (negative)
+ d = -d;
+ }
+
+ return d;
+}
+
+#undef mpfr_get_d1
+double
+mpfr_get_d1 (mpfr_srcptr src)
+{
+ return mpfr_get_d (src, __gmpfr_default_rounding_mode);
+}
+
+double
+mpfr_get_d_2exp (long *expptr, mpfr_srcptr src, mpfr_rnd_t rnd_mode)
+{
+ double ret;
+ mpfr_exp_t exp;
+ mpfr_t tmp;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
+ {
+ int negative;
+ *expptr = 0;
+ if (MPFR_IS_NAN (src))
+ return MPFR_DBL_NAN;
+ negative = MPFR_IS_NEG (src);
+ if (MPFR_IS_INF (src))
+ return negative ? MPFR_DBL_INFM : MPFR_DBL_INFP;
+ MPFR_ASSERTD (MPFR_IS_ZERO(src));
+ return negative ? DBL_NEG_ZERO : 0.0;
+ }
+
+ tmp[0] = *src; /* Hack copy mpfr_t */
+ MPFR_SET_EXP (tmp, 0);
+ ret = mpfr_get_d (tmp, rnd_mode);
+
+ if (MPFR_IS_PURE_FP(src))
+ {
+ exp = MPFR_GET_EXP (src);
+
+ /* rounding can give 1.0, adjust back to 0.5 <= abs(ret) < 1.0 */
+ if (ret == 1.0)
+ {
+ ret = 0.5;
+ exp++;
+ }
+ else if (ret == -1.0)
+ {
+ ret = -0.5;
+ exp++;
+ }
+
+ MPFR_ASSERTN ((ret >= 0.5 && ret < 1.0)
+ || (ret <= -0.5 && ret > -1.0));
+ MPFR_ASSERTN (exp >= LONG_MIN && exp <= LONG_MAX);
+ }
+ else
+ exp = 0;
+
+ *expptr = exp;
+ return ret;
+}
diff --git a/src/get_d64.c b/src/get_d64.c
new file mode 100644
index 0000000..ec4d8e8
--- /dev/null
+++ b/src/get_d64.c
@@ -0,0 +1,400 @@
+/* mpfr_get_decimal64 -- convert a multiple precision floating-point number
+ to a IEEE 754r decimal64 float
+
+See http://gcc.gnu.org/ml/gcc/2006-06/msg00691.html,
+http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html,
+and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
+
+Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h> /* for strtol */
+#include "mpfr-impl.h"
+
+#define ISDIGIT(c) ('0' <= c && c <= '9')
+
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+
+#ifndef DEC64_MAX
+# define DEC64_MAX 9.999999999999999E384dd
+#endif
+
+#ifdef DPD_FORMAT
+static int T[1000] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88,
+ 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116,
+ 117, 118, 119, 120, 121, 10, 11, 42, 43, 74, 75, 106, 107, 78, 79, 26, 27,
+ 58, 59, 90, 91, 122, 123, 94, 95, 128, 129, 130, 131, 132, 133, 134, 135,
+ 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 160, 161, 162,
+ 163, 164, 165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 182, 183,
+ 184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208, 209, 210,
+ 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 230, 231,
+ 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 138, 139, 170,
+ 171, 202, 203, 234, 235, 206, 207, 154, 155, 186, 187, 218, 219, 250, 251,
+ 222, 223, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 288, 289, 290, 291, 292, 293, 294, 295,
+ 296, 297, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 320, 321, 322,
+ 323, 324, 325, 326, 327, 328, 329, 336, 337, 338, 339, 340, 341, 342, 343,
+ 344, 345, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 368, 369, 370,
+ 371, 372, 373, 374, 375, 376, 377, 266, 267, 298, 299, 330, 331, 362, 363,
+ 334, 335, 282, 283, 314, 315, 346, 347, 378, 379, 350, 351, 384, 385, 386,
+ 387, 388, 389, 390, 391, 392, 393, 400, 401, 402, 403, 404, 405, 406, 407,
+ 408, 409, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 432, 433, 434,
+ 435, 436, 437, 438, 439, 440, 441, 448, 449, 450, 451, 452, 453, 454, 455,
+ 456, 457, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 480, 481, 482,
+ 483, 484, 485, 486, 487, 488, 489, 496, 497, 498, 499, 500, 501, 502, 503,
+ 504, 505, 394, 395, 426, 427, 458, 459, 490, 491, 462, 463, 410, 411, 442,
+ 443, 474, 475, 506, 507, 478, 479, 512, 513, 514, 515, 516, 517, 518, 519,
+ 520, 521, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 544, 545, 546,
+ 547, 548, 549, 550, 551, 552, 553, 560, 561, 562, 563, 564, 565, 566, 567,
+ 568, 569, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 592, 593, 594,
+ 595, 596, 597, 598, 599, 600, 601, 608, 609, 610, 611, 612, 613, 614, 615,
+ 616, 617, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 522, 523, 554,
+ 555, 586, 587, 618, 619, 590, 591, 538, 539, 570, 571, 602, 603, 634, 635,
+ 606, 607, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 656, 657, 658,
+ 659, 660, 661, 662, 663, 664, 665, 672, 673, 674, 675, 676, 677, 678, 679,
+ 680, 681, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 704, 705, 706,
+ 707, 708, 709, 710, 711, 712, 713, 720, 721, 722, 723, 724, 725, 726, 727,
+ 728, 729, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 752, 753, 754,
+ 755, 756, 757, 758, 759, 760, 761, 650, 651, 682, 683, 714, 715, 746, 747,
+ 718, 719, 666, 667, 698, 699, 730, 731, 762, 763, 734, 735, 768, 769, 770,
+ 771, 772, 773, 774, 775, 776, 777, 784, 785, 786, 787, 788, 789, 790, 791,
+ 792, 793, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 816, 817, 818,
+ 819, 820, 821, 822, 823, 824, 825, 832, 833, 834, 835, 836, 837, 838, 839,
+ 840, 841, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 864, 865, 866,
+ 867, 868, 869, 870, 871, 872, 873, 880, 881, 882, 883, 884, 885, 886, 887,
+ 888, 889, 778, 779, 810, 811, 842, 843, 874, 875, 846, 847, 794, 795, 826,
+ 827, 858, 859, 890, 891, 862, 863, 896, 897, 898, 899, 900, 901, 902, 903,
+ 904, 905, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 928, 929, 930,
+ 931, 932, 933, 934, 935, 936, 937, 944, 945, 946, 947, 948, 949, 950, 951,
+ 952, 953, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 976, 977, 978,
+ 979, 980, 981, 982, 983, 984, 985, 992, 993, 994, 995, 996, 997, 998, 999,
+ 1000, 1001, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 906,
+ 907, 938, 939, 970, 971, 1002, 1003, 974, 975, 922, 923, 954, 955, 986,
+ 987, 1018, 1019, 990, 991, 12, 13, 268, 269, 524, 525, 780, 781, 46, 47, 28,
+ 29, 284, 285, 540, 541, 796, 797, 62, 63, 44, 45, 300, 301, 556, 557, 812,
+ 813, 302, 303, 60, 61, 316, 317, 572, 573, 828, 829, 318, 319, 76, 77,
+ 332, 333, 588, 589, 844, 845, 558, 559, 92, 93, 348, 349, 604, 605, 860,
+ 861, 574, 575, 108, 109, 364, 365, 620, 621, 876, 877, 814, 815, 124, 125,
+ 380, 381, 636, 637, 892, 893, 830, 831, 14, 15, 270, 271, 526, 527, 782,
+ 783, 110, 111, 30, 31, 286, 287, 542, 543, 798, 799, 126, 127, 140, 141,
+ 396, 397, 652, 653, 908, 909, 174, 175, 156, 157, 412, 413, 668, 669, 924,
+ 925, 190, 191, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 188, 189,
+ 444, 445, 700, 701, 956, 957, 446, 447, 204, 205, 460, 461, 716, 717, 972,
+ 973, 686, 687, 220, 221, 476, 477, 732, 733, 988, 989, 702, 703, 236, 237,
+ 492, 493, 748, 749, 1004, 1005, 942, 943, 252, 253, 508, 509, 764, 765,
+ 1020, 1021, 958, 959, 142, 143, 398, 399, 654, 655, 910, 911, 238, 239, 158,
+ 159, 414, 415, 670, 671, 926, 927, 254, 255};
+#endif
+
+/* construct a decimal64 NaN */
+static _Decimal64
+get_decimal64_nan (void)
+{
+ union ieee_double_extract x;
+ union ieee_double_decimal64 y;
+
+ x.s.exp = 1984; /* G[0]..G[4] = 11111: quiet NaN */
+ y.d = x.d;
+ return y.d64;
+}
+
+/* construct the decimal64 Inf with given sign */
+static _Decimal64
+get_decimal64_inf (int negative)
+{
+ union ieee_double_extract x;
+ union ieee_double_decimal64 y;
+
+ x.s.sig = (negative) ? 1 : 0;
+ x.s.exp = 1920; /* G[0]..G[4] = 11110: Inf */
+ y.d = x.d;
+ return y.d64;
+}
+
+/* construct the decimal64 zero with given sign */
+static _Decimal64
+get_decimal64_zero (int negative)
+{
+ union ieee_double_decimal64 y;
+
+ /* zero has the same representation in binary64 and decimal64 */
+ y.d = negative ? DBL_NEG_ZERO : 0.0;
+ return y.d64;
+}
+
+/* construct the decimal64 smallest non-zero with given sign */
+static _Decimal64
+get_decimal64_min (int negative)
+{
+ return negative ? - 1E-398dd : 1E-398dd;
+}
+
+/* construct the decimal64 largest finite number with given sign */
+static _Decimal64
+get_decimal64_max (int negative)
+{
+ return negative ? - DEC64_MAX : DEC64_MAX;
+}
+
+/* one-to-one conversion:
+ s is a decimal string representing a number x = m * 10^e which must be
+ exactly representable in the decimal64 format, i.e.
+ (a) the mantissa m has at most 16 decimal digits
+ (b1) -383 <= e <= 384 with m integer multiple of 10^(-15), |m| < 10
+ (b2) or -398 <= e <= 369 with m integer, |m| < 10^16.
+ Assumes s is neither NaN nor +Inf nor -Inf.
+*/
+static _Decimal64
+string_to_Decimal64 (char *s)
+{
+ long int exp = 0;
+ char m[17];
+ long n = 0; /* mantissa length */
+ char *endptr[1];
+ union ieee_double_extract x;
+ union ieee_double_decimal64 y;
+#ifdef DPD_FORMAT
+ unsigned int G, d1, d2, d3, d4, d5;
+#endif
+
+ /* read sign */
+ if (*s == '-')
+ {
+ x.s.sig = 1;
+ s ++;
+ }
+ else
+ x.s.sig = 0;
+ /* read mantissa */
+ while (ISDIGIT (*s))
+ m[n++] = *s++;
+ exp = n;
+ if (*s == '.')
+ {
+ s ++;
+ while (ISDIGIT (*s))
+ m[n++] = *s++;
+ }
+ /* we have exp digits before decimal point, and a total of n digits */
+ exp -= n; /* we will consider an integer mantissa */
+ MPFR_ASSERTN(n <= 16);
+ if (*s == 'E' || *s == 'e')
+ exp += strtol (s + 1, endptr, 10);
+ else
+ *endptr = s;
+ MPFR_ASSERTN(**endptr == '\0');
+ MPFR_ASSERTN(-398 <= exp && exp <= (long) (385 - n));
+ while (n < 16)
+ {
+ m[n++] = '0';
+ exp --;
+ }
+ /* now n=16 and -398 <= exp <= 369 */
+ m[n] = '\0';
+
+ /* compute biased exponent */
+ exp += 398;
+
+ MPFR_ASSERTN(exp >= -15);
+ if (exp < 0)
+ {
+ int i;
+ n = -exp;
+ /* check the last n digits of the mantissa are zero */
+ for (i = 1; i <= n; i++)
+ MPFR_ASSERTN(m[16 - n] == '0');
+ /* shift the first (16-n) digits to the right */
+ for (i = 16 - n - 1; i >= 0; i--)
+ m[i + n] = m[i];
+ /* zero the first n digits */
+ for (i = 0; i < n; i ++)
+ m[i] = '0';
+ exp = 0;
+ }
+
+ /* now convert to DPD or BID */
+#ifdef DPD_FORMAT
+#define CH(d) (d - '0')
+ if (m[0] >= '8')
+ G = (3 << 11) | ((exp & 768) << 1) | ((CH(m[0]) & 1) << 8);
+ else
+ G = ((exp & 768) << 3) | (CH(m[0]) << 8);
+ /* now the most 5 significant bits of G are filled */
+ G |= exp & 255;
+ d1 = T[100 * CH(m[1]) + 10 * CH(m[2]) + CH(m[3])]; /* 10-bit encoding */
+ d2 = T[100 * CH(m[4]) + 10 * CH(m[5]) + CH(m[6])]; /* 10-bit encoding */
+ d3 = T[100 * CH(m[7]) + 10 * CH(m[8]) + CH(m[9])]; /* 10-bit encoding */
+ d4 = T[100 * CH(m[10]) + 10 * CH(m[11]) + CH(m[12])]; /* 10-bit encoding */
+ d5 = T[100 * CH(m[13]) + 10 * CH(m[14]) + CH(m[15])]; /* 10-bit encoding */
+ x.s.exp = G >> 2;
+ x.s.manh = ((G & 3) << 18) | (d1 << 8) | (d2 >> 2);
+ x.s.manl = (d2 & 3) << 30;
+ x.s.manl |= (d3 << 20) | (d4 << 10) | d5;
+#else /* BID format */
+ {
+ mp_size_t rn;
+ mp_limb_t rp[2];
+ int case_i = strcmp (m, "9007199254740992") < 0;
+
+ for (n = 0; n < 16; n++)
+ m[n] -= '0';
+ rn = mpn_set_str (rp, (unsigned char *) m, 16, 10);
+ if (rn == 1)
+ rp[1] = 0;
+#if GMP_NUMB_BITS > 32
+ rp[1] = rp[1] << (GMP_NUMB_BITS - 32);
+ rp[1] |= rp[0] >> 32;
+ rp[0] &= 4294967295UL;
+#endif
+ if (case_i)
+ { /* s < 2^53: case i) */
+ x.s.exp = exp << 1;
+ x.s.manl = rp[0]; /* 32 bits */
+ x.s.manh = rp[1] & 1048575; /* 20 low bits */
+ x.s.exp |= rp[1] >> 20; /* 1 bit */
+ }
+ else /* s >= 2^53: case ii) */
+ {
+ x.s.exp = 1536 | (exp >> 1);
+ x.s.manl = rp[0];
+ x.s.manh = (rp[1] ^ 2097152) | ((exp & 1) << 19);
+ }
+ }
+#endif /* DPD_FORMAT */
+ y.d = x.d;
+ return y.d64;
+}
+
+_Decimal64
+mpfr_get_decimal64 (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
+{
+ int negative;
+ mpfr_exp_t e;
+
+ /* the encoding of NaN, Inf, zero is the same under DPD or BID */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
+ {
+ if (MPFR_IS_NAN (src))
+ return get_decimal64_nan ();
+
+ negative = MPFR_IS_NEG (src);
+
+ if (MPFR_IS_INF (src))
+ return get_decimal64_inf (negative);
+
+ MPFR_ASSERTD (MPFR_IS_ZERO(src));
+ return get_decimal64_zero (negative);
+ }
+
+ e = MPFR_GET_EXP (src);
+ negative = MPFR_IS_NEG (src);
+
+ if (MPFR_UNLIKELY(rnd_mode == MPFR_RNDA))
+ rnd_mode = negative ? MPFR_RNDD : MPFR_RNDU;
+
+ /* the smallest decimal64 number is 10^(-398),
+ with 2^(-1323) < 10^(-398) < 2^(-1322) */
+ if (MPFR_UNLIKELY (e < -1323)) /* src <= 2^(-1324) < 1/2*10^(-398) */
+ {
+ if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDN
+ || (rnd_mode == MPFR_RNDD && negative == 0)
+ || (rnd_mode == MPFR_RNDU && negative != 0))
+ return get_decimal64_zero (negative);
+ else /* return the smallest non-zero number */
+ return get_decimal64_min (negative);
+ }
+ /* the largest decimal64 number is just below 10^(385) < 2^1279 */
+ else if (MPFR_UNLIKELY (e > 1279)) /* then src >= 2^1279 */
+ {
+ if (rnd_mode == MPFR_RNDZ
+ || (rnd_mode == MPFR_RNDU && negative != 0)
+ || (rnd_mode == MPFR_RNDD && negative == 0))
+ return get_decimal64_max (negative);
+ else
+ return get_decimal64_inf (negative);
+ }
+ else
+ {
+ /* we need to store the sign (1), the mantissa (16), and the terminating
+ character, thus we need at least 18 characters in s */
+ char s[23];
+ mpfr_get_str (s, &e, 10, 16, src, rnd_mode);
+ /* the smallest normal number is 1.000...000E-383,
+ which corresponds to s=[0.]1000...000 and e=-382 */
+ if (e < -382)
+ {
+ /* the smallest subnormal number is 0.000...001E-383 = 1E-398,
+ which corresponds to s=[0.]1000...000 and e=-397 */
+ if (e < -397)
+ {
+ if (rnd_mode == MPFR_RNDN && e == -398)
+ {
+ /* If 0.5E-398 < |src| < 1E-398 (smallest subnormal),
+ src should round to +/- 1E-398 in MPFR_RNDN. */
+ mpfr_get_str (s, &e, 10, 1, src, MPFR_RNDA);
+ return e == -398 && s[negative] <= '5' ?
+ get_decimal64_zero (negative) :
+ get_decimal64_min (negative);
+ }
+ if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDN
+ || (rnd_mode == MPFR_RNDD && negative == 0)
+ || (rnd_mode == MPFR_RNDU && negative != 0))
+ return get_decimal64_zero (negative);
+ else /* return the smallest non-zero number */
+ return get_decimal64_min (negative);
+ }
+ else
+ {
+ mpfr_exp_t e2;
+ long digits = 16 - (-382 - e);
+ /* if e = -397 then 16 - (-382 - e) = 1 */
+ mpfr_get_str (s, &e2, 10, digits, src, rnd_mode);
+ /* Warning: we can have e2 = e + 1 here, when rounding to
+ nearest or away from zero. */
+ s[negative + digits] = 'E';
+ sprintf (s + negative + digits + 1, "%ld",
+ (long int)e2 - digits);
+ return string_to_Decimal64 (s);
+ }
+ }
+ /* the largest number is 9.999...999E+384,
+ which corresponds to s=[0.]9999...999 and e=385 */
+ else if (e > 385)
+ {
+ if (rnd_mode == MPFR_RNDZ
+ || (rnd_mode == MPFR_RNDU && negative != 0)
+ || (rnd_mode == MPFR_RNDD && negative == 0))
+ return get_decimal64_max (negative);
+ else
+ return get_decimal64_inf (negative);
+ }
+ else /* -382 <= e <= 385 */
+ {
+ s[16 + negative] = 'E';
+ sprintf (s + 17 + negative, "%ld", (long int)e - 16);
+ return string_to_Decimal64 (s);
+ }
+ }
+}
+
+#endif /* MPFR_WANT_DECIMAL_FLOATS */
diff --git a/src/get_exp.c b/src/get_exp.c
new file mode 100644
index 0000000..5be268f
--- /dev/null
+++ b/src/get_exp.c
@@ -0,0 +1,31 @@
+/* mpfr_get_exp - get the exponent of a floating-point number
+
+Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_get_exp
+mpfr_exp_t
+mpfr_get_exp (mpfr_srcptr x)
+{
+ MPFR_ASSERTN(MPFR_IS_PURE_FP(x));
+ return MPFR_EXP(x); /* do not use MPFR_GET_EXP of course... */
+}
diff --git a/src/get_f.c b/src/get_f.c
new file mode 100644
index 0000000..67b2962
--- /dev/null
+++ b/src/get_f.c
@@ -0,0 +1,148 @@
+/* mpfr_get_f -- convert a MPFR number to a GNU MPF number
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Since MPFR-3.0, return the usual inexact value.
+ The erange flag is set if an error occurred in the conversion
+ (y is NaN, +Inf, or -Inf that have no equivalent in mpf)
+*/
+int
+mpfr_get_f (mpf_ptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ int inex;
+ mp_size_t sx, sy;
+ mpfr_prec_t precx, precy;
+ mp_limb_t *xp;
+ int sh;
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(y)))
+ {
+ if (MPFR_IS_ZERO(y))
+ {
+ mpf_set_ui (x, 0);
+ return 0;
+ }
+ else if (MPFR_IS_NAN (y))
+ {
+ MPFR_SET_ERANGE ();
+ return 0;
+ }
+ else /* y is plus infinity (resp. minus infinity), set x to the maximum
+ value (resp. the minimum value) in precision PREC(x) */
+ {
+ int i;
+ mp_limb_t *xp;
+
+ MPFR_SET_ERANGE ();
+
+ /* To this day, [mp_exp_t] and mp_size_t are #defined as the same
+ type */
+ EXP (x) = MP_SIZE_T_MAX;
+
+ sx = PREC (x);
+ SIZ (x) = sx;
+ xp = PTR (x);
+ for (i = 0; i < sx; i++)
+ xp[i] = MP_LIMB_T_MAX;
+
+ if (MPFR_IS_POS (y))
+ return -1;
+ else
+ {
+ mpf_neg (x, x);
+ return +1;
+ }
+ }
+ }
+
+ sx = PREC(x); /* number of limbs of the mantissa of x */
+
+ precy = MPFR_PREC(y);
+ precx = (mpfr_prec_t) sx * GMP_NUMB_BITS;
+ sy = MPFR_LIMB_SIZE (y);
+
+ xp = PTR (x);
+
+ /* since mpf numbers are represented in base 2^GMP_NUMB_BITS,
+ we loose -EXP(y) % GMP_NUMB_BITS bits in the most significant limb */
+ sh = MPFR_GET_EXP(y) % GMP_NUMB_BITS;
+ sh = sh <= 0 ? - sh : GMP_NUMB_BITS - sh;
+ MPFR_ASSERTD (sh >= 0);
+ if (precy + sh <= precx) /* we can copy directly */
+ {
+ mp_size_t ds;
+
+ MPFR_ASSERTN (sx >= sy);
+ ds = sx - sy;
+
+ if (sh != 0)
+ {
+ mp_limb_t out;
+ out = mpn_rshift (xp + ds, MPFR_MANT(y), sy, sh);
+ MPFR_ASSERTN (ds > 0 || out == 0);
+ if (ds > 0)
+ xp[--ds] = out;
+ }
+ else
+ MPN_COPY (xp + ds, MPFR_MANT (y), sy);
+ if (ds > 0)
+ MPN_ZERO (xp, ds);
+ EXP(x) = (MPFR_GET_EXP(y) + sh) / GMP_NUMB_BITS;
+ inex = 0;
+ }
+ else /* we have to round to precx - sh bits */
+ {
+ mpfr_t z;
+ mp_size_t sz;
+
+ /* Recall that precx = (mpfr_prec_t) sx * GMP_NUMB_BITS, thus removing
+ sh bits (sh < GMP_NUMB_BITSS) won't reduce the number of limbs. */
+ mpfr_init2 (z, precx - sh);
+ sz = MPFR_LIMB_SIZE (z);
+ MPFR_ASSERTN (sx == sz);
+
+ inex = mpfr_set (z, y, rnd_mode);
+ /* warning, sh may change due to rounding, but then z is a power of two,
+ thus we can safely ignore its last bit which is 0 */
+ sh = MPFR_GET_EXP(z) % GMP_NUMB_BITS;
+ sh = sh <= 0 ? - sh : GMP_NUMB_BITS - sh;
+ MPFR_ASSERTD (sh >= 0);
+ if (sh != 0)
+ {
+ mp_limb_t out;
+ out = mpn_rshift (xp, MPFR_MANT(z), sz, sh);
+ /* If sh hasn't changed, it is the number of the non-significant
+ bits in the lowest limb of z. Therefore out == 0. */
+ MPFR_ASSERTD (out == 0); (void) out; /* avoid a warning */
+ }
+ else
+ MPN_COPY (xp, MPFR_MANT(z), sz);
+ EXP(x) = (MPFR_GET_EXP(z) + sh) / GMP_NUMB_BITS;
+ mpfr_clear (z);
+ }
+
+ /* set size and sign */
+ SIZ(x) = (MPFR_FROM_SIGN_TO_INT(MPFR_SIGN(y)) < 0) ? -sx : sx;
+
+ return inex;
+}
diff --git a/src/get_flt.c b/src/get_flt.c
new file mode 100644
index 0000000..411e3c7
--- /dev/null
+++ b/src/get_flt.c
@@ -0,0 +1,123 @@
+/* mpfr_get_flt -- convert a mpfr_t to a machine single precision float
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h> /* for FLT_MIN */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#include "ieee_floats.h"
+
+#define FLT_NEG_ZERO ((float) DBL_NEG_ZERO)
+#define MPFR_FLT_INFM ((float) MPFR_DBL_INFM)
+#define MPFR_FLT_INFP ((float) MPFR_DBL_INFP)
+
+float
+mpfr_get_flt (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
+{
+ int negative;
+ mpfr_exp_t e;
+ float d;
+
+ /* in case of NaN, +Inf, -Inf, +0, -0, the conversion from double to float
+ is exact */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
+ return (float) mpfr_get_d (src, rnd_mode);
+
+ e = MPFR_GET_EXP (src);
+ negative = MPFR_IS_NEG (src);
+
+ if (MPFR_UNLIKELY(rnd_mode == MPFR_RNDA))
+ rnd_mode = negative ? MPFR_RNDD : MPFR_RNDU;
+
+ /* the smallest positive normal float number is 2^(-126) = 0.5*2^(-125),
+ and the smallest positive subnormal number is 2^(-149) = 0.5*2^(-148) */
+ if (MPFR_UNLIKELY (e < -148))
+ {
+ /* |src| < 2^(-149), i.e., |src| is smaller than the smallest positive
+ subnormal number.
+ In round-to-nearest mode, 2^(-150) is rounded to zero.
+ */
+ d = negative ?
+ (rnd_mode == MPFR_RNDD ||
+ (rnd_mode == MPFR_RNDN && mpfr_cmp_si_2exp (src, -1, -150) < 0)
+ ? -FLT_MIN : FLT_NEG_ZERO) :
+ (rnd_mode == MPFR_RNDU ||
+ (rnd_mode == MPFR_RNDN && mpfr_cmp_si_2exp (src, 1, -150) > 0)
+ ? FLT_MIN : 0.0);
+ if (d != 0.0) /* we multiply FLT_MIN = 2^(-126) by FLT_EPSILON = 2^(-23)
+ to get +-2^(-149) */
+ d *= FLT_EPSILON;
+ }
+ /* the largest normal number is 2^128*(1-2^(-24)) = 0.111...111e128 */
+ else if (MPFR_UNLIKELY (e > 128))
+ {
+ d = negative ?
+ (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDU ?
+ -FLT_MAX : MPFR_FLT_INFM) :
+ (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDD ?
+ FLT_MAX : MPFR_FLT_INFP);
+ }
+ else /* -148 <= e <= 127 */
+ {
+ int nbits;
+ mp_size_t np, i;
+ mp_limb_t tp[MPFR_LIMBS_PER_FLT];
+ int carry;
+ double dd;
+
+ nbits = IEEE_FLT_MANT_DIG; /* 24 */
+ if (MPFR_UNLIKELY (e < -125))
+ /*In the subnormal case, compute the exact number of significant bits*/
+ {
+ nbits += (125 + e);
+ MPFR_ASSERTD (nbits >= 1);
+ }
+ np = MPFR_PREC2LIMBS (nbits);
+ MPFR_ASSERTD(np <= MPFR_LIMBS_PER_FLT);
+ carry = mpfr_round_raw_4 (tp, MPFR_MANT(src), MPFR_PREC(src), negative,
+ nbits, rnd_mode);
+ /* we perform the reconstruction using the 'double' type here,
+ knowing the result is exactly representable as 'float' */
+ if (MPFR_UNLIKELY(carry))
+ dd = 1.0;
+ else
+ {
+ /* The following computations are exact thanks to the previous
+ mpfr_round_raw. */
+ dd = (double) tp[0] / MP_BASE_AS_DOUBLE;
+ for (i = 1 ; i < np ; i++)
+ dd = (dd + tp[i]) / MP_BASE_AS_DOUBLE;
+ /* dd is the mantissa (between 1/2 and 1) of the argument rounded
+ to 24 bits */
+ }
+ dd = mpfr_scale2 (dd, e);
+ if (negative)
+ dd = -dd;
+
+ /* convert (exacly) to float */
+ d = (float) dd;
+ }
+
+ return d;
+}
+
diff --git a/src/get_ld.c b/src/get_ld.c
new file mode 100644
index 0000000..146c516
--- /dev/null
+++ b/src/get_ld.c
@@ -0,0 +1,222 @@
+/* mpfr_get_ld, mpfr_get_ld_2exp -- convert a multiple precision floating-point
+ number to a machine long double
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h>
+
+#include "mpfr-impl.h"
+
+#ifndef HAVE_LDOUBLE_IEEE_EXT_LITTLE
+
+long double
+mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return (long double) mpfr_get_d (x, rnd_mode);
+ else /* now x is a normal non-zero number */
+ {
+ long double r; /* result */
+ long double m;
+ double s; /* part of result */
+ mpfr_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */
+ mpfr_t y, z;
+ int sign;
+
+ /* first round x to the target long double precision, so that
+ all subsequent operations are exact (this avoids double rounding
+ problems) */
+ mpfr_init2 (y, MPFR_LDBL_MANT_DIG);
+ mpfr_init2 (z, MPFR_LDBL_MANT_DIG);
+ /* Note about the precision of z: even though IEEE_DBL_MANT_DIG is
+ sufficient, z has been set to the same precision as y so that
+ the mpfr_sub below calls mpfr_sub1sp, which is faster than the
+ generic subtraction, even in this particular case (from tests
+ done by Patrick Pelissier on a 64-bit Core2 Duo against r7285).
+ But here there is an important cancellation in the subtraction.
+ TODO: get more information about what has been tested. */
+
+ mpfr_set (y, x, rnd_mode);
+ sh = MPFR_GET_EXP (y);
+ sign = MPFR_SIGN (y);
+ MPFR_SET_EXP (y, 0);
+ MPFR_SET_POS (y);
+
+ r = 0.0;
+ do {
+ s = mpfr_get_d (y, MPFR_RNDN); /* high part of y */
+ r += (long double) s;
+ mpfr_set_d (z, s, MPFR_RNDN); /* exact */
+ mpfr_sub (y, y, z, MPFR_RNDN); /* exact */
+ } while (!MPFR_IS_ZERO (y));
+
+ mpfr_clear (z);
+ mpfr_clear (y);
+
+ /* we now have to multiply back by 2^sh */
+ MPFR_ASSERTD (r > 0);
+ if (sh != 0)
+ {
+ /* An overflow may occurs (example: 0.5*2^1024) */
+ while (r < 1.0)
+ {
+ r += r;
+ sh--;
+ }
+
+ if (sh > 0)
+ m = 2.0;
+ else
+ {
+ m = 0.5;
+ sh = -sh;
+ }
+
+ for (;;)
+ {
+ if (sh % 2)
+ r = r * m;
+ sh >>= 1;
+ if (sh == 0)
+ break;
+ m = m * m;
+ }
+ }
+ if (sign < 0)
+ r = -r;
+ return r;
+ }
+}
+
+#else
+
+long double
+mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_long_double_t ld;
+ mpfr_t tmp;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (tmp, MPFR_LDBL_MANT_DIG);
+ inex = mpfr_set (tmp, x, rnd_mode);
+
+ mpfr_set_emin (-16382-63);
+ mpfr_set_emax (16384);
+ mpfr_subnormalize (tmp, mpfr_check_range (tmp, inex, rnd_mode), rnd_mode);
+ mpfr_prec_round (tmp, 64, MPFR_RNDZ); /* exact */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (tmp)))
+ ld.ld = (long double) mpfr_get_d (tmp, rnd_mode);
+ else
+ {
+ mp_limb_t *tmpmant;
+ mpfr_exp_t e, denorm;
+
+ tmpmant = MPFR_MANT (tmp);
+ e = MPFR_GET_EXP (tmp);
+ /* the smallest normal number is 2^(-16382), which is 0.5*2^(-16381)
+ in MPFR, thus any exponent <= -16382 corresponds to a subnormal
+ number */
+ denorm = MPFR_UNLIKELY (e <= -16382) ? - e - 16382 + 1 : 0;
+#if GMP_NUMB_BITS >= 64
+ ld.s.manl = (tmpmant[0] >> denorm);
+ ld.s.manh = (tmpmant[0] >> denorm) >> 32;
+#elif GMP_NUMB_BITS == 32
+ if (MPFR_LIKELY (denorm == 0))
+ {
+ ld.s.manl = tmpmant[0];
+ ld.s.manh = tmpmant[1];
+ }
+ else if (denorm < 32)
+ {
+ ld.s.manl = (tmpmant[0] >> denorm) | (tmpmant[1] << (32 - denorm));
+ ld.s.manh = tmpmant[1] >> denorm;
+ }
+ else /* 32 <= denorm <= 64 */
+ {
+ ld.s.manl = tmpmant[1] >> (denorm - 32);
+ ld.s.manh = 0;
+ }
+#else
+# error "GMP_NUMB_BITS must be 32 or >= 64"
+ /* Other values have never been supported anyway. */
+#endif
+ if (MPFR_LIKELY (denorm == 0))
+ {
+ ld.s.exph = (e + 0x3FFE) >> 8;
+ ld.s.expl = (e + 0x3FFE);
+ }
+ else
+ ld.s.exph = ld.s.expl = 0;
+ ld.s.sign = MPFR_IS_NEG (x);
+ }
+
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return ld.ld;
+}
+
+#endif
+
+/* contributed by Damien Stehle */
+long double
+mpfr_get_ld_2exp (long *expptr, mpfr_srcptr src, mpfr_rnd_t rnd_mode)
+{
+ long double ret;
+ mpfr_exp_t exp;
+ mpfr_t tmp;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
+ return (long double) mpfr_get_d_2exp (expptr, src, rnd_mode);
+
+ tmp[0] = *src; /* Hack copy mpfr_t */
+ MPFR_SET_EXP (tmp, 0);
+ ret = mpfr_get_ld (tmp, rnd_mode);
+
+ if (MPFR_IS_PURE_FP(src))
+ {
+ exp = MPFR_GET_EXP (src);
+
+ /* rounding can give 1.0, adjust back to 0.5 <= abs(ret) < 1.0 */
+ if (ret == 1.0)
+ {
+ ret = 0.5;
+ exp ++;
+ }
+ else if (ret == -1.0)
+ {
+ ret = -0.5;
+ exp ++;
+ }
+
+ MPFR_ASSERTN ((ret >= 0.5 && ret < 1.0)
+ || (ret <= -0.5 && ret > -1.0));
+ MPFR_ASSERTN (exp >= LONG_MIN && exp <= LONG_MAX);
+ }
+ else
+ exp = 0;
+
+ *expptr = exp;
+ return ret;
+}
diff --git a/src/get_patches.c b/src/get_patches.c
new file mode 100644
index 0000000..ac9f6ae
--- /dev/null
+++ b/src/get_patches.c
@@ -0,0 +1,29 @@
+/* mpfr_get_patches -- Patches that have been applied
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+const char *
+mpfr_get_patches (void)
+{
+ return "";
+}
diff --git a/src/get_si.c b/src/get_si.c
new file mode 100644
index 0000000..f2b2762
--- /dev/null
+++ b/src/get_si.c
@@ -0,0 +1,69 @@
+/* mpfr_get_si -- convert a floating-point number to a signed long.
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+long
+mpfr_get_si (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t prec;
+ long s;
+ mpfr_t x;
+
+ if (MPFR_UNLIKELY (!mpfr_fits_slong_p (f, rnd)))
+ {
+ MPFR_SET_ERANGE ();
+ return MPFR_IS_NAN (f) ? 0 :
+ MPFR_IS_NEG (f) ? LONG_MIN : LONG_MAX;
+ }
+
+ if (MPFR_IS_ZERO (f))
+ return (long) 0;
+
+ /* determine prec of long */
+ for (s = LONG_MIN, prec = 0; s != 0; s /= 2, prec++)
+ { }
+
+ /* first round to prec bits */
+ mpfr_init2 (x, prec);
+ mpfr_rint (x, f, rnd);
+
+ /* warning: if x=0, taking its exponent is illegal */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO(x)))
+ s = 0;
+ else
+ {
+ mp_limb_t a;
+ mp_size_t n;
+ mpfr_exp_t exp;
+
+ /* now the result is in the most significant limb of x */
+ exp = MPFR_GET_EXP (x); /* since |x| >= 1, exp >= 1 */
+ n = MPFR_LIMB_SIZE(x);
+ a = MPFR_MANT(x)[n - 1] >> (GMP_NUMB_BITS - exp);
+ s = MPFR_SIGN(f) > 0 ? a : a <= LONG_MAX ? - (long) a : LONG_MIN;
+ }
+
+ mpfr_clear (x);
+
+ return s;
+}
diff --git a/src/get_sj.c b/src/get_sj.c
new file mode 100644
index 0000000..528f421
--- /dev/null
+++ b/src/get_sj.c
@@ -0,0 +1,123 @@
+/* mpfr_get_sj -- convert a MPFR number to a huge machine signed integer
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+intmax_t
+mpfr_get_sj (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ intmax_t r;
+ mpfr_prec_t prec;
+ mpfr_t x;
+
+ if (MPFR_UNLIKELY (!mpfr_fits_intmax_p (f, rnd)))
+ {
+ MPFR_SET_ERANGE ();
+ return MPFR_IS_NAN (f) ? 0 :
+ MPFR_IS_NEG (f) ? MPFR_INTMAX_MIN : MPFR_INTMAX_MAX;
+ }
+
+ if (MPFR_IS_ZERO (f))
+ return (intmax_t) 0;
+
+ /* determine the precision of intmax_t */
+ for (r = MPFR_INTMAX_MIN, prec = 0; r != 0; r /= 2, prec++)
+ { }
+ /* Note: though INTMAX_MAX would have been sufficient for the conversion,
+ we chose INTMAX_MIN so that INTMAX_MIN - 1 is always representable in
+ precision prec; this is useful to detect overflows in MPFR_RNDZ (will
+ be needed later). */
+
+ /* Now, r = 0. */
+
+ mpfr_init2 (x, prec);
+ mpfr_rint (x, f, rnd);
+ MPFR_ASSERTN (MPFR_IS_FP (x));
+
+ if (MPFR_NOTZERO (x))
+ {
+ mp_limb_t *xp;
+ int sh, n; /* An int should be sufficient in this context. */
+
+ xp = MPFR_MANT (x);
+ sh = MPFR_GET_EXP (x);
+ MPFR_ASSERTN ((mpfr_prec_t) sh <= prec);
+ if (MPFR_INTMAX_MIN + MPFR_INTMAX_MAX != 0
+ && MPFR_UNLIKELY ((mpfr_prec_t) sh == prec))
+ {
+ /* 2's complement and x <= INTMAX_MIN: in the case mp_limb_t
+ has the same size as intmax_t, we cannot use the code in
+ the for loop since the operations would be performed in
+ unsigned arithmetic. */
+ MPFR_ASSERTN (MPFR_IS_NEG (x) && (mpfr_powerof2_raw (x)));
+ r = MPFR_INTMAX_MIN;
+ }
+ else if (MPFR_IS_POS (x))
+ {
+ /* Note: testing the condition sh >= 0 is necessary to avoid
+ an undefined behavior on xp[n] >> S when S >= GMP_NUMB_BITS
+ (even though xp[n] == 0 in such a case). This can happen if
+ sizeof(mp_limb_t) < sizeof(intmax_t) and |x| is small enough
+ because of the trailing bits due to its normalization. */
+ for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh >= 0; n--)
+ {
+ sh -= GMP_NUMB_BITS;
+ /* Note the concerning the casts below:
+ When sh >= 0, the cast must be performed before the shift
+ for the case sizeof(intmax_t) > sizeof(mp_limb_t).
+ When sh < 0, the cast must be performed after the shift
+ for the case sizeof(intmax_t) == sizeof(mp_limb_t), as
+ mp_limb_t is unsigned, therefore not representable as an
+ intmax_t when the MSB is 1 (this is the case here). */
+ MPFR_ASSERTD (sh < GMP_NUMB_BITS && -sh < GMP_NUMB_BITS);
+ r += (sh >= 0
+ ? (intmax_t) xp[n] << sh
+ : (intmax_t) (xp[n] >> (-sh)));
+ }
+ }
+ else
+ {
+ /* See the comments for the case x positive. */
+ for (n = MPFR_LIMB_SIZE (x) - 1; n >= 0 && sh >= 0; n--)
+ {
+ sh -= GMP_NUMB_BITS;
+ MPFR_ASSERTD (sh < GMP_NUMB_BITS && -sh < GMP_NUMB_BITS);
+ r -= (sh >= 0
+ ? (intmax_t) xp[n] << sh
+ : (intmax_t) (xp[n] >> (-sh)));
+ }
+ }
+ }
+
+ mpfr_clear (x);
+
+ return r;
+}
+
+#endif
diff --git a/src/get_str.c b/src/get_str.c
new file mode 100644
index 0000000..b907aa6
--- /dev/null
+++ b/src/get_str.c
@@ -0,0 +1,2555 @@
+/* mpfr_get_str -- output a floating-point number to a string
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+static int mpfr_get_str_aux (char *const, mpfr_exp_t *const, mp_limb_t *const,
+ mp_size_t, mpfr_exp_t, long, int, size_t, mpfr_rnd_t);
+
+/* The implicit \0 is useless, but we do not write num_to_text[62] otherwise
+ g++ complains. */
+static const char num_to_text36[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+static const char num_to_text62[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz";
+
+/* copy most important limbs of {op, n2} in {rp, n1} */
+/* if n1 > n2 put 0 in low limbs of {rp, n1} */
+#define MPN_COPY2(rp, n1, op, n2) \
+ if ((n1) <= (n2)) \
+ { \
+ MPN_COPY ((rp), (op) + (n2) - (n1), (n1)); \
+ } \
+ else \
+ { \
+ MPN_COPY ((rp) + (n1) - (n2), (op), (n2)); \
+ MPN_ZERO ((rp), (n1) - (n2)); \
+ }
+
+#define MPFR_ROUND_FAILED 3
+
+/* Input: an approximation r*2^f of a real Y, with |r*2^f-Y| <= 2^(e+f).
+ Returns if possible in the string s the mantissa corresponding to
+ the integer nearest to Y, within the direction rnd, and returns the
+ exponent in exp.
+ n is the number of limbs of r.
+ e represents the maximal error in the approximation of Y
+ (e < 0 iff the approximation is exact, i.e., r*2^f = Y).
+ b is the wanted base (2 <= b <= 62).
+ m is the number of wanted digits in the mantissa.
+ rnd is the rounding mode.
+ It is assumed that b^(m-1) <= Y < b^(m+1), thus the returned value
+ satisfies b^(m-1) <= rnd(Y) < b^(m+1).
+
+ Rounding may fail for two reasons:
+ - the error is too large to determine the integer N nearest to Y
+ - either the number of digits of N in base b is too large (m+1),
+ N=2*N1+(b/2) and the rounding mode is to nearest. This can
+ only happen when b is even.
+
+ Return value:
+ - the direction of rounding (-1, 0, 1) if rounding is possible
+ - -MPFR_ROUND_FAILED if rounding not possible because m+1 digits
+ - MPFR_ROUND_FAILED otherwise (too large error)
+*/
+static int
+mpfr_get_str_aux (char *const str, mpfr_exp_t *const exp, mp_limb_t *const r,
+ mp_size_t n, mpfr_exp_t f, long e, int b, size_t m,
+ mpfr_rnd_t rnd)
+{
+ const char *num_to_text;
+ int dir; /* direction of the rounded result */
+ mp_limb_t ret = 0; /* possible carry in addition */
+ mp_size_t i0, j0; /* number of limbs and bits of Y */
+ unsigned char *str1; /* string of m+2 characters */
+ size_t size_s1; /* length of str1 */
+ mpfr_rnd_t rnd1;
+ size_t i;
+ int exact = (e < 0);
+ MPFR_TMP_DECL(marker);
+
+ /* if f > 0, then the maximal error 2^(e+f) is larger than 2 so we can't
+ determine the integer Y */
+ MPFR_ASSERTN(f <= 0);
+ /* if f is too small, then r*2^f is smaller than 1 */
+ MPFR_ASSERTN(f > (-n * GMP_NUMB_BITS));
+
+ MPFR_TMP_MARK(marker);
+
+ num_to_text = b < 37 ? num_to_text36 : num_to_text62;
+
+ /* R = 2^f sum r[i]K^(i)
+ r[i] = (r_(i,k-1)...r_(i,0))_2
+ R = sum r(i,j)2^(j+ki+f)
+ the bits from R are referenced by pairs (i,j) */
+
+ /* check if is possible to round r with rnd mode
+ where |r*2^f-Y| <= 2^(e+f)
+ the exponent of R is: f + n*GMP_NUMB_BITS
+ we must have e + f == f + n*GMP_NUMB_BITS - err
+ err = n*GMP_NUMB_BITS - e
+ R contains exactly -f bits after the integer point:
+ to determine the nearest integer, we thus need a precision of
+ n * GMP_NUMB_BITS + f */
+
+ if (exact || mpfr_can_round_raw (r, n, (mp_size_t) 1,
+ n * GMP_NUMB_BITS - e, MPFR_RNDN, rnd, n * GMP_NUMB_BITS + f))
+ {
+ /* compute the nearest integer to R */
+
+ /* bit of weight 0 in R has position j0 in limb r[i0] */
+ i0 = (-f) / GMP_NUMB_BITS;
+ j0 = (-f) % GMP_NUMB_BITS;
+
+ ret = mpfr_round_raw (r + i0, r, n * GMP_NUMB_BITS, 0,
+ n * GMP_NUMB_BITS + f, rnd, &dir);
+ MPFR_ASSERTD(dir != MPFR_ROUND_FAILED);
+
+ /* warning: mpfr_round_raw_generic returns MPFR_EVEN_INEX (2) or
+ -MPFR_EVEN_INEX (-2) in case of even rounding */
+
+ if (ret) /* Y is a power of 2 */
+ {
+ if (j0)
+ r[n - 1] = MPFR_LIMB_HIGHBIT >> (j0 - 1);
+ else /* j0=0, necessarily i0 >= 1 otherwise f=0 and r is exact */
+ {
+ r[n - 1] = ret;
+ r[--i0] = 0; /* set to zero the new low limb */
+ }
+ }
+ else /* shift r to the right by (-f) bits (i0 already done) */
+ {
+ if (j0)
+ mpn_rshift (r + i0, r + i0, n - i0, j0);
+ }
+
+ /* now the rounded value Y is in {r+i0, n-i0} */
+
+ /* convert r+i0 into base b */
+ str1 = (unsigned char*) MPFR_TMP_ALLOC (m + 3); /* need one extra character for mpn_get_str */
+ size_s1 = mpn_get_str (str1, b, r + i0, n - i0);
+
+ /* round str1 */
+ MPFR_ASSERTN(size_s1 >= m);
+ *exp = size_s1 - m; /* number of superfluous characters */
+
+ /* if size_s1 = m + 2, necessarily we have b^(m+1) as result,
+ and the result will not change */
+
+ /* so we have to double-round only when size_s1 = m + 1 and
+ (i) the result is inexact
+ (ii) or the last digit is non-zero */
+ if ((size_s1 == m + 1) && ((dir != 0) || (str1[size_s1 - 1] != 0)))
+ {
+ /* rounding mode */
+ rnd1 = rnd;
+
+ /* round to nearest case */
+ if (rnd == MPFR_RNDN)
+ {
+ if (2 * str1[size_s1 - 1] == b)
+ {
+ if (dir == 0 && exact) /* exact: even rounding */
+ {
+ rnd1 = ((str1[size_s1 - 2] & 1) == 0)
+ ? MPFR_RNDD : MPFR_RNDU;
+ }
+ else
+ {
+ /* otherwise we cannot round correctly: for example
+ if b=10, we might have a mantissa of
+ xxxxxxx5.00000000 which can be rounded to nearest
+ to 8 digits but not to 7 */
+ dir = -MPFR_ROUND_FAILED;
+ MPFR_ASSERTD(dir != MPFR_EVEN_INEX);
+ goto free_and_return;
+ }
+ }
+ else if (2 * str1[size_s1 - 1] < b)
+ rnd1 = MPFR_RNDD;
+ else
+ rnd1 = MPFR_RNDU;
+ }
+
+ /* now rnd1 is either
+ MPFR_RNDD or MPFR_RNDZ -> truncate, or
+ MPFR_RNDU or MPFR_RNDA -> round toward infinity */
+
+ /* round away from zero */
+ if (rnd1 == MPFR_RNDU || rnd1 == MPFR_RNDA)
+ {
+ if (str1[size_s1 - 1] != 0)
+ {
+ /* the carry cannot propagate to the whole string, since
+ Y = x*b^(m-g) < 2*b^m <= b^(m+1)-b
+ where x is the input float */
+ MPFR_ASSERTN(size_s1 >= 2);
+ i = size_s1 - 2;
+ while (str1[i] == b - 1)
+ {
+ MPFR_ASSERTD(i > 0);
+ str1[i--] = 0;
+ }
+ str1[i]++;
+ }
+ dir = 1;
+ }
+ /* round toward zero (truncate) */
+ else
+ dir = -1;
+ }
+
+ /* copy str1 into str and convert to characters (digits and
+ lowercase letters from the source character set) */
+ for (i = 0; i < m; i++)
+ str[i] = num_to_text[(int) str1[i]]; /* str1[i] is an unsigned char */
+ str[m] = 0;
+ }
+ /* mpfr_can_round_raw failed: rounding is not possible */
+ else
+ {
+ dir = MPFR_ROUND_FAILED; /* should be different from MPFR_EVEN_INEX */
+ MPFR_ASSERTD(dir != MPFR_EVEN_INEX);
+ }
+
+ free_and_return:
+ MPFR_TMP_FREE(marker);
+
+ return dir;
+}
+
+/***************************************************************************
+ * __gmpfr_l2b[b-2][0] is a 23-bit upper approximation to log(b)/log(2), *
+ * __gmpfr_l2b[b-2][1] is a 76-bit upper approximation to log(2)/log(b). *
+ * The following code is generated by tests/tl2b (with an argument). *
+ ***************************************************************************/
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x0000, 0x8000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x80000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x8000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x800000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x80000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_2_0__tab[] = { 0x8000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x8000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x00000000, 0x00000000, 0x80000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x0000000000000000, 0x8000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x800000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x80000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_2_1__tab[] = { 0x8000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_3_0__tab[] = { 0x0e00, 0xcae0 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_3_0__tab[] = { 0xcae00e0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_3_1__tab[] = { 0x0448, 0xe94e, 0xa9a9, 0x9cc1, 0xa184 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_3_1__tab[] = { 0x04480000, 0xa9a9e94e, 0xa1849cc1 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_3_1__tab[] = { 0x0448000000000000, 0xa1849cc1a9a9e94e };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_3_1__tab[] = { 0xa1849cc1a9a9e94e04480000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_3_1__tab[] = { 0xa1849cc1a9a9e94e0448000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_3_1__tab[] = { 0xa1849cc1a9a9e94e044800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x0000, 0x8000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x80000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x8000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x800000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x80000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_4_0__tab[] = { 0x8000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x8000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x00000000, 0x00000000, 0x80000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x0000000000000000, 0x8000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x800000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x80000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_4_1__tab[] = { 0x8000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x7a00, 0x949a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_5_0__tab[] = { 0x949a7a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_5_1__tab[] = { 0x67b8, 0x9728, 0x287b, 0xa348, 0xdc81 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_5_1__tab[] = { 0x67b80000, 0x287b9728, 0xdc81a348 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_5_1__tab[] = { 0x67b8000000000000, 0xdc81a348287b9728 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_5_1__tab[] = { 0xdc81a348287b972867b80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_5_1__tab[] = { 0xdc81a348287b972867b8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_5_1__tab[] = { 0xdc81a348287b972867b800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_6_0__tab[] = { 0x0800, 0xa570 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa5700800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa570080000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa57008000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa5700800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_6_0__tab[] = { 0xa570080000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xff10, 0xf9e9, 0xe054, 0x9236, 0xc611 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xff100000, 0xe054f9e9, 0xc6119236 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xff10000000000000, 0xc6119236e054f9e9 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xc6119236e054f9e9ff100000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xc6119236e054f9e9ff10000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_6_1__tab[] = { 0xc6119236e054f9e9ff1000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb400, 0xb3ab };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb40000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb4000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_7_0__tab[] = { 0xb3abb40000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_7_1__tab[] = { 0x37b8, 0xa711, 0x754d, 0xc9d6, 0xb660 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_7_1__tab[] = { 0x37b80000, 0x754da711, 0xb660c9d6 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_7_1__tab[] = { 0x37b8000000000000, 0xb660c9d6754da711 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_7_1__tab[] = { 0xb660c9d6754da71137b80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_7_1__tab[] = { 0xb660c9d6754da71137b8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_7_1__tab[] = { 0xb660c9d6754da71137b800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_8_0__tab[] = { 0x0000, 0xc000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc0000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc00000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc0000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_8_0__tab[] = { 0xc000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaab0, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaab00000, 0xaaaaaaaa, 0xaaaaaaaa };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaab0000000000000, 0xaaaaaaaaaaaaaaaa };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaaaaaaaaaaaaaaaaaab00000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaaaaaaaaaaaaaaaaaab0000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_8_1__tab[] = { 0xaaaaaaaaaaaaaaaaaab000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_9_0__tab[] = { 0x0e00, 0xcae0 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_9_0__tab[] = { 0xcae00e0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_9_1__tab[] = { 0x0448, 0xe94e, 0xa9a9, 0x9cc1, 0xa184 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_9_1__tab[] = { 0x04480000, 0xa9a9e94e, 0xa1849cc1 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_9_1__tab[] = { 0x0448000000000000, 0xa1849cc1a9a9e94e };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_9_1__tab[] = { 0xa1849cc1a9a9e94e04480000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_9_1__tab[] = { 0xa1849cc1a9a9e94e0448000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_9_1__tab[] = { 0xa1849cc1a9a9e94e044800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_10_0__tab[] = { 0x7a00, 0xd49a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_10_0__tab[] = { 0xd49a7a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x8f90, 0xf798, 0xfbcf, 0x9a84, 0x9a20 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x8f900000, 0xfbcff798, 0x9a209a84 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x8f90000000000000, 0x9a209a84fbcff798 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x9a209a84fbcff7988f900000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x9a209a84fbcff7988f90000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_10_1__tab[] = { 0x9a209a84fbcff7988f9000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_11_0__tab[] = { 0x5400, 0xdd67 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd675400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd67540000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd6754000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd675400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_11_0__tab[] = { 0xdd67540000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_11_1__tab[] = { 0xe170, 0x9d10, 0xeb22, 0x4e0e, 0x9400 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_11_1__tab[] = { 0xe1700000, 0xeb229d10, 0x94004e0e };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_11_1__tab[] = { 0xe170000000000000, 0x94004e0eeb229d10 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_11_1__tab[] = { 0x94004e0eeb229d10e1700000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_11_1__tab[] = { 0x94004e0eeb229d10e170000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_11_1__tab[] = { 0x94004e0eeb229d10e17000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_12_0__tab[] = { 0x0800, 0xe570 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe5700800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe570080000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe57008000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe5700800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_12_0__tab[] = { 0xe570080000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_12_1__tab[] = { 0xfe28, 0x1c24, 0x0b03, 0x9c1a, 0x8ed1 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_12_1__tab[] = { 0xfe280000, 0x0b031c24, 0x8ed19c1a };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_12_1__tab[] = { 0xfe28000000000000, 0x8ed19c1a0b031c24 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_12_1__tab[] = { 0x8ed19c1a0b031c24fe280000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_12_1__tab[] = { 0x8ed19c1a0b031c24fe28000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_12_1__tab[] = { 0x8ed19c1a0b031c24fe2800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_13_0__tab[] = { 0x0200, 0xecd4 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd40200 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd4020000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd402000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd40200000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_13_0__tab[] = { 0xecd4020000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x57f8, 0xf7b4, 0xcb20, 0xa7c6, 0x8a5c };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x57f80000, 0xcb20f7b4, 0x8a5ca7c6 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x57f8000000000000, 0x8a5ca7c6cb20f7b4 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x8a5ca7c6cb20f7b457f80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x8a5ca7c6cb20f7b457f8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_13_1__tab[] = { 0x8a5ca7c6cb20f7b457f800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xb400, 0xf3ab };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb40000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb4000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_14_0__tab[] = { 0xf3abb40000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x85a8, 0x5cab, 0x96b5, 0xfff6, 0x8679 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x85a80000, 0x96b55cab, 0x8679fff6 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x85a8000000000000, 0x8679fff696b55cab };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x8679fff696b55cab85a80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x8679fff696b55cab85a8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_14_1__tab[] = { 0x8679fff696b55cab85a800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_15_0__tab[] = { 0x8000, 0xfa0a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a8000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a800000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a80000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a8000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_15_0__tab[] = { 0xfa0a800000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x6f80, 0xa6aa, 0x69f0, 0xee23, 0x830c };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x6f800000, 0x69f0a6aa, 0x830cee23 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x6f80000000000000, 0x830cee2369f0a6aa };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x830cee2369f0a6aa6f800000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x830cee2369f0a6aa6f80000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_15_1__tab[] = { 0x830cee2369f0a6aa6f8000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x0000, 0x8000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x80000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x8000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x800000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x80000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_16_0__tab[] = { 0x8000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x8000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x00000000, 0x00000000, 0x80000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x0000000000000000, 0x8000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x800000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x80000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_16_1__tab[] = { 0x8000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x8000, 0x82cc };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc8000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc800000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc80000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc8000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_17_0__tab[] = { 0x82cc800000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_17_1__tab[] = { 0x8720, 0x259b, 0x62c4, 0xabf5, 0xfa85 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_17_1__tab[] = { 0x87200000, 0x62c4259b, 0xfa85abf5 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_17_1__tab[] = { 0x8720000000000000, 0xfa85abf562c4259b };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_17_1__tab[] = { 0xfa85abf562c4259b87200000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_17_1__tab[] = { 0xfa85abf562c4259b8720000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_17_1__tab[] = { 0xfa85abf562c4259b872000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x0800, 0x8570 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x85700800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x8570080000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x857008000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x85700800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_18_0__tab[] = { 0x8570080000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_18_1__tab[] = { 0x3698, 0x1378, 0x5537, 0x6634, 0xf591 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_18_1__tab[] = { 0x36980000, 0x55371378, 0xf5916634 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_18_1__tab[] = { 0x3698000000000000, 0xf591663455371378 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_18_1__tab[] = { 0xf59166345537137836980000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_18_1__tab[] = { 0xf5916634553713783698000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_18_1__tab[] = { 0xf591663455371378369800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x0600, 0x87ef };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef0600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef060000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef06000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef0600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_19_0__tab[] = { 0x87ef060000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_19_1__tab[] = { 0x0db8, 0x558c, 0x62ed, 0x08c0, 0xf10f };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_19_1__tab[] = { 0x0db80000, 0x62ed558c, 0xf10f08c0 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_19_1__tab[] = { 0x0db8000000000000, 0xf10f08c062ed558c };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_19_1__tab[] = { 0xf10f08c062ed558c0db80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_19_1__tab[] = { 0xf10f08c062ed558c0db8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_19_1__tab[] = { 0xf10f08c062ed558c0db800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x3e00, 0x8a4d };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_20_0__tab[] = { 0x8a4d3e0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_20_1__tab[] = { 0x0b40, 0xa71c, 0x1cc1, 0x690a, 0xecee };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_20_1__tab[] = { 0x0b400000, 0x1cc1a71c, 0xecee690a };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_20_1__tab[] = { 0x0b40000000000000, 0xecee690a1cc1a71c };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_20_1__tab[] = { 0xecee690a1cc1a71c0b400000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_20_1__tab[] = { 0xecee690a1cc1a71c0b40000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_20_1__tab[] = { 0xecee690a1cc1a71c0b4000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_21_0__tab[] = { 0xde00, 0x8c8d };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_21_0__tab[] = { 0x8c8dde0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_21_1__tab[] = { 0x4108, 0x6b26, 0xb3d0, 0x63c1, 0xe922 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_21_1__tab[] = { 0x41080000, 0xb3d06b26, 0xe92263c1 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_21_1__tab[] = { 0x4108000000000000, 0xe92263c1b3d06b26 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_21_1__tab[] = { 0xe92263c1b3d06b2641080000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_21_1__tab[] = { 0xe92263c1b3d06b264108000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_21_1__tab[] = { 0xe92263c1b3d06b26410800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_22_0__tab[] = { 0xaa00, 0x8eb3 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_22_0__tab[] = { 0x8eb3aa0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xdbe8, 0xf061, 0x60b9, 0x2c4d, 0xe5a0 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xdbe80000, 0x60b9f061, 0xe5a02c4d };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xdbe8000000000000, 0xe5a02c4d60b9f061 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xe5a02c4d60b9f061dbe80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xe5a02c4d60b9f061dbe8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_22_1__tab[] = { 0xe5a02c4d60b9f061dbe800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x0600, 0x90c1 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c10600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c1060000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c106000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c10600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_23_0__tab[] = { 0x90c1060000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xc3e0, 0x586a, 0x46b9, 0xcadd, 0xe25e };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xc3e00000, 0x46b9586a, 0xe25ecadd };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xc3e0000000000000, 0xe25ecadd46b9586a };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xe25ecadd46b9586ac3e00000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xe25ecadd46b9586ac3e0000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_23_1__tab[] = { 0xe25ecadd46b9586ac3e000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x0400, 0x92b8 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b80400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b8040000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b804000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b80400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_24_0__tab[] = { 0x92b8040000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_24_1__tab[] = { 0x3668, 0x7263, 0xc7c6, 0xbb44, 0xdf56 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_24_1__tab[] = { 0x36680000, 0xc7c67263, 0xdf56bb44 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_24_1__tab[] = { 0x3668000000000000, 0xdf56bb44c7c67263 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_24_1__tab[] = { 0xdf56bb44c7c6726336680000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_24_1__tab[] = { 0xdf56bb44c7c672633668000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_24_1__tab[] = { 0xdf56bb44c7c67263366800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x7a00, 0x949a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_25_0__tab[] = { 0x949a7a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_25_1__tab[] = { 0x67b8, 0x9728, 0x287b, 0xa348, 0xdc81 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_25_1__tab[] = { 0x67b80000, 0x287b9728, 0xdc81a348 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_25_1__tab[] = { 0x67b8000000000000, 0xdc81a348287b9728 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_25_1__tab[] = { 0xdc81a348287b972867b80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_25_1__tab[] = { 0xdc81a348287b972867b8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_25_1__tab[] = { 0xdc81a348287b972867b800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x0200, 0x966a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a0200 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a020000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a02000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a0200000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_26_0__tab[] = { 0x966a020000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_26_1__tab[] = { 0x6458, 0x78a4, 0x7583, 0x19f9, 0xd9da };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_26_1__tab[] = { 0x64580000, 0x758378a4, 0xd9da19f9 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_26_1__tab[] = { 0x6458000000000000, 0xd9da19f9758378a4 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_26_1__tab[] = { 0xd9da19f9758378a464580000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_26_1__tab[] = { 0xd9da19f9758378a46458000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_26_1__tab[] = { 0xd9da19f9758378a4645800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x0a00, 0x9828 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_27_0__tab[] = { 0x98280a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_27_1__tab[] = { 0x5b08, 0xe1bd, 0xe237, 0x7bac, 0xd75b };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_27_1__tab[] = { 0x5b080000, 0xe237e1bd, 0xd75b7bac };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_27_1__tab[] = { 0x5b08000000000000, 0xd75b7bace237e1bd };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_27_1__tab[] = { 0xd75b7bace237e1bd5b080000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_27_1__tab[] = { 0xd75b7bace237e1bd5b08000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_27_1__tab[] = { 0xd75b7bace237e1bd5b0800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_28_0__tab[] = { 0xda00, 0x99d5 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_28_0__tab[] = { 0x99d5da0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xdeb8, 0xe8b8, 0x71df, 0xc758, 0xd501 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xdeb80000, 0x71dfe8b8, 0xd501c758 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xdeb8000000000000, 0xd501c75871dfe8b8 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xd501c75871dfe8b8deb80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xd501c75871dfe8b8deb8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_28_1__tab[] = { 0xd501c75871dfe8b8deb800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9600, 0x9b74 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b749600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b74960000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b7496000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b749600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_29_0__tab[] = { 0x9b74960000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xccc8, 0x62b3, 0x9c6c, 0x8315, 0xd2c9 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xccc80000, 0x9c6c62b3, 0xd2c98315 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xccc8000000000000, 0xd2c983159c6c62b3 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xd2c983159c6c62b3ccc80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xd2c983159c6c62b3ccc8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_29_1__tab[] = { 0xd2c983159c6c62b3ccc800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x4000, 0x9d05 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d054000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d05400000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d0540000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d054000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_30_0__tab[] = { 0x9d05400000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_30_1__tab[] = { 0x3588, 0x1732, 0x5cad, 0xa619, 0xd0af };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_30_1__tab[] = { 0x35880000, 0x5cad1732, 0xd0afa619 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_30_1__tab[] = { 0x3588000000000000, 0xd0afa6195cad1732 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_30_1__tab[] = { 0xd0afa6195cad173235880000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_30_1__tab[] = { 0xd0afa6195cad17323588000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_30_1__tab[] = { 0xd0afa6195cad1732358800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_31_0__tab[] = { 0xc800, 0x9e88 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c80000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c8000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_31_0__tab[] = { 0x9e88c80000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xd578, 0xf7ca, 0x63ee, 0x86e6, 0xceb1 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xd5780000, 0x63eef7ca, 0xceb186e6 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xd578000000000000, 0xceb186e663eef7ca };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xceb186e663eef7cad5780000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xceb186e663eef7cad578000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_31_1__tab[] = { 0xceb186e663eef7cad57800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_32_0__tab[] = { 0x0000, 0xa000 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa0000000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa000000000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa00000000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa0000000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_32_0__tab[] = { 0xa000000000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccd0, 0xcccc, 0xcccc, 0xcccc, 0xcccc };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccd00000, 0xcccccccc, 0xcccccccc };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccd0000000000000, 0xcccccccccccccccc };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccccccccccccccccccd00000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccccccccccccccccccd0000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_32_1__tab[] = { 0xccccccccccccccccccd000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xae00, 0xa16b };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_33_0__tab[] = { 0xa16bae0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_33_1__tab[] = { 0x0888, 0xa187, 0x5304, 0x6404, 0xcaff };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_33_1__tab[] = { 0x08880000, 0x5304a187, 0xcaff6404 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_33_1__tab[] = { 0x0888000000000000, 0xcaff64045304a187 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_33_1__tab[] = { 0xcaff64045304a18708880000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_33_1__tab[] = { 0xcaff64045304a1870888000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_33_1__tab[] = { 0xcaff64045304a187088800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_34_0__tab[] = { 0x8000, 0xa2cc };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc8000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc800000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc80000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc8000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_34_0__tab[] = { 0xa2cc800000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xfb50, 0x17ca, 0x5a79, 0x73d8, 0xc947 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xfb500000, 0x5a7917ca, 0xc94773d8 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xfb50000000000000, 0xc94773d85a7917ca };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xc94773d85a7917cafb500000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xc94773d85a7917cafb50000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_34_1__tab[] = { 0xc94773d85a7917cafb5000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_35_0__tab[] = { 0x1800, 0xa423 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa4231800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa423180000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa42318000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa4231800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_35_0__tab[] = { 0xa423180000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_35_1__tab[] = { 0x6960, 0x18c2, 0x6037, 0x567c, 0xc7a3 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_35_1__tab[] = { 0x69600000, 0x603718c2, 0xc7a3567c };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_35_1__tab[] = { 0x6960000000000000, 0xc7a3567c603718c2 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_35_1__tab[] = { 0xc7a3567c603718c269600000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_35_1__tab[] = { 0xc7a3567c603718c26960000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_35_1__tab[] = { 0xc7a3567c603718c2696000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_36_0__tab[] = { 0x0800, 0xa570 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa5700800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa570080000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa57008000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa5700800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_36_0__tab[] = { 0xa570080000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xff10, 0xf9e9, 0xe054, 0x9236, 0xc611 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xff100000, 0xe054f9e9, 0xc6119236 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xff10000000000000, 0xc6119236e054f9e9 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xc6119236e054f9e9ff100000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xc6119236e054f9e9ff10000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_36_1__tab[] = { 0xc6119236e054f9e9ff1000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xd800, 0xa6b3 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d80000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d8000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_37_0__tab[] = { 0xa6b3d80000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_37_1__tab[] = { 0x1618, 0x6b36, 0x70d7, 0xd3a2, 0xc490 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_37_1__tab[] = { 0x16180000, 0x70d76b36, 0xc490d3a2 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_37_1__tab[] = { 0x1618000000000000, 0xc490d3a270d76b36 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_37_1__tab[] = { 0xc490d3a270d76b3616180000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_37_1__tab[] = { 0xc490d3a270d76b361618000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_37_1__tab[] = { 0xc490d3a270d76b36161800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_38_0__tab[] = { 0x0600, 0xa7ef };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef0600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef060000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef06000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef0600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_38_0__tab[] = { 0xa7ef060000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xa3e0, 0x9505, 0x5182, 0xe8d2, 0xc31f };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xa3e00000, 0x51829505, 0xc31fe8d2 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xa3e0000000000000, 0xc31fe8d251829505 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xc31fe8d251829505a3e00000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xc31fe8d251829505a3e0000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_38_1__tab[] = { 0xc31fe8d251829505a3e000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_39_0__tab[] = { 0x0400, 0xa922 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa9220400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa922040000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa92204000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa9220400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_39_0__tab[] = { 0xa922040000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xfcf8, 0xf1b5, 0x10ca, 0xbd32, 0xc1bd };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xfcf80000, 0x10caf1b5, 0xc1bdbd32 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xfcf8000000000000, 0xc1bdbd3210caf1b5 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xc1bdbd3210caf1b5fcf80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xc1bdbd3210caf1b5fcf8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_39_1__tab[] = { 0xc1bdbd3210caf1b5fcf800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_40_0__tab[] = { 0x3e00, 0xaa4d };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_40_0__tab[] = { 0xaa4d3e0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xdce8, 0x4948, 0xeff7, 0x55ff, 0xc069 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xdce80000, 0xeff74948, 0xc06955ff };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xdce8000000000000, 0xc06955ffeff74948 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xc06955ffeff74948dce80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xc06955ffeff74948dce8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_40_1__tab[] = { 0xc06955ffeff74948dce800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_41_0__tab[] = { 0x1200, 0xab71 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab711200 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab71120000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab7112000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab711200000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_41_0__tab[] = { 0xab71120000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xdc28, 0x7cef, 0xf695, 0xcf47, 0xbf21 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xdc280000, 0xf6957cef, 0xbf21cf47 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xdc28000000000000, 0xbf21cf47f6957cef };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xbf21cf47f6957cefdc280000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xbf21cf47f6957cefdc28000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_41_1__tab[] = { 0xbf21cf47f6957cefdc2800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xde00, 0xac8d };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_42_0__tab[] = { 0xac8dde0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xba10, 0x7125, 0x939b, 0x594a, 0xbde6 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xba100000, 0x939b7125, 0xbde6594a };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xba10000000000000, 0xbde6594a939b7125 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xbde6594a939b7125ba100000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xbde6594a939b7125ba10000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_42_1__tab[] = { 0xbde6594a939b7125ba1000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xf600, 0xada3 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f60000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f6000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_43_0__tab[] = { 0xada3f60000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_43_1__tab[] = { 0x9560, 0x2ab5, 0x9118, 0x363d, 0xbcb6 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_43_1__tab[] = { 0x95600000, 0x91182ab5, 0xbcb6363d };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_43_1__tab[] = { 0x9560000000000000, 0xbcb6363d91182ab5 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_43_1__tab[] = { 0xbcb6363d91182ab595600000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_43_1__tab[] = { 0xbcb6363d91182ab59560000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_43_1__tab[] = { 0xbcb6363d91182ab5956000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaa00, 0xaeb3 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_44_0__tab[] = { 0xaeb3aa0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_44_1__tab[] = { 0x1590, 0x4e90, 0x3a3d, 0xb859, 0xbb90 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_44_1__tab[] = { 0x15900000, 0x3a3d4e90, 0xbb90b859 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_44_1__tab[] = { 0x1590000000000000, 0xbb90b8593a3d4e90 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_44_1__tab[] = { 0xbb90b8593a3d4e9015900000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_44_1__tab[] = { 0xbb90b8593a3d4e901590000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_44_1__tab[] = { 0xbb90b8593a3d4e90159000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_45_0__tab[] = { 0x4400, 0xafbd };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd4400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd440000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd44000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd4400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_45_0__tab[] = { 0xafbd440000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_45_1__tab[] = { 0x1e78, 0x76f5, 0x1010, 0x4026, 0xba75 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_45_1__tab[] = { 0x1e780000, 0x101076f5, 0xba754026 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_45_1__tab[] = { 0x1e78000000000000, 0xba754026101076f5 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_45_1__tab[] = { 0xba754026101076f51e780000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_45_1__tab[] = { 0xba754026101076f51e78000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_45_1__tab[] = { 0xba754026101076f51e7800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_46_0__tab[] = { 0x0600, 0xb0c1 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c10600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c1060000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c106000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c10600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_46_0__tab[] = { 0xb0c1060000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb670, 0x0512, 0x69aa, 0x3b01, 0xb963 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb6700000, 0x69aa0512, 0xb9633b01 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb670000000000000, 0xb9633b0169aa0512 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb9633b0169aa0512b6700000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb9633b0169aa0512b670000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_46_1__tab[] = { 0xb9633b0169aa0512b67000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_47_0__tab[] = { 0x3200, 0xb1bf };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf3200 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf320000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf32000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf3200000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_47_0__tab[] = { 0xb1bf320000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_47_1__tab[] = { 0x5118, 0x4133, 0xfbe4, 0x21d0, 0xb85a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_47_1__tab[] = { 0x51180000, 0xfbe44133, 0xb85a21d0 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_47_1__tab[] = { 0x5118000000000000, 0xb85a21d0fbe44133 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_47_1__tab[] = { 0xb85a21d0fbe4413351180000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_47_1__tab[] = { 0xb85a21d0fbe441335118000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_47_1__tab[] = { 0xb85a21d0fbe44133511800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_48_0__tab[] = { 0x0400, 0xb2b8 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b80400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b8040000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b804000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b80400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_48_0__tab[] = { 0xb2b8040000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_48_1__tab[] = { 0x0490, 0x663d, 0x960d, 0x77de, 0xb759 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_48_1__tab[] = { 0x04900000, 0x960d663d, 0xb75977de };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_48_1__tab[] = { 0x0490000000000000, 0xb75977de960d663d };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_48_1__tab[] = { 0xb75977de960d663d04900000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_48_1__tab[] = { 0xb75977de960d663d0490000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_48_1__tab[] = { 0xb75977de960d663d049000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb400, 0xb3ab };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb40000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb4000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_49_0__tab[] = { 0xb3abb40000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_49_1__tab[] = { 0x37b8, 0xa711, 0x754d, 0xc9d6, 0xb660 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_49_1__tab[] = { 0x37b80000, 0x754da711, 0xb660c9d6 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_49_1__tab[] = { 0x37b8000000000000, 0xb660c9d6754da711 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_49_1__tab[] = { 0xb660c9d6754da71137b80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_49_1__tab[] = { 0xb660c9d6754da71137b8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_49_1__tab[] = { 0xb660c9d6754da71137b800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_50_0__tab[] = { 0x7a00, 0xb49a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_50_0__tab[] = { 0xb49a7a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_50_1__tab[] = { 0x27f0, 0xe532, 0x7344, 0xace3, 0xb56f };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_50_1__tab[] = { 0x27f00000, 0x7344e532, 0xb56face3 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_50_1__tab[] = { 0x27f0000000000000, 0xb56face37344e532 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_50_1__tab[] = { 0xb56face37344e53227f00000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_50_1__tab[] = { 0xb56face37344e53227f0000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_50_1__tab[] = { 0xb56face37344e53227f000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_51_0__tab[] = { 0x8400, 0xb584 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb5848400 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb584840000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb58484000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb5848400000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_51_0__tab[] = { 0xb584840000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_51_1__tab[] = { 0x4000, 0xe9a9, 0x0f8a, 0xbde5, 0xb485 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_51_1__tab[] = { 0x40000000, 0x0f8ae9a9, 0xb485bde5 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_51_1__tab[] = { 0x4000000000000000, 0xb485bde50f8ae9a9 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_51_1__tab[] = { 0xb485bde50f8ae9a940000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_51_1__tab[] = { 0xb485bde50f8ae9a94000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_51_1__tab[] = { 0xb485bde50f8ae9a9400000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_52_0__tab[] = { 0x0200, 0xb66a };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a0200 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a020000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a02000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a0200000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_52_0__tab[] = { 0xb66a020000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_52_1__tab[] = { 0x4608, 0xfcb3, 0xeecf, 0xa0bb, 0xb3a2 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_52_1__tab[] = { 0x46080000, 0xeecffcb3, 0xb3a2a0bb };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_52_1__tab[] = { 0x4608000000000000, 0xb3a2a0bbeecffcb3 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_52_1__tab[] = { 0xb3a2a0bbeecffcb346080000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_52_1__tab[] = { 0xb3a2a0bbeecffcb34608000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_52_1__tab[] = { 0xb3a2a0bbeecffcb3460800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_53_0__tab[] = { 0x2000, 0xb74b };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b2000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b200000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b20000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b2000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_53_0__tab[] = { 0xb74b200000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xa360, 0x8ccb, 0xeb5f, 0xffa9, 0xb2c5 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xa3600000, 0xeb5f8ccb, 0xb2c5ffa9 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xa360000000000000, 0xb2c5ffa9eb5f8ccb };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xb2c5ffa9eb5f8ccba3600000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xb2c5ffa9eb5f8ccba360000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_53_1__tab[] = { 0xb2c5ffa9eb5f8ccba36000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_54_0__tab[] = { 0x0a00, 0xb828 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_54_0__tab[] = { 0xb8280a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xf368, 0xe940, 0x3e86, 0x8ac3, 0xb1ef };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xf3680000, 0x3e86e940, 0xb1ef8ac3 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xf368000000000000, 0xb1ef8ac33e86e940 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xb1ef8ac33e86e940f3680000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xb1ef8ac33e86e940f368000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_54_1__tab[] = { 0xb1ef8ac33e86e940f36800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xe800, 0xb900 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e80000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e8000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_55_0__tab[] = { 0xb900e80000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_55_1__tab[] = { 0x7a40, 0xd18e, 0xa4b5, 0xf76e, 0xb11e };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_55_1__tab[] = { 0x7a400000, 0xa4b5d18e, 0xb11ef76e };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_55_1__tab[] = { 0x7a40000000000000, 0xb11ef76ea4b5d18e };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_55_1__tab[] = { 0xb11ef76ea4b5d18e7a400000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_55_1__tab[] = { 0xb11ef76ea4b5d18e7a40000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_55_1__tab[] = { 0xb11ef76ea4b5d18e7a4000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xda00, 0xb9d5 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_56_0__tab[] = { 0xb9d5da0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xe818, 0x4c7b, 0xaa2c, 0xfff2, 0xb053 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xe8180000, 0xaa2c4c7b, 0xb053fff2 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xe818000000000000, 0xb053fff2aa2c4c7b };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xb053fff2aa2c4c7be8180000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xb053fff2aa2c4c7be818000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_56_1__tab[] = { 0xb053fff2aa2c4c7be81800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_57_0__tab[] = { 0x0a00, 0xbaa7 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_57_0__tab[] = { 0xbaa70a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xefb0, 0x814f, 0x8e2f, 0x630e, 0xaf8e };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xefb00000, 0x8e2f814f, 0xaf8e630e };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xefb0000000000000, 0xaf8e630e8e2f814f };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xaf8e630e8e2f814fefb00000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xaf8e630e8e2f814fefb0000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_57_1__tab[] = { 0xaf8e630e8e2f814fefb000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_58_0__tab[] = { 0x9600, 0xbb74 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb749600 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb74960000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb7496000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb749600000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_58_0__tab[] = { 0xbb74960000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_58_1__tab[] = { 0x5d18, 0x41a1, 0x6114, 0xe39d, 0xaecd };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_58_1__tab[] = { 0x5d180000, 0x611441a1, 0xaecde39d };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_58_1__tab[] = { 0x5d18000000000000, 0xaecde39d611441a1 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_58_1__tab[] = { 0xaecde39d611441a15d180000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_58_1__tab[] = { 0xaecde39d611441a15d18000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_58_1__tab[] = { 0xaecde39d611441a15d1800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_59_0__tab[] = { 0x9e00, 0xbc3e };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_59_0__tab[] = { 0xbc3e9e0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xd000, 0x97df, 0x2f97, 0x4842, 0xae12 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xd0000000, 0x2f9797df, 0xae124842 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xd000000000000000, 0xae1248422f9797df };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xae1248422f9797dfd0000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xae1248422f9797dfd000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_59_1__tab[] = { 0xae1248422f9797dfd00000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_60_0__tab[] = { 0x4000, 0xbd05 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd054000 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd05400000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd0540000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd054000000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_60_0__tab[] = { 0xbd05400000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xfe58, 0x206d, 0x3555, 0x5b1c, 0xad5b };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xfe580000, 0x3555206d, 0xad5b5b1c };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xfe58000000000000, 0xad5b5b1c3555206d };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xad5b5b1c3555206dfe580000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xad5b5b1c3555206dfe58000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_60_1__tab[] = { 0xad5b5b1c3555206dfe5800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_61_0__tab[] = { 0x9a00, 0xbdc8 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a00 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a0000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a00000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_61_0__tab[] = { 0xbdc89a0000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_61_1__tab[] = { 0x4df8, 0x7757, 0x31cb, 0xe982, 0xaca8 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_61_1__tab[] = { 0x4df80000, 0x31cb7757, 0xaca8e982 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_61_1__tab[] = { 0x4df8000000000000, 0xaca8e98231cb7757 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_61_1__tab[] = { 0xaca8e98231cb77574df80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_61_1__tab[] = { 0xaca8e98231cb77574df8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_61_1__tab[] = { 0xaca8e98231cb77574df800000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xc800, 0xbe88 };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c800 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c80000000000 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c8000000000000000000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c800000000000000000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_62_0__tab[] = { 0xbe88c80000000000000000000000000000000000000000000000000000000000 };
+#endif
+
+#if 0
+#elif GMP_NUMB_BITS == 16
+const mp_limb_t mpfr_l2b_62_1__tab[] = { 0x74f8, 0xf905, 0x1831, 0xc3c4, 0xabfa };
+#elif GMP_NUMB_BITS == 32
+const mp_limb_t mpfr_l2b_62_1__tab[] = { 0x74f80000, 0x1831f905, 0xabfac3c4 };
+#elif GMP_NUMB_BITS == 64
+const mp_limb_t mpfr_l2b_62_1__tab[] = { 0x74f8000000000000, 0xabfac3c41831f905 };
+#elif GMP_NUMB_BITS == 96
+const mp_limb_t mpfr_l2b_62_1__tab[] = { 0xabfac3c41831f90574f80000 };
+#elif GMP_NUMB_BITS == 128
+const mp_limb_t mpfr_l2b_62_1__tab[] = { 0xabfac3c41831f90574f8000000000000 };
+#elif GMP_NUMB_BITS == 256
+const mp_limb_t mpfr_l2b_62_1__tab[] = { 0xabfac3c41831f90574f800000000000000000000000000000000000000000000 };
+#endif
+
+const __mpfr_struct __gmpfr_l2b[BASE_MAX-1][2] = {
+ { { 23, 1, 1, (mp_limb_t *) mpfr_l2b_2_0__tab },
+ { 77, 1, 1, (mp_limb_t *) mpfr_l2b_2_1__tab } },
+ { { 23, 1, 1, (mp_limb_t *) mpfr_l2b_3_0__tab },
+ { 77, 1, 0, (mp_limb_t *) mpfr_l2b_3_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_4_0__tab },
+ { 77, 1, 0, (mp_limb_t *) mpfr_l2b_4_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_5_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_5_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_6_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_6_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_7_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_7_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_8_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_8_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_9_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_9_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_10_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_10_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_11_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_11_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_12_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_12_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_13_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_13_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_14_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_14_1__tab } },
+ { { 23, 1, 2, (mp_limb_t *) mpfr_l2b_15_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_15_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_16_0__tab },
+ { 77, 1, -1, (mp_limb_t *) mpfr_l2b_16_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_17_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_17_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_18_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_18_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_19_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_19_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_20_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_20_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_21_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_21_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_22_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_22_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_23_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_23_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_24_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_24_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_25_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_25_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_26_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_26_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_27_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_27_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_28_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_28_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_29_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_29_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_30_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_30_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_31_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_31_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_32_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_32_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_33_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_33_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_34_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_34_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_35_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_35_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_36_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_36_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_37_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_37_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_38_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_38_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_39_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_39_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_40_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_40_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_41_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_41_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_42_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_42_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_43_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_43_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_44_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_44_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_45_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_45_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_46_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_46_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_47_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_47_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_48_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_48_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_49_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_49_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_50_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_50_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_51_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_51_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_52_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_52_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_53_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_53_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_54_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_54_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_55_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_55_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_56_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_56_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_57_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_57_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_58_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_58_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_59_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_59_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_60_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_60_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_61_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_61_1__tab } },
+ { { 23, 1, 3, (mp_limb_t *) mpfr_l2b_62_0__tab },
+ { 77, 1, -2, (mp_limb_t *) mpfr_l2b_62_1__tab } } };
+
+/***************************************************************************/
+
+/* returns ceil(e * log2(b)^((-1)^i)), or ... + 1.
+ For i=0, uses a 23-bit upper approximation to log(beta)/log(2).
+ For i=1, uses a 76-bit upper approximation to log(2)/log(beta).
+ Note: this function should be called only in the extended exponent range.
+*/
+mpfr_exp_t
+mpfr_ceil_mul (mpfr_exp_t e, int beta, int i)
+{
+ mpfr_srcptr p;
+ mpfr_t t;
+ mpfr_exp_t r;
+
+ p = &__gmpfr_l2b[beta-2][i];
+ mpfr_init2 (t, sizeof (mpfr_exp_t) * CHAR_BIT);
+ mpfr_set_exp_t (t, e, MPFR_RNDU);
+ mpfr_mul (t, t, p, MPFR_RNDU);
+ r = mpfr_get_exp_t (t, MPFR_RNDU);
+ mpfr_clear (t);
+ return r;
+}
+
+/* prints the mantissa of x in the string s, and writes the corresponding
+ exponent in e.
+ x is rounded with direction rnd, m is the number of digits of the mantissa,
+ b is the given base (2 <= b <= 62).
+
+ Return value:
+ if s=NULL, allocates a string to store the mantissa, with
+ m characters, plus a final '\0', plus a possible minus sign
+ (thus m+1 or m+2 characters).
+
+ Important: when you call this function with s=NULL, don't forget to free
+ the memory space allocated, with free(s, strlen(s)).
+*/
+char*
+mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ const char *num_to_text;
+ int exact; /* exact result */
+ mpfr_exp_t exp, g;
+ mpfr_exp_t prec; /* precision of the computation */
+ long err;
+ mp_limb_t *a;
+ mpfr_exp_t exp_a;
+ mp_limb_t *result;
+ mp_limb_t *xp;
+ mp_limb_t *reste;
+ size_t nx, nx1;
+ size_t n, i;
+ char *s0;
+ int neg;
+ int ret; /* return value of mpfr_get_str_aux */
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_TMP_DECL(marker);
+
+ /* if exact = 1 then err is undefined */
+ /* otherwise err is such that |x*b^(m-g)-a*2^exp_a| < 2^(err+exp_a) */
+
+ /* is the base valid? */
+ if (b < 2 || b > 62)
+ return NULL;
+
+ num_to_text = b < 37 ? num_to_text36 : num_to_text62;
+
+ if (MPFR_UNLIKELY (MPFR_IS_NAN (x)))
+ {
+ if (s == NULL)
+ s = (char *) (*__gmp_allocate_func) (6);
+ strcpy (s, "@NaN@");
+ return s;
+ }
+
+ neg = MPFR_SIGN(x) < 0; /* 0 if positive, 1 if negative */
+
+ if (MPFR_UNLIKELY (MPFR_IS_INF (x)))
+ {
+ if (s == NULL)
+ s = (char *) (*__gmp_allocate_func) (neg + 6);
+ strcpy (s, (neg) ? "-@Inf@" : "@Inf@");
+ return s;
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo); /* needed for mpfr_ceil_mul (at least) */
+
+ if (m == 0)
+ {
+
+ /* take at least 1 + ceil(n*log(2)/log(b)) digits, where n is the
+ number of bits of the mantissa, to ensure back conversion from
+ the output gives the same floating-point.
+
+ Warning: if b = 2^k, this may be too large. The worst case is when
+ the first base-b digit contains only one bit, so we get
+ 1 + ceil((n-1)/k) = 2 + floor((n-2)/k) instead.
+ */
+ m = 1 +
+ mpfr_ceil_mul (IS_POW2(b) ? MPFR_PREC(x) - 1 : MPFR_PREC(x), b, 1);
+ if (m < 2)
+ m = 2;
+ }
+
+ /* the code below for non-power-of-two bases works for m=1 */
+ MPFR_ASSERTN (m >= 2 || (IS_POW2(b) == 0 && m >= 1));
+
+ /* x is a floating-point number */
+
+ if (MPFR_IS_ZERO(x))
+ {
+ if (s == NULL)
+ s = (char*) (*__gmp_allocate_func) (neg + m + 1);
+ s0 = s;
+ if (neg)
+ *s++ = '-';
+ memset (s, '0', m);
+ s[m] = '\0';
+ *e = 0; /* a bit like frexp() in ISO C99 */
+ MPFR_SAVE_EXPO_FREE (expo);
+ return s0; /* strlen(s0) = neg + m */
+ }
+
+ if (s == NULL)
+ s = (char*) (*__gmp_allocate_func) (neg + m + 1);
+ s0 = s;
+ if (neg)
+ *s++ = '-';
+
+ xp = MPFR_MANT(x);
+
+ if (IS_POW2(b))
+ {
+ int pow2;
+ mpfr_exp_t f, r;
+ mp_limb_t *x1;
+ mp_size_t nb;
+ int inexp;
+
+ count_leading_zeros (pow2, (mp_limb_t) b);
+ pow2 = GMP_NUMB_BITS - pow2 - 1; /* base = 2^pow2 */
+
+ /* set MPFR_EXP(x) = f*pow2 + r, 1 <= r <= pow2 */
+ f = (MPFR_GET_EXP (x) - 1) / pow2;
+ r = MPFR_GET_EXP (x) - f * pow2;
+ if (r <= 0)
+ {
+ f --;
+ r += pow2;
+ }
+
+ /* the first digit will contain only r bits */
+ prec = (m - 1) * pow2 + r; /* total number of bits */
+ n = MPFR_PREC2LIMBS (prec);
+
+ MPFR_TMP_MARK (marker);
+ x1 = MPFR_TMP_LIMBS_ALLOC (n + 1);
+ nb = n * GMP_NUMB_BITS - prec;
+ /* round xp to the precision prec, and put it into x1
+ put the carry into x1[n] */
+ if ((x1[n] = mpfr_round_raw (x1, xp, MPFR_PREC(x),
+ MPFR_IS_STRICTNEG(x),
+ prec, rnd, &inexp)))
+ {
+ /* overflow when rounding x: x1 = 2^prec */
+ if (r == pow2) /* prec = m * pow2,
+ 2^prec will need (m+1) digits in base 2^pow2 */
+ {
+ /* divide x1 by 2^pow2, and increase the exponent */
+ mpn_rshift (x1, x1, n + 1, pow2);
+ f ++;
+ }
+ else /* 2^prec needs still m digits, but x1 may need n+1 limbs */
+ n ++;
+ }
+
+ /* it remains to shift x1 by nb limbs to the right, since mpn_get_str
+ expects a right-normalized number */
+ if (nb != 0)
+ {
+ mpn_rshift (x1, x1, n, nb);
+ /* the most significant word may be zero */
+ if (x1[n - 1] == 0)
+ n --;
+ }
+
+ mpn_get_str ((unsigned char*) s, b, x1, n);
+ for (i=0; i<m; i++)
+ s[i] = num_to_text[(int) s[i]];
+ s[m] = 0;
+
+ /* the exponent of s is f + 1 */
+ *e = f + 1;
+
+ MPFR_TMP_FREE(marker);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return (s0);
+ }
+
+ /* if x < 0, reduce to x > 0 */
+ if (neg)
+ rnd = MPFR_INVERT_RND(rnd);
+
+ g = mpfr_ceil_mul (MPFR_GET_EXP (x) - 1, b, 1);
+ exact = 1;
+ prec = mpfr_ceil_mul (m, b, 0) + 1;
+ exp = ((mpfr_exp_t) m < g) ? g - (mpfr_exp_t) m : (mpfr_exp_t) m - g;
+ prec += MPFR_INT_CEIL_LOG2 (prec); /* number of guard bits */
+ if (exp != 0) /* add maximal exponentiation error */
+ prec += 3 * (mpfr_exp_t) MPFR_INT_CEIL_LOG2 (exp);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ MPFR_TMP_MARK(marker);
+
+ exact = 1;
+
+ /* number of limbs */
+ n = MPFR_PREC2LIMBS (prec);
+
+ /* a will contain the approximation of the mantissa */
+ a = MPFR_TMP_LIMBS_ALLOC (n);
+
+ nx = MPFR_LIMB_SIZE (x);
+
+ if ((mpfr_exp_t) m == g) /* final exponent is 0, no multiplication or
+ division to perform */
+ {
+ if (nx > n)
+ exact = mpn_scan1 (xp, 0) >= (nx - n) * GMP_NUMB_BITS;
+ err = !exact;
+ MPN_COPY2 (a, n, xp, nx);
+ exp_a = MPFR_GET_EXP (x) - n * GMP_NUMB_BITS;
+ }
+ else if ((mpfr_exp_t) m > g) /* we have to multiply x by b^exp */
+ {
+ mp_limb_t *x1;
+
+ /* a2*2^exp_a = b^e */
+ err = mpfr_mpn_exp (a, &exp_a, b, exp, n);
+ /* here, the error on a is at most 2^err ulps */
+ exact = (err == -1);
+
+ /* x = x1*2^(n*GMP_NUMB_BITS) */
+ x1 = (nx >= n) ? xp + nx - n : xp;
+ nx1 = (nx >= n) ? n : nx; /* nx1 = min(n, nx) */
+
+ /* test si exact */
+ if (nx > n)
+ exact = (exact &&
+ ((mpn_scan1 (xp, 0) >= (nx - n) * GMP_NUMB_BITS)));
+
+ /* we loose one more bit in the multiplication,
+ except when err=0 where we loose two bits */
+ err = (err <= 0) ? 2 : err + 1;
+
+ /* result = a * x */
+ result = MPFR_TMP_LIMBS_ALLOC (n + nx1);
+ mpn_mul (result, a, n, x1, nx1);
+ exp_a += MPFR_GET_EXP (x);
+ if (mpn_scan1 (result, 0) < (nx1 * GMP_NUMB_BITS))
+ exact = 0;
+
+ /* normalize a and truncate */
+ if ((result[n + nx1 - 1] & MPFR_LIMB_HIGHBIT) == 0)
+ {
+ mpn_lshift (a, result + nx1, n , 1);
+ a[0] |= result[nx1 - 1] >> (GMP_NUMB_BITS - 1);
+ exp_a --;
+ }
+ else
+ MPN_COPY (a, result + nx1, n);
+ }
+ else
+ {
+ mp_limb_t *x1;
+
+ /* a2*2^exp_a = b^e */
+ err = mpfr_mpn_exp (a, &exp_a, b, exp, n);
+ exact = (err == -1);
+
+ /* allocate memory for x1, result and reste */
+ x1 = MPFR_TMP_LIMBS_ALLOC (2 * n);
+ result = MPFR_TMP_LIMBS_ALLOC (n + 1);
+ reste = MPFR_TMP_LIMBS_ALLOC (n);
+
+ /* initialize x1 = x */
+ MPN_COPY2 (x1, 2 * n, xp, nx);
+ if ((exact) && (nx > 2 * n) &&
+ (mpn_scan1 (xp, 0) < (nx - 2 * n) * GMP_NUMB_BITS))
+ exact = 0;
+
+ /* result = x / a */
+ mpn_tdiv_qr (result, reste, 0, x1, 2 * n, a, n);
+ exp_a = MPFR_GET_EXP (x) - exp_a - 2 * n * GMP_NUMB_BITS;
+
+ /* test if division was exact */
+ if (exact)
+ exact = mpn_popcount (reste, n) == 0;
+
+ /* normalize the result and copy into a */
+ if (result[n] == 1)
+ {
+ mpn_rshift (a, result, n, 1);
+ a[n - 1] |= MPFR_LIMB_HIGHBIT;;
+ exp_a ++;
+ }
+ else
+ MPN_COPY (a, result, n);
+
+ err = (err == -1) ? 2 : err + 2;
+ }
+
+ /* check if rounding is possible */
+ if (exact)
+ err = -1;
+ ret = mpfr_get_str_aux (s, e, a, n, exp_a, err, b, m, rnd);
+ if (ret == MPFR_ROUND_FAILED)
+ {
+ /* too large error: increment the working precision */
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ else if (ret == -MPFR_ROUND_FAILED)
+ {
+ /* too many digits in mantissa: exp = |m-g| */
+ if ((mpfr_exp_t) m > g) /* exp = m - g, multiply by b^exp */
+ {
+ g++;
+ exp --;
+ }
+ else /* exp = g - m, divide by b^exp */
+ {
+ g++;
+ exp ++;
+ }
+ }
+ else
+ break;
+
+ MPFR_TMP_FREE(marker);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ *e += g;
+
+ MPFR_TMP_FREE(marker);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return s0;
+}
+
+void mpfr_free_str (char *str)
+{
+ (*__gmp_free_func) (str, strlen (str) + 1);
+}
diff --git a/src/get_ui.c b/src/get_ui.c
new file mode 100644
index 0000000..d7b11fe
--- /dev/null
+++ b/src/get_ui.c
@@ -0,0 +1,65 @@
+/* mpfr_get_ui -- convert a floating-point number to an unsigned long.
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+unsigned long
+mpfr_get_ui (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t prec;
+ unsigned long s;
+ mpfr_t x;
+ mp_size_t n;
+ mpfr_exp_t exp;
+
+ if (MPFR_UNLIKELY (!mpfr_fits_ulong_p (f, rnd)))
+ {
+ MPFR_SET_ERANGE ();
+ return MPFR_IS_NAN (f) || MPFR_IS_NEG (f) ?
+ (unsigned long) 0 : ULONG_MAX;
+ }
+
+ if (MPFR_IS_ZERO (f))
+ return (unsigned long) 0;
+
+ for (s = ULONG_MAX, prec = 0; s != 0; s /= 2, prec ++)
+ { }
+
+ /* first round to prec bits */
+ mpfr_init2 (x, prec);
+ mpfr_rint (x, f, rnd);
+
+ /* warning: if x=0, taking its exponent is illegal */
+ if (MPFR_IS_ZERO(x))
+ s = 0;
+ else
+ {
+ /* now the result is in the most significant limb of x */
+ exp = MPFR_GET_EXP (x); /* since |x| >= 1, exp >= 1 */
+ n = MPFR_LIMB_SIZE(x);
+ s = MPFR_MANT(x)[n - 1] >> (GMP_NUMB_BITS - exp);
+ }
+
+ mpfr_clear (x);
+
+ return s;
+}
diff --git a/src/get_uj.c b/src/get_uj.c
new file mode 100644
index 0000000..4f085b4
--- /dev/null
+++ b/src/get_uj.c
@@ -0,0 +1,82 @@
+/* mpfr_get_uj -- convert a MPFR number to a huge machine unsigned integer
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+uintmax_t
+mpfr_get_uj (mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ uintmax_t r;
+ mpfr_prec_t prec;
+ mpfr_t x;
+
+ if (MPFR_UNLIKELY (!mpfr_fits_uintmax_p (f, rnd)))
+ {
+ MPFR_SET_ERANGE ();
+ return MPFR_IS_NAN (f) || MPFR_IS_NEG (f) ?
+ (uintmax_t) 0 : MPFR_UINTMAX_MAX;
+ }
+
+ if (MPFR_IS_ZERO (f))
+ return (uintmax_t) 0;
+
+ /* determine the precision of uintmax_t */
+ for (r = MPFR_UINTMAX_MAX, prec = 0; r != 0; r /= 2, prec++)
+ { }
+
+ /* Now, r = 0. */
+
+ mpfr_init2 (x, prec);
+ mpfr_rint (x, f, rnd);
+ MPFR_ASSERTN (MPFR_IS_FP (x));
+
+ if (MPFR_NOTZERO (x))
+ {
+ mp_limb_t *xp;
+ int sh, n; /* An int should be sufficient in this context. */
+
+ MPFR_ASSERTN (MPFR_IS_POS (x));
+ xp = MPFR_MANT (x);
+ sh = MPFR_GET_EXP (x);
+ MPFR_ASSERTN ((mpfr_prec_t) sh <= prec);
+ for (n = MPFR_LIMB_SIZE(x) - 1; n >= 0; n--)
+ {
+ sh -= GMP_NUMB_BITS;
+ r += (sh >= 0
+ ? (uintmax_t) xp[n] << sh
+ : (uintmax_t) xp[n] >> (- sh));
+ }
+ }
+
+ mpfr_clear (x);
+
+ return r;
+}
+
+#endif
diff --git a/src/get_z.c b/src/get_z.c
new file mode 100644
index 0000000..13a2e99
--- /dev/null
+++ b/src/get_z.c
@@ -0,0 +1,61 @@
+/* mpfr_get_z -- get a multiple-precision integer from
+ a floating-point number
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_get_z (mpz_ptr z, mpfr_srcptr f, mpfr_rnd_t rnd)
+{
+ int inex;
+ mpfr_t r;
+ mpfr_exp_t exp;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
+ {
+ if (MPFR_UNLIKELY (MPFR_NOTZERO (f)))
+ MPFR_SET_ERANGE ();
+ mpz_set_ui (z, 0);
+ /* The ternary value is 0 even for infinity. Giving the rounding
+ direction in this case would not make much sense anyway, and
+ the direction would not necessarily match rnd. */
+ return 0;
+ }
+
+ exp = MPFR_GET_EXP (f);
+ /* if exp <= 0, then |f|<1, thus |o(f)|<=1 */
+ MPFR_ASSERTN (exp < 0 || exp <= MPFR_PREC_MAX);
+ mpfr_init2 (r, (exp < (mpfr_exp_t) MPFR_PREC_MIN ?
+ MPFR_PREC_MIN : (mpfr_prec_t) exp));
+ inex = mpfr_rint (r, f, rnd);
+ MPFR_ASSERTN (inex != 1 && inex != -1); /* integral part of f is
+ representable in r */
+ MPFR_ASSERTN (MPFR_IS_FP (r));
+ exp = mpfr_get_z_2exp (z, r);
+ if (exp >= 0)
+ mpz_mul_2exp (z, z, exp);
+ else
+ mpz_fdiv_q_2exp (z, z, -exp);
+ mpfr_clear (r);
+
+ return inex;
+}
diff --git a/src/get_z_exp.c b/src/get_z_exp.c
new file mode 100644
index 0000000..30a5f18
--- /dev/null
+++ b/src/get_z_exp.c
@@ -0,0 +1,79 @@
+/* mpfr_get_z_2exp -- get a multiple-precision integer and an exponent
+ from a floating-point number
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* puts the significand of f into z, and returns 'exp' such that f = z * 2^exp
+ *
+ * 0 doesn't have an exponent, therefore the returned exponent in this case
+ * isn't really important. We choose to return __gmpfr_emin because
+ * 1) it is in the exponent range [__gmpfr_emin,__gmpfr_emax],
+ * 2) the smaller a number is (in absolute value), the smaller its
+ * exponent is. In other words, the f -> exp function is monotonous
+ * on nonnegative numbers. --> This is WRONG since the returned
+ * exponent is not necessarily in the exponent range!
+ * Note that this is different from the C function frexp().
+ *
+ * For NaN and infinities, we choose to set z = 0 (neutral value).
+ * The exponent doesn't really matter, so let's keep __gmpfr_emin
+ * for consistency. The erange flag is set.
+ */
+
+mpfr_exp_t
+mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f)
+{
+ mp_size_t fn;
+ int sh;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
+ {
+ if (MPFR_UNLIKELY (MPFR_NOTZERO (f)))
+ MPFR_SET_ERANGE ();
+ mpz_set_ui (z, 0);
+ return __gmpfr_emin;
+ }
+
+ fn = MPFR_LIMB_SIZE(f);
+
+ /* check whether allocated space for z is enough */
+ if (MPFR_UNLIKELY (ALLOC (z) < fn))
+ MPZ_REALLOC (z, fn);
+
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (f));
+ if (MPFR_LIKELY (sh))
+ mpn_rshift (PTR (z), MPFR_MANT (f), fn, sh);
+ else
+ MPN_COPY (PTR (z), MPFR_MANT (f), fn);
+
+ SIZ(z) = MPFR_IS_NEG (f) ? -fn : fn;
+
+ if (MPFR_UNLIKELY ((mpfr_uexp_t) MPFR_GET_EXP (f) - MPFR_EXP_MIN
+ < (mpfr_uexp_t) MPFR_PREC (f)))
+ {
+ /* The exponent isn't representable in an mpfr_exp_t. */
+ MPFR_SET_ERANGE ();
+ return MPFR_EXP_MIN;
+ }
+
+ return MPFR_GET_EXP (f) - MPFR_PREC (f);
+}
diff --git a/src/gmp_op.c b/src/gmp_op.c
new file mode 100644
index 0000000..769cd03
--- /dev/null
+++ b/src/gmp_op.c
@@ -0,0 +1,489 @@
+/* Implementations of operations between mpfr and mpz/mpq data
+
+Copyright 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Init and set a mpfr_t with enough precision to store a mpz.
+ This function should be called in the extended exponent range. */
+static void
+init_set_z (mpfr_ptr t, mpz_srcptr z)
+{
+ mpfr_prec_t p;
+ int i;
+
+ if (mpz_size (z) <= 1)
+ p = GMP_NUMB_BITS;
+ else
+ MPFR_MPZ_SIZEINBASE2 (p, z);
+ mpfr_init2 (t, p);
+ i = mpfr_set_z (t, z, MPFR_RNDN);
+ /* Possible assertion failure in case of overflow. Such cases,
+ which imply that z is huge (if the function is called in
+ the extended exponent range), are currently not supported,
+ just like precisions around MPFR_PREC_MAX. */
+ MPFR_ASSERTN (i == 0); (void) i; /* use i to avoid a warning */
+}
+
+/* Init, set a mpfr_t with enough precision to store a mpz_t without round,
+ call the function, and clear the allocated mpfr_t */
+static int
+foo (mpfr_ptr x, mpfr_srcptr y, mpz_srcptr z, mpfr_rnd_t r,
+ int (*f)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t))
+{
+ mpfr_t t;
+ int i;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ init_set_z (t, z); /* There should be no exceptions. */
+ i = (*f) (x, y, t, r);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (x, i, r);
+}
+
+static int
+foo2 (mpfr_ptr x, mpz_srcptr y, mpfr_srcptr z, mpfr_rnd_t r,
+ int (*f)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t))
+{
+ mpfr_t t;
+ int i;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ init_set_z (t, y); /* There should be no exceptions. */
+ i = (*f) (x, t, z, r);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (x, i, r);
+}
+
+int
+mpfr_mul_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r)
+{
+ return foo (y, x, z, r, mpfr_mul);
+}
+
+int
+mpfr_div_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r)
+{
+ return foo (y, x, z, r, mpfr_div);
+}
+
+int
+mpfr_add_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r)
+{
+ /* Mpz 0 is unsigned */
+ if (MPFR_UNLIKELY (mpz_sgn (z) == 0))
+ return mpfr_set (y, x, r);
+ else
+ return foo (y, x, z, r, mpfr_add);
+}
+
+int
+mpfr_sub_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t r)
+{
+ /* Mpz 0 is unsigned */
+ if (MPFR_UNLIKELY (mpz_sgn (z) == 0))
+ return mpfr_set (y, x, r);
+ else
+ return foo (y, x, z, r, mpfr_sub);
+}
+
+int
+mpfr_z_sub (mpfr_ptr y, mpz_srcptr x, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ /* Mpz 0 is unsigned */
+ if (MPFR_UNLIKELY (mpz_sgn (x) == 0))
+ return mpfr_neg (y, z, r);
+ else
+ return foo2 (y, x, z, r, mpfr_sub);
+}
+
+int
+mpfr_cmp_z (mpfr_srcptr x, mpz_srcptr z)
+{
+ mpfr_t t;
+ int res;
+ mpfr_prec_t p;
+ unsigned int flags;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_cmp_si (x, mpz_sgn (z));
+
+ if (mpz_size (z) <= 1)
+ p = GMP_NUMB_BITS;
+ else
+ MPFR_MPZ_SIZEINBASE2 (p, z);
+ mpfr_init2 (t, p);
+ flags = __gmpfr_flags;
+ if (mpfr_set_z (t, z, MPFR_RNDN))
+ {
+ /* overflow (t is an infinity) or underflow */
+ mpfr_div_2ui (t, t, 2, MPFR_RNDZ); /* if underflow, set t to zero */
+ __gmpfr_flags = flags; /* restore the flags */
+ /* The real value of t (= z), which falls outside the exponent range,
+ has been replaced by an equivalent value for the comparison: zero
+ or an infinity. */
+ }
+ res = mpfr_cmp (x, t);
+ mpfr_clear (t);
+ return res;
+}
+
+/* Compute y = RND(x*n/d), where n and d are mpz integers.
+ An integer 0 is assumed to have a positive sign.
+ This function is used by mpfr_mul_q and mpfr_div_q.
+ Note: the status of the rational 0/(-1) is not clear (if there is
+ a signed infinity, there should be a signed zero). But infinities
+ are not currently supported/documented in GMP, and if the rational
+ is canonicalized as it should be, the case 0/(-1) cannot occur. */
+static int
+mpfr_muldiv_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr n, mpz_srcptr d,
+ mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_UNLIKELY (mpz_sgn (n) == 0))
+ {
+ if (MPFR_UNLIKELY (mpz_sgn (d) == 0))
+ MPFR_SET_NAN (y);
+ else
+ {
+ mpfr_mul_ui (y, x, 0, MPFR_RNDN); /* exact: +0, -0 or NaN */
+ if (MPFR_UNLIKELY (mpz_sgn (d) < 0))
+ MPFR_CHANGE_SIGN (y);
+ }
+ return 0;
+ }
+ else if (MPFR_UNLIKELY (mpz_sgn (d) == 0))
+ {
+ mpfr_div_ui (y, x, 0, MPFR_RNDN); /* exact: +Inf, -Inf or NaN */
+ if (MPFR_UNLIKELY (mpz_sgn (n) < 0))
+ MPFR_CHANGE_SIGN (y);
+ return 0;
+ }
+ else
+ {
+ mpfr_prec_t p;
+ mpfr_t tmp;
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* With the current MPFR code, using mpfr_mul_z and mpfr_div_z
+ for the general case should be faster than doing everything
+ in mpn, mpz and/or mpq. MPFR_SAVE_EXPO_MARK could be avoided
+ here, but it would be more difficult to handle corner cases. */
+ MPFR_MPZ_SIZEINBASE2 (p, n);
+ mpfr_init2 (tmp, MPFR_PREC (x) + p);
+ inexact = mpfr_mul_z (tmp, x, n, MPFR_RNDN);
+ /* Since |n| >= 1, an underflow is not possible. And the precision of
+ tmp has been chosen so that inexact != 0 iff there's an overflow. */
+ if (MPFR_UNLIKELY (inexact != 0))
+ {
+ mpfr_t x0;
+ mpfr_exp_t ex;
+ MPFR_BLOCK_DECL (flags);
+
+ /* intermediate overflow case */
+ MPFR_ASSERTD (mpfr_inf_p (tmp));
+ ex = MPFR_GET_EXP (x); /* x is a pure FP number */
+ MPFR_ALIAS (x0, x, MPFR_SIGN(x), 0); /* x0 = x / 2^ex */
+ MPFR_BLOCK (flags,
+ inexact = mpfr_mul_z (tmp, x0, n, MPFR_RNDN);
+ MPFR_ASSERTD (inexact == 0);
+ inexact = mpfr_div_z (y, tmp, d, rnd_mode);
+ /* Just in case the division underflows
+ (highly unlikely, not supported)... */
+ MPFR_ASSERTN (!MPFR_BLOCK_EXCEP));
+ MPFR_EXP (y) += ex;
+ /* Detect highly unlikely, not supported corner cases... */
+ MPFR_ASSERTN (MPFR_EXP (y) >= __gmpfr_emin && MPFR_IS_PURE_FP (y));
+ /* The potential overflow will be detected by mpfr_check_range. */
+ }
+ else
+ inexact = mpfr_div_z (y, tmp, d, rnd_mode);
+
+ mpfr_clear (tmp);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+}
+
+int
+mpfr_mul_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_muldiv_z (y, x, mpq_numref (z), mpq_denref (z), rnd_mode);
+}
+
+int
+mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_muldiv_z (y, x, mpq_denref (z), mpq_numref (z), rnd_mode);
+}
+
+int
+mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t,q;
+ mpfr_prec_t p;
+ mpfr_exp_t err;
+ int res;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ if (MPFR_UNLIKELY (mpz_sgn (mpq_denref (z)) == 0 &&
+ MPFR_MULT_SIGN (mpz_sgn (mpq_numref (z)),
+ MPFR_SIGN (x)) <= 0))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ if (MPFR_UNLIKELY (mpq_sgn (z) == 0))
+ return mpfr_set (y, x, rnd_mode); /* signed 0 - Unsigned 0 */
+ else
+ return mpfr_set_q (y, z, rnd_mode);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ p = MPFR_PREC (y) + 10;
+ mpfr_init2 (t, p);
+ mpfr_init2 (q, p);
+
+ MPFR_ZIV_INIT (loop, p);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ res = mpfr_set_q (q, z, MPFR_RNDN); /* Error <= 1/2 ulp(q) */
+ /* If z if @INF@ (1/0), res = 0, so it quits immediately */
+ if (MPFR_UNLIKELY (res == 0))
+ /* Result is exact so we can add it directly! */
+ {
+ res = mpfr_add (y, x, q, rnd_mode);
+ break;
+ }
+ MPFR_BLOCK (flags, mpfr_add (t, x, q, MPFR_RNDN));
+ /* Error on t is <= 1/2 ulp(t), except in case of overflow/underflow,
+ but such an exception is very unlikely as it would be possible
+ only if q has a huge numerator or denominator. Not supported! */
+ MPFR_ASSERTN (! (MPFR_OVERFLOW (flags) || MPFR_UNDERFLOW (flags)));
+ /* Error / ulp(t) <= 1/2 + 1/2 * 2^(EXP(q)-EXP(t))
+ If EXP(q)-EXP(t)>0, <= 2^(EXP(q)-EXP(t)-1)*(1+2^-(EXP(q)-EXP(t)))
+ <= 2^(EXP(q)-EXP(t))
+ If EXP(q)-EXP(t)<0, <= 2^0 */
+ /* We can get 0, but we can't round since q is inexact */
+ if (MPFR_LIKELY (!MPFR_IS_ZERO (t)))
+ {
+ err = (mpfr_exp_t) p - 1 - MAX (MPFR_GET_EXP(q)-MPFR_GET_EXP(t), 0);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, MPFR_PREC (y), rnd_mode)))
+ {
+ res = mpfr_set (y, t, rnd_mode);
+ break;
+ }
+ }
+ MPFR_ZIV_NEXT (loop, p);
+ mpfr_set_prec (t, p);
+ mpfr_set_prec (q, p);
+ }
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ mpfr_clear (q);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, res, rnd_mode);
+}
+
+int
+mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t,q;
+ mpfr_prec_t p;
+ int res;
+ mpfr_exp_t err;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ if (MPFR_UNLIKELY (mpz_sgn (mpq_denref (z)) == 0 &&
+ MPFR_MULT_SIGN (mpz_sgn (mpq_numref (z)),
+ MPFR_SIGN (x)) >= 0))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+
+ if (MPFR_UNLIKELY (mpq_sgn (z) == 0))
+ return mpfr_set (y, x, rnd_mode); /* signed 0 - Unsigned 0 */
+ else
+ {
+ res = mpfr_set_q (y, z, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ return -res;
+ }
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ p = MPFR_PREC (y) + 10;
+ mpfr_init2 (t, p);
+ mpfr_init2 (q, p);
+
+ MPFR_ZIV_INIT (loop, p);
+ for(;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ res = mpfr_set_q(q, z, MPFR_RNDN); /* Error <= 1/2 ulp(q) */
+ /* If z if @INF@ (1/0), res = 0, so it quits immediately */
+ if (MPFR_UNLIKELY (res == 0))
+ /* Result is exact so we can add it directly!*/
+ {
+ res = mpfr_sub (y, x, q, rnd_mode);
+ break;
+ }
+ MPFR_BLOCK (flags, mpfr_sub (t, x, q, MPFR_RNDN));
+ /* Error on t is <= 1/2 ulp(t), except in case of overflow/underflow,
+ but such an exception is very unlikely as it would be possible
+ only if q has a huge numerator or denominator. Not supported! */
+ MPFR_ASSERTN (! (MPFR_OVERFLOW (flags) || MPFR_UNDERFLOW (flags)));
+ /* Error / ulp(t) <= 1/2 + 1/2 * 2^(EXP(q)-EXP(t))
+ If EXP(q)-EXP(t)>0, <= 2^(EXP(q)-EXP(t)-1)*(1+2^-(EXP(q)-EXP(t)))
+ <= 2^(EXP(q)-EXP(t))
+ If EXP(q)-EXP(t)<0, <= 2^0 */
+ /* We can get 0, but we can't round since q is inexact */
+ if (MPFR_LIKELY (!MPFR_IS_ZERO (t)))
+ {
+ err = (mpfr_exp_t) p - 1 - MAX (MPFR_GET_EXP(q)-MPFR_GET_EXP(t), 0);
+ res = MPFR_CAN_ROUND (t, err, MPFR_PREC (y), rnd_mode);
+ if (MPFR_LIKELY (res != 0)) /* We can round! */
+ {
+ res = mpfr_set (y, t, rnd_mode);
+ break;
+ }
+ }
+ MPFR_ZIV_NEXT (loop, p);
+ mpfr_set_prec (t, p);
+ mpfr_set_prec (q, p);
+ }
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ mpfr_clear (q);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, res, rnd_mode);
+}
+
+int
+mpfr_cmp_q (mpfr_srcptr x, mpq_srcptr q)
+{
+ mpfr_t t;
+ int res;
+ mpfr_prec_t p;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ if (MPFR_UNLIKELY (mpq_denref (q) == 0))
+ {
+ /* q is an infinity or NaN */
+ mpfr_init2 (t, 2);
+ mpfr_set_q (t, q, MPFR_RNDN);
+ res = mpfr_cmp (x, t);
+ mpfr_clear (t);
+ return res;
+ }
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_cmp_si (x, mpq_sgn (q));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* x < a/b ? <=> x*b < a */
+ MPFR_MPZ_SIZEINBASE2 (p, mpq_denref (q));
+ mpfr_init2 (t, MPFR_PREC(x) + p);
+ res = mpfr_mul_z (t, x, mpq_denref (q), MPFR_RNDN);
+ MPFR_ASSERTD (res == 0);
+ res = mpfr_cmp_z (t, mpq_numref (q));
+ mpfr_clear (t);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return res;
+}
+
+int
+mpfr_cmp_f (mpfr_srcptr x, mpf_srcptr z)
+{
+ mpfr_t t;
+ int res;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_cmp_si (x, mpf_sgn (z));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (t, MPFR_PREC_MIN + ABS(SIZ(z)) * GMP_NUMB_BITS );
+ res = mpfr_set_f (t, z, MPFR_RNDN);
+ MPFR_ASSERTD (res == 0);
+ res = mpfr_cmp (x, t);
+ mpfr_clear (t);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return res;
+}
diff --git a/src/grandom.c b/src/grandom.c
new file mode 100644
index 0000000..f3aead3
--- /dev/null
+++ b/src/grandom.c
@@ -0,0 +1,198 @@
+/* mpfr_grandom (rop1, rop2, state, rnd_mode) -- Generate up to two
+ pseudorandom real numbers according to a standard normal gaussian
+ distribution and round it to the precision of rop1, rop2 according
+ to the given rounding mode.
+
+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+/* #define MPFR_NEED_LONGLONG_H */
+#include "mpfr-impl.h"
+
+
+int
+mpfr_grandom (mpfr_ptr rop1, mpfr_ptr rop2, gmp_randstate_t rstate,
+ mpfr_rnd_t rnd)
+{
+ int inex1, inex2, s1, s2;
+ mpz_t x, y, xp, yp, t, a, b, s;
+ mpfr_t sfr, l, r1, r2;
+ mpfr_prec_t tprec, tprec0;
+
+ inex2 = inex1 = 0;
+
+ if (rop2 == NULL) /* only one output requested. */
+ {
+ tprec0 = MPFR_PREC (rop1);
+ }
+ else
+ {
+ tprec0 = MAX (MPFR_PREC (rop1), MPFR_PREC (rop2));
+ }
+
+ tprec0 += 11;
+
+ /* We use "Marsaglia polar method" here (cf.
+ George Marsaglia, Normal (Gaussian) random variables for supercomputers
+ The Journal of Supercomputing, Volume 5, Number 1, 49–55
+ DOI: 10.1007/BF00155857).
+
+ First we draw uniform x and y in [0,1] using mpz_urandomb (in
+ fixed precision), and scale them to [-1, 1].
+ */
+
+ mpz_init (xp);
+ mpz_init (yp);
+ mpz_init (x);
+ mpz_init (y);
+ mpz_init (t);
+ mpz_init (s);
+ mpz_init (a);
+ mpz_init (b);
+ mpfr_init2 (sfr, MPFR_PREC_MIN);
+ mpfr_init2 (l, MPFR_PREC_MIN);
+ mpfr_init2 (r1, MPFR_PREC_MIN);
+ if (rop2 != NULL)
+ mpfr_init2 (r2, MPFR_PREC_MIN);
+
+ mpz_set_ui (xp, 0);
+ mpz_set_ui (yp, 0);
+
+ for (;;)
+ {
+ tprec = tprec0;
+ do
+ {
+ mpz_urandomb (xp, rstate, tprec);
+ mpz_urandomb (yp, rstate, tprec);
+ mpz_mul (a, xp, xp);
+ mpz_mul (b, yp, yp);
+ mpz_add (s, a, b);
+ }
+ while (mpz_sizeinbase (s, 2) > tprec * 2); /* x^2 + y^2 <= 2^{2tprec} */
+
+ for (;;)
+ {
+ /* FIXME: compute s as s += 2x + 2y + 2 */
+ mpz_add_ui (a, xp, 1);
+ mpz_add_ui (b, yp, 1);
+ mpz_mul (a, a, a);
+ mpz_mul (b, b, b);
+ mpz_add (s, a, b);
+ if ((mpz_sizeinbase (s, 2) <= 2 * tprec) ||
+ ((mpz_sizeinbase (s, 2) == 2 * tprec + 1) &&
+ (mpz_scan1 (s, 0) == 2 * tprec)))
+ goto yeepee;
+ /* Extend by 32 bits */
+ mpz_mul_2exp (xp, xp, 32);
+ mpz_mul_2exp (yp, yp, 32);
+ mpz_urandomb (x, rstate, 32);
+ mpz_urandomb (y, rstate, 32);
+ mpz_add (xp, xp, x);
+ mpz_add (yp, yp, y);
+ tprec += 32;
+
+ mpz_mul (a, xp, xp);
+ mpz_mul (b, yp, yp);
+ mpz_add (s, a, b);
+ if (mpz_sizeinbase (s, 2) > tprec * 2)
+ break;
+ }
+ }
+ yeepee:
+
+ /* FIXME: compute s with s -= 2x + 2y + 2 */
+ mpz_mul (a, xp, xp);
+ mpz_mul (b, yp, yp);
+ mpz_add (s, a, b);
+ /* Compute the signs of the output */
+ mpz_urandomb (x, rstate, 2);
+ s1 = mpz_tstbit (x, 0);
+ s2 = mpz_tstbit (x, 1);
+ for (;;)
+ {
+ /* s = xp^2 + yp^2 (loop invariant) */
+ mpfr_set_prec (sfr, 2 * tprec);
+ mpfr_set_prec (l, tprec);
+ mpfr_set_z (sfr, s, MPFR_RNDN); /* exact */
+ mpfr_mul_2si (sfr, sfr, -2 * tprec, MPFR_RNDN); /* exact */
+ mpfr_log (l, sfr, MPFR_RNDN);
+ mpfr_neg (l, l, MPFR_RNDN);
+ mpfr_mul_2si (l, l, 1, MPFR_RNDN);
+ mpfr_div (l, l, sfr, MPFR_RNDN);
+ mpfr_sqrt (l, l, MPFR_RNDN);
+
+ mpfr_set_prec (r1, tprec);
+ mpfr_mul_z (r1, l, xp, MPFR_RNDN);
+ mpfr_div_2ui (r1, r1, tprec, MPFR_RNDN); /* exact */
+ if (s1)
+ mpfr_neg (r1, r1, MPFR_RNDN);
+ if (MPFR_CAN_ROUND (r1, tprec - 2, MPFR_PREC (rop1), rnd))
+ {
+ if (rop2 != NULL)
+ {
+ mpfr_set_prec (r2, tprec);
+ mpfr_mul_z (r2, l, yp, MPFR_RNDN);
+ mpfr_div_2ui (r2, r2, tprec, MPFR_RNDN); /* exact */
+ if (s2)
+ mpfr_neg (r2, r2, MPFR_RNDN);
+ if (MPFR_CAN_ROUND (r2, tprec - 2, MPFR_PREC (rop2), rnd))
+ break;
+ }
+ else
+ break;
+ }
+ /* Extend by 32 bits */
+ mpz_mul_2exp (xp, xp, 32);
+ mpz_mul_2exp (yp, yp, 32);
+ mpz_urandomb (x, rstate, 32);
+ mpz_urandomb (y, rstate, 32);
+ mpz_add (xp, xp, x);
+ mpz_add (yp, yp, y);
+ tprec += 32;
+ mpz_mul (a, xp, xp);
+ mpz_mul (b, yp, yp);
+ mpz_add (s, a, b);
+ }
+ inex1 = mpfr_set (rop1, r1, rnd);
+ if (rop2 != NULL)
+ {
+ inex2 = mpfr_set (rop2, r2, rnd);
+ inex2 = mpfr_check_range (rop2, inex2, rnd);
+ }
+ inex1 = mpfr_check_range (rop1, inex1, rnd);
+
+ if (rop2 != NULL)
+ mpfr_clear (r2);
+ mpfr_clear (r1);
+ mpfr_clear (l);
+ mpfr_clear (sfr);
+ mpz_clear (b);
+ mpz_clear (a);
+ mpz_clear (s);
+ mpz_clear (t);
+ mpz_clear (y);
+ mpz_clear (x);
+ mpz_clear (yp);
+ mpz_clear (xp);
+
+ return INEX (inex1, inex2);
+}
diff --git a/src/hppa/mparam.h b/src/hppa/mparam.h
new file mode 100644
index 0000000..febdca5
--- /dev/null
+++ b/src/hppa/mparam.h
@@ -0,0 +1,233 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */
+/* generated on gcc61.fsffrance.org (HP PA-8600) with GMP 5.0.2 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,48,47,48,47,48,47,48,47, \
+ 48,47,64,63,64,63,64,63,64,63,64,63,64,63,64,63, \
+ 64,63,64,63,64,63,64,63,64,63,64,63,64,63,64,63, \
+ 64,63,64,72,64,72,64,93,64,93,64,93,92,93,92,93, \
+ 92,93,92,93,92,93,92,93,92,93,92,93,92,93,92,93, \
+ 92,93,92,93,105,93,105,93,105,93,105,93,105,105,105,108, \
+ 105,105,105,105,108,105,105,105,108,108,108,117,108,117,108,141, \
+ 140,141,140,141,140,141,140,141,140,141,140,141,140,141,140,141, \
+ 140,141,140,141,140,141,140,141,140,141,140,141,140,141,140,141, \
+ 140,141,140,141,140,141,140,141,141,153,140,141,140,141,140,140, \
+ 144,140,140,141,140,139,140,141,140,141,140,141,188,188,188,187, \
+ 188,187,188,188,188,188,188,188,188,188,188,188,188,188,188,187, \
+ 187,187,188,188,188,188,188,188,210,188,210,188,188,210,188,188, \
+ 188,188,188,188,188,188,188,188,188,188,186,188,210,188,188,187, \
+ 188,188,210,210,210,210,210,210,210,210,210,210,210,210,210,210, \
+ 210,210,210,210,210,210,210,208,210,209,210,210,210,210,210,233, \
+ 234,234,234,233,232,234,234,234,234,234,234,234,234,234,234,276, \
+ 234,276,234,276,234,276,276,276,276,276,276,276,282,276,282,276, \
+ 282,276,276,276,276,276,282,281,276,276,276,276,276,276,276,276, \
+ 276,276,276,276,276,276,282,276,282,276,282,276,282,281,282,281, \
+ 282,281,282,281,282,281,282,281,282,281,282,306,282,306,282,306, \
+ 306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, \
+ 306,372,306,371,306,372,372,372,372,372,372,371,372,372,372,372, \
+ 372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372, \
+ 372,371,372,372,372,372,372,372,372,372,372,372,372,372,372,372, \
+ 372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372, \
+ 372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372, \
+ 372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372, \
+ 372,372,372,372,372,372,372,372,426,372,426,426,426,426,426,426, \
+ 426,426,426,426,426,425,426,425,426,426,426,426,426,426,426,426, \
+ 426,426,426,426,426,424,426,426,426,426,426,426,426,426,426,426, \
+ 426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, \
+ 426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,503, \
+ 504,503,504,503,504,503,504,503,504,503,504,503,504,503,504,503, \
+ 504,503,504,503,504,503,504,503,502,503,504,503,504,503,504,503, \
+ 504,496,504,503,504,503,504,503,504,503,504,503,504,503,504,503, \
+ 504,503,504,503,504,503,504,503,504,503,568,568,568,568,568,568, \
+ 568,567,568,568,568,567,568,567,568,567,568,568,568,567,568,568, \
+ 568,568,568,568,568,567,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,567,568,568,568,568,568,567,568,567,568,568,568,567, \
+ 568,567,568,567,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,567,568,568,568,568,568,568,632,568,568,568,568,631,568,568, \
+ 568,568,568,568,568,567,568,567,568,568,568,568,632,632,632,631, \
+ 632,631,632,631,632,632,632,631,632,632,632,631,632,632,632,728, \
+ 728,727,728,727,728,728,728,727,728,727,728,727,728,727,728,728, \
+ 728,728,728,728,728,728,728,728,728,728,728,728,728,728,728,728, \
+ 728,728,728,728,728,728,728,728,728,728,728,728,728,728,728,728, \
+ 728,752,728,752,728,752,728,752,752,752,728,752,752,752,752,752, \
+ 752,752,752,752,752,752,752,752,752,752,752,752,752,751,752,751, \
+ 752,751,752,751,728,728,728,728,752,728,728,728,728,728,728,728, \
+ 728,752,832,751,832,752,832,752,832,752,832,752,832,752,832,751, \
+ 832,831,832,752,832,831,832,832,832,832,832,832,832,824,832,832, \
+ 832,832,832,832,832,832,832,832,832,832,832,832,832,832,832,832, \
+ 832,832,832,832,832,832,832,831,832,831,832,831,832,831,832,831, \
+ 832,831,832,832,832,831,832,831,832,831,832,831,832,831,832,831, \
+ 832,832,832,831,832,832,832,832,832,831,832,832,832,832,832,832 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,7,0,8,9,9, \
+ 10,10,11,11,12,13,14,13,14,15,16,15,16,17,18,17, \
+ 18,19,20,19,20,21,22,21,22,23,24,23,24,25,26,25, \
+ 26,27,28,27,28,29,30,29,30,31,32,31,32,33,34,33, \
+ 34,35,36,35,36,37,38,37,38,39,40,39,40,41,42,41, \
+ 42,43,44,43,44,47,48,47,48,47,48,47,48,51,52,51, \
+ 52,51,52,51,56,55,56,55,56,55,56,59,60,59,60,59, \
+ 60,63,60,63,64,63,64,63,68,63,68,67,68,67,68,71, \
+ 68,71,72,71,72,71,72,75,76,75,76,75,76,79,80,79, \
+ 80,79,80,75,76,83,84,79,80,79,80,79,80,83,84,83, \
+ 84,83,84,83,88,93,88,93,88,93,96,93,88,93,96,99, \
+ 96,93,92,93,92,93,96,93,96,99,96,99,96,99,98,99, \
+ 102,99,102,99,102,105,102,105,102,105,104,105,108,111,108,111, \
+ 108,117,114,117,116,117,116,117,116,117,120,117,120,123,120,123, \
+ 120,123,128,129,126,129,128,129,132,129,132,141,138,141,140,141, \
+ 140,141,140,141,140,141,140,141,140,153,152,153,152,153,152,153, \
+ 152,153,152,153,152,153,152,153,164,165,164,165,164,165,164,165, \
+ 164,165,164,165,164,177,176,177,176,177,176,177,176,177,176,177, \
+ 176,177,180,177,165,189,165,189,165,189,165,164,165,164,165,164, \
+ 165,164,177,176,177,176,177,176,177,176,177,176,177,176,177,188, \
+ 189,188,189,188,189,188,189,188,189,188,189,188,189,188,189,200, \
+ 189,200,201,200,201,200,201,200,201,200,201,212,213,212,213,212, \
+ 213,212,213,212,213,212,213,212,213,212,213,212,213,224,225,213, \
+ 225,213,225,213,225,213,225,213,225,213,237,225,237,225,237,225, \
+ 201,225,201,200,201,201,201,252,201,201,201,201,201,212,213,213, \
+ 213,213,213,212,213,213,213,212,213,213,213,213,213,213,225,225, \
+ 225,225,225,225,225,225,225,225,225,225,225,237,237,237,237,237, \
+ 237,236,237,237,237,252,252,252,252,252,252,252,252,252,252,252, \
+ 252,252,252,252,252,252,252,252,268,268,268,268,268,268,268,268, \
+ 268,266,268,268,268,268,268,268,268,268,275,268,275,268,275,268, \
+ 275,294,294,294,294,294,294,294,300,294,300,294,300,300,300,300, \
+ 300,300,300,300,300,300,318,318,318,318,318,318,318,318,318,318, \
+ 318,318,318,318,324,318,318,318,318,324,324,318,324,324,330,330, \
+ 330,330,342,342,342,342,342,342,342,342,342,342,342,342,342,342, \
+ 342,348,348,348,348,348,348,348,348,348,348,366,366,366,366,366, \
+ 366,366,366,366,372,366,372,366,372,372,366,372,372,372,372,372, \
+ 372,372,372,372,372,372,378,390,378,390,390,390,390,390,390,390, \
+ 390,390,396,390,396,390,366,390,396,396,372,396,372,396,372,396, \
+ 378,414,366,414,366,414,366,414,366,414,372,414,372,414,372,414, \
+ 372,372,372,395,396,395,396,390,390,390,390,390,390,390,390,390, \
+ 390,390,366,390,396,365,366,371,396,396,372,371,372,390,378,414, \
+ 378,414,378,414,414,414,414,414,390,414,390,389,390,389,390,395, \
+ 396,395,396,395,396,396,402,414,402,395,396,395,396,389,414,413, \
+ 414,413,414,413,414,413,414,414,420,395,420,419,420,395,396,401, \
+ 396,419,420,419,414,413,414,413,414,413,414,413,414,413,414,413, \
+ 414,413,420,419,420,419,420,419,420,419,426,425,426,437,438,437, \
+ 438,437,438,437,438,437,444,437,444,443,438,443,444,443,444,443, \
+ 444,443,444,443,444,461,462,461,462,461,462,461,462,461,462,461, \
+ 462,461,462,467,468,467,468,467,468,467,468,467,468,467,474,473, \
+ 486,485,486,485,486,485,414,485,486,485,486,491,492,491,492,519, \
+ 520,491,504,503,420,503,504,437,504,503,504,437,504,437,438,437, \
+ 520,443,444,519,520,519,520,519,520,519,520,519,520,527,520,527, \
+ 528,527,528,461,528,461,528,461,462,461,462,467,468,467,468,467, \
+ 468,551,552,551,552,551,552,551,552,551,560,551,552,551,552,551, \
+ 552,551,552,559,560,559,560,559,560,503,568,567,504,503,504,503, \
+ 504,503,504,519,520,519,520,519,520,519,520,520,520,519,520,519, \
+ 520,519,520,519,520,527,528,527,528,527,528,527,528,527,528,527, \
+ 528,535,552,551,552,551,552,551,552,552,552,551,552,551,552,551, \
+ 552,551,552,551,552,551,552,551,552,559,560,551,560,559,560,559, \
+ 560,567,568,567,568,583,568,567,584,583,584,583,584,583,584,583, \
+ 584,583,584,583,584,583,584,583,584,583,592,591,592,591,592,591, \
+ 592,591,592,591,592,615,616,519,520,615,520,519,520,615,616,615, \
+ 616,615,528,615,616,615,528,527,528,615,528,623,624,623,536,552, \
+ 552,551,552,551,552,551,552,551,552,551,552,551,552,551,552,551 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,6,7,10,11,10,11,12,13, \
+ 10,11,11,11,12,12,14,15,14,14,16,16,16,16,18,17, \
+ 22,19,22,23,22,23,26,27,26,23,30,29,26,27,26,27, \
+ 30,31,30,31,30,35,30,35,30,35,34,31,34,35,38,35, \
+ 34,36,38,39,38,39,38,43,38,40,42,43,42,44,42,43, \
+ 42,44,46,47,46,44,46,51,50,48,50,51,54,52,54,52, \
+ 50,51,54,55,58,55,54,56,58,56,62,60,58,63,58,63, \
+ 62,64,62,64,62,64,62,64,62,67,66,71,66,67,74,71, \
+ 70,67,70,71,74,72,74,75,70,76,74,79,74,75,74,79, \
+ 74,79,78,80,78,76,78,80,78,79,82,84,82,80,82,87, \
+ 86,84,86,84,86,84,86,88,90,88,90,92,90,88,94,96, \
+ 90,92,94,92,94,92,94,96,94,102,98,96,100,102,98,102, \
+ 98,104,100,102,102,104,104,102,102,102,104,104,104,104,108,112, \
+ 128,110,128,110,128,128,128,128,128,128,128,128,128,128,128,128, \
+ 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, \
+ 128,128,128,128,128,128,128,128,128,128,128,128,128,128,142,142, \
+ 142,142,140,142,144,144,144,142,144,142,140,142,140,142,142,144, \
+ 140,142,140,142,140,144,144,144,144,144,144,144,144,144,148,146, \
+ 148,160,148,150,148,158,156,158,156,160,156,158,160,160,156,160, \
+ 164,158,156,160,164,160,164,182,180,182,164,184,182,184,182,182, \
+ 180,182,182,182,182,186,184,182,180,182,184,184,184,185,182,184, \
+ 182,185,182,185,182,185,184,185,184,185,182,185,184,184,184,182, \
+ 184,185,184,186,184,185,182,182,184,184,184,184,184,184,186,185, \
+ 186,206,200,206,188,206,196,198,196,208,196,198,196,198,196,206, \
+ 200,206,208,206,196,198,200,208,200,206,200,206,200,208,216,208, \
+ 208,206,208,206,216,208,216,208,216,208,216,208,216,208,216,220, \
+ 216,210,216,220,256,220,216,220,216,224,216,222,256,250,248,254, \
+ 256,256,256,254,256,254,256,254,256,254,256,254,256,256,256,256, \
+ 256,254,256,254,256,256,256,254,256,254,256,254,256,256,256,254, \
+ 256,254,256,254,256,254,256,256,256,254,256,254,256,256,256,254, \
+ 256,254,256,256,256,254,256,254,256,254,256,256,256,254,256,254, \
+ 256,254,256,254,256,254,256,254,256,282,280,256,256,256,282,284, \
+ 282,284,282,288,280,281,282,288,282,288,282,282,280,281,280,282, \
+ 282,287,288,288,280,282,282,288,282,288,282,288,282,288,282,288, \
+ 282,284,282,288,280,288,282,288,282,284,282,288,282,288,282,288, \
+ 282,288,288,288,288,288,288,288,288,288,288,288,288,288,296,300, \
+ 296,304,296,304,298,300,296,300,296,300,312,302,296,306,312,300, \
+ 312,320,312,300,312,370,312,320,312,302,312,320,312,370,312,371, \
+ 312,371,312,369,372,371,372,371,368,370,372,370,372,370,372,370, \
+ 371,369,372,370,368,370,372,370,372,370,372,370,370,370,364,370, \
+ 371,370,372,370,370,370,372,370,372,370,372,370,370,370,372,370, \
+ 370,372,370,370,372,370,372,370,372,370,368,370,370,372,372,370, \
+ 370,370,372,370,372,372,372,370,372,370,370,366,372,370,370,370, \
+ 372,368,368,370,370,370,372,370,370,370,372,370,372,370,368,370, \
+ 372,370,372,370,369,370,372,370,372,369,372,370,372,371,372,370, \
+ 372,370,368,372,372,371,372,369,372,371,370,371,372,370,372,372, \
+ 372,370,372,372,372,372,376,416,376,416,376,416,414,416,416,420, \
+ 384,416,415,416,414,416,415,416,392,420,400,416,420,420,392,420, \
+ 400,416,416,416,416,420,416,412,416,416,416,416,418,416,414,416, \
+ 418,420,418,420,418,416,416,416,418,420,414,420,418,420,420,420, \
+ 416,416,418,420,418,418,416,416,420,416,418,416,432,420,432,420, \
+ 416,416,416,420,416,420,432,420,418,420,432,420,418,416,418,420, \
+ 420,420,432,420,420,420,432,468,464,512,432,468,432,444,432,444, \
+ 512,508,432,468,512,512,464,510,432,510,512,512,512,512,512,512, \
+ 512,512,512,512,512,508,512,508,512,512,512,508,512,510,512,512, \
+ 512,512,512,512,512,512,512,508,512,512,512,508,512,512,512,512, \
+ 512,512,512,512,512,512,512,512,512,512,512,508,512,512,512,512, \
+ 512,512,512,512,512,508,512,512,512,512,512,468,464,512,564,468, \
+ 512,564,512,512,564,512,512,512,564,508,564,508,564,503,564,508, \
+ 512,508,512,512,564,508,512,508,564,512,512,512,512,512,512,508, \
+ 512,510,512,512,512,512,512,512,512,512,512,512,512,512,512,512, \
+ 512,508,512,508,512,512,512,512,512,512,512,512,512,512,512,512, \
+ 512,512,512,512,512,512,512,512,512,564,562,564,560,512,564,564, \
+ 562,564,560,564,564,564,560,564,564,564,564,564,564,564,564,562 \
+
+#define MPFR_MUL_THRESHOLD 6 /* limbs */
+#define MPFR_SQR_THRESHOLD 8 /* limbs */
+#define MPFR_DIV_THRESHOLD 23 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 530 /* bits */
+#define MPFR_EXP_THRESHOLD 2918 /* bits */
+#define MPFR_SINCOS_THRESHOLD 28251 /* bits */
+#define MPFR_AI_THRESHOLD1 -21852 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 2256
+#define MPFR_AI_THRESHOLD3 34310
+/* Tuneup completed successfully, took 8236 seconds */
diff --git a/src/hypot.c b/src/hypot.c
new file mode 100644
index 0000000..79e25ab
--- /dev/null
+++ b/src/hypot.c
@@ -0,0 +1,194 @@
+/* mpfr_hypot -- Euclidean distance
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of hypot of x and y is done by *
+ * hypot(x,y)= sqrt(x^2+y^2) = z */
+
+int
+mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ int inexact, exact;
+ mpfr_t t, te, ti; /* auxiliary variables */
+ mpfr_prec_t N, Nz; /* size variables */
+ mpfr_prec_t Nt; /* precision of the intermediary variable */
+ mpfr_prec_t threshold;
+ mpfr_exp_t Ex, sh;
+ mpfr_uexp_t diff_exp;
+
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x,
+ mpfr_get_prec (y), mpfr_log_prec, y, rnd_mode),
+ ("z[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (z), mpfr_log_prec, z, inexact));
+
+ /* particular cases */
+ if (MPFR_ARE_SINGULAR (x, y))
+ {
+ if (MPFR_IS_INF (x) || MPFR_IS_INF (y))
+ {
+ /* Return +inf, even when the other number is NaN. */
+ MPFR_SET_INF (z);
+ MPFR_SET_POS (z);
+ MPFR_RET (0);
+ }
+ else if (MPFR_IS_NAN (x) || MPFR_IS_NAN (y))
+ {
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_ZERO (x))
+ return mpfr_abs (z, y, rnd_mode);
+ else /* y is necessarily 0 */
+ return mpfr_abs (z, x, rnd_mode);
+ }
+
+ if (mpfr_cmpabs (x, y) < 0)
+ {
+ mpfr_srcptr u;
+ u = x;
+ x = y;
+ y = u;
+ }
+
+ /* now |x| >= |y| */
+
+ Ex = MPFR_GET_EXP (x);
+ diff_exp = (mpfr_uexp_t) Ex - MPFR_GET_EXP (y);
+
+ N = MPFR_PREC (x); /* Precision of input variable */
+ Nz = MPFR_PREC (z); /* Precision of output variable */
+ threshold = (MAX (N, Nz) + (rnd_mode == MPFR_RNDN ? 1 : 0)) << 1;
+ if (rnd_mode == MPFR_RNDA)
+ rnd_mode = MPFR_RNDU; /* since the result is positive, RNDA = RNDU */
+
+ /* Is |x| a suitable approximation to the precision Nz ?
+ (see algorithms.tex for explanations) */
+ if (diff_exp > threshold)
+ /* result is |x| or |x|+ulp(|x|,Nz) */
+ {
+ if (MPFR_UNLIKELY (rnd_mode == MPFR_RNDU))
+ {
+ /* If z > abs(x), then it was already rounded up; otherwise
+ z = abs(x), and we need to add one ulp due to y. */
+ if (mpfr_abs (z, x, rnd_mode) == 0)
+ mpfr_nexttoinf (z);
+ MPFR_RET (1);
+ }
+ else /* MPFR_RNDZ, MPFR_RNDD, MPFR_RNDN */
+ {
+ if (MPFR_LIKELY (Nz >= N))
+ {
+ mpfr_abs (z, x, rnd_mode); /* exact */
+ MPFR_RET (-1);
+ }
+ else
+ {
+ MPFR_SET_EXP (z, Ex);
+ MPFR_SET_SIGN (z, 1);
+ MPFR_RNDRAW_GEN (inexact, z, MPFR_MANT (x), N, rnd_mode, 1,
+ goto addoneulp,
+ if (MPFR_UNLIKELY (++ MPFR_EXP (z) >
+ __gmpfr_emax))
+ return mpfr_overflow (z, rnd_mode, 1);
+ );
+
+ if (MPFR_UNLIKELY (inexact == 0))
+ inexact = -1;
+ MPFR_RET (inexact);
+ }
+ }
+ }
+
+ /* General case */
+
+ N = MAX (MPFR_PREC (x), MPFR_PREC (y));
+
+ /* working precision */
+ Nt = Nz + MPFR_INT_CEIL_LOG2 (Nz) + 4;
+
+ mpfr_init2 (t, Nt);
+ mpfr_init2 (te, Nt);
+ mpfr_init2 (ti, Nt);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Scale x and y to avoid overflow/underflow in x^2 and overflow in y^2
+ (as |x| >= |y|). The scaling of y can underflow only when the target
+ precision is huge, otherwise the case would already have been handled
+ by the diff_exp > threshold code. */
+ sh = mpfr_get_emax () / 2 - Ex - 1;
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ mpfr_prec_t err;
+
+ exact = mpfr_mul_2si (te, x, sh, MPFR_RNDZ);
+ exact |= mpfr_mul_2si (ti, y, sh, MPFR_RNDZ);
+ exact |= mpfr_sqr (te, te, MPFR_RNDZ);
+ /* Use fma in order to avoid underflow when diff_exp<=MPFR_EMAX_MAX-2 */
+ exact |= mpfr_fma (t, ti, ti, te, MPFR_RNDZ);
+ exact |= mpfr_sqrt (t, t, MPFR_RNDZ);
+
+ err = Nt < N ? 4 : 2;
+ if (MPFR_LIKELY (exact == 0
+ || MPFR_CAN_ROUND (t, Nt-err, Nz, rnd_mode)))
+ break;
+
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ mpfr_set_prec (te, Nt);
+ mpfr_set_prec (ti, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ MPFR_BLOCK (flags, inexact = mpfr_div_2si (z, t, sh, rnd_mode));
+ MPFR_ASSERTD (exact == 0 || inexact != 0);
+
+ mpfr_clear (t);
+ mpfr_clear (ti);
+ mpfr_clear (te);
+
+ /*
+ exact inexact
+ 0 0 result is exact, ternary flag is 0
+ 0 non zero t is exact, ternary flag given by inexact
+ 1 0 impossible (see above)
+ 1 non zero ternary flag given by inexact
+ */
+
+ MPFR_SAVE_EXPO_FREE (expo);
+
+ if (MPFR_OVERFLOW (flags))
+ mpfr_set_overflow ();
+ /* hypot(x,y) >= |x|, thus underflow is not possible. */
+
+ return mpfr_check_range (z, inexact, rnd_mode);
+}
diff --git a/src/ia64/mparam.h b/src/ia64/mparam.h
new file mode 100644
index 0000000..4292ca2
--- /dev/null
+++ b/src/ia64/mparam.h
@@ -0,0 +1,233 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.4.5 */
+/* gcc60.fsffrance.org (Madison) with gmp 5.0.2 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, \
+ -1,-1,14,16,16,17,18,19,20,20,22,22,20,21,22,23, \
+ 24,23,24,25,24,25,30,30,30,31,32,32,32,33,32,33, \
+ 32,33,34,37,36,37,38,35,36,40,36,39,40,41,40,43, \
+ 48,48,42,43,48,41,48,50,48,48,48,50,48,60,48,50, \
+ 60,64,60,60,60,60,60,66,64,64,64,63,64,65,68,64, \
+ 64,64,64,63,64,64,68,68,64,68,64,64,64,64,76,76, \
+ 80,76,76,72,72,80,76,76,76,82,80,80,80,80,80,80, \
+ 84,93,88,96,96,96,90,99,96,93,96,99,96,93,96,99, \
+ 96,96,102,105,108,99,108,105,108,105,108,111,108,111,108,111, \
+ 108,117,120,117,120,117,117,117,120,120,120,117,120,120,120,123, \
+ 120,117,120,123,120,120,126,141,120,141,141,141,140,141,144,141, \
+ 140,141,141,141,144,141,144,147,144,141,156,141,140,141,156,165, \
+ 164,165,156,165,164,165,165,165,164,165,164,165,164,165,165,165, \
+ 164,165,164,165,168,177,180,177,165,177,177,177,176,177,180,177, \
+ 180,177,180,177,176,177,180,165,168,189,180,189,192,189,186,189, \
+ 188,189,176,177,192,189,180,177,192,189,180,201,192,177,192,189, \
+ 192,189,189,189,188,213,212,213,192,213,200,201,192,213,200,201, \
+ 212,213,192,201,200,213,212,213,212,213,200,213,212,213,210,201, \
+ 212,213,236,212,212,213,212,213,216,213,236,213,236,235,236,252, \
+ 236,225,236,251,236,233,236,235,236,240,252,252,236,235,252,252, \
+ 236,249,252,251,252,252,252,251,256,256,256,251,252,251,252,251, \
+ 252,252,252,267,268,265,268,267,268,265,268,267,268,265,268,267, \
+ 268,267,268,283,268,281,284,283,284,281,268,283,284,281,284,283, \
+ 284,284,284,283,284,283,284,283,284,283,284,283,284,281,300,284, \
+ 284,284,300,300,300,316,284,315,284,313,300,315,316,284,316,315, \
+ 316,299,300,284,316,284,316,315,300,315,316,315,316,300,316,316, \
+ 316,313,316,315,316,313,316,315,316,316,316,315,320,316,316,315, \
+ 354,354,354,315,354,354,354,354,354,354,354,354,354,353,378,378, \
+ 354,354,354,378,354,354,354,354,354,377,378,354,354,377,378,378, \
+ 378,378,378,378,378,377,378,378,378,378,378,378,378,377,378,378, \
+ 378,378,378,378,378,377,378,378,378,378,378,378,378,378,378,378, \
+ 378,377,378,378,378,378,378,402,378,378,378,378,402,378,378,378, \
+ 402,426,426,426,426,402,426,426,402,402,426,426,402,402,426,426, \
+ 426,426,426,426,426,425,426,426,426,402,426,426,426,426,426,426, \
+ 426,426,426,426,426,426,426,426,472,472,426,426,472,426,472,472, \
+ 472,426,426,426,472,471,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,472,472,472,472,472,472,472,472,472,504,504,472,472, \
+ 504,504,504,472,472,472,472,504,472,472,472,472,504,472,504,504, \
+ 504,504,504,504,504,504,536,504,504,504,504,504,504,504,504,504, \
+ 504,504,536,535,536,504,536,536,536,504,536,536,504,504,504,504, \
+ 504,504,536,536,536,536,536,536,536,536,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,536,536,536,536,536,568,536,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,600,600,568,600,600,600,600,568,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,599,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,599,600,600,600,600,600,600,632,600, \
+ 600,600,600,600,632,600,600,600,632,600,632,632,632,632,632,632, \
+ 632,632,632,632,632,632,632,632,632,600,632,600,632,632,632,600, \
+ 664,632,664,664,632,632,664,664,664,664,632,664,664,632,664,664, \
+ 664,632,664,664,664,664,664,664,664,664,664,664,631,632,632,632, \
+ 664,632,664,664,664,664,663,664,664,664,736,664,736,664,664,664, \
+ 736,736,736,664,736,735,736,735,736,736,736,735,736,735,736,735, \
+ 736,736,664,735,736,736,736,736,736,735,736,735,736,735,736,736, \
+ 736,736,736,735,736,736,736,735,736,736,736,735,736,735,736,736, \
+ 736,736,760,760,736,760,760,760,760,760,784,760,760,783,784,760, \
+ 760,760,760,760,784,760,760,760,760,784,784,784,784,784,784,784, \
+ 736,760,784,784,784,784,784,783,784,783,784,783,784,783,784,784, \
+ 784,760,784,784,784,784,784,784,784,784,784,784,784,784,784,760, \
+ 784,784,784,784,784,783,784,831,784,784,784,784,784,784,784,831, \
+ 832,784,832,831,784,831,832,831,832,784,784,831,832,783,784,831, \
+ 832,784,832,831,832,784,856,856,856,856,856,856,856,856,856,856 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,0,-1,-1,-1,6,-1,8,8,8,10,10, \
+ 10,12,11,11,12,12,14,14,14,14,16,15,16,16,18,19, \
+ 18,18,19,20,20,20,22,22,22,22,24,24,24,28,26,30, \
+ 28,32,30,28,28,28,30,30,30,30,32,34,34,34,36,36, \
+ 36,38,38,40,36,38,38,40,38,42,42,44,44,44,42,44, \
+ 44,46,46,48,44,50,46,52,48,54,50,52,48,54,50,52, \
+ 54,50,56,52,56,52,58,56,56,56,58,58,60,60,62,62, \
+ 60,64,62,62,68,68,66,66,64,68,66,70,72,72,66,68, \
+ 68,70,70,70,72,74,74,74,80,78,78,76,80,80,82,84, \
+ 84,82,86,80,82,82,84,84,86,86,88,92,88,90,86,92, \
+ 84,94,86,90,88,92,90,94,86,86,88,98,92,88,90,90, \
+ 94,92,92,94,96,92,94,94,96,100,98,98,96,100,102,102, \
+ 100,98,102,100,100,102,102,102,104,106,106,108,108,104,106,110, \
+ 108,106,114,108,108,124,110,110,116,110,114,116,112,114,114,128, \
+ 128,114,118,120,128,128,118,120,132,132,132,120,120,128,124,124, \
+ 128,144,124,128,128,128,140,136,132,132,128,136,136,128,136,140, \
+ 132,140,166,136,160,161,140,140,136,140,166,154,144,168,166,154, \
+ 154,155,142,142,160,167,166,166,148,166,178,167,160,154,154,179, \
+ 172,167,167,154,156,148,156,160,172,172,166,166,167,166,154,155, \
+ 168,167,166,162,172,168,167,178,166,178,167,178,180,174,173,184, \
+ 180,190,178,172,178,178,190,178,178,190,191,184,178,190,190,172, \
+ 191,184,178,192,180,180,191,184,192,190,190,190,184,190,190,190, \
+ 192,190,214,203,204,202,190,214,202,190,190,190,204,191,190,208, \
+ 204,216,196,203,216,208,215,212,209,214,214,216,215,220,215,216, \
+ 214,216,216,214,220,216,214,216,220,214,214,240,228,226,226,232, \
+ 226,234,228,238,233,238,226,226,232,220,238,240,244,239,239,214, \
+ 240,232,238,250,227,232,250,250,233,238,240,226,232,234,238,226, \
+ 252,232,238,244,239,240,238,238,239,240,238,262,246,256,250,246, \
+ 252,244,262,252,252,262,251,262,262,264,275,262,264,258,233,262, \
+ 268,234,263,236,263,240,239,270,238,244,239,244,240,240,249,244, \
+ 243,244,245,252,249,244,251,250,257,258,255,250,262,264,257,258, \
+ 250,262,262,258,257,262,262,274,274,262,273,262,263,274,275,274, \
+ 275,264,263,276,274,268,275,288,281,286,288,288,264,274,281,274, \
+ 295,274,296,300,293,274,275,296,295,288,292,280,311,312,300,304, \
+ 307,302,300,308,312,304,315,314,299,316,320,316,303,320,318,320, \
+ 315,312,320,320,318,320,307,336,316,334,313,332,327,336,312,334, \
+ 316,320,313,340,316,320,315,344,332,315,332,315,316,328,335,318, \
+ 332,320,331,308,332,331,326,315,316,331,345,332,347,344,347,347, \
+ 315,329,335,331,348,345,327,320,331,334,348,352,378,378,334,378, \
+ 351,390,332,378,348,390,390,378,377,390,377,378,390,377,329,402, \
+ 356,390,402,378,378,390,378,390,378,390,401,378,378,390,390,414, \
+ 388,426,401,426,378,401,378,426,389,390,402,426,402,402,426,414, \
+ 402,414,402,426,425,426,437,414,402,438,402,426,426,401,426,426, \
+ 426,390,426,390,426,425,426,414,426,426,402,426,426,426,426,426, \
+ 426,438,426,426,426,426,438,414,402,438,450,426,426,402,426,438, \
+ 426,426,426,426,437,438,426,426,438,438,450,426,426,438,426,426, \
+ 437,438,426,426,425,426,438,460,474,438,449,438,426,474,426,474, \
+ 425,438,426,425,486,462,438,474,438,462,450,474,426,426,426,474, \
+ 438,474,462,474,450,474,438,474,473,438,474,474,474,536,426,474, \
+ 486,486,474,486,474,474,536,474,474,536,474,474,474,536,462,536, \
+ 486,536,474,536,536,536,536,536,536,536,536,536,474,536,536,536, \
+ 535,536,535,536,536,536,536,536,536,536,536,536,536,536,536,536, \
+ 536,536,535,535,536,536,536,535,536,536,535,535,536,536,536,536, \
+ 536,536,536,536,536,552,536,535,536,535,536,535,536,536,536,535, \
+ 536,536,536,536,536,584,536,536,536,535,536,535,536,536,568,535, \
+ 552,536,568,536,536,584,536,535,536,536,536,536,536,536,600,535, \
+ 536,536,536,584,536,584,536,535,536,536,536,535,536,600,600,535, \
+ 536,600,568,536,568,568,536,584,536,536,536,536,600,584,567,584, \
+ 600,584,583,599,584,584,600,584,600,568,600,599,600,600,600,584, \
+ 616,600,600,600,600,600,600,599,600,600,600,600,600,600,600,599, \
+ 600,600,615,599,616,616,584,599,600,616,600,600,600,600,600,599, \
+ 616,616,600,600,616,616,600,600,600,616,600,599,600,600,600,599, \
+ 600,616,616,599,616,616,616,599,616,616,616,599,616,616,600,599, \
+ 616,616,600,616,616,616,632,648,664,648,616,648,600,600,632,664 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,13, \
+ 16,17,18,19,18,21,22,23,22,25,17,17,20,23,25,22, \
+ 24,25,21,21,24,29,29,31,28,28,26,31,30,28,29,30, \
+ 31,37,38,37,36,40,37,37,40,37,41,37,36,39,38,46, \
+ 42,43,42,43,40,37,42,43,44,49,42,43,40,45,46,47, \
+ 49,49,50,43,44,45,50,46,54,53,53,55,50,51,50,50, \
+ 54,56,54,52,55,53,57,55,56,57,58,58,56,62,66,59, \
+ 62,65,64,59,60,65,66,77,76,73,70,73,68,65,72,73, \
+ 76,69,72,71,70,81,72,85,76,77,74,77,80,81,76,77, \
+ 84,85,84,79,82,81,84,77,84,83,80,85,82,81,96,83, \
+ 96,85,85,91,96,84,92,95,92,100,92,96,88,98,96,99, \
+ 96,96,100,100,96,95,100,100,102,96,100,95,96,98,100,99, \
+ 109,100,100,100,104,112,104,117,104,109,120,117,108,110,124,109, \
+ 112,114,112,115,120,120,112,117,118,116,116,115,112,120,124,127, \
+ 128,127,120,116,120,127,125,129,120,123,120,131,131,129,132,136, \
+ 132,125,136,131,136,125,144,144,136,144,144,147,144,128,152,144, \
+ 148,149,132,144,150,145,147,145,152,151,144,143,152,164,152,152, \
+ 152,152,152,149,152,159,152,152,152,159,144,155,160,144,164,160, \
+ 152,152,168,163,148,160,168,160,155,164,170,152,152,160,160,164, \
+ 168,160,166,168,168,170,168,162,164,168,164,168,168,160,163,176, \
+ 168,166,176,167,168,168,169,176,168,190,186,176,192,171,184,192, \
+ 192,190,192,186,176,172,176,176,176,192,192,186,192,192,198,191, \
+ 192,198,192,198,192,192,192,216,192,192,192,191,192,191,216,198, \
+ 198,198,192,192,192,198,197,192,192,192,198,198,208,224,208,198, \
+ 198,216,198,198,216,208,216,208,216,222,216,215,208,209,234,224, \
+ 240,221,234,216,216,240,232,233,216,222,233,232,216,239,240,218, \
+ 224,234,240,240,240,240,224,232,240,240,216,240,224,233,230,240, \
+ 224,233,240,234,240,234,224,232,240,233,233,240,230,230,234,240, \
+ 240,232,240,240,240,228,240,240,235,240,240,232,240,238,240,240, \
+ 240,240,240,240,240,244,246,240,256,240,240,240,244,288,250,250, \
+ 256,288,288,256,246,282,288,288,256,288,256,288,248,293,254,288, \
+ 288,256,264,256,257,265,288,257,255,288,288,288,256,288,288,281, \
+ 292,280,288,292,288,287,280,288,287,280,288,282,288,294,288,288, \
+ 288,288,288,288,288,288,288,288,294,304,288,304,288,288,288,292, \
+ 294,288,288,288,280,294,292,294,292,328,288,282,328,288,288,291, \
+ 288,288,288,288,300,288,317,304,288,329,304,292,304,320,304,318, \
+ 327,325,324,326,304,312,336,304,329,320,328,330,328,330,336,320, \
+ 328,327,330,318,316,319,330,336,328,336,352,336,320,326,352,320, \
+ 336,325,326,324,342,329,327,328,336,336,336,336,336,328,352,330, \
+ 320,328,336,326,320,335,335,326,352,352,342,336,352,326,336,336, \
+ 336,352,329,328,342,328,342,336,326,336,384,352,384,329,352,336, \
+ 384,352,384,352,336,336,334,384,384,384,384,384,384,352,351,384, \
+ 384,384,383,372,384,372,384,384,352,368,384,384,382,396,384,372, \
+ 384,384,352,384,384,383,384,384,384,384,384,384,384,384,384,384, \
+ 372,384,384,396,384,384,384,384,384,384,384,384,384,384,384,384, \
+ 384,396,384,384,384,384,384,372,384,384,384,396,384,384,384,432, \
+ 384,383,384,384,384,396,384,384,384,396,382,384,384,396,394,384, \
+ 384,384,384,383,392,396,400,384,384,401,384,384,396,432,396,432, \
+ 392,408,432,396,396,396,416,396,416,432,448,428,424,420,394,395, \
+ 432,432,432,396,432,432,432,432,432,426,432,432,448,448,444,464, \
+ 416,440,432,425,432,430,448,432,432,432,432,432,432,432,442,432, \
+ 432,432,432,447,472,432,432,480,432,468,480,480,448,465,450,432, \
+ 480,465,448,464,480,448,472,467,468,480,438,479,464,465,468,472, \
+ 468,469,480,448,480,480,464,480,468,469,464,467,468,432,472,480, \
+ 464,480,472,468,480,468,472,472,468,477,480,471,472,467,448,480, \
+ 448,496,488,464,470,480,480,480,480,469,472,448,480,479,480,512, \
+ 492,477,480,469,480,464,480,480,464,480,500,480,472,480,472,479, \
+ 488,468,500,480,512,472,504,467,480,472,480,480,464,469,480,480, \
+ 480,472,496,500,480,480,480,480,472,480,480,496,480,576,480,480, \
+ 480,497,576,500,480,516,504,504,498,480,504,480,504,480,504,576, \
+ 512,496,512,508,576,529,512,500,576,534,534,504,512,515,528,576, \
+ 560,528,576,512,528,513,512,528,528,576,576,496,528,576,576,511, \
+ 512,504,576,576,560,512,576,504,576,576,576,576,564,576,564,576, \
+ 576,562,576,576,576,576,576,560,576,576,564,528,532,576,576,576 \
+
+#define MPFR_MUL_THRESHOLD 26 /* limbs */
+#define MPFR_SQR_THRESHOLD 19 /* limbs */
+#define MPFR_DIV_THRESHOLD 44 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 1092 /* bits */
+#define MPFR_EXP_THRESHOLD 5435 /* bits */
+#define MPFR_SINCOS_THRESHOLD 24855 /* bits */
+#define MPFR_AI_THRESHOLD1 -9637 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 922
+#define MPFR_AI_THRESHOLD3 16031
+/* Tuneup completed successfully, took 1058 seconds */
diff --git a/src/ieee_floats.h b/src/ieee_floats.h
new file mode 100644
index 0000000..fe52468
--- /dev/null
+++ b/src/ieee_floats.h
@@ -0,0 +1,80 @@
+/* auxiliary data to generate special IEEE floats (NaN, +Inf, -Inf)
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* "double" NaN and infinities are written as explicit bytes to be sure of
+ getting what we want, and to be sure of not depending on libm.
+
+ Could use 4-byte "float" values and let the code convert them, but it
+ seems more direct to give exactly what we want. Certainly for gcc 3.0.2
+ on alphaev56-unknown-freebsd4.3 the NaN must be 8-bytes, since that
+ compiler+system was seen incorrectly converting from a "float" NaN. */
+
+#if _GMP_IEEE_FLOATS
+
+/* The "d" field guarantees alignment to a suitable boundary for a double.
+ Could use a union instead, if we checked the compiler supports union
+ initializers. */
+union dbl_bytes {
+ unsigned char b[8];
+ double d;
+};
+
+#define MPFR_DBL_INFP (dbl_infp.d)
+#define MPFR_DBL_INFM (dbl_infm.d)
+#define MPFR_DBL_NAN (dbl_nan.d)
+
+/* Warning! dbl_nan.d is not consistently the same NaN on all the
+ processors: it can be either a qNaN (quiet) or sNaN (signaling).
+ Processors are known to differ... */
+
+#if HAVE_DOUBLE_IEEE_LITTLE_ENDIAN
+static const union dbl_bytes dbl_infp =
+ { { 0, 0, 0, 0, 0, 0, 0xF0, 0x7F } };
+static const union dbl_bytes dbl_infm =
+ { { 0, 0, 0, 0, 0, 0, 0xF0, 0xFF } };
+static const union dbl_bytes dbl_nan =
+ { { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F } };
+#endif
+#if HAVE_DOUBLE_IEEE_LITTLE_SWAPPED
+static const union dbl_bytes dbl_infp =
+ { { 0, 0, 0xF0, 0x7F, 0, 0, 0, 0 } };
+static const union dbl_bytes dbl_infm =
+ { { 0, 0, 0xF0, 0xFF, 0, 0, 0, 0 } };
+static const union dbl_bytes dbl_nan =
+ { { 0, 0, 0xF8, 0x7F, 0, 0, 0, 0 } };
+#endif
+#if HAVE_DOUBLE_IEEE_BIG_ENDIAN
+static const union dbl_bytes dbl_infp =
+ { { 0x7F, 0xF0, 0, 0, 0, 0, 0, 0 } };
+static const union dbl_bytes dbl_infm =
+ { { 0xFF, 0xF0, 0, 0, 0, 0, 0, 0 } };
+static const union dbl_bytes dbl_nan =
+ { { 0x7F, 0xF8, 0, 0, 0, 0, 0, 0 } };
+#endif
+
+#else /* _GMP_IEEE_FLOATS */
+
+#define MPFR_DBL_INFP DBL_POS_INF
+#define MPFR_DBL_INFM DBL_NEG_INF
+#define MPFR_DBL_NAN DBL_NAN
+
+#endif /* _GMP_IEEE_FLOATS */
diff --git a/src/init.c b/src/init.c
new file mode 100644
index 0000000..a36de47
--- /dev/null
+++ b/src/init.c
@@ -0,0 +1,29 @@
+/* mpfr_init -- initialize a floating-point number
+
+Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_init (mpfr_ptr x)
+{
+ mpfr_init2 (x, __gmpfr_default_fp_bit_precision);
+}
diff --git a/src/init2.c b/src/init2.c
new file mode 100644
index 0000000..25f53af
--- /dev/null
+++ b/src/init2.c
@@ -0,0 +1,69 @@
+/* mpfr_init2 -- initialize a floating-point number with given precision
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_init2 (mpfr_ptr x, mpfr_prec_t p)
+{
+ mp_size_t xsize;
+ mpfr_limb_ptr tmp;
+
+ /* Check if we can represent the number of limbs
+ * associated to the maximum of mpfr_prec_t*/
+ MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/BYTES_PER_MP_LIMB) );
+
+ /* Check for correct GMP_NUMB_BITS and BYTES_PER_MP_LIMB */
+ MPFR_ASSERTN( GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
+ && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB );
+
+ MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS);
+
+ /* Check for correct EXP NAN, ZERO & INF in both mpfr.h and mpfr-impl.h */
+ MPFR_ASSERTN( __MPFR_EXP_NAN == MPFR_EXP_NAN );
+ MPFR_ASSERTN( __MPFR_EXP_ZERO == MPFR_EXP_ZERO );
+ MPFR_ASSERTN( __MPFR_EXP_INF == MPFR_EXP_INF );
+
+ MPFR_ASSERTN( MPFR_EMAX_MAX <= (MPFR_EXP_MAX >> 1) );
+ MPFR_ASSERTN( MPFR_EMIN_MIN >= -(MPFR_EXP_MAX >> 1) );
+
+ /* p=1 is not allowed since the rounding to nearest even rule requires at
+ least two bits of mantissa: the neighbours of 3/2 are 1*2^0 and 1*2^1,
+ which both have an odd mantissa */
+ MPFR_ASSERTN(p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
+
+ xsize = MPFR_PREC2LIMBS (p);
+ tmp = (mpfr_limb_ptr) (*__gmp_allocate_func)(MPFR_MALLOC_SIZE(xsize));
+
+ MPFR_PREC(x) = p; /* Set prec */
+ MPFR_EXP (x) = MPFR_EXP_INVALID; /* make sure that the exp field has a
+ valid value in the C point of view */
+ MPFR_SET_POS(x); /* Set a sign */
+ MPFR_SET_MANT_PTR(x, tmp); /* Set Mantissa ptr */
+ MPFR_SET_ALLOC_SIZE(x, xsize); /* Fix alloc size of Mantissa */
+ MPFR_SET_NAN(x); /* initializes to NaN */
+}
+
+#ifdef MPFR_USE_OWN_MPFR_TMP_ALLOC
+static unsigned char mpfr_stack_tab[8000000];
+unsigned char *mpfr_stack = mpfr_stack_tab;
+#endif
diff --git a/src/inits.c b/src/inits.c
new file mode 100644
index 0000000..b27599d
--- /dev/null
+++ b/src/inits.c
@@ -0,0 +1,62 @@
+/* mpfr_inits -- initialize several floating-point numbers
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+#undef HAVE_STDARG
+#include "config.h" /* for a build within gmp */
+#endif
+
+#if HAVE_STDARG
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#include "mpfr-impl.h"
+
+/* Since it uses "...", we need an explicit support for K&R */
+
+void
+#if HAVE_STDARG
+mpfr_inits (mpfr_ptr x, ...)
+#else
+mpfr_inits (va_alist)
+ va_dcl
+#endif
+{
+ va_list arg;
+
+#if HAVE_STDARG
+ va_start (arg, x);
+#else
+ mpfr_ptr x;
+ va_start(arg);
+ x = va_arg (arg, mpfr_ptr);
+#endif
+
+ while (x != 0)
+ {
+ mpfr_init (x);
+ x = (mpfr_ptr) va_arg (arg, mpfr_ptr);
+ }
+ va_end (arg);
+}
diff --git a/src/inits2.c b/src/inits2.c
new file mode 100644
index 0000000..dd3d32d
--- /dev/null
+++ b/src/inits2.c
@@ -0,0 +1,66 @@
+/* mpfr_inits2 -- initialize several floating-point numbers with given
+ precision
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+#undef HAVE_STDARG
+#include "config.h" /* for a build within gmp */
+#endif
+
+#if HAVE_STDARG
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#include "mpfr-impl.h"
+
+/*
+ * Contrary to mpfr_init2, mpfr_prec_t p is the first argument
+ */
+
+/* Explicit support for K&R compiler */
+void
+#if HAVE_STDARG
+mpfr_inits2 (mpfr_prec_t p, mpfr_ptr x, ...)
+#else
+mpfr_inits2 (va_alist)
+ va_dcl
+#endif
+{
+ va_list arg;
+#if HAVE_STDARG
+ va_start (arg, x);
+#else
+ mpfr_prec_t p;
+ mpfr_ptr x;
+ va_start(arg);
+ p = va_arg (arg, mpfr_prec_t);
+ x = va_arg (arg, mpfr_ptr);
+#endif
+ while (x != 0)
+ {
+ mpfr_init2 (x, p);
+ x = (mpfr_ptr) va_arg (arg, mpfr_ptr);
+ }
+ va_end (arg);
+}
diff --git a/src/inp_str.c b/src/inp_str.c
new file mode 100644
index 0000000..5679844
--- /dev/null
+++ b/src/inp_str.c
@@ -0,0 +1,89 @@
+/* mpfr_inp_str -- input a number in base BASE from stdio stream STREAM
+ and store the result in ROP
+
+Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <ctype.h>
+
+#include "mpfr-impl.h"
+
+/* The original version of this function came from GMP's mpf/inp_str.c;
+ it has been adapted for MPFR. */
+
+size_t
+mpfr_inp_str (mpfr_ptr rop, FILE *stream, int base, mpfr_rnd_t rnd_mode)
+{
+ unsigned char *str;
+ size_t alloc_size, str_size;
+ int c;
+ int retval;
+ size_t nread;
+
+ if (stream == NULL)
+ stream = stdin;
+
+ alloc_size = 100;
+ str = (unsigned char *) (*__gmp_allocate_func) (alloc_size);
+ str_size = 0;
+ nread = 0;
+
+ /* Skip whitespace. */
+ do
+ {
+ c = getc (stream);
+ nread++;
+ }
+ while (isspace (c));
+
+ /* number of characters read is nread */
+
+ for (;;)
+ {
+ if (str_size >= alloc_size)
+ {
+ size_t old_alloc_size = alloc_size;
+ alloc_size = alloc_size * 3 / 2;
+ str = (unsigned char *)
+ (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ }
+ if (c == EOF || isspace (c))
+ break;
+ str[str_size++] = (unsigned char) c;
+ c = getc (stream);
+ }
+ ungetc (c, stream);
+
+ /* number of characters read is nread + str_size - 1 */
+
+ /* we can exit the for loop only by the break instruction,
+ then necessarily str_size >= alloc_size was checked, so
+ now str_size < alloc_size */
+
+ str[str_size] = '\0';
+
+ retval = mpfr_set_str (rop, (char *) str, base, rnd_mode);
+ (*__gmp_free_func) (str, alloc_size);
+
+ if (retval == -1)
+ return 0; /* error */
+
+ return str_size + nread - 1;
+}
diff --git a/src/int_ceil_log2.c b/src/int_ceil_log2.c
new file mode 100644
index 0000000..5763830
--- /dev/null
+++ b/src/int_ceil_log2.c
@@ -0,0 +1,42 @@
+/* __gmpfr_int_ceil_log2 -- Integer ceil of log2(x)
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H /* for count_leading_zeros */
+#include "mpfr-impl.h"
+
+int
+__gmpfr_int_ceil_log2 (unsigned long n)
+{
+ if (MPFR_UNLIKELY (n == 1))
+ return 0;
+ else
+ {
+ int b;
+ mp_limb_t limb;
+
+ MPFR_ASSERTN (n > 1);
+ limb = n - 1;
+ MPFR_ASSERTN (limb == n - 1);
+ count_leading_zeros (b, limb);
+ return GMP_NUMB_BITS - b;
+ }
+}
diff --git a/src/isinf.c b/src/isinf.c
new file mode 100644
index 0000000..85cb6fd
--- /dev/null
+++ b/src/isinf.c
@@ -0,0 +1,29 @@
+/* mpfr_inf_p -- check for infinities
+
+Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+(mpfr_inf_p) (mpfr_srcptr x)
+{
+ return MPFR_IS_INF(x);
+}
diff --git a/src/isinteger.c b/src/isinteger.c
new file mode 100644
index 0000000..b82a95d
--- /dev/null
+++ b/src/isinteger.c
@@ -0,0 +1,59 @@
+/* mpfr_integer_p -- test if a mpfr variable is integer.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#include "mpfr-impl.h"
+
+int
+mpfr_integer_p (mpfr_srcptr x)
+{
+ mpfr_exp_t expo;
+ mpfr_prec_t prec;
+ mp_size_t xn;
+ mp_limb_t *xp;
+
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x)))
+ return (MPFR_IS_ZERO(x));
+
+ expo = MPFR_GET_EXP (x);
+ if (expo <= 0)
+ return 0;
+
+ prec = MPFR_PREC(x);
+ if ((mpfr_uexp_t) expo >= (mpfr_uexp_t) prec)
+ return 1;
+
+ /* 0 < expo < prec */
+
+ xn = (mp_size_t) ((prec - 1) / GMP_NUMB_BITS); /* index of last limb */
+ xn -= (mp_size_t) (expo / GMP_NUMB_BITS);
+ /* now the index of the last limb containing bits of the fractional part */
+
+ xp = MPFR_MANT(x);
+ MPFR_ASSERTN(xn >= 0);
+ if (xp[xn] << (expo % GMP_NUMB_BITS) != 0)
+ return 0;
+ while (--xn >= 0)
+ if (xp[xn] != 0)
+ return 0;
+ return 1;
+}
diff --git a/src/isnan.c b/src/isnan.c
new file mode 100644
index 0000000..4049701
--- /dev/null
+++ b/src/isnan.c
@@ -0,0 +1,29 @@
+/* mpfr_nan_p -- check for NaN
+
+Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+(mpfr_nan_p) (mpfr_srcptr x)
+{
+ return MPFR_IS_NAN (x);
+}
diff --git a/src/isnum.c b/src/isnum.c
new file mode 100644
index 0000000..9f25138
--- /dev/null
+++ b/src/isnum.c
@@ -0,0 +1,29 @@
+/* mpfr_number_p -- check for ordinary numbers
+
+Copyright 2000, 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_number_p (mpfr_srcptr x)
+{
+ return MPFR_IS_FP(x);
+}
diff --git a/src/isqrt.c b/src/isqrt.c
new file mode 100644
index 0000000..34d02ff
--- /dev/null
+++ b/src/isqrt.c
@@ -0,0 +1,84 @@
+/* __gmpfr_isqrt && __gmpfr_cuberoot -- Integer square root and cube root
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* returns floor(sqrt(n)) */
+unsigned long
+__gmpfr_isqrt (unsigned long n)
+{
+ unsigned long i, s;
+
+ /* First find an approximation to floor(sqrt(n)) of the form 2^k. */
+ i = n;
+ s = 1;
+ while (i >= 2)
+ {
+ i >>= 2;
+ s <<= 1;
+ }
+
+ do
+ {
+ s = (s + n / s) / 2;
+ }
+ while (!(s*s <= n && (s*s > s*(s+2) || n <= s*(s+2))));
+ /* Short explanation: As mathematically s*(s+2) < 2*ULONG_MAX,
+ the condition s*s > s*(s+2) is evaluated as true when s*(s+2)
+ "overflows" but not s*s. This implies that mathematically, one
+ has s*s <= n <= s*(s+2). If s*s "overflows", this means that n
+ is "large" and the inequality n <= s*(s+2) cannot be satisfied. */
+ return s;
+}
+
+/* returns floor(n^(1/3)) */
+unsigned long
+__gmpfr_cuberoot (unsigned long n)
+{
+ unsigned long i, s;
+
+ /* First find an approximation to floor(cbrt(n)) of the form 2^k. */
+ i = n;
+ s = 1;
+ while (i >= 4)
+ {
+ i >>= 3;
+ s <<= 1;
+ }
+
+ /* Improve the approximation (this is necessary if n is large, so that
+ mathematically (s+1)*(s+1)*(s+1) isn't much larger than ULONG_MAX). */
+ if (n >= 256)
+ {
+ s = (2 * s + n / (s * s)) / 3;
+ s = (2 * s + n / (s * s)) / 3;
+ s = (2 * s + n / (s * s)) / 3;
+ }
+
+ do
+ {
+ s = (2 * s + n / (s * s)) / 3;
+ }
+ while (!(s*s*s <= n && (s*s*s > (s+1)*(s+1)*(s+1) ||
+ n < (s+1)*(s+1)*(s+1))));
+ return s;
+}
diff --git a/src/isregular.c b/src/isregular.c
new file mode 100644
index 0000000..51f47ab
--- /dev/null
+++ b/src/isregular.c
@@ -0,0 +1,29 @@
+/* mpfr_regular_p -- check for regular number (neither NaN, Inf or zero)
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+(mpfr_regular_p) (mpfr_srcptr x)
+{
+ return MPFR_IS_SINGULAR(x) == 0;
+}
diff --git a/src/iszero.c b/src/iszero.c
new file mode 100644
index 0000000..ed9e9f7
--- /dev/null
+++ b/src/iszero.c
@@ -0,0 +1,29 @@
+/* mpfr_zero_p -- check for zero
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+(mpfr_zero_p) (mpfr_srcptr x)
+{
+ return MPFR_IS_ZERO(x);
+}
diff --git a/src/jn.c b/src/jn.c
new file mode 100644
index 0000000..f857207
--- /dev/null
+++ b/src/jn.c
@@ -0,0 +1,329 @@
+/* mpfr_j0, mpfr_j1, mpfr_jn -- Bessel functions of 1st kind, integer order.
+ http://www.opengroup.org/onlinepubs/009695399/functions/j0.html
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Relations: j(-n,z) = (-1)^n j(n,z)
+ j(n,-z) = (-1)^n j(n,z)
+*/
+
+static int mpfr_jn_asympt (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t);
+
+int
+mpfr_j0 (mpfr_ptr res, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ return mpfr_jn (res, 0, z, r);
+}
+
+int
+mpfr_j1 (mpfr_ptr res, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ return mpfr_jn (res, 1, z, r);
+}
+
+/* Estimate k1 such that z^2/4 = k1 * (k1 + n)
+ i.e., k1 = (sqrt(n^2+z^2)-n)/2 = n/2 * (sqrt(1+(z/n)^2) - 1) if n != 0.
+ Return k0 = min(2*k1/log(2), ULONG_MAX).
+*/
+static unsigned long
+mpfr_jn_k0 (unsigned long n, mpfr_srcptr z)
+{
+ mpfr_t t, u;
+ unsigned long k0;
+
+ mpfr_init2 (t, 32);
+ mpfr_init2 (u, 32);
+ if (n == 0)
+ {
+ mpfr_abs (t, z, MPFR_RNDN); /* t = 2*k1 */
+ }
+ else
+ {
+ mpfr_div_ui (t, z, n, MPFR_RNDN);
+ mpfr_sqr (t, t, MPFR_RNDN);
+ mpfr_add_ui (t, t, 1, MPFR_RNDN);
+ mpfr_sqrt (t, t, MPFR_RNDN);
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN);
+ mpfr_mul_ui (t, t, n, MPFR_RNDN); /* t = 2*k1 */
+ }
+ /* the following is a 32-bit approximation to nearest to 1/log(2) */
+ mpfr_set_str_binary (u, "1.0111000101010100011101100101001");
+ mpfr_mul (t, t, u, MPFR_RNDN);
+ if (mpfr_fits_ulong_p (t, MPFR_RNDN))
+ k0 = mpfr_get_ui (t, MPFR_RNDN);
+ else
+ k0 = ULONG_MAX;
+ mpfr_clear (t);
+ mpfr_clear (u);
+ return k0;
+}
+
+int
+mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ int inex;
+ int exception = 0;
+ unsigned long absn;
+ mpfr_prec_t prec, pbound, err;
+ mpfr_uprec_t uprec;
+ mpfr_exp_t exps, expT, diffexp;
+ mpfr_t y, s, t, absz;
+ unsigned long k, zz, k0;
+ MPFR_GROUP_DECL(g);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("n=%d x[%Pu]=%.*Rg rnd=%d", n, mpfr_get_prec (z), mpfr_log_prec, z, r),
+ ("res[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (res), mpfr_log_prec, res, inex));
+
+ absn = SAFE_ABS (unsigned long, n);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (z)))
+ {
+ if (MPFR_IS_NAN (z))
+ {
+ MPFR_SET_NAN (res);
+ MPFR_RET_NAN;
+ }
+ /* j(n,z) tends to zero when z goes to +Inf or -Inf, oscillating around
+ 0. We choose to return +0 in that case. */
+ else if (MPFR_IS_INF (z)) /* FIXME: according to j(-n,z) = (-1)^n j(n,z)
+ we might want to give a sign depending on
+ z and n */
+ return mpfr_set_ui (res, 0, r);
+ else /* z=0: j(0,0)=1, j(n odd,+/-0) = +/-0 if n > 0, -/+0 if n < 0,
+ j(n even,+/-0) = +0 */
+ {
+ if (n == 0)
+ return mpfr_set_ui (res, 1, r);
+ else if (absn & 1) /* n odd */
+ return (n > 0) ? mpfr_set (res, z, r) : mpfr_neg (res, z, r);
+ else /* n even */
+ return mpfr_set_ui (res, 0, r);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* check for tiny input for j0: j0(z) = 1 - z^2/4 + ..., more precisely
+ |j0(z) - 1| <= z^2/4 for -1 <= z <= 1. */
+ if (n == 0)
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (res, __gmpfr_one, -2 * MPFR_GET_EXP (z),
+ 2, 0, r, inex = _inexact; goto end);
+
+ /* idem for j1: j1(z) = z/2 - z^3/16 + ..., more precisely
+ |j1(z) - z/2| <= |z^3|/16 for -1 <= z <= 1, with the sign of j1(z) - z/2
+ being the opposite of that of z. */
+ /* TODO: add a test to trigger an error when
+ inex = _inexact; goto end
+ is forgotten in MPFR_FAST_COMPUTE_IF_SMALL_INPUT below. */
+ if (n == 1)
+ {
+ /* We first compute 2j1(z) = z - z^3/8 + ..., then divide by 2 using
+ the "extra" argument of MPFR_FAST_COMPUTE_IF_SMALL_INPUT. But we
+ must also handle the underflow case (an overflow is not possible
+ for small inputs). If an underflow occurred in mpfr_round_near_x,
+ the rounding was to zero or equivalent, and the result is 0, so
+ that the division by 2 will give the wanted result. Otherwise...
+ The rounded result in unbounded exponent range is res/2. If the
+ division by 2 doesn't underflow, it is exact, and we can return
+ this result. And an underflow in the division is a real underflow.
+ In case of directed rounding mode, the result is correct. But in
+ case of rounding to nearest, there is a double rounding problem,
+ and the result is 0 iff the result before the division is the
+ minimum positive number and _inexact has the same sign as z;
+ but in rounding to nearest, res/2 will yield 0 iff |res| is the
+ minimum positive number, so that we just need to test the result
+ of the division and the sign of _inexact. */
+ mpfr_clear_flags ();
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT
+ (res, z, -2 * MPFR_GET_EXP (z), 3, 0, r, {
+ int inex2 = mpfr_div_2ui (res, res, 1, r);
+ if (MPFR_UNLIKELY (r == MPFR_RNDN && MPFR_IS_ZERO (res)) &&
+ (MPFR_ASSERTN (inex2 != 0), SIGN (_inexact) != MPFR_SIGN (z)))
+ {
+ mpfr_nexttoinf (res);
+ inex = - inex2;
+ }
+ else
+ inex = inex2 != 0 ? inex2 : _inexact;
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ goto end;
+ });
+ }
+
+ /* we can use the asymptotic expansion as soon as |z| > p log(2)/2,
+ but to get some margin we use it for |z| > p/2 */
+ pbound = MPFR_PREC (res) / 2 + 3;
+ MPFR_ASSERTN (pbound <= ULONG_MAX);
+ MPFR_ALIAS (absz, z, 1, MPFR_EXP (z));
+ if (mpfr_cmp_ui (absz, pbound) > 0)
+ {
+ inex = mpfr_jn_asympt (res, n, z, r);
+ if (inex != 0)
+ goto end;
+ }
+
+ MPFR_GROUP_INIT_3 (g, 32, y, s, t);
+
+ /* check underflow case: |j(n,z)| <= 1/sqrt(2 Pi n) (ze/2n)^n
+ (see algorithms.tex) */
+ /* FIXME: the code below doesn't detect all the underflow cases. Either
+ this should be done, or the generic code should detect underflows. */
+ if (absn > 0)
+ {
+ /* the following is an upper 32-bit approximation to exp(1)/2 */
+ mpfr_set_str_binary (y, "1.0101101111110000101010001011001");
+ if (MPFR_SIGN(z) > 0)
+ mpfr_mul (y, y, z, MPFR_RNDU);
+ else
+ {
+ mpfr_mul (y, y, z, MPFR_RNDD);
+ mpfr_neg (y, y, MPFR_RNDU);
+ }
+ mpfr_div_ui (y, y, absn, MPFR_RNDU);
+ /* now y is an upper approximation to |ze/2n|: y < 2^EXP(y),
+ thus |j(n,z)| < 1/2*y^n < 2^(n*EXP(y)-1).
+ If n*EXP(y) < emin then we have an underflow.
+ Note that if emin = MPFR_EMIN_MIN and j = 1, this inequality
+ will never be satisfied.
+ Warning: absn is an unsigned long. */
+ if ((MPFR_GET_EXP (y) < 0 && absn > - expo.saved_emin)
+ || (absn <= - MPFR_EMIN_MIN &&
+ MPFR_GET_EXP (y) < expo.saved_emin / (mpfr_exp_t) absn))
+ {
+ MPFR_GROUP_CLEAR (g);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (res, (r == MPFR_RNDN) ? MPFR_RNDZ : r,
+ (n % 2) ? ((n > 0) ? MPFR_SIGN(z) : -MPFR_SIGN(z))
+ : MPFR_SIGN_POS);
+ }
+ }
+
+ /* the logarithm of the ratio between the largest term in the series
+ and the first one is roughly bounded by k0, which we add to the
+ working precision to take into account this cancellation */
+ /* The following operations avoid integer overflow and ensure that
+ prec <= MPFR_PREC_MAX (prec = MPFR_PREC_MAX won't prevent an abort,
+ but the failure should be handled cleanly). */
+ k0 = mpfr_jn_k0 (absn, z);
+ MPFR_LOG_MSG (("k0 = %lu\n", k0));
+ uprec = MPFR_PREC_MAX - 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC_MAX) - 3;
+ if (k0 < uprec)
+ uprec = k0;
+ uprec += MPFR_PREC (res) + 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC (res)) + 3;
+ prec = uprec < MPFR_PREC_MAX ? (mpfr_prec_t) uprec : MPFR_PREC_MAX;
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_GROUP_REPREC_3 (g, prec, y, s, t);
+ MPFR_BLOCK (flags, {
+ mpfr_pow_ui (t, z, absn, MPFR_RNDN); /* z^|n| */
+ mpfr_mul (y, z, z, MPFR_RNDN); /* z^2 */
+ mpfr_clear_erangeflag ();
+ zz = mpfr_get_ui (y, MPFR_RNDU);
+ /* FIXME: The error analysis is incorrect in case of range error. */
+ MPFR_ASSERTN (! mpfr_erangeflag_p ()); /* since mpfr_clear_erangeflag */
+ mpfr_div_2ui (y, y, 2, MPFR_RNDN); /* z^2/4 */
+ mpfr_fac_ui (s, absn, MPFR_RNDN); /* |n|! */
+ mpfr_div (t, t, s, MPFR_RNDN);
+ if (absn > 0)
+ mpfr_div_2ui (t, t, absn, MPFR_RNDN);
+ mpfr_set (s, t, MPFR_RNDN);
+ /* note: we assume here that the maximal error bound is proportional to
+ 2^exps, which is true also in the case where s=0 */
+ exps = MPFR_IS_ZERO (s) ? MPFR_EMIN_MIN : MPFR_GET_EXP (s);
+ expT = exps;
+ for (k = 1; ; k++)
+ {
+ MPFR_LOG_MSG (("loop on k, k = %lu\n", k));
+ mpfr_mul (t, t, y, MPFR_RNDN);
+ mpfr_neg (t, t, MPFR_RNDN);
+ /* Mathematically: absn <= LONG_MAX + 1 <= (ULONG_MAX + 1) / 2,
+ and in practice, k is not very large, so that one should have
+ k + absn <= ULONG_MAX. */
+ MPFR_ASSERTN (absn <= ULONG_MAX - k);
+ if (k + absn <= ULONG_MAX / k)
+ mpfr_div_ui (t, t, k * (k + absn), MPFR_RNDN);
+ else
+ {
+ mpfr_div_ui (t, t, k, MPFR_RNDN);
+ mpfr_div_ui (t, t, k + absn, MPFR_RNDN);
+ }
+ /* see above note */
+ exps = MPFR_IS_ZERO (s) ? MPFR_EMIN_MIN : MPFR_GET_EXP (t);
+ if (exps > expT)
+ expT = exps;
+ mpfr_add (s, s, t, MPFR_RNDN);
+ exps = MPFR_IS_ZERO (s) ? MPFR_EMIN_MIN : MPFR_GET_EXP (s);
+ if (exps > expT)
+ expT = exps;
+ /* Above it has been checked that k + absn <= ULONG_MAX. */
+ if (MPFR_GET_EXP (t) + (mpfr_exp_t) prec <= exps &&
+ zz / (2 * k) < k + absn)
+ break;
+ }
+ });
+ /* the error is bounded by (4k^2+21/2k+7) ulp(s)*2^(expT-exps)
+ <= (k+2)^2 ulp(s)*2^(2+expT-exps) */
+ diffexp = expT - exps;
+ err = 2 * MPFR_INT_CEIL_LOG2(k + 2) + 2;
+ /* FIXME: Can an overflow occur in the following sum? */
+ MPFR_ASSERTN (diffexp >= 0 && err >= 0 &&
+ diffexp <= MPFR_PREC_MAX - err);
+ err += diffexp;
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, prec - err, MPFR_PREC(res), r)))
+ {
+ if (MPFR_LIKELY (! (MPFR_UNDERFLOW (flags) ||
+ MPFR_OVERFLOW (flags))))
+ break;
+ /* The error analysis is incorrect in case of exception.
+ If an underflow or overflow occurred, try once more in
+ a larger precision, and if this happens a second time,
+ then abort to avoid a probable infinite loop. This is
+ a problem that must be fixed! */
+ MPFR_ASSERTN (! exception);
+ exception = 1;
+ }
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inex = ((n >= 0) || ((n & 1) == 0)) ? mpfr_set (res, s, r)
+ : mpfr_neg (res, s, r);
+
+ MPFR_GROUP_CLEAR (g);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (res, inex, r);
+}
+
+#define MPFR_JN
+#include "jyn_asympt.c"
diff --git a/src/jyn_asympt.c b/src/jyn_asympt.c
new file mode 100644
index 0000000..2f0e2fd
--- /dev/null
+++ b/src/jyn_asympt.c
@@ -0,0 +1,269 @@
+/* mpfr_jn_asympt, mpfr_yn_asympt -- shared code for mpfr_jn and mpfr_yn
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef MPFR_JN
+# define FUNCTION mpfr_jn_asympt
+#else
+# ifdef MPFR_YN
+# define FUNCTION mpfr_yn_asympt
+# else
+# error "neither MPFR_JN nor MPFR_YN is defined"
+# endif
+#endif
+
+/* Implements asymptotic expansion for jn or yn (formulae 9.2.5 and 9.2.6
+ from Abramowitz & Stegun).
+ Assumes |z| > p log(2)/2, where p is the target precision
+ (z can be negative only for jn).
+ Return 0 if the expansion does not converge enough (the value 0 as inexact
+ flag should not happen for normal input).
+*/
+static int
+FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ mpfr_t s, c, P, Q, t, iz, err_t, err_s, err_u;
+ mpfr_prec_t w;
+ long k;
+ int inex, stop, diverge = 0;
+ mpfr_exp_t err2, err;
+ MPFR_ZIV_DECL (loop);
+
+ mpfr_init (c);
+
+ w = MPFR_PREC(res) + MPFR_INT_CEIL_LOG2(MPFR_PREC(res)) + 4;
+
+ MPFR_ZIV_INIT (loop, w);
+ for (;;)
+ {
+ mpfr_set_prec (c, w);
+ mpfr_init2 (s, w);
+ mpfr_init2 (P, w);
+ mpfr_init2 (Q, w);
+ mpfr_init2 (t, w);
+ mpfr_init2 (iz, w);
+ mpfr_init2 (err_t, 31);
+ mpfr_init2 (err_s, 31);
+ mpfr_init2 (err_u, 31);
+
+ /* Approximate sin(z) and cos(z). In the following, err <= k means that
+ the approximate value y and the true value x are related by
+ y = x * (1 + u)^k with |u| <= 2^(-w), following Higham's method. */
+ mpfr_sin_cos (s, c, z, MPFR_RNDN);
+ if (MPFR_IS_NEG(z))
+ mpfr_neg (s, s, MPFR_RNDN); /* compute jn/yn(|z|), fix sign later */
+ /* The absolute error on s/c is bounded by 1/2 ulp(1/2) <= 2^(-w-1). */
+ mpfr_add (t, s, c, MPFR_RNDN);
+ mpfr_sub (c, s, c, MPFR_RNDN);
+ mpfr_swap (s, t);
+ /* now s approximates sin(z)+cos(z), and c approximates sin(z)-cos(z),
+ with total absolute error bounded by 2^(1-w). */
+
+ /* precompute 1/(8|z|) */
+ mpfr_si_div (iz, MPFR_IS_POS(z) ? 1 : -1, z, MPFR_RNDN); /* err <= 1 */
+ mpfr_div_2ui (iz, iz, 3, MPFR_RNDN);
+
+ /* compute P and Q */
+ mpfr_set_ui (P, 1, MPFR_RNDN);
+ mpfr_set_ui (Q, 0, MPFR_RNDN);
+ mpfr_set_ui (t, 1, MPFR_RNDN); /* current term */
+ mpfr_set_ui (err_t, 0, MPFR_RNDN); /* error on t */
+ mpfr_set_ui (err_s, 0, MPFR_RNDN); /* error on P and Q (sum of errors) */
+ for (k = 1, stop = 0; stop < 4; k++)
+ {
+ /* compute next term: t(k)/t(k-1) = (2n+2k-1)(2n-2k+1)/(8kz) */
+ mpfr_mul_si (t, t, 2 * (n + k) - 1, MPFR_RNDN); /* err <= err_k + 1 */
+ mpfr_mul_si (t, t, 2 * (n - k) + 1, MPFR_RNDN); /* err <= err_k + 2 */
+ mpfr_div_ui (t, t, k, MPFR_RNDN); /* err <= err_k + 3 */
+ mpfr_mul (t, t, iz, MPFR_RNDN); /* err <= err_k + 5 */
+ /* the relative error on t is bounded by (1+u)^(5k)-1, which is
+ bounded by 6ku for 6ku <= 0.02: first |5 log(1+u)| <= |5.5u|
+ for |u| <= 0.15, then |exp(5.5u)-1| <= 6u for |u| <= 0.02. */
+ mpfr_mul_ui (err_t, t, 6 * k, MPFR_IS_POS(t) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_abs (err_t, err_t, MPFR_RNDN); /* exact */
+ /* the absolute error on t is bounded by err_t * 2^(-w) */
+ mpfr_abs (err_u, t, MPFR_RNDU);
+ mpfr_mul_2ui (err_u, err_u, w, MPFR_RNDU); /* t * 2^w */
+ mpfr_add (err_u, err_u, err_t, MPFR_RNDU); /* max|t| * 2^w */
+ if (stop >= 2)
+ {
+ /* take into account the neglected terms: t * 2^w */
+ mpfr_div_2ui (err_s, err_s, w, MPFR_RNDU);
+ if (MPFR_IS_POS(t))
+ mpfr_add (err_s, err_s, t, MPFR_RNDU);
+ else
+ mpfr_sub (err_s, err_s, t, MPFR_RNDU);
+ mpfr_mul_2ui (err_s, err_s, w, MPFR_RNDU);
+ stop ++;
+ }
+ /* if k is odd, add to Q, otherwise to P */
+ else if (k & 1)
+ {
+ /* if k = 1 mod 4, add, otherwise subtract */
+ if ((k & 2) == 0)
+ mpfr_add (Q, Q, t, MPFR_RNDN);
+ else
+ mpfr_sub (Q, Q, t, MPFR_RNDN);
+ /* check if the next term is smaller than ulp(Q): if EXP(err_u)
+ <= EXP(Q), since the current term is bounded by
+ err_u * 2^(-w), it is bounded by ulp(Q) */
+ if (MPFR_EXP(err_u) <= MPFR_EXP(Q))
+ stop ++;
+ else
+ stop = 0;
+ }
+ else
+ {
+ /* if k = 0 mod 4, add, otherwise subtract */
+ if ((k & 2) == 0)
+ mpfr_add (P, P, t, MPFR_RNDN);
+ else
+ mpfr_sub (P, P, t, MPFR_RNDN);
+ /* check if the next term is smaller than ulp(P) */
+ if (MPFR_EXP(err_u) <= MPFR_EXP(P))
+ stop ++;
+ else
+ stop = 0;
+ }
+ mpfr_add (err_s, err_s, err_t, MPFR_RNDU);
+ /* the sum of the rounding errors on P and Q is bounded by
+ err_s * 2^(-w) */
+
+ /* stop when start to diverge */
+ if (stop < 2 &&
+ ((MPFR_IS_POS(z) && mpfr_cmp_ui (z, (k + 1) / 2) < 0) ||
+ (MPFR_IS_NEG(z) && mpfr_cmp_si (z, - ((k + 1) / 2)) > 0)))
+ {
+ /* if we have to stop the series because it diverges, then
+ increasing the precision will most probably fail, since
+ we will stop to the same point, and thus compute a very
+ similar approximation */
+ diverge = 1;
+ stop = 2; /* force stop */
+ }
+ }
+ /* the sum of the total errors on P and Q is bounded by err_s * 2^(-w) */
+
+ /* Now combine: the sum of the rounding errors on P and Q is bounded by
+ err_s * 2^(-w), and the absolute error on s/c is bounded by 2^(1-w) */
+ if ((n & 1) == 0) /* n even: P * (sin + cos) + Q (cos - sin) for jn
+ Q * (sin + cos) + P (sin - cos) for yn */
+ {
+#ifdef MPFR_JN
+ mpfr_mul (c, c, Q, MPFR_RNDN); /* Q * (sin - cos) */
+ mpfr_mul (s, s, P, MPFR_RNDN); /* P * (sin + cos) */
+#else
+ mpfr_mul (c, c, P, MPFR_RNDN); /* P * (sin - cos) */
+ mpfr_mul (s, s, Q, MPFR_RNDN); /* Q * (sin + cos) */
+#endif
+ err = MPFR_EXP(c);
+ if (MPFR_EXP(s) > err)
+ err = MPFR_EXP(s);
+#ifdef MPFR_JN
+ mpfr_sub (s, s, c, MPFR_RNDN);
+#else
+ mpfr_add (s, s, c, MPFR_RNDN);
+#endif
+ }
+ else /* n odd: P * (sin - cos) + Q (cos + sin) for jn,
+ Q * (sin - cos) - P (cos + sin) for yn */
+ {
+#ifdef MPFR_JN
+ mpfr_mul (c, c, P, MPFR_RNDN); /* P * (sin - cos) */
+ mpfr_mul (s, s, Q, MPFR_RNDN); /* Q * (sin + cos) */
+#else
+ mpfr_mul (c, c, Q, MPFR_RNDN); /* Q * (sin - cos) */
+ mpfr_mul (s, s, P, MPFR_RNDN); /* P * (sin + cos) */
+#endif
+ err = MPFR_EXP(c);
+ if (MPFR_EXP(s) > err)
+ err = MPFR_EXP(s);
+#ifdef MPFR_JN
+ mpfr_add (s, s, c, MPFR_RNDN);
+#else
+ mpfr_sub (s, c, s, MPFR_RNDN);
+#endif
+ }
+ if ((n & 2) != 0)
+ mpfr_neg (s, s, MPFR_RNDN);
+ if (MPFR_EXP(s) > err)
+ err = MPFR_EXP(s);
+ /* the absolute error on s is bounded by P*err(s/c) + Q*err(s/c)
+ + err(P)*(s/c) + err(Q)*(s/c) + 3 * 2^(err - w - 1)
+ <= (|P|+|Q|) * 2^(1-w) + err_s * 2^(1-w) + 2^err * 2^(1-w),
+ since |c|, |old_s| <= 2. */
+ err2 = (MPFR_EXP(P) >= MPFR_EXP(Q)) ? MPFR_EXP(P) + 2 : MPFR_EXP(Q) + 2;
+ /* (|P| + |Q|) * 2^(1 - w) <= 2^(err2 - w) */
+ err = MPFR_EXP(err_s) >= err ? MPFR_EXP(err_s) + 2 : err + 2;
+ /* err_s * 2^(1-w) + 2^old_err * 2^(1-w) <= 2^err * 2^(-w) */
+ err2 = (err >= err2) ? err + 1 : err2 + 1;
+ /* now the absolute error on s is bounded by 2^(err2 - w) */
+
+ /* multiply by sqrt(1/(Pi*z)) */
+ mpfr_const_pi (c, MPFR_RNDN); /* Pi, err <= 1 */
+ mpfr_mul (c, c, z, MPFR_RNDN); /* err <= 2 */
+ mpfr_si_div (c, MPFR_IS_POS(z) ? 1 : -1, c, MPFR_RNDN); /* err <= 3 */
+ mpfr_sqrt (c, c, MPFR_RNDN); /* err<=5/2, thus the absolute error is
+ bounded by 3*u*|c| for |u| <= 0.25 */
+ mpfr_mul (err_t, c, s, MPFR_SIGN(c)==MPFR_SIGN(s) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_abs (err_t, err_t, MPFR_RNDU);
+ mpfr_mul_ui (err_t, err_t, 3, MPFR_RNDU);
+ /* 3*2^(-w)*|old_c|*|s| [see below] is bounded by err_t * 2^(-w) */
+ err2 += MPFR_EXP(c);
+ /* |old_c| * 2^(err2 - w) [see below] is bounded by 2^(err2-w) */
+ mpfr_mul (c, c, s, MPFR_RNDN); /* the absolute error on c is bounded by
+ 1/2 ulp(c) + 3*2^(-w)*|old_c|*|s|
+ + |old_c| * 2^(err2 - w) */
+ /* compute err_t * 2^(-w) + 1/2 ulp(c) = (err_t + 2^EXP(c)) * 2^(-w) */
+ err = (MPFR_EXP(err_t) > MPFR_EXP(c)) ? MPFR_EXP(err_t) + 1 : MPFR_EXP(c) + 1;
+ /* err_t * 2^(-w) + 1/2 ulp(c) <= 2^(err - w) */
+ /* now err_t * 2^(-w) bounds 1/2 ulp(c) + 3*2^(-w)*|old_c|*|s| */
+ err = (err >= err2) ? err + 1 : err2 + 1;
+ /* the absolute error on c is bounded by 2^(err - w) */
+
+ mpfr_clear (s);
+ mpfr_clear (P);
+ mpfr_clear (Q);
+ mpfr_clear (t);
+ mpfr_clear (iz);
+ mpfr_clear (err_t);
+ mpfr_clear (err_s);
+ mpfr_clear (err_u);
+
+ err -= MPFR_EXP(c);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (c, w - err, MPFR_PREC(res), r)))
+ break;
+ if (diverge != 0)
+ {
+ mpfr_set (c, z, r); /* will force inex=0 below, which means the
+ asymptotic expansion failed */
+ break;
+ }
+ MPFR_ZIV_NEXT (loop, w);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inex = (MPFR_IS_POS(z) || ((n & 1) == 0)) ? mpfr_set (res, c, r)
+ : mpfr_neg (res, c, r);
+ mpfr_clear (c);
+
+ return inex;
+}
diff --git a/src/li2.c b/src/li2.c
new file mode 100644
index 0000000..c118c0f
--- /dev/null
+++ b/src/li2.c
@@ -0,0 +1,634 @@
+/* mpfr_li2 -- Dilogarithm.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Compute the alternating series
+ s = S(z) = \sum_{k=0}^infty B_{2k} (z))^{2k+1} / (2k+1)!
+ with 0 < z <= log(2) to the precision of s rounded in the direction
+ rnd_mode.
+ Return the maximum index of the truncature which is useful
+ for determinating the relative error.
+*/
+static int
+li2_series (mpfr_t sum, mpfr_srcptr z, mpfr_rnd_t rnd_mode)
+{
+ int i, Bm, Bmax;
+ mpfr_t s, u, v, w;
+ mpfr_prec_t sump, p;
+ mpfr_exp_t se, err;
+ mpz_t *B;
+ MPFR_ZIV_DECL (loop);
+
+ /* The series converges for |z| < 2 pi, but in mpfr_li2 the argument is
+ reduced so that 0 < z <= log(2). Here is additionnal check that z is
+ (nearly) correct */
+ MPFR_ASSERTD (MPFR_IS_STRICTPOS (z));
+ MPFR_ASSERTD (mpfr_cmp_d (z, 0.6953125) <= 0);
+
+ sump = MPFR_PREC (sum); /* target precision */
+ p = sump + MPFR_INT_CEIL_LOG2 (sump) + 4; /* the working precision */
+ mpfr_init2 (s, p);
+ mpfr_init2 (u, p);
+ mpfr_init2 (v, p);
+ mpfr_init2 (w, p);
+
+ B = mpfr_bernoulli_internal ((mpz_t *) 0, 0);
+ Bm = Bmax = 1;
+
+ MPFR_ZIV_INIT (loop, p);
+ for (;;)
+ {
+ mpfr_sqr (u, z, MPFR_RNDU);
+ mpfr_set (v, z, MPFR_RNDU);
+ mpfr_set (s, z, MPFR_RNDU);
+ se = MPFR_GET_EXP (s);
+ err = 0;
+
+ for (i = 1;; i++)
+ {
+ if (i >= Bmax)
+ B = mpfr_bernoulli_internal (B, Bmax++); /* B_2i*(2i+1)!, exact */
+
+ mpfr_mul (v, u, v, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i + 1, MPFR_RNDU);
+ mpfr_div_ui (v, v, 2 * i + 1, MPFR_RNDU);
+ /* here, v_2i = v_{2i-2} / (2i * (2i+1))^2 */
+
+ mpfr_mul_z (w, v, B[i], MPFR_RNDN);
+ /* here, w_2i = v_2i * B_2i * (2i+1)! with
+ error(w_2i) < 2^(5 * i + 8) ulp(w_2i) (see algorithms.tex) */
+
+ mpfr_add (s, s, w, MPFR_RNDN);
+
+ err = MAX (err + se, 5 * i + 8 + MPFR_GET_EXP (w))
+ - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err);
+ se = MPFR_GET_EXP (s);
+ if (MPFR_GET_EXP (w) <= se - (mpfr_exp_t) p)
+ break;
+ }
+
+ /* the previous value of err is the rounding error,
+ the truncation error is less than EXP(z) - 6 * i - 5
+ (see algorithms.tex) */
+ err = MAX (err, MPFR_GET_EXP (z) - 6 * i - 5) + 1;
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) p - err, sump, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, p);
+ mpfr_set_prec (s, p);
+ mpfr_set_prec (u, p);
+ mpfr_set_prec (v, p);
+ mpfr_set_prec (w, p);
+ }
+ MPFR_ZIV_FREE (loop);
+ mpfr_set (sum, s, rnd_mode);
+
+ Bm = Bmax;
+ while (Bm--)
+ mpz_clear (B[Bm]);
+ (*__gmp_free_func) (B, Bmax * sizeof (mpz_t));
+ mpfr_clears (s, u, v, w, (mpfr_ptr) 0);
+
+ /* Let K be the returned value.
+ 1. As we compute an alternating series, the truncation error has the same
+ sign as the next term w_{K+2} which is positive iff K%4 == 0.
+ 2. Assume that error(z) <= (1+t) z', where z' is the actual value, then
+ error(s) <= 2 * (K+1) * t (see algorithms.tex).
+ */
+ return 2 * i;
+}
+
+/* try asymptotic expansion when x is large and positive:
+ Li2(x) = -log(x)^2/2 + Pi^2/3 - 1/x + O(1/x^2).
+ More precisely for x >= 2 we have for g(x) = -log(x)^2/2 + Pi^2/3:
+ -2 <= x * (Li2(x) - g(x)) <= -1
+ thus |Li2(x) - g(x)| <= 2/x.
+ Assumes x >= 38, which ensures log(x)^2/2 >= 2*Pi^2/3, and g(x) <= -3.3.
+ Return 0 if asymptotic expansion failed (unable to round), otherwise
+ returns correct ternary value.
+*/
+static int
+mpfr_li2_asympt_pos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t g, h;
+ mpfr_prec_t w = MPFR_PREC (y) + 20;
+ int inex = 0;
+
+ MPFR_ASSERTN (mpfr_cmp_ui (x, 38) >= 0);
+
+ mpfr_init2 (g, w);
+ mpfr_init2 (h, w);
+ mpfr_log (g, x, MPFR_RNDN); /* rel. error <= |(1 + theta) - 1| */
+ mpfr_sqr (g, g, MPFR_RNDN); /* rel. error <= |(1 + theta)^3 - 1| <= 2^(2-w) */
+ mpfr_div_2ui (g, g, 1, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_const_pi (h, MPFR_RNDN); /* error <= 2^(1-w) */
+ mpfr_sqr (h, h, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_div_ui (h, h, 3, MPFR_RNDN); /* rel. error <= |(1 + theta)^4 - 1|
+ <= 5 * 2^(-w) */
+ /* since x is chosen such that log(x)^2/2 >= 2 * (Pi^2/3), we should have
+ g >= 2*h, thus |g-h| >= |h|, and the relative error on g is at most
+ multiplied by 2 in the difference, and that by h is unchanged. */
+ MPFR_ASSERTN (MPFR_EXP (g) > MPFR_EXP (h));
+ mpfr_sub (g, h, g, MPFR_RNDN); /* err <= ulp(g)/2 + g*2^(3-w) + g*5*2^(-w)
+ <= ulp(g) * (1/2 + 8 + 5) < 14 ulp(g).
+
+ If in addition 2/x <= 2 ulp(g), i.e.,
+ 1/x <= ulp(g), then the total error is
+ bounded by 16 ulp(g). */
+ if ((MPFR_EXP (x) >= (mpfr_exp_t) w - MPFR_EXP (g)) &&
+ MPFR_CAN_ROUND (g, w - 4, MPFR_PREC (y), rnd_mode))
+ inex = mpfr_set (y, g, rnd_mode);
+
+ mpfr_clear (g);
+ mpfr_clear (h);
+
+ return inex;
+}
+
+/* try asymptotic expansion when x is large and negative:
+ Li2(x) = -log(-x)^2/2 - Pi^2/6 - 1/x + O(1/x^2).
+ More precisely for x <= -2 we have for g(x) = -log(-x)^2/2 - Pi^2/6:
+ |Li2(x) - g(x)| <= 1/|x|.
+ Assumes x <= -7, which ensures |log(-x)^2/2| >= Pi^2/6, and g(x) <= -3.5.
+ Return 0 if asymptotic expansion failed (unable to round), otherwise
+ returns correct ternary value.
+*/
+static int
+mpfr_li2_asympt_neg (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t g, h;
+ mpfr_prec_t w = MPFR_PREC (y) + 20;
+ int inex = 0;
+
+ MPFR_ASSERTN (mpfr_cmp_si (x, -7) <= 0);
+
+ mpfr_init2 (g, w);
+ mpfr_init2 (h, w);
+ mpfr_neg (g, x, MPFR_RNDN);
+ mpfr_log (g, g, MPFR_RNDN); /* rel. error <= |(1 + theta) - 1| */
+ mpfr_sqr (g, g, MPFR_RNDN); /* rel. error <= |(1 + theta)^3 - 1| <= 2^(2-w) */
+ mpfr_div_2ui (g, g, 1, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_const_pi (h, MPFR_RNDN); /* error <= 2^(1-w) */
+ mpfr_sqr (h, h, MPFR_RNDN); /* rel. error <= 2^(2-w) */
+ mpfr_div_ui (h, h, 6, MPFR_RNDN); /* rel. error <= |(1 + theta)^4 - 1|
+ <= 5 * 2^(-w) */
+ MPFR_ASSERTN (MPFR_EXP (g) >= MPFR_EXP (h));
+ mpfr_add (g, g, h, MPFR_RNDN); /* err <= ulp(g)/2 + g*2^(2-w) + g*5*2^(-w)
+ <= ulp(g) * (1/2 + 4 + 5) < 10 ulp(g).
+
+ If in addition |1/x| <= 4 ulp(g), then the
+ total error is bounded by 16 ulp(g). */
+ if ((MPFR_EXP (x) >= (mpfr_exp_t) (w - 2) - MPFR_EXP (g)) &&
+ MPFR_CAN_ROUND (g, w - 4, MPFR_PREC (y), rnd_mode))
+ inex = mpfr_neg (y, g, rnd_mode);
+
+ mpfr_clear (g);
+ mpfr_clear (h);
+
+ return inex;
+}
+
+/* Compute the real part of the dilogarithm defined by
+ Li2(x) = -\Int_{t=0}^x log(1-t)/t dt */
+int
+mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_exp_t err;
+ mpfr_prec_t yp, m;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ MPFR_SET_NEG (y);
+ MPFR_SET_INF (y);
+ MPFR_RET (0);
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_SET_ZERO (y);
+ MPFR_RET (0);
+ }
+ }
+
+ /* Li2(x) = x + x^2/4 + x^3/9 + ..., more precisely for 0 < x <= 1/2
+ we have |Li2(x) - x| < x^2/2 <= 2^(2EXP(x)-1) and for -1/2 <= x < 0
+ we have |Li2(x) - x| < x^2/4 <= 2^(2EXP(x)-2) */
+ if (MPFR_IS_POS (x))
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -MPFR_GET_EXP (x), 1, 1, rnd_mode,
+ {});
+ else
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -MPFR_GET_EXP (x), 2, 0, rnd_mode,
+ {});
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ yp = MPFR_PREC (y);
+ m = yp + MPFR_INT_CEIL_LOG2 (yp) + 13;
+
+ if (MPFR_LIKELY ((mpfr_cmp_ui (x, 0) > 0) && (mpfr_cmp_d (x, 0.5) <= 0)))
+ /* 0 < x <= 1/2: Li2(x) = S(-log(1-x))-log^2(1-x)/4 */
+ {
+ mpfr_t s, u;
+ mpfr_exp_t expo_l;
+ int k;
+
+ mpfr_init2 (u, m);
+ mpfr_init2 (s, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_ui_sub (u, 1, x, MPFR_RNDN);
+ mpfr_log (u, u, MPFR_RNDU);
+ if (MPFR_IS_ZERO(u))
+ goto next_m;
+ mpfr_neg (u, u, MPFR_RNDN); /* u = -log(1-x) */
+ expo_l = MPFR_GET_EXP (u);
+ k = li2_series (s, u, MPFR_RNDU);
+ err = 1 + MPFR_INT_CEIL_LOG2 (k + 1);
+
+ mpfr_sqr (u, u, MPFR_RNDU);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDU); /* u = log^2(1-x) / 4 */
+ mpfr_sub (s, s, u, MPFR_RNDN);
+
+ /* error(s) <= (0.5 + 2^(d-EXP(s))
+ + 2^(3 + MAX(1, - expo_l) - EXP(s))) ulp(s) */
+ err = MAX (err, MAX (1, - expo_l) - 1) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err);
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode))
+ break;
+
+ next_m:
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (u, m);
+ mpfr_set_prec (s, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+
+ mpfr_clear (u);
+ mpfr_clear (s);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+ else if (!mpfr_cmp_ui (x, 1))
+ /* Li2(1)= pi^2 / 6 */
+ {
+ mpfr_t u;
+ mpfr_init2 (u, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 6, MPFR_RNDN);
+
+ err = m - 4; /* error(u) <= 19/2 ulp(u) */
+ if (MPFR_CAN_ROUND (u, err, yp, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (u, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, u, rnd_mode);
+
+ mpfr_clear (u);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+ else if (mpfr_cmp_ui (x, 2) >= 0)
+ /* x >= 2: Li2(x) = -S(-log(1-1/x))-log^2(x)/2+log^2(1-1/x)/4+pi^2/3 */
+ {
+ int k;
+ mpfr_exp_t expo_l;
+ mpfr_t s, u, xx;
+
+ if (mpfr_cmp_ui (x, 38) >= 0)
+ {
+ inexact = mpfr_li2_asympt_pos (y, x, rnd_mode);
+ if (inexact != 0)
+ goto end_of_case_gt2;
+ }
+
+ mpfr_init2 (u, m);
+ mpfr_init2 (s, m);
+ mpfr_init2 (xx, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_ui_div (xx, 1, x, MPFR_RNDN);
+ mpfr_neg (xx, xx, MPFR_RNDN);
+ mpfr_log1p (u, xx, MPFR_RNDD);
+ mpfr_neg (u, u, MPFR_RNDU); /* u = -log(1-1/x) */
+ expo_l = MPFR_GET_EXP (u);
+ k = li2_series (s, u, MPFR_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
+ err = MPFR_INT_CEIL_LOG2 (k + 1) + 1; /* error(s) <= 2^err ulp(s) */
+
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u= log^2(1-1/x)/4 */
+ mpfr_add (s, s, u, MPFR_RNDN);
+ err =
+ MAX (err,
+ 3 + MAX (1, -expo_l) + MPFR_GET_EXP (u)) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */
+ err += MPFR_GET_EXP (s);
+
+ mpfr_log (u, x, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 1, MPFR_RNDN); /* u = log^2(x)/2 */
+ mpfr_sub (s, s, u, MPFR_RNDN);
+ err = MAX (err, 3 + MPFR_GET_EXP (u)) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */
+ err += MPFR_GET_EXP (s);
+
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 3, MPFR_RNDN); /* u = pi^2/3 */
+ mpfr_add (s, s, u, MPFR_RNDN);
+ err = MAX (err, 2) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err); /* error(s) <= 2^err ulp(s) */
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (u, m);
+ mpfr_set_prec (s, m);
+ mpfr_set_prec (xx, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+ mpfr_clears (s, u, xx, (mpfr_ptr) 0);
+
+ end_of_case_gt2:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+ else if (mpfr_cmp_ui (x, 1) > 0)
+ /* 2 > x > 1: Li2(x) = S(log(x))+log^2(x)/4-log(x)log(x-1)+pi^2/6 */
+ {
+ int k;
+ mpfr_exp_t e1, e2;
+ mpfr_t s, u, v, xx;
+ mpfr_init2 (s, m);
+ mpfr_init2 (u, m);
+ mpfr_init2 (v, m);
+ mpfr_init2 (xx, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_log (v, x, MPFR_RNDU);
+ k = li2_series (s, v, MPFR_RNDN);
+ e1 = MPFR_GET_EXP (s);
+
+ mpfr_sqr (u, v, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u = log^2(x)/4 */
+ mpfr_add (s, s, u, MPFR_RNDN);
+
+ mpfr_sub_ui (xx, x, 1, MPFR_RNDN);
+ mpfr_log (u, xx, MPFR_RNDU);
+ e2 = MPFR_GET_EXP (u);
+ mpfr_mul (u, v, u, MPFR_RNDN); /* u = log(x) * log(x-1) */
+ mpfr_sub (s, s, u, MPFR_RNDN);
+
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 6, MPFR_RNDN); /* u = pi^2/6 */
+ mpfr_add (s, s, u, MPFR_RNDN);
+ /* error(s) <= (31 + (k+1) * 2^(1-e1) + 2^(1-e2)) ulp(s)
+ see algorithms.tex */
+ err = MAX (MPFR_INT_CEIL_LOG2 (k + 1) + 1 - e1, 1 - e2);
+ err = 2 + MAX (5, err);
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (s, m);
+ mpfr_set_prec (u, m);
+ mpfr_set_prec (v, m);
+ mpfr_set_prec (xx, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+
+ mpfr_clears (s, u, v, xx, (mpfr_ptr) 0);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+ else if (mpfr_cmp_ui_2exp (x, 1, -1) > 0) /* 1/2 < x < 1 */
+ /* 1 > x > 1/2: Li2(x) = -S(-log(x))+log^2(x)/4-log(x)log(1-x)+pi^2/6 */
+ {
+ int k;
+ mpfr_t s, u, v, xx;
+ mpfr_init2 (s, m);
+ mpfr_init2 (u, m);
+ mpfr_init2 (v, m);
+ mpfr_init2 (xx, m);
+
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_log (u, x, MPFR_RNDD);
+ mpfr_neg (u, u, MPFR_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
+ err = 1 + MPFR_INT_CEIL_LOG2 (k + 1) - MPFR_GET_EXP (s);
+
+ mpfr_ui_sub (xx, 1, x, MPFR_RNDN);
+ mpfr_log (v, xx, MPFR_RNDU);
+ mpfr_mul (v, v, u, MPFR_RNDN); /* v = - log(x) * log(1-x) */
+ mpfr_add (s, s, v, MPFR_RNDN);
+ err = MAX (err, 1 - MPFR_GET_EXP (v));
+ err = 2 + MAX (3, err) - MPFR_GET_EXP (s);
+
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u = log^2(x)/4 */
+ mpfr_add (s, s, u, MPFR_RNDN);
+ err = MAX (err, 2 + MPFR_GET_EXP (u)) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
+
+ mpfr_const_pi (u, MPFR_RNDU);
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_ui (u, u, 6, MPFR_RNDN); /* u = pi^2/6 */
+ mpfr_add (s, s, u, MPFR_RNDN);
+ err = MAX (err, 3) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err);
+
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (s, m);
+ mpfr_set_prec (u, m);
+ mpfr_set_prec (v, m);
+ mpfr_set_prec (xx, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+
+ mpfr_clears (s, u, v, xx, (mpfr_ptr) 0);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+ else if (mpfr_cmp_si (x, -1) >= 0)
+ /* 0 > x >= -1: Li2(x) = -S(log(1-x))-log^2(1-x)/4 */
+ {
+ int k;
+ mpfr_exp_t expo_l;
+ mpfr_t s, u, xx;
+ mpfr_init2 (s, m);
+ mpfr_init2 (u, m);
+ mpfr_init2 (xx, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_neg (xx, x, MPFR_RNDN);
+ mpfr_log1p (u, xx, MPFR_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+ mpfr_neg (s, s, MPFR_RNDN);
+ expo_l = MPFR_GET_EXP (u);
+ err = 1 + MPFR_INT_CEIL_LOG2 (k + 1) - MPFR_GET_EXP (s);
+
+ mpfr_sqr (u, u, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 2, MPFR_RNDN); /* u = log^2(1-x)/4 */
+ mpfr_sub (s, s, u, MPFR_RNDN);
+ err = MAX (err, - expo_l);
+ err = 2 + MAX (err, 3);
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (s, m);
+ mpfr_set_prec (u, m);
+ mpfr_set_prec (xx, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+
+ mpfr_clears (s, u, xx, (mpfr_ptr) 0);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+ else
+ /* x < -1: Li2(x)
+ = S(log(1-1/x))-log^2(-x)/4-log(1-x)log(-x)/2+log^2(1-x)/4-pi^2/6 */
+ {
+ int k;
+ mpfr_t s, u, v, w, xx;
+
+ if (mpfr_cmp_si (x, -7) <= 0)
+ {
+ inexact = mpfr_li2_asympt_neg (y, x, rnd_mode);
+ if (inexact != 0)
+ goto end_of_case_ltm1;
+ }
+
+ mpfr_init2 (s, m);
+ mpfr_init2 (u, m);
+ mpfr_init2 (v, m);
+ mpfr_init2 (w, m);
+ mpfr_init2 (xx, m);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ mpfr_ui_div (xx, 1, x, MPFR_RNDN);
+ mpfr_neg (xx, xx, MPFR_RNDN);
+ mpfr_log1p (u, xx, MPFR_RNDN);
+ k = li2_series (s, u, MPFR_RNDN);
+
+ mpfr_ui_sub (xx, 1, x, MPFR_RNDN);
+ mpfr_log (u, xx, MPFR_RNDU);
+ mpfr_neg (xx, x, MPFR_RNDN);
+ mpfr_log (v, xx, MPFR_RNDU);
+ mpfr_mul (w, v, u, MPFR_RNDN);
+ mpfr_div_2ui (w, w, 1, MPFR_RNDN); /* w = log(-x) * log(1-x) / 2 */
+ mpfr_sub (s, s, w, MPFR_RNDN);
+ err = 1 + MAX (3, MPFR_INT_CEIL_LOG2 (k+1) + 1 - MPFR_GET_EXP (s))
+ + MPFR_GET_EXP (s);
+
+ mpfr_sqr (w, v, MPFR_RNDN);
+ mpfr_div_2ui (w, w, 2, MPFR_RNDN); /* w = log^2(-x) / 4 */
+ mpfr_sub (s, s, w, MPFR_RNDN);
+ err = MAX (err, 3 + MPFR_GET_EXP(w)) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
+
+ mpfr_sqr (w, u, MPFR_RNDN);
+ mpfr_div_2ui (w, w, 2, MPFR_RNDN); /* w = log^2(1-x) / 4 */
+ mpfr_add (s, s, w, MPFR_RNDN);
+ err = MAX (err, 3 + MPFR_GET_EXP (w)) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
+
+ mpfr_const_pi (w, MPFR_RNDU);
+ mpfr_sqr (w, w, MPFR_RNDN);
+ mpfr_div_ui (w, w, 6, MPFR_RNDN); /* w = pi^2 / 6 */
+ mpfr_sub (s, s, w, MPFR_RNDN);
+ err = MAX (err, 3) - MPFR_GET_EXP (s);
+ err = 2 + MAX (-1, err) + MPFR_GET_EXP (s);
+
+ if (MPFR_CAN_ROUND (s, (mpfr_exp_t) m - err, yp, rnd_mode))
+ break;
+
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (s, m);
+ mpfr_set_prec (u, m);
+ mpfr_set_prec (v, m);
+ mpfr_set_prec (w, m);
+ mpfr_set_prec (xx, m);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, s, rnd_mode);
+ mpfr_clears (s, u, v, w, xx, (mpfr_ptr) 0);
+
+ end_of_case_ltm1:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+
+ MPFR_ASSERTN (0); /* should never reach this point */
+}
diff --git a/src/lngamma.c b/src/lngamma.c
new file mode 100644
index 0000000..c400bd8
--- /dev/null
+++ b/src/lngamma.c
@@ -0,0 +1,738 @@
+/* mpfr_lngamma -- lngamma function
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* given a precision p, return alpha, such that the argument reduction
+ will use k = alpha*p*log(2).
+
+ Warning: we should always have alpha >= log(2)/(2Pi) ~ 0.11,
+ and the smallest value of alpha multiplied by the smallest working
+ precision should be >= 4.
+*/
+static void
+mpfr_gamma_alpha (mpfr_t s, mpfr_prec_t p)
+{
+ if (p <= 100)
+ mpfr_set_ui_2exp (s, 614, -10, MPFR_RNDN); /* about 0.6 */
+ else if (p <= 500)
+ mpfr_set_ui_2exp (s, 819, -10, MPFR_RNDN); /* about 0.8 */
+ else if (p <= 1000)
+ mpfr_set_ui_2exp (s, 1331, -10, MPFR_RNDN); /* about 1.3 */
+ else if (p <= 2000)
+ mpfr_set_ui_2exp (s, 1741, -10, MPFR_RNDN); /* about 1.7 */
+ else if (p <= 5000)
+ mpfr_set_ui_2exp (s, 2253, -10, MPFR_RNDN); /* about 2.2 */
+ else if (p <= 10000)
+ mpfr_set_ui_2exp (s, 3482, -10, MPFR_RNDN); /* about 3.4 */
+ else
+ mpfr_set_ui_2exp (s, 9, -1, MPFR_RNDN); /* 4.5 */
+}
+
+#ifdef IS_GAMMA
+
+/* This function is called in case of intermediate overflow/underflow.
+ The s1 and s2 arguments are temporary MPFR numbers, having the
+ working precision. If the result could be determined, then the
+ flags are updated via pexpo, y is set to the result, and the
+ (non-zero) ternary value is returned. Otherwise 0 is returned
+ in order to perform the next Ziv iteration. */
+static int
+mpfr_explgamma (mpfr_ptr y, mpfr_srcptr x, mpfr_save_expo_t *pexpo,
+ mpfr_ptr s1, mpfr_ptr s2, mpfr_rnd_t rnd)
+{
+ mpfr_t t1, t2;
+ int inex1, inex2, sign;
+ MPFR_BLOCK_DECL (flags1);
+ MPFR_BLOCK_DECL (flags2);
+ MPFR_GROUP_DECL (group);
+
+ MPFR_BLOCK (flags1, inex1 = mpfr_lgamma (s1, &sign, x, MPFR_RNDD));
+ MPFR_ASSERTN (inex1 != 0);
+ /* s1 = RNDD(lngamma(x)), inexact */
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags1)))
+ {
+ if (MPFR_SIGN (s1) > 0)
+ {
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (*pexpo, MPFR_FLAGS_OVERFLOW);
+ return mpfr_overflow (y, rnd, sign);
+ }
+ else
+ {
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (*pexpo, MPFR_FLAGS_UNDERFLOW);
+ return mpfr_underflow (y, rnd == MPFR_RNDN ? MPFR_RNDZ : rnd, sign);
+ }
+ }
+
+ mpfr_set (s2, s1, MPFR_RNDN); /* exact */
+ mpfr_nextabove (s2); /* v = RNDU(lngamma(z0)) */
+
+ if (sign < 0)
+ rnd = MPFR_INVERT_RND (rnd); /* since the result with be negated */
+ MPFR_GROUP_INIT_2 (group, MPFR_PREC (y), t1, t2);
+ MPFR_BLOCK (flags1, inex1 = mpfr_exp (t1, s1, rnd));
+ MPFR_BLOCK (flags2, inex2 = mpfr_exp (t2, s2, rnd));
+ /* t1 is the rounding with mode 'rnd' of a lower bound on |Gamma(x)|,
+ t2 is the rounding with mode 'rnd' of an upper bound, thus if both
+ are equal, so is the wanted result. If t1 and t2 differ or the flags
+ differ, at some point of Ziv's loop they should agree. */
+ if (mpfr_equal_p (t1, t2) && flags1 == flags2)
+ {
+ MPFR_ASSERTN ((inex1 > 0 && inex2 > 0) || (inex1 < 0 && inex2 < 0));
+ mpfr_set4 (y, t1, MPFR_RNDN, sign); /* exact */
+ if (sign < 0)
+ inex1 = - inex1;
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (*pexpo, flags1);
+ }
+ else
+ inex1 = 0; /* couldn't determine the result */
+ MPFR_GROUP_CLEAR (group);
+
+ return inex1;
+}
+
+#else
+
+static int
+unit_bit (mpfr_srcptr x)
+{
+ mpfr_exp_t expo;
+ mpfr_prec_t prec;
+ mp_limb_t x0;
+
+ expo = MPFR_GET_EXP (x);
+ if (expo <= 0)
+ return 0; /* |x| < 1 */
+
+ prec = MPFR_PREC (x);
+ if (expo > prec)
+ return 0; /* y is a multiple of 2^(expo-prec), thus an even integer */
+
+ /* Now, the unit bit is represented. */
+
+ prec = MPFR_PREC2LIMBS (prec) * GMP_NUMB_BITS - expo;
+ /* number of represented fractional bits (including the trailing 0's) */
+
+ x0 = *(MPFR_MANT (x) + prec / GMP_NUMB_BITS);
+ /* limb containing the unit bit */
+
+ return (x0 >> (prec % GMP_NUMB_BITS)) & 1;
+}
+
+#endif
+
+/* lngamma(x) = log(gamma(x)).
+ We use formula [6.1.40] from Abramowitz&Stegun:
+ lngamma(z) = (z-1/2)*log(z) - z + 1/2*log(2*Pi)
+ + sum (Bernoulli[2m]/(2m)/(2m-1)/z^(2m-1),m=1..infinity)
+ According to [6.1.42], if the sum is truncated after m=n, the error
+ R_n(z) is bounded by |B[2n+2]|*K(z)/(2n+1)/(2n+2)/|z|^(2n+1)
+ where K(z) = max (z^2/(u^2+z^2)) for u >= 0.
+ For z real, |K(z)| <= 1 thus R_n(z) is bounded by the first neglected term.
+ */
+#ifdef IS_GAMMA
+#define GAMMA_FUNC mpfr_gamma_aux
+#else
+#define GAMMA_FUNC mpfr_lngamma_aux
+#endif
+
+static int
+GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t precy, w; /* working precision */
+ mpfr_t s, t, u, v, z;
+ unsigned long m, k, maxm;
+ mpz_t *INITIALIZED(B); /* variable B declared as initialized */
+ int compared;
+ int inexact = 0; /* 0 means: result y not set yet */
+ mpfr_exp_t err_s, err_t;
+ unsigned long Bm = 0; /* number of allocated B[] */
+ unsigned long oldBm;
+ double d;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ compared = mpfr_cmp_ui (z0, 1);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+#ifndef IS_GAMMA /* lngamma or lgamma */
+ if (compared == 0 || (compared > 0 && mpfr_cmp_ui (z0, 2) == 0))
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_set_ui (y, 0, MPFR_RNDN); /* lngamma(1 or 2) = +0 */
+ }
+
+ /* Deal here with tiny inputs. We have for -0.3 <= x <= 0.3:
+ - log|x| - gamma*x <= log|gamma(x)| <= - log|x| - gamma*x + x^2 */
+ if (MPFR_EXP(z0) <= - (mpfr_exp_t) MPFR_PREC(y))
+ {
+ mpfr_t l, h, g;
+ int ok, inex1, inex2;
+ mpfr_prec_t prec = MPFR_PREC(y) + 14;
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_ZIV_INIT (loop, prec);
+ do
+ {
+ mpfr_init2 (l, prec);
+ if (MPFR_IS_POS(z0))
+ {
+ mpfr_log (l, z0, MPFR_RNDU); /* upper bound for log(z0) */
+ mpfr_init2 (h, MPFR_PREC(l));
+ }
+ else
+ {
+ mpfr_init2 (h, MPFR_PREC(z0));
+ mpfr_neg (h, z0, MPFR_RNDN); /* exact */
+ mpfr_log (l, h, MPFR_RNDU); /* upper bound for log(-z0) */
+ mpfr_set_prec (h, MPFR_PREC(l));
+ }
+ mpfr_neg (l, l, MPFR_RNDD); /* lower bound for -log(|z0|) */
+ mpfr_set (h, l, MPFR_RNDD); /* exact */
+ mpfr_nextabove (h); /* upper bound for -log(|z0|), avoids two calls
+ to mpfr_log */
+ mpfr_init2 (g, MPFR_PREC(l));
+ /* if z0>0, we need an upper approximation of Euler's constant
+ for the left bound */
+ mpfr_const_euler (g, MPFR_IS_POS(z0) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_mul (g, g, z0, MPFR_RNDD);
+ mpfr_sub (l, l, g, MPFR_RNDD);
+ mpfr_const_euler (g, MPFR_IS_POS(z0) ? MPFR_RNDD : MPFR_RNDU); /* cached */
+ mpfr_mul (g, g, z0, MPFR_RNDU);
+ mpfr_sub (h, h, g, MPFR_RNDD);
+ mpfr_mul (g, z0, z0, MPFR_RNDU);
+ mpfr_add (h, h, g, MPFR_RNDU);
+ inex1 = mpfr_prec_round (l, MPFR_PREC(y), rnd);
+ inex2 = mpfr_prec_round (h, MPFR_PREC(y), rnd);
+ /* Caution: we not only need l = h, but both inexact flags should
+ agree. Indeed, one of the inexact flags might be zero. In that
+ case if we assume lngamma(z0) cannot be exact, the other flag
+ should be correct. We are conservative here and request that both
+ inexact flags agree. */
+ ok = SAME_SIGN (inex1, inex2) && mpfr_cmp (l, h) == 0;
+ if (ok)
+ mpfr_set (y, h, rnd); /* exact */
+ mpfr_clear (l);
+ mpfr_clear (h);
+ mpfr_clear (g);
+ if (ok)
+ {
+ MPFR_ZIV_FREE (loop);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex1, rnd);
+ }
+ /* since we have log|gamma(x)| = - log|x| - gamma*x + O(x^2),
+ if x ~ 2^(-n), then we have a n-bit approximation, thus
+ we can try again with a working precision of n bits,
+ especially when n >> PREC(y).
+ Otherwise we would use the reflection formula evaluating x-1,
+ which would need precision n. */
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ while (prec <= -MPFR_EXP(z0));
+ MPFR_ZIV_FREE (loop);
+ }
+#endif
+
+ precy = MPFR_PREC(y);
+
+ mpfr_init2 (s, MPFR_PREC_MIN);
+ mpfr_init2 (t, MPFR_PREC_MIN);
+ mpfr_init2 (u, MPFR_PREC_MIN);
+ mpfr_init2 (v, MPFR_PREC_MIN);
+ mpfr_init2 (z, MPFR_PREC_MIN);
+
+ if (compared < 0)
+ {
+ mpfr_exp_t err_u;
+
+ /* use reflection formula:
+ gamma(x) = Pi*(x-1)/sin(Pi*(2-x))/gamma(2-x)
+ thus lngamma(x) = log(Pi*(x-1)/sin(Pi*(2-x))) - lngamma(2-x) */
+
+ w = precy + MPFR_INT_CEIL_LOG2 (precy);
+ w += MPFR_INT_CEIL_LOG2 (w) + 14;
+ MPFR_ZIV_INIT (loop, w);
+ while (1)
+ {
+ MPFR_ASSERTD(w >= 3);
+ mpfr_set_prec (s, w);
+ mpfr_set_prec (t, w);
+ mpfr_set_prec (u, w);
+ mpfr_set_prec (v, w);
+ /* In the following, we write r for a real of absolute value
+ at most 2^(-w). Different instances of r may represent different
+ values. */
+ mpfr_ui_sub (s, 2, z0, MPFR_RNDD); /* s = (2-z0) * (1+2r) >= 1 */
+ mpfr_const_pi (t, MPFR_RNDN); /* t = Pi * (1+r) */
+ mpfr_lngamma (u, s, MPFR_RNDN); /* lngamma(2-x) */
+ /* Let s = (2-z0) + h. By construction, -(2-z0)*2^(1-w) <= h <= 0.
+ We have lngamma(s) = lngamma(2-z0) + h*Psi(z), z in [2-z0+h,2-z0].
+ Since 2-z0+h = s >= 1 and |Psi(x)| <= max(1,log(x)) for x >= 1,
+ the error on u is bounded by
+ ulp(u)/2 + (2-z0)*max(1,log(2-z0))*2^(1-w)
+ = (1/2 + (2-z0)*max(1,log(2-z0))*2^(1-E(u))) ulp(u) */
+ d = (double) MPFR_GET_EXP(s) * 0.694; /* upper bound for log(2-z0) */
+ err_u = MPFR_GET_EXP(s) + __gmpfr_ceil_log2 (d) + 1 - MPFR_GET_EXP(u);
+ err_u = (err_u >= 0) ? err_u + 1 : 0;
+ /* now the error on u is bounded by 2^err_u ulps */
+
+ mpfr_mul (s, s, t, MPFR_RNDN); /* Pi*(2-x) * (1+r)^4 */
+ err_s = MPFR_GET_EXP(s); /* 2-x <= 2^err_s */
+ mpfr_sin (s, s, MPFR_RNDN); /* sin(Pi*(2-x)) */
+ /* the error on s is bounded by 1/2*ulp(s) + [(1+2^(-w))^4-1]*(2-x)
+ <= 1/2*ulp(s) + 5*2^(-w)*(2-x) for w >= 3
+ <= (1/2 + 5 * 2^(-E(s)) * (2-x)) ulp(s) */
+ err_s += 3 - MPFR_GET_EXP(s);
+ err_s = (err_s >= 0) ? err_s + 1 : 0;
+ /* the error on s is bounded by 2^err_s ulp(s), thus by
+ 2^(err_s+1)*2^(-w)*|s| since ulp(s) <= 2^(1-w)*|s|.
+ Now n*2^(-w) can always be written |(1+r)^n-1| for some
+ |r|<=2^(-w), thus taking n=2^(err_s+1) we see that
+ |S - s| <= |(1+r)^(2^(err_s+1))-1| * |s|, where S is the
+ true value.
+ In fact if ulp(s) <= ulp(S) the same inequality holds for
+ |S| instead of |s| in the right hand side, i.e., we can
+ write s = (1+r)^(2^(err_s+1)) * S.
+ But if ulp(S) < ulp(s), we need to add one ``bit'' to the error,
+ to get s = (1+r)^(2^(err_s+2)) * S. This is true since with
+ E = n*2^(-w) we have |s - S| <= E * |s|, thus
+ |s - S| <= E/(1-E) * |S|.
+ Now E/(1-E) is bounded by 2E as long as E<=1/2,
+ and 2E can be written (1+r)^(2n)-1 as above.
+ */
+ err_s += 2; /* exponent of relative error */
+
+ mpfr_sub_ui (v, z0, 1, MPFR_RNDN); /* v = (x-1) * (1+r) */
+ mpfr_mul (v, v, t, MPFR_RNDN); /* v = Pi*(x-1) * (1+r)^3 */
+ mpfr_div (v, v, s, MPFR_RNDN); /* Pi*(x-1)/sin(Pi*(2-x)) */
+ mpfr_abs (v, v, MPFR_RNDN);
+ /* (1+r)^(3+2^err_s+1) */
+ err_s = (err_s <= 1) ? 3 : err_s + 1;
+ /* now (1+r)^M with M <= 2^err_s */
+ mpfr_log (v, v, MPFR_RNDN);
+ /* log(v*(1+e)) = log(v)+log(1+e) where |e| <= 2^(err_s-w).
+ Since |log(1+e)| <= 2*e for |e| <= 1/4, the error on v is
+ bounded by ulp(v)/2 + 2^(err_s+1-w). */
+ if (err_s + 2 > w)
+ {
+ w += err_s + 2;
+ }
+ else
+ {
+ err_s += 1 - MPFR_GET_EXP(v);
+ err_s = (err_s >= 0) ? err_s + 1 : 0;
+ /* the error on v is bounded by 2^err_s ulps */
+ err_u += MPFR_GET_EXP(u); /* absolute error on u */
+ err_s += MPFR_GET_EXP(v); /* absolute error on v */
+ mpfr_sub (s, v, u, MPFR_RNDN);
+ /* the total error on s is bounded by ulp(s)/2 + 2^(err_u-w)
+ + 2^(err_s-w) <= ulp(s)/2 + 2^(max(err_u,err_s)+1-w) */
+ err_s = (err_s >= err_u) ? err_s : err_u;
+ err_s += 1 - MPFR_GET_EXP(s); /* error is 2^err_s ulp(s) */
+ err_s = (err_s >= 0) ? err_s + 1 : 0;
+ if (mpfr_can_round (s, w - err_s, MPFR_RNDN, MPFR_RNDZ, precy
+ + (rnd == MPFR_RNDN)))
+ goto end;
+ }
+ MPFR_ZIV_NEXT (loop, w);
+ }
+ MPFR_ZIV_FREE (loop);
+ }
+
+ /* now z0 > 1 */
+
+ MPFR_ASSERTD (compared > 0);
+
+ /* since k is O(w), the value of log(z0*...*(z0+k-1)) is about w*log(w),
+ so there is a cancellation of ~log(w) in the argument reconstruction */
+ w = precy + MPFR_INT_CEIL_LOG2 (precy);
+ w += MPFR_INT_CEIL_LOG2 (w) + 13;
+ MPFR_ZIV_INIT (loop, w);
+ while (1)
+ {
+ MPFR_ASSERTD (w >= 3);
+
+ /* argument reduction: we compute gamma(z0 + k), where the series
+ has error term B_{2n}/(z0+k)^(2n) ~ (n/(Pi*e*(z0+k)))^(2n)
+ and we need k steps of argument reconstruction. Assuming k is large
+ with respect to z0, and k = n, we get 1/(Pi*e)^(2n) ~ 2^(-w), i.e.,
+ k ~ w*log(2)/2/log(Pi*e) ~ 0.1616 * w.
+ However, since the series is more expensive to compute, the optimal
+ value seems to be k ~ 4.5 * w experimentally. */
+ mpfr_set_prec (s, 53);
+ mpfr_gamma_alpha (s, w);
+ mpfr_set_ui_2exp (s, 9, -1, MPFR_RNDU);
+ mpfr_mul_ui (s, s, w, MPFR_RNDU);
+ if (mpfr_cmp (z0, s) < 0)
+ {
+ mpfr_sub (s, s, z0, MPFR_RNDU);
+ k = mpfr_get_ui (s, MPFR_RNDU);
+ if (k < 3)
+ k = 3;
+ }
+ else
+ k = 3;
+
+ mpfr_set_prec (s, w);
+ mpfr_set_prec (t, w);
+ mpfr_set_prec (u, w);
+ mpfr_set_prec (v, w);
+ mpfr_set_prec (z, w);
+
+ mpfr_add_ui (z, z0, k, MPFR_RNDN);
+ /* z = (z0+k)*(1+t1) with |t1| <= 2^(-w) */
+
+ /* z >= 4 ensures the relative error on log(z) is small,
+ and also (z-1/2)*log(z)-z >= 0 */
+ MPFR_ASSERTD (mpfr_cmp_ui (z, 4) >= 0);
+
+ mpfr_log (s, z, MPFR_RNDN); /* log(z) */
+ /* we have s = log((z0+k)*(1+t1))*(1+t2) with |t1|, |t2| <= 2^(-w).
+ Since w >= 2 and z0+k >= 4, we can write log((z0+k)*(1+t1))
+ = log(z0+k) * (1+t3) with |t3| <= 2^(-w), thus we have
+ s = log(z0+k) * (1+t4)^2 with |t4| <= 2^(-w) */
+ mpfr_mul_2ui (t, z, 1, MPFR_RNDN); /* t = 2z * (1+t5) */
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN); /* t = 2z-1 * (1+t6)^3 */
+ /* since we can write 2z*(1+t5) = (2z-1)*(1+t5') with
+ t5' = 2z/(2z-1) * t5, thus |t5'| <= 8/7 * t5 */
+ mpfr_mul (s, s, t, MPFR_RNDN); /* (2z-1)*log(z) * (1+t7)^6 */
+ mpfr_div_2ui (s, s, 1, MPFR_RNDN); /* (z-1/2)*log(z) * (1+t7)^6 */
+ mpfr_sub (s, s, z, MPFR_RNDN); /* (z-1/2)*log(z)-z */
+ /* s = [(z-1/2)*log(z)-z]*(1+u)^14, s >= 1/2 */
+
+ mpfr_ui_div (u, 1, z, MPFR_RNDN); /* 1/z * (1+u), u <= 1/4 since z >= 4 */
+
+ /* the first term is B[2]/2/z = 1/12/z: t=1/12/z, C[2]=1 */
+ mpfr_div_ui (t, u, 12, MPFR_RNDN); /* 1/(12z) * (1+u)^2, t <= 3/128 */
+ mpfr_set (v, t, MPFR_RNDN); /* (1+u)^2, v < 2^(-5) */
+ mpfr_add (s, s, v, MPFR_RNDN); /* (1+u)^15 */
+
+ mpfr_mul (u, u, u, MPFR_RNDN); /* 1/z^2 * (1+u)^3 */
+
+ if (Bm == 0)
+ {
+ B = mpfr_bernoulli_internal ((mpz_t *) 0, 0);
+ B = mpfr_bernoulli_internal (B, 1);
+ Bm = 2;
+ }
+
+ /* m <= maxm ensures that 2*m*(2*m+1) <= ULONG_MAX */
+ maxm = 1UL << (GMP_NUMB_BITS / 2 - 1);
+
+ /* s:(1+u)^15, t:(1+u)^2, t <= 3/128 */
+
+ for (m = 2; MPFR_GET_EXP(v) + (mpfr_exp_t) w >= MPFR_GET_EXP(s); m++)
+ {
+ mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(10m-14) */
+ if (m <= maxm)
+ {
+ mpfr_mul_ui (t, t, 2*(m-1)*(2*m-3), MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m*(2*m-1), MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m*(2*m+1), MPFR_RNDN);
+ }
+ else
+ {
+ mpfr_mul_ui (t, t, 2*(m-1), MPFR_RNDN);
+ mpfr_mul_ui (t, t, 2*m-3, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m-1, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m, MPFR_RNDN);
+ mpfr_div_ui (t, t, 2*m+1, MPFR_RNDN);
+ }
+ /* (1+u)^(10m-8) */
+ /* invariant: t=1/(2m)/(2m-1)/z^(2m-1)/(2m+1)! */
+ if (Bm <= m)
+ {
+ B = mpfr_bernoulli_internal (B, m); /* B[2m]*(2m+1)!, exact */
+ Bm ++;
+ }
+ mpfr_mul_z (v, t, B[m], MPFR_RNDN); /* (1+u)^(10m-7) */
+ MPFR_ASSERTD(MPFR_GET_EXP(v) <= - (2 * m + 3));
+ mpfr_add (s, s, v, MPFR_RNDN);
+ }
+ /* m <= 1/2*Pi*e*z ensures that |v[m]| < 1/2^(2m+3) */
+ MPFR_ASSERTD ((double) m <= 4.26 * mpfr_get_d (z, MPFR_RNDZ));
+
+ /* We have sum([(1+u)^(10m-7)-1]*1/2^(2m+3), m=2..infinity)
+ <= 1.46*u for u <= 2^(-3).
+ We have 0 < lngamma(z) - [(z - 1/2) ln(z) - z + 1/2 ln(2 Pi)] < 0.021
+ for z >= 4, thus since the initial s >= 0.85, the different values of
+ s differ by at most one binade, and the total rounding error on s
+ in the for-loop is bounded by 2*(m-1)*ulp(final_s).
+ The error coming from the v's is bounded by
+ 1.46*2^(-w) <= 2*ulp(final_s).
+ Thus the total error so far is bounded by [(1+u)^15-1]*s+2m*ulp(s)
+ <= (2m+47)*ulp(s).
+ Taking into account the truncation error (which is bounded by the last
+ term v[] according to 6.1.42 in A&S), the bound is (2m+48)*ulp(s).
+ */
+
+ /* add 1/2*log(2*Pi) and subtract log(z0*(z0+1)*...*(z0+k-1)) */
+ mpfr_const_pi (v, MPFR_RNDN); /* v = Pi*(1+u) */
+ mpfr_mul_2ui (v, v, 1, MPFR_RNDN); /* v = 2*Pi * (1+u) */
+ if (k)
+ {
+ unsigned long l;
+ mpfr_set (t, z0, MPFR_RNDN); /* t = z0*(1+u) */
+ for (l = 1; l < k; l++)
+ {
+ mpfr_add_ui (u, z0, l, MPFR_RNDN); /* u = (z0+l)*(1+u) */
+ mpfr_mul (t, t, u, MPFR_RNDN); /* (1+u)^(2l+1) */
+ }
+ /* now t: (1+u)^(2k-1) */
+ /* instead of computing log(sqrt(2*Pi)/t), we compute
+ 1/2*log(2*Pi/t^2), which trades a square root for a square */
+ mpfr_mul (t, t, t, MPFR_RNDN); /* (z0*...*(z0+k-1))^2, (1+u)^(4k-1) */
+ mpfr_div (v, v, t, MPFR_RNDN);
+ /* 2*Pi/(z0*...*(z0+k-1))^2 (1+u)^(4k+1) */
+ }
+#ifdef IS_GAMMA
+ err_s = MPFR_GET_EXP(s);
+ mpfr_exp (s, s, MPFR_RNDN);
+ /* If s is +Inf, we compute exp(lngamma(z0)). */
+ if (mpfr_inf_p (s))
+ {
+ inexact = mpfr_explgamma (y, z0, &expo, s, t, rnd);
+ if (inexact)
+ goto end0;
+ else
+ goto ziv_next;
+ }
+ /* before the exponential, we have s = s0 + h where
+ |h| <= (2m+48)*ulp(s), thus exp(s0) = exp(s) * exp(-h).
+ For |h| <= 1/4, we have |exp(h)-1| <= 1.2*|h| thus
+ |exp(s) - exp(s0)| <= 1.2 * exp(s) * (2m+48)* 2^(EXP(s)-w). */
+ d = 1.2 * (2.0 * (double) m + 48.0);
+ /* the error on s is bounded by d*2^err_s * 2^(-w) */
+ mpfr_sqrt (t, v, MPFR_RNDN);
+ /* let v0 be the exact value of v. We have v = v0*(1+u)^(4k+1),
+ thus t = sqrt(v0)*(1+u)^(2k+3/2). */
+ mpfr_mul (s, s, t, MPFR_RNDN);
+ /* the error on input s is bounded by (1+u)^(d*2^err_s),
+ and that on t is (1+u)^(2k+3/2), thus the
+ total error is (1+u)^(d*2^err_s+2k+5/2) */
+ err_s += __gmpfr_ceil_log2 (d);
+ err_t = __gmpfr_ceil_log2 (2.0 * (double) k + 2.5);
+ err_s = (err_s >= err_t) ? err_s + 1 : err_t + 1;
+#else
+ mpfr_log (t, v, MPFR_RNDN);
+ /* let v0 be the exact value of v. We have v = v0*(1+u)^(4k+1),
+ thus log(v) = log(v0) + (4k+1)*log(1+u). Since |log(1+u)/u| <= 1.07
+ for |u| <= 2^(-3), the absolute error on log(v) is bounded by
+ 1.07*(4k+1)*u, and the rounding error by ulp(t). */
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN);
+ /* the error on t is now bounded by ulp(t) + 0.54*(4k+1)*2^(-w).
+ We have sqrt(2*Pi)/(z0*(z0+1)*...*(z0+k-1)) <= sqrt(2*Pi)/k! <= 0.5
+ since k>=3, thus t <= -0.5 and ulp(t) >= 2^(-w).
+ Thus the error on t is bounded by (2.16*k+1.54)*ulp(t). */
+ err_t = MPFR_GET_EXP(t) + (mpfr_exp_t)
+ __gmpfr_ceil_log2 (2.2 * (double) k + 1.6);
+ err_s = MPFR_GET_EXP(s) + (mpfr_exp_t)
+ __gmpfr_ceil_log2 (2.0 * (double) m + 48.0);
+ mpfr_add (s, s, t, MPFR_RNDN); /* this is a subtraction in fact */
+ /* the final error in ulp(s) is
+ <= 1 + 2^(err_t-EXP(s)) + 2^(err_s-EXP(s))
+ <= 2^(1+max(err_t,err_s)-EXP(s)) if err_t <> err_s
+ <= 2^(2+max(err_t,err_s)-EXP(s)) if err_t = err_s */
+ err_s = (err_t == err_s) ? 1 + err_s : ((err_t > err_s) ? err_t : err_s);
+ err_s += 1 - MPFR_GET_EXP(s);
+#endif
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, w - err_s, precy, rnd)))
+ break;
+#ifdef IS_GAMMA
+ ziv_next:
+#endif
+ MPFR_ZIV_NEXT (loop, w);
+ }
+
+#ifdef IS_GAMMA
+ end0:
+#endif
+ oldBm = Bm;
+ while (Bm--)
+ mpz_clear (B[Bm]);
+ (*__gmp_free_func) (B, oldBm * sizeof (mpz_t));
+
+ end:
+ if (inexact == 0)
+ inexact = mpfr_set (y, s, rnd);
+ MPFR_ZIV_FREE (loop);
+
+ mpfr_clear (s);
+ mpfr_clear (t);
+ mpfr_clear (u);
+ mpfr_clear (v);
+ mpfr_clear (z);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd);
+}
+
+#ifndef IS_GAMMA
+
+int
+mpfr_lngamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inex;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inex));
+
+ /* special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_NEG (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* lngamma(+Inf) = lngamma(+0) = +Inf */
+ {
+ if (MPFR_IS_ZERO (x))
+ mpfr_set_divby0 ();
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0); /* exact */
+ }
+ }
+
+ /* if x < 0 and -2k-1 <= x <= -2k, then lngamma(x) = NaN */
+ if (MPFR_IS_NEG (x) && (unit_bit (x) == 0 || mpfr_integer_p (x)))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ inex = mpfr_lngamma_aux (y, x, rnd);
+ return inex;
+}
+
+int
+mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inex;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pu]=%.*Rg signp=%d inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, *signp, inex));
+
+ *signp = 1; /* most common case */
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ if (MPFR_IS_ZERO (x))
+ mpfr_set_divby0 ();
+ *signp = MPFR_INT_SIGN (x);
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ }
+
+ if (MPFR_IS_NEG (x))
+ {
+ if (mpfr_integer_p (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ mpfr_set_divby0 ();
+ MPFR_RET (0);
+ }
+
+ if (unit_bit (x) == 0)
+ *signp = -1;
+
+ /* For tiny negative x, we have gamma(x) = 1/x - euler + O(x),
+ thus |gamma(x)| = -1/x + euler + O(x), and
+ log |gamma(x)| = -log(-x) - euler*x + O(x^2).
+ More precisely we have for -0.4 <= x < 0:
+ -log(-x) <= log |gamma(x)| <= -log(-x) - x.
+ Since log(x) is not representable, we may have an instance of the
+ Table Maker Dilemma. The only way to ensure correct rounding is to
+ compute an interval [l,h] such that l <= -log(-x) and
+ -log(-x) - x <= h, and check whether l and h round to the same number
+ for the target precision and rounding modes. */
+ if (MPFR_EXP(x) + 1 <= - (mpfr_exp_t) MPFR_PREC(y))
+ /* since PREC(y) >= 1, this ensures EXP(x) <= -2,
+ thus |x| <= 0.25 < 0.4 */
+ {
+ mpfr_t l, h;
+ int ok, inex2;
+ mpfr_prec_t w = MPFR_PREC (y) + 14;
+ mpfr_exp_t expl;
+
+ while (1)
+ {
+ mpfr_init2 (l, w);
+ mpfr_init2 (h, w);
+ /* we want a lower bound on -log(-x), thus an upper bound
+ on log(-x), thus an upper bound on -x. */
+ mpfr_neg (l, x, MPFR_RNDU); /* upper bound on -x */
+ mpfr_log (l, l, MPFR_RNDU); /* upper bound for log(-x) */
+ mpfr_neg (l, l, MPFR_RNDD); /* lower bound for -log(-x) */
+ mpfr_neg (h, x, MPFR_RNDD); /* lower bound on -x */
+ mpfr_log (h, h, MPFR_RNDD); /* lower bound on log(-x) */
+ mpfr_neg (h, h, MPFR_RNDU); /* upper bound for -log(-x) */
+ mpfr_sub (h, h, x, MPFR_RNDU); /* upper bound for -log(-x) - x */
+ inex = mpfr_prec_round (l, MPFR_PREC (y), rnd);
+ inex2 = mpfr_prec_round (h, MPFR_PREC (y), rnd);
+ /* Caution: we not only need l = h, but both inexact flags
+ should agree. Indeed, one of the inexact flags might be
+ zero. In that case if we assume ln|gamma(x)| cannot be
+ exact, the other flag should be correct. We are conservative
+ here and request that both inexact flags agree. */
+ ok = SAME_SIGN (inex, inex2) && mpfr_equal_p (l, h);
+ if (ok)
+ mpfr_set (y, h, rnd); /* exact */
+ else
+ expl = MPFR_EXP (l);
+ mpfr_clear (l);
+ mpfr_clear (h);
+ if (ok)
+ return inex;
+ /* if ulp(log(-x)) <= |x| there is no reason to loop,
+ since the width of [l, h] will be at least |x| */
+ if (expl < MPFR_EXP(x) + (mpfr_exp_t) w)
+ break;
+ w += MPFR_INT_CEIL_LOG2(w) + 3;
+ }
+ }
+ }
+
+ inex = mpfr_lngamma_aux (y, x, rnd);
+ return inex;
+}
+
+#endif
diff --git a/src/log.c b/src/log.c
new file mode 100644
index 0000000..0244ab5
--- /dev/null
+++ b/src/log.c
@@ -0,0 +1,171 @@
+/* mpfr_log -- natural logarithm of a floating-point number
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of log(x) is done using the formula :
+ if we want p bits of the result,
+
+ pi
+ log(x) ~ ------------ - m log 2
+ 2 AG(1,4/s)
+
+ where s = x 2^m > 2^(p/2)
+
+ More precisely, if F(x) = int(1/sqrt(1-(1-x^2)*sin(t)^2), t=0..PI/2),
+ then for s>=1.26 we have log(s) < F(4/s) < log(s)*(1+4/s^2)
+ from which we deduce pi/2/AG(1,4/s)*(1-4/s^2) < log(s) < pi/2/AG(1,4/s)
+ so the relative error 4/s^2 is < 4/2^p i.e. 4 ulps.
+*/
+
+int
+mpfr_log (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_prec_t p, q;
+ mpfr_t tmp1, tmp2;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+ MPFR_GROUP_DECL(group);
+
+ MPFR_LOG_FUNC
+ (("a[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
+ ("r[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r,
+ inexact));
+
+ /* Special cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (a)))
+ {
+ /* If a is NaN, the result is NaN */
+ if (MPFR_IS_NAN (a))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ /* check for infinity before zero */
+ else if (MPFR_IS_INF (a))
+ {
+ if (MPFR_IS_NEG (a))
+ /* log(-Inf) = NaN */
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ else /* log(+Inf) = +Inf */
+ {
+ MPFR_SET_INF (r);
+ MPFR_SET_POS (r);
+ MPFR_RET (0);
+ }
+ }
+ else /* a is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (a));
+ MPFR_SET_INF (r);
+ MPFR_SET_NEG (r);
+ mpfr_set_divby0 ();
+ MPFR_RET (0); /* log(0) is an exact -infinity */
+ }
+ }
+ /* If a is negative, the result is NaN */
+ else if (MPFR_UNLIKELY (MPFR_IS_NEG (a)))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ /* If a is 1, the result is 0 */
+ else if (MPFR_UNLIKELY (MPFR_GET_EXP (a) == 1 && mpfr_cmp_ui (a, 1) == 0))
+ {
+ MPFR_SET_ZERO (r);
+ MPFR_SET_POS (r);
+ MPFR_RET (0); /* only "normal" case where the result is exact */
+ }
+
+ q = MPFR_PREC (r);
+
+ /* use initial precision about q+lg(q)+5 */
+ p = q + 5 + 2 * MPFR_INT_CEIL_LOG2 (q);
+ /* % ~(mpfr_prec_t)GMP_NUMB_BITS ;
+ m=q; while (m) { p++; m >>= 1; } */
+ /* if (MPFR_LIKELY(p % GMP_NUMB_BITS != 0))
+ p += GMP_NUMB_BITS - (p%GMP_NUMB_BITS); */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_GROUP_INIT_2 (group, p, tmp1, tmp2);
+
+ MPFR_ZIV_INIT (loop, p);
+ for (;;)
+ {
+ long m;
+ mpfr_exp_t cancel;
+
+ /* Calculus of m (depends on p) */
+ m = (p + 1) / 2 - MPFR_GET_EXP (a) + 1;
+
+ mpfr_mul_2si (tmp2, a, m, MPFR_RNDN); /* s=a*2^m, err<=1 ulp */
+ mpfr_div (tmp1, __gmpfr_four, tmp2, MPFR_RNDN);/* 4/s, err<=2 ulps */
+ mpfr_agm (tmp2, __gmpfr_one, tmp1, MPFR_RNDN); /* AG(1,4/s),err<=3 ulps */
+ mpfr_mul_2ui (tmp2, tmp2, 1, MPFR_RNDN); /* 2*AG(1,4/s), err<=3 ulps */
+ mpfr_const_pi (tmp1, MPFR_RNDN); /* compute pi, err<=1ulp */
+ mpfr_div (tmp2, tmp1, tmp2, MPFR_RNDN); /* pi/2*AG(1,4/s), err<=5ulps */
+ mpfr_const_log2 (tmp1, MPFR_RNDN); /* compute log(2), err<=1ulp */
+ mpfr_mul_si (tmp1, tmp1, m, MPFR_RNDN); /* compute m*log(2),err<=2ulps */
+ mpfr_sub (tmp1, tmp2, tmp1, MPFR_RNDN); /* log(a), err<=7ulps+cancel */
+
+ if (MPFR_LIKELY (MPFR_IS_PURE_FP (tmp1) && MPFR_IS_PURE_FP (tmp2)))
+ {
+ cancel = MPFR_GET_EXP (tmp2) - MPFR_GET_EXP (tmp1);
+ MPFR_LOG_MSG (("canceled bits=%ld\n", (long) cancel));
+ MPFR_LOG_VAR (tmp1);
+ if (MPFR_UNLIKELY (cancel < 0))
+ cancel = 0;
+
+ /* we have 7 ulps of error from the above roundings,
+ 4 ulps from the 4/s^2 second order term,
+ plus the canceled bits */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp1, p-cancel-4, q, rnd_mode)))
+ break;
+
+ /* VL: I think it is better to have an increment that it isn't
+ too low; in particular, the increment must be positive even
+ if cancel = 0 (can this occur?). */
+ p += cancel >= 8 ? cancel : 8;
+ }
+ else
+ {
+ /* TODO: find why this case can occur and what is best to do
+ with it. */
+ p += 32;
+ }
+
+ MPFR_ZIV_NEXT (loop, p);
+ MPFR_GROUP_REPREC_2 (group, p, tmp1, tmp2);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (r, tmp1, rnd_mode);
+ /* We clean */
+ MPFR_GROUP_CLEAR (group);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inexact, rnd_mode);
+}
diff --git a/src/log10.c b/src/log10.c
new file mode 100644
index 0000000..31b6ce9
--- /dev/null
+++ b/src/log10.c
@@ -0,0 +1,150 @@
+/* mpfr_log10 -- logarithm in base 10.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of r=log10(a)
+
+ r=log10(a)=log(a)/log(10)
+ */
+
+int
+mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("a[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
+ ("r[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (r), mpfr_log_prec, r, inexact));
+
+ /* If a is NaN, the result is NaN */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (a)))
+ {
+ if (MPFR_IS_NAN (a))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ /* check for infinity before zero */
+ else if (MPFR_IS_INF (a))
+ {
+ if (MPFR_IS_NEG (a))
+ /* log10(-Inf) = NaN */
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ else /* log10(+Inf) = +Inf */
+ {
+ MPFR_SET_INF (r);
+ MPFR_SET_POS (r);
+ MPFR_RET (0); /* exact */
+ }
+ }
+ else /* a = 0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (a));
+ MPFR_SET_INF (r);
+ MPFR_SET_NEG (r);
+ mpfr_set_divby0 ();
+ MPFR_RET (0); /* log10(0) is an exact -infinity */
+ }
+ }
+
+ /* If a is negative, the result is NaN */
+ if (MPFR_UNLIKELY (MPFR_IS_NEG (a)))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+
+ /* If a is 1, the result is 0 */
+ if (mpfr_cmp_ui (a, 1) == 0)
+ {
+ MPFR_SET_ZERO (r);
+ MPFR_SET_POS (r);
+ MPFR_RET (0); /* result is exact */
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t, tt;
+ MPFR_ZIV_DECL (loop);
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(r); /* Precision of output variable */
+ mpfr_prec_t Nt; /* Precision of the intermediary variable */
+ mpfr_exp_t err; /* Precision of error */
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + 4 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ /* initialise of intermediary variables */
+ mpfr_init2 (t, Nt);
+ mpfr_init2 (tt, Nt);
+
+ /* First computation of log10 */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute log10 */
+ mpfr_set_ui (t, 10, MPFR_RNDN); /* 10 */
+ mpfr_log (t, t, MPFR_RNDD); /* log(10) */
+ mpfr_log (tt, a, MPFR_RNDN); /* log(a) */
+ mpfr_div (t, tt, t, MPFR_RNDN); /* log(a)/log(10) */
+
+ /* estimation of the error */
+ err = Nt - 4;
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ break;
+
+ /* log10(10^n) is exact:
+ FIXME: Can we have 10^n exactly representable as a mpfr_t
+ but n can't fit an unsigned long? */
+ if (MPFR_IS_POS (t)
+ && mpfr_integer_p (t) && mpfr_fits_ulong_p (t, MPFR_RNDN)
+ && !mpfr_ui_pow_ui (tt, 10, mpfr_get_ui (t, MPFR_RNDN), MPFR_RNDN)
+ && mpfr_cmp (a, tt) == 0)
+ break;
+
+ /* actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ mpfr_set_prec (tt, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (r, t, rnd_mode);
+
+ mpfr_clear (t);
+ mpfr_clear (tt);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inexact, rnd_mode);
+}
diff --git a/src/log1p.c b/src/log1p.c
new file mode 100644
index 0000000..a4c9b25
--- /dev/null
+++ b/src/log1p.c
@@ -0,0 +1,158 @@
+/* mpfr_log1p -- Compute log(1+x)
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of log1p is done by
+ log1p(x)=log(1+x) */
+
+int
+mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int comp, inexact;
+ mpfr_exp_t ex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ /* check for inf or -inf (result is not defined) */
+ else if (MPFR_IS_INF (x))
+ {
+ if (MPFR_IS_POS (x))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ else
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y); /* log1p(+/- 0) = +/- 0 */
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ ex = MPFR_GET_EXP (x);
+ if (ex < 0) /* -0.5 < x < 0.5 */
+ {
+ /* For x > 0, abs(log(1+x)-x) < x^2/2.
+ For x > -0.5, abs(log(1+x)-x) < x^2. */
+ if (MPFR_IS_POS (x))
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, - ex - 1, 0, 0, rnd_mode, {});
+ else
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, - ex, 0, 1, rnd_mode, {});
+ }
+
+ comp = mpfr_cmp_si (x, -1);
+ /* log1p(x) is undefined for x < -1 */
+ if (MPFR_UNLIKELY(comp <= 0))
+ {
+ if (comp == 0)
+ /* x=0: log1p(-1)=-inf (divide-by-zero exception) */
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_NEG (y);
+ mpfr_set_divby0 ();
+ MPFR_RET (0);
+ }
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t;
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err; /* error */
+ MPFR_ZIV_DECL (loop);
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 6;
+
+ /* if |x| is smaller than 2^(-e), we will loose about e bits
+ in log(1+x) */
+ if (MPFR_EXP(x) < 0)
+ Nt += -MPFR_EXP(x);
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+
+ /* First computation of log1p */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute log1p */
+ inexact = mpfr_add_ui (t, x, 1, MPFR_RNDN); /* 1+x */
+ /* if inexact = 0, then t = x+1, and the result is simply log(t) */
+ if (inexact == 0)
+ {
+ inexact = mpfr_log (y, t, rnd_mode);
+ goto end;
+ }
+ mpfr_log (t, t, MPFR_RNDN); /* log(1+x) */
+
+ /* the error is bounded by (1/2+2^(1-EXP(t))*ulp(t) (cf algorithms.tex)
+ if EXP(t)>=2, then error <= ulp(t)
+ if EXP(t)<=1, then error <= 2^(2-EXP(t))*ulp(t) */
+ err = Nt - MAX (0, 2 - MPFR_GET_EXP (t));
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ break;
+
+ /* increase the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/log2.c b/src/log2.c
new file mode 100644
index 0000000..d95497b
--- /dev/null
+++ b/src/log2.c
@@ -0,0 +1,142 @@
+/* mpfr_log2 -- log base 2
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of r=log2(a)
+ r=log2(a)=log(a)/log(2) */
+
+int
+mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("a[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
+ ("r[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (a)))
+ {
+ /* If a is NaN, the result is NaN */
+ if (MPFR_IS_NAN (a))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ /* check for infinity before zero */
+ else if (MPFR_IS_INF (a))
+ {
+ if (MPFR_IS_NEG (a))
+ /* log(-Inf) = NaN */
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ else /* log(+Inf) = +Inf */
+ {
+ MPFR_SET_INF (r);
+ MPFR_SET_POS (r);
+ MPFR_RET (0);
+ }
+ }
+ else /* a is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (a));
+ MPFR_SET_INF (r);
+ MPFR_SET_NEG (r);
+ mpfr_set_divby0 ();
+ MPFR_RET (0); /* log2(0) is an exact -infinity */
+ }
+ }
+
+ /* If a is negative, the result is NaN */
+ if (MPFR_UNLIKELY (MPFR_IS_NEG (a)))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+
+ /* If a is 1, the result is 0 */
+ if (MPFR_UNLIKELY (mpfr_cmp_ui (a, 1) == 0))
+ {
+ MPFR_SET_ZERO (r);
+ MPFR_SET_POS (r);
+ MPFR_RET (0); /* only "normal" case where the result is exact */
+ }
+
+ /* If a is 2^N, log2(a) is exact*/
+ if (MPFR_UNLIKELY (mpfr_cmp_ui_2exp (a, 1, MPFR_GET_EXP (a) - 1) == 0))
+ return mpfr_set_si(r, MPFR_GET_EXP (a) - 1, rnd_mode);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t, tt;
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(r); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err; /* error */
+ MPFR_ZIV_DECL (loop);
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + 3 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+ mpfr_init2 (tt, Nt);
+
+ /* First computation of log2 */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* compute log2 */
+ mpfr_const_log2(t,MPFR_RNDD); /* log(2) */
+ mpfr_log(tt,a,MPFR_RNDN); /* log(a) */
+ mpfr_div(t,tt,t,MPFR_RNDN); /* log(a)/log(2) */
+
+ /* estimation of the error */
+ err = Nt-3;
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ break;
+
+ /* actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ mpfr_set_prec (tt, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (r, t, rnd_mode);
+
+ mpfr_clear (t);
+ mpfr_clear (tt);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inexact, rnd_mode);
+}
diff --git a/src/logging.c b/src/logging.c
new file mode 100644
index 0000000..7b3f8c5
--- /dev/null
+++ b/src/logging.c
@@ -0,0 +1,124 @@
+/* MPFR Logging functions.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Logging MPFR needs GCC >= 3.0 and GLIBC >= 2.0. */
+
+#ifdef MPFR_USE_LOGGING
+
+/* Can't include them before (in particular, printf.h) */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <time.h>
+
+/* Define LOGGING variables */
+
+FILE *mpfr_log_file;
+int mpfr_log_type;
+int mpfr_log_level;
+int mpfr_log_current;
+int mpfr_log_worstcase_limit;
+mpfr_prec_t mpfr_log_prec;
+
+static void mpfr_log_begin (void) __attribute__((constructor));
+
+/* We let the system close the LOG itself
+ (Otherwise functions called by destructor can't use LOG File */
+static void
+mpfr_log_begin (void)
+{
+ const char *var;
+ time_t tt;
+
+ /* Grab some information */
+ var = getenv ("MPFR_LOG_LEVEL");
+ mpfr_log_level = var == NULL || *var == 0 ? 7 : atoi (var);
+ mpfr_log_current = 0;
+
+ var = getenv ("MPFR_LOG_PREC");
+ mpfr_log_prec = var == NULL ? 6 : atol (var);
+
+ /* Get what we need to log */
+ mpfr_log_type = 0;
+ if (getenv ("MPFR_LOG_INPUT") != NULL)
+ mpfr_log_type |= MPFR_LOG_INPUT_F;
+ if (getenv ("MPFR_LOG_OUTPUT") != NULL)
+ mpfr_log_type |= MPFR_LOG_OUTPUT_F;
+ if (getenv ("MPFR_LOG_TIME") != NULL)
+ mpfr_log_type |= MPFR_LOG_TIME_F;
+ if (getenv ("MPFR_LOG_INTERNAL") != NULL)
+ mpfr_log_type |= MPFR_LOG_INTERNAL_F;
+ if (getenv ("MPFR_LOG_MSG") != NULL)
+ mpfr_log_type |= MPFR_LOG_MSG_F;
+ if (getenv ("MPFR_LOG_ZIV") != NULL)
+ mpfr_log_type |= MPFR_LOG_BADCASE_F;
+ if (getenv ("MPFR_LOG_STAT") != NULL)
+ mpfr_log_type |= MPFR_LOG_STAT_F;
+ if (getenv ("MPFR_LOG_ALL") != NULL)
+ mpfr_log_type = MPFR_LOG_INPUT_F|MPFR_LOG_OUTPUT_F|MPFR_LOG_TIME_F
+ |MPFR_LOG_INTERNAL_F|MPFR_LOG_MSG_F|MPFR_LOG_BADCASE_F|MPFR_LOG_STAT_F;
+
+ /* Open filename if needed */
+ var = getenv ("MPFR_LOG_FILE");
+ if (var == NULL || *var == 0)
+ var = "mpfr.log";
+ if (mpfr_log_type != 0)
+ {
+ mpfr_log_file = fopen (var, "w");
+ if (mpfr_log_file == NULL)
+ {
+ fprintf (stderr, "MPFR LOG: Can't open '%s' with w.\n", var);
+ abort ();
+ }
+ time (&tt);
+ fprintf (mpfr_log_file, "MPFR LOG FILE %s\n", ctime (&tt));
+ }
+}
+
+/* Return user CPU time measured in milliseconds. Thanks to Torbjorn. */
+
+#if defined (ANSIONLY) || defined (USG) || defined (__SVR4) \
+ || defined (_UNICOS) || defined(__hpux)
+
+int
+mpfr_get_cputime (void)
+{
+ return (int) ((unsigned long long) clock () * 1000 / CLOCKS_PER_SEC);
+}
+
+#else /* Use getrusage for cputime */
+
+#include <sys/types.h>
+#include <sys/resource.h>
+
+int
+mpfr_get_cputime (void)
+{
+ struct rusage rus;
+ getrusage (0, &rus);
+ return rus.ru_utime.tv_sec * 1000 + rus.ru_utime.tv_usec / 1000;
+}
+
+#endif /* cputime */
+
+#endif /* MPFR_USE_LOGGING */
diff --git a/src/min_prec.c b/src/min_prec.c
new file mode 100644
index 0000000..7df9e77
--- /dev/null
+++ b/src/min_prec.c
@@ -0,0 +1,33 @@
+/* mpfr_min_prec -- minimal size in bits to hold the mantissa
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+mpfr_prec_t
+mpfr_min_prec (mpfr_srcptr x)
+{
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return 0;
+
+ /* from a suggestion by Andreas Enge (2010-11-18) */
+ return MPFR_LIMB_SIZE (x) * GMP_NUMB_BITS - mpn_scan1 (MPFR_MANT (x), 0);
+}
diff --git a/src/minmax.c b/src/minmax.c
new file mode 100644
index 0000000..288027b
--- /dev/null
+++ b/src/minmax.c
@@ -0,0 +1,92 @@
+/* mpfr_min -- min and max of x, y
+
+Copyright 2001, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#include "mpfr-impl.h"
+
+ /* The computation of z=min(x,y)
+
+ z=x if x <= y
+ z=y if x > y
+ */
+
+int
+mpfr_min (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_ARE_SINGULAR(x,y))
+ {
+ if (MPFR_IS_NAN(x) && MPFR_IS_NAN(y) )
+ {
+ MPFR_SET_NAN(z);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_NAN(x))
+ return mpfr_set(z, y, rnd_mode);
+ else if (MPFR_IS_NAN(y))
+ return mpfr_set(z, x, rnd_mode);
+ else if (MPFR_IS_ZERO(x) && MPFR_IS_ZERO(y))
+ {
+ if (MPFR_IS_NEG(x))
+ return mpfr_set(z, x, rnd_mode);
+ else
+ return mpfr_set(z, y, rnd_mode);
+ }
+ }
+ if (mpfr_cmp(x,y) <= 0)
+ return mpfr_set(z, x, rnd_mode);
+ else
+ return mpfr_set(z, y, rnd_mode);
+}
+
+ /* The computation of z=max(x,y)
+
+ z=x if x >= y
+ z=y if x < y
+ */
+
+int
+mpfr_max (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_ARE_SINGULAR(x,y))
+ {
+ if (MPFR_IS_NAN(x) && MPFR_IS_NAN(y) )
+ {
+ MPFR_SET_NAN(z);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_NAN(x))
+ return mpfr_set(z, y, rnd_mode);
+ else if (MPFR_IS_NAN(y))
+ return mpfr_set(z, x, rnd_mode);
+ else if (MPFR_IS_ZERO(x) && MPFR_IS_ZERO(y))
+ {
+ if (MPFR_IS_NEG(x))
+ return mpfr_set(z, y, rnd_mode);
+ else
+ return mpfr_set(z, x, rnd_mode);
+ }
+ }
+ if (mpfr_cmp(x,y) <= 0)
+ return mpfr_set(z, y, rnd_mode);
+ else
+ return mpfr_set(z, x, rnd_mode);
+}
diff --git a/src/modf.c b/src/modf.c
new file mode 100644
index 0000000..a16020b
--- /dev/null
+++ b/src/modf.c
@@ -0,0 +1,102 @@
+/* mpfr_modf -- Integral and fractional part.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#define INEXPOS(y) ((y) == 0 ? 0 : (((y) > 0) ? 1 : 2))
+#define INEX(y,z) (INEXPOS(y) | (INEXPOS(z) << 2))
+
+/* Set iop to the integral part of op and fop to its fractional part */
+int
+mpfr_modf (mpfr_ptr iop, mpfr_ptr fop, mpfr_srcptr op, mpfr_rnd_t rnd_mode)
+{
+ mpfr_exp_t ope;
+ mpfr_prec_t opq;
+ int inexi, inexf;
+
+ MPFR_LOG_FUNC
+ (("op[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (op), mpfr_log_prec, op, rnd_mode),
+ ("iop[%Pu]=%.*Rg fop[%Pu]=%.*Rg",
+ mpfr_get_prec (iop), mpfr_log_prec, iop,
+ mpfr_get_prec (fop), mpfr_log_prec, fop));
+
+ MPFR_ASSERTN (iop != fop);
+
+ if ( MPFR_UNLIKELY (MPFR_IS_SINGULAR (op)) )
+ {
+ if (MPFR_IS_NAN (op))
+ {
+ MPFR_SET_NAN (iop);
+ MPFR_SET_NAN (fop);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_SAME_SIGN (iop, op);
+ MPFR_SET_SAME_SIGN (fop, op);
+ if (MPFR_IS_INF (op))
+ {
+ MPFR_SET_INF (iop);
+ MPFR_SET_ZERO (fop);
+ MPFR_RET (0);
+ }
+ else /* op is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (op));
+ MPFR_SET_ZERO (iop);
+ MPFR_SET_ZERO (fop);
+ MPFR_RET (0);
+ }
+ }
+
+ ope = MPFR_GET_EXP (op);
+ opq = MPFR_PREC (op);
+
+ if (ope <= 0) /* 0 < |op| < 1 */
+ {
+ inexf = (fop != op) ? mpfr_set (fop, op, rnd_mode) : 0;
+ MPFR_SET_SAME_SIGN (iop, op);
+ MPFR_SET_ZERO (iop);
+ MPFR_RET (INEX(0, inexf));
+ }
+ else if (ope >= opq) /* op has no fractional part */
+ {
+ inexi = (iop != op) ? mpfr_set (iop, op, rnd_mode) : 0;
+ MPFR_SET_SAME_SIGN (fop, op);
+ MPFR_SET_ZERO (fop);
+ MPFR_RET (INEX(inexi, 0));
+ }
+ else /* op has both integral and fractional parts */
+ {
+ if (iop != op)
+ {
+ inexi = mpfr_rint_trunc (iop, op, rnd_mode);
+ inexf = mpfr_frac (fop, op, rnd_mode);
+ }
+ else
+ {
+ MPFR_ASSERTN (fop != op);
+ inexf = mpfr_frac (fop, op, rnd_mode);
+ inexi = mpfr_rint_trunc (iop, op, rnd_mode);
+ }
+ MPFR_RET (INEX(inexi, inexf));
+ }
+}
diff --git a/src/mp_clz_tab.c b/src/mp_clz_tab.c
new file mode 100644
index 0000000..3f455e4
--- /dev/null
+++ b/src/mp_clz_tab.c
@@ -0,0 +1,38 @@
+/* __clz_tab -- support for longlong.h
+
+ THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND MAY CHANGE
+ INCOMPATIBLY OR DISAPPEAR IN A FUTURE GNU MPFR RELEASE.
+
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+It has been copied and adapted from the GNU MP Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#if defined(COUNT_LEADING_ZEROS_NEED_CLZ_TAB) && defined(__GMPFR_GMP_H__)
+const
+unsigned char __clz_tab[128] =
+{
+ 1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+};
+#endif
diff --git a/src/mparam_h.in b/src/mparam_h.in
new file mode 100644
index 0000000..732f073
--- /dev/null
+++ b/src/mparam_h.in
@@ -0,0 +1,92 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_IMPL_H__
+# error "MPFR Internal not included"
+#endif
+
+/* Note: the different macros used here are those defined by gcc,
+ for example with gcc -dM -E -xc /dev/null
+ As of gcc 4.2, you can also use: -march=native or -mtune=native */
+
+#if defined (__tune_pentium4__) /* Threshold for Pentium 4 */
+#define MPFR_TUNE_CASE "src/x86_64/pentium4/mparam.h"
+#include "x86_64/pentium4/mparam.h"
+
+#elif (defined (__tune_core2__) || defined (__tune_nocona__)) && defined (__x86_64) /* 64-bit Core 2 or Xeon */
+#define MPFR_TUNE_CASE "src/x86_64/core2/mparam.h"
+#include "x86_64/core2/mparam.h"
+
+#elif defined (__tune_core2__) && defined (__i386) /* 32-bit Core 2,
+ for example a 64-bit machine with gmp/mpfr compiled with ABI=32 */
+#define MPFR_TUNE_CASE "src/x86/core2/mparam.h"
+#include "x86/core2/mparam.h"
+
+#elif defined (__tune_k8__) /* Threshold for AMD 64 */
+#define MPFR_TUNE_CASE "src/amd/k8/mparam.h"
+#include "amd/k8/mparam.h"
+
+#elif defined (__tune_athlon__) /* Threshold for Athlon */
+#define MPFR_TUNE_CASE "src/amd/athlon/mparam.h"
+#include "amd/athlon/mparam.h"
+
+#elif defined (__tune_pentiumpro__) || defined (__tune_i686__) || defined (__i386) /* we consider all other 386's here */
+#define MPFR_TUNE_CASE "src/x86/mparam.h"
+#include "x86/mparam.h"
+
+#elif defined (__ia64) || defined (__itanium__) || defined (__tune_ia64__)
+/* Threshold for IA64 */
+#define MPFR_TUNE_CASE "src/ia64/mparam.h"
+#include "ia64/mparam.h"
+
+#elif defined (__arm__) /* Threshold for ARM */
+#define MPFR_TUNE_CASE "src/arm/mparam.h"
+#include "arm/mparam.h"
+
+#elif defined (__PPC64__) /* Threshold for 64-bit PowerPC, test it before
+ 32-bit PowerPC since _ARCH_PPC is also defined
+ on 64-bit PowerPC */
+#define MPFR_TUNE_CASE "src/powerpc64/mparam.h"
+#include "powerpc64/mparam.h"
+
+#elif defined (_ARCH_PPC) /* Threshold for 32-bit PowerPC */
+#define MPFR_TUNE_CASE "src/powerpc32/mparam.h"
+#include "powerpc32/mparam.h"
+
+#elif defined (__sparc_v9__) /* Threshold for 64-bits Sparc */
+#define MPFR_TUNE_CASE "src/sparc64/mparam.h"
+#include "sparc64/mparam.h"
+
+#elif defined (__hppa__) /* Threshold for HPPA */
+#define MPFR_TUNE_CASE "src/hppa/mparam.h"
+#include "hppa/mparam.h"
+
+#else
+#define MPFR_TUNE_CASE "default"
+#endif
+
+/****************************************************************
+ * Default values of Threshold. *
+ * Must be included in any case: it checks, for every constant, *
+ * if it has been defined, and it sets it to a default value if *
+ * it was not previously defined. *
+ ****************************************************************/
+#include "generic/mparam.h"
diff --git a/src/mpf2mpfr.h b/src/mpf2mpfr.h
new file mode 100644
index 0000000..ef6ab82
--- /dev/null
+++ b/src/mpf2mpfr.h
@@ -0,0 +1,175 @@
+/* mpf2mpfr.h -- Compatibility include file with mpf.
+
+Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_FROM_MPF__
+#define __MPFR_FROM_MPF__
+
+/* types */
+#define mpf_t mpfr_t
+#define mpf_srcptr mpfr_srcptr
+#define mpf_ptr mpfr_ptr
+
+/* Get current Rounding Mode */
+#ifndef MPFR_DEFAULT_RND
+# define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode ()
+#endif
+
+/* mpf_init initalizes at 0 */
+#undef mpf_init
+#define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND)
+#undef mpf_init2
+#define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND))
+
+/* functions which don't take as argument the rounding mode */
+#undef mpf_ceil
+#define mpf_ceil mpfr_ceil
+#undef mpf_clear
+#define mpf_clear mpfr_clear
+#undef mpf_cmp
+#define mpf_cmp mpfr_cmp
+#undef mpf_cmp_si
+#define mpf_cmp_si mpfr_cmp_si
+#undef mpf_cmp_ui
+#define mpf_cmp_ui mpfr_cmp_ui
+#undef mpf_cmp_d
+#define mpf_cmp_d mpfr_cmp_d
+#undef mpf_eq
+#define mpf_eq mpfr_eq
+#undef mpf_floor
+#define mpf_floor mpfr_floor
+#undef mpf_get_prec
+#define mpf_get_prec mpfr_get_prec
+#undef mpf_integer_p
+#define mpf_integer_p mpfr_integer_p
+#undef mpf_random2
+#define mpf_random2 mpfr_random2
+#undef mpf_set_default_prec
+#define mpf_set_default_prec mpfr_set_default_prec
+#undef mpf_get_default_prec
+#define mpf_get_default_prec mpfr_get_default_prec
+#undef mpf_set_prec
+#define mpf_set_prec mpfr_set_prec
+#undef mpf_set_prec_raw
+#define mpf_set_prec_raw(x,p) mpfr_prec_round(x,p,MPFR_DEFAULT_RND)
+#undef mpf_trunc
+#define mpf_trunc mpfr_trunc
+#undef mpf_sgn
+#define mpf_sgn mpfr_sgn
+#undef mpf_swap
+#define mpf_swap mpfr_swap
+#undef mpf_dump
+#define mpf_dump mpfr_dump
+
+/* functions which take as argument the rounding mode */
+#undef mpf_abs
+#define mpf_abs(x,y) mpfr_abs(x,y,MPFR_DEFAULT_RND)
+#undef mpf_add
+#define mpf_add(x,y,z) mpfr_add(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_add_ui
+#define mpf_add_ui(x,y,z) mpfr_add_ui(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_div
+#define mpf_div(x,y,z) mpfr_div(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_div_ui
+#define mpf_div_ui(x,y,z) mpfr_div_ui(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_div_2exp
+#define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_fits_slong_p
+#define mpf_fits_slong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
+#undef mpf_fits_ulong_p
+#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
+#undef mpf_fits_sint_p
+#define mpf_fits_sint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
+#undef mpf_fits_uint_p
+#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
+#undef mpf_fits_sshort_p
+#define mpf_fits_sshort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
+#undef mpf_fits_ushort_p
+#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
+#undef mpf_get_str
+#define mpf_get_str(x,y,z,t,u) mpfr_get_str(x,y,z,t,u,MPFR_DEFAULT_RND)
+#undef mpf_get_d
+#define mpf_get_d(x) mpfr_get_d(x,MPFR_DEFAULT_RND)
+#undef mpf_get_d_2exp
+#define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,MPFR_DEFAULT_RND)
+#undef mpf_get_ui
+#define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
+#undef mpf_get_si
+#define mpf_get_si(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
+#undef mpf_inp_str
+#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_set_str
+#define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_init_set
+#define mpf_init_set(x,y) mpfr_init_set(x,y,MPFR_DEFAULT_RND)
+#undef mpf_init_set_d
+#define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,MPFR_DEFAULT_RND)
+#undef mpf_init_set_si
+#define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,MPFR_DEFAULT_RND)
+#undef mpf_init_set_str
+#define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_init_set_ui
+#define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,MPFR_DEFAULT_RND)
+#undef mpf_mul
+#define mpf_mul(x,y,z) mpfr_mul(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_mul_2exp
+#define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_mul_ui
+#define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_neg
+#define mpf_neg(x,y) mpfr_neg(x,y,MPFR_DEFAULT_RND)
+#undef mpf_out_str
+#define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,MPFR_DEFAULT_RND)
+#undef mpf_pow_ui
+#define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_reldiff
+#define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_set
+#define mpf_set(x,y) mpfr_set(x,y,MPFR_DEFAULT_RND)
+#undef mpf_set_d
+#define mpf_set_d(x,y) mpfr_set_d(x,y,MPFR_DEFAULT_RND)
+#undef mpf_set_q
+#define mpf_set_q(x,y) mpfr_set_q(x,y,MPFR_DEFAULT_RND)
+#undef mpf_set_si
+#define mpf_set_si(x,y) mpfr_set_si(x,y,MPFR_DEFAULT_RND)
+#undef mpf_set_ui
+#define mpf_set_ui(x,y) mpfr_set_ui(x,y,MPFR_DEFAULT_RND)
+#undef mpf_set_z
+#define mpf_set_z(x,y) mpfr_set_z(x,y,MPFR_DEFAULT_RND)
+#undef mpf_sqrt
+#define mpf_sqrt(x,y) mpfr_sqrt(x,y,MPFR_DEFAULT_RND)
+#undef mpf_sqrt_ui
+#define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,MPFR_DEFAULT_RND)
+#undef mpf_sub
+#define mpf_sub(x,y,z) mpfr_sub(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_sub_ui
+#define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_ui_div
+#define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_ui_sub
+#define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,MPFR_DEFAULT_RND)
+#undef mpf_urandomb
+#define mpf_urandomb(x,y,n) mpfr_urandomb(x,y)
+
+#undef mpz_set_f
+#define mpz_set_f(z,f) mpfr_get_z(z,f,MPFR_DEFAULT_RND)
+
+#endif /* __MPFR_FROM_MPF__ */
diff --git a/src/mpfr-gmp.c b/src/mpfr-gmp.c
new file mode 100644
index 0000000..0d60c88
--- /dev/null
+++ b/src/mpfr-gmp.c
@@ -0,0 +1,386 @@
+/* mpfr_gmp -- Limited gmp-impl emulator
+ Modified version of the GMP files.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h> /* For malloc, free, realloc and abort */
+
+#include "mpfr-impl.h"
+
+#ifndef MPFR_HAVE_GMP_IMPL
+
+char mpfr_rands_initialized = 0;
+gmp_randstate_t mpfr_rands;
+
+const struct bases mpfr_bases[257] =
+{
+ /* 0 */ {0.0},
+ /* 1 */ {1e37},
+ /* 2 */ {1.0000000000000000},
+ /* 3 */ {0.6309297535714574},
+ /* 4 */ {0.5000000000000000},
+ /* 5 */ {0.4306765580733931},
+ /* 6 */ {0.3868528072345416},
+ /* 7 */ {0.3562071871080222},
+ /* 8 */ {0.3333333333333333},
+ /* 9 */ {0.3154648767857287},
+ /* 10 */ {0.3010299956639812},
+ /* 11 */ {0.2890648263178878},
+ /* 12 */ {0.2789429456511298},
+ /* 13 */ {0.2702381544273197},
+ /* 14 */ {0.2626495350371935},
+ /* 15 */ {0.2559580248098155},
+ /* 16 */ {0.2500000000000000},
+ /* 17 */ {0.2446505421182260},
+ /* 18 */ {0.2398124665681314},
+ /* 19 */ {0.2354089133666382},
+ /* 20 */ {0.2313782131597592},
+ /* 21 */ {0.2276702486969530},
+ /* 22 */ {0.2242438242175754},
+ /* 23 */ {0.2210647294575037},
+ /* 24 */ {0.2181042919855316},
+ /* 25 */ {0.2153382790366965},
+ /* 26 */ {0.2127460535533632},
+ /* 27 */ {0.2103099178571525},
+ /* 28 */ {0.2080145976765095},
+ /* 29 */ {0.2058468324604344},
+ /* 30 */ {0.2037950470905062},
+ /* 31 */ {0.2018490865820999},
+ /* 32 */ {0.2000000000000000},
+ /* 33 */ {0.1982398631705605},
+ /* 34 */ {0.1965616322328226},
+ /* 35 */ {0.1949590218937863},
+ /* 36 */ {0.1934264036172708},
+ /* 37 */ {0.1919587200065601},
+ /* 38 */ {0.1905514124267734},
+ /* 39 */ {0.1892003595168700},
+ /* 40 */ {0.1879018247091076},
+ /* 41 */ {0.1866524112389434},
+ /* 42 */ {0.1854490234153689},
+ /* 43 */ {0.1842888331487062},
+ /* 44 */ {0.1831692509136336},
+ /* 45 */ {0.1820879004699383},
+ /* 46 */ {0.1810425967800402},
+ /* 47 */ {0.1800313266566926},
+ /* 48 */ {0.1790522317510414},
+ /* 49 */ {0.1781035935540111},
+ /* 50 */ {0.1771838201355579},
+ /* 51 */ {0.1762914343888821},
+ /* 52 */ {0.1754250635819545},
+ /* 53 */ {0.1745834300480449},
+ /* 54 */ {0.1737653428714400},
+ /* 55 */ {0.1729696904450771},
+ /* 56 */ {0.1721954337940981},
+ /* 57 */ {0.1714416005739134},
+ /* 58 */ {0.1707072796637201},
+ /* 59 */ {0.1699916162869140},
+ /* 60 */ {0.1692938075987814},
+ /* 61 */ {0.1686130986895011},
+ /* 62 */ {0.1679487789570419},
+ /* 63 */ {0.1673001788101741},
+ /* 64 */ {0.1666666666666667},
+ /* 65 */ {0.1660476462159378},
+ /* 66 */ {0.1654425539190583},
+ /* 67 */ {0.1648508567221603},
+ /* 68 */ {0.1642720499620502},
+ /* 69 */ {0.1637056554452156},
+ /* 70 */ {0.1631512196835108},
+ /* 71 */ {0.1626083122716342},
+ /* 72 */ {0.1620765243931223},
+ /* 73 */ {0.1615554674429964},
+ /* 74 */ {0.1610447717564444},
+ /* 75 */ {0.1605440854340214},
+ /* 76 */ {0.1600530732548213},
+ /* 77 */ {0.1595714156699382},
+ /* 78 */ {0.1590988078692941},
+ /* 79 */ {0.1586349589155960},
+ /* 80 */ {0.1581795909397823},
+ /* 81 */ {0.1577324383928644},
+ /* 82 */ {0.1572932473495469},
+ /* 83 */ {0.1568617748594410},
+ /* 84 */ {0.1564377883420715},
+ /* 85 */ {0.1560210650222250},
+ /* 86 */ {0.1556113914024939},
+ /* 87 */ {0.1552085627701551},
+ /* 88 */ {0.1548123827357682},
+ /* 89 */ {0.1544226628011101},
+ /* 90 */ {0.1540392219542636},
+ /* 91 */ {0.1536618862898642},
+ /* 92 */ {0.1532904886526781},
+ /* 93 */ {0.1529248683028321},
+ /* 94 */ {0.1525648706011593},
+ /* 95 */ {0.1522103467132434},
+ /* 96 */ {0.1518611533308632},
+ /* 97 */ {0.1515171524096389},
+ /* 98 */ {0.1511782109217764},
+ /* 99 */ {0.1508442006228941},
+ /* 100 */ {0.1505149978319906},
+ /* 101 */ {0.1501904832236880},
+ /* 102 */ {0.1498705416319474},
+ /* 103 */ {0.1495550618645152},
+ /* 104 */ {0.1492439365274121},
+ /* 105 */ {0.1489370618588283},
+ /* 106 */ {0.1486343375718350},
+ /* 107 */ {0.1483356667053617},
+ /* 108 */ {0.1480409554829326},
+ /* 109 */ {0.1477501131786861},
+ /* 110 */ {0.1474630519902391},
+ /* 111 */ {0.1471796869179852},
+ /* 112 */ {0.1468999356504447},
+ /* 113 */ {0.1466237184553111},
+ /* 114 */ {0.1463509580758620},
+ /* 115 */ {0.1460815796324244},
+ /* 116 */ {0.1458155105286054},
+ /* 117 */ {0.1455526803620167},
+ /* 118 */ {0.1452930208392429},
+ /* 119 */ {0.1450364656948130},
+ /* 120 */ {0.1447829506139581},
+ /* 121 */ {0.1445324131589439},
+ /* 122 */ {0.1442847926987864},
+ /* 123 */ {0.1440400303421672},
+ /* 124 */ {0.1437980688733776},
+ /* 125 */ {0.1435588526911310},
+ /* 126 */ {0.1433223277500932},
+ /* 127 */ {0.1430884415049874},
+ /* 128 */ {0.1428571428571428},
+ /* 129 */ {0.1426283821033600},
+ /* 130 */ {0.1424021108869747},
+ /* 131 */ {0.1421782821510107},
+ /* 132 */ {0.1419568500933153},
+ /* 133 */ {0.1417377701235801},
+ /* 134 */ {0.1415209988221527},
+ /* 135 */ {0.1413064939005528},
+ /* 136 */ {0.1410942141636095},
+ /* 137 */ {0.1408841194731412},
+ /* 138 */ {0.1406761707131039},
+ /* 139 */ {0.1404703297561400},
+ /* 140 */ {0.1402665594314587},
+ /* 141 */ {0.1400648234939879},
+ /* 142 */ {0.1398650865947379},
+ /* 143 */ {0.1396673142523192},
+ /* 144 */ {0.1394714728255649},
+ /* 145 */ {0.1392775294872041},
+ /* 146 */ {0.1390854521985406},
+ /* 147 */ {0.1388952096850913},
+ /* 148 */ {0.1387067714131417},
+ /* 149 */ {0.1385201075671774},
+ /* 150 */ {0.1383351890281539},
+ /* 151 */ {0.1381519873525671},
+ /* 152 */ {0.1379704747522905},
+ /* 153 */ {0.1377906240751463},
+ /* 154 */ {0.1376124087861776},
+ /* 155 */ {0.1374358029495937},
+ /* 156 */ {0.1372607812113589},
+ /* 157 */ {0.1370873187823978},
+ /* 158 */ {0.1369153914223921},
+ /* 159 */ {0.1367449754241439},
+ /* 160 */ {0.1365760475984821},
+ /* 161 */ {0.1364085852596902},
+ /* 162 */ {0.1362425662114337},
+ /* 163 */ {0.1360779687331669},
+ /* 164 */ {0.1359147715670014},
+ /* 165 */ {0.1357529539050150},
+ /* 166 */ {0.1355924953769864},
+ /* 167 */ {0.1354333760385373},
+ /* 168 */ {0.1352755763596663},
+ /* 169 */ {0.1351190772136599},
+ /* 170 */ {0.1349638598663645},
+ /* 171 */ {0.1348099059658080},
+ /* 172 */ {0.1346571975321549},
+ /* 173 */ {0.1345057169479844},
+ /* 174 */ {0.1343554469488779},
+ /* 175 */ {0.1342063706143054},
+ /* 176 */ {0.1340584713587979},
+ /* 177 */ {0.1339117329233981},
+ /* 178 */ {0.1337661393673756},
+ /* 179 */ {0.1336216750601996},
+ /* 180 */ {0.1334783246737591},
+ /* 181 */ {0.1333360731748201},
+ /* 182 */ {0.1331949058177136},
+ /* 183 */ {0.1330548081372441},
+ /* 184 */ {0.1329157659418126},
+ /* 185 */ {0.1327777653067443},
+ /* 186 */ {0.1326407925678156},
+ /* 187 */ {0.1325048343149731},
+ /* 188 */ {0.1323698773862368},
+ /* 189 */ {0.1322359088617821},
+ /* 190 */ {0.1321029160581950},
+ /* 191 */ {0.1319708865228925},
+ /* 192 */ {0.1318398080287045},
+ /* 193 */ {0.1317096685686114},
+ /* 194 */ {0.1315804563506306},
+ /* 195 */ {0.1314521597928493},
+ /* 196 */ {0.1313247675185968},
+ /* 197 */ {0.1311982683517524},
+ /* 198 */ {0.1310726513121843},
+ /* 199 */ {0.1309479056113158},
+ /* 200 */ {0.1308240206478128},
+ /* 201 */ {0.1307009860033912},
+ /* 202 */ {0.1305787914387386},
+ /* 203 */ {0.1304574268895465},
+ /* 204 */ {0.1303368824626505},
+ /* 205 */ {0.1302171484322746},
+ /* 206 */ {0.1300982152363760},
+ /* 207 */ {0.1299800734730872},
+ /* 208 */ {0.1298627138972530},
+ /* 209 */ {0.1297461274170591},
+ /* 210 */ {0.1296303050907487},
+ /* 211 */ {0.1295152381234257},
+ /* 212 */ {0.1294009178639407},
+ /* 213 */ {0.1292873358018581},
+ /* 214 */ {0.1291744835645007},
+ /* 215 */ {0.1290623529140715},
+ /* 216 */ {0.1289509357448472},
+ /* 217 */ {0.1288402240804449},
+ /* 218 */ {0.1287302100711566},
+ /* 219 */ {0.1286208859913518},
+ /* 220 */ {0.1285122442369443},
+ /* 221 */ {0.1284042773229231},
+ /* 222 */ {0.1282969778809442},
+ /* 223 */ {0.1281903386569819},
+ /* 224 */ {0.1280843525090381},
+ /* 225 */ {0.1279790124049077},
+ /* 226 */ {0.1278743114199984},
+ /* 227 */ {0.1277702427352035},
+ /* 228 */ {0.1276667996348261},
+ /* 229 */ {0.1275639755045533},
+ /* 230 */ {0.1274617638294791},
+ /* 231 */ {0.1273601581921740},
+ /* 232 */ {0.1272591522708010},
+ /* 233 */ {0.1271587398372755},
+ /* 234 */ {0.1270589147554692},
+ /* 235 */ {0.1269596709794558},
+ /* 236 */ {0.1268610025517973},
+ /* 237 */ {0.1267629036018709},
+ /* 238 */ {0.1266653683442337},
+ /* 239 */ {0.1265683910770258},
+ /* 240 */ {0.1264719661804097},
+ /* 241 */ {0.1263760881150453},
+ /* 242 */ {0.1262807514205999},
+ /* 243 */ {0.1261859507142915},
+ /* 244 */ {0.1260916806894653},
+ /* 245 */ {0.1259979361142023},
+ /* 246 */ {0.1259047118299582},
+ /* 247 */ {0.1258120027502338},
+ /* 248 */ {0.1257198038592741},
+ /* 249 */ {0.1256281102107963},
+ /* 250 */ {0.1255369169267456},
+ /* 251 */ {0.1254462191960791},
+ /* 252 */ {0.1253560122735751},
+ /* 253 */ {0.1252662914786691},
+ /* 254 */ {0.1251770521943144},
+ /* 255 */ {0.1250882898658681},
+ /* 256 */ {0.1250000000000000},
+};
+
+void
+mpfr_assert_fail (const char *filename, int linenum,
+ const char *expr)
+{
+ if (filename != NULL && filename[0] != '\0')
+ {
+ fprintf (stderr, "%s:", filename);
+ if (linenum != -1)
+ fprintf (stderr, "%d: ", linenum);
+ }
+ fprintf (stderr, "MPFR assertion failed: %s\n", expr);
+ abort();
+}
+
+#ifdef mp_get_memory_functions
+
+/* putting 0 as initial values forces those symbols to be fully defined,
+ and always resolved, otherwise they are only tentatively defined, which
+ leads to problems on e.g. MacOS, cf
+ http://lists.gforge.inria.fr/pipermail/mpc-discuss/2008-November/000048.html
+ and http://software.intel.com/en-us/articles/intelr-fortran-compiler-for-mac-os-non_lazy_ptr-unresolved-references-from-linking
+ Note that using ranlib -c or libtool -c is another fix.
+*/
+void * (*mpfr_allocate_func) (size_t) = 0;
+void * (*mpfr_reallocate_func) (void *,size_t, size_t) = 0;
+void (*mpfr_free_func) (void *, size_t) = 0;
+
+#endif
+
+void *
+mpfr_default_allocate (size_t size)
+{
+ void *ret;
+ ret = malloc (size);
+ if (ret == NULL)
+ {
+ fprintf (stderr, "MPFR: Can't allocate memory (size=%lu)\n",
+ (unsigned long) size);
+ abort ();
+ }
+ return ret;
+}
+
+void *
+mpfr_default_reallocate (void *oldptr, size_t old_size, size_t new_size)
+{
+ void *ret;
+ ret = realloc (oldptr, new_size);
+ if (ret == NULL)
+ {
+ fprintf (stderr,
+ "MPFR: Can't reallocate memory (old_size=%lu new_size=%lu)\n",
+ (unsigned long) old_size, (unsigned long) new_size);
+ abort ();
+ }
+ return ret;
+}
+
+void
+mpfr_default_free (void *blk_ptr, size_t blk_size)
+{
+ free (blk_ptr);
+}
+
+void *
+mpfr_tmp_allocate (struct tmp_marker **tmp_marker, size_t size)
+{
+ struct tmp_marker *head;
+
+ head = (struct tmp_marker *)
+ mpfr_default_allocate (sizeof (struct tmp_marker));
+ head->ptr = mpfr_default_allocate (size);
+ head->size = size;
+ head->next = *tmp_marker;
+ *tmp_marker = head;
+ return head->ptr;
+}
+
+void
+mpfr_tmp_free (struct tmp_marker *tmp_marker)
+{
+ struct tmp_marker *t;
+
+ while (tmp_marker != NULL)
+ {
+ t = tmp_marker;
+ mpfr_default_free (t->ptr, t->size);
+ tmp_marker = t->next;
+ mpfr_default_free (t, sizeof (struct tmp_marker));
+ }
+}
+
+#endif /* Have gmp-impl.h */
diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h
new file mode 100644
index 0000000..c004fe5
--- /dev/null
+++ b/src/mpfr-gmp.h
@@ -0,0 +1,411 @@
+/* Interface to replace gmp-impl.h
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __GMPFR_GMP_H__
+#define __GMPFR_GMP_H__
+
+#ifndef __MPFR_IMPL_H__
+# error "mpfr-impl.h not included"
+#endif
+
+#include <limits.h> /* For INT_MAX, ... */
+#include <string.h> /* For memcpy, memset and memmove */
+
+/* The following tries to get a good version of alloca.
+ See gmp-impl.h for implementation details and original version */
+/* FIXME: the autoconf manual gives a different piece of code under the
+ documentation of the AC_FUNC_ALLOCA macro. Should we switch to it? */
+#ifndef alloca
+# if defined ( __GNUC__ )
+# define alloca __builtin_alloca
+# elif defined (__DECC)
+# define alloca(x) __ALLOCA(x)
+# elif defined (_MSC_VER)
+# include <malloc.h>
+# define alloca _alloca
+# elif defined (HAVE_ALLOCA_H)
+# include <alloca.h>
+# elif defined (_AIX) || defined (_IBMR2)
+# pragma alloca
+# else
+void *alloca (size_t);
+# endif
+#endif
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* Define GMP_NUMB_BITS
+ Can't use sizeof(mp_limb_t) since it should be a preprocessor constant */
+#if defined(GMP_NUMB_BITS) /* GMP 4.1.2 or above */
+#ifndef GMP_NUMB_BITS
+# define GMP_NUMB_BITS (GMP_NUMB_BITS+GMP_NAIL_BITS)
+#endif
+#elif defined (__GMP_GMP_NUMB_BITS) /* Older versions 4.x.x */
+# define GMP_NUMB_BITS __GMP_GMP_NUMB_BITS
+# define GMP_NUMB_BITS GMP_NUMB_BITS
+# ifndef GMP_NAIL_BITS
+# define GMP_NAIL_BITS 0
+# endif
+#else
+# error "Could not detect GMP_NUMB_BITS. Try with gmp internal files."
+#endif
+
+/* Define some macros */
+#define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT)
+
+#define MP_LIMB_T_MAX (~(mp_limb_t)0)
+
+#define ULONG_HIGHBIT (ULONG_MAX ^ ((unsigned long) ULONG_MAX >> 1))
+#define UINT_HIGHBIT (UINT_MAX ^ ((unsigned) UINT_MAX >> 1))
+#define USHRT_HIGHBIT ((unsigned short) (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1)))
+
+#define GMP_LIMB_HIGHBIT (MP_LIMB_T_MAX ^ (MP_LIMB_T_MAX >> 1))
+
+
+#if __GMP_MP_SIZE_T_INT
+#define MP_SIZE_T_MAX INT_MAX
+#define MP_SIZE_T_MIN INT_MIN
+#else
+#define MP_SIZE_T_MAX LONG_MAX
+#define MP_SIZE_T_MIN LONG_MIN
+#endif
+
+#define LONG_HIGHBIT LONG_MIN
+#define INT_HIGHBIT INT_MIN
+#define SHRT_HIGHBIT SHRT_MIN
+
+/* MP_LIMB macros */
+#define MPN_ZERO(dst, n) memset((dst), 0, (n)*BYTES_PER_MP_LIMB)
+#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB)
+#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB)
+#define MPN_COPY(dst,src,n) \
+ do \
+ { \
+ if ((dst) != (src)) \
+ { \
+ MPFR_ASSERTD ((char *) (dst) >= (char *) (src) + \
+ (n) * BYTES_PER_MP_LIMB || \
+ (char *) (src) >= (char *) (dst) + \
+ (n) * BYTES_PER_MP_LIMB); \
+ memcpy ((dst), (src), (n) * BYTES_PER_MP_LIMB); \
+ } \
+ } \
+ while (0)
+
+/* MPN macros taken from gmp-impl.h */
+#define MPN_NORMALIZE(DST, NLIMBS) \
+ do { \
+ while (NLIMBS > 0) \
+ { \
+ if ((DST)[(NLIMBS) - 1] != 0) \
+ break; \
+ NLIMBS--; \
+ } \
+ } while (0)
+#define MPN_NORMALIZE_NOT_ZERO(DST, NLIMBS) \
+ do { \
+ MPFR_ASSERTD ((NLIMBS) >= 1); \
+ while (1) \
+ { \
+ if ((DST)[(NLIMBS) - 1] != 0) \
+ break; \
+ NLIMBS--; \
+ } \
+ } while (0)
+#define MPN_OVERLAP_P(xp, xsize, yp, ysize) \
+ ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
+#define MPN_SAME_OR_INCR2_P(dst, dsize, src, ssize) \
+ ((dst) <= (src) || ! MPN_OVERLAP_P (dst, dsize, src, ssize))
+#define MPN_SAME_OR_INCR_P(dst, src, size) \
+ MPN_SAME_OR_INCR2_P(dst, size, src, size)
+#define MPN_SAME_OR_DECR2_P(dst, dsize, src, ssize) \
+ ((dst) >= (src) || ! MPN_OVERLAP_P (dst, dsize, src, ssize))
+#define MPN_SAME_OR_DECR_P(dst, src, size) \
+ MPN_SAME_OR_DECR2_P(dst, size, src, size)
+
+/* If mul_basecase or mpn_sqr_basecase are not exported, used mpn_mul instead */
+#ifndef mpn_mul_basecase
+# define mpn_mul_basecase(dst,s1,n1,s2,n2) mpn_mul((dst),(s1),(n1),(s2),(n2))
+#endif
+#ifndef mpn_sqr_basecase
+# define mpn_sqr_basecase(dst,src,n) mpn_mul((dst),(src),(n),(src),(n))
+#endif
+
+/* ASSERT */
+__MPFR_DECLSPEC void mpfr_assert_fail _MPFR_PROTO((const char *, int,
+ const char *));
+
+#define ASSERT_FAIL(expr) mpfr_assert_fail (__FILE__, __LINE__, #expr)
+#define ASSERT(expr) MPFR_ASSERTD(expr)
+
+/* Access fileds of GMP struct */
+#define SIZ(x) ((x)->_mp_size)
+#define ABSIZ(x) ABS (SIZ (x))
+#define PTR(x) ((x)->_mp_d)
+#define EXP(x) ((x)->_mp_exp)
+#define PREC(x) ((x)->_mp_prec)
+#define ALLOC(x) ((x)->_mp_alloc)
+#define MPZ_REALLOC(z,n) ((n) > ALLOC(z) ? _mpz_realloc(z,n) : PTR(z))
+
+/* Non IEEE float supports -- needs to detect them with proper configure */
+#undef XDEBUG
+#define XDEBUG
+
+/* For longlong.h */
+#ifdef HAVE_ATTRIBUTE_MODE
+typedef unsigned int UQItype __attribute__ ((mode (QI)));
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+#else
+typedef unsigned char UQItype;
+typedef long SItype;
+typedef unsigned long USItype;
+#ifdef HAVE_LONG_LONG
+typedef long long int DItype;
+typedef unsigned long long int UDItype;
+#else /* Assume `long' gives us a wide enough type. Needed for hppa2.0w. */
+typedef long int DItype;
+typedef unsigned long int UDItype;
+#endif
+#endif
+typedef mp_limb_t UWtype;
+typedef unsigned int UHWtype;
+#define W_TYPE_SIZE GMP_NUMB_BITS
+
+/* Remap names of internal mpn functions (for longlong.h). */
+#undef __clz_tab
+#define __clz_tab mpfr_clz_tab
+
+/* Use (4.0 * ...) instead of (2.0 * ...) to work around buggy compilers
+ that don't convert ulong->double correctly (eg. SunOS 4 native cc). */
+#undef MP_BASE_AS_DOUBLE
+#define MP_BASE_AS_DOUBLE (4.0 * ((mp_limb_t) 1 << (GMP_NUMB_BITS - 2)))
+
+/* Structure for conversion between internal binary format and
+ strings in base 2..36. */
+struct bases
+{
+ /* log(2)/log(conversion_base) */
+ double chars_per_bit_exactly;
+};
+#undef __mp_bases
+#define __mp_bases mpfr_bases
+__MPFR_DECLSPEC extern const struct bases mpfr_bases[257];
+
+/* Standard macros */
+#undef ABS
+#undef MIN
+#undef MAX
+#undef numberof
+#define ABS(x) ((x) >= 0 ? (x) : -(x))
+#define MIN(l,o) ((l) < (o) ? (l) : (o))
+#define MAX(h,i) ((h) > (i) ? (h) : (i))
+#define numberof(x) (sizeof (x) / sizeof ((x)[0]))
+
+/* Random */
+#undef __gmp_rands_initialized
+#undef __gmp_rands
+#define __gmp_rands_initialized mpfr_rands_initialized
+#define __gmp_rands mpfr_rands
+
+__MPFR_DECLSPEC extern char mpfr_rands_initialized;
+__MPFR_DECLSPEC extern gmp_randstate_t mpfr_rands;
+
+#undef RANDS
+#define RANDS \
+ ((__gmp_rands_initialized ? 0 \
+ : (__gmp_rands_initialized = 1, \
+ gmp_randinit_default (__gmp_rands), 0)), \
+ __gmp_rands)
+
+#undef RANDS_CLEAR
+#define RANDS_CLEAR() \
+ do { \
+ if (__gmp_rands_initialized) \
+ { \
+ __gmp_rands_initialized = 0; \
+ gmp_randclear (__gmp_rands); \
+ } \
+ } while (0)
+
+typedef __gmp_randstate_struct *gmp_randstate_ptr;
+
+/* Allocate func are defined in gmp-impl.h */
+
+/* In newer GMP, there aren't anymore __gmp_allocate_func,
+ __gmp_reallocate_func & __gmp_free_func in gmp.h
+ Just getting the correct value by calling mp_get_memory_functions */
+#ifdef mp_get_memory_functions
+
+#undef __gmp_allocate_func
+#undef __gmp_reallocate_func
+#undef __gmp_free_func
+#define MPFR_GET_MEMFUNC mp_get_memory_functions(&mpfr_allocate_func, &mpfr_reallocate_func, &mpfr_free_func)
+#define __gmp_allocate_func (MPFR_GET_MEMFUNC, mpfr_allocate_func)
+#define __gmp_reallocate_func (MPFR_GET_MEMFUNC, mpfr_reallocate_func)
+#define __gmp_free_func (MPFR_GET_MEMFUNC, mpfr_free_func)
+__MPFR_DECLSPEC extern void * (*mpfr_allocate_func) _MPFR_PROTO ((size_t));
+__MPFR_DECLSPEC extern void * (*mpfr_reallocate_func) _MPFR_PROTO ((void *,
+ size_t, size_t));
+__MPFR_DECLSPEC extern void (*mpfr_free_func) _MPFR_PROTO ((void *,
+ size_t));
+
+#endif
+
+#undef __gmp_default_allocate
+#undef __gmp_default_reallocate
+#undef __gmp_default_free
+#define __gmp_default_allocate mpfr_default_allocate
+#define __gmp_default_reallocate mpfr_default_reallocate
+#define __gmp_default_free mpfr_default_free
+__MPFR_DECLSPEC void *__gmp_default_allocate _MPFR_PROTO ((size_t));
+__MPFR_DECLSPEC void *__gmp_default_reallocate _MPFR_PROTO ((void *, size_t,
+ size_t));
+__MPFR_DECLSPEC void __gmp_default_free _MPFR_PROTO ((void *, size_t));
+
+#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_ROOTREM)
+#ifndef __gmpn_rootrem
+ __MPFR_DECLSPEC mp_size_t __gmpn_rootrem _MPFR_PROTO ((mp_limb_t*,
+ mp_limb_t*, mp_limb_t*, mp_size_t, mp_limb_t));
+#endif
+#endif
+
+#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_SBPI1_DIVAPPR_Q)
+#ifndef __gmpn_sbpi1_divappr_q
+ __MPFR_DECLSPEC mp_limb_t __gmpn_sbpi1_divappr_q _MPFR_PROTO ((mp_limb_t*,
+ mp_limb_t*, mp_size_t, mp_limb_t*, mp_size_t, mp_limb_t));
+#endif
+#endif
+
+/* Temp memory allocate */
+
+struct tmp_marker
+{
+ void *ptr;
+ size_t size;
+ struct tmp_marker *next;
+};
+
+__MPFR_DECLSPEC void *mpfr_tmp_allocate _MPFR_PROTO ((struct tmp_marker **,
+ size_t));
+__MPFR_DECLSPEC void mpfr_tmp_free _MPFR_PROTO ((struct tmp_marker *));
+
+/* Do not define TMP_SALLOC (see the test in mpfr-impl.h)! */
+#define TMP_ALLOC(n) (MPFR_LIKELY ((n) < 16384) ? \
+ alloca (n) : mpfr_tmp_allocate (&tmp_marker, (n)))
+#define TMP_DECL(m) struct tmp_marker *tmp_marker
+#define TMP_MARK(m) (tmp_marker = 0)
+#define TMP_FREE(m) mpfr_tmp_free (tmp_marker)
+
+/* invert_limb macro, copied from GMP 5.0.2, file gmp-impl.h.
+ It returns invxl = floor((B^2-1)/xl)-B, where B=2^BITS_PER_LIMB,
+ assuming the most significant bit of xl is set. */
+#undef invert_limb
+#define invert_limb(invxl,xl) \
+ do { \
+ mp_limb_t dummy; \
+ MPFR_ASSERTD ((xl) != 0); \
+ udiv_qrnnd (invxl, dummy, ~(xl), ~(mp_limb_t)0, xl); \
+ } while (0)
+
+typedef struct {mp_limb_t inv32;} mpfr_pi1_t; /* We changed gmp_pi1_t into
+ mpfr_pi1_t to avoid using
+ GMP's namespace. */
+/* invert_pi1 macro, adapted from GMP 5.0.2, file gmp-impl.h.
+ It returns dinv = floor((B^3-1)/(d1*B+d0))-B, where B=2^BITS_PER_LIMB,
+ assuming the most significant bit of d1 is set. */
+#undef invert_pi1
+#define invert_pi1(dinv, d1, d0) \
+ do { \
+ mp_limb_t _v, _p, _t1, _t0, _mask; \
+ invert_limb (_v, d1); \
+ _p = d1 * _v; \
+ _p += d0; \
+ if (_p < d0) \
+ { \
+ _v--; \
+ _mask = -(_p >= d1); \
+ _p -= d1; \
+ _v += _mask; \
+ _p -= _mask & d1; \
+ } \
+ umul_ppmm (_t1, _t0, d0, _v); \
+ _p += _t1; \
+ if (_p < _t1) \
+ { \
+ _v--; \
+ if (MPFR_UNLIKELY (_p >= d1)) \
+ { \
+ if (_p > d1 || _t0 >= d0) \
+ _v--; \
+ } \
+ } \
+ (dinv).inv32 = _v; \
+ } while (0)
+
+/* udiv_qr_3by2 macro, adapted from GMP 5.0.2, file gmp-impl.h.
+ Compute quotient the quotient and remainder for n / d. Requires d
+ >= B^2 / 2 and n < d B. dinv is the inverse
+
+ floor ((B^3 - 1) / (d0 + d1 B)) - B.
+
+ NOTE: Output variables are updated multiple times. Only some inputs
+ and outputs may overlap.
+*/
+#undef udiv_qr_3by2
+#define udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \
+ do { \
+ mp_limb_t _q0, _t1, _t0, _mask; \
+ umul_ppmm ((q), _q0, (n2), (dinv)); \
+ add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \
+ \
+ /* Compute the two most significant limbs of n - q'd */ \
+ (r1) = (n1) - (d1) * (q); \
+ (r0) = (n0); \
+ sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \
+ umul_ppmm (_t1, _t0, (d0), (q)); \
+ sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0); \
+ (q)++; \
+ \
+ /* Conditionally adjust q and the remainders */ \
+ _mask = - (mp_limb_t) ((r1) >= _q0); \
+ (q) += _mask; \
+ add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
+ if (MPFR_UNLIKELY ((r1) >= (d1))) \
+ { \
+ if ((r1) > (d1) || (r0) >= (d0)) \
+ { \
+ (q)++; \
+ sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \
+ } \
+ } \
+ } while (0)
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif /* Gmp internal emulator */
diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h
new file mode 100644
index 0000000..fa693d3
--- /dev/null
+++ b/src/mpfr-impl.h
@@ -0,0 +1,1924 @@
+/* Utilities for MPFR developers, not exported.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_IMPL_H__
+#define __MPFR_IMPL_H__
+
+/* Let's include some standard headers unconditionally as they are
+ already needed by several source files or when some options are
+ enabled/disabled, and it is easy to forget them (some configure
+ options may hide the error).
+ Note: If some source file must not have such a header included
+ (which is very unlikely and probably means something broken in
+ this source file), we should do that with some macro (that would
+ also force to disable incompatible features). */
+#if defined (__cplusplus)
+#include <cstdio>
+#include <cstring>
+#else
+#include <stdio.h>
+#include <string.h>
+#endif
+#include <limits.h>
+
+#if _MPFR_EXP_FORMAT == 4
+/* mpfr_exp_t will be defined as intmax_t */
+# include "mpfr-intmax.h"
+#endif
+
+/* Check if we are inside a build of MPFR or inside the test suite.
+ This is needed in mpfr.h to export or import the functions.
+ It matters only for Windows DLL */
+#ifndef __MPFR_TEST_H__
+# define __MPFR_WITHIN_MPFR 1
+#endif
+
+/******************************************************
+ ****************** Include files *********************
+ ******************************************************/
+
+/* Include 'config.h' before using ANY configure macros if needed
+ NOTE: It isn't MPFR 'config.h', but GMP's one! */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef MPFR_HAVE_GMP_IMPL /* Build with gmp internals*/
+
+# ifndef __GMP_H__
+# include "gmp.h"
+# endif
+# ifndef __GMP_IMPL_H__
+# include "gmp-impl.h"
+# endif
+# ifdef MPFR_NEED_LONGLONG_H
+# include "longlong.h"
+# endif
+# ifndef __MPFR_H
+# include "mpfr.h"
+# endif
+
+#else /* Build without gmp internals */
+
+# ifndef __GMP_H__
+# include "gmp.h"
+# endif
+# ifndef __MPFR_H
+# include "mpfr.h"
+# endif
+# ifndef __GMPFR_GMP_H__
+# include "mpfr-gmp.h"
+# endif
+# ifdef MPFR_NEED_LONGLONG_H
+# define LONGLONG_STANDALONE
+# include "mpfr-longlong.h"
+# endif
+
+#endif
+#undef MPFR_NEED_LONGLONG_H
+
+/* If a mpn_sqr_n macro is not defined, use mpn_mul. GMP 4.x defines a
+ mpn_sqr_n macro in gmp-impl.h (and this macro disappeared in GMP 5),
+ so that GMP's macro can only be used when MPFR has been configured
+ with --with-gmp-build (and only with GMP 4.x). */
+#ifndef mpn_sqr_n
+# define mpn_sqr_n(dst,src,n) mpn_mul((dst),(src),(n),(src),(n))
+#endif
+
+/* For the definition of MPFR_THREAD_ATTR. GCC/ICC detection macros are
+ no longer used, as they sometimes gave incorrect information about
+ the support of thread-local variables. A configure check is now done.
+ If the use of detection macros is needed in the future, this could be
+ moved below (after the detection macros are defined). */
+#include "mpfr-thread.h"
+
+
+/******************************************************
+ ***************** Detection macros *******************
+ ******************************************************/
+
+/* Macros to detect STDC, GCC, GLIBC, GMP and ICC version */
+#if defined(__STDC_VERSION__)
+# define __MPFR_STDC(version) (__STDC_VERSION__>=(version))
+#elif defined(__STDC__)
+# define __MPFR_STDC(version) (0 == (version))
+#else
+# define __MPFR_STDC(version) 0
+#endif
+
+#if defined(_WIN32)
+/* Under MS Windows (e.g. with VS2008 or VS2010), Intel's compiler doesn't
+ support/enable extensions like the ones seen under GNU/Linux.
+ https://sympa.inria.fr/sympa/arc/mpfr/2011-02/msg00032.html */
+# define __MPFR_ICC(a,b,c) 0
+#elif defined(__ICC)
+# define __MPFR_ICC(a,b,c) (__ICC >= (a)*100+(b)*10+(c))
+#elif defined(__INTEL_COMPILER)
+# define __MPFR_ICC(a,b,c) (__INTEL_COMPILER >= (a)*100+(b)*10+(c))
+#else
+# define __MPFR_ICC(a,b,c) 0
+#endif
+
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) && ! __MPFR_ICC(0,0,0)
+# define __MPFR_GNUC(a,i) \
+ (MPFR_VERSION_NUM(__GNUC__,__GNUC_MINOR__,0) >= MPFR_VERSION_NUM(a,i,0))
+#else
+# define __MPFR_GNUC(a,i) 0
+#endif
+
+#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
+# define __MPFR_GLIBC(a,i) \
+ (MPFR_VERSION_NUM(__GLIBC__,__GLIBC_MINOR__,0) >= MPFR_VERSION_NUM(a,i,0))
+#else
+# define __MPFR_GLIBC(a,i) 0
+#endif
+
+#if defined(__GNU_MP_VERSION) && \
+ defined(__GNU_MP_VERSION_MINOR) && \
+ defined(__GNU_MP_VERSION_PATCHLEVEL)
+# define __MPFR_GMP(a,b,c) \
+ (MPFR_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL) >= MPFR_VERSION_NUM(a,b,c))
+#else
+# define __MPFR_GMP(a,b,c) 0
+#endif
+
+
+
+/******************************************************
+ ************* GMP Basic Pointer Types ****************
+ ******************************************************/
+
+typedef mp_limb_t *mpfr_limb_ptr;
+typedef __gmp_const mp_limb_t *mpfr_limb_srcptr;
+
+
+
+/******************************************************
+ ****************** (U)INTMAX_MAX *********************
+ ******************************************************/
+
+/* Let's try to fix UINTMAX_MAX and INTMAX_MAX if these macros don't work
+ (e.g. with gcc -ansi -pedantic-errors in 32-bit mode under GNU/Linux),
+ see <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=582698>. */
+#ifdef _MPFR_H_HAVE_INTMAX_T
+# ifdef MPFR_HAVE_INTMAX_MAX
+# define MPFR_UINTMAX_MAX UINTMAX_MAX
+# define MPFR_INTMAX_MAX INTMAX_MAX
+# define MPFR_INTMAX_MIN INTMAX_MIN
+# else
+# define MPFR_UINTMAX_MAX ((uintmax_t) -1)
+# define MPFR_INTMAX_MAX ((intmax_t) (MPFR_UINTMAX_MAX >> 1))
+# define MPFR_INTMAX_MIN (INT_MIN + INT_MAX - MPFR_INTMAX_MAX)
+# endif
+#endif
+
+
+
+/******************************************************
+ ******************** Check GMP ***********************
+ ******************************************************/
+
+#if !__MPFR_GMP(4,1,0)
+# error "GMP 4.1.0 or newer needed"
+#endif
+
+#if GMP_NAIL_BITS != 0
+# error "MPFR doesn't support nonzero values of GMP_NAIL_BITS"
+#endif
+
+#if (GMP_NUMB_BITS<32) || (GMP_NUMB_BITS & (GMP_NUMB_BITS - 1))
+# error "GMP_NUMB_BITS must be a power of 2, and >= 32"
+#endif
+
+#if GMP_NUMB_BITS == 16
+# define MPFR_LOG2_GMP_NUMB_BITS 4
+#elif GMP_NUMB_BITS == 32
+# define MPFR_LOG2_GMP_NUMB_BITS 5
+#elif GMP_NUMB_BITS == 64
+# define MPFR_LOG2_GMP_NUMB_BITS 6
+#elif GMP_NUMB_BITS == 128
+# define MPFR_LOG2_GMP_NUMB_BITS 7
+#elif GMP_NUMB_BITS == 256
+# define MPFR_LOG2_GMP_NUMB_BITS 8
+#else
+# error "Can't compute log2(GMP_NUMB_BITS)"
+#endif
+
+#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0)
+/* For the future: N1478: Supporting the 'noreturn' property in C1x
+ http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1478.htm */
+# define MPFR_NORETURN_ATTR __attribute__ ((noreturn))
+# define MPFR_CONST_ATTR __attribute__ ((const))
+#else
+# define MPFR_NORETURN_ATTR
+# define MPFR_CONST_ATTR
+#endif
+
+/******************************************************
+ ************* Global Internal Variables **************
+ ******************************************************/
+
+/* Cache struct */
+struct __gmpfr_cache_s {
+ mpfr_t x;
+ int inexact;
+ int (*func)(mpfr_ptr, mpfr_rnd_t);
+};
+typedef struct __gmpfr_cache_s mpfr_cache_t[1];
+typedef struct __gmpfr_cache_s *mpfr_cache_ptr;
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR unsigned int __gmpfr_flags;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emin;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_exp_t __gmpfr_emax;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_prec_t __gmpfr_default_fp_bit_precision;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_rnd_t __gmpfr_default_rounding_mode;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_euler;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_catalan;
+
+#ifndef MPFR_USE_LOGGING
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_pi;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_cache_const_log2;
+#else
+/* Two constants are used by the logging functions (via mpfr_fprintf,
+ then mpfr_log, for the base conversion): pi and log(2). Since the
+ mpfr_cache function isn't re-entrant when working on the same cache,
+ we need to define two caches for each constant. */
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_pi;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_normal_log2;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_pi;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_t __gmpfr_logging_log2;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_pi;
+__MPFR_DECLSPEC extern MPFR_THREAD_ATTR mpfr_cache_ptr __gmpfr_cache_const_log2;
+#endif
+
+#define BASE_MAX 62
+__MPFR_DECLSPEC extern const __mpfr_struct __gmpfr_l2b[BASE_MAX-1][2];
+
+/* Note: do not use the following values when they can be outside the
+ current exponent range, e.g. when the exponent range has not been
+ extended yet; under such a condition, they can be used only in
+ mpfr_cmpabs. */
+__MPFR_DECLSPEC extern const mpfr_t __gmpfr_one;
+__MPFR_DECLSPEC extern const mpfr_t __gmpfr_two;
+__MPFR_DECLSPEC extern const mpfr_t __gmpfr_four;
+
+
+#if defined (__cplusplus)
+ }
+#endif
+
+/* Flags of __gmpfr_flags */
+#define MPFR_FLAGS_UNDERFLOW 1
+#define MPFR_FLAGS_OVERFLOW 2
+#define MPFR_FLAGS_NAN 4
+#define MPFR_FLAGS_INEXACT 8
+#define MPFR_FLAGS_ERANGE 16
+#define MPFR_FLAGS_DIVBY0 32
+#define MPFR_FLAGS_ALL 63
+
+/* Replace some common functions for direct access to the global vars */
+#define mpfr_get_emin() (__gmpfr_emin + 0)
+#define mpfr_get_emax() (__gmpfr_emax + 0)
+#define mpfr_get_default_rounding_mode() (__gmpfr_default_rounding_mode + 0)
+#define mpfr_get_default_prec() (__gmpfr_default_fp_bit_precision + 0)
+
+#define mpfr_clear_flags() \
+ ((void) (__gmpfr_flags = 0))
+#define mpfr_clear_underflow() \
+ ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_UNDERFLOW))
+#define mpfr_clear_overflow() \
+ ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_OVERFLOW))
+#define mpfr_clear_nanflag() \
+ ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_NAN))
+#define mpfr_clear_inexflag() \
+ ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_INEXACT))
+#define mpfr_clear_erangeflag() \
+ ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE))
+#define mpfr_clear_divby0() \
+ ((void) (__gmpfr_flags &= MPFR_FLAGS_ALL ^ MPFR_FLAGS_DIVBY0))
+#define mpfr_underflow_p() \
+ ((int) (__gmpfr_flags & MPFR_FLAGS_UNDERFLOW))
+#define mpfr_overflow_p() \
+ ((int) (__gmpfr_flags & MPFR_FLAGS_OVERFLOW))
+#define mpfr_nanflag_p() \
+ ((int) (__gmpfr_flags & MPFR_FLAGS_NAN))
+#define mpfr_inexflag_p() \
+ ((int) (__gmpfr_flags & MPFR_FLAGS_INEXACT))
+#define mpfr_erangeflag_p() \
+ ((int) (__gmpfr_flags & MPFR_FLAGS_ERANGE))
+#define mpfr_divby0_p() \
+ ((int) (__gmpfr_flags & MPFR_FLAGS_DIVBY0))
+
+/* Testing an exception flag correctly is tricky. There are mainly two
+ pitfalls: First, one needs to remember to clear the corresponding
+ flag, in case it was set before the function call or during some
+ intermediate computations (in practice, one can clear all the flags).
+ Secondly, one needs to test the flag early enough, i.e. before it
+ can be modified by another function. Moreover, it is quite difficult
+ (if not impossible) to reliably check problems with "make check". To
+ avoid these pitfalls, it is recommended to use the following macros.
+ Other use of the exception-flag predicate functions/macros will be
+ detected by mpfrlint.
+ Note: _op can be either a statement or an expression.
+ MPFR_BLOCK_EXCEP should be used only inside a block; it is useful to
+ detect some exception in order to exit the block as soon as possible. */
+#define MPFR_BLOCK_DECL(_flags) unsigned int _flags
+/* The (void) (_flags) makes sure that _flags is read at least once (it
+ makes sense to use MPFR_BLOCK while _flags will never be read in the
+ source, so that we wish to avoid the corresponding warning). */
+#define MPFR_BLOCK(_flags,_op) \
+ do \
+ { \
+ mpfr_clear_flags (); \
+ _op; \
+ (_flags) = __gmpfr_flags; \
+ (void) (_flags); \
+ } \
+ while (0)
+#define MPFR_BLOCK_TEST(_flags,_f) MPFR_UNLIKELY ((_flags) & (_f))
+#define MPFR_BLOCK_EXCEP (__gmpfr_flags & (MPFR_FLAGS_UNDERFLOW | \
+ MPFR_FLAGS_OVERFLOW | \
+ MPFR_FLAGS_DIVBY0 | \
+ MPFR_FLAGS_NAN))
+/* Let's use a MPFR_ prefix, because e.g. OVERFLOW is defined by glibc's
+ math.h, though this is not a reserved identifier! */
+#define MPFR_UNDERFLOW(_flags) MPFR_BLOCK_TEST (_flags, MPFR_FLAGS_UNDERFLOW)
+#define MPFR_OVERFLOW(_flags) MPFR_BLOCK_TEST (_flags, MPFR_FLAGS_OVERFLOW)
+#define MPFR_NANFLAG(_flags) MPFR_BLOCK_TEST (_flags, MPFR_FLAGS_NAN)
+#define MPFR_INEXFLAG(_flags) MPFR_BLOCK_TEST (_flags, MPFR_FLAGS_INEXACT)
+#define MPFR_ERANGEFLAG(_flags) MPFR_BLOCK_TEST (_flags, MPFR_FLAGS_ERANGE)
+#define MPFR_DIVBY0(_flags) MPFR_BLOCK_TEST (_flags, MPFR_FLAGS_DIVBY0)
+
+
+/******************************************************
+ ******************** Assertions **********************
+ ******************************************************/
+
+/* Compile with -DWANT_ASSERT to check all assert statements */
+
+/* Note: do not use GMP macros ASSERT_ALWAYS and ASSERT as they are not
+ expressions, and as a consequence, they cannot be used in a for(),
+ with a comma operator and so on. */
+
+/* MPFR_ASSERTN(expr): assertions that should always be checked */
+#define MPFR_ASSERTN(expr) \
+ ((void) ((MPFR_UNLIKELY(expr)) || MPFR_UNLIKELY( (ASSERT_FAIL(expr),0) )))
+
+/* MPFR_ASSERTD(expr): assertions that should be checked when testing */
+#ifdef WANT_ASSERT
+# define MPFR_EXP_CHECK 1
+# define MPFR_ASSERTD(expr) MPFR_ASSERTN (expr)
+#else
+# define MPFR_ASSERTD(expr) ((void) 0)
+#endif
+
+/* Code to deal with impossible
+ WARNING: It doesn't use do { } while (0) for Insure++*/
+#define MPFR_RET_NEVER_GO_HERE() {MPFR_ASSERTN(0); return 0;}
+
+
+/******************************************************
+ ******************** Warnings ************************
+ ******************************************************/
+
+/* MPFR_WARNING is no longer useful, but let's keep the macro in case
+ it needs to be used again in the future. */
+
+#ifdef MPFR_USE_WARNINGS
+# include <stdlib.h>
+# define MPFR_WARNING(W) \
+ do \
+ { \
+ char *q = getenv ("MPFR_QUIET"); \
+ if (q == NULL || *q == 0) \
+ fprintf (stderr, "MPFR: %s\n", W); \
+ } \
+ while (0)
+#else
+# define MPFR_WARNING(W) ((void) 0)
+#endif
+
+
+/******************************************************
+ ****************** double macros *********************
+ ******************************************************/
+
+/* Precision used for lower precision computations */
+#define MPFR_SMALL_PRECISION 32
+
+/* Definition of constants */
+#define LOG2 0.69314718055994528622 /* log(2) rounded to zero on 53 bits */
+#define ALPHA 4.3191365662914471407 /* a+2 = a*log(a), rounded to +infinity */
+#define EXPM1 0.36787944117144227851 /* exp(-1), rounded to zero */
+
+/* MPFR_DOUBLE_SPEC = 1 if the C type 'double' corresponds to IEEE-754
+ double precision, 0 if it doesn't, and undefined if one doesn't know.
+ On all the tested machines, MPFR_DOUBLE_SPEC = 1. To have this macro
+ defined here, #include <float.h> is needed. If need be, other values
+ could be defined for other specs (once they are known). */
+#if !defined(MPFR_DOUBLE_SPEC) && defined(FLT_RADIX) && \
+ defined(DBL_MANT_DIG) && defined(DBL_MIN_EXP) && defined(DBL_MAX_EXP)
+# if FLT_RADIX == 2 && DBL_MANT_DIG == 53 && \
+ DBL_MIN_EXP == -1021 && DBL_MAX_EXP == 1024
+# define MPFR_DOUBLE_SPEC 1
+# else
+# define MPFR_DOUBLE_SPEC 0
+# endif
+#endif
+
+/* Debug non IEEE floats */
+#ifdef XDEBUG
+# undef _GMP_IEEE_FLOATS
+#endif
+#ifndef _GMP_IEEE_FLOATS
+# define _GMP_IEEE_FLOATS 0
+#endif
+
+#ifndef IEEE_DBL_MANT_DIG
+#define IEEE_DBL_MANT_DIG 53
+#endif
+#define MPFR_LIMBS_PER_DOUBLE ((IEEE_DBL_MANT_DIG-1)/GMP_NUMB_BITS+1)
+
+#ifndef IEEE_FLT_MANT_DIG
+#define IEEE_FLT_MANT_DIG 24
+#endif
+#define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1)
+
+/* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0
+ at compile time. */
+#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)
+static double double_zero = 0.0;
+# define DBL_NAN (double_zero/double_zero)
+# define DBL_POS_INF ((double) 1.0/double_zero)
+# define DBL_NEG_INF ((double)-1.0/double_zero)
+# define DBL_NEG_ZERO (-double_zero)
+#else
+# define DBL_POS_INF ((double) 1.0/0.0)
+# define DBL_NEG_INF ((double)-1.0/0.0)
+# define DBL_NAN ((double) 0.0/0.0)
+# define DBL_NEG_ZERO (-0.0)
+#endif
+
+/* Note: In the past, there was specific code for _GMP_IEEE_FLOATS, which
+ was based on NaN and Inf memory representations. This code was breaking
+ the aliasing rules (see ISO C99, 6.5#6 and 6.5#7 on the effective type)
+ and for this reason it did not behave correctly with GCC 4.5.0 20091119.
+ The code needed a memory transfer and was probably not better than the
+ macros below with a good compiler (a fix based on the NaN / Inf memory
+ representation would be even worse due to C limitations), and this code
+ could be selected only when MPFR was built with --with-gmp-build, thus
+ introducing a difference (bad for maintaining/testing MPFR); therefore
+ it has been removed. The old code required that the argument x be an
+ lvalue of type double. We still require that, in case one would need
+ to change the macros below, e.g. for some broken compiler. But the
+ LVALUE(x) condition could be removed if really necessary. */
+/* Below, the &(x) == &(x) || &(x) != &(x) allows to make sure that x
+ is a lvalue without (probably) any warning from the compiler. The
+ &(x) != &(x) is needed to avoid a failure under Mac OS X 10.4.11
+ (with Xcode 2.4.1, i.e. the latest one). */
+#define LVALUE(x) (&(x) == &(x) || &(x) != &(x))
+#define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX))
+#ifdef MPFR_NANISNAN
+/* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations.
+ The + must not be replaced by a ||. With gcc -ffast-math, NaN is
+ regarded as a positive number or something like that; the second
+ test catches this case. */
+# define DOUBLE_ISNAN(x) \
+ (LVALUE(x) && !((((x) >= 0.0) + ((x) <= 0.0)) && -(x)*(x) <= 0.0))
+#else
+# define DOUBLE_ISNAN(x) (LVALUE(x) && (x) != (x))
+#endif
+
+/******************************************************
+ *************** Long double macros *******************
+ ******************************************************/
+
+/* We try to get the exact value of the precision of long double
+ (provided by the implementation) in order to provide correct
+ rounding in this case (not guaranteed if the C implementation
+ does not have an adequate long double arithmetic). Note that
+ it may be lower than the precision of some numbers that can
+ be represented in a long double; e.g. on FreeBSD/x86, it is
+ 53 because the processor is configured to round in double
+ precision (even when using the long double type -- this is a
+ limitation of the x87 arithmetic), and on Mac OS X, it is 106
+ because the implementation is a double-double arithmetic.
+ Otherwise (e.g. in base 10), we get an upper bound of the
+ precision, and correct rounding isn't currently provided.
+*/
+#if defined(LDBL_MANT_DIG) && FLT_RADIX == 2
+# define MPFR_LDBL_MANT_DIG LDBL_MANT_DIG
+#else
+# define MPFR_LDBL_MANT_DIG \
+ (sizeof(long double)*GMP_NUMB_BITS/sizeof(mp_limb_t))
+#endif
+#define MPFR_LIMBS_PER_LONG_DOUBLE \
+ ((sizeof(long double)-1)/sizeof(mp_limb_t)+1)
+
+/* LONGDOUBLE_NAN_ACTION executes the code "action" if x is a NaN. */
+
+/* On hppa2.0n-hp-hpux10 with the unbundled HP cc, the test x!=x on a NaN
+ has been seen false, meaning NaNs are not detected. This seemed to
+ happen only after other comparisons, not sure what's really going on. In
+ any case we can pick apart the bytes to identify a NaN. */
+#ifdef HAVE_LDOUBLE_IEEE_QUAD_BIG
+# define LONGDOUBLE_NAN_ACTION(x, action) \
+ do { \
+ union { \
+ long double ld; \
+ struct { \
+ unsigned int sign : 1; \
+ unsigned int exp : 15; \
+ unsigned int man3 : 16; \
+ unsigned int man2 : 32; \
+ unsigned int man1 : 32; \
+ unsigned int man0 : 32; \
+ } s; \
+ } u; \
+ u.ld = (x); \
+ if (u.s.exp == 0x7FFFL \
+ && (u.s.man0 | u.s.man1 | u.s.man2 | u.s.man3) != 0) \
+ { action; } \
+ } while (0)
+#endif
+
+#ifdef HAVE_LDOUBLE_IEEE_QUAD_LITTLE
+# define LONGDOUBLE_NAN_ACTION(x, action) \
+ do { \
+ union { \
+ long double ld; \
+ struct { \
+ unsigned int man0 : 32; \
+ unsigned int man1 : 32; \
+ unsigned int man2 : 32; \
+ unsigned int man3 : 16; \
+ unsigned int exp : 15; \
+ unsigned int sign : 1; \
+ } s; \
+ } u; \
+ u.ld = (x); \
+ if (u.s.exp == 0x7FFFL \
+ && (u.s.man0 | u.s.man1 | u.s.man2 | u.s.man3) != 0) \
+ { action; } \
+ } while (0)
+#endif
+
+/* Under IEEE rules, NaN is not equal to anything, including itself.
+ "volatile" here stops "cc" on mips64-sgi-irix6.5 from optimizing away
+ x!=x. */
+#ifndef LONGDOUBLE_NAN_ACTION
+# define LONGDOUBLE_NAN_ACTION(x, action) \
+ do { \
+ volatile long double __x = LONGDOUBLE_VOLATILE (x); \
+ if ((x) != __x) \
+ { action; } \
+ } while (0)
+# define WANT_LONGDOUBLE_VOLATILE 1
+#endif
+
+/* If we don't have a proper "volatile" then volatile is #defined to empty,
+ in this case call through an external function to stop the compiler
+ optimizing anything. */
+#ifdef WANT_LONGDOUBLE_VOLATILE
+# ifdef volatile
+__MPFR_DECLSPEC long double __gmpfr_longdouble_volatile _MPFR_PROTO ((long double)) MPFR_CONST_ATTR;
+# define LONGDOUBLE_VOLATILE(x) (__gmpfr_longdouble_volatile (x))
+# define WANT_GMPFR_LONGDOUBLE_VOLATILE 1
+# else
+# define LONGDOUBLE_VOLATILE(x) (x)
+# endif
+#endif
+
+/* Some special case for IEEE_EXT Litle Endian */
+#if HAVE_LDOUBLE_IEEE_EXT_LITTLE
+
+typedef union {
+ long double ld;
+ struct {
+ unsigned int manl : 32;
+ unsigned int manh : 32;
+ unsigned int expl : 8 ;
+ unsigned int exph : 7;
+ unsigned int sign : 1;
+ } s;
+} mpfr_long_double_t;
+
+/* #undef MPFR_LDBL_MANT_DIG */
+#undef MPFR_LIMBS_PER_LONG_DOUBLE
+/* #define MPFR_LDBL_MANT_DIG 64 */
+#define MPFR_LIMBS_PER_LONG_DOUBLE ((64-1)/GMP_NUMB_BITS+1)
+
+#endif
+
+/******************************************************
+ *************** _Decimal64 support *******************
+ ******************************************************/
+
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+/* to cast between binary64 and decimal64 */
+union ieee_double_decimal64 { double d; _Decimal64 d64; };
+#endif
+
+/******************************************************
+ **************** mpfr_t properties *******************
+ ******************************************************/
+
+/* In the following macro, p is usually a mpfr_prec_t, but this macro
+ works with other integer types (without integer overflow). Checking
+ that p >= 1 in debug mode is useful here because this macro can be
+ used on a computed precision (in particular, this formula does not
+ work for a degenerate case p = 0, and could give different results
+ on different platforms). But let us not use an assertion checking
+ in the MPFR_LAST_LIMB() and MPFR_LIMB_SIZE() macros below to avoid
+ too much expansion for assertions (in practice, this should be a
+ problem just when testing MPFR with the --enable-assert configure
+ option and the -ansi -pedantic-errors gcc compiler flags). */
+#define MPFR_PREC2LIMBS(p) \
+ (MPFR_ASSERTD ((p) >= 1), ((p) - 1) / GMP_NUMB_BITS + 1)
+
+#define MPFR_PREC(x) ((x)->_mpfr_prec)
+#define MPFR_EXP(x) ((x)->_mpfr_exp)
+#define MPFR_MANT(x) ((x)->_mpfr_d)
+#define MPFR_LAST_LIMB(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS)
+#define MPFR_LIMB_SIZE(x) (MPFR_LAST_LIMB (x) + 1)
+
+
+/******************************************************
+ **************** exponent properties *****************
+ ******************************************************/
+
+/* Limits of the mpfr_exp_t type (NOT those of valid exponent values).
+ These macros can be used in preprocessor directives. */
+#if _MPFR_EXP_FORMAT == 1
+# define MPFR_EXP_MAX (SHRT_MAX)
+# define MPFR_EXP_MIN (SHRT_MIN)
+#elif _MPFR_EXP_FORMAT == 2
+# define MPFR_EXP_MAX (INT_MAX)
+# define MPFR_EXP_MIN (INT_MIN)
+#elif _MPFR_EXP_FORMAT == 3
+# define MPFR_EXP_MAX (LONG_MAX)
+# define MPFR_EXP_MIN (LONG_MIN)
+#elif _MPFR_EXP_FORMAT == 4
+# define MPFR_EXP_MAX (MPFR_INTMAX_MAX)
+# define MPFR_EXP_MIN (MPFR_INTMAX_MIN)
+#else
+# error "Invalid MPFR Exp format"
+#endif
+
+/* Before doing a cast to mpfr_uexp_t, make sure that the value is
+ nonnegative. */
+#define MPFR_UEXP(X) (MPFR_ASSERTD ((X) >= 0), (mpfr_uexp_t) (X))
+
+#if MPFR_EXP_MIN >= LONG_MIN && MPFR_EXP_MAX <= LONG_MAX
+typedef long int mpfr_eexp_t;
+# define mpfr_get_exp_t(x,r) mpfr_get_si((x),(r))
+# define mpfr_set_exp_t(x,e,r) mpfr_set_si((x),(e),(r))
+# define MPFR_EXP_FSPEC "l"
+#elif defined (_MPFR_H_HAVE_INTMAX_T)
+typedef intmax_t mpfr_eexp_t;
+# define mpfr_get_exp_t(x,r) mpfr_get_sj((x),(r))
+# define mpfr_set_exp_t(x,e,r) mpfr_set_sj((x),(e),(r))
+# define MPFR_EXP_FSPEC "j"
+#else
+# error "Cannot define mpfr_get_exp_t and mpfr_set_exp_t"
+#endif
+
+/* Invalid exponent value (to track bugs...) */
+#define MPFR_EXP_INVALID \
+ ((mpfr_exp_t) 1 << (GMP_NUMB_BITS*sizeof(mpfr_exp_t)/sizeof(mp_limb_t)-2))
+
+/* Definition of the exponent limits for MPFR numbers.
+ * These limits are chosen so that if e is such an exponent, then 2e-1 and
+ * 2e+1 are representable. This is useful for intermediate computations,
+ * in particular the multiplication.
+ */
+#undef MPFR_EMIN_MIN
+#undef MPFR_EMIN_MAX
+#undef MPFR_EMAX_MIN
+#undef MPFR_EMAX_MAX
+#define MPFR_EMIN_MIN (1-MPFR_EXP_INVALID)
+#define MPFR_EMIN_MAX (MPFR_EXP_INVALID-1)
+#define MPFR_EMAX_MIN (1-MPFR_EXP_INVALID)
+#define MPFR_EMAX_MAX (MPFR_EXP_INVALID-1)
+
+/* Use MPFR_GET_EXP and MPFR_SET_EXP instead of MPFR_EXP directly,
+ unless when the exponent may be out-of-range, for instance when
+ setting the exponent before calling mpfr_check_range.
+ MPFR_EXP_CHECK is defined when WANT_ASSERT is defined, but if you
+ don't use WANT_ASSERT (for speed reasons), you can still define
+ MPFR_EXP_CHECK by setting -DMPFR_EXP_CHECK in $CFLAGS. */
+
+#ifdef MPFR_EXP_CHECK
+# define MPFR_GET_EXP(x) (mpfr_get_exp) (x)
+# define MPFR_SET_EXP(x, exp) MPFR_ASSERTN (!mpfr_set_exp ((x), (exp)))
+# define MPFR_SET_INVALID_EXP(x) ((void) (MPFR_EXP (x) = MPFR_EXP_INVALID))
+#else
+# define MPFR_GET_EXP(x) MPFR_EXP (x)
+# define MPFR_SET_EXP(x, exp) ((void) (MPFR_EXP (x) = (exp)))
+# define MPFR_SET_INVALID_EXP(x) ((void) 0)
+#endif
+
+
+
+/******************************************************
+ ********** Singular Values (NAN, INF, ZERO) **********
+ ******************************************************/
+
+/* Enum special value of exponent. */
+# define MPFR_EXP_ZERO (MPFR_EXP_MIN+1)
+# define MPFR_EXP_NAN (MPFR_EXP_MIN+2)
+# define MPFR_EXP_INF (MPFR_EXP_MIN+3)
+
+#define MPFR_IS_NAN(x) (MPFR_EXP(x) == MPFR_EXP_NAN)
+#define MPFR_SET_NAN(x) (MPFR_EXP(x) = MPFR_EXP_NAN)
+#define MPFR_IS_INF(x) (MPFR_EXP(x) == MPFR_EXP_INF)
+#define MPFR_SET_INF(x) (MPFR_EXP(x) = MPFR_EXP_INF)
+#define MPFR_IS_ZERO(x) (MPFR_EXP(x) == MPFR_EXP_ZERO)
+#define MPFR_SET_ZERO(x) (MPFR_EXP(x) = MPFR_EXP_ZERO)
+#define MPFR_NOTZERO(x) (MPFR_EXP(x) != MPFR_EXP_ZERO)
+
+#define MPFR_IS_FP(x) (!MPFR_IS_NAN(x) && !MPFR_IS_INF(x))
+#define MPFR_IS_SINGULAR(x) (MPFR_EXP(x) <= MPFR_EXP_INF)
+#define MPFR_IS_PURE_FP(x) (!MPFR_IS_SINGULAR(x) && \
+ (MPFR_ASSERTD ((MPFR_MANT(x)[MPFR_LAST_LIMB(x)] \
+ & MPFR_LIMB_HIGHBIT) != 0), 1))
+
+#define MPFR_ARE_SINGULAR(x,y) \
+ (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)) || MPFR_UNLIKELY(MPFR_IS_SINGULAR(y)))
+
+#define MPFR_IS_POWER_OF_2(x) \
+ (mpfr_cmp_ui_2exp ((x), 1, MPFR_GET_EXP (x) - 1) == 0)
+
+
+/******************************************************
+ ********************* Sign Macros ********************
+ ******************************************************/
+
+#define MPFR_SIGN_POS (1)
+#define MPFR_SIGN_NEG (-1)
+
+#define MPFR_IS_STRICTPOS(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x) > 0)
+#define MPFR_IS_STRICTNEG(x) (MPFR_NOTZERO((x)) && MPFR_SIGN(x) < 0)
+
+#define MPFR_IS_NEG(x) (MPFR_SIGN(x) < 0)
+#define MPFR_IS_POS(x) (MPFR_SIGN(x) > 0)
+
+#define MPFR_SET_POS(x) (MPFR_SIGN(x) = MPFR_SIGN_POS)
+#define MPFR_SET_NEG(x) (MPFR_SIGN(x) = MPFR_SIGN_NEG)
+
+#define MPFR_CHANGE_SIGN(x) (MPFR_SIGN(x) = -MPFR_SIGN(x))
+#define MPFR_SET_SAME_SIGN(x, y) (MPFR_SIGN(x) = MPFR_SIGN(y))
+#define MPFR_SET_OPPOSITE_SIGN(x, y) (MPFR_SIGN(x) = -MPFR_SIGN(y))
+#define MPFR_ASSERT_SIGN(s) \
+ (MPFR_ASSERTD((s) == MPFR_SIGN_POS || (s) == MPFR_SIGN_NEG))
+#define MPFR_SET_SIGN(x, s) \
+ (MPFR_ASSERT_SIGN(s), MPFR_SIGN(x) = s)
+#define MPFR_IS_POS_SIGN(s1) (s1 > 0)
+#define MPFR_IS_NEG_SIGN(s1) (s1 < 0)
+#define MPFR_MULT_SIGN(s1, s2) ((s1) * (s2))
+/* Transform a sign to 1 or -1 */
+#define MPFR_FROM_SIGN_TO_INT(s) (s)
+#define MPFR_INT_SIGN(x) MPFR_FROM_SIGN_TO_INT(MPFR_SIGN(x))
+
+
+
+/******************************************************
+ ***************** Ternary Value Macros ***************
+ ******************************************************/
+
+/* Special inexact value */
+#define MPFR_EVEN_INEX 2
+
+/* Macros for functions returning two inexact values in an 'int' */
+#define INEXPOS(y) ((y) == 0 ? 0 : (((y) > 0) ? 1 : 2))
+#define INEX(y,z) (INEXPOS(y) | (INEXPOS(z) << 2))
+
+/* When returning the ternary inexact value, ALWAYS use one of the
+ following two macros, unless the flag comes from another function
+ returning the ternary inexact value */
+#define MPFR_RET(I) return \
+ (I) ? ((__gmpfr_flags |= MPFR_FLAGS_INEXACT), (I)) : 0
+#define MPFR_RET_NAN return (__gmpfr_flags |= MPFR_FLAGS_NAN), 0
+
+#define MPFR_SET_ERANGE() (__gmpfr_flags |= MPFR_FLAGS_ERANGE)
+
+#define SIGN(I) ((I) < 0 ? -1 : (I) > 0)
+#define SAME_SIGN(I1,I2) (SIGN (I1) == SIGN (I2))
+
+
+
+/******************************************************
+ ************** Rounding mode macros *****************
+ ******************************************************/
+
+/* MPFR_RND_MAX gives the number of supported rounding modes by all functions.
+ * Once faithful rounding is implemented, MPFR_RNDA should be changed
+ * to MPFR_RNDF. But this will also require more changes in the tests.
+ */
+#define MPFR_RND_MAX ((mpfr_rnd_t)((MPFR_RNDA)+1))
+
+/* We want to test this :
+ * (rnd == MPFR_RNDU && test) || (rnd == RNDD && !test)
+ * ie it transforms RNDU or RNDD to Away or Zero according to the sign */
+#define MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test) \
+ (((rnd) + (test)) == MPFR_RNDD)
+
+/* We want to test if rnd = Zero, or Away.
+ 'test' is 1 if negative, and 0 if positive. */
+#define MPFR_IS_LIKE_RNDZ(rnd, test) \
+ ((rnd==MPFR_RNDZ) || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, test))
+
+#define MPFR_IS_LIKE_RNDU(rnd, sign) \
+ ((rnd==MPFR_RNDU) || (rnd==MPFR_RNDZ && sign<0) || (rnd==MPFR_RNDA && sign>0))
+
+#define MPFR_IS_LIKE_RNDD(rnd, sign) \
+ ((rnd==MPFR_RNDD) || (rnd==MPFR_RNDZ && sign>0) || (rnd==MPFR_RNDA && sign<0))
+
+/* Invert a rounding mode, RNDZ and RNDA are unchanged */
+#define MPFR_INVERT_RND(rnd) ((rnd == MPFR_RNDU) ? MPFR_RNDD : \
+ ((rnd == MPFR_RNDD) ? MPFR_RNDU : rnd))
+
+/* Transform RNDU and RNDD to RNDZ according to test */
+#define MPFR_UPDATE_RND_MODE(rnd, test) \
+ do { \
+ if (MPFR_UNLIKELY(MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test))) \
+ rnd = MPFR_RNDZ; \
+ } while (0)
+
+/* Transform RNDU and RNDD to RNDZ or RNDA according to sign,
+ leave the other modes unchanged */
+#define MPFR_UPDATE2_RND_MODE(rnd, sign) \
+ do { \
+ if (rnd == MPFR_RNDU) \
+ rnd = (sign > 0) ? MPFR_RNDA : MPFR_RNDZ; \
+ else if (rnd == MPFR_RNDD) \
+ rnd = (sign < 0) ? MPFR_RNDA : MPFR_RNDZ; \
+ } while (0)
+
+
+/******************************************************
+ ******************* Limb Macros **********************
+ ******************************************************/
+
+ /* Definition of MPFR_LIMB_HIGHBIT */
+#if defined(GMP_LIMB_HIGHBIT)
+# define MPFR_LIMB_HIGHBIT GMP_LIMB_HIGHBIT
+#elif defined(MP_LIMB_T_HIGHBIT)
+# define MPFR_LIMB_HIGHBIT MP_LIMB_T_HIGHBIT
+#else
+# error "Neither GMP_LIMB_HIGHBIT nor MP_LIMB_T_HIGHBIT defined in GMP"
+#endif
+
+/* Mask to get the Most Significant Bit of a limb */
+#define MPFR_LIMB_MSB(l) ((l)&MPFR_LIMB_HIGHBIT)
+
+/* Definition of MPFR_LIMB_ONE & MPFR_LIMB_ZERO */
+#ifdef CNST_LIMB
+# define MPFR_LIMB_ONE CNST_LIMB(1)
+# define MPFR_LIMB_ZERO CNST_LIMB(0)
+#else
+# define MPFR_LIMB_ONE ((mp_limb_t) 1L)
+# define MPFR_LIMB_ZERO ((mp_limb_t) 0L)
+#endif
+
+/* Mask for the low 's' bits of a limb */
+#define MPFR_LIMB_MASK(s) ((MPFR_LIMB_ONE<<(s))-MPFR_LIMB_ONE)
+
+
+
+/******************************************************
+ ********************** Memory ************************
+ ******************************************************/
+
+/* Heap Memory gestion */
+typedef union { mp_size_t s; mp_limb_t l; } mpfr_size_limb_t;
+#define MPFR_GET_ALLOC_SIZE(x) \
+ ( ((mp_size_t*) MPFR_MANT(x))[-1] + 0)
+#define MPFR_SET_ALLOC_SIZE(x, n) \
+ ( ((mp_size_t*) MPFR_MANT(x))[-1] = n)
+#define MPFR_MALLOC_SIZE(s) \
+ ( sizeof(mpfr_size_limb_t) + BYTES_PER_MP_LIMB * ((size_t) s) )
+#define MPFR_SET_MANT_PTR(x,p) \
+ (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1))
+#define MPFR_GET_REAL_PTR(x) \
+ ((mp_limb_t*) ((mpfr_size_limb_t*) MPFR_MANT(x) - 1))
+
+/* Temporary memory gestion */
+#ifndef TMP_SALLOC
+/* GMP 4.1.x or below or internals */
+#define MPFR_TMP_DECL TMP_DECL
+#define MPFR_TMP_MARK TMP_MARK
+#define MPFR_TMP_ALLOC TMP_ALLOC
+#define MPFR_TMP_FREE TMP_FREE
+#else
+#define MPFR_TMP_DECL(x) TMP_DECL
+#define MPFR_TMP_MARK(x) TMP_MARK
+#define MPFR_TMP_ALLOC(s) TMP_ALLOC(s)
+#define MPFR_TMP_FREE(x) TMP_FREE
+#endif
+
+/* This code is experimental: don't use it */
+#ifdef MPFR_USE_OWN_MPFR_TMP_ALLOC
+extern unsigned char *mpfr_stack;
+#undef MPFR_TMP_DECL
+#undef MPFR_TMP_MARK
+#undef MPFR_TMP_ALLOC
+#undef MPFR_TMP_FREE
+#define MPFR_TMP_DECL(_x) unsigned char *(_x)
+#define MPFR_TMP_MARK(_x) ((_x) = mpfr_stack)
+#define MPFR_TMP_ALLOC(_s) (mpfr_stack += (_s), mpfr_stack - (_s))
+#define MPFR_TMP_FREE(_x) (mpfr_stack = (_x))
+#endif
+
+#define MPFR_TMP_LIMBS_ALLOC(N) \
+ ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * BYTES_PER_MP_LIMB))
+
+/* temporary allocate 1 limb at xp, and initialize mpfr variable x */
+/* The temporary var doesn't have any size field, but it doesn't matter
+ * since only functions dealing with the Heap care about it */
+#define MPFR_TMP_INIT1(xp, x, p) \
+ ( MPFR_PREC(x) = (p), \
+ MPFR_MANT(x) = (xp), \
+ MPFR_SET_POS(x), \
+ MPFR_SET_INVALID_EXP(x))
+
+#define MPFR_TMP_INIT(xp, x, p, s) \
+ (xp = MPFR_TMP_LIMBS_ALLOC(s), \
+ MPFR_TMP_INIT1(xp, x, p))
+
+#define MPFR_TMP_INIT_ABS(d, s) \
+ ( MPFR_PREC(d) = MPFR_PREC(s), \
+ MPFR_MANT(d) = MPFR_MANT(s), \
+ MPFR_SET_POS(d), \
+ MPFR_EXP(d) = MPFR_EXP(s))
+
+
+
+/******************************************************
+ ***************** Cache macros **********************
+ ******************************************************/
+
+#define mpfr_const_pi(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_pi,_r)
+#define mpfr_const_log2(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_log2, _r)
+#define mpfr_const_euler(_d,_r) mpfr_cache(_d, __gmpfr_cache_const_euler, _r)
+#define mpfr_const_catalan(_d,_r) mpfr_cache(_d,__gmpfr_cache_const_catalan,_r)
+
+#define MPFR_DECL_INIT_CACHE(_cache,_func) \
+ mpfr_cache_t MPFR_THREAD_ATTR _cache = \
+ {{{{0,MPFR_SIGN_POS,0,(mp_limb_t*)0}},0,_func}}
+
+
+
+/******************************************************
+ ******************* Threshold ***********************
+ ******************************************************/
+
+#include "mparam.h"
+
+/******************************************************
+ ***************** Useful macros *********************
+ ******************************************************/
+
+/* Theses macros help the compiler to determine if a test is
+ likely or unlikely. The !! is necessary in case x is larger
+ than a long. */
+#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0)
+# define MPFR_LIKELY(x) (__builtin_expect(!!(x),1))
+# define MPFR_UNLIKELY(x) (__builtin_expect(!!(x),0))
+#else
+# define MPFR_LIKELY(x) (x)
+# define MPFR_UNLIKELY(x) (x)
+#endif
+
+/* Declare that some variable is initialized before being used (without a
+ dummy initialization) in order to avoid some compiler warnings. Use the
+ VAR = VAR trick (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296)
+ only with gcc as this is undefined behavior, and we don't know what
+ other compilers do (they may also be smarter). This trick could be
+ disabled with future gcc versions. */
+#if defined(__GNUC__)
+# define INITIALIZED(VAR) VAR = VAR
+#else
+# define INITIALIZED(VAR) VAR
+#endif
+
+/* Ceil log 2: If GCC, uses a GCC extension, otherwise calls a function */
+/* Warning:
+ * Needs to define MPFR_NEED_LONGLONG.
+ * Computes ceil(log2(x)) only for x integer (unsigned long)
+ * Undefined if x is 0 */
+#if __MPFR_GNUC(2,95) || __MPFR_ICC(8,1,0)
+# define MPFR_INT_CEIL_LOG2(x) \
+ (MPFR_UNLIKELY ((x) == 1) ? 0 : \
+ __extension__ ({ int _b; mp_limb_t _limb; \
+ MPFR_ASSERTN ((x) > 1); \
+ _limb = (x) - 1; \
+ MPFR_ASSERTN (_limb == (x) - 1); \
+ count_leading_zeros (_b, _limb); \
+ (GMP_NUMB_BITS - _b); }))
+#else
+# define MPFR_INT_CEIL_LOG2(x) (__gmpfr_int_ceil_log2(x))
+#endif
+
+/* Add two integers with overflow handling */
+/* Example: MPFR_SADD_OVERFLOW (c, a, b, long, unsigned long,
+ * LONG_MIN, LONG_MAX,
+ * goto overflow, goto underflow); */
+#define MPFR_UADD_OVERFLOW(c,a,b,ACTION_IF_OVERFLOW) \
+ do { \
+ (c) = (a) + (b); \
+ if ((c) < (a)) ACTION_IF_OVERFLOW; \
+ } while (0)
+
+#define MPFR_SADD_OVERFLOW(c,a,b,STYPE,UTYPE,MIN,MAX,ACTION_IF_POS_OVERFLOW,ACTION_IF_NEG_OVERFLOW) \
+ do { \
+ if ((a) >= 0 && (b) >= 0) { \
+ UTYPE uc,ua,ub; \
+ ua = (UTYPE) (a); ub = (UTYPE) (b); \
+ MPFR_UADD_OVERFLOW (uc, ua, ub, ACTION_IF_POS_OVERFLOW); \
+ if (uc > (UTYPE)(MAX)) ACTION_IF_POS_OVERFLOW; \
+ else (c) = (STYPE) uc; \
+ } else if ((a) < 0 && (b) < 0) { \
+ UTYPE uc,ua,ub; \
+ ua = -(UTYPE) (a); ub = -(UTYPE) (b); \
+ MPFR_UADD_OVERFLOW (uc, ua, ub, ACTION_IF_NEG_OVERFLOW); \
+ if (uc >= -(UTYPE)(MIN) || uc > (UTYPE)(MAX)) { \
+ if (uc == -(UTYPE)(MIN)) (c) = (MIN); \
+ else ACTION_IF_NEG_OVERFLOW; } \
+ else (c) = -(STYPE) uc; \
+ } else (c) = (a) + (b); \
+ } while (0)
+
+
+/* Set a number to 1 (Fast) - It doesn't check if 1 is in the exponent range */
+#define MPFR_SET_ONE(x) \
+do { \
+ mp_size_t _size = MPFR_LAST_LIMB(x); \
+ MPFR_SET_POS(x); \
+ MPFR_EXP(x) = 1; \
+ MPN_ZERO ( MPFR_MANT(x), _size); \
+ MPFR_MANT(x)[_size] = MPFR_LIMB_HIGHBIT; \
+} while (0)
+
+/* Compute s = (-a) % GMP_NUMB_BITS as unsigned */
+#define MPFR_UNSIGNED_MINUS_MODULO(s, a) \
+ do \
+ { \
+ if (IS_POW2 (GMP_NUMB_BITS)) \
+ (s) = (- (unsigned int) (a)) % GMP_NUMB_BITS; \
+ else \
+ { \
+ (s) = (a) % GMP_NUMB_BITS; \
+ if ((s) != 0) \
+ (s) = GMP_NUMB_BITS - (s); \
+ } \
+ MPFR_ASSERTD ((s) >= 0 && (s) < GMP_NUMB_BITS); \
+ } \
+ while (0)
+
+/* Use it only for debug reasons */
+/* MPFR_TRACE (operation) : execute operation iff DEBUG flag is set */
+/* MPFR_DUMP (x) : print x (a mpfr_t) on stdout */
+#ifdef DEBUG
+# define MPFR_TRACE(x) x
+#else
+# define MPFR_TRACE(x) (void) 0
+#endif
+#define MPFR_DUMP(x) ( printf(#x"="), mpfr_dump(x) )
+
+/* Test if X (positive) is a power of 2 */
+#define IS_POW2(X) (((X) & ((X) - 1)) == 0)
+#define NOT_POW2(X) (((X) & ((X) - 1)) != 0)
+
+/* Safe absolute value (to avoid possible integer overflow) */
+/* type is the target (unsigned) type */
+#define SAFE_ABS(type,x) ((x) >= 0 ? (type)(x) : -(type)(x))
+
+#define mpfr_get_d1(x) mpfr_get_d(x,__gmpfr_default_rounding_mode)
+
+/* Store in r the size in bits of the mpz_t z */
+#define MPFR_MPZ_SIZEINBASE2(r, z) \
+ do { \
+ int _cnt; \
+ mp_size_t _size; \
+ MPFR_ASSERTD (mpz_sgn (z) != 0); \
+ _size = ABSIZ(z); \
+ count_leading_zeros (_cnt, PTR(z)[_size-1]); \
+ (r) = _size * GMP_NUMB_BITS - _cnt; \
+ } while (0)
+
+/* Needs <locale.h> */
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+/* Warning! In case of signed char, the value of MPFR_DECIMAL_POINT may
+ be negative (the ISO C99 does not seem to forbid negative values). */
+#define MPFR_DECIMAL_POINT (localeconv()->decimal_point[0])
+#define MPFR_THOUSANDS_SEPARATOR (localeconv()->thousands_sep[0])
+#else
+#define MPFR_DECIMAL_POINT ((char) '.')
+#define MPFR_THOUSANDS_SEPARATOR ('\0')
+#endif
+
+
+/* Set y to s*significand(x)*2^e, for example MPFR_ALIAS(y,x,1,MPFR_EXP(x))
+ sets y to |x|, and MPFR_ALIAS(y,x,MPFR_SIGN(x),0) sets y to x*2^f such
+ that 1/2 <= |y| < 1. Does not check y is in the valid exponent range.
+ WARNING! x and y share the same mantissa. So, some operations are
+ not valid if x has been provided via an argument, e.g., trying to
+ modify the mantissa of y, even temporarily, or calling mpfr_clear on y.
+*/
+#define MPFR_ALIAS(y,x,s,e) \
+ do \
+ { \
+ MPFR_PREC(y) = MPFR_PREC(x); \
+ MPFR_SIGN(y) = (s); \
+ MPFR_EXP(y) = (e); \
+ MPFR_MANT(y) = MPFR_MANT(x); \
+ } while (0)
+
+
+/******************************************************
+ ************** Save exponent macros ****************
+ ******************************************************/
+
+/* See README.dev for details on how to use the macros.
+ They are used to set the exponent range to the maximum
+ temporarily */
+
+typedef struct {
+ unsigned int saved_flags;
+ mpfr_exp_t saved_emin;
+ mpfr_exp_t saved_emax;
+} mpfr_save_expo_t;
+
+/* Minimum and maximum exponents of the extended exponent range. */
+#define MPFR_EXT_EMIN MPFR_EMIN_MIN
+#define MPFR_EXT_EMAX MPFR_EMAX_MAX
+
+#define MPFR_SAVE_EXPO_DECL(x) mpfr_save_expo_t x
+#define MPFR_SAVE_EXPO_MARK(x) \
+ ((x).saved_flags = __gmpfr_flags, \
+ (x).saved_emin = __gmpfr_emin, \
+ (x).saved_emax = __gmpfr_emax, \
+ __gmpfr_emin = MPFR_EXT_EMIN, \
+ __gmpfr_emax = MPFR_EXT_EMAX)
+#define MPFR_SAVE_EXPO_FREE(x) \
+ (__gmpfr_flags = (x).saved_flags, \
+ __gmpfr_emin = (x).saved_emin, \
+ __gmpfr_emax = (x).saved_emax)
+#define MPFR_SAVE_EXPO_UPDATE_FLAGS(x, flags) \
+ (x).saved_flags |= (flags)
+
+/* Speed up final checking */
+#define mpfr_check_range(x,t,r) \
+ (MPFR_LIKELY (MPFR_EXP (x) >= __gmpfr_emin && MPFR_EXP (x) <= __gmpfr_emax) \
+ ? ((t) ? (__gmpfr_flags |= MPFR_FLAGS_INEXACT, (t)) : 0) \
+ : mpfr_check_range(x,t,r))
+
+
+/******************************************************
+ ***************** Inline Rounding *******************
+ ******************************************************/
+
+/*
+ * Note: due to the labels, one cannot use a macro MPFR_RNDRAW* more than
+ * once in a function (otherwise these labels would not be unique).
+ */
+
+/*
+ * Round mantissa (srcp, sprec) to mpfr_t dest using rounding mode rnd
+ * assuming dest's sign is sign.
+ * In rounding to nearest mode, execute MIDDLE_HANDLER when the value
+ * is the middle of two consecutive numbers in dest precision.
+ * Execute OVERFLOW_HANDLER in case of overflow when rounding.
+ */
+#define MPFR_RNDRAW_GEN(inexact, dest, srcp, sprec, rnd, sign, \
+ MIDDLE_HANDLER, OVERFLOW_HANDLER) \
+ do { \
+ mp_size_t _dests, _srcs; \
+ mp_limb_t *_destp; \
+ mpfr_prec_t _destprec, _srcprec; \
+ \
+ /* Check Trivial Case when Dest Mantissa has more bits than source */ \
+ _srcprec = (sprec); \
+ _destprec = MPFR_PREC (dest); \
+ _destp = MPFR_MANT (dest); \
+ if (MPFR_UNLIKELY (_destprec >= _srcprec)) \
+ { \
+ _srcs = MPFR_PREC2LIMBS (_srcprec); \
+ _dests = MPFR_PREC2LIMBS (_destprec) - _srcs; \
+ MPN_COPY (_destp + _dests, srcp, _srcs); \
+ MPN_ZERO (_destp, _dests); \
+ inexact = 0; \
+ } \
+ else \
+ { \
+ /* Non trivial case: rounding needed */ \
+ mpfr_prec_t _sh; \
+ mp_limb_t *_sp; \
+ mp_limb_t _rb, _sb, _ulp; \
+ \
+ /* Compute Position and shift */ \
+ _srcs = MPFR_PREC2LIMBS (_srcprec); \
+ _dests = MPFR_PREC2LIMBS (_destprec); \
+ MPFR_UNSIGNED_MINUS_MODULO (_sh, _destprec); \
+ _sp = (srcp) + _srcs - _dests; \
+ \
+ /* General case when prec % GMP_NUMB_BITS != 0 */ \
+ if (MPFR_LIKELY (_sh != 0)) \
+ { \
+ mp_limb_t _mask; \
+ /* Compute Rounding Bit and Sticky Bit */ \
+ /* Note: in directed rounding modes, if the rounding bit */ \
+ /* is 1, the behavior does not depend on the sticky bit; */ \
+ /* thus we will not try to compute it in this case (this */ \
+ /* can be much faster and avoids to read uninitialized */ \
+ /* data in the current mpfr_mul implementation). We just */ \
+ /* make sure that _sb is initialized. */ \
+ _mask = MPFR_LIMB_ONE << (_sh - 1); \
+ _rb = _sp[0] & _mask; \
+ _sb = _sp[0] & (_mask - 1); \
+ if (MPFR_UNLIKELY (_sb == 0) && \
+ ((rnd) == MPFR_RNDN || _rb == 0)) \
+ { /* TODO: Improve it */ \
+ mp_limb_t *_tmp; \
+ mp_size_t _n; \
+ for (_tmp = _sp, _n = _srcs - _dests ; \
+ _n != 0 && _sb == 0 ; _n--) \
+ _sb = *--_tmp; \
+ } \
+ _ulp = 2 * _mask; \
+ } \
+ else /* _sh == 0 */ \
+ { \
+ MPFR_ASSERTD (_dests < _srcs); \
+ /* Compute Rounding Bit and Sticky Bit - see note above */ \
+ _rb = _sp[-1] & MPFR_LIMB_HIGHBIT; \
+ _sb = _sp[-1] & (MPFR_LIMB_HIGHBIT-1); \
+ if (MPFR_UNLIKELY (_sb == 0) && \
+ ((rnd) == MPFR_RNDN || _rb == 0)) \
+ { \
+ mp_limb_t *_tmp; \
+ mp_size_t _n; \
+ for (_tmp = _sp - 1, _n = _srcs - _dests - 1 ; \
+ _n != 0 && _sb == 0 ; _n--) \
+ _sb = *--_tmp; \
+ } \
+ _ulp = MPFR_LIMB_ONE; \
+ } \
+ /* Rounding */ \
+ if (MPFR_LIKELY (rnd == MPFR_RNDN)) \
+ { \
+ if (_rb == 0) \
+ { \
+ trunc: \
+ inexact = MPFR_LIKELY ((_sb | _rb) != 0) ? -sign : 0; \
+ trunc_doit: \
+ MPN_COPY (_destp, _sp, _dests); \
+ _destp[0] &= ~(_ulp - 1); \
+ } \
+ else if (MPFR_UNLIKELY (_sb == 0)) \
+ { /* Middle of two consecutive representable numbers */ \
+ MIDDLE_HANDLER; \
+ } \
+ else \
+ { \
+ if (0) \
+ goto addoneulp_doit; /* dummy code to avoid warning */ \
+ addoneulp: \
+ inexact = sign; \
+ addoneulp_doit: \
+ if (MPFR_UNLIKELY (mpn_add_1 (_destp, _sp, _dests, _ulp))) \
+ { \
+ _destp[_dests - 1] = MPFR_LIMB_HIGHBIT; \
+ OVERFLOW_HANDLER; \
+ } \
+ _destp[0] &= ~(_ulp - 1); \
+ } \
+ } \
+ else \
+ { /* Directed rounding mode */ \
+ if (MPFR_LIKELY (MPFR_IS_LIKE_RNDZ (rnd, \
+ MPFR_IS_NEG_SIGN (sign)))) \
+ goto trunc; \
+ else if (MPFR_UNLIKELY ((_sb | _rb) == 0)) \
+ { \
+ inexact = 0; \
+ goto trunc_doit; \
+ } \
+ else \
+ goto addoneulp; \
+ } \
+ } \
+ } while (0)
+
+/*
+ * Round mantissa (srcp, sprec) to mpfr_t dest using rounding mode rnd
+ * assuming dest's sign is sign.
+ * Execute OVERFLOW_HANDLER in case of overflow when rounding.
+ */
+#define MPFR_RNDRAW(inexact, dest, srcp, sprec, rnd, sign, OVERFLOW_HANDLER) \
+ MPFR_RNDRAW_GEN (inexact, dest, srcp, sprec, rnd, sign, \
+ if ((_sp[0] & _ulp) == 0) \
+ { \
+ inexact = -sign; \
+ goto trunc_doit; \
+ } \
+ else \
+ goto addoneulp; \
+ , OVERFLOW_HANDLER)
+
+/*
+ * Round mantissa (srcp, sprec) to mpfr_t dest using rounding mode rnd
+ * assuming dest's sign is sign.
+ * Execute OVERFLOW_HANDLER in case of overflow when rounding.
+ * Set inexact to +/- MPFR_EVEN_INEX in case of even rounding.
+ */
+#define MPFR_RNDRAW_EVEN(inexact, dest, srcp, sprec, rnd, sign, \
+ OVERFLOW_HANDLER) \
+ MPFR_RNDRAW_GEN (inexact, dest, srcp, sprec, rnd, sign, \
+ if ((_sp[0] & _ulp) == 0) \
+ { \
+ inexact = -MPFR_EVEN_INEX * sign; \
+ goto trunc_doit; \
+ } \
+ else \
+ { \
+ inexact = MPFR_EVEN_INEX * sign; \
+ goto addoneulp_doit; \
+ } \
+ , OVERFLOW_HANDLER)
+
+/* Return TRUE if b is non singular and we can round it to precision 'prec'
+ and determine the ternary value, with rounding mode 'rnd', and with
+ error at most 'error' */
+#define MPFR_CAN_ROUND(b,err,prec,rnd) \
+ (!MPFR_IS_SINGULAR (b) && mpfr_round_p (MPFR_MANT (b), MPFR_LIMB_SIZE (b), \
+ (err), (prec) + ((rnd)==MPFR_RNDN)))
+
+/* Copy the sign and the significand, and handle the exponent in exp. */
+#define MPFR_SETRAW(inexact,dest,src,exp,rnd) \
+ if (MPFR_UNLIKELY (dest != src)) \
+ { \
+ MPFR_SET_SIGN (dest, MPFR_SIGN (src)); \
+ if (MPFR_LIKELY (MPFR_PREC (dest) == MPFR_PREC (src))) \
+ { \
+ MPN_COPY (MPFR_MANT (dest), MPFR_MANT (src), \
+ MPFR_LIMB_SIZE (src)); \
+ inexact = 0; \
+ } \
+ else \
+ { \
+ MPFR_RNDRAW (inexact, dest, MPFR_MANT (src), MPFR_PREC (src), \
+ rnd, MPFR_SIGN (src), exp++); \
+ } \
+ } \
+ else \
+ inexact = 0;
+
+/* TODO: fix this description (see round_near_x.c). */
+/* Assuming that the function has a Taylor expansion which looks like:
+ y=o(f(x)) = o(v + g(x)) with |g(x)| <= 2^(EXP(v)-err)
+ we can quickly set y to v if x is small (ie err > prec(y)+1) in most
+ cases. It assumes that f(x) is not representable exactly as a FP number.
+ v must not be a singular value (NAN, INF or ZERO); usual values are
+ v=1 or v=x.
+
+ y is the destination (a mpfr_t), v the value to set (a mpfr_t),
+ err1+err2 with err2 <= 3 the error term (mpfr_exp_t's), dir (an int) is
+ the direction of the committed error (if dir = 0, it rounds toward 0,
+ if dir=1, it rounds away from 0), rnd the rounding mode.
+
+ It returns from the function a ternary value in case of success.
+ If you want to free something, you must fill the "extra" field
+ in consequences, otherwise put nothing in it.
+
+ The test is less restrictive than necessary, but the function
+ will finish the check itself.
+
+ Note: err1 + err2 is allowed to overflow as mpfr_exp_t, but it must give
+ its real value as mpfr_uexp_t.
+*/
+#define MPFR_FAST_COMPUTE_IF_SMALL_INPUT(y,v,err1,err2,dir,rnd,extra) \
+ do { \
+ mpfr_ptr _y = (y); \
+ mpfr_exp_t _err1 = (err1); \
+ mpfr_exp_t _err2 = (err2); \
+ if (_err1 > 0) \
+ { \
+ mpfr_uexp_t _err = (mpfr_uexp_t) _err1 + _err2; \
+ if (MPFR_UNLIKELY (_err > MPFR_PREC (_y) + 1)) \
+ { \
+ int _inexact = mpfr_round_near_x (_y,(v),_err,(dir),(rnd)); \
+ if (_inexact != 0) \
+ { \
+ extra; \
+ return _inexact; \
+ } \
+ } \
+ } \
+ } while (0)
+
+/* Variant, to be called somewhere after MPFR_SAVE_EXPO_MARK. This variant
+ is needed when there are some computations before or when some non-zero
+ real constant is used, such as __gmpfr_one for mpfr_cos. */
+#define MPFR_SMALL_INPUT_AFTER_SAVE_EXPO(y,v,err1,err2,dir,rnd,expo,extra) \
+ do { \
+ mpfr_ptr _y = (y); \
+ mpfr_exp_t _err1 = (err1); \
+ mpfr_exp_t _err2 = (err2); \
+ if (_err1 > 0) \
+ { \
+ mpfr_uexp_t _err = (mpfr_uexp_t) _err1 + _err2; \
+ if (MPFR_UNLIKELY (_err > MPFR_PREC (_y) + 1)) \
+ { \
+ int _inexact; \
+ mpfr_clear_flags (); \
+ _inexact = mpfr_round_near_x (_y,(v),_err,(dir),(rnd)); \
+ if (_inexact != 0) \
+ { \
+ extra; \
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); \
+ MPFR_SAVE_EXPO_FREE (expo); \
+ return mpfr_check_range (_y, _inexact, (rnd)); \
+ } \
+ } \
+ } \
+ } while (0)
+
+/******************************************************
+ *************** Ziv Loop Macro *********************
+ ******************************************************/
+
+#ifndef MPFR_USE_LOGGING
+
+#define MPFR_ZIV_DECL(_x) mpfr_prec_t _x
+#define MPFR_ZIV_INIT(_x, _p) (_x) = GMP_NUMB_BITS
+#define MPFR_ZIV_NEXT(_x, _p) ((_p) += (_x), (_x) = (_p)/2)
+#define MPFR_ZIV_FREE(x)
+
+#else
+
+/* The following test on glibc is there mainly for Darwin (Mac OS X), to
+ obtain a better error message. The real test should have been a test
+ concerning nested functions in gcc, which are disabled by default on
+ Darwin; but it is not possible to do that without a configure test. */
+# if defined (__cplusplus) || !(__MPFR_GNUC(3,0) && __MPFR_GLIBC(2,0))
+# error "Logging not supported (needs gcc >= 3.0 and GNU C Library >= 2.0)."
+# endif
+
+/* Use LOGGING */
+
+/* Note: the mpfr_log_level >= 0 below avoids to take into account
+ Ziv loops used by the MPFR functions called by the mpfr_fprintf
+ in LOG_PRINT. */
+
+#define MPFR_ZIV_DECL(_x) \
+ mpfr_prec_t _x; \
+ int _x ## _cpt = 1; \
+ static unsigned long _x ## _loop = 0, _x ## _bad = 0; \
+ static const char *_x ## _fname = __func__; \
+ auto void __attribute__ ((destructor)) x ## _f (void); \
+ void __attribute__ ((destructor)) x ## _f (void) { \
+ if (_x ## _loop != 0 && (MPFR_LOG_STAT_F & mpfr_log_type)) \
+ fprintf (mpfr_log_file, \
+ "%s: Ziv failed %2.2f%% (%lu bad cases / %lu calls)\n", \
+ _x ## _fname, (double) 100.0 * _x ## _bad / _x ## _loop, \
+ _x ## _bad, _x ## _loop ); }
+
+#define MPFR_ZIV_INIT(_x, _p) \
+ do \
+ { \
+ (_x) = GMP_NUMB_BITS; \
+ if (mpfr_log_level >= 0) \
+ _x ## _loop ++; \
+ if ((MPFR_LOG_BADCASE_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ LOG_PRINT ("%s:ZIV 1st prec=%Pd\n", \
+ __func__, (mpfr_prec_t) (_p)); \
+ } \
+ while (0)
+
+#define MPFR_ZIV_NEXT(_x, _p) \
+ do \
+ { \
+ (_p) += (_x); \
+ (_x) = (_p) / 2; \
+ if (mpfr_log_level >= 0) \
+ _x ## _bad += (_x ## _cpt == 1); \
+ _x ## _cpt ++; \
+ if ((MPFR_LOG_BADCASE_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ LOG_PRINT ("%s:ZIV new prec=%Pd\n", \
+ __func__, (mpfr_prec_t) (_p)); \
+ } \
+ while (0)
+
+#define MPFR_ZIV_FREE(_x) \
+ do \
+ { \
+ if ((MPFR_LOG_BADCASE_F & mpfr_log_type) && _x ## _cpt > 1 && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ fprintf (mpfr_log_file, "%s:ZIV %d loops\n", \
+ __func__, _x ## _cpt); \
+ } \
+ while (0)
+
+#endif
+
+
+/******************************************************
+ *************** Logging Macros *********************
+ ******************************************************/
+
+/* The different kind of LOG */
+#define MPFR_LOG_INPUT_F 1
+#define MPFR_LOG_OUTPUT_F 2
+#define MPFR_LOG_INTERNAL_F 4
+#define MPFR_LOG_TIME_F 8
+#define MPFR_LOG_BADCASE_F 16
+#define MPFR_LOG_MSG_F 32
+#define MPFR_LOG_STAT_F 64
+
+#ifdef MPFR_USE_LOGGING
+
+/* Check if we can support this feature */
+# ifdef MPFR_USE_THREAD_SAFE
+# error "Enable either `Logging' or `thread-safe', not both"
+# endif
+# if !__MPFR_GNUC(3,0)
+# error "Logging not supported (GCC >= 3.0)"
+# endif
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+__MPFR_DECLSPEC extern FILE *mpfr_log_file;
+__MPFR_DECLSPEC extern int mpfr_log_type;
+__MPFR_DECLSPEC extern int mpfr_log_level;
+__MPFR_DECLSPEC extern int mpfr_log_current;
+__MPFR_DECLSPEC extern mpfr_prec_t mpfr_log_prec;
+
+#if defined (__cplusplus)
+ }
+#endif
+
+/* LOG_PRINT calls mpfr_fprintf on mpfr_log_file with logging disabled
+ (recursive logging is not wanted and freezes MPFR). */
+#define LOG_PRINT(format, ...) \
+ do \
+ { \
+ int old_level = mpfr_log_level; \
+ mpfr_log_level = -1; /* disable logging in mpfr_fprintf */ \
+ __gmpfr_cache_const_pi = __gmpfr_logging_pi; \
+ __gmpfr_cache_const_log2 = __gmpfr_logging_log2; \
+ mpfr_fprintf (mpfr_log_file, format, __VA_ARGS__); \
+ mpfr_log_level = old_level; \
+ __gmpfr_cache_const_pi = __gmpfr_normal_pi; \
+ __gmpfr_cache_const_log2 = __gmpfr_normal_log2; \
+ } \
+ while (0)
+
+#define MPFR_LOG_VAR(x) \
+ do \
+ if ((MPFR_LOG_INTERNAL_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ LOG_PRINT ("%s.%d:%s[%#Pu]=%.*Rg\n", __func__, __LINE__, \
+ #x, mpfr_get_prec (x), mpfr_log_prec, x); \
+ while (0)
+
+#define MPFR_LOG_MSG2(format, ...) \
+ do \
+ if ((MPFR_LOG_MSG_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ LOG_PRINT ("%s.%d: "format, __func__, __LINE__, __VA_ARGS__); \
+ while (0)
+#define MPFR_LOG_MSG(x) MPFR_LOG_MSG2 x
+
+#define MPFR_LOG_BEGIN2(format, ...) \
+ mpfr_log_current ++; \
+ if ((MPFR_LOG_INPUT_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ LOG_PRINT ("%s:IN "format"\n", __func__, __VA_ARGS__); \
+ if ((MPFR_LOG_TIME_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ __gmpfr_log_time = mpfr_get_cputime ();
+#define MPFR_LOG_BEGIN(x) \
+ int __gmpfr_log_time = 0; \
+ MPFR_LOG_BEGIN2 x
+
+#define MPFR_LOG_END2(format, ...) \
+ if ((MPFR_LOG_TIME_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ fprintf (mpfr_log_file, "%s:TIM %dms\n", __mpfr_log_fname, \
+ mpfr_get_cputime () - __gmpfr_log_time); \
+ if ((MPFR_LOG_OUTPUT_F & mpfr_log_type) && \
+ (mpfr_log_current <= mpfr_log_level)) \
+ LOG_PRINT ("%s:OUT "format"\n", __mpfr_log_fname, __VA_ARGS__); \
+ mpfr_log_current --;
+#define MPFR_LOG_END(x) \
+ static const char *__mpfr_log_fname = __func__; \
+ MPFR_LOG_END2 x
+
+#define MPFR_LOG_FUNC(begin,end) \
+ static const char *__mpfr_log_fname = __func__; \
+ auto void __mpfr_log_cleanup (int *time); \
+ void __mpfr_log_cleanup (int *time) { \
+ int __gmpfr_log_time = *time; \
+ MPFR_LOG_END2 end; } \
+ int __gmpfr_log_time __attribute__ ((cleanup (__mpfr_log_cleanup))); \
+ __gmpfr_log_time = 0; \
+ MPFR_LOG_BEGIN2 begin
+
+#else /* MPFR_USE_LOGGING */
+
+/* Define void macro for logging */
+
+#define MPFR_LOG_VAR(x)
+#define MPFR_LOG_BEGIN(x)
+#define MPFR_LOG_END(x)
+#define MPFR_LOG_MSG(x)
+#define MPFR_LOG_FUNC(x,y)
+
+#endif /* MPFR_USE_LOGGING */
+
+
+/**************************************************************
+ ************ Group Initialize Functions Macros *************
+ **************************************************************/
+
+#ifndef MPFR_GROUP_STATIC_SIZE
+# define MPFR_GROUP_STATIC_SIZE 16
+#endif
+
+struct mpfr_group_t {
+ size_t alloc;
+ mp_limb_t *mant;
+ mp_limb_t tab[MPFR_GROUP_STATIC_SIZE];
+};
+
+#define MPFR_GROUP_DECL(g) struct mpfr_group_t g
+#define MPFR_GROUP_CLEAR(g) do { \
+ MPFR_LOG_MSG (("GROUP_CLEAR: ptr = 0x%lX, size = %lu\n", \
+ (unsigned long) (g).mant, \
+ (unsigned long) (g).alloc)); \
+ if (MPFR_UNLIKELY ((g).alloc != 0)) { \
+ MPFR_ASSERTD ((g).mant != (g).tab); \
+ (*__gmp_free_func) ((g).mant, (g).alloc); \
+ }} while (0)
+
+#define MPFR_GROUP_INIT_TEMPLATE(g, prec, num, handler) do { \
+ mpfr_prec_t _prec = (prec); \
+ mp_size_t _size; \
+ MPFR_ASSERTD (_prec >= MPFR_PREC_MIN); \
+ if (MPFR_UNLIKELY (_prec > MPFR_PREC_MAX)) \
+ mpfr_abort_prec_max (); \
+ _size = MPFR_PREC2LIMBS (_prec); \
+ if (MPFR_UNLIKELY (_size * (num) > MPFR_GROUP_STATIC_SIZE)) \
+ { \
+ (g).alloc = (num) * _size * sizeof (mp_limb_t); \
+ (g).mant = (mp_limb_t *) (*__gmp_allocate_func) ((g).alloc); \
+ } \
+ else \
+ { \
+ (g).alloc = 0; \
+ (g).mant = (g).tab; \
+ } \
+ MPFR_LOG_MSG (("GROUP_INIT: ptr = 0x%lX, size = %lu\n", \
+ (unsigned long) (g).mant, (unsigned long) (g).alloc)); \
+ handler; \
+ } while (0)
+#define MPFR_GROUP_TINIT(g, n, x) \
+ MPFR_TMP_INIT1 ((g).mant + _size * (n), x, _prec)
+
+#define MPFR_GROUP_INIT_1(g, prec, x) \
+ MPFR_GROUP_INIT_TEMPLATE(g, prec, 1, MPFR_GROUP_TINIT(g, 0, x))
+#define MPFR_GROUP_INIT_2(g, prec, x, y) \
+ MPFR_GROUP_INIT_TEMPLATE(g, prec, 2, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y))
+#define MPFR_GROUP_INIT_3(g, prec, x, y, z) \
+ MPFR_GROUP_INIT_TEMPLATE(g, prec, 3, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z))
+#define MPFR_GROUP_INIT_4(g, prec, x, y, z, t) \
+ MPFR_GROUP_INIT_TEMPLATE(g, prec, 4, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z);MPFR_GROUP_TINIT(g, 3, t))
+#define MPFR_GROUP_INIT_5(g, prec, x, y, z, t, a) \
+ MPFR_GROUP_INIT_TEMPLATE(g, prec, 5, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z);MPFR_GROUP_TINIT(g, 3, t); \
+ MPFR_GROUP_TINIT(g, 4, a))
+#define MPFR_GROUP_INIT_6(g, prec, x, y, z, t, a, b) \
+ MPFR_GROUP_INIT_TEMPLATE(g, prec, 6, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z);MPFR_GROUP_TINIT(g, 3, t); \
+ MPFR_GROUP_TINIT(g, 4, a);MPFR_GROUP_TINIT(g, 5, b))
+
+#define MPFR_GROUP_REPREC_TEMPLATE(g, prec, num, handler) do { \
+ mpfr_prec_t _prec = (prec); \
+ size_t _oalloc = (g).alloc; \
+ mp_size_t _size; \
+ MPFR_LOG_MSG (("GROUP_REPREC: oldptr = 0x%lX, oldsize = %lu\n", \
+ (unsigned long) (g).mant, (unsigned long) _oalloc)); \
+ MPFR_ASSERTD (_prec >= MPFR_PREC_MIN); \
+ if (MPFR_UNLIKELY (_prec > MPFR_PREC_MAX)) \
+ mpfr_abort_prec_max (); \
+ _size = MPFR_PREC2LIMBS (_prec); \
+ (g).alloc = (num) * _size * sizeof (mp_limb_t); \
+ if (MPFR_LIKELY (_oalloc == 0)) \
+ (g).mant = (mp_limb_t *) (*__gmp_allocate_func) ((g).alloc); \
+ else \
+ (g).mant = (mp_limb_t *) \
+ (*__gmp_reallocate_func) ((g).mant, _oalloc, (g).alloc); \
+ MPFR_LOG_MSG (("GROUP_REPREC: newptr = 0x%lX, newsize = %lu\n", \
+ (unsigned long) (g).mant, (unsigned long) (g).alloc)); \
+ handler; \
+ } while (0)
+
+#define MPFR_GROUP_REPREC_1(g, prec, x) \
+ MPFR_GROUP_REPREC_TEMPLATE(g, prec, 1, MPFR_GROUP_TINIT(g, 0, x))
+#define MPFR_GROUP_REPREC_2(g, prec, x, y) \
+ MPFR_GROUP_REPREC_TEMPLATE(g, prec, 2, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y))
+#define MPFR_GROUP_REPREC_3(g, prec, x, y, z) \
+ MPFR_GROUP_REPREC_TEMPLATE(g, prec, 3, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z))
+#define MPFR_GROUP_REPREC_4(g, prec, x, y, z, t) \
+ MPFR_GROUP_REPREC_TEMPLATE(g, prec, 4, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z);MPFR_GROUP_TINIT(g, 3, t))
+#define MPFR_GROUP_REPREC_5(g, prec, x, y, z, t, a) \
+ MPFR_GROUP_REPREC_TEMPLATE(g, prec, 5, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z);MPFR_GROUP_TINIT(g, 3, t); \
+ MPFR_GROUP_TINIT(g, 4, a))
+#define MPFR_GROUP_REPREC_6(g, prec, x, y, z, t, a, b) \
+ MPFR_GROUP_REPREC_TEMPLATE(g, prec, 6, \
+ MPFR_GROUP_TINIT(g, 0, x);MPFR_GROUP_TINIT(g, 1, y); \
+ MPFR_GROUP_TINIT(g, 2, z);MPFR_GROUP_TINIT(g, 3, t); \
+ MPFR_GROUP_TINIT(g, 4, a);MPFR_GROUP_TINIT(g, 5, b))
+
+
+/******************************************************
+ *************** Internal Functions *****************
+ ******************************************************/
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+__MPFR_DECLSPEC int mpfr_underflow _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t, int));
+__MPFR_DECLSPEC int mpfr_overflow _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t, int));
+
+__MPFR_DECLSPEC int mpfr_add1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_add1sp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub1sp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_can_round_raw _MPFR_PROTO ((const mp_limb_t *,
+ mp_size_t, int, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, mpfr_prec_t));
+
+__MPFR_DECLSPEC int mpfr_cmp2 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr,
+ mpfr_prec_t *));
+
+__MPFR_DECLSPEC long __gmpfr_ceil_log2 _MPFR_PROTO ((double));
+__MPFR_DECLSPEC long __gmpfr_floor_log2 _MPFR_PROTO ((double));
+__MPFR_DECLSPEC double __gmpfr_ceil_exp2 _MPFR_PROTO ((double));
+__MPFR_DECLSPEC unsigned long __gmpfr_isqrt _MPFR_PROTO ((unsigned long));
+__MPFR_DECLSPEC unsigned long __gmpfr_cuberoot _MPFR_PROTO ((unsigned long));
+__MPFR_DECLSPEC int __gmpfr_int_ceil_log2 _MPFR_PROTO ((unsigned long));
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_ceil_mul _MPFR_PROTO ((mpfr_exp_t, int, int));
+
+__MPFR_DECLSPEC int mpfr_exp_2 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_exp_3 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_powerof2_raw _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_pow_general _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t, int, mpfr_save_expo_t *));
+
+__MPFR_DECLSPEC void mpfr_setmax _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t));
+__MPFR_DECLSPEC void mpfr_setmin _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t));
+
+__MPFR_DECLSPEC long mpfr_mpn_exp _MPFR_PROTO ((mp_limb_t *, mpfr_exp_t *, int,
+ mpfr_exp_t, size_t));
+
+#ifdef _MPFR_H_HAVE_FILE
+__MPFR_DECLSPEC void mpfr_fprint_binary _MPFR_PROTO ((FILE *, mpfr_srcptr));
+#endif
+__MPFR_DECLSPEC void mpfr_print_binary _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC void mpfr_print_mant_binary _MPFR_PROTO ((const char*,
+ const mp_limb_t*, mpfr_prec_t));
+__MPFR_DECLSPEC void mpfr_set_str_binary _MPFR_PROTO((mpfr_ptr, const char*));
+
+__MPFR_DECLSPEC int mpfr_round_raw _MPFR_PROTO ((mp_limb_t *,
+ const mp_limb_t *, mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t, int *));
+__MPFR_DECLSPEC int mpfr_round_raw_2 _MPFR_PROTO ((const mp_limb_t *,
+ mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t));
+/* No longer defined (see round_prec.c).
+ Uncomment if it needs to be defined again.
+__MPFR_DECLSPEC int mpfr_round_raw_3 _MPFR_PROTO ((const mp_limb_t *,
+ mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t, int *));
+*/
+__MPFR_DECLSPEC int mpfr_round_raw_4 _MPFR_PROTO ((mp_limb_t *,
+ const mp_limb_t *, mpfr_prec_t, int, mpfr_prec_t, mpfr_rnd_t));
+
+#define mpfr_round_raw2(xp, xn, neg, r, prec) \
+ mpfr_round_raw_2((xp),(xn)*GMP_NUMB_BITS,(neg),(prec),(r))
+
+__MPFR_DECLSPEC int mpfr_check _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_sum_sort _MPFR_PROTO ((mpfr_srcptr *const,
+ unsigned long, mpfr_srcptr *));
+
+__MPFR_DECLSPEC int mpfr_get_cputime _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC void mpfr_nexttozero _MPFR_PROTO ((mpfr_ptr));
+__MPFR_DECLSPEC void mpfr_nexttoinf _MPFR_PROTO ((mpfr_ptr));
+
+__MPFR_DECLSPEC int mpfr_const_pi_internal _MPFR_PROTO ((mpfr_ptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_const_log2_internal _MPFR_PROTO((mpfr_ptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_const_euler_internal _MPFR_PROTO((mpfr_ptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_const_catalan_internal _MPFR_PROTO((mpfr_ptr, mpfr_rnd_t));
+
+#if 0
+__MPFR_DECLSPEC void mpfr_init_cache _MPFR_PROTO ((mpfr_cache_t,
+ int(*)(mpfr_ptr,mpfr_rnd_t)));
+#endif
+__MPFR_DECLSPEC void mpfr_clear_cache _MPFR_PROTO ((mpfr_cache_t));
+__MPFR_DECLSPEC int mpfr_cache _MPFR_PROTO ((mpfr_ptr, mpfr_cache_t,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_mulhigh_n _MPFR_PROTO ((mpfr_limb_ptr,
+ mpfr_limb_srcptr, mpfr_limb_srcptr, mp_size_t));
+__MPFR_DECLSPEC void mpfr_mullow_n _MPFR_PROTO ((mpfr_limb_ptr,
+ mpfr_limb_srcptr, mpfr_limb_srcptr, mp_size_t));
+__MPFR_DECLSPEC void mpfr_sqrhigh_n _MPFR_PROTO ((mpfr_limb_ptr,
+ mpfr_limb_srcptr, mp_size_t));
+__MPFR_DECLSPEC mp_limb_t mpfr_divhigh_n _MPFR_PROTO ((mpfr_limb_ptr,
+ mpfr_limb_ptr, mpfr_limb_ptr, mp_size_t));
+
+__MPFR_DECLSPEC int mpfr_round_p _MPFR_PROTO ((mp_limb_t *, mp_size_t,
+ mpfr_exp_t, mpfr_prec_t));
+
+__MPFR_DECLSPEC void mpfr_dump_mant _MPFR_PROTO ((const mp_limb_t *,
+ mpfr_prec_t, mpfr_prec_t,
+ mpfr_prec_t));
+
+__MPFR_DECLSPEC int mpfr_round_near_x _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_uexp_t, int,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC void mpfr_abort_prec_max _MPFR_PROTO ((void))
+ MPFR_NORETURN_ATTR;
+
+__MPFR_DECLSPEC void mpfr_rand_raw _MPFR_PROTO((mpfr_limb_ptr, gmp_randstate_t,
+ mpfr_prec_t));
+
+__MPFR_DECLSPEC mpz_t* mpfr_bernoulli_internal _MPFR_PROTO((mpz_t*,
+ unsigned long));
+
+__MPFR_DECLSPEC int mpfr_sincos_fast _MPFR_PROTO((mpfr_t, mpfr_t,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC double mpfr_scale2 _MPFR_PROTO((double, int));
+
+__MPFR_DECLSPEC void mpfr_div_ui2 _MPFR_PROTO((mpfr_ptr, mpfr_srcptr,
+ unsigned long int, unsigned long int,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_gamma_one_and_two_third _MPFR_PROTO((mpfr_ptr, mpfr_ptr, mpfr_prec_t));
+
+#if defined (__cplusplus)
+}
+#endif
+
+#endif
diff --git a/src/mpfr-intmax.h b/src/mpfr-intmax.h
new file mode 100644
index 0000000..f00c672
--- /dev/null
+++ b/src/mpfr-intmax.h
@@ -0,0 +1,40 @@
+/* MPFR internal header related to intmax_t.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_INTMAX_H__
+#define __MPFR_INTMAX_H__
+
+/* The ISO C99 standard specifies that in C++ implementations the
+ INTMAX_MAX, ... macros should only be defined if explicitly requested. */
+#if defined __cplusplus
+# define __STDC_LIMIT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#endif
diff --git a/src/mpfr-longlong.h b/src/mpfr-longlong.h
new file mode 100644
index 0000000..32d0873
--- /dev/null
+++ b/src/mpfr-longlong.h
@@ -0,0 +1,1943 @@
+/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
+
+Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file 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 3 of the License, or (at your option) any
+later version.
+
+This file 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 file. If not, see http://www.gnu.org/licenses/. */
+
+/* You have to define the following before including this file:
+
+ UWtype -- An unsigned type, default type for operations (typically a "word")
+ UHWtype -- An unsigned type, at least half the size of UWtype.
+ UDWtype -- An unsigned type, at least twice as large a UWtype
+ W_TYPE_SIZE -- size in bits of UWtype
+
+ SItype, USItype -- Signed and unsigned 32 bit types.
+ DItype, UDItype -- Signed and unsigned 64 bit types.
+
+ On a 32 bit machine UWtype should typically be USItype;
+ on a 64 bit machine, UWtype should typically be UDItype.
+
+ CAUTION! Using this file outside of GMP is not safe. You need to include
+ gmp.h and gmp-impl.h, or certain things might not work as expected.
+*/
+
+#define __BITS4 (W_TYPE_SIZE / 4)
+#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
+#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
+#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
+
+/* This is used to make sure no undesirable sharing between different libraries
+ that use this file takes place. */
+#ifndef __MPN
+#define __MPN(x) __##x
+#endif
+
+#ifndef _PROTO
+#if (__STDC__-0) || defined (__cplusplus)
+#define _PROTO(x) x
+#else
+#define _PROTO(x) ()
+#endif
+#endif
+
+/* Define auxiliary asm macros.
+
+ 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two
+ UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype
+ word product in HIGH_PROD and LOW_PROD.
+
+ 2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a
+ UDWtype product. This is just a variant of umul_ppmm.
+
+ 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
+ denominator) divides a UDWtype, composed by the UWtype integers
+ HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient
+ in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less
+ than DENOMINATOR for correct operation. If, in addition, the most
+ significant bit of DENOMINATOR must be 1, then the pre-processor symbol
+ UDIV_NEEDS_NORMALIZATION is defined to 1.
+
+ 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
+ denominator). Like udiv_qrnnd but the numbers are signed. The quotient
+ is rounded toward 0.
+
+ 5) count_leading_zeros(count, x) counts the number of zero-bits from the
+ msb to the first non-zero bit in the UWtype X. This is the number of
+ steps X needs to be shifted left to set the msb. Undefined for X == 0,
+ unless the symbol COUNT_LEADING_ZEROS_0 is defined to some value.
+
+ 6) count_trailing_zeros(count, x) like count_leading_zeros, but counts
+ from the least significant end.
+
+ 7) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,
+ high_addend_2, low_addend_2) adds two UWtype integers, composed by
+ HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2
+ respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow
+ (i.e. carry out) is not stored anywhere, and is lost.
+
+ 8) sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend,
+ high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers,
+ composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and
+ LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE
+ and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere,
+ and is lost.
+
+ If any of these macros are left undefined for a particular CPU,
+ C macros are used.
+
+
+ Notes:
+
+ For add_ssaaaa the two high and two low addends can both commute, but
+ unfortunately gcc only supports one "%" commutative in each asm block.
+ This has always been so but is only documented in recent versions
+ (eg. pre-release 3.3). Having two or more "%"s can cause an internal
+ compiler error in certain rare circumstances.
+
+ Apparently it was only the last "%" that was ever actually respected, so
+ the code has been updated to leave just that. Clearly there's a free
+ choice whether high or low should get it, if there's a reason to favour
+ one over the other. Also obviously when the constraints on the two
+ operands are identical there's no benefit to the reloader in any "%" at
+ all.
+
+ */
+
+/* The CPUs come in alphabetical order below.
+
+ Please add support for more CPUs here, or improve the current support
+ for the CPUs below! */
+
+
+/* count_leading_zeros_gcc_clz is count_leading_zeros implemented with gcc
+ 3.4 __builtin_clzl or __builtin_clzll, according to our limb size.
+ Similarly count_trailing_zeros_gcc_ctz using __builtin_ctzl or
+ __builtin_ctzll.
+
+ These builtins are only used when we check what code comes out, on some
+ chips they're merely libgcc calls, where we will instead want an inline
+ in that case (either asm or generic C).
+
+ These builtins are better than an asm block of the same insn, since an
+ asm block doesn't give gcc any information about scheduling or resource
+ usage. We keep an asm block for use on prior versions of gcc though.
+
+ For reference, __builtin_ffs existed in gcc prior to __builtin_clz, but
+ it's not used (for count_leading_zeros) because it generally gives extra
+ code to ensure the result is 0 when the input is 0, which we don't need
+ or want. */
+
+#ifdef _LONG_LONG_LIMB
+#define count_leading_zeros_gcc_clz(count,x) \
+ do { \
+ ASSERT ((x) != 0); \
+ (count) = __builtin_clzll (x); \
+ } while (0)
+#else
+#define count_leading_zeros_gcc_clz(count,x) \
+ do { \
+ ASSERT ((x) != 0); \
+ (count) = __builtin_clzl (x); \
+ } while (0)
+#endif
+
+#ifdef _LONG_LONG_LIMB
+#define count_trailing_zeros_gcc_ctz(count,x) \
+ do { \
+ ASSERT ((x) != 0); \
+ (count) = __builtin_ctzll (x); \
+ } while (0)
+#else
+#define count_trailing_zeros_gcc_ctz(count,x) \
+ do { \
+ ASSERT ((x) != 0); \
+ (count) = __builtin_ctzl (x); \
+ } while (0)
+#endif
+
+/* Note: the following FIXME comes from GMP, thus it does make sense to try
+ to resolve it in MPFR. */
+/* FIXME: The macros using external routines like __MPN(count_leading_zeros)
+ don't need to be under !NO_ASM */
+#if ! defined (NO_ASM)
+
+#if defined (__alpha) && W_TYPE_SIZE == 64
+/* Most alpha-based machines, except Cray systems. */
+#if defined (__GNUC__)
+#if __GMP_GNUC_PREREQ (3,3)
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UDItype __m0 = (m0), __m1 = (m1); \
+ (ph) = __builtin_alpha_umulh (__m0, __m1); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#else
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UDItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("umulh %r1,%2,%0" \
+ : "=r" (ph) \
+ : "%rJ" (m0), "rI" (m1)); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#endif
+#define UMUL_TIME 18
+#else /* ! __GNUC__ */
+#include <machine/builtins.h>
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UDItype __m0 = (m0), __m1 = (m1); \
+ (ph) = __UMULH (m0, m1); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#endif
+#ifndef LONGLONG_STANDALONE
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { UWtype __di; \
+ __di = __MPN(invert_limb) (d); \
+ udiv_qrnnd_preinv (q, r, n1, n0, d, __di); \
+ } while (0)
+#define UDIV_PREINV_ALWAYS 1
+#define UDIV_NEEDS_NORMALIZATION 1
+#define UDIV_TIME 220
+#endif /* LONGLONG_STANDALONE */
+
+/* clz_tab is required in all configurations, since mpn/alpha/cntlz.asm
+ always goes into libgmp.so, even when not actually used. */
+#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
+
+#if defined (__GNUC__) && HAVE_HOST_CPU_alpha_CIX
+#define count_leading_zeros(COUNT,X) \
+ __asm__("ctlz %1,%0" : "=r"(COUNT) : "r"(X))
+#define count_trailing_zeros(COUNT,X) \
+ __asm__("cttz %1,%0" : "=r"(COUNT) : "r"(X))
+#endif /* clz/ctz using cix */
+
+#if ! defined (count_leading_zeros) \
+ && defined (__GNUC__) && ! defined (LONGLONG_STANDALONE)
+/* ALPHA_CMPBGE_0 gives "cmpbge $31,src,dst", ie. test src bytes == 0.
+ "$31" is written explicitly in the asm, since an "r" constraint won't
+ select reg 31. There seems no need to worry about "r31" syntax for cray,
+ since gcc itself (pre-release 3.4) emits just $31 in various places. */
+#define ALPHA_CMPBGE_0(dst, src) \
+ do { asm ("cmpbge $31, %1, %0" : "=r" (dst) : "r" (src)); } while (0)
+/* Zero bytes are turned into bits with cmpbge, a __clz_tab lookup counts
+ them, locating the highest non-zero byte. A second __clz_tab lookup
+ counts the leading zero bits in that byte, giving the result. */
+#define count_leading_zeros(count, x) \
+ do { \
+ UWtype __clz__b, __clz__c, __clz__x = (x); \
+ ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \
+ __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \
+ __clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \
+ __clz__x >>= __clz__b; \
+ __clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \
+ __clz__b = 65 - __clz__b; \
+ (count) = __clz__b - __clz__c; \
+ } while (0)
+#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
+#endif /* clz using cmpbge */
+
+#if ! defined (count_leading_zeros) && ! defined (LONGLONG_STANDALONE)
+#if HAVE_ATTRIBUTE_CONST
+long __MPN(count_leading_zeros) _PROTO ((UDItype)) __attribute__ ((const));
+#else
+long __MPN(count_leading_zeros) _PROTO ((UDItype));
+#endif
+#define count_leading_zeros(count, x) \
+ ((count) = __MPN(count_leading_zeros) (x))
+#endif /* clz using mpn */
+#endif /* __alpha */
+
+#if defined (_CRAY) && W_TYPE_SIZE == 64
+#include <intrinsics.h>
+#define UDIV_PREINV_ALWAYS 1
+#define UDIV_NEEDS_NORMALIZATION 1
+#define UDIV_TIME 220
+long __MPN(count_leading_zeros) _PROTO ((UDItype));
+#define count_leading_zeros(count, x) \
+ ((count) = _leadz ((UWtype) (x)))
+#if defined (_CRAYIEEE) /* I.e., Cray T90/ieee, T3D, and T3E */
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UDItype __m0 = (m0), __m1 = (m1); \
+ (ph) = _int_mult_upper (m0, m1); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#ifndef LONGLONG_STANDALONE
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { UWtype __di; \
+ __di = __MPN(invert_limb) (d); \
+ udiv_qrnnd_preinv (q, r, n1, n0, d, __di); \
+ } while (0)
+#endif /* LONGLONG_STANDALONE */
+#endif /* _CRAYIEEE */
+#endif /* _CRAY */
+
+#if defined (__ia64) && W_TYPE_SIZE == 64
+/* This form encourages gcc (pre-release 3.4 at least) to emit predicated
+ "sub r=r,r" and "sub r=r,r,1", giving a 2 cycle latency. The generic
+ code using "al<bl" arithmetically comes out making an actual 0 or 1 in a
+ register, which takes an extra cycle. */
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ UWtype __x; \
+ __x = (al) - (bl); \
+ if ((al) < (bl)) \
+ (sh) = (ah) - (bh) - 1; \
+ else \
+ (sh) = (ah) - (bh); \
+ (sl) = __x; \
+ } while (0)
+#if defined (__GNUC__) && ! defined (__INTEL_COMPILER)
+/* Do both product parts in assembly, since that gives better code with
+ all gcc versions. Some callers will just use the upper part, and in
+ that situation we waste an instruction, but not any cycles. */
+#define umul_ppmm(ph, pl, m0, m1) \
+ __asm__ ("xma.hu %0 = %2, %3, f0\n\txma.l %1 = %2, %3, f0" \
+ : "=&f" (ph), "=f" (pl) \
+ : "f" (m0), "f" (m1))
+#define UMUL_TIME 14
+#define count_leading_zeros(count, x) \
+ do { \
+ UWtype _x = (x), _y, _a, _c; \
+ __asm__ ("mux1 %0 = %1, @rev" : "=r" (_y) : "r" (_x)); \
+ __asm__ ("czx1.l %0 = %1" : "=r" (_a) : "r" (-_y | _y)); \
+ _c = (_a - 1) << 3; \
+ _x >>= _c; \
+ if (_x >= 1 << 4) \
+ _x >>= 4, _c += 4; \
+ if (_x >= 1 << 2) \
+ _x >>= 2, _c += 2; \
+ _c += _x >> 1; \
+ (count) = W_TYPE_SIZE - 1 - _c; \
+ } while (0)
+/* similar to what gcc does for __builtin_ffs, but 0 based rather than 1
+ based, and we don't need a special case for x==0 here */
+#define count_trailing_zeros(count, x) \
+ do { \
+ UWtype __ctz_x = (x); \
+ __asm__ ("popcnt %0 = %1" \
+ : "=r" (count) \
+ : "r" ((__ctz_x-1) & ~__ctz_x)); \
+ } while (0)
+#endif
+#if defined (__INTEL_COMPILER)
+#include <ia64intrin.h>
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UWtype _m0 = (m0), _m1 = (m1); \
+ ph = _m64_xmahu (_m0, _m1, 0); \
+ pl = _m0 * _m1; \
+ } while (0)
+#endif
+#ifndef LONGLONG_STANDALONE
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { UWtype __di; \
+ __di = __MPN(invert_limb) (d); \
+ udiv_qrnnd_preinv (q, r, n1, n0, d, __di); \
+ } while (0)
+#define UDIV_PREINV_ALWAYS 1
+#define UDIV_NEEDS_NORMALIZATION 1
+#endif
+#define UDIV_TIME 220
+#endif
+
+
+#if defined (__GNUC__)
+
+/* We sometimes need to clobber "cc" with gcc2, but that would not be
+ understood by gcc1. Use cpp to avoid major code duplication. */
+#if __GNUC__ < 2
+#define __CLOBBER_CC
+#define __AND_CLOBBER_CC
+#else /* __GNUC__ >= 2 */
+#define __CLOBBER_CC : "cc"
+#define __AND_CLOBBER_CC , "cc"
+#endif /* __GNUC__ < 2 */
+
+#if (defined (__a29k__) || defined (_AM29K)) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add %1,%4,%5\n\taddc %0,%2,%3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub %1,%4,%5\n\tsubc %0,%2,%3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "r" (al), "rI" (bl))
+#define umul_ppmm(xh, xl, m0, m1) \
+ do { \
+ USItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("multiplu %0,%1,%2" \
+ : "=r" (xl) \
+ : "r" (__m0), "r" (__m1)); \
+ __asm__ ("multmu %0,%1,%2" \
+ : "=r" (xh) \
+ : "r" (__m0), "r" (__m1)); \
+ } while (0)
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ __asm__ ("dividu %0,%3,%4" \
+ : "=r" (q), "=q" (r) \
+ : "1" (n1), "r" (n0), "r" (d))
+#define count_leading_zeros(count, x) \
+ __asm__ ("clz %0,%1" \
+ : "=r" (count) \
+ : "r" (x))
+#define COUNT_LEADING_ZEROS_0 32
+#endif /* __a29k__ */
+
+#if defined (__arc__)
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add.f\t%1, %4, %5\n\tadc\t%0, %2, %3" \
+ : "=r" (sh), \
+ "=&r" (sl) \
+ : "r" ((USItype) (ah)), \
+ "rIJ" ((USItype) (bh)), \
+ "%r" ((USItype) (al)), \
+ "rIJ" ((USItype) (bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub.f\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
+ : "=r" (sh), \
+ "=&r" (sl) \
+ : "r" ((USItype) (ah)), \
+ "rIJ" ((USItype) (bh)), \
+ "r" ((USItype) (al)), \
+ "rIJ" ((USItype) (bl)))
+#endif
+
+#if defined (__arm__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ if (__builtin_constant_p (al)) \
+ { \
+ if (__builtin_constant_p (ah)) \
+ __asm__ ("rsbs\t%1, %5, %4\n\trsc\t%0, %3, %2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rI" (ah), "r" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
+ else \
+ __asm__ ("rsbs\t%1, %5, %4\n\tsbc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
+ } \
+ else if (__builtin_constant_p (ah)) \
+ { \
+ if (__builtin_constant_p (bl)) \
+ __asm__ ("subs\t%1, %4, %5\n\trsc\t%0, %3, %2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rI" (ah), "r" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
+ else \
+ __asm__ ("rsbs\t%1, %5, %4\n\trsc\t%0, %3, %2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rI" (ah), "r" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
+ } \
+ else if (__builtin_constant_p (bl)) \
+ { \
+ if (__builtin_constant_p (bh)) \
+ __asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
+ else \
+ __asm__ ("subs\t%1, %4, %5\n\trsc\t%0, %3, %2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rI" (ah), "r" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
+ } \
+ else /* only bh might be a constant */ \
+ __asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC);\
+ } while (0)
+#if 1 || defined (__arm_m__) /* `M' series has widening multiply support */
+#define umul_ppmm(xh, xl, a, b) \
+ __asm__ ("umull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
+#define UMUL_TIME 5
+#define smul_ppmm(xh, xl, a, b) \
+ __asm__ ("smull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
+#ifndef LONGLONG_STANDALONE
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { UWtype __di; \
+ __di = __MPN(invert_limb) (d); \
+ udiv_qrnnd_preinv (q, r, n1, n0, d, __di); \
+ } while (0)
+#define UDIV_PREINV_ALWAYS 1
+#define UDIV_NEEDS_NORMALIZATION 1
+#define UDIV_TIME 70
+#endif /* LONGLONG_STANDALONE */
+#else
+#define umul_ppmm(xh, xl, a, b) \
+ __asm__ ("%@ Inlined umul_ppmm\n" \
+" mov %|r0, %2, lsr #16\n" \
+" mov %|r2, %3, lsr #16\n" \
+" bic %|r1, %2, %|r0, lsl #16\n" \
+" bic %|r2, %3, %|r2, lsl #16\n" \
+" mul %1, %|r1, %|r2\n" \
+" mul %|r2, %|r0, %|r2\n" \
+" mul %|r1, %0, %|r1\n" \
+" mul %0, %|r0, %0\n" \
+" adds %|r1, %|r2, %|r1\n" \
+" addcs %0, %0, #65536\n" \
+" adds %1, %1, %|r1, lsl #16\n" \
+" adc %0, %0, %|r1, lsr #16" \
+ : "=&r" (xh), "=r" (xl) \
+ : "r" (a), "r" (b) \
+ : "r0", "r1", "r2")
+#define UMUL_TIME 20
+#ifndef LONGLONG_STANDALONE
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { UWtype __r; \
+ (q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
+ (r) = __r; \
+ } while (0)
+extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
+#define UDIV_TIME 200
+#endif /* LONGLONG_STANDALONE */
+#endif
+#endif /* __arm__ */
+
+#if defined (__clipper__) && W_TYPE_SIZE == 32
+#define umul_ppmm(w1, w0, u, v) \
+ ({union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __x; \
+ __asm__ ("mulwux %2,%0" \
+ : "=r" (__x.__ll) \
+ : "%0" ((USItype)(u)), "r" ((USItype)(v))); \
+ (w1) = __x.__i.__h; (w0) = __x.__i.__l;})
+#define smul_ppmm(w1, w0, u, v) \
+ ({union {DItype __ll; \
+ struct {SItype __l, __h;} __i; \
+ } __x; \
+ __asm__ ("mulwx %2,%0" \
+ : "=r" (__x.__ll) \
+ : "%0" ((SItype)(u)), "r" ((SItype)(v))); \
+ (w1) = __x.__i.__h; (w0) = __x.__i.__l;})
+#define __umulsidi3(u, v) \
+ ({UDItype __w; \
+ __asm__ ("mulwux %2,%0" \
+ : "=r" (__w) : "%0" ((USItype)(u)), "r" ((USItype)(v))); \
+ __w; })
+#endif /* __clipper__ */
+
+/* Fujitsu vector computers. */
+#if defined (__uxp__) && W_TYPE_SIZE == 32
+#define umul_ppmm(ph, pl, u, v) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __asm__ ("mult.lu %1,%2,%0" : "=r" (__x.__ll) : "%r" (u), "rK" (v));\
+ (ph) = __x.__i.__h; \
+ (pl) = __x.__i.__l; \
+ } while (0)
+#define smul_ppmm(ph, pl, u, v) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __asm__ ("mult.l %1,%2,%0" : "=r" (__x.__ll) : "%r" (u), "rK" (v)); \
+ (ph) = __x.__i.__h; \
+ (pl) = __x.__i.__l; \
+ } while (0)
+#endif
+
+#if defined (__gmicro__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add.w %5,%1\n\taddx %3,%0" \
+ : "=g" (sh), "=&g" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "%1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub.w %5,%1\n\tsubx %3,%0" \
+ : "=g" (sh), "=&g" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define umul_ppmm(ph, pl, m0, m1) \
+ __asm__ ("mulx %3,%0,%1" \
+ : "=g" (ph), "=r" (pl) \
+ : "%0" ((USItype)(m0)), "g" ((USItype)(m1)))
+#define udiv_qrnnd(q, r, nh, nl, d) \
+ __asm__ ("divx %4,%0,%1" \
+ : "=g" (q), "=r" (r) \
+ : "1" ((USItype)(nh)), "0" ((USItype)(nl)), "g" ((USItype)(d)))
+#define count_leading_zeros(count, x) \
+ __asm__ ("bsch/1 %1,%0" \
+ : "=g" (count) : "g" ((USItype)(x)), "0" ((USItype)0))
+#endif
+
+#if defined (__hppa) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add%I5 %5,%r4,%1\n\taddc %r2,%r3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rM" (ah), "rM" (bh), "%rM" (al), "rI" (bl))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub%I4 %4,%r5,%1\n\tsubb %r2,%r3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rM" (ah), "rM" (bh), "rI" (al), "rM" (bl))
+#if defined (_PA_RISC1_1)
+#define umul_ppmm(wh, wl, u, v) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __asm__ ("xmpyu %1,%2,%0" : "=*f" (__x.__ll) : "*f" (u), "*f" (v)); \
+ (wh) = __x.__i.__h; \
+ (wl) = __x.__i.__l; \
+ } while (0)
+#define UMUL_TIME 8
+#define UDIV_TIME 60
+#else
+#define UMUL_TIME 40
+#define UDIV_TIME 80
+#endif
+#define count_leading_zeros(count, x) \
+ do { \
+ USItype __tmp; \
+ __asm__ ( \
+ "ldi 1,%0\n" \
+" extru,= %1,15,16,%%r0 ; Bits 31..16 zero?\n" \
+" extru,tr %1,15,16,%1 ; No. Shift down, skip add.\n" \
+" ldo 16(%0),%0 ; Yes. Perform add.\n" \
+" extru,= %1,23,8,%%r0 ; Bits 15..8 zero?\n" \
+" extru,tr %1,23,8,%1 ; No. Shift down, skip add.\n" \
+" ldo 8(%0),%0 ; Yes. Perform add.\n" \
+" extru,= %1,27,4,%%r0 ; Bits 7..4 zero?\n" \
+" extru,tr %1,27,4,%1 ; No. Shift down, skip add.\n" \
+" ldo 4(%0),%0 ; Yes. Perform add.\n" \
+" extru,= %1,29,2,%%r0 ; Bits 3..2 zero?\n" \
+" extru,tr %1,29,2,%1 ; No. Shift down, skip add.\n" \
+" ldo 2(%0),%0 ; Yes. Perform add.\n" \
+" extru %1,30,1,%1 ; Extract bit 1.\n" \
+" sub %0,%1,%0 ; Subtract it.\n" \
+ : "=r" (count), "=r" (__tmp) : "1" (x)); \
+ } while (0)
+#endif /* hppa */
+
+/* These macros are for ABI=2.0w. In ABI=2.0n they can't be used, since GCC
+ (3.2) puts longlong into two adjacent 32-bit registers. Presumably this
+ is just a case of no direct support for 2.0n but treating it like 1.0. */
+#if defined (__hppa) && W_TYPE_SIZE == 64 && ! defined (_LONG_LONG_LIMB)
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add%I5 %5,%r4,%1\n\tadd,dc %r2,%r3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rM" (ah), "rM" (bh), "%rM" (al), "rI" (bl))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub%I4 %4,%r5,%1\n\tsub,db %r2,%r3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rM" (ah), "rM" (bh), "rI" (al), "rM" (bl))
+#endif /* hppa */
+
+#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32
+#define smul_ppmm(xh, xl, m0, m1) \
+ do { \
+ union {DItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __asm__ ("lr %N0,%1\n\tmr %0,%2" \
+ : "=&r" (__x.__ll) \
+ : "r" (m0), "r" (m1)); \
+ (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
+ } while (0)
+#define sdiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ union {DItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __x.__i.__h = n1; __x.__i.__l = n0; \
+ __asm__ ("dr %0,%2" \
+ : "=r" (__x.__ll) \
+ : "0" (__x.__ll), "r" (d)); \
+ (q) = __x.__i.__l; (r) = __x.__i.__h; \
+ } while (0)
+#endif
+
+#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addl %5,%k1\n\tadcl %3,%k0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "%1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subl %5,%k1\n\tsbbl %3,%k0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("mull %3" \
+ : "=a" (w0), "=d" (w1) \
+ : "%0" ((USItype)(u)), "rm" ((USItype)(v)))
+#define udiv_qrnnd(q, r, n1, n0, dx) /* d renamed to dx avoiding "=d" */\
+ __asm__ ("divl %4" /* stringification in K&R C */ \
+ : "=a" (q), "=d" (r) \
+ : "0" ((USItype)(n0)), "1" ((USItype)(n1)), "rm" ((USItype)(dx)))
+
+#if HAVE_HOST_CPU_i586 || HAVE_HOST_CPU_pentium || HAVE_HOST_CPU_pentiummmx
+/* Pentium bsrl takes between 10 and 72 cycles depending where the most
+ significant 1 bit is, hence the use of the following alternatives. bsfl
+ is slow too, between 18 and 42 depending where the least significant 1
+ bit is, so let the generic count_trailing_zeros below make use of the
+ count_leading_zeros here too. */
+
+#if HAVE_HOST_CPU_pentiummmx && ! defined (LONGLONG_STANDALONE)
+/* The following should be a fixed 14 or 15 cycles, but possibly plus an L1
+ cache miss reading from __clz_tab. For P55 it's favoured over the float
+ below so as to avoid mixing MMX and x87, since the penalty for switching
+ between the two is about 100 cycles.
+
+ The asm block sets __shift to -3 if the high 24 bits are clear, -2 for
+ 16, -1 for 8, or 0 otherwise. This could be written equivalently as
+ follows, but as of gcc 2.95.2 it results in conditional jumps.
+
+ __shift = -(__n < 0x1000000);
+ __shift -= (__n < 0x10000);
+ __shift -= (__n < 0x100);
+
+ The middle two sbbl and cmpl's pair, and with luck something gcc
+ generates might pair with the first cmpl and the last sbbl. The "32+1"
+ constant could be folded into __clz_tab[], but it doesn't seem worth
+ making a different table just for that. */
+
+#define count_leading_zeros(c,n) \
+ do { \
+ USItype __n = (n); \
+ USItype __shift; \
+ __asm__ ("cmpl $0x1000000, %1\n" \
+ "sbbl %0, %0\n" \
+ "cmpl $0x10000, %1\n" \
+ "sbbl $0, %0\n" \
+ "cmpl $0x100, %1\n" \
+ "sbbl $0, %0\n" \
+ : "=&r" (__shift) : "r" (__n)); \
+ __shift = __shift*8 + 24 + 1; \
+ (c) = 32 + 1 - __shift - __clz_tab[__n >> __shift]; \
+ } while (0)
+#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
+#define COUNT_LEADING_ZEROS_0 31 /* n==0 indistinguishable from n==1 */
+
+#else /* ! pentiummmx || LONGLONG_STANDALONE */
+/* The following should be a fixed 14 cycles or so. Some scheduling
+ opportunities should be available between the float load/store too. This
+ sort of code is used in gcc 3 for __builtin_ffs (with "n&-n") and is
+ apparently suggested by the Intel optimizing manual (don't know exactly
+ where). gcc 2.95 or up will be best for this, so the "double" is
+ correctly aligned on the stack. */
+#define count_leading_zeros(c,n) \
+ do { \
+ union { \
+ double d; \
+ unsigned a[2]; \
+ } __u; \
+ ASSERT ((n) != 0); \
+ __u.d = (UWtype) (n); \
+ (c) = 0x3FF + 31 - (__u.a[1] >> 20); \
+ } while (0)
+#define COUNT_LEADING_ZEROS_0 (0x3FF + 31)
+#endif /* pentiummx */
+
+#else /* ! pentium */
+
+#if __GMP_GNUC_PREREQ (3,4) /* using bsrl */
+#define count_leading_zeros(count,x) count_leading_zeros_gcc_clz(count,x)
+#endif /* gcc clz */
+
+/* On P6, gcc prior to 3.0 generates a partial register stall for
+ __cbtmp^31, due to using "xorb $31" instead of "xorl $31", the former
+ being 1 code byte smaller. "31-__cbtmp" is a workaround, probably at the
+ cost of one extra instruction. Do this for "i386" too, since that means
+ generic x86. */
+#if ! defined (count_leading_zeros) && __GNUC__ < 3 \
+ && (HAVE_HOST_CPU_i386 \
+ || HAVE_HOST_CPU_i686 \
+ || HAVE_HOST_CPU_pentiumpro \
+ || HAVE_HOST_CPU_pentium2 \
+ || HAVE_HOST_CPU_pentium3)
+#define count_leading_zeros(count, x) \
+ do { \
+ USItype __cbtmp; \
+ ASSERT ((x) != 0); \
+ __asm__ ("bsrl %1,%0" : "=r" (__cbtmp) : "rm" ((USItype)(x))); \
+ (count) = 31 - __cbtmp; \
+ } while (0)
+#endif /* gcc<3 asm bsrl */
+
+#ifndef count_leading_zeros
+#define count_leading_zeros(count, x) \
+ do { \
+ USItype __cbtmp; \
+ ASSERT ((x) != 0); \
+ __asm__ ("bsrl %1,%0" : "=r" (__cbtmp) : "rm" ((USItype)(x))); \
+ (count) = __cbtmp ^ 31; \
+ } while (0)
+#endif /* asm bsrl */
+
+#if __GMP_GNUC_PREREQ (3,4) /* using bsfl */
+#define count_trailing_zeros(count,x) count_trailing_zeros_gcc_ctz(count,x)
+#endif /* gcc ctz */
+
+#ifndef count_trailing_zeros
+#define count_trailing_zeros(count, x) \
+ do { \
+ ASSERT ((x) != 0); \
+ __asm__ ("bsfl %1,%k0" : "=r" (count) : "rm" ((USItype)(x))); \
+ } while (0)
+#endif /* asm bsfl */
+
+#endif /* ! pentium */
+
+#ifndef UMUL_TIME
+#define UMUL_TIME 10
+#endif
+#ifndef UDIV_TIME
+#define UDIV_TIME 40
+#endif
+#endif /* 80x86 */
+
+#if defined (__amd64__) && W_TYPE_SIZE == 64
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addq %5,%q1\n\tadcq %3,%q0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((UDItype)(ah)), "rme" ((UDItype)(bh)), \
+ "%1" ((UDItype)(al)), "rme" ((UDItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subq %5,%q1\n\tsbbq %3,%q0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((UDItype)(ah)), "rme" ((UDItype)(bh)), \
+ "1" ((UDItype)(al)), "rme" ((UDItype)(bl)))
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("mulq %3" \
+ : "=a" (w0), "=d" (w1) \
+ : "%0" ((UDItype)(u)), "rm" ((UDItype)(v)))
+#define udiv_qrnnd(q, r, n1, n0, dx) /* d renamed to dx avoiding "=d" */\
+ __asm__ ("divq %4" /* stringification in K&R C */ \
+ : "=a" (q), "=d" (r) \
+ : "0" ((UDItype)(n0)), "1" ((UDItype)(n1)), "rm" ((UDItype)(dx)))
+/* bsrq destination must be a 64-bit register, hence UDItype for __cbtmp. */
+#define count_leading_zeros(count, x) \
+ do { \
+ UDItype __cbtmp; \
+ ASSERT ((x) != 0); \
+ __asm__ ("bsrq %1,%0" : "=r" (__cbtmp) : "rm" ((UDItype)(x))); \
+ (count) = __cbtmp ^ 63; \
+ } while (0)
+/* bsfq destination must be a 64-bit register, "%q0" forces this in case
+ count is only an int. */
+#define count_trailing_zeros(count, x) \
+ do { \
+ ASSERT ((x) != 0); \
+ __asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x))); \
+ } while (0)
+#endif /* x86_64 */
+
+#if defined (__i860__) && W_TYPE_SIZE == 32
+#define rshift_rhlc(r,h,l,c) \
+ __asm__ ("shr %3,r0,r0\;shrd %1,%2,%0" \
+ "=r" (r) : "r" (h), "r" (l), "rn" (c))
+#endif /* i860 */
+
+#if defined (__i960__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("cmpo 1,0\;addc %5,%4,%1\;addc %3,%2,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "dI" (ah), "dI" (bh), "%dI" (al), "dI" (bl))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("cmpo 0,0\;subc %5,%4,%1\;subc %3,%2,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "dI" (ah), "dI" (bh), "dI" (al), "dI" (bl))
+#define umul_ppmm(w1, w0, u, v) \
+ ({union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __x; \
+ __asm__ ("emul %2,%1,%0" \
+ : "=d" (__x.__ll) : "%dI" (u), "dI" (v)); \
+ (w1) = __x.__i.__h; (w0) = __x.__i.__l;})
+#define __umulsidi3(u, v) \
+ ({UDItype __w; \
+ __asm__ ("emul %2,%1,%0" : "=d" (__w) : "%dI" (u), "dI" (v)); \
+ __w; })
+#define udiv_qrnnd(q, r, nh, nl, d) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __nn; \
+ __nn.__i.__h = (nh); __nn.__i.__l = (nl); \
+ __asm__ ("ediv %d,%n,%0" \
+ : "=d" (__rq.__ll) : "dI" (__nn.__ll), "dI" (d)); \
+ (r) = __rq.__i.__l; (q) = __rq.__i.__h; \
+ } while (0)
+#define count_leading_zeros(count, x) \
+ do { \
+ USItype __cbtmp; \
+ __asm__ ("scanbit %1,%0" : "=r" (__cbtmp) : "r" (x)); \
+ (count) = __cbtmp ^ 31; \
+ } while (0)
+#define COUNT_LEADING_ZEROS_0 (-32) /* sic */
+#if defined (__i960mx) /* what is the proper symbol to test??? */
+#define rshift_rhlc(r,h,l,c) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __nn; \
+ __nn.__i.__h = (h); __nn.__i.__l = (l); \
+ __asm__ ("shre %2,%1,%0" : "=d" (r) : "dI" (__nn.__ll), "dI" (c)); \
+ }
+#endif /* i960mx */
+#endif /* i960 */
+
+#if (defined (__mc68000__) || defined (__mc68020__) || defined(mc68020) \
+ || defined (__m68k__) || defined (__mc5200__) || defined (__mc5206e__) \
+ || defined (__mc5307__)) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \
+ : "=d" (sh), "=&d" (sl) \
+ : "0" ((USItype)(ah)), "d" ((USItype)(bh)), \
+ "%1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub%.l %5,%1\n\tsubx%.l %3,%0" \
+ : "=d" (sh), "=&d" (sl) \
+ : "0" ((USItype)(ah)), "d" ((USItype)(bh)), \
+ "1" ((USItype)(al)), "g" ((USItype)(bl)))
+/* The '020, '030, '040 and CPU32 have 32x32->64 and 64/32->32q-32r. */
+#if defined (__mc68020__) || defined(mc68020) \
+ || defined (__mc68030__) || defined (mc68030) \
+ || defined (__mc68040__) || defined (mc68040) \
+ || defined (__mcpu32__) || defined (mcpu32) \
+ || defined (__NeXT__)
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("mulu%.l %3,%1:%0" \
+ : "=d" (w0), "=d" (w1) \
+ : "%0" ((USItype)(u)), "dmi" ((USItype)(v)))
+#define UMUL_TIME 45
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ __asm__ ("divu%.l %4,%1:%0" \
+ : "=d" (q), "=d" (r) \
+ : "0" ((USItype)(n0)), "1" ((USItype)(n1)), "dmi" ((USItype)(d)))
+#define UDIV_TIME 90
+#define sdiv_qrnnd(q, r, n1, n0, d) \
+ __asm__ ("divs%.l %4,%1:%0" \
+ : "=d" (q), "=d" (r) \
+ : "0" ((USItype)(n0)), "1" ((USItype)(n1)), "dmi" ((USItype)(d)))
+#else /* for other 68k family members use 16x16->32 multiplication */
+#define umul_ppmm(xh, xl, a, b) \
+ do { USItype __umul_tmp1, __umul_tmp2; \
+ __asm__ ("| Inlined umul_ppmm\n" \
+" move%.l %5,%3\n" \
+" move%.l %2,%0\n" \
+" move%.w %3,%1\n" \
+" swap %3\n" \
+" swap %0\n" \
+" mulu%.w %2,%1\n" \
+" mulu%.w %3,%0\n" \
+" mulu%.w %2,%3\n" \
+" swap %2\n" \
+" mulu%.w %5,%2\n" \
+" add%.l %3,%2\n" \
+" jcc 1f\n" \
+" add%.l %#0x10000,%0\n" \
+"1: move%.l %2,%3\n" \
+" clr%.w %2\n" \
+" swap %2\n" \
+" swap %3\n" \
+" clr%.w %3\n" \
+" add%.l %3,%1\n" \
+" addx%.l %2,%0\n" \
+" | End inlined umul_ppmm" \
+ : "=&d" (xh), "=&d" (xl), \
+ "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
+ : "%2" ((USItype)(a)), "d" ((USItype)(b))); \
+ } while (0)
+#define UMUL_TIME 100
+#define UDIV_TIME 400
+#endif /* not mc68020 */
+/* The '020, '030, '040 and '060 have bitfield insns.
+ GCC 3.4 defines __mc68020__ when in CPU32 mode, check for __mcpu32__ to
+ exclude bfffo on that chip (bitfield insns not available). */
+#if (defined (__mc68020__) || defined (mc68020) \
+ || defined (__mc68030__) || defined (mc68030) \
+ || defined (__mc68040__) || defined (mc68040) \
+ || defined (__mc68060__) || defined (mc68060) \
+ || defined (__NeXT__)) \
+ && ! defined (__mcpu32__)
+#define count_leading_zeros(count, x) \
+ __asm__ ("bfffo %1{%b2:%b2},%0" \
+ : "=d" (count) \
+ : "od" ((USItype) (x)), "n" (0))
+#define COUNT_LEADING_ZEROS_0 32
+#endif
+#endif /* mc68000 */
+
+#if defined (__m88000__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rJ" (ah), "rJ" (bh), "%rJ" (al), "rJ" (bl))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subu.co %1,%r4,%r5\n\tsubu.ci %0,%r2,%r3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rJ" (ah), "rJ" (bh), "rJ" (al), "rJ" (bl))
+#define count_leading_zeros(count, x) \
+ do { \
+ USItype __cbtmp; \
+ __asm__ ("ff1 %0,%1" : "=r" (__cbtmp) : "r" (x)); \
+ (count) = __cbtmp ^ 31; \
+ } while (0)
+#define COUNT_LEADING_ZEROS_0 63 /* sic */
+#if defined (__m88110__)
+#define umul_ppmm(wh, wl, u, v) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __asm__ ("mulu.d %0,%1,%2" : "=r" (__x.__ll) : "r" (u), "r" (v)); \
+ (wh) = __x.__i.__h; \
+ (wl) = __x.__i.__l; \
+ } while (0)
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ ({union {UDItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x, __q; \
+ __x.__i.__h = (n1); __x.__i.__l = (n0); \
+ __asm__ ("divu.d %0,%1,%2" \
+ : "=r" (__q.__ll) : "r" (__x.__ll), "r" (d)); \
+ (r) = (n0) - __q.__l * (d); (q) = __q.__l; })
+#define UMUL_TIME 5
+#define UDIV_TIME 25
+#else
+#define UMUL_TIME 17
+#define UDIV_TIME 150
+#endif /* __m88110__ */
+#endif /* __m88000__ */
+
+#if defined (__mips) && W_TYPE_SIZE == 32
+#if __GMP_GNUC_PREREQ (4,4)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __ll = (UDItype)(u) * (v); \
+ w1 = __ll >> 32; \
+ w0 = __ll; \
+ } while (0)
+#endif
+#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7)
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+#endif
+#if !defined (umul_ppmm)
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("multu %2,%3\n\tmflo %0\n\tmfhi %1" \
+ : "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
+#endif
+#define UMUL_TIME 10
+#define UDIV_TIME 100
+#endif /* __mips */
+
+#if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
+#if __GMP_GNUC_PREREQ (4,4)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
+ __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
+ w1 = __ll >> 64; \
+ w0 = __ll; \
+ } while (0)
+#endif
+#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7)
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+#endif
+#if !defined (umul_ppmm)
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("dmultu %2,%3\n\tmflo %0\n\tmfhi %1" \
+ : "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
+#endif
+#define UMUL_TIME 20
+#define UDIV_TIME 140
+#endif /* __mips */
+
+#if defined (__mmix__) && W_TYPE_SIZE == 64
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("MULU %0,%2,%3" : "=r" (w0), "=z" (w1) : "r" (u), "r" (v))
+#endif
+
+#if defined (__ns32000__) && W_TYPE_SIZE == 32
+#define umul_ppmm(w1, w0, u, v) \
+ ({union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __x; \
+ __asm__ ("meid %2,%0" \
+ : "=g" (__x.__ll) \
+ : "%0" ((USItype)(u)), "g" ((USItype)(v))); \
+ (w1) = __x.__i.__h; (w0) = __x.__i.__l;})
+#define __umulsidi3(u, v) \
+ ({UDItype __w; \
+ __asm__ ("meid %2,%0" \
+ : "=g" (__w) \
+ : "%0" ((USItype)(u)), "g" ((USItype)(v))); \
+ __w; })
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ ({union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __x; \
+ __x.__i.__h = (n1); __x.__i.__l = (n0); \
+ __asm__ ("deid %2,%0" \
+ : "=g" (__x.__ll) \
+ : "0" (__x.__ll), "g" ((USItype)(d))); \
+ (r) = __x.__i.__l; (q) = __x.__i.__h; })
+#define count_trailing_zeros(count,x) \
+ do { \
+ __asm__ ("ffsd %2,%0" \
+ : "=r" (count) \
+ : "0" ((USItype) 0), "r" ((USItype) (x))); \
+ } while (0)
+#endif /* __ns32000__ */
+
+/* In the past we had a block of various #defines tested
+ _ARCH_PPC - AIX
+ _ARCH_PWR - AIX
+ __powerpc__ - gcc
+ __POWERPC__ - BEOS
+ __ppc__ - Darwin
+ PPC - old gcc, GNU/Linux, SysV
+ The plain PPC test was not good for vxWorks, since PPC is defined on all
+ CPUs there (eg. m68k too), as a constant one is expected to compare
+ CPU_FAMILY against.
+
+ At any rate, this was pretty unattractive and a bit fragile. The use of
+ HAVE_HOST_CPU_FAMILY is designed to cut through it all and be sure of
+ getting the desired effect.
+
+ ENHANCE-ME: We should test _IBMR2 here when we add assembly support for
+ the system vendor compilers. (Is that vendor compilers with inline asm,
+ or what?) */
+
+#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc) \
+ && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ do { \
+ if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
+ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
+ else \
+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
+ } while (0)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ if (__builtin_constant_p (ah) && (ah) == 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
+ else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
+ else if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
+ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
+ else \
+ __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
+ } while (0)
+#define count_leading_zeros(count, x) \
+ __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x))
+#define COUNT_LEADING_ZEROS_0 32
+#if HAVE_HOST_CPU_FAMILY_powerpc
+#if __GMP_GNUC_PREREQ (4,4)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __ll = (UDItype)(u) * (v); \
+ w1 = __ll >> 32; \
+ w0 = __ll; \
+ } while (0)
+#endif
+#if !defined (umul_ppmm)
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ USItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#endif
+#define UMUL_TIME 15
+#define smul_ppmm(ph, pl, m0, m1) \
+ do { \
+ SItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("mulhw %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#define SMUL_TIME 14
+#define UDIV_TIME 120
+#else
+#define UMUL_TIME 8
+#define smul_ppmm(xh, xl, m0, m1) \
+ __asm__ ("mul %0,%2,%3" : "=r" (xh), "=q" (xl) : "r" (m0), "r" (m1))
+#define SMUL_TIME 4
+#define sdiv_qrnnd(q, r, nh, nl, d) \
+ __asm__ ("div %0,%2,%4" : "=r" (q), "=q" (r) : "r" (nh), "1" (nl), "r" (d))
+#define UDIV_TIME 100
+#endif
+#endif /* 32-bit POWER architecture variants. */
+
+/* We should test _IBMR2 here when we add assembly support for the system
+ vendor compilers. */
+#if HAVE_HOST_CPU_FAMILY_powerpc && W_TYPE_SIZE == 64
+#if !defined (_LONG_LONG_LIMB)
+/* _LONG_LONG_LIMB is ABI=mode32 where adde operates on 32-bit values. So
+ use adde etc only when not _LONG_LONG_LIMB. */
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ do { \
+ if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
+ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
+ else \
+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
+ } while (0)
+/* We use "*rI" for the constant operand here, since with just "I", gcc barfs.
+ This might seem strange, but gcc folds away the dead code late. */
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) { \
+ if (__builtin_constant_p (ah) && (ah) == 0) \
+ __asm__ ("{ai|addic} %1,%3,%4\n\t{sfze|subfze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \
+ else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
+ __asm__ ("{ai|addic} %1,%3,%4\n\t{sfme|subfme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \
+ else if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("{ai|addic} %1,%3,%4\n\t{ame|addme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \
+ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
+ __asm__ ("{ai|addic} %1,%3,%4\n\t{aze|addze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \
+ else \
+ __asm__ ("{ai|addic} %1,%4,%5\n\t{sfe|subfe} %0,%3,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "rI" (al), "*rI" (-bl)); \
+ } else { \
+ if (__builtin_constant_p (ah) && (ah) == 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
+ else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
+ else if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
+ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
+ else \
+ __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
+ } \
+ } while (0)
+#endif /* ! _LONG_LONG_LIMB */
+#define count_leading_zeros(count, x) \
+ __asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x))
+#define COUNT_LEADING_ZEROS_0 64
+#if __GMP_GNUC_PREREQ (4,4)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
+ __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
+ w1 = __ll >> 64; \
+ w0 = __ll; \
+ } while (0)
+#endif
+#if !defined (umul_ppmm)
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UDItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#endif
+#define UMUL_TIME 15
+#define smul_ppmm(ph, pl, m0, m1) \
+ do { \
+ DItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#define SMUL_TIME 14 /* ??? */
+#define UDIV_TIME 120 /* ??? */
+#endif /* 64-bit PowerPC. */
+
+#if defined (__pyr__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addw %5,%1\n\taddwc %3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "%1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subw %5,%1\n\tsubwb %3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "1" ((USItype)(al)), "g" ((USItype)(bl)))
+/* This insn works on Pyramids with AP, XP, or MI CPUs, but not with SP. */
+#define umul_ppmm(w1, w0, u, v) \
+ ({union {UDItype __ll; \
+ struct {USItype __h, __l;} __i; \
+ } __x; \
+ __asm__ ("movw %1,%R0\n\tuemul %2,%0" \
+ : "=&r" (__x.__ll) \
+ : "g" ((USItype) (u)), "g" ((USItype)(v))); \
+ (w1) = __x.__i.__h; (w0) = __x.__i.__l;})
+#endif /* __pyr__ */
+
+#if defined (__ibm032__) /* RT/ROMP */ && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("a %1,%5\n\tae %0,%3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((USItype)(ah)), "r" ((USItype)(bh)), \
+ "%1" ((USItype)(al)), "r" ((USItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("s %1,%5\n\tse %0,%3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((USItype)(ah)), "r" ((USItype)(bh)), \
+ "1" ((USItype)(al)), "r" ((USItype)(bl)))
+#define smul_ppmm(ph, pl, m0, m1) \
+ __asm__ ( \
+ "s r2,r2\n" \
+" mts r10,%2\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" m r2,%3\n" \
+" cas %0,r2,r0\n" \
+" mfs r10,%1" \
+ : "=r" (ph), "=r" (pl) \
+ : "%r" ((USItype)(m0)), "r" ((USItype)(m1)) \
+ : "r2")
+#define UMUL_TIME 20
+#define UDIV_TIME 200
+#define count_leading_zeros(count, x) \
+ do { \
+ if ((x) >= 0x10000) \
+ __asm__ ("clz %0,%1" \
+ : "=r" (count) : "r" ((USItype)(x) >> 16)); \
+ else \
+ { \
+ __asm__ ("clz %0,%1" \
+ : "=r" (count) : "r" ((USItype)(x))); \
+ (count) += 16; \
+ } \
+ } while (0)
+#endif /* RT/ROMP */
+
+#if defined (__sh2__) && W_TYPE_SIZE == 32
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0" \
+ : "=r" (w1), "=r" (w0) : "r" (u), "r" (v) : "macl", "mach")
+#define UMUL_TIME 5
+#endif
+
+#if defined (__sparc__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addcc %r4,%5,%1\n\taddx %r2,%3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rJ" (ah), "rI" (bh),"%rJ" (al), "rI" (bl) \
+ __CLOBBER_CC)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subcc %r4,%5,%1\n\tsubx %r2,%3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl) \
+ __CLOBBER_CC)
+/* Note: the following FIXME comes from GMP, thus it does make sense to try
+ to resolve it in MPFR. */
+/* FIXME: When gcc -mcpu=v9 is used on solaris, gcc/config/sol2-sld-64.h
+ doesn't define anything to indicate that to us, it only sets __sparcv8. */
+#if defined (__sparc_v9__) || defined (__sparcv9)
+/* Perhaps we should use floating-point operations here? */
+#if 0
+/* Triggers a bug making mpz/tests/t-gcd.c fail.
+ Perhaps we simply need explicitly zero-extend the inputs? */
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("mulx %2,%3,%%g1; srl %%g1,0,%1; srlx %%g1,32,%0" : \
+ "=r" (w1), "=r" (w0) : "r" (u), "r" (v) : "g1")
+#else
+/* Use v8 umul until above bug is fixed. */
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (w1), "=r" (w0) : "r" (u), "r" (v))
+#endif
+/* Use a plain v8 divide for v9. */
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ USItype __q; \
+ __asm__ ("mov %1,%%y;nop;nop;nop;udiv %2,%3,%0" \
+ : "=r" (__q) : "r" (n1), "r" (n0), "r" (d)); \
+ (r) = (n0) - __q * (d); \
+ (q) = __q; \
+ } while (0)
+#else
+#if defined (__sparc_v8__) /* gcc normal */ \
+ || defined (__sparcv8) /* gcc solaris */ \
+ || HAVE_HOST_CPU_supersparc
+/* Don't match immediate range because, 1) it is not often useful,
+ 2) the 'I' flag thinks of the range as a 13 bit signed interval,
+ while we want to match a 13 bit interval, sign extended to 32 bits,
+ but INTERPRETED AS UNSIGNED. */
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (w1), "=r" (w0) : "r" (u), "r" (v))
+#define UMUL_TIME 5
+
+#if HAVE_HOST_CPU_supersparc
+#define UDIV_TIME 60 /* SuperSPARC timing */
+#else
+/* Don't use this on SuperSPARC because its udiv only handles 53 bit
+ dividends and will trap to the kernel for the rest. */
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ USItype __q; \
+ __asm__ ("mov %1,%%y;nop;nop;nop;udiv %2,%3,%0" \
+ : "=r" (__q) : "r" (n1), "r" (n0), "r" (d)); \
+ (r) = (n0) - __q * (d); \
+ (q) = __q; \
+ } while (0)
+#define UDIV_TIME 25
+#endif /* HAVE_HOST_CPU_supersparc */
+
+#else /* ! __sparc_v8__ */
+#if defined (__sparclite__)
+/* This has hardware multiply but not divide. It also has two additional
+ instructions scan (ffs from high bit) and divscc. */
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("umul %2,%3,%1;rd %%y,%0" : "=r" (w1), "=r" (w0) : "r" (u), "r" (v))
+#define UMUL_TIME 5
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ __asm__ ("! Inlined udiv_qrnnd\n" \
+" wr %%g0,%2,%%y ! Not a delayed write for sparclite\n" \
+" tst %%g0\n" \
+" divscc %3,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%%g1\n" \
+" divscc %%g1,%4,%0\n" \
+" rd %%y,%1\n" \
+" bl,a 1f\n" \
+" add %1,%4,%1\n" \
+"1: ! End of inline udiv_qrnnd" \
+ : "=r" (q), "=r" (r) : "r" (n1), "r" (n0), "rI" (d) \
+ : "%g1" __AND_CLOBBER_CC)
+#define UDIV_TIME 37
+#define count_leading_zeros(count, x) \
+ __asm__ ("scan %1,1,%0" : "=r" (count) : "r" (x))
+/* Early sparclites return 63 for an argument of 0, but they warn that future
+ implementations might change this. Therefore, leave COUNT_LEADING_ZEROS_0
+ undefined. */
+#endif /* __sparclite__ */
+#endif /* __sparc_v8__ */
+#endif /* __sparc_v9__ */
+/* Default to sparc v7 versions of umul_ppmm and udiv_qrnnd. */
+#ifndef umul_ppmm
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("! Inlined umul_ppmm\n" \
+" wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr\n" \
+" sra %3,31,%%g2 ! Don't move this insn\n" \
+" and %2,%%g2,%%g2 ! Don't move this insn\n" \
+" andcc %%g0,0,%%g1 ! Don't move this insn\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,%3,%%g1\n" \
+" mulscc %%g1,0,%%g1\n" \
+" add %%g1,%%g2,%0\n" \
+" rd %%y,%1" \
+ : "=r" (w1), "=r" (w0) : "%rI" (u), "r" (v) \
+ : "%g1", "%g2" __AND_CLOBBER_CC)
+#define UMUL_TIME 39 /* 39 instructions */
+#endif
+#ifndef udiv_qrnnd
+#ifndef LONGLONG_STANDALONE
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { UWtype __r; \
+ (q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
+ (r) = __r; \
+ } while (0)
+extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
+#ifndef UDIV_TIME
+#define UDIV_TIME 140
+#endif
+#endif /* LONGLONG_STANDALONE */
+#endif /* udiv_qrnnd */
+#endif /* __sparc__ */
+
+#if defined (__sparc__) && W_TYPE_SIZE == 64
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ( \
+ "addcc %r4,%5,%1\n" \
+ " addccc %r6,%7,%%g0\n" \
+ " addc %r2,%3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl), \
+ "%rJ" ((al) >> 32), "rI" ((bl) >> 32) \
+ __CLOBBER_CC)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ( \
+ "subcc %r4,%5,%1\n" \
+ " subccc %r6,%7,%%g0\n" \
+ " subc %r2,%3,%0" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl), \
+ "rJ" ((al) >> 32), "rI" ((bl) >> 32) \
+ __CLOBBER_CC)
+#endif
+
+#if defined (__vax__) && W_TYPE_SIZE == 32
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("addl2 %5,%1\n\tadwc %3,%0" \
+ : "=g" (sh), "=&g" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "%1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subl2 %5,%1\n\tsbwc %3,%0" \
+ : "=g" (sh), "=&g" (sl) \
+ : "0" ((USItype)(ah)), "g" ((USItype)(bh)), \
+ "1" ((USItype)(al)), "g" ((USItype)(bl)))
+#define smul_ppmm(xh, xl, m0, m1) \
+ do { \
+ union {UDItype __ll; \
+ struct {USItype __l, __h;} __i; \
+ } __x; \
+ USItype __m0 = (m0), __m1 = (m1); \
+ __asm__ ("emul %1,%2,$0,%0" \
+ : "=g" (__x.__ll) : "g" (__m0), "g" (__m1)); \
+ (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
+ } while (0)
+#define sdiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ union {DItype __ll; \
+ struct {SItype __l, __h;} __i; \
+ } __x; \
+ __x.__i.__h = n1; __x.__i.__l = n0; \
+ __asm__ ("ediv %3,%2,%0,%1" \
+ : "=g" (q), "=g" (r) : "g" (__x.__ll), "g" (d)); \
+ } while (0)
+#if 0
+/* Note: the following FIXME comes from GMP, thus it does make sense to try
+ to resolve it in MPFR. */
+/* FIXME: This instruction appears to be unimplemented on some systems (vax
+ 8800 maybe). */
+#define count_trailing_zeros(count,x) \
+ do { \
+ __asm__ ("ffs 0, 31, %1, %0" \
+ : "=g" (count) \
+ : "g" ((USItype) (x))); \
+ } while (0)
+#endif
+#endif /* __vax__ */
+
+#if defined (__z8000__) && W_TYPE_SIZE == 16
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add %H1,%H5\n\tadc %H0,%H3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((unsigned int)(ah)), "r" ((unsigned int)(bh)), \
+ "%1" ((unsigned int)(al)), "rQR" ((unsigned int)(bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub %H1,%H5\n\tsbc %H0,%H3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "0" ((unsigned int)(ah)), "r" ((unsigned int)(bh)), \
+ "1" ((unsigned int)(al)), "rQR" ((unsigned int)(bl)))
+#define umul_ppmm(xh, xl, m0, m1) \
+ do { \
+ union {long int __ll; \
+ struct {unsigned int __h, __l;} __i; \
+ } __x; \
+ unsigned int __m0 = (m0), __m1 = (m1); \
+ __asm__ ("mult %S0,%H3" \
+ : "=r" (__x.__i.__h), "=r" (__x.__i.__l) \
+ : "%1" (m0), "rQR" (m1)); \
+ (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
+ (xh) += ((((signed int) __m0 >> 15) & __m1) \
+ + (((signed int) __m1 >> 15) & __m0)); \
+ } while (0)
+#endif /* __z8000__ */
+
+#endif /* __GNUC__ */
+
+#endif /* NO_ASM */
+
+
+#if !defined (umul_ppmm) && defined (__umulsidi3)
+#define umul_ppmm(ph, pl, m0, m1) \
+ { \
+ UDWtype __ll = __umulsidi3 (m0, m1); \
+ ph = (UWtype) (__ll >> W_TYPE_SIZE); \
+ pl = (UWtype) __ll; \
+ }
+#endif
+
+#if !defined (__umulsidi3)
+#define __umulsidi3(u, v) \
+ ({UWtype __hi, __lo; \
+ umul_ppmm (__hi, __lo, u, v); \
+ ((UDWtype) __hi << W_TYPE_SIZE) | __lo; })
+#endif
+
+
+/* Use mpn_umul_ppmm or mpn_udiv_qrnnd functions, if they exist. The "_r"
+ forms have "reversed" arguments, meaning the pointer is last, which
+ sometimes allows better parameter passing, in particular on 64-bit
+ hppa. */
+
+#define mpn_umul_ppmm __MPN(umul_ppmm)
+extern UWtype mpn_umul_ppmm _PROTO ((UWtype *, UWtype, UWtype));
+
+#if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm \
+ && ! defined (LONGLONG_STANDALONE)
+#define umul_ppmm(wh, wl, u, v) \
+ do { \
+ UWtype __umul_ppmm__p0; \
+ (wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v)); \
+ (wl) = __umul_ppmm__p0; \
+ } while (0)
+#endif
+
+#define mpn_umul_ppmm_r __MPN(umul_ppmm_r)
+extern UWtype mpn_umul_ppmm_r _PROTO ((UWtype, UWtype, UWtype *));
+
+#if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm_r \
+ && ! defined (LONGLONG_STANDALONE)
+#define umul_ppmm(wh, wl, u, v) \
+ do { \
+ UWtype __umul_ppmm__p0; \
+ (wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_ppmm__p0); \
+ (wl) = __umul_ppmm__p0; \
+ } while (0)
+#endif
+
+#define mpn_udiv_qrnnd __MPN(udiv_qrnnd)
+extern UWtype mpn_udiv_qrnnd _PROTO ((UWtype *, UWtype, UWtype, UWtype));
+
+#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd \
+ && ! defined (LONGLONG_STANDALONE)
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ UWtype __udiv_qrnnd__r; \
+ (q) = mpn_udiv_qrnnd (&__udiv_qrnnd__r, \
+ (UWtype) (n1), (UWtype) (n0), (UWtype) d); \
+ (r) = __udiv_qrnnd__r; \
+ } while (0)
+#endif
+
+#define mpn_udiv_qrnnd_r __MPN(udiv_qrnnd_r)
+extern UWtype mpn_udiv_qrnnd_r _PROTO ((UWtype, UWtype, UWtype, UWtype *));
+
+#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd_r \
+ && ! defined (LONGLONG_STANDALONE)
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ UWtype __udiv_qrnnd__r; \
+ (q) = mpn_udiv_qrnnd_r ((UWtype) (n1), (UWtype) (n0), (UWtype) d, \
+ &__udiv_qrnnd__r); \
+ (r) = __udiv_qrnnd__r; \
+ } while (0)
+#endif
+
+
+/* If this machine has no inline assembler, use C macros. */
+
+#if !defined (add_ssaaaa)
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ do { \
+ UWtype __x; \
+ __x = (al) + (bl); \
+ (sh) = (ah) + (bh) + (__x < (al)); \
+ (sl) = __x; \
+ } while (0)
+#endif
+
+#if !defined (sub_ddmmss)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ do { \
+ UWtype __x; \
+ __x = (al) - (bl); \
+ (sh) = (ah) - (bh) - ((al) < (bl)); \
+ (sl) = __x; \
+ } while (0)
+#endif
+
+/* If we lack umul_ppmm but have smul_ppmm, define umul_ppmm in terms of
+ smul_ppmm. */
+#if !defined (umul_ppmm) && defined (smul_ppmm)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UWtype __w1; \
+ UWtype __xm0 = (u), __xm1 = (v); \
+ smul_ppmm (__w1, w0, __xm0, __xm1); \
+ (w1) = __w1 + (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \
+ + (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \
+ } while (0)
+#endif
+
+/* If we still don't have umul_ppmm, define it using plain C.
+
+ For reference, when this code is used for squaring (ie. u and v identical
+ expressions), gcc recognises __x1 and __x2 are the same and generates 3
+ multiplies, not 4. The subsequent additions could be optimized a bit,
+ but the only place GMP currently uses such a square is mpn_sqr_basecase,
+ and chips obliged to use this generic C umul will have plenty of worse
+ performance problems than a couple of extra instructions on the diagonal
+ of sqr_basecase. */
+
+#if !defined (umul_ppmm)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UWtype __x0, __x1, __x2, __x3; \
+ UHWtype __ul, __vl, __uh, __vh; \
+ UWtype __u = (u), __v = (v); \
+ \
+ __ul = __ll_lowpart (__u); \
+ __uh = __ll_highpart (__u); \
+ __vl = __ll_lowpart (__v); \
+ __vh = __ll_highpart (__v); \
+ \
+ __x0 = (UWtype) __ul * __vl; \
+ __x1 = (UWtype) __ul * __vh; \
+ __x2 = (UWtype) __uh * __vl; \
+ __x3 = (UWtype) __uh * __vh; \
+ \
+ __x1 += __ll_highpart (__x0);/* this can't give carry */ \
+ __x1 += __x2; /* but this indeed can */ \
+ if (__x1 < __x2) /* did we get it? */ \
+ __x3 += __ll_B; /* yes, add it in the proper pos. */ \
+ \
+ (w1) = __x3 + __ll_highpart (__x1); \
+ (w0) = (__x1 << W_TYPE_SIZE/2) + __ll_lowpart (__x0); \
+ } while (0)
+#endif
+
+/* If we don't have smul_ppmm, define it using umul_ppmm (which surely will
+ exist in one form or another. */
+#if !defined (smul_ppmm)
+#define smul_ppmm(w1, w0, u, v) \
+ do { \
+ UWtype __w1; \
+ UWtype __xm0 = (u), __xm1 = (v); \
+ umul_ppmm (__w1, w0, __xm0, __xm1); \
+ (w1) = __w1 - (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \
+ - (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \
+ } while (0)
+#endif
+
+/* Define this unconditionally, so it can be used for debugging. */
+#define __udiv_qrnnd_c(q, r, n1, n0, d) \
+ do { \
+ UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \
+ \
+ ASSERT ((d) != 0); \
+ ASSERT ((n1) < (d)); \
+ \
+ __d1 = __ll_highpart (d); \
+ __d0 = __ll_lowpart (d); \
+ \
+ __q1 = (n1) / __d1; \
+ __r1 = (n1) - __q1 * __d1; \
+ __m = __q1 * __d0; \
+ __r1 = __r1 * __ll_B | __ll_highpart (n0); \
+ if (__r1 < __m) \
+ { \
+ __q1--, __r1 += (d); \
+ if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\
+ if (__r1 < __m) \
+ __q1--, __r1 += (d); \
+ } \
+ __r1 -= __m; \
+ \
+ __q0 = __r1 / __d1; \
+ __r0 = __r1 - __q0 * __d1; \
+ __m = __q0 * __d0; \
+ __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
+ if (__r0 < __m) \
+ { \
+ __q0--, __r0 += (d); \
+ if (__r0 >= (d)) \
+ if (__r0 < __m) \
+ __q0--, __r0 += (d); \
+ } \
+ __r0 -= __m; \
+ \
+ (q) = __q1 * __ll_B | __q0; \
+ (r) = __r0; \
+ } while (0)
+
+/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through
+ __udiv_w_sdiv (defined in libgcc or elsewhere). */
+#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd)
+#define udiv_qrnnd(q, r, nh, nl, d) \
+ do { \
+ UWtype __r; \
+ (q) = __MPN(udiv_w_sdiv) (&__r, nh, nl, d); \
+ (r) = __r; \
+ } while (0)
+#endif
+
+/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */
+#if !defined (udiv_qrnnd)
+#define UDIV_NEEDS_NORMALIZATION 1
+#define udiv_qrnnd __udiv_qrnnd_c
+#endif
+
+#if !defined (count_leading_zeros)
+#define count_leading_zeros(count, x) \
+ do { \
+ UWtype __xr = (x); \
+ UWtype __a; \
+ \
+ if (W_TYPE_SIZE == 32) \
+ { \
+ __a = __xr < ((UWtype) 1 << 2*__BITS4) \
+ ? (__xr < ((UWtype) 1 << __BITS4) ? 1 : __BITS4 + 1) \
+ : (__xr < ((UWtype) 1 << 3*__BITS4) ? 2*__BITS4 + 1 \
+ : 3*__BITS4 + 1); \
+ } \
+ else \
+ { \
+ for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \
+ if (((__xr >> __a) & 0xff) != 0) \
+ break; \
+ ++__a; \
+ } \
+ \
+ (count) = W_TYPE_SIZE + 1 - __a - __clz_tab[__xr >> __a]; \
+ } while (0)
+/* This version gives a well-defined value for zero. */
+#define COUNT_LEADING_ZEROS_0 (W_TYPE_SIZE - 1)
+#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
+#endif
+
+/* clz_tab needed by mpn/x86/pentium/mod_1.asm in a fat binary */
+#if HAVE_HOST_CPU_FAMILY_x86 && WANT_FAT_BINARY
+#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
+#endif
+
+#ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
+# ifdef MPFR_HAVE_GMP_IMPL
+ extern const unsigned char __GMP_DECLSPEC __clz_tab[128];
+# else
+ extern const unsigned char __clz_tab[128];
+# endif
+#endif
+
+#if !defined (count_trailing_zeros)
+/* Define count_trailing_zeros using count_leading_zeros. The latter might be
+ defined in asm, but if it is not, the C version above is good enough. */
+#define count_trailing_zeros(count, x) \
+ do { \
+ UWtype __ctz_x = (x); \
+ UWtype __ctz_c; \
+ ASSERT (__ctz_x != 0); \
+ count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \
+ (count) = W_TYPE_SIZE - 1 - __ctz_c; \
+ } while (0)
+#endif
+
+#ifndef UDIV_NEEDS_NORMALIZATION
+#define UDIV_NEEDS_NORMALIZATION 0
+#endif
+
+/* Whether udiv_qrnnd is actually implemented with udiv_qrnnd_preinv, and
+ that hence the latter should always be used. */
+#ifndef UDIV_PREINV_ALWAYS
+#define UDIV_PREINV_ALWAYS 0
+#endif
+
+/* Give defaults for UMUL_TIME and UDIV_TIME. */
+#ifndef UMUL_TIME
+#define UMUL_TIME 1
+#endif
+
+#ifndef UDIV_TIME
+#define UDIV_TIME UMUL_TIME
+#endif
diff --git a/src/mpfr-thread.h b/src/mpfr-thread.h
new file mode 100644
index 0000000..5dd137b
--- /dev/null
+++ b/src/mpfr-thread.h
@@ -0,0 +1,48 @@
+/* MPFR internal header related to thread-local variables.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_THREAD_H__
+#define __MPFR_THREAD_H__
+
+/* Note: Let's define MPFR_THREAD_ATTR even after a #error to make the
+ error message more visible (e.g. gcc doesn't immediately stop after
+ the #error line and outputs many error messages if MPFR_THREAD_ATTR
+ is not defined). But some compilers will just output a message and
+ may build MPFR "successfully" (without thread support). */
+#ifndef MPFR_THREAD_ATTR
+# ifdef MPFR_USE_THREAD_SAFE
+# if defined(_MSC_VER)
+# if defined(_WINDLL)
+# error "Can't build MPFR DLL as thread safe."
+# define MPFR_THREAD_ATTR
+# else
+# define MPFR_THREAD_ATTR __declspec( thread )
+# endif
+# else
+# define MPFR_THREAD_ATTR __thread
+# endif
+# else
+# define MPFR_THREAD_ATTR
+# endif
+#endif
+
+#endif
diff --git a/src/mpfr.h b/src/mpfr.h
new file mode 100644
index 0000000..a3241dc
--- /dev/null
+++ b/src/mpfr.h
@@ -0,0 +1,1059 @@
+/* mpfr.h -- Include file for mpfr.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_H
+#define __MPFR_H
+
+/* Define MPFR version number */
+#define MPFR_VERSION_MAJOR 3
+#define MPFR_VERSION_MINOR 1
+#define MPFR_VERSION_PATCHLEVEL 2
+#define MPFR_VERSION_STRING "3.1.2"
+
+/* Macros dealing with MPFR VERSION */
+#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
+#define MPFR_VERSION \
+MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL)
+
+/* Check if GMP is included, and try to include it (Works with local GMP) */
+#ifndef __GMP_H__
+# include <gmp.h>
+#endif
+
+/* GMP's internal __gmp_const macro has been removed on 2012-03-04:
+ http://gmplib.org:8000/gmp/rev/d287cfaf6732
+ const is standard and now assumed to be available. If the __gmp_const
+ definition is no longer present in GMP, this probably means that GMP
+ assumes that const is available; thus let's define it to const.
+ Note: this is a temporary fix that can be backported to previous MPFR
+ versions. In the future, __gmp_const should be replaced by const like
+ in GMP. */
+#ifndef __gmp_const
+# define __gmp_const const
+#endif
+
+/* Avoid some problems with macro expansion if the user defines macros
+ with the same name as keywords. By convention, identifiers and macro
+ names starting with mpfr_ are reserved by MPFR. */
+typedef void mpfr_void;
+typedef int mpfr_int;
+typedef unsigned int mpfr_uint;
+typedef long mpfr_long;
+typedef unsigned long mpfr_ulong;
+typedef size_t mpfr_size_t;
+
+/* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
+ Warning! Changing the contents of this enum should be seen as an
+ interface change since the old and the new types are not compatible
+ (the integer type compatible with the enumerated type can even change,
+ see ISO C99, 6.7.2.2#4), and in Makefile.am, AGE should be set to 0.
+
+ MPFR_RNDU must appear just before MPFR_RNDD (see
+ MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h).
+
+ MPFR_RNDF has been added, though not implemented yet, in order to avoid
+ to break the ABI once faithful rounding gets implemented.
+
+ If you change the order of the rounding modes, please update the routines
+ in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA.
+*/
+typedef enum {
+ MPFR_RNDN=0, /* round to nearest, with ties to even */
+ MPFR_RNDZ, /* round toward zero */
+ MPFR_RNDU, /* round toward +Inf */
+ MPFR_RNDD, /* round toward -Inf */
+ MPFR_RNDA, /* round away from zero */
+ MPFR_RNDF, /* faithful rounding (not implemented yet) */
+ MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */
+} mpfr_rnd_t;
+
+/* kept for compatibility with MPFR 2.4.x and before */
+#define GMP_RNDN MPFR_RNDN
+#define GMP_RNDZ MPFR_RNDZ
+#define GMP_RNDU MPFR_RNDU
+#define GMP_RNDD MPFR_RNDD
+
+/* Note: With the following default choices for _MPFR_PREC_FORMAT and
+ _MPFR_EXP_FORMAT, mpfr_exp_t will be the same as [mp_exp_t] (at least
+ up to GMP 5). */
+
+/* Define precision: 1 (short), 2 (int) or 3 (long) (DON'T USE IT!) */
+#ifndef _MPFR_PREC_FORMAT
+# if __GMP_MP_SIZE_T_INT == 1
+# define _MPFR_PREC_FORMAT 2
+# else
+# define _MPFR_PREC_FORMAT 3
+# endif
+#endif
+
+/* Define exponent: 1 (short), 2 (int), 3 (long) or 4 (intmax_t)
+ (DON'T USE IT!) */
+#ifndef _MPFR_EXP_FORMAT
+# define _MPFR_EXP_FORMAT _MPFR_PREC_FORMAT
+#endif
+
+#if _MPFR_PREC_FORMAT > _MPFR_EXP_FORMAT
+# error "mpfr_prec_t must not be larger than mpfr_exp_t"
+#endif
+
+/* Let's make mpfr_prec_t signed in order to avoid problems due to the
+ usual arithmetic conversions when mixing mpfr_prec_t and mpfr_exp_t
+ in an expression (for error analysis) if casts are forgotten. */
+#if _MPFR_PREC_FORMAT == 1
+typedef short mpfr_prec_t;
+typedef unsigned short mpfr_uprec_t;
+#elif _MPFR_PREC_FORMAT == 2
+typedef int mpfr_prec_t;
+typedef unsigned int mpfr_uprec_t;
+#elif _MPFR_PREC_FORMAT == 3
+typedef long mpfr_prec_t;
+typedef unsigned long mpfr_uprec_t;
+#else
+# error "Invalid MPFR Prec format"
+#endif
+
+/* Definition of precision limits without needing <limits.h> */
+/* Note: the casts allows the expression to yield the wanted behavior
+ for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). */
+#define MPFR_PREC_MIN 2
+#define MPFR_PREC_MAX ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))
+
+/* Definition of sign */
+typedef int mpfr_sign_t;
+
+/* Definition of the exponent. _MPFR_EXP_FORMAT must be large enough
+ so that mpfr_exp_t has at least 32 bits. */
+#if _MPFR_EXP_FORMAT == 1
+typedef short mpfr_exp_t;
+typedef unsigned short mpfr_uexp_t;
+#elif _MPFR_EXP_FORMAT == 2
+typedef int mpfr_exp_t;
+typedef unsigned int mpfr_uexp_t;
+#elif _MPFR_EXP_FORMAT == 3
+typedef long mpfr_exp_t;
+typedef unsigned long mpfr_uexp_t;
+#elif _MPFR_EXP_FORMAT == 4
+/* Note: in this case, intmax_t and uintmax_t must be defined before
+ the inclusion of mpfr.h (we do not include <stdint.h> here because
+ of some non-ISO C99 implementations that support these types). */
+typedef intmax_t mpfr_exp_t;
+typedef uintmax_t mpfr_uexp_t;
+#else
+# error "Invalid MPFR Exp format"
+#endif
+
+/* Definition of the standard exponent limits */
+#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((mpfr_ulong) 1 << 30) - 1))
+#define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT))
+
+/* DON'T USE THIS! (For MPFR-public macros only, see below.)
+ The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO
+ are the smallest values. */
+#define __MPFR_EXP_MAX ((mpfr_exp_t) (((mpfr_uexp_t) -1) >> 1))
+#define __MPFR_EXP_NAN (1 - __MPFR_EXP_MAX)
+#define __MPFR_EXP_ZERO (0 - __MPFR_EXP_MAX)
+#define __MPFR_EXP_INF (2 - __MPFR_EXP_MAX)
+
+/* Definition of the main structure */
+typedef struct {
+ mpfr_prec_t _mpfr_prec;
+ mpfr_sign_t _mpfr_sign;
+ mpfr_exp_t _mpfr_exp;
+ mp_limb_t *_mpfr_d;
+} __mpfr_struct;
+
+/* Compatibility with previous types of MPFR */
+#ifndef mp_rnd_t
+# define mp_rnd_t mpfr_rnd_t
+#endif
+#ifndef mp_prec_t
+# define mp_prec_t mpfr_prec_t
+#endif
+
+/*
+ The represented number is
+ _sign*(_d[k-1]/B+_d[k-2]/B^2+...+_d[0]/B^k)*2^_exp
+ where k=ceil(_mp_prec/GMP_NUMB_BITS) and B=2^GMP_NUMB_BITS.
+
+ For the msb (most significant bit) normalized representation, we must have
+ _d[k-1]>=B/2, unless the number is singular.
+
+ We must also have the last k*GMP_NUMB_BITS-_prec bits set to zero.
+*/
+
+typedef __mpfr_struct mpfr_t[1];
+typedef __mpfr_struct *mpfr_ptr;
+typedef __gmp_const __mpfr_struct *mpfr_srcptr;
+
+/* For those who need a direct and fast access to the sign field.
+ However it is not in the API, thus use it at your own risk: it might
+ not be supported, or change name, in further versions!
+ Unfortunately, it must be defined here (instead of MPFR's internal
+ header file mpfr-impl.h) because it is used by some macros below.
+*/
+#define MPFR_SIGN(x) ((x)->_mpfr_sign)
+
+/* Stack interface */
+typedef enum {
+ MPFR_NAN_KIND = 0,
+ MPFR_INF_KIND = 1, MPFR_ZERO_KIND = 2, MPFR_REGULAR_KIND = 3
+} mpfr_kind_t;
+
+/* GMP defines:
+ + size_t: Standard size_t
+ + __GMP_ATTRIBUTE_PURE Attribute for math functions.
+ + __GMP_NOTHROW For C++: can't throw .
+ + __GMP_EXTERN_INLINE Attribute for inline function.
+ * __gmp_const const (Supports for K&R compiler only for mpfr.h).
+ + __GMP_DECLSPEC_EXPORT compiling to go into a DLL
+ + __GMP_DECLSPEC_IMPORT compiling to go into a application
+*/
+/* Extra MPFR defines */
+#define __MPFR_SENTINEL_ATTR
+#if defined (__GNUC__)
+# if __GNUC__ >= 4
+# undef __MPFR_SENTINEL_ATTR
+# define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel))
+# endif
+#endif
+
+/* Prototypes: Support of K&R compiler */
+#if defined (__GMP_PROTO)
+# define _MPFR_PROTO __GMP_PROTO
+#elif defined (__STDC__) || defined (__cplusplus)
+# define _MPFR_PROTO(x) x
+#else
+# define _MPFR_PROTO(x) ()
+#endif
+/* Support for WINDOWS Dll:
+ Check if we are inside a MPFR build, and if so export the functions.
+ Otherwise does the same thing as GMP */
+#if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL
+# define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT
+#else
+# define __MPFR_DECLSPEC __GMP_DECLSPEC
+#endif
+
+/* Use MPFR_DEPRECATED to mark MPFR functions, types or variables as
+ deprecated. Code inspired by Apache Subversion's svn_types.h file. */
+#if defined(__GNUC__) && \
+ (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+# define MPFR_DEPRECATED __attribute__ ((deprecated))
+#elif defined(_MSC_VER) && _MSC_VER >= 1300
+# define MPFR_DEPRECATED __declspec(deprecated)
+#else
+# define MPFR_DEPRECATED
+#endif
+
+/* Note: In order to be declared, some functions need a specific
+ system header to be included *before* "mpfr.h". If the user
+ forgets to include the header, the MPFR function prototype in
+ the user object file is not correct. To avoid wrong results,
+ we raise a linker error in that case by changing their internal
+ name in the library (prefixed by __gmpfr instead of mpfr). See
+ the lines of the form "#define mpfr_xxx __gmpfr_xxx" below. */
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+__MPFR_DECLSPEC __gmp_const char * mpfr_get_version _MPFR_PROTO ((void));
+__MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_buildopt_gmpinternals_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC __gmp_const char * mpfr_buildopt_tune_case _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t));
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void));
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void));
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t));
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void));
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t));
+__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void));
+__MPFR_DECLSPEC __gmp_const char *
+ mpfr_print_rnd_mode _MPFR_PROTO((mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_clear_flags _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_clear_underflow _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_clear_overflow _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_clear_divby0 _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_clear_nanflag _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_clear_inexflag _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_clear_erangeflag _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC void mpfr_set_underflow _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_set_overflow _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_set_divby0 _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_set_nanflag _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_set_inexflag _MPFR_PROTO ((void));
+__MPFR_DECLSPEC void mpfr_set_erangeflag _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC int mpfr_underflow_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_overflow_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_divby0_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_nanflag_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_inexflag_p _MPFR_PROTO ((void));
+__MPFR_DECLSPEC int mpfr_erangeflag_p _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC int
+ mpfr_check_range _MPFR_PROTO ((mpfr_ptr, int, mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_init2 _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t));
+__MPFR_DECLSPEC void mpfr_init _MPFR_PROTO ((mpfr_ptr));
+__MPFR_DECLSPEC void mpfr_clear _MPFR_PROTO ((mpfr_ptr));
+
+__MPFR_DECLSPEC void
+ mpfr_inits2 _MPFR_PROTO ((mpfr_prec_t, mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
+__MPFR_DECLSPEC void
+ mpfr_inits _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
+__MPFR_DECLSPEC void
+ mpfr_clears _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR;
+
+__MPFR_DECLSPEC int
+ mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t,
+ mpfr_prec_t));
+__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t));
+__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr));
+__MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
+__MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t));
+__MPFR_DECLSPEC void mpfr_set_default_prec _MPFR_PROTO((mpfr_prec_t));
+__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec _MPFR_PROTO((void));
+
+__MPFR_DECLSPEC int mpfr_set_d _MPFR_PROTO ((mpfr_ptr, double, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_set_flt _MPFR_PROTO ((mpfr_ptr, float, mpfr_rnd_t));
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+__MPFR_DECLSPEC int mpfr_set_decimal64 _MPFR_PROTO ((mpfr_ptr, _Decimal64,
+ mpfr_rnd_t));
+#endif
+__MPFR_DECLSPEC int
+ mpfr_set_ld _MPFR_PROTO ((mpfr_ptr, long double, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t));
+__MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr));
+__MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int));
+__MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int));
+__MPFR_DECLSPEC int
+ mpfr_set_f _MPFR_PROTO ((mpfr_ptr, mpf_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_get_f _MPFR_PROTO ((mpf_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_init_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set4 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int));
+__MPFR_DECLSPEC int
+ mpfr_abs _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_neg _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_signbit _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC int
+ mpfr_setsign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_copysign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr));
+__MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 _MPFR_PROTO ((mpfr_srcptr,
+ mpfr_rnd_t));
+#endif
+__MPFR_DECLSPEC long double mpfr_get_ld _MPFR_PROTO ((mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC double mpfr_get_d1 _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC double mpfr_get_d_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_frexp _MPFR_PROTO ((mpfr_exp_t*, mpfr_ptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_free_str _MPFR_PROTO ((char *));
+
+__MPFR_DECLSPEC int mpfr_urandom _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_grandom _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, gmp_randstate_t,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_urandomb _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t));
+
+__MPFR_DECLSPEC void mpfr_nextabove _MPFR_PROTO ((mpfr_ptr));
+__MPFR_DECLSPEC void mpfr_nextbelow _MPFR_PROTO ((mpfr_ptr));
+__MPFR_DECLSPEC void mpfr_nexttoward _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...));
+__MPFR_DECLSPEC int mpfr_asprintf _MPFR_PROTO ((char**, __gmp_const char*,
+ ...));
+__MPFR_DECLSPEC int mpfr_sprintf _MPFR_PROTO ((char*, __gmp_const char*,
+ ...));
+__MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t,
+ __gmp_const char*, ...));
+
+__MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_pow_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_pow_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_ui_pow_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
+ unsigned long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_ui_pow _MPFR_PROTO ((mpfr_ptr, unsigned long int,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_pow_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpz_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sqrt_ui _MPFR_PROTO ((mpfr_ptr, unsigned long,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_rec_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_add _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_mul _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_add_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_ui_sub _MPFR_PROTO ((mpfr_ptr, unsigned long,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_mul_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_ui_div _MPFR_PROTO ((mpfr_ptr, unsigned long,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_add_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_si_sub _MPFR_PROTO ((mpfr_ptr, long int,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_mul_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long int, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_si_div _MPFR_PROTO ((mpfr_ptr, long int,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_add_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ double, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ double, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_d_sub _MPFR_PROTO ((mpfr_ptr, double,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_mul_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ double, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ double, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_d_div _MPFR_PROTO ((mpfr_ptr, double,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_sqr _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_const_pi _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_const_log2 _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_const_euler _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_const_catalan _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_agm _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_log _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_log2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_log10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_log1p _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_exp2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_exp10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_expm1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_eint _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_li2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_cmp _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_cmp3 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, int));
+__MPFR_DECLSPEC int mpfr_cmp_d _MPFR_PROTO ((mpfr_srcptr, double));
+__MPFR_DECLSPEC int mpfr_cmp_ld _MPFR_PROTO ((mpfr_srcptr, long double));
+__MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long));
+__MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long));
+__MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long,
+ mpfr_exp_t));
+__MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long,
+ mpfr_exp_t));
+__MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr,
+ unsigned long));
+__MPFR_DECLSPEC int mpfr_sgn _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_mul_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_mul_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ unsigned long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_mul_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ long, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_rint _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_round _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_trunc _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_ceil _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_floor _MPFR_PROTO((mpfr_ptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_rint_round _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_rint_trunc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_rint_ceil _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_rint_floor _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_frac _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_modf _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_remquo _MPFR_PROTO ((mpfr_ptr, long*, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_remainder _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fmod _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_fits_ulong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_slong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_uint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_sint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_ushort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_sshort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_uintmax_p _MPFR_PROTO((mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fits_intmax_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_extract _MPFR_PROTO ((mpz_ptr, mpfr_srcptr,
+ unsigned int));
+__MPFR_DECLSPEC void mpfr_swap _MPFR_PROTO ((mpfr_ptr, mpfr_ptr));
+__MPFR_DECLSPEC void mpfr_dump _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_nan_p _MPFR_PROTO((mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_inf_p _MPFR_PROTO((mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_number_p _MPFR_PROTO((mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_integer_p _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_zero_p _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_regular_p _MPFR_PROTO ((mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_greater_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_greaterequal_p _MPFR_PROTO ((mpfr_srcptr,
+ mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_less_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_lessequal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_lessgreater_p _MPFR_PROTO((mpfr_srcptr,mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_equal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+__MPFR_DECLSPEC int mpfr_unordered_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr));
+
+__MPFR_DECLSPEC int mpfr_atanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_acosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_asinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_cosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_tanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sinh_cosh _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
+ mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_sech _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_csch _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_coth _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_acos _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_asin _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_atan _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sin _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sin_cos _MPFR_PROTO ((mpfr_ptr, mpfr_ptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_cos _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_tan _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_atan2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sec _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_csc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_cot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_hypot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_erf _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_erfc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_cbrt _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_root _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,unsigned long,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_gamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_lngamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_lgamma _MPFR_PROTO((mpfr_ptr,int*,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_digamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_zeta _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_zeta_ui _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fac_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_j0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_j1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_jn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_y0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_y1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_yn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_ai _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_min _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_max _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_dim _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_mul_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpz_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpz_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_add_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpz_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpz_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_z_sub _MPFR_PROTO ((mpfr_ptr, mpz_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_cmp_z _MPFR_PROTO ((mpfr_srcptr, mpz_srcptr));
+
+__MPFR_DECLSPEC int mpfr_mul_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpq_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_div_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpq_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_add_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpq_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sub_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,
+ mpq_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_cmp_q _MPFR_PROTO ((mpfr_srcptr, mpq_srcptr));
+
+__MPFR_DECLSPEC int mpfr_cmp_f _MPFR_PROTO ((mpfr_srcptr, mpf_srcptr));
+
+__MPFR_DECLSPEC int mpfr_fma _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_sum _MPFR_PROTO ((mpfr_ptr, mpfr_ptr *__gmp_const,
+ unsigned long, mpfr_rnd_t));
+
+__MPFR_DECLSPEC void mpfr_free_cache _MPFR_PROTO ((void));
+
+__MPFR_DECLSPEC int mpfr_subnormalize _MPFR_PROTO ((mpfr_ptr, int,
+ mpfr_rnd_t));
+
+__MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *,
+ char **, int, mpfr_rnd_t));
+
+__MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t));
+__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t));
+__MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr));
+__MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *));
+__MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int,
+ mpfr_exp_t, mpfr_prec_t, void *));
+__MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr));
+
+#if defined (__cplusplus)
+}
+#endif
+
+/* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */
+#ifndef MPFR_EXTENSION
+# if defined(MPFR_USE_EXTENSION)
+# define MPFR_EXTENSION __extension__
+# else
+# define MPFR_EXTENSION
+# endif
+#endif
+
+/* Warning! This macro doesn't work with K&R C (e.g., compare the "gcc -E"
+ output with and without -traditional) and shouldn't be used internally.
+ For public use only, but see the MPFR manual. */
+#define MPFR_DECL_INIT(_x, _p) \
+ MPFR_EXTENSION mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \
+ MPFR_EXTENSION mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}}
+
+/* Fast access macros to replace function interface.
+ If the USER don't want to use the macro interface, let him make happy
+ even if it produces faster and smaller code. */
+#ifndef MPFR_USE_NO_MACRO
+
+/* Inlining theses functions is both faster and smaller */
+#define mpfr_nan_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_NAN)
+#define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
+#define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
+#define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF)
+#define mpfr_sgn(_x) \
+ ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
+ (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (mpfr_void) 0), 0 : \
+ MPFR_SIGN (_x))
+
+/* Prevent them from using as lvalues */
+#define MPFR_VALUE_OF(x) (0 ? (x) : (x))
+#define mpfr_get_prec(_x) MPFR_VALUE_OF((_x)->_mpfr_prec)
+#define mpfr_get_exp(_x) MPFR_VALUE_OF((_x)->_mpfr_exp)
+/* Note: if need be, the MPFR_VALUE_OF can be used for other expressions
+ (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. */
+
+#define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA)
+#define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ)
+#define mpfr_ceil(a,b) mpfr_rint((a), (b), MPFR_RNDU)
+#define mpfr_floor(a,b) mpfr_rint((a), (b), MPFR_RNDD)
+
+#define mpfr_cmp_ui(b,i) mpfr_cmp_ui_2exp((b),(i),0)
+#define mpfr_cmp_si(b,i) mpfr_cmp_si_2exp((b),(i),0)
+#define mpfr_set(a,b,r) mpfr_set4(a,b,r,MPFR_SIGN(b))
+#define mpfr_abs(a,b,r) mpfr_set4(a,b,r,1)
+#define mpfr_copysign(a,b,c,r) mpfr_set4(a,b,r,MPFR_SIGN(c))
+#define mpfr_setsign(a,b,s,r) mpfr_set4(a,b,r,(s) ? -1 : 1)
+#define mpfr_signbit(x) (MPFR_SIGN(x) < 0)
+#define mpfr_cmp(b, c) mpfr_cmp3(b, c, 1)
+#define mpfr_mul_2exp(y,x,n,r) mpfr_mul_2ui((y),(x),(n),(r))
+#define mpfr_div_2exp(y,x,n,r) mpfr_div_2ui((y),(x),(n),(r))
+
+
+/* When using GCC, optimize certain common comparisons and affectations.
+ + Remove ICC since it defines __GNUC__ but produces a
+ huge number of warnings if you use this code.
+ VL: I couldn't reproduce a single warning when enabling these macros
+ with icc 10.1 20080212 on Itanium. But with this version, __ICC isn't
+ defined (__INTEL_COMPILER is, though), so that these macros are enabled
+ anyway. Checking with other ICC versions is needed. Possibly detect
+ whether warnings are produced or not with a configure test.
+ + Remove C++ too, since it complains too much. */
+/* Added casts to improve robustness in case of undefined behavior and
+ compiler extensions based on UB (in particular -fwrapv). MPFR doesn't
+ use such extensions, but these macros will be used by 3rd-party code,
+ where such extensions may be required.
+ Moreover casts to unsigned long have been added to avoid warnings in
+ programs that use MPFR and are compiled with -Wconversion; such casts
+ are OK since if X is a constant expression, then (unsigned long) X is
+ also a constant expression, so that the optimizations still work. The
+ warnings are probably related to the following two bugs:
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
+ and the casts could be removed once these bugs are fixed.
+ Casts shouldn't be used on the generic calls (to the ..._2exp functions),
+ where implicit conversions are performed. Indeed, having at least one
+ implicit conversion in the macro allows the compiler to emit diagnostics
+ when normally expected, for instance in the following call:
+ mpfr_set_ui (x, "foo", MPFR_RNDN);
+ If this is not possible (for future macros), one of the tricks described
+ on http://groups.google.com/group/comp.std.c/msg/e92abd24bf9eaf7b could
+ be used. */
+#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
+#if (__GNUC__ >= 2)
+#undef mpfr_cmp_ui
+/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
+ But warning! mpfr_sgn is specified as a macro in the API, thus the macro
+ mustn't be used if side effects are possible, like here. */
+#define mpfr_cmp_ui(_f,_u) \
+ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
+ (mpfr_sgn) (_f) : \
+ mpfr_cmp_ui_2exp ((_f), (_u), 0))
+#undef mpfr_cmp_si
+#define mpfr_cmp_si(_f,_s) \
+ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
+ mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \
+ mpfr_cmp_si_2exp ((_f), (_s), 0))
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
+#undef mpfr_set_ui
+#define mpfr_set_ui(_f,_u,_r) \
+ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
+ __extension__ ({ \
+ mpfr_ptr _p = (_f); \
+ _p->_mpfr_sign = 1; \
+ _p->_mpfr_exp = __MPFR_EXP_ZERO; \
+ (mpfr_void) (_r); 0; }) : \
+ mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
+#endif
+#undef mpfr_set_si
+#define mpfr_set_si(_f,_s,_r) \
+ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
+ mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
+ mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
+#endif
+#endif
+
+/* Macro version of mpfr_stack interface for fast access */
+#define mpfr_custom_get_size(p) ((mpfr_size_t) \
+ (((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t)))
+#define mpfr_custom_init(m,p) do {} while (0)
+#define mpfr_custom_get_significand(x) ((mpfr_void*)((x)->_mpfr_d))
+#define mpfr_custom_get_exp(x) ((x)->_mpfr_exp)
+#define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0)
+#define mpfr_custom_init_set(x,k,e,p,m) do { \
+ mpfr_ptr _x = (x); \
+ mpfr_exp_t _e; \
+ mpfr_kind_t _t; \
+ mpfr_int _s, _k; \
+ _k = (k); \
+ if (_k >= 0) { \
+ _t = (mpfr_kind_t) _k; \
+ _s = 1; \
+ } else { \
+ _t = (mpfr_kind_t) -k; \
+ _s = -1; \
+ } \
+ _e = _t == MPFR_REGULAR_KIND ? (e) : \
+ _t == MPFR_NAN_KIND ? __MPFR_EXP_NAN : \
+ _t == MPFR_INF_KIND ? __MPFR_EXP_INF : __MPFR_EXP_ZERO; \
+ _x->_mpfr_prec = (p); \
+ _x->_mpfr_sign = _s; \
+ _x->_mpfr_exp = _e; \
+ _x->_mpfr_d = (mp_limb_t*) (m); \
+ } while (0)
+#define mpfr_custom_get_kind(x) \
+ ( (x)->_mpfr_exp > __MPFR_EXP_INF ? \
+ (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \
+ : (x)->_mpfr_exp == __MPFR_EXP_INF ? \
+ (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \
+ : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
+ : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
+
+
+#endif /* MPFR_USE_NO_MACRO */
+
+/* Theses are defined to be macros */
+#define mpfr_init_set_si(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_si((x), (i), (rnd)) )
+#define mpfr_init_set_ui(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_ui((x), (i), (rnd)) )
+#define mpfr_init_set_d(x, d, rnd) \
+ ( mpfr_init(x), mpfr_set_d((x), (d), (rnd)) )
+#define mpfr_init_set_ld(x, d, rnd) \
+ ( mpfr_init(x), mpfr_set_ld((x), (d), (rnd)) )
+#define mpfr_init_set_z(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) )
+#define mpfr_init_set_q(x, i, rnd) \
+ ( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) )
+#define mpfr_init_set(x, y, rnd) \
+ ( mpfr_init(x), mpfr_set((x), (y), (rnd)) )
+#define mpfr_init_set_f(x, y, rnd) \
+ ( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) )
+
+/* Compatibility layer -- obsolete functions and macros */
+/* Note: it is not possible to output warnings, unless one defines
+ * a deprecated variable and uses it, e.g.
+ * MPFR_DEPRECATED extern int mpfr_deprecated_feature;
+ * #define MPFR_EMIN_MIN ((void)mpfr_deprecated_feature,mpfr_get_emin_min())
+ * (the cast to void avoids a warning because the left-hand operand
+ * has no effect).
+ */
+#define mpfr_cmp_abs mpfr_cmpabs
+#define mpfr_round_prec(x,r,p) mpfr_prec_round(x,p,r)
+#define __gmp_default_rounding_mode (mpfr_get_default_rounding_mode())
+#define __mpfr_emin (mpfr_get_emin())
+#define __mpfr_emax (mpfr_get_emax())
+#define __mpfr_default_fp_bit_precision (mpfr_get_default_fp_bit_precision())
+#define MPFR_EMIN_MIN mpfr_get_emin_min()
+#define MPFR_EMIN_MAX mpfr_get_emin_max()
+#define MPFR_EMAX_MIN mpfr_get_emax_min()
+#define MPFR_EMAX_MAX mpfr_get_emax_max()
+#define mpfr_version (mpfr_get_version())
+#ifndef mpz_set_fr
+# define mpz_set_fr mpfr_get_z
+#endif
+#define mpfr_add_one_ulp(x,r) \
+ (mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x))
+#define mpfr_sub_one_ulp(x,r) \
+ (mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x))
+#define mpfr_get_z_exp mpfr_get_z_2exp
+#define mpfr_custom_get_mantissa mpfr_custom_get_significand
+
+#endif /* __MPFR_H */
+
+
+/* Check if <stdint.h> / <inttypes.h> is included or if the user
+ explicitly wants intmax_t. Automatical detection is done by
+ checking:
+ - INTMAX_C and UINTMAX_C, but not if the compiler is a C++ one
+ (as suggested by Patrick Pelissier) because the test does not
+ work well in this case. See:
+ https://sympa.inria.fr/sympa/arc/mpfr/2010-02/msg00025.html
+ We do not check INTMAX_MAX and UINTMAX_MAX because under Solaris,
+ these macros are always defined by <limits.h> (i.e. even when
+ <stdint.h> and <inttypes.h> are not included).
+ - _STDINT_H (defined by the glibc), _STDINT_H_ (defined under
+ Mac OS X) and _STDINT (defined under MS Visual Studio), but
+ this test may not work with all implementations.
+ Portable software should not rely on these tests.
+*/
+#if (defined (INTMAX_C) && defined (UINTMAX_C) && !defined(__cplusplus)) || \
+ defined (MPFR_USE_INTMAX_T) || \
+ defined (_STDINT_H) || defined (_STDINT_H_) || defined (_STDINT)
+# ifndef _MPFR_H_HAVE_INTMAX_T
+# define _MPFR_H_HAVE_INTMAX_T 1
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define mpfr_set_sj __gmpfr_set_sj
+#define mpfr_set_sj_2exp __gmpfr_set_sj_2exp
+#define mpfr_set_uj __gmpfr_set_uj
+#define mpfr_set_uj_2exp __gmpfr_set_uj_2exp
+#define mpfr_get_sj __gmpfr_mpfr_get_sj
+#define mpfr_get_uj __gmpfr_mpfr_get_uj
+__MPFR_DECLSPEC int mpfr_set_sj _MPFR_PROTO ((mpfr_t, intmax_t, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_sj_2exp _MPFR_PROTO ((mpfr_t, intmax_t, intmax_t, mpfr_rnd_t));
+__MPFR_DECLSPEC int mpfr_set_uj _MPFR_PROTO ((mpfr_t, uintmax_t, mpfr_rnd_t));
+__MPFR_DECLSPEC int
+ mpfr_set_uj_2exp _MPFR_PROTO ((mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t));
+__MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+__MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t));
+
+#if defined (__cplusplus)
+}
+#endif
+
+# endif /* _MPFR_H_HAVE_INTMAX_T */
+#endif
+
+
+/* Check if <stdio.h> has been included or if the user wants FILE */
+#if defined (_GMP_H_HAVE_FILE) || defined (MPFR_USE_FILE)
+# ifndef _MPFR_H_HAVE_FILE
+# define _MPFR_H_HAVE_FILE 1
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define mpfr_inp_str __gmpfr_inp_str
+#define mpfr_out_str __gmpfr_out_str
+__MPFR_DECLSPEC size_t mpfr_inp_str _MPFR_PROTO ((mpfr_ptr, FILE*, int,
+ mpfr_rnd_t));
+__MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t,
+ mpfr_srcptr, mpfr_rnd_t));
+#define mpfr_fprintf __gmpfr_fprintf
+__MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
+ ...));
+
+#if defined (__cplusplus)
+}
+#endif
+
+# endif /* _MPFR_H_HAVE_FILE */
+#endif
+
+
+/* check if <stdarg.h> has been included or if the user wants va_list */
+#if defined (_GMP_H_HAVE_VA_LIST) || defined (MPFR_USE_VA_LIST)
+# ifndef _MPFR_H_HAVE_VA_LIST
+# define _MPFR_H_HAVE_VA_LIST 1
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define mpfr_vprintf __gmpfr_vprintf
+#define mpfr_vasprintf __gmpfr_vasprintf
+#define mpfr_vsprintf __gmpfr_vsprintf
+#define mpfr_vsnprintf __gmpfr_vsnprintf
+__MPFR_DECLSPEC int mpfr_vprintf _MPFR_PROTO ((__gmp_const char*, va_list));
+__MPFR_DECLSPEC int mpfr_vasprintf _MPFR_PROTO ((char**, __gmp_const char*,
+ va_list));
+__MPFR_DECLSPEC int mpfr_vsprintf _MPFR_PROTO ((char*, __gmp_const char*,
+ va_list));
+__MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t,
+ __gmp_const char*, va_list));
+
+#if defined (__cplusplus)
+}
+#endif
+
+# endif /* _MPFR_H_HAVE_VA_LIST */
+#endif
+
+
+/* check if <stdarg.h> has been included and if FILE is available
+ (see above) */
+#if defined (_MPFR_H_HAVE_VA_LIST) && defined (_MPFR_H_HAVE_FILE)
+# ifndef _MPFR_H_HAVE_VA_LIST_FILE
+# define _MPFR_H_HAVE_VA_LIST_FILE 1
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define mpfr_vfprintf __gmpfr_vfprintf
+__MPFR_DECLSPEC int mpfr_vfprintf _MPFR_PROTO ((FILE*, __gmp_const char*,
+ va_list));
+
+#if defined (__cplusplus)
+}
+#endif
+
+# endif /* _MPFR_H_HAVE_VA_LIST_FILE */
+#endif
diff --git a/src/mpn_exp.c b/src/mpn_exp.c
new file mode 100644
index 0000000..63dcde9
--- /dev/null
+++ b/src/mpn_exp.c
@@ -0,0 +1,174 @@
+/* mpfr_mpn_exp -- auxiliary function for mpfr_get_str and mpfr_set_str
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* this function computes an approximation of b^e in {a, n}, with exponent
+ stored in exp_r. The computed value is rounded toward zero (truncated).
+ It returns an integer f such that the final error is bounded by 2^f ulps,
+ that is:
+ a*2^exp_r <= b^e <= 2^exp_r (a + 2^f),
+ where a represents {a, n}, i.e. the integer
+ a[0] + a[1]*B + ... + a[n-1]*B^(n-1) where B=2^GMP_NUMB_BITS
+
+ Return -1 is the result is exact.
+ Return -2 if an overflow occurred in the computation of exp_r.
+*/
+
+long
+mpfr_mpn_exp (mp_limb_t *a, mpfr_exp_t *exp_r, int b, mpfr_exp_t e, size_t n)
+{
+ mp_limb_t *c, B;
+ mpfr_exp_t f, h;
+ int i;
+ unsigned long t; /* number of bits in e */
+ unsigned long bits;
+ size_t n1;
+ unsigned int error; /* (number - 1) of loop a^2b inexact */
+ /* error == t means no error */
+ int err_s_a2 = 0;
+ int err_s_ab = 0; /* number of error when shift A^2, AB */
+ MPFR_TMP_DECL(marker);
+
+ MPFR_ASSERTN(e > 0);
+ MPFR_ASSERTN((2 <= b) && (b <= 62));
+
+ MPFR_TMP_MARK(marker);
+
+ /* initialization of a, b, f, h */
+
+ /* normalize the base */
+ B = (mp_limb_t) b;
+ count_leading_zeros (h, B);
+
+ bits = GMP_NUMB_BITS - h;
+
+ B = B << h;
+ h = - h;
+
+ /* allocate space for A and set it to B */
+ c = MPFR_TMP_LIMBS_ALLOC (2 * n);
+ a [n - 1] = B;
+ MPN_ZERO (a, n - 1);
+ /* initial exponent for A: invariant is A = {a, n} * 2^f */
+ f = h - (n - 1) * GMP_NUMB_BITS;
+
+ /* determine number of bits in e */
+ count_leading_zeros (t, (mp_limb_t) e);
+
+ t = GMP_NUMB_BITS - t; /* number of bits of exponent e */
+
+ error = t; /* error <= GMP_NUMB_BITS */
+
+ MPN_ZERO (c, 2 * n);
+
+ for (i = t - 2; i >= 0; i--)
+ {
+
+ /* determine precision needed */
+ bits = n * GMP_NUMB_BITS - mpn_scan1 (a, 0);
+ n1 = (n * GMP_NUMB_BITS - bits) / GMP_NUMB_BITS;
+
+ /* square of A : {c+2n1, 2(n-n1)} = {a+n1, n-n1}^2 */
+ mpn_sqr_n (c + 2 * n1, a + n1, n - n1);
+
+ /* set {c+n, 2n1-n} to 0 : {c, n} = {a, n}^2*K^n */
+
+ /* check overflow on f */
+ if (MPFR_UNLIKELY(f < MPFR_EXP_MIN/2 || f > MPFR_EXP_MAX/2))
+ {
+ overflow:
+ MPFR_TMP_FREE(marker);
+ return -2;
+ }
+ /* FIXME: Could f = 2*f + n * GMP_NUMB_BITS be used? */
+ f = 2*f;
+ MPFR_SADD_OVERFLOW (f, f, n * GMP_NUMB_BITS,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto overflow);
+ if ((c[2*n - 1] & MPFR_LIMB_HIGHBIT) == 0)
+ {
+ /* shift A by one bit to the left */
+ mpn_lshift (a, c + n, n, 1);
+ a[0] |= mpn_lshift (c + n - 1, c + n - 1, 1, 1);
+ f --;
+ if (error != t)
+ err_s_a2 ++;
+ }
+ else
+ MPN_COPY (a, c + n, n);
+
+ if ((error == t) && (2 * n1 <= n) &&
+ (mpn_scan1 (c + 2 * n1, 0) < (n - 2 * n1) * GMP_NUMB_BITS))
+ error = i;
+
+ if (e & ((mpfr_exp_t) 1 << i))
+ {
+ /* multiply A by B */
+ c[2 * n - 1] = mpn_mul_1 (c + n - 1, a, n, B);
+ f += h + GMP_NUMB_BITS;
+ if ((c[2 * n - 1] & MPFR_LIMB_HIGHBIT) == 0)
+ { /* shift A by one bit to the left */
+ mpn_lshift (a, c + n, n, 1);
+ a[0] |= mpn_lshift (c + n - 1, c + n - 1, 1, 1);
+ f --;
+ }
+ else
+ {
+ MPN_COPY (a, c + n, n);
+ if (error != t)
+ err_s_ab ++;
+ }
+ if ((error == t) && (c[n - 1] != 0))
+ error = i;
+ }
+ }
+
+ MPFR_TMP_FREE(marker);
+
+ *exp_r = f;
+
+ if (error == t)
+ return -1; /* result is exact */
+ else /* error <= t-2 <= GMP_NUMB_BITS-2
+ err_s_ab, err_s_a2 <= t-1 */
+ {
+ /* if there are p loops after the first inexact result, with
+ j shifts in a^2 and l shifts in a*b, then the final error is
+ at most 2^(p+ceil((j+1)/2)+l+1)*ulp(res).
+ This is bounded by 2^(5/2*t-1/2) where t is the number of bits of e.
+ */
+ error = error + err_s_ab + err_s_a2 / 2 + 3; /* <= 5t/2-1/2 */
+#if 0
+ if ((error - 1) >= ((n * GMP_NUMB_BITS - 1) / 2))
+ error = n * GMP_NUMB_BITS; /* result is completely wrong:
+ this is very unlikely since error is
+ at most 5/2*log_2(e), and
+ n * GMP_NUMB_BITS is at least
+ 3*log_2(e) */
+#endif
+ return error;
+ }
+}
diff --git a/src/mul.c b/src/mul.c
new file mode 100644
index 0000000..efbfdb1
--- /dev/null
+++ b/src/mul.c
@@ -0,0 +1,547 @@
+/* mpfr_mul -- multiply two floating-point numbers
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+
+/********* BEGINNING CHECK *************/
+
+/* Check if we have to check the result of mpfr_mul.
+ TODO: Find a better (and faster?) check than using old implementation */
+#ifdef WANT_ASSERT
+# if WANT_ASSERT >= 3
+
+int mpfr_mul2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode);
+static int
+mpfr_mul3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ /* Old implementation */
+ int sign_product, cc, inexact;
+ mpfr_exp_t ax;
+ mp_limb_t *tmp;
+ mp_limb_t b1;
+ mpfr_prec_t bq, cq;
+ mp_size_t bn, cn, tn, k;
+ MPFR_TMP_DECL(marker);
+
+ /* deal with special cases */
+ if (MPFR_ARE_SINGULAR(b,c))
+ {
+ if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c))
+ {
+ MPFR_SET_NAN(a);
+ MPFR_RET_NAN;
+ }
+ sign_product = MPFR_MULT_SIGN( MPFR_SIGN(b) , MPFR_SIGN(c) );
+ if (MPFR_IS_INF(b))
+ {
+ if (MPFR_IS_INF(c) || MPFR_NOTZERO(c))
+ {
+ MPFR_SET_SIGN(a,sign_product);
+ MPFR_SET_INF(a);
+ MPFR_RET(0); /* exact */
+ }
+ else
+ {
+ MPFR_SET_NAN(a);
+ MPFR_RET_NAN;
+ }
+ }
+ else if (MPFR_IS_INF(c))
+ {
+ if (MPFR_NOTZERO(b))
+ {
+ MPFR_SET_SIGN(a, sign_product);
+ MPFR_SET_INF(a);
+ MPFR_RET(0); /* exact */
+ }
+ else
+ {
+ MPFR_SET_NAN(a);
+ MPFR_RET_NAN;
+ }
+ }
+ else
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(b) || MPFR_IS_ZERO(c));
+ MPFR_SET_SIGN(a, sign_product);
+ MPFR_SET_ZERO(a);
+ MPFR_RET(0); /* 0 * 0 is exact */
+ }
+ }
+ sign_product = MPFR_MULT_SIGN( MPFR_SIGN(b) , MPFR_SIGN(c) );
+
+ ax = MPFR_GET_EXP (b) + MPFR_GET_EXP (c);
+
+ bq = MPFR_PREC (b);
+ cq = MPFR_PREC (c);
+
+ MPFR_ASSERTN ((mpfr_uprec_t) bq + cq <= MPFR_PREC_MAX);
+
+ bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */
+ cn = MPFR_PREC2LIMBS (cq); /* number of limbs of c */
+ k = bn + cn; /* effective nb of limbs used by b*c (= tn or tn+1) below */
+ tn = MPFR_PREC2LIMBS (bq + cq);
+ /* <= k, thus no int overflow */
+ MPFR_ASSERTD(tn <= k);
+
+ /* Check for no size_t overflow*/
+ MPFR_ASSERTD((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB);
+ MPFR_TMP_MARK(marker);
+ tmp = MPFR_TMP_LIMBS_ALLOC (k);
+
+ /* multiplies two mantissa in temporary allocated space */
+ b1 = (MPFR_LIKELY(bn >= cn)) ?
+ mpn_mul (tmp, MPFR_MANT(b), bn, MPFR_MANT(c), cn)
+ : mpn_mul (tmp, MPFR_MANT(c), cn, MPFR_MANT(b), bn);
+
+ /* now tmp[0]..tmp[k-1] contains the product of both mantissa,
+ with tmp[k-1]>=2^(GMP_NUMB_BITS-2) */
+ b1 >>= GMP_NUMB_BITS - 1; /* msb from the product */
+
+ /* if the mantissas of b and c are uniformly distributed in ]1/2, 1],
+ then their product is in ]1/4, 1/2] with probability 2*ln(2)-1 ~ 0.386
+ and in [1/2, 1] with probability 2-2*ln(2) ~ 0.614 */
+ tmp += k - tn;
+ if (MPFR_UNLIKELY(b1 == 0))
+ mpn_lshift (tmp, tmp, tn, 1); /* tn <= k, so no stack corruption */
+ cc = mpfr_round_raw (MPFR_MANT (a), tmp, bq + cq,
+ MPFR_IS_NEG_SIGN(sign_product),
+ MPFR_PREC (a), rnd_mode, &inexact);
+
+ /* cc = 1 ==> result is a power of two */
+ if (MPFR_UNLIKELY(cc))
+ MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] = MPFR_LIMB_HIGHBIT;
+
+ MPFR_TMP_FREE(marker);
+
+ {
+ mpfr_exp_t ax2 = ax + (mpfr_exp_t) (b1 - 1 + cc);
+ if (MPFR_UNLIKELY( ax2 > __gmpfr_emax))
+ return mpfr_overflow (a, rnd_mode, sign_product);
+ if (MPFR_UNLIKELY( ax2 < __gmpfr_emin))
+ {
+ /* In the rounding to the nearest mode, if the exponent of the exact
+ result (i.e. before rounding, i.e. without taking cc into account)
+ is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if
+ both arguments are powers of 2) in absolute value, then round to
+ zero. */
+ if (rnd_mode == MPFR_RNDN &&
+ (ax + (mpfr_exp_t) b1 < __gmpfr_emin ||
+ (mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (a, rnd_mode, sign_product);
+ }
+ MPFR_SET_EXP (a, ax2);
+ MPFR_SET_SIGN(a, sign_product);
+ }
+ MPFR_RET (inexact);
+}
+
+int
+mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t ta, tb, tc;
+ int inexact1, inexact2;
+
+ mpfr_init2 (ta, MPFR_PREC (a));
+ mpfr_init2 (tb, MPFR_PREC (b));
+ mpfr_init2 (tc, MPFR_PREC (c));
+ MPFR_ASSERTN (mpfr_set (tb, b, MPFR_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_set (tc, c, MPFR_RNDN) == 0);
+
+ inexact2 = mpfr_mul3 (ta, tb, tc, rnd_mode);
+ inexact1 = mpfr_mul2 (a, b, c, rnd_mode);
+ if (mpfr_cmp (ta, a) || inexact1*inexact2 < 0
+ || (inexact1*inexact2 == 0 && (inexact1|inexact2) != 0))
+ {
+ fprintf (stderr, "mpfr_mul return different values for %s\n"
+ "Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ",
+ mpfr_print_rnd_mode (rnd_mode),
+ MPFR_PREC (a), MPFR_PREC (b), MPFR_PREC (c));
+ mpfr_out_str (stderr, 16, 0, tb, MPFR_RNDN);
+ fprintf (stderr, "\nC = ");
+ mpfr_out_str (stderr, 16, 0, tc, MPFR_RNDN);
+ fprintf (stderr, "\nOldMul: ");
+ mpfr_out_str (stderr, 16, 0, ta, MPFR_RNDN);
+ fprintf (stderr, "\nNewMul: ");
+ mpfr_out_str (stderr, 16, 0, a, MPFR_RNDN);
+ fprintf (stderr, "\nNewInexact = %d | OldInexact = %d\n",
+ inexact1, inexact2);
+ MPFR_ASSERTN(0);
+ }
+
+ mpfr_clears (ta, tb, tc, (mpfr_ptr) 0);
+ return inexact1;
+}
+
+# define mpfr_mul mpfr_mul2
+# endif
+#endif
+
+/****** END OF CHECK *******/
+
+/* Multiply 2 mpfr_t */
+
+/* Note: mpfr_sqr will call mpfr_mul if bn > MPFR_SQR_THRESHOLD,
+ in order to use Mulders' mulhigh, which is handled only here
+ to avoid partial code duplication. There is some overhead due
+ to the additional tests, but slowdown should not be noticeable
+ as this code is not executed in very small precisions. */
+
+int
+mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int sign, inexact;
+ mpfr_exp_t ax, ax2;
+ mp_limb_t *tmp;
+ mp_limb_t b1;
+ mpfr_prec_t bq, cq;
+ mp_size_t bn, cn, tn, k, threshold;
+ MPFR_TMP_DECL (marker);
+
+ MPFR_LOG_FUNC
+ (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (b), mpfr_log_prec, b,
+ mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (a), mpfr_log_prec, a, inexact));
+
+ /* deal with special cases */
+ if (MPFR_ARE_SINGULAR (b, c))
+ {
+ if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c))
+ {
+ MPFR_SET_NAN (a);
+ MPFR_RET_NAN;
+ }
+ sign = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c));
+ if (MPFR_IS_INF (b))
+ {
+ if (!MPFR_IS_ZERO (c))
+ {
+ MPFR_SET_SIGN (a, sign);
+ MPFR_SET_INF (a);
+ MPFR_RET (0);
+ }
+ else
+ {
+ MPFR_SET_NAN (a);
+ MPFR_RET_NAN;
+ }
+ }
+ else if (MPFR_IS_INF (c))
+ {
+ if (!MPFR_IS_ZERO (b))
+ {
+ MPFR_SET_SIGN (a, sign);
+ MPFR_SET_INF (a);
+ MPFR_RET(0);
+ }
+ else
+ {
+ MPFR_SET_NAN (a);
+ MPFR_RET_NAN;
+ }
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO(b) || MPFR_IS_ZERO(c));
+ MPFR_SET_SIGN (a, sign);
+ MPFR_SET_ZERO (a);
+ MPFR_RET (0);
+ }
+ }
+ sign = MPFR_MULT_SIGN (MPFR_SIGN (b), MPFR_SIGN (c));
+
+ ax = MPFR_GET_EXP (b) + MPFR_GET_EXP (c);
+ /* Note: the exponent of the exact result will be e = bx + cx + ec with
+ ec in {-1,0,1} and the following assumes that e is representable. */
+
+ /* FIXME: Useful since we do an exponent check after ?
+ * It is useful iff the precision is big, there is an overflow
+ * and we are doing further mults...*/
+#ifdef HUGE
+ if (MPFR_UNLIKELY (ax > __gmpfr_emax + 1))
+ return mpfr_overflow (a, rnd_mode, sign);
+ if (MPFR_UNLIKELY (ax < __gmpfr_emin - 2))
+ return mpfr_underflow (a, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
+ sign);
+#endif
+
+ bq = MPFR_PREC (b);
+ cq = MPFR_PREC (c);
+
+ MPFR_ASSERTN ((mpfr_uprec_t) bq + cq <= MPFR_PREC_MAX);
+
+ bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */
+ cn = MPFR_PREC2LIMBS (cq); /* number of limbs of c */
+ k = bn + cn; /* effective nb of limbs used by b*c (= tn or tn+1) below */
+ tn = MPFR_PREC2LIMBS (bq + cq);
+ MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */
+
+ /* Check for no size_t overflow*/
+ MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB);
+ MPFR_TMP_MARK (marker);
+ tmp = MPFR_TMP_LIMBS_ALLOC (k);
+
+ /* multiplies two mantissa in temporary allocated space */
+ if (MPFR_UNLIKELY (bn < cn))
+ {
+ mpfr_srcptr z = b;
+ mp_size_t zn = bn;
+ b = c;
+ bn = cn;
+ c = z;
+ cn = zn;
+ }
+ MPFR_ASSERTD (bn >= cn);
+ if (MPFR_LIKELY (bn <= 2))
+ {
+ if (bn == 1)
+ {
+ /* 1 limb * 1 limb */
+ umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]);
+ b1 = tmp[1];
+ }
+ else if (MPFR_UNLIKELY (cn == 1))
+ {
+ /* 2 limbs * 1 limb */
+ mp_limb_t t;
+ umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]);
+ umul_ppmm (tmp[2], t, MPFR_MANT (b)[1], MPFR_MANT (c)[0]);
+ add_ssaaaa (tmp[2], tmp[1], tmp[2], tmp[1], 0, t);
+ b1 = tmp[2];
+ }
+ else
+ {
+ /* 2 limbs * 2 limbs */
+ mp_limb_t t1, t2, t3;
+ /* First 2 limbs * 1 limb */
+ umul_ppmm (tmp[1], tmp[0], MPFR_MANT (b)[0], MPFR_MANT (c)[0]);
+ umul_ppmm (tmp[2], t1, MPFR_MANT (b)[1], MPFR_MANT (c)[0]);
+ add_ssaaaa (tmp[2], tmp[1], tmp[2], tmp[1], 0, t1);
+ /* Second, the other 2 limbs * 1 limb product */
+ umul_ppmm (t1, t2, MPFR_MANT (b)[0], MPFR_MANT (c)[1]);
+ umul_ppmm (tmp[3], t3, MPFR_MANT (b)[1], MPFR_MANT (c)[1]);
+ add_ssaaaa (tmp[3], t1, tmp[3], t1, 0, t3);
+ /* Sum those two partial products */
+ add_ssaaaa (tmp[2], tmp[1], tmp[2], tmp[1], t1, t2);
+ tmp[3] += (tmp[2] < t1);
+ b1 = tmp[3];
+ }
+ b1 >>= (GMP_NUMB_BITS - 1);
+ tmp += k - tn;
+ if (MPFR_UNLIKELY (b1 == 0))
+ mpn_lshift (tmp, tmp, tn, 1); /* tn <= k, so no stack corruption */
+ }
+ else
+ /* Mulders' mulhigh. This code can also be used via mpfr_sqr,
+ hence the tests b != c. */
+ if (MPFR_UNLIKELY (bn > (threshold = b != c ?
+ MPFR_MUL_THRESHOLD : MPFR_SQR_THRESHOLD)))
+ {
+ mp_limb_t *bp, *cp;
+ mp_size_t n;
+ mpfr_prec_t p;
+
+ /* First check if we can reduce the precision of b or c:
+ exact values are a nightmare for the short product trick */
+ bp = MPFR_MANT (b);
+ cp = MPFR_MANT (c);
+ MPFR_ASSERTN (threshold >= 1);
+ if (MPFR_UNLIKELY ((bp[0] == 0 && bp[1] == 0) ||
+ (cp[0] == 0 && cp[1] == 0)))
+ {
+ mpfr_t b_tmp, c_tmp;
+
+ MPFR_TMP_FREE (marker);
+ /* Check for b */
+ while (*bp == 0)
+ {
+ bp++;
+ bn--;
+ MPFR_ASSERTD (bn > 0);
+ } /* This must end since the most significant limb is != 0 */
+
+ /* Check for c too: if b ==c, will do nothing */
+ while (*cp == 0)
+ {
+ cp++;
+ cn--;
+ MPFR_ASSERTD (cn > 0);
+ } /* This must end since the most significant limb is != 0 */
+
+ /* It is not the faster way, but it is safer */
+ MPFR_SET_SAME_SIGN (b_tmp, b);
+ MPFR_SET_EXP (b_tmp, MPFR_GET_EXP (b));
+ MPFR_PREC (b_tmp) = bn * GMP_NUMB_BITS;
+ MPFR_MANT (b_tmp) = bp;
+
+ if (b != c)
+ {
+ MPFR_SET_SAME_SIGN (c_tmp, c);
+ MPFR_SET_EXP (c_tmp, MPFR_GET_EXP (c));
+ MPFR_PREC (c_tmp) = cn * GMP_NUMB_BITS;
+ MPFR_MANT (c_tmp) = cp;
+
+ /* Call again mpfr_mul with the fixed arguments */
+ return mpfr_mul (a, b_tmp, c_tmp, rnd_mode);
+ }
+ else
+ /* Call mpfr_mul instead of mpfr_sqr as the precision
+ is probably still high enough. */
+ return mpfr_mul (a, b_tmp, b_tmp, rnd_mode);
+ }
+
+ /* Compute estimated precision of mulhigh.
+ We could use `+ (n < cn) + (n < bn)' instead of `+ 2',
+ but does it worth it? */
+ n = MPFR_LIMB_SIZE (a) + 1;
+ n = MIN (n, cn);
+ MPFR_ASSERTD (n >= 1 && 2*n <= k && n <= cn && n <= bn);
+ p = n * GMP_NUMB_BITS - MPFR_INT_CEIL_LOG2 (n + 2);
+ bp += bn - n;
+ cp += cn - n;
+
+ /* Check if MulHigh can produce a roundable result.
+ We may lose 1 bit due to RNDN, 1 due to final shift. */
+ if (MPFR_UNLIKELY (MPFR_PREC (a) > p - 5))
+ {
+ if (MPFR_UNLIKELY (MPFR_PREC (a) > p - 5 + GMP_NUMB_BITS
+ || bn <= threshold + 1))
+ {
+ /* MulHigh can't produce a roundable result. */
+ MPFR_LOG_MSG (("mpfr_mulhigh can't be used (%lu VS %lu)\n",
+ MPFR_PREC (a), p));
+ goto full_multiply;
+ }
+ /* Add one extra limb to mantissa of b and c. */
+ if (bn > n)
+ bp --;
+ else
+ {
+ bp = MPFR_TMP_LIMBS_ALLOC (n + 1);
+ bp[0] = 0;
+ MPN_COPY (bp + 1, MPFR_MANT (b) + bn - n, n);
+ }
+ if (b != c)
+ {
+ if (cn > n)
+ cp --; /* FIXME: Could this happen? */
+ else
+ {
+ cp = MPFR_TMP_LIMBS_ALLOC (n + 1);
+ cp[0] = 0;
+ MPN_COPY (cp + 1, MPFR_MANT (c) + cn - n, n);
+ }
+ }
+ /* We will compute with one extra limb */
+ n++;
+ /* ceil(log2(n+2)) takes into account the lost bits due to
+ Mulders' short product */
+ p = n * GMP_NUMB_BITS - MPFR_INT_CEIL_LOG2 (n + 2);
+ /* Due to some nasty reasons we can have only 4 bits */
+ MPFR_ASSERTD (MPFR_PREC (a) <= p - 4);
+
+ if (MPFR_LIKELY (k < 2*n))
+ {
+ tmp = MPFR_TMP_LIMBS_ALLOC (2 * n);
+ tmp += 2*n-k; /* `tmp' still points to an area of `k' limbs */
+ }
+ }
+ MPFR_LOG_MSG (("Use mpfr_mulhigh (%lu VS %lu)\n", MPFR_PREC (a), p));
+ /* Compute an approximation of the product of b and c */
+ if (b != c)
+ mpfr_mulhigh_n (tmp + k - 2 * n, bp, cp, n);
+ else
+ mpfr_sqrhigh_n (tmp + k - 2 * n, bp, n);
+ /* now tmp[0]..tmp[k-1] contains the product of both mantissa,
+ with tmp[k-1]>=2^(GMP_NUMB_BITS-2) */
+ /* [VL] FIXME: This cannot be true: mpfr_mulhigh_n only
+ depends on pointers and n. As k can be arbitrarily larger,
+ the result cannot depend on k. And indeed, with GMP compiled
+ with --enable-alloca=debug, valgrind was complaining, at
+ least because MPFR_RNDRAW at the end tried to compute the
+ sticky bit even when not necessary; this problem is fixed,
+ but there's at least something wrong with the comment above. */
+ b1 = tmp[k-1] >> (GMP_NUMB_BITS - 1); /* msb from the product */
+
+ /* If the mantissas of b and c are uniformly distributed in (1/2, 1],
+ then their product is in (1/4, 1/2] with probability 2*ln(2)-1
+ ~ 0.386 and in [1/2, 1] with probability 2-2*ln(2) ~ 0.614 */
+ if (MPFR_UNLIKELY (b1 == 0))
+ /* Warning: the mpfr_mulhigh_n call above only surely affects
+ tmp[k-n-1..k-1], thus we shift only those limbs */
+ mpn_lshift (tmp + k - n - 1, tmp + k - n - 1, n + 1, 1);
+ tmp += k - tn;
+ MPFR_ASSERTD (MPFR_LIMB_MSB (tmp[tn-1]) != 0);
+
+ /* if the most significant bit b1 is zero, we have only p-1 correct
+ bits */
+ if (MPFR_UNLIKELY (!mpfr_round_p (tmp, tn, p + b1 - 1, MPFR_PREC(a)
+ + (rnd_mode == MPFR_RNDN))))
+ {
+ tmp -= k - tn; /* tmp may have changed, FIX IT!!!!! */
+ goto full_multiply;
+ }
+ }
+ else
+ {
+ full_multiply:
+ MPFR_LOG_MSG (("Use mpn_mul\n", 0));
+ b1 = mpn_mul (tmp, MPFR_MANT (b), bn, MPFR_MANT (c), cn);
+
+ /* now tmp[0]..tmp[k-1] contains the product of both mantissa,
+ with tmp[k-1]>=2^(GMP_NUMB_BITS-2) */
+ b1 >>= GMP_NUMB_BITS - 1; /* msb from the product */
+
+ /* if the mantissas of b and c are uniformly distributed in (1/2, 1],
+ then their product is in (1/4, 1/2] with probability 2*ln(2)-1
+ ~ 0.386 and in [1/2, 1] with probability 2-2*ln(2) ~ 0.614 */
+ tmp += k - tn;
+ if (MPFR_UNLIKELY (b1 == 0))
+ mpn_lshift (tmp, tmp, tn, 1); /* tn <= k, so no stack corruption */
+ }
+
+ ax2 = ax + (mpfr_exp_t) (b1 - 1);
+ MPFR_RNDRAW (inexact, a, tmp, bq+cq, rnd_mode, sign, ax2++);
+ MPFR_TMP_FREE (marker);
+ MPFR_EXP (a) = ax2; /* Can't use MPFR_SET_EXP: Expo may be out of range */
+ MPFR_SET_SIGN (a, sign);
+ if (MPFR_UNLIKELY (ax2 > __gmpfr_emax))
+ return mpfr_overflow (a, rnd_mode, sign);
+ if (MPFR_UNLIKELY (ax2 < __gmpfr_emin))
+ {
+ /* In the rounding to the nearest mode, if the exponent of the exact
+ result (i.e. before rounding, i.e. without taking cc into account)
+ is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if
+ both arguments are powers of 2), then round to zero. */
+ if (rnd_mode == MPFR_RNDN
+ && (ax + (mpfr_exp_t) b1 < __gmpfr_emin
+ || (mpfr_powerof2_raw (b) && mpfr_powerof2_raw (c))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (a, rnd_mode, sign);
+ }
+ MPFR_RET (inexact);
+}
diff --git a/src/mul_2exp.c b/src/mul_2exp.c
new file mode 100644
index 0000000..a3e2450
--- /dev/null
+++ b/src/mul_2exp.c
@@ -0,0 +1,33 @@
+/* mpfr_mul_2exp -- multiply a floating-point number by a power of two
+
+Copyright 1999, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Obsolete function, use mpfr_mul_2ui or mpfr_mul_2si instead. */
+
+#undef mpfr_mul_2exp
+
+int
+mpfr_mul_2exp (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_mul_2ui (y, x, n, rnd_mode);
+}
diff --git a/src/mul_2si.c b/src/mul_2si.c
new file mode 100644
index 0000000..814a30d
--- /dev/null
+++ b/src/mul_2si.c
@@ -0,0 +1,59 @@
+/* mpfr_mul_2si -- multiply a floating-point number by a power of two
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, n, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_set (y, x, rnd_mode);
+ else
+ {
+ mpfr_exp_t exp = MPFR_GET_EXP (x);
+ MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
+ if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
+ exp > __gmpfr_emax - n)))
+ return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
+ else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
+ exp < __gmpfr_emin - n)))
+ {
+ if (rnd_mode == MPFR_RNDN &&
+ (__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
+ exp < __gmpfr_emin - (n + 1) ||
+ (inexact >= 0 && mpfr_powerof2_raw (y))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
+ }
+ MPFR_SET_EXP (y, exp + n);
+ }
+
+ MPFR_RET (inexact);
+}
diff --git a/src/mul_2ui.c b/src/mul_2ui.c
new file mode 100644
index 0000000..a4bafe9
--- /dev/null
+++ b/src/mul_2ui.c
@@ -0,0 +1,66 @@
+/* mpfr_mul_2ui -- multiply a floating-point number by a power of two
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_mul_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg n=%lu rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, n, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ inexact = MPFR_UNLIKELY(y != x) ? mpfr_set (y, x, rnd_mode) : 0;
+
+ if (MPFR_LIKELY( MPFR_IS_PURE_FP(y)) )
+ {
+ /* n will have to be casted to long to make sure that the addition
+ and subtraction below (for overflow detection) are signed */
+ while (MPFR_UNLIKELY(n > LONG_MAX))
+ {
+ int inex2;
+
+ n -= LONG_MAX;
+ inex2 = mpfr_mul_2ui(y, y, LONG_MAX, rnd_mode);
+ if (inex2)
+ return inex2; /* overflow */
+ }
+
+ /* MPFR_EMIN_MIN + (long) n is signed and doesn't lead to an overflow;
+ the first test useful so that the real test can't lead to an
+ overflow. */
+ {
+ mpfr_exp_t exp = MPFR_GET_EXP (y);
+ if (MPFR_UNLIKELY( __gmpfr_emax < MPFR_EMIN_MIN + (long) n ||
+ exp > __gmpfr_emax - (long) n))
+ return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
+
+ MPFR_SET_EXP (y, exp + (long) n);
+ }
+ }
+
+ return inexact;
+}
diff --git a/src/mul_d.c b/src/mul_d.c
new file mode 100644
index 0000000..d1296da
--- /dev/null
+++ b/src/mul_d.c
@@ -0,0 +1,52 @@
+/* mpfr_mul_d -- multiply a multiple precision floating-point number
+ by a machine double precision float
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_mul_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t d;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("b[%Pu]=%.*Rg c=%.20g rnd=%d",
+ mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode),
+ ("a[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (a), mpfr_log_prec, a, inexact));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (d, IEEE_DBL_MANT_DIG);
+ inexact = mpfr_set_d (d, c, rnd_mode);
+ MPFR_ASSERTN (inexact == 0);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_mul (a, b, d, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
+ mpfr_clear(d);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (a, inexact, rnd_mode);
+}
diff --git a/src/mul_ui.c b/src/mul_ui.c
new file mode 100644
index 0000000..8c9258a
--- /dev/null
+++ b/src/mul_ui.c
@@ -0,0 +1,133 @@
+/* mpfr_mul_ui -- multiply a floating-point number by a machine integer
+ mpfr_mul_si -- multiply a floating-point number by a machine integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_mul_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode)
+{
+ mp_limb_t *yp;
+ mp_size_t xn;
+ int cnt, inexact;
+ MPFR_TMP_DECL (marker);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ if (u != 0)
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0); /* infinity is exact */
+ }
+ else /* 0 * infinity */
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0); /* zero is exact */
+ }
+ }
+ else if (MPFR_UNLIKELY (u <= 1))
+ {
+ if (u < 1)
+ {
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0); /* zero is exact */
+ }
+ else
+ return mpfr_set (y, x, rnd_mode);
+ }
+ else if (MPFR_UNLIKELY (IS_POW2 (u)))
+ return mpfr_mul_2si (y, x, MPFR_INT_CEIL_LOG2 (u), rnd_mode);
+
+ yp = MPFR_MANT (y);
+ xn = MPFR_LIMB_SIZE (x);
+
+ MPFR_ASSERTD (xn < MP_SIZE_T_MAX);
+ MPFR_TMP_MARK(marker);
+ yp = MPFR_TMP_LIMBS_ALLOC (xn + 1);
+
+ MPFR_ASSERTN (u == (mp_limb_t) u);
+ yp[xn] = mpn_mul_1 (yp, MPFR_MANT (x), xn, u);
+
+ /* x * u is stored in yp[xn], ..., yp[0] */
+
+ /* since the case u=1 was treated above, we have u >= 2, thus
+ yp[xn] >= 1 since x was msb-normalized */
+ MPFR_ASSERTD (yp[xn] != 0);
+ if (MPFR_LIKELY (MPFR_LIMB_MSB (yp[xn]) == 0))
+ {
+ count_leading_zeros (cnt, yp[xn]);
+ mpn_lshift (yp, yp, xn + 1, cnt);
+ }
+ else
+ {
+ cnt = 0;
+ }
+
+ /* now yp[xn], ..., yp[0] is msb-normalized too, and has at most
+ PREC(x) + (GMP_NUMB_BITS - cnt) non-zero bits */
+ MPFR_RNDRAW (inexact, y, yp, (mpfr_prec_t) (xn + 1) * GMP_NUMB_BITS,
+ rnd_mode, MPFR_SIGN (x), cnt -- );
+
+ MPFR_TMP_FREE (marker);
+
+ cnt = GMP_NUMB_BITS - cnt;
+ if (MPFR_UNLIKELY (__gmpfr_emax < MPFR_EMAX_MIN + cnt
+ || MPFR_GET_EXP (x) > __gmpfr_emax - cnt))
+ return mpfr_overflow (y, rnd_mode, MPFR_SIGN(x));
+
+ MPFR_SET_EXP (y, MPFR_GET_EXP (x) + cnt);
+ MPFR_SET_SAME_SIGN (y, x);
+
+ return inexact;
+}
+
+int mpfr_mul_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
+{
+ int res;
+
+ if (u >= 0)
+ res = mpfr_mul_ui (y, x, u, rnd_mode);
+ else
+ {
+ res = -mpfr_mul_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ }
+ return res;
+}
diff --git a/src/mulders.c b/src/mulders.c
new file mode 100644
index 0000000..273c75a
--- /dev/null
+++ b/src/mulders.c
@@ -0,0 +1,495 @@
+/* Mulders' MulHigh function (short product)
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* References:
+ [1] Short Division of Long Integers, David Harvey and Paul Zimmermann,
+ Proceedings of the 20th Symposium on Computer Arithmetic (ARITH-20),
+ July 25-27, 2011, pages 7-14.
+*/
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#ifndef MUL_FFT_THRESHOLD
+#define MUL_FFT_THRESHOLD 8448
+#endif
+
+/* Don't use MPFR_MULHIGH_SIZE since it is handled by tuneup */
+#ifdef MPFR_MULHIGH_TAB_SIZE
+static short mulhigh_ktab[MPFR_MULHIGH_TAB_SIZE];
+#else
+static short mulhigh_ktab[] = {MPFR_MULHIGH_TAB};
+#define MPFR_MULHIGH_TAB_SIZE \
+ ((mp_size_t) (sizeof(mulhigh_ktab) / sizeof(mulhigh_ktab[0])))
+#endif
+
+/* Put in rp[n..2n-1] an approximation of the n high limbs
+ of {up, n} * {vp, n}. The error is less than n ulps of rp[n] (and the
+ approximation is always less or equal to the truncated full product).
+ Assume 2n limbs are allocated at rp.
+
+ Implements Algorithm ShortMulNaive from [1].
+*/
+static void
+mpfr_mulhigh_n_basecase (mpfr_limb_ptr rp, mpfr_limb_srcptr up,
+ mpfr_limb_srcptr vp, mp_size_t n)
+{
+ mp_size_t i;
+
+ rp += n - 1;
+ umul_ppmm (rp[1], rp[0], up[n-1], vp[0]); /* we neglect up[0..n-2]*vp[0],
+ which is less than B^n */
+ for (i = 1 ; i < n ; i++)
+ /* here, we neglect up[0..n-i-2] * vp[i], which is less than B^n too */
+ rp[i + 1] = mpn_addmul_1 (rp, up + (n - i - 1), i + 1, vp[i]);
+ /* in total, we neglect less than n*B^n, i.e., n ulps of rp[n]. */
+}
+
+/* Put in rp[0..n] the n+1 low limbs of {up, n} * {vp, n}.
+ Assume 2n limbs are allocated at rp. */
+static void
+mpfr_mullow_n_basecase (mpfr_limb_ptr rp, mpfr_limb_srcptr up,
+ mpfr_limb_srcptr vp, mp_size_t n)
+{
+ mp_size_t i;
+
+ rp[n] = mpn_mul_1 (rp, up, n, vp[0]);
+ for (i = 1 ; i < n ; i++)
+ mpn_addmul_1 (rp + i, up, n - i + 1, vp[i]);
+}
+
+/* Put in rp[n..2n-1] an approximation of the n high limbs
+ of {np, n} * {mp, n}. The error is less than n ulps of rp[n] (and the
+ approximation is always less or equal to the truncated full product).
+
+ Implements Algorithm ShortMul from [1].
+*/
+void
+mpfr_mulhigh_n (mpfr_limb_ptr rp, mpfr_limb_srcptr np, mpfr_limb_srcptr mp,
+ mp_size_t n)
+{
+ mp_size_t k;
+
+ MPFR_ASSERTN (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */
+ k = MPFR_LIKELY (n < MPFR_MULHIGH_TAB_SIZE) ? mulhigh_ktab[n] : 3*(n/4);
+ /* Algorithm ShortMul from [1] requires k >= (n+3)/2, which translates
+ into k >= (n+4)/2 in the C language. */
+ MPFR_ASSERTD (k == -1 || k == 0 || (k >= (n+4)/2 && k < n));
+ if (k < 0)
+ mpn_mul_basecase (rp, np, n, mp, n); /* result is exact, no error */
+ else if (k == 0)
+ mpfr_mulhigh_n_basecase (rp, np, mp, n); /* basecase error < n ulps */
+ else if (n > MUL_FFT_THRESHOLD)
+ mpn_mul_n (rp, np, mp, n); /* result is exact, no error */
+ else
+ {
+ mp_size_t l = n - k;
+ mp_limb_t cy;
+
+ mpn_mul_n (rp + 2 * l, np + l, mp + l, k); /* fills rp[2l..2n-1] */
+ mpfr_mulhigh_n (rp, np + k, mp, l); /* fills rp[l-1..2l-1] */
+ cy = mpn_add_n (rp + n - 1, rp + n - 1, rp + l - 1, l + 1);
+ mpfr_mulhigh_n (rp, np, mp + k, l); /* fills rp[l-1..2l-1] */
+ cy += mpn_add_n (rp + n - 1, rp + n - 1, rp + l - 1, l + 1);
+ mpn_add_1 (rp + n + l, rp + n + l, k, cy); /* propagate carry */
+ }
+}
+
+/* Put in rp[0..n] the n+1 low limbs of {np, n} * {mp, n}.
+ Assume 2n limbs are allocated at rp. */
+void
+mpfr_mullow_n (mpfr_limb_ptr rp, mpfr_limb_srcptr np, mpfr_limb_srcptr mp,
+ mp_size_t n)
+{
+ mp_size_t k;
+
+ MPFR_ASSERTN (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */
+ k = MPFR_LIKELY (n < MPFR_MULHIGH_TAB_SIZE) ? mulhigh_ktab[n] : 3*(n/4);
+ MPFR_ASSERTD (k == -1 || k == 0 || (2 * k >= n && k < n));
+ if (k < 0)
+ mpn_mul_basecase (rp, np, n, mp, n);
+ else if (k == 0)
+ mpfr_mullow_n_basecase (rp, np, mp, n);
+ else if (n > MUL_FFT_THRESHOLD)
+ mpn_mul_n (rp, np, mp, n);
+ else
+ {
+ mp_size_t l = n - k;
+
+ mpn_mul_n (rp, np, mp, k); /* fills rp[0..2k] */
+ mpfr_mullow_n (rp + n, np + k, mp, l); /* fills rp[n..n+2l] */
+ mpn_add_n (rp + k, rp + k, rp + n, l + 1);
+ mpfr_mullow_n (rp + n, np, mp + k, l); /* fills rp[n..n+2l] */
+ mpn_add_n (rp + k, rp + k, rp + n, l + 1);
+ }
+}
+
+#ifdef MPFR_SQRHIGH_TAB_SIZE
+static short sqrhigh_ktab[MPFR_SQRHIGH_TAB_SIZE];
+#else
+static short sqrhigh_ktab[] = {MPFR_SQRHIGH_TAB};
+#define MPFR_SQRHIGH_TAB_SIZE (sizeof(sqrhigh_ktab) / sizeof(sqrhigh_ktab[0]))
+#endif
+
+/* Put in rp[n..2n-1] an approximation of the n high limbs
+ of {np, n}^2. The error is less than n ulps of rp[n]. */
+void
+mpfr_sqrhigh_n (mpfr_limb_ptr rp, mpfr_limb_srcptr np, mp_size_t n)
+{
+ mp_size_t k;
+
+ MPFR_ASSERTN (MPFR_SQRHIGH_TAB_SIZE > 2); /* ensures k < n */
+ k = MPFR_LIKELY (n < MPFR_SQRHIGH_TAB_SIZE) ? sqrhigh_ktab[n]
+ : (n+4)/2; /* ensures that k >= (n+3)/2 */
+ MPFR_ASSERTD (k == -1 || k == 0 || (k >= (n+4)/2 && k < n));
+ if (k < 0)
+ /* we can't use mpn_sqr_basecase here, since it requires
+ n <= SQR_KARATSUBA_THRESHOLD, where SQR_KARATSUBA_THRESHOLD
+ is not exported by GMP */
+ mpn_sqr_n (rp, np, n);
+ else if (k == 0)
+ mpfr_mulhigh_n_basecase (rp, np, np, n);
+ else
+ {
+ mp_size_t l = n - k;
+ mp_limb_t cy;
+
+ mpn_sqr_n (rp + 2 * l, np + l, k); /* fills rp[2l..2n-1] */
+ mpfr_mulhigh_n (rp, np, np + k, l); /* fills rp[l-1..2l-1] */
+ /* {rp+n-1,l+1} += 2 * {rp+l-1,l+1} */
+ cy = mpn_lshift (rp + l - 1, rp + l - 1, l + 1, 1);
+ cy += mpn_add_n (rp + n - 1, rp + n - 1, rp + l - 1, l + 1);
+ mpn_add_1 (rp + n + l, rp + n + l, k, cy); /* propagate carry */
+ }
+}
+
+#ifdef MPFR_DIVHIGH_TAB_SIZE
+static short divhigh_ktab[MPFR_DIVHIGH_TAB_SIZE];
+#else
+static short divhigh_ktab[] = {MPFR_DIVHIGH_TAB};
+#define MPFR_DIVHIGH_TAB_SIZE (sizeof(divhigh_ktab) / sizeof(divhigh_ktab[0]))
+#endif
+
+#ifndef __GMPFR_GMP_H__
+#define mpfr_pi1_t gmp_pi1_t /* with a GMP build */
+#endif
+
+#if !(defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_SBPI1_DIVAPPR_Q))
+/* Put in Q={qp, n} an approximation of N={np, 2*n} divided by D={dp, n},
+ with the most significant limb of the quotient as return value (0 or 1).
+ Assumes the most significant bit of D is set. Clobbers N.
+
+ The approximate quotient Q satisfies - 2(n-1) < N/D - Q <= 4.
+*/
+static mp_limb_t
+mpfr_divhigh_n_basecase (mpfr_limb_ptr qp, mpfr_limb_ptr np,
+ mpfr_limb_srcptr dp, mp_size_t n)
+{
+ mp_limb_t qh, d1, d0, dinv, q2, q1, q0;
+ mpfr_pi1_t dinv2;
+
+ np += n;
+
+ if ((qh = (mpn_cmp (np, dp, n) >= 0)))
+ mpn_sub_n (np, np, dp, n);
+
+ /* now {np, n} is less than D={dp, n}, which implies np[n-1] <= dp[n-1] */
+
+ d1 = dp[n - 1];
+
+ if (n == 1)
+ {
+ invert_limb (dinv, d1);
+ umul_ppmm (q1, q0, np[0], dinv);
+ qp[0] = np[0] + q1;
+ return qh;
+ }
+
+ /* now n >= 2 */
+ d0 = dp[n - 2];
+ invert_pi1 (dinv2, d1, d0);
+ /* dinv2.inv32 = floor ((B^3 - 1) / (d0 + d1 B)) - B */
+ while (n > 1)
+ {
+ /* Invariant: it remains to reduce n limbs from N (in addition to the
+ initial low n limbs).
+ Since n >= 2 here, necessarily we had n >= 2 initially, which means
+ that in addition to the limb np[n-1] to reduce, we have at least 2
+ extra limbs, thus accessing np[n-3] is valid. */
+
+ /* warning: we can have np[n-1]=d1 and np[n-2]=d0, but since {np,n} < D,
+ the largest possible partial quotient is B-1 */
+ if (MPFR_UNLIKELY(np[n - 1] == d1 && np[n - 2] == d0))
+ q2 = ~ (mp_limb_t) 0;
+ else
+ udiv_qr_3by2 (q2, q1, q0, np[n - 1], np[n - 2], np[n - 3],
+ d1, d0, dinv2.inv32);
+ /* since q2 = floor((np[n-1]*B^2+np[n-2]*B+np[n-3])/(d1*B+d0)),
+ we have q2 <= (np[n-1]*B^2+np[n-2]*B+np[n-3])/(d1*B+d0),
+ thus np[n-1]*B^2+np[n-2]*B+np[n-3] >= q2*(d1*B+d0)
+ and {np-1, n} >= q2*D - q2*B^(n-2) >= q2*D - B^(n-1)
+ thus {np-1, n} - (q2-1)*D >= D - B^(n-1) >= 0
+ which proves that at most one correction is needed */
+ q0 = mpn_submul_1 (np - 1, dp, n, q2);
+ if (MPFR_UNLIKELY(q0 > np[n - 1]))
+ {
+ mpn_add_n (np - 1, np - 1, dp, n);
+ q2 --;
+ }
+ qp[--n] = q2;
+ dp ++;
+ }
+
+ /* we have B+dinv2 = floor((B^3-1)/(d1*B+d0)) < B^2/d1
+ q1 = floor(np[0]*(B+dinv2)/B) <= floor(np[0]*B/d1)
+ <= floor((np[0]*B+np[1])/d1)
+ thus q1 is not larger than the true quotient.
+ q1 > np[0]*(B+dinv2)/B - 1 > np[0]*(B^3-1)/(d1*B+d0)/B - 2
+ For d1*B+d0 <> B^2/2, we have B+dinv2 = floor(B^3/(d1*B+d0))
+ thus q1 > np[0]*B^2/(d1*B+d0) - 2, i.e.,
+ (d1*B+d0)*q1 > np[0]*B^2 - 2*(d1*B+d0)
+ d1*B*q1 > np[0]*B^2 - 2*d1*B - 2*d0 - d0*q1 >= np[0]*B^2 - 2*d1*B - B^2
+ thus q1 > np[0]*B/d1 - 2 - B/d1 > np[0]*B/d1 - 4.
+
+ For d1*B+d0 = B^2/2, dinv2 = B-1 thus q1 > np[0]*(2B-1)/B - 1 >
+ np[0]*B/d1 - 2.
+
+ In all cases, if q = floor((np[0]*B+np[1])/d1), we have:
+ q - 4 <= q1 <= q
+ */
+ umul_ppmm (q1, q0, np[0], dinv2.inv32);
+ qp[0] = np[0] + q1;
+
+ return qh;
+}
+#endif
+
+/* Put in {qp, n} an approximation of N={np, 2*n} divided by D={dp, n},
+ with the most significant limb of the quotient as return value (0 or 1).
+ Assumes the most significant bit of D is set. Clobbers N.
+
+ This implements the ShortDiv algorithm from reference [1].
+*/
+#if 1
+mp_limb_t
+mpfr_divhigh_n (mpfr_limb_ptr qp, mpfr_limb_ptr np, mpfr_limb_ptr dp,
+ mp_size_t n)
+{
+ mp_size_t k, l;
+ mp_limb_t qh, cy;
+ mpfr_limb_ptr tp;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_ASSERTN (MPFR_MULHIGH_TAB_SIZE >= 15); /* so that 2*(n/3) >= (n+4)/2 */
+ k = MPFR_LIKELY (n < MPFR_DIVHIGH_TAB_SIZE) ? divhigh_ktab[n] : 2*(n/3);
+
+ if (k == 0)
+#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_SBPI1_DIVAPPR_Q)
+ {
+ mpfr_pi1_t dinv2;
+ invert_pi1 (dinv2, dp[n - 1], dp[n - 2]);
+ return __gmpn_sbpi1_divappr_q (qp, np, n + n, dp, n, dinv2.inv32);
+ }
+#else /* use our own code for base-case short division */
+ return mpfr_divhigh_n_basecase (qp, np, dp, n);
+#endif
+ else if (k == n)
+ /* for k=n, we use a division with remainder (mpn_divrem),
+ which computes the exact quotient */
+ return mpn_divrem (qp, 0, np, 2 * n, dp, n);
+
+ MPFR_ASSERTD ((n+4)/2 <= k && k < n); /* bounds from [1] */
+ MPFR_TMP_MARK (marker);
+ l = n - k;
+ /* first divide the most significant 2k limbs from N by the most significant
+ k limbs of D */
+ qh = mpn_divrem (qp + l, 0, np + 2 * l, 2 * k, dp + l, k); /* exact */
+
+ /* it remains {np,2l+k} = {np,n+l} as remainder */
+
+ /* now we have to subtract high(Q1)*D0 where Q1=qh*B^k+{qp+l,k} and
+ D0={dp,l} */
+ tp = MPFR_TMP_LIMBS_ALLOC (2 * l);
+ mpfr_mulhigh_n (tp, qp + k, dp, l);
+ /* we are only interested in the upper l limbs from {tp,2l} */
+ cy = mpn_sub_n (np + n, np + n, tp + l, l);
+ if (qh)
+ cy += mpn_sub_n (np + n, np + n, dp, l);
+ while (cy > 0) /* Q1 was too large: subtract 1 to Q1 and add D to np+l */
+ {
+ qh -= mpn_sub_1 (qp + l, qp + l, k, MPFR_LIMB_ONE);
+ cy -= mpn_add_n (np + l, np + l, dp, n);
+ }
+
+ /* now it remains {np,n+l} to divide by D */
+ cy = mpfr_divhigh_n (qp, np + k, dp + k, l);
+ qh += mpn_add_1 (qp + l, qp + l, k, cy);
+ MPFR_TMP_FREE(marker);
+
+ return qh;
+}
+#else /* below is the FoldDiv(K) algorithm from [1] */
+mp_limb_t
+mpfr_divhigh_n (mpfr_limb_ptr qp, mpfr_limb_ptr np, mpfr_limb_ptr dp,
+ mp_size_t n)
+{
+ mp_size_t k, r;
+ mpfr_limb_ptr ip, tp, up;
+ mp_limb_t qh = 0, cy, cc;
+ int count;
+ MPFR_TMP_DECL(marker);
+
+#define K 3
+ if (n < K)
+ return mpn_divrem (qp, 0, np, 2 * n, dp, n);
+
+ k = (n - 1) / K + 1; /* ceil(n/K) */
+
+ MPFR_TMP_MARK (marker);
+ ip = MPFR_TMP_LIMBS_ALLOC (k + 1);
+ tp = MPFR_TMP_LIMBS_ALLOC (n + k);
+ up = MPFR_TMP_LIMBS_ALLOC (2 * (k + 1));
+ mpn_invert (ip, dp + n - (k + 1), k + 1, NULL); /* takes about 13% for n=1000 */
+ /* {ip, k+1} = floor((B^(2k+2)-1)/D - B^(k+1) where D = {dp+n-(k+1),k+1} */
+ for (r = n, cc = 0UL; r > 0;)
+ {
+ /* cc is the carry at np[n+r] */
+ MPFR_ASSERTD(cc <= 1);
+ /* FIXME: why can we have cc as large as say 8? */
+ count = 0;
+ while (cc > 0)
+ {
+ count ++;
+ MPFR_ASSERTD(count <= 1);
+ /* subtract {dp+n-r,r} from {np+n,r} */
+ cc -= mpn_sub_n (np + n, np + n, dp + n - r, r);
+ /* add 1 at qp[r] */
+ qh += mpn_add_1 (qp + r, qp + r, n - r, 1UL);
+ }
+ /* it remains r limbs to reduce, i.e., the remainder is {np, n+r} */
+ if (r < k)
+ {
+ ip += k - r;
+ k = r;
+ }
+ /* now r >= k */
+ /* qp + r - 2 * k -> up */
+ mpfr_mulhigh_n (up, np + n + r - (k + 1), ip, k + 1);
+ /* take into account the term B^k in the inverse: B^k * {np+n+r-k, k} */
+ cy = mpn_add_n (qp + r - k, up + k + 2, np + n + r - k, k);
+ /* since we need only r limbs of tp (below), it suffices to consider
+ r high limbs of dp */
+ if (r > k)
+ {
+#if 0
+ mpn_mul (tp, dp + n - r, r, qp + r - k, k);
+#else /* use a short product for the low k x k limbs */
+ /* we know the upper k limbs of the r-limb product cancel with the
+ remainder, thus we only need to compute the low r-k limbs */
+ if (r - k >= k)
+ mpn_mul (tp + k, dp + n - r + k, r - k, qp + r - k, k);
+ else /* r-k < k */
+ {
+/* #define LOW */
+#ifndef LOW
+ mpn_mul (tp + k, qp + r - k, k, dp + n - r + k, r - k);
+#else
+ mpfr_mullow_n_basecase (tp + k, qp + r - k, dp + n - r + k, r - k);
+ /* take into account qp[2r-2k] * dp[n - r + k] */
+ tp[r] += qp[2*r-2*k] * dp[n - r + k];
+#endif
+ /* tp[k..r] is filled */
+ }
+#if 0
+ mpfr_mulhigh_n (up, dp + n - r, qp + r - k, k);
+#else /* compute one more limb. FIXME: we could add one limb of dp in the
+ above, to save one mpn_addmul_1 call */
+ mpfr_mulhigh_n (up, dp + n - r, qp + r - k, k - 1); /* {up,2k-2} */
+ /* add {qp + r - k, k - 1} * dp[n-r+k-1] */
+ up[2*k-2] = mpn_addmul_1 (up + k - 1, qp + r - k, k-1, dp[n-r+k-1]);
+ /* add {dp+n-r, k} * qp[r-1] */
+ up[2*k-1] = mpn_addmul_1 (up + k - 1, dp + n - r, k, qp[r-1]);
+#endif
+#ifndef LOW
+ cc = mpn_add_n (tp + k, tp + k, up + k, k);
+ mpn_add_1 (tp + 2 * k, tp + 2 * k, r - k, cc);
+#else
+ /* update tp[k..r] */
+ if (r - k + 1 <= k)
+ mpn_add_n (tp + k, tp + k, up + k, r - k + 1);
+ else /* r - k >= k */
+ {
+ cc = mpn_add_n (tp + k, tp + k, up + k, k);
+ mpn_add_1 (tp + 2 * k, tp + 2 * k, r - 2 * k + 1, cc);
+ }
+#endif
+#endif
+ }
+ else /* last step: since we only want the quotient, no need to update,
+ just propagate the carry cy */
+ {
+ MPFR_ASSERTD(r < n);
+ if (cy > 0)
+ qh += mpn_add_1 (qp + r, qp + r, n - r, cy);
+ break;
+ }
+ /* subtract {tp, n+k} from {np+r-k, n+k}; however we only want to
+ update {np+n, n} */
+ /* we should have tp[r] = np[n+r-k] up to 1 */
+ MPFR_ASSERTD(tp[r] == np[n + r - k] || tp[r] + 1 == np[n + r - k]);
+#ifndef LOW
+ cc = mpn_sub_n (np + n - 1, np + n - 1, tp + k - 1, r + 1); /* borrow at np[n+r] */
+#else
+ cc = mpn_sub_n (np + n - 1, np + n - 1, tp + k - 1, r - k + 2);
+#endif
+ /* if cy = 1, subtract {dp, n} from {np+r, n}, thus
+ {dp+n-r,r} from {np+n,r} */
+ if (cy)
+ {
+ if (r < n)
+ cc += mpn_sub_n (np + n - 1, np + n - 1, dp + n - r - 1, r + 1);
+ else
+ cc += mpn_sub_n (np + n, np + n, dp + n - r, r);
+ /* propagate cy */
+ if (r == n)
+ qh = cy;
+ else
+ qh += mpn_add_1 (qp + r, qp + r, n - r, cy);
+ }
+ /* cc is the borrow at np[n+r] */
+ count = 0;
+ while (cc > 0) /* quotient was too large */
+ {
+ count++;
+ MPFR_ASSERTD (count <= 1);
+ cy = mpn_add_n (np + n, np + n, dp + n - (r - k), r - k);
+ cc -= mpn_add_1 (np + n + r - k, np + n + r - k, k, cy);
+ qh -= mpn_sub_1 (qp + r - k, qp + r - k, n - (r - k), 1UL);
+ }
+ r -= k;
+ cc = np[n + r];
+ }
+ MPFR_TMP_FREE(marker);
+
+ return qh;
+}
+#endif
diff --git a/src/neg.c b/src/neg.c
new file mode 100644
index 0000000..400b78b
--- /dev/null
+++ b/src/neg.c
@@ -0,0 +1,39 @@
+/* mpfr_neg -- change the sign of a floating-point number
+
+Copyright 1999, 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_neg (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_UNLIKELY(a != b))
+ return mpfr_set4 (a, b, rnd_mode, -MPFR_SIGN(b));
+ else if (MPFR_UNLIKELY(MPFR_IS_NAN (b)))
+ {
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_CHANGE_SIGN(a);
+ MPFR_RET(0);
+ }
+}
diff --git a/src/next.c b/src/next.c
new file mode 100644
index 0000000..849d206
--- /dev/null
+++ b/src/next.c
@@ -0,0 +1,150 @@
+/* mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward -- next representable
+floating-point number
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_nexttozero (mpfr_ptr x)
+{
+ if (MPFR_UNLIKELY(MPFR_IS_INF(x)))
+ {
+ mpfr_setmax (x, __gmpfr_emax);
+ return;
+ }
+ else if (MPFR_UNLIKELY( MPFR_IS_ZERO(x) ))
+ {
+ MPFR_CHANGE_SIGN(x);
+ mpfr_setmin (x, __gmpfr_emin);
+ }
+ else
+ {
+ mp_size_t xn;
+ int sh;
+ mp_limb_t *xp;
+
+ xn = MPFR_LIMB_SIZE (x);
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC(x));
+ xp = MPFR_MANT(x);
+ mpn_sub_1 (xp, xp, xn, MPFR_LIMB_ONE << sh);
+ if (MPFR_UNLIKELY( MPFR_LIMB_MSB(xp[xn-1]) == 0) )
+ { /* was an exact power of two: not normalized any more */
+ mpfr_exp_t exp = MPFR_EXP (x);
+ if (MPFR_UNLIKELY(exp == __gmpfr_emin))
+ MPFR_SET_ZERO(x);
+ else
+ {
+ mp_size_t i;
+ MPFR_SET_EXP (x, exp - 1);
+ xp[0] = MP_LIMB_T_MAX << sh;
+ for (i = 1; i < xn; i++)
+ xp[i] = MP_LIMB_T_MAX;
+ }
+ }
+ }
+}
+
+void
+mpfr_nexttoinf (mpfr_ptr x)
+{
+ if (MPFR_UNLIKELY(MPFR_IS_INF(x)))
+ return;
+ else if (MPFR_UNLIKELY(MPFR_IS_ZERO(x)))
+ mpfr_setmin (x, __gmpfr_emin);
+ else
+ {
+ mp_size_t xn;
+ int sh;
+ mp_limb_t *xp;
+
+ xn = MPFR_LIMB_SIZE (x);
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC(x));
+ xp = MPFR_MANT(x);
+ if (MPFR_UNLIKELY( mpn_add_1 (xp, xp, xn, MPFR_LIMB_ONE << sh)) )
+ /* got 1.0000... */
+ {
+ mpfr_exp_t exp = MPFR_EXP (x);
+ if (MPFR_UNLIKELY(exp == __gmpfr_emax))
+ MPFR_SET_INF(x);
+ else
+ {
+ MPFR_SET_EXP (x, exp + 1);
+ xp[xn-1] = MPFR_LIMB_HIGHBIT;
+ }
+ }
+ }
+}
+
+void
+mpfr_nextabove (mpfr_ptr x)
+{
+ if (MPFR_UNLIKELY(MPFR_IS_NAN(x)))
+ {
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+ return;
+ }
+ if (MPFR_IS_NEG(x))
+ mpfr_nexttozero (x);
+ else
+ mpfr_nexttoinf (x);
+}
+
+void
+mpfr_nextbelow (mpfr_ptr x)
+{
+ if (MPFR_UNLIKELY(MPFR_IS_NAN(x)))
+ {
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+ return;
+ }
+
+ if (MPFR_IS_NEG(x))
+ mpfr_nexttoinf (x);
+ else
+ mpfr_nexttozero (x);
+}
+
+void
+mpfr_nexttoward (mpfr_ptr x, mpfr_srcptr y)
+{
+ int s;
+
+ if (MPFR_UNLIKELY(MPFR_IS_NAN(x)))
+ {
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+ return;
+ }
+ else if (MPFR_UNLIKELY(MPFR_IS_NAN(x) || MPFR_IS_NAN(y)))
+ {
+ MPFR_SET_NAN(x);
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+ return;
+ }
+
+ s = mpfr_cmp (x, y);
+ if (s == 0)
+ return;
+ else if (s < 0)
+ mpfr_nextabove (x);
+ else
+ mpfr_nextbelow (x);
+}
diff --git a/src/out_str.c b/src/out_str.c
new file mode 100644
index 0000000..c32dbe2
--- /dev/null
+++ b/src/out_str.c
@@ -0,0 +1,98 @@
+/* mpfr_out_str -- output a floating-point number to a stream
+
+Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Warning! S should not contain "%". */
+#define OUT_STR_RET(S) \
+ do \
+ { \
+ int r; \
+ r = fprintf (stream, (S)); \
+ return r < 0 ? 0 : r; \
+ } \
+ while (0)
+
+size_t
+mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
+ mpfr_rnd_t rnd_mode)
+{
+ char *s, *s0;
+ size_t l;
+ mpfr_exp_t e;
+ int err;
+
+ MPFR_ASSERTN (base >= 2 && base <= 62);
+
+ /* when stream=NULL, output to stdout */
+ if (stream == NULL)
+ stream = stdout;
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op)))
+ {
+ if (MPFR_IS_NAN (op))
+ OUT_STR_RET ("@NaN@");
+ else if (MPFR_IS_INF (op))
+ OUT_STR_RET (MPFR_IS_POS (op) ? "@Inf@" : "-@Inf@");
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (op));
+ OUT_STR_RET (MPFR_IS_POS (op) ? "0" : "-0");
+ }
+ }
+
+ s = mpfr_get_str (NULL, &e, base, n_digits, op, rnd_mode);
+
+ s0 = s;
+ /* for op=3.1416 we have s = "31416" and e = 1 */
+
+ l = strlen (s) + 1; /* size of allocated block returned by mpfr_get_str
+ - may be incorrect, as only an upper bound? */
+
+ /* outputs possible sign and significand */
+ err = (*s == '-' && fputc (*s++, stream) == EOF)
+ || fputc (*s++, stream) == EOF /* leading digit */
+ || fputc ((unsigned char) MPFR_DECIMAL_POINT, stream) == EOF
+ || fputs (s, stream) == EOF; /* trailing significand */
+ (*__gmp_free_func) (s0, l);
+ if (MPFR_UNLIKELY (err))
+ return 0;
+
+ e--; /* due to the leading digit */
+
+ /* outputs exponent */
+ if (e)
+ {
+ int r;
+
+ MPFR_ASSERTN(e >= LONG_MIN);
+ MPFR_ASSERTN(e <= LONG_MAX);
+
+ r = fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
+ if (MPFR_UNLIKELY (r < 0))
+ return 0;
+
+ l += r;
+ }
+
+ return l;
+}
diff --git a/src/pow.c b/src/pow.c
new file mode 100644
index 0000000..b0add7e
--- /dev/null
+++ b/src/pow.c
@@ -0,0 +1,715 @@
+/* mpfr_pow -- power function x^y
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* return non zero iff x^y is exact.
+ Assumes x and y are ordinary numbers,
+ y is not an integer, x is not a power of 2 and x is positive
+
+ If x^y is exact, it computes it and sets *inexact.
+*/
+static int
+mpfr_pow_is_exact (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
+ mpfr_rnd_t rnd_mode, int *inexact)
+{
+ mpz_t a, c;
+ mpfr_exp_t d, b;
+ unsigned long i;
+ int res;
+
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (y));
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (x));
+ MPFR_ASSERTD (!mpfr_integer_p (y));
+ MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_INT_SIGN (x),
+ MPFR_GET_EXP (x) - 1) != 0);
+ MPFR_ASSERTD (MPFR_IS_POS (x));
+
+ if (MPFR_IS_NEG (y))
+ return 0; /* x is not a power of two => x^-y is not exact */
+
+ /* compute d such that y = c*2^d with c odd integer */
+ mpz_init (c);
+ d = mpfr_get_z_2exp (c, y);
+ i = mpz_scan1 (c, 0);
+ mpz_fdiv_q_2exp (c, c, i);
+ d += i;
+ /* now y=c*2^d with c odd */
+ /* Since y is not an integer, d is necessarily < 0 */
+ MPFR_ASSERTD (d < 0);
+
+ /* Compute a,b such that x=a*2^b */
+ mpz_init (a);
+ b = mpfr_get_z_2exp (a, x);
+ i = mpz_scan1 (a, 0);
+ mpz_fdiv_q_2exp (a, a, i);
+ b += i;
+ /* now x=a*2^b with a is odd */
+
+ for (res = 1 ; d != 0 ; d++)
+ {
+ /* a*2^b is a square iff
+ (i) a is a square when b is even
+ (ii) 2*a is a square when b is odd */
+ if (b % 2 != 0)
+ {
+ mpz_mul_2exp (a, a, 1); /* 2*a */
+ b --;
+ }
+ MPFR_ASSERTD ((b % 2) == 0);
+ if (!mpz_perfect_square_p (a))
+ {
+ res = 0;
+ goto end;
+ }
+ mpz_sqrt (a, a);
+ b = b / 2;
+ }
+ /* Now x = (a'*2^b')^(2^-d) with d < 0
+ so x^y = ((a'*2^b')^(2^-d))^(c*2^d)
+ = ((a'*2^b')^c with c odd integer */
+ {
+ mpfr_t tmp;
+ mpfr_prec_t p;
+ MPFR_MPZ_SIZEINBASE2 (p, a);
+ mpfr_init2 (tmp, p); /* prec = 1 should not be possible */
+ res = mpfr_set_z (tmp, a, MPFR_RNDN);
+ MPFR_ASSERTD (res == 0);
+ res = mpfr_mul_2si (tmp, tmp, b, MPFR_RNDN);
+ MPFR_ASSERTD (res == 0);
+ *inexact = mpfr_pow_z (z, tmp, c, rnd_mode);
+ mpfr_clear (tmp);
+ res = 1;
+ }
+ end:
+ mpz_clear (a);
+ mpz_clear (c);
+ return res;
+}
+
+/* Return 1 if y is an odd integer, 0 otherwise. */
+static int
+is_odd (mpfr_srcptr y)
+{
+ mpfr_exp_t expo;
+ mpfr_prec_t prec;
+ mp_size_t yn;
+ mp_limb_t *yp;
+
+ /* NAN, INF or ZERO are not allowed */
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (y));
+
+ expo = MPFR_GET_EXP (y);
+ if (expo <= 0)
+ return 0; /* |y| < 1 and not 0 */
+
+ prec = MPFR_PREC(y);
+ if ((mpfr_prec_t) expo > prec)
+ return 0; /* y is a multiple of 2^(expo-prec), thus not odd */
+
+ /* 0 < expo <= prec:
+ y = 1xxxxxxxxxt.zzzzzzzzzzzzzzzzzz[000]
+ expo bits (prec-expo) bits
+
+ We have to check that:
+ (a) the bit 't' is set
+ (b) all the 'z' bits are zero
+ */
+
+ prec = MPFR_PREC2LIMBS (prec) * GMP_NUMB_BITS - expo;
+ /* number of z+0 bits */
+
+ yn = prec / GMP_NUMB_BITS;
+ MPFR_ASSERTN(yn >= 0);
+ /* yn is the index of limb containing the 't' bit */
+
+ yp = MPFR_MANT(y);
+ /* if expo is a multiple of GMP_NUMB_BITS, t is bit 0 */
+ if (expo % GMP_NUMB_BITS == 0 ? (yp[yn] & 1) == 0
+ : yp[yn] << ((expo % GMP_NUMB_BITS) - 1) != MPFR_LIMB_HIGHBIT)
+ return 0;
+ while (--yn >= 0)
+ if (yp[yn] != 0)
+ return 0;
+ return 1;
+}
+
+/* Assumes that the exponent range has already been extended and if y is
+ an integer, then the result is not exact in unbounded exponent range. */
+int
+mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
+ mpfr_rnd_t rnd_mode, int y_is_integer, mpfr_save_expo_t *expo)
+{
+ mpfr_t t, u, k, absx;
+ int neg_result = 0;
+ int k_non_zero = 0;
+ int check_exact_case = 0;
+ int inexact;
+ /* Declaration of the size variable */
+ mpfr_prec_t Nz = MPFR_PREC(z); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err; /* error */
+ MPFR_ZIV_DECL (ziv_loop);
+
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x,
+ mpfr_get_prec (y), mpfr_log_prec, y, rnd_mode),
+ ("z[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (z), mpfr_log_prec, z, inexact));
+
+ /* We put the absolute value of x in absx, pointing to the significand
+ of x to avoid allocating memory for the significand of absx. */
+ MPFR_ALIAS(absx, x, /*sign=*/ 1, /*EXP=*/ MPFR_EXP(x));
+
+ /* We will compute the absolute value of the result. So, let's
+ invert the rounding mode if the result is negative. */
+ if (MPFR_IS_NEG (x) && is_odd (y))
+ {
+ neg_result = 1;
+ rnd_mode = MPFR_INVERT_RND (rnd_mode);
+ }
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Nz + 5 + MPFR_INT_CEIL_LOG2 (Nz);
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+
+ MPFR_ZIV_INIT (ziv_loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags1);
+
+ /* compute exp(y*ln|x|), using MPFR_RNDU to get an upper bound, so
+ that we can detect underflows. */
+ mpfr_log (t, absx, MPFR_IS_NEG (y) ? MPFR_RNDD : MPFR_RNDU); /* ln|x| */
+ mpfr_mul (t, y, t, MPFR_RNDU); /* y*ln|x| */
+ if (k_non_zero)
+ {
+ MPFR_LOG_MSG (("subtract k * ln(2)\n", 0));
+ mpfr_const_log2 (u, MPFR_RNDD);
+ mpfr_mul (u, u, k, MPFR_RNDD);
+ /* Error on u = k * log(2): < k * 2^(-Nt) < 1. */
+ mpfr_sub (t, t, u, MPFR_RNDU);
+ MPFR_LOG_MSG (("t = y * ln|x| - k * ln(2)\n", 0));
+ MPFR_LOG_VAR (t);
+ }
+ /* estimate of the error -- see pow function in algorithms.tex.
+ The error on t is at most 1/2 + 3*2^(EXP(t)+1) ulps, which is
+ <= 2^(EXP(t)+3) for EXP(t) >= -1, and <= 2 ulps for EXP(t) <= -2.
+ Additional error if k_no_zero: treal = t * errk, with
+ 1 - |k| * 2^(-Nt) <= exp(-|k| * 2^(-Nt)) <= errk <= 1,
+ i.e., additional absolute error <= 2^(EXP(k)+EXP(t)-Nt).
+ Total error <= 2^err1 + 2^err2 <= 2^(max(err1,err2)+1). */
+ err = MPFR_NOTZERO (t) && MPFR_GET_EXP (t) >= -1 ?
+ MPFR_GET_EXP (t) + 3 : 1;
+ if (k_non_zero)
+ {
+ if (MPFR_GET_EXP (k) > err)
+ err = MPFR_GET_EXP (k);
+ err++;
+ }
+ MPFR_BLOCK (flags1, mpfr_exp (t, t, MPFR_RNDN)); /* exp(y*ln|x|)*/
+ /* We need to test */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (t) || MPFR_UNDERFLOW (flags1)))
+ {
+ mpfr_prec_t Ntmin;
+ MPFR_BLOCK_DECL (flags2);
+
+ MPFR_ASSERTN (!k_non_zero);
+ MPFR_ASSERTN (!MPFR_IS_NAN (t));
+
+ /* Real underflow? */
+ if (MPFR_IS_ZERO (t))
+ {
+ /* Underflow. We computed rndn(exp(t)), where t >= y*ln|x|.
+ Therefore rndn(|x|^y) = 0, and we have a real underflow on
+ |x|^y. */
+ inexact = mpfr_underflow (z, rnd_mode == MPFR_RNDN ? MPFR_RNDZ
+ : rnd_mode, MPFR_SIGN_POS);
+ if (expo != NULL)
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (*expo, MPFR_FLAGS_INEXACT
+ | MPFR_FLAGS_UNDERFLOW);
+ break;
+ }
+
+ /* Real overflow? */
+ if (MPFR_IS_INF (t))
+ {
+ /* Note: we can probably use a low precision for this test. */
+ mpfr_log (t, absx, MPFR_IS_NEG (y) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_mul (t, y, t, MPFR_RNDD); /* y * ln|x| */
+ MPFR_BLOCK (flags2, mpfr_exp (t, t, MPFR_RNDD));
+ /* t = lower bound on exp(y * ln|x|) */
+ if (MPFR_OVERFLOW (flags2))
+ {
+ /* We have computed a lower bound on |x|^y, and it
+ overflowed. Therefore we have a real overflow
+ on |x|^y. */
+ inexact = mpfr_overflow (z, rnd_mode, MPFR_SIGN_POS);
+ if (expo != NULL)
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (*expo, MPFR_FLAGS_INEXACT
+ | MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+ }
+
+ k_non_zero = 1;
+ Ntmin = sizeof(mpfr_exp_t) * CHAR_BIT;
+ if (Ntmin > Nt)
+ {
+ Nt = Ntmin;
+ mpfr_set_prec (t, Nt);
+ }
+ mpfr_init2 (u, Nt);
+ mpfr_init2 (k, Ntmin);
+ mpfr_log2 (k, absx, MPFR_RNDN);
+ mpfr_mul (k, y, k, MPFR_RNDN);
+ mpfr_round (k, k);
+ MPFR_LOG_VAR (k);
+ /* |y| < 2^Ntmin, therefore |k| < 2^Nt. */
+ continue;
+ }
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - err, Nz, rnd_mode)))
+ {
+ inexact = mpfr_set (z, t, rnd_mode);
+ break;
+ }
+
+ /* check exact power, except when y is an integer (since the
+ exact cases for y integer have already been filtered out) */
+ if (check_exact_case == 0 && ! y_is_integer)
+ {
+ if (mpfr_pow_is_exact (z, absx, y, rnd_mode, &inexact))
+ break;
+ check_exact_case = 1;
+ }
+
+ /* reactualisation of the precision */
+ MPFR_ZIV_NEXT (ziv_loop, Nt);
+ mpfr_set_prec (t, Nt);
+ if (k_non_zero)
+ mpfr_set_prec (u, Nt);
+ }
+ MPFR_ZIV_FREE (ziv_loop);
+
+ if (k_non_zero)
+ {
+ int inex2;
+ long lk;
+
+ /* The rounded result in an unbounded exponent range is z * 2^k. As
+ * MPFR chooses underflow after rounding, the mpfr_mul_2si below will
+ * correctly detect underflows and overflows. However, in rounding to
+ * nearest, if z * 2^k = 2^(emin - 2), then the double rounding may
+ * affect the result. We need to cope with that before overwriting z.
+ * This can occur only if k < 0 (this test is necessary to avoid a
+ * potential integer overflow).
+ * If inexact >= 0, then the real result is <= 2^(emin - 2), so that
+ * o(2^(emin - 2)) = +0 is correct. If inexact < 0, then the real
+ * result is > 2^(emin - 2) and we need to round to 2^(emin - 1).
+ */
+ MPFR_ASSERTN (MPFR_EXP_MAX <= LONG_MAX);
+ lk = mpfr_get_si (k, MPFR_RNDN);
+ /* Due to early overflow detection, |k| should not be much larger than
+ * MPFR_EMAX_MAX, and as MPFR_EMAX_MAX <= MPFR_EXP_MAX/2 <= LONG_MAX/2,
+ * an overflow should not be possible in mpfr_get_si (and lk is exact).
+ * And one even has the following assertion. TODO: complete proof.
+ */
+ MPFR_ASSERTD (lk > LONG_MIN && lk < LONG_MAX);
+ /* Note: even in case of overflow (lk inexact), the code is correct.
+ * Indeed, for the 3 occurrences of lk:
+ * - The test lk < 0 is correct as sign(lk) = sign(k).
+ * - In the test MPFR_GET_EXP (z) == __gmpfr_emin - 1 - lk,
+ * if lk is inexact, then lk = LONG_MIN <= MPFR_EXP_MIN
+ * (the minimum value of the mpfr_exp_t type), and
+ * __gmpfr_emin - 1 - lk >= MPFR_EMIN_MIN - 1 - 2 * MPFR_EMIN_MIN
+ * >= - MPFR_EMIN_MIN - 1 = MPFR_EMAX_MAX - 1. However, from the
+ * choice of k, z has been chosen to be around 1, so that the
+ * result of the test is false, as if lk were exact.
+ * - In the mpfr_mul_2si (z, z, lk, rnd_mode), if lk is inexact,
+ * then |lk| >= LONG_MAX >= MPFR_EXP_MAX, and as z is around 1,
+ * mpfr_mul_2si underflows or overflows in the same way as if
+ * lk were exact.
+ * TODO: give a bound on |t|, then on |EXP(z)|.
+ */
+ if (rnd_mode == MPFR_RNDN && inexact < 0 && lk < 0 &&
+ MPFR_GET_EXP (z) == __gmpfr_emin - 1 - lk && mpfr_powerof2_raw (z))
+ {
+ /* Rounding to nearest, real result > z * 2^k = 2^(emin - 2),
+ * underflow case: as the minimum precision is > 1, we will
+ * obtain the correct result and exceptions by replacing z by
+ * nextabove(z).
+ */
+ MPFR_ASSERTN (MPFR_PREC_MIN > 1);
+ mpfr_nextabove (z);
+ }
+ mpfr_clear_flags ();
+ inex2 = mpfr_mul_2si (z, z, lk, rnd_mode);
+ if (inex2) /* underflow or overflow */
+ {
+ inexact = inex2;
+ if (expo != NULL)
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (*expo, __gmpfr_flags);
+ }
+ mpfr_clears (u, k, (mpfr_ptr) 0);
+ }
+ mpfr_clear (t);
+
+ /* update the sign of the result if x was negative */
+ if (neg_result)
+ {
+ MPFR_SET_NEG(z);
+ inexact = -inexact;
+ }
+
+ return inexact;
+}
+
+/* The computation of z = pow(x,y) is done by
+ z = exp(y * log(x)) = x^y
+ For the special cases, see Section F.9.4.4 of the C standard:
+ _ pow(±0, y) = ±inf for y an odd integer < 0.
+ _ pow(±0, y) = +inf for y < 0 and not an odd integer.
+ _ pow(±0, y) = ±0 for y an odd integer > 0.
+ _ pow(±0, y) = +0 for y > 0 and not an odd integer.
+ _ pow(-1, ±inf) = 1.
+ _ pow(+1, y) = 1 for any y, even a NaN.
+ _ pow(x, ±0) = 1 for any x, even a NaN.
+ _ pow(x, y) = NaN for finite x < 0 and finite non-integer y.
+ _ pow(x, -inf) = +inf for |x| < 1.
+ _ pow(x, -inf) = +0 for |x| > 1.
+ _ pow(x, +inf) = +0 for |x| < 1.
+ _ pow(x, +inf) = +inf for |x| > 1.
+ _ pow(-inf, y) = -0 for y an odd integer < 0.
+ _ pow(-inf, y) = +0 for y < 0 and not an odd integer.
+ _ pow(-inf, y) = -inf for y an odd integer > 0.
+ _ pow(-inf, y) = +inf for y > 0 and not an odd integer.
+ _ pow(+inf, y) = +0 for y < 0.
+ _ pow(+inf, y) = +inf for y > 0. */
+int
+mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ int cmp_x_1;
+ int y_is_integer;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x,
+ mpfr_get_prec (y), mpfr_log_prec, y, rnd_mode),
+ ("z[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (z), mpfr_log_prec, z, inexact));
+
+ if (MPFR_ARE_SINGULAR (x, y))
+ {
+ /* pow(x, 0) returns 1 for any x, even a NaN. */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (y)))
+ return mpfr_set_ui (z, 1, rnd_mode);
+ else if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_NAN (y))
+ {
+ /* pow(+1, NaN) returns 1. */
+ if (mpfr_cmp_ui (x, 1) == 0)
+ return mpfr_set_ui (z, 1, rnd_mode);
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (y))
+ {
+ if (MPFR_IS_INF (x))
+ {
+ if (MPFR_IS_POS (y))
+ MPFR_SET_INF (z);
+ else
+ MPFR_SET_ZERO (z);
+ MPFR_SET_POS (z);
+ MPFR_RET (0);
+ }
+ else
+ {
+ int cmp;
+ cmp = mpfr_cmpabs (x, __gmpfr_one) * MPFR_INT_SIGN (y);
+ MPFR_SET_POS (z);
+ if (cmp > 0)
+ {
+ /* Return +inf. */
+ MPFR_SET_INF (z);
+ MPFR_RET (0);
+ }
+ else if (cmp < 0)
+ {
+ /* Return +0. */
+ MPFR_SET_ZERO (z);
+ MPFR_RET (0);
+ }
+ else
+ {
+ /* Return 1. */
+ return mpfr_set_ui (z, 1, rnd_mode);
+ }
+ }
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ int negative;
+ /* Determine the sign now, in case y and z are the same object */
+ negative = MPFR_IS_NEG (x) && is_odd (y);
+ if (MPFR_IS_POS (y))
+ MPFR_SET_INF (z);
+ else
+ MPFR_SET_ZERO (z);
+ if (negative)
+ MPFR_SET_NEG (z);
+ else
+ MPFR_SET_POS (z);
+ MPFR_RET (0);
+ }
+ else
+ {
+ int negative;
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ /* Determine the sign now, in case y and z are the same object */
+ negative = MPFR_IS_NEG(x) && is_odd (y);
+ if (MPFR_IS_NEG (y))
+ {
+ MPFR_ASSERTD (! MPFR_IS_INF (y));
+ MPFR_SET_INF (z);
+ mpfr_set_divby0 ();
+ }
+ else
+ MPFR_SET_ZERO (z);
+ if (negative)
+ MPFR_SET_NEG (z);
+ else
+ MPFR_SET_POS (z);
+ MPFR_RET (0);
+ }
+ }
+
+ /* x^y for x < 0 and y not an integer is not defined */
+ y_is_integer = mpfr_integer_p (y);
+ if (MPFR_IS_NEG (x) && ! y_is_integer)
+ {
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+
+ /* now the result cannot be NaN:
+ (1) either x > 0
+ (2) or x < 0 and y is an integer */
+
+ cmp_x_1 = mpfr_cmpabs (x, __gmpfr_one);
+ if (cmp_x_1 == 0)
+ return mpfr_set_si (z, MPFR_IS_NEG (x) && is_odd (y) ? -1 : 1, rnd_mode);
+
+ /* now we have:
+ (1) either x > 0
+ (2) or x < 0 and y is an integer
+ and in addition |x| <> 1.
+ */
+
+ /* detect overflow: an overflow is possible if
+ (a) |x| > 1 and y > 0
+ (b) |x| < 1 and y < 0.
+ FIXME: this assumes 1 is always representable.
+
+ FIXME2: maybe we can test overflow and underflow simultaneously.
+ The idea is the following: first compute an approximation to
+ y * log2|x|, using rounding to nearest. If |x| is not too near from 1,
+ this approximation should be accurate enough, and in most cases enable
+ one to prove that there is no underflow nor overflow.
+ Otherwise, it should enable one to check only underflow or overflow,
+ instead of both cases as in the present case.
+ */
+ if (cmp_x_1 * MPFR_SIGN (y) > 0)
+ {
+ mpfr_t t;
+ int negative, overflow;
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (t, 53);
+ /* we want a lower bound on y*log2|x|:
+ (i) if x > 0, it suffices to round log2(x) toward zero, and
+ to round y*o(log2(x)) toward zero too;
+ (ii) if x < 0, we first compute t = o(-x), with rounding toward 1,
+ and then follow as in case (1). */
+ if (MPFR_SIGN (x) > 0)
+ mpfr_log2 (t, x, MPFR_RNDZ);
+ else
+ {
+ mpfr_neg (t, x, (cmp_x_1 > 0) ? MPFR_RNDZ : MPFR_RNDU);
+ mpfr_log2 (t, t, MPFR_RNDZ);
+ }
+ mpfr_mul (t, t, y, MPFR_RNDZ);
+ overflow = mpfr_cmp_si (t, __gmpfr_emax) > 0;
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ if (overflow)
+ {
+ MPFR_LOG_MSG (("early overflow detection\n", 0));
+ negative = MPFR_SIGN(x) < 0 && is_odd (y);
+ return mpfr_overflow (z, rnd_mode, negative ? -1 : 1);
+ }
+ }
+
+ /* Basic underflow checking. One has:
+ * - if y > 0, |x^y| < 2^(EXP(x) * y);
+ * - if y < 0, |x^y| <= 2^((EXP(x) - 1) * y);
+ * so that one can compute a value ebound such that |x^y| < 2^ebound.
+ * If we have ebound <= emin - 2 (emin - 1 in directed rounding modes),
+ * then there is an underflow and we can decide the return value.
+ */
+ if (MPFR_IS_NEG (y) ? (MPFR_GET_EXP (x) > 1) : (MPFR_GET_EXP (x) < 0))
+ {
+ mpfr_t tmp;
+ mpfr_eexp_t ebound;
+ int inex2;
+
+ /* We must restore the flags. */
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp, sizeof (mpfr_exp_t) * CHAR_BIT);
+ inex2 = mpfr_set_exp_t (tmp, MPFR_GET_EXP (x), MPFR_RNDN);
+ MPFR_ASSERTN (inex2 == 0);
+ if (MPFR_IS_NEG (y))
+ {
+ inex2 = mpfr_sub_ui (tmp, tmp, 1, MPFR_RNDN);
+ MPFR_ASSERTN (inex2 == 0);
+ }
+ mpfr_mul (tmp, tmp, y, MPFR_RNDU);
+ if (MPFR_IS_NEG (y))
+ mpfr_nextabove (tmp);
+ /* tmp doesn't necessarily fit in ebound, but that doesn't matter
+ since we get the minimum value in such a case. */
+ ebound = mpfr_get_exp_t (tmp, MPFR_RNDU);
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ if (MPFR_UNLIKELY (ebound <=
+ __gmpfr_emin - (rnd_mode == MPFR_RNDN ? 2 : 1)))
+ {
+ /* warning: mpfr_underflow rounds away from 0 for MPFR_RNDN */
+ MPFR_LOG_MSG (("early underflow detection\n", 0));
+ return mpfr_underflow (z,
+ rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
+ MPFR_SIGN (x) < 0 && is_odd (y) ? -1 : 1);
+ }
+ }
+
+ /* If y is an integer, we can use mpfr_pow_z (based on multiplications),
+ but if y is very large (I'm not sure about the best threshold -- VL),
+ we shouldn't use it, as it can be very slow and take a lot of memory
+ (and even crash or make other programs crash, as several hundred of
+ MBs may be necessary). Note that in such a case, either x = +/-2^b
+ (this case is handled below) or x^y cannot be represented exactly in
+ any precision supported by MPFR (the general case uses this property).
+ */
+ if (y_is_integer && (MPFR_GET_EXP (y) <= 256))
+ {
+ mpz_t zi;
+
+ MPFR_LOG_MSG (("special code for y not too large integer\n", 0));
+ mpz_init (zi);
+ mpfr_get_z (zi, y, MPFR_RNDN);
+ inexact = mpfr_pow_z (z, x, zi, rnd_mode);
+ mpz_clear (zi);
+ return inexact;
+ }
+
+ /* Special case (+/-2^b)^Y which could be exact. If x is negative, then
+ necessarily y is a large integer. */
+ {
+ mpfr_exp_t b = MPFR_GET_EXP (x) - 1;
+
+ MPFR_ASSERTN (b >= LONG_MIN && b <= LONG_MAX); /* FIXME... */
+ if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), b) == 0)
+ {
+ mpfr_t tmp;
+ int sgnx = MPFR_SIGN (x);
+
+ MPFR_LOG_MSG (("special case (+/-2^b)^Y\n", 0));
+ /* now x = +/-2^b, so x^y = (+/-1)^y*2^(b*y) is exact whenever b*y is
+ an integer */
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp, MPFR_PREC (y) + sizeof (long) * CHAR_BIT);
+ inexact = mpfr_mul_si (tmp, y, b, MPFR_RNDN); /* exact */
+ MPFR_ASSERTN (inexact == 0);
+ /* Note: as the exponent range has been extended, an overflow is not
+ possible (due to basic overflow and underflow checking above, as
+ the result is ~ 2^tmp), and an underflow is not possible either
+ because b is an integer (thus either 0 or >= 1). */
+ mpfr_clear_flags ();
+ inexact = mpfr_exp2 (z, tmp, rnd_mode);
+ mpfr_clear (tmp);
+ if (sgnx < 0 && is_odd (y))
+ {
+ mpfr_neg (z, z, rnd_mode);
+ inexact = -inexact;
+ }
+ /* Without the following, the overflows3 test in tpow.c fails. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (z, inexact, rnd_mode);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Case where |y * log(x)| is very small. Warning: x can be negative, in
+ that case y is a large integer. */
+ {
+ mpfr_t t;
+ mpfr_exp_t err;
+
+ /* We need an upper bound on the exponent of y * log(x). */
+ mpfr_init2 (t, 16);
+ if (MPFR_IS_POS(x))
+ mpfr_log (t, x, cmp_x_1 < 0 ? MPFR_RNDD : MPFR_RNDU); /* away from 0 */
+ else
+ {
+ /* if x < -1, round to +Inf, else round to zero */
+ mpfr_neg (t, x, (mpfr_cmp_si (x, -1) < 0) ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_log (t, t, (mpfr_cmp_ui (t, 1) < 0) ? MPFR_RNDD : MPFR_RNDU);
+ }
+ MPFR_ASSERTN (MPFR_IS_PURE_FP (t));
+ err = MPFR_GET_EXP (y) + MPFR_GET_EXP (t);
+ mpfr_clear (t);
+ mpfr_clear_flags ();
+ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (z, __gmpfr_one, - err, 0,
+ (MPFR_SIGN (y) > 0) ^ (cmp_x_1 < 0),
+ rnd_mode, expo, {});
+ }
+
+ /* General case */
+ inexact = mpfr_pow_general (z, x, y, rnd_mode, y_is_integer, &expo);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (z, inexact, rnd_mode);
+}
diff --git a/src/pow_si.c b/src/pow_si.c
new file mode 100644
index 0000000..645035e
--- /dev/null
+++ b/src/pow_si.c
@@ -0,0 +1,250 @@
+/* mpfr_pow_si -- power function x^y with y a signed int
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of y = pow_si(x,n) is done by
+ * y = pow_ui(x,n) if n >= 0
+ * y = 1 / pow_ui(x,-n) if n < 0
+ */
+
+int
+mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
+{
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, n, rnd),
+ ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+
+ if (n >= 0)
+ return mpfr_pow_ui (y, x, n, rnd);
+ else
+ {
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ int positive = MPFR_IS_POS (x) || ((unsigned long) n & 1) == 0;
+ if (MPFR_IS_INF (x))
+ MPFR_SET_ZERO (y);
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_INF (y);
+ mpfr_set_divby0 ();
+ }
+ if (positive)
+ MPFR_SET_POS (y);
+ else
+ MPFR_SET_NEG (y);
+ MPFR_RET (0);
+ }
+ }
+
+ /* detect exact powers: x^(-n) is exact iff x is a power of 2 */
+ if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), MPFR_EXP(x) - 1) == 0)
+ {
+ mpfr_exp_t expx = MPFR_EXP (x) - 1, expy;
+ MPFR_ASSERTD (n < 0);
+ /* Warning: n * expx may overflow!
+ *
+ * Some systems (apparently alpha-freebsd) abort with
+ * LONG_MIN / 1, and LONG_MIN / -1 is undefined.
+ * http://www.freebsd.org/cgi/query-pr.cgi?pr=72024
+ *
+ * Proof of the overflow checking. The expressions below are
+ * assumed to be on the rational numbers, but the word "overflow"
+ * still has its own meaning in the C context. / still denotes
+ * the integer (truncated) division, and // denotes the exact
+ * division.
+ * - First, (__gmpfr_emin - 1) / n and (__gmpfr_emax - 1) / n
+ * cannot overflow due to the constraints on the exponents of
+ * MPFR numbers.
+ * - If n = -1, then n * expx = - expx, which is representable
+ * because of the constraints on the exponents of MPFR numbers.
+ * - If expx = 0, then n * expx = 0, which is representable.
+ * - If n < -1 and expx > 0:
+ * + If expx > (__gmpfr_emin - 1) / n, then
+ * expx >= (__gmpfr_emin - 1) / n + 1
+ * > (__gmpfr_emin - 1) // n,
+ * and
+ * n * expx < __gmpfr_emin - 1,
+ * i.e.
+ * n * expx <= __gmpfr_emin - 2.
+ * This corresponds to an underflow, with a null result in
+ * the rounding-to-nearest mode.
+ * + If expx <= (__gmpfr_emin - 1) / n, then n * expx cannot
+ * overflow since 0 < expx <= (__gmpfr_emin - 1) / n and
+ * 0 > n * expx >= n * ((__gmpfr_emin - 1) / n)
+ * >= __gmpfr_emin - 1.
+ * - If n < -1 and expx < 0:
+ * + If expx < (__gmpfr_emax - 1) / n, then
+ * expx <= (__gmpfr_emax - 1) / n - 1
+ * < (__gmpfr_emax - 1) // n,
+ * and
+ * n * expx > __gmpfr_emax - 1,
+ * i.e.
+ * n * expx >= __gmpfr_emax.
+ * This corresponds to an overflow (2^(n * expx) has an
+ * exponent > __gmpfr_emax).
+ * + If expx >= (__gmpfr_emax - 1) / n, then n * expx cannot
+ * overflow since 0 > expx >= (__gmpfr_emax - 1) / n and
+ * 0 < n * expx <= n * ((__gmpfr_emax - 1) / n)
+ * <= __gmpfr_emax - 1.
+ * Note: one could use expx bounds based on MPFR_EXP_MIN and
+ * MPFR_EXP_MAX instead of __gmpfr_emin and __gmpfr_emax. The
+ * current bounds do not lead to noticeably slower code and
+ * allow us to avoid a bug in Sun's compiler for Solaris/x86
+ * (when optimizations are enabled); known affected versions:
+ * cc: Sun C 5.8 2005/10/13
+ * cc: Sun C 5.8 Patch 121016-02 2006/03/31
+ * cc: Sun C 5.8 Patch 121016-04 2006/10/18
+ */
+ expy =
+ n != -1 && expx > 0 && expx > (__gmpfr_emin - 1) / n ?
+ MPFR_EMIN_MIN - 2 /* Underflow */ :
+ n != -1 && expx < 0 && expx < (__gmpfr_emax - 1) / n ?
+ MPFR_EMAX_MAX /* Overflow */ : n * expx;
+ return mpfr_set_si_2exp (y, n % 2 ? MPFR_INT_SIGN (x) : 1,
+ expy, rnd);
+ }
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t;
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny; /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_rnd_t rnd1;
+ int size_n;
+ int inexact;
+ unsigned long abs_n;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ abs_n = - (unsigned long) n;
+ count_leading_zeros (size_n, (mp_limb_t) abs_n);
+ size_n = GMP_NUMB_BITS - size_n;
+
+ /* initial working precision */
+ Ny = MPFR_PREC (y);
+ Nt = Ny + size_n + 3 + MPFR_INT_CEIL_LOG2 (Ny);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+
+ /* We will compute rnd(rnd1(1/x) ^ |n|), where rnd1 is the rounding
+ toward sign(x), to avoid spurious overflow or underflow, as in
+ mpfr_pow_z. */
+ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ :
+ (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD);
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* compute (1/x)^|n| */
+ MPFR_BLOCK (flags, mpfr_ui_div (t, 1, x, rnd1));
+ MPFR_ASSERTD (! MPFR_UNDERFLOW (flags));
+ /* t = (1/x)*(1+theta) where |theta| <= 2^(-Nt) */
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
+ goto overflow;
+ MPFR_BLOCK (flags, mpfr_pow_ui (t, t, abs_n, rnd));
+ /* t = (1/x)^|n|*(1+theta')^(|n|+1) where |theta'| <= 2^(-Nt).
+ If (|n|+1)*2^(-Nt) <= 1/2, which is satisfied as soon as
+ Nt >= bits(n)+2, then we can use Lemma \ref{lemma_graillat}
+ from algorithms.tex, which yields x^n*(1+theta) with
+ |theta| <= 2(|n|+1)*2^(-Nt), thus the error is bounded by
+ 2(|n|+1) ulps <= 2^(bits(n)+2) ulps. */
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
+ {
+ overflow:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ MPFR_LOG_MSG (("overflow\n", 0));
+ return mpfr_overflow (y, rnd, abs_n & 1 ?
+ MPFR_SIGN (x) : MPFR_SIGN_POS);
+ }
+ if (MPFR_UNLIKELY (MPFR_UNDERFLOW (flags)))
+ {
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ MPFR_LOG_MSG (("underflow\n", 0));
+ if (rnd == MPFR_RNDN)
+ {
+ mpfr_t y2, nn;
+
+ /* We cannot decide now whether the result should be
+ rounded toward zero or away from zero. So, like
+ in mpfr_pow_pos_z, let's use the general case of
+ mpfr_pow in precision 2. */
+ MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_SIGN (x),
+ MPFR_EXP (x) - 1) != 0);
+ mpfr_init2 (y2, 2);
+ mpfr_init2 (nn, sizeof (long) * CHAR_BIT);
+ inexact = mpfr_set_si (nn, n, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_pow_general (y2, x, nn, rnd, 1,
+ (mpfr_save_expo_t *) NULL);
+ mpfr_clear (nn);
+ mpfr_set (y, y2, MPFR_RNDN);
+ mpfr_clear (y2);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
+ goto end;
+ }
+ else
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, rnd, abs_n & 1 ?
+ MPFR_SIGN (x) : MPFR_SIGN_POS);
+ }
+ }
+ /* error estimate -- see pow function in algorithms.ps */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - size_n - 2, Ny, rnd)))
+ break;
+
+ /* actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd);
+ mpfr_clear (t);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd);
+ }
+ }
+}
diff --git a/src/pow_ui.c b/src/pow_ui.c
new file mode 100644
index 0000000..377aee1
--- /dev/null
+++ b/src/pow_ui.c
@@ -0,0 +1,164 @@
+/* mpfr_pow_ui-- compute the power of a floating-point
+ by a machine integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* sets y to x^n, and return 0 if exact, non-zero otherwise */
+int
+mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd)
+{
+ unsigned long m;
+ mpfr_t res;
+ mpfr_prec_t prec, err;
+ int inexact;
+ mpfr_rnd_t rnd1;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg n=%lu rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, n, rnd),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ /* x^0 = 1 for any x, even a NaN */
+ if (MPFR_UNLIKELY (n == 0))
+ return mpfr_set_ui (y, 1, rnd);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ /* Inf^n = Inf, (-Inf)^n = Inf for n even, -Inf for n odd */
+ if (MPFR_IS_NEG (x) && (n & 1) == 1)
+ MPFR_SET_NEG (y);
+ else
+ MPFR_SET_POS (y);
+ MPFR_SET_INF (y);
+ MPFR_RET (0);
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ /* 0^n = 0 for any n */
+ MPFR_SET_ZERO (y);
+ if (MPFR_IS_POS (x) || (n & 1) == 0)
+ MPFR_SET_POS (y);
+ else
+ MPFR_SET_NEG (y);
+ MPFR_RET (0);
+ }
+ }
+ else if (MPFR_UNLIKELY (n <= 2))
+ {
+ if (n < 2)
+ /* x^1 = x */
+ return mpfr_set (y, x, rnd);
+ else
+ /* x^2 = sqr(x) */
+ return mpfr_sqr (y, x, rnd);
+ }
+
+ /* Augment exponent range */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* setup initial precision */
+ prec = MPFR_PREC (y) + 3 + GMP_NUMB_BITS
+ + MPFR_INT_CEIL_LOG2 (MPFR_PREC (y));
+ mpfr_init2 (res, prec);
+
+ rnd1 = MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD; /* away */
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ int i;
+
+ for (m = n, i = 0; m; i++, m >>= 1)
+ ;
+ /* now 2^(i-1) <= n < 2^i */
+ MPFR_ASSERTD (prec > (mpfr_prec_t) i);
+ err = prec - 1 - (mpfr_prec_t) i;
+ /* First step: compute square from x */
+ MPFR_BLOCK (flags,
+ inexact = mpfr_mul (res, x, x, MPFR_RNDU);
+ MPFR_ASSERTD (i >= 2);
+ if (n & (1UL << (i-2)))
+ inexact |= mpfr_mul (res, res, x, rnd1);
+ for (i -= 3; i >= 0 && !MPFR_BLOCK_EXCEP; i--)
+ {
+ inexact |= mpfr_mul (res, res, res, MPFR_RNDU);
+ if (n & (1UL << i))
+ inexact |= mpfr_mul (res, res, x, rnd1);
+ });
+ /* let r(n) be the number of roundings: we have r(2)=1, r(3)=2,
+ and r(2n)=2r(n)+1, r(2n+1)=2r(n)+2, thus r(n)=n-1.
+ Using Higham's method, to each rounding corresponds a factor
+ (1-theta) with 0 <= theta <= 2^(1-p), thus at the end the
+ absolute error is bounded by (n-1)*2^(1-p)*res <= 2*(n-1)*ulp(res)
+ since 2^(-p)*x <= ulp(x). Since n < 2^i, this gives a maximal
+ error of 2^(1+i)*ulp(res).
+ */
+ if (MPFR_LIKELY (inexact == 0
+ || MPFR_OVERFLOW (flags) || MPFR_UNDERFLOW (flags)
+ || MPFR_CAN_ROUND (res, err, MPFR_PREC (y), rnd)))
+ break;
+ /* Actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (res, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags) || MPFR_UNDERFLOW (flags)))
+ {
+ mpz_t z;
+
+ /* Internal overflow or underflow. However the approximation error has
+ * not been taken into account. So, let's solve this problem by using
+ * mpfr_pow_z, which can handle it. This case could be improved in the
+ * future, without having to use mpfr_pow_z.
+ */
+ MPFR_LOG_MSG (("Internal overflow or underflow,"
+ " let's use mpfr_pow_z.\n", 0));
+ mpfr_clear (res);
+ MPFR_SAVE_EXPO_FREE (expo);
+ mpz_init (z);
+ mpz_set_ui (z, n);
+ inexact = mpfr_pow_z (y, x, z, rnd);
+ mpz_clear (z);
+ return inexact;
+ }
+
+ inexact = mpfr_set (y, res, rnd);
+ mpfr_clear (res);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd);
+}
diff --git a/src/pow_z.c b/src/pow_z.c
new file mode 100644
index 0000000..df356ee
--- /dev/null
+++ b/src/pow_z.c
@@ -0,0 +1,373 @@
+/* mpfr_pow_z -- power function x^z with z a MPZ
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* y <- x^|z| with z != 0
+ if cr=1: ensures correct rounding of y
+ if cr=0: does not ensure correct rounding, but avoid spurious overflow
+ or underflow, and uses the precision of y as working precision (warning,
+ y and x might be the same variable). */
+static int
+mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd, int cr)
+{
+ mpfr_t res;
+ mpfr_prec_t prec, err;
+ int inexact;
+ mpfr_rnd_t rnd1, rnd2;
+ mpz_t absz;
+ mp_size_t size_z;
+ MPFR_ZIV_DECL (loop);
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg z=%Zd rnd=%d cr=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, z, rnd, cr),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ MPFR_ASSERTD (mpz_sgn (z) != 0);
+
+ if (MPFR_UNLIKELY (mpz_cmpabs_ui (z, 1) == 0))
+ return mpfr_set (y, x, rnd);
+
+ absz[0] = z[0];
+ SIZ (absz) = ABS(SIZ(absz)); /* Hack to get abs(z) */
+ MPFR_MPZ_SIZEINBASE2 (size_z, z);
+
+ /* round toward 1 (or -1) to avoid spurious overflow or underflow,
+ i.e. if an overflow or underflow occurs, it is a real exception
+ and is not just due to the rounding error. */
+ rnd1 = (MPFR_EXP(x) >= 1) ? MPFR_RNDZ
+ : (MPFR_IS_POS(x) ? MPFR_RNDU : MPFR_RNDD);
+ rnd2 = (MPFR_EXP(x) >= 1) ? MPFR_RNDD : MPFR_RNDU;
+
+ if (cr != 0)
+ prec = MPFR_PREC (y) + 3 + size_z + MPFR_INT_CEIL_LOG2 (MPFR_PREC (y));
+ else
+ prec = MPFR_PREC (y);
+ mpfr_init2 (res, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ unsigned int inexmul; /* will be non-zero if res may be inexact */
+ mp_size_t i = size_z;
+
+ /* now 2^(i-1) <= z < 2^i */
+ /* see below (case z < 0) for the error analysis, which is identical,
+ except if z=n, the maximal relative error is here 2(n-1)2^(-prec)
+ instead of 2(2n-1)2^(-prec) for z<0. */
+ MPFR_ASSERTD (prec > (mpfr_prec_t) i);
+ err = prec - 1 - (mpfr_prec_t) i;
+
+ MPFR_BLOCK (flags,
+ inexmul = mpfr_mul (res, x, x, rnd2);
+ MPFR_ASSERTD (i >= 2);
+ if (mpz_tstbit (absz, i - 2))
+ inexmul |= mpfr_mul (res, res, x, rnd1);
+ for (i -= 3; i >= 0 && !MPFR_BLOCK_EXCEP; i--)
+ {
+ inexmul |= mpfr_mul (res, res, res, rnd2);
+ if (mpz_tstbit (absz, i))
+ inexmul |= mpfr_mul (res, res, x, rnd1);
+ });
+ if (MPFR_LIKELY (inexmul == 0 || cr == 0
+ || MPFR_OVERFLOW (flags) || MPFR_UNDERFLOW (flags)
+ || MPFR_CAN_ROUND (res, err, MPFR_PREC (y), rnd)))
+ break;
+ /* Can't decide correct rounding, increase the precision */
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (res, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ /* Check Overflow */
+ if (MPFR_OVERFLOW (flags))
+ {
+ MPFR_LOG_MSG (("overflow\n", 0));
+ inexact = mpfr_overflow (y, rnd, mpz_odd_p (absz) ?
+ MPFR_SIGN (x) : MPFR_SIGN_POS);
+ }
+ /* Check Underflow */
+ else if (MPFR_UNDERFLOW (flags))
+ {
+ MPFR_LOG_MSG (("underflow\n", 0));
+ if (rnd == MPFR_RNDN)
+ {
+ mpfr_t y2, zz;
+
+ /* We cannot decide now whether the result should be rounded
+ toward zero or +Inf. So, let's use the general case of
+ mpfr_pow, which can do that. But the problem is that the
+ result can be exact! However, it is sufficient to try to
+ round on 2 bits (the precision does not matter in case of
+ underflow, since MPFR does not have subnormals), in which
+ case, the result cannot be exact due to previous filtering
+ of trivial cases. */
+ MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_SIGN (x),
+ MPFR_EXP (x) - 1) != 0);
+ mpfr_init2 (y2, 2);
+ mpfr_init2 (zz, ABS (SIZ (z)) * GMP_NUMB_BITS);
+ inexact = mpfr_set_z (zz, z, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_pow_general (y2, x, zz, rnd, 1,
+ (mpfr_save_expo_t *) NULL);
+ mpfr_clear (zz);
+ mpfr_set (y, y2, MPFR_RNDN);
+ mpfr_clear (y2);
+ __gmpfr_flags = MPFR_FLAGS_INEXACT | MPFR_FLAGS_UNDERFLOW;
+ }
+ else
+ {
+ inexact = mpfr_underflow (y, rnd, mpz_odd_p (absz) ?
+ MPFR_SIGN (x) : MPFR_SIGN_POS);
+ }
+ }
+ else
+ inexact = mpfr_set (y, res, rnd);
+
+ mpfr_clear (res);
+ return inexact;
+}
+
+/* The computation of y = pow(x,z) is done by
+ * y = set_ui(1) if z = 0
+ * y = pow_ui(x,z) if z > 0
+ * y = pow_ui(1/x,-z) if z < 0
+ *
+ * Note: in case z < 0, we could also compute 1/pow_ui(x,-z). However, in
+ * case MAX < 1/MIN, where MAX is the largest positive value, i.e.,
+ * MAX = nextbelow(+Inf), and MIN is the smallest positive value, i.e.,
+ * MIN = nextabove(+0), then x^(-z) might produce an overflow, whereas
+ * x^z is representable.
+ */
+
+int
+mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd)
+{
+ int inexact;
+ mpz_t tmp;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg z=%Zd rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, z, rnd),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ /* x^0 = 1 for any x, even a NaN */
+ if (MPFR_UNLIKELY (mpz_sgn (z) == 0))
+ return mpfr_set_ui (y, 1, rnd);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ /* Inf^n = Inf, (-Inf)^n = Inf for n even, -Inf for n odd */
+ /* Inf ^(-n) = 0, sign = + if x>0 or z even */
+ if (mpz_sgn (z) > 0)
+ MPFR_SET_INF (y);
+ else
+ MPFR_SET_ZERO (y);
+ if (MPFR_UNLIKELY (MPFR_IS_NEG (x) && mpz_odd_p (z)))
+ MPFR_SET_NEG (y);
+ else
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO(x));
+ if (mpz_sgn (z) > 0)
+ /* 0^n = +/-0 for any n */
+ MPFR_SET_ZERO (y);
+ else
+ {
+ /* 0^(-n) if +/- INF */
+ MPFR_SET_INF (y);
+ mpfr_set_divby0 ();
+ }
+ if (MPFR_LIKELY (MPFR_IS_POS (x) || mpz_even_p (z)))
+ MPFR_SET_POS (y);
+ else
+ MPFR_SET_NEG (y);
+ MPFR_RET(0);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* detect exact powers: x^-n is exact iff x is a power of 2
+ Do it if n > 0 too as this is faster and this filtering is
+ needed in case of underflow. */
+ if (MPFR_UNLIKELY (mpfr_cmp_si_2exp (x, MPFR_SIGN (x),
+ MPFR_EXP (x) - 1) == 0))
+ {
+ mpfr_exp_t expx = MPFR_EXP (x); /* warning: x and y may be the same
+ variable */
+
+ MPFR_LOG_MSG (("x^n with x power of two\n", 0));
+ mpfr_set_si (y, mpz_odd_p (z) ? MPFR_INT_SIGN(x) : 1, rnd);
+ MPFR_ASSERTD (MPFR_IS_FP (y));
+ mpz_init (tmp);
+ mpz_mul_si (tmp, z, expx - 1);
+ MPFR_ASSERTD (MPFR_GET_EXP (y) == 1);
+ mpz_add_ui (tmp, tmp, 1);
+ inexact = 0;
+ if (MPFR_UNLIKELY (mpz_cmp_si (tmp, __gmpfr_emin) < 0))
+ {
+ MPFR_LOG_MSG (("underflow\n", 0));
+ /* |y| is a power of two, thus |y| <= 2^(emin-2), and in
+ rounding to nearest, the value must be rounded to 0. */
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
+ inexact = mpfr_underflow (y, rnd, MPFR_SIGN (y));
+ }
+ else if (MPFR_UNLIKELY (mpz_cmp_si (tmp, __gmpfr_emax) > 0))
+ {
+ MPFR_LOG_MSG (("overflow\n", 0));
+ inexact = mpfr_overflow (y, rnd, MPFR_SIGN (y));
+ }
+ else
+ MPFR_SET_EXP (y, mpz_get_si (tmp));
+ mpz_clear (tmp);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ }
+ else if (mpz_sgn (z) > 0)
+ {
+ inexact = mpfr_pow_pos_z (y, x, z, rnd, 1);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ }
+ else
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t;
+ mpfr_prec_t Nt; /* Precision of the intermediary variable */
+ mpfr_rnd_t rnd1;
+ mp_size_t size_z;
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_MPZ_SIZEINBASE2 (size_z, z);
+
+ /* initial working precision */
+ Nt = MPFR_PREC (y);
+ Nt = Nt + size_z + 3 + MPFR_INT_CEIL_LOG2 (Nt);
+ /* ensures Nt >= bits(z)+2 */
+
+ /* initialise of intermediary variable */
+ mpfr_init2 (t, Nt);
+
+ /* We will compute rnd(rnd1(1/x) ^ (-z)), where rnd1 is the rounding
+ toward sign(x), to avoid spurious overflow or underflow. */
+ rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ :
+ (MPFR_SIGN (x) > 0 ? MPFR_RNDU : MPFR_RNDD);
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* compute (1/x)^(-z), -z>0 */
+ /* As emin = -emax, an underflow cannot occur in the division.
+ And if an overflow occurs, then this means that x^z overflows
+ too (since we have rounded toward 1 or -1). */
+ MPFR_BLOCK (flags, mpfr_ui_div (t, 1, x, rnd1));
+ MPFR_ASSERTD (! MPFR_UNDERFLOW (flags));
+ /* t = (1/x)*(1+theta) where |theta| <= 2^(-Nt) */
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
+ goto overflow;
+ MPFR_BLOCK (flags, mpfr_pow_pos_z (t, t, z, rnd, 0));
+ /* Now if z=-n, t = x^z*(1+theta)^(2n-1) where |theta| <= 2^(-Nt),
+ with theta maybe different from above. If (2n-1)*2^(-Nt) <= 1/2,
+ which is satisfied as soon as Nt >= bits(z)+2, then we can use
+ Lemma \ref{lemma_graillat} from algorithms.tex, which yields
+ t = x^z*(1+theta) with |theta| <= 2(2n-1)*2^(-Nt), thus the
+ error is bounded by 2(2n-1) ulps <= 2^(bits(z)+2) ulps. */
+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
+ {
+ overflow:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ MPFR_LOG_MSG (("overflow\n", 0));
+ return mpfr_overflow (y, rnd,
+ mpz_odd_p (z) ? MPFR_SIGN (x) :
+ MPFR_SIGN_POS);
+ }
+ if (MPFR_UNLIKELY (MPFR_UNDERFLOW (flags)))
+ {
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ MPFR_LOG_MSG (("underflow\n", 0));
+ if (rnd == MPFR_RNDN)
+ {
+ mpfr_t y2, zz;
+
+ /* We cannot decide now whether the result should be
+ rounded toward zero or away from zero. So, like
+ in mpfr_pow_pos_z, let's use the general case of
+ mpfr_pow in precision 2. */
+ MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_SIGN (x),
+ MPFR_EXP (x) - 1) != 0);
+ mpfr_init2 (y2, 2);
+ mpfr_init2 (zz, ABS (SIZ (z)) * GMP_NUMB_BITS);
+ inexact = mpfr_set_z (zz, z, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_pow_general (y2, x, zz, rnd, 1,
+ (mpfr_save_expo_t *) NULL);
+ mpfr_clear (zz);
+ mpfr_set (y, y2, MPFR_RNDN);
+ mpfr_clear (y2);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_UNDERFLOW);
+ goto end;
+ }
+ else
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, rnd, mpz_odd_p (z) ?
+ MPFR_SIGN (x) : MPFR_SIGN_POS);
+ }
+ }
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - size_z - 2, MPFR_PREC (y),
+ rnd)))
+ break;
+ /* actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd);
+ mpfr_clear (t);
+ }
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd);
+}
diff --git a/src/powerof2.c b/src/powerof2.c
new file mode 100644
index 0000000..76ce6b9
--- /dev/null
+++ b/src/powerof2.c
@@ -0,0 +1,49 @@
+/* mpfr_powerof2_raw -- test whether a floating-point number is a power of 2
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* This is an internal function and one assumes that x is a non-special
+ * number (more precisely, only its significand is considered and this
+ * function can be used even if the exponent field of x has not been
+ * initialized). It returns 1 (true) if |x| is a power of 2, else 0.
+ */
+
+int
+mpfr_powerof2_raw (mpfr_srcptr x)
+{
+ mp_limb_t *xp;
+ mp_size_t xn;
+
+ /* This is an internal function, and we may call it with some
+ wrong numbers (ie good mantissa but wrong flags or exp)
+ So we don't want to test if it is a pure FP.
+ MPFR_ASSERTN(MPFR_IS_PURE_FP(x)); */
+ xp = MPFR_MANT(x);
+ xn = (MPFR_PREC(x) - 1) / GMP_NUMB_BITS;
+ if (xp[xn] != MPFR_LIMB_HIGHBIT)
+ return 0;
+ while (xn > 0)
+ if (xp[--xn] != 0)
+ return 0;
+ return 1;
+}
diff --git a/src/powerpc32/mparam.h b/src/powerpc32/mparam.h
new file mode 100644
index 0000000..44e9667
--- /dev/null
+++ b/src/powerpc32/mparam.h
@@ -0,0 +1,232 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2010-10-22, gcc 4.2.4, gmp 5.0.1 */
+/* RS/6000 7025 F50 kindly provided by David Kirkby, under AIX 5.3 */
+/* used MPFR svn revision 7238 */
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,40,40,40,40,40,40, \
+ 40,40,40,40,40,44,48,48,48,48,48,48,48,48,48,48, \
+ 48,48,48,48,52,52,52,52,52,52,52,52,52,52,52,64, \
+ 64,64,64,64,74,74,74,75,74,75,75,75,75,75,75,75, \
+ 75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75, \
+ 75,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93, \
+ 105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105, \
+ 105,105,124,124,124,124,124,124,124,124,124,124,124,124,124,124, \
+ 124,124,124,124,124,124,140,140,140,140,140,140,140,140,156,156, \
+ 156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156, \
+ 156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156, \
+ 156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156, \
+ 156,156,156,156,156,156,156,156,186,186,186,186,186,186,186,186, \
+ 186,186,186,186,186,186,186,186,186,186,186,186,186,186,210,210, \
+ 210,210,234,234,234,234,234,234,234,234,234,234,234,234,234,234, \
+ 234,234,234,234,234,234,234,233,234,234,234,234,234,234,234,234, \
+ 234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234, \
+ 234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234, \
+ 234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234, \
+ 234,280,280,280,280,280,280,280,312,312,312,312,312,312,312,312, \
+ 312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312, \
+ 312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312, \
+ 312,312,312,312,312,312,312,312,312,344,344,344,344,344,344,312, \
+ 344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, \
+ 344,344,344,344,344,344,376,376,376,376,376,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,407,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,584,584,584,584,584,584,584,584,584,584,584, \
+ 584,584,584,584,584,584,584,584,583,584,583,584,584,584,584,584, \
+ 592,584,592,584,592,592,592,592,592,584,592,592,592,584,584,584, \
+ 584,584,584,584,584,584,584,584,584,584,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,591,592,591,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,591,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,735,736,735,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,832,832,736, \
+ 832,831,832,832,832,832,832,832,832,832,832,832,832,832,832,832, \
+ 832,832,831,832,832,832,832,832,832,832,832,832,832,832,832,832, \
+ 832,832,832,832,832,832,832,832,832,832,832,832,832,832,832,832 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,7,8,8,9,9, \
+ 10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17, \
+ 18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25, \
+ 26,26,27,28,28,28,30,32,32,32,32,32,32,32,34,34, \
+ 36,36,36,36,36,40,40,40,40,40,40,40,42,42,42,44, \
+ 44,44,46,46,46,46,46,46,46,46,47,47,56,56,56,56, \
+ 56,56,56,56,60,64,64,64,64,64,64,64,64,64,64,64, \
+ 64,64,64,68,68,72,72,72,72,72,72,72,72,76,76,76, \
+ 76,76,76,76,68,72,72,72,72,72,76,76,76,76,76,76, \
+ 76,76,76,76,76,76,77,77,87,90,93,93,93,93,93,93, \
+ 93,96,99,99,99,99,93,96,93,93,96,99,99,102,99,99, \
+ 105,102,105,105,105,105,108,108,108,111,111,111,111,111,117,117, \
+ 117,117,117,117,117,117,123,123,123,123,123,123,123,126,126,129, \
+ 129,123,129,129,129,129,129,129,129,129,129,129,129,129,129,129, \
+ 129,123,123,123,123,123,123,123,126,129,129,129,129,129,129,129, \
+ 129,129,129,129,129,129,164,164,164,164,164,164,164,164,164,164, \
+ 172,172,172,172,172,172,156,156,156,156,156,156,156,156,156,163, \
+ 164,164,164,164,164,171,171,171,172,172,172,172,172,172,172,180, \
+ 180,179,180,180,180,180,180,180,180,180,180,180,180,180,180,180, \
+ 180,180,180,180,198,198,198,198,180,198,198,198,210,210,210,210, \
+ 210,210,210,210,210,210,210,222,222,222,222,222,222,222,222,222, \
+ 222,222,222,222,234,234,234,234,234,234,234,234,234,234,234,234, \
+ 234,234,246,246,246,246,246,246,246,246,246,246,246,246,246,246, \
+ 258,246,246,258,258,258,258,258,258,258,258,258,258,270,270,270, \
+ 270,270,270,270,270,270,270,270,270,270,270,270,270,270,270,270, \
+ 270,270,270,270,270,270,270,270,270,270,270,270,270,270,270,270, \
+ 270,270,270,270,270,270,270,270,270,270,270,270,270,270,312,270, \
+ 312,312,312,270,270,270,270,270,270,270,270,328,328,312,328,328, \
+ 328,328,328,328,328,328,328,344,344,312,328,344,328,328,328,328, \
+ 328,328,328,328,328,328,328,328,328,328,328,327,328,328,328,328, \
+ 328,344,328,328,328,328,328,328,344,344,344,344,344,344,344,344, \
+ 344,344,344,360,360,360,360,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,360,360,360,328,328,360,328,328,328, \
+ 328,328,360,328,328,328,328,328,328,328,328,344,344,344,344,344, \
+ 344,344,344,344,344,344,344,344,344,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, \
+ 408,408,408,408,408,408,408,408,408,408,440,440,440,440,440,439, \
+ 440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, \
+ 440,440,440,440,440,440,440,440,440,440,440,440,440,472,472,440, \
+ 440,471,504,472,472,472,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,472,472,472,472,472,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,504,504,504,504,536,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,536,536,536,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 504,504,504,504,568,568,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,504,600,600,600,600,600,600,600,536,536,536,535, \
+ 535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,536,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,567,568,568,568,568,568,568, \
+ 568,568,568,568,568,567,568,568,568,568,568,568,600,600,600,599, \
+ 600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,568,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,599,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,7,10,9,12,13,12,9, \
+ 12,12,12,12,12,12,15,15,16,15,16,16,16,19,20,20, \
+ 20,19,19,19,20,20,21,21,22,23,23,24,25,25,25,25, \
+ 26,26,27,27,28,28,29,29,31,31,31,31,32,35,33,33, \
+ 34,36,35,35,36,36,37,37,38,38,40,39,40,40,41,41, \
+ 42,42,43,48,44,48,47,45,47,47,47,48,48,48,49,49, \
+ 50,51,51,51,52,52,53,53,54,55,56,55,56,63,57,64, \
+ 63,64,64,64,64,64,62,64,64,63,64,64,72,64,72,65, \
+ 66,72,72,71,72,71,71,70,80,71,71,71,80,72,73,80, \
+ 74,79,80,80,80,80,80,80,80,79,80,80,80,80,81,81, \
+ 82,88,85,95,84,96,96,88,96,96,95,95,96,96,96,96, \
+ 96,95,96,104,96,96,96,94,96,95,104,96,96,96,104,104, \
+ 98,104,100,104,104,104,104,104,103,104,104,103,104,104,105,105, \
+ 106,106,128,110,108,128,128,128,128,128,128,128,128,128,128,128, \
+ 128,128,128,128,127,128,128,128,127,124,128,128,126,126,128,125, \
+ 128,128,127,128,128,128,128,128,128,127,128,128,148,128,146,129, \
+ 130,148,144,147,150,148,150,148,148,150,147,150,144,148,150,148, \
+ 150,150,160,148,160,148,148,150,148,149,150,150,160,148,150,148, \
+ 148,150,147,150,150,150,149,149,160,150,151,151,152,156,156,156, \
+ 154,156,160,160,160,156,159,157,158,160,160,160,160,160,161,161, \
+ 162,168,176,192,186,192,186,186,186,192,192,184,192,186,184,192, \
+ 185,186,191,192,192,191,186,192,192,192,192,192,192,192,192,192, \
+ 192,190,192,192,190,192,192,192,186,192,192,192,192,192,192,192, \
+ 192,192,192,192,192,192,192,191,192,192,191,192,192,208,208,208, \
+ 194,208,208,208,208,207,208,208,208,208,207,208,206,208,201,208, \
+ 208,208,204,208,208,208,208,208,208,208,208,208,208,208,209,209, \
+ 210,210,211,211,212,248,256,216,216,248,254,256,256,248,255,256, \
+ 256,256,256,255,256,256,256,255,256,256,256,248,256,256,248,256, \
+ 256,255,256,256,254,256,256,256,248,255,256,256,256,256,254,256, \
+ 256,248,256,247,256,256,256,256,256,256,256,255,255,255,256,256, \
+ 256,254,256,256,253,255,256,256,256,255,256,256,256,253,256,288, \
+ 256,256,296,256,256,296,300,296,296,288,300,299,312,312,312,312, \
+ 288,312,294,311,312,312,299,300,312,296,312,300,300,296,295,299, \
+ 312,300,310,312,296,312,310,312,312,311,312,312,311,312,312,312, \
+ 312,312,311,312,312,312,310,311,312,310,312,312,310,311,311,312, \
+ 312,312,312,312,299,300,300,312,312,312,311,312,312,312,312,312, \
+ 312,312,312,312,310,300,311,310,312,312,312,312,308,300,312,312, \
+ 312,310,311,310,311,311,312,301,312,312,312,311,312,312,312,312, \
+ 311,312,312,312,312,312,312,312,312,312,311,312,312,312,313,313, \
+ 314,314,315,320,320,372,320,320,320,372,372,371,371,372,324,372, \
+ 371,371,372,370,369,371,371,372,372,372,372,372,370,370,372,370, \
+ 371,372,370,372,372,372,372,372,371,371,372,372,370,372,372,372, \
+ 370,372,372,372,370,372,372,370,372,370,370,371,372,371,384,372, \
+ 371,384,368,372,384,370,383,372,384,383,384,384,384,384,384,372, \
+ 372,384,372,372,369,370,372,370,372,368,372,372,372,372,371,370, \
+ 372,372,371,416,384,384,384,416,415,383,383,416,384,384,372,372, \
+ 416,370,371,372,372,415,373,417,415,416,384,384,384,416,416,417, \
+ 417,416,384,416,416,384,415,415,416,384,414,416,414,416,416,417, \
+ 386,408,416,416,416,408,416,416,414,416,417,417,417,416,414,416, \
+ 415,416,416,416,414,416,408,415,415,417,414,407,415,416,416,415, \
+ 416,416,417,416,416,415,416,416,416,416,415,416,416,416,419,415, \
+ 416,416,415,414,415,416,417,413,416,417,416,416,416,416,417,417, \
+ 418,418,419,419,420,420,421,421,422,444,432,430,496,443,496,496, \
+ 432,432,432,468,468,468,468,444,495,466,496,496,496,494,496,496, \
+ 496,468,512,494,496,496,496,496,468,496,493,496,492,496,496,512, \
+ 496,496,496,495,495,495,496,496,496,496,496,512,496,496,512,496, \
+ 496,493,496,496,496,509,496,512,512,496,512,496,512,512,496,495, \
+ 496,512,511,511,512,512,512,511,512,511,495,496,511,511,512,511, \
+ 512,512,493,495,495,495,512,493,495,560,496,496,496,496,496,560, \
+ 496,560,492,496,560,495,494,496,496,495,496,495,496,560,511,496, \
+ 512,509,512,495,494,496,511,496,560,496,512,512,511,496,575,512, \
+ 560,496,496,495,585,511,621,495,621,511,622,624,623,511,624,620, \
+ 624,623,511,620,620,624,591,623,624,622,623,620,624,613,624,624, \
+ 560,623,624,624,624,621,622,623,624,623,576,624,624,624,624,620 \
+
+#define MPFR_MUL_THRESHOLD 8 /* limbs */
+#define MPFR_SQR_THRESHOLD 1 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 530 /* bits */
+#define MPFR_EXP_THRESHOLD 7030 /* bits */
+#define MPFR_SINCOS_THRESHOLD 10754 /* bits */
+#define MPFR_AI_THRESHOLD1 -30447 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 3973
+#define MPFR_AI_THRESHOLD3 46501
+/* Tuneup completed successfully, took 12578 seconds */
diff --git a/src/powerpc64/mparam.h b/src/powerpc64/mparam.h
new file mode 100644
index 0000000..b220950
--- /dev/null
+++ b/src/powerpc64/mparam.h
@@ -0,0 +1,233 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */
+/* generated on gcc40.fsffrance.org (IBM PowerPC 970 G5) with GMP 5.0.2 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,10,11,12,13,12,13,16,14,18,18,18,18,18,20,20, \
+ 22,22,23,24,24,26,24,24,26,26,26,28,26,32,36,36, \
+ 32,36,36,36,36,36,36,36,36,36,36,40,40,36,44,44, \
+ 44,44,44,44,48,48,48,44,44,44,48,48,48,48,48,48, \
+ 52,52,52,52,52,52,63,57,57,63,63,63,63,63,63,63, \
+ 63,69,69,69,69,69,69,75,75,69,75,72,75,74,75,75, \
+ 75,75,75,75,75,75,81,81,81,81,81,93,93,93,93,93, \
+ 93,93,105,104,105,105,105,105,105,105,105,104,105,105,105,105, \
+ 105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105, \
+ 105,105,105,105,117,117,105,117,117,117,117,129,117,129,117,129, \
+ 129,129,129,129,129,129,129,129,129,129,129,129,129,129,141,129, \
+ 141,141,141,141,141,141,141,141,141,141,156,156,156,156,156,156, \
+ 156,156,156,156,156,156,156,156,156,156,156,156,156,172,172,172, \
+ 172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172, \
+ 188,172,172,188,172,188,188,188,188,188,188,188,188,188,188,187, \
+ 188,188,188,210,210,210,210,210,210,210,210,210,210,210,210,210, \
+ 210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210, \
+ 210,234,210,210,234,234,234,210,234,234,234,234,234,234,234,234, \
+ 234,234,234,234,234,258,234,234,258,234,258,258,258,258,258,258, \
+ 258,258,258,258,258,258,258,258,258,258,258,258,258,258,258,258, \
+ 258,258,258,258,258,257,258,258,282,282,282,282,282,281,282,282, \
+ 282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282, \
+ 312,282,282,312,282,282,282,312,312,312,312,282,312,312,312,312, \
+ 312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312, \
+ 312,312,312,312,344,344,344,344,344,344,344,344,344,344,344,344, \
+ 344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,343, \
+ 344,343,344,344,344,344,344,344,344,344,344,344,376,376,376,376, \
+ 344,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,376,376,376,376,376,376,408,376, \
+ 408,408,408,408,376,376,408,408,376,408,408,408,408,376,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,448,448,408,408,407, \
+ 408,408,408,448,408,448,448,448,448,408,448,448,448,448,448,448, \
+ 448,448,448,448,448,448,448,496,496,496,496,496,496,496,448,496, \
+ 496,496,496,496,496,496,496,496,496,496,496,496,496,496,496,496, \
+ 496,496,496,496,496,496,496,496,496,496,496,496,496,496,496,496, \
+ 496,496,496,496,496,496,496,496,496,496,496,496,496,496,496,496, \
+ 496,496,496,496,496,496,496,496,496,496,496,496,496,496,496,496, \
+ 496,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544, \
+ 544,544,544,544,544,544,544,544,544,544,543,544,544,544,544,544, \
+ 544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544, \
+ 544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544, \
+ 544,544,592,592,592,592,567,544,568,568,568,592,592,592,592,592, \
+ 592,592,568,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,591,592,592,592,592,592,592, \
+ 592,592,592,592,592,592,592,592,592,592,640,592,640,592,640,640, \
+ 640,640,639,640,640,640,640,639,640,639,640,640,639,640,640,639, \
+ 640,639,640,640,640,640,640,640,640,640,640,640,640,640,640,639, \
+ 640,639,640,639,639,640,640,639,639,640,640,640,736,736,736,736, \
+ 735,736,736,736,736,735,736,736,736,735,736,736,736,735,734,735, \
+ 736,735,736,736,736,736,736,736,736,736,736,736,736,736,736,735, \
+ 736,736,736,735,736,736,736,736,736,736,736,735,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,735,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,735,736,736,736,735,736,832,832,831,831,832,832,832,831, \
+ 832,832,832,832,832,831,832,831,832,832,831,832,832,832,832,832, \
+ 832,832,832,831,832,832,832,832,832,832,832,832,832,831,832,832, \
+ 832,832,832,832,832,832,832,831,832,832,832,832,832,832,832,832, \
+ 832,832,831,832,832,832,832,831,832,830,832,832,832,832,832,832, \
+ 832,832,832,832,832,832,832,831,832,832,832,832,832,832,832,832, \
+ 832,832,832,832,832,832,832,832,832,832,832,832,832,832,832,832 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,10,9, \
+ 10,10,12,12,12,12,14,13,14,14,15,15,16,16,17,17, \
+ 18,18,19,20,20,20,22,22,22,22,23,23,25,25,26,25, \
+ 26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,34, \
+ 34,34,35,35,36,36,38,38,40,38,42,40,40,42,42,44, \
+ 42,42,44,44,44,44,46,46,46,46,50,48,52,48,50,52, \
+ 50,50,52,52,52,52,53,53,54,54,56,56,56,56,58,60, \
+ 58,58,60,60,60,60,63,63,63,63,63,63,66,66,66,72, \
+ 66,66,75,75,75,75,69,69,72,72,75,75,75,75,78,75, \
+ 75,75,75,75,78,78,78,81,78,81,81,81,81,81,81,87, \
+ 84,84,87,87,87,90,90,87,87,90,93,87,96,93,90,90, \
+ 99,96,102,99,96,93,99,93,99,96,96,96,96,99,99,99, \
+ 99,99,99,99,105,102,102,102,102,102,105,105,105,105,105,105, \
+ 111,111,111,111,111,111,117,111,111,111,111,111,123,117,117,123, \
+ 129,129,129,129,123,129,129,123,129,129,129,123,129,129,135,129, \
+ 129,129,135,135,129,135,134,135,135,135,135,135,135,141,135,129, \
+ 135,141,135,135,135,135,135,135,135,135,135,135,141,141,141,138, \
+ 138,141,141,141,141,141,141,141,147,144,147,146,147,147,146,147, \
+ 153,146,153,147,152,153,153,153,153,153,153,153,153,153,153,153, \
+ 164,164,164,164,164,172,164,171,172,172,172,172,172,172,172,164, \
+ 164,164,172,180,172,180,180,172,172,180,172,171,172,172,172,180, \
+ 180,180,180,180,180,180,180,188,188,187,187,188,188,188,180,196, \
+ 196,196,180,180,196,196,203,204,204,204,204,204,204,204,210,210, \
+ 188,188,188,210,188,188,222,222,204,196,222,222,222,222,204,222, \
+ 204,204,204,204,204,234,234,222,234,234,234,234,210,222,222,234, \
+ 246,246,222,222,222,222,246,222,222,234,258,258,258,258,234,258, \
+ 258,258,258,258,234,234,234,258,246,246,270,246,258,246,246,246, \
+ 246,246,258,258,258,258,258,258,258,258,258,258,258,258,258,258, \
+ 270,270,258,270,270,258,270,270,270,270,258,258,270,270,258,270, \
+ 258,258,258,258,258,258,258,270,257,258,258,270,258,270,258,270, \
+ 270,270,270,270,258,270,270,258,270,270,270,270,258,270,282,270, \
+ 270,270,270,270,270,270,270,270,270,270,270,282,270,282,282,282, \
+ 282,270,282,282,282,282,282,306,282,306,306,294,282,306,306,306, \
+ 312,306,294,306,306,306,306,306,270,306,306,306,306,306,306,282, \
+ 306,282,282,282,282,282,282,328,282,282,344,344,328,344,282,344, \
+ 344,282,328,344,344,344,344,306,306,306,344,306,306,306,344,344, \
+ 360,344,344,344,344,344,344,344,306,360,344,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,360,328,344,344,344,344,344,344,344, \
+ 344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, \
+ 344,344,344,344,360,344,344,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,376,376,360,360,360,376,376,360,376,376,376,376,376, \
+ 376,376,376,376,376,376,376,376,392,392,392,408,408,376,408,408, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,408,424,408,408,424,408,408,424, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,407,408,408, \
+ 408,407,407,408,408,408,424,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,408,408,424,408,424,424,424,424,424,424, \
+ 424,424,424,424,424,424,408,408,408,408,408,407,440,440,408,408, \
+ 408,440,440,424,424,440,424,424,424,424,424,424,424,424,424,424, \
+ 424,424,424,440,440,408,440,440,440,472,440,440,472,440,440,440, \
+ 440,472,440,440,440,424,472,440,472,440,472,424,424,440,424,424, \
+ 424,440,440,424,440,440,440,472,472,440,440,472,440,472,472,472, \
+ 472,472,472,424,440,424,424,423,424,424,472,440,424,424,472,440, \
+ 440,440,440,440,440,472,440,472,440,440,472,440,440,440,472,440, \
+ 440,440,440,440,440,440,440,456,440,472,439,440,440,456,456,472, \
+ 472,472,472,471,471,472,472,472,472,472,472,472,471,472,472,472, \
+ 472,472,471,471,472,472,472,471,472,472,472,472,472,472,472,472, \
+ 472,472,472,471,472,472,472,472,472,471,472,472,472,472,472,472, \
+ 472,472,472,472,471,472,472,519,520,472,520,472,472,472,591,592, \
+ 520,520,520,520,520,592,592,592,592,568,592,592,520,520,520,592, \
+ 520,544,520,544,592,544,520,543,544,544,544,520,520,520,592,519, \
+ 568,568,592,592,592,592,568,592,568,568,592,568,568,592,568,592, \
+ 568,568,592,592,544,568,592,592,592,592,592,568,592,592,592,592, \
+ 592,592,591,592,592,592,592,592,592,592,592,568,592,592,592,568 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,6,9,8,9,10,8,12,13, \
+ 10,10,11,12,13,14,14,13,15,14,15,17,17,18,19,20, \
+ 21,21,19,21,20,20,23,21,22,22,23,24,25,24,26,28, \
+ 27,27,27,27,29,28,29,35,32,32,32,32,32,36,35,36, \
+ 36,36,36,36,36,36,39,40,40,40,43,40,47,40,43,42, \
+ 44,47,43,43,44,44,47,48,48,48,48,48,48,48,52,50, \
+ 52,52,52,52,52,52,56,55,64,64,55,64,64,64,64,64, \
+ 64,72,64,72,72,64,64,72,64,72,72,72,72,70,72,72, \
+ 72,72,72,72,72,72,72,72,72,72,72,72,80,72,80,80, \
+ 80,80,80,80,80,80,80,88,80,88,88,80,87,80,88,88, \
+ 88,88,88,96,88,88,88,96,88,96,96,96,88,96,96,96, \
+ 96,96,96,96,96,96,96,96,96,96,96,96,96,104,104,104, \
+ 104,104,100,104,104,104,104,103,104,102,104,104,104,104,112,120, \
+ 112,112,126,126,126,126,126,126,126,126,126,126,126,126,126,126, \
+ 144,126,126,128,144,144,128,126,144,144,144,144,144,144,144,128, \
+ 144,144,144,144,144,128,144,144,144,144,144,144,144,144,144,144, \
+ 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, \
+ 144,144,144,144,144,144,144,144,144,144,144,144,144,144,150,160, \
+ 160,156,150,156,160,160,160,160,160,156,160,160,160,160,160,160, \
+ 160,160,160,160,160,160,160,160,160,160,160,160,160,160,174,176, \
+ 176,176,176,192,186,192,174,176,192,192,192,192,192,174,192,192, \
+ 192,192,192,192,192,192,208,186,192,192,186,192,192,192,192,192, \
+ 192,192,192,192,192,192,192,208,192,208,192,192,208,192,208,208, \
+ 208,208,208,208,192,208,208,207,208,192,204,208,208,208,208,208, \
+ 208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208, \
+ 208,208,208,208,208,208,208,208,208,208,208,208,208,208,209,209, \
+ 256,220,216,216,256,252,256,240,240,252,252,256,224,252,256,256, \
+ 252,256,256,240,252,256,256,256,256,256,256,256,256,252,252,256, \
+ 256,256,252,256,252,256,256,256,288,288,254,256,256,288,288,288, \
+ 288,252,252,288,288,288,288,288,288,288,288,288,288,288,288,252, \
+ 288,288,288,288,288,288,288,288,288,288,256,288,288,288,252,257, \
+ 288,256,256,256,288,288,288,288,288,288,288,288,288,288,288,288, \
+ 288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,288, \
+ 288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,288, \
+ 288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,288, \
+ 288,288,288,288,288,288,288,288,288,288,288,288,288,288,312,312, \
+ 312,300,312,312,312,312,312,312,312,320,312,312,312,312,312,312, \
+ 312,312,312,312,320,312,320,320,320,320,320,320,320,320,320,320, \
+ 312,344,320,312,344,320,312,312,320,344,320,336,342,344,344,344, \
+ 320,344,344,320,344,320,320,320,352,352,352,352,352,352,352,372, \
+ 372,368,368,384,344,372,368,384,369,368,384,372,370,368,376,370, \
+ 372,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384, \
+ 384,384,372,372,384,372,384,344,368,368,384,384,384,408,384,372, \
+ 384,384,384,416,416,416,384,416,384,416,416,416,416,416,384,384, \
+ 384,384,384,415,384,384,416,416,416,384,384,384,384,416,384,384, \
+ 384,416,384,384,372,384,417,416,384,416,416,416,384,416,416,416, \
+ 416,416,416,384,384,416,416,384,384,384,416,416,417,416,416,416, \
+ 416,416,416,417,417,417,416,418,416,415,416,416,416,416,416,415, \
+ 416,417,417,416,417,416,415,416,416,416,416,417,416,413,416,416, \
+ 416,416,416,416,416,416,416,417,416,416,418,416,415,416,416,417, \
+ 416,416,416,416,416,416,416,416,416,416,417,416,416,416,416,415, \
+ 416,416,417,416,416,417,416,416,416,416,416,416,416,416,417,419, \
+ 419,420,420,444,420,420,432,512,468,504,456,456,456,456,514,512, \
+ 512,512,456,504,456,444,512,512,504,512,513,512,512,504,512,512, \
+ 512,512,513,513,512,512,513,504,512,512,513,512,512,504,512,512, \
+ 513,514,513,512,512,513,513,504,512,504,512,512,512,513,512,512, \
+ 510,512,512,512,512,512,512,512,513,512,515,512,513,512,504,512, \
+ 512,514,516,512,512,512,512,512,512,513,512,512,513,513,513,514, \
+ 515,512,512,504,564,512,512,512,512,512,512,576,561,512,576,564, \
+ 576,512,512,576,512,512,512,515,564,512,513,576,564,564,576,512, \
+ 512,510,512,564,576,576,512,576,576,514,576,576,512,564,576,576, \
+ 512,513,576,512,512,513,514,512,512,576,576,512,513,576,513,515, \
+ 552,552,576,512,512,512,564,513,564,576,576,576,564,576,564,576, \
+ 564,512,576,564,564,576,576,564,564,576,564,576,564,576,551,576 \
+
+#define MPFR_MUL_THRESHOLD 1 /* limbs */
+#define MPFR_SQR_THRESHOLD 5 /* limbs */
+#define MPFR_DIV_THRESHOLD 17 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 966 /* bits */
+#define MPFR_EXP_THRESHOLD 10924 /* bits */
+#define MPFR_SINCOS_THRESHOLD 36978 /* bits */
+#define MPFR_AI_THRESHOLD1 -12626 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 1377
+#define MPFR_AI_THRESHOLD3 24323
+/* Tuneup completed successfully, took 2598 seconds */
diff --git a/src/print_raw.c b/src/print_raw.c
new file mode 100644
index 0000000..08b7baf
--- /dev/null
+++ b/src/print_raw.c
@@ -0,0 +1,129 @@
+/* mpfr_print_binary -- print the internal binary representation of a
+ floating-point number
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_fprint_binary (FILE *stream, mpfr_srcptr x)
+{
+ if (MPFR_IS_NAN (x))
+ {
+ fprintf (stream, "@NaN@");
+ return;
+ }
+
+ if (MPFR_SIGN (x) < 0)
+ fprintf (stream, "-");
+
+ if (MPFR_IS_INF (x))
+ fprintf (stream, "@Inf@");
+ else if (MPFR_IS_ZERO (x))
+ fprintf (stream, "0");
+ else
+ {
+ mp_limb_t *mx;
+ mpfr_prec_t px;
+ mp_size_t n;
+
+ mx = MPFR_MANT (x);
+ px = MPFR_PREC (x);
+
+ fprintf (stream, "0.");
+ for (n = (px - 1) / GMP_NUMB_BITS; ; n--)
+ {
+ mp_limb_t wd, t;
+
+ MPFR_ASSERTN (n >= 0);
+ wd = mx[n];
+ for (t = MPFR_LIMB_HIGHBIT; t != 0; t >>= 1)
+ {
+ putc ((wd & t) == 0 ? '0' : '1', stream);
+ if (--px == 0)
+ {
+ mpfr_exp_t ex;
+
+ ex = MPFR_GET_EXP (x);
+ MPFR_ASSERTN (ex >= LONG_MIN && ex <= LONG_MAX);
+ fprintf (stream, "E%ld", (long) ex);
+ return;
+ }
+ }
+ }
+ }
+}
+
+void
+mpfr_print_binary (mpfr_srcptr x)
+{
+ mpfr_fprint_binary (stdout, x);
+}
+
+void
+mpfr_print_mant_binary(const char *str, const mp_limb_t *p, mpfr_prec_t r)
+{
+ int i;
+ mpfr_prec_t count = 0;
+ char c;
+ mp_size_t n = MPFR_PREC2LIMBS (r);
+
+ printf("%s ", str);
+ for(n-- ; n>=0 ; n--)
+ {
+ for(i = GMP_NUMB_BITS-1 ; i >=0 ; i--)
+ {
+ c = (p[n] & (((mp_limb_t)1L)<<i)) ? '1' : '0';
+ putchar(c);
+ count++;
+ if (count == r)
+ putchar('[');
+ }
+ putchar('.');
+ }
+ putchar('\n');
+}
+
+void
+mpfr_dump_mant (const mp_limb_t *p, mpfr_prec_t r, mpfr_prec_t precx,
+ mpfr_prec_t error)
+{
+ int i;
+ mpfr_prec_t count = 0;
+ char c;
+ mp_size_t n = MPFR_PREC2LIMBS (r);
+
+ for(n-- ; n>=0 ; n--)
+ {
+ for(i = GMP_NUMB_BITS-1 ; i >=0 ; i--)
+ {
+ c = (p[n] & (((mp_limb_t)1L)<<i)) ? '1' : '0';
+ putchar(c);
+ count++;
+ if (count == precx)
+ putchar (',');
+ if (count == error)
+ putchar('[');
+ }
+ putchar('.');
+ }
+ putchar('\n');
+}
diff --git a/src/print_rnd_mode.c b/src/print_rnd_mode.c
new file mode 100644
index 0000000..65269c7
--- /dev/null
+++ b/src/print_rnd_mode.c
@@ -0,0 +1,46 @@
+/* mpfr_print_rnd_mode -- convert a given rounding mode to a string
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+const char *
+mpfr_print_rnd_mode (mpfr_rnd_t rnd_mode)
+{
+ /* If we forget to update this function after a new rounding mode
+ is added, this will be detected by the following assertion. */
+ MPFR_ASSERTN (MPFR_RND_MAX == MPFR_RNDA + 1);
+ switch (rnd_mode)
+ {
+ case MPFR_RNDD:
+ return "MPFR_RNDD";
+ case MPFR_RNDU:
+ return "MPFR_RNDU";
+ case MPFR_RNDN:
+ return "MPFR_RNDN";
+ case MPFR_RNDZ:
+ return "MPFR_RNDZ";
+ case MPFR_RNDA:
+ return "MPFR_RNDA";
+ default:
+ return (const char*) 0;
+ }
+}
diff --git a/src/printf.c b/src/printf.c
new file mode 100644
index 0000000..10a67c4
--- /dev/null
+++ b/src/printf.c
@@ -0,0 +1,215 @@
+/* mpfr_printf -- printf function and friends.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* The mpfr_printf-like functions are defined only if <stdarg.h> exists */
+#ifdef HAVE_STDARG
+
+#include <stdarg.h>
+
+#ifndef HAVE_VA_COPY
+# ifdef HAVE___VA_COPY
+# define va_copy(dst,src) __va_copy(dst, src)
+# else
+/* autoconf manual advocates this fallback.
+ This is also the solution chosen by gmp */
+# define va_copy(dst,src) \
+ do { memcpy(&(dst), &(src), sizeof(va_list)); } while (0)
+# endif /* HAVE___VA_COPY */
+#endif /* HAVE_VA_COPY */
+
+#include <errno.h>
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_FILE
+
+/* Each printf-like function calls mpfr_vasprintf which
+ - returns the number of characters in the returned string excluding the
+ terminating null
+ - returns -1 and sets the erange flag if the number of produced characters
+ exceeds INT_MAX (in that case, also sets errno to EOVERFLOW in POSIX
+ systems) */
+
+#define GET_STR_VA(sz, str, fmt, ap) \
+ do \
+ { \
+ sz = mpfr_vasprintf (&(str), fmt, ap); \
+ if (sz < 0) \
+ { \
+ if (str) \
+ mpfr_free_str (str); \
+ return -1; \
+ } \
+ } while (0)
+
+#define GET_STR(sz, str, fmt) \
+ do \
+ { \
+ va_list ap; \
+ va_start(ap, fmt); \
+ sz = mpfr_vasprintf (&(str), fmt, ap); \
+ va_end (ap); \
+ if (sz < 0) \
+ { \
+ if (str) \
+ mpfr_free_str (str); \
+ return -1; \
+ } \
+ } while (0)
+
+int
+mpfr_printf (const char *fmt, ...)
+{
+ char *str;
+ int ret;
+
+ GET_STR (ret, str, fmt);
+ ret = printf ("%s", str);
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+int
+mpfr_vprintf (const char *fmt, va_list ap)
+{
+ char *str;
+ int ret;
+
+ GET_STR_VA (ret, str, fmt, ap);
+ ret = printf ("%s", str);
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+
+int
+mpfr_fprintf (FILE *fp, const char *fmt, ...)
+{
+ char *str;
+ int ret;
+
+ GET_STR (ret, str, fmt);
+ ret = fprintf (fp, "%s", str);
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+int
+mpfr_vfprintf (FILE *fp, const char *fmt, va_list ap)
+{
+ char *str;
+ int ret;
+
+ GET_STR_VA (ret, str, fmt, ap);
+ ret = fprintf (fp, "%s", str);
+
+ mpfr_free_str (str);
+ return ret;
+}
+#endif /* _MPFR_H_HAVE_FILE */
+
+int
+mpfr_sprintf (char *buf, const char *fmt, ...)
+{
+ char *str;
+ int ret;
+
+ GET_STR (ret, str, fmt);
+ ret = sprintf (buf, "%s", str);
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+int
+mpfr_vsprintf (char *buf, const char *fmt, va_list ap)
+{
+ char *str;
+ int ret;
+
+ GET_STR_VA (ret, str, fmt, ap);
+ ret = sprintf (buf, "%s", str);
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+int
+mpfr_snprintf (char *buf, size_t size, const char *fmt, ...)
+{
+ char *str;
+ int ret;
+ size_t min_size;
+
+ GET_STR (ret, str, fmt);
+
+ /* C99 allows SIZE to be zero */
+ if (size != 0)
+ {
+ MPFR_ASSERTN (buf != NULL);
+ min_size = (size_t)ret < size ? (size_t)ret : size - 1;
+ strncpy (buf, str, min_size);
+ buf[min_size] = '\0';
+ }
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+int
+mpfr_vsnprintf (char *buf, size_t size, const char *fmt, va_list ap)
+{
+ char *str;
+ int ret;
+ int min_size;
+
+ GET_STR_VA (ret, str, fmt, ap);
+
+ /* C99 allows SIZE to be zero */
+ if (size != 0)
+ {
+ MPFR_ASSERTN (buf != NULL);
+ min_size = (size_t)ret < size ? (size_t)ret : size - 1;
+ strncpy (buf, str, min_size);
+ buf[min_size] = '\0';
+ }
+
+ mpfr_free_str (str);
+ return ret;
+}
+
+int
+mpfr_asprintf (char **pp, const char *fmt, ...)
+{
+ int ret;
+
+ GET_STR (ret, *pp, fmt);
+
+ return ret;
+}
+#endif /* HAVE_STDARG */
diff --git a/src/rec_sqrt.c b/src/rec_sqrt.c
new file mode 100644
index 0000000..f3ccf72
--- /dev/null
+++ b/src/rec_sqrt.c
@@ -0,0 +1,556 @@
+/* mpfr_rec_sqrt -- inverse square root
+
+Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MPFR_NEED_LONGLONG_H /* for umul_ppmm */
+#include "mpfr-impl.h"
+
+#define LIMB_SIZE(x) ((((x)-1)>>MPFR_LOG2_GMP_NUMB_BITS) + 1)
+
+#define MPFR_COM_N(x,y,n) \
+ { \
+ mp_size_t i; \
+ for (i = 0; i < n; i++) \
+ *((x)+i) = ~*((y)+i); \
+ }
+
+/* Put in X a p-bit approximation of 1/sqrt(A),
+ where X = {x, n}/B^n, n = ceil(p/GMP_NUMB_BITS),
+ A = 2^(1+as)*{a, an}/B^an, as is 0 or 1, an = ceil(ap/GMP_NUMB_BITS),
+ where B = 2^GMP_NUMB_BITS.
+
+ We have 1 <= A < 4 and 1/2 <= X < 1.
+
+ The error in the approximate result with respect to the true
+ value 1/sqrt(A) is bounded by 1 ulp(X), i.e., 2^{-p} since 1/2 <= X < 1.
+
+ Note: x and a are left-aligned, i.e., the most significant bit of
+ a[an-1] is set, and so is the most significant bit of the output x[n-1].
+
+ If p is not a multiple of GMP_NUMB_BITS, the extra low bits of the input
+ A are taken into account to compute the approximation of 1/sqrt(A), but
+ whether or not they are zero, the error between X and 1/sqrt(A) is bounded
+ by 1 ulp(X) [in precision p].
+ The extra low bits of the output X (if p is not a multiple of GMP_NUMB_BITS)
+ are set to 0.
+
+ Assumptions:
+ (1) A should be normalized, i.e., the most significant bit of a[an-1]
+ should be 1. If as=0, we have 1 <= A < 2; if as=1, we have 2 <= A < 4.
+ (2) p >= 12
+ (3) {a, an} and {x, n} should not overlap
+ (4) GMP_NUMB_BITS >= 12 and is even
+
+ Note: this routine is much more efficient when ap is small compared to p,
+ including the case where ap <= GMP_NUMB_BITS, thus it can be used to
+ implement an efficient mpfr_rec_sqrt_ui function.
+
+ References:
+ [1] Modern Computer Algebra, Richard Brent and Paul Zimmermann,
+ http://www.loria.fr/~zimmerma/mca/pub226.html
+*/
+static void
+mpfr_mpn_rec_sqrt (mpfr_limb_ptr x, mpfr_prec_t p,
+ mpfr_limb_srcptr a, mpfr_prec_t ap, int as)
+
+{
+ /* the following T1 and T2 are bipartite tables giving initial
+ approximation for the inverse square root, with 13-bit input split in
+ 5+4+4, and 11-bit output. More precisely, if 2048 <= i < 8192,
+ with i = a*2^8 + b*2^4 + c, we use for approximation of
+ 2048/sqrt(i/2048) the value x = T1[16*(a-8)+b] + T2[16*(a-8)+c].
+ The largest error is obtained for i = 2054, where x = 2044,
+ and 2048/sqrt(i/2048) = 2045.006576...
+ */
+ static short int T1[384] = {
+2040, 2033, 2025, 2017, 2009, 2002, 1994, 1987, 1980, 1972, 1965, 1958, 1951,
+1944, 1938, 1931, /* a=8 */
+1925, 1918, 1912, 1905, 1899, 1892, 1886, 1880, 1874, 1867, 1861, 1855, 1849,
+1844, 1838, 1832, /* a=9 */
+1827, 1821, 1815, 1810, 1804, 1799, 1793, 1788, 1783, 1777, 1772, 1767, 1762,
+1757, 1752, 1747, /* a=10 */
+1742, 1737, 1733, 1728, 1723, 1718, 1713, 1709, 1704, 1699, 1695, 1690, 1686,
+1681, 1677, 1673, /* a=11 */
+1669, 1664, 1660, 1656, 1652, 1647, 1643, 1639, 1635, 1631, 1627, 1623, 1619,
+1615, 1611, 1607, /* a=12 */
+1603, 1600, 1596, 1592, 1588, 1585, 1581, 1577, 1574, 1570, 1566, 1563, 1559,
+1556, 1552, 1549, /* a=13 */
+1545, 1542, 1538, 1535, 1532, 1528, 1525, 1522, 1518, 1515, 1512, 1509, 1505,
+1502, 1499, 1496, /* a=14 */
+1493, 1490, 1487, 1484, 1481, 1478, 1475, 1472, 1469, 1466, 1463, 1460, 1457,
+1454, 1451, 1449, /* a=15 */
+1446, 1443, 1440, 1438, 1435, 1432, 1429, 1427, 1424, 1421, 1419, 1416, 1413,
+1411, 1408, 1405, /* a=16 */
+1403, 1400, 1398, 1395, 1393, 1390, 1388, 1385, 1383, 1380, 1378, 1375, 1373,
+1371, 1368, 1366, /* a=17 */
+1363, 1360, 1358, 1356, 1353, 1351, 1349, 1346, 1344, 1342, 1340, 1337, 1335,
+1333, 1331, 1329, /* a=18 */
+1327, 1325, 1323, 1321, 1319, 1316, 1314, 1312, 1310, 1308, 1306, 1304, 1302,
+1300, 1298, 1296, /* a=19 */
+1294, 1292, 1290, 1288, 1286, 1284, 1282, 1280, 1278, 1276, 1274, 1272, 1270,
+1268, 1266, 1265, /* a=20 */
+1263, 1261, 1259, 1257, 1255, 1253, 1251, 1250, 1248, 1246, 1244, 1242, 1241,
+1239, 1237, 1235, /* a=21 */
+1234, 1232, 1230, 1229, 1227, 1225, 1223, 1222, 1220, 1218, 1217, 1215, 1213,
+1212, 1210, 1208, /* a=22 */
+1206, 1204, 1203, 1201, 1199, 1198, 1196, 1195, 1193, 1191, 1190, 1188, 1187,
+1185, 1184, 1182, /* a=23 */
+1181, 1180, 1178, 1177, 1175, 1174, 1172, 1171, 1169, 1168, 1166, 1165, 1163,
+1162, 1160, 1159, /* a=24 */
+1157, 1156, 1154, 1153, 1151, 1150, 1149, 1147, 1146, 1144, 1143, 1142, 1140,
+1139, 1137, 1136, /* a=25 */
+1135, 1133, 1132, 1131, 1129, 1128, 1127, 1125, 1124, 1123, 1121, 1120, 1119,
+1117, 1116, 1115, /* a=26 */
+1114, 1113, 1111, 1110, 1109, 1108, 1106, 1105, 1104, 1103, 1101, 1100, 1099,
+1098, 1096, 1095, /* a=27 */
+1093, 1092, 1091, 1090, 1089, 1087, 1086, 1085, 1084, 1083, 1081, 1080, 1079,
+1078, 1077, 1076, /* a=28 */
+1075, 1073, 1072, 1071, 1070, 1069, 1068, 1067, 1065, 1064, 1063, 1062, 1061,
+1060, 1059, 1058, /* a=29 */
+1057, 1056, 1055, 1054, 1052, 1051, 1050, 1049, 1048, 1047, 1046, 1045, 1044,
+1043, 1042, 1041, /* a=30 */
+1040, 1039, 1038, 1037, 1036, 1035, 1034, 1033, 1032, 1031, 1030, 1029, 1028,
+1027, 1026, 1025 /* a=31 */
+};
+ static unsigned char T2[384] = {
+ 7, 7, 6, 6, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1, 1, 0, /* a=8 */
+ 6, 5, 5, 5, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 0, 0, /* a=9 */
+ 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, /* a=10 */
+ 4, 4, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, /* a=11 */
+ 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, /* a=12 */
+ 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* a=13 */
+ 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* a=14 */
+ 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* a=15 */
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* a=16 */
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* a=17 */
+ 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, /* a=18 */
+ 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, /* a=19 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* a=20 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, /* a=21 */
+ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a=22 */
+ 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, /* a=23 */
+ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a=24 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* a=25 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* a=26 */
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a=27 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* a=28 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, /* a=29 */
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a=30 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* a=31 */
+};
+ mp_size_t n = LIMB_SIZE(p); /* number of limbs of X */
+ mp_size_t an = LIMB_SIZE(ap); /* number of limbs of A */
+
+ /* A should be normalized */
+ MPFR_ASSERTD((a[an - 1] & MPFR_LIMB_HIGHBIT) != 0);
+ /* We should have enough bits in one limb and GMP_NUMB_BITS should be even.
+ Since that does not depend on MPFR, we always check this. */
+ MPFR_ASSERTN((GMP_NUMB_BITS >= 12) && ((GMP_NUMB_BITS & 1) == 0));
+ /* {a, an} and {x, n} should not overlap */
+ MPFR_ASSERTD((a + an <= x) || (x + n <= a));
+ MPFR_ASSERTD(p >= 11);
+
+ if (MPFR_UNLIKELY(an > n)) /* we can cut the input to n limbs */
+ {
+ a += an - n;
+ an = n;
+ }
+
+ if (p == 11) /* should happen only from recursive calls */
+ {
+ unsigned long i, ab, ac;
+ mp_limb_t t;
+
+ /* take the 12+as most significant bits of A */
+ i = a[an - 1] >> (GMP_NUMB_BITS - (12 + as));
+ /* if one wants faithful rounding for p=11, replace #if 0 by #if 1 */
+ ab = i >> 4;
+ ac = (ab & 0x3F0) | (i & 0x0F);
+ t = (mp_limb_t) T1[ab - 0x80] + (mp_limb_t) T2[ac - 0x80];
+ x[0] = t << (GMP_NUMB_BITS - p);
+ }
+ else /* p >= 12 */
+ {
+ mpfr_prec_t h, pl;
+ mpfr_limb_ptr r, s, t, u;
+ mp_size_t xn, rn, th, ln, tn, sn, ahn, un;
+ mp_limb_t neg, cy, cu;
+ MPFR_TMP_DECL(marker);
+
+ /* compared to Algorithm 3.9 of [1], we have {a, an} = A/2 if as=0,
+ and A/4 if as=1. */
+
+ /* h = max(11, ceil((p+3)/2)) is the bitsize of the recursive call */
+ h = (p < 18) ? 11 : (p >> 1) + 2;
+
+ xn = LIMB_SIZE(h); /* limb size of the recursive Xh */
+ rn = LIMB_SIZE(2 * h); /* a priori limb size of Xh^2 */
+ ln = n - xn; /* remaining limbs to be computed */
+
+ /* Since |Xh - A^{-1/2}| <= 2^{-h}, then by multiplying by Xh + A^{-1/2}
+ we get |Xh^2 - 1/A| <= 2^{-h+1}, thus |A*Xh^2 - 1| <= 2^{-h+3},
+ thus the h-3 most significant bits of t should be zero,
+ which is in fact h+1+as-3 because of the normalization of A.
+ This corresponds to th=floor((h+1+as-3)/GMP_NUMB_BITS) limbs.
+
+ More precisely we have |Xh^2 - 1/A| <= 2^{-h} * (Xh + A^{-1/2})
+ <= 2^{-h} * (2 A^{-1/2} + 2^{-h}) <= 2.001 * 2^{-h} * A^{-1/2}
+ since A < 4 and h >= 11, thus
+ |A*Xh^2 - 1| <= 2.001 * 2^{-h} * A^{1/2} <= 1.001 * 2^{2-h}.
+ This is sufficient to prove that the upper limb of {t,tn} below is
+ less that 0.501 * 2^GMP_NUMB_BITS, thus cu = 0 below.
+ */
+ th = (h + 1 + as - 3) >> MPFR_LOG2_GMP_NUMB_BITS;
+ tn = LIMB_SIZE(2 * h + 1 + as);
+
+ /* we need h+1+as bits of a */
+ ahn = LIMB_SIZE(h + 1 + as); /* number of high limbs of A
+ needed for the recursive call*/
+ if (MPFR_UNLIKELY(ahn > an))
+ ahn = an;
+ mpfr_mpn_rec_sqrt (x + ln, h, a + an - ahn, ahn * GMP_NUMB_BITS, as);
+ /* the most h significant bits of X are set, X has ceil(h/GMP_NUMB_BITS)
+ limbs, the low (-h) % GMP_NUMB_BITS bits are zero */
+
+ /* compared to Algorithm 3.9 of [1], we have {x+ln,xn} = X_h */
+
+ MPFR_TMP_MARK (marker);
+ /* first step: square X in r, result is exact */
+ un = xn + (tn - th);
+ /* We use the same temporary buffer to store r and u: r needs 2*xn
+ limbs where u needs xn+(tn-th) limbs. Since tn can store at least
+ 2h bits, and th at most h bits, then tn-th can store at least h bits,
+ thus tn - th >= xn, and reserving the space for u is enough. */
+ MPFR_ASSERTD(2 * xn <= un);
+ u = r = MPFR_TMP_LIMBS_ALLOC (un);
+ if (2 * h <= GMP_NUMB_BITS) /* xn=rn=1, and since p <= 2h-3, n=1,
+ thus ln = 0 */
+ {
+ MPFR_ASSERTD(ln == 0);
+ cy = x[0] >> (GMP_NUMB_BITS >> 1);
+ r ++;
+ r[0] = cy * cy;
+ }
+ else if (xn == 1) /* xn=1, rn=2 */
+ umul_ppmm(r[1], r[0], x[ln], x[ln]);
+ else
+ {
+ mpn_mul_n (r, x + ln, x + ln, xn);
+ /* we have {r, 2*xn} = X_h^2 */
+ if (rn < 2 * xn)
+ r ++;
+ }
+ /* now the 2h most significant bits of {r, rn} contains X^2, r has rn
+ limbs, and the low (-2h) % GMP_NUMB_BITS bits are zero */
+
+ /* Second step: s <- A * (r^2), and truncate the low ap bits,
+ i.e., at weight 2^{-2h} (s is aligned to the low significant bits)
+ */
+ sn = an + rn;
+ s = MPFR_TMP_LIMBS_ALLOC (sn);
+ if (rn == 1) /* rn=1 implies n=1, since rn*GMP_NUMB_BITS >= 2h,
+ and 2h >= p+3 */
+ {
+ /* necessarily p <= GMP_NUMB_BITS-3: we can ignore the two low
+ bits from A */
+ /* since n=1, and we ensured an <= n, we also have an=1 */
+ MPFR_ASSERTD(an == 1);
+ umul_ppmm (s[1], s[0], r[0], a[0]);
+ }
+ else
+ {
+ /* we have p <= n * GMP_NUMB_BITS
+ 2h <= rn * GMP_NUMB_BITS with p+3 <= 2h <= p+4
+ thus n <= rn <= n + 1 */
+ MPFR_ASSERTD(rn <= n + 1);
+ /* since we ensured an <= n, we have an <= rn */
+ MPFR_ASSERTD(an <= rn);
+ mpn_mul (s, r, rn, a, an);
+ /* s should be near B^sn/2^(1+as), thus s[sn-1] is either
+ 100000... or 011111... if as=0, or
+ 010000... or 001111... if as=1.
+ We ignore the bits of s after the first 2h+1+as ones.
+ We have {s, rn+an} = A*X_h^2/2 if as=0, A*X_h^2/4 if as=1. */
+ }
+
+ /* We ignore the bits of s after the first 2h+1+as ones: s has rn + an
+ limbs, where rn = LIMBS(2h), an=LIMBS(a), and tn = LIMBS(2h+1+as). */
+ t = s + sn - tn; /* pointer to low limb of the high part of t */
+ /* the upper h-3 bits of 1-t should be zero,
+ where 1 corresponds to the most significant bit of t[tn-1] if as=0,
+ and to the 2nd most significant bit of t[tn-1] if as=1 */
+
+ /* compute t <- 1 - t, which is B^tn - {t, tn+1},
+ with rounding toward -Inf, i.e., rounding the input t toward +Inf.
+ We could only modify the low tn - th limbs from t, but it gives only
+ a small speedup, and would make the code more complex.
+ */
+ neg = t[tn - 1] & (MPFR_LIMB_HIGHBIT >> as);
+ if (neg == 0) /* Ax^2 < 1: we have t = th + eps, where 0 <= eps < ulp(th)
+ is the part truncated above, thus 1 - t rounded to -Inf
+ is 1 - th - ulp(th) */
+ {
+ /* since the 1+as most significant bits of t are zero, set them
+ to 1 before the one-complement */
+ t[tn - 1] |= MPFR_LIMB_HIGHBIT | (MPFR_LIMB_HIGHBIT >> as);
+ MPFR_COM_N (t, t, tn);
+ /* we should add 1 here to get 1-th complement, and subtract 1 for
+ -ulp(th), thus we do nothing */
+ }
+ else /* negative case: we want 1 - t rounded toward -Inf, i.e.,
+ th + eps rounded toward +Inf, which is th + ulp(th):
+ we discard the bit corresponding to 1,
+ and we add 1 to the least significant bit of t */
+ {
+ t[tn - 1] ^= neg;
+ mpn_add_1 (t, t, tn, 1);
+ }
+ tn -= th; /* we know at least th = floor((h+1+as-3)/GMP_NUMB_LIMBS) of
+ the high limbs of {t, tn} are zero */
+
+ /* tn = rn - th, where rn * GMP_NUMB_BITS >= 2*h and
+ th * GMP_NUMB_BITS <= h+1+as-3, thus tn > 0 */
+ MPFR_ASSERTD(tn > 0);
+
+ /* u <- x * t, where {t, tn} contains at least h+3 bits,
+ and {x, xn} contains h bits, thus tn >= xn */
+ MPFR_ASSERTD(tn >= xn);
+ if (tn == 1) /* necessarily xn=1 */
+ umul_ppmm (u[1], u[0], t[0], x[ln]);
+ else
+ mpn_mul (u, t, tn, x + ln, xn);
+
+ /* we have {u, tn+xn} = T_l X_h/2 if as=0, T_l X_h/4 if as=1 */
+
+ /* we have already discarded the upper th high limbs of t, thus we only
+ have to consider the upper n - th limbs of u */
+ un = n - th; /* un cannot be zero, since p <= n*GMP_NUMB_BITS,
+ h = ceil((p+3)/2) <= (p+4)/2,
+ th*GMP_NUMB_BITS <= h-1 <= p/2+1,
+ thus (n-th)*GMP_NUMB_BITS >= p/2-1.
+ */
+ MPFR_ASSERTD(un > 0);
+ u += (tn + xn) - un; /* xn + tn - un = xn + (original_tn - th) - (n - th)
+ = xn + original_tn - n
+ = LIMBS(h) + LIMBS(2h+1+as) - LIMBS(p) > 0
+ since 2h >= p+3 */
+ MPFR_ASSERTD(tn + xn > un); /* will allow to access u[-1] below */
+
+ /* In case as=0, u contains |x*(1-Ax^2)/2|, which is exactly what we
+ need to add or subtract.
+ In case as=1, u contains |x*(1-Ax^2)/4|, thus we need to multiply
+ u by 2. */
+
+ if (as == 1)
+ /* shift on un+1 limbs to get most significant bit of u[-1] into
+ least significant bit of u[0] */
+ mpn_lshift (u - 1, u - 1, un + 1, 1);
+
+ /* now {u,un} represents U / 2 from Algorithm 3.9 */
+
+ pl = n * GMP_NUMB_BITS - p; /* low bits from x */
+ /* We want that the low pl bits are zero after rounding to nearest,
+ thus we round u to nearest at bit pl-1 of u[0] */
+ if (pl > 0)
+ {
+ cu = mpn_add_1 (u, u, un, u[0] & (MPFR_LIMB_ONE << (pl - 1)));
+ /* mask bits 0..pl-1 of u[0] */
+ u[0] &= ~MPFR_LIMB_MASK(pl);
+ }
+ else /* round bit is in u[-1] */
+ cu = mpn_add_1 (u, u, un, u[-1] >> (GMP_NUMB_BITS - 1));
+ MPFR_ASSERTN(cu == 0);
+
+ /* We already have filled {x + ln, xn = n - ln}, and we want to add or
+ subtract {u, un} at position x.
+ un = n - th, where th contains <= h+1+as-3<=h-1 bits
+ ln = n - xn, where xn contains >= h bits
+ thus un > ln.
+ Warning: ln might be zero.
+ */
+ MPFR_ASSERTD(un > ln);
+ /* we can have un = ln + 2, for example with GMP_NUMB_BITS=32 and
+ p=62, as=0, then h=33, n=2, th=0, xn=2, thus un=2 and ln=0. */
+ MPFR_ASSERTD(un == ln + 1 || un == ln + 2);
+ /* the high un-ln limbs of u will overlap the low part of {x+ln,xn},
+ we need to add or subtract the overlapping part {u + ln, un - ln} */
+ /* Warning! th may be 0, in which case the mpn_add_1 and mpn_sub_1
+ below (with size = th) mustn't be used. */
+ if (neg == 0)
+ {
+ if (ln > 0)
+ MPN_COPY (x, u, ln);
+ cy = mpn_add (x + ln, x + ln, xn, u + ln, un - ln);
+ /* cy is the carry at x + (ln + xn) = x + n */
+ }
+ else /* negative case */
+ {
+ /* subtract {u+ln, un-ln} from {x+ln,un} */
+ cy = mpn_sub (x + ln, x + ln, xn, u + ln, un - ln);
+ /* cy is the borrow at x + (ln + xn) = x + n */
+
+ /* cy cannot be non-zero, since the most significant bit of Xh is 1,
+ and the correction is bounded by 2^{-h+3} */
+ MPFR_ASSERTD(cy == 0);
+ if (ln > 0)
+ {
+ MPFR_COM_N (x, u, ln);
+ /* we must add one for the 2-complement ... */
+ cy = mpn_add_1 (x, x, n, MPFR_LIMB_ONE);
+ /* ... and subtract 1 at x[ln], where n = ln + xn */
+ cy -= mpn_sub_1 (x + ln, x + ln, xn, MPFR_LIMB_ONE);
+ }
+ }
+
+ /* cy can be 1 when A=1, i.e., {a, n} = B^n. In that case we should
+ have X = B^n, and setting X to 1-2^{-p} satisties the error bound
+ of 1 ulp. */
+ if (MPFR_UNLIKELY(cy != 0))
+ {
+ cy -= mpn_sub_1 (x, x, n, MPFR_LIMB_ONE << pl);
+ MPFR_ASSERTD(cy == 0);
+ }
+
+ MPFR_TMP_FREE (marker);
+ }
+}
+
+int
+mpfr_rec_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t rp, up, wp;
+ mp_size_t rn, wn;
+ int s, cy, inex;
+ mpfr_limb_ptr x;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (u), mpfr_log_prec, u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r, inex));
+
+ /* special values */
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(u)))
+ {
+ if (MPFR_IS_NAN(u))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_ZERO(u)) /* 1/sqrt(+0) = 1/sqrt(-0) = +Inf */
+ {
+ /* 0+ or 0- */
+ MPFR_SET_INF(r);
+ MPFR_SET_POS(r);
+ mpfr_set_divby0 ();
+ MPFR_RET(0); /* Inf is exact */
+ }
+ else
+ {
+ MPFR_ASSERTD(MPFR_IS_INF(u));
+ /* 1/sqrt(-Inf) = NAN */
+ if (MPFR_IS_NEG(u))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ /* 1/sqrt(+Inf) = +0 */
+ MPFR_SET_POS(r);
+ MPFR_SET_ZERO(r);
+ MPFR_RET(0);
+ }
+ }
+
+ /* if u < 0, 1/sqrt(u) is NaN */
+ if (MPFR_UNLIKELY(MPFR_IS_NEG(u)))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+
+ MPFR_SET_POS(r);
+
+ rp = MPFR_PREC(r); /* output precision */
+ up = MPFR_PREC(u); /* input precision */
+ wp = rp + 11; /* initial working precision */
+
+ /* Let u = U*2^e, where e = EXP(u), and 1/2 <= U < 1.
+ If e is even, we compute an approximation of X of (4U)^{-1/2},
+ and the result is X*2^(-(e-2)/2) [case s=1].
+ If e is odd, we compute an approximation of X of (2U)^{-1/2},
+ and the result is X*2^(-(e-1)/2) [case s=0]. */
+
+ /* parity of the exponent of u */
+ s = 1 - ((mpfr_uexp_t) MPFR_GET_EXP (u) & 1);
+
+ rn = LIMB_SIZE(rp);
+
+ /* for the first iteration, if rp + 11 fits into rn limbs, we round up
+ up to a full limb to maximize the chance of rounding, while avoiding
+ to allocate extra space */
+ wp = rp + 11;
+ if (wp < rn * GMP_NUMB_BITS)
+ wp = rn * GMP_NUMB_BITS;
+ for (;;)
+ {
+ MPFR_TMP_MARK (marker);
+ wn = LIMB_SIZE(wp);
+ if (r == u || wn > rn) /* out of place, i.e., we cannot write to r */
+ x = MPFR_TMP_LIMBS_ALLOC (wn);
+ else
+ x = MPFR_MANT(r);
+ mpfr_mpn_rec_sqrt (x, wp, MPFR_MANT(u), up, s);
+ /* If the input was not truncated, the error is at most one ulp;
+ if the input was truncated, the error is at most two ulps
+ (see algorithms.tex). */
+ if (MPFR_LIKELY (mpfr_round_p (x, wn, wp - (wp < up),
+ rp + (rnd_mode == MPFR_RNDN))))
+ break;
+
+ /* We detect only now the exact case where u=2^(2e), to avoid
+ slowing down the average case. This can happen only when the
+ mantissa is exactly 1/2 and the exponent is odd. */
+ if (s == 0 && mpfr_cmp_ui_2exp (u, 1, MPFR_EXP(u) - 1) == 0)
+ {
+ mpfr_prec_t pl = wn * GMP_NUMB_BITS - wp;
+
+ /* we should have x=111...111 */
+ mpn_add_1 (x, x, wn, MPFR_LIMB_ONE << pl);
+ x[wn - 1] = MPFR_LIMB_HIGHBIT;
+ s += 2;
+ break; /* go through */
+ }
+ MPFR_TMP_FREE(marker);
+
+ wp += GMP_NUMB_BITS;
+ }
+ cy = mpfr_round_raw (MPFR_MANT(r), x, wp, 0, rp, rnd_mode, &inex);
+ MPFR_EXP(r) = - (MPFR_EXP(u) - 1 - s) / 2;
+ if (MPFR_UNLIKELY(cy != 0))
+ {
+ MPFR_EXP(r) ++;
+ MPFR_MANT(r)[rn - 1] = MPFR_LIMB_HIGHBIT;
+ }
+ MPFR_TMP_FREE(marker);
+ return mpfr_check_range (r, inex, rnd_mode);
+}
diff --git a/src/reldiff.c b/src/reldiff.c
new file mode 100644
index 0000000..a82400e
--- /dev/null
+++ b/src/reldiff.c
@@ -0,0 +1,73 @@
+/* mpfr_reldiff -- compute relative difference of two floating-point numbers.
+
+Copyright 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* reldiff(b, c) = abs(b-c)/b */
+void
+mpfr_reldiff (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t b_copy;
+
+ if (MPFR_ARE_SINGULAR (b, c))
+ {
+ if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c))
+ {
+ MPFR_SET_NAN(a);
+ return;
+ }
+ else if (MPFR_IS_INF(b))
+ {
+ if (MPFR_IS_INF (c) && (MPFR_SIGN (c) == MPFR_SIGN (b)))
+ MPFR_SET_ZERO(a);
+ else
+ MPFR_SET_NAN(a);
+ return;
+ }
+ else if (MPFR_IS_INF(c))
+ {
+ MPFR_SET_SAME_SIGN (a, b);
+ MPFR_SET_INF (a);
+ return;
+ }
+ else if (MPFR_IS_ZERO(b)) /* reldiff = abs(c)/c = sign(c) */
+ {
+ mpfr_set_si (a, MPFR_INT_SIGN (c), rnd_mode);
+ return;
+ }
+ /* Fall through */
+ }
+
+ if (a == b)
+ {
+ mpfr_init2 (b_copy, MPFR_PREC(b));
+ mpfr_set (b_copy, b, MPFR_RNDN);
+ }
+
+ mpfr_sub (a, b, c, rnd_mode);
+ mpfr_abs (a, a, rnd_mode); /* for compatibility with MPF */
+ mpfr_div (a, a, (a == b) ? b_copy : b, rnd_mode);
+
+ if (a == b)
+ mpfr_clear (b_copy);
+
+}
diff --git a/src/rem1.c b/src/rem1.c
new file mode 100644
index 0000000..24d5441
--- /dev/null
+++ b/src/rem1.c
@@ -0,0 +1,229 @@
+/* mpfr_rem1 -- internal function
+ mpfr_fmod -- compute the floating-point remainder of x/y
+ mpfr_remquo and mpfr_remainder -- argument reduction functions
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+# include "mpfr-impl.h"
+
+/* we return as many bits as we can, keeping just one bit for the sign */
+# define WANTED_BITS (sizeof(long) * CHAR_BIT - 1)
+
+/*
+ rem1 works as follows:
+ The first rounding mode rnd_q indicate if we are actually computing
+ a fmod (MPFR_RNDZ) or a remainder/remquo (MPFR_RNDN).
+
+ Let q = x/y rounded to an integer in the direction rnd_q.
+ Put x - q*y in rem, rounded according to rnd.
+ If quo is not null, the value stored in *quo has the sign of q,
+ and agrees with q with the 2^n low order bits.
+ In other words, *quo = q (mod 2^n) and *quo q >= 0.
+ If rem is zero, then it has the sign of x.
+ The returned 'int' is the inexact flag giving the place of rem wrt x - q*y.
+
+ If x or y is NaN: *quo is undefined, rem is NaN.
+ If x is Inf, whatever y: *quo is undefined, rem is NaN.
+ If y is Inf, x not NaN nor Inf: *quo is 0, rem is x.
+ If y is 0, whatever x: *quo is undefined, rem is NaN.
+ If x is 0, whatever y (not NaN nor 0): *quo is 0, rem is x.
+
+ Otherwise if x and y are neither NaN, Inf nor 0, q is always defined,
+ thus *quo is.
+ Since |x - q*y| <= y/2, no overflow is possible.
+ Only an underflow is possible when y is very small.
+ */
+
+static int
+mpfr_rem1 (mpfr_ptr rem, long *quo, mpfr_rnd_t rnd_q,
+ mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd)
+{
+ mpfr_exp_t ex, ey;
+ int compare, inex, q_is_odd, sign, signx = MPFR_SIGN (x);
+ mpz_t mx, my, r;
+
+ MPFR_ASSERTD (rnd_q == MPFR_RNDN || rnd_q == MPFR_RNDZ);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) || MPFR_IS_SINGULAR (y)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_NAN (y) || MPFR_IS_INF (x)
+ || MPFR_IS_ZERO (y))
+ {
+ /* for remquo, quo is undefined */
+ MPFR_SET_NAN (rem);
+ MPFR_RET_NAN;
+ }
+ else /* either y is Inf and x is 0 or non-special,
+ or x is 0 and y is non-special,
+ in both cases the quotient is zero. */
+ {
+ if (quo)
+ *quo = 0;
+ return mpfr_set (rem, x, rnd);
+ }
+ }
+
+ /* now neither x nor y is NaN, Inf or zero */
+
+ mpz_init (mx);
+ mpz_init (my);
+ mpz_init (r);
+
+ ex = mpfr_get_z_2exp (mx, x); /* x = mx*2^ex */
+ ey = mpfr_get_z_2exp (my, y); /* y = my*2^ey */
+
+ /* to get rid of sign problems, we compute it separately:
+ quo(-x,-y) = quo(x,y), rem(-x,-y) = -rem(x,y)
+ quo(-x,y) = -quo(x,y), rem(-x,y) = -rem(x,y)
+ thus quo = sign(x/y)*quo(|x|,|y|), rem = sign(x)*rem(|x|,|y|) */
+ sign = (signx == MPFR_SIGN (y)) ? 1 : -1;
+ mpz_abs (mx, mx);
+ mpz_abs (my, my);
+ q_is_odd = 0;
+
+ /* divide my by 2^k if possible to make operations mod my easier */
+ {
+ unsigned long k = mpz_scan1 (my, 0);
+ ey += k;
+ mpz_fdiv_q_2exp (my, my, k);
+ }
+
+ if (ex <= ey)
+ {
+ /* q = x/y = mx/(my*2^(ey-ex)) */
+ mpz_mul_2exp (my, my, ey - ex); /* divide mx by my*2^(ey-ex) */
+ if (rnd_q == MPFR_RNDZ)
+ /* 0 <= |r| <= |my|, r has the same sign as mx */
+ mpz_tdiv_qr (mx, r, mx, my);
+ else
+ /* 0 <= |r| <= |my|, r has the same sign as my */
+ mpz_fdiv_qr (mx, r, mx, my);
+
+ if (rnd_q == MPFR_RNDN)
+ q_is_odd = mpz_tstbit (mx, 0);
+ if (quo) /* mx is the quotient */
+ {
+ mpz_tdiv_r_2exp (mx, mx, WANTED_BITS);
+ *quo = mpz_get_si (mx);
+ }
+ }
+ else /* ex > ey */
+ {
+ if (quo) /* remquo case */
+ /* for remquo, to get the low WANTED_BITS more bits of the quotient,
+ we first compute R = X mod Y*2^WANTED_BITS, where X and Y are
+ defined below. Then the low WANTED_BITS of the quotient are
+ floor(R/Y). */
+ mpz_mul_2exp (my, my, WANTED_BITS); /* 2^WANTED_BITS*Y */
+
+ else if (rnd_q == MPFR_RNDN) /* remainder case */
+ /* Let X = mx*2^(ex-ey) and Y = my. Then both X and Y are integers.
+ Assume X = R mod Y, then x = X*2^ey = R*2^ey mod (Y*2^ey=y).
+ To be able to perform the rounding, we need the least significant
+ bit of the quotient, i.e., one more bit in the remainder,
+ which is obtained by dividing by 2Y. */
+ mpz_mul_2exp (my, my, 1); /* 2Y */
+
+ mpz_set_ui (r, 2);
+ mpz_powm_ui (r, r, ex - ey, my); /* 2^(ex-ey) mod my */
+ mpz_mul (r, r, mx);
+ mpz_mod (r, r, my);
+
+ if (quo) /* now 0 <= r < 2^WANTED_BITS*Y */
+ {
+ mpz_fdiv_q_2exp (my, my, WANTED_BITS); /* back to Y */
+ mpz_tdiv_qr (mx, r, r, my);
+ /* oldr = mx*my + newr */
+ *quo = mpz_get_si (mx);
+ q_is_odd = *quo & 1;
+ }
+ else if (rnd_q == MPFR_RNDN) /* now 0 <= r < 2Y in the remainder case */
+ {
+ mpz_fdiv_q_2exp (my, my, 1); /* back to Y */
+ /* least significant bit of q */
+ q_is_odd = mpz_cmpabs (r, my) >= 0;
+ if (q_is_odd)
+ mpz_sub (r, r, my);
+ }
+ /* now 0 <= |r| < |my|, and if needed,
+ q_is_odd is the least significant bit of q */
+ }
+
+ if (mpz_cmp_ui (r, 0) == 0)
+ {
+ inex = mpfr_set_ui (rem, 0, MPFR_RNDN);
+ /* take into account sign of x */
+ if (signx < 0)
+ mpfr_neg (rem, rem, MPFR_RNDN);
+ }
+ else
+ {
+ if (rnd_q == MPFR_RNDN)
+ {
+ /* FIXME: the comparison 2*r < my could be done more efficiently
+ at the mpn level */
+ mpz_mul_2exp (r, r, 1);
+ compare = mpz_cmpabs (r, my);
+ mpz_fdiv_q_2exp (r, r, 1);
+ compare = ((compare > 0) ||
+ ((rnd_q == MPFR_RNDN) && (compare == 0) && q_is_odd));
+ /* if compare != 0, we need to subtract my to r, and add 1 to quo */
+ if (compare)
+ {
+ mpz_sub (r, r, my);
+ if (quo && (rnd_q == MPFR_RNDN))
+ *quo += 1;
+ }
+ }
+ /* take into account sign of x */
+ if (signx < 0)
+ mpz_neg (r, r);
+ inex = mpfr_set_z_2exp (rem, r, ex > ey ? ey : ex, rnd);
+ }
+
+ if (quo)
+ *quo *= sign;
+
+ mpz_clear (mx);
+ mpz_clear (my);
+ mpz_clear (r);
+
+ return inex;
+}
+
+int
+mpfr_remainder (mpfr_ptr rem, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd)
+{
+ return mpfr_rem1 (rem, (long *) 0, MPFR_RNDN, x, y, rnd);
+}
+
+int
+mpfr_remquo (mpfr_ptr rem, long *quo,
+ mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd)
+{
+ return mpfr_rem1 (rem, quo, MPFR_RNDN, x, y, rnd);
+}
+
+int
+mpfr_fmod (mpfr_ptr rem, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd)
+{
+ return mpfr_rem1 (rem, (long *) 0, MPFR_RNDZ, x, y, rnd);
+}
diff --git a/src/rint.c b/src/rint.c
new file mode 100644
index 0000000..809f366
--- /dev/null
+++ b/src/rint.c
@@ -0,0 +1,437 @@
+/* mpfr_rint -- Round to an integer.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Merge the following mpfr_rint code with mpfr_round_raw_generic? */
+
+int
+mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ int sign;
+ int rnd_away;
+ mpfr_exp_t exp;
+
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ))
+ {
+ if (MPFR_IS_NAN(u))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_SAME_SIGN(r, u);
+ if (MPFR_IS_INF(u))
+ {
+ MPFR_SET_INF(r);
+ MPFR_RET(0); /* infinity is exact */
+ }
+ else /* now u is zero */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(u));
+ MPFR_SET_ZERO(r);
+ MPFR_RET(0); /* zero is exact */
+ }
+ }
+ MPFR_SET_SAME_SIGN (r, u); /* Does nothing if r==u */
+
+ sign = MPFR_INT_SIGN (u);
+ exp = MPFR_GET_EXP (u);
+
+ rnd_away =
+ rnd_mode == MPFR_RNDD ? sign < 0 :
+ rnd_mode == MPFR_RNDU ? sign > 0 :
+ rnd_mode == MPFR_RNDZ ? 0 :
+ rnd_mode == MPFR_RNDA ? 1 :
+ -1; /* round to nearest-even (RNDN) or nearest-away (RNDNA) */
+
+ /* rnd_away:
+ 1 if round away from zero,
+ 0 if round to zero,
+ -1 if not decided yet.
+ */
+
+ if (MPFR_UNLIKELY (exp <= 0)) /* 0 < |u| < 1 ==> round |u| to 0 or 1 */
+ {
+ /* Note: in the MPFR_RNDN mode, 0.5 must be rounded to 0. */
+ if (rnd_away != 0 &&
+ (rnd_away > 0 ||
+ (exp == 0 && (rnd_mode == MPFR_RNDNA ||
+ !mpfr_powerof2_raw (u)))))
+ {
+ mp_limb_t *rp;
+ mp_size_t rm;
+
+ rp = MPFR_MANT(r);
+ rm = (MPFR_PREC(r) - 1) / GMP_NUMB_BITS;
+ rp[rm] = MPFR_LIMB_HIGHBIT;
+ MPN_ZERO(rp, rm);
+ MPFR_SET_EXP (r, 1); /* |r| = 1 */
+ MPFR_RET(sign > 0 ? 2 : -2);
+ }
+ else
+ {
+ MPFR_SET_ZERO(r); /* r = 0 */
+ MPFR_RET(sign > 0 ? -2 : 2);
+ }
+ }
+ else /* exp > 0, |u| >= 1 */
+ {
+ mp_limb_t *up, *rp;
+ mp_size_t un, rn, ui;
+ int sh, idiff;
+ int uflags;
+
+ /*
+ * uflags will contain:
+ * _ 0 if u is an integer representable in r,
+ * _ 1 if u is an integer not representable in r,
+ * _ 2 if u is not an integer.
+ */
+
+ up = MPFR_MANT(u);
+ rp = MPFR_MANT(r);
+
+ un = MPFR_LIMB_SIZE(u);
+ rn = MPFR_LIMB_SIZE(r);
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (r));
+
+ MPFR_SET_EXP (r, exp); /* Does nothing if r==u */
+
+ if ((exp - 1) / GMP_NUMB_BITS >= un)
+ {
+ ui = un;
+ idiff = 0;
+ uflags = 0; /* u is an integer, representable or not in r */
+ }
+ else
+ {
+ mp_size_t uj;
+
+ ui = (exp - 1) / GMP_NUMB_BITS + 1; /* #limbs of the int part */
+ MPFR_ASSERTD (un >= ui);
+ uj = un - ui; /* lowest limb of the integer part */
+ idiff = exp % GMP_NUMB_BITS; /* #int-part bits in up[uj] or 0 */
+
+ uflags = idiff == 0 || (up[uj] << idiff) == 0 ? 0 : 2;
+ if (uflags == 0)
+ while (uj > 0)
+ if (up[--uj] != 0)
+ {
+ uflags = 2;
+ break;
+ }
+ }
+
+ if (ui > rn)
+ {
+ /* More limbs in the integer part of u than in r.
+ Just round u with the precision of r. */
+ MPFR_ASSERTD (rp != up && un > rn);
+ MPN_COPY (rp, up + (un - rn), rn); /* r != u */
+ if (rnd_away < 0)
+ {
+ /* This is a rounding to nearest mode (MPFR_RNDN or MPFR_RNDNA).
+ Decide the rounding direction here. */
+ if (rnd_mode == MPFR_RNDN &&
+ (rp[0] & (MPFR_LIMB_ONE << sh)) == 0)
+ { /* halfway cases rounded toward zero */
+ mp_limb_t a, b;
+ /* a: rounding bit and some of the following bits */
+ /* b: boundary for a (weight of the rounding bit in a) */
+ if (sh != 0)
+ {
+ a = rp[0] & ((MPFR_LIMB_ONE << sh) - 1);
+ b = MPFR_LIMB_ONE << (sh - 1);
+ }
+ else
+ {
+ a = up[un - rn - 1];
+ b = MPFR_LIMB_HIGHBIT;
+ }
+ rnd_away = a > b;
+ if (a == b)
+ {
+ mp_size_t i;
+ for (i = un - rn - 1 - (sh == 0); i >= 0; i--)
+ if (up[i] != 0)
+ {
+ rnd_away = 1;
+ break;
+ }
+ }
+ }
+ else /* halfway cases rounded away from zero */
+ rnd_away = /* rounding bit */
+ ((sh != 0 && (rp[0] & (MPFR_LIMB_ONE << (sh - 1))) != 0) ||
+ (sh == 0 && (up[un - rn - 1] & MPFR_LIMB_HIGHBIT) != 0));
+ }
+ if (uflags == 0)
+ { /* u is an integer; determine if it is representable in r */
+ if (sh != 0 && rp[0] << (GMP_NUMB_BITS - sh) != 0)
+ uflags = 1; /* u is not representable in r */
+ else
+ {
+ mp_size_t i;
+ for (i = un - rn - 1; i >= 0; i--)
+ if (up[i] != 0)
+ {
+ uflags = 1; /* u is not representable in r */
+ break;
+ }
+ }
+ }
+ }
+ else /* ui <= rn */
+ {
+ mp_size_t uj, rj;
+ int ush;
+
+ uj = un - ui; /* lowest limb of the integer part in u */
+ rj = rn - ui; /* lowest limb of the integer part in r */
+
+ if (MPFR_LIKELY (rp != up))
+ MPN_COPY(rp + rj, up + uj, ui);
+
+ /* Ignore the lowest rj limbs, all equal to zero. */
+ rp += rj;
+ rn = ui;
+
+ /* number of fractional bits in whole rp[0] */
+ ush = idiff == 0 ? 0 : GMP_NUMB_BITS - idiff;
+
+ if (rj == 0 && ush < sh)
+ {
+ /* If u is an integer (uflags == 0), we need to determine
+ if it is representable in r, i.e. if its sh - ush bits
+ in the non-significant part of r are all 0. */
+ if (uflags == 0 && (rp[0] & ((MPFR_LIMB_ONE << sh) -
+ (MPFR_LIMB_ONE << ush))) != 0)
+ uflags = 1; /* u is an integer not representable in r */
+ }
+ else /* The integer part of u fits in r, we'll round to it. */
+ sh = ush;
+
+ if (rnd_away < 0)
+ {
+ /* This is a rounding to nearest mode.
+ Decide the rounding direction here. */
+ if (uj == 0 && sh == 0)
+ rnd_away = 0; /* rounding bit = 0 (not represented in u) */
+ else if (rnd_mode == MPFR_RNDN &&
+ (rp[0] & (MPFR_LIMB_ONE << sh)) == 0)
+ { /* halfway cases rounded toward zero */
+ mp_limb_t a, b;
+ /* a: rounding bit and some of the following bits */
+ /* b: boundary for a (weight of the rounding bit in a) */
+ if (sh != 0)
+ {
+ a = rp[0] & ((MPFR_LIMB_ONE << sh) - 1);
+ b = MPFR_LIMB_ONE << (sh - 1);
+ }
+ else
+ {
+ MPFR_ASSERTD (uj >= 1); /* see above */
+ a = up[uj - 1];
+ b = MPFR_LIMB_HIGHBIT;
+ }
+ rnd_away = a > b;
+ if (a == b)
+ {
+ mp_size_t i;
+ for (i = uj - 1 - (sh == 0); i >= 0; i--)
+ if (up[i] != 0)
+ {
+ rnd_away = 1;
+ break;
+ }
+ }
+ }
+ else /* halfway cases rounded away from zero */
+ rnd_away = /* rounding bit */
+ ((sh != 0 && (rp[0] & (MPFR_LIMB_ONE << (sh - 1))) != 0) ||
+ (sh == 0 && (MPFR_ASSERTD (uj >= 1),
+ up[uj - 1] & MPFR_LIMB_HIGHBIT) != 0));
+ }
+ /* Now we can make the low rj limbs to 0 */
+ MPN_ZERO (rp-rj, rj);
+ }
+
+ if (sh != 0)
+ rp[0] &= MP_LIMB_T_MAX << sh;
+
+ /* If u is a representable integer, there is no rounding. */
+ if (uflags == 0)
+ MPFR_RET(0);
+
+ MPFR_ASSERTD (rnd_away >= 0); /* rounding direction is defined */
+ if (rnd_away && mpn_add_1(rp, rp, rn, MPFR_LIMB_ONE << sh))
+ {
+ if (exp == __gmpfr_emax)
+ return mpfr_overflow(r, rnd_mode, MPFR_SIGN(r)) >= 0 ?
+ uflags : -uflags;
+ else
+ {
+ MPFR_SET_EXP(r, exp + 1);
+ rp[rn-1] = MPFR_LIMB_HIGHBIT;
+ }
+ }
+
+ MPFR_RET (rnd_away ^ (sign < 0) ? uflags : -uflags);
+ } /* exp > 0, |u| >= 1 */
+}
+
+#undef mpfr_round
+
+int
+mpfr_round (mpfr_ptr r, mpfr_srcptr u)
+{
+ return mpfr_rint (r, u, MPFR_RNDNA);
+}
+
+#undef mpfr_trunc
+
+int
+mpfr_trunc (mpfr_ptr r, mpfr_srcptr u)
+{
+ return mpfr_rint (r, u, MPFR_RNDZ);
+}
+
+#undef mpfr_ceil
+
+int
+mpfr_ceil (mpfr_ptr r, mpfr_srcptr u)
+{
+ return mpfr_rint (r, u, MPFR_RNDU);
+}
+
+#undef mpfr_floor
+
+int
+mpfr_floor (mpfr_ptr r, mpfr_srcptr u)
+{
+ return mpfr_rint (r, u, MPFR_RNDD);
+}
+
+#undef mpfr_rint_round
+
+int
+mpfr_rint_round (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ) || mpfr_integer_p (u))
+ return mpfr_set (r, u, rnd_mode);
+ else
+ {
+ mpfr_t tmp;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp, MPFR_PREC (u));
+ /* round(u) is representable in tmp unless an overflow occurs */
+ MPFR_BLOCK (flags, mpfr_round (tmp, u));
+ inex = (MPFR_OVERFLOW (flags)
+ ? mpfr_overflow (r, rnd_mode, MPFR_SIGN (u))
+ : mpfr_set (r, tmp, rnd_mode));
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inex, rnd_mode);
+ }
+}
+
+#undef mpfr_rint_trunc
+
+int
+mpfr_rint_trunc (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ) || mpfr_integer_p (u))
+ return mpfr_set (r, u, rnd_mode);
+ else
+ {
+ mpfr_t tmp;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp, MPFR_PREC (u));
+ /* trunc(u) is always representable in tmp */
+ mpfr_trunc (tmp, u);
+ inex = mpfr_set (r, tmp, rnd_mode);
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inex, rnd_mode);
+ }
+}
+
+#undef mpfr_rint_ceil
+
+int
+mpfr_rint_ceil (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ) || mpfr_integer_p (u))
+ return mpfr_set (r, u, rnd_mode);
+ else
+ {
+ mpfr_t tmp;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp, MPFR_PREC (u));
+ /* ceil(u) is representable in tmp unless an overflow occurs */
+ MPFR_BLOCK (flags, mpfr_ceil (tmp, u));
+ inex = (MPFR_OVERFLOW (flags)
+ ? mpfr_overflow (r, rnd_mode, MPFR_SIGN_POS)
+ : mpfr_set (r, tmp, rnd_mode));
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inex, rnd_mode);
+ }
+}
+
+#undef mpfr_rint_floor
+
+int
+mpfr_rint_floor (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(u) ) || mpfr_integer_p (u))
+ return mpfr_set (r, u, rnd_mode);
+ else
+ {
+ mpfr_t tmp;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_BLOCK_DECL (flags);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (tmp, MPFR_PREC (u));
+ /* floor(u) is representable in tmp unless an overflow occurs */
+ MPFR_BLOCK (flags, mpfr_floor (tmp, u));
+ inex = (MPFR_OVERFLOW (flags)
+ ? mpfr_overflow (r, rnd_mode, MPFR_SIGN_NEG)
+ : mpfr_set (r, tmp, rnd_mode));
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inex, rnd_mode);
+ }
+}
diff --git a/src/root.c b/src/root.c
new file mode 100644
index 0000000..619c9dd
--- /dev/null
+++ b/src/root.c
@@ -0,0 +1,205 @@
+/* mpfr_root -- kth root.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of y = x^(1/k) is done as follows:
+
+ Let x = sign * m * 2^(k*e) where m is an integer
+
+ with 2^(k*(n-1)) <= m < 2^(k*n) where n = PREC(y)
+
+ and m = s^k + r where 0 <= r and m < (s+1)^k
+
+ we want that s has n bits i.e. s >= 2^(n-1), or m >= 2^(k*(n-1))
+ i.e. m must have at least k*(n-1)+1 bits
+
+ then, not taking into account the sign, the result will be
+ x^(1/k) = s * 2^e or (s+1) * 2^e according to the rounding mode.
+ */
+
+int
+mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode)
+{
+ mpz_t m;
+ mpfr_exp_t e, r, sh;
+ mpfr_prec_t n, size_m, tmp;
+ int inexact, negative;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg k=%lu rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, k, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (k <= 1))
+ {
+ if (k < 1) /* k==0 => y=x^(1/0)=x^(+Inf) */
+#if 0
+ /* For 0 <= x < 1 => +0.
+ For x = 1 => 1.
+ For x > 1, => +Inf.
+ For x < 0 => NaN.
+ */
+ {
+ if (MPFR_IS_NEG (x) && !MPFR_IS_ZERO (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ inexact = mpfr_cmp (x, __gmpfr_one);
+ if (inexact == 0)
+ return mpfr_set_ui (y, 1, rnd_mode); /* 1 may be Out of Range */
+ else if (inexact < 0)
+ return mpfr_set_ui (y, 0, rnd_mode); /* 0+ */
+ else
+ {
+ mpfr_set_inf (y, 1);
+ return 0;
+ }
+ }
+#endif
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* y =x^(1/1)=x */
+ return mpfr_set (y, x, rnd_mode);
+ }
+
+ /* Singular values */
+ else if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y); /* NaN^(1/k) = NaN */
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x)) /* +Inf^(1/k) = +Inf
+ -Inf^(1/k) = -Inf if k odd
+ -Inf^(1/k) = NaN if k even */
+ {
+ if (MPFR_IS_NEG(x) && (k % 2 == 0))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ else /* x is necessarily 0: (+0)^(1/k) = +0
+ (-0)^(1/k) = -0 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ /* Returns NAN for x < 0 and k even */
+ else if (MPFR_IS_NEG (x) && (k % 2 == 0))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ /* General case */
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpz_init (m);
+
+ e = mpfr_get_z_2exp (m, x); /* x = m * 2^e */
+ if ((negative = MPFR_IS_NEG(x)))
+ mpz_neg (m, m);
+ r = e % (mpfr_exp_t) k;
+ if (r < 0)
+ r += k; /* now r = e (mod k) with 0 <= e < r */
+ /* x = (m*2^r) * 2^(e-r) where e-r is a multiple of k */
+
+ MPFR_MPZ_SIZEINBASE2 (size_m, m);
+ /* for rounding to nearest, we want the round bit to be in the root */
+ n = MPFR_PREC (y) + (rnd_mode == MPFR_RNDN);
+
+ /* we now multiply m by 2^(r+k*sh) so that root(m,k) will give
+ exactly n bits: we want k*(n-1)+1 <= size_m + k*sh + r <= k*n
+ i.e. sh = floor ((kn-size_m-r)/k) */
+ if ((mpfr_exp_t) size_m + r > k * (mpfr_exp_t) n)
+ sh = 0; /* we already have too many bits */
+ else
+ sh = (k * (mpfr_exp_t) n - (mpfr_exp_t) size_m - r) / k;
+ sh = k * sh + r;
+ if (sh >= 0)
+ {
+ mpz_mul_2exp (m, m, sh);
+ e = e - sh;
+ }
+ else if (r > 0)
+ {
+ mpz_mul_2exp (m, m, r);
+ e = e - r;
+ }
+
+ /* invariant: x = m*2^e, with e divisible by k */
+
+ /* we reuse the variable m to store the kth root, since it is not needed
+ any more: we just need to know if the root is exact */
+ inexact = mpz_root (m, m, k) == 0;
+
+ MPFR_MPZ_SIZEINBASE2 (tmp, m);
+ sh = tmp - n;
+ if (sh > 0) /* we have to flush to 0 the last sh bits from m */
+ {
+ inexact = inexact || ((mpfr_exp_t) mpz_scan1 (m, 0) < sh);
+ mpz_fdiv_q_2exp (m, m, sh);
+ e += k * sh;
+ }
+
+ if (inexact)
+ {
+ if (negative)
+ rnd_mode = MPFR_INVERT_RND (rnd_mode);
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (rnd_mode == MPFR_RNDN && mpz_tstbit (m, 0)))
+ inexact = 1, mpz_add_ui (m, m, 1);
+ else
+ inexact = -1;
+ }
+
+ /* either inexact is not zero, and the conversion is exact, i.e. inexact
+ is not changed; or inexact=0, and inexact is set only when
+ rnd_mode=MPFR_RNDN and bit (n+1) from m is 1 */
+ inexact += mpfr_set_z (y, m, MPFR_RNDN);
+ MPFR_SET_EXP (y, MPFR_GET_EXP (y) + e / (mpfr_exp_t) k);
+
+ if (negative)
+ {
+ MPFR_CHANGE_SIGN (y);
+ inexact = -inexact;
+ }
+
+ mpz_clear (m);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/round_near_x.c b/src/round_near_x.c
new file mode 100644
index 0000000..9789c9b
--- /dev/null
+++ b/src/round_near_x.c
@@ -0,0 +1,233 @@
+/* mpfr_round_near_x -- Round a floating point number nears another one.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Use MPFR_FAST_COMPUTE_IF_SMALL_INPUT instead (a simple wrapper) */
+
+/* int mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
+ mpfr_rnd_t rnd)
+
+ TODO: fix this description.
+ Assuming y = o(f(x)) = o(x + g(x)) with |g(x)| < 2^(EXP(v)-error)
+ If x is small enough, y ~= v. This function checks and does this.
+
+ It assumes that f(x) is not representable exactly as a FP number.
+ v must not be a singular value (NAN, INF or ZERO), usual values are
+ v=1 or v=x.
+
+ y is the destination (a mpfr_t), v the value to set (a mpfr_t),
+ err the error term (a mpfr_uexp_t) such that |g(x)| < 2^(EXP(x)-err),
+ dir (an int) is the direction of the error (if dir = 0,
+ it rounds toward 0, if dir=1, it rounds away from 0),
+ rnd the rounding mode.
+
+ It returns 0 if it can't round.
+ Otherwise it returns the ternary flag (It can't return an exact value).
+*/
+
+/* What "small enough" means?
+
+ We work with the positive values.
+ Assuming err > Prec (y)+1
+
+ i = [ y = o(x)] // i = inexact flag
+ If i == 0
+ Setting x in y is exact. We have:
+ y = [XXXXXXXXX[...]]0[...] + error where [..] are optional zeros
+ if dirError = ToInf,
+ x < f(x) < x + 2^(EXP(x)-err)
+ since x=y, and ulp (y)/2 > 2^(EXP(x)-err), we have:
+ y < f(x) < y+ulp(y) and |y-f(x)| < ulp(y)/2
+ if rnd = RNDN, nothing
+ if rnd = RNDZ, nothing
+ if rnd = RNDA, addoneulp
+ elif dirError = ToZero
+ x -2^(EXP(x)-err) < f(x) < x
+ since x=y, and ulp (y)/2 > 2^(EXP(x)-err), we have:
+ y-ulp(y) < f(x) < y and |y-f(x)| < ulp(y)/2
+ if rnd = RNDN, nothing
+ if rnd = RNDZ, nexttozero
+ if rnd = RNDA, nothing
+ NOTE: err > prec (y)+1 is needed only for RNDN.
+ elif i > 0 and i = EVEN_ROUNDING
+ So rnd = RNDN and we have y = x + ulp(y)/2
+ if dirError = ToZero,
+ we have x -2^(EXP(x)-err) < f(x) < x
+ so y - ulp(y)/2 - 2^(EXP(x)-err) < f(x) < y-ulp(y)/2
+ so y -ulp(y) < f(x) < y-ulp(y)/2
+ => nexttozero(y)
+ elif dirError = ToInf
+ we have x < f(x) < x + 2^(EXP(x)-err)
+ so y - ulp(y)/2 < f(x) < y+ulp(y)/2-ulp(y)/2
+ so y - ulp(y)/2 < f(x) < y
+ => do nothing
+ elif i < 0 and i = -EVEN_ROUNDING
+ So rnd = RNDN and we have y = x - ulp(y)/2
+ if dirError = ToZero,
+ y < f(x) < y + ulp(y)/2 => do nothing
+ if dirError = ToInf
+ y + ulp(y)/2 < f(x) < y + ulp(y) => AddOneUlp
+ elif i > 0
+ we can't have rnd = RNDZ, and prec(x) > prec(y), so ulp(x) < ulp(y)
+ we have y - ulp (y) < x < y
+ or more exactly y - ulp(y) + ulp(x)/2 <= x <= y - ulp(x)/2
+ if rnd = RNDA,
+ if dirError = ToInf,
+ we have x < f(x) < x + 2^(EXP(x)-err)
+ if err > prec (x),
+ we have 2^(EXP(x)-err) < ulp(x), so 2^(EXP(x)-err) <= ulp(x)/2
+ so f(x) <= y - ulp(x)/2+ulp(x)/2 <= y
+ and y - ulp(y) < x < f(x)
+ so we have y - ulp(y) < f(x) < y
+ so do nothing.
+ elif we can round, ie y - ulp(y) < x + 2^(EXP(x)-err) < y
+ we have y - ulp(y) < x < f(x) < x + 2^(EXP(x)-err) < y
+ so do nothing
+ otherwise
+ Wrong. Example X=[0.11101]111111110000
+ + 1111111111111111111....
+ elif dirError = ToZero
+ we have x - 2^(EXP(x)-err) < f(x) < x
+ so f(x) < x < y
+ if err > prec (x)
+ x-2^(EXP(x)-err) >= x-ulp(x)/2 >= y - ulp(y) + ulp(x)/2-ulp(x)/2
+ so y - ulp(y) < f(x) < y
+ so do nothing
+ elif we can round, ie y - ulp(y) < x - 2^(EXP(x)-err) < y
+ y - ulp(y) < x - 2^(EXP(x)-err) < f(x) < y
+ so do nothing
+ otherwise
+ Wrong. Example: X=[1.111010]00000010
+ - 10000001000000000000100....
+ elif rnd = RNDN,
+ y - ulp(y)/2 < x < y and we can't have x = y-ulp(y)/2:
+ so we have:
+ y - ulp(y)/2 + ulp(x)/2 <= x <= y - ulp(x)/2
+ if dirError = ToInf
+ we have x < f(x) < x+2^(EXP(x)-err) and ulp(y) > 2^(EXP(x)-err)
+ so y - ulp(y)/2 + ulp (x)/2 < f(x) < y + ulp (y)/2 - ulp (x)/2
+ we can round but we can't compute inexact flag.
+ if err > prec (x)
+ y - ulp(y)/2 + ulp (x)/2 < f(x) < y + ulp(x)/2 - ulp(x)/2
+ so y - ulp(y)/2 + ulp (x)/2 < f(x) < y
+ we can round and compute inexact flag. do nothing
+ elif we can round, ie y - ulp(y)/2 < x + 2^(EXP(x)-err) < y
+ we have y - ulp(y)/2 + ulp (x)/2 < f(x) < y
+ so do nothing
+ otherwise
+ Wrong
+ elif dirError = ToZero
+ we have x -2^(EXP(x)-err) < f(x) < x and ulp(y)/2 > 2^(EXP(x)-err)
+ so y-ulp(y)+ulp(x)/2 < f(x) < y - ulp(x)/2
+ if err > prec (x)
+ x- ulp(x)/2 < f(x) < x
+ so y - ulp(y)/2+ulp(x)/2 - ulp(x)/2 < f(x) < x <= y - ulp(x)/2 < y
+ do nothing
+ elif we can round, ie y-ulp(y)/2 < x-2^(EXP(x)-err) < y
+ we have y-ulp(y)/2 < x-2^(EXP(x)-err) < f(x) < x < y
+ do nothing
+ otherwise
+ Wrong
+ elif i < 0
+ same thing?
+ */
+
+int
+mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
+ mpfr_rnd_t rnd)
+{
+ int inexact, sign;
+ unsigned int old_flags = __gmpfr_flags;
+
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (v));
+ MPFR_ASSERTD (dir == 0 || dir == 1);
+
+ /* First check if we can round. The test is more restrictive than
+ necessary. Note that if err is not representable in an mpfr_exp_t,
+ then err > MPFR_PREC (v) and the conversion to mpfr_exp_t will not
+ occur. */
+ if (!(err > MPFR_PREC (y) + 1
+ && (err > MPFR_PREC (v)
+ || mpfr_round_p (MPFR_MANT (v), MPFR_LIMB_SIZE (v),
+ (mpfr_exp_t) err,
+ MPFR_PREC (y) + (rnd == MPFR_RNDN)))))
+ /* If we assume we can not round, return 0, and y is not modified */
+ return 0;
+
+ /* First round v in y */
+ sign = MPFR_SIGN (v);
+ MPFR_SET_EXP (y, MPFR_GET_EXP (v));
+ MPFR_SET_SIGN (y, sign);
+ MPFR_RNDRAW_GEN (inexact, y, MPFR_MANT (v), MPFR_PREC (v), rnd, sign,
+ if (dir == 0)
+ {
+ inexact = -sign;
+ goto trunc_doit;
+ }
+ else
+ goto addoneulp;
+ , if (MPFR_UNLIKELY (++MPFR_EXP (y) > __gmpfr_emax))
+ mpfr_overflow (y, rnd, sign)
+ );
+
+ /* Fix it in some cases */
+ MPFR_ASSERTD (!MPFR_IS_NAN (y) && !MPFR_IS_ZERO (y));
+ /* If inexact == 0, setting y from v is exact but we haven't
+ take into account yet the error term */
+ if (inexact == 0)
+ {
+ if (dir == 0) /* The error term is negative for v positive */
+ {
+ inexact = sign;
+ if (MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN (sign)))
+ {
+ /* case nexttozero */
+ /* The underflow flag should be set if the result is zero */
+ __gmpfr_flags = old_flags;
+ inexact = -sign;
+ mpfr_nexttozero (y);
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (y)))
+ mpfr_set_underflow ();
+ }
+ }
+ else /* The error term is positive for v positive */
+ {
+ inexact = -sign;
+ /* Round Away */
+ if (rnd != MPFR_RNDN && !MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN(sign)))
+ {
+ /* case nexttoinf */
+ /* The overflow flag should be set if the result is infinity */
+ inexact = sign;
+ mpfr_nexttoinf (y);
+ if (MPFR_UNLIKELY (MPFR_IS_INF (y)))
+ mpfr_set_overflow ();
+ }
+ }
+ }
+
+ /* the inexact flag cannot be 0, since this would mean an exact value,
+ and in this case we cannot round correctly */
+ MPFR_ASSERTD(inexact != 0);
+ MPFR_RET (inexact);
+}
diff --git a/src/round_p.c b/src/round_p.c
new file mode 100644
index 0000000..4a35831
--- /dev/null
+++ b/src/round_p.c
@@ -0,0 +1,123 @@
+/* mpfr_round_p -- check if an approximation is roundable.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Check against mpfr_can_round? */
+#ifdef WANT_ASSERT
+# if WANT_ASSERT >= 2
+int mpfr_round_p_2 (mp_limb_t *, mp_size_t, mpfr_exp_t, mpfr_prec_t);
+int
+mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec)
+{
+ int i1, i2;
+
+ i1 = mpfr_round_p_2 (bp, bn, err0, prec);
+ i2 = mpfr_can_round_raw (bp, bn, MPFR_SIGN_POS, err0,
+ MPFR_RNDN, MPFR_RNDZ, prec);
+ if (i1 != i2)
+ {
+ fprintf (stderr, "mpfr_round_p(%d) != mpfr_can_round(%d)!\n"
+ "bn = %lu, err0 = %ld, prec = %lu\nbp = ", i1, i2,
+ (unsigned long) bn, (long) err0, (unsigned long) prec);
+ gmp_fprintf (stderr, "%NX\n", bp, bn);
+ MPFR_ASSERTN (0);
+ }
+ return i1;
+}
+# define mpfr_round_p mpfr_round_p_2
+# endif
+#endif
+
+/*
+ * Assuming {bp, bn} is an approximation of a non-singular number
+ * with error at most equal to 2^(EXP(b)-err0) (`err0' bits of b are known)
+ * of direction unknown, check if we can round b toward zero with
+ * precision prec.
+ */
+int
+mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mpfr_exp_t err0, mpfr_prec_t prec)
+{
+ mpfr_prec_t err;
+ mp_size_t k, n;
+ mp_limb_t tmp, mask;
+ int s;
+
+ err = (mpfr_prec_t) bn * GMP_NUMB_BITS;
+ if (MPFR_UNLIKELY (err0 <= 0 || (mpfr_uexp_t) err0 <= prec || prec >= err))
+ return 0; /* can't round */
+ err = MIN (err, (mpfr_uexp_t) err0);
+
+ k = prec / GMP_NUMB_BITS;
+ s = GMP_NUMB_BITS - prec%GMP_NUMB_BITS;
+ n = err / GMP_NUMB_BITS - k;
+
+ MPFR_ASSERTD (n >= 0);
+ MPFR_ASSERTD (bn > k);
+
+ /* Check first limb */
+ bp += bn-1-k;
+ tmp = *bp--;
+ mask = s == GMP_NUMB_BITS ? MP_LIMB_T_MAX : MPFR_LIMB_MASK (s);
+ tmp &= mask;
+
+ if (MPFR_LIKELY (n == 0))
+ {
+ /* prec and error are in the same limb */
+ s = GMP_NUMB_BITS - err % GMP_NUMB_BITS;
+ MPFR_ASSERTD (s < GMP_NUMB_BITS);
+ tmp >>= s;
+ mask >>= s;
+ return tmp != 0 && tmp != mask;
+ }
+ else if (MPFR_UNLIKELY (tmp == 0))
+ {
+ /* Check if all (n-1) limbs are 0 */
+ while (--n)
+ if (*bp-- != 0)
+ return 1;
+ /* Check if final error limb is 0 */
+ s = GMP_NUMB_BITS - err % GMP_NUMB_BITS;
+ if (s == GMP_NUMB_BITS)
+ return 0;
+ tmp = *bp >> s;
+ return tmp != 0;
+ }
+ else if (MPFR_UNLIKELY (tmp == mask))
+ {
+ /* Check if all (n-1) limbs are 11111111111111111 */
+ while (--n)
+ if (*bp-- != MP_LIMB_T_MAX)
+ return 1;
+ /* Check if final error limb is 0 */
+ s = GMP_NUMB_BITS - err % GMP_NUMB_BITS;
+ if (s == GMP_NUMB_BITS)
+ return 0;
+ tmp = *bp >> s;
+ return tmp != (MP_LIMB_T_MAX >> s);
+ }
+ else
+ {
+ /* First limb is different from 000000 or 1111111 */
+ return 1;
+ }
+}
diff --git a/src/round_prec.c b/src/round_prec.c
new file mode 100644
index 0000000..600ac8d
--- /dev/null
+++ b/src/round_prec.c
@@ -0,0 +1,240 @@
+/* mpfr_round_raw_generic, mpfr_round_raw2, mpfr_round_raw, mpfr_prec_round,
+ mpfr_can_round, mpfr_can_round_raw -- various rounding functions
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#define mpfr_round_raw_generic mpfr_round_raw
+#define flag 0
+#define use_inexp 1
+#include "round_raw_generic.c"
+
+#define mpfr_round_raw_generic mpfr_round_raw_2
+#define flag 1
+#define use_inexp 0
+#include "round_raw_generic.c"
+
+/* Seems to be unused. Remove comment to implement it.
+#define mpfr_round_raw_generic mpfr_round_raw_3
+#define flag 1
+#define use_inexp 1
+#include "round_raw_generic.c"
+*/
+
+#define mpfr_round_raw_generic mpfr_round_raw_4
+#define flag 0
+#define use_inexp 0
+#include "round_raw_generic.c"
+
+int
+mpfr_prec_round (mpfr_ptr x, mpfr_prec_t prec, mpfr_rnd_t rnd_mode)
+{
+ mp_limb_t *tmp, *xp;
+ int carry, inexact;
+ mpfr_prec_t nw, ow;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_ASSERTN(prec >= MPFR_PREC_MIN && prec <= MPFR_PREC_MAX);
+
+ nw = MPFR_PREC2LIMBS (prec); /* needed allocated limbs */
+
+ /* check if x has enough allocated space for the significand */
+ /* Get the number of limbs from the precision.
+ (Compatible with all allocation methods) */
+ ow = MPFR_LIMB_SIZE (x);
+ if (nw > ow)
+ {
+ /* FIXME: Variable can't be created using custom allocation,
+ MPFR_DECL_INIT or GROUP_ALLOC: How to detect? */
+ ow = MPFR_GET_ALLOC_SIZE(x);
+ if (nw > ow)
+ {
+ /* Realloc significand */
+ mpfr_limb_ptr tmpx = (mpfr_limb_ptr) (*__gmp_reallocate_func)
+ (MPFR_GET_REAL_PTR(x), MPFR_MALLOC_SIZE(ow), MPFR_MALLOC_SIZE(nw));
+ MPFR_SET_MANT_PTR(x, tmpx); /* mant ptr must be set
+ before alloc size */
+ MPFR_SET_ALLOC_SIZE(x, nw); /* new number of allocated limbs */
+ }
+ }
+
+ if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) ))
+ {
+ MPFR_PREC(x) = prec; /* Special value: need to set prec */
+ if (MPFR_IS_NAN(x))
+ MPFR_RET_NAN;
+ MPFR_ASSERTD(MPFR_IS_INF(x) || MPFR_IS_ZERO(x));
+ return 0; /* infinity and zero are exact */
+ }
+
+ /* x is a non-zero real number */
+
+ MPFR_TMP_MARK(marker);
+ tmp = MPFR_TMP_LIMBS_ALLOC (nw);
+ xp = MPFR_MANT(x);
+ carry = mpfr_round_raw (tmp, xp, MPFR_PREC(x), MPFR_IS_NEG(x),
+ prec, rnd_mode, &inexact);
+ MPFR_PREC(x) = prec;
+
+ if (MPFR_UNLIKELY(carry))
+ {
+ mpfr_exp_t exp = MPFR_EXP (x);
+
+ if (MPFR_UNLIKELY(exp == __gmpfr_emax))
+ (void) mpfr_overflow(x, rnd_mode, MPFR_SIGN(x));
+ else
+ {
+ MPFR_ASSERTD (exp < __gmpfr_emax);
+ MPFR_SET_EXP (x, exp + 1);
+ xp[nw - 1] = MPFR_LIMB_HIGHBIT;
+ if (nw - 1 > 0)
+ MPN_ZERO(xp, nw - 1);
+ }
+ }
+ else
+ MPN_COPY(xp, tmp, nw);
+
+ MPFR_TMP_FREE(marker);
+ return inexact;
+}
+
+/* assumption: GMP_NUMB_BITS is a power of 2 */
+
+/* assuming b is an approximation to x in direction rnd1 with error at
+ most 2^(MPFR_EXP(b)-err), returns 1 if one is able to round exactly
+ x to precision prec with direction rnd2, and 0 otherwise.
+
+ Side effects: none.
+*/
+
+int
+mpfr_can_round (mpfr_srcptr b, mpfr_exp_t err, mpfr_rnd_t rnd1,
+ mpfr_rnd_t rnd2, mpfr_prec_t prec)
+{
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(b)))
+ return 0; /* We cannot round if Zero, Nan or Inf */
+ else
+ return mpfr_can_round_raw (MPFR_MANT(b), MPFR_LIMB_SIZE(b),
+ MPFR_SIGN(b), err, rnd1, rnd2, prec);
+}
+
+int
+mpfr_can_round_raw (const mp_limb_t *bp, mp_size_t bn, int neg, mpfr_exp_t err0,
+ mpfr_rnd_t rnd1, mpfr_rnd_t rnd2, mpfr_prec_t prec)
+{
+ mpfr_prec_t err;
+ mp_size_t k, k1, tn;
+ int s, s1;
+ mp_limb_t cc, cc2;
+ mp_limb_t *tmp;
+ MPFR_TMP_DECL(marker);
+
+ if (MPFR_UNLIKELY(err0 < 0 || (mpfr_uexp_t) err0 <= prec))
+ return 0; /* can't round */
+ else if (MPFR_UNLIKELY (prec > (mpfr_prec_t) bn * GMP_NUMB_BITS))
+ { /* then ulp(b) < precision < error */
+ return rnd2 == MPFR_RNDN && (mpfr_uexp_t) err0 - 2 >= prec;
+ /* can round only in rounding to the nearest and err0 >= prec + 2 */
+ }
+
+ MPFR_ASSERT_SIGN(neg);
+ neg = MPFR_IS_NEG_SIGN(neg);
+
+ /* if the error is smaller than ulp(b), then anyway it will propagate
+ up to ulp(b) */
+ err = ((mpfr_uexp_t) err0 > (mpfr_prec_t) bn * GMP_NUMB_BITS) ?
+ (mpfr_prec_t) bn * GMP_NUMB_BITS : (mpfr_prec_t) err0;
+
+ /* warning: if k = m*GMP_NUMB_BITS, consider limb m-1 and not m */
+ k = (err - 1) / GMP_NUMB_BITS;
+ MPFR_UNSIGNED_MINUS_MODULO(s, err);
+ /* the error corresponds to bit s in limb k, the most significant limb
+ being limb 0 */
+
+ k1 = (prec - 1) / GMP_NUMB_BITS;
+ MPFR_UNSIGNED_MINUS_MODULO(s1, prec);
+ /* the last significant bit is bit s1 in limb k1 */
+
+ /* don't need to consider the k1 most significant limbs */
+ k -= k1;
+ bn -= k1;
+ prec -= (mpfr_prec_t) k1 * GMP_NUMB_BITS;
+
+ /* if when adding or subtracting (1 << s) in bp[bn-1-k], it does not
+ change bp[bn-1] >> s1, then we can round */
+ MPFR_TMP_MARK(marker);
+ tn = bn;
+ k++; /* since we work with k+1 everywhere */
+ tmp = MPFR_TMP_LIMBS_ALLOC (tn);
+ if (bn > k)
+ MPN_COPY (tmp, bp, bn - k);
+
+ MPFR_ASSERTD (k > 0);
+
+ /* Transform RNDD and RNDU to Zero / Away */
+ MPFR_ASSERTD((neg == 0) || (neg ==1));
+ if (MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd1, neg))
+ rnd1 = MPFR_RNDZ;
+
+ switch (rnd1)
+ {
+ case MPFR_RNDZ:
+ /* Round to Zero */
+ cc = (bp[bn - 1] >> s1) & 1;
+ /* mpfr_round_raw2 returns 1 if one should add 1 at ulp(b,prec),
+ and 0 otherwise */
+ cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec);
+ /* cc is the new value of bit s1 in bp[bn-1] */
+ /* now round b + 2^(MPFR_EXP(b)-err) */
+ cc2 = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s);
+ break;
+ case MPFR_RNDN:
+ /* Round to nearest */
+ /* first round b+2^(MPFR_EXP(b)-err) */
+ cc = mpn_add_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s);
+ cc = (tmp[bn - 1] >> s1) & 1; /* gives 0 when cc=1 */
+ cc ^= mpfr_round_raw2 (tmp, bn, neg, rnd2, prec);
+ /* now round b-2^(MPFR_EXP(b)-err) */
+ cc2 = mpn_sub_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s);
+ break;
+ default:
+ /* Round away */
+ cc = (bp[bn - 1] >> s1) & 1;
+ cc ^= mpfr_round_raw2 (bp, bn, neg, rnd2, prec);
+ /* now round b +/- 2^(MPFR_EXP(b)-err) */
+ cc2 = mpn_sub_1 (tmp + bn - k, bp + bn - k, k, MPFR_LIMB_ONE << s);
+ break;
+ }
+
+ /* if cc2 is 1, then a carry or borrow propagates to the next limb */
+ if (cc2 && cc)
+ {
+ MPFR_TMP_FREE(marker);
+ return 0;
+ }
+
+ cc2 = (tmp[bn - 1] >> s1) & 1;
+ cc2 ^= mpfr_round_raw2 (tmp, bn, neg, rnd2, prec);
+
+ MPFR_TMP_FREE(marker);
+ return cc == cc2;
+}
diff --git a/src/round_raw_generic.c b/src/round_raw_generic.c
new file mode 100644
index 0000000..79ba90d
--- /dev/null
+++ b/src/round_raw_generic.c
@@ -0,0 +1,259 @@
+/* mpfr_round_raw_generic -- Generic rounding function
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef flag
+# error "ERROR: flag must be defined (0 / 1)"
+#endif
+#ifndef use_inexp
+# error "ERROR: use_enexp must be defined (0 / 1)"
+#endif
+#ifndef mpfr_round_raw_generic
+# error "ERROR: mpfr_round_raw_generic must be defined"
+#endif
+
+/*
+ * If flag = 0, puts in y the value of xp (with precision xprec and
+ * sign 1 if negative=0, -1 otherwise) rounded to precision yprec and
+ * direction rnd_mode. Supposes x is not zero nor NaN nor +/- Infinity
+ * (i.e. *xp != 0). In that case, the return value is a possible carry
+ * (0 or 1) that may happen during the rounding, in which case the result
+ * is a power of two.
+ *
+ * If inexp != NULL, put in *inexp the inexact flag of the rounding (0, 1, -1).
+ * In case of even rounding when rnd = MPFR_RNDN, put MPFR_EVEN_INEX (2) or
+ * -MPFR_EVEN_INEX (-2) in *inexp.
+ *
+ * If flag = 1, just returns whether one should add 1 or not for rounding.
+ *
+ * Note: yprec may be < MPFR_PREC_MIN; in particular, it may be equal
+ * to 1. In this case, the even rounding is done away from 0, which is
+ * a natural generalization. Indeed, a number with 1-bit precision can
+ * be seen as a denormalized number with more precision.
+ */
+
+int
+mpfr_round_raw_generic(
+#if flag == 0
+ mp_limb_t *yp,
+#endif
+ const mp_limb_t *xp, mpfr_prec_t xprec,
+ int neg, mpfr_prec_t yprec, mpfr_rnd_t rnd_mode
+#if use_inexp != 0
+ , int *inexp
+#endif
+ )
+{
+ mp_size_t xsize, nw;
+ mp_limb_t himask, lomask, sb;
+ int rw;
+#if flag == 0
+ int carry;
+#endif
+#if use_inexp == 0
+ int *inexp;
+#endif
+
+ if (use_inexp)
+ MPFR_ASSERTD(inexp != ((int*) 0));
+ MPFR_ASSERTD(neg == 0 || neg == 1);
+
+ if (flag && !use_inexp &&
+ (xprec <= yprec || MPFR_IS_LIKE_RNDZ (rnd_mode, neg)))
+ return 0;
+
+ xsize = MPFR_PREC2LIMBS (xprec);
+ nw = yprec / GMP_NUMB_BITS;
+ rw = yprec & (GMP_NUMB_BITS - 1);
+
+ if (MPFR_UNLIKELY(xprec <= yprec))
+ { /* No rounding is necessary. */
+ /* if yp=xp, maybe an overlap: MPN_COPY_DECR is ok when src <= dst */
+ if (MPFR_LIKELY(rw))
+ nw++;
+ MPFR_ASSERTD(nw >= 1);
+ MPFR_ASSERTD(nw >= xsize);
+ if (use_inexp)
+ *inexp = 0;
+#if flag == 0
+ MPN_COPY_DECR(yp + (nw - xsize), xp, xsize);
+ MPN_ZERO(yp, nw - xsize);
+#endif
+ return 0;
+ }
+
+ if (use_inexp || !MPFR_IS_LIKE_RNDZ(rnd_mode, neg))
+ {
+ mp_size_t k = xsize - nw - 1;
+
+ if (MPFR_LIKELY(rw))
+ {
+ nw++;
+ lomask = MPFR_LIMB_MASK (GMP_NUMB_BITS - rw);
+ himask = ~lomask;
+ }
+ else
+ {
+ lomask = ~(mp_limb_t) 0;
+ himask = ~(mp_limb_t) 0;
+ }
+ MPFR_ASSERTD(k >= 0);
+ sb = xp[k] & lomask; /* First non-significant bits */
+ /* Rounding to nearest ? */
+ if (MPFR_LIKELY( rnd_mode == MPFR_RNDN) )
+ {
+ /* Rounding to nearest */
+ mp_limb_t rbmask = MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1 - rw);
+ if (sb & rbmask) /* rounding bit */
+ sb &= ~rbmask; /* it is 1, clear it */
+ else
+ {
+ /* Rounding bit is 0, behave like rounding to 0 */
+ goto rnd_RNDZ;
+ }
+ while (MPFR_UNLIKELY(sb == 0) && k > 0)
+ sb = xp[--k];
+ /* rounding to nearest, with rounding bit = 1 */
+ if (MPFR_UNLIKELY(sb == 0)) /* Even rounding. */
+ {
+ /* sb == 0 && rnd_mode == MPFR_RNDN */
+ sb = xp[xsize - nw] & (himask ^ (himask << 1));
+ if (sb == 0)
+ {
+ if (use_inexp)
+ *inexp = 2*MPFR_EVEN_INEX*neg-MPFR_EVEN_INEX;
+ /* ((neg!=0)^(sb!=0)) ? MPFR_EVEN_INEX : -MPFR_EVEN_INEX;*/
+ /* Since neg = 0 or 1 and sb=0*/
+#if flag == 1
+ return 0 /*sb != 0 && rnd_mode != MPFR_RNDZ */;
+#else
+ MPN_COPY_INCR(yp, xp + xsize - nw, nw);
+ yp[0] &= himask;
+ return 0;
+#endif
+ }
+ else
+ {
+ /* sb != 0 && rnd_mode == MPFR_RNDN */
+ if (use_inexp)
+ *inexp = MPFR_EVEN_INEX-2*MPFR_EVEN_INEX*neg;
+ /*((neg!=0)^(sb!=0))? MPFR_EVEN_INEX : -MPFR_EVEN_INEX; */
+ /*Since neg= 0 or 1 and sb != 0 */
+ goto rnd_RNDN_add_one_ulp;
+ }
+ }
+ else /* sb != 0 && rnd_mode == MPFR_RNDN*/
+ {
+ if (use_inexp)
+ /* *inexp = (neg == 0) ? 1 : -1; but since neg = 0 or 1 */
+ *inexp = 1-2*neg;
+ rnd_RNDN_add_one_ulp:
+#if flag == 1
+ return 1; /*sb != 0 && rnd_mode != MPFR_RNDZ;*/
+#else
+ carry = mpn_add_1 (yp, xp + xsize - nw, nw,
+ rw ?
+ MPFR_LIMB_ONE << (GMP_NUMB_BITS - rw)
+ : MPFR_LIMB_ONE);
+ yp[0] &= himask;
+ return carry;
+#endif
+ }
+ }
+ /* Rounding to Zero ? */
+ else if (MPFR_IS_LIKE_RNDZ(rnd_mode, neg))
+ {
+ /* rnd_mode == MPFR_RNDZ */
+ rnd_RNDZ:
+ while (MPFR_UNLIKELY(sb == 0) && k > 0)
+ sb = xp[--k];
+ if (use_inexp)
+ /* rnd_mode == MPFR_RNDZ and neg = 0 or 1 */
+ /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/
+ *inexp = MPFR_UNLIKELY(sb == 0) ? 0 : (2*neg-1);
+#if flag == 1
+ return 0; /*sb != 0 && rnd_mode != MPFR_RNDZ;*/
+#else
+ MPN_COPY_INCR(yp, xp + xsize - nw, nw);
+ yp[0] &= himask;
+ return 0;
+#endif
+ }
+ else
+ {
+ /* rnd_mode = Away */
+ while (MPFR_UNLIKELY(sb == 0) && k > 0)
+ sb = xp[--k];
+ if (MPFR_UNLIKELY(sb == 0))
+ {
+ /* sb = 0 && rnd_mode != MPFR_RNDZ */
+ if (use_inexp)
+ /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/
+ *inexp = 0;
+#if flag == 1
+ return 0;
+#else
+ MPN_COPY_INCR(yp, xp + xsize - nw, nw);
+ yp[0] &= himask;
+ return 0;
+#endif
+ }
+ else
+ {
+ /* sb != 0 && rnd_mode != MPFR_RNDZ */
+ if (use_inexp)
+ /* (neg != 0) ^ (rnd_mode != MPFR_RNDZ)) ? 1 : -1);*/
+ *inexp = 1-2*neg;
+#if flag == 1
+ return 1;
+#else
+ carry = mpn_add_1(yp, xp + xsize - nw, nw,
+ rw ? MPFR_LIMB_ONE << (GMP_NUMB_BITS - rw)
+ : 1);
+ yp[0] &= himask;
+ return carry;
+#endif
+ }
+ }
+ }
+ else
+ {
+ /* Roundind mode = Zero / No inexact flag */
+#if flag == 1
+ return 0 /*sb != 0 && rnd_mode != MPFR_RNDZ*/;
+#else
+ if (MPFR_LIKELY(rw))
+ {
+ nw++;
+ himask = ~MPFR_LIMB_MASK (GMP_NUMB_BITS - rw);
+ }
+ else
+ himask = ~(mp_limb_t) 0;
+ MPN_COPY_INCR(yp, xp + xsize - nw, nw);
+ yp[0] &= himask;
+ return 0;
+#endif
+ }
+}
+
+#undef flag
+#undef use_inexp
+#undef mpfr_round_raw_generic
diff --git a/src/scale2.c b/src/scale2.c
new file mode 100644
index 0000000..5de38c3
--- /dev/null
+++ b/src/scale2.c
@@ -0,0 +1,91 @@
+/* mpfr_scale2 -- multiply a double float by 2^exp
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h> /* for DBL_EPSILON */
+#include "mpfr-impl.h"
+
+/* Note: we could use the ldexp function, but since we want not to depend on
+ math.h, we write our own implementation. */
+
+/* multiplies 1/2 <= d <= 1 by 2^exp */
+double
+mpfr_scale2 (double d, int exp)
+{
+#if _GMP_IEEE_FLOATS
+ {
+ union ieee_double_extract x;
+
+ if (MPFR_UNLIKELY (d == 1.0))
+ {
+ d = 0.5;
+ exp ++;
+ }
+
+ /* now 1/2 <= d < 1 */
+
+ /* infinities and zeroes have already been checked */
+ MPFR_ASSERTD (-1073 <= exp && exp <= 1025);
+
+ x.d = d;
+ if (MPFR_UNLIKELY (exp < -1021)) /* subnormal case */
+ {
+ x.s.exp += exp + 52;
+ x.d *= DBL_EPSILON;
+ }
+ else /* normalized case */
+ {
+ x.s.exp += exp;
+ }
+ return x.d;
+ }
+#else /* _GMP_IEEE_FLOATS */
+ {
+ double factor;
+
+ /* An overflow may occurs (example: 0.5*2^1024) */
+ if (d < 1.0)
+ {
+ d += d;
+ exp--;
+ }
+ /* Now 1.0 <= d < 2.0 */
+
+ if (exp < 0)
+ {
+ factor = 0.5;
+ exp = -exp;
+ }
+ else
+ {
+ factor = 2.0;
+ }
+ while (exp != 0)
+ {
+ if ((exp & 1) != 0)
+ d *= factor;
+ exp >>= 1;
+ factor *= factor;
+ }
+ return d;
+ }
+#endif
+}
diff --git a/src/sec.c b/src/sec.c
new file mode 100644
index 0000000..c5ced39
--- /dev/null
+++ b/src/sec.c
@@ -0,0 +1,34 @@
+/* mpfr_sec - secant function = 1/cos.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define FUNCTION mpfr_sec
+#define INVERSE mpfr_cos
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_ZERO(y,x) return mpfr_set_ui (y, 1, rnd_mode)
+/* for x near 0, sec(x) = 1 + x^2/2 + ..., more precisely |sec(x)-1| < x^2
+ for |x| <= 1. */
+#define ACTION_TINY(y,x,r) \
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT(y, __gmpfr_one, -2 * MPFR_GET_EXP (x), 0, \
+ 1, r, inexact = _inexact; goto end)
+
+#include "gen_inverse.h"
diff --git a/src/sech.c b/src/sech.c
new file mode 100644
index 0000000..6e37a9a
--- /dev/null
+++ b/src/sech.c
@@ -0,0 +1,40 @@
+/* mpfr_sech - Hyperbolic secant function = 1/cosh.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* The hyperbolic secant function is defined by sech(x)=1/cosh(x):
+ csc (NaN) = NaN.
+ csc (+Inf) = csc (-Inf) = 0+.
+ csc (+0) = csc (-0) = 1.
+ */
+
+#define FUNCTION mpfr_sech
+#define INVERSE mpfr_cosh
+#define ACTION_NAN(y) do { MPFR_SET_NAN(y); MPFR_RET_NAN; } while (1)
+#define ACTION_INF(y) return mpfr_set_ui (y, 0, MPFR_RNDN)
+#define ACTION_ZERO(y,x) return mpfr_set_ui (y, 1, rnd_mode)
+/* for x near 0, sech(x) = 1 - x^2/2 + ..., more precisely |sech(x)-1| <= x^2/2
+ for |x| <= 1. The tiny action is the same as for cos(x). */
+#define ACTION_TINY(y,x,r) \
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT(y, __gmpfr_one, -2 * MPFR_GET_EXP (x), 1, \
+ 0, r, inexact = _inexact; goto end)
+
+#include "gen_inverse.h"
diff --git a/src/set.c b/src/set.c
new file mode 100644
index 0000000..1561aa2
--- /dev/null
+++ b/src/set.c
@@ -0,0 +1,80 @@
+/* mpfr_set -- copy of a floating-point number
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* set a to abs(b) * signb: a=b when signb = SIGN(b), a=abs(b) when signb=1 */
+int
+mpfr_set4 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, int signb)
+{
+ /* Sign is ALWAYS copied */
+ MPFR_SET_SIGN (a, signb);
+
+ /* Exponent is also always copied since if the number is singular,
+ the exponent field determined the number.
+ Can't use MPFR_SET_EXP since the exponent may be singular */
+ MPFR_EXP (a) = MPFR_EXP (b);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (b)))
+ {
+ /* MPFR_SET_NAN, MPFR_SET_ZERO and MPFR_SET_INF are useless
+ since MPFR_EXP (a) = MPFR_EXP (b) does the job */
+ if (MPFR_IS_NAN (b))
+ MPFR_RET_NAN;
+ else
+ MPFR_RET (0);
+ }
+ else if (MPFR_LIKELY (MPFR_PREC (b) == MPFR_PREC (a)))
+ {
+ /* Same precision and b is not singular:
+ * just copy the mantissa, and set the exponent and the sign
+ * The result is exact. */
+ MPN_COPY (MPFR_MANT (a), MPFR_MANT (b), MPFR_LIMB_SIZE (b));
+ MPFR_RET (0);
+ }
+ else
+ {
+ int inex;
+
+ /* Else Round B inside a */
+ MPFR_RNDRAW (inex, a, MPFR_MANT (b), MPFR_PREC (b), rnd_mode, signb,
+ if (MPFR_UNLIKELY ( ++MPFR_EXP (a) > __gmpfr_emax))
+ return mpfr_overflow (a, rnd_mode, signb) );
+ MPFR_RET (inex);
+ }
+}
+
+/* Set a to b */
+#undef mpfr_set
+int
+mpfr_set (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (b));
+}
+
+/* Set a to |b| */
+#undef mpfr_abs
+int
+mpfr_abs (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN_POS);
+}
diff --git a/src/set_d.c b/src/set_d.c
new file mode 100644
index 0000000..479167b
--- /dev/null
+++ b/src/set_d.c
@@ -0,0 +1,255 @@
+/* mpfr_set_d -- convert a machine double precision float to
+ a multiple precision floating-point number
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h> /* For DOUBLE_ISINF and DOUBLE_ISNAN */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* extracts the bits of d in rp[0..n-1] where n=ceil(53/GMP_NUMB_BITS).
+ Assumes d is neither 0 nor NaN nor Inf. */
+static long
+__gmpfr_extract_double (mpfr_limb_ptr rp, double d)
+ /* e=0 iff GMP_NUMB_BITS=32 and rp has only one limb */
+{
+ long exp;
+ mp_limb_t manl;
+#if GMP_NUMB_BITS == 32
+ mp_limb_t manh;
+#endif
+
+ /* BUGS
+ 1. Should handle Inf and NaN in IEEE specific code.
+ 2. Handle Inf and NaN also in default code, to avoid hangs.
+ 3. Generalize to handle all GMP_NUMB_BITS.
+ 4. This lits is incomplete and misspelled.
+ */
+
+ MPFR_ASSERTD(!DOUBLE_ISNAN(d));
+ MPFR_ASSERTD(!DOUBLE_ISINF(d));
+ MPFR_ASSERTD(d != 0.0);
+
+#if _GMP_IEEE_FLOATS
+
+ {
+ union ieee_double_extract x;
+ x.d = d;
+
+ exp = x.s.exp;
+ if (exp)
+ {
+#if GMP_NUMB_BITS >= 64
+ manl = ((MPFR_LIMB_ONE << 63)
+ | ((mp_limb_t) x.s.manh << 43) | ((mp_limb_t) x.s.manl << 11));
+#else
+ manh = (MPFR_LIMB_ONE << 31) | (x.s.manh << 11) | (x.s.manl >> 21);
+ manl = x.s.manl << 11;
+#endif
+ }
+ else /* denormalized number */
+ {
+#if GMP_NUMB_BITS >= 64
+ manl = ((mp_limb_t) x.s.manh << 43) | ((mp_limb_t) x.s.manl << 11);
+#else
+ manh = (x.s.manh << 11) /* high 21 bits */
+ | (x.s.manl >> 21); /* middle 11 bits */
+ manl = x.s.manl << 11; /* low 21 bits */
+#endif
+ }
+
+ if (exp)
+ exp -= 1022;
+ else
+ exp = -1021;
+ }
+
+#else /* _GMP_IEEE_FLOATS */
+
+ {
+ /* Unknown (or known to be non-IEEE) double format. */
+ exp = 0;
+ if (d >= 1.0)
+ {
+ MPFR_ASSERTN (d * 0.5 != d);
+ while (d >= 32768.0)
+ {
+ d *= (1.0 / 65536.0);
+ exp += 16;
+ }
+ while (d >= 1.0)
+ {
+ d *= 0.5;
+ exp += 1;
+ }
+ }
+ else if (d < 0.5)
+ {
+ while (d < (1.0 / 65536.0))
+ {
+ d *= 65536.0;
+ exp -= 16;
+ }
+ while (d < 0.5)
+ {
+ d *= 2.0;
+ exp -= 1;
+ }
+ }
+
+ d *= MP_BASE_AS_DOUBLE;
+#if GMP_NUMB_BITS >= 64
+ manl = d;
+#else
+ manh = (mp_limb_t) d;
+ manl = (mp_limb_t) ((d - manh) * MP_BASE_AS_DOUBLE);
+#endif
+ }
+
+#endif /* _GMP_IEEE_FLOATS */
+
+#if GMP_NUMB_BITS >= 64
+ rp[0] = manl;
+#else
+ rp[1] = manh;
+ rp[0] = manl;
+#endif
+
+ return exp;
+}
+
+/* End of part included from gmp-2.0.2 */
+
+int
+mpfr_set_d (mpfr_ptr r, double d, mpfr_rnd_t rnd_mode)
+{
+ int signd, inexact;
+ unsigned int cnt;
+ mp_size_t i, k;
+ mpfr_t tmp;
+ mp_limb_t tmpmant[MPFR_LIMBS_PER_DOUBLE];
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ if (MPFR_UNLIKELY(DOUBLE_ISNAN(d)))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_UNLIKELY(d == 0))
+ {
+#if _GMP_IEEE_FLOATS
+ union ieee_double_extract x;
+
+ MPFR_SET_ZERO(r);
+ /* set correct sign */
+ x.d = d;
+ if (x.s.sig == 1)
+ MPFR_SET_NEG(r);
+ else
+ MPFR_SET_POS(r);
+#else /* _GMP_IEEE_FLOATS */
+ MPFR_SET_ZERO(r);
+ {
+ /* This is to get the sign of zero on non-IEEE hardware
+ Some systems support +0.0, -0.0 and unsigned zero.
+ We can't use d==+0.0 since it should be always true,
+ so we check that the memory representation of d is the
+ same than +0.0. etc */
+ /* FIXME: consider the case where +0.0 or -0.0 may have several
+ representations. */
+ double poszero = +0.0, negzero = DBL_NEG_ZERO;
+ if (memcmp(&d, &poszero, sizeof(double)) == 0)
+ MPFR_SET_POS(r);
+ else if (memcmp(&d, &negzero, sizeof(double)) == 0)
+ MPFR_SET_NEG(r);
+ else
+ MPFR_SET_POS(r);
+ }
+#endif
+ return 0; /* 0 is exact */
+ }
+ else if (MPFR_UNLIKELY(DOUBLE_ISINF(d)))
+ {
+ MPFR_SET_INF(r);
+ if (d > 0)
+ MPFR_SET_POS(r);
+ else
+ MPFR_SET_NEG(r);
+ return 0; /* infinity is exact */
+ }
+
+ /* now d is neither 0, nor NaN nor Inf */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* warning: don't use tmp=r here, even if SIZE(r) >= MPFR_LIMBS_PER_DOUBLE,
+ since PREC(r) may be different from PREC(tmp), and then both variables
+ would have same precision in the mpfr_set4 call below. */
+ MPFR_MANT(tmp) = tmpmant;
+ MPFR_PREC(tmp) = IEEE_DBL_MANT_DIG;
+
+ signd = (d < 0) ? MPFR_SIGN_NEG : MPFR_SIGN_POS;
+ d = ABS (d);
+
+ /* don't use MPFR_SET_EXP here since the exponent may be out of range */
+ MPFR_EXP(tmp) = __gmpfr_extract_double (tmpmant, d);
+
+#ifdef WANT_ASSERT
+ /* Failed assertion if the stored value is 0 (e.g., if the exponent range
+ has been reduced at the wrong moment and an underflow to 0 occurred).
+ Probably a bug in the C implementation if this happens. */
+ i = 0;
+ while (tmpmant[i] == 0)
+ {
+ i++;
+ MPFR_ASSERTN(i < MPFR_LIMBS_PER_DOUBLE);
+ }
+#endif
+
+ /* determine the index i-1 of the most significant non-zero limb
+ and the number k of zero high limbs */
+ i = MPFR_LIMBS_PER_DOUBLE;
+ MPN_NORMALIZE_NOT_ZERO(tmpmant, i);
+ k = MPFR_LIMBS_PER_DOUBLE - i;
+
+ count_leading_zeros (cnt, tmpmant[i - 1]);
+
+ if (MPFR_LIKELY(cnt != 0))
+ mpn_lshift (tmpmant + k, tmpmant, i, cnt);
+ else if (k != 0)
+ MPN_COPY (tmpmant + k, tmpmant, i);
+
+ if (MPFR_UNLIKELY(k != 0))
+ MPN_ZERO (tmpmant, k);
+
+ /* don't use MPFR_SET_EXP here since the exponent may be out of range */
+ MPFR_EXP(tmp) -= (mpfr_exp_t) (cnt + k * GMP_NUMB_BITS);
+
+ /* tmp is exact since PREC(tmp)=53 */
+ inexact = mpfr_set4 (r, tmp, rnd_mode, signd);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inexact, rnd_mode);
+}
+
+
+
diff --git a/src/set_d64.c b/src/set_d64.c
new file mode 100644
index 0000000..d950acf
--- /dev/null
+++ b/src/set_d64.c
@@ -0,0 +1,224 @@
+/* mpfr_set_decimal64 -- convert a IEEE 754r decimal64 float to
+ a multiple precision floating-point number
+
+See http://gcc.gnu.org/ml/gcc/2006-06/msg00691.html,
+http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html,
+and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
+
+Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+
+#ifdef DPD_FORMAT
+ /* conversion 10-bits to 3 digits */
+static unsigned int T[1024] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 80, 81, 800, 801, 880, 881, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 90, 91, 810, 811, 890, 891, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 82, 83, 820, 821, 808, 809, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 92, 93, 830, 831, 818, 819, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 84, 85, 840, 841, 88, 89, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 94, 95,
+ 850, 851, 98, 99, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 86, 87, 860, 861,
+ 888, 889, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 96, 97, 870, 871, 898,
+ 899, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 180, 181, 900, 901,
+ 980, 981, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 190, 191, 910,
+ 911, 990, 991, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 182, 183,
+ 920, 921, 908, 909, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 192,
+ 193, 930, 931, 918, 919, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 184, 185, 940, 941, 188, 189, 150, 151, 152, 153, 154, 155, 156, 157, 158,
+ 159, 194, 195, 950, 951, 198, 199, 160, 161, 162, 163, 164, 165, 166, 167,
+ 168, 169, 186, 187, 960, 961, 988, 989, 170, 171, 172, 173, 174, 175, 176,
+ 177, 178, 179, 196, 197, 970, 971, 998, 999, 200, 201, 202, 203, 204, 205,
+ 206, 207, 208, 209, 280, 281, 802, 803, 882, 883, 210, 211, 212, 213, 214,
+ 215, 216, 217, 218, 219, 290, 291, 812, 813, 892, 893, 220, 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 282, 283, 822, 823, 828, 829, 230, 231, 232,
+ 233, 234, 235, 236, 237, 238, 239, 292, 293, 832, 833, 838, 839, 240, 241,
+ 242, 243, 244, 245, 246, 247, 248, 249, 284, 285, 842, 843, 288, 289, 250,
+ 251, 252, 253, 254, 255, 256, 257, 258, 259, 294, 295, 852, 853, 298, 299,
+ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 286, 287, 862, 863, 888,
+ 889, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 296, 297, 872, 873,
+ 898, 899, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 380, 381, 902,
+ 903, 982, 983, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 390, 391,
+ 912, 913, 992, 993, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 382,
+ 383, 922, 923, 928, 929, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339,
+ 392, 393, 932, 933, 938, 939, 340, 341, 342, 343, 344, 345, 346, 347, 348,
+ 349, 384, 385, 942, 943, 388, 389, 350, 351, 352, 353, 354, 355, 356, 357,
+ 358, 359, 394, 395, 952, 953, 398, 399, 360, 361, 362, 363, 364, 365, 366,
+ 367, 368, 369, 386, 387, 962, 963, 988, 989, 370, 371, 372, 373, 374, 375,
+ 376, 377, 378, 379, 396, 397, 972, 973, 998, 999, 400, 401, 402, 403, 404,
+ 405, 406, 407, 408, 409, 480, 481, 804, 805, 884, 885, 410, 411, 412, 413,
+ 414, 415, 416, 417, 418, 419, 490, 491, 814, 815, 894, 895, 420, 421, 422,
+ 423, 424, 425, 426, 427, 428, 429, 482, 483, 824, 825, 848, 849, 430, 431,
+ 432, 433, 434, 435, 436, 437, 438, 439, 492, 493, 834, 835, 858, 859, 440,
+ 441, 442, 443, 444, 445, 446, 447, 448, 449, 484, 485, 844, 845, 488, 489,
+ 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 494, 495, 854, 855, 498,
+ 499, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 486, 487, 864, 865,
+ 888, 889, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 496, 497, 874,
+ 875, 898, 899, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 580, 581,
+ 904, 905, 984, 985, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 590,
+ 591, 914, 915, 994, 995, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529,
+ 582, 583, 924, 925, 948, 949, 530, 531, 532, 533, 534, 535, 536, 537, 538,
+ 539, 592, 593, 934, 935, 958, 959, 540, 541, 542, 543, 544, 545, 546, 547,
+ 548, 549, 584, 585, 944, 945, 588, 589, 550, 551, 552, 553, 554, 555, 556,
+ 557, 558, 559, 594, 595, 954, 955, 598, 599, 560, 561, 562, 563, 564, 565,
+ 566, 567, 568, 569, 586, 587, 964, 965, 988, 989, 570, 571, 572, 573, 574,
+ 575, 576, 577, 578, 579, 596, 597, 974, 975, 998, 999, 600, 601, 602, 603,
+ 604, 605, 606, 607, 608, 609, 680, 681, 806, 807, 886, 887, 610, 611, 612,
+ 613, 614, 615, 616, 617, 618, 619, 690, 691, 816, 817, 896, 897, 620, 621,
+ 622, 623, 624, 625, 626, 627, 628, 629, 682, 683, 826, 827, 868, 869, 630,
+ 631, 632, 633, 634, 635, 636, 637, 638, 639, 692, 693, 836, 837, 878, 879,
+ 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 684, 685, 846, 847, 688,
+ 689, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 694, 695, 856, 857,
+ 698, 699, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 686, 687, 866,
+ 867, 888, 889, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 696, 697,
+ 876, 877, 898, 899, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 780,
+ 781, 906, 907, 986, 987, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719,
+ 790, 791, 916, 917, 996, 997, 720, 721, 722, 723, 724, 725, 726, 727, 728,
+ 729, 782, 783, 926, 927, 968, 969, 730, 731, 732, 733, 734, 735, 736, 737,
+ 738, 739, 792, 793, 936, 937, 978, 979, 740, 741, 742, 743, 744, 745, 746,
+ 747, 748, 749, 784, 785, 946, 947, 788, 789, 750, 751, 752, 753, 754, 755,
+ 756, 757, 758, 759, 794, 795, 956, 957, 798, 799, 760, 761, 762, 763, 764,
+ 765, 766, 767, 768, 769, 786, 787, 966, 967, 988, 989, 770, 771, 772, 773,
+ 774, 775, 776, 777, 778, 779, 796, 797, 976, 977, 998, 999 };
+#endif
+
+/* Convert d to a decimal string (one-to-one correspondence, no rounding).
+ The string s needs to have at least 23 characters.
+ */
+static void
+decimal64_to_string (char *s, _Decimal64 d)
+{
+ union ieee_double_extract x;
+ union ieee_double_decimal64 y;
+ char *t;
+ unsigned int Gh; /* most 5 significant bits from combination field */
+ int exp; /* exponent */
+ mp_limb_t rp[2];
+ mp_size_t rn = 2;
+ unsigned int i;
+#ifdef DPD_FORMAT
+ unsigned int d0, d1, d2, d3, d4, d5;
+#endif
+
+ /* now convert BID or DPD to string */
+ y.d64 = d;
+ x.d = y.d;
+ Gh = x.s.exp >> 6;
+ if (Gh == 31)
+ {
+ sprintf (s, "NaN");
+ return;
+ }
+ else if (Gh == 30)
+ {
+ if (x.s.sig == 0)
+ sprintf (s, "Inf");
+ else
+ sprintf (s, "-Inf");
+ return;
+ }
+ t = s;
+ if (x.s.sig)
+ *t++ = '-';
+
+#ifdef DPD_FORMAT
+ if (Gh < 24)
+ {
+ exp = (x.s.exp >> 1) & 768;
+ d0 = Gh & 7;
+ }
+ else
+ {
+ exp = (x.s.exp & 384) << 1;
+ d0 = 8 | (Gh & 1);
+ }
+ exp |= (x.s.exp & 63) << 2;
+ exp |= x.s.manh >> 18;
+ d1 = (x.s.manh >> 8) & 1023;
+ d2 = ((x.s.manh << 2) | (x.s.manl >> 30)) & 1023;
+ d3 = (x.s.manl >> 20) & 1023;
+ d4 = (x.s.manl >> 10) & 1023;
+ d5 = x.s.manl & 1023;
+ sprintf (t, "%1u%3u%3u%3u%3u%3u", d0, T[d1], T[d2], T[d3], T[d4], T[d5]);
+ /* Warning: some characters may be blank */
+ for (i = 0; i < 16; i++)
+ if (t[i] == ' ')
+ t[i] = '0';
+ t += 16;
+#else /* BID */
+ if (Gh < 24)
+ {
+ /* the biased exponent E is formed from G[0] to G[9] and the
+ significand from bits G[10] through the end of the decoding */
+ exp = x.s.exp >> 1;
+ /* manh has 20 bits, manl has 32 bits */
+ rp[1] = ((x.s.exp & 1) << 20) | x.s.manh;
+ rp[0] = x.s.manl;
+ }
+ else
+ {
+ /* the biased exponent is formed from G[2] to G[11] */
+ exp = (x.s.exp & 511) << 1;
+ rp[1] = x.s.manh;
+ rp[0] = x.s.manl;
+ exp |= rp[1] >> 19;
+ rp[1] &= 524287; /* 2^19-1: cancel G[11] */
+ rp[1] |= 2097152; /* add 2^21 */
+ }
+#if GMP_NUMB_BITS >= 54
+ rp[0] |= rp[1] << 32;
+ rn = 1;
+#endif
+ while (rn > 0 && rp[rn - 1] == 0)
+ rn --;
+ if (rn == 0)
+ {
+ *t = 0;
+ i = 1;
+ }
+ else
+ {
+ i = mpn_get_str ((unsigned char*)t, 10, rp, rn);
+ }
+ while (i-- > 0)
+ *t++ += '0';
+#endif /* DPD or BID */
+
+ exp -= 398; /* unbiased exponent */
+ t += sprintf (t, "E%d", exp);
+}
+
+int
+mpfr_set_decimal64 (mpfr_ptr r, _Decimal64 d, mpfr_rnd_t rnd_mode)
+{
+ char s[23]; /* need 1 character for sign,
+ 16 characters for mantissa,
+ 1 character for exponent,
+ 4 characters for exponent (including sign),
+ 1 character for terminating \0. */
+
+ decimal64_to_string (s, d);
+ return mpfr_set_str (r, s, 10, rnd_mode);
+}
+
+#endif /* MPFR_WANT_DECIMAL_FLOATS */
diff --git a/src/set_dfl_prec.c b/src/set_dfl_prec.c
new file mode 100644
index 0000000..f2bbf32
--- /dev/null
+++ b/src/set_dfl_prec.c
@@ -0,0 +1,41 @@
+/* mpfr_set_default_prec, mpfr_get_default_prec -- set/get default precision
+
+Copyright 1999, 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* default is IEEE double precision, i.e. 53 bits */
+mpfr_prec_t MPFR_THREAD_ATTR __gmpfr_default_fp_bit_precision \
+ = IEEE_DBL_MANT_DIG;
+
+void
+mpfr_set_default_prec (mpfr_prec_t prec)
+{
+ MPFR_ASSERTN (prec >= MPFR_PREC_MIN && prec <= MPFR_PREC_MAX);
+ __gmpfr_default_fp_bit_precision = prec;
+}
+
+#undef mpfr_get_default_prec
+mpfr_prec_t
+mpfr_get_default_prec (void)
+{
+ return __gmpfr_default_fp_bit_precision;
+}
diff --git a/src/set_exp.c b/src/set_exp.c
new file mode 100644
index 0000000..e2d01da
--- /dev/null
+++ b/src/set_exp.c
@@ -0,0 +1,37 @@
+/* mpfr_set_exp - set the exponent of a floating-point number
+
+Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_set_exp (mpfr_ptr x, mpfr_exp_t exponent)
+{
+ if (exponent >= __gmpfr_emin && exponent <= __gmpfr_emax)
+ {
+ MPFR_EXP(x) = exponent; /* do not use MPFR_SET_EXP of course... */
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
diff --git a/src/set_f.c b/src/set_f.c
new file mode 100644
index 0000000..80f776b
--- /dev/null
+++ b/src/set_f.c
@@ -0,0 +1,99 @@
+/* mpfr_set_f -- set a MPFR number from a GNU MPF number
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_set_f (mpfr_ptr y, mpf_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mp_limb_t *my, *mx, *tmp;
+ unsigned long cnt, sx, sy;
+ int inexact, carry = 0;
+ MPFR_TMP_DECL(marker);
+
+ sx = ABS(SIZ(x)); /* number of limbs of the mantissa of x */
+
+ if (sx == 0) /* x is zero */
+ {
+ MPFR_SET_ZERO(y);
+ MPFR_SET_POS(y);
+ return 0; /* 0 is exact */
+ }
+
+ if (SIZ(x) * MPFR_FROM_SIGN_TO_INT(MPFR_SIGN(y)) < 0)
+ MPFR_CHANGE_SIGN (y);
+
+ sy = MPFR_LIMB_SIZE (y);
+ my = MPFR_MANT(y);
+ mx = PTR(x);
+
+ count_leading_zeros(cnt, mx[sx - 1]);
+
+ if (sy <= sx) /* we may have to round even when sy = sx */
+ {
+ unsigned long xprec = sx * GMP_NUMB_BITS;
+
+ MPFR_TMP_MARK(marker);
+ tmp = MPFR_TMP_LIMBS_ALLOC (sx);
+ if (cnt)
+ mpn_lshift (tmp, mx, sx, cnt);
+ else
+ /* FIXME: we may avoid the copy here, and directly call mpfr_round_raw
+ on mx instead of tmp */
+ MPN_COPY (tmp, mx, sx);
+ carry = mpfr_round_raw (my, tmp, xprec, (SIZ(x) < 0), MPFR_PREC(y),
+ rnd_mode, &inexact);
+ if (MPFR_UNLIKELY(carry)) /* result is a power of two */
+ my[sy - 1] = MPFR_LIMB_HIGHBIT;
+ MPFR_TMP_FREE(marker);
+ }
+ else
+ {
+ if (cnt)
+ mpn_lshift (my + sy - sx, mx, sx, cnt);
+ else
+ MPN_COPY (my + sy - sx, mx, sx);
+ MPN_ZERO(my, sy - sx);
+ /* no rounding necessary, since y has a larger mantissa */
+ inexact = 0;
+ }
+
+ /* warning: EXP(x) * GMP_NUMB_BITS may exceed the maximal exponent */
+ if (EXP(x) > 1 + (__gmpfr_emax - 1) / GMP_NUMB_BITS)
+ {
+ /* EXP(x) >= 2 + floor((__gmpfr_emax-1)/GMP_NUMB_BITS)
+ EXP(x) >= 2 + (__gmpfr_emax - GMP_NUMB_BITS) / GMP_NUMB_BITS
+ >= 1 + __gmpfr_emax / GMP_NUMB_BITS
+ EXP(x) * GMP_NUMB_BITS >= __gmpfr_emax + GMP_NUMB_BITS
+ Since 0 <= cnt <= GMP_NUMB_BITS-1, and 0 <= carry <= 1,
+ we have then EXP(x) * GMP_NUMB_BITS - cnt + carry > __gmpfr_emax */
+ return mpfr_overflow (y, rnd_mode, MPFR_SIGN (y));
+ }
+ else
+ {
+ /* Do not use MPFR_SET_EXP as the exponent may be out of range. */
+ MPFR_EXP (y) = EXP (x) * GMP_NUMB_BITS - (mpfr_exp_t) cnt + carry;
+ }
+
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/set_flt.c b/src/set_flt.c
new file mode 100644
index 0000000..46677b3
--- /dev/null
+++ b/src/set_flt.c
@@ -0,0 +1,34 @@
+/* mpfr_set_flt -- convert a machine single precision float to mpfr_t
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_set_flt (mpfr_ptr r, float f, mpfr_rnd_t rnd_mode)
+{
+ /* we convert f to double precision and use mpfr_set_d;
+ NaN and infinities should be preserved, and all single precision
+ numbers are exactly representable in the double format, thus the
+ conversion is always exact */
+ return mpfr_set_d (r, (double) f, rnd_mode);
+}
+
diff --git a/src/set_inf.c b/src/set_inf.c
new file mode 100644
index 0000000..c7daefb
--- /dev/null
+++ b/src/set_inf.c
@@ -0,0 +1,33 @@
+/* mpfr_set_inf -- set a number to plus or minus infinity.
+
+Copyright 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_set_inf (mpfr_ptr x, int sign)
+{
+ MPFR_SET_INF(x);
+ if (sign >= 0)
+ MPFR_SET_POS(x);
+ else
+ MPFR_SET_NEG(x);
+}
diff --git a/src/set_ld.c b/src/set_ld.c
new file mode 100644
index 0000000..6a3bd04
--- /dev/null
+++ b/src/set_ld.c
@@ -0,0 +1,331 @@
+/* mpfr_set_ld -- convert a machine long double to
+ a multiple precision floating-point number
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h>
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Various i386 systems have been seen with <float.h> LDBL constants equal
+ to the DBL ones, whereas they ought to be bigger, reflecting the 10-byte
+ IEEE extended format on that processor. gcc 3.2.1 on FreeBSD and Solaris
+ has been seen with the problem, and gcc 2.95.4 on FreeBSD 4.7. */
+
+#if HAVE_LDOUBLE_IEEE_EXT_LITTLE
+static const union {
+ char bytes[10];
+ long double d;
+} ldbl_max_struct = {
+ { '\377','\377','\377','\377',
+ '\377','\377','\377','\377',
+ '\376','\177' }
+};
+#define MPFR_LDBL_MAX (ldbl_max_struct.d)
+#else
+#define MPFR_LDBL_MAX LDBL_MAX
+#endif
+
+#ifndef HAVE_LDOUBLE_IEEE_EXT_LITTLE
+
+/* Generic code */
+int
+mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t, u;
+ int inexact, shift_exp;
+ long double x;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ /* Check for NAN */
+ LONGDOUBLE_NAN_ACTION (d, goto nan);
+
+ /* Check for INF */
+ if (d > MPFR_LDBL_MAX)
+ {
+ mpfr_set_inf (r, 1);
+ return 0;
+ }
+ else if (d < -MPFR_LDBL_MAX)
+ {
+ mpfr_set_inf (r, -1);
+ return 0;
+ }
+ /* Check for ZERO */
+ else if (d == 0.0)
+ return mpfr_set_d (r, (double) d, rnd_mode);
+
+ mpfr_init2 (t, MPFR_LDBL_MANT_DIG);
+ mpfr_init2 (u, IEEE_DBL_MANT_DIG);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ convert:
+ x = d;
+ MPFR_SET_ZERO (t); /* The sign doesn't matter. */
+ shift_exp = 0; /* invariant: remainder to deal with is d*2^shift_exp */
+ while (x != (long double) 0.0)
+ {
+ /* Check overflow of double */
+ if (x > (long double) DBL_MAX || (-x) > (long double) DBL_MAX)
+ {
+ long double div9, div10, div11, div12, div13;
+
+#define TWO_64 18446744073709551616.0 /* 2^64 */
+#define TWO_128 (TWO_64 * TWO_64)
+#define TWO_256 (TWO_128 * TWO_128)
+ div9 = (long double) (double) (TWO_256 * TWO_256); /* 2^(2^9) */
+ div10 = div9 * div9;
+ div11 = div10 * div10; /* 2^(2^11) */
+ div12 = div11 * div11; /* 2^(2^12) */
+ div13 = div12 * div12; /* 2^(2^13) */
+ if (ABS (x) >= div13)
+ {
+ x /= div13; /* exact */
+ shift_exp += 8192;
+ mpfr_div_2si (t, t, 8192, MPFR_RNDZ);
+ }
+ if (ABS (x) >= div12)
+ {
+ x /= div12; /* exact */
+ shift_exp += 4096;
+ mpfr_div_2si (t, t, 4096, MPFR_RNDZ);
+ }
+ if (ABS (x) >= div11)
+ {
+ x /= div11; /* exact */
+ shift_exp += 2048;
+ mpfr_div_2si (t, t, 2048, MPFR_RNDZ);
+ }
+ if (ABS (x) >= div10)
+ {
+ x /= div10; /* exact */
+ shift_exp += 1024;
+ mpfr_div_2si (t, t, 1024, MPFR_RNDZ);
+ }
+ /* warning: we may have DBL_MAX=2^1024*(1-2^(-53)) < x < 2^1024,
+ therefore we have one extra exponent reduction step */
+ if (ABS (x) >= div9)
+ {
+ x /= div9; /* exact */
+ shift_exp += 512;
+ mpfr_div_2si (t, t, 512, MPFR_RNDZ);
+ }
+ } /* Check overflow of double */
+ else /* no overflow on double */
+ {
+ long double div9, div10, div11;
+
+ div9 = (long double) (double) 7.4583407312002067432909653e-155;
+ /* div9 = 2^(-2^9) */
+ div10 = div9 * div9; /* 2^(-2^10) */
+ div11 = div10 * div10; /* 2^(-2^11) if extended precision */
+ /* since -DBL_MAX <= x <= DBL_MAX, the cast to double should not
+ overflow here */
+ if (ABS(x) < div10 &&
+ div11 != (long double) 0.0 &&
+ div11 / div10 == div10) /* possible underflow */
+ {
+ long double div12, div13;
+ /* After the divisions, any bit of x must be >= div10,
+ hence the possible division by div9. */
+ div12 = div11 * div11; /* 2^(-2^12) */
+ div13 = div12 * div12; /* 2^(-2^13) */
+ if (ABS (x) <= div13)
+ {
+ x /= div13; /* exact */
+ shift_exp -= 8192;
+ mpfr_mul_2si (t, t, 8192, MPFR_RNDZ);
+ }
+ if (ABS (x) <= div12)
+ {
+ x /= div12; /* exact */
+ shift_exp -= 4096;
+ mpfr_mul_2si (t, t, 4096, MPFR_RNDZ);
+ }
+ if (ABS (x) <= div11)
+ {
+ x /= div11; /* exact */
+ shift_exp -= 2048;
+ mpfr_mul_2si (t, t, 2048, MPFR_RNDZ);
+ }
+ if (ABS (x) <= div10)
+ {
+ x /= div10; /* exact */
+ shift_exp -= 1024;
+ mpfr_mul_2si (t, t, 1024, MPFR_RNDZ);
+ }
+ if (ABS(x) <= div9)
+ {
+ x /= div9; /* exact */
+ shift_exp -= 512;
+ mpfr_mul_2si (t, t, 512, MPFR_RNDZ);
+ }
+ }
+ else /* no underflow */
+ {
+ inexact = mpfr_set_d (u, (double) x, MPFR_RNDZ);
+ MPFR_ASSERTD (inexact == 0);
+ if (mpfr_add (t, t, u, MPFR_RNDZ) != 0)
+ {
+ if (!mpfr_number_p (t))
+ break;
+ /* Inexact. This cannot happen unless the C implementation
+ "lies" on the precision or when long doubles are
+ implemented with FP expansions like under Mac OS X. */
+ if (MPFR_PREC (t) != MPFR_PREC (r) + 1)
+ {
+ /* We assume that MPFR_PREC (r) < MPFR_PREC_MAX.
+ The precision MPFR_PREC (r) + 1 allows us to
+ deduce the rounding bit and the sticky bit. */
+ mpfr_set_prec (t, MPFR_PREC (r) + 1);
+ goto convert;
+ }
+ else
+ {
+ mp_limb_t *tp;
+ int rb_mask;
+
+ /* Since mpfr_add was inexact, the sticky bit is 1. */
+ tp = MPFR_MANT (t);
+ rb_mask = MPFR_LIMB_ONE <<
+ (GMP_NUMB_BITS - 1 -
+ (MPFR_PREC (r) & (GMP_NUMB_BITS - 1)));
+ if (rnd_mode == MPFR_RNDN)
+ rnd_mode = (*tp & rb_mask) ^ MPFR_IS_NEG (t) ?
+ MPFR_RNDU : MPFR_RNDD;
+ *tp |= rb_mask;
+ break;
+ }
+ }
+ x -= (long double) mpfr_get_d1 (u); /* exact */
+ }
+ }
+ }
+ inexact = mpfr_mul_2si (r, t, shift_exp, rnd_mode);
+ mpfr_clear (t);
+ mpfr_clear (u);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inexact, rnd_mode);
+
+ nan:
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+}
+
+#else /* IEEE Extended Little Endian Code */
+
+int
+mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
+{
+ int inexact, i, k, cnt;
+ mpfr_t tmp;
+ mp_limb_t tmpmant[MPFR_LIMBS_PER_LONG_DOUBLE];
+ mpfr_long_double_t x;
+ mpfr_exp_t exp;
+ int signd;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ /* Check for NAN */
+ if (MPFR_UNLIKELY (d != d))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ /* Check for INF */
+ else if (MPFR_UNLIKELY (d > MPFR_LDBL_MAX))
+ {
+ MPFR_SET_INF (r);
+ MPFR_SET_POS (r);
+ return 0;
+ }
+ else if (MPFR_UNLIKELY (d < -MPFR_LDBL_MAX))
+ {
+ MPFR_SET_INF (r);
+ MPFR_SET_NEG (r);
+ return 0;
+ }
+ /* Check for ZERO */
+ else if (MPFR_UNLIKELY (d == 0.0))
+ {
+ x.ld = d;
+ MPFR_SET_ZERO (r);
+ if (x.s.sign == 1)
+ MPFR_SET_NEG(r);
+ else
+ MPFR_SET_POS(r);
+ return 0;
+ }
+
+ /* now d is neither 0, nor NaN nor Inf */
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ MPFR_MANT (tmp) = tmpmant;
+ MPFR_PREC (tmp) = 64;
+
+ /* Extract sign */
+ x.ld = d;
+ signd = MPFR_SIGN_POS;
+ if (x.ld < 0.0)
+ {
+ signd = MPFR_SIGN_NEG;
+ x.ld = -x.ld;
+ }
+
+ /* Extract mantissa */
+#if GMP_NUMB_BITS >= 64
+ tmpmant[0] = ((mp_limb_t) x.s.manh << 32) | ((mp_limb_t) x.s.manl);
+#else
+ tmpmant[0] = (mp_limb_t) x.s.manl;
+ tmpmant[1] = (mp_limb_t) x.s.manh;
+#endif
+
+ /* Normalize mantissa */
+ i = MPFR_LIMBS_PER_LONG_DOUBLE;
+ MPN_NORMALIZE_NOT_ZERO (tmpmant, i);
+ k = MPFR_LIMBS_PER_LONG_DOUBLE - i;
+ count_leading_zeros (cnt, tmpmant[i - 1]);
+ if (MPFR_LIKELY (cnt != 0))
+ mpn_lshift (tmpmant + k, tmpmant, i, cnt);
+ else if (k != 0)
+ MPN_COPY (tmpmant + k, tmpmant, i);
+ if (MPFR_UNLIKELY (k != 0))
+ MPN_ZERO (tmpmant, k);
+
+ /* Set exponent */
+ exp = (mpfr_exp_t) ((x.s.exph << 8) + x.s.expl); /* 15-bit unsigned int */
+ if (MPFR_UNLIKELY (exp == 0))
+ exp -= 0x3FFD;
+ else
+ exp -= 0x3FFE;
+
+ MPFR_SET_EXP (tmp, exp - cnt - k * GMP_NUMB_BITS);
+
+ /* tmp is exact */
+ inexact = mpfr_set4 (r, tmp, rnd_mode, signd);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (r, inexact, rnd_mode);
+}
+
+#endif
diff --git a/src/set_nan.c b/src/set_nan.c
new file mode 100644
index 0000000..db89041
--- /dev/null
+++ b/src/set_nan.c
@@ -0,0 +1,31 @@
+/* mpfr_set_nan -- set a number to NaN.
+
+Copyright 2002, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#include "mpfr-impl.h"
+
+void
+mpfr_set_nan (mpfr_ptr x)
+{
+ MPFR_SET_NAN (x);
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+}
diff --git a/src/set_prc_raw.c b/src/set_prc_raw.c
new file mode 100644
index 0000000..7b66e54
--- /dev/null
+++ b/src/set_prc_raw.c
@@ -0,0 +1,31 @@
+/* mpfr_set_prec_raw -- reset the precision of a floating-point number
+
+Copyright 2000, 2001, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_set_prec_raw (mpfr_ptr x, mpfr_prec_t p)
+{
+ MPFR_ASSERTN (p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
+ MPFR_ASSERTN (p <= (mpfr_prec_t) MPFR_GET_ALLOC_SIZE(x) * GMP_NUMB_BITS);
+ MPFR_PREC(x) = p;
+}
diff --git a/src/set_prec.c b/src/set_prec.c
new file mode 100644
index 0000000..3ecdc05
--- /dev/null
+++ b/src/set_prec.c
@@ -0,0 +1,55 @@
+/* mpfr_set_prec -- reset the precision of a floating-point number
+
+Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_set_prec (mpfr_ptr x, mpfr_prec_t p)
+{
+ mp_size_t xsize, xoldsize;
+ mpfr_limb_ptr tmp;
+
+ /* first, check if p is correct */
+ MPFR_ASSERTN (p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
+
+ /* Calculate the new number of limbs */
+ xsize = MPFR_PREC2LIMBS (p);
+
+ /* Realloc only if the new size is greater than the old */
+ xoldsize = MPFR_GET_ALLOC_SIZE (x);
+ if (xsize > xoldsize)
+ {
+ tmp = (mpfr_limb_ptr) (*__gmp_reallocate_func)
+ (MPFR_GET_REAL_PTR(x), MPFR_MALLOC_SIZE(xoldsize), MPFR_MALLOC_SIZE(xsize));
+ MPFR_SET_MANT_PTR(x, tmp);
+ MPFR_SET_ALLOC_SIZE(x, xsize);
+ }
+ MPFR_PREC (x) = p;
+ MPFR_SET_NAN (x); /* initializes to NaN */
+}
+
+#undef mpfr_get_prec
+mpfr_prec_t
+mpfr_get_prec (mpfr_srcptr x)
+{
+ return MPFR_PREC(x);
+}
diff --git a/src/set_q.c b/src/set_q.c
new file mode 100644
index 0000000..1a4e511
--- /dev/null
+++ b/src/set_q.c
@@ -0,0 +1,133 @@
+/* mpfr_set_q -- set a floating-point number from a multiple-precision rational
+
+Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/*
+ * Set f to z, choosing the smallest precision for f
+ * so that z = f*(2^BPML)*zs*2^(RetVal)
+ */
+static int
+set_z (mpfr_ptr f, mpz_srcptr z, mp_size_t *zs)
+{
+ mp_limb_t *p;
+ mp_size_t s;
+ int c;
+ mpfr_prec_t pf;
+
+ MPFR_ASSERTD (mpz_sgn (z) != 0);
+
+ /* Remove useless ending 0 */
+ for (p = PTR (z), s = *zs = ABS (SIZ (z)) ; *p == 0; p++, s--)
+ MPFR_ASSERTD (s >= 0);
+
+ /* Get working precision */
+ count_leading_zeros (c, p[s-1]);
+ pf = s * GMP_NUMB_BITS - c;
+ if (pf < MPFR_PREC_MIN)
+ pf = MPFR_PREC_MIN;
+ mpfr_init2 (f, pf);
+
+ /* Copy Mantissa */
+ if (MPFR_LIKELY (c))
+ mpn_lshift (MPFR_MANT (f), p, s, c);
+ else
+ MPN_COPY (MPFR_MANT (f), p, s);
+
+ MPFR_SET_SIGN (f, mpz_sgn (z));
+ MPFR_SET_EXP (f, 0);
+
+ return -c;
+}
+
+/* set f to the rational q */
+int
+mpfr_set_q (mpfr_ptr f, mpq_srcptr q, mpfr_rnd_t rnd)
+{
+ mpz_srcptr num, den;
+ mpfr_t n, d;
+ int inexact;
+ int cn, cd;
+ long shift;
+ mp_size_t sn, sd;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ num = mpq_numref (q);
+ den = mpq_denref (q);
+ /* NAN and INF for mpq are not really documented, but could be found */
+ if (MPFR_UNLIKELY (mpz_sgn (num) == 0))
+ {
+ if (MPFR_UNLIKELY (mpz_sgn (den) == 0))
+ {
+ MPFR_SET_NAN (f);
+ MPFR_RET_NAN;
+ }
+ else
+ {
+ MPFR_SET_ZERO (f);
+ MPFR_SET_POS (f);
+ MPFR_RET (0);
+ }
+ }
+ if (MPFR_UNLIKELY (mpz_sgn (den) == 0))
+ {
+ MPFR_SET_INF (f);
+ MPFR_SET_SIGN (f, mpz_sgn (num));
+ MPFR_RET (0);
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ cn = set_z (n, num, &sn);
+ cd = set_z (d, den, &sd);
+
+ sn -= sd;
+ if (MPFR_UNLIKELY (sn > MPFR_EMAX_MAX / GMP_NUMB_BITS))
+ {
+ inexact = mpfr_overflow (f, rnd, MPFR_SIGN (f));
+ goto end;
+ }
+ if (MPFR_UNLIKELY (sn < MPFR_EMIN_MIN / GMP_NUMB_BITS -1))
+ {
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
+ inexact = mpfr_underflow (f, rnd, MPFR_SIGN (f));
+ goto end;
+ }
+
+ inexact = mpfr_div (f, n, d, rnd);
+ shift = GMP_NUMB_BITS*sn+cn-cd;
+ MPFR_ASSERTD (shift == GMP_NUMB_BITS*sn+cn-cd);
+ cd = mpfr_mul_2si (f, f, shift, rnd);
+ MPFR_SAVE_EXPO_FREE (expo);
+ if (MPFR_UNLIKELY (cd != 0))
+ inexact = cd;
+ else
+ inexact = mpfr_check_range (f, inexact, rnd);
+ end:
+ mpfr_clear (d);
+ mpfr_clear (n);
+ return inexact;
+}
+
+
diff --git a/src/set_rnd.c b/src/set_rnd.c
new file mode 100644
index 0000000..7b014dd
--- /dev/null
+++ b/src/set_rnd.c
@@ -0,0 +1,40 @@
+/* mpfr_set_default_rounding_mode -- set the default rounding mode
+ mpfr_get_default_rounding_mode -- get the default rounding mode
+
+Copyright 1999, 2001, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+mpfr_rnd_t MPFR_THREAD_ATTR __gmpfr_default_rounding_mode = MPFR_RNDN;
+
+void
+mpfr_set_default_rounding_mode (mpfr_rnd_t rnd_mode)
+{
+ if (rnd_mode >= MPFR_RNDN && rnd_mode < MPFR_RND_MAX)
+ __gmpfr_default_rounding_mode = rnd_mode;
+}
+
+#undef mpfr_get_default_rounding_mode
+mpfr_rnd_t
+mpfr_get_default_rounding_mode (void)
+{
+ return __gmpfr_default_rounding_mode;
+}
diff --git a/src/set_si.c b/src/set_si.c
new file mode 100644
index 0000000..30cb66d
--- /dev/null
+++ b/src/set_si.c
@@ -0,0 +1,30 @@
+/* mpfr_set_si -- set a MPFR number from a machine signed integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_set_si
+int
+mpfr_set_si (mpfr_ptr x, long i, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set_si_2exp (x, i, 0, rnd_mode);
+}
diff --git a/src/set_si_2exp.c b/src/set_si_2exp.c
new file mode 100644
index 0000000..2064a70
--- /dev/null
+++ b/src/set_si_2exp.c
@@ -0,0 +1,73 @@
+/* mpfr_set_si_2exp -- set a MPFR number from a machine signed integer with
+ a shift
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_set_si_2exp (mpfr_ptr x, long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode)
+{
+ if (i == 0)
+ {
+ MPFR_SET_ZERO (x);
+ MPFR_SET_POS (x);
+ MPFR_RET (0);
+ }
+ else
+ {
+ mp_size_t xn;
+ unsigned int cnt, nbits;
+ mp_limb_t ai, *xp;
+ int inex = 0;
+
+ /* FIXME: support int limbs (e.g. 16-bit limbs on 16-bit proc) */
+ ai = SAFE_ABS (unsigned long, i);
+ MPFR_ASSERTN (SAFE_ABS (unsigned long, i) == ai);
+
+ /* Position of the highest limb */
+ xn = (MPFR_PREC (x) - 1) / GMP_NUMB_BITS;
+ count_leading_zeros (cnt, ai);
+ MPFR_ASSERTD (cnt < GMP_NUMB_BITS); /* OK since i != 0 */
+
+ xp = MPFR_MANT(x);
+ xp[xn] = ai << cnt;
+ /* Zero the xn lower limbs. */
+ MPN_ZERO(xp, xn);
+ MPFR_SET_SIGN (x, i < 0 ? MPFR_SIGN_NEG : MPFR_SIGN_POS);
+
+ nbits = GMP_NUMB_BITS - cnt;
+ e += nbits; /* exponent _before_ the rounding */
+
+ /* round if MPFR_PREC(x) smaller than length of i */
+ if (MPFR_UNLIKELY (MPFR_PREC (x) < nbits) &&
+ MPFR_UNLIKELY (mpfr_round_raw (xp + xn, xp + xn, nbits, i < 0,
+ MPFR_PREC (x), rnd_mode, &inex)))
+ {
+ e++;
+ xp[xn] = MPFR_LIMB_HIGHBIT;
+ }
+
+ MPFR_EXP (x) = e;
+ return mpfr_check_range (x, inex, rnd_mode);
+ }
+}
diff --git a/src/set_sj.c b/src/set_sj.c
new file mode 100644
index 0000000..1d8c522
--- /dev/null
+++ b/src/set_sj.c
@@ -0,0 +1,52 @@
+/* mpfr_set_sj -- set a MPFR number from a huge machine signed integer
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+int
+mpfr_set_sj (mpfr_t x, intmax_t j, mpfr_rnd_t rnd)
+{
+ return mpfr_set_sj_2exp (x, j, 0, rnd);
+}
+
+int
+mpfr_set_sj_2exp (mpfr_t x, intmax_t j, intmax_t e, mpfr_rnd_t rnd)
+{
+ if (j>=0)
+ return mpfr_set_uj_2exp (x, j, e, rnd);
+ else
+ {
+ int inex;
+ inex = mpfr_set_uj_2exp (x, - (uintmax_t) j, e, MPFR_INVERT_RND (rnd));
+ MPFR_CHANGE_SIGN (x);
+ return -inex;
+ }
+}
+
+#endif
diff --git a/src/set_str.c b/src/set_str.c
new file mode 100644
index 0000000..d2c40fc
--- /dev/null
+++ b/src/set_str.c
@@ -0,0 +1,42 @@
+/* mpfr_set_str -- set a floating-point number from a string
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_set_str (mpfr_t x, const char *str, int base, mpfr_rnd_t rnd)
+{
+ char *p;
+
+ if (MPFR_UNLIKELY (*str == 0))
+ return -1;
+ mpfr_strtofr (x, str, &p, base, rnd);
+ return (*p == 0) ? 0 : -1;
+}
+
+
+int
+mpfr_init_set_str (mpfr_ptr x, const char *str, int base, mpfr_rnd_t rnd)
+{
+ mpfr_init (x);
+ return mpfr_set_str (x, str, base, rnd);
+}
diff --git a/src/set_str_raw.c b/src/set_str_raw.c
new file mode 100644
index 0000000..e7debb4
--- /dev/null
+++ b/src/set_str_raw.c
@@ -0,0 +1,55 @@
+/* mpfr_set_str_binary -- set a floating-point number from a binary string
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Currently the number should be of the form +/- xxxx.xxxxxxEyy, with
+ decimal exponent. The mantissa of x is supposed to be large enough
+ to hold all the bits of str. */
+
+void
+mpfr_set_str_binary (mpfr_ptr x, const char *str)
+{
+ int has_sign;
+ int res;
+
+ if (*str == 'N')
+ {
+ MPFR_SET_NAN(x);
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+ return;
+ }
+
+ has_sign = *str == '-' || *str == '+';
+ if (str[has_sign] == 'I')
+ {
+ MPFR_SET_INF(x);
+ if (*str == '-')
+ MPFR_SET_NEG(x);
+ else
+ MPFR_SET_POS(x);
+ return;
+ }
+
+ res = mpfr_strtofr (x, str, 0, 2, MPFR_RNDZ);
+ MPFR_ASSERTN (res == 0);
+}
diff --git a/src/set_ui.c b/src/set_ui.c
new file mode 100644
index 0000000..caafaac
--- /dev/null
+++ b/src/set_ui.c
@@ -0,0 +1,30 @@
+/* mpfr_set_ui -- set a MPFR number from a machine unsigned integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_set_ui
+int
+mpfr_set_ui (mpfr_ptr x, unsigned long i, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set_ui_2exp (x, i, 0, rnd_mode);
+}
diff --git a/src/set_ui_2exp.c b/src/set_ui_2exp.c
new file mode 100644
index 0000000..6c77ba2
--- /dev/null
+++ b/src/set_ui_2exp.c
@@ -0,0 +1,72 @@
+/* mpfr_set_ui_2exp -- set a MPFR number from a machine unsigned integer with
+ a shift
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_set_ui_2exp (mpfr_ptr x, unsigned long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode)
+{
+ MPFR_SET_POS (x);
+
+ if (i == 0)
+ {
+ MPFR_SET_ZERO (x);
+ MPFR_RET (0);
+ }
+ else
+ {
+ mp_size_t xn;
+ unsigned int cnt, nbits;
+ mp_limb_t *xp;
+ int inex = 0;
+
+ /* FIXME: support int limbs (e.g. 16-bit limbs on 16-bit proc) */
+ MPFR_ASSERTD (i == (mp_limb_t) i);
+
+ /* Position of the highest limb */
+ xn = (MPFR_PREC (x) - 1) / GMP_NUMB_BITS;
+ count_leading_zeros (cnt, (mp_limb_t) i);
+ MPFR_ASSERTD (cnt < GMP_NUMB_BITS); /* OK since i != 0 */
+
+ xp = MPFR_MANT(x);
+ xp[xn] = ((mp_limb_t) i) << cnt;
+ /* Zero the xn lower limbs. */
+ MPN_ZERO(xp, xn);
+
+ nbits = GMP_NUMB_BITS - cnt;
+ e += nbits; /* exponent _before_ the rounding */
+
+ /* round if MPFR_PREC(x) smaller than length of i */
+ if (MPFR_UNLIKELY (MPFR_PREC (x) < nbits) &&
+ MPFR_UNLIKELY (mpfr_round_raw (xp + xn, xp + xn, nbits, 0,
+ MPFR_PREC (x), rnd_mode, &inex)))
+ {
+ e++;
+ xp[xn] = MPFR_LIMB_HIGHBIT;
+ }
+
+ MPFR_EXP (x) = e;
+ return mpfr_check_range (x, inex, rnd_mode);
+ }
+}
diff --git a/src/set_uj.c b/src/set_uj.c
new file mode 100644
index 0000000..768d3fe
--- /dev/null
+++ b/src/set_uj.c
@@ -0,0 +1,123 @@
+/* mpfr_set_uj -- set a MPFR number from a huge machine unsigned integer
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+int
+mpfr_set_uj (mpfr_t x, uintmax_t j, mpfr_rnd_t rnd)
+{
+ return mpfr_set_uj_2exp (x, j, 0, rnd);
+}
+
+int
+mpfr_set_uj_2exp (mpfr_t x, uintmax_t j, intmax_t e, mpfr_rnd_t rnd)
+{
+ unsigned int cnt, i;
+ mp_size_t k, len;
+ mp_limb_t limb;
+ mp_limb_t yp[sizeof(uintmax_t) / sizeof(mp_limb_t)];
+ mpfr_t y;
+ unsigned long uintmax_bit_size = sizeof(uintmax_t) * CHAR_BIT;
+ unsigned long bpml = GMP_NUMB_BITS % uintmax_bit_size;
+
+ /* Special case */
+ if (j == 0)
+ {
+ MPFR_SET_POS(x);
+ MPFR_SET_ZERO(x);
+ MPFR_RET(0);
+ }
+
+ MPFR_ASSERTN (sizeof(uintmax_t) % sizeof(mp_limb_t) == 0);
+
+ /* Create an auxillary var */
+ MPFR_TMP_INIT1 (yp, y, uintmax_bit_size);
+ k = numberof (yp);
+ if (k == 1)
+ limb = yp[0] = j;
+ else
+ {
+ /* Note: either GMP_NUMB_BITS = uintmax_bit_size, then k = 1 the
+ shift j >>= bpml is never done, or GMP_NUMB_BITS < uintmax_bit_size
+ and bpml = GMP_NUMB_BITS. */
+ for (i = 0; i < k; i++, j >>= bpml)
+ yp[i] = j; /* Only the low bits are copied */
+
+ /* Find the first limb not equal to zero. */
+ do
+ {
+ MPFR_ASSERTD (k > 0);
+ limb = yp[--k];
+ }
+ while (limb == 0);
+ k++;
+ }
+ count_leading_zeros(cnt, limb);
+ len = numberof (yp) - k;
+
+ /* Normalize it: len = number of last 0 limb, k number of non-zero limbs */
+ if (MPFR_LIKELY(cnt))
+ mpn_lshift (yp+len, yp, k, cnt); /* Normalize the High Limb*/
+ else if (len != 0)
+ MPN_COPY_DECR (yp+len, yp, k); /* Must use DECR */
+ if (len != 0)
+ /* Note: when numberof(yp)==1, len is constant and null, so the compiler
+ can optimize out this code. */
+ {
+ if (len == 1)
+ yp[0] = (mp_limb_t) 0;
+ else
+ MPN_ZERO (yp, len); /* Zeroing the last limbs */
+ }
+ e += k * GMP_NUMB_BITS - cnt; /* Update Expo */
+ MPFR_ASSERTD (MPFR_LIMB_MSB(yp[numberof (yp) - 1]) != 0);
+
+ /* Check expo underflow / overflow (can't use mpfr_check_range) */
+ if (MPFR_UNLIKELY(e < __gmpfr_emin))
+ {
+ /* The following test is necessary because in the rounding to the
+ * nearest mode, mpfr_underflow always rounds away from 0. In
+ * this rounding mode, we need to round to 0 if:
+ * _ |x| < 2^(emin-2), or
+ * _ |x| = 2^(emin-2) and the absolute value of the exact
+ * result is <= 2^(emin-2). */
+ if (rnd == MPFR_RNDN && (e+1 < __gmpfr_emin || mpfr_powerof2_raw(y)))
+ rnd = MPFR_RNDZ;
+ return mpfr_underflow (x, rnd, MPFR_SIGN_POS);
+ }
+ if (MPFR_UNLIKELY(e > __gmpfr_emax))
+ return mpfr_overflow (x, rnd, MPFR_SIGN_POS);
+ MPFR_SET_EXP (y, e);
+
+ /* Final: set x to y (rounding if necessary) */
+ return mpfr_set (x, y, rnd);
+}
+
+#endif
diff --git a/src/set_z.c b/src/set_z.c
new file mode 100644
index 0000000..8a14d94
--- /dev/null
+++ b/src/set_z.c
@@ -0,0 +1,30 @@
+/* mpfr_set_z -- set a floating-point number from a multiple-precision integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* set f to the integer z */
+int
+mpfr_set_z (mpfr_ptr f, mpz_srcptr z, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set_z_2exp (f, z, 0, rnd_mode);
+}
diff --git a/src/set_z_exp.c b/src/set_z_exp.c
new file mode 100644
index 0000000..e5fe961
--- /dev/null
+++ b/src/set_z_exp.c
@@ -0,0 +1,180 @@
+/* mpfr_set_z_2exp -- set a floating-point number from a multiple-precision
+ integer and an exponent
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* set f to the integer z multiplied by 2^e */
+int
+mpfr_set_z_2exp (mpfr_ptr f, mpz_srcptr z, mpfr_exp_t e, mpfr_rnd_t rnd_mode)
+{
+ mp_size_t fn, zn, dif, en;
+ int k, sign_z, inex;
+ mp_limb_t *fp, *zp;
+ mpfr_exp_t exp;
+
+ sign_z = mpz_sgn (z);
+ if (MPFR_UNLIKELY (sign_z == 0)) /* ignore the exponent for 0 */
+ {
+ MPFR_SET_ZERO(f);
+ MPFR_SET_POS(f);
+ MPFR_RET(0);
+ }
+ MPFR_ASSERTD (sign_z == MPFR_SIGN_POS || sign_z == MPFR_SIGN_NEG);
+
+ zn = ABS(SIZ(z)); /* limb size of z */
+ /* compute en = floor(e/GMP_NUMB_BITS) */
+ en = (e >= 0) ? e / GMP_NUMB_BITS : (e + 1) / GMP_NUMB_BITS - 1;
+ MPFR_ASSERTD (zn >= 1);
+ if (MPFR_UNLIKELY (zn + en > MPFR_EMAX_MAX / GMP_NUMB_BITS + 1))
+ return mpfr_overflow (f, rnd_mode, sign_z);
+ /* because zn + en >= MPFR_EMAX_MAX / GMP_NUMB_BITS + 2
+ implies (zn + en) * GMP_NUMB_BITS >= MPFR_EMAX_MAX + GMP_NUMB_BITS + 1
+ and exp = zn * GMP_NUMB_BITS + e - k
+ >= (zn + en) * GMP_NUMB_BITS - k > MPFR_EMAX_MAX */
+
+ fp = MPFR_MANT (f);
+ fn = MPFR_LIMB_SIZE (f);
+ dif = zn - fn;
+ zp = PTR(z);
+ count_leading_zeros (k, zp[zn-1]);
+
+ /* now zn + en <= MPFR_EMAX_MAX / GMP_NUMB_BITS + 1
+ thus (zn + en) * GMP_NUMB_BITS <= MPFR_EMAX_MAX + GMP_NUMB_BITS
+ and exp = zn * GMP_NUMB_BITS + e - k
+ <= (zn + en) * GMP_NUMB_BITS - k + GMP_NUMB_BITS - 1
+ <= MPFR_EMAX_MAX + 2 * GMP_NUMB_BITS - 1 */
+ exp = (mpfr_prec_t) zn * GMP_NUMB_BITS + e - k;
+ /* The exponent will be exp or exp + 1 (due to rounding) */
+ if (MPFR_UNLIKELY (exp > __gmpfr_emax))
+ return mpfr_overflow (f, rnd_mode, sign_z);
+ if (MPFR_UNLIKELY (exp + 1 < __gmpfr_emin))
+ return mpfr_underflow (f, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode,
+ sign_z);
+
+ if (MPFR_LIKELY (dif >= 0))
+ {
+ mp_limb_t rb, sb, ulp;
+ int sh;
+
+ /* number has to be truncated */
+ if (MPFR_LIKELY (k != 0))
+ {
+ mpn_lshift (fp, &zp[dif], fn, k);
+ if (MPFR_LIKELY (dif > 0))
+ fp[0] |= zp[dif - 1] >> (GMP_NUMB_BITS - k);
+ }
+ else
+ MPN_COPY (fp, zp + dif, fn);
+
+ /* Compute Rounding Bit and Sticky Bit */
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (f) );
+ if (MPFR_LIKELY (sh != 0))
+ {
+ mp_limb_t mask = MPFR_LIMB_ONE << (sh-1);
+ mp_limb_t limb = fp[0];
+ rb = limb & mask;
+ sb = limb & (mask-1);
+ ulp = 2*mask;
+ fp[0] = limb & ~(ulp-1);
+ }
+ else /* sh == 0 */
+ {
+ mp_limb_t mask = MPFR_LIMB_ONE << (GMP_NUMB_BITS - 1 - k);
+ if (MPFR_LIKELY (dif > 0))
+ {
+ rb = zp[--dif] & mask;
+ sb = zp[dif] & (mask-1);
+ }
+ else
+ rb = sb = 0;
+ k = 0;
+ ulp = MPFR_LIMB_ONE;
+ }
+ if (MPFR_UNLIKELY (sb == 0) && MPFR_LIKELY (dif > 0))
+ {
+ sb = zp[--dif];
+ if (MPFR_LIKELY (k != 0))
+ sb &= MPFR_LIMB_MASK (GMP_NUMB_BITS - k);
+ if (MPFR_UNLIKELY (sb == 0) && MPFR_LIKELY (dif > 0))
+ do {
+ sb = zp[--dif];
+ } while (dif > 0 && sb == 0);
+ }
+
+ /* Rounding */
+ if (MPFR_LIKELY (rnd_mode == MPFR_RNDN))
+ {
+ if (rb == 0 || MPFR_UNLIKELY (sb == 0 && (fp[0] & ulp) == 0))
+ goto trunc;
+ else
+ goto addoneulp;
+ }
+ else /* Not Nearest */
+ {
+ if (MPFR_LIKELY (MPFR_IS_LIKE_RNDZ (rnd_mode, sign_z < 0))
+ || MPFR_UNLIKELY ( (sb | rb) == 0 ))
+ goto trunc;
+ else
+ goto addoneulp;
+ }
+
+ trunc:
+ inex = MPFR_LIKELY ((sb | rb) != 0) ? -1 : 0;
+ goto end;
+
+ addoneulp:
+ inex = 1;
+ if (MPFR_UNLIKELY (mpn_add_1 (fp, fp, fn, ulp)))
+ {
+ /* Pow 2 case */
+ if (MPFR_UNLIKELY (exp == __gmpfr_emax))
+ return mpfr_overflow (f, rnd_mode, sign_z);
+ exp ++;
+ fp[fn-1] = MPFR_LIMB_HIGHBIT;
+ }
+ end:
+ (void) 0;
+ }
+ else /* dif < 0: Mantissa F is strictly bigger than z's one */
+ {
+ if (MPFR_LIKELY (k != 0))
+ mpn_lshift (fp - dif, zp, zn, k);
+ else
+ MPN_COPY (fp - dif, zp, zn);
+ /* fill with zeroes */
+ MPN_ZERO (fp, -dif);
+ inex = 0; /* result is exact */
+ }
+
+ if (MPFR_UNLIKELY (exp < __gmpfr_emin))
+ {
+ if (rnd_mode == MPFR_RNDN && inex == 0 && mpfr_powerof2_raw (f))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (f, rnd_mode, sign_z);
+ }
+
+ MPFR_SET_EXP (f, exp);
+ MPFR_SET_SIGN (f, sign_z);
+ MPFR_RET (inex*sign_z);
+}
diff --git a/src/set_zero.c b/src/set_zero.c
new file mode 100644
index 0000000..ea13b03
--- /dev/null
+++ b/src/set_zero.c
@@ -0,0 +1,31 @@
+/* mpfr_set_zero -- set a number to plus or minus zero.
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+void
+mpfr_set_zero (mpfr_ptr x, int sign)
+{
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ if (sign < 0)
+ MPFR_SET_NEG(x);
+}
diff --git a/src/setmax.c b/src/setmax.c
new file mode 100644
index 0000000..e88a709
--- /dev/null
+++ b/src/setmax.c
@@ -0,0 +1,41 @@
+/* mpfr_setmax -- maximum representable floating-point number (raw version)
+
+Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Note: the flags are not cleared and the current sign is kept. */
+
+void
+mpfr_setmax (mpfr_ptr x, mpfr_exp_t e)
+{
+ mp_size_t xn, i;
+ int sh;
+ mp_limb_t *xp;
+
+ MPFR_SET_EXP (x, e);
+ xn = MPFR_LIMB_SIZE (x);
+ sh = (mpfr_prec_t) xn * GMP_NUMB_BITS - MPFR_PREC(x);
+ xp = MPFR_MANT(x);
+ xp[0] = MP_LIMB_T_MAX << sh;
+ for (i = 1; i < xn; i++)
+ xp[i] = MP_LIMB_T_MAX;
+}
diff --git a/src/setmin.c b/src/setmin.c
new file mode 100644
index 0000000..62c003a
--- /dev/null
+++ b/src/setmin.c
@@ -0,0 +1,38 @@
+/* mpfr_setmin -- minimum representable floating-point number (raw version)
+
+Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Note: the flags are not cleared and the current sign is kept. */
+
+void
+mpfr_setmin (mpfr_ptr x, mpfr_exp_t e)
+{
+ mp_size_t xn;
+ mp_limb_t *xp;
+
+ MPFR_SET_EXP (x, e);
+ xn = (MPFR_PREC(x) - 1) / GMP_NUMB_BITS;
+ xp = MPFR_MANT(x);
+ xp[xn] = MPFR_LIMB_HIGHBIT;
+ MPN_ZERO(xp, xn);
+}
diff --git a/src/setsign.c b/src/setsign.c
new file mode 100644
index 0000000..eb9e481
--- /dev/null
+++ b/src/setsign.c
@@ -0,0 +1,30 @@
+/* mpfr_setsign -- Produce a value with the magnitude of x and sign bit s
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_setsign
+int
+mpfr_setsign (mpfr_ptr z, mpfr_srcptr x, int s, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_set4 (z, x, rnd_mode, s ? -1 : 1);
+}
diff --git a/src/sgn.c b/src/sgn.c
new file mode 100644
index 0000000..ec59929
--- /dev/null
+++ b/src/sgn.c
@@ -0,0 +1,40 @@
+/* mpfr_sgn -- Sign of a floating point number.
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+(mpfr_sgn) (mpfr_srcptr a)
+{
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (a)))
+ {
+ if (MPFR_LIKELY (MPFR_IS_ZERO (a)))
+ return 0;
+ if (MPFR_UNLIKELY (MPFR_IS_NAN (a)))
+ {
+ MPFR_SET_ERANGE ();
+ return 0;
+ }
+ /* Remains infinity, handled by the return below. */
+ }
+ return MPFR_INT_SIGN (a);
+}
diff --git a/src/si_op.c b/src/si_op.c
new file mode 100644
index 0000000..bad4b85
--- /dev/null
+++ b/src/si_op.c
@@ -0,0 +1,57 @@
+/* mpfr_add_si -- add a floating-point number with a machine integer
+ mpfr_sub_si -- sub a floating-point number with a machine integer
+ mpfr_si_sub -- sub a machine number with a floating-point number
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_add_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
+{
+ if (u >= 0)
+ return mpfr_add_ui (y, x, u, rnd_mode);
+ else
+ return mpfr_sub_ui (y, x, -u, rnd_mode);
+}
+
+int
+mpfr_sub_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
+{
+ if (u >= 0)
+ return mpfr_sub_ui (y, x, u, rnd_mode);
+ else
+ return mpfr_add_ui (y, x, -u, rnd_mode);
+}
+
+int
+mpfr_si_sub (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ if (u >= 0)
+ return mpfr_ui_sub (y, u, x, rnd_mode);
+ else
+ {
+ int res = -mpfr_add_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ return res;
+ }
+}
+
diff --git a/src/signbit.c b/src/signbit.c
new file mode 100644
index 0000000..8a2bc7f
--- /dev/null
+++ b/src/signbit.c
@@ -0,0 +1,30 @@
+/* mpfr_signbit -- Signbit of a MPFR number
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_signbit
+int
+mpfr_signbit (mpfr_srcptr x)
+{
+ return MPFR_SIGN (x) < 0;
+}
diff --git a/src/sin.c b/src/sin.c
new file mode 100644
index 0000000..88e73f3
--- /dev/null
+++ b/src/sin.c
@@ -0,0 +1,183 @@
+/* mpfr_sin -- sine of a floating-point number
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+static int
+mpfr_sin_fast (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inex;
+
+ inex = mpfr_sincos_fast (y, NULL, x, rnd_mode);
+ inex = inex & 3; /* 0: exact, 1: rounded up, 2: rounded down */
+ return (inex == 2) ? -1 : inex;
+}
+
+int
+mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t c, xr;
+ mpfr_srcptr xx;
+ mpfr_exp_t expx, err;
+ mpfr_prec_t precy, m;
+ int inexact, sign, reduce;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ /* sin(x) = x - x^3/6 + ... so the error is < 2^(3*EXP(x)-2) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2 * MPFR_GET_EXP (x), 2, 0,
+ rnd_mode, {});
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Compute initial precision */
+ precy = MPFR_PREC (y);
+
+ if (precy >= MPFR_SINCOS_THRESHOLD)
+ return mpfr_sin_fast (y, x, rnd_mode);
+
+ m = precy + MPFR_INT_CEIL_LOG2 (precy) + 13;
+ expx = MPFR_GET_EXP (x);
+
+ mpfr_init (c);
+ mpfr_init (xr);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ /* first perform argument reduction modulo 2*Pi (if needed),
+ also helps to determine the sign of sin(x) */
+ if (expx >= 2) /* If Pi < x < 4, we need to reduce too, to determine
+ the sign of sin(x). For 2 <= |x| < Pi, we could avoid
+ the reduction. */
+ {
+ reduce = 1;
+ /* As expx + m - 1 will silently be converted into mpfr_prec_t
+ in the mpfr_set_prec call, the assert below may be useful to
+ avoid undefined behavior. */
+ MPFR_ASSERTN (expx + m - 1 <= MPFR_PREC_MAX);
+ mpfr_set_prec (c, expx + m - 1);
+ mpfr_set_prec (xr, m);
+ mpfr_const_pi (c, MPFR_RNDN);
+ mpfr_mul_2ui (c, c, 1, MPFR_RNDN);
+ mpfr_remainder (xr, x, c, MPFR_RNDN);
+ /* The analysis is similar to that of cos.c:
+ |xr - x - 2kPi| <= 2^(2-m). Thus we can decide the sign
+ of sin(x) if xr is at distance at least 2^(2-m) of both
+ 0 and +/-Pi. */
+ mpfr_div_2ui (c, c, 1, MPFR_RNDN);
+ /* Since c approximates Pi with an error <= 2^(2-expx-m) <= 2^(-m),
+ it suffices to check that c - |xr| >= 2^(2-m). */
+ if (MPFR_SIGN (xr) > 0)
+ mpfr_sub (c, c, xr, MPFR_RNDZ);
+ else
+ mpfr_add (c, c, xr, MPFR_RNDZ);
+ if (MPFR_IS_ZERO(xr)
+ || MPFR_GET_EXP(xr) < (mpfr_exp_t) 3 - (mpfr_exp_t) m
+ || MPFR_IS_ZERO(c)
+ || MPFR_GET_EXP(c) < (mpfr_exp_t) 3 - (mpfr_exp_t) m)
+ goto ziv_next;
+
+ /* |xr - x - 2kPi| <= 2^(2-m), thus |sin(xr) - sin(x)| <= 2^(2-m) */
+ xx = xr;
+ }
+ else /* the input argument is already reduced */
+ {
+ reduce = 0;
+ xx = x;
+ }
+
+ sign = MPFR_SIGN(xx);
+ /* now that the argument is reduced, precision m is enough */
+ mpfr_set_prec (c, m);
+ mpfr_cos (c, xx, MPFR_RNDZ); /* can't be exact */
+ mpfr_nexttoinf (c); /* now c = cos(x) rounded away */
+ mpfr_mul (c, c, c, MPFR_RNDU); /* away */
+ mpfr_ui_sub (c, 1, c, MPFR_RNDZ);
+ mpfr_sqrt (c, c, MPFR_RNDZ);
+ if (MPFR_IS_NEG_SIGN(sign))
+ MPFR_CHANGE_SIGN(c);
+
+ /* Warning: c may be 0! */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (c)))
+ {
+ /* Huge cancellation: increase prec a lot! */
+ m = MAX (m, MPFR_PREC (x));
+ m = 2 * m;
+ }
+ else
+ {
+ /* the absolute error on c is at most 2^(3-m-EXP(c)),
+ plus 2^(2-m) if there was an argument reduction.
+ Since EXP(c) <= 1, 3-m-EXP(c) >= 2-m, thus the error
+ is at most 2^(3-m-EXP(c)) in case of argument reduction. */
+ err = 2 * MPFR_GET_EXP (c) + (mpfr_exp_t) m - 3 - (reduce != 0);
+ if (MPFR_CAN_ROUND (c, err, precy, rnd_mode))
+ break;
+
+ /* check for huge cancellation (Near 0) */
+ if (err < (mpfr_exp_t) MPFR_PREC (y))
+ m += MPFR_PREC (y) - err;
+ /* Check if near 1 */
+ if (MPFR_GET_EXP (c) == 1)
+ m += m;
+ }
+
+ ziv_next:
+ /* Else generic increase */
+ MPFR_ZIV_NEXT (loop, m);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, c, rnd_mode);
+ /* inexact cannot be 0, since this would mean that c was representable
+ within the target precision, but in that case mpfr_can_round will fail */
+
+ mpfr_clear (c);
+ mpfr_clear (xr);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/sin_cos.c b/src/sin_cos.c
new file mode 100644
index 0000000..8ee95e9
--- /dev/null
+++ b/src/sin_cos.c
@@ -0,0 +1,662 @@
+/* mpfr_sin_cos -- sine and cosine of a floating-point number
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* (y, z) <- (sin(x), cos(x)), return value is 0 iff both results are exact
+ ie, iff x = 0 */
+int
+mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t prec, m;
+ int neg, reduce;
+ mpfr_t c, xr;
+ mpfr_srcptr xx;
+ mpfr_exp_t err, expx;
+ int inexy, inexz;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_ASSERTN (y != z);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ /* y = 0, thus exact, but z is inexact in case of underflow
+ or overflow */
+ inexy = 0; /* y is exact */
+ inexz = mpfr_set_ui (z, 1, rnd_mode);
+ return INEX(inexy,inexz);
+ }
+ }
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("sin[%Pu]=%.*Rg cos[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y,
+ mpfr_get_prec (z), mpfr_log_prec, z));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ prec = MAX (MPFR_PREC (y), MPFR_PREC (z));
+ m = prec + MPFR_INT_CEIL_LOG2 (prec) + 13;
+ expx = MPFR_GET_EXP (x);
+
+ /* When x is close to 0, say 2^(-k), then there is a cancellation of about
+ 2k bits in 1-cos(x)^2. FIXME: in that case, it would be more efficient
+ to compute sin(x) directly. VL: This is partly done by using
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT from the mpfr_sin and mpfr_cos
+ functions. Moreover, any overflow on m is avoided. */
+ if (expx < 0)
+ {
+ /* Warning: in case y = x, and the first call to
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT succeeds but the second fails,
+ we will have clobbered the original value of x.
+ The workaround is to first compute z = cos(x) in that case, since
+ y and z are different. */
+ if (y != x)
+ /* y and x differ, thus we can safely try to compute y first */
+ {
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (
+ y, x, -2 * expx, 2, 0, rnd_mode,
+ { inexy = _inexact;
+ goto small_input; });
+ if (0)
+ {
+ small_input:
+ /* we can go here only if we can round sin(x) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (
+ z, __gmpfr_one, -2 * expx, 1, 0, rnd_mode,
+ { inexz = _inexact;
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ goto end; });
+ }
+
+ /* if we go here, one of the two MPFR_FAST_COMPUTE_IF_SMALL_INPUT
+ calls failed */
+ }
+ else /* y and x are the same variable: try to compute z first, which
+ necessarily differs */
+ {
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (
+ z, __gmpfr_one, -2 * expx, 1, 0, rnd_mode,
+ { inexz = _inexact;
+ goto small_input2; });
+ if (0)
+ {
+ small_input2:
+ /* we can go here only if we can round cos(x) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (
+ y, x, -2 * expx, 2, 0, rnd_mode,
+ { inexy = _inexact;
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ goto end; });
+ }
+ }
+ m += 2 * (-expx);
+ }
+
+ if (prec >= MPFR_SINCOS_THRESHOLD)
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_sincos_fast (y, z, x, rnd_mode);
+ }
+
+ mpfr_init (c);
+ mpfr_init (xr);
+
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ /* the following is copied from sin.c */
+ if (expx >= 2) /* reduce the argument */
+ {
+ reduce = 1;
+ mpfr_set_prec (c, expx + m - 1);
+ mpfr_set_prec (xr, m);
+ mpfr_const_pi (c, MPFR_RNDN);
+ mpfr_mul_2ui (c, c, 1, MPFR_RNDN);
+ mpfr_remainder (xr, x, c, MPFR_RNDN);
+ mpfr_div_2ui (c, c, 1, MPFR_RNDN);
+ if (MPFR_SIGN (xr) > 0)
+ mpfr_sub (c, c, xr, MPFR_RNDZ);
+ else
+ mpfr_add (c, c, xr, MPFR_RNDZ);
+ if (MPFR_IS_ZERO(xr)
+ || MPFR_EXP(xr) < (mpfr_exp_t) 3 - (mpfr_exp_t) m
+ || MPFR_EXP(c) < (mpfr_exp_t) 3 - (mpfr_exp_t) m)
+ goto next_step;
+ xx = xr;
+ }
+ else /* the input argument is already reduced */
+ {
+ reduce = 0;
+ xx = x;
+ }
+
+ neg = MPFR_IS_NEG (xx); /* gives sign of sin(x) */
+ mpfr_set_prec (c, m);
+ mpfr_cos (c, xx, MPFR_RNDZ);
+ /* If no argument reduction was performed, the error is at most ulp(c),
+ otherwise it is at most ulp(c) + 2^(2-m). Since |c| < 1, we have
+ ulp(c) <= 2^(-m), thus the error is bounded by 2^(3-m) in that later
+ case. */
+ if (reduce == 0)
+ err = m;
+ else
+ err = MPFR_GET_EXP (c) + (mpfr_exp_t) (m - 3);
+ if (!mpfr_can_round (c, err, MPFR_RNDN, MPFR_RNDZ,
+ MPFR_PREC (z) + (rnd_mode == MPFR_RNDN)))
+ goto next_step;
+
+ /* we can't set z now, because in case z = x, and the mpfr_can_round()
+ call below fails, we will have clobbered the input */
+ mpfr_set_prec (xr, MPFR_PREC(c));
+ mpfr_swap (xr, c); /* save the approximation of the cosine in xr */
+ mpfr_sqr (c, xr, MPFR_RNDU); /* the absolute error is bounded by
+ 2^(5-m) if reduce=1, and by 2^(2-m)
+ otherwise */
+ mpfr_ui_sub (c, 1, c, MPFR_RNDN); /* error bounded by 2^(6-m) if reduce
+ is 1, and 2^(3-m) otherwise */
+ mpfr_sqrt (c, c, MPFR_RNDN); /* the absolute error is bounded by
+ 2^(6-m-Exp(c)) if reduce=1, and
+ 2^(3-m-Exp(c)) otherwise */
+ err = 3 + 3 * reduce - MPFR_GET_EXP (c);
+ if (neg)
+ MPFR_CHANGE_SIGN (c);
+
+ /* the absolute error on c is at most 2^(err-m), which we must put
+ in the form 2^(EXP(c)-err). */
+ err = MPFR_GET_EXP (c) + (mpfr_exp_t) m - err;
+ if (mpfr_can_round (c, err, MPFR_RNDN, MPFR_RNDZ,
+ MPFR_PREC (y) + (rnd_mode == MPFR_RNDN)))
+ break;
+ /* check for huge cancellation */
+ if (err < (mpfr_exp_t) MPFR_PREC (y))
+ m += MPFR_PREC (y) - err;
+ /* Check if near 1 */
+ if (MPFR_GET_EXP (c) == 1
+ && MPFR_MANT (c)[MPFR_LIMB_SIZE (c)-1] == MPFR_LIMB_HIGHBIT)
+ m += m;
+
+ next_step:
+ MPFR_ZIV_NEXT (loop, m);
+ mpfr_set_prec (c, m);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexy = mpfr_set (y, c, rnd_mode);
+ inexz = mpfr_set (z, xr, rnd_mode);
+
+ mpfr_clear (c);
+ mpfr_clear (xr);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ /* FIXME: add a test for bug before revision 7355 */
+ inexy = mpfr_check_range (y, inexy, rnd_mode);
+ inexz = mpfr_check_range (z, inexz, rnd_mode);
+ MPFR_RET (INEX(inexy,inexz));
+}
+
+/*************** asymptotically fast implementation below ********************/
+
+/* truncate Q from R to at most prec bits.
+ Return the number of truncated bits.
+ */
+static mpfr_prec_t
+reduce (mpz_t Q, mpz_srcptr R, mpfr_prec_t prec)
+{
+ mpfr_prec_t l = mpz_sizeinbase (R, 2);
+
+ l = (l > prec) ? l - prec : 0;
+ mpz_fdiv_q_2exp (Q, R, l);
+ return l;
+}
+
+/* truncate S and C so that the smaller has prec bits.
+ Return the number of truncated bits.
+ */
+static unsigned long
+reduce2 (mpz_t S, mpz_t C, mpfr_prec_t prec)
+{
+ unsigned long ls = mpz_sizeinbase (S, 2);
+ unsigned long lc = mpz_sizeinbase (C, 2);
+ unsigned long l;
+
+ l = (ls < lc) ? ls : lc; /* smaller length */
+ l = (l > prec) ? l - prec : 0;
+ mpz_fdiv_q_2exp (S, S, l);
+ mpz_fdiv_q_2exp (C, C, l);
+ return l;
+}
+
+/* return in S0/Q0 a rational approximation of sin(X) with absolute error
+ bounded by 9*2^(-prec), where 0 <= X=p/2^r <= 1/2,
+ and in C0/Q0 a rational approximation of cos(X), with relative error
+ bounded by 9*2^(-prec) (and also absolute error, since
+ |cos(X)| <= 1).
+ We have sin(X)/X = sum((-1)^i*(p/2^r)^i/(2i+1)!, i=0..infinity).
+ We use the following binary splitting formula:
+ P(a,b) = (-p)^(b-a)
+ Q(a,b) = (2a)*(2a+1)*2^r if a+1=b [except Q(0,1)=1], Q(a,c)*Q(c,b) otherwise
+ T(a,b) = 1 if a+1=b, Q(c,b)*T(a,c)+P(a,c)*T(c,b) otherwise.
+
+ Since we use P(a,b) for b-a=2^k only, we compute only p^(2^k).
+ We do not store the factor 2^r in Q().
+
+ Then sin(X)/X ~ T(0,i)/Q(0,i) for i so that (p/2^r)^i/i! is small enough.
+
+ Return l such that Q0 has to be multiplied by 2^l.
+
+ Assumes prec >= 10.
+*/
+static unsigned long
+sin_bs_aux (mpz_t Q0, mpz_t S0, mpz_t C0, mpz_srcptr p, mpfr_prec_t r,
+ mpfr_prec_t prec)
+{
+ mpz_t T[GMP_NUMB_BITS], Q[GMP_NUMB_BITS], ptoj[GMP_NUMB_BITS], pp;
+ mpfr_prec_t log2_nb_terms[GMP_NUMB_BITS], mult[GMP_NUMB_BITS];
+ mpfr_prec_t accu[GMP_NUMB_BITS], size_ptoj[GMP_NUMB_BITS];
+ mpfr_prec_t prec_i_have, r0 = r;
+ unsigned long alloc, i, j, k;
+ mpfr_prec_t l;
+
+ if (MPFR_UNLIKELY(mpz_cmp_ui (p, 0) == 0)) /* sin(x)/x -> 1 */
+ {
+ mpz_set_ui (Q0, 1);
+ mpz_set_ui (S0, 1);
+ mpz_set_ui (C0, 1);
+ return 0;
+ }
+
+ /* check that X=p/2^r <= 1/2 */
+ MPFR_ASSERTN(mpz_sizeinbase (p, 2) - (mpfr_exp_t) r <= -1);
+
+ mpz_init (pp);
+
+ /* normalize p (non-zero here) */
+ l = mpz_scan1 (p, 0);
+ mpz_fdiv_q_2exp (pp, p, l); /* p = pp * 2^l */
+ mpz_mul (pp, pp, pp);
+ r = 2 * (r - l); /* x^2 = (p/2^r0)^2 = pp / 2^r */
+
+ /* now p is odd */
+ alloc = 2;
+ mpz_init_set_ui (T[0], 6);
+ mpz_init_set_ui (Q[0], 6);
+ mpz_init_set (ptoj[0], pp); /* ptoj[i] = pp^(2^i) */
+ mpz_init (T[1]);
+ mpz_init (Q[1]);
+ mpz_init (ptoj[1]);
+ mpz_mul (ptoj[1], pp, pp); /* ptoj[1] = pp^2 */
+ size_ptoj[1] = mpz_sizeinbase (ptoj[1], 2);
+
+ mpz_mul_2exp (T[0], T[0], r);
+ mpz_sub (T[0], T[0], pp); /* 6*2^r - pp = 6*2^r*(1 - x^2/6) */
+ log2_nb_terms[0] = 1;
+
+ /* already take into account the factor x=p/2^r in sin(x) = x * (...) */
+ mult[0] = r - mpz_sizeinbase (pp, 2) + r0 - mpz_sizeinbase (p, 2);
+ /* we have x^3 < 1/2^mult[0] */
+
+ for (i = 2, k = 0, prec_i_have = mult[0]; prec_i_have < prec; i += 2)
+ {
+ /* i is even here */
+ /* invariant: Q[0]*Q[1]*...*Q[k] equals (2i-1)!,
+ we have already summed terms of index < i
+ in S[0]/Q[0], ..., S[k]/Q[k] */
+ k ++;
+ if (k + 1 >= alloc) /* necessarily k + 1 = alloc */
+ {
+ alloc ++;
+ mpz_init (T[k+1]);
+ mpz_init (Q[k+1]);
+ mpz_init (ptoj[k+1]);
+ mpz_mul (ptoj[k+1], ptoj[k], ptoj[k]); /* pp^(2^(k+1)) */
+ size_ptoj[k+1] = mpz_sizeinbase (ptoj[k+1], 2);
+ }
+ /* for i even, we have Q[k] = (2*i)*(2*i+1), T[k] = 1,
+ then Q[k+1] = (2*i+2)*(2*i+3), T[k+1] = 1,
+ which reduces to T[k] = (2*i+2)*(2*i+3)*2^r-pp,
+ Q[k] = (2*i)*(2*i+1)*(2*i+2)*(2*i+3). */
+ log2_nb_terms[k] = 1;
+ mpz_set_ui (Q[k], (2 * i + 2) * (2 * i + 3));
+ mpz_mul_2exp (T[k], Q[k], r);
+ mpz_sub (T[k], T[k], pp);
+ mpz_mul_ui (Q[k], Q[k], (2 * i) * (2 * i + 1));
+ /* the next term of the series is divided by Q[k] and multiplied
+ by pp^2/2^(2r), thus the mult. factor < 1/2^mult[k] */
+ mult[k] = mpz_sizeinbase (Q[k], 2) + 2 * r - size_ptoj[1] - 1;
+ /* the absolute contribution of the next term is 1/2^accu[k] */
+ accu[k] = (k == 0) ? mult[k] : mult[k] + accu[k-1];
+ prec_i_have = accu[k]; /* the current term is < 1/2^accu[k] */
+ j = (i + 2) / 2;
+ l = 1;
+ while ((j & 1) == 0) /* combine and reduce */
+ {
+ mpz_mul (T[k], T[k], ptoj[l]);
+ mpz_mul (T[k-1], T[k-1], Q[k]);
+ mpz_mul_2exp (T[k-1], T[k-1], r << l);
+ mpz_add (T[k-1], T[k-1], T[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ log2_nb_terms[k-1] ++; /* number of terms in S[k-1]
+ is a power of 2 by construction */
+ prec_i_have = mpz_sizeinbase (Q[k], 2);
+ mult[k-1] += prec_i_have + (r << l) - size_ptoj[l] - 1;
+ accu[k-1] = (k == 1) ? mult[k-1] : mult[k-1] + accu[k-2];
+ prec_i_have = accu[k-1];
+ l ++;
+ j >>= 1;
+ k --;
+ }
+ }
+
+ /* accumulate all products in T[0] and Q[0]. Warning: contrary to above,
+ here we do not have log2_nb_terms[k-1] = log2_nb_terms[k]+1. */
+ l = 0; /* number of accumulated terms in the right part T[k]/Q[k] */
+ while (k > 0)
+ {
+ j = log2_nb_terms[k-1];
+ mpz_mul (T[k], T[k], ptoj[j]);
+ mpz_mul (T[k-1], T[k-1], Q[k]);
+ l += 1 << log2_nb_terms[k];
+ mpz_mul_2exp (T[k-1], T[k-1], r * l);
+ mpz_add (T[k-1], T[k-1], T[k]);
+ mpz_mul (Q[k-1], Q[k-1], Q[k]);
+ k--;
+ }
+
+ l = r0 + r * (i - 1); /* implicit multiplier 2^r for Q0 */
+ /* at this point T[0]/(2^l*Q[0]) is an approximation of sin(x) where the 1st
+ neglected term has contribution < 1/2^prec, thus since the series has
+ alternate signs, the error is < 1/2^prec */
+
+ /* we truncate Q0 to prec bits: the relative error is at most 2^(1-prec),
+ which means that Q0 = Q[0] * (1+theta) with |theta| <= 2^(1-prec)
+ [up to a power of two] */
+ l += reduce (Q0, Q[0], prec);
+ l -= reduce (T[0], T[0], prec);
+ /* multiply by x = p/2^l */
+ mpz_mul (S0, T[0], p);
+ l -= reduce (S0, S0, prec); /* S0 = T[0] * (1 + theta)^2 up to power of 2 */
+ /* sin(X) ~ S0/Q0*(1 + theta)^3 + err with |theta| <= 2^(1-prec) and
+ |err| <= 2^(-prec), thus since |S0/Q0| <= 1:
+ |sin(X) - S0/Q0| <= 4*|theta*S0/Q0| + |err| <= 9*2^(-prec) */
+
+ mpz_clear (pp);
+ for (j = 0; j < alloc; j ++)
+ {
+ mpz_clear (T[j]);
+ mpz_clear (Q[j]);
+ mpz_clear (ptoj[j]);
+ }
+
+ /* compute cos(X) from sin(X): sqrt(1-(S/Q)^2) = sqrt(Q^2-S^2)/Q
+ = sqrt(Q0^2*2^(2l)-S0^2)/Q0.
+ Write S/Q = sin(X) + eps with |eps| <= 9*2^(-prec),
+ then sqrt(Q^2-S^2) = sqrt(Q^2-Q^2*(sin(X)+eps)^2)
+ = sqrt(Q^2*cos(X)^2-Q^2*(2*sin(X)*eps+eps^2))
+ = sqrt(Q^2*cos(X)^2-Q^2*eps1) with |eps1|<=9*2^(-prec)
+ [using X<=1/2 and eps<=9*2^(-prec) and prec>=10]
+
+ Since we truncate the square root, we get:
+ sqrt(Q^2*cos(X)^2-Q^2*eps1)+eps2 with |eps2|<1
+ = Q*sqrt(cos(X)^2-eps1)+eps2
+ = Q*cos(X)*(1+eps3)+eps2 with |eps3| <= 6*2^(-prec)
+ = Q*cos(X)*(1+eps3+eps2/(Q*cos(X)))
+ = Q*cos(X)*(1+eps4) with |eps4| <= 9*2^(-prec)
+ since |Q| >= 2^(prec-1) */
+ /* we assume that Q0*2^l >= 2^(prec-1) */
+ MPFR_ASSERTN(l + mpz_sizeinbase (Q0, 2) >= prec);
+ mpz_mul (C0, Q0, Q0);
+ mpz_mul_2exp (C0, C0, 2 * l);
+ mpz_submul (C0, S0, S0);
+ mpz_sqrt (C0, C0);
+
+ return l;
+}
+
+/* Put in s and c approximations of sin(x) and cos(x) respectively.
+ Assumes 0 < x < Pi/4 and PREC(s) = PREC(c) >= 10.
+ Return err such that the relative error is bounded by 2^err ulps.
+*/
+static int
+sincos_aux (mpfr_t s, mpfr_t c, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t prec_s, sh;
+ mpz_t Q, S, C, Q2, S2, C2, y;
+ mpfr_t x2;
+ unsigned long l, l2, j, err;
+
+ MPFR_ASSERTD(MPFR_PREC(s) == MPFR_PREC(c));
+
+ prec_s = MPFR_PREC(s);
+
+ mpfr_init2 (x2, MPFR_PREC(x));
+ mpz_init (Q);
+ mpz_init (S);
+ mpz_init (C);
+ mpz_init (Q2);
+ mpz_init (S2);
+ mpz_init (C2);
+ mpz_init (y);
+
+ mpfr_set (x2, x, MPFR_RNDN); /* exact */
+ mpz_set_ui (Q, 1);
+ l = 0;
+ mpz_set_ui (S, 0); /* sin(0) = S/(2^l*Q), exact */
+ mpz_set_ui (C, 1); /* cos(0) = C/(2^l*Q), exact */
+
+ /* Invariant: x = X + x2/2^(sh-1), where the part X was already treated,
+ S/(2^l*Q) ~ sin(X), C/(2^l*Q) ~ cos(X), and x2/2^(sh-1) < Pi/4.
+ 'sh-1' is the number of already shifted bits in x2.
+ */
+
+ for (sh = 1, j = 0; mpfr_cmp_ui (x2, 0) != 0 && sh <= prec_s; sh <<= 1, j++)
+ {
+ if (sh > prec_s / 2) /* sin(x) = x + O(x^3), cos(x) = 1 + O(x^2) */
+ {
+ l2 = -mpfr_get_z_2exp (S2, x2); /* S2/2^l2 = x2 */
+ l2 += sh - 1;
+ mpz_set_ui (Q2, 1);
+ mpz_set_ui (C2, 1);
+ mpz_mul_2exp (C2, C2, l2);
+ mpfr_set_ui (x2, 0, MPFR_RNDN);
+ }
+ else
+ {
+ /* y <- trunc(x2 * 2^sh) = trunc(x * 2^(2*sh-1)) */
+ mpfr_mul_2exp (x2, x2, sh, MPFR_RNDN); /* exact */
+ mpfr_get_z (y, x2, MPFR_RNDZ); /* round towards zero: now
+ 0 <= x2 < 2^sh, thus
+ 0 <= x2/2^(sh-1) < 2^(1-sh) */
+ if (mpz_cmp_ui (y, 0) == 0)
+ continue;
+ mpfr_sub_z (x2, x2, y, MPFR_RNDN); /* should be exact */
+ l2 = sin_bs_aux (Q2, S2, C2, y, 2 * sh - 1, prec_s);
+ /* we now have |S2/Q2/2^l2 - sin(X)| <= 9*2^(prec_s)
+ and |C2/Q2/2^l2 - cos(X)| <= 6*2^(prec_s), with X=y/2^(2sh-1) */
+ }
+ if (sh == 1) /* S=0, C=1 */
+ {
+ l = l2;
+ mpz_swap (Q, Q2);
+ mpz_swap (S, S2);
+ mpz_swap (C, C2);
+ }
+ else
+ {
+ /* s <- s*c2+c*s2, c <- c*c2-s*s2, using Karatsuba:
+ a = s+c, b = s2+c2, t = a*b, d = s*s2, e = c*c2,
+ s <- t - d - e, c <- e - d */
+ mpz_add (y, S, C); /* a */
+ mpz_mul (C, C, C2); /* e */
+ mpz_add (C2, C2, S2); /* b */
+ mpz_mul (S2, S, S2); /* d */
+ mpz_mul (y, y, C2); /* a*b */
+ mpz_sub (S, y, S2); /* t - d */
+ mpz_sub (S, S, C); /* t - d - e */
+ mpz_sub (C, C, S2); /* e - d */
+ mpz_mul (Q, Q, Q2);
+ /* after j loops, the error is <= (11j-2)*2^(prec_s) */
+ l += l2;
+ /* reduce Q to prec_s bits */
+ l += reduce (Q, Q, prec_s);
+ /* reduce S,C to prec_s bits, error <= 11*j*2^(prec_s) */
+ l -= reduce2 (S, C, prec_s);
+ }
+ }
+
+ j = 11 * j;
+ for (err = 0; j > 1; j = (j + 1) / 2, err ++);
+
+ mpfr_set_z (s, S, MPFR_RNDN);
+ mpfr_div_z (s, s, Q, MPFR_RNDN);
+ mpfr_div_2exp (s, s, l, MPFR_RNDN);
+
+ mpfr_set_z (c, C, MPFR_RNDN);
+ mpfr_div_z (c, c, Q, MPFR_RNDN);
+ mpfr_div_2exp (c, c, l, MPFR_RNDN);
+
+ mpz_clear (Q);
+ mpz_clear (S);
+ mpz_clear (C);
+ mpz_clear (Q2);
+ mpz_clear (S2);
+ mpz_clear (C2);
+ mpz_clear (y);
+ mpfr_clear (x2);
+ return err;
+}
+
+/* Assumes x is neither NaN, +/-Inf, nor +/- 0.
+ One of s and c might be NULL, in which case the corresponding value is
+ not computed.
+ Assumes s differs from c.
+ */
+int
+mpfr_sincos_fast (mpfr_t s, mpfr_t c, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inexs, inexc;
+ mpfr_t x_red, ts, tc;
+ mpfr_prec_t w;
+ mpfr_exp_t err, errs, errc;
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_ASSERTN(s != c);
+ if (s == NULL)
+ w = MPFR_PREC(c);
+ else if (c == NULL)
+ w = MPFR_PREC(s);
+ else
+ w = MPFR_PREC(s) >= MPFR_PREC(c) ? MPFR_PREC(s) : MPFR_PREC(c);
+ w += MPFR_INT_CEIL_LOG2(w) + 9; /* ensures w >= 10 (needed by sincos_aux) */
+ mpfr_init2 (ts, w);
+ mpfr_init2 (tc, w);
+
+ MPFR_ZIV_INIT (loop, w);
+ for (;;)
+ {
+ /* if 0 < x <= Pi/4, we can call sincos_aux directly */
+ if (MPFR_IS_POS(x) && mpfr_cmp_ui_2exp (x, 1686629713, -31) <= 0)
+ {
+ err = sincos_aux (ts, tc, x, MPFR_RNDN);
+ }
+ /* if -Pi/4 <= x < 0, use sin(-x)=-sin(x) */
+ else if (MPFR_IS_NEG(x) && mpfr_cmp_si_2exp (x, -1686629713, -31) >= 0)
+ {
+ mpfr_init2 (x_red, MPFR_PREC(x));
+ mpfr_neg (x_red, x, rnd); /* exact */
+ err = sincos_aux (ts, tc, x_red, MPFR_RNDN);
+ mpfr_neg (ts, ts, MPFR_RNDN);
+ mpfr_clear (x_red);
+ }
+ else /* argument reduction is needed */
+ {
+ long q;
+ mpfr_t pi;
+ int neg = 0;
+
+ mpfr_init2 (x_red, w);
+ mpfr_init2 (pi, (MPFR_EXP(x) > 0) ? w + MPFR_EXP(x) : w);
+ mpfr_const_pi (pi, MPFR_RNDN);
+ mpfr_div_2exp (pi, pi, 1, MPFR_RNDN); /* Pi/2 */
+ mpfr_remquo (x_red, &q, x, pi, MPFR_RNDN);
+ /* x = q * (Pi/2 + eps1) + x_red + eps2,
+ where |eps1| <= 1/2*ulp(Pi/2) = 2^(-w-MAX(0,EXP(x))),
+ and eps2 <= 1/2*ulp(x_red) <= 1/2*ulp(Pi/2) = 2^(-w)
+ Since |q| <= x/(Pi/2) <= |x|, we have
+ q*|eps1| <= 2^(-w), thus
+ |x - q * Pi/2 - x_red| <= 2^(1-w) */
+ /* now -Pi/4 <= x_red <= Pi/4: if x_red < 0, consider -x_red */
+ if (MPFR_IS_NEG(x_red))
+ {
+ mpfr_neg (x_red, x_red, MPFR_RNDN);
+ neg = 1;
+ }
+ err = sincos_aux (ts, tc, x_red, MPFR_RNDN);
+ err ++; /* to take into account the argument reduction */
+ if (neg) /* sin(-x) = -sin(x), cos(-x) = cos(x) */
+ mpfr_neg (ts, ts, MPFR_RNDN);
+ if (q & 2) /* sin(x+Pi) = -sin(x), cos(x+Pi) = -cos(x) */
+ {
+ mpfr_neg (ts, ts, MPFR_RNDN);
+ mpfr_neg (tc, tc, MPFR_RNDN);
+ }
+ if (q & 1) /* sin(x+Pi/2) = cos(x), cos(x+Pi/2) = -sin(x) */
+ {
+ mpfr_neg (ts, ts, MPFR_RNDN);
+ mpfr_swap (ts, tc);
+ }
+ mpfr_clear (x_red);
+ mpfr_clear (pi);
+ }
+ /* adjust errors with respect to absolute values */
+ errs = err - MPFR_EXP(ts);
+ errc = err - MPFR_EXP(tc);
+ if ((s == NULL || MPFR_CAN_ROUND (ts, w - errs, MPFR_PREC(s), rnd)) &&
+ (c == NULL || MPFR_CAN_ROUND (tc, w - errc, MPFR_PREC(c), rnd)))
+ break;
+ MPFR_ZIV_NEXT (loop, w);
+ mpfr_set_prec (ts, w);
+ mpfr_set_prec (tc, w);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexs = (s == NULL) ? 0 : mpfr_set (s, ts, rnd);
+ inexc = (c == NULL) ? 0 : mpfr_set (c, tc, rnd);
+
+ mpfr_clear (ts);
+ mpfr_clear (tc);
+ return INEX(inexs,inexc);
+}
diff --git a/src/sinh.c b/src/sinh.c
new file mode 100644
index 0000000..0349036
--- /dev/null
+++ b/src/sinh.c
@@ -0,0 +1,184 @@
+/* mpfr_sinh -- hyperbolic sine
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+ /* The computation of sinh is done by
+ sinh(x) = 1/2 [e^(x)-e^(-x)] */
+
+int
+mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t x;
+ int inexact;
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (xt)))
+ {
+ if (MPFR_IS_NAN (xt))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (xt))
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_SAME_SIGN (y, xt);
+ MPFR_RET (0);
+ }
+ else /* xt is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (xt));
+ MPFR_SET_ZERO (y); /* sinh(0) = 0 */
+ MPFR_SET_SAME_SIGN (y, xt);
+ MPFR_RET (0);
+ }
+ }
+
+ /* sinh(x) = x + x^3/6 + ... so the error is < 2^(3*EXP(x)-2) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, xt, -2 * MPFR_GET_EXP(xt), 2, 1,
+ rnd_mode, {});
+
+ MPFR_TMP_INIT_ABS (x, xt);
+
+ {
+ mpfr_t t, ti;
+ mpfr_exp_t d;
+ mpfr_prec_t Nt; /* Precision of the intermediary variable */
+ long int err; /* Precision of error */
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_GROUP_DECL (group);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* compute the precision of intermediary variable */
+ Nt = MAX (MPFR_PREC (x), MPFR_PREC (y));
+ /* the optimal number of bits : see algorithms.ps */
+ Nt = Nt + MPFR_INT_CEIL_LOG2 (Nt) + 4;
+ /* If x is near 0, exp(x) - 1/exp(x) = 2*x+x^3/3+O(x^5) */
+ if (MPFR_GET_EXP (x) < 0)
+ Nt -= 2*MPFR_GET_EXP (x);
+
+ /* initialise of intermediary variables */
+ MPFR_GROUP_INIT_2 (group, Nt, t, ti);
+
+ /* First computation of sinh */
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* compute sinh */
+ MPFR_BLOCK (flags, mpfr_exp (t, x, MPFR_RNDD));
+ if (MPFR_OVERFLOW (flags))
+ /* exp(x) does overflow */
+ {
+ /* sinh(x) = 2 * sinh(x/2) * cosh(x/2) */
+ mpfr_div_2ui (ti, x, 1, MPFR_RNDD); /* exact */
+
+ /* t <- cosh(x/2): error(t) <= 1 ulp(t) */
+ MPFR_BLOCK (flags, mpfr_cosh (t, ti, MPFR_RNDD));
+ if (MPFR_OVERFLOW (flags))
+ /* when x>1 we have |sinh(x)| >= cosh(x/2), so sinh(x)
+ overflows too */
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN (xt));
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+
+ /* ti <- sinh(x/2): , error(ti) <= 1 ulp(ti)
+ cannot overflow because 0 < sinh(x) < cosh(x) when x > 0 */
+ mpfr_sinh (ti, ti, MPFR_RNDD);
+
+ /* multiplication below, error(t) <= 5 ulp(t) */
+ MPFR_BLOCK (flags, mpfr_mul (t, t, ti, MPFR_RNDD));
+ if (MPFR_OVERFLOW (flags))
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN (xt));
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+
+ /* doubling below, exact */
+ MPFR_BLOCK (flags, mpfr_mul_2ui (t, t, 1, MPFR_RNDN));
+ if (MPFR_OVERFLOW (flags))
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN (xt));
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+
+ /* we have lost at most 3 bits of precision */
+ err = Nt - 3;
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, MPFR_PREC (y),
+ rnd_mode)))
+ {
+ inexact = mpfr_set4 (y, t, rnd_mode, MPFR_SIGN (xt));
+ break;
+ }
+ err = Nt; /* double the precision */
+ }
+ else
+ {
+ d = MPFR_GET_EXP (t);
+ mpfr_ui_div (ti, 1, t, MPFR_RNDU); /* 1/exp(x) */
+ mpfr_sub (t, t, ti, MPFR_RNDN); /* exp(x) - 1/exp(x) */
+ mpfr_div_2ui (t, t, 1, MPFR_RNDN); /* 1/2(exp(x) - 1/exp(x)) */
+
+ /* it may be that t is zero (in fact, it can only occur when te=1,
+ and thus ti=1 too) */
+ if (MPFR_IS_ZERO (t))
+ err = Nt; /* double the precision */
+ else
+ {
+ /* calculation of the error */
+ d = d - MPFR_GET_EXP (t) + 2;
+ /* error estimate: err = Nt-(__gmpfr_ceil_log2(1+pow(2,d)));*/
+ err = Nt - (MAX (d, 0) + 1);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, err, MPFR_PREC (y),
+ rnd_mode)))
+ {
+ inexact = mpfr_set4 (y, t, rnd_mode, MPFR_SIGN (xt));
+ break;
+ }
+ }
+ }
+
+ /* actualisation of the precision */
+ Nt += err;
+ MPFR_ZIV_NEXT (loop, Nt);
+ MPFR_GROUP_REPREC_2 (group, Nt, t, ti);
+ }
+ MPFR_ZIV_FREE (loop);
+ MPFR_GROUP_CLEAR (group);
+ MPFR_SAVE_EXPO_FREE (expo);
+ }
+
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/sinh_cosh.c b/src/sinh_cosh.c
new file mode 100644
index 0000000..af4fede
--- /dev/null
+++ b/src/sinh_cosh.c
@@ -0,0 +1,161 @@
+/* mpfr_sinh_cosh -- hyperbolic sine and cosine
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define INEXPOS(y) ((y) == 0 ? 0 : (((y) > 0) ? 1 : 2))
+#define INEX(y,z) (INEXPOS(y) | (INEXPOS(z) << 2))
+
+ /* The computations are done by
+ cosh(x) = 1/2 [e^(x)+e^(-x)]
+ sinh(x) = 1/2 [e^(x)-e^(-x)]
+ Adapted from mpfr_sinh.c */
+
+int
+mpfr_sinh_cosh (mpfr_ptr sh, mpfr_ptr ch, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t x;
+ int inexact_sh, inexact_ch;
+
+ MPFR_ASSERTN (sh != ch);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("sh[%Pu]=%.*Rg ch[%Pu]=%.*Rg",
+ mpfr_get_prec (sh), mpfr_log_prec, sh,
+ mpfr_get_prec (ch), mpfr_log_prec, ch));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (xt)))
+ {
+ if (MPFR_IS_NAN (xt))
+ {
+ MPFR_SET_NAN (ch);
+ MPFR_SET_NAN (sh);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (xt))
+ {
+ MPFR_SET_INF (sh);
+ MPFR_SET_SAME_SIGN (sh, xt);
+ MPFR_SET_INF (ch);
+ MPFR_SET_POS (ch);
+ MPFR_RET (0);
+ }
+ else /* xt is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (xt));
+ MPFR_SET_ZERO (sh); /* sinh(0) = 0 */
+ MPFR_SET_SAME_SIGN (sh, xt);
+ inexact_sh = 0;
+ inexact_ch = mpfr_set_ui (ch, 1, rnd_mode); /* cosh(0) = 1 */
+ return INEX(inexact_sh,inexact_ch);
+ }
+ }
+
+ /* Warning: if we use MPFR_FAST_COMPUTE_IF_SMALL_INPUT here, make sure
+ that the code also works in case of overlap (see sin_cos.c) */
+
+ MPFR_TMP_INIT_ABS (x, xt);
+
+ {
+ mpfr_t s, c, ti;
+ mpfr_exp_t d;
+ mpfr_prec_t N; /* Precision of the intermediary variables */
+ long int err; /* Precision of error */
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_GROUP_DECL (group);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* compute the precision of intermediary variable */
+ N = MPFR_PREC (ch);
+ N = MAX (N, MPFR_PREC (sh));
+ /* the optimal number of bits : see algorithms.ps */
+ N = N + MPFR_INT_CEIL_LOG2 (N) + 4;
+
+ /* initialise of intermediary variables */
+ MPFR_GROUP_INIT_3 (group, N, s, c, ti);
+
+ /* First computation of sinh_cosh */
+ MPFR_ZIV_INIT (loop, N);
+ for (;;)
+ {
+ MPFR_BLOCK_DECL (flags);
+
+ /* compute sinh_cosh */
+ MPFR_BLOCK (flags, mpfr_exp (s, x, MPFR_RNDD));
+ if (MPFR_OVERFLOW (flags))
+ /* exp(x) does overflow */
+ {
+ /* since cosh(x) >= exp(x), cosh(x) overflows too */
+ inexact_ch = mpfr_overflow (ch, rnd_mode, MPFR_SIGN_POS);
+ /* sinh(x) may be representable */
+ inexact_sh = mpfr_sinh (sh, xt, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ break;
+ }
+ d = MPFR_GET_EXP (s);
+ mpfr_ui_div (ti, 1, s, MPFR_RNDU); /* 1/exp(x) */
+ mpfr_add (c, s, ti, MPFR_RNDU); /* exp(x) + 1/exp(x) */
+ mpfr_sub (s, s, ti, MPFR_RNDN); /* exp(x) - 1/exp(x) */
+ mpfr_div_2ui (c, c, 1, MPFR_RNDN); /* 1/2(exp(x) + 1/exp(x)) */
+ mpfr_div_2ui (s, s, 1, MPFR_RNDN); /* 1/2(exp(x) - 1/exp(x)) */
+
+ /* it may be that s is zero (in fact, it can only occur when exp(x)=1,
+ and thus ti=1 too) */
+ if (MPFR_IS_ZERO (s))
+ err = N; /* double the precision */
+ else
+ {
+ /* calculation of the error */
+ d = d - MPFR_GET_EXP (s) + 2;
+ /* error estimate: err = N-(__gmpfr_ceil_log2(1+pow(2,d)));*/
+ err = N - (MAX (d, 0) + 1);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s, err, MPFR_PREC (sh),
+ rnd_mode) && \
+ MPFR_CAN_ROUND (c, err, MPFR_PREC (ch),
+ rnd_mode)))
+ {
+ inexact_sh = mpfr_set4 (sh, s, rnd_mode, MPFR_SIGN (xt));
+ inexact_ch = mpfr_set (ch, c, rnd_mode);
+ break;
+ }
+ }
+ /* actualisation of the precision */
+ N += err;
+ MPFR_ZIV_NEXT (loop, N);
+ MPFR_GROUP_REPREC_3 (group, N, s, c, ti);
+ }
+ MPFR_ZIV_FREE (loop);
+ MPFR_GROUP_CLEAR (group);
+ MPFR_SAVE_EXPO_FREE (expo);
+ }
+
+ /* now, let's raise the flags if needed */
+ inexact_sh = mpfr_check_range (sh, inexact_sh, rnd_mode);
+ inexact_ch = mpfr_check_range (ch, inexact_ch, rnd_mode);
+
+ return INEX(inexact_sh,inexact_ch);
+}
diff --git a/src/sparc64/mparam.h b/src/sparc64/mparam.h
new file mode 100644
index 0000000..4de32af
--- /dev/null
+++ b/src/sparc64/mparam.h
@@ -0,0 +1,233 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 3.3.5 */
+/* gcc64.fsffrance.org (sparc64) with gmp 5.0.2 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,-1,0,-1,-1,-1,7,-1,9,9,11,11,11,13, \
+ 11,13,13,15,15,17,15,19,17,17,19,19,19,19,21,21, \
+ 23,23,23,23,25,27,23,30,30,30,30,30,30,30,34,34, \
+ 34,34,34,34,38,38,38,38,38,38,42,42,41,42,42,42, \
+ 42,42,42,46,46,46,46,46,46,50,50,50,50,50,50,60, \
+ 60,60,60,60,60,60,60,60,60,68,60,68,68,60,68,68, \
+ 68,68,68,68,68,68,68,68,76,76,76,76,76,76,76,76, \
+ 76,76,76,76,84,76,84,84,84,76,84,84,84,84,84,84, \
+ 84,84,84,84,84,84,92,92,92,92,92,92,92,84,92,92, \
+ 92,92,100,100,100,100,100,100,100,100,100,100,120,100,120,120, \
+ 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, \
+ 120,120,119,120,119,120,120,136,136,136,136,136,136,136,136,136, \
+ 136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,152, \
+ 152,152,152,136,152,152,152,136,152,136,152,152,136,152,152,152, \
+ 152,152,152,136,152,152,168,168,168,201,168,168,201,201,201,201, \
+ 201,201,201,201,201,200,201,200,201,200,201,201,201,201,201,201, \
+ 201,201,201,201,201,200,201,201,201,201,201,201,201,201,201,201, \
+ 201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201, \
+ 201,201,201,201,200,201,200,201,201,201,201,201,201,201,201,201, \
+ 225,224,225,225,225,225,225,224,225,224,225,224,225,225,225,282, \
+ 225,282,282,282,282,282,282,294,294,294,294,294,294,294,294,294, \
+ 282,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294, \
+ 294,294,293,294,294,294,294,294,294,294,294,294,294,294,294,294, \
+ 294,294,294,294,293,294,294,294,294,294,294,294,294,294,293,294, \
+ 294,294,294,294,294,294,294,294,294,294,294,294,294,318,294,318, \
+ 294,294,294,360,359,360,360,358,360,360,360,360,359,360,360,360, \
+ 360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,359,360,360,360,360,360,360,360,360,360, \
+ 360,360,360,360,360,360,360,358,360,360,360,360,360,360,354,360, \
+ 360,360,360,360,360,360,360,392,360,360,392,392,360,392,391,392, \
+ 391,392,392,392,391,392,391,392,354,392,391,392,391,392,391,392, \
+ 391,392,391,392,391,392,391,392,392,392,391,392,392,392,392,392, \
+ 424,392,391,392,424,392,424,424,424,392,424,424,424,424,424,472, \
+ 424,424,424,472,424,472,472,472,472,472,472,472,472,472,472,471, \
+ 472,472,472,472,472,472,472,472,472,472,472,471,472,472,472,471, \
+ 472,472,472,472,472,472,472,472,472,472,472,472,472,472,471,472, \
+ 472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,472,472,471,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, \
+ 472,472,472,536,536,536,536,536,536,528,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,544,536,536,536,536,600,536,599,600,600, \
+ 599,599,600,600,600,600,600,600,599,600,600,600,600,599,600,600, \
+ 600,600,600,600,600,599,600,599,600,600,600,599,600,600,600,600, \
+ 600,599,600,599,600,600,600,599,600,600,600,600,600,600,600,600, \
+ 600,600,600,599,599,600,600,600,600,600,600,600,600,600,600,600, \
+ 600,600,600,600,600,599,600,600,599,600,599,600,599,600,600,600, \
+ 599,600,600,600,599,600,600,664,600,664,600,600,600,600,600,663, \
+ 599,664,600,664,600,664,664,664,664,664,664,664,663,664,664,664, \
+ 663,664,664,664,663,664,663,664,664,664,663,664,663,664,664,664, \
+ 664,664,664,664,664,664,663,664,664,663,664,664,664,664,664,664, \
+ 663,663,664,664,664,664,663,664,663,664,663,664,663,664,663,664, \
+ 663,664,663,664,664,664,664,664,664,664,663,664,663,664,664,664, \
+ 664,664,664,664,664,664,664,664,663,728,663,728,728,727,728,728, \
+ 728,728,728,728,728,728,728,728,727,728,728,728,727,728,728,728, \
+ 728,728,728,728,727,728,727,728,728,728,727,728,727,728,728,728, \
+ 727,728,728,728,727,728,728,728,728,728,727,728,728,728,728,728, \
+ 727,728,728,728,727,728,792,792,727,728,727,728,791,792,728,728, \
+ 728,728,728,728,728,728,792,792,727,792,792,792,792,792,791,792, \
+ 792,792,792,792,792,792,792,792,792,792,792,792,792,792,791,790, \
+ 791,792,791,792,792,792,791,792,791,792,791,792,791,792,791,792, \
+ 791,792,792,792,791,792,792,792,791,792,792,792,791,792,791,791, \
+ 791,791,791,792,792,791,792,792,791,792,792,792,791,792,792,792, \
+ 792,791,792,792,791,792,792,856,792,792,792,856,792,791,792,856 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,-1,5,5,7,7,9,7,9,8,9,10, \
+ 11,10,11,11,13,12,13,13,17,14,16,16,16,16,17,18, \
+ 18,18,19,20,20,22,21,24,22,24,23,24,24,26,26,26, \
+ 28,28,28,30,28,29,30,31,30,31,32,33,32,33,34,35, \
+ 34,35,36,36,36,37,38,40,40,40,40,40,42,43,42,44, \
+ 45,47,50,44,44,44,50,48,50,51,47,48,49,48,49,50, \
+ 51,52,53,52,53,52,53,54,55,56,57,58,59,56,57,58, \
+ 59,58,59,62,61,60,61,62,63,62,63,64,65,64,65,70, \
+ 67,72,72,72,76,74,72,72,74,76,76,76,76,74,80,80, \
+ 74,76,84,80,80,82,80,84,82,84,84,88,84,90,88,82, \
+ 86,88,88,84,84,86,88,88,88,88,88,88,88,88,90,92, \
+ 90,92,92,92,96,94,96,96,96,96,100,96,96,116,98,100, \
+ 98,98,100,100,117,117,118,119,119,120,116,119,120,119,118,119, \
+ 119,119,122,128,120,119,120,119,116,121,120,118,120,125,125,119, \
+ 125,124,131,131,130,131,134,131,132,134,124,125,133,143,137,138, \
+ 131,144,138,137,135,138,130,135,137,143,143,137,137,143,130,138, \
+ 131,140,138,137,136,149,149,142,143,156,149,149,144,154,149,147, \
+ 149,156,149,152,147,147,155,156,149,150,149,146,160,160,163,168, \
+ 167,167,156,166,156,164,156,158,161,172,161,166,167,161,173,164, \
+ 167,174,173,162,171,172,173,176,173,171,165,182,174,174,173,184, \
+ 171,170,174,173,178,176,176,168,179,176,177,182,178,180,191,174, \
+ 186,184,176,192,180,180,173,174,179,185,175,182,184,180,179,178, \
+ 179,180,179,186,185,185,188,184,186,188,186,190,191,191,195,192, \
+ 198,192,194,200,213,197,225,198,201,200,191,210,195,212,224,212, \
+ 213,213,212,212,213,213,221,218,218,224,199,224,219,224,225,225, \
+ 225,222,225,228,229,213,237,228,218,224,234,240,237,240,242,242, \
+ 243,240,242,242,235,228,231,228,237,230,231,236,236,237,336,336, \
+ 336,336,336,336,336,336,336,336,336,336,341,336,336,336,336,336, \
+ 336,336,341,336,336,336,336,342,336,336,342,336,336,336,336,342, \
+ 336,336,336,336,336,336,336,342,336,336,336,336,342,336,336,336, \
+ 336,336,336,336,336,336,336,342,336,336,336,336,342,336,336,342, \
+ 336,336,342,336,336,336,336,336,336,336,342,336,336,336,336,342, \
+ 336,342,342,336,342,342,336,342,336,342,336,336,342,336,336,342, \
+ 336,336,342,336,336,342,336,342,342,342,341,348,342,348,348,348, \
+ 342,342,354,348,354,354,348,336,354,354,354,336,342,360,360,354, \
+ 354,342,360,360,366,366,360,372,354,360,354,360,354,360,360,353, \
+ 336,336,342,360,366,342,360,336,336,342,342,336,336,336,341,341, \
+ 336,336,336,336,342,342,336,342,342,342,342,336,342,342,341,342, \
+ 348,342,342,360,354,348,348,342,354,348,360,348,354,354,353,354, \
+ 354,354,354,456,360,360,456,366,372,366,366,456,354,366,456,456, \
+ 456,378,456,456,455,456,456,456,378,366,390,384,378,378,360,378, \
+ 372,366,378,456,378,464,472,378,472,472,336,456,472,456,456,456, \
+ 472,472,456,456,472,464,456,456,456,342,426,456,426,455,472,456, \
+ 472,472,426,472,348,456,472,456,456,455,456,480,455,456,455,456, \
+ 456,455,456,456,454,456,456,456,456,455,456,456,454,455,456,456, \
+ 456,464,456,456,455,456,455,456,456,464,456,456,472,456,456,464, \
+ 472,472,456,456,455,456,456,456,455,472,479,456,472,472,488,464, \
+ 472,472,471,488,472,472,488,488,472,472,488,456,480,472,456,488, \
+ 472,472,479,463,488,426,456,426,426,426,426,425,455,455,425,456, \
+ 455,455,456,480,455,456,456,456,456,455,456,456,454,456,455,456, \
+ 456,455,456,456,455,455,455,456,456,454,456,456,455,456,456,456, \
+ 456,455,456,456,472,456,456,456,456,455,464,464,472,472,472,464, \
+ 472,472,456,455,472,472,471,456,472,480,456,480,480,480,456,488, \
+ 480,488,488,488,472,472,488,488,472,472,488,480,496,472,456,480, \
+ 496,472,488,456,480,456,456,456,456,488,456,456,488,456,456,456, \
+ 456,455,456,456,455,455,456,464,456,512,456,456,512,472,464,456, \
+ 472,512,456,480,464,480,472,471,472,472,471,479,470,480,471,471, \
+ 472,472,480,488,478,480,488,487,480,480,488,488,568,485,488,488, \
+ 512,488,488,471,568,512,512,512,512,496,511,511,512,512,520,511, \
+ 512,512,520,520,568,512,520,520,512,512,520,520,519,520,519,519, \
+ 520,568,520,536,536,536,536,528,536,528,535,535,534,512,535,512, \
+ 536,536,552,552,536,552,552,520,567,544,552,552,552,568,567,567, \
+ 568,568,567,567,568,568,535,584,568,512,568,567,512,568,567,568, \
+ 576,568,567,584,568,600,584,584,600,568,597,592,591,600,599,599 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,6,7,8,9,10,11,12,13, \
+ 10,10,11,11,13,12,13,13,14,14,15,15,18,17,19,19, \
+ 18,21,19,20,22,21,27,27,22,22,27,28,27,27,27,30, \
+ 27,27,27,27,31,31,30,30,31,31,31,35,34,33,35,35, \
+ 38,37,36,38,39,39,39,37,39,39,43,43,47,42,43,43, \
+ 45,47,54,43,54,54,45,54,54,54,54,55,54,54,55,54, \
+ 54,54,54,54,54,54,54,54,54,54,58,58,60,60,60,60, \
+ 60,60,68,62,60,60,65,68,68,68,68,68,67,68,76,68, \
+ 67,68,67,68,76,76,71,73,76,76,77,76,79,73,79,84, \
+ 76,76,78,76,76,84,84,84,84,83,84,84,92,92,83,84, \
+ 92,92,84,84,92,84,88,108,86,108,108,108,108,108,108,108, \
+ 108,92,108,108,92,108,108,108,120,120,108,108,120,120,120,120, \
+ 120,120,108,108,108,120,108,108,120,108,118,108,108,108,108,120, \
+ 120,120,108,108,120,120,118,120,120,120,120,120,120,120,120,120, \
+ 120,120,120,120,120,120,136,120,120,120,125,136,136,120,136,136, \
+ 136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136, \
+ 136,136,136,136,152,136,135,136,152,152,136,136,152,152,152,152, \
+ 152,152,152,152,151,152,152,152,152,152,149,150,152,152,152,152, \
+ 152,152,151,152,152,168,167,168,152,152,167,152,152,152,165,157, \
+ 168,168,167,168,168,184,168,168,168,168,168,168,168,168,168,168, \
+ 168,167,168,168,184,168,168,168,184,184,184,184,184,184,184,184, \
+ 172,184,179,180,184,184,184,184,184,184,176,180,184,184,216,216, \
+ 184,184,184,216,184,184,216,184,184,216,184,216,216,184,216,216, \
+ 240,240,216,216,240,240,216,216,240,240,239,214,240,240,216,240, \
+ 240,240,238,240,240,240,216,240,240,239,240,216,240,240,216,238, \
+ 240,240,240,216,240,240,240,238,240,240,239,240,240,240,240,240, \
+ 240,239,240,240,240,240,240,240,240,240,239,238,240,240,240,240, \
+ 240,240,240,238,240,240,240,240,240,240,239,238,240,240,240,240, \
+ 240,240,238,238,240,240,240,240,240,239,239,240,240,240,240,240, \
+ 240,240,240,240,240,240,271,240,240,240,240,271,240,240,272,272, \
+ 272,272,272,272,272,272,272,272,270,271,272,272,272,272,272,272, \
+ 272,271,272,272,272,269,272,272,272,270,269,272,272,272,272,272, \
+ 272,272,272,269,272,272,272,272,304,267,271,272,272,272,272,272, \
+ 271,272,272,272,272,272,271,272,272,270,272,272,272,272,273,301, \
+ 304,304,300,301,304,303,304,304,304,303,303,304,304,304,303,301, \
+ 304,304,303,298,304,304,303,304,304,303,301,304,304,303,301,302, \
+ 304,303,304,304,304,304,301,304,304,304,301,302,304,304,301,304, \
+ 304,303,303,304,304,304,304,304,304,304,303,304,304,304,336,336, \
+ 336,335,336,334,336,336,336,336,336,336,336,336,336,336,336,336, \
+ 336,336,334,336,336,336,336,336,336,336,335,336,336,336,336,336, \
+ 336,336,336,336,336,328,336,336,336,336,335,336,336,336,336,336, \
+ 336,368,336,334,336,336,336,336,336,336,336,336,336,336,396,400, \
+ 398,384,368,400,384,399,399,400,368,368,368,400,368,368,368,400, \
+ 400,400,399,400,400,376,400,400,400,367,399,400,368,367,400,366, \
+ 367,368,400,366,368,368,365,368,368,368,400,399,400,400,368,399, \
+ 368,368,366,368,368,368,400,368,368,368,368,368,368,368,400,400, \
+ 396,400,397,374,400,399,400,400,400,400,397,398,400,401,400,400, \
+ 400,400,400,396,399,397,400,400,400,400,400,396,400,401,400,432, \
+ 400,398,399,400,396,396,432,432,400,432,400,396,400,397,399,400, \
+ 400,400,400,396,400,401,432,432,432,399,432,400,400,432,432,432, \
+ 432,432,432,432,432,433,432,432,432,432,432,480,480,432,432,432, \
+ 432,432,432,432,432,432,432,432,432,431,431,432,432,480,432,432, \
+ 480,480,432,478,480,432,432,480,432,432,432,432,480,432,432,432, \
+ 432,432,432,432,480,480,432,432,480,432,432,432,432,432,480,478, \
+ 480,447,477,480,480,480,480,480,480,479,440,444,480,445,448,480, \
+ 480,479,464,464,480,480,480,478,480,480,478,480,480,480,480,480, \
+ 480,479,480,479,480,480,478,480,480,480,478,478,480,480,480,480, \
+ 480,480,480,478,480,480,480,478,480,479,478,480,480,476,480,478, \
+ 480,480,478,478,480,480,480,480,480,479,479,478,480,480,480,480, \
+ 480,479,480,478,480,480,480,480,480,479,543,544,544,480,544,544, \
+ 542,543,544,544,544,540,544,544,544,544,544,542,544,544,544,544, \
+ 542,542,542,542,544,544,544,560,542,542,575,543,544,544,544,542, \
+ 544,575,575,544,544,544,544,544,561,561,543,559,544,560,560,560, \
+ 608,587,573,575,575,608,583,585,560,575,585,575,588,573,608,577 \
+
+#define MPFR_MUL_THRESHOLD 13 /* limbs */
+#define MPFR_SQR_THRESHOLD 11 /* limbs */
+#define MPFR_DIV_THRESHOLD 19 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 1092 /* bits */
+#define MPFR_EXP_THRESHOLD 11053 /* bits */
+#define MPFR_SINCOS_THRESHOLD 25857 /* bits */
+#define MPFR_AI_THRESHOLD1 -19352 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 1476
+#define MPFR_AI_THRESHOLD3 30069
+/* Tuneup completed successfully, took 8167 seconds */
diff --git a/src/sqr.c b/src/sqr.c
new file mode 100644
index 0000000..a3748b5
--- /dev/null
+++ b/src/sqr.c
@@ -0,0 +1,112 @@
+/* mpfr_sqr -- Floating square
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int cc, inexact;
+ mpfr_exp_t ax;
+ mp_limb_t *tmp;
+ mp_limb_t b1;
+ mpfr_prec_t bq;
+ mp_size_t bn, tn;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (b), mpfr_log_prec, b, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (a), mpfr_log_prec, a, inexact));
+
+ /* deal with special cases */
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(b)))
+ {
+ if (MPFR_IS_NAN(b))
+ {
+ MPFR_SET_NAN(a);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_POS (a);
+ if (MPFR_IS_INF(b))
+ MPFR_SET_INF(a);
+ else
+ ( MPFR_ASSERTD(MPFR_IS_ZERO(b)), MPFR_SET_ZERO(a) );
+ MPFR_RET(0);
+ }
+ ax = 2 * MPFR_GET_EXP (b);
+ bq = MPFR_PREC(b);
+
+ MPFR_ASSERTN (2 * (mpfr_uprec_t) bq <= MPFR_PREC_MAX);
+
+ bn = MPFR_LIMB_SIZE (b); /* number of limbs of b */
+ tn = MPFR_PREC2LIMBS (2 * bq); /* number of limbs of square,
+ 2*bn or 2*bn-1 */
+
+ if (MPFR_UNLIKELY(bn > MPFR_SQR_THRESHOLD))
+ return mpfr_mul (a, b, b, rnd_mode);
+
+ MPFR_TMP_MARK(marker);
+ tmp = MPFR_TMP_LIMBS_ALLOC (2 * bn);
+
+ /* Multiplies the mantissa in temporary allocated space */
+ mpn_sqr_n (tmp, MPFR_MANT(b), bn);
+ b1 = tmp[2 * bn - 1];
+
+ /* now tmp[0]..tmp[2*bn-1] contains the product of both mantissa,
+ with tmp[2*bn-1]>=2^(GMP_NUMB_BITS-2) */
+ b1 >>= GMP_NUMB_BITS - 1; /* msb from the product */
+
+ /* if the mantissas of b and c are uniformly distributed in ]1/2, 1],
+ then their product is in ]1/4, 1/2] with probability 2*ln(2)-1 ~ 0.386
+ and in [1/2, 1] with probability 2-2*ln(2) ~ 0.614 */
+ tmp += 2 * bn - tn; /* +0 or +1 */
+ if (MPFR_UNLIKELY(b1 == 0))
+ mpn_lshift (tmp, tmp, tn, 1); /* tn <= k, so no stack corruption */
+
+ cc = mpfr_round_raw (MPFR_MANT (a), tmp, 2 * bq, 0,
+ MPFR_PREC (a), rnd_mode, &inexact);
+ /* cc = 1 ==> result is a power of two */
+ if (MPFR_UNLIKELY(cc))
+ MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] = MPFR_LIMB_HIGHBIT;
+
+ MPFR_TMP_FREE(marker);
+ {
+ mpfr_exp_t ax2 = ax + (mpfr_exp_t) (b1 - 1 + cc);
+ if (MPFR_UNLIKELY( ax2 > __gmpfr_emax))
+ return mpfr_overflow (a, rnd_mode, MPFR_SIGN_POS);
+ if (MPFR_UNLIKELY( ax2 < __gmpfr_emin))
+ {
+ /* In the rounding to the nearest mode, if the exponent of the exact
+ result (i.e. before rounding, i.e. without taking cc into account)
+ is < __gmpfr_emin - 1 or the exact result is a power of 2 (i.e. if
+ both arguments are powers of 2), then round to zero. */
+ if (rnd_mode == MPFR_RNDN &&
+ (ax + (mpfr_exp_t) b1 < __gmpfr_emin || mpfr_powerof2_raw (b)))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (a, rnd_mode, MPFR_SIGN_POS);
+ }
+ MPFR_SET_EXP (a, ax2);
+ MPFR_SET_POS (a);
+ }
+ MPFR_RET (inexact);
+}
diff --git a/src/sqrt.c b/src/sqrt.c
new file mode 100644
index 0000000..64a9e02
--- /dev/null
+++ b/src/sqrt.c
@@ -0,0 +1,231 @@
+/* mpfr_sqrt -- square root of a floating-point number
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
+{
+ mp_size_t rsize; /* number of limbs of r (plus 1 if exact limb multiple) */
+ mp_size_t rrsize;
+ mp_size_t usize; /* number of limbs of u */
+ mp_size_t tsize; /* number of limbs of the sqrtrem remainder */
+ mp_size_t k;
+ mp_size_t l;
+ mpfr_limb_ptr rp, rp0;
+ mpfr_limb_ptr up;
+ mpfr_limb_ptr sp;
+ mp_limb_t sticky0; /* truncated part of input */
+ mp_limb_t sticky1; /* truncated part of rp[0] */
+ mp_limb_t sticky;
+ int odd_exp;
+ int sh; /* number of extra bits in rp[0] */
+ int inexact; /* return ternary flag */
+ mpfr_exp_t expr;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (u), mpfr_log_prec, u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (r), mpfr_log_prec, r, inexact));
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(u)))
+ {
+ if (MPFR_IS_NAN(u))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_ZERO(u))
+ {
+ /* 0+ or 0- */
+ MPFR_SET_SAME_SIGN(r, u);
+ MPFR_SET_ZERO(r);
+ MPFR_RET(0); /* zero is exact */
+ }
+ else
+ {
+ MPFR_ASSERTD(MPFR_IS_INF(u));
+ /* sqrt(-Inf) = NAN */
+ if (MPFR_IS_NEG(u))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_POS(r);
+ MPFR_SET_INF(r);
+ MPFR_RET(0);
+ }
+ }
+ if (MPFR_UNLIKELY(MPFR_IS_NEG(u)))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_POS(r);
+
+ MPFR_TMP_MARK (marker);
+ MPFR_UNSIGNED_MINUS_MODULO(sh,MPFR_PREC(r));
+ if (sh == 0 && rnd_mode == MPFR_RNDN)
+ sh = GMP_NUMB_BITS; /* ugly case */
+ rsize = MPFR_LIMB_SIZE(r) + (sh == GMP_NUMB_BITS);
+ /* rsize is the number of limbs of r + 1 if exact limb multiple and rounding
+ to nearest, this is the number of wanted limbs for the square root */
+ rrsize = rsize + rsize;
+ usize = MPFR_LIMB_SIZE(u); /* number of limbs of u */
+ rp0 = MPFR_MANT(r);
+ rp = (sh < GMP_NUMB_BITS) ? rp0 : MPFR_TMP_LIMBS_ALLOC (rsize);
+ up = MPFR_MANT(u);
+ sticky0 = MPFR_LIMB_ZERO; /* truncated part of input */
+ sticky1 = MPFR_LIMB_ZERO; /* truncated part of rp[0] */
+ odd_exp = (unsigned int) MPFR_GET_EXP (u) & 1;
+ inexact = -1; /* return ternary flag */
+
+ sp = MPFR_TMP_LIMBS_ALLOC (rrsize);
+
+ /* copy the most significant limbs of u to {sp, rrsize} */
+ if (MPFR_LIKELY(usize <= rrsize)) /* in case r and u have the same precision,
+ we have indeed rrsize = 2 * usize */
+ {
+ k = rrsize - usize;
+ if (MPFR_LIKELY(k))
+ MPN_ZERO (sp, k);
+ if (odd_exp)
+ {
+ if (MPFR_LIKELY(k))
+ sp[k - 1] = mpn_rshift (sp + k, up, usize, 1);
+ else
+ sticky0 = mpn_rshift (sp, up, usize, 1);
+ }
+ else
+ MPN_COPY (sp + rrsize - usize, up, usize);
+ }
+ else /* usize > rrsize: truncate the input */
+ {
+ k = usize - rrsize;
+ if (odd_exp)
+ sticky0 = mpn_rshift (sp, up + k, rrsize, 1);
+ else
+ MPN_COPY (sp, up + k, rrsize);
+ l = k;
+ while (sticky0 == MPFR_LIMB_ZERO && l != 0)
+ sticky0 = up[--l];
+ }
+
+ /* sticky0 is non-zero iff the truncated part of the input is non-zero */
+
+ /* mpn_rootrem with NULL 2nd argument is faster than mpn_sqrtrem, thus use
+ it if available and if the user asked to use GMP internal functions */
+#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_ROOTREM)
+ tsize = __gmpn_rootrem (rp, NULL, sp, rrsize, 2);
+#else
+ tsize = mpn_sqrtrem (rp, NULL, sp, rrsize);
+#endif
+
+ /* a return value of zero in mpn_sqrtrem indicates a perfect square */
+ sticky = sticky0 || tsize != 0;
+
+ /* truncate low bits of rp[0] */
+ sticky1 = rp[0] & ((sh < GMP_NUMB_BITS) ? MPFR_LIMB_MASK(sh)
+ : ~MPFR_LIMB_ZERO);
+ rp[0] -= sticky1;
+
+ sticky = sticky || sticky1;
+
+ expr = (MPFR_GET_EXP(u) + odd_exp) / 2; /* exact */
+
+ if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDD || sticky == MPFR_LIMB_ZERO)
+ {
+ inexact = (sticky == MPFR_LIMB_ZERO) ? 0 : -1;
+ goto truncate;
+ }
+ else if (rnd_mode == MPFR_RNDN)
+ {
+ /* if sh < GMP_NUMB_BITS, the round bit is bit (sh-1) of sticky1
+ and the sticky bit is formed by the low sh-1 bits from
+ sticky1, together with the sqrtrem remainder and sticky0. */
+ if (sh < GMP_NUMB_BITS)
+ {
+ if (sticky1 & (MPFR_LIMB_ONE << (sh - 1)))
+ { /* round bit is set */
+ if (sticky1 == (MPFR_LIMB_ONE << (sh - 1)) && tsize == 0
+ && sticky0 == 0)
+ goto even_rule;
+ else
+ goto add_one_ulp;
+ }
+ else /* round bit is zero */
+ goto truncate; /* with the default inexact=-1 */
+ }
+ else /* sh = GMP_NUMB_BITS: the round bit is the most significant bit
+ of rp[0], and the remaining GMP_NUMB_BITS-1 bits contribute to
+ the sticky bit */
+ {
+ if (sticky1 & MPFR_LIMB_HIGHBIT)
+ { /* round bit is set */
+ if (sticky1 == MPFR_LIMB_HIGHBIT && tsize == 0 && sticky0 == 0)
+ goto even_rule;
+ else
+ goto add_one_ulp;
+ }
+ else /* round bit is zero */
+ goto truncate; /* with the default inexact=-1 */
+ }
+ }
+ else /* rnd_mode=GMP_RDNU, necessarily sticky <> 0, thus add 1 ulp */
+ goto add_one_ulp;
+
+ even_rule: /* has to set inexact */
+ if (sh < GMP_NUMB_BITS)
+ inexact = (rp[0] & (MPFR_LIMB_ONE << sh)) ? 1 : -1;
+ else
+ inexact = (rp[1] & MPFR_LIMB_ONE) ? 1 : -1;
+ if (inexact == -1)
+ goto truncate;
+ /* else go through add_one_ulp */
+
+ add_one_ulp:
+ inexact = 1; /* always here */
+ if (sh == GMP_NUMB_BITS)
+ {
+ rp ++;
+ rsize --;
+ sh = 0;
+ }
+ if (mpn_add_1 (rp0, rp, rsize, MPFR_LIMB_ONE << sh))
+ {
+ expr ++;
+ rp[rsize - 1] = MPFR_LIMB_HIGHBIT;
+ }
+ goto end;
+
+ truncate: /* inexact = 0 or -1 */
+ if (sh == GMP_NUMB_BITS)
+ MPN_COPY (rp0, rp + 1, rsize - 1);
+
+ end:
+ MPFR_ASSERTN (expr >= MPFR_EMIN_MIN && expr <= MPFR_EMAX_MAX);
+ MPFR_EXP (r) = expr;
+ MPFR_TMP_FREE(marker);
+
+ return mpfr_check_range (r, inexact, rnd_mode);
+}
diff --git a/src/sqrt_ui.c b/src/sqrt_ui.c
new file mode 100644
index 0000000..92d60de
--- /dev/null
+++ b/src/sqrt_ui.c
@@ -0,0 +1,54 @@
+/* mpfr_sqrt_ui -- square root of a machine integer
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_sqrt_ui (mpfr_ptr r, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ if (u)
+ {
+ mpfr_t uu;
+ mp_limb_t up[1];
+ unsigned long cnt;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS);
+ MPFR_ASSERTN (u == (mp_limb_t) u);
+ count_leading_zeros (cnt, (mp_limb_t) u);
+ *up = (mp_limb_t) u << cnt;
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
+ inex = mpfr_sqrt(r, uu, rnd_mode);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range(r, inex, rnd_mode);
+ }
+ else /* sqrt(0) = 0 */
+ {
+ MPFR_SET_ZERO(r);
+ MPFR_SET_POS(r);
+ MPFR_RET(0);
+ }
+}
diff --git a/src/stack_interface.c b/src/stack_interface.c
new file mode 100644
index 0000000..25c44da
--- /dev/null
+++ b/src/stack_interface.c
@@ -0,0 +1,104 @@
+/* mpfr_stack -- initialize a floating-point number with given allocation area
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_custom_get_size
+size_t
+mpfr_custom_get_size (mpfr_prec_t prec)
+{
+ return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB;
+}
+
+#undef mpfr_custom_init
+void
+mpfr_custom_init (void *mantissa, mpfr_prec_t prec)
+{
+ return ;
+}
+
+#undef mpfr_custom_get_significand
+void *
+mpfr_custom_get_significand (mpfr_srcptr x)
+{
+ return (void*) MPFR_MANT (x);
+}
+
+#undef mpfr_custom_get_exp
+mpfr_exp_t
+mpfr_custom_get_exp (mpfr_srcptr x)
+{
+ return MPFR_EXP (x);
+}
+
+#undef mpfr_custom_move
+void
+mpfr_custom_move (mpfr_ptr x, void *new_position)
+{
+ MPFR_MANT (x) = (mp_limb_t *) new_position;
+}
+
+#undef mpfr_custom_init_set
+void
+mpfr_custom_init_set (mpfr_ptr x, int kind, mpfr_exp_t exp,
+ mpfr_prec_t prec, void *mantissa)
+{
+ mpfr_kind_t t;
+ int s;
+ mpfr_exp_t e;
+
+ if (kind >= 0)
+ {
+ t = (mpfr_kind_t) kind;
+ s = MPFR_SIGN_POS;
+ }
+ else
+ {
+ t = (mpfr_kind_t) -kind;
+ s = MPFR_SIGN_NEG;
+ }
+ MPFR_ASSERTD (t <= MPFR_REGULAR_KIND);
+ e = MPFR_LIKELY (t == MPFR_REGULAR_KIND) ? exp :
+ MPFR_UNLIKELY (t == MPFR_NAN_KIND) ? MPFR_EXP_NAN :
+ MPFR_UNLIKELY (t == MPFR_INF_KIND) ? MPFR_EXP_INF : MPFR_EXP_ZERO;
+
+ MPFR_PREC (x) = prec;
+ MPFR_SET_SIGN (x, s);
+ MPFR_EXP (x) = e;
+ MPFR_MANT (x) = (mp_limb_t*) mantissa;
+ return;
+}
+
+#undef mpfr_custom_get_kind
+int
+mpfr_custom_get_kind (mpfr_srcptr x)
+{
+ if (MPFR_LIKELY (!MPFR_IS_SINGULAR (x)))
+ return (int) MPFR_REGULAR_KIND * MPFR_INT_SIGN (x);
+ if (MPFR_IS_INF (x))
+ return (int) MPFR_INF_KIND * MPFR_INT_SIGN (x);
+ if (MPFR_IS_NAN (x))
+ return (int) MPFR_NAN_KIND;
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ return (int) MPFR_ZERO_KIND * MPFR_INT_SIGN (x);
+}
+
diff --git a/src/strtofr.c b/src/strtofr.c
new file mode 100644
index 0000000..5248c10
--- /dev/null
+++ b/src/strtofr.c
@@ -0,0 +1,851 @@
+/* mpfr_strtofr -- set a floating-point number from a string
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h> /* For strtol */
+#include <ctype.h> /* For isspace */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define MPFR_MAX_BASE 62
+
+struct parsed_string {
+ int negative; /* non-zero iff the number is negative */
+ int base; /* base of the string */
+ unsigned char *mantissa; /* raw significand (without any point) */
+ unsigned char *mant; /* stripped significand (without starting and
+ ending zeroes). This points inside the area
+ allocated for the mantissa field. */
+ size_t prec; /* length of mant (zero for +/-0) */
+ size_t alloc; /* allocation size of mantissa */
+ mpfr_exp_t exp_base; /* number of digits before the point */
+ mpfr_exp_t exp_bin; /* exponent in case base=2 or 16, and the pxxx
+ format is used (i.e., exponent is given in
+ base 10) */
+};
+
+/* This table has been generated by the following program.
+ For 2 <= b <= MPFR_MAX_BASE,
+ RedInvLog2Table[b-2][0] / RedInvLog2Table[b-2][1]
+ is an upper approximation of log(2)/log(b).
+*/
+static const unsigned long RedInvLog2Table[MPFR_MAX_BASE-1][2] = {
+ {1UL, 1UL},
+ {53UL, 84UL},
+ {1UL, 2UL},
+ {4004UL, 9297UL},
+ {53UL, 137UL},
+ {2393UL, 6718UL},
+ {1UL, 3UL},
+ {665UL, 2108UL},
+ {4004UL, 13301UL},
+ {949UL, 3283UL},
+ {53UL, 190UL},
+ {5231UL, 19357UL},
+ {2393UL, 9111UL},
+ {247UL, 965UL},
+ {1UL, 4UL},
+ {4036UL, 16497UL},
+ {665UL, 2773UL},
+ {5187UL, 22034UL},
+ {4004UL, 17305UL},
+ {51UL, 224UL},
+ {949UL, 4232UL},
+ {3077UL, 13919UL},
+ {53UL, 243UL},
+ {73UL, 339UL},
+ {5231UL, 24588UL},
+ {665UL, 3162UL},
+ {2393UL, 11504UL},
+ {4943UL, 24013UL},
+ {247UL, 1212UL},
+ {3515UL, 17414UL},
+ {1UL, 5UL},
+ {4415UL, 22271UL},
+ {4036UL, 20533UL},
+ {263UL, 1349UL},
+ {665UL, 3438UL},
+ {1079UL, 5621UL},
+ {5187UL, 27221UL},
+ {2288UL, 12093UL},
+ {4004UL, 21309UL},
+ {179UL, 959UL},
+ {51UL, 275UL},
+ {495UL, 2686UL},
+ {949UL, 5181UL},
+ {3621UL, 19886UL},
+ {3077UL, 16996UL},
+ {229UL, 1272UL},
+ {53UL, 296UL},
+ {109UL, 612UL},
+ {73UL, 412UL},
+ {1505UL, 8537UL},
+ {5231UL, 29819UL},
+ {283UL, 1621UL},
+ {665UL, 3827UL},
+ {32UL, 185UL},
+ {2393UL, 13897UL},
+ {1879UL, 10960UL},
+ {4943UL, 28956UL},
+ {409UL, 2406UL},
+ {247UL, 1459UL},
+ {231UL, 1370UL},
+ {3515UL, 20929UL} };
+#if 0
+#define N 8
+int main ()
+{
+ unsigned long tab[N];
+ int i, n, base;
+ mpfr_t x, y;
+ mpq_t q1, q2;
+ int overflow = 0, base_overflow;
+
+ mpfr_init2 (x, 200);
+ mpfr_init2 (y, 200);
+ mpq_init (q1);
+ mpq_init (q2);
+
+ for (base = 2 ; base < 63 ; base ++)
+ {
+ mpfr_set_ui (x, base, MPFR_RNDN);
+ mpfr_log2 (x, x, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
+ printf ("Base: %d x=%e ", base, mpfr_get_d1 (x));
+ for (i = 0 ; i < N ; i++)
+ {
+ mpfr_floor (y, x);
+ tab[i] = mpfr_get_ui (y, MPFR_RNDN);
+ mpfr_sub (x, x, y, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
+ }
+ for (i = N-1 ; i >= 0 ; i--)
+ if (tab[i] != 0)
+ break;
+ mpq_set_ui (q1, tab[i], 1);
+ for (i = i-1 ; i >= 0 ; i--)
+ {
+ mpq_inv (q1, q1);
+ mpq_set_ui (q2, tab[i], 1);
+ mpq_add (q1, q1, q2);
+ }
+ printf("Approx: ", base);
+ mpq_out_str (stdout, 10, q1);
+ printf (" = %e\n", mpq_get_d (q1) );
+ fprintf (stderr, "{");
+ mpz_out_str (stderr, 10, mpq_numref (q1));
+ fprintf (stderr, "UL, ");
+ mpz_out_str (stderr, 10, mpq_denref (q1));
+ fprintf (stderr, "UL},\n");
+ if (mpz_cmp_ui (mpq_numref (q1), 1<<16-1) >= 0
+ || mpz_cmp_ui (mpq_denref (q1), 1<<16-1) >= 0)
+ overflow = 1, base_overflow = base;
+ }
+
+ mpq_clear (q2);
+ mpq_clear (q1);
+ mpfr_clear (y);
+ mpfr_clear (x);
+ if (overflow )
+ printf ("OVERFLOW for base =%d!\n", base_overflow);
+}
+#endif
+
+
+/* Compatible with any locale, but one still assumes that 'a', 'b', 'c',
+ ..., 'z', and 'A', 'B', 'C', ..., 'Z' are consecutive values (like
+ in any ASCII-based character set). */
+static int
+digit_value_in_base (int c, int base)
+{
+ int digit;
+
+ MPFR_ASSERTD (base > 0 && base <= MPFR_MAX_BASE);
+
+ if (c >= '0' && c <= '9')
+ digit = c - '0';
+ else if (c >= 'a' && c <= 'z')
+ digit = (base >= 37) ? c - 'a' + 36 : c - 'a' + 10;
+ else if (c >= 'A' && c <= 'Z')
+ digit = c - 'A' + 10;
+ else
+ return -1;
+
+ return MPFR_LIKELY (digit < base) ? digit : -1;
+}
+
+/* Compatible with any locale, but one still assumes that 'a', 'b', 'c',
+ ..., 'z', and 'A', 'B', 'C', ..., 'Z' are consecutive values (like
+ in any ASCII-based character set). */
+/* TODO: support EBCDIC. */
+static int
+fast_casecmp (const char *s1, const char *s2)
+{
+ unsigned char c1, c2;
+
+ do
+ {
+ c2 = *(const unsigned char *) s2++;
+ if (c2 == '\0')
+ return 0;
+ c1 = *(const unsigned char *) s1++;
+ if (c1 >= 'A' && c1 <= 'Z')
+ c1 = c1 - 'A' + 'a';
+ }
+ while (c1 == c2);
+ return 1;
+}
+
+/* Parse a string and fill pstr.
+ Return the advanced ptr too.
+ It returns:
+ -1 if invalid string,
+ 0 if special string (like nan),
+ 1 if the string is ok.
+ 2 if overflows
+ So it doesn't return the ternary value
+ BUT if it returns 0 (NAN or INF), the ternary value is also '0'
+ (ie NAN and INF are exact) */
+static int
+parse_string (mpfr_t x, struct parsed_string *pstr,
+ const char **string, int base)
+{
+ const char *str = *string;
+ unsigned char *mant;
+ int point;
+ int res = -1; /* Invalid input return value */
+ const char *prefix_str;
+ int decimal_point;
+
+ decimal_point = (unsigned char) MPFR_DECIMAL_POINT;
+
+ /* Init variable */
+ pstr->mantissa = NULL;
+
+ /* Optional leading whitespace */
+ while (isspace((unsigned char) *str)) str++;
+
+ /* An optional sign `+' or `-' */
+ pstr->negative = (*str == '-');
+ if (*str == '-' || *str == '+')
+ str++;
+
+ /* Can be case-insensitive NAN */
+ if (fast_casecmp (str, "@nan@") == 0)
+ {
+ str += 5;
+ goto set_nan;
+ }
+ if (base <= 16 && fast_casecmp (str, "nan") == 0)
+ {
+ str += 3;
+ set_nan:
+ /* Check for "(dummychars)" */
+ if (*str == '(')
+ {
+ const char *s;
+ for (s = str+1 ; *s != ')' ; s++)
+ if (!(*s >= 'A' && *s <= 'Z')
+ && !(*s >= 'a' && *s <= 'z')
+ && !(*s >= '0' && *s <= '9')
+ && *s != '_')
+ break;
+ if (*s == ')')
+ str = s+1;
+ }
+ *string = str;
+ MPFR_SET_NAN(x);
+ /* MPFR_RET_NAN not used as the return value isn't a ternary value */
+ __gmpfr_flags |= MPFR_FLAGS_NAN;
+ return 0;
+ }
+
+ /* Can be case-insensitive INF */
+ if (fast_casecmp (str, "@inf@") == 0)
+ {
+ str += 5;
+ goto set_inf;
+ }
+ if (base <= 16 && fast_casecmp (str, "infinity") == 0)
+ {
+ str += 8;
+ goto set_inf;
+ }
+ if (base <= 16 && fast_casecmp (str, "inf") == 0)
+ {
+ str += 3;
+ set_inf:
+ *string = str;
+ MPFR_SET_INF (x);
+ (pstr->negative) ? MPFR_SET_NEG (x) : MPFR_SET_POS (x);
+ return 0;
+ }
+
+ /* If base=0 or 16, it may include '0x' prefix */
+ prefix_str = NULL;
+ if ((base == 0 || base == 16) && str[0]=='0'
+ && (str[1]=='x' || str[1] == 'X'))
+ {
+ prefix_str = str;
+ base = 16;
+ str += 2;
+ }
+ /* If base=0 or 2, it may include '0b' prefix */
+ if ((base == 0 || base == 2) && str[0]=='0'
+ && (str[1]=='b' || str[1] == 'B'))
+ {
+ prefix_str = str;
+ base = 2;
+ str += 2;
+ }
+ /* Else if base=0, we assume decimal base */
+ if (base == 0)
+ base = 10;
+ pstr->base = base;
+
+ /* Alloc mantissa */
+ pstr->alloc = (size_t) strlen (str) + 1;
+ pstr->mantissa = (unsigned char*) (*__gmp_allocate_func) (pstr->alloc);
+
+ /* Read mantissa digits */
+ parse_begin:
+ mant = pstr->mantissa;
+ point = 0;
+ pstr->exp_base = 0;
+ pstr->exp_bin = 0;
+
+ for (;;) /* Loop until an invalid character is read */
+ {
+ int c = (unsigned char) *str++;
+ /* The cast to unsigned char is needed because of digit_value_in_base;
+ decimal_point uses this convention too. */
+ if (c == '.' || c == decimal_point)
+ {
+ if (MPFR_UNLIKELY(point)) /* Second '.': stop parsing */
+ break;
+ point = 1;
+ continue;
+ }
+ c = digit_value_in_base (c, base);
+ if (c == -1)
+ break;
+ MPFR_ASSERTN (c >= 0); /* c is representable in an unsigned char */
+ *mant++ = (unsigned char) c;
+ if (!point)
+ pstr->exp_base ++;
+ }
+ str--; /* The last read character was invalid */
+
+ /* Update the # of char in the mantissa */
+ pstr->prec = mant - pstr->mantissa;
+ /* Check if there are no characters in the mantissa (Invalid argument) */
+ if (pstr->prec == 0)
+ {
+ /* Check if there was a prefix (in such a case, we have to read
+ again the mantissa without skipping the prefix)
+ The allocated mantissa is still big enough since we will
+ read only 0, and we alloc one more char than needed.
+ FIXME: Not really friendly. Maybe cleaner code? */
+ if (prefix_str != NULL)
+ {
+ str = prefix_str;
+ prefix_str = NULL;
+ goto parse_begin;
+ }
+ goto end;
+ }
+
+ /* Valid entry */
+ res = 1;
+ MPFR_ASSERTD (pstr->exp_base >= 0);
+
+ /* an optional exponent (e or E, p or P, @) */
+ if ( (*str == '@' || (base <= 10 && (*str == 'e' || *str == 'E')))
+ && (!isspace((unsigned char) str[1])) )
+ {
+ char *endptr;
+ /* the exponent digits are kept in ASCII */
+ mpfr_exp_t sum;
+ long read_exp = strtol (str + 1, &endptr, 10);
+ if (endptr != str+1)
+ str = endptr;
+ sum =
+ read_exp < MPFR_EXP_MIN ? (str = endptr, MPFR_EXP_MIN) :
+ read_exp > MPFR_EXP_MAX ? (str = endptr, MPFR_EXP_MAX) :
+ (mpfr_exp_t) read_exp;
+ MPFR_SADD_OVERFLOW (sum, sum, pstr->exp_base,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ res = 2, res = 3);
+ /* Since exp_base was positive, read_exp + exp_base can't
+ do a negative overflow. */
+ MPFR_ASSERTD (res != 3);
+ pstr->exp_base = sum;
+ }
+ else if ((base == 2 || base == 16)
+ && (*str == 'p' || *str == 'P')
+ && (!isspace((unsigned char) str[1])))
+ {
+ char *endptr;
+ long read_exp = strtol (str + 1, &endptr, 10);
+ if (endptr != str+1)
+ str = endptr;
+ pstr->exp_bin =
+ read_exp < MPFR_EXP_MIN ? (str = endptr, MPFR_EXP_MIN) :
+ read_exp > MPFR_EXP_MAX ? (str = endptr, MPFR_EXP_MAX) :
+ (mpfr_exp_t) read_exp;
+ }
+
+ /* Remove 0's at the beginning and end of mantissa[0..prec-1] */
+ mant = pstr->mantissa;
+ for ( ; (pstr->prec > 0) && (*mant == 0) ; mant++, pstr->prec--)
+ pstr->exp_base--;
+ for ( ; (pstr->prec > 0) && (mant[pstr->prec - 1] == 0); pstr->prec--);
+ pstr->mant = mant;
+
+ /* Check if x = 0 */
+ if (pstr->prec == 0)
+ {
+ MPFR_SET_ZERO (x);
+ if (pstr->negative)
+ MPFR_SET_NEG(x);
+ else
+ MPFR_SET_POS(x);
+ res = 0;
+ }
+
+ *string = str;
+ end:
+ if (pstr->mantissa != NULL && res != 1)
+ (*__gmp_free_func) (pstr->mantissa, pstr->alloc);
+ return res;
+}
+
+/* Transform a parsed string to a mpfr_t according to the rounding mode
+ and the precision of x.
+ Returns the ternary value. */
+static int
+parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t prec;
+ mpfr_exp_t exp;
+ mpfr_exp_t ysize_bits;
+ mp_limb_t *y, *result;
+ int count, exact;
+ size_t pstr_size;
+ mp_size_t ysize, real_ysize;
+ int res, err;
+ MPFR_ZIV_DECL (loop);
+ MPFR_TMP_DECL (marker);
+
+ /* initialize the working precision */
+ prec = MPFR_PREC (x) + MPFR_INT_CEIL_LOG2 (MPFR_PREC (x));
+
+ /* compute the value y of the leading characters as long as rounding is not
+ possible */
+ MPFR_TMP_MARK(marker);
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ /* Set y to the value of the ~prec most significant bits of pstr->mant
+ (as long as we guarantee correct rounding, we don't need to get
+ exactly prec bits). */
+ ysize = MPFR_PREC2LIMBS (prec);
+ /* prec bits corresponds to ysize limbs */
+ ysize_bits = ysize * GMP_NUMB_BITS;
+ /* and to ysize_bits >= prec > MPFR_PREC (x) bits */
+ y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 1);
+ y += ysize; /* y has (ysize+1) allocated limbs */
+
+ /* pstr_size is the number of characters we read in pstr->mant
+ to have at least ysize full limbs.
+ We must have base^(pstr_size-1) >= (2^(GMP_NUMB_BITS))^ysize
+ (in the worst case, the first digit is one and all others are zero).
+ i.e., pstr_size >= 1 + ysize*GMP_NUMB_BITS/log2(base)
+ Since ysize ~ prec/GMP_NUMB_BITS and prec < Umax/2 =>
+ ysize*GMP_NUMB_BITS can not overflow.
+ We compute pstr_size = 1 + ceil(ysize_bits * Num / Den)
+ where Num/Den >= 1/log2(base)
+ It is not exactly ceil(1/log2(base)) but could be one more (base 2)
+ Quite ugly since it tries to avoid overflow:
+ let Num = RedInvLog2Table[pstr->base-2][0]
+ and Den = RedInvLog2Table[pstr->base-2][1],
+ and ysize_bits = a*Den+b,
+ then ysize_bits * Num/Den = a*Num + (b * Num)/Den,
+ thus ceil(ysize_bits * Num/Den) = a*Num + floor(b * Num + Den - 1)/Den
+ */
+ {
+ unsigned long Num = RedInvLog2Table[pstr->base-2][0];
+ unsigned long Den = RedInvLog2Table[pstr->base-2][1];
+ pstr_size = ((ysize_bits / Den) * Num)
+ + (((ysize_bits % Den) * Num + Den - 1) / Den)
+ + 1;
+ }
+
+ /* since pstr_size corresponds to at least ysize_bits full bits,
+ and ysize_bits > prec, the weight of the neglected part of
+ pstr->mant (if any) is < ulp(y) < ulp(x) */
+
+ /* if the number of wanted characters is more than what we have in
+ pstr->mant, round it down */
+ if (pstr_size >= pstr->prec)
+ pstr_size = pstr->prec;
+ MPFR_ASSERTD (pstr_size == (mpfr_exp_t) pstr_size);
+
+ /* convert str into binary: note that pstr->mant is big endian,
+ thus no offset is needed */
+ real_ysize = mpn_set_str (y, pstr->mant, pstr_size, pstr->base);
+ MPFR_ASSERTD (real_ysize <= ysize+1);
+
+ /* normalize y: warning we can even get ysize+1 limbs! */
+ MPFR_ASSERTD (y[real_ysize - 1] != 0); /* mpn_set_str guarantees this */
+ count_leading_zeros (count, y[real_ysize - 1]);
+ /* exact means that the number of limbs of the output of mpn_set_str
+ is less or equal to ysize */
+ exact = real_ysize <= ysize;
+ if (exact) /* shift y to the left in that case y should be exact */
+ {
+ /* we have enough limbs to store {y, real_ysize} */
+ /* shift {y, num_limb} for count bits to the left */
+ if (count != 0)
+ mpn_lshift (y + ysize - real_ysize, y, real_ysize, count);
+ if (real_ysize != ysize)
+ {
+ if (count == 0)
+ MPN_COPY_DECR (y + ysize - real_ysize, y, real_ysize);
+ MPN_ZERO (y, ysize - real_ysize);
+ }
+ /* for each bit shift decrease exponent of y */
+ /* (This should not overflow) */
+ exp = - ((ysize - real_ysize) * GMP_NUMB_BITS + count);
+ }
+ else /* shift y to the right, by doing this we might lose some
+ bits from the result of mpn_set_str (in addition to the
+ characters neglected from pstr->mant) */
+ {
+ /* shift {y, num_limb} for (GMP_NUMB_BITS - count) bits
+ to the right. FIXME: can we prove that count cannot be zero here,
+ since mpn_rshift does not accept a shift of GMP_NUMB_BITS? */
+ MPFR_ASSERTD (count != 0);
+ exact = mpn_rshift (y, y, real_ysize, GMP_NUMB_BITS - count) ==
+ MPFR_LIMB_ZERO;
+ /* for each bit shift increase exponent of y */
+ exp = GMP_NUMB_BITS - count;
+ }
+
+ /* compute base^(exp_base - pstr_size) on n limbs */
+ if (IS_POW2 (pstr->base))
+ {
+ /* Base: 2, 4, 8, 16, 32 */
+ int pow2;
+ mpfr_exp_t tmp;
+
+ count_leading_zeros (pow2, (mp_limb_t) pstr->base);
+ pow2 = GMP_NUMB_BITS - pow2 - 1; /* base = 2^pow2 */
+ MPFR_ASSERTD (0 < pow2 && pow2 <= 5);
+ /* exp += pow2 * (pstr->exp_base - pstr_size) + pstr->exp_bin
+ with overflow checking
+ and check that we can add/substract 2 to exp without overflow */
+ MPFR_SADD_OVERFLOW (tmp, pstr->exp_base, -(mpfr_exp_t) pstr_size,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ /* On some FreeBsd/Alpha, LONG_MIN/1 produced an exception
+ so we used to check for this before doing the division.
+ Since this bug is closed now (Nov 26, 2009), we remove
+ that check (http://www.freebsd.org/cgi/query-pr.cgi?pr=72024) */
+ if (tmp > 0 && MPFR_EXP_MAX / pow2 <= tmp)
+ goto overflow;
+ else if (tmp < 0 && MPFR_EXP_MIN / pow2 >= tmp)
+ goto underflow;
+ tmp *= pow2;
+ MPFR_SADD_OVERFLOW (tmp, tmp, pstr->exp_bin,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ MPFR_SADD_OVERFLOW (exp, exp, tmp,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
+ goto overflow, goto underflow);
+ result = y;
+ err = 0;
+ }
+ /* case non-power-of-two-base, and pstr->exp_base > pstr_size */
+ else if (pstr->exp_base > (mpfr_exp_t) pstr_size)
+ {
+ mp_limb_t *z;
+ mpfr_exp_t exp_z;
+
+ result = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 1);
+
+ /* z = base^(exp_base-sptr_size) using space allocated at y-ysize */
+ z = y - ysize;
+ /* NOTE: exp_base-pstr_size can't overflow since pstr_size > 0 */
+ err = mpfr_mpn_exp (z, &exp_z, pstr->base,
+ pstr->exp_base - pstr_size, ysize);
+ if (err == -2)
+ goto overflow;
+ exact = exact && (err == -1);
+
+ /* If exact is non zero, then z equals exactly the value of the
+ pstr_size most significant digits from pstr->mant, i.e., the
+ only difference can come from the neglected pstr->prec-pstr_size
+ least significant digits of pstr->mant.
+ If exact is zero, then z is rounded toward zero with respect
+ to that value. */
+
+ /* multiply(y = 0.mant[0]...mant[pr-1])_base by base^(exp-g):
+ since both y and z are rounded toward zero, so is "result" */
+ mpn_mul_n (result, y, z, ysize);
+
+ /* compute the error on the product */
+ if (err == -1)
+ err = 0;
+ err ++;
+
+ /* compute the exponent of y */
+ /* exp += exp_z + ysize_bits with overflow checking
+ and check that we can add/substract 2 to exp without overflow */
+ MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ MPFR_SADD_OVERFLOW (exp, exp, exp_z,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
+ goto overflow, goto underflow);
+
+ /* normalize result */
+ if (MPFR_LIMB_MSB (result[2 * ysize - 1]) == 0)
+ {
+ mp_limb_t *r = result + ysize - 1;
+ mpn_lshift (r, r, ysize + 1, 1);
+ /* Overflow checking not needed */
+ exp --;
+ }
+
+ /* if the low ysize limbs of {result, 2*ysize} are all zero,
+ then the result is still "exact" (if it was before) */
+ exact = exact && (mpn_scan1 (result, 0)
+ >= (unsigned long) ysize_bits);
+ result += ysize;
+ }
+ /* case exp_base < pstr_size */
+ else if (pstr->exp_base < (mpfr_exp_t) pstr_size)
+ {
+ mp_limb_t *z;
+ mpfr_exp_t exp_z;
+
+ result = MPFR_TMP_LIMBS_ALLOC (3 * ysize + 1);
+
+ /* set y to y * K^ysize */
+ y = y - ysize; /* we have allocated ysize limbs at y - ysize */
+ MPN_ZERO (y, ysize);
+
+ /* pstr_size - pstr->exp_base can overflow */
+ MPFR_SADD_OVERFLOW (exp_z, (mpfr_exp_t) pstr_size, -pstr->exp_base,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto underflow, goto overflow);
+
+ /* (z, exp_z) = base^(exp_base-pstr_size) */
+ z = result + 2*ysize + 1;
+ err = mpfr_mpn_exp (z, &exp_z, pstr->base, exp_z, ysize);
+ /* Since we want y/z rounded toward zero, we must get an upper
+ bound of z. If err >= 0, the error on z is bounded by 2^err. */
+ if (err >= 0)
+ {
+ mp_limb_t cy;
+ unsigned long h = err / GMP_NUMB_BITS;
+ unsigned long l = err - h * GMP_NUMB_BITS;
+
+ if (h >= ysize) /* not enough precision in z */
+ goto next_loop;
+ cy = mpn_add_1 (z, z, ysize - h, MPFR_LIMB_ONE << l);
+ if (cy != 0) /* the code below requires z on ysize limbs */
+ goto next_loop;
+ }
+ exact = exact && (err == -1);
+ if (err == -2)
+ goto underflow; /* FIXME: Sure? */
+ if (err == -1)
+ err = 0;
+
+ /* compute y / z */
+ /* result will be put into result + n, and remainder into result */
+ mpn_tdiv_qr (result + ysize, result, (mp_size_t) 0, y,
+ 2 * ysize, z, ysize);
+
+ /* exp -= exp_z + ysize_bits with overflow checking
+ and check that we can add/substract 2 to exp without overflow */
+ MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto underflow, goto overflow);
+ MPFR_SADD_OVERFLOW (exp, exp, -exp_z,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
+ goto overflow, goto underflow);
+ err += 2;
+ /* if the remainder of the division is zero, then the result is
+ still "exact" if it was before */
+ exact = exact && (mpn_popcount (result, ysize) == 0);
+
+ /* normalize result */
+ if (result[2 * ysize] == MPFR_LIMB_ONE)
+ {
+ mp_limb_t *r = result + ysize;
+
+ exact = exact && ((*r & MPFR_LIMB_ONE) == 0);
+ mpn_rshift (r, r, ysize + 1, 1);
+ /* Overflow Checking not needed */
+ exp ++;
+ }
+ result += ysize;
+ }
+ /* case exp_base = pstr_size: no multiplication or division needed */
+ else
+ {
+ /* base^(exp-pr) = 1 nothing to compute */
+ result = y;
+ err = 0;
+ }
+
+ /* If result is exact, we still have to consider the neglected part
+ of the input string. For a directed rounding, in that case we could
+ still correctly round, since the neglected part is less than
+ one ulp, but that would make the code more complex, and give a
+ speedup for rare cases only. */
+ exact = exact && (pstr_size == pstr->prec);
+
+ /* at this point, result is an approximation rounded toward zero
+ of the pstr_size most significant digits of pstr->mant, with
+ equality in case exact is non-zero. */
+
+ /* test if rounding is possible, and if so exit the loop */
+ if (exact || mpfr_can_round_raw (result, ysize,
+ (pstr->negative) ? -1 : 1,
+ ysize_bits - err - 1,
+ MPFR_RNDN, rnd, MPFR_PREC(x)))
+ break;
+
+ next_loop:
+ /* update the prec for next loop */
+ MPFR_ZIV_NEXT (loop, prec);
+ } /* loop */
+ MPFR_ZIV_FREE (loop);
+
+ /* round y */
+ if (mpfr_round_raw (MPFR_MANT (x), result,
+ ysize_bits,
+ pstr->negative, MPFR_PREC(x), rnd, &res ))
+ {
+ /* overflow when rounding y */
+ MPFR_MANT (x)[MPFR_LIMB_SIZE (x) - 1] = MPFR_LIMB_HIGHBIT;
+ /* Overflow Checking not needed */
+ exp ++;
+ }
+
+ if (res == 0) /* fix ternary value */
+ {
+ exact = exact && (pstr_size == pstr->prec);
+ if (!exact)
+ res = (pstr->negative) ? 1 : -1;
+ }
+
+ /* Set sign of x before exp since check_range needs a valid sign */
+ (pstr->negative) ? MPFR_SET_NEG (x) : MPFR_SET_POS (x);
+
+ /* DO NOT USE MPFR_SET_EXP. The exp may be out of range! */
+ MPFR_SADD_OVERFLOW (exp, exp, ysize_bits,
+ mpfr_exp_t, mpfr_uexp_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ MPFR_EXP (x) = exp;
+ res = mpfr_check_range (x, res, rnd);
+ goto end;
+
+ underflow:
+ /* This is called when there is a huge overflow
+ (Real expo < MPFR_EXP_MIN << __gmpfr_emin */
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
+ res = mpfr_underflow (x, rnd, (pstr->negative) ? -1 : 1);
+ goto end;
+
+ overflow:
+ res = mpfr_overflow (x, rnd, (pstr->negative) ? -1 : 1);
+
+ end:
+ MPFR_TMP_FREE (marker);
+ return res;
+}
+
+static void
+free_parsed_string (struct parsed_string *pstr)
+{
+ (*__gmp_free_func) (pstr->mantissa, pstr->alloc);
+}
+
+int
+mpfr_strtofr (mpfr_t x, const char *string, char **end, int base,
+ mpfr_rnd_t rnd)
+{
+ int res;
+ struct parsed_string pstr;
+
+ /* For base <= 36, parsing is case-insensitive. */
+ MPFR_ASSERTN (base == 0 || (base >= 2 && base <= 62));
+
+ /* If an error occured, it must return 0 */
+ MPFR_SET_ZERO (x);
+ MPFR_SET_POS (x);
+
+ MPFR_ASSERTN (MPFR_MAX_BASE >= 62);
+ res = parse_string (x, &pstr, &string, base);
+ /* If res == 0, then it was exact (NAN or INF),
+ so it is also the ternary value */
+ if (MPFR_UNLIKELY (res == -1)) /* invalid data */
+ res = 0; /* x is set to 0, which is exact, thus ternary value is 0 */
+ else if (res == 1)
+ {
+ res = parsed_string_to_mpfr (x, &pstr, rnd);
+ free_parsed_string (&pstr);
+ }
+ else if (res == 2)
+ res = mpfr_overflow (x, rnd, (pstr.negative) ? -1 : 1);
+ MPFR_ASSERTD (res != 3);
+#if 0
+ else if (res == 3)
+ {
+ /* This is called when there is a huge overflow
+ (Real expo < MPFR_EXP_MIN << __gmpfr_emin */
+ if (rnd == MPFR_RNDN)
+ rnd = MPFR_RNDZ;
+ res = mpfr_underflow (x, rnd, (pstr.negative) ? -1 : 1);
+ }
+#endif
+
+ if (end != NULL)
+ *end = (char *) string;
+ return res;
+}
diff --git a/src/sub.c b/src/sub.c
new file mode 100644
index 0000000..d1af16f
--- /dev/null
+++ b/src/sub.c
@@ -0,0 +1,116 @@
+/* mpfr_sub -- subtract two floating-point numbers
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ MPFR_LOG_FUNC
+ (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg rnd=%d",
+ mpfr_get_prec (b), mpfr_log_prec, b,
+ mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+
+ if (MPFR_ARE_SINGULAR (b,c))
+ {
+ if (MPFR_IS_NAN (b) || MPFR_IS_NAN (c))
+ {
+ MPFR_SET_NAN (a);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (b))
+ {
+ if (!MPFR_IS_INF (c) || MPFR_SIGN (b) != MPFR_SIGN(c))
+ {
+ MPFR_SET_INF (a);
+ MPFR_SET_SAME_SIGN (a, b);
+ MPFR_RET (0); /* exact */
+ }
+ else
+ {
+ MPFR_SET_NAN (a); /* Inf - Inf */
+ MPFR_RET_NAN;
+ }
+ }
+ else if (MPFR_IS_INF (c))
+ {
+ MPFR_SET_INF (a);
+ MPFR_SET_OPPOSITE_SIGN (a, c);
+ MPFR_RET (0); /* exact */
+ }
+ else if (MPFR_IS_ZERO (b))
+ {
+ if (MPFR_IS_ZERO (c))
+ {
+ int sign = rnd_mode != MPFR_RNDD
+ ? ((MPFR_IS_NEG(b) && MPFR_IS_POS(c)) ? -1 : 1)
+ : ((MPFR_IS_POS(b) && MPFR_IS_NEG(c)) ? 1 : -1);
+ MPFR_SET_SIGN (a, sign);
+ MPFR_SET_ZERO (a);
+ MPFR_RET(0); /* 0 - 0 is exact */
+ }
+ else
+ return mpfr_neg (a, c, rnd_mode);
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (c));
+ return mpfr_set (a, b, rnd_mode);
+ }
+ }
+
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (b));
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (c));
+
+ if (MPFR_LIKELY (MPFR_SIGN (b) == MPFR_SIGN (c)))
+ { /* signs are equal, it's a real subtraction */
+ if (MPFR_LIKELY (MPFR_PREC (a) == MPFR_PREC (b)
+ && MPFR_PREC (b) == MPFR_PREC (c)))
+ return mpfr_sub1sp (a, b, c, rnd_mode);
+ else
+ return mpfr_sub1 (a, b, c, rnd_mode);
+ }
+ else
+ { /* signs differ, it's an addition */
+ if (MPFR_GET_EXP (b) < MPFR_GET_EXP (c))
+ { /* exchange rounding modes toward +/- infinity */
+ int inexact;
+ rnd_mode = MPFR_INVERT_RND (rnd_mode);
+ if (MPFR_LIKELY (MPFR_PREC (a) == MPFR_PREC (b)
+ && MPFR_PREC (b) == MPFR_PREC (c)))
+ inexact = mpfr_add1sp (a, c, b, rnd_mode);
+ else
+ inexact = mpfr_add1 (a, c, b, rnd_mode);
+ MPFR_CHANGE_SIGN (a);
+ return -inexact;
+ }
+ else
+ {
+ if (MPFR_LIKELY (MPFR_PREC (a) == MPFR_PREC (b)
+ && MPFR_PREC (b) == MPFR_PREC (c)))
+ return mpfr_add1sp (a, b, c, rnd_mode);
+ else
+ return mpfr_add1 (a, b, c, rnd_mode);
+ }
+ }
+}
diff --git a/src/sub1.c b/src/sub1.c
new file mode 100644
index 0000000..b266412
--- /dev/null
+++ b/src/sub1.c
@@ -0,0 +1,657 @@
+/* mpfr_sub1 -- internal function to perform a "real" subtraction
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* compute sign(b) * (|b| - |c|), with |b| > |c|, diff_exp = EXP(b) - EXP(c)
+ Returns 0 iff result is exact,
+ a negative value when the result is less than the exact value,
+ a positive value otherwise.
+*/
+
+int
+mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int sign;
+ mpfr_uexp_t diff_exp;
+ mpfr_prec_t cancel, cancel1;
+ mp_size_t cancel2, an, bn, cn, cn0;
+ mp_limb_t *ap, *bp, *cp;
+ mp_limb_t carry, bb, cc;
+ int inexact, shift_b, shift_c, add_exp = 0;
+ int cmp_low = 0; /* used for rounding to nearest: 0 if low(b) = low(c),
+ negative if low(b) < low(c), positive if low(b)>low(c) */
+ int sh, k;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_TMP_MARK(marker);
+ ap = MPFR_MANT(a);
+ an = MPFR_LIMB_SIZE(a);
+
+ sign = mpfr_cmp2 (b, c, &cancel);
+ if (MPFR_UNLIKELY(sign == 0))
+ {
+ if (rnd_mode == MPFR_RNDD)
+ MPFR_SET_NEG (a);
+ else
+ MPFR_SET_POS (a);
+ MPFR_SET_ZERO (a);
+ MPFR_RET (0);
+ }
+
+ /*
+ * If subtraction: sign(a) = sign * sign(b)
+ * If addition: sign(a) = sign of the larger argument in absolute value.
+ *
+ * Both cases can be simplidied in:
+ * if (sign>0)
+ * if addition: sign(a) = sign * sign(b) = sign(b)
+ * if subtraction, b is greater, so sign(a) = sign(b)
+ * else
+ * if subtraction, sign(a) = - sign(b)
+ * if addition, sign(a) = sign(c) (since c is greater)
+ * But if it is an addition, sign(b) and sign(c) are opposed!
+ * So sign(a) = - sign(b)
+ */
+
+ if (sign < 0) /* swap b and c so that |b| > |c| */
+ {
+ mpfr_srcptr t;
+ MPFR_SET_OPPOSITE_SIGN (a,b);
+ t = b; b = c; c = t;
+ }
+ else
+ MPFR_SET_SAME_SIGN (a,b);
+
+ /* Check if c is too small.
+ A more precise test is to replace 2 by
+ (rnd == MPFR_RNDN) + mpfr_power2_raw (b)
+ but it is more expensive and not very useful */
+ if (MPFR_UNLIKELY (MPFR_GET_EXP (c) <= MPFR_GET_EXP (b)
+ - (mpfr_exp_t) MAX (MPFR_PREC (a), MPFR_PREC (b)) - 2))
+ {
+ /* Remember, we can't have an exact result! */
+ /* A.AAAAAAAAAAAAAAAAA
+ = B.BBBBBBBBBBBBBBB
+ - C.CCCCCCCCCCCCC */
+ /* A = S*ABS(B) +/- ulp(a) */
+ MPFR_SET_EXP (a, MPFR_GET_EXP (b));
+ MPFR_RNDRAW_EVEN (inexact, a, MPFR_MANT (b), MPFR_PREC (b),
+ rnd_mode, MPFR_SIGN (a),
+ if (MPFR_UNLIKELY ( ++MPFR_EXP (a) > __gmpfr_emax))
+ inexact = mpfr_overflow (a, rnd_mode, MPFR_SIGN (a)));
+ /* inexact = mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (a)); */
+ if (inexact == 0)
+ {
+ /* a = b (Exact)
+ But we know it isn't (Since we have to remove `c')
+ So if we round to Zero, we have to remove one ulp.
+ Otherwise the result is correctly rounded. */
+ if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG (a)))
+ {
+ mpfr_nexttozero (a);
+ MPFR_RET (- MPFR_INT_SIGN (a));
+ }
+ MPFR_RET (MPFR_INT_SIGN (a));
+ }
+ else
+ {
+ /* A.AAAAAAAAAAAAAA
+ = B.BBBBBBBBBBBBBBB
+ - C.CCCCCCCCCCCCC */
+ /* It isn't exact so Prec(b) > Prec(a) and the last
+ Prec(b)-Prec(a) bits of `b' are not zeros.
+ Which means that removing c from b can't generate a carry
+ execpt in case of even rounding.
+ In all other case the result and the inexact flag should be
+ correct (We can't have an exact result).
+ In case of EVEN rounding:
+ 1.BBBBBBBBBBBBBx10
+ - 1.CCCCCCCCCCCC
+ = 1.BBBBBBBBBBBBBx01 Rounded to Prec(b)
+ = 1.BBBBBBBBBBBBBx Nearest / Rounded to Prec(a)
+ Set gives:
+ 1.BBBBBBBBBBBBB0 if inexact == EVEN_INEX (x == 0)
+ 1.BBBBBBBBBBBBB1+1 if inexact == -EVEN_INEX (x == 1)
+ which means we get a wrong rounded result if x==1,
+ i.e. inexact= MPFR_EVEN_INEX */
+ if (MPFR_UNLIKELY (inexact == MPFR_EVEN_INEX*MPFR_INT_SIGN (a)))
+ {
+ mpfr_nexttozero (a);
+ inexact = -MPFR_INT_SIGN (a);
+ }
+ MPFR_RET (inexact);
+ }
+ }
+
+ diff_exp = (mpfr_uexp_t) MPFR_GET_EXP (b) - MPFR_GET_EXP (c);
+
+ /* reserve a space to store b aligned with the result, i.e. shifted by
+ (-cancel) % GMP_NUMB_BITS to the right */
+ bn = MPFR_LIMB_SIZE (b);
+ MPFR_UNSIGNED_MINUS_MODULO (shift_b, cancel);
+ cancel1 = (cancel + shift_b) / GMP_NUMB_BITS;
+
+ /* the high cancel1 limbs from b should not be taken into account */
+ if (MPFR_UNLIKELY (shift_b == 0))
+ {
+ bp = MPFR_MANT(b); /* no need of an extra space */
+ /* Ensure ap != bp */
+ if (MPFR_UNLIKELY (ap == bp))
+ {
+ bp = MPFR_TMP_LIMBS_ALLOC (bn);
+ MPN_COPY (bp, ap, bn);
+ }
+ }
+ else
+ {
+ bp = MPFR_TMP_LIMBS_ALLOC (bn + 1);
+ bp[0] = mpn_rshift (bp + 1, MPFR_MANT(b), bn++, shift_b);
+ }
+
+ /* reserve a space to store c aligned with the result, i.e. shifted by
+ (diff_exp-cancel) % GMP_NUMB_BITS to the right */
+ cn = MPFR_LIMB_SIZE(c);
+ if ((UINT_MAX % GMP_NUMB_BITS) == (GMP_NUMB_BITS-1)
+ && ((-(unsigned) 1)%GMP_NUMB_BITS > 0))
+ shift_c = ((mpfr_uexp_t) diff_exp - cancel) % GMP_NUMB_BITS;
+ else
+ {
+ shift_c = diff_exp - (cancel % GMP_NUMB_BITS);
+ shift_c = (shift_c + GMP_NUMB_BITS) % GMP_NUMB_BITS;
+ }
+ MPFR_ASSERTD( shift_c >= 0 && shift_c < GMP_NUMB_BITS);
+
+ if (MPFR_UNLIKELY(shift_c == 0))
+ {
+ cp = MPFR_MANT(c);
+ /* Ensure ap != cp */
+ if (ap == cp)
+ {
+ cp = MPFR_TMP_LIMBS_ALLOC (cn);
+ MPN_COPY(cp, ap, cn);
+ }
+ }
+ else
+ {
+ cp = MPFR_TMP_LIMBS_ALLOC (cn + 1);
+ cp[0] = mpn_rshift (cp + 1, MPFR_MANT(c), cn++, shift_c);
+ }
+
+#ifdef DEBUG
+ printf ("rnd=%s shift_b=%d shift_c=%d diffexp=%lu\n",
+ mpfr_print_rnd_mode (rnd_mode), shift_b, shift_c,
+ (unsigned long) diff_exp);
+#endif
+
+ MPFR_ASSERTD (ap != cp);
+ MPFR_ASSERTD (bp != cp);
+
+ /* here we have shift_c = (diff_exp - cancel) % GMP_NUMB_BITS,
+ 0 <= shift_c < GMP_NUMB_BITS
+ thus we want cancel2 = ceil((cancel - diff_exp) / GMP_NUMB_BITS) */
+
+ /* Possible optimization with a C99 compiler (i.e. well-defined
+ integer division): if MPFR_PREC_MAX is reduced to
+ ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1) - GMP_NUMB_BITS + 1)
+ and diff_exp is of type mpfr_exp_t (no need for mpfr_uexp_t, since
+ the sum or difference of 2 exponents must be representable, as used
+ by the multiplication code), then the computation of cancel2 could
+ be simplified to
+ cancel2 = (cancel - (diff_exp - shift_c)) / GMP_NUMB_BITS;
+ because cancel, diff_exp and shift_c are all non-negative and
+ these variables are signed. */
+
+ MPFR_ASSERTD (cancel >= 0);
+ if (cancel >= diff_exp)
+ /* Note that cancel is signed and will be converted to mpfr_uexp_t
+ (type of diff_exp) in the expression below, so that this will
+ work even if cancel is very large and diff_exp = 0. */
+ cancel2 = (cancel - diff_exp + (GMP_NUMB_BITS - 1)) / GMP_NUMB_BITS;
+ else
+ cancel2 = - (mp_size_t) ((diff_exp - cancel) / GMP_NUMB_BITS);
+ /* the high cancel2 limbs from b should not be taken into account */
+#ifdef DEBUG
+ printf ("cancel=%lu cancel1=%lu cancel2=%ld\n",
+ (unsigned long) cancel, (unsigned long) cancel1, (long) cancel2);
+#endif
+
+ /* ap[an-1] ap[0]
+ <----------------+-----------|---->
+ <----------PREC(a)----------><-sh->
+ cancel1
+ limbs bp[bn-cancel1-1]
+ <--...-----><----------------+-----------+----------->
+ cancel2
+ limbs cp[cn-cancel2-1] cancel2 >= 0
+ <--...--><----------------+----------------+---------------->
+ (-cancel2) cancel2 < 0
+ limbs <----------------+---------------->
+ */
+
+ /* first part: put in ap[0..an-1] the value of high(b) - high(c),
+ where high(b) consists of the high an+cancel1 limbs of b,
+ and high(c) consists of the high an+cancel2 limbs of c.
+ */
+
+ /* copy high(b) into a */
+ if (MPFR_LIKELY(an + (mp_size_t) cancel1 <= bn))
+ /* a: <----------------+-----------|---->
+ b: <-----------------------------------------> */
+ MPN_COPY (ap, bp + bn - (an + cancel1), an);
+ else
+ /* a: <----------------+-----------|---->
+ b: <-------------------------> */
+ if ((mp_size_t) cancel1 < bn) /* otherwise b does not overlap with a */
+ {
+ MPN_ZERO (ap, an + cancel1 - bn);
+ MPN_COPY (ap + (an + cancel1 - bn), bp, bn - cancel1);
+ }
+ else
+ MPN_ZERO (ap, an);
+
+#ifdef DEBUG
+ printf("after copying high(b), a="); mpfr_print_binary(a); putchar('\n');
+#endif
+
+ /* subtract high(c) */
+ if (MPFR_LIKELY(an + cancel2 > 0)) /* otherwise c does not overlap with a */
+ {
+ mp_limb_t *ap2;
+
+ if (cancel2 >= 0)
+ {
+ if (an + cancel2 <= cn)
+ /* a: <----------------------------->
+ c: <-----------------------------------------> */
+ mpn_sub_n (ap, ap, cp + cn - (an + cancel2), an);
+ else
+ /* a: <---------------------------->
+ c: <-------------------------> */
+ {
+ ap2 = ap + an + (cancel2 - cn);
+ if (cn > cancel2)
+ mpn_sub_n (ap2, ap2, cp, cn - cancel2);
+ }
+ }
+ else /* cancel2 < 0 */
+ {
+ mp_limb_t borrow;
+
+ if (an + cancel2 <= cn)
+ /* a: <----------------------------->
+ c: <-----------------------------> */
+ borrow = mpn_sub_n (ap, ap, cp + cn - (an + cancel2),
+ an + cancel2);
+ else
+ /* a: <---------------------------->
+ c: <----------------> */
+ {
+ ap2 = ap + an + cancel2 - cn;
+ borrow = mpn_sub_n (ap2, ap2, cp, cn);
+ }
+ ap2 = ap + an + cancel2;
+ mpn_sub_1 (ap2, ap2, -cancel2, borrow);
+ }
+ }
+
+#ifdef DEBUG
+ printf("after subtracting high(c), a=");
+ mpfr_print_binary(a);
+ putchar('\n');
+#endif
+
+ /* now perform rounding */
+ sh = (mpfr_prec_t) an * GMP_NUMB_BITS - MPFR_PREC(a);
+ /* last unused bits from a */
+ carry = ap[0] & MPFR_LIMB_MASK (sh);
+ ap[0] -= carry;
+
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ if (MPFR_LIKELY(sh))
+ {
+ /* can decide except when carry = 2^(sh-1) [middle]
+ or carry = 0 [truncate, but cannot decide inexact flag] */
+ if (carry > (MPFR_LIMB_ONE << (sh - 1)))
+ goto add_one_ulp;
+ else if ((0 < carry) && (carry < (MPFR_LIMB_ONE << (sh - 1))))
+ {
+ inexact = -1; /* result if smaller than exact value */
+ goto truncate;
+ }
+ /* now carry = 2^(sh-1), in which case cmp_low=2,
+ or carry = 0, in which case cmp_low=0 */
+ cmp_low = (carry == 0) ? 0 : 2;
+ }
+ }
+ else /* directed rounding: set rnd_mode to RNDZ iff toward zero */
+ {
+ if (MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd_mode, MPFR_IS_NEG(a)))
+ rnd_mode = MPFR_RNDZ;
+
+ if (carry)
+ {
+ if (rnd_mode == MPFR_RNDZ)
+ {
+ inexact = -1;
+ goto truncate;
+ }
+ else /* round away */
+ goto add_one_ulp;
+ }
+ }
+
+ /* we have to consider the low (bn - (an+cancel1)) limbs from b,
+ and the (cn - (an+cancel2)) limbs from c. */
+ bn -= an + cancel1;
+ cn0 = cn;
+ cn -= an + cancel2;
+
+#ifdef DEBUG
+ printf ("last sh=%d bits from a are %lu, bn=%ld, cn=%ld\n",
+ sh, (unsigned long) carry, (long) bn, (long) cn);
+#endif
+
+ /* for rounding to nearest, we couldn't conclude up to here in the following
+ cases:
+ 1. sh = 0, then cmp_low=0: we can either truncate, subtract one ulp
+ or add one ulp: -1 ulp < low(b)-low(c) < 1 ulp
+ 2. sh > 0 but the low sh bits from high(b)-high(c) equal 2^(sh-1):
+ -0.5 ulp <= -1/2^sh < low(b)-low(c)-0.5 < 1/2^sh <= 0.5 ulp
+ we can't decide the rounding, in that case cmp_low=2:
+ either we truncate and flag=-1, or we add one ulp and flag=1
+ 3. the low sh>0 bits from high(b)-high(c) equal 0: we know we have to
+ truncate but we can't decide the ternary value, here cmp_low=0:
+ -0.5 ulp <= -1/2^sh < low(b)-low(c) < 1/2^sh <= 0.5 ulp
+ we always truncate and inexact can be any of -1,0,1
+ */
+
+ /* note: here cn might exceed cn0, in which case we consider a zero limb */
+ for (k = 0; (bn > 0) || (cn > 0); k = 1)
+ {
+ /* if cmp_low < 0, we know low(b) - low(c) < 0
+ if cmp_low > 0, we know low(b) - low(c) > 0
+ (more precisely if cmp_low = 2, low(b) - low(c) = 0.5 ulp so far)
+ if cmp_low = 0, so far low(b) - low(c) = 0 */
+
+ /* get next limbs */
+ bb = (bn > 0) ? bp[--bn] : 0;
+ if ((cn > 0) && (cn-- <= cn0))
+ cc = cp[cn];
+ else
+ cc = 0;
+
+ /* cmp_low compares low(b) and low(c) */
+ if (cmp_low == 0) /* case 1 or 3 */
+ cmp_low = (bb < cc) ? -2+k : (bb > cc) ? 1 : 0;
+
+ /* Case 1 for k=0 splits into 7 subcases:
+ 1a: bb > cc + half
+ 1b: bb = cc + half
+ 1c: 0 < bb - cc < half
+ 1d: bb = cc
+ 1e: -half < bb - cc < 0
+ 1f: bb - cc = -half
+ 1g: bb - cc < -half
+
+ Case 2 splits into 3 subcases:
+ 2a: bb > cc
+ 2b: bb = cc
+ 2c: bb < cc
+
+ Case 3 splits into 3 subcases:
+ 3a: bb > cc
+ 3b: bb = cc
+ 3c: bb < cc
+ */
+
+ /* the case rounding to nearest with sh=0 is special since one couldn't
+ subtract above 1/2 ulp in the trailing limb of the result */
+ if (rnd_mode == MPFR_RNDN && sh == 0 && k == 0) /* case 1 for k=0 */
+ {
+ mp_limb_t half = MPFR_LIMB_HIGHBIT;
+
+ /* add one ulp if bb > cc + half
+ truncate if cc - half < bb < cc + half
+ sub one ulp if bb < cc - half
+ */
+
+ if (cmp_low < 0) /* bb < cc: -1 ulp < low(b) - low(c) < 0,
+ cases 1e, 1f and 1g */
+ {
+ if (cc >= half)
+ cc -= half;
+ else /* since bb < cc < half, bb+half < 2*half */
+ bb += half;
+ /* now we have bb < cc + half:
+ we have to subtract one ulp if bb < cc,
+ and truncate if bb > cc */
+ }
+ else if (cmp_low >= 0) /* bb >= cc, cases 1a to 1d */
+ {
+ if (cc < half)
+ cc += half;
+ else /* since bb >= cc >= half, bb - half >= 0 */
+ bb -= half;
+ /* now we have bb > cc - half: we have to add one ulp if bb > cc,
+ and truncate if bb < cc */
+ if (cmp_low > 0)
+ cmp_low = 2;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("k=%u bb=%lu cc=%lu cmp_low=%d\n", k,
+ (unsigned long) bb, (unsigned long) cc, cmp_low);
+#endif
+ if (cmp_low < 0) /* low(b) - low(c) < 0: either truncate or subtract
+ one ulp */
+ {
+ if (rnd_mode == MPFR_RNDZ)
+ goto sub_one_ulp; /* set inexact=-1 */
+ else if (rnd_mode != MPFR_RNDN) /* round away */
+ {
+ inexact = 1;
+ goto truncate;
+ }
+ else /* round to nearest */
+ {
+ /* If cmp_low < 0 and bb > cc, then -0.5 ulp < low(b)-low(c) < 0,
+ whatever the value of sh.
+ If sh>0, then cmp_low < 0 implies that the initial neglected
+ sh bits were 0 (otherwise cmp_low=2 initially), thus the
+ weight of the new bits is less than 0.5 ulp too.
+ If k > 0 (and sh=0) this means that either the first neglected
+ limbs bb and cc were equal (thus cmp_low was 0 for k=0),
+ or we had bb - cc = -0.5 ulp or 0.5 ulp.
+ The last case is not possible here since we would have
+ cmp_low > 0 which is sticky.
+ In the first case (where we have cmp_low = -1), we truncate,
+ whereas in the 2nd case we have cmp_low = -2 and we subtract
+ one ulp.
+ */
+ if (bb > cc || sh > 0 || cmp_low == -1)
+ { /* -0.5 ulp < low(b)-low(c) < 0,
+ bb > cc corresponds to cases 1e and 1f1
+ sh > 0 corresponds to cases 3c and 3b3
+ cmp_low = -1 corresponds to case 1d3 (also 3b3) */
+ inexact = 1;
+ goto truncate;
+ }
+ else if (bb < cc) /* here sh = 0 and low(b)-low(c) < -0.5 ulp,
+ this corresponds to cases 1g and 1f3 */
+ goto sub_one_ulp;
+ /* the only case where we can't conclude is sh=0 and bb=cc,
+ i.e., we have low(b) - low(c) = -0.5 ulp (up to now), thus
+ we don't know if we must truncate or subtract one ulp.
+ Note: for sh=0 we can't have low(b) - low(c) = -0.5 ulp up to
+ now, since low(b) - low(c) > 1/2^sh */
+ }
+ }
+ else if (cmp_low > 0) /* 0 < low(b) - low(c): either truncate or
+ add one ulp */
+ {
+ if (rnd_mode == MPFR_RNDZ)
+ {
+ inexact = -1;
+ goto truncate;
+ }
+ else if (rnd_mode != MPFR_RNDN) /* round away */
+ goto add_one_ulp;
+ else /* round to nearest */
+ {
+ if (bb > cc)
+ {
+ /* if sh=0, then bb>cc means that low(b)-low(c) > 0.5 ulp,
+ and similarly when cmp_low=2 */
+ if (cmp_low == 2) /* cases 1a, 1b1, 2a and 2b1 */
+ goto add_one_ulp;
+ /* sh > 0 and cmp_low > 0: this implies that the sh initial
+ neglected bits were 0, and the remaining low(b)-low(c)>0,
+ but its weight is less than 0.5 ulp */
+ else /* 0 < low(b) - low(c) < 0.5 ulp, this corresponds to
+ cases 3a, 1d1 and 3b1 */
+ {
+ inexact = -1;
+ goto truncate;
+ }
+ }
+ else if (bb < cc) /* 0 < low(b) - low(c) < 0.5 ulp, cases 1c,
+ 1b3, 2b3 and 2c */
+ {
+ inexact = -1;
+ goto truncate;
+ }
+ /* the only case where we can't conclude is bb=cc, i.e.,
+ low(b) - low(c) = 0.5 ulp (up to now), thus we don't know
+ if we must truncate or add one ulp. */
+ }
+ }
+ /* after k=0, we cannot conclude in the following cases, we split them
+ according to the values of bb and cc for k=1:
+ 1b. sh=0 and cmp_low = 1 and bb-cc = half [around 0.5 ulp]
+ 1b1. bb > cc: add one ulp, inex = 1
+ 1b2: bb = cc: cannot conclude
+ 1b3: bb < cc: truncate, inex = -1
+ 1d. sh=0 and cmp_low = 0 and bb-cc = 0 [around 0]
+ 1d1: bb > cc: truncate, inex = -1
+ 1d2: bb = cc: cannot conclude
+ 1d3: bb < cc: truncate, inex = +1
+ 1f. sh=0 and cmp_low = -1 and bb-cc = -half [around -0.5 ulp]
+ 1f1: bb > cc: truncate, inex = +1
+ 1f2: bb = cc: cannot conclude
+ 1f3: bb < cc: sub one ulp, inex = -1
+ 2b. sh > 0 and cmp_low = 2 and bb=cc [around 0.5 ulp]
+ 2b1. bb > cc: add one ulp, inex = 1
+ 2b2: bb = cc: cannot conclude
+ 2b3: bb < cc: truncate, inex = -1
+ 3b. sh > 0 and cmp_low = 0 [around 0]
+ 3b1. bb > cc: truncate, inex = -1
+ 3b2: bb = cc: cannot conclude
+ 3b3: bb < cc: truncate, inex = +1
+ */
+ }
+
+ if ((rnd_mode == MPFR_RNDN) && cmp_low != 0)
+ {
+ /* even rounding rule */
+ if ((ap[0] >> sh) & 1)
+ {
+ if (cmp_low < 0)
+ goto sub_one_ulp;
+ else
+ goto add_one_ulp;
+ }
+ else
+ inexact = (cmp_low > 0) ? -1 : 1;
+ }
+ else
+ inexact = 0;
+ goto truncate;
+
+ sub_one_ulp: /* sub one unit in last place to a */
+ mpn_sub_1 (ap, ap, an, MPFR_LIMB_ONE << sh);
+ inexact = -1;
+ goto end_of_sub;
+
+ add_one_ulp: /* add one unit in last place to a */
+ if (MPFR_UNLIKELY(mpn_add_1 (ap, ap, an, MPFR_LIMB_ONE << sh)))
+ /* result is a power of 2: 11111111111111 + 1 = 1000000000000000 */
+ {
+ ap[an-1] = MPFR_LIMB_HIGHBIT;
+ add_exp = 1;
+ }
+ inexact = 1; /* result larger than exact value */
+
+ truncate:
+ if (MPFR_UNLIKELY((ap[an-1] >> (GMP_NUMB_BITS - 1)) == 0))
+ /* case 1 - epsilon */
+ {
+ ap[an-1] = MPFR_LIMB_HIGHBIT;
+ add_exp = 1;
+ }
+
+ end_of_sub:
+ /* we have to set MPFR_EXP(a) to MPFR_EXP(b) - cancel + add_exp, taking
+ care of underflows/overflows in that computation, and of the allowed
+ exponent range */
+ if (MPFR_LIKELY(cancel))
+ {
+ mpfr_exp_t exp_a;
+
+ cancel -= add_exp; /* OK: add_exp is an int equal to 0 or 1 */
+ exp_a = MPFR_GET_EXP (b) - cancel;
+ if (MPFR_UNLIKELY(exp_a < __gmpfr_emin))
+ {
+ MPFR_TMP_FREE(marker);
+ if (rnd_mode == MPFR_RNDN &&
+ (exp_a < __gmpfr_emin - 1 ||
+ (inexact >= 0 && mpfr_powerof2_raw (a))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a));
+ }
+ MPFR_SET_EXP (a, exp_a);
+ }
+ else /* cancel = 0: MPFR_EXP(a) <- MPFR_EXP(b) + add_exp */
+ {
+ /* in case cancel = 0, add_exp can still be 1, in case b is just
+ below a power of two, c is very small, prec(a) < prec(b),
+ and rnd=away or nearest */
+ mpfr_exp_t exp_b;
+
+ exp_b = MPFR_GET_EXP (b);
+ if (MPFR_UNLIKELY(add_exp && exp_b == __gmpfr_emax))
+ {
+ MPFR_TMP_FREE(marker);
+ return mpfr_overflow (a, rnd_mode, MPFR_SIGN(a));
+ }
+ MPFR_SET_EXP (a, exp_b + add_exp);
+ }
+ MPFR_TMP_FREE(marker);
+#ifdef DEBUG
+ printf ("result is a="); mpfr_print_binary(a); putchar('\n');
+#endif
+ /* check that result is msb-normalized */
+ MPFR_ASSERTD(ap[an-1] > ~ap[an-1]);
+ MPFR_RET (inexact * MPFR_INT_SIGN (a));
+}
diff --git a/src/sub1sp.c b/src/sub1sp.c
new file mode 100644
index 0000000..0741734
--- /dev/null
+++ b/src/sub1sp.c
@@ -0,0 +1,810 @@
+/* mpfr_sub1sp -- internal function to perform a "real" substraction
+ All the op must have the same precision
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* Check if we have to check the result of mpfr_sub1sp with mpfr_sub1 */
+#ifdef WANT_ASSERT
+# if WANT_ASSERT >= 2
+
+int mpfr_sub1sp2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode);
+int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmpa, tmpb, tmpc;
+ int inexb, inexc, inexact, inexact2;
+
+ mpfr_init2 (tmpa, MPFR_PREC (a));
+ mpfr_init2 (tmpb, MPFR_PREC (b));
+ mpfr_init2 (tmpc, MPFR_PREC (c));
+
+ inexb = mpfr_set (tmpb, b, MPFR_RNDN);
+ MPFR_ASSERTN (inexb == 0);
+
+ inexc = mpfr_set (tmpc, c, MPFR_RNDN);
+ MPFR_ASSERTN (inexc == 0);
+
+ inexact2 = mpfr_sub1 (tmpa, tmpb, tmpc, rnd_mode);
+ inexact = mpfr_sub1sp2(a, b, c, rnd_mode);
+
+ if (mpfr_cmp (tmpa, a) || inexact != inexact2)
+ {
+ fprintf (stderr, "sub1 & sub1sp return different values for %s\n"
+ "Prec_a = %lu, Prec_b = %lu, Prec_c = %lu\nB = ",
+ mpfr_print_rnd_mode (rnd_mode), (unsigned long) MPFR_PREC (a),
+ (unsigned long) MPFR_PREC (b), (unsigned long) MPFR_PREC (c));
+ mpfr_fprint_binary (stderr, tmpb);
+ fprintf (stderr, "\nC = ");
+ mpfr_fprint_binary (stderr, tmpc);
+ fprintf (stderr, "\nSub1 : ");
+ mpfr_fprint_binary (stderr, tmpa);
+ fprintf (stderr, "\nSub1sp: ");
+ mpfr_fprint_binary (stderr, a);
+ fprintf (stderr, "\nInexact sp = %d | Inexact = %d\n",
+ inexact, inexact2);
+ MPFR_ASSERTN (0);
+ }
+ mpfr_clears (tmpa, tmpb, tmpc, (mpfr_ptr) 0);
+ return inexact;
+}
+# define mpfr_sub1sp mpfr_sub1sp2
+# endif
+#endif
+
+/* Debugging support */
+#ifdef DEBUG
+# undef DEBUG
+# define DEBUG(x) (x)
+#else
+# define DEBUG(x) /**/
+#endif
+
+/* Rounding Sub */
+
+/*
+ compute sgn(b)*(|b| - |c|) if |b|>|c| else -sgn(b)*(|c| -|b|)
+ Returns 0 iff result is exact,
+ a negative value when the result is less than the exact value,
+ a positive value otherwise.
+*/
+
+/* A0...Ap-1
+ * Cp Cp+1 ....
+ * <- C'p+1 ->
+ * Cp = -1 if calculated from c mantissa
+ * Cp = 0 if 0 from a or c
+ * Cp = 1 if calculated from a.
+ * C'p+1 = First bit not null or 0 if there isn't one
+ *
+ * Can't have Cp=-1 and C'p+1=1*/
+
+/* RND = MPFR_RNDZ:
+ * + if Cp=0 and C'p+1=0,1, Truncate.
+ * + if Cp=0 and C'p+1=-1, SubOneUlp
+ * + if Cp=-1, SubOneUlp
+ * + if Cp=1, AddOneUlp
+ * RND = MPFR_RNDA (Away)
+ * + if Cp=0 and C'p+1=0,-1, Truncate
+ * + if Cp=0 and C'p+1=1, AddOneUlp
+ * + if Cp=1, AddOneUlp
+ * + if Cp=-1, Truncate
+ * RND = MPFR_RNDN
+ * + if Cp=0, Truncate
+ * + if Cp=1 and C'p+1=1, AddOneUlp
+ * + if Cp=1 and C'p+1=-1, Truncate
+ * + if Cp=1 and C'p+1=0, Truncate if Ap-1=0, AddOneUlp else
+ * + if Cp=-1 and C'p+1=-1, SubOneUlp
+ * + if Cp=-1 and C'p+1=0, Truncate if Ap-1=0, SubOneUlp else
+ *
+ * If AddOneUlp:
+ * If carry, then it is 11111111111 + 1 = 10000000000000
+ * ap[n-1]=MPFR_HIGHT_BIT
+ * If SubOneUlp:
+ * If we lose one bit, it is 1000000000 - 1 = 0111111111111
+ * Then shift, and put as last bit x which is calculated
+ * according Cp, Cp-1 and rnd_mode.
+ * If Truncate,
+ * If it is a power of 2,
+ * we may have to suboneulp in some special cases.
+ *
+ * To simplify, we don't use Cp = 1.
+ *
+ */
+
+int
+mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_exp_t bx,cx;
+ mpfr_uexp_t d;
+ mpfr_prec_t p, sh, cnt;
+ mp_size_t n;
+ mp_limb_t *ap, *bp, *cp;
+ mp_limb_t limb;
+ int inexact;
+ mp_limb_t bcp,bcp1; /* Cp and C'p+1 */
+ mp_limb_t bbcp = (mp_limb_t) -1, bbcp1 = (mp_limb_t) -1; /* Cp+1 and C'p+2,
+ gcc claims that they might be used uninitialized. We fill them with invalid
+ values, which should produce a failure if so. See README.dev file. */
+
+ MPFR_TMP_DECL(marker);
+
+ MPFR_TMP_MARK(marker);
+
+ MPFR_ASSERTD(MPFR_PREC(a) == MPFR_PREC(b) && MPFR_PREC(b) == MPFR_PREC(c));
+ MPFR_ASSERTD(MPFR_IS_PURE_FP(b));
+ MPFR_ASSERTD(MPFR_IS_PURE_FP(c));
+
+ /* Read prec and num of limbs */
+ p = MPFR_PREC (b);
+ n = MPFR_PREC2LIMBS (p);
+
+ /* Fast cmp of |b| and |c|*/
+ bx = MPFR_GET_EXP (b);
+ cx = MPFR_GET_EXP (c);
+ if (MPFR_UNLIKELY(bx == cx))
+ {
+ mp_size_t k = n - 1;
+ /* Check mantissa since exponent are equals */
+ bp = MPFR_MANT(b);
+ cp = MPFR_MANT(c);
+ while (k>=0 && MPFR_UNLIKELY(bp[k] == cp[k]))
+ k--;
+ if (MPFR_UNLIKELY(k < 0))
+ /* b == c ! */
+ {
+ /* Return exact number 0 */
+ if (rnd_mode == MPFR_RNDD)
+ MPFR_SET_NEG(a);
+ else
+ MPFR_SET_POS(a);
+ MPFR_SET_ZERO(a);
+ MPFR_RET(0);
+ }
+ else if (bp[k] > cp[k])
+ goto BGreater;
+ else
+ {
+ MPFR_ASSERTD(bp[k]<cp[k]);
+ goto CGreater;
+ }
+ }
+ else if (MPFR_UNLIKELY(bx < cx))
+ {
+ /* Swap b and c and set sign */
+ mpfr_srcptr t;
+ mpfr_exp_t tx;
+ CGreater:
+ MPFR_SET_OPPOSITE_SIGN(a,b);
+ t = b; b = c; c = t;
+ tx = bx; bx = cx; cx = tx;
+ }
+ else
+ {
+ /* b > c */
+ BGreater:
+ MPFR_SET_SAME_SIGN(a,b);
+ }
+
+ /* Now b > c */
+ MPFR_ASSERTD(bx >= cx);
+ d = (mpfr_uexp_t) bx - cx;
+ DEBUG (printf ("New with diff=%lu\n", (unsigned long) d));
+
+ if (MPFR_UNLIKELY(d <= 1))
+ {
+ if (MPFR_LIKELY(d < 1))
+ {
+ /* <-- b -->
+ <-- c --> : exact sub */
+ ap = MPFR_MANT(a);
+ mpn_sub_n (ap, MPFR_MANT(b), MPFR_MANT(c), n);
+ /* Normalize */
+ ExactNormalize:
+ limb = ap[n-1];
+ if (MPFR_LIKELY(limb))
+ {
+ /* First limb is not zero. */
+ count_leading_zeros(cnt, limb);
+ /* cnt could be == 0 <= SubD1Lose */
+ if (MPFR_LIKELY(cnt))
+ {
+ mpn_lshift(ap, ap, n, cnt); /* Normalize number */
+ bx -= cnt; /* Update final expo */
+ }
+ /* Last limb should be ok */
+ MPFR_ASSERTD(!(ap[0] & MPFR_LIMB_MASK((unsigned int) (-p)
+ % GMP_NUMB_BITS)));
+ }
+ else
+ {
+ /* First limb is zero */
+ mp_size_t k = n-1, len;
+ /* Find the first limb not equal to zero.
+ FIXME:It is assume it exists (since |b| > |c| and same prec)*/
+ do
+ {
+ MPFR_ASSERTD( k > 0 );
+ limb = ap[--k];
+ }
+ while (limb == 0);
+ MPFR_ASSERTD(limb != 0);
+ count_leading_zeros(cnt, limb);
+ k++;
+ len = n - k; /* Number of last limb */
+ MPFR_ASSERTD(k >= 0);
+ if (MPFR_LIKELY(cnt))
+ mpn_lshift(ap+len, ap, k, cnt); /* Normalize the High Limb*/
+ else
+ {
+ /* Must use DECR since src and dest may overlap & dest>=src*/
+ MPN_COPY_DECR(ap+len, ap, k);
+ }
+ MPN_ZERO(ap, len); /* Zeroing the last limbs */
+ bx -= cnt + len*GMP_NUMB_BITS; /* Update Expo */
+ /* Last limb should be ok */
+ MPFR_ASSERTD(!(ap[len]&MPFR_LIMB_MASK((unsigned int) (-p)
+ % GMP_NUMB_BITS)));
+ }
+ /* Check expo underflow */
+ if (MPFR_UNLIKELY(bx < __gmpfr_emin))
+ {
+ MPFR_TMP_FREE(marker);
+ /* inexact=0 */
+ DEBUG( printf("(D==0 Underflow)\n") );
+ if (rnd_mode == MPFR_RNDN &&
+ (bx < __gmpfr_emin - 1 ||
+ (/*inexact >= 0 &&*/ mpfr_powerof2_raw (a))))
+ rnd_mode = MPFR_RNDZ;
+ return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a));
+ }
+ MPFR_SET_EXP (a, bx);
+ /* No rounding is necessary since the result is exact */
+ MPFR_ASSERTD(ap[n-1] > ~ap[n-1]);
+ MPFR_TMP_FREE(marker);
+ return 0;
+ }
+ else /* if (d == 1) */
+ {
+ /* | <-- b -->
+ | <-- c --> */
+ mp_limb_t c0, mask;
+ mp_size_t k;
+ MPFR_UNSIGNED_MINUS_MODULO(sh, p);
+ /* If we lose at least one bit, compute 2*b-c (Exact)
+ * else compute b-c/2 */
+ bp = MPFR_MANT(b);
+ cp = MPFR_MANT(c);
+ k = n-1;
+ limb = bp[k] - cp[k]/2;
+ if (limb > MPFR_LIMB_HIGHBIT)
+ {
+ /* We can't lose precision: compute b-c/2 */
+ /* Shift c in the allocated temporary block */
+ SubD1NoLose:
+ c0 = cp[0] & (MPFR_LIMB_ONE<<sh);
+ cp = MPFR_TMP_LIMBS_ALLOC (n);
+ mpn_rshift(cp, MPFR_MANT(c), n, 1);
+ if (MPFR_LIKELY(c0 == 0))
+ {
+ /* Result is exact: no need of rounding! */
+ ap = MPFR_MANT(a);
+ mpn_sub_n (ap, bp, cp, n);
+ MPFR_SET_EXP(a, bx); /* No expo overflow! */
+ /* No truncate or normalize is needed */
+ MPFR_ASSERTD(ap[n-1] > ~ap[n-1]);
+ /* No rounding is necessary since the result is exact */
+ MPFR_TMP_FREE(marker);
+ return 0;
+ }
+ ap = MPFR_MANT(a);
+ mask = ~MPFR_LIMB_MASK(sh);
+ cp[0] &= mask; /* Delete last bit of c */
+ mpn_sub_n (ap, bp, cp, n);
+ MPFR_SET_EXP(a, bx); /* No expo overflow! */
+ MPFR_ASSERTD( !(ap[0] & ~mask) ); /* Check last bits */
+ /* No normalize is needed */
+ MPFR_ASSERTD(ap[n-1] > ~ap[n-1]);
+ /* Rounding is necessary since c0 = 1*/
+ /* Cp =-1 and C'p+1=0 */
+ bcp = 1; bcp1 = 0;
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ /* Even Rule apply: Check Ap-1 */
+ if (MPFR_LIKELY( (ap[0] & (MPFR_LIMB_ONE<<sh)) == 0) )
+ goto truncate;
+ else
+ goto sub_one_ulp;
+ }
+ MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
+ if (rnd_mode == MPFR_RNDZ)
+ goto sub_one_ulp;
+ else
+ goto truncate;
+ }
+ else if (MPFR_LIKELY(limb < MPFR_LIMB_HIGHBIT))
+ {
+ /* We lose at least one bit of prec */
+ /* Calcul of 2*b-c (Exact) */
+ /* Shift b in the allocated temporary block */
+ SubD1Lose:
+ bp = MPFR_TMP_LIMBS_ALLOC (n);
+ mpn_lshift (bp, MPFR_MANT(b), n, 1);
+ ap = MPFR_MANT(a);
+ mpn_sub_n (ap, bp, cp, n);
+ bx--;
+ goto ExactNormalize;
+ }
+ else
+ {
+ /* Case: limb = 100000000000 */
+ /* Check while b[k] == c'[k] (C' is C shifted by 1) */
+ /* If b[k]<c'[k] => We lose at least one bit*/
+ /* If b[k]>c'[k] => We don't lose any bit */
+ /* If k==-1 => We don't lose any bit
+ AND the result is 100000000000 0000000000 00000000000 */
+ mp_limb_t carry;
+ do {
+ carry = cp[k]&MPFR_LIMB_ONE;
+ k--;
+ } while (k>=0 &&
+ bp[k]==(carry=cp[k]/2+(carry<<(GMP_NUMB_BITS-1))));
+ if (MPFR_UNLIKELY(k<0))
+ {
+ /*If carry then (sh==0 and Virtual c'[-1] > Virtual b[-1]) */
+ if (MPFR_UNLIKELY(carry)) /* carry = cp[0]&MPFR_LIMB_ONE */
+ {
+ /* FIXME: Can be faster? */
+ MPFR_ASSERTD(sh == 0);
+ goto SubD1Lose;
+ }
+ /* Result is a power of 2 */
+ ap = MPFR_MANT (a);
+ MPN_ZERO (ap, n);
+ ap[n-1] = MPFR_LIMB_HIGHBIT;
+ MPFR_SET_EXP (a, bx); /* No expo overflow! */
+ /* No Normalize is needed*/
+ /* No Rounding is needed */
+ MPFR_TMP_FREE (marker);
+ return 0;
+ }
+ /* carry = cp[k]/2+(cp[k-1]&1)<<(GMP_NUMB_BITS-1) = c'[k]*/
+ else if (bp[k] > carry)
+ goto SubD1NoLose;
+ else
+ {
+ MPFR_ASSERTD(bp[k]<carry);
+ goto SubD1Lose;
+ }
+ }
+ }
+ }
+ else if (MPFR_UNLIKELY(d >= p))
+ {
+ ap = MPFR_MANT(a);
+ MPFR_UNSIGNED_MINUS_MODULO(sh, p);
+ /* We can't set A before since we use cp for rounding... */
+ /* Perform rounding: check if a=b or a=b-ulp(b) */
+ if (MPFR_UNLIKELY(d == p))
+ {
+ /* cp == -1 and c'p+1 = ? */
+ bcp = 1;
+ /* We need Cp+1 later for a very improbable case. */
+ bbcp = (MPFR_MANT(c)[n-1] & (MPFR_LIMB_ONE<<(GMP_NUMB_BITS-2)));
+ /* We need also C'p+1 for an even more unprobable case... */
+ if (MPFR_LIKELY( bbcp ))
+ bcp1 = 1;
+ else
+ {
+ cp = MPFR_MANT(c);
+ if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT))
+ {
+ mp_size_t k = n-1;
+ do {
+ k--;
+ } while (k>=0 && cp[k]==0);
+ bcp1 = (k>=0);
+ }
+ else
+ bcp1 = 1;
+ }
+ DEBUG( printf("(D=P) Cp=-1 Cp+1=%d C'p+1=%d \n", bbcp!=0, bcp1!=0) );
+ bp = MPFR_MANT (b);
+
+ /* Even if src and dest overlap, it is ok using MPN_COPY */
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ if (MPFR_UNLIKELY( bcp && bcp1==0 ))
+ /* Cp=-1 and C'p+1=0: Even rule Apply! */
+ /* Check Ap-1 = Bp-1 */
+ if ((bp[0] & (MPFR_LIMB_ONE<<sh)) == 0)
+ {
+ MPN_COPY(ap, bp, n);
+ goto truncate;
+ }
+ MPN_COPY(ap, bp, n);
+ goto sub_one_ulp;
+ }
+ MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
+ if (rnd_mode == MPFR_RNDZ)
+ {
+ MPN_COPY(ap, bp, n);
+ goto sub_one_ulp;
+ }
+ else
+ {
+ MPN_COPY(ap, bp, n);
+ goto truncate;
+ }
+ }
+ else
+ {
+ /* Cp=0, Cp+1=-1 if d==p+1, C'p+1=-1 */
+ bcp = 0; bbcp = (d==p+1); bcp1 = 1;
+ DEBUG( printf("(D>P) Cp=%d Cp+1=%d C'p+1=%d\n", bcp!=0,bbcp!=0,bcp1!=0) );
+ /* Need to compute C'p+2 if d==p+1 and if rnd_mode=NEAREST
+ (Because of a very improbable case) */
+ if (MPFR_UNLIKELY(d==p+1 && rnd_mode==MPFR_RNDN))
+ {
+ cp = MPFR_MANT(c);
+ if (MPFR_UNLIKELY(cp[n-1] == MPFR_LIMB_HIGHBIT))
+ {
+ mp_size_t k = n-1;
+ do {
+ k--;
+ } while (k>=0 && cp[k]==0);
+ bbcp1 = (k>=0);
+ }
+ else
+ bbcp1 = 1;
+ DEBUG( printf("(D>P) C'p+2=%d\n", bbcp1!=0) );
+ }
+ /* Copy mantissa B in A */
+ MPN_COPY(ap, MPFR_MANT(b), n);
+ /* Round */
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ goto truncate;
+ MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
+ if (rnd_mode == MPFR_RNDZ)
+ goto sub_one_ulp;
+ else /* rnd_mode = AWAY */
+ goto truncate;
+ }
+ }
+ else
+ {
+ mpfr_uexp_t dm;
+ mp_size_t m;
+ mp_limb_t mask;
+
+ /* General case: 2 <= d < p */
+ MPFR_UNSIGNED_MINUS_MODULO(sh, p);
+ cp = MPFR_TMP_LIMBS_ALLOC (n);
+
+ /* Shift c in temporary allocated place */
+ dm = d % GMP_NUMB_BITS;
+ m = d / GMP_NUMB_BITS;
+ if (MPFR_UNLIKELY(dm == 0))
+ {
+ /* dm = 0 and m > 0: Just copy */
+ MPFR_ASSERTD(m!=0);
+ MPN_COPY(cp, MPFR_MANT(c)+m, n-m);
+ MPN_ZERO(cp+n-m, m);
+ }
+ else if (MPFR_LIKELY(m == 0))
+ {
+ /* dm >=2 and m == 0: just shift */
+ MPFR_ASSERTD(dm >= 2);
+ mpn_rshift(cp, MPFR_MANT(c), n, dm);
+ }
+ else
+ {
+ /* dm > 0 and m > 0: shift and zero */
+ mpn_rshift(cp, MPFR_MANT(c)+m, n-m, dm);
+ MPN_ZERO(cp+n-m, m);
+ }
+
+ DEBUG( mpfr_print_mant_binary("Before", MPFR_MANT(c), p) );
+ DEBUG( mpfr_print_mant_binary("B= ", MPFR_MANT(b), p) );
+ DEBUG( mpfr_print_mant_binary("After ", cp, p) );
+
+ /* Compute bcp=Cp and bcp1=C'p+1 */
+ if (MPFR_LIKELY(sh))
+ {
+ /* Try to compute them from C' rather than C (FIXME: Faster?) */
+ bcp = (cp[0] & (MPFR_LIMB_ONE<<(sh-1))) ;
+ if (MPFR_LIKELY( cp[0] & MPFR_LIMB_MASK(sh-1) ))
+ bcp1 = 1;
+ else
+ {
+ /* We can't compute C'p+1 from C'. Compute it from C */
+ /* Start from bit x=p-d+sh in mantissa C
+ (+sh since we have already looked sh bits in C'!) */
+ mpfr_prec_t x = p-d+sh-1;
+ if (MPFR_LIKELY(x>p))
+ /* We are already looked at all the bits of c, so C'p+1 = 0*/
+ bcp1 = 0;
+ else
+ {
+ mp_limb_t *tp = MPFR_MANT(c);
+ mp_size_t kx = n-1 - (x / GMP_NUMB_BITS);
+ mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS);
+ DEBUG (printf ("(First) x=%lu Kx=%ld Sx=%lu\n",
+ (unsigned long) x, (long) kx,
+ (unsigned long) sx));
+ /* Looks at the last bits of limb kx (if sx=0 does nothing)*/
+ if (tp[kx] & MPFR_LIMB_MASK(sx))
+ bcp1 = 1;
+ else
+ {
+ /*kx += (sx==0);*/
+ /*If sx==0, tp[kx] hasn't been checked*/
+ do {
+ kx--;
+ } while (kx>=0 && tp[kx]==0);
+ bcp1 = (kx >= 0);
+ }
+ }
+ }
+ }
+ else
+ {
+ /* Compute Cp and C'p+1 from C with sh=0 */
+ mp_limb_t *tp = MPFR_MANT(c);
+ /* Start from bit x=p-d in mantissa C */
+ mpfr_prec_t x = p-d;
+ mp_size_t kx = n-1 - (x / GMP_NUMB_BITS);
+ mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS);
+ MPFR_ASSERTD(p >= d);
+ bcp = (tp[kx] & (MPFR_LIMB_ONE<<sx));
+ /* Looks at the last bits of limb kx (If sx=0, does nothing)*/
+ if (tp[kx] & MPFR_LIMB_MASK(sx))
+ bcp1 = 1;
+ else
+ {
+ /*kx += (sx==0);*/ /*If sx==0, tp[kx] hasn't been checked*/
+ do {
+ kx--;
+ } while (kx>=0 && tp[kx]==0);
+ bcp1 = (kx>=0);
+ }
+ }
+ DEBUG( printf("sh=%lu Cp=%d C'p+1=%d\n", sh, bcp!=0, bcp1!=0) );
+
+ /* Check if we can lose a bit, and if so compute Cp+1 and C'p+2 */
+ bp = MPFR_MANT(b);
+ if (MPFR_UNLIKELY((bp[n-1]-cp[n-1]) <= MPFR_LIMB_HIGHBIT))
+ {
+ /* We can lose a bit so we precompute Cp+1 and C'p+2 */
+ /* Test for trivial case: since C'p+1=0, Cp+1=0 and C'p+2 =0 */
+ if (MPFR_LIKELY(bcp1 == 0))
+ {
+ bbcp = 0;
+ bbcp1 = 0;
+ }
+ else /* bcp1 != 0 */
+ {
+ /* We can lose a bit:
+ compute Cp+1 and C'p+2 from mantissa C */
+ mp_limb_t *tp = MPFR_MANT(c);
+ /* Start from bit x=(p+1)-d in mantissa C */
+ mpfr_prec_t x = p+1-d;
+ mp_size_t kx = n-1 - (x/GMP_NUMB_BITS);
+ mpfr_prec_t sx = GMP_NUMB_BITS-1-(x%GMP_NUMB_BITS);
+ MPFR_ASSERTD(p > d);
+ DEBUG (printf ("(pre) x=%lu Kx=%ld Sx=%lu\n",
+ (unsigned long) x, (long) kx,
+ (unsigned long) sx));
+ bbcp = (tp[kx] & (MPFR_LIMB_ONE<<sx)) ;
+ /* Looks at the last bits of limb kx (If sx=0, does nothing)*/
+ /* If Cp+1=0, since C'p+1!=0, C'p+2=1 ! */
+ if (MPFR_LIKELY(bbcp==0 || (tp[kx]&MPFR_LIMB_MASK(sx))))
+ bbcp1 = 1;
+ else
+ {
+ /*kx += (sx==0);*/ /*If sx==0, tp[kx] hasn't been checked*/
+ do {
+ kx--;
+ } while (kx>=0 && tp[kx]==0);
+ bbcp1 = (kx>=0);
+ DEBUG (printf ("(Pre) Scan done for %ld\n", (long) kx));
+ }
+ } /*End of Bcp1 != 0*/
+ DEBUG( printf("(Pre) Cp+1=%d C'p+2=%d\n", bbcp!=0, bbcp1!=0) );
+ } /* End of "can lose a bit" */
+
+ /* Clean shifted C' */
+ mask = ~MPFR_LIMB_MASK (sh);
+ cp[0] &= mask;
+
+ /* Substract the mantissa c from b in a */
+ ap = MPFR_MANT(a);
+ mpn_sub_n (ap, bp, cp, n);
+ DEBUG( mpfr_print_mant_binary("Sub= ", ap, p) );
+
+ /* Normalize: we lose at max one bit*/
+ if (MPFR_UNLIKELY(MPFR_LIMB_MSB(ap[n-1]) == 0))
+ {
+ /* High bit is not set and we have to fix it! */
+ /* Ap >= 010000xxx001 */
+ mpn_lshift(ap, ap, n, 1);
+ /* Ap >= 100000xxx010 */
+ if (MPFR_UNLIKELY(bcp!=0)) /* Check if Cp = -1 */
+ /* Since Cp == -1, we have to substract one more */
+ {
+ mpn_sub_1(ap, ap, n, MPFR_LIMB_ONE<<sh);
+ MPFR_ASSERTD(MPFR_LIMB_MSB(ap[n-1]) != 0);
+ }
+ /* Ap >= 10000xxx001 */
+ /* Final exponent -1 since we have shifted the mantissa */
+ bx--;
+ /* Update bcp and bcp1 */
+ MPFR_ASSERTN(bbcp != (mp_limb_t) -1);
+ MPFR_ASSERTN(bbcp1 != (mp_limb_t) -1);
+ bcp = bbcp;
+ bcp1 = bbcp1;
+ /* We dont't have anymore a valid Cp+1!
+ But since Ap >= 100000xxx001, the final sub can't unnormalize!*/
+ }
+ MPFR_ASSERTD( !(ap[0] & ~mask) );
+
+ /* Rounding */
+ if (MPFR_LIKELY(rnd_mode == MPFR_RNDN))
+ {
+ if (MPFR_LIKELY(bcp==0))
+ goto truncate;
+ else if ((bcp1) || ((ap[0] & (MPFR_LIMB_ONE<<sh)) != 0))
+ goto sub_one_ulp;
+ else
+ goto truncate;
+ }
+
+ /* Update rounding mode */
+ MPFR_UPDATE_RND_MODE(rnd_mode, MPFR_IS_NEG(a));
+ if (rnd_mode == MPFR_RNDZ && (MPFR_LIKELY(bcp || bcp1)))
+ goto sub_one_ulp;
+ goto truncate;
+ }
+ MPFR_RET_NEVER_GO_HERE ();
+
+ /* Sub one ulp to the result */
+ sub_one_ulp:
+ mpn_sub_1 (ap, ap, n, MPFR_LIMB_ONE << sh);
+ /* Result should be smaller than exact value: inexact=-1 */
+ inexact = -1;
+ /* Check normalisation */
+ if (MPFR_UNLIKELY(MPFR_LIMB_MSB(ap[n-1]) == 0))
+ {
+ /* ap was a power of 2, and we lose a bit */
+ /* Now it is 0111111111111111111[00000 */
+ mpn_lshift(ap, ap, n, 1);
+ bx--;
+ /* And the lost bit x depends on Cp+1, and Cp */
+ /* Compute Cp+1 if it isn't already compute (ie d==1) */
+ /* FIXME: Is this case possible? */
+ if (MPFR_UNLIKELY(d == 1))
+ bbcp = 0;
+ DEBUG( printf("(SubOneUlp)Cp=%d, Cp+1=%d C'p+1=%d\n", bcp!=0,bbcp!=0,bcp1!=0));
+ /* Compute the last bit (Since we have shifted the mantissa)
+ we need one more bit!*/
+ MPFR_ASSERTN(bbcp != (mp_limb_t) -1);
+ if ( (rnd_mode == MPFR_RNDZ && bcp==0)
+ || (rnd_mode==MPFR_RNDN && bbcp==0)
+ || (bcp && bcp1==0) ) /*Exact result*/
+ {
+ ap[0] |= MPFR_LIMB_ONE<<sh;
+ if (rnd_mode == MPFR_RNDN)
+ inexact = 1;
+ DEBUG( printf("(SubOneUlp) Last bit set\n") );
+ }
+ /* Result could be exact if C'p+1 = 0 and rnd == Zero
+ since we have had one more bit to the result */
+ /* Fixme: rnd_mode == MPFR_RNDZ needed ? */
+ if (bcp1==0 && rnd_mode==MPFR_RNDZ)
+ {
+ DEBUG( printf("(SubOneUlp) Exact result\n") );
+ inexact = 0;
+ }
+ }
+
+ goto end_of_sub;
+
+ truncate:
+ /* Check if the result is an exact power of 2: 100000000000
+ in which cases, we could have to do sub_one_ulp due to some nasty reasons:
+ If Result is a Power of 2:
+ + If rnd = AWAY,
+ | If Cp=-1 and C'p+1 = 0, SubOneUlp and the result is EXACT.
+ If Cp=-1 and C'p+1 =-1, SubOneUlp and the result is above.
+ Otherwise truncate
+ + If rnd = NEAREST,
+ If Cp= 0 and Cp+1 =-1 and C'p+2=-1, SubOneUlp and the result is above
+ If cp=-1 and C'p+1 = 0, SubOneUlp and the result is exact.
+ Otherwise truncate.
+ X bit should always be set if SubOneUlp*/
+ if (MPFR_UNLIKELY(ap[n-1] == MPFR_LIMB_HIGHBIT))
+ {
+ mp_size_t k = n-1;
+ do {
+ k--;
+ } while (k>=0 && ap[k]==0);
+ if (MPFR_UNLIKELY(k<0))
+ {
+ /* It is a power of 2! */
+ /* Compute Cp+1 if it isn't already compute (ie d==1) */
+ /* FIXME: Is this case possible? */
+ if (d == 1)
+ bbcp=0;
+ DEBUG( printf("(Truncate) Cp=%d, Cp+1=%d C'p+1=%d C'p+2=%d\n", \
+ bcp!=0, bbcp!=0, bcp1!=0, bbcp1!=0) );
+ MPFR_ASSERTN(bbcp != (mp_limb_t) -1);
+ MPFR_ASSERTN((rnd_mode != MPFR_RNDN) || (bcp != 0) || (bbcp == 0) || (bbcp1 != (mp_limb_t) -1));
+ if (((rnd_mode != MPFR_RNDZ) && bcp)
+ ||
+ ((rnd_mode == MPFR_RNDN) && (bcp == 0) && (bbcp) && (bbcp1)))
+ {
+ DEBUG( printf("(Truncate) Do sub\n") );
+ mpn_sub_1 (ap, ap, n, MPFR_LIMB_ONE << sh);
+ mpn_lshift(ap, ap, n, 1);
+ ap[0] |= MPFR_LIMB_ONE<<sh;
+ bx--;
+ /* FIXME: Explain why it works (or why not)... */
+ inexact = (bcp1 == 0) ? 0 : (rnd_mode==MPFR_RNDN) ? -1 : 1;
+ goto end_of_sub;
+ }
+ }
+ }
+
+ /* Calcul of Inexact flag.*/
+ inexact = MPFR_LIKELY(bcp || bcp1) ? 1 : 0;
+
+ end_of_sub:
+ /* Update Expo */
+ /* FIXME: Is this test really useful?
+ If d==0 : Exact case. This is never called.
+ if 1 < d < p : bx=MPFR_EXP(b) or MPFR_EXP(b)-1 > MPFR_EXP(c) > emin
+ if d == 1 : bx=MPFR_EXP(b). If we could lose any bits, the exact
+ normalisation is called.
+ if d >= p : bx=MPFR_EXP(b) >= MPFR_EXP(c) + p > emin
+ After SubOneUlp, we could have one bit less.
+ if 1 < d < p : bx >= MPFR_EXP(b)-2 >= MPFR_EXP(c) > emin
+ if d == 1 : bx >= MPFR_EXP(b)-1 = MPFR_EXP(c) > emin.
+ if d >= p : bx >= MPFR_EXP(b)-1 > emin since p>=2.
+ */
+ MPFR_ASSERTD( bx >= __gmpfr_emin);
+ /*
+ if (MPFR_UNLIKELY(bx < __gmpfr_emin))
+ {
+ DEBUG( printf("(Final Underflow)\n") );
+ if (rnd_mode == MPFR_RNDN &&
+ (bx < __gmpfr_emin - 1 ||
+ (inexact >= 0 && mpfr_powerof2_raw (a))))
+ rnd_mode = MPFR_RNDZ;
+ MPFR_TMP_FREE(marker);
+ return mpfr_underflow (a, rnd_mode, MPFR_SIGN(a));
+ }
+ */
+ MPFR_SET_EXP (a, bx);
+
+ MPFR_TMP_FREE(marker);
+ MPFR_RET (inexact * MPFR_INT_SIGN (a));
+}
diff --git a/src/sub_d.c b/src/sub_d.c
new file mode 100644
index 0000000..14922ca
--- /dev/null
+++ b/src/sub_d.c
@@ -0,0 +1,51 @@
+/* mpfr_sub_d -- subtract a machine double precision float from
+ a multiple precision floating-point number
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_sub_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t d;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("b[%Pu]=%.*Rg c=%.20g rnd=%d",
+ mpfr_get_prec (b), mpfr_log_prec, b, c, rnd_mode),
+ ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (d, IEEE_DBL_MANT_DIG);
+ inexact = mpfr_set_d (d, c, rnd_mode);
+ MPFR_ASSERTN (inexact == 0);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_sub (a, b, d, rnd_mode);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
+ mpfr_clear(d);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (a, inexact, rnd_mode);
+}
diff --git a/src/sub_ui.c b/src/sub_ui.c
new file mode 100644
index 0000000..8fcd530
--- /dev/null
+++ b/src/sub_ui.c
@@ -0,0 +1,60 @@
+/* mpfr_sub_ui -- subtract a floating-point number and a machine integer
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_sub_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode)
+{
+ if (MPFR_LIKELY (u != 0)) /* if u=0, do nothing */
+ {
+ mpfr_t uu;
+ mp_limb_t up[1];
+ unsigned long cnt;
+ int inex;
+
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg u=%lu rnd=%d",
+ mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(y), mpfr_log_prec, y, inex));
+
+ MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS);
+ MPFR_ASSERTN (u == (mp_limb_t) u);
+ count_leading_zeros (cnt, (mp_limb_t) u);
+ *up = (mp_limb_t) u << cnt;
+
+ /* Optimization note: Exponent save/restore operations may be
+ removed if mpfr_sub works even when uu is out-of-range. */
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
+ inex = mpfr_sub (y, x, uu, rnd_mode);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex, rnd_mode);
+ }
+ else
+ return mpfr_set (y, x, rnd_mode);
+}
diff --git a/src/subnormal.c b/src/subnormal.c
new file mode 100644
index 0000000..cbf35ae
--- /dev/null
+++ b/src/subnormal.c
@@ -0,0 +1,163 @@
+/* mpfr_subnormalize -- Subnormalize a floating point number
+ emulating sub-normal numbers.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* For MPFR_RNDN, we can have a problem of double rounding.
+ In such a case, this table helps to conclude what to do (y positive):
+ Rounding Bit | Sticky Bit | inexact | Action | new inexact
+ 0 | ? | ? | Trunc | sticky
+ 1 | 0 | 1 | Trunc |
+ 1 | 0 | 0 | Trunc if even |
+ 1 | 0 | -1 | AddOneUlp |
+ 1 | 1 | ? | AddOneUlp |
+
+ For other rounding mode, there isn't such a problem.
+ Just round it again and merge the ternary values.
+
+ Set the inexact flag if the returned ternary value is non-zero.
+ Set the underflow flag if a second rounding occurred (whether this
+ rounding is exact or not). See
+ https://sympa.inria.fr/sympa/arc/mpfr/2009-06/msg00000.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2009-06/msg00008.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2009-06/msg00010.html
+*/
+
+int
+mpfr_subnormalize (mpfr_ptr y, int old_inexact, mpfr_rnd_t rnd)
+{
+ int sign;
+
+ /* The subnormal exponent range is [ emin, emin + MPFR_PREC(y) - 2 ] */
+ if (MPFR_LIKELY (MPFR_IS_SINGULAR (y)
+ || (MPFR_GET_EXP (y) >=
+ __gmpfr_emin + (mpfr_exp_t) MPFR_PREC (y) - 1)))
+ MPFR_RET (old_inexact);
+
+ mpfr_set_underflow ();
+ sign = MPFR_SIGN (y);
+
+ /* We have to emulate one bit rounding if EXP(y) = emin */
+ if (MPFR_GET_EXP (y) == __gmpfr_emin)
+ {
+ /* If this is a power of 2, we don't need rounding.
+ It handles cases when |y| = 0.1 * 2^emin */
+ if (mpfr_powerof2_raw (y))
+ MPFR_RET (old_inexact);
+
+ /* We keep the same sign for y.
+ Assuming Y is the real value and y the approximation
+ and since y is not a power of 2: 0.5*2^emin < Y < 1*2^emin
+ We also know the direction of the error thanks to ternary value. */
+
+ if (rnd == MPFR_RNDN)
+ {
+ mp_limb_t *mant, rb ,sb;
+ mp_size_t s;
+ /* We need the rounding bit and the sticky bit. Read them
+ and use the previous table to conclude. */
+ s = MPFR_LIMB_SIZE (y) - 1;
+ mant = MPFR_MANT (y) + s;
+ rb = *mant & (MPFR_LIMB_HIGHBIT >> 1);
+ if (rb == 0)
+ goto set_min;
+ sb = *mant & ((MPFR_LIMB_HIGHBIT >> 1) - 1);
+ while (sb == 0 && s-- != 0)
+ sb = *--mant;
+ if (sb != 0)
+ goto set_min_p1;
+ /* Rounding bit is 1 and sticky bit is 0.
+ We need to examine old inexact flag to conclude. */
+ if ((old_inexact > 0 && sign > 0) ||
+ (old_inexact < 0 && sign < 0))
+ goto set_min;
+ /* If inexact != 0, return 0.1*2^(emin+1).
+ Otherwise, rounding bit = 1, sticky bit = 0 and inexact = 0
+ So we have 0.1100000000000000000000000*2^emin exactly.
+ We return 0.1*2^(emin+1) according to the even-rounding
+ rule on subnormals. */
+ goto set_min_p1;
+ }
+ else if (MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG (y)))
+ {
+ set_min:
+ mpfr_setmin (y, __gmpfr_emin);
+ MPFR_RET (-sign);
+ }
+ else
+ {
+ set_min_p1:
+ /* Note: mpfr_setmin will abort if __gmpfr_emax == __gmpfr_emin. */
+ mpfr_setmin (y, __gmpfr_emin + 1);
+ MPFR_RET (sign);
+ }
+ }
+ else /* Hard case: It is more or less the same problem than mpfr_cache */
+ {
+ mpfr_t dest;
+ mpfr_prec_t q;
+ int inexact, inex2;
+
+ MPFR_ASSERTD (MPFR_GET_EXP (y) > __gmpfr_emin);
+
+ /* Compute the intermediary precision */
+ q = (mpfr_uexp_t) MPFR_GET_EXP (y) - __gmpfr_emin + 1;
+ MPFR_ASSERTD (q >= MPFR_PREC_MIN && q < MPFR_PREC (y));
+
+ /* TODO: perform the rounding in place. */
+ mpfr_init2 (dest, q);
+ /* Round y in dest */
+ MPFR_SET_EXP (dest, MPFR_GET_EXP (y));
+ MPFR_SET_SIGN (dest, sign);
+ MPFR_RNDRAW_EVEN (inexact, dest,
+ MPFR_MANT (y), MPFR_PREC (y), rnd, sign,
+ MPFR_SET_EXP (dest, MPFR_GET_EXP (dest) + 1));
+ if (MPFR_LIKELY (old_inexact != 0))
+ {
+ if (MPFR_UNLIKELY (rnd == MPFR_RNDN &&
+ (inexact == MPFR_EVEN_INEX ||
+ inexact == -MPFR_EVEN_INEX)))
+ {
+ /* if both roundings are in the same direction, we have to go
+ back in the other direction */
+ if (SAME_SIGN (inexact, old_inexact))
+ {
+ if (SAME_SIGN (inexact, MPFR_INT_SIGN (y)))
+ mpfr_nexttozero (dest);
+ else
+ mpfr_nexttoinf (dest);
+ inexact = -inexact;
+ }
+ }
+ else if (MPFR_UNLIKELY (inexact == 0))
+ inexact = old_inexact;
+ }
+
+ inex2 = mpfr_set (y, dest, rnd);
+ MPFR_ASSERTN (inex2 == 0);
+ MPFR_ASSERTN (MPFR_IS_PURE_FP (y));
+ mpfr_clear (dest);
+
+ MPFR_RET (inexact);
+ }
+}
diff --git a/src/sum.c b/src/sum.c
new file mode 100644
index 0000000..200a523
--- /dev/null
+++ b/src/sum.c
@@ -0,0 +1,316 @@
+/* Sum -- efficiently sum a list of floating-point numbers
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Reference: James Demmel and Yozo Hida, Fast and accurate floating-point
+ summation with application to computational geometry, Numerical Algorithms,
+ volume 37, number 1-4, pages 101--112, 2004. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* I would really like to use "mpfr_srcptr const []" but the norm is buggy:
+ it doesn't automaticaly cast a "mpfr_ptr []" to "mpfr_srcptr const []"
+ if necessary. So the choice are:
+ mpfr_s ** : ok
+ mpfr_s *const* : ok
+ mpfr_s **const : ok
+ mpfr_s *const*const : ok
+ const mpfr_s *const* : no
+ const mpfr_s **const : no
+ const mpfr_s *const*const: no
+ VL: this is not a bug, but a feature. See the reason here:
+ http://c-faq.com/ansi/constmismatch.html
+*/
+static void heap_sort (mpfr_srcptr *const, unsigned long, mpfr_srcptr *);
+static void count_sort (mpfr_srcptr *const, unsigned long, mpfr_srcptr *,
+ mpfr_exp_t, mpfr_uexp_t);
+
+/* Either sort the tab in perm and returns 0
+ Or returns 1 for +INF, -1 for -INF and 2 for NAN */
+int
+mpfr_sum_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm)
+{
+ mpfr_exp_t min, max;
+ mpfr_uexp_t exp_num;
+ unsigned long i;
+ int sign_inf;
+
+ sign_inf = 0;
+ min = MPFR_EMIN_MAX;
+ max = MPFR_EMAX_MIN;
+ for (i = 0; i < n; i++)
+ {
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (tab[i])))
+ {
+ if (MPFR_IS_NAN (tab[i]))
+ return 2; /* Return NAN code */
+ else if (MPFR_IS_INF (tab[i]))
+ {
+ if (sign_inf == 0) /* No previous INF */
+ sign_inf = MPFR_SIGN (tab[i]);
+ else if (sign_inf != MPFR_SIGN (tab[i]))
+ return 2; /* Return NAN */
+ }
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (tab[i]));
+ if (MPFR_GET_EXP (tab[i]) < min)
+ min = MPFR_GET_EXP(tab[i]);
+ if (MPFR_GET_EXP (tab[i]) > max)
+ max = MPFR_GET_EXP(tab[i]);
+ }
+ }
+ if (MPFR_UNLIKELY (sign_inf != 0))
+ return sign_inf;
+
+ exp_num = max - min + 1;
+ /* FIXME : better test */
+ if (exp_num > n * MPFR_INT_CEIL_LOG2 (n))
+ heap_sort (tab, n, perm);
+ else
+ count_sort (tab, n, perm, min, exp_num);
+ return 0;
+}
+
+#define GET_EXP1(x) (MPFR_IS_ZERO (x) ? min : MPFR_GET_EXP (x))
+/* Performs a count sort of the entries */
+static void
+count_sort (mpfr_srcptr *const tab, unsigned long n,
+ mpfr_srcptr *perm, mpfr_exp_t min, mpfr_uexp_t exp_num)
+{
+ unsigned long *account;
+ unsigned long target_rank, i;
+ MPFR_TMP_DECL(marker);
+
+ /* Reserve a place for potential 0 (with EXP min-1)
+ If there is no zero, we only lose one unused entry */
+ min--;
+ exp_num++;
+
+ /* Performs a counting sort of the entries */
+ MPFR_TMP_MARK (marker);
+ account = (unsigned long *) MPFR_TMP_ALLOC (exp_num * sizeof *account);
+ for (i = 0; i < exp_num; i++)
+ account[i] = 0;
+ for (i = 0; i < n; i++)
+ account[GET_EXP1 (tab[i]) - min]++;
+ for (i = exp_num - 1; i >= 1; i--)
+ account[i - 1] += account[i];
+ for (i = 0; i < n; i++)
+ {
+ target_rank = --account[GET_EXP1 (tab[i]) - min];
+ perm[target_rank] = tab[i];
+ }
+ MPFR_TMP_FREE (marker);
+}
+
+
+#define GET_EXP2(x) (MPFR_IS_ZERO (x) ? MPFR_EMIN_MIN : MPFR_GET_EXP (x))
+
+/* Performs a heap sort of the entries */
+static void
+heap_sort (mpfr_srcptr *const tab, unsigned long n, mpfr_srcptr *perm)
+{
+ unsigned long dernier_traite;
+ unsigned long i, pere;
+ mpfr_srcptr tmp;
+ unsigned long fils_gauche, fils_droit, fils_indigne;
+ /* Reminder of a heap structure :
+ node(i) has for left son node(2i +1) and right son node(2i)
+ and father(node(i)) = node((i - 1) / 2)
+ */
+
+ /* initialize the permutation to identity */
+ for (i = 0; i < n; i++)
+ perm[i] = tab[i];
+
+ /* insertion phase */
+ for (dernier_traite = 1; dernier_traite < n; dernier_traite++)
+ {
+ i = dernier_traite;
+ while (i > 0)
+ {
+ pere = (i - 1) / 2;
+ if (GET_EXP2 (perm[pere]) > GET_EXP2 (perm[i]))
+ {
+ tmp = perm[pere];
+ perm[pere] = perm[i];
+ perm[i] = tmp;
+ i = pere;
+ }
+ else
+ break;
+ }
+ }
+
+ /* extraction phase */
+ for (dernier_traite = n - 1; dernier_traite > 0; dernier_traite--)
+ {
+ tmp = perm[0];
+ perm[0] = perm[dernier_traite];
+ perm[dernier_traite] = tmp;
+
+ i = 0;
+ while (1)
+ {
+ fils_gauche = 2 * i + 1;
+ fils_droit = fils_gauche + 1;
+ if (fils_gauche < dernier_traite)
+ {
+ if (fils_droit < dernier_traite)
+ {
+ if (GET_EXP2(perm[fils_droit]) < GET_EXP2(perm[fils_gauche]))
+ fils_indigne = fils_droit;
+ else
+ fils_indigne = fils_gauche;
+
+ if (GET_EXP2 (perm[i]) > GET_EXP2 (perm[fils_indigne]))
+ {
+ tmp = perm[i];
+ perm[i] = perm[fils_indigne];
+ perm[fils_indigne] = tmp;
+ i = fils_indigne;
+ }
+ else
+ break;
+ }
+ else /* on a un fils gauche, pas de fils droit */
+ {
+ if (GET_EXP2 (perm[i]) > GET_EXP2 (perm[fils_gauche]))
+ {
+ tmp = perm[i];
+ perm[i] = perm[fils_gauche];
+ perm[fils_gauche] = tmp;
+ }
+ break;
+ }
+ }
+ else /* on n'a pas de fils */
+ break;
+ }
+ }
+}
+
+
+/* Sum a list of float with order given by permutation perm,
+ * intermediate size set to F.
+ * Internal use function.
+ */
+static int
+sum_once (mpfr_ptr ret, mpfr_srcptr *const tab, unsigned long n, mpfr_prec_t F)
+{
+ mpfr_t sum;
+ unsigned long i;
+ int error_trap;
+
+ MPFR_ASSERTD (n >= 2);
+
+ mpfr_init2 (sum, F);
+ error_trap = mpfr_set (sum, tab[0], MPFR_RNDN);
+ for (i = 1; i < n - 1; i++)
+ {
+ MPFR_ASSERTD (!MPFR_IS_NAN (sum) && !MPFR_IS_INF (sum));
+ error_trap |= mpfr_add (sum, sum, tab[i], MPFR_RNDN);
+ }
+ error_trap |= mpfr_add (ret, sum, tab[n - 1], MPFR_RNDN);
+ mpfr_clear (sum);
+ return error_trap;
+}
+
+/* Sum a list of floating-point numbers.
+ */
+
+int
+mpfr_sum (mpfr_ptr ret, mpfr_ptr *const tab_p, unsigned long n, mpfr_rnd_t rnd)
+{
+ mpfr_t cur_sum;
+ mpfr_prec_t prec;
+ mpfr_srcptr *perm, *const tab = (mpfr_srcptr *) tab_p;
+ int k, error_trap;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_TMP_DECL (marker);
+
+ if (MPFR_UNLIKELY (n <= 1))
+ {
+ if (n < 1)
+ {
+ MPFR_SET_ZERO (ret);
+ MPFR_SET_POS (ret);
+ return 0;
+ }
+ else
+ return mpfr_set (ret, tab[0], rnd);
+ }
+
+ /* Sort and treat special cases */
+ MPFR_TMP_MARK (marker);
+ perm = (mpfr_srcptr *) MPFR_TMP_ALLOC (n * sizeof *perm);
+ error_trap = mpfr_sum_sort (tab, n, perm);
+ /* Check if there was a NAN or a INF */
+ if (MPFR_UNLIKELY (error_trap != 0))
+ {
+ MPFR_TMP_FREE (marker);
+ if (error_trap == 2)
+ {
+ MPFR_SET_NAN (ret);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_INF (ret);
+ MPFR_SET_SIGN (ret, error_trap);
+ MPFR_RET (0);
+ }
+
+ /* Initial precision */
+ prec = MAX (MPFR_PREC (tab[0]), MPFR_PREC (ret));
+ k = MPFR_INT_CEIL_LOG2 (n) + 1;
+ prec += k + 2;
+ mpfr_init2 (cur_sum, prec);
+
+ /* Ziv Loop */
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ error_trap = sum_once (cur_sum, perm, n, prec + k);
+ if (MPFR_LIKELY (error_trap == 0 ||
+ (!MPFR_IS_ZERO (cur_sum) &&
+ mpfr_can_round (cur_sum,
+ MPFR_GET_EXP (cur_sum) - prec + 2,
+ MPFR_RNDN, rnd, MPFR_PREC (ret)))))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (cur_sum, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+ MPFR_TMP_FREE (marker);
+
+ error_trap |= mpfr_set (ret, cur_sum, rnd);
+ mpfr_clear (cur_sum);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ error_trap |= mpfr_check_range (ret, 0, rnd);
+ return error_trap; /* It doesn't return the ternary value */
+}
+
+/* __END__ */
diff --git a/src/swap.c b/src/swap.c
new file mode 100644
index 0000000..8ab213a
--- /dev/null
+++ b/src/swap.c
@@ -0,0 +1,54 @@
+/* mpfr_swap (U, V) -- Swap U and V.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Using memcpy is a few slower than swapping by hand. */
+
+void
+mpfr_swap (mpfr_ptr u, mpfr_ptr v)
+{
+ mpfr_prec_t p1, p2;
+ mpfr_sign_t s1, s2;
+ mpfr_exp_t e1, e2;
+ mp_limb_t *m1, *m2;
+
+ p1 = MPFR_PREC(u);
+ p2 = MPFR_PREC(v);
+ MPFR_PREC(v) = p1;
+ MPFR_PREC(u) = p2;
+
+ s1 = MPFR_SIGN(u);
+ s2 = MPFR_SIGN(v);
+ MPFR_SIGN(v) = s1;
+ MPFR_SIGN(u) = s2;
+
+ e1 = MPFR_EXP(u);
+ e2 = MPFR_EXP(v);
+ MPFR_EXP(v) = e1;
+ MPFR_EXP(u) = e2;
+
+ m1 = MPFR_MANT(u);
+ m2 = MPFR_MANT(v);
+ MPFR_MANT(v) = m1;
+ MPFR_MANT(u) = m2;
+}
diff --git a/src/tan.c b/src/tan.c
new file mode 100644
index 0000000..8cd93cd
--- /dev/null
+++ b/src/tan.c
@@ -0,0 +1,89 @@
+/* mpfr_tan -- tangent of a floating-point number
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* computes tan(x) = sign(x)*sqrt(1/cos(x)^2-1) */
+int
+mpfr_tan (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_prec_t precy, m;
+ int inexact;
+ mpfr_t s, c;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_GROUP_DECL (group);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
+ {
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ MPFR_SET_ZERO(y);
+ MPFR_SET_SAME_SIGN(y, x);
+ MPFR_RET(0);
+ }
+ }
+
+ /* tan(x) = x + x^3/3 + ... so the error is < 2^(3*EXP(x)-1) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2 * MPFR_GET_EXP (x), 1, 1,
+ rnd_mode, {});
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Compute initial precision */
+ precy = MPFR_PREC (y);
+ m = precy + MPFR_INT_CEIL_LOG2 (precy) + 13;
+ MPFR_ASSERTD (m >= 2); /* needed for the error analysis in algorithms.tex */
+
+ MPFR_GROUP_INIT_2 (group, m, s, c);
+ MPFR_ZIV_INIT (loop, m);
+ for (;;)
+ {
+ /* The only way to get an overflow is to get ~ Pi/2
+ But the result will be ~ 2^Prec(y). */
+ mpfr_sin_cos (s, c, x, MPFR_RNDN); /* err <= 1/2 ulp on s and c */
+ mpfr_div (c, s, c, MPFR_RNDN); /* err <= 4 ulps */
+ MPFR_ASSERTD (!MPFR_IS_SINGULAR (c));
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (c, m - 2, precy, rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, m);
+ MPFR_GROUP_REPREC_2 (group, m, s, c);
+ }
+ MPFR_ZIV_FREE (loop);
+ inexact = mpfr_set (y, c, rnd_mode);
+ MPFR_GROUP_CLEAR (group);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/tanh.c b/src/tanh.c
new file mode 100644
index 0000000..b1e9b7d
--- /dev/null
+++ b/src/tanh.c
@@ -0,0 +1,153 @@
+/* mpfr_tanh -- hyperbolic tangent
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt , mpfr_rnd_t rnd_mode)
+{
+ /****** Declaration ******/
+ mpfr_t x;
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ /* Special value checking */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (xt)))
+ {
+ if (MPFR_IS_NAN (xt))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (xt))
+ {
+ /* tanh(inf) = 1 && tanh(-inf) = -1 */
+ return mpfr_set_si (y, MPFR_INT_SIGN (xt), rnd_mode);
+ }
+ else /* tanh (0) = 0 and xt is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO(xt));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, xt);
+ MPFR_RET (0);
+ }
+ }
+
+ /* tanh(x) = x - x^3/3 + ... so the error is < 2^(3*EXP(x)-1) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, xt, -2 * MPFR_GET_EXP (xt), 1, 0,
+ rnd_mode, {});
+
+ MPFR_TMP_INIT_ABS (x, xt);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* General case */
+ {
+ /* Declaration of the intermediary variable */
+ mpfr_t t, te;
+ mpfr_exp_t d;
+
+ /* Declaration of the size variable */
+ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ long int err; /* error */
+ int sign = MPFR_SIGN (xt);
+ MPFR_ZIV_DECL (loop);
+ MPFR_GROUP_DECL (group);
+
+ /* First check for BIG overflow of exp(2*x):
+ For x > 0, exp(2*x) > 2^(2*x)
+ If 2 ^(2*x) > 2^emax or x>emax/2, there is an overflow */
+ if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emax/2) >= 0)) {
+ /* initialise of intermediary variables
+ since 'set_one' label assumes the variables have been
+ initialize */
+ MPFR_GROUP_INIT_2 (group, MPFR_PREC_MIN, t, te);
+ goto set_one;
+ }
+
+ /* Compute the precision of intermediary variable */
+ /* The optimal number of bits: see algorithms.tex */
+ Nt = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 4;
+ /* if x is small, there will be a cancellation in exp(2x)-1 */
+ if (MPFR_GET_EXP (x) < 0)
+ Nt += -MPFR_GET_EXP (x);
+
+ /* initialise of intermediary variable */
+ MPFR_GROUP_INIT_2 (group, Nt, t, te);
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;) {
+ /* tanh = (exp(2x)-1)/(exp(2x)+1) */
+ mpfr_mul_2ui (te, x, 1, MPFR_RNDN); /* 2x */
+ /* since x > 0, we can only have an overflow */
+ mpfr_exp (te, te, MPFR_RNDN); /* exp(2x) */
+ if (MPFR_UNLIKELY (MPFR_IS_INF (te))) {
+ set_one:
+ inexact = MPFR_FROM_SIGN_TO_INT (sign);
+ mpfr_set4 (y, __gmpfr_one, MPFR_RNDN, sign);
+ if (MPFR_IS_LIKE_RNDZ (rnd_mode, MPFR_IS_NEG_SIGN (sign)))
+ {
+ inexact = -inexact;
+ mpfr_nexttozero (y);
+ }
+ break;
+ }
+ d = MPFR_GET_EXP (te); /* For Error calculation */
+ mpfr_add_ui (t, te, 1, MPFR_RNDD); /* exp(2x) + 1*/
+ mpfr_sub_ui (te, te, 1, MPFR_RNDU); /* exp(2x) - 1*/
+ d = d - MPFR_GET_EXP (te);
+ mpfr_div (t, te, t, MPFR_RNDN); /* (exp(2x)-1)/(exp(2x)+1)*/
+
+ /* Calculation of the error */
+ d = MAX(3, d + 1);
+ err = Nt - (d + 1);
+
+ if (MPFR_LIKELY ((d <= Nt / 2) && MPFR_CAN_ROUND (t, err, Ny, rnd_mode)))
+ {
+ inexact = mpfr_set4 (y, t, rnd_mode, sign);
+ break;
+ }
+
+ /* if t=1, we still can round since |sinh(x)| < 1 */
+ if (MPFR_GET_EXP (t) == 1)
+ goto set_one;
+
+ /* Actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ MPFR_GROUP_REPREC_2 (group, Nt, t, te);
+ }
+ MPFR_ZIV_FREE (loop);
+ MPFR_GROUP_CLEAR (group);
+ }
+ MPFR_SAVE_EXPO_FREE (expo);
+ inexact = mpfr_check_range (y, inexact, rnd_mode);
+
+ return inexact;
+}
+
diff --git a/src/uceil_exp2.c b/src/uceil_exp2.c
new file mode 100644
index 0000000..dd571d0
--- /dev/null
+++ b/src/uceil_exp2.c
@@ -0,0 +1,65 @@
+/* __gmpfr_ceil_exp2 - returns y >= 2^d
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* returns y >= 2^d, assuming that d <= 1024
+ for d integer, returns exactly 2^d
+*/
+double
+__gmpfr_ceil_exp2 (double d)
+{
+ long exp;
+#if _GMP_IEEE_FLOATS
+ union ieee_double_extract x;
+#else
+ struct {double d;} x;
+#endif
+
+ MPFR_ASSERTN(d <= 1024.0);
+ exp = (long) d;
+ if (d != (double) exp)
+ exp++;
+ /* now exp = ceil(d) */
+ x.d = 1.0;
+#if _GMP_IEEE_FLOATS
+ x.s.exp = exp <= -1022 ? 1 : 1023 + exp;
+#else
+ if (exp >= 0)
+ {
+ while (exp != 0)
+ {
+ x.d *= 2.0;
+ exp--;
+ }
+ }
+ else
+ {
+ while (exp != 0)
+ {
+ x.d *= (1.0 / 2.0);
+ exp++;
+ }
+ }
+#endif
+ return x.d;
+}
diff --git a/src/uceil_log2.c b/src/uceil_log2.c
new file mode 100644
index 0000000..27f7d4f
--- /dev/null
+++ b/src/uceil_log2.c
@@ -0,0 +1,63 @@
+/* __gmpfr_ceil_log2 - returns ceil(log(d)/log(2))
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* returns ceil(log(d)/log(2)) if d > 0,
+ -1023 if d = +0,
+ and floor(log(-d)/log(2))+1 if d < 0*/
+long
+__gmpfr_ceil_log2 (double d)
+{
+ long exp;
+#if _GMP_IEEE_FLOATS
+ union ieee_double_extract x;
+
+ x.d = d;
+ exp = x.s.exp - 1023;
+ x.s.exp = 1023; /* value for 1 <= d < 2 */
+ if (x.d != 1.0) /* d: not a power of two? */
+ exp++;
+ return exp;
+#else
+ double m;
+
+ if (d < 0.0)
+ return __gmpfr_floor_log2(-d)+1;
+ else if (d == 0.0)
+ return -1023;
+ else if (d >= 1.0)
+ {
+ exp = 0;
+ for( m= 1.0 ; m < d ; m *=2.0 )
+ exp++;
+ }
+ else
+ {
+ exp = 1;
+ for( m= 1.0 ; m >= d ; m *= (1.0/2.0) )
+ exp--;
+ }
+#endif
+ return exp;
+}
+
diff --git a/src/ufloor_log2.c b/src/ufloor_log2.c
new file mode 100644
index 0000000..9200dbf
--- /dev/null
+++ b/src/ufloor_log2.c
@@ -0,0 +1,53 @@
+/* __gmpfr_floor_log2 - returns floor(log(d)/log(2))
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* returns floor(log2(d)) */
+long
+__gmpfr_floor_log2 (double d)
+{
+#if _GMP_IEEE_FLOATS
+ union ieee_double_extract x;
+
+ x.d = d;
+ return (long) x.s.exp - 1023;
+#else
+ long exp;
+ double m;
+
+ MPFR_ASSERTD (d >= 0);
+ if (d >= 1.0)
+ {
+ exp = -1;
+ for( m= 1.0 ; m <= d ; m *=2.0 )
+ exp++;
+ }
+ else
+ {
+ exp = 0;
+ for( m= 1.0 ; m > d ; m *= (1.0/2.0) )
+ exp--;
+ }
+ return exp;
+#endif
+}
diff --git a/src/ui_div.c b/src/ui_div.c
new file mode 100644
index 0000000..223ec79
--- /dev/null
+++ b/src/ui_div.c
@@ -0,0 +1,103 @@
+/* mpfr_ui_div -- divide a machine integer by a floating-point number
+ mpfr_si_div -- divide a machine number by a floating-point number
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_ui_div (mpfr_ptr y, unsigned long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t uu;
+ mp_limb_t up[1];
+ unsigned long cnt;
+
+ MPFR_LOG_FUNC
+ (("u=%lu x[%Pu]=%.*Rg rnd=%d",
+ u, mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y));
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
+ {
+ if (MPFR_IS_NAN(x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(x)) /* u/Inf = 0 */
+ {
+ MPFR_SET_ZERO(y);
+ MPFR_SET_SAME_SIGN(y,x);
+ MPFR_RET(0);
+ }
+ else /* u / 0 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ if (u)
+ {
+ /* u > 0, so y = sign(x) * Inf */
+ MPFR_SET_SAME_SIGN(y, x);
+ MPFR_SET_INF(y);
+ mpfr_set_divby0 ();
+ MPFR_RET(0);
+ }
+ else
+ {
+ /* 0 / 0 */
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ }
+ }
+ else if (MPFR_LIKELY(u != 0))
+ {
+ MPFR_TMP_INIT1(up, uu, GMP_NUMB_BITS);
+ MPFR_ASSERTN(u == (mp_limb_t) u);
+ count_leading_zeros(cnt, (mp_limb_t) u);
+ up[0] = (mp_limb_t) u << cnt;
+ MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
+ return mpfr_div (y, uu, x, rnd_mode);
+ }
+ else /* u = 0, and x != 0 */
+ {
+ MPFR_SET_ZERO(y); /* if u=0, then set y to 0 */
+ MPFR_SET_SAME_SIGN(y, x); /* u considered as +0: sign(+0/x) = sign(x) */
+ MPFR_RET(0);
+ }
+}
+
+
+int
+mpfr_si_div (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int res;
+
+ if (u >= 0)
+ res = mpfr_ui_div (y, u, x, rnd_mode);
+ else
+ {
+ res = -mpfr_ui_div (y, -u, x, MPFR_INVERT_RND(rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ }
+ return res;
+}
diff --git a/src/ui_pow.c b/src/ui_pow.c
new file mode 100644
index 0000000..a566cae
--- /dev/null
+++ b/src/ui_pow.c
@@ -0,0 +1,41 @@
+/* mpfr_ui_pow -- power of n function n^x
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_ui_pow (mpfr_ptr y, unsigned long int n, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t;
+ int inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (t, sizeof(n) * CHAR_BIT);
+ inexact = mpfr_set_ui (t, n, MPFR_RNDN);
+ MPFR_ASSERTN (!inexact);
+ inexact = mpfr_pow (y, t, x, rnd_mode);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/src/ui_pow_ui.c b/src/ui_pow_ui.c
new file mode 100644
index 0000000..63bcb33
--- /dev/null
+++ b/src/ui_pow_ui.c
@@ -0,0 +1,95 @@
+/* mpfr_ui_pow_ui -- compute the power beetween two machine integer
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n,
+ mpfr_rnd_t rnd)
+{
+ mpfr_exp_t err;
+ unsigned long m;
+ mpfr_t res;
+ mpfr_prec_t prec;
+ int size_n;
+ int inexact;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ if (MPFR_UNLIKELY (n <= 1))
+ {
+ if (n == 1)
+ return mpfr_set_ui (x, y, rnd); /* y^1 = y */
+ else
+ return mpfr_set_ui (x, 1, rnd); /* y^0 = 1 for any y */
+ }
+ else if (MPFR_UNLIKELY (y <= 1))
+ {
+ if (y == 1)
+ return mpfr_set_ui (x, 1, rnd); /* 1^n = 1 for any n > 0 */
+ else
+ return mpfr_set_ui (x, 0, rnd); /* 0^n = 0 for any n > 0 */
+ }
+
+ for (size_n = 0, m = n; m; size_n++, m >>= 1);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ prec = MPFR_PREC (x) + 3 + size_n;
+ mpfr_init2 (res, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ int i = size_n;
+
+ inexact = mpfr_set_ui (res, y, MPFR_RNDU);
+ err = 1;
+ /* now 2^(i-1) <= n < 2^i: i=1+floor(log2(n)) */
+ for (i -= 2; i >= 0; i--)
+ {
+ inexact |= mpfr_mul (res, res, res, MPFR_RNDU);
+ err++;
+ if (n & (1UL << i))
+ inexact |= mpfr_mul_ui (res, res, y, MPFR_RNDU);
+ }
+ /* since the loop is executed floor(log2(n)) times,
+ we have err = 1+floor(log2(n)).
+ Since prec >= MPFR_PREC(x) + 4 + floor(log2(n)), prec > err */
+ err = prec - err;
+
+ if (MPFR_LIKELY (inexact == 0
+ || MPFR_CAN_ROUND (res, err, MPFR_PREC (x), rnd)))
+ break;
+
+ /* Actualisation of the precision */
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (res, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (x, res, rnd);
+
+ mpfr_clear (res);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (x, inexact, rnd);
+}
diff --git a/src/ui_sub.c b/src/ui_sub.c
new file mode 100644
index 0000000..0b3911b
--- /dev/null
+++ b/src/ui_sub.c
@@ -0,0 +1,68 @@
+/* mpfr_ui_sub -- subtract a floating-point number from an integer
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_ui_sub (mpfr_ptr y, unsigned long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t uu;
+ mp_limb_t up[1];
+ unsigned long cnt;
+
+ MPFR_LOG_FUNC
+ (("u=%lu x[%Pu]=%.*Rg rnd=%d",
+ u, mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y));
+
+ if (MPFR_UNLIKELY (u == 0))
+ return mpfr_neg (y, x, rnd_mode);
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
+ {
+ if (MPFR_IS_NAN(x))
+ {
+ MPFR_SET_NAN(y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF(x))
+ {
+ /* u - Inf = -Inf and u - -Inf = +Inf */
+ MPFR_SET_INF(y);
+ MPFR_SET_OPPOSITE_SIGN(y,x);
+ MPFR_RET(0); /* +/-infinity is exact */
+ }
+ else /* x is zero */
+ /* u - 0 = u */
+ return mpfr_set_ui(y, u, rnd_mode);
+ }
+ else
+ {
+ MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS);
+ MPFR_ASSERTN(u == (mp_limb_t) u);
+ count_leading_zeros (cnt, (mp_limb_t) u);
+ *up = (mp_limb_t) u << cnt;
+ MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
+ return mpfr_sub (y, uu, x, rnd_mode);
+ }
+}
diff --git a/src/urandom.c b/src/urandom.c
new file mode 100644
index 0000000..de626f1
--- /dev/null
+++ b/src/urandom.c
@@ -0,0 +1,147 @@
+/* mpfr_urandom (rop, state, rnd_mode) -- Generate a uniform pseudorandom
+ real number between 0 and 1 (exclusive) and round it to the precision of rop
+ according to the given rounding mode.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+
+/* generate one random bit */
+static int
+random_rounding_bit (gmp_randstate_t rstate)
+{
+ mp_limb_t r;
+
+ mpfr_rand_raw (&r, rstate, 1);
+ return r & MPFR_LIMB_ONE;
+}
+
+
+int
+mpfr_urandom (mpfr_ptr rop, gmp_randstate_t rstate, mpfr_rnd_t rnd_mode)
+{
+ mpfr_limb_ptr rp;
+ mpfr_prec_t nbits;
+ mp_size_t nlimbs;
+ mp_size_t n;
+ mpfr_exp_t exp;
+ mpfr_exp_t emin;
+ int cnt;
+ int inex;
+
+ rp = MPFR_MANT (rop);
+ nbits = MPFR_PREC (rop);
+ nlimbs = MPFR_LIMB_SIZE (rop);
+ MPFR_SET_POS (rop);
+ exp = 0;
+ emin = mpfr_get_emin ();
+ if (MPFR_UNLIKELY (emin > 0))
+ {
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (emin == 1 && rnd_mode == MPFR_RNDN
+ && random_rounding_bit (rstate)))
+ {
+ mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode);
+ return +1;
+ }
+ else
+ {
+ MPFR_SET_ZERO (rop);
+ return -1;
+ }
+ }
+
+ /* Exponent */
+#define DRAW_BITS 8 /* we draw DRAW_BITS at a time */
+ cnt = DRAW_BITS;
+ MPFR_ASSERTN(DRAW_BITS <= GMP_NUMB_BITS);
+ while (cnt == DRAW_BITS)
+ {
+ /* generate DRAW_BITS in rp[0] */
+ mpfr_rand_raw (rp, rstate, DRAW_BITS);
+ if (MPFR_UNLIKELY (rp[0] == 0))
+ cnt = DRAW_BITS;
+ else
+ {
+ count_leading_zeros (cnt, rp[0]);
+ cnt -= GMP_NUMB_BITS - DRAW_BITS;
+ }
+
+ if (MPFR_UNLIKELY (exp < emin + cnt))
+ {
+ /* To get here, we have been drawing more than -emin zeros
+ in a row, then return 0 or the smallest representable
+ positive number.
+
+ The rounding to nearest mode is subtle:
+ If exp - cnt == emin - 1, the rounding bit is set, except
+ if cnt == DRAW_BITS in which case the rounding bit is
+ outside rp[0] and must be generated. */
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (rnd_mode == MPFR_RNDN && cnt == exp - emin - 1
+ && (cnt != DRAW_BITS || random_rounding_bit (rstate))))
+ {
+ mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode);
+ return +1;
+ }
+ else
+ {
+ MPFR_SET_ZERO (rop);
+ return -1;
+ }
+ }
+ exp -= cnt;
+ }
+ MPFR_EXP (rop) = exp; /* Warning: may be outside the current
+ exponent range */
+
+
+ /* Significand: we need generate only nbits-1 bits, since the most
+ significant is 1 */
+ mpfr_rand_raw (rp, rstate, nbits - 1);
+ n = nlimbs * GMP_NUMB_BITS - nbits;
+ if (MPFR_LIKELY (n != 0)) /* this will put the low bits to zero */
+ mpn_lshift (rp, rp, nlimbs, n);
+
+ /* Set the msb to 1 since it was fixed by the exponent choice */
+ rp[nlimbs - 1] |= MPFR_LIMB_HIGHBIT;
+
+ /* Rounding */
+ if (rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA
+ || (rnd_mode == MPFR_RNDN && random_rounding_bit (rstate)))
+ {
+ /* Take care of the exponent range: it may have been reduced */
+ if (exp < emin)
+ mpfr_set_ui_2exp (rop, 1, emin - 1, rnd_mode);
+ else if (exp > mpfr_get_emax ())
+ mpfr_set_inf (rop, +1); /* overflow, flag set by mpfr_check_range */
+ else
+ mpfr_nextabove (rop);
+ inex = +1;
+ }
+ else
+ inex = -1;
+
+ return mpfr_check_range (rop, inex, rnd_mode);
+}
diff --git a/src/urandomb.c b/src/urandomb.c
new file mode 100644
index 0000000..5bf64f4
--- /dev/null
+++ b/src/urandomb.c
@@ -0,0 +1,108 @@
+/* mpfr_urandomb (rop, state, nbits) -- Generate a uniform pseudorandom
+ real number between 0 (inclusive) and 1 (exclusive) of size NBITS,
+ using STATE as the random state previously initialized by a call to
+ gmp_randinit_lc_2exp_size().
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* generate nbits random bits into mp[], assuming mp was allocated to contain
+ a sufficient number of limbs */
+void
+mpfr_rand_raw (mpfr_limb_ptr mp, gmp_randstate_t rstate,
+ mpfr_prec_t nbits)
+{
+ mpz_t z;
+
+ MPFR_ASSERTN (nbits >= 1);
+ /* To be sure to avoid the potential allocation of mpz_urandomb */
+ ALLOC(z) = SIZ(z) = MPFR_PREC2LIMBS (nbits);
+ PTR(z) = mp;
+#if __MPFR_GMP(5,0,0)
+ /* Check for integer overflow (unless mp_bitcnt_t is signed,
+ but according to the GMP manual, this shouldn't happen).
+ Note: mp_bitcnt_t has been introduced in GMP 5.0.0. */
+ MPFR_ASSERTN ((mp_bitcnt_t) -1 < 0 || nbits <= (mp_bitcnt_t) -1);
+#endif
+ mpz_urandomb (z, rstate, nbits);
+}
+
+int
+mpfr_urandomb (mpfr_ptr rop, gmp_randstate_t rstate)
+{
+ mpfr_limb_ptr rp;
+ mpfr_prec_t nbits;
+ mp_size_t nlimbs;
+ mp_size_t k; /* number of high zero limbs */
+ mpfr_exp_t exp;
+ int cnt;
+
+ rp = MPFR_MANT (rop);
+ nbits = MPFR_PREC (rop);
+ nlimbs = MPFR_LIMB_SIZE (rop);
+ MPFR_SET_POS (rop);
+ cnt = nlimbs * GMP_NUMB_BITS - nbits;
+
+ /* Uniform non-normalized significand */
+ /* generate exactly nbits so that the random generator stays in the same
+ state, independent of the machine word size GMP_NUMB_BITS */
+ mpfr_rand_raw (rp, rstate, nbits);
+ if (MPFR_LIKELY (cnt != 0)) /* this will put the low bits to zero */
+ mpn_lshift (rp, rp, nlimbs, cnt);
+
+ /* Count the null significant limbs and remaining limbs */
+ exp = 0;
+ k = 0;
+ while (nlimbs != 0 && rp[nlimbs - 1] == 0)
+ {
+ k ++;
+ nlimbs --;
+ exp -= GMP_NUMB_BITS;
+ }
+
+ if (MPFR_LIKELY (nlimbs != 0)) /* otherwise value is zero */
+ {
+ count_leading_zeros (cnt, rp[nlimbs - 1]);
+ /* Normalization */
+ if (mpfr_set_exp (rop, exp - cnt))
+ {
+ /* If the exponent is not in the current exponent range, we
+ choose to return a NaN as this is probably a user error.
+ Indeed this can happen only if the exponent range has been
+ reduced to a very small interval and/or the precision is
+ huge (very unlikely). */
+ MPFR_SET_NAN (rop);
+ __gmpfr_flags |= MPFR_FLAGS_NAN; /* Can't use MPFR_RET_NAN */
+ return 1;
+ }
+ if (cnt != 0)
+ mpn_lshift (rp + k, rp, nlimbs, cnt);
+ if (k != 0)
+ MPN_ZERO (rp, k);
+ }
+ else
+ MPFR_SET_ZERO (rop);
+
+ return 0;
+}
diff --git a/src/vasprintf.c b/src/vasprintf.c
new file mode 100644
index 0000000..31e001c
--- /dev/null
+++ b/src/vasprintf.c
@@ -0,0 +1,2086 @@
+/* mpfr_vasprintf -- main function for the printf functions family
+ plus helper macros & functions.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* The mpfr_printf-like functions are defined only if <stdarg.h> exists */
+#ifdef HAVE_STDARG
+
+#include <stdarg.h>
+
+#ifndef HAVE_VA_COPY
+# ifdef HAVE___VA_COPY
+# define va_copy(dst,src) __va_copy(dst, src)
+# else
+/* autoconf manual advocates this fallback.
+ This is also the solution chosen by gmp */
+# define va_copy(dst,src) \
+ do { memcpy(&(dst), &(src), sizeof(va_list)); } while (0)
+# endif /* HAVE___VA_COPY */
+#endif /* HAVE_VA_COPY */
+
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+
+#if defined (__cplusplus)
+#include <cstddef>
+#define __STDC_LIMIT_MACROS /* SIZE_MAX defined with <stdint.h> inclusion */
+#else
+#include <stddef.h> /* for ptrdiff_t */
+#endif
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-intmax.h"
+#include "mpfr-impl.h"
+
+/* Define a length modifier corresponding to mpfr_prec_t.
+ We use literal string instead of literal character so as to permit future
+ extension to long long int ("ll"). */
+#if _MPFR_PREC_FORMAT == 1
+#define MPFR_PREC_FORMAT_TYPE "h"
+#define MPFR_PREC_FORMAT_SIZE 1
+#elif _MPFR_PREC_FORMAT == 2
+#define MPFR_PREC_FORMAT_TYPE ""
+#define MPFR_PREC_FORMAT_SIZE 0
+#elif _MPFR_PREC_FORMAT == 3
+#define MPFR_PREC_FORMAT_TYPE "l"
+#define MPFR_PREC_FORMAT_SIZE 1
+#else
+#error "mpfr_prec_t size not supported"
+#endif
+
+/* Output for special values defined in the C99 standard */
+#define MPFR_NAN_STRING_LC "nan"
+#define MPFR_NAN_STRING_UC "NAN"
+#define MPFR_NAN_STRING_LENGTH 3
+#define MPFR_INF_STRING_LC "inf"
+#define MPFR_INF_STRING_UC "INF"
+#define MPFR_INF_STRING_LENGTH 3
+
+/* The implicit \0 is useless, but we do not write num_to_text[16]
+ otherwise g++ complains. */
+static const char num_to_text[] = "0123456789abcdef";
+
+/* some macro and functions for parsing format string */
+
+/* Read an integer; saturate to INT_MAX. */
+#define READ_INT(ap, format, specinfo, field, label_out) \
+ do { \
+ while (*(format)) \
+ { \
+ int _i; \
+ switch (*(format)) \
+ { \
+ case '0': \
+ case '1': \
+ case '2': \
+ case '3': \
+ case '4': \
+ case '5': \
+ case '6': \
+ case '7': \
+ case '8': \
+ case '9': \
+ specinfo.field = (specinfo.field <= INT_MAX / 10) ? \
+ specinfo.field * 10 : INT_MAX; \
+ _i = *(format) - '0'; \
+ MPFR_ASSERTN (_i >= 0 && _i <= 9); \
+ specinfo.field = (specinfo.field <= INT_MAX - _i) ? \
+ specinfo.field + _i : INT_MAX; \
+ ++(format); \
+ break; \
+ case '*': \
+ specinfo.field = va_arg ((ap), int); \
+ ++(format); \
+ default: \
+ goto label_out; \
+ } \
+ } \
+ } while (0)
+
+/* arg_t contains all the types described by the 'type' field of the
+ format string */
+enum arg_t
+ {
+ NONE,
+ CHAR_ARG,
+ SHORT_ARG,
+ LONG_ARG,
+ LONG_LONG_ARG,
+ INTMAX_ARG,
+ SIZE_ARG,
+ PTRDIFF_ARG,
+ LONG_DOUBLE_ARG,
+ MPF_ARG,
+ MPQ_ARG,
+ MP_LIMB_ARG,
+ MP_LIMB_ARRAY_ARG,
+ MPZ_ARG,
+ MPFR_PREC_ARG,
+ MPFR_ARG,
+ UNSUPPORTED
+ };
+
+/* Each conversion specification of the format string will be translated in a
+ printf_spec structure by the parser.
+ This structure is adapted from the GNU libc one. */
+struct printf_spec
+{
+ unsigned int alt:1; /* # flag */
+ unsigned int space:1; /* Space flag */
+ unsigned int left:1; /* - flag */
+ unsigned int showsign:1; /* + flag */
+ unsigned int group:1; /* ' flag */
+
+ int width; /* Width */
+ int prec; /* Precision */
+
+ enum arg_t arg_type; /* Type of argument */
+ mpfr_rnd_t rnd_mode; /* Rounding mode */
+ char spec; /* Conversion specifier */
+
+ char pad; /* Padding character */
+};
+
+static void
+specinfo_init (struct printf_spec *specinfo)
+{
+ specinfo->alt = 0;
+ specinfo->space = 0;
+ specinfo->left = 0;
+ specinfo->showsign = 0;
+ specinfo->group = 0;
+ specinfo->width = 0;
+ specinfo->prec = 0;
+ specinfo->arg_type = NONE;
+ specinfo->rnd_mode = MPFR_RNDN;
+ specinfo->spec = '\0';
+ specinfo->pad = ' ';
+}
+
+#define FLOATING_POINT_ARG_TYPE(at) \
+ ((at) == MPFR_ARG || (at) == MPF_ARG || (at) == LONG_DOUBLE_ARG)
+
+#define INTEGER_LIKE_ARG_TYPE(at) \
+ ((at) == SHORT_ARG || (at) == LONG_ARG || (at) == LONG_LONG_ARG \
+ || (at) == INTMAX_ARG || (at) == MPFR_PREC_ARG || (at) == MPZ_ARG \
+ || (at) == MPQ_ARG || (at) == MP_LIMB_ARG || (at) == MP_LIMB_ARRAY_ARG \
+ || (at) == CHAR_ARG || (at) == SIZE_ARG || (at) == PTRDIFF_ARG)
+
+static int
+specinfo_is_valid (struct printf_spec spec)
+{
+ switch (spec.spec)
+ {
+ case 'n':
+ return -1;
+
+ case 'a': case 'A':
+ case 'e': case 'E':
+ case 'f': case 'F':
+ case 'g': case 'G':
+ return (spec.arg_type == NONE
+ || FLOATING_POINT_ARG_TYPE (spec.arg_type));
+
+ case 'b':
+ return spec.arg_type == MPFR_ARG;
+
+ case 'd': case 'i':
+ case 'u': case 'o':
+ case 'x': case 'X':
+ return (spec.arg_type == NONE
+ || INTEGER_LIKE_ARG_TYPE (spec.arg_type));
+
+ case 'c':
+ case 's':
+ return (spec.arg_type == NONE || spec.arg_type == LONG_ARG);
+
+ case 'p':
+ return spec.arg_type == NONE;
+
+ default:
+ return 0;
+ }
+}
+
+static const char *
+parse_flags (const char *format, struct printf_spec *specinfo)
+{
+ while (*format)
+ {
+ switch (*format)
+ {
+ case '0':
+ specinfo->pad = '0';
+ ++format;
+ break;
+ case '#':
+ specinfo->alt = 1;
+ ++format;
+ break;
+ case '+':
+ specinfo->showsign = 1;
+ ++format;
+ break;
+ case ' ':
+ specinfo->space = 1;
+ ++format;
+ break;
+ case '-':
+ specinfo->left = 1;
+ ++format;
+ break;
+ case '\'':
+ /* Single UNIX Specification for thousand separator */
+ specinfo->group = 1;
+ ++format;
+ break;
+ default:
+ return format;
+ }
+ }
+ return format;
+}
+
+static const char *
+parse_arg_type (const char *format, struct printf_spec *specinfo)
+{
+ switch (*format)
+ {
+ case '\0':
+ break;
+ case 'h':
+ if (*++format == 'h')
+#ifndef NPRINTF_HH
+ {
+ ++format;
+ specinfo->arg_type = CHAR_ARG;
+ }
+#else
+ specinfo->arg_type = UNSUPPORTED;
+#endif
+ else
+ specinfo->arg_type = SHORT_ARG;
+ break;
+ case 'l':
+ if (*++format == 'l')
+ {
+ ++format;
+#if defined (HAVE_LONG_LONG) && !defined(NPRINTF_LL)
+ specinfo->arg_type = LONG_LONG_ARG;
+#else
+ specinfo->arg_type = UNSUPPORTED;
+#endif
+ break;
+ }
+ else
+ {
+ specinfo->arg_type = LONG_ARG;
+ break;
+ }
+ case 'j':
+ ++format;
+#if defined(_MPFR_H_HAVE_INTMAX_T) && !defined(NPRINTF_J)
+ specinfo->arg_type = INTMAX_ARG;
+#else
+ specinfo->arg_type = UNSUPPORTED;
+#endif
+ break;
+ case 'z':
+ ++format;
+ specinfo->arg_type = SIZE_ARG;
+ break;
+ case 't':
+ ++format;
+#ifndef NPRINTF_T
+ specinfo->arg_type = PTRDIFF_ARG;
+#else
+ specinfo->arg_type = UNSUPPORTED;
+#endif
+ break;
+ case 'L':
+ ++format;
+#ifndef NPRINTF_L
+ specinfo->arg_type = LONG_DOUBLE_ARG;
+#else
+ specinfo->arg_type = UNSUPPORTED;
+#endif
+ break;
+ case 'F':
+ ++format;
+ specinfo->arg_type = MPF_ARG;
+ break;
+ case 'Q':
+ ++format;
+ specinfo->arg_type = MPQ_ARG;
+ break;
+ case 'M':
+ ++format;
+ /* The 'M' specifier was added in gmp 4.2.0 */
+ specinfo->arg_type = MP_LIMB_ARG;
+ break;
+ case 'N':
+ ++format;
+ specinfo->arg_type = MP_LIMB_ARRAY_ARG;
+ break;
+ case 'Z':
+ ++format;
+ specinfo->arg_type = MPZ_ARG;
+ break;
+
+ /* mpfr specific specifiers */
+ case 'P':
+ ++format;
+ specinfo->arg_type = MPFR_PREC_ARG;
+ break;
+ case 'R':
+ ++format;
+ specinfo->arg_type = MPFR_ARG;
+ }
+ return format;
+}
+
+
+/* some macros and functions filling the buffer */
+
+/* CONSUME_VA_ARG removes from va_list AP the type expected by SPECINFO */
+
+/* With a C++ compiler wchar_t and enumeration in va_list are converted to
+ integer type : int, unsigned int, long or unsigned long (unfortunately,
+ this is implementation dependant).
+ We follow gmp which assumes in print/doprnt.c that wchar_t is converted
+ to int (because wchar_t <= int).
+ For wint_t, we assume that the case WINT_MAX < INT_MAX yields an
+ integer promotion. */
+#ifdef HAVE_WCHAR_H
+#if defined(WINT_MAX) && WINT_MAX < INT_MAX
+typedef int mpfr_va_wint; /* integer promotion */
+#else
+typedef wint_t mpfr_va_wint;
+#endif
+#define CASE_LONG_ARG(specinfo, ap) \
+ case LONG_ARG: \
+ if (((specinfo).spec == 'd') || ((specinfo).spec == 'i') \
+ || ((specinfo).spec == 'o') || ((specinfo).spec == 'u') \
+ || ((specinfo).spec == 'x') || ((specinfo).spec == 'X')) \
+ (void) va_arg ((ap), long); \
+ else if ((specinfo).spec == 'c') \
+ (void) va_arg ((ap), mpfr_va_wint); \
+ else if ((specinfo).spec == 's') \
+ (void) va_arg ((ap), int); /* we assume integer promotion */ \
+ break;
+#else
+#define CASE_LONG_ARG(specinfo, ap) \
+ case LONG_ARG: \
+ (void) va_arg ((ap), long); \
+ break;
+#endif
+
+#if defined(_MPFR_H_HAVE_INTMAX_T)
+#define CASE_INTMAX_ARG(specinfo, ap) \
+ case INTMAX_ARG: \
+ (void) va_arg ((ap), intmax_t); \
+ break;
+#else
+#define CASE_INTMAX_ARG(specinfo, ap)
+#endif
+
+#ifdef HAVE_LONG_LONG
+#define CASE_LONG_LONG_ARG(specinfo, ap) \
+ case LONG_LONG_ARG: \
+ (void) va_arg ((ap), long long); \
+ break;
+#else
+#define CASE_LONG_LONG_ARG(specinfo, ap)
+#endif
+
+#define CONSUME_VA_ARG(specinfo, ap) \
+ do { \
+ switch ((specinfo).arg_type) \
+ { \
+ case CHAR_ARG: \
+ case SHORT_ARG: \
+ (void) va_arg ((ap), int); \
+ break; \
+ CASE_LONG_ARG (specinfo, ap) \
+ CASE_LONG_LONG_ARG (specinfo, ap) \
+ CASE_INTMAX_ARG (specinfo, ap) \
+ case SIZE_ARG: \
+ (void) va_arg ((ap), size_t); \
+ break; \
+ case PTRDIFF_ARG: \
+ (void) va_arg ((ap), ptrdiff_t); \
+ break; \
+ case LONG_DOUBLE_ARG: \
+ (void) va_arg ((ap), long double); \
+ break; \
+ case MPF_ARG: \
+ (void) va_arg ((ap), mpf_srcptr); \
+ break; \
+ case MPQ_ARG: \
+ (void) va_arg ((ap), mpq_srcptr); \
+ break; \
+ case MP_LIMB_ARG: \
+ (void) va_arg ((ap), mp_limb_t); \
+ break; \
+ case MP_LIMB_ARRAY_ARG: \
+ (void) va_arg ((ap), mpfr_limb_ptr); \
+ (void) va_arg ((ap), mp_size_t); \
+ break; \
+ case MPZ_ARG: \
+ (void) va_arg ((ap), mpz_srcptr); \
+ break; \
+ default: \
+ switch ((specinfo).spec) \
+ { \
+ case 'd': \
+ case 'i': \
+ case 'o': \
+ case 'u': \
+ case 'x': \
+ case 'X': \
+ case 'c': \
+ (void) va_arg ((ap), int); \
+ break; \
+ case 'f': \
+ case 'F': \
+ case 'e': \
+ case 'E': \
+ case 'g': \
+ case 'G': \
+ case 'a': \
+ case 'A': \
+ (void) va_arg ((ap), double); \
+ break; \
+ case 's': \
+ (void) va_arg ((ap), char *); \
+ break; \
+ case 'p': \
+ (void) va_arg ((ap), void *); \
+ } \
+ } \
+ } while (0)
+
+/* process the format part which does not deal with mpfr types,
+ jump to external label 'error' if gmp_asprintf return -1. */
+#define FLUSH(flag, start, end, ap, buf_ptr) \
+ do { \
+ const size_t n = (end) - (start); \
+ if ((flag)) \
+ /* previous specifiers are understood by gmp_printf */ \
+ { \
+ MPFR_TMP_DECL (marker); \
+ char *fmt_copy; \
+ MPFR_TMP_MARK (marker); \
+ fmt_copy = (char*) MPFR_TMP_ALLOC (n + 1); \
+ strncpy (fmt_copy, (start), n); \
+ fmt_copy[n] = '\0'; \
+ if (sprntf_gmp ((buf_ptr), (fmt_copy), (ap)) == -1) \
+ { \
+ MPFR_TMP_FREE (marker); \
+ goto error; \
+ } \
+ (flag) = 0; \
+ MPFR_TMP_FREE (marker); \
+ } \
+ else if ((start) != (end)) \
+ /* no conversion specification, just simple characters */ \
+ buffer_cat ((buf_ptr), (start), n); \
+ } while (0)
+
+struct string_buffer
+{
+ char *start; /* beginning of the buffer */
+ char *curr; /* null terminating character */
+ size_t size; /* buffer capacity */
+};
+
+static void
+buffer_init (struct string_buffer *b, size_t s)
+{
+ b->start = (char *) (*__gmp_allocate_func) (s);
+ b->start[0] = '\0';
+ b->curr = b->start;
+ b->size = s;
+}
+
+/* Increase buffer size by a number of character being the least multiple of
+ 4096 greater than LEN+1. */
+static void
+buffer_widen (struct string_buffer *b, size_t len)
+{
+ const size_t pos = b->curr - b->start;
+ const size_t n = 0x1000 + (len & ~((size_t) 0xfff));
+ MPFR_ASSERTD (pos < b->size);
+
+ MPFR_ASSERTN ((len & ~((size_t) 4095)) <= (size_t)(SIZE_MAX - 4096));
+ MPFR_ASSERTN (b->size < SIZE_MAX - n);
+
+ b->start =
+ (char *) (*__gmp_reallocate_func) (b->start, b->size, b->size + n);
+ b->size += n;
+ b->curr = b->start + pos;
+
+ MPFR_ASSERTD (pos < b->size);
+ MPFR_ASSERTD (*b->curr == '\0');
+}
+
+/* Concatenate the LEN first characters of the string S to the buffer B and
+ expand it if needed. */
+static void
+buffer_cat (struct string_buffer *b, const char *s, size_t len)
+{
+ MPFR_ASSERTD (len != 0);
+ MPFR_ASSERTD (len <= strlen (s));
+
+ if (MPFR_UNLIKELY ((b->curr + len) >= (b->start + b->size)))
+ buffer_widen (b, len);
+
+ strncat (b->curr, s, len);
+ b->curr += len;
+
+ MPFR_ASSERTD (b->curr < b->start + b->size);
+ MPFR_ASSERTD (*b->curr == '\0');
+}
+
+/* Add N characters C to the end of buffer B */
+static void
+buffer_pad (struct string_buffer *b, const char c, const size_t n)
+{
+ MPFR_ASSERTD (n != 0);
+
+ MPFR_ASSERTN (b->size < SIZE_MAX - n - 1);
+ if (MPFR_UNLIKELY ((b->curr + n + 1) > (b->start + b->size)))
+ buffer_widen (b, n);
+
+ if (n == 1)
+ *b->curr = c;
+ else
+ memset (b->curr, c, n);
+ b->curr += n;
+ *b->curr = '\0';
+
+ MPFR_ASSERTD (b->curr < b->start + b->size);
+}
+
+/* Form a string by concatenating the first LEN characters of STR to TZ
+ zero(s), insert into one character C each 3 characters starting from end
+ to begining and concatenate the result to the buffer B. */
+static void
+buffer_sandwich (struct string_buffer *b, char *str, size_t len,
+ const size_t tz, const char c)
+{
+ const size_t step = 3;
+ const size_t size = len + tz;
+ const size_t r = size % step == 0 ? step : size % step;
+ const size_t q = size % step == 0 ? size / step - 1 : size / step;
+ size_t i;
+
+ MPFR_ASSERTD (size != 0);
+ if (c == '\0')
+ {
+ buffer_cat (b, str, len);
+ buffer_pad (b, '0', tz);
+ return;
+ }
+
+ MPFR_ASSERTN (b->size < SIZE_MAX - size - 1 - q);
+ MPFR_ASSERTD (len <= strlen (str));
+ if (MPFR_UNLIKELY ((b->curr + size + 1 + q) > (b->start + b->size)))
+ buffer_widen (b, size + q);
+
+ /* first R significant digits */
+ memcpy (b->curr, str, r);
+ b->curr += r;
+ str += r;
+ len -= r;
+
+ /* blocks of thousands. Warning: STR might end in the middle of a block */
+ for (i = 0; i < q; ++i)
+ {
+ *b->curr++ = c;
+ if (MPFR_LIKELY (len > 0))
+ {
+ if (MPFR_LIKELY (len >= step))
+ /* step significant digits */
+ {
+ memcpy (b->curr, str, step);
+ len -= step;
+ }
+ else
+ /* last digits in STR, fill up thousand block with zeros */
+ {
+ memcpy (b->curr, str, len);
+ memset (b->curr + len, '0', step - len);
+ len = 0;
+ }
+ }
+ else
+ /* trailing zeros */
+ memset (b->curr, '0', step);
+
+ b->curr += step;
+ str += step;
+ }
+
+ *b->curr = '\0';
+
+ MPFR_ASSERTD (b->curr < b->start + b->size);
+}
+
+/* let gmp_xprintf process the part it can understand */
+static int
+sprntf_gmp (struct string_buffer *b, const char *fmt, va_list ap)
+{
+ int length;
+ char *s;
+
+ length = gmp_vasprintf (&s, fmt, ap);
+ if (length > 0)
+ buffer_cat (b, s, length);
+
+ mpfr_free_str (s);
+ return length;
+}
+
+/* Helper struct and functions for temporary strings management */
+/* struct for easy string clearing */
+struct string_list
+{
+ char *string;
+ struct string_list *next; /* NULL in last node */
+};
+
+/* initialisation */
+static void
+init_string_list (struct string_list *sl)
+{
+ sl->string = NULL;
+ sl->next = NULL;
+}
+
+/* clear all strings in the list */
+static void
+clear_string_list (struct string_list *sl)
+{
+ struct string_list *n;
+
+ while (sl)
+ {
+ if (sl->string)
+ mpfr_free_str (sl->string);
+ n = sl->next;
+ (*__gmp_free_func) (sl, sizeof(struct string_list));
+ sl = n;
+ }
+}
+
+/* add a string in the list */
+static char *
+register_string (struct string_list *sl, char *new_string)
+{
+ /* look for the last node */
+ while (sl->next)
+ sl = sl->next;
+
+ sl->next = (struct string_list*)
+ (*__gmp_allocate_func) (sizeof (struct string_list));
+
+ sl = sl->next;
+ sl->next = NULL;
+ return sl->string = new_string;
+}
+
+/* padding type: where are the padding characters */
+enum pad_t
+ {
+ LEFT, /* spaces in left hand side for right justification */
+ LEADING_ZEROS, /* padding with '0' characters in integral part */
+ RIGHT /* spaces in right hand side for left justification */
+ };
+
+/* number_parts details how much characters are needed in each part of a float
+ print. */
+struct number_parts
+{
+ enum pad_t pad_type; /* Padding type */
+ size_t pad_size; /* Number of padding characters */
+
+ char sign; /* Sign character */
+
+ char *prefix_ptr; /* Pointer to prefix part */
+ size_t prefix_size; /* Number of characters in *prefix_ptr */
+
+ char thousands_sep; /* Thousands separator (only with style 'f') */
+
+ char *ip_ptr; /* Pointer to integral part characters*/
+ size_t ip_size; /* Number of digits in *ip_ptr */
+ int ip_trailing_zeros; /* Number of additional null digits in integral
+ part */
+
+ char point; /* Decimal point character */
+
+ int fp_leading_zeros; /* Number of additional leading zeros in fractional
+ part */
+ char *fp_ptr; /* Pointer to fractional part characters */
+ size_t fp_size; /* Number of digits in *fp_ptr */
+ int fp_trailing_zeros; /* Number of additional trailing zeros in fractional
+ part */
+
+ char *exp_ptr; /* Pointer to exponent part */
+ size_t exp_size; /* Number of characters in *exp_ptr */
+
+ struct string_list *sl; /* List of string buffers in use: we need such a
+ mechanism because fp_ptr may point into the same
+ string as ip_ptr */
+};
+
+/* For a real non zero number x, what is the base exponent f when rounding x
+ with rounding mode r to r(x) = m*b^f, where m is a digit and 1 <= m < b ?
+ Return non zero value if x is rounded up to b^f, return zero otherwise */
+static int
+next_base_power_p (mpfr_srcptr x, int base, mpfr_rnd_t rnd)
+{
+ mpfr_prec_t nbits;
+ mp_limb_t pm;
+ mp_limb_t xm;
+
+ MPFR_ASSERTD (MPFR_IS_PURE_FP (x));
+ MPFR_ASSERTD (base == 2 || base == 16);
+
+ /* Warning: the decimal point is AFTER THE FIRST DIGIT in this output
+ representation. */
+ nbits = base == 2 ? 1 : 4;
+
+ if (rnd == MPFR_RNDZ
+ || (rnd == MPFR_RNDD && MPFR_IS_POS (x))
+ || (rnd == MPFR_RNDU && MPFR_IS_NEG (x))
+ || MPFR_PREC (x) <= nbits)
+ /* no rounding when printing x with 1 digit */
+ return 0;
+
+ xm = MPFR_MANT (x) [MPFR_LIMB_SIZE (x) - 1];
+ pm = MPFR_LIMB_MASK (GMP_NUMB_BITS - nbits);
+ if ((xm & ~pm) ^ ~pm)
+ /* do no round up if some of the nbits first bits are 0s. */
+ return 0;
+
+ if (rnd == MPFR_RNDN)
+ /* mask for rounding bit */
+ pm = (MPFR_LIMB_ONE << (GMP_NUMB_BITS - nbits - 1));
+
+ /* round up if some remaining bits are 1 */
+ /* warning: the return value must be an int */
+ return xm & pm ? 1 : 0;
+}
+
+/* Record information from mpfr_get_str() so as to avoid multiple
+ calls to this expensive function. */
+struct decimal_info
+{
+ mpfr_exp_t exp;
+ char *str;
+};
+
+/* For a real non zero number x, what is the exponent f so that
+ 10^f <= x < 10^(f+1). */
+static mpfr_exp_t
+floor_log10 (mpfr_srcptr x)
+{
+ mpfr_t y;
+ mpfr_exp_t exp;
+
+ /* make sure first that y can represent a mpfr_exp_t exactly
+ and can compare with x */
+ mpfr_prec_t prec = sizeof (mpfr_exp_t) * CHAR_BIT;
+ mpfr_init2 (y, MAX (prec, MPFR_PREC (x)));
+
+ exp = mpfr_ceil_mul (MPFR_GET_EXP (x), 10, 1) - 1;
+ mpfr_set_exp_t (y, exp, MPFR_RNDU);
+ /* The following call to mpfr_ui_pow should be fast: y is an integer
+ (not too large), so that mpfr_pow_z will be used internally. */
+ mpfr_ui_pow (y, 10, y, MPFR_RNDU);
+ if (mpfr_cmpabs (x, y) < 0)
+ exp--;
+
+ mpfr_clear (y);
+ return exp;
+}
+
+/* Determine the different parts of the string representation of the regular
+ number P when SPEC.SPEC is 'a', 'A', or 'b'.
+
+ return -1 if some field > INT_MAX */
+static int
+regular_ab (struct number_parts *np, mpfr_srcptr p,
+ const struct printf_spec spec)
+{
+ int uppercase;
+ int base;
+ char *str;
+ mpfr_exp_t exp;
+
+ uppercase = spec.spec == 'A';
+
+ /* sign */
+ if (MPFR_IS_NEG (p))
+ np->sign = '-';
+ else if (spec.showsign || spec.space)
+ np->sign = spec.showsign ? '+' : ' ';
+
+ if (spec.spec == 'a' || spec.spec == 'A')
+ /* prefix part */
+ {
+ np->prefix_size = 2;
+ str = (char *) (*__gmp_allocate_func) (1 + np->prefix_size);
+ str[0] = '0';
+ str[1] = uppercase ? 'X' : 'x';
+ str[2] = '\0';
+ np->prefix_ptr = register_string (np->sl, str);
+ }
+
+ /* integral part */
+ np->ip_size = 1;
+ base = (spec.spec == 'b') ? 2 : 16;
+
+ if (spec.prec != 0)
+ {
+ size_t nsd;
+
+ /* Number of significant digits:
+ - if no given precision, let mpfr_get_str determine it;
+ - if a non-zero precision is specified, then one digit before decimal
+ point plus SPEC.PREC after it. */
+ nsd = spec.prec < 0 ? 0 : spec.prec + np->ip_size;
+ str = mpfr_get_str (0, &exp, base, nsd, p, spec.rnd_mode);
+ register_string (np->sl, str);
+ np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign if any */
+
+ if (base == 16)
+ /* EXP is the exponent for radix sixteen with decimal point BEFORE the
+ first digit, we want the exponent for radix two and the decimal
+ point AFTER the first digit. */
+ {
+ MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */
+ exp = (exp - 1) * 4;
+ }
+ else
+ /* EXP is the exponent for decimal point BEFORE the first digit, we
+ want the exponent for decimal point AFTER the first digit. */
+ {
+ MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */
+ --exp;
+ }
+ }
+ else if (next_base_power_p (p, base, spec.rnd_mode))
+ {
+ str = (char *)(*__gmp_allocate_func) (2);
+ str[0] = '1';
+ str[1] = '\0';
+ np->ip_ptr = register_string (np->sl, str);
+
+ exp = MPFR_GET_EXP (p);
+ }
+ else if (base == 2)
+ {
+ str = (char *)(*__gmp_allocate_func) (2);
+ str[0] = '1';
+ str[1] = '\0';
+ np->ip_ptr = register_string (np->sl, str);
+
+ exp = MPFR_GET_EXP (p) - 1;
+ }
+ else
+ {
+ int digit;
+ mp_limb_t msl = MPFR_MANT (p)[MPFR_LIMB_SIZE (p) - 1];
+ int rnd_bit = GMP_NUMB_BITS - 5;
+
+ /* pick up the 4 first bits */
+ digit = msl >> (rnd_bit+1);
+ if (spec.rnd_mode == MPFR_RNDA
+ || (spec.rnd_mode == MPFR_RNDU && MPFR_IS_POS (p))
+ || (spec.rnd_mode == MPFR_RNDD && MPFR_IS_NEG (p))
+ || (spec.rnd_mode == MPFR_RNDN
+ && (msl & (MPFR_LIMB_ONE << rnd_bit))))
+ digit++;
+ MPFR_ASSERTD ((0 <= digit) && (digit <= 15));
+
+ str = (char *)(*__gmp_allocate_func) (1 + np->ip_size);
+ str[0] = num_to_text [digit];
+ str[1] = '\0';
+ np->ip_ptr = register_string (np->sl, str);
+
+ exp = MPFR_GET_EXP (p) - 4;
+ }
+
+ if (uppercase)
+ /* All digits in upper case */
+ {
+ char *s1 = str;
+ while (*s1)
+ {
+ switch (*s1)
+ {
+ case 'a':
+ *s1 = 'A';
+ break;
+ case 'b':
+ *s1 = 'B';
+ break;
+ case 'c':
+ *s1 = 'C';
+ break;
+ case 'd':
+ *s1 = 'D';
+ break;
+ case 'e':
+ *s1 = 'E';
+ break;
+ case 'f':
+ *s1 = 'F';
+ break;
+ }
+ s1++;
+ }
+ }
+
+ if (spec.spec == 'b' || spec.prec != 0)
+ /* compute the number of digits in fractional part */
+ {
+ char *ptr;
+ size_t str_len;
+
+ /* the sign has been skipped, skip also the first digit */
+ ++str;
+ str_len = strlen (str);
+ ptr = str + str_len - 1; /* points to the end of str */
+
+ if (spec.prec < 0)
+ /* remove trailing zeros, if any */
+ {
+ while ((*ptr == '0') && (str_len != 0))
+ {
+ --ptr;
+ --str_len;
+ }
+ }
+
+ if (str_len > INT_MAX)
+ /* too many digits in fractional part */
+ return -1;
+
+ if (str_len != 0)
+ /* there are some non-zero digits in fractional part */
+ {
+ np->fp_ptr = str;
+ np->fp_size = str_len;
+ if ((int) str_len < spec.prec)
+ np->fp_trailing_zeros = spec.prec - str_len;
+ }
+ }
+
+ /* decimal point */
+ if ((np->fp_size != 0) || spec.alt)
+ np->point = MPFR_DECIMAL_POINT;
+
+ /* the exponent part contains the character 'p', or 'P' plus the sign
+ character plus at least one digit and only as many more digits as
+ necessary to represent the exponent.
+ We assume that |EXP| < 10^INT_MAX. */
+ np->exp_size = 3;
+ {
+ mpfr_uexp_t x;
+
+ x = SAFE_ABS (mpfr_uexp_t, exp);
+ while (x > 9)
+ {
+ np->exp_size++;
+ x /= 10;
+ }
+ }
+ str = (char *) (*__gmp_allocate_func) (1 + np->exp_size);
+ np->exp_ptr = register_string (np->sl, str);
+ {
+ char exp_fmt[8]; /* contains at most 7 characters like in "p%+.1i",
+ or "P%+.2li" */
+
+ exp_fmt[0] = uppercase ? 'P' : 'p';
+ exp_fmt[1] = '\0';
+ strcat (exp_fmt, "%+.1" MPFR_EXP_FSPEC "d");
+
+ if (sprintf (str, exp_fmt, (mpfr_eexp_t) exp) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Determine the different parts of the string representation of the regular
+ number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'.
+ DEC_INFO contains the previously computed exponent and string or is NULL.
+
+ return -1 if some field > INT_MAX */
+static int
+regular_eg (struct number_parts *np, mpfr_srcptr p,
+ const struct printf_spec spec, struct decimal_info *dec_info)
+{
+ char *str;
+ mpfr_exp_t exp;
+
+ const int uppercase = spec.spec == 'E' || spec.spec == 'G';
+ const int spec_g = spec.spec == 'g' || spec.spec == 'G';
+ const int keep_trailing_zeros = (spec_g && spec.alt)
+ || (!spec_g && (spec.prec > 0));
+
+ /* sign */
+ if (MPFR_IS_NEG (p))
+ np->sign = '-';
+ else if (spec.showsign || spec.space)
+ np->sign = spec.showsign ? '+' : ' ';
+
+ /* integral part */
+ np->ip_size = 1;
+ if (dec_info == NULL)
+ {
+ size_t nsd;
+
+ /* Number of significant digits:
+ - if no given precision, then let mpfr_get_str determine it,
+ - if a precision is specified, then one digit before decimal point
+ plus SPEC.PREC after it.
+ We use the fact here that mpfr_get_str allows us to ask for only one
+ significant digit when the base is not a power of 2. */
+ nsd = (spec.prec < 0) ? 0 : spec.prec + np->ip_size;
+ str = mpfr_get_str (0, &exp, 10, nsd, p, spec.rnd_mode);
+ register_string (np->sl, str);
+ }
+ else
+ {
+ exp = dec_info->exp;
+ str = dec_info->str;
+ }
+ np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign if any */
+
+ if (spec.prec != 0)
+ /* compute the number of digits in fractional part */
+ {
+ char *ptr;
+ size_t str_len;
+
+ /* the sign has been skipped, skip also the first digit */
+ ++str;
+ str_len = strlen (str);
+ ptr = str + str_len - 1; /* points to the end of str */
+
+ if (!keep_trailing_zeros)
+ /* remove trailing zeros, if any */
+ {
+ while ((*ptr == '0') && (str_len != 0))
+ {
+ --ptr;
+ --str_len;
+ }
+ }
+
+ if (str_len > INT_MAX)
+ /* too many digits in fractional part */
+ return -1;
+
+ if (str_len != 0)
+ /* there are some non-zero digits in fractional part */
+ {
+ np->fp_ptr = str;
+ np->fp_size = str_len;
+ if ((!spec_g || spec.alt) && (spec.prec > 0)
+ && ((int)str_len < spec.prec))
+ /* add missing trailing zeros */
+ np->fp_trailing_zeros = spec.prec - str_len;
+ }
+ }
+
+ /* decimal point */
+ if (np->fp_size != 0 || spec.alt)
+ np->point = MPFR_DECIMAL_POINT;
+
+ /* EXP is the exponent for decimal point BEFORE the first digit, we want
+ the exponent for decimal point AFTER the first digit.
+ Here, no possible overflow because exp < MPFR_EXP (p) / 3 */
+ exp--;
+
+ /* the exponent part contains the character 'e', or 'E' plus the sign
+ character plus at least two digits and only as many more digits as
+ necessary to represent the exponent.
+ We assume that |EXP| < 10^INT_MAX. */
+ np->exp_size = 3;
+ {
+ mpfr_uexp_t x;
+
+ x = SAFE_ABS (mpfr_uexp_t, exp);
+ while (x > 9)
+ {
+ np->exp_size++;
+ x /= 10;
+ }
+ }
+ if (np->exp_size < 4)
+ np->exp_size = 4;
+
+ str = (char *) (*__gmp_allocate_func) (1 + np->exp_size);
+ np->exp_ptr = register_string (np->sl, str);
+
+ {
+ char exp_fmt[8]; /* e.g. "e%+.2i", or "E%+.2li" */
+
+ exp_fmt[0] = uppercase ? 'E' : 'e';
+ exp_fmt[1] = '\0';
+ strcat (exp_fmt, "%+.2" MPFR_EXP_FSPEC "d");
+
+ if (sprintf (str, exp_fmt, (mpfr_eexp_t) exp) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Determine the different parts of the string representation of the regular
+ number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'.
+ DEC_INFO contains the previously computed exponent and string or is NULL.
+
+ return -1 if some field of number_parts is greater than INT_MAX */
+static int
+regular_fg (struct number_parts *np, mpfr_srcptr p,
+ const struct printf_spec spec, struct decimal_info *dec_info)
+{
+ mpfr_exp_t exp;
+ char * str;
+ const int spec_g = (spec.spec == 'g' || spec.spec == 'G');
+ const int keep_trailing_zeros = !spec_g || spec.alt;
+
+ /* WARNING: an empty precision field is forbidden (it means precision = 6
+ and it should have been changed to 6 before the function call) */
+ MPFR_ASSERTD (spec.prec >= 0);
+
+ /* sign */
+ if (MPFR_IS_NEG (p))
+ np->sign = '-';
+ else if (spec.showsign || spec.space)
+ np->sign = spec.showsign ? '+' : ' ';
+
+ if (MPFR_GET_EXP (p) <= 0)
+ /* 0 < |p| < 1 */
+ {
+ /* Most of the time, integral part is 0 */
+ np->ip_size = 1;
+ str = (char *) (*__gmp_allocate_func) (1 + np->ip_size);
+ str[0] = '0';
+ str[1] = '\0';
+ np->ip_ptr = register_string (np->sl, str);
+
+ if (spec.prec == 0)
+ /* only two possibilities: either 1 or 0. */
+ {
+ mpfr_t y;
+ /* y = abs(p) */
+ MPFR_ALIAS (y, p, 1, MPFR_EXP (p));
+
+ if (spec.rnd_mode == MPFR_RNDA
+ || (spec.rnd_mode == MPFR_RNDD && MPFR_IS_NEG (p))
+ || (spec.rnd_mode == MPFR_RNDU && MPFR_IS_POS (p))
+ || (spec.rnd_mode == MPFR_RNDN && mpfr_cmp_d (y, 0.5) > 0))
+ /* rounded up to 1: one digit '1' in integral part.
+ note that 0.5 is rounded to 0 with RNDN (round ties to even) */
+ np->ip_ptr[0] = '1';
+ }
+ else
+ {
+ /* exp = position of the most significant decimal digit. */
+ exp = floor_log10 (p);
+ MPFR_ASSERTD (exp < 0);
+
+ if (exp < -spec.prec)
+ /* only the last digit may be non zero */
+ {
+ int round_away;
+ switch (spec.rnd_mode)
+ {
+ case MPFR_RNDA:
+ round_away = 1;
+ break;
+ case MPFR_RNDD:
+ round_away = MPFR_IS_NEG (p);
+ break;
+ case MPFR_RNDU:
+ round_away = MPFR_IS_POS (p);
+ break;
+ case MPFR_RNDN:
+ {
+ /* compare |p| to y = 0.5*10^(-spec.prec) */
+ mpfr_t y;
+ mpfr_exp_t e = MAX (MPFR_PREC (p), 56);
+ mpfr_init2 (y, e + 8);
+ do
+ {
+ /* find a lower approximation of
+ 0.5*10^(-spec.prec) different from |p| */
+ e += 8;
+ mpfr_set_prec (y, e);
+ mpfr_set_si (y, -spec.prec, MPFR_RNDN);
+ mpfr_exp10 (y, y, MPFR_RNDD);
+ mpfr_div_2ui (y, y, 1, MPFR_RNDN);
+ } while (mpfr_cmpabs (y, p) == 0);
+
+ round_away = mpfr_cmpabs (y, p) < 0;
+ mpfr_clear (y);
+ }
+ break;
+ default:
+ round_away = 0;
+ }
+
+ if (round_away)
+ /* round away from zero: the last output digit is '1' */
+ {
+ np->fp_leading_zeros = spec.prec - 1;
+
+ np->fp_size = 1;
+ str =
+ (char *) (*__gmp_allocate_func) (1 + np->fp_size);
+ str[0] = '1';
+ str[1] = '\0';
+ np->fp_ptr = register_string (np->sl, str);
+ }
+ else
+ /* only zeros in fractional part */
+ {
+ MPFR_ASSERTD (!spec_g);
+ np->fp_leading_zeros = spec.prec;
+ }
+ }
+ else
+ /* the most significant digits are the last
+ spec.prec + exp + 1 digits in fractional part */
+ {
+ char *ptr;
+ size_t str_len;
+ if (dec_info == NULL)
+ {
+ size_t nsd = spec.prec + exp + 1;
+ /* WARNING: nsd may equal 1, but here we use the
+ fact that mpfr_get_str can return one digit with
+ base ten (undocumented feature, see comments in
+ get_str.c) */
+
+ str = mpfr_get_str (NULL, &exp, 10, nsd, p, spec.rnd_mode);
+ register_string (np->sl, str);
+ }
+ else
+ {
+ exp = dec_info->exp;
+ str = dec_info->str;
+ }
+ if (MPFR_IS_NEG (p))
+ /* skip sign */
+ ++str;
+ if (exp == 1)
+ /* round up to 1 */
+ {
+ MPFR_ASSERTD (str[0] == '1');
+ np->ip_ptr[0] = '1';
+ if (!spec_g || spec.alt)
+ np->fp_leading_zeros = spec.prec;
+ }
+ else
+ {
+ np->fp_ptr = str;
+ np->fp_leading_zeros = -exp;
+ MPFR_ASSERTD (exp <= 0);
+
+ str_len = strlen (str); /* the sign has been skipped */
+ ptr = str + str_len - 1; /* points to the end of str */
+
+ if (!keep_trailing_zeros)
+ /* remove trailing zeros, if any */
+ {
+ while ((*ptr == '0') && str_len)
+ {
+ --ptr;
+ --str_len;
+ }
+ }
+
+ if (str_len > INT_MAX)
+ /* too many digits in fractional part */
+ return -1;
+
+ MPFR_ASSERTD (str_len > 0);
+ np->fp_size = str_len;
+
+ if ((!spec_g || spec.alt)
+ && spec.prec > 0
+ && (np->fp_leading_zeros + np->fp_size < spec.prec))
+ /* add missing trailing zeros */
+ np->fp_trailing_zeros = spec.prec - np->fp_leading_zeros
+ - np->fp_size;
+ }
+ }
+ }
+
+ if (spec.alt || np->fp_leading_zeros != 0 || np->fp_size != 0
+ || np->fp_trailing_zeros != 0)
+ np->point = MPFR_DECIMAL_POINT;
+ }
+ else
+ /* 1 <= |p| */
+ {
+ size_t str_len;
+
+ /* Determine the position of the most significant decimal digit. */
+ exp = floor_log10 (p);
+ MPFR_ASSERTD (exp >= 0);
+ if (exp > INT_MAX)
+ /* P is too large to print all its integral part digits */
+ return -1;
+
+ if (dec_info == NULL)
+ { /* this case occurs with mpfr_printf ("%.0RUf", x) with x=9.5 */
+ str =
+ mpfr_get_str (NULL, &exp, 10, spec.prec+exp+1, p, spec.rnd_mode);
+ register_string (np->sl, str);
+ }
+ else
+ {
+ exp = dec_info->exp;
+ str = dec_info->str;
+ }
+ np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign */
+ str_len = strlen (str);
+
+ /* integral part */
+ if (exp > str_len)
+ /* mpfr_get_str gives no trailing zero when p is rounded up to the next
+ power of 10 (p integer, so no fractional part) */
+ {
+ np->ip_trailing_zeros = exp - str_len;
+ np->ip_size = str_len;
+ }
+ else
+ np->ip_size = exp;
+
+ if (spec.group)
+ /* thousands separator in integral part */
+ np->thousands_sep = MPFR_THOUSANDS_SEPARATOR;
+
+ /* fractional part */
+ str += np->ip_size;
+ str_len -= np->ip_size;
+ if (!keep_trailing_zeros)
+ /* remove trailing zeros, if any */
+ {
+ char *ptr = str + str_len - 1; /* pointer to the last digit of
+ str */
+ while ((*ptr == '0') && (str_len != 0))
+ {
+ --ptr;
+ --str_len;
+ }
+ }
+
+ if (str_len > 0)
+ /* some nonzero digits in fractional part */
+ {
+ if (str_len > INT_MAX)
+ /* too many digits in fractional part */
+ return -1;
+
+ np->point = MPFR_DECIMAL_POINT;
+ np->fp_ptr = str;
+ np->fp_size = str_len;
+ }
+
+ if (keep_trailing_zeros && str_len < spec.prec)
+ /* add missing trailing zeros */
+ {
+ np->point = MPFR_DECIMAL_POINT;
+ np->fp_trailing_zeros = spec.prec - np->fp_size;
+ }
+
+ if (spec.alt)
+ /* add decimal point even if no digits follow it */
+ np->point = MPFR_DECIMAL_POINT;
+ }
+
+ return 0;
+}
+
+/* partition_number determines the different parts of the string
+ representation of the number p according to the given specification.
+ partition_number initializes the given structure np, so all previous
+ information in that variable is lost.
+ return the total number of characters to be written.
+ return -1 if an error occured, in that case np's fields are in an undefined
+ state but all string buffers have been freed. */
+static int
+partition_number (struct number_parts *np, mpfr_srcptr p,
+ struct printf_spec spec)
+{
+ char *str;
+ long total;
+ int uppercase;
+
+ /* WARNING: left justification means right space padding */
+ np->pad_type = spec.left ? RIGHT : spec.pad == '0' ? LEADING_ZEROS : LEFT;
+ np->pad_size = 0;
+ np->sign = '\0';
+ np->prefix_ptr =NULL;
+ np->prefix_size = 0;
+ np->thousands_sep = '\0';
+ np->ip_ptr = NULL;
+ np->ip_size = 0;
+ np->ip_trailing_zeros = 0;
+ np->point = '\0';
+ np->fp_leading_zeros = 0;
+ np->fp_ptr = NULL;
+ np->fp_size = 0;
+ np->fp_trailing_zeros = 0;
+ np->exp_ptr = NULL;
+ np->exp_size = 0;
+ np->sl = (struct string_list *)
+ (*__gmp_allocate_func) (sizeof (struct string_list));
+ init_string_list (np->sl);
+
+ uppercase = spec.spec == 'A' || spec.spec == 'E' || spec.spec == 'F'
+ || spec.spec == 'G';
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (p)))
+ {
+ if (MPFR_IS_NAN (p))
+ {
+ if (np->pad_type == LEADING_ZEROS)
+ /* don't want "0000nan", change to right justification padding
+ with left spaces instead */
+ np->pad_type = LEFT;
+
+ if (uppercase)
+ {
+ np->ip_size = MPFR_NAN_STRING_LENGTH;
+ str = (char *) (*__gmp_allocate_func) (1 + np->ip_size);
+ strcpy (str, MPFR_NAN_STRING_UC);
+ np->ip_ptr = register_string (np->sl, str);
+ }
+ else
+ {
+ np->ip_size = MPFR_NAN_STRING_LENGTH;
+ str = (char *) (*__gmp_allocate_func) (1 + np->ip_size);
+ strcpy (str, MPFR_NAN_STRING_LC);
+ np->ip_ptr = register_string (np->sl, str);
+ }
+ }
+ else if (MPFR_IS_INF (p))
+ {
+ if (np->pad_type == LEADING_ZEROS)
+ /* don't want "0000inf", change to right justification padding
+ with left spaces instead */
+ np->pad_type = LEFT;
+
+ if (MPFR_IS_NEG (p))
+ np->sign = '-';
+
+ if (uppercase)
+ {
+ np->ip_size = MPFR_INF_STRING_LENGTH;
+ str = (char *) (*__gmp_allocate_func) (1 + np->ip_size);
+ strcpy (str, MPFR_INF_STRING_UC);
+ np->ip_ptr = register_string (np->sl, str);
+ }
+ else
+ {
+ np->ip_size = MPFR_INF_STRING_LENGTH;
+ str = (char *) (*__gmp_allocate_func) (1 + np->ip_size);
+ strcpy (str, MPFR_INF_STRING_LC);
+ np->ip_ptr = register_string (np->sl, str);
+ }
+ }
+ else
+ /* p == 0 */
+ {
+ /* note: for 'g' spec, zero is always displayed with 'f'-style with
+ precision spec.prec - 1 and the trailing zeros are removed unless
+ the flag '#' is used. */
+ if (MPFR_IS_NEG (p))
+ /* signed zero */
+ np->sign = '-';
+ else if (spec.showsign || spec.space)
+ np->sign = spec.showsign ? '+' : ' ';
+
+ if (spec.spec == 'a' || spec.spec == 'A')
+ /* prefix part */
+ {
+ np->prefix_size = 2;
+ str = (char *) (*__gmp_allocate_func) (1 + np->prefix_size);
+ str[0] = '0';
+ str[1] = uppercase ? 'X' : 'x';
+ str[2] = '\0';
+ np->prefix_ptr = register_string (np->sl, str);
+ }
+
+ /* integral part */
+ np->ip_size = 1;
+ str = (char *) (*__gmp_allocate_func) (1 + np->ip_size);
+ str[0] = '0';
+ str[1] = '\0';
+ np->ip_ptr = register_string (np->sl, str);
+
+ if (spec.prec > 0
+ && ((spec.spec != 'g' && spec.spec != 'G') || spec.alt))
+ /* fractional part */
+ {
+ np->point = MPFR_DECIMAL_POINT;
+ np->fp_trailing_zeros = (spec.spec == 'g' && spec.spec == 'G') ?
+ spec.prec - 1 : spec.prec;
+ }
+ else if (spec.alt)
+ np->point = MPFR_DECIMAL_POINT;
+
+ if (spec.spec == 'a' || spec.spec == 'A' || spec.spec == 'b'
+ || spec.spec == 'e' || spec.spec == 'E')
+ /* exponent part */
+ {
+ np->exp_size = (spec.spec == 'e' || spec.spec == 'E') ? 4 : 3;
+ str = (char *) (*__gmp_allocate_func) (1 + np->exp_size);
+ if (spec.spec == 'e' || spec.spec == 'E')
+ strcpy (str, uppercase ? "E+00" : "e+00");
+ else
+ strcpy (str, uppercase ? "P+0" : "p+0");
+ np->exp_ptr = register_string (np->sl, str);
+ }
+ }
+ }
+ else
+ /* regular p, p != 0 */
+ {
+ if (spec.spec == 'a' || spec.spec == 'A' || spec.spec == 'b')
+ {
+ if (regular_ab (np, p, spec) == -1)
+ goto error;
+ }
+ else if (spec.spec == 'f' || spec.spec == 'F')
+ {
+ if (spec.prec == -1)
+ spec.prec = 6;
+ if (regular_fg (np, p, spec, NULL) == -1)
+ goto error;
+ }
+ else if (spec.spec == 'e' || spec.spec == 'E')
+ {
+ if (regular_eg (np, p, spec, NULL) == -1)
+ goto error;
+ }
+ else
+ /* %g case */
+ {
+ /* Use the C99 rules:
+ if T > X >= -4 then the conversion is with style 'f'/'F' and
+ precision T-(X+1).
+ otherwise, the conversion is with style 'e'/'E' and
+ precision T-1.
+ where T is the threshold computed below and X is the exponent
+ that would be displayed with style 'e' and precision T-1. */
+ int threshold;
+ mpfr_exp_t x;
+ struct decimal_info dec_info;
+
+ threshold = (spec.prec < 0) ? 6 : (spec.prec == 0) ? 1 : spec.prec;
+ dec_info.str = mpfr_get_str (NULL, &dec_info.exp, 10, threshold,
+ p, spec.rnd_mode);
+ register_string (np->sl, dec_info.str);
+ /* mpfr_get_str corresponds to a significand between 0.1 and 1,
+ whereas here we want a significand between 1 and 10. */
+ x = dec_info.exp - 1;
+
+ if (threshold > x && x >= -4)
+ {
+ /* the conversion is with style 'f' */
+ spec.prec = threshold - x - 1;
+
+ if (regular_fg (np, p, spec, &dec_info) == -1)
+ goto error;
+ }
+ else
+ {
+ spec.prec = threshold - 1;
+
+ if (regular_eg (np, p, spec, &dec_info) == -1)
+ goto error;
+ }
+ }
+ }
+
+ /* compute the number of characters to be written verifying it is not too
+ much */
+ total = np->sign ? 1 : 0;
+ total += np->prefix_size;
+ total += np->ip_size;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+ total += np->ip_trailing_zeros;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+ if (np->thousands_sep)
+ /* ' flag, style f and the thousands separator in current locale is not
+ reduced to the null character */
+ total += (np->ip_size + np->ip_trailing_zeros) / 3;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+ if (np->point)
+ ++total;
+ total += np->fp_leading_zeros;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+ total += np->fp_size;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+ total += np->fp_trailing_zeros;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+ total += np->exp_size;
+ if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
+ goto error;
+
+ if (spec.width > total)
+ /* pad with spaces or zeros depending on np->pad_type */
+ {
+ np->pad_size = spec.width - total;
+ total += np->pad_size; /* here total == spec.width,
+ so 0 < total < INT_MAX */
+ }
+
+ return total;
+
+ error:
+ clear_string_list (np->sl);
+ np->prefix_ptr = NULL;
+ np->ip_ptr = NULL;
+ np->fp_ptr = NULL;
+ np->exp_ptr = NULL;
+ return -1;
+}
+
+/* sprnt_fp prints a mpfr_t according to spec.spec specification.
+
+ return the size of the string (not counting the terminating '\0')
+ return -1 if the built string is too long (i.e. has more than
+ INT_MAX characters). */
+static int
+sprnt_fp (struct string_buffer *buf, mpfr_srcptr p,
+ const struct printf_spec spec)
+{
+ int length;
+ struct number_parts np;
+
+ length = partition_number (&np, p, spec);
+ if (length < 0)
+ return -1;
+
+ /* right justification padding with left spaces */
+ if (np.pad_type == LEFT && np.pad_size != 0)
+ buffer_pad (buf, ' ', np.pad_size);
+
+ /* sign character (may be '-', '+', or ' ') */
+ if (np.sign)
+ buffer_pad (buf, np.sign, 1);
+
+ /* prefix part */
+ if (np.prefix_ptr)
+ buffer_cat (buf, np.prefix_ptr, np.prefix_size);
+
+ /* right justification padding with leading zeros */
+ if (np.pad_type == LEADING_ZEROS && np.pad_size != 0)
+ buffer_pad (buf, '0', np.pad_size);
+
+ /* integral part (may also be "nan" or "inf") */
+ MPFR_ASSERTN (np.ip_ptr != NULL); /* never empty */
+ if (MPFR_UNLIKELY (np.thousands_sep))
+ buffer_sandwich (buf, np.ip_ptr, np.ip_size, np.ip_trailing_zeros,
+ np.thousands_sep);
+ else
+ {
+ buffer_cat (buf, np.ip_ptr, np.ip_size);
+
+ /* trailing zeros in integral part */
+ if (np.ip_trailing_zeros != 0)
+ buffer_pad (buf, '0', np.ip_trailing_zeros);
+ }
+
+ /* decimal point */
+ if (np.point)
+ buffer_pad (buf, np.point, 1);
+
+ /* leading zeros in fractional part */
+ if (np.fp_leading_zeros != 0)
+ buffer_pad (buf, '0', np.fp_leading_zeros);
+
+ /* significant digits in fractional part */
+ if (np.fp_ptr)
+ buffer_cat (buf, np.fp_ptr, np.fp_size);
+
+ /* trailing zeros in fractional part */
+ if (np.fp_trailing_zeros != 0)
+ buffer_pad (buf, '0', np.fp_trailing_zeros);
+
+ /* exponent part */
+ if (np.exp_ptr)
+ buffer_cat (buf, np.exp_ptr, np.exp_size);
+
+ /* left justication padding with right spaces */
+ if (np.pad_type == RIGHT && np.pad_size != 0)
+ buffer_pad (buf, ' ', np.pad_size);
+
+ clear_string_list (np.sl);
+ return length;
+}
+
+int
+mpfr_vasprintf (char **ptr, const char *fmt, va_list ap)
+{
+ struct string_buffer buf;
+ size_t nbchar;
+
+ /* informations on the conversion specification filled by the parser */
+ struct printf_spec spec;
+ /* flag raised when previous part of fmt need to be processed by
+ gmp_vsnprintf */
+ int xgmp_fmt_flag;
+ /* beginning and end of the previous unprocessed part of fmt */
+ const char *start, *end;
+ /* pointer to arguments for gmp_vasprintf */
+ va_list ap2;
+
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ nbchar = 0;
+ buffer_init (&buf, 4096);
+ xgmp_fmt_flag = 0;
+ va_copy (ap2, ap);
+ start = fmt;
+ while (*fmt)
+ {
+ /* Look for the next format specification */
+ while ((*fmt) && (*fmt != '%'))
+ ++fmt;
+
+ if (*fmt == '\0')
+ break;
+
+ if (*++fmt == '%')
+ /* %%: go one step further otherwise the second '%' would be
+ considered as a new conversion specification introducing
+ character */
+ {
+ ++fmt;
+ xgmp_fmt_flag = 1;
+ continue;
+ }
+
+ end = fmt - 1;
+
+ /* format string analysis */
+ specinfo_init (&spec);
+ fmt = parse_flags (fmt, &spec);
+
+ READ_INT (ap, fmt, spec, width, width_analysis);
+ width_analysis:
+ if (spec.width < 0)
+ {
+ spec.left = 1;
+ spec.width = -spec.width;
+ MPFR_ASSERTN (spec.width < INT_MAX);
+ }
+ if (*fmt == '.')
+ {
+ const char *f = ++fmt;
+ READ_INT (ap, fmt, spec, prec, prec_analysis);
+ prec_analysis:
+ if (f == fmt)
+ spec.prec = -1;
+ }
+ else
+ spec.prec = -1;
+
+ fmt = parse_arg_type (fmt, &spec);
+ if (spec.arg_type == UNSUPPORTED)
+ /* the current architecture doesn't support this type */
+ {
+ goto error;
+ }
+ else if (spec.arg_type == MPFR_ARG)
+ {
+ switch (*fmt)
+ {
+ case '\0':
+ break;
+ case '*':
+ ++fmt;
+ spec.rnd_mode = (mpfr_rnd_t) va_arg (ap, int);
+ break;
+ case 'D':
+ ++fmt;
+ spec.rnd_mode = MPFR_RNDD;
+ break;
+ case 'U':
+ ++fmt;
+ spec.rnd_mode = MPFR_RNDU;
+ break;
+ case 'Y':
+ ++fmt;
+ spec.rnd_mode = MPFR_RNDA;
+ break;
+ case 'Z':
+ ++fmt;
+ spec.rnd_mode = MPFR_RNDZ;
+ break;
+ case 'N':
+ ++fmt;
+ default:
+ spec.rnd_mode = MPFR_RNDN;
+ }
+ }
+
+ spec.spec = *fmt;
+ if (!specinfo_is_valid (spec))
+ goto error;
+
+ if (*fmt)
+ fmt++;
+
+ /* Format processing */
+ if (spec.spec == '\0')
+ /* end of the format string */
+ break;
+ else if (spec.spec == 'n')
+ /* put the number of characters written so far in the location pointed
+ by the next va_list argument; the types of pointer accepted are the
+ same as in GMP (except unsupported quad_t) plus pointer to a mpfr_t
+ so as to be able to accept the same format strings. */
+ {
+ void *p;
+ size_t nchar;
+
+ p = va_arg (ap, void *);
+ FLUSH (xgmp_fmt_flag, start, end, ap2, &buf);
+ va_end (ap2);
+ start = fmt;
+ nchar = buf.curr - buf.start;
+
+ switch (spec.arg_type)
+ {
+ case CHAR_ARG:
+ *(char *) p = (char) nchar;
+ break;
+ case SHORT_ARG:
+ *(short *) p = (short) nchar;
+ break;
+ case LONG_ARG:
+ *(long *) p = (long) nchar;
+ break;
+#ifdef HAVE_LONG_LONG
+ case LONG_LONG_ARG:
+ *(long long *) p = (long long) nchar;
+ break;
+#endif
+#ifdef _MPFR_H_HAVE_INTMAX_T
+ case INTMAX_ARG:
+ *(intmax_t *) p = (intmax_t) nchar;
+ break;
+#endif
+ case SIZE_ARG:
+ *(size_t *) p = nchar;
+ break;
+ case PTRDIFF_ARG:
+ *(ptrdiff_t *) p = (ptrdiff_t) nchar;
+ break;
+ case MPF_ARG:
+ mpf_set_ui ((mpf_ptr) p, (unsigned long) nchar);
+ break;
+ case MPQ_ARG:
+ mpq_set_ui ((mpq_ptr) p, (unsigned long) nchar, 1L);
+ break;
+ case MP_LIMB_ARG:
+ *(mp_limb_t *) p = (mp_limb_t) nchar;
+ break;
+ case MP_LIMB_ARRAY_ARG:
+ {
+ mp_limb_t *q = (mp_limb_t *) p;
+ mp_size_t n;
+ n = va_arg (ap, mp_size_t);
+ if (n < 0)
+ n = -n;
+ else if (n == 0)
+ break;
+
+ /* we assume here that mp_limb_t is wider than int */
+ *q = (mp_limb_t) nchar;
+ while (--n != 0)
+ {
+ q++;
+ *q = (mp_limb_t) 0;
+ }
+ }
+ break;
+ case MPZ_ARG:
+ mpz_set_ui ((mpz_ptr) p, (unsigned long) nchar);
+ break;
+
+ case MPFR_ARG:
+ mpfr_set_ui ((mpfr_ptr) p, (unsigned long) nchar,
+ spec.rnd_mode);
+ break;
+
+ default:
+ *(int *) p = (int) nchar;
+ }
+ va_copy (ap2, ap); /* after the switch, due to MP_LIMB_ARRAY_ARG
+ case */
+ }
+ else if (spec.arg_type == MPFR_PREC_ARG)
+ /* output mpfr_prec_t variable */
+ {
+ char *s;
+ char format[MPFR_PREC_FORMAT_SIZE + 6]; /* see examples below */
+ size_t length;
+ mpfr_prec_t prec;
+ prec = va_arg (ap, mpfr_prec_t);
+
+ FLUSH (xgmp_fmt_flag, start, end, ap2, &buf);
+ va_end (ap2);
+ va_copy (ap2, ap);
+ start = fmt;
+
+ /* construct format string, like "%*.*hu" "%*.*u" or "%*.*lu" */
+ format[0] = '%';
+ format[1] = '*';
+ format[2] = '.';
+ format[3] = '*';
+ format[4] = '\0';
+ strcat (format, MPFR_PREC_FORMAT_TYPE);
+ format[4 + MPFR_PREC_FORMAT_SIZE] = spec.spec;
+ format[5 + MPFR_PREC_FORMAT_SIZE] = '\0';
+ length = gmp_asprintf (&s, format, spec.width, spec.prec, prec);
+ if (buf.size <= INT_MAX - length)
+ {
+ buffer_cat (&buf, s, length);
+ mpfr_free_str (s);
+ }
+ else
+ {
+ mpfr_free_str (s);
+ goto overflow_error;
+ }
+ }
+ else if (spec.arg_type == MPFR_ARG)
+ /* output a mpfr_t variable */
+ {
+ mpfr_srcptr p;
+
+ p = va_arg (ap, mpfr_srcptr);
+
+ FLUSH (xgmp_fmt_flag, start, end, ap2, &buf);
+ va_end (ap2);
+ va_copy (ap2, ap);
+ start = fmt;
+
+ switch (spec.spec)
+ {
+ case 'a':
+ case 'A':
+ case 'b':
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'F':
+ case 'g':
+ case 'G':
+ if (sprnt_fp (&buf, p, spec) < 0)
+ goto overflow_error;
+ break;
+
+ default:
+ /* unsupported specifier */
+ goto error;
+ }
+ }
+ else
+ /* gmp_printf specification, step forward in the va_list */
+ {
+ CONSUME_VA_ARG (spec, ap);
+ xgmp_fmt_flag = 1;
+ }
+ }
+
+ if (start != fmt)
+ FLUSH (xgmp_fmt_flag, start, fmt, ap2, &buf);
+
+ va_end (ap2);
+ nbchar = buf.curr - buf.start;
+ MPFR_ASSERTD (nbchar == strlen (buf.start));
+ buf.start =
+ (char *) (*__gmp_reallocate_func) (buf.start, buf.size, nbchar + 1);
+ buf.size = nbchar + 1; /* update needed for __gmp_free_func below when
+ nbchar is too large (overflow_error) */
+ *ptr = buf.start;
+
+ /* If nbchar is larger than INT_MAX, the ISO C99 standard is silent, but
+ POSIX says concerning the snprintf() function:
+ "[EOVERFLOW] The value of n is greater than {INT_MAX} or the
+ number of bytes needed to hold the output excluding the
+ terminating null is greater than {INT_MAX}." See:
+ http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html
+ But it doesn't say anything concerning the other printf-like functions.
+ A defect report has been submitted to austin-review-l (item 2532).
+ So, for the time being, we return a negative value and set the erange
+ flag, and set errno to EOVERFLOW in POSIX system. */
+ if (nbchar <= INT_MAX)
+ {
+ MPFR_SAVE_EXPO_FREE (expo);
+ return nbchar;
+ }
+
+ overflow_error:
+ MPFR_SAVE_EXPO_UPDATE_FLAGS(expo, MPFR_FLAGS_ERANGE);
+#ifdef EOVERFLOW
+ errno = EOVERFLOW;
+#endif
+
+ error:
+ MPFR_SAVE_EXPO_FREE (expo);
+ *ptr = NULL;
+ (*__gmp_free_func) (buf.start, buf.size);
+
+ return -1;
+}
+
+#endif /* HAVE_STDARG */
diff --git a/src/version.c b/src/version.c
new file mode 100644
index 0000000..1ae4fe2
--- /dev/null
+++ b/src/version.c
@@ -0,0 +1,29 @@
+/* mpfr_get_version -- MPFR version
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+const char *
+mpfr_get_version (void)
+{
+ return "3.1.2";
+}
diff --git a/src/volatile.c b/src/volatile.c
new file mode 100644
index 0000000..82c82ee
--- /dev/null
+++ b/src/volatile.c
@@ -0,0 +1,36 @@
+/* __gmpfr_longdouble_volatile -- support for LONGDOUBLE_NAN_ACTION.
+
+ THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
+ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
+ FUTURE MPFR RELEASES.
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+/* Only needed sometimes. */
+#ifdef WANT_GMPFR_LONGDOUBLE_VOLATILE
+long double
+__gmpfr_longdouble_volatile (long double x)
+{
+ return x;
+}
+#endif
diff --git a/src/x86/core2/mparam.h b/src/x86/core2/mparam.h
new file mode 100644
index 0000000..1f4e77b
--- /dev/null
+++ b/src/x86/core2/mparam.h
@@ -0,0 +1,234 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */
+/* gcc14.fsffrance.org (Intel(R) Xeon(R) CPU X5450 @ 3.00GHz) with gmp 5.0.2
+ configured with ABI=32 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,0,10,10,0, \
+ 11,11,0,13,13,0,0,17,17,16,19,19,19,18,18,22, \
+ 20,18,19,26,26,28,23,24,28,29,26,28,29,28,30,32, \
+ 29,30,38,30,34,32,33,37,34,36,37,38,38,38,38,38, \
+ 38,44,36,52,44,48,52,56,51,52,56,56,52,52,56,58, \
+ 52,60,60,56,60,55,52,68,60,68,68,68,68,72,72,67, \
+ 68,68,68,76,76,68,75,75,68,72,76,68,68,75,72,72, \
+ 78,73,74,72,76,74,76,72,76,74,76,72,76,76,75,76, \
+ 75,74,76,76,99,99,104,76,76,111,104,102,99,99,99,104, \
+ 93,105,99,104,99,104,99,99,99,96,102,99,104,104,104,108, \
+ 104,105,111,110,110,111,111,111,109,111,110,111,111,114,108,111, \
+ 111,111,105,105,111,108,111,110,111,110,111,111,110,111,110,134, \
+ 111,141,153,153,153,140,141,165,141,153,151,153,153,153,152,152, \
+ 153,165,153,152,153,153,153,163,165,164,165,153,153,164,163,164, \
+ 165,165,153,168,168,173,174,165,176,177,177,164,176,177,165,165, \
+ 165,172,164,165,165,165,168,177,175,176,177,176,165,175,176,176, \
+ 165,177,176,177,204,204,204,204,204,203,177,218,217,220,204,219, \
+ 220,217,220,220,220,218,219,220,220,220,220,217,217,219,220,220, \
+ 217,204,217,219,220,220,217,218,218,219,220,219,220,219,219,220, \
+ 220,220,220,220,219,220,220,220,220,251,220,219,220,220,220,236, \
+ 249,220,251,250,249,249,251,248,251,251,251,250,251,251,251,249, \
+ 248,248,240,250,250,250,249,251,246,251,250,251,251,251,250,250, \
+ 251,249,249,250,251,251,249,251,250,306,305,306,306,306,306,306, \
+ 306,306,306,251,306,306,305,305,306,306,305,305,306,306,306,305, \
+ 330,305,306,305,306,306,306,330,306,306,305,305,330,330,327,330, \
+ 330,330,306,329,330,330,330,330,330,329,330,306,330,330,329,329, \
+ 329,330,329,330,330,330,330,330,330,327,328,329,330,329,329,330, \
+ 330,329,330,330,328,330,330,330,330,330,354,330,329,330,330,354, \
+ 330,329,330,353,354,330,354,354,330,353,354,354,354,354,354,354, \
+ 354,354,353,354,352,354,354,354,330,354,354,353,354,354,354,378, \
+ 353,408,408,408,408,407,408,407,407,408,408,408,408,407,408,408, \
+ 407,407,407,440,407,408,408,407,439,408,408,408,407,408,440,440, \
+ 440,440,440,440,440,439,440,437,439,440,439,439,440,440,439,440, \
+ 439,439,440,439,440,440,440,439,438,439,440,440,439,440,438,439, \
+ 440,440,440,439,440,440,440,440,438,440,439,439,440,440,440,439, \
+ 440,440,440,440,440,440,439,440,440,471,472,471,439,440,439,472, \
+ 472,472,472,472,472,472,440,472,439,440,471,472,471,471,439,472, \
+ 496,496,496,472,440,471,472,480,495,496,496,495,472,534,536,534, \
+ 534,536,536,536,536,536,536,536,536,536,535,536,536,536,536,536, \
+ 534,535,536,536,536,535,534,534,535,536,536,534,535,536,536,535, \
+ 536,536,536,536,535,536,536,536,536,536,535,536,568,535,536,536, \
+ 536,535,536,568,536,536,568,536,568,568,568,536,568,536,536,566, \
+ 567,567,535,568,568,536,535,536,535,536,536,536,567,536,568,536, \
+ 568,567,568,568,567,600,597,568,567,567,568,600,568,568,568,598, \
+ 566,567,568,568,566,568,568,568,567,568,567,568,568,568,568,568, \
+ 600,567,568,600,568,600,568,568,568,568,568,600,599,566,568,600, \
+ 568,568,600,567,568,599,567,600,599,600,568,600,567,599,600,599, \
+ 568,597,600,598,600,599,599,599,600,600,598,600,598,600,597,600, \
+ 600,600,600,600,600,599,600,600,598,599,600,599,600,639,600,600, \
+ 600,600,568,639,600,568,567,568,568,568,600,640,600,599,600,599, \
+ 600,600,600,598,600,599,568,600,598,600,600,599,600,597,639,598, \
+ 600,600,600,600,599,600,600,600,600,600,600,687,736,598,599,600, \
+ 736,600,600,688,736,736,600,688,735,736,736,734,736,736,735,736, \
+ 640,734,735,736,734,733,736,736,731,735,736,736,736,736,736,736, \
+ 736,735,736,736,736,736,784,735,784,735,784,783,783,736,736,735, \
+ 784,784,784,736,783,784,784,784,784,783,783,784,784,784,784,784, \
+ 781,782,782,784,784,784,784,784,784,734,784,783,784,784,784,736, \
+ 808,783,784,784,784,783,784,783,784,783,784,783,784,832,832,829, \
+ 832,824,823,832,824,784,784,824,831,832,784,783,784,783,784,832, \
+ 784,784,784,783,784,784,781,784,784,784,784,783,824,832,831,784, \
+ 832,831,832,830,832,807,784,832,830,784,832,808,832,824,823,832, \
+ 824,808,831,824,824,824,832,823,832,824,832,831,832,832,829,830, \
+ 831,832,832,832,831,831,832,832,830,832,832,832,832,831,831,832, \
+ 879,832,832,880,832,831,832,831,832,832,832,832,832,832,832,831 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,-1,-1,-1,-1,-1,-1,-1,8,8,8,9,9, \
+ 10,10,11,13,13,14,15,16,14,16,17,16,18,17,19,18, \
+ 20,18,19,22,21,22,23,22,23,22,25,24,25,24,25,26, \
+ 27,26,29,27,28,29,30,34,34,36,36,38,38,40,40,42, \
+ 34,44,42,46,38,42,44,38,38,44,40,42,42,50,44,46, \
+ 50,48,48,44,50,52,52,46,50,46,52,50,52,50,50,52, \
+ 52,54,52,52,54,58,58,54,57,58,58,58,56,58,58,58, \
+ 68,58,64,68,72,60,64,72,68,64,72,64,72,68,72,68, \
+ 76,76,72,76,80,76,76,76,84,80,76,88,84,84,84,84, \
+ 88,84,87,88,88,92,92,92,88,96,92,96,96,92,96,96, \
+ 100,100,100,100,96,84,92,92,88,96,92,88,99,92,96,91, \
+ 92,96,100,100,99,100,100,100,100,96,98,96,100,98,100,100, \
+ 100,100,100,117,100,123,123,135,122,123,124,129,126,122,135,123, \
+ 129,135,135,133,134,135,141,140,135,126,140,135,129,129,129,132, \
+ 146,134,129,147,150,135,152,140,135,140,141,141,147,141,147,147, \
+ 147,150,141,147,152,147,141,150,141,151,153,146,147,152,147,147, \
+ 147,152,147,153,151,153,147,147,153,150,147,152,153,150,150,152, \
+ 153,150,153,152,153,150,147,164,150,187,188,148,187,180,152,196, \
+ 187,196,180,186,187,188,196,187,196,188,196,180,195,196,188,188, \
+ 188,196,196,188,192,194,195,196,196,196,195,204,211,212,203,204, \
+ 204,196,196,203,204,220,212,203,196,204,195,204,196,187,216,188, \
+ 200,195,196,204,219,203,195,196,188,203,204,195,203,204,219,195, \
+ 196,211,212,220,196,203,196,212,204,204,220,196,203,220,220,211, \
+ 203,212,212,211,212,212,216,218,220,211,211,218,220,219,220,220, \
+ 220,220,220,220,220,220,219,220,282,282,219,276,276,282,282,275, \
+ 276,282,269,276,258,294,276,282,282,294,294,270,282,294,258,270, \
+ 258,270,294,270,258,270,282,276,306,282,282,282,282,282,276,270, \
+ 282,282,282,281,282,281,281,294,282,276,282,282,282,294,294,282, \
+ 306,306,294,282,294,282,294,294,305,288,306,294,294,294,306,294, \
+ 306,305,318,306,306,318,312,306,306,318,305,306,306,306,317,312, \
+ 311,318,311,312,324,318,317,330,330,318,318,330,323,330,329,330, \
+ 324,330,329,324,342,330,342,329,330,336,341,318,294,329,341,306, \
+ 300,305,300,299,300,305,306,306,324,305,318,318,312,317,330,306, \
+ 306,306,306,306,318,317,318,318,318,324,330,329,324,318,318,318, \
+ 323,324,306,323,324,324,329,328,328,330,330,330,318,318,318,317, \
+ 317,336,330,342,342,341,330,330,330,342,330,340,330,330,318,341, \
+ 342,426,426,341,342,425,426,426,426,342,426,425,426,425,425,426, \
+ 426,426,318,426,425,450,426,425,378,378,378,426,426,450,450,450, \
+ 402,330,449,450,449,450,450,449,450,450,402,450,450,450,450,450, \
+ 426,401,402,450,450,426,426,450,474,472,474,450,426,426,426,474, \
+ 474,474,473,425,426,450,450,426,424,425,426,426,474,449,450,450, \
+ 450,426,474,449,426,450,450,448,449,498,450,498,450,426,450,449, \
+ 448,450,450,448,449,449,474,448,449,450,450,473,474,474,473,449, \
+ 449,474,450,474,450,450,473,474,450,473,474,474,474,474,521,498, \
+ 474,474,474,474,474,474,498,498,474,474,474,473,473,474,474,498, \
+ 498,474,498,498,498,498,498,519,498,522,522,498,498,520,498,498, \
+ 498,498,498,522,522,498,521,521,520,521,522,522,474,522,521,546, \
+ 520,522,546,522,516,546,546,521,522,522,522,521,522,522,521,474, \
+ 545,545,546,546,474,522,522,522,522,474,498,546,522,546,546,544, \
+ 545,545,522,521,546,546,546,522,546,545,522,498,546,546,522,520, \
+ 522,522,522,521,521,545,546,522,521,522,600,568,522,522,521,522, \
+ 600,522,521,521,522,522,519,599,521,522,545,546,522,545,546,545, \
+ 522,599,522,521,546,545,546,546,600,598,600,546,546,545,546,600, \
+ 568,546,600,546,598,600,600,632,632,545,546,599,600,546,546,545, \
+ 546,632,632,600,632,631,632,631,600,600,632,632,598,600,632,599, \
+ 599,599,600,599,599,600,600,600,600,596,600,631,599,600,600,599, \
+ 600,600,600,600,600,600,664,631,632,600,663,664,696,664,600,664, \
+ 663,631,696,662,600,693,696,695,663,696,696,664,631,632,688,630, \
+ 632,632,696,631,695,632,632,695,696,695,695,696,696,696,632,695, \
+ 696,695,696,696,632,695,696,631,664,664,695,663,663,664,696,687, \
+ 662,664,664,663,664,663,694,695,695,727,728,728,693,728,693,695, \
+ 696,696,696,696,696,694,695,696,696,695,696,694,727,696,696,688, \
+ 695,696,696,695,696,695,695,696,696,727,696,696,695,696,695,696, \
+ 696,695,696,695,696,696,696,728,728,696,720,728,728,728,726,728 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,9,10,9,10,11,14,13, \
+ 14,11,16,17,13,14,15,16,16,14,16,16,16,19,20,18, \
+ 23,18,22,19,24,25,27,23,23,24,24,23,27,28,27,28, \
+ 28,33,29,30,32,29,37,32,35,33,33,39,33,33,35,38, \
+ 39,38,38,37,38,39,37,37,48,40,39,40,40,50,51,46, \
+ 47,48,48,46,50,50,50,59,52,50,51,48,56,56,54,50, \
+ 51,54,53,58,58,58,56,59,61,58,62,59,62,67,62,67, \
+ 60,64,71,68,64,64,62,68,67,72,66,72,76,72,74,72, \
+ 67,72,72,74,76,70,74,74,76,76,76,76,76,76,74,76, \
+ 76,76,80,87,78,76,88,80,79,88,88,96,94,96,88,103, \
+ 104,104,104,100,103,102,104,104,104,96,104,104,112,112,104,104, \
+ 95,104,104,103,104,104,104,112,104,104,104,103,112,104,104,112, \
+ 104,104,112,104,104,112,104,112,112,112,111,112,120,104,112,116, \
+ 112,120,112,110,120,112,120,112,120,118,116,126,119,120,128,120, \
+ 136,128,120,120,136,120,120,136,152,136,136,136,143,136,128,140, \
+ 128,152,148,152,136,144,152,152,144,152,144,152,152,152,152,152, \
+ 134,152,152,136,136,136,140,152,152,143,152,144,152,152,152,152, \
+ 152,152,144,152,152,152,144,152,152,152,152,152,152,152,152,152, \
+ 152,152,152,152,152,152,150,151,152,152,152,152,156,152,160,160, \
+ 168,156,176,159,160,160,176,160,176,174,176,176,208,176,176,174, \
+ 176,183,176,208,208,176,208,208,208,208,192,208,208,208,208,208, \
+ 208,208,208,200,208,208,208,208,208,208,208,208,208,208,208,208, \
+ 208,208,208,208,208,208,222,208,209,208,208,208,208,208,208,222, \
+ 208,208,208,208,208,208,208,208,208,208,208,208,208,207,208,208, \
+ 208,208,208,208,208,208,208,208,208,222,220,220,222,208,221,216, \
+ 208,220,208,208,208,209,208,208,220,208,208,208,208,208,222,221, \
+ 222,220,220,224,220,216,216,220,216,220,221,222,216,224,224,222, \
+ 222,221,221,222,222,224,222,222,222,222,228,240,232,224,225,225, \
+ 304,228,272,256,231,248,240,234,232,272,288,234,270,256,264,240, \
+ 240,272,256,272,270,271,272,240,303,270,304,304,272,303,304,304, \
+ 304,304,272,270,272,304,288,287,257,303,304,304,288,304,304,272, \
+ 304,304,304,272,304,305,304,303,304,304,303,302,303,304,272,303, \
+ 304,304,304,303,304,304,272,304,304,288,288,304,304,304,305,282, \
+ 304,304,303,304,304,304,304,304,303,304,304,304,302,304,304,305, \
+ 303,302,287,302,304,304,304,305,304,304,302,302,303,303,304,288, \
+ 303,304,304,304,304,302,303,304,304,288,304,303,304,304,304,303, \
+ 304,304,303,303,304,304,304,304,304,304,304,303,304,303,304,304, \
+ 304,303,304,303,304,304,320,303,304,304,304,304,304,304,305,306, \
+ 320,312,320,320,320,320,320,320,320,320,320,320,320,320,352,320, \
+ 352,320,336,320,352,320,319,320,336,336,352,348,348,344,348,348, \
+ 352,348,351,351,351,352,352,354,350,352,352,352,360,353,416,359, \
+ 352,360,416,352,352,370,416,352,353,416,352,416,416,416,352,416, \
+ 352,416,416,416,416,352,408,416,416,384,416,352,416,392,416,416, \
+ 416,401,408,416,416,416,416,416,416,416,416,407,416,408,416,416, \
+ 416,408,408,416,416,416,416,432,416,416,416,436,440,416,416,440, \
+ 440,416,416,416,432,416,440,416,440,438,440,416,440,416,440,438, \
+ 440,444,416,448,416,440,440,440,416,448,448,415,447,440,416,440, \
+ 416,416,408,408,416,416,416,448,416,416,416,416,416,416,416,416, \
+ 416,416,416,416,416,416,440,416,417,416,416,416,416,416,416,416, \
+ 416,416,416,440,416,416,440,416,416,448,416,416,416,416,416,416, \
+ 448,416,416,416,448,416,416,416,416,416,440,416,416,416,432,440, \
+ 416,416,416,416,416,432,416,432,432,440,440,416,416,416,440,440, \
+ 440,448,448,438,440,433,440,439,440,448,440,440,440,439,440,447, \
+ 444,439,440,440,440,440,448,448,448,440,440,448,444,448,443,440, \
+ 440,440,440,440,440,448,448,440,448,439,440,444,447,448,448,448, \
+ 448,448,448,448,448,448,448,447,448,448,448,448,448,448,512,608, \
+ 480,608,464,480,608,456,464,608,608,480,608,480,608,480,480,480, \
+ 608,480,512,480,608,513,512,608,512,512,608,512,608,496,480,496, \
+ 608,516,496,608,480,512,608,512,608,512,512,608,608,608,608,608, \
+ 608,576,608,607,608,608,512,608,607,609,607,608,608,609,608,608, \
+ 609,608,608,608,607,608,607,608,607,608,608,608,608,608,608,607, \
+ 607,608,608,608,608,608,607,607,608,607,608,608,608,607,608,608, \
+ 608,608,609,609,608,608,609,608,608,608,606,606,608,608,609,607, \
+ 606,607,608,608,610,608,608,609,608,608,608,608,608,608,607,608 \
+
+#define MPFR_MUL_THRESHOLD 15 /* limbs */
+#define MPFR_SQR_THRESHOLD 18 /* limbs */
+#define MPFR_DIV_THRESHOLD 22 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 649 /* bits */
+#define MPFR_EXP_THRESHOLD 10653 /* bits */
+#define MPFR_SINCOS_THRESHOLD 36331 /* bits */
+#define MPFR_AI_THRESHOLD1 -21595 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 2333
+#define MPFR_AI_THRESHOLD3 33925
+/* Tuneup completed successfully, took 1155 seconds */
diff --git a/src/x86/mparam.h b/src/x86/mparam.h
new file mode 100644
index 0000000..5514690
--- /dev/null
+++ b/src/x86/mparam.h
@@ -0,0 +1,233 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.4.2 */
+/* contributed by Jim Cloos <cloos at jhcloos dot com> with GMP 5.0.2 on a
+ Pentium3-M, where __i386, __i686, __pentiumpro are defined */
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,-1,-1,-1,-1,-1,-1,-1,7,8,9,10,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,28,30,30,30,30,32, \
+ 32,32,34,34,34,32,34,34,34,36,36,36,36,40,40,40, \
+ 42,44,48,48,48,48,48,48,48,48,48,52,52,52,52,52, \
+ 52,52,56,56,60,56,60,60,60,60,60,64,64,64,64,64, \
+ 64,64,64,64,64,64,68,64,64,68,68,68,68,72,72,81, \
+ 81,80,81,81,87,87,87,87,87,87,87,87,87,87,93,87, \
+ 93,93,93,93,93,93,93,93,99,99,93,93,93,92,93,99, \
+ 99,99,99,99,99,99,99,99,105,105,99,105,105,104,105,105, \
+ 105,105,111,117,117,117,117,117,117,117,117,117,117,117,117,117, \
+ 123,123,123,123,141,141,141,141,141,141,141,141,141,141,141,141, \
+ 141,141,141,141,141,141,141,141,141,153,153,153,153,153,153,153, \
+ 153,153,153,153,153,165,165,165,153,165,165,165,165,165,165,165, \
+ 165,165,165,165,165,177,177,165,177,177,177,177,165,177,177,177, \
+ 177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177, \
+ 177,177,189,204,189,204,204,204,204,204,204,189,204,189,204,204, \
+ 204,204,204,204,204,204,204,204,203,204,204,204,204,204,204,204, \
+ 220,204,220,220,220,220,220,220,220,220,220,220,220,220,220,220, \
+ 236,220,236,236,236,236,236,235,236,235,236,236,236,236,235,236, \
+ 236,236,236,236,236,236,236,236,236,252,252,252,252,252,252,252, \
+ 252,252,252,252,252,252,252,252,282,282,282,282,282,282,282,282, \
+ 282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282, \
+ 282,282,282,282,282,282,282,306,306,282,306,306,306,306,306,306, \
+ 306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, \
+ 306,306,306,306,306,330,330,330,329,330,330,330,330,330,330,330, \
+ 330,330,330,330,330,330,330,330,330,330,330,330,330,330,354,354, \
+ 354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354, \
+ 354,354,354,354,354,354,354,354,354,378,378,378,378,378,378,378, \
+ 378,377,378,378,378,378,378,378,378,378,378,378,378,378,378,378, \
+ 408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,408,408,408,408,407,408,407,408,408,407,408,408,408,408, \
+ 408,408,439,408,440,440,439,440,440,440,440,439,440,440,439,440, \
+ 439,440,439,440,439,439,440,440,440,440,439,440,439,440,439,440, \
+ 440,440,439,439,440,440,472,440,472,439,440,439,440,440,440,472, \
+ 472,472,469,471,471,472,471,471,472,471,470,470,472,472,471,472, \
+ 472,504,504,463,471,455,438,501,462,497,501,503,459,471,451,467, \
+ 448,501,503,485,504,453,469,470,503,472,496,496,480,467,504,460, \
+ 504,488,488,532,535,497,480,470,504,497,504,492,497,498,536,468, \
+ 504,510,519,528,500,500,495,504,504,504,504,534,504,504,498,504, \
+ 504,511,504,504,504,503,504,563,504,511,504,504,504,504,504,504, \
+ 504,504,533,504,536,536,536,533,536,536,536,536,536,536,536,536, \
+ 536,536,536,536,536,536,536,536,536,536,536,536,536,536,566,536, \
+ 536,536,536,568,568,568,568,568,568,568,568,568,568,568,568,568, \
+ 568,568,568,568,568,568,568,568,568,568,568,568,568,568,592,592, \
+ 592,592,592,592,592,592,592,592,640,592,640,592,640,639,640,640, \
+ 640,640,640,639,640,639,640,640,640,639,640,640,640,640,640,640, \
+ 640,640,640,640,640,640,640,640,640,640,640,640,640,640,640,640, \
+ 639,640,639,639,688,688,688,639,640,639,640,640,640,687,688,688, \
+ 688,687,687,688,688,688,688,688,688,688,688,687,688,736,688,688, \
+ 688,687,636,688,688,688,688,688,688,688,688,688,688,688,688,688, \
+ 688,688,688,688,688,688,688,688,688,688,687,688,688,688,688,688, \
+ 688,688,688,688,688,688,688,688,688,688,688,688,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,688,735,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,735,736,735,736,736, \
+ 736,735,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,735,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,784,736,784,784,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 784,736,784,784,784,784,784,784,736,784,736,784,784,784,784,736, \
+ 784,783,784,784,784,784,784,784,784,784,784,784,784,784,784,784, \
+ 784,784,784,784,784,784,784,784,784,784,784,832,784,784,784,784, \
+ 832,784,832,831,832,831,832,832,832,832,832,784,784,784,784,784, \
+ 832,784,832,784,832,832,832,832,832,832,832,832,832,832,832,832 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,-1,-1,-1,-1,5,6,6,7,7,8,8,9,9, \
+ 10,11,12,11,12,13,14,13,14,15,16,15,16,16,17,17, \
+ 18,19,19,19,20,20,21,22,23,22,23,24,25,24,25,26, \
+ 27,26,27,27,28,28,29,29,30,31,32,31,32,32,33,34, \
+ 35,34,35,36,36,38,38,38,39,40,40,40,41,41,41,41, \
+ 42,43,44,44,48,48,48,48,48,50,52,50,52,52,54,54, \
+ 56,56,58,54,54,54,56,56,56,56,58,58,60,60,62,64, \
+ 64,64,62,62,64,64,64,64,64,66,66,68,68,70,68,72, \
+ 70,72,74,72,74,72,72,72,74,74,76,72,72,72,74,74, \
+ 76,76,76,76,78,78,78,80,80,80,80,80,80,80,87,90, \
+ 87,90,90,93,93,90,90,90,90,93,93,93,90,96,96,93, \
+ 96,96,96,96,96,93,99,96,102,99,99,99,96,102,102,102, \
+ 108,102,105,105,105,108,111,111,108,111,111,111,111,111,111,117, \
+ 114,117,114,117,117,120,120,120,120,120,120,120,123,126,126,126, \
+ 126,129,129,129,129,129,132,132,132,135,135,135,141,141,141,141, \
+ 141,141,148,148,148,152,148,152,152,148,152,156,156,156,156,156, \
+ 160,135,141,152,141,141,141,141,141,141,141,141,141,141,141,141, \
+ 141,141,152,141,156,152,156,156,160,160,160,152,160,156,156,156, \
+ 160,160,156,168,160,168,164,164,168,160,168,176,172,168,168,172, \
+ 172,172,176,176,188,176,176,172,188,188,188,188,188,187,188,188, \
+ 188,188,188,188,196,188,196,196,196,196,196,204,204,204,204,204, \
+ 204,204,204,212,212,212,212,212,212,212,212,220,220,220,220,220, \
+ 220,220,220,219,220,220,220,228,220,228,220,220,228,228,220,220, \
+ 220,236,236,228,228,236,228,236,228,244,244,228,244,244,236,236, \
+ 258,236,258,258,258,258,258,258,258,264,258,264,264,264,264,264, \
+ 264,264,264,264,264,258,264,258,264,282,258,264,282,282,282,282, \
+ 282,264,264,282,282,276,264,264,282,294,282,282,282,282,282,282, \
+ 282,282,282,282,282,282,282,282,282,282,282,282,294,282,282,282, \
+ 282,282,282,306,282,282,306,306,282,306,306,306,306,318,306,318, \
+ 318,318,318,318,318,318,318,318,318,318,318,330,330,318,318,318, \
+ 330,318,318,330,330,318,318,318,318,318,318,330,342,330,330,330, \
+ 330,330,330,330,330,330,330,330,330,318,330,318,318,342,342,318, \
+ 342,318,318,342,318,330,330,330,330,330,318,330,330,318,330,318, \
+ 342,330,342,342,342,342,342,342,342,330,342,342,330,342,342,342, \
+ 342,354,342,342,342,342,342,342,342,354,342,342,354,354,354,342, \
+ 354,354,354,354,354,354,354,378,366,366,366,366,378,366,366,366, \
+ 378,408,366,378,378,378,378,378,378,378,378,378,378,424,424,424, \
+ 424,424,424,424,424,408,408,408,408,408,408,408,408,408,408,408, \
+ 408,408,424,424,408,424,408,424,424,408,408,424,424,424,424,424, \
+ 424,424,424,424,424,424,408,424,424,424,424,424,440,424,440,424, \
+ 424,440,424,424,424,424,440,440,440,440,424,424,440,440,424,424, \
+ 424,424,440,424,440,456,456,424,440,440,440,440,456,424,424,424, \
+ 440,440,456,440,472,456,440,440,472,440,456,440,440,440,456,440, \
+ 440,440,456,456,456,472,471,472,456,472,440,472,488,488,455,455, \
+ 456,456,488,456,472,488,504,472,456,504,488,488,456,472,472,471, \
+ 472,502,472,472,496,488,487,503,456,504,504,503,504,456,456,487, \
+ 488,488,504,488,487,504,503,503,504,504,503,503,503,504,502,503, \
+ 502,504,519,501,504,551,502,520,520,488,504,479,517,503,488,463, \
+ 472,456,504,503,487,519,552,534,485,480,486,502,499,552,504,534, \
+ 486,440,504,511,512,533,516,472,536,567,534,494,519,440,542,534, \
+ 528,592,468,536,516,485,472,583,550,509,537,471,493,533,526,446, \
+ 558,498,499,495,487,571,500,544,471,583,545,530,470,566,520,536, \
+ 558,463,504,544,534,494,520,542,522,520,552,520,514,483,434,607, \
+ 566,538,536,552,486,607,623,606,520,453,588,476,614,497,472,504, \
+ 504,566,552,504,504,504,504,504,504,504,504,504,504,552,520,504, \
+ 520,520,520,504,520,520,504,520,536,520,520,536,536,536,536,536, \
+ 536,536,536,586,536,536,520,555,504,565,520,552,536,552,552,552, \
+ 552,552,552,552,552,552,552,552,552,552,552,552,552,552,568,552, \
+ 568,552,568,568,568,568,559,560,568,552,552,568,568,552,568,584, \
+ 552,552,552,552,552,552,568,568,552,568,568,552,568,568,552,552, \
+ 584,568,568,568,568,568,568,568,568,568,552,568,584,584,568,552, \
+ 584,584,584,584,584,584,584,568,568,568,568,616,568,568,616,568, \
+ 600,584,600,600,600,632,616,600,584,616,616,632,632,584,632,616, \
+ 616,616,616,616,616,632,632,616,616,632,632,616,616,632,616,616 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,7,10,9,10,11,12,13, \
+ 14,15,16,17,18,16,14,16,16,19,19,18,20,19,20,18, \
+ 24,19,20,23,24,21,21,23,27,24,28,29,28,28,28,28, \
+ 31,31,30,28,34,29,32,32,33,34,35,31,34,38,38,34, \
+ 35,36,38,38,38,40,41,43,39,42,43,42,42,43,44,43, \
+ 45,48,49,48,51,50,50,48,50,48,51,50,51,52,53,50, \
+ 55,51,53,54,56,59,56,59,58,55,57,59,59,63,64,63, \
+ 63,64,64,59,64,64,67,64,63,67,67,71,67,67,71,66, \
+ 75,75,75,75,73,75,73,75,75,75,73,75,84,73,74,73, \
+ 76,76,75,81,76,79,81,84,81,83,84,84,84,84,88,86, \
+ 83,88,96,94,96,96,96,96,96,96,96,95,96,96,96,104, \
+ 96,100,100,104,104,104,96,96,96,104,100,96,102,96,104,104, \
+ 102,104,100,104,112,104,104,112,112,112,104,112,120,112,112,112, \
+ 112,120,110,118,118,118,119,112,120,118,120,112,118,127,128,128, \
+ 128,128,128,128,128,128,128,128,128,128,128,128,128,136,128,136, \
+ 128,128,128,128,128,128,128,128,127,128,128,128,128,128,130,133, \
+ 134,136,136,135,136,136,150,136,136,138,148,140,136,143,148,150, \
+ 150,150,150,148,150,148,148,150,156,149,168,150,160,161,168,168, \
+ 168,168,168,162,168,162,167,168,168,168,168,168,162,174,168,168, \
+ 174,174,184,168,168,176,162,168,192,174,168,168,173,174,186,174, \
+ 174,168,192,174,168,174,168,168,186,192,192,180,174,176,192,192, \
+ 185,192,192,180,192,192,186,192,192,192,192,192,184,192,208,208, \
+ 208,208,190,192,190,192,192,191,186,192,192,208,192,192,192,192, \
+ 192,192,196,204,204,192,204,192,208,192,191,192,208,208,198,208, \
+ 205,220,197,218,222,208,216,199,207,220,206,224,214,204,208,219, \
+ 221,209,227,207,221,216,208,236,222,244,225,208,208,212,224,222, \
+ 229,230,225,221,222,256,227,240,221,224,240,216,240,231,224,263, \
+ 246,232,240,240,240,240,239,240,240,234,234,240,234,238,240,240, \
+ 240,240,256,256,240,256,240,240,240,234,256,240,240,256,234,256, \
+ 256,239,272,244,256,255,256,240,256,240,256,255,240,255,256,256, \
+ 256,254,254,256,244,256,256,256,256,256,256,256,256,253,272,255, \
+ 256,256,252,256,256,256,256,256,256,272,256,256,256,256,257,272, \
+ 272,272,272,272,264,270,272,288,272,280,282,282,280,280,270,282, \
+ 282,282,288,282,288,282,282,300,286,288,300,282,282,288,300,312, \
+ 300,298,306,300,304,304,304,300,300,300,316,306,300,288,306,311, \
+ 324,312,320,300,306,336,320,300,324,320,336,336,336,328,336,324, \
+ 336,336,328,336,322,328,336,336,336,336,312,336,336,336,336,336, \
+ 336,336,336,335,336,344,348,336,353,349,336,336,348,348,346,336, \
+ 352,320,336,336,336,336,352,336,336,336,336,336,336,336,336,336, \
+ 336,336,336,330,336,336,336,336,334,335,336,336,344,344,348,336, \
+ 348,336,352,336,336,348,336,348,336,348,352,351,348,336,336,336, \
+ 352,352,352,348,352,336,336,384,336,336,352,348,336,348,376,352, \
+ 352,372,384,352,384,352,352,352,348,384,348,349,384,351,384,353, \
+ 368,352,350,353,378,372,372,372,384,352,384,352,408,384,378,368, \
+ 383,384,408,356,371,368,372,371,384,376,384,408,384,407,372,384, \
+ 408,369,406,383,377,384,394,382,370,416,408,378,369,372,381,400, \
+ 378,408,376,402,417,408,376,384,382,384,384,408,384,384,384,408, \
+ 384,416,408,408,416,384,384,384,408,384,384,384,396,408,408,408, \
+ 408,408,408,406,408,408,416,416,408,408,408,408,408,416,408,416, \
+ 408,405,416,408,408,440,408,416,416,416,440,408,408,408,440,444, \
+ 408,440,440,408,415,419,440,440,444,443,436,436,440,447,448,440, \
+ 440,416,440,439,440,444,440,444,468,448,440,416,440,416,465,465, \
+ 468,436,468,440,472,439,440,468,472,448,465,468,464,439,440,480, \
+ 480,472,439,468,440,440,468,440,468,468,444,440,448,480,438,440, \
+ 504,439,440,467,480,468,448,465,466,440,468,464,440,472,448,468, \
+ 468,469,456,465,448,460,472,472,468,469,465,480,480,468,472,512, \
+ 468,464,465,469,480,468,504,466,468,480,480,480,468,512,504,469, \
+ 466,466,472,468,480,480,512,469,472,480,480,480,504,477,500,466, \
+ 504,468,480,512,504,512,504,480,480,511,512,510,492,511,503,513, \
+ 503,502,504,512,504,512,504,512,504,512,504,512,513,503,512,504, \
+ 513,504,512,512,510,501,513,503,512,513,498,504,512,510,502,512, \
+ 501,500,552,497,516,511,503,513,497,511,502,509,564,509,504,512, \
+ 503,504,512,504,504,500,512,512,512,511,512,504,557,504,564,564, \
+ 512,564,514,512,516,512,560,564,560,564,564,512,564,564,564,560 \
+
+#define MPFR_MUL_THRESHOLD 15 /* limbs */
+#define MPFR_SQR_THRESHOLD 14 /* limbs */
+#define MPFR_DIV_THRESHOLD 27 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 562 /* bits */
+#define MPFR_EXP_THRESHOLD 9671 /* bits */
+#define MPFR_SINCOS_THRESHOLD 30620 /* bits */
+#define MPFR_AI_THRESHOLD1 -28021 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 2991
+#define MPFR_AI_THRESHOLD3 37474
+/* Tuneup completed successfully, took 6469 seconds */
diff --git a/src/x86_64/core2/mparam.h b/src/x86_64/core2/mparam.h
new file mode 100644
index 0000000..0cf85d0
--- /dev/null
+++ b/src/x86_64/core2/mparam.h
@@ -0,0 +1,236 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2011-07-31, gcc 4.3.2 */
+/* gcc14.fsffrance.org (Intel(R) Xeon(R) CPU X5450 @ 3.00GHz) with gmp 5.0.2 */
+
+/* very similar timings were obtained on 2012-01-25 with gcc 4.1.3
+ on gcc70.fsffrance.org (Intel(R) Xeon(TM) CPU 3.20GHz) with gmp 5.0.2,
+ where GMP defines -mtune=nocona, thus we share the parameters */
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,9, \
+ 10,10,12,12,13,13,13,13,14,16,16,17,18,19,20,24, \
+ 24,24,24,24,26,26,26,26,28,28,28,30,30,32,32,28, \
+ 28,30,30,32,32,32,32,32,32,32,32,34,36,48,38,36, \
+ 40,46,48,48,48,48,48,48,48,48,48,48,48,56,56,56, \
+ 56,48,48,48,56,60,60,60,64,64,56,56,56,60,60,60, \
+ 64,69,64,64,64,69,69,69,69,69,69,69,64,64,75,81, \
+ 81,80,80,80,81,81,81,81,81,81,87,81,87,87,92,93, \
+ 92,87,93,92,87,90,93,92,93,92,90,93,92,93,92,93, \
+ 92,93,93,93,104,93,99,93,99,104,105,104,105,104,105,104, \
+ 111,104,111,110,104,117,117,117,117,117,117,104,105,141,141,140, \
+ 141,141,141,141,141,141,141,141,141,141,141,141,141,140,141,141, \
+ 141,141,141,141,141,141,141,141,140,141,141,141,141,138,140,141, \
+ 141,141,140,141,141,141,141,141,141,141,141,141,165,141,153,141, \
+ 153,165,188,188,188,188,188,188,188,188,188,188,188,188,188,188, \
+ 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, \
+ 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, \
+ 188,188,204,204,188,203,188,188,204,204,188,188,216,220,220,220, \
+ 220,204,204,220,220,220,220,220,220,220,220,220,220,220,220,220, \
+ 220,220,220,235,236,219,220,220,236,236,236,236,236,236,236,236, \
+ 236,236,236,236,236,236,236,282,282,282,282,282,282,282,282,282, \
+ 282,282,282,282,282,282,282,282,282,281,282,280,282,282,282,282, \
+ 282,282,282,282,282,282,282,281,281,282,281,281,282,282,282,282, \
+ 282,282,282,282,282,282,282,282,282,282,282,281,282,280,281,282, \
+ 282,282,282,282,306,282,306,330,330,306,281,330,282,282,330,330, \
+ 330,282,330,329,330,330,330,330,330,330,330,330,330,330,330,330, \
+ 330,330,330,330,330,330,330,330,330,330,354,354,330,330,330,329, \
+ 330,330,330,330,330,330,330,329,330,330,354,354,330,330,330,330, \
+ 330,330,378,330,354,330,354,354,354,354,354,377,378,354,354,354, \
+ 378,354,378,378,354,353,354,378,354,378,378,377,378,378,378,408, \
+ 408,408,378,408,408,408,378,416,408,408,377,378,378,408,408,407, \
+ 408,408,408,408,408,408,408,440,408,440,440,440,439,440,440,440, \
+ 432,439,440,440,440,439,440,440,440,439,440,439,440,439,440,440, \
+ 440,440,440,439,440,440,440,440,440,439,440,440,440,440,439,440, \
+ 440,440,440,439,471,440,440,440,440,440,440,439,440,440,440,440, \
+ 440,440,440,440,440,440,472,440,440,439,440,440,440,439,440,440, \
+ 440,472,439,440,440,440,472,440,471,472,472,472,472,472,472,471, \
+ 471,472,471,472,472,472,504,504,504,504,504,504,504,504,472,471, \
+ 472,472,504,472,471,472,504,504,504,504,504,503,504,504,504,504, \
+ 504,503,504,504,504,504,503,504,504,504,504,504,503,504,504,504, \
+ 504,504,503,504,504,504,504,504,504,504,504,504,504,504,504,504, \
+ 504,504,504,504,544,544,544,544,544,544,544,544,544,544,544,544, \
+ 542,543,544,544,544,544,544,544,544,544,544,544,544,544,544,544, \
+ 543,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544, \
+ 544,592,544,544,592,592,544,592,592,591,592,592,632,631,592,592, \
+ 592,592,592,592,592,640,640,640,640,640,616,616,616,616,616,616, \
+ 632,592,616,616,632,630,631,632,632,632,616,632,640,632,632,640, \
+ 640,640,640,640,640,640,639,640,632,632,639,640,640,640,632,632, \
+ 640,639,640,640,632,640,640,640,640,640,640,640,640,640,640,640, \
+ 640,640,640,640,640,640,632,640,640,640,640,640,640,640,640,640, \
+ 640,640,640,640,640,640,640,640,640,640,632,688,640,640,632,632, \
+ 640,640,640,640,639,640,640,640,688,632,687,640,712,688,640,640, \
+ 640,640,640,712,640,640,640,712,736,640,640,640,711,712,736,736, \
+ 640,640,688,712,712,712,712,712,728,736,728,728,736,736,736,736, \
+ 736,736,736,736,734,736,728,736,736,736,728,736,736,736,736,736, \
+ 736,736,736,736,735,712,736,736,736,712,736,736,736,736,736,736, \
+ 736,736,736,712,736,736,712,736,728,712,736,712,736,736,736,736, \
+ 728,712,736,736,735,736,736,736,735,736,736,736,736,735,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,734,736,736, \
+ 736,736,735,736,736,736,735,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,735,736, \
+ 736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736, \
+ 824,824,832,832,832,832,824,832,832,832,832,832,824,831,832,832 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,0,0,0,0,0,0,5,6,6,7,8,8,8,10,9, \
+ 10,11,11,11,12,13,13,13,14,16,16,17,17,17,17,17, \
+ 18,19,20,21,20,23,24,21,26,23,23,24,24,24,25,28, \
+ 26,28,28,34,32,34,32,32,34,34,32,34,34,34,34,34, \
+ 34,36,40,38,38,36,42,42,40,40,40,40,42,42,42,42, \
+ 46,42,48,48,48,46,52,52,52,52,52,52,56,56,56,56, \
+ 64,56,64,64,64,64,68,56,64,64,64,68,63,64,64,68, \
+ 68,68,68,68,64,68,68,68,72,64,68,68,68,64,67,68, \
+ 68,68,68,68,68,68,72,84,80,72,72,72,72,72,76,76, \
+ 76,76,80,80,76,76,80,84,80,80,80,84,84,84,84,84, \
+ 84,84,84,96,84,84,92,92,96,96,96,99,92,92,92,95, \
+ 96,105,111,105,104,105,104,104,105,105,105,105,104,105,104,105, \
+ 99,114,105,116,117,117,117,123,117,123,116,123,116,111,123,123, \
+ 123,123,123,123,123,117,117,117,123,123,123,117,123,117,123,123, \
+ 123,123,123,123,117,123,123,123,156,123,123,141,123,123,135,135, \
+ 123,148,123,141,141,156,156,129,156,163,156,164,156,156,156,135, \
+ 156,141,155,164,156,156,164,148,148,147,141,164,164,164,164,156, \
+ 164,164,164,164,163,164,164,164,164,164,164,164,164,164,164,164, \
+ 164,156,164,164,156,164,164,164,188,163,164,164,164,164,187,188, \
+ 180,164,204,204,164,188,196,188,188,204,196,180,196,204,188,196, \
+ 220,187,204,220,204,180,220,220,204,204,196,204,220,204,220,220, \
+ 220,220,204,220,220,220,220,220,220,220,220,220,220,220,220,220, \
+ 252,220,220,220,220,220,252,220,252,220,220,220,220,252,252,252, \
+ 252,252,252,252,252,252,252,252,252,252,252,252,267,268,252,252, \
+ 252,250,252,252,252,268,251,252,268,252,268,268,268,252,252,252, \
+ 265,268,268,268,268,268,268,268,268,268,268,268,268,268,268,268, \
+ 268,267,268,268,268,267,268,268,268,267,268,268,268,268,268,268, \
+ 268,268,252,268,252,268,268,268,268,268,268,265,268,268,268,268, \
+ 268,268,268,268,268,268,268,268,268,268,268,268,265,268,268,268, \
+ 252,268,268,266,268,268,268,328,265,282,312,268,268,268,268,268, \
+ 268,268,268,268,268,268,268,311,310,282,282,294,312,282,281,294, \
+ 282,268,312,312,268,311,312,268,268,312,268,312,312,268,312,327, \
+ 268,312,328,268,328,268,328,328,328,312,328,312,327,328,328,312, \
+ 327,328,328,327,325,327,327,359,328,328,327,328,328,328,328,328, \
+ 311,328,360,360,360,360,360,360,360,360,360,360,328,360,360,360, \
+ 328,312,328,360,327,328,328,359,360,328,359,328,312,360,360,327, \
+ 312,408,328,440,328,328,328,328,328,392,328,328,408,408,408,392, \
+ 407,408,408,408,392,407,408,408,407,407,408,408,408,392,408,408, \
+ 407,408,392,408,408,440,406,408,408,408,440,408,408,408,440,440, \
+ 440,440,440,392,440,392,440,440,440,440,440,440,440,440,440,440, \
+ 408,392,440,440,440,438,439,440,440,440,440,440,440,439,440,439, \
+ 440,440,440,504,408,504,408,408,408,472,408,408,407,408,440,439, \
+ 439,440,440,440,440,440,440,440,437,440,440,440,439,504,503,504, \
+ 504,503,504,504,440,502,504,503,503,504,504,503,504,504,504,504, \
+ 504,503,504,504,499,503,502,504,504,536,502,504,504,504,536,504, \
+ 504,504,503,504,504,503,536,504,502,536,503,504,504,504,536,536, \
+ 504,504,504,536,536,535,504,536,535,504,504,504,504,504,504,536, \
+ 536,536,503,536,504,503,536,536,504,535,536,536,504,535,520,536, \
+ 504,504,504,536,535,536,520,536,535,520,536,535,535,536,536,535, \
+ 504,536,536,535,536,535,535,536,536,536,536,536,535,504,536,536, \
+ 536,536,536,536,536,536,536,536,536,535,536,536,536,535,504,536, \
+ 536,536,536,536,504,535,536,536,536,535,535,536,536,536,536,536, \
+ 536,535,536,504,536,535,536,536,536,536,536,504,504,536,504,535, \
+ 536,504,536,535,536,504,504,504,536,536,504,536,504,536,504,536, \
+ 536,504,535,536,632,535,536,536,535,536,536,536,536,536,632,632, \
+ 536,631,536,536,535,536,536,536,536,535,536,536,536,631,632,632, \
+ 536,536,630,535,536,536,600,632,631,600,536,536,536,536,535,632, \
+ 536,598,536,600,536,631,600,568,632,568,568,568,568,568,664,566, \
+ 568,568,632,632,664,568,664,663,632,629,632,535,600,536,536,536, \
+ 632,536,536,599,536,630,536,632,631,632,600,600,600,664,600,664, \
+ 664,632,600,599,664,600,662,663,664,599,598,616,632,625,632,630, \
+ 628,627,630,631,632,663,632,631,632,630,632,631,632,626,632,632, \
+ 632,663,631,631,632,632,632,664,632,632,600,632,632,600,632,632, \
+ 600,600,632,632,632,662,663,663,663,600,664,632,664,663,664,632 \
+
+#define MPFR_DIVHIGH_TAB \
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,12,13, \
+ 14,15,16,13,14,14,14,15,15,17,17,17,19,19,19,19, \
+ 23,23,19,25,23,25,23,25,25,22,26,28,25,28,25,25, \
+ 28,27,31,27,29,28,33,31,32,33,31,32,33,33,35,35, \
+ 35,39,37,43,39,37,39,41,39,40,39,40,41,45,41,47, \
+ 45,45,47,43,44,45,50,54,49,46,53,47,55,56,52,55, \
+ 52,60,60,52,60,64,62,55,55,62,55,58,56,64,61,59, \
+ 63,63,64,59,60,60,63,64,64,63,64,64,68,68,66,66, \
+ 68,69,71,71,70,71,71,72,78,74,74,71,72,78,78,74, \
+ 76,77,78,79,78,80,79,79,84,83,80,80,82,95,96,83, \
+ 92,92,88,91,92,84,95,95,92,96,94,91,94,92,96,94, \
+ 96,96,96,104,94,94,112,112,104,112,112,112,96,112,112,112, \
+ 112,112,110,104,112,112,112,111,112,108,110,120,112,112,112,112, \
+ 112,112,120,112,120,120,112,120,120,120,120,120,128,120,120,116, \
+ 128,128,124,128,120,128,128,120,120,120,128,120,128,120,124,128, \
+ 128,128,128,127,128,128,126,128,128,128,128,127,136,128,138,137, \
+ 137,135,138,138,138,137,135,138,150,150,138,147,150,138,150,150, \
+ 150,150,160,160,156,150,156,148,150,158,162,160,161,160,150,160, \
+ 160,160,168,156,156,160,168,173,162,156,180,160,160,157,168,160, \
+ 160,160,162,168,168,160,184,162,184,162,160,160,174,160,184,180, \
+ 184,184,180,184,184,186,180,184,184,184,184,184,186,188,188,192, \
+ 185,184,184,186,192,192,192,186,182,192,192,185,184,184,192,208, \
+ 192,184,184,180,192,184,192,186,186,184,192,186,186,191,186,185, \
+ 192,216,192,192,208,192,191,192,192,192,204,192,207,192,216,208, \
+ 208,216,216,197,196,216,216,208,216,222,216,222,208,222,208,222, \
+ 224,208,209,216,216,209,224,207,216,222,224,224,208,223,224,224, \
+ 224,216,222,222,224,224,224,216,224,216,222,221,222,224,224,224, \
+ 224,224,224,232,224,222,224,232,225,233,224,240,224,232,256,240, \
+ 256,256,240,255,240,256,256,240,232,240,232,232,240,232,256,256, \
+ 256,256,256,256,256,256,255,256,256,240,256,240,256,240,254,252, \
+ 256,256,256,256,256,256,256,256,254,256,256,282,276,256,254,256, \
+ 256,255,282,256,255,256,255,256,255,288,256,264,264,256,274,276, \
+ 276,269,273,273,282,269,276,276,276,276,273,282,276,282,276,277, \
+ 280,312,282,281,288,282,276,282,276,276,288,312,276,288,300,276, \
+ 304,276,288,300,304,312,312,312,312,312,306,312,312,312,316,300, \
+ 324,312,320,320,300,312,312,312,312,324,312,330,300,320,312,312, \
+ 316,318,324,324,318,312,312,324,336,336,324,312,312,336,324,320, \
+ 312,336,312,324,336,336,336,368,324,348,312,336,368,312,312,320, \
+ 368,372,368,312,324,376,372,312,368,376,376,372,370,372,318,376, \
+ 320,372,372,368,372,324,376,376,376,376,368,372,376,376,376,376, \
+ 372,372,376,376,376,372,384,376,372,368,384,376,376,370,376,376, \
+ 376,371,372,368,384,336,370,370,376,372,376,376,368,376,376,372, \
+ 376,370,376,368,376,372,376,376,368,376,376,368,368,376,368,368, \
+ 370,370,372,368,372,376,376,376,376,368,370,368,368,372,376,376, \
+ 372,376,368,376,376,376,372,376,376,372,376,376,368,376,372,376, \
+ 372,368,376,370,376,372,376,372,376,376,372,370,376,376,370,372, \
+ 372,373,376,376,384,384,384,376,376,376,376,384,376,376,384,384, \
+ 384,416,384,384,408,384,416,384,384,384,384,408,416,416,416,432, \
+ 408,408,416,408,408,416,408,416,416,416,416,416,416,408,407,440, \
+ 432,408,416,408,416,440,416,408,416,416,432,416,416,440,416,416, \
+ 416,440,432,440,408,448,448,408,408,432,440,432,448,416,416,416, \
+ 440,432,432,416,448,432,465,440,432,440,480,448,416,448,432,432, \
+ 480,432,448,440,466,448,432,440,432,440,440,440,480,430,448,448, \
+ 448,439,440,432,438,447,448,440,440,440,448,448,480,432,448,448, \
+ 448,448,448,447,448,448,448,447,448,448,440,465,448,467,448,448, \
+ 448,448,464,464,448,448,466,480,480,480,468,480,448,464,480,464, \
+ 466,466,464,479,480,480,512,480,540,480,496,480,552,512,480,479, \
+ 504,480,552,552,512,480,504,552,564,512,480,480,504,561,564,564, \
+ 512,552,560,564,564,480,564,480,552,480,564,564,564,564,536,564, \
+ 540,564,552,564,564,564,564,552,564,552,564,480,564,552,552,564, \
+ 512,564,546,564,564,564,512,552,552,559,560,561,564,564,560,560, \
+ 552,561,564,564,560,564,561,564,564,564,564,564,564,564,564,560, \
+ 561,560,564,564,560,564,564,552,564,564,564,552,564,564,564,564, \
+ 564,563,564,564,564,564,560,564,564,564,564,552,564,564,560,564 \
+
+#define MPFR_MUL_THRESHOLD 7 /* limbs */
+#define MPFR_SQR_THRESHOLD 12 /* limbs */
+#define MPFR_DIV_THRESHOLD 20 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 1024 /* bits */
+#define MPFR_EXP_THRESHOLD 9670 /* bits */
+#define MPFR_SINCOS_THRESHOLD 23808 /* bits */
+#define MPFR_AI_THRESHOLD1 -13250 /* threshold for negative input of mpfr_ai */
+#define MPFR_AI_THRESHOLD2 1430
+#define MPFR_AI_THRESHOLD3 21190
+/* Tuneup completed successfully, took 770 seconds */
diff --git a/src/x86_64/pentium4/mparam.h b/src/x86_64/pentium4/mparam.h
new file mode 100644
index 0000000..8412940
--- /dev/null
+++ b/src/x86_64/pentium4/mparam.h
@@ -0,0 +1,160 @@
+/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Generated by MPFR's tuneup.c, 2009-02-09, gcc 4.3 */
+/* crumble.loria.fr with gmp-4.2.4 */
+
+
+#define MPFR_MULHIGH_TAB \
+ -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \
+ 0,0,0,19,20,20,24,26,0,0,24,26,28,27,26,28, \
+ 30,32,32,32,30,30,34,34,32,34,34,36,32,34,36,34, \
+ 35,0,0,36,36,0,37,48,0,0,48,48,51,0,48,52, \
+ 51,0,52,52,51,55,52,56,55,0,56,60,59,59,60,64, \
+ 63,63,64,64,67,67,68,72,63,71,72,60,67,67,60,72, \
+ 63,61,64,64,63,71,68,68,71,67,68,68,67,71,68,72, \
+ 68,68,72,72,76,76,69,69,72,72,71,103,104,72,73,96, \
+ 103,94,95,104,96,96,94,103,104,104,96,96,103,103,104,104, \
+ 120,120,103,103,104,104,120,111,103,112,104,104,120,120,109,103, \
+ 119,119,120,120,127,112,128,128,120,120,136,127,128,128,120,126, \
+ 121,129,126,134,135,135,136,120,113,113,114,118,127,127,136,120, \
+ 121,125,126,118,119,119,120,136,121,153,122,122,127,119,120,128, \
+ 165,153,162,134,163,159,136,136,153,153,134,158,135,135,136,136, \
+ 153,153,162,158,159,159,156,152,153,189,158,186,187,163,156,168, \
+ 189,159,165,165,176,176,172,172,183,173,164,174,165,165,176,176, \
+ 177,177,183,188,189,189,180,185,176,186,177,177,193,188,189,189, \
+ 200,200,201,201,177,207,188,198,199,189,200,200,186,201,207,207, \
+ 213,203,189,189,200,210,201,196,212,207,208,213,189,199,200,200, \
+ 203,209,216,204,199,223,206,200,213,225,208,208,203,203,216,204, \
+ 205,205,224,212,213,213,184,208,209,203,198,210,199,187,206,200, \
+ 201,189,208,208,203,185,216,198,187,199,200,212,213,213,202,208, \
+ 203,197,198,198,199,211,212,212,285,213,280,274,227,275,288,204, \
+ 284,284,278,285,307,216,273,308,309,309,275,219,213,311,305,284, \
+ 306,306,307,307,308,308,309,309,303,303,311,311,284,312,285,285, \
+ 307,286,287,308,309,309,303,303,304,332,305,305,306,299,328,300, \
+ 308,301,309,309,303,310,311,311,333,305,285,285,307,314,308,308, \
+ 321,305,354,322,331,355,332,308,309,333,334,334,303,303,304,312, \
+ 305,305,306,306,307,307,308,308,309,309,302,302,375,311,312,360, \
+ 353,305,330,354,307,355,380,308,357,309,358,358,359,311,312,312, \
+ 345,329,378,354,331,355,356,356,357,357,374,334,375,311,336,384, \
+ 356,329,330,357,331,358,404,332,369,333,334,334,335,353,354,354, \
+ 355,382,356,347,357,357,358,358,377,359,405,333,352,379,353,353, \
+ 354,354,355,355,356,356,357,357,358,376,359,377,369,360,379,370, \
+ 380,380,354,372,355,382,383,401,357,357,376,358,377,377,405,378, \
+ 379,379,380,380,381,381,402,402,353,403,404,404,405,405,376,376, \
+ 377,357,368,358,379,379,360,400,401,381,372,452,373,383,454,384, \
+ 405,405,456,356,357,357,358,378,379,379,490,370,381,381,492,402, \
+ 463,403,404,404,405,405,456,456,527,357,448,448,489,449,400,450, \
+ 453,453,454,454,455,455,456,456,468,490,491,491,492,404,405,482, \
+ 472,450,451,462,463,463,464,453,465,465,455,455,456,489,490,490, \
+ 491,491,492,492,405,526,483,527,484,484,452,452,486,453,454,454, \
+ 455,477,456,522,490,490,491,524,481,492,526,482,483,527,495,517, \
+ 521,533,522,474,499,523,524,524,489,489,490,526,527,527,528,528, \
+ 529,529,518,554,495,483,496,472,521,557,486,522,535,535,524,512, \
+ 525,561,526,526,491,527,528,528,529,517,518,554,531,519,544,520, \
+ 521,521,558,546,559,535,560,536,489,573,490,514,491,563,492,492, \
+ 528,489,555,555,491,491,492,596,597,545,546,546,560,599,600,600, \
+ 523,562,563,511,564,525,526,630,553,527,528,528,607,555,595,543, \
+ 544,531,532,571,559,559,599,560,535,535,562,562,563,537,564,564, \
+ 565,630,514,631,528,632,555,542,634,595,557,557,597,558,559,559, \
+ 571,599,530,530,559,545,546,616,561,547,548,534,633,563,564,564, \
+ 607,537,594,636,567,539,624,554,555,555,598,598,557,557,558,572, \
+ 559,559,560,574,603,561,562,632,563,563,578,592,593,607,580,608, \
+ 553,609,624,596,597,597,598,612,627,585,600,614,573,629,616,602, \
+ 599,599,585,585,616,616,587,632,603,603,634,634,635,605,636,621, \
+ 622,607,623,593,609,609,625,610,611,626,612,597,628,598,599,599, \
+ 600,630,631,616,602,632,633,603,634,634,635,635,636,636,607,637, \
+ 668,608,609,609,610,610,611,611,597,657,628,628,629,629,630,630, \
+ 609,625,562,626,627,563,564,628,629,629,630,630,631,599,664,632, \
+ 681,633,634,634,635,635,620,636,621,621,622,622,623,639,672,592, \
+ 609,641,594,594,595,627,596,564,629,597,598,598,631,599,600,600, \
+ 601,681,618,634,603,635,636,636,557,621,622,606,623,623,608,608 \
+
+#define MPFR_SQRHIGH_TAB \
+ -1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,8,8,9,9, \
+ 10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17, \
+ 18,18,19,19,20,20,21,21,22,22,23,23,26,24,25,25, \
+ 26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33, \
+ 34,34,35,35,36,36,37,38,39,39,39,39,40,40,41,41, \
+ 42,42,43,43,44,44,45,46,46,46,47,47,48,48,49,49, \
+ 50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57, \
+ 58,58,59,59,60,60,61,61,62,62,63,68,64,64,65,65, \
+ 66,68,67,69,68,68,71,69,70,75,76,76,72,72,73,73, \
+ 74,82,75,80,78,76,77,77,78,83,79,81,82,80,81,81, \
+ 82,82,83,85,84,84,85,85,86,86,87,87,88,88,89,89, \
+ 90,92,91,93,94,92,93,93,94,94,95,95,96,96,97,97, \
+ 98,98,99,99,100,100,101,101,102,102,103,103,104,104,105,105, \
+ 106,106,107,107,108,108,109,112,110,110,111,118,112,112,113,113, \
+ 114,114,115,122,123,116,117,117,118,118,119,119,120,120,121,121, \
+ 122,122,123,123,124,124,125,125,126,126,127,127,128,128,129,129, \
+ 130,154,135,131,132,132,133,133,134,134,135,135,136,140,151,137, \
+ 142,138,139,143,144,154,155,150,151,156,152,143,153,158,145,145, \
+ 165,146,147,147,152,162,149,149,150,150,151,151,152,171,153,153, \
+ 154,154,155,155,156,156,157,157,158,158,159,159,160,160,161,161, \
+ 162,162,163,163,164,164,165,165,166,166,167,167,168,168,169,169, \
+ 170,170,171,171,172,183,173,173,174,174,175,175,176,187,194,182, \
+ 183,178,179,179,180,180,181,181,182,182,183,183,195,184,185,185, \
+ 186,197,187,187,188,188,189,189,190,190,191,191,192,192,193,204, \
+ 207,200,201,208,209,196,197,203,204,198,199,199,200,200,201,201, \
+ 202,215,216,230,217,210,211,218,212,206,207,207,208,208,209,209, \
+ 210,230,231,231,232,225,226,226,227,227,228,242,222,257,217,217, \
+ 218,245,246,219,220,240,241,234,235,235,236,264,230,258,225,225, \
+ 226,226,227,227,228,228,229,260,261,230,231,270,247,232,233,233, \
+ 234,234,235,235,236,236,237,237,238,238,239,239,240,240,241,241, \
+ 242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249, \
+ 250,250,251,251,252,252,253,253,254,254,255,255,256,256,257,257, \
+ 258,258,259,259,260,260,261,261,262,262,263,263,264,264,265,265, \
+ 266,266,267,267,268,268,269,269,270,270,279,271,272,272,273,273, \
+ 274,274,275,275,276,276,277,277,278,278,279,279,280,280,281,281, \
+ 282,282,283,283,284,284,285,285,294,286,287,287,288,288,289,289, \
+ 290,290,291,291,292,292,293,293,294,294,295,295,296,296,297,297, \
+ 298,298,299,299,300,300,301,301,302,302,303,303,304,304,305,305, \
+ 306,306,307,307,308,308,309,309,310,310,311,311,312,312,313,313, \
+ 314,314,315,315,316,316,317,317,318,318,319,319,320,320,321,321, \
+ 322,322,323,323,324,324,325,325,326,326,327,337,349,338,329,329, \
+ 330,330,331,331,332,332,333,333,334,334,335,335,336,336,337,337, \
+ 338,338,339,360,340,340,341,341,342,342,343,343,344,354,355,345, \
+ 346,346,368,368,369,369,359,349,393,382,383,361,362,362,363,363, \
+ 365,365,366,390,367,391,380,404,358,393,406,382,383,395,396,396, \
+ 385,409,386,410,387,399,388,412,413,401,390,367,368,403,404,416, \
+ 417,405,382,406,407,407,408,408,409,409,410,410,435,411,412,412, \
+ 413,413,414,379,439,427,428,392,393,441,442,430,479,455,444,432, \
+ 437,386,451,387,465,439,427,389,390,454,455,455,404,417,444,444, \
+ 394,394,395,446,460,460,461,487,410,475,399,476,477,464,401,465, \
+ 402,492,403,403,404,404,405,405,406,406,407,419,408,408,409,409, \
+ 410,410,411,411,412,412,413,413,414,414,415,415,416,416,417,417, \
+ 418,418,419,419,420,420,421,421,422,422,423,423,424,424,425,508, \
+ 426,426,427,427,428,428,429,429,430,430,431,431,432,432,433,433, \
+ 434,434,435,435,436,436,437,437,438,438,439,536,440,440,441,441, \
+ 442,442,443,443,444,444,445,445,446,446,447,447,448,448,449,476, \
+ 450,450,451,451,452,452,482,453,454,454,455,455,456,456,457,457, \
+ 458,458,459,459,460,460,461,461,462,462,463,463,464,464,465,465, \
+ 466,466,467,467,468,468,469,469,470,470,471,471,472,472,473,473, \
+ 474,474,475,475,476,476,477,477,478,478,479,479,480,480,481,481, \
+ 482,482,483,483,484,484,485,485,486,486,487,487,488,488,489,489, \
+ 490,490,491,491,492,492,493,493,494,494,495,495,496,496,497,497, \
+ 498,498,499,499,500,500,501,501,502,502,503,503,504,504,505,505, \
+ 506,506,507,507,508,508,509,509,510,510,511,511,512,512,513,513 \
+
+#define MPFR_MUL_THRESHOLD 8 /* limbs */
+#define MPFR_EXP_2_THRESHOLD 519 /* bits */
+#define MPFR_EXP_THRESHOLD 6533 /* bits */
diff --git a/src/yn.c b/src/yn.c
new file mode 100644
index 0000000..24d3e17
--- /dev/null
+++ b/src/yn.c
@@ -0,0 +1,426 @@
+/* mpfr_y0, mpfr_y1, mpfr_yn -- Bessel functions of 2nd kind, integer order.
+ http://www.opengroup.org/onlinepubs/009695399/functions/y0.html
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+static int mpfr_yn_asympt (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t);
+
+int
+mpfr_y0 (mpfr_ptr res, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ return mpfr_yn (res, 0, z, r);
+}
+
+int
+mpfr_y1 (mpfr_ptr res, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ return mpfr_yn (res, 1, z, r);
+}
+
+/* compute in s an approximation of S1 = sum((n-k)!/k!*y^k,k=0..n)
+ return e >= 0 the exponent difference between the maximal value of |s|
+ during the for loop and the final value of |s|.
+*/
+static mpfr_exp_t
+mpfr_yn_s1 (mpfr_ptr s, mpfr_srcptr y, unsigned long n)
+{
+ unsigned long k;
+ mpz_t f;
+ mpfr_exp_t e, emax;
+
+ mpz_init_set_ui (f, 1);
+ /* we compute n!*S1 = sum(a[k]*y^k,k=0..n) where a[k] = n!*(n-k)!/k!,
+ a[0] = (n!)^2, a[1] = n!*(n-1)!, ..., a[n-1] = n, a[n] = 1 */
+ mpfr_set_ui (s, 1, MPFR_RNDN); /* a[n] */
+ emax = MPFR_EXP(s);
+ for (k = n; k-- > 0;)
+ {
+ /* a[k]/a[k+1] = (n-k)!/k!/(n-(k+1))!*(k+1)! = (k+1)*(n-k) */
+ mpfr_mul (s, s, y, MPFR_RNDN);
+ mpz_mul_ui (f, f, n - k);
+ mpz_mul_ui (f, f, k + 1);
+ /* invariant: f = a[k] */
+ mpfr_add_z (s, s, f, MPFR_RNDN);
+ e = MPFR_EXP(s);
+ if (e > emax)
+ emax = e;
+ }
+ /* now we have f = (n!)^2 */
+ mpz_sqrt (f, f);
+ mpfr_div_z (s, s, f, MPFR_RNDN);
+ mpz_clear (f);
+ return emax - MPFR_EXP(s);
+}
+
+/* compute in s an approximation of
+ S3 = c*sum((h(k)+h(n+k))*y^k/k!/(n+k)!,k=0..infinity)
+ where h(k) = 1 + 1/2 + ... + 1/k
+ k=0: h(n)
+ k=1: 1+h(n+1)
+ k=2: 3/2+h(n+2)
+ Returns e such that the error is bounded by 2^e ulp(s).
+*/
+static mpfr_exp_t
+mpfr_yn_s3 (mpfr_ptr s, mpfr_srcptr y, mpfr_srcptr c, unsigned long n)
+{
+ unsigned long k, zz;
+ mpfr_t t, u;
+ mpz_t p, q; /* p/q will store h(k)+h(n+k) */
+ mpfr_exp_t exps, expU;
+
+ zz = mpfr_get_ui (y, MPFR_RNDU); /* y = z^2/4 */
+ MPFR_ASSERTN (zz < ULONG_MAX - 2);
+ zz += 2; /* z^2 <= 2^zz */
+ mpz_init_set_ui (p, 0);
+ mpz_init_set_ui (q, 1);
+ /* initialize p/q to h(n) */
+ for (k = 1; k <= n; k++)
+ {
+ /* p/q + 1/k = (k*p+q)/(q*k) */
+ mpz_mul_ui (p, p, k);
+ mpz_add (p, p, q);
+ mpz_mul_ui (q, q, k);
+ }
+ mpfr_init2 (t, MPFR_PREC(s));
+ mpfr_init2 (u, MPFR_PREC(s));
+ mpfr_fac_ui (t, n, MPFR_RNDN);
+ mpfr_div (t, c, t, MPFR_RNDN); /* c/n! */
+ mpfr_mul_z (u, t, p, MPFR_RNDN);
+ mpfr_div_z (s, u, q, MPFR_RNDN);
+ exps = MPFR_EXP (s);
+ expU = exps;
+ for (k = 1; ;k ++)
+ {
+ /* update t */
+ mpfr_mul (t, t, y, MPFR_RNDN);
+ mpfr_div_ui (t, t, k, MPFR_RNDN);
+ mpfr_div_ui (t, t, n + k, MPFR_RNDN);
+ /* update p/q:
+ p/q + 1/k + 1/(n+k) = [p*k*(n+k) + q*(n+k) + q*k]/(q*k*(n+k)) */
+ mpz_mul_ui (p, p, k);
+ mpz_mul_ui (p, p, n + k);
+ mpz_addmul_ui (p, q, n + 2 * k);
+ mpz_mul_ui (q, q, k);
+ mpz_mul_ui (q, q, n + k);
+ mpfr_mul_z (u, t, p, MPFR_RNDN);
+ mpfr_div_z (u, u, q, MPFR_RNDN);
+ exps = MPFR_EXP (u);
+ if (exps > expU)
+ expU = exps;
+ mpfr_add (s, s, u, MPFR_RNDN);
+ exps = MPFR_EXP (s);
+ if (exps > expU)
+ expU = exps;
+ if (MPFR_EXP (u) + (mpfr_exp_t) MPFR_PREC (u) < MPFR_EXP (s) &&
+ zz / (2 * k) < k + n)
+ break;
+ }
+ mpfr_clear (t);
+ mpfr_clear (u);
+ mpz_clear (p);
+ mpz_clear (q);
+ exps = expU - MPFR_EXP (s);
+ /* the error is bounded by (6k^2+33/2k+11) 2^exps ulps
+ <= 8*(k+2)^2 2^exps ulps */
+ return 3 + 2 * MPFR_INT_CEIL_LOG2(k + 2) + exps;
+}
+
+int
+mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
+{
+ int inex;
+ unsigned long absn;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("n=%ld x[%Pu]=%.*Rg rnd=%d", n, mpfr_get_prec (z), mpfr_log_prec, z, r),
+ ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (res), mpfr_log_prec, res, inex));
+
+ absn = SAFE_ABS (unsigned long, n);
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (z)))
+ {
+ if (MPFR_IS_NAN (z))
+ {
+ MPFR_SET_NAN (res); /* y(n,NaN) = NaN */
+ MPFR_RET_NAN;
+ }
+ /* y(n,z) tends to zero when z goes to +Inf, oscillating around
+ 0. We choose to return +0 in that case. */
+ else if (MPFR_IS_INF (z))
+ {
+ if (MPFR_SIGN(z) > 0)
+ return mpfr_set_ui (res, 0, r);
+ else /* y(n,-Inf) = NaN */
+ {
+ MPFR_SET_NAN (res);
+ MPFR_RET_NAN;
+ }
+ }
+ else /* y(n,z) tends to -Inf for n >= 0 or n even, to +Inf otherwise,
+ when z goes to zero */
+ {
+ MPFR_SET_INF(res);
+ if (n >= 0 || ((unsigned long) n & 1) == 0)
+ MPFR_SET_NEG(res);
+ else
+ MPFR_SET_POS(res);
+ mpfr_set_divby0 ();
+ MPFR_RET(0);
+ }
+ }
+
+ /* for z < 0, y(n,z) is imaginary except when j(n,|z|) = 0, which we
+ assume does not happen for a rational z. */
+ if (MPFR_SIGN(z) < 0)
+ {
+ MPFR_SET_NAN (res);
+ MPFR_RET_NAN;
+ }
+
+ /* now z is not singular, and z > 0 */
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Deal with tiny arguments. We have:
+ y0(z) = 2 log(z)/Pi + 2 (euler - log(2))/Pi + O(log(z)*z^2), more
+ precisely for 0 <= z <= 1/2, with g(z) = 2/Pi + 2(euler-log(2))/Pi/log(z),
+ g(z) - 0.41*z^2 < y0(z)/log(z) < g(z)
+ thus since log(z) is negative:
+ g(z)*log(z) < y0(z) < (g(z) - z^2/2)*log(z)
+ and since |g(z)| >= 0.63 for 0 <= z <= 1/2, the relative error on
+ y0(z)/log(z) is bounded by 0.41*z^2/0.63 <= 0.66*z^2.
+ Note: we use both the main term in log(z) and the constant term, because
+ otherwise the relative error would be only in 1/log(|log(z)|).
+ */
+ if (n == 0 && MPFR_EXP(z) < - (mpfr_exp_t) (MPFR_PREC(res) / 2))
+ {
+ mpfr_t l, h, t, logz;
+ mpfr_prec_t prec;
+ int ok, inex2;
+
+ prec = MPFR_PREC(res) + 10;
+ mpfr_init2 (l, prec);
+ mpfr_init2 (h, prec);
+ mpfr_init2 (t, prec);
+ mpfr_init2 (logz, prec);
+ /* first enclose log(z) + euler - log(2) = log(z/2) + euler */
+ mpfr_log (logz, z, MPFR_RNDD); /* lower bound of log(z) */
+ mpfr_set (h, logz, MPFR_RNDU); /* exact */
+ mpfr_nextabove (h); /* upper bound of log(z) */
+ mpfr_const_euler (t, MPFR_RNDD); /* lower bound of euler */
+ mpfr_add (l, logz, t, MPFR_RNDD); /* lower bound of log(z) + euler */
+ mpfr_nextabove (t); /* upper bound of euler */
+ mpfr_add (h, h, t, MPFR_RNDU); /* upper bound of log(z) + euler */
+ mpfr_const_log2 (t, MPFR_RNDU); /* upper bound of log(2) */
+ mpfr_sub (l, l, t, MPFR_RNDD); /* lower bound of log(z/2) + euler */
+ mpfr_nextbelow (t); /* lower bound of log(2) */
+ mpfr_sub (h, h, t, MPFR_RNDU); /* upper bound of log(z/2) + euler */
+ mpfr_const_pi (t, MPFR_RNDU); /* upper bound of Pi */
+ mpfr_div (l, l, t, MPFR_RNDD); /* lower bound of (log(z/2)+euler)/Pi */
+ mpfr_nextbelow (t); /* lower bound of Pi */
+ mpfr_div (h, h, t, MPFR_RNDD); /* upper bound of (log(z/2)+euler)/Pi */
+ mpfr_mul_2ui (l, l, 1, MPFR_RNDD); /* lower bound on g(z)*log(z) */
+ mpfr_mul_2ui (h, h, 1, MPFR_RNDU); /* upper bound on g(z)*log(z) */
+ /* we now have l <= g(z)*log(z) <= h, and we need to add -z^2/2*log(z)
+ to h */
+ mpfr_mul (t, z, z, MPFR_RNDU); /* upper bound on z^2 */
+ /* since logz is negative, a lower bound corresponds to an upper bound
+ for its absolute value */
+ mpfr_neg (t, t, MPFR_RNDD);
+ mpfr_div_2ui (t, t, 1, MPFR_RNDD);
+ mpfr_mul (t, t, logz, MPFR_RNDU); /* upper bound on z^2/2*log(z) */
+ mpfr_add (h, h, t, MPFR_RNDU);
+ inex = mpfr_prec_round (l, MPFR_PREC(res), r);
+ inex2 = mpfr_prec_round (h, MPFR_PREC(res), r);
+ /* we need h=l and inex=inex2 */
+ ok = (inex == inex2) && mpfr_equal_p (l, h);
+ if (ok)
+ mpfr_set (res, h, r); /* exact */
+ mpfr_clear (l);
+ mpfr_clear (h);
+ mpfr_clear (t);
+ mpfr_clear (logz);
+ if (ok)
+ goto end;
+ }
+
+ /* small argument check for y1(z) = -2/Pi/z + O(log(z)):
+ for 0 <= z <= 1, |y1(z) + 2/Pi/z| <= 0.25 */
+ if (n == 1 && MPFR_EXP(z) + 1 < - (mpfr_exp_t) MPFR_PREC(res))
+ {
+ mpfr_t y;
+ mpfr_prec_t prec;
+ mpfr_exp_t err1;
+ int ok;
+ MPFR_BLOCK_DECL (flags);
+
+ /* since 2/Pi > 0.5, and |y1(z)| >= |2/Pi/z|, if z <= 2^(-emax-1),
+ then |y1(z)| > 2^emax */
+ prec = MPFR_PREC(res) + 10;
+ mpfr_init2 (y, prec);
+ mpfr_const_pi (y, MPFR_RNDU); /* Pi*(1+u)^2, where here and below u
+ represents a quantity <= 1/2^prec */
+ mpfr_mul (y, y, z, MPFR_RNDU); /* Pi*z * (1+u)^4, upper bound */
+ MPFR_BLOCK (flags, mpfr_ui_div (y, 2, y, MPFR_RNDZ));
+ /* 2/Pi/z * (1+u)^6, lower bound, with possible overflow */
+ if (MPFR_OVERFLOW (flags))
+ {
+ mpfr_clear (y);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_overflow (res, r, -1);
+ }
+ mpfr_neg (y, y, MPFR_RNDN);
+ /* (1+u)^6 can be written 1+7u [for another value of u], thus the
+ error on 2/Pi/z is less than 7ulp(y). The truncation error is less
+ than 1/4, thus if ulp(y)>=1/4, the total error is less than 8ulp(y),
+ otherwise it is less than 1/4+7/8 <= 2. */
+ if (MPFR_EXP(y) + 2 >= MPFR_PREC(y)) /* ulp(y) >= 1/4 */
+ err1 = 3;
+ else /* ulp(y) <= 1/8 */
+ err1 = (mpfr_exp_t) MPFR_PREC(y) - MPFR_EXP(y) + 1;
+ ok = MPFR_CAN_ROUND (y, prec - err1, MPFR_PREC(res), r);
+ if (ok)
+ inex = mpfr_set (res, y, r);
+ mpfr_clear (y);
+ if (ok)
+ goto end;
+ }
+
+ /* we can use the asymptotic expansion as soon as z > p log(2)/2,
+ but to get some margin we use it for z > p/2 */
+ if (mpfr_cmp_ui (z, MPFR_PREC(res) / 2 + 3) > 0)
+ {
+ inex = mpfr_yn_asympt (res, n, z, r);
+ if (inex != 0)
+ goto end;
+ }
+
+ /* General case */
+ {
+ mpfr_prec_t prec;
+ mpfr_exp_t err1, err2, err3;
+ mpfr_t y, s1, s2, s3;
+ MPFR_ZIV_DECL (loop);
+
+ mpfr_init (y);
+ mpfr_init (s1);
+ mpfr_init (s2);
+ mpfr_init (s3);
+
+ prec = MPFR_PREC(res) + 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC (res)) + 13;
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ mpfr_set_prec (y, prec);
+ mpfr_set_prec (s1, prec);
+ mpfr_set_prec (s2, prec);
+ mpfr_set_prec (s3, prec);
+
+ mpfr_mul (y, z, z, MPFR_RNDN);
+ mpfr_div_2ui (y, y, 2, MPFR_RNDN); /* z^2/4 */
+
+ /* store (z/2)^n temporarily in s2 */
+ mpfr_pow_ui (s2, z, absn, MPFR_RNDN);
+ mpfr_div_2si (s2, s2, absn, MPFR_RNDN);
+
+ /* compute S1 * (z/2)^(-n) */
+ if (n == 0)
+ {
+ mpfr_set_ui (s1, 0, MPFR_RNDN);
+ err1 = 0;
+ }
+ else
+ err1 = mpfr_yn_s1 (s1, y, absn - 1);
+ mpfr_div (s1, s1, s2, MPFR_RNDN); /* (z/2)^(-n) * S1 */
+ /* See algorithms.tex: the relative error on s1 is bounded by
+ (3n+3)*2^(e+1-prec). */
+ err1 = MPFR_INT_CEIL_LOG2 (3 * absn + 3) + err1 + 1;
+ /* rel_err(s1) <= 2^(err1-prec), thus err(s1) <= 2^err1 ulps */
+
+ /* compute (z/2)^n * S3 */
+ mpfr_neg (y, y, MPFR_RNDN); /* -z^2/4 */
+ err3 = mpfr_yn_s3 (s3, y, s2, absn); /* (z/2)^n * S3 */
+ /* the error on s3 is bounded by 2^err3 ulps */
+
+ /* add s1+s3 */
+ err1 += MPFR_EXP(s1);
+ mpfr_add (s1, s1, s3, MPFR_RNDN);
+ /* the error is bounded by 1/2 + 2^err1*2^(- EXP(s1))
+ + 2^err3*2^(EXP(s3) - EXP(s1)) */
+ err3 += MPFR_EXP(s3);
+ err1 = (err3 > err1) ? err3 + 1 : err1 + 1;
+ err1 -= MPFR_EXP(s1);
+ err1 = (err1 >= 0) ? err1 + 1 : 1;
+ /* now the error on s1 is bounded by 2^err1*ulp(s1) */
+
+ /* compute S2 */
+ mpfr_div_2ui (s2, z, 1, MPFR_RNDN); /* z/2 */
+ mpfr_log (s2, s2, MPFR_RNDN); /* log(z/2) */
+ mpfr_const_euler (s3, MPFR_RNDN);
+ err2 = MPFR_EXP(s2) > MPFR_EXP(s3) ? MPFR_EXP(s2) : MPFR_EXP(s3);
+ mpfr_add (s2, s2, s3, MPFR_RNDN); /* log(z/2) + gamma */
+ err2 -= MPFR_EXP(s2);
+ mpfr_mul_2ui (s2, s2, 1, MPFR_RNDN); /* 2*(log(z/2) + gamma) */
+ mpfr_jn (s3, absn, z, MPFR_RNDN); /* Jn(z) */
+ mpfr_mul (s2, s2, s3, MPFR_RNDN); /* 2*(log(z/2) + gamma)*Jn(z) */
+ err2 += 4; /* the error on s2 is bounded by 2^err2 ulps, see
+ algorithms.tex */
+
+ /* add all three sums */
+ err1 += MPFR_EXP(s1); /* the error on s1 is bounded by 2^err1 */
+ err2 += MPFR_EXP(s2); /* the error on s2 is bounded by 2^err2 */
+ mpfr_sub (s2, s2, s1, MPFR_RNDN); /* s2 - (s1+s3) */
+ err2 = (err1 > err2) ? err1 + 1 : err2 + 1;
+ err2 -= MPFR_EXP(s2);
+ err2 = (err2 >= 0) ? err2 + 1 : 1;
+ /* now the error on s2 is bounded by 2^err2*ulp(s2) */
+ mpfr_const_pi (y, MPFR_RNDN); /* error bounded by 1 ulp */
+ mpfr_div (s2, s2, y, MPFR_RNDN); /* error bounded by
+ 2^(err2+1)*ulp(s2) */
+ err2 ++;
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (s2, prec - err2, MPFR_PREC(res), r)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ /* Assume two's complement for the test n & 1 */
+ inex = mpfr_set4 (res, s2, r, n >= 0 || (n & 1) == 0 ?
+ MPFR_SIGN (s2) : - MPFR_SIGN (s2));
+
+ mpfr_clear (y);
+ mpfr_clear (s1);
+ mpfr_clear (s2);
+ mpfr_clear (s3);
+ }
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (res, inex, r);
+}
+
+#define MPFR_YN
+#include "jyn_asympt.c"
diff --git a/src/zeta.c b/src/zeta.c
new file mode 100644
index 0000000..525e7af
--- /dev/null
+++ b/src/zeta.c
@@ -0,0 +1,466 @@
+/* mpfr_zeta -- compute the Riemann Zeta function
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/*
+ Parameters:
+ s - the input floating-point number
+ n, p - parameters from the algorithm
+ tc - an array of p floating-point numbers tc[1]..tc[p]
+ Output:
+ b is the result, i.e.
+ sum(tc[i]*product((s+2j)*(s+2j-1)/n^2,j=1..i-1), i=1..p)*s*n^(-s-1)
+*/
+static void
+mpfr_zeta_part_b (mpfr_t b, mpfr_srcptr s, int n, int p, mpfr_t *tc)
+{
+ mpfr_t s1, d, u;
+ unsigned long n2;
+ int l, t;
+ MPFR_GROUP_DECL (group);
+
+ if (p == 0)
+ {
+ MPFR_SET_ZERO (b);
+ MPFR_SET_POS (b);
+ return;
+ }
+
+ n2 = n * n;
+ MPFR_GROUP_INIT_3 (group, MPFR_PREC (b), s1, d, u);
+
+ /* t equals 2p-2, 2p-3, ... ; s1 equals s+t */
+ t = 2 * p - 2;
+ mpfr_set (d, tc[p], MPFR_RNDN);
+ for (l = 1; l < p; l++)
+ {
+ mpfr_add_ui (s1, s, t, MPFR_RNDN); /* s + (2p-2l) */
+ mpfr_mul (d, d, s1, MPFR_RNDN);
+ t = t - 1;
+ mpfr_add_ui (s1, s, t, MPFR_RNDN); /* s + (2p-2l-1) */
+ mpfr_mul (d, d, s1, MPFR_RNDN);
+ t = t - 1;
+ mpfr_div_ui (d, d, n2, MPFR_RNDN);
+ mpfr_add (d, d, tc[p-l], MPFR_RNDN);
+ /* since s is positive and the tc[i] have alternate signs,
+ the following is unlikely */
+ if (MPFR_UNLIKELY (mpfr_cmpabs (d, tc[p-l]) > 0))
+ mpfr_set (d, tc[p-l], MPFR_RNDN);
+ }
+ mpfr_mul (d, d, s, MPFR_RNDN);
+ mpfr_add (s1, s, __gmpfr_one, MPFR_RNDN);
+ mpfr_neg (s1, s1, MPFR_RNDN);
+ mpfr_ui_pow (u, n, s1, MPFR_RNDN);
+ mpfr_mul (b, d, u, MPFR_RNDN);
+
+ MPFR_GROUP_CLEAR (group);
+}
+
+/* Input: p - an integer
+ Output: fills tc[1..p], tc[i] = bernoulli(2i)/(2i)!
+ tc[1]=1/12, tc[2]=-1/720, tc[3]=1/30240, ...
+*/
+static void
+mpfr_zeta_c (int p, mpfr_t *tc)
+{
+ mpfr_t d;
+ int k, l;
+
+ if (p > 0)
+ {
+ mpfr_init2 (d, MPFR_PREC (tc[1]));
+ mpfr_div_ui (tc[1], __gmpfr_one, 12, MPFR_RNDN);
+ for (k = 2; k <= p; k++)
+ {
+ mpfr_set_ui (d, k-1, MPFR_RNDN);
+ mpfr_div_ui (d, d, 12*k+6, MPFR_RNDN);
+ for (l=2; l < k; l++)
+ {
+ mpfr_div_ui (d, d, 4*(2*k-2*l+3)*(2*k-2*l+2), MPFR_RNDN);
+ mpfr_add (d, d, tc[l], MPFR_RNDN);
+ }
+ mpfr_div_ui (tc[k], d, 24, MPFR_RNDN);
+ MPFR_CHANGE_SIGN (tc[k]);
+ }
+ mpfr_clear (d);
+ }
+}
+
+/* Input: s - a floating-point number
+ n - an integer
+ Output: sum - a floating-point number approximating sum(1/i^s, i=1..n-1) */
+static void
+mpfr_zeta_part_a (mpfr_t sum, mpfr_srcptr s, int n)
+{
+ mpfr_t u, s1;
+ int i;
+ MPFR_GROUP_DECL (group);
+
+ MPFR_GROUP_INIT_2 (group, MPFR_PREC (sum), u, s1);
+
+ mpfr_neg (s1, s, MPFR_RNDN);
+ mpfr_ui_pow (u, n, s1, MPFR_RNDN);
+ mpfr_div_2ui (u, u, 1, MPFR_RNDN);
+ mpfr_set (sum, u, MPFR_RNDN);
+ for (i=n-1; i>1; i--)
+ {
+ mpfr_ui_pow (u, i, s1, MPFR_RNDN);
+ mpfr_add (sum, sum, u, MPFR_RNDN);
+ }
+ mpfr_add (sum, sum, __gmpfr_one, MPFR_RNDN);
+
+ MPFR_GROUP_CLEAR (group);
+}
+
+/* Input: s - a floating-point number >= 1/2.
+ rnd_mode - a rounding mode.
+ Assumes s is neither NaN nor Infinite.
+ Output: z - Zeta(s) rounded to the precision of z with direction rnd_mode
+*/
+static int
+mpfr_zeta_pos (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t b, c, z_pre, f, s1;
+ double beta, sd, dnep;
+ mpfr_t *tc1;
+ mpfr_prec_t precz, precs, d, dint;
+ int p, n, l, add;
+ int inex;
+ MPFR_GROUP_DECL (group);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_ASSERTD (MPFR_IS_POS (s) && MPFR_GET_EXP (s) >= 0);
+
+ precz = MPFR_PREC (z);
+ precs = MPFR_PREC (s);
+
+ /* Zeta(x) = 1+1/2^x+1/3^x+1/4^x+1/5^x+O(1/6^x)
+ so with 2^(EXP(x)-1) <= x < 2^EXP(x)
+ So for x > 2^3, k^x > k^8, so 2/k^x < 2/k^8
+ Zeta(x) = 1 + 1/2^x*(1+(2/3)^x+(2/4)^x+...)
+ = 1 + 1/2^x*(1+sum((2/k)^x,k=3..infinity))
+ <= 1 + 1/2^x*(1+sum((2/k)^8,k=3..infinity))
+ And sum((2/k)^8,k=3..infinity) = -257+128*Pi^8/4725 ~= 0.0438035
+ So Zeta(x) <= 1 + 1/2^x*2 for x >= 8
+ The error is < 2^(-x+1) <= 2^(-2^(EXP(x)-1)+1) */
+ if (MPFR_GET_EXP (s) > 3)
+ {
+ mpfr_exp_t err;
+ err = MPFR_GET_EXP (s) - 1;
+ if (err > (mpfr_exp_t) (sizeof (mpfr_exp_t)*CHAR_BIT-2))
+ err = MPFR_EMAX_MAX;
+ else
+ err = ((mpfr_exp_t)1) << err;
+ err = 1 - (-err+1); /* GET_EXP(one) - (-err+1) = err :) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (z, __gmpfr_one, err, 0, 1,
+ rnd_mode, {});
+ }
+
+ d = precz + MPFR_INT_CEIL_LOG2(precz) + 10;
+
+ /* we want that s1 = s-1 is exact, i.e. we should have PREC(s1) >= EXP(s) */
+ dint = (mpfr_uexp_t) MPFR_GET_EXP (s);
+ mpfr_init2 (s1, MAX (precs, dint));
+ inex = mpfr_sub (s1, s, __gmpfr_one, MPFR_RNDN);
+ MPFR_ASSERTD (inex == 0);
+
+ /* case s=1 should have already been handled */
+ MPFR_ASSERTD (!MPFR_IS_ZERO (s1));
+
+ MPFR_GROUP_INIT_4 (group, MPFR_PREC_MIN, b, c, z_pre, f);
+
+ MPFR_ZIV_INIT (loop, d);
+ for (;;)
+ {
+ /* Principal loop: we compute, in z_pre,
+ an approximation of Zeta(s), that we send to can_round */
+ if (MPFR_GET_EXP (s1) <= -(mpfr_exp_t) ((mpfr_prec_t) (d-3)/2))
+ /* Branch 1: when s-1 is very small, one
+ uses the approximation Zeta(s)=1/(s-1)+gamma,
+ where gamma is Euler's constant */
+ {
+ dint = MAX (d + 3, precs);
+ MPFR_TRACE (printf ("branch 1\ninternal precision=%lu\n",
+ (unsigned long) dint));
+ MPFR_GROUP_REPREC_4 (group, dint, b, c, z_pre, f);
+ mpfr_div (z_pre, __gmpfr_one, s1, MPFR_RNDN);
+ mpfr_const_euler (f, MPFR_RNDN);
+ mpfr_add (z_pre, z_pre, f, MPFR_RNDN);
+ }
+ else /* Branch 2 */
+ {
+ size_t size;
+
+ MPFR_TRACE (printf ("branch 2\n"));
+ /* Computation of parameters n, p and working precision */
+ dnep = (double) d * LOG2;
+ sd = mpfr_get_d (s, MPFR_RNDN);
+ /* beta = dnep + 0.61 + sd * log (6.2832 / sd);
+ but a larger value is ok */
+#define LOG6dot2832 1.83787940484160805532
+ beta = dnep + 0.61 + sd * (LOG6dot2832 - LOG2 *
+ __gmpfr_floor_log2 (sd));
+ if (beta <= 0.0)
+ {
+ p = 0;
+ /* n = 1 + (int) (exp ((dnep - LOG2) / sd)); */
+ n = 1 + (int) __gmpfr_ceil_exp2 ((d - 1.0) / sd);
+ }
+ else
+ {
+ p = 1 + (int) beta / 2;
+ n = 1 + (int) ((sd + 2.0 * (double) p - 1.0) / 6.2832);
+ }
+ MPFR_TRACE (printf ("\nn=%d\np=%d\n",n,p));
+ /* add = 4 + floor(1.5 * log(d) / log (2)).
+ We should have add >= 10, which is always fulfilled since
+ d = precz + 11 >= 12, thus ceil(log2(d)) >= 4 */
+ add = 4 + (3 * MPFR_INT_CEIL_LOG2 (d)) / 2;
+ MPFR_ASSERTD(add >= 10);
+ dint = d + add;
+ if (dint < precs)
+ dint = precs;
+
+ MPFR_TRACE (printf ("internal precision=%lu\n",
+ (unsigned long) dint));
+
+ size = (p + 1) * sizeof(mpfr_t);
+ tc1 = (mpfr_t*) (*__gmp_allocate_func) (size);
+ for (l=1; l<=p; l++)
+ mpfr_init2 (tc1[l], dint);
+ MPFR_GROUP_REPREC_4 (group, dint, b, c, z_pre, f);
+
+ MPFR_TRACE (printf ("precision of z = %lu\n",
+ (unsigned long) precz));
+
+ /* Computation of the coefficients c_k */
+ mpfr_zeta_c (p, tc1);
+ /* Computation of the 3 parts of the fonction Zeta. */
+ mpfr_zeta_part_a (z_pre, s, n);
+ mpfr_zeta_part_b (b, s, n, p, tc1);
+ /* s1 = s-1 is already computed above */
+ mpfr_div (c, __gmpfr_one, s1, MPFR_RNDN);
+ mpfr_ui_pow (f, n, s1, MPFR_RNDN);
+ mpfr_div (c, c, f, MPFR_RNDN);
+ MPFR_TRACE (MPFR_DUMP (c));
+ mpfr_add (z_pre, z_pre, c, MPFR_RNDN);
+ mpfr_add (z_pre, z_pre, b, MPFR_RNDN);
+ for (l=1; l<=p; l++)
+ mpfr_clear (tc1[l]);
+ (*__gmp_free_func) (tc1, size);
+ /* End branch 2 */
+ }
+
+ MPFR_TRACE (MPFR_DUMP (z_pre));
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (z_pre, d-3, precz, rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, d);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inex = mpfr_set (z, z_pre, rnd_mode);
+
+ MPFR_GROUP_CLEAR (group);
+ mpfr_clear (s1);
+
+ return inex;
+}
+
+int
+mpfr_zeta (mpfr_t z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t z_pre, s1, y, p;
+ double sd, eps, m1, c;
+ long add;
+ mpfr_prec_t precz, prec1, precs, precs1;
+ int inex;
+ MPFR_GROUP_DECL (group);
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("s[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (s), mpfr_log_prec, s, rnd_mode),
+ ("z[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (z), mpfr_log_prec, z, inex));
+
+ /* Zero, Nan or Inf ? */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (s)))
+ {
+ if (MPFR_IS_NAN (s))
+ {
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (s))
+ {
+ if (MPFR_IS_POS (s))
+ return mpfr_set_ui (z, 1, MPFR_RNDN); /* Zeta(+Inf) = 1 */
+ MPFR_SET_NAN (z); /* Zeta(-Inf) = NaN */
+ MPFR_RET_NAN;
+ }
+ else /* s iz zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (s));
+ return mpfr_set_si_2exp (z, -1, -1, rnd_mode);
+ }
+ }
+
+ /* s is neither Nan, nor Inf, nor Zero */
+
+ /* check tiny s: we have zeta(s) = -1/2 - 1/2 log(2 Pi) s + ... around s=0,
+ and for |s| <= 0.074, we have |zeta(s) + 1/2| <= |s|.
+ Thus if |s| <= 1/4*ulp(1/2), we can deduce the correct rounding
+ (the 1/4 covers the case where |zeta(s)| < 1/2 and rounding to nearest).
+ A sufficient condition is that EXP(s) + 1 < -PREC(z). */
+ if (MPFR_GET_EXP (s) + 1 < - (mpfr_exp_t) MPFR_PREC(z))
+ {
+ int signs = MPFR_SIGN(s);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_set_si_2exp (z, -1, -1, rnd_mode); /* -1/2 */
+ if (rnd_mode == MPFR_RNDA)
+ rnd_mode = MPFR_RNDD; /* the result is around -1/2, thus negative */
+ if ((rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDZ) && signs < 0)
+ {
+ mpfr_nextabove (z); /* z = -1/2 + epsilon */
+ inex = 1;
+ }
+ else if (rnd_mode == MPFR_RNDD && signs > 0)
+ {
+ mpfr_nextbelow (z); /* z = -1/2 - epsilon */
+ inex = -1;
+ }
+ else
+ {
+ if (rnd_mode == MPFR_RNDU) /* s > 0: z = -1/2 */
+ inex = 1;
+ else if (rnd_mode == MPFR_RNDD)
+ inex = -1; /* s < 0: z = -1/2 */
+ else /* (MPFR_RNDZ and s > 0) or MPFR_RNDN: z = -1/2 */
+ inex = (signs > 0) ? 1 : -1;
+ }
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (z, inex, rnd_mode);
+ }
+
+ /* Check for case s= -2n */
+ if (MPFR_IS_NEG (s))
+ {
+ mpfr_t tmp;
+ tmp[0] = *s;
+ MPFR_EXP (tmp) = MPFR_GET_EXP (s) - 1;
+ if (mpfr_integer_p (tmp))
+ {
+ MPFR_SET_ZERO (z);
+ MPFR_SET_POS (z);
+ MPFR_RET (0);
+ }
+ }
+
+ /* Check for case s= 1 before changing the exponent range */
+ if (mpfr_cmp (s, __gmpfr_one) ==0)
+ {
+ MPFR_SET_INF (z);
+ MPFR_SET_POS (z);
+ mpfr_set_divby0 ();
+ MPFR_RET (0);
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Compute Zeta */
+ if (MPFR_IS_POS (s) && MPFR_GET_EXP (s) >= 0) /* Case s >= 1/2 */
+ inex = mpfr_zeta_pos (z, s, rnd_mode);
+ else /* use reflection formula
+ zeta(s) = 2^s*Pi^(s-1)*sin(Pi*s/2)*gamma(1-s)*zeta(1-s) */
+ {
+ int overflow = 0;
+
+ precz = MPFR_PREC (z);
+ precs = MPFR_PREC (s);
+
+ /* Precision precs1 needed to represent 1 - s, and s + 2,
+ without any truncation */
+ precs1 = precs + 2 + MAX (0, - MPFR_GET_EXP (s));
+ sd = mpfr_get_d (s, MPFR_RNDN) - 1.0;
+ if (sd < 0.0)
+ sd = -sd; /* now sd = abs(s-1.0) */
+ /* Precision prec1 is the precision on elementary computations;
+ it ensures a final precision prec1 - add for zeta(s) */
+ /* eps = pow (2.0, - (double) precz - 14.0); */
+ eps = __gmpfr_ceil_exp2 (- (double) precz - 14.0);
+ m1 = 1.0 + MAX(1.0 / eps, 2.0 * sd) * (1.0 + eps);
+ c = (1.0 + eps) * (1.0 + eps * MAX(8.0, m1));
+ /* add = 1 + floor(log(c*c*c*(13 + m1))/log(2)); */
+ add = __gmpfr_ceil_log2 (c * c * c * (13.0 + m1));
+ prec1 = precz + add;
+ prec1 = MAX (prec1, precs1) + 10;
+
+ MPFR_GROUP_INIT_4 (group, prec1, z_pre, s1, y, p);
+ MPFR_ZIV_INIT (loop, prec1);
+ for (;;)
+ {
+ mpfr_sub (s1, __gmpfr_one, s, MPFR_RNDN);/* s1 = 1-s */
+ mpfr_zeta_pos (z_pre, s1, MPFR_RNDN); /* zeta(1-s) */
+ mpfr_gamma (y, s1, MPFR_RNDN); /* gamma(1-s) */
+ if (MPFR_IS_INF (y)) /* Zeta(s) < 0 for -4k-2 < s < -4k,
+ Zeta(s) > 0 for -4k < s < -4k+2 */
+ {
+ mpfr_div_2ui (s1, s, 2, MPFR_RNDN); /* s/4, exact */
+ mpfr_frac (s1, s1, MPFR_RNDN); /* exact, -1 < s1 < 0 */
+ overflow = (mpfr_cmp_si_2exp (s1, -1, -1) > 0) ? -1 : 1;
+ break;
+ }
+ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN); /* gamma(1-s)*zeta(1-s) */
+ mpfr_const_pi (p, MPFR_RNDD);
+ mpfr_mul (y, s, p, MPFR_RNDN);
+ mpfr_div_2ui (y, y, 1, MPFR_RNDN); /* s*Pi/2 */
+ mpfr_sin (y, y, MPFR_RNDN); /* sin(Pi*s/2) */
+ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN);
+ mpfr_mul_2ui (y, p, 1, MPFR_RNDN); /* 2*Pi */
+ mpfr_neg (s1, s1, MPFR_RNDN); /* s-1 */
+ mpfr_pow (y, y, s1, MPFR_RNDN); /* (2*Pi)^(s-1) */
+ mpfr_mul (z_pre, z_pre, y, MPFR_RNDN);
+ mpfr_mul_2ui (z_pre, z_pre, 1, MPFR_RNDN);
+
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (z_pre, prec1 - add, precz,
+ rnd_mode)))
+ break;
+
+ MPFR_ZIV_NEXT (loop, prec1);
+ MPFR_GROUP_REPREC_4 (group, prec1, z_pre, s1, y, p);
+ }
+ MPFR_ZIV_FREE (loop);
+ if (overflow != 0)
+ {
+ inex = mpfr_overflow (z, rnd_mode, overflow);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ }
+ else
+ inex = mpfr_set (z, z_pre, rnd_mode);
+ MPFR_GROUP_CLEAR (group);
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (z, inex, rnd_mode);
+}
diff --git a/src/zeta_ui.c b/src/zeta_ui.c
new file mode 100644
index 0000000..08f9f1d
--- /dev/null
+++ b/src/zeta_ui.c
@@ -0,0 +1,230 @@
+/* mpfr_zeta_ui -- compute the Riemann Zeta function for integer argument.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+mpfr_zeta_ui (mpfr_ptr z, unsigned long m, mpfr_rnd_t r)
+{
+ MPFR_ZIV_DECL (loop);
+
+ if (m == 0)
+ {
+ mpfr_set_ui (z, 1, r);
+ mpfr_div_2ui (z, z, 1, r);
+ MPFR_CHANGE_SIGN (z);
+ MPFR_RET (0);
+ }
+ else if (m == 1)
+ {
+ MPFR_SET_INF (z);
+ MPFR_SET_POS (z);
+ mpfr_set_divby0 ();
+ return 0;
+ }
+ else /* m >= 2 */
+ {
+ mpfr_prec_t p = MPFR_PREC(z);
+ unsigned long n, k, err, kbits;
+ mpz_t d, t, s, q;
+ mpfr_t y;
+ int inex;
+
+ if (r == MPFR_RNDA)
+ r = MPFR_RNDU; /* since the result is always positive */
+
+ if (m >= p) /* 2^(-m) < ulp(1) = 2^(1-p). This means that
+ 2^(-m) <= 1/2*ulp(1). We have 3^(-m)+4^(-m)+... < 2^(-m)
+ i.e. zeta(m) < 1+2*2^(-m) for m >= 3 */
+
+ {
+ if (m == 2) /* necessarily p=2 */
+ return mpfr_set_ui_2exp (z, 13, -3, r);
+ else if (r == MPFR_RNDZ || r == MPFR_RNDD || (r == MPFR_RNDN && m > p))
+ {
+ mpfr_set_ui (z, 1, r);
+ return -1;
+ }
+ else
+ {
+ mpfr_set_ui (z, 1, r);
+ mpfr_nextabove (z);
+ return 1;
+ }
+ }
+
+ /* now treat also the case where zeta(m) - (1+1/2^m) < 1/2*ulp(1),
+ and the result is either 1+2^(-m) or 1+2^(-m)+2^(1-p). */
+ mpfr_init2 (y, 31);
+
+ if (m >= p / 2) /* otherwise 4^(-m) > 2^(-p) */
+ {
+ /* the following is a lower bound for log(3)/log(2) */
+ mpfr_set_str_binary (y, "1.100101011100000000011010001110");
+ mpfr_mul_ui (y, y, m, MPFR_RNDZ); /* lower bound for log2(3^m) */
+ if (mpfr_cmp_ui (y, p + 2) >= 0)
+ {
+ mpfr_clear (y);
+ mpfr_set_ui (z, 1, MPFR_RNDZ);
+ mpfr_div_2ui (z, z, m, MPFR_RNDZ);
+ mpfr_add_ui (z, z, 1, MPFR_RNDZ);
+ if (r != MPFR_RNDU)
+ return -1;
+ mpfr_nextabove (z);
+ return 1;
+ }
+ }
+
+ mpz_init (s);
+ mpz_init (d);
+ mpz_init (t);
+ mpz_init (q);
+
+ p += MPFR_INT_CEIL_LOG2(p); /* account of the n term in the error */
+
+ p += MPFR_INT_CEIL_LOG2(p) + 15; /* initial value */
+
+ MPFR_ZIV_INIT (loop, p);
+ for(;;)
+ {
+ /* 0.39321985067869744 = log(2)/log(3+sqrt(8)) */
+ n = 1 + (unsigned long) (0.39321985067869744 * (double) p);
+ err = n + 4;
+
+ mpfr_set_prec (y, p);
+
+ /* computation of the d[k] */
+ mpz_set_ui (s, 0);
+ mpz_set_ui (t, 1);
+ mpz_mul_2exp (t, t, 2 * n - 1); /* t[n] */
+ mpz_set (d, t);
+ for (k = n; k > 0; k--)
+ {
+ count_leading_zeros (kbits, k);
+ kbits = GMP_NUMB_BITS - kbits;
+ /* if k^m is too large, use mpz_tdiv_q */
+ if (m * kbits > 2 * GMP_NUMB_BITS)
+ {
+ /* if we know in advance that k^m > d, then floor(d/k^m) will
+ be zero below, so there is no need to compute k^m */
+ kbits = (kbits - 1) * m + 1;
+ /* k^m has at least kbits bits */
+ if (kbits > mpz_sizeinbase (d, 2))
+ mpz_set_ui (q, 0);
+ else
+ {
+ mpz_ui_pow_ui (q, k, m);
+ mpz_tdiv_q (q, d, q);
+ }
+ }
+ else /* use several mpz_tdiv_q_ui calls */
+ {
+ unsigned long km = k, mm = m - 1;
+ while (mm > 0 && km < ULONG_MAX / k)
+ {
+ km *= k;
+ mm --;
+ }
+ mpz_tdiv_q_ui (q, d, km);
+ while (mm > 0)
+ {
+ km = k;
+ mm --;
+ while (mm > 0 && km < ULONG_MAX / k)
+ {
+ km *= k;
+ mm --;
+ }
+ mpz_tdiv_q_ui (q, q, km);
+ }
+ }
+ if (k % 2)
+ mpz_add (s, s, q);
+ else
+ mpz_sub (s, s, q);
+
+ /* we have d[k] = sum(t[i], i=k+1..n)
+ with t[i] = n*(n+i-1)!*4^i/(n-i)!/(2i)!
+ t[k-1]/t[k] = k*(2k-1)/(n-k+1)/(n+k-1)/2 */
+#if (GMP_NUMB_BITS == 32)
+#define KMAX 46341 /* max k such that k*(2k-1) < 2^32 */
+#elif (GMP_NUMB_BITS == 64)
+#define KMAX 3037000500
+#endif
+#ifdef KMAX
+ if (k <= KMAX)
+ mpz_mul_ui (t, t, k * (2 * k - 1));
+ else
+#endif
+ {
+ mpz_mul_ui (t, t, k);
+ mpz_mul_ui (t, t, 2 * k - 1);
+ }
+ mpz_fdiv_q_2exp (t, t, 1);
+ /* Warning: the test below assumes that an unsigned long
+ has no padding bits. */
+ if (n < 1UL << ((sizeof(unsigned long) * CHAR_BIT) / 2))
+ /* (n - k + 1) * (n + k - 1) < n^2 */
+ mpz_divexact_ui (t, t, (n - k + 1) * (n + k - 1));
+ else
+ {
+ mpz_divexact_ui (t, t, n - k + 1);
+ mpz_divexact_ui (t, t, n + k - 1);
+ }
+ mpz_add (d, d, t);
+ }
+
+ /* multiply by 1/(1-2^(1-m)) = 1 + 2^(1-m) + 2^(2-m) + ... */
+ mpz_fdiv_q_2exp (t, s, m - 1);
+ do
+ {
+ err ++;
+ mpz_add (s, s, t);
+ mpz_fdiv_q_2exp (t, t, m - 1);
+ }
+ while (mpz_cmp_ui (t, 0) > 0);
+
+ /* divide by d[n] */
+ mpz_mul_2exp (s, s, p);
+ mpz_tdiv_q (s, s, d);
+ mpfr_set_z (y, s, MPFR_RNDN);
+ mpfr_div_2ui (y, y, p, MPFR_RNDN);
+
+ err = MPFR_INT_CEIL_LOG2 (err);
+
+ if (MPFR_LIKELY(MPFR_CAN_ROUND (y, p - err, MPFR_PREC(z), r)))
+ break;
+
+ MPFR_ZIV_NEXT (loop, p);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ mpz_clear (d);
+ mpz_clear (t);
+ mpz_clear (q);
+ mpz_clear (s);
+ inex = mpfr_set (z, y, r);
+ mpfr_clear (y);
+ return inex;
+ }
+}
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..2c64f9b
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,90 @@
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+
+AUTOMAKE_OPTIONS = 1.6 gnu
+
+# tversion is run
+# * at the beginning so that the user gets a possible version error
+# before any other one (the version error may be the cause of the
+# other errors), and
+# * at the end so that the error message is also near the end of the
+# output.
+check_PROGRAMS = tversion tinternals tinits tisqrt tsgn tcheck \
+ tisnan texceptions tset_exp tset mpf_compat mpfr_compat \
+ reuse tabs tacos tacosh tadd tadd1sp tadd_d tadd_ui tagm \
+ tai tasin tasinh tatan tatanh taway tbuildopt tcan_round \
+ tcbrt tcmp tcmp2 tcmp_d tcmp_ld tcmp_ui tcmpabs \
+ tcomparisons tconst_catalan tconst_euler tconst_log2 \
+ tconst_pi tcopysign tcos tcosh tcot tcoth tcsc tcsch \
+ td_div td_sub tdigamma tdim tdiv tdiv_d tdiv_ui teint teq \
+ terf texp texp10 texp2 texpm1 tfactorial tfits tfma tfmod \
+ tfms tfprintf tfrac tfrexp tgamma tget_flt tget_d tget_d_2exp \
+ tget_f tget_ld_2exp tget_set_d64 tget_sj tget_str tget_z \
+ tgmpop tgrandom thyperbolic thypot tinp_str tj0 tj1 tjn tl2b \
+ tlgamma tli2 tlngamma tlog tlog10 tlog1p tlog2 tmin_prec \
+ tminmax tmodf tmul tmul_2exp tmul_d tmul_ui tnext \
+ tout_str toutimpl tpow tpow3 tpow_all tpow_z tprintf \
+ trandom trec_sqrt tremquo trint troot tround_prec tsec \
+ tsech tset_d tset_f tset_ld tset_q tset_si tset_sj \
+ tset_str tset_z tset_z_exp tsi_op tsin tsin_cos tsinh \
+ tsinh_cosh tsprintf tsqr tsqrt tsqrt_ui tstckintc tstdint tstrtofr \
+ tsub tsub1sp tsub_d tsub_ui tsubnormal tsum tswap ttan \
+ ttanh ttrunc tui_div tui_pow tui_sub turandom \
+ tvalist ty0 ty1 tyn tzeta tzeta_ui tversion
+
+AM_CPPFLAGS = -DSRCDIR='"$(srcdir)"'
+
+EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat
+
+LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/src/libmpfr.la
+INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
+
+# LOADLIBES (documented in the "GNU make" manual and equivalent to LDLIBS)
+# enables to compile a program foo.c in the test directory by simply doing
+# "make foo".
+# Warning! This is not guaranteed to work, as libtool is not used. In
+# particular, this may not work as expected under GNU/Linux if --with-gmp
+# has been used, unless the directory is in your $LD_LIBRARY_PATH.
+# Moreover, dependencies are not tracked. Thus you may want to run
+# "make tversion" (for instance) just before, to make sure that every
+# dependency has been rebuilt.
+LOADLIBES=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(top_builddir)/tests/.libs/libfrtests.a $(top_builddir)/src/.libs/libmpfr.a $(LIBS) $(MPFR_LIBM)
+
+check_LTLIBRARIES = libfrtests.la
+libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c random2.c
+
+$(top_builddir)/src/libmpfr.la:
+ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
+
+TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND)
+
+# The -no-install option prevents libtool from generating wrapper scripts
+# for the tests.
+# This is useful to easily run the test scripts under valgrind or gdb.
+# See discussion http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28033
+# http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28140 in particular.
+#
+# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
+# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
+# library is already installed in the corresponding lib directory: its
+# purpose is to make sure that the local .libs comes first in the library
+# search path (otherwise the tests are linked against the old MPFR library
+# by the LINK command -- see the generated Makefile). See:
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00042.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00043.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00044.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00066.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00065.html
+# and
+# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
+#
+AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..6322b37
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,2208 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
+
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+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@
+check_PROGRAMS = tversion$(EXEEXT) tinternals$(EXEEXT) tinits$(EXEEXT) \
+ tisqrt$(EXEEXT) tsgn$(EXEEXT) tcheck$(EXEEXT) tisnan$(EXEEXT) \
+ texceptions$(EXEEXT) tset_exp$(EXEEXT) tset$(EXEEXT) \
+ mpf_compat$(EXEEXT) mpfr_compat$(EXEEXT) reuse$(EXEEXT) \
+ tabs$(EXEEXT) tacos$(EXEEXT) tacosh$(EXEEXT) tadd$(EXEEXT) \
+ tadd1sp$(EXEEXT) tadd_d$(EXEEXT) tadd_ui$(EXEEXT) \
+ tagm$(EXEEXT) tai$(EXEEXT) tasin$(EXEEXT) tasinh$(EXEEXT) \
+ tatan$(EXEEXT) tatanh$(EXEEXT) taway$(EXEEXT) \
+ tbuildopt$(EXEEXT) tcan_round$(EXEEXT) tcbrt$(EXEEXT) \
+ tcmp$(EXEEXT) tcmp2$(EXEEXT) tcmp_d$(EXEEXT) tcmp_ld$(EXEEXT) \
+ tcmp_ui$(EXEEXT) tcmpabs$(EXEEXT) tcomparisons$(EXEEXT) \
+ tconst_catalan$(EXEEXT) tconst_euler$(EXEEXT) \
+ tconst_log2$(EXEEXT) tconst_pi$(EXEEXT) tcopysign$(EXEEXT) \
+ tcos$(EXEEXT) tcosh$(EXEEXT) tcot$(EXEEXT) tcoth$(EXEEXT) \
+ tcsc$(EXEEXT) tcsch$(EXEEXT) td_div$(EXEEXT) td_sub$(EXEEXT) \
+ tdigamma$(EXEEXT) tdim$(EXEEXT) tdiv$(EXEEXT) tdiv_d$(EXEEXT) \
+ tdiv_ui$(EXEEXT) teint$(EXEEXT) teq$(EXEEXT) terf$(EXEEXT) \
+ texp$(EXEEXT) texp10$(EXEEXT) texp2$(EXEEXT) texpm1$(EXEEXT) \
+ tfactorial$(EXEEXT) tfits$(EXEEXT) tfma$(EXEEXT) \
+ tfmod$(EXEEXT) tfms$(EXEEXT) tfprintf$(EXEEXT) tfrac$(EXEEXT) \
+ tfrexp$(EXEEXT) tgamma$(EXEEXT) tget_flt$(EXEEXT) \
+ tget_d$(EXEEXT) tget_d_2exp$(EXEEXT) tget_f$(EXEEXT) \
+ tget_ld_2exp$(EXEEXT) tget_set_d64$(EXEEXT) tget_sj$(EXEEXT) \
+ tget_str$(EXEEXT) tget_z$(EXEEXT) tgmpop$(EXEEXT) \
+ tgrandom$(EXEEXT) thyperbolic$(EXEEXT) thypot$(EXEEXT) \
+ tinp_str$(EXEEXT) tj0$(EXEEXT) tj1$(EXEEXT) tjn$(EXEEXT) \
+ tl2b$(EXEEXT) tlgamma$(EXEEXT) tli2$(EXEEXT) tlngamma$(EXEEXT) \
+ tlog$(EXEEXT) tlog10$(EXEEXT) tlog1p$(EXEEXT) tlog2$(EXEEXT) \
+ tmin_prec$(EXEEXT) tminmax$(EXEEXT) tmodf$(EXEEXT) \
+ tmul$(EXEEXT) tmul_2exp$(EXEEXT) tmul_d$(EXEEXT) \
+ tmul_ui$(EXEEXT) tnext$(EXEEXT) tout_str$(EXEEXT) \
+ toutimpl$(EXEEXT) tpow$(EXEEXT) tpow3$(EXEEXT) \
+ tpow_all$(EXEEXT) tpow_z$(EXEEXT) tprintf$(EXEEXT) \
+ trandom$(EXEEXT) trec_sqrt$(EXEEXT) tremquo$(EXEEXT) \
+ trint$(EXEEXT) troot$(EXEEXT) tround_prec$(EXEEXT) \
+ tsec$(EXEEXT) tsech$(EXEEXT) tset_d$(EXEEXT) tset_f$(EXEEXT) \
+ tset_ld$(EXEEXT) tset_q$(EXEEXT) tset_si$(EXEEXT) \
+ tset_sj$(EXEEXT) tset_str$(EXEEXT) tset_z$(EXEEXT) \
+ tset_z_exp$(EXEEXT) tsi_op$(EXEEXT) tsin$(EXEEXT) \
+ tsin_cos$(EXEEXT) tsinh$(EXEEXT) tsinh_cosh$(EXEEXT) \
+ tsprintf$(EXEEXT) tsqr$(EXEEXT) tsqrt$(EXEEXT) \
+ tsqrt_ui$(EXEEXT) tstckintc$(EXEEXT) tstdint$(EXEEXT) \
+ tstrtofr$(EXEEXT) tsub$(EXEEXT) tsub1sp$(EXEEXT) \
+ tsub_d$(EXEEXT) tsub_ui$(EXEEXT) tsubnormal$(EXEEXT) \
+ tsum$(EXEEXT) tswap$(EXEEXT) ttan$(EXEEXT) ttanh$(EXEEXT) \
+ ttrunc$(EXEEXT) tui_div$(EXEEXT) tui_pow$(EXEEXT) \
+ tui_sub$(EXEEXT) turandom$(EXEEXT) tvalist$(EXEEXT) \
+ ty0$(EXEEXT) ty1$(EXEEXT) tyn$(EXEEXT) tzeta$(EXEEXT) \
+ tzeta_ui$(EXEEXT) tversion$(EXEEXT)
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+libfrtests_la_LIBADD =
+am_libfrtests_la_OBJECTS = memory.lo rnd_mode.lo tests.lo cmp_str.lo \
+ random2.lo
+libfrtests_la_OBJECTS = $(am_libfrtests_la_OBJECTS)
+mpf_compat_SOURCES = mpf_compat.c
+mpf_compat_OBJECTS = mpf_compat.$(OBJEXT)
+mpf_compat_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+mpf_compat_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+mpfr_compat_SOURCES = mpfr_compat.c
+mpfr_compat_OBJECTS = mpfr_compat.$(OBJEXT)
+mpfr_compat_LDADD = $(LDADD)
+mpfr_compat_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+reuse_SOURCES = reuse.c
+reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_LDADD = $(LDADD)
+reuse_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tabs_SOURCES = tabs.c
+tabs_OBJECTS = tabs.$(OBJEXT)
+tabs_LDADD = $(LDADD)
+tabs_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tacos_SOURCES = tacos.c
+tacos_OBJECTS = tacos.$(OBJEXT)
+tacos_LDADD = $(LDADD)
+tacos_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tacosh_SOURCES = tacosh.c
+tacosh_OBJECTS = tacosh.$(OBJEXT)
+tacosh_LDADD = $(LDADD)
+tacosh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tadd_SOURCES = tadd.c
+tadd_OBJECTS = tadd.$(OBJEXT)
+tadd_LDADD = $(LDADD)
+tadd_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tadd1sp_SOURCES = tadd1sp.c
+tadd1sp_OBJECTS = tadd1sp.$(OBJEXT)
+tadd1sp_LDADD = $(LDADD)
+tadd1sp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tadd_d_SOURCES = tadd_d.c
+tadd_d_OBJECTS = tadd_d.$(OBJEXT)
+tadd_d_LDADD = $(LDADD)
+tadd_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tadd_ui_SOURCES = tadd_ui.c
+tadd_ui_OBJECTS = tadd_ui.$(OBJEXT)
+tadd_ui_LDADD = $(LDADD)
+tadd_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tagm_SOURCES = tagm.c
+tagm_OBJECTS = tagm.$(OBJEXT)
+tagm_LDADD = $(LDADD)
+tagm_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tai_SOURCES = tai.c
+tai_OBJECTS = tai.$(OBJEXT)
+tai_LDADD = $(LDADD)
+tai_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tasin_SOURCES = tasin.c
+tasin_OBJECTS = tasin.$(OBJEXT)
+tasin_LDADD = $(LDADD)
+tasin_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tasinh_SOURCES = tasinh.c
+tasinh_OBJECTS = tasinh.$(OBJEXT)
+tasinh_LDADD = $(LDADD)
+tasinh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tatan_SOURCES = tatan.c
+tatan_OBJECTS = tatan.$(OBJEXT)
+tatan_LDADD = $(LDADD)
+tatan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tatanh_SOURCES = tatanh.c
+tatanh_OBJECTS = tatanh.$(OBJEXT)
+tatanh_LDADD = $(LDADD)
+tatanh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+taway_SOURCES = taway.c
+taway_OBJECTS = taway.$(OBJEXT)
+taway_LDADD = $(LDADD)
+taway_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tbuildopt_SOURCES = tbuildopt.c
+tbuildopt_OBJECTS = tbuildopt.$(OBJEXT)
+tbuildopt_LDADD = $(LDADD)
+tbuildopt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcan_round_SOURCES = tcan_round.c
+tcan_round_OBJECTS = tcan_round.$(OBJEXT)
+tcan_round_LDADD = $(LDADD)
+tcan_round_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcbrt_SOURCES = tcbrt.c
+tcbrt_OBJECTS = tcbrt.$(OBJEXT)
+tcbrt_LDADD = $(LDADD)
+tcbrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcheck_SOURCES = tcheck.c
+tcheck_OBJECTS = tcheck.$(OBJEXT)
+tcheck_LDADD = $(LDADD)
+tcheck_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcmp_SOURCES = tcmp.c
+tcmp_OBJECTS = tcmp.$(OBJEXT)
+tcmp_LDADD = $(LDADD)
+tcmp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcmp2_SOURCES = tcmp2.c
+tcmp2_OBJECTS = tcmp2.$(OBJEXT)
+tcmp2_LDADD = $(LDADD)
+tcmp2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcmp_d_SOURCES = tcmp_d.c
+tcmp_d_OBJECTS = tcmp_d.$(OBJEXT)
+tcmp_d_LDADD = $(LDADD)
+tcmp_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcmp_ld_SOURCES = tcmp_ld.c
+tcmp_ld_OBJECTS = tcmp_ld.$(OBJEXT)
+tcmp_ld_LDADD = $(LDADD)
+tcmp_ld_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcmp_ui_SOURCES = tcmp_ui.c
+tcmp_ui_OBJECTS = tcmp_ui.$(OBJEXT)
+tcmp_ui_LDADD = $(LDADD)
+tcmp_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcmpabs_SOURCES = tcmpabs.c
+tcmpabs_OBJECTS = tcmpabs.$(OBJEXT)
+tcmpabs_LDADD = $(LDADD)
+tcmpabs_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcomparisons_SOURCES = tcomparisons.c
+tcomparisons_OBJECTS = tcomparisons.$(OBJEXT)
+tcomparisons_LDADD = $(LDADD)
+tcomparisons_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tconst_catalan_SOURCES = tconst_catalan.c
+tconst_catalan_OBJECTS = tconst_catalan.$(OBJEXT)
+tconst_catalan_LDADD = $(LDADD)
+tconst_catalan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tconst_euler_SOURCES = tconst_euler.c
+tconst_euler_OBJECTS = tconst_euler.$(OBJEXT)
+tconst_euler_LDADD = $(LDADD)
+tconst_euler_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tconst_log2_SOURCES = tconst_log2.c
+tconst_log2_OBJECTS = tconst_log2.$(OBJEXT)
+tconst_log2_LDADD = $(LDADD)
+tconst_log2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tconst_pi_SOURCES = tconst_pi.c
+tconst_pi_OBJECTS = tconst_pi.$(OBJEXT)
+tconst_pi_LDADD = $(LDADD)
+tconst_pi_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcopysign_SOURCES = tcopysign.c
+tcopysign_OBJECTS = tcopysign.$(OBJEXT)
+tcopysign_LDADD = $(LDADD)
+tcopysign_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcos_SOURCES = tcos.c
+tcos_OBJECTS = tcos.$(OBJEXT)
+tcos_LDADD = $(LDADD)
+tcos_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcosh_SOURCES = tcosh.c
+tcosh_OBJECTS = tcosh.$(OBJEXT)
+tcosh_LDADD = $(LDADD)
+tcosh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcot_SOURCES = tcot.c
+tcot_OBJECTS = tcot.$(OBJEXT)
+tcot_LDADD = $(LDADD)
+tcot_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcoth_SOURCES = tcoth.c
+tcoth_OBJECTS = tcoth.$(OBJEXT)
+tcoth_LDADD = $(LDADD)
+tcoth_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcsc_SOURCES = tcsc.c
+tcsc_OBJECTS = tcsc.$(OBJEXT)
+tcsc_LDADD = $(LDADD)
+tcsc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tcsch_SOURCES = tcsch.c
+tcsch_OBJECTS = tcsch.$(OBJEXT)
+tcsch_LDADD = $(LDADD)
+tcsch_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+td_div_SOURCES = td_div.c
+td_div_OBJECTS = td_div.$(OBJEXT)
+td_div_LDADD = $(LDADD)
+td_div_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+td_sub_SOURCES = td_sub.c
+td_sub_OBJECTS = td_sub.$(OBJEXT)
+td_sub_LDADD = $(LDADD)
+td_sub_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tdigamma_SOURCES = tdigamma.c
+tdigamma_OBJECTS = tdigamma.$(OBJEXT)
+tdigamma_LDADD = $(LDADD)
+tdigamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tdim_SOURCES = tdim.c
+tdim_OBJECTS = tdim.$(OBJEXT)
+tdim_LDADD = $(LDADD)
+tdim_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tdiv_SOURCES = tdiv.c
+tdiv_OBJECTS = tdiv.$(OBJEXT)
+tdiv_LDADD = $(LDADD)
+tdiv_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tdiv_d_SOURCES = tdiv_d.c
+tdiv_d_OBJECTS = tdiv_d.$(OBJEXT)
+tdiv_d_LDADD = $(LDADD)
+tdiv_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tdiv_ui_SOURCES = tdiv_ui.c
+tdiv_ui_OBJECTS = tdiv_ui.$(OBJEXT)
+tdiv_ui_LDADD = $(LDADD)
+tdiv_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+teint_SOURCES = teint.c
+teint_OBJECTS = teint.$(OBJEXT)
+teint_LDADD = $(LDADD)
+teint_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+teq_SOURCES = teq.c
+teq_OBJECTS = teq.$(OBJEXT)
+teq_LDADD = $(LDADD)
+teq_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+terf_SOURCES = terf.c
+terf_OBJECTS = terf.$(OBJEXT)
+terf_LDADD = $(LDADD)
+terf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+texceptions_SOURCES = texceptions.c
+texceptions_OBJECTS = texceptions.$(OBJEXT)
+texceptions_LDADD = $(LDADD)
+texceptions_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+texp_SOURCES = texp.c
+texp_OBJECTS = texp.$(OBJEXT)
+texp_LDADD = $(LDADD)
+texp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+texp10_SOURCES = texp10.c
+texp10_OBJECTS = texp10.$(OBJEXT)
+texp10_LDADD = $(LDADD)
+texp10_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+texp2_SOURCES = texp2.c
+texp2_OBJECTS = texp2.$(OBJEXT)
+texp2_LDADD = $(LDADD)
+texp2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+texpm1_SOURCES = texpm1.c
+texpm1_OBJECTS = texpm1.$(OBJEXT)
+texpm1_LDADD = $(LDADD)
+texpm1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfactorial_SOURCES = tfactorial.c
+tfactorial_OBJECTS = tfactorial.$(OBJEXT)
+tfactorial_LDADD = $(LDADD)
+tfactorial_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfits_SOURCES = tfits.c
+tfits_OBJECTS = tfits.$(OBJEXT)
+tfits_LDADD = $(LDADD)
+tfits_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfma_SOURCES = tfma.c
+tfma_OBJECTS = tfma.$(OBJEXT)
+tfma_LDADD = $(LDADD)
+tfma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfmod_SOURCES = tfmod.c
+tfmod_OBJECTS = tfmod.$(OBJEXT)
+tfmod_LDADD = $(LDADD)
+tfmod_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfms_SOURCES = tfms.c
+tfms_OBJECTS = tfms.$(OBJEXT)
+tfms_LDADD = $(LDADD)
+tfms_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfprintf_SOURCES = tfprintf.c
+tfprintf_OBJECTS = tfprintf.$(OBJEXT)
+tfprintf_LDADD = $(LDADD)
+tfprintf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfrac_SOURCES = tfrac.c
+tfrac_OBJECTS = tfrac.$(OBJEXT)
+tfrac_LDADD = $(LDADD)
+tfrac_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tfrexp_SOURCES = tfrexp.c
+tfrexp_OBJECTS = tfrexp.$(OBJEXT)
+tfrexp_LDADD = $(LDADD)
+tfrexp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tgamma_SOURCES = tgamma.c
+tgamma_OBJECTS = tgamma.$(OBJEXT)
+tgamma_LDADD = $(LDADD)
+tgamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_d_SOURCES = tget_d.c
+tget_d_OBJECTS = tget_d.$(OBJEXT)
+tget_d_LDADD = $(LDADD)
+tget_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_d_2exp_SOURCES = tget_d_2exp.c
+tget_d_2exp_OBJECTS = tget_d_2exp.$(OBJEXT)
+tget_d_2exp_LDADD = $(LDADD)
+tget_d_2exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_f_SOURCES = tget_f.c
+tget_f_OBJECTS = tget_f.$(OBJEXT)
+tget_f_LDADD = $(LDADD)
+tget_f_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_flt_SOURCES = tget_flt.c
+tget_flt_OBJECTS = tget_flt.$(OBJEXT)
+tget_flt_LDADD = $(LDADD)
+tget_flt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_ld_2exp_SOURCES = tget_ld_2exp.c
+tget_ld_2exp_OBJECTS = tget_ld_2exp.$(OBJEXT)
+tget_ld_2exp_LDADD = $(LDADD)
+tget_ld_2exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_set_d64_SOURCES = tget_set_d64.c
+tget_set_d64_OBJECTS = tget_set_d64.$(OBJEXT)
+tget_set_d64_LDADD = $(LDADD)
+tget_set_d64_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_sj_SOURCES = tget_sj.c
+tget_sj_OBJECTS = tget_sj.$(OBJEXT)
+tget_sj_LDADD = $(LDADD)
+tget_sj_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_str_SOURCES = tget_str.c
+tget_str_OBJECTS = tget_str.$(OBJEXT)
+tget_str_LDADD = $(LDADD)
+tget_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tget_z_SOURCES = tget_z.c
+tget_z_OBJECTS = tget_z.$(OBJEXT)
+tget_z_LDADD = $(LDADD)
+tget_z_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tgmpop_SOURCES = tgmpop.c
+tgmpop_OBJECTS = tgmpop.$(OBJEXT)
+tgmpop_LDADD = $(LDADD)
+tgmpop_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tgrandom_SOURCES = tgrandom.c
+tgrandom_OBJECTS = tgrandom.$(OBJEXT)
+tgrandom_LDADD = $(LDADD)
+tgrandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+thyperbolic_SOURCES = thyperbolic.c
+thyperbolic_OBJECTS = thyperbolic.$(OBJEXT)
+thyperbolic_LDADD = $(LDADD)
+thyperbolic_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+thypot_SOURCES = thypot.c
+thypot_OBJECTS = thypot.$(OBJEXT)
+thypot_LDADD = $(LDADD)
+thypot_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tinits_SOURCES = tinits.c
+tinits_OBJECTS = tinits.$(OBJEXT)
+tinits_LDADD = $(LDADD)
+tinits_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tinp_str_SOURCES = tinp_str.c
+tinp_str_OBJECTS = tinp_str.$(OBJEXT)
+tinp_str_LDADD = $(LDADD)
+tinp_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tinternals_SOURCES = tinternals.c
+tinternals_OBJECTS = tinternals.$(OBJEXT)
+tinternals_LDADD = $(LDADD)
+tinternals_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tisnan_SOURCES = tisnan.c
+tisnan_OBJECTS = tisnan.$(OBJEXT)
+tisnan_LDADD = $(LDADD)
+tisnan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tisqrt_SOURCES = tisqrt.c
+tisqrt_OBJECTS = tisqrt.$(OBJEXT)
+tisqrt_LDADD = $(LDADD)
+tisqrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tj0_SOURCES = tj0.c
+tj0_OBJECTS = tj0.$(OBJEXT)
+tj0_LDADD = $(LDADD)
+tj0_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tj1_SOURCES = tj1.c
+tj1_OBJECTS = tj1.$(OBJEXT)
+tj1_LDADD = $(LDADD)
+tj1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tjn_SOURCES = tjn.c
+tjn_OBJECTS = tjn.$(OBJEXT)
+tjn_LDADD = $(LDADD)
+tjn_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tl2b_SOURCES = tl2b.c
+tl2b_OBJECTS = tl2b.$(OBJEXT)
+tl2b_LDADD = $(LDADD)
+tl2b_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tlgamma_SOURCES = tlgamma.c
+tlgamma_OBJECTS = tlgamma.$(OBJEXT)
+tlgamma_LDADD = $(LDADD)
+tlgamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tli2_SOURCES = tli2.c
+tli2_OBJECTS = tli2.$(OBJEXT)
+tli2_LDADD = $(LDADD)
+tli2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tlngamma_SOURCES = tlngamma.c
+tlngamma_OBJECTS = tlngamma.$(OBJEXT)
+tlngamma_LDADD = $(LDADD)
+tlngamma_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tlog_SOURCES = tlog.c
+tlog_OBJECTS = tlog.$(OBJEXT)
+tlog_LDADD = $(LDADD)
+tlog_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tlog10_SOURCES = tlog10.c
+tlog10_OBJECTS = tlog10.$(OBJEXT)
+tlog10_LDADD = $(LDADD)
+tlog10_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tlog1p_SOURCES = tlog1p.c
+tlog1p_OBJECTS = tlog1p.$(OBJEXT)
+tlog1p_LDADD = $(LDADD)
+tlog1p_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tlog2_SOURCES = tlog2.c
+tlog2_OBJECTS = tlog2.$(OBJEXT)
+tlog2_LDADD = $(LDADD)
+tlog2_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tmin_prec_SOURCES = tmin_prec.c
+tmin_prec_OBJECTS = tmin_prec.$(OBJEXT)
+tmin_prec_LDADD = $(LDADD)
+tmin_prec_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tminmax_SOURCES = tminmax.c
+tminmax_OBJECTS = tminmax.$(OBJEXT)
+tminmax_LDADD = $(LDADD)
+tminmax_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tmodf_SOURCES = tmodf.c
+tmodf_OBJECTS = tmodf.$(OBJEXT)
+tmodf_LDADD = $(LDADD)
+tmodf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tmul_SOURCES = tmul.c
+tmul_OBJECTS = tmul.$(OBJEXT)
+tmul_LDADD = $(LDADD)
+tmul_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tmul_2exp_SOURCES = tmul_2exp.c
+tmul_2exp_OBJECTS = tmul_2exp.$(OBJEXT)
+tmul_2exp_LDADD = $(LDADD)
+tmul_2exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tmul_d_SOURCES = tmul_d.c
+tmul_d_OBJECTS = tmul_d.$(OBJEXT)
+tmul_d_LDADD = $(LDADD)
+tmul_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tmul_ui_SOURCES = tmul_ui.c
+tmul_ui_OBJECTS = tmul_ui.$(OBJEXT)
+tmul_ui_LDADD = $(LDADD)
+tmul_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tnext_SOURCES = tnext.c
+tnext_OBJECTS = tnext.$(OBJEXT)
+tnext_LDADD = $(LDADD)
+tnext_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tout_str_SOURCES = tout_str.c
+tout_str_OBJECTS = tout_str.$(OBJEXT)
+tout_str_LDADD = $(LDADD)
+tout_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+toutimpl_SOURCES = toutimpl.c
+toutimpl_OBJECTS = toutimpl.$(OBJEXT)
+toutimpl_LDADD = $(LDADD)
+toutimpl_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tpow_SOURCES = tpow.c
+tpow_OBJECTS = tpow.$(OBJEXT)
+tpow_LDADD = $(LDADD)
+tpow_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tpow3_SOURCES = tpow3.c
+tpow3_OBJECTS = tpow3.$(OBJEXT)
+tpow3_LDADD = $(LDADD)
+tpow3_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tpow_all_SOURCES = tpow_all.c
+tpow_all_OBJECTS = tpow_all.$(OBJEXT)
+tpow_all_LDADD = $(LDADD)
+tpow_all_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tpow_z_SOURCES = tpow_z.c
+tpow_z_OBJECTS = tpow_z.$(OBJEXT)
+tpow_z_LDADD = $(LDADD)
+tpow_z_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tprintf_SOURCES = tprintf.c
+tprintf_OBJECTS = tprintf.$(OBJEXT)
+tprintf_LDADD = $(LDADD)
+tprintf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+trandom_SOURCES = trandom.c
+trandom_OBJECTS = trandom.$(OBJEXT)
+trandom_LDADD = $(LDADD)
+trandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+trec_sqrt_SOURCES = trec_sqrt.c
+trec_sqrt_OBJECTS = trec_sqrt.$(OBJEXT)
+trec_sqrt_LDADD = $(LDADD)
+trec_sqrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tremquo_SOURCES = tremquo.c
+tremquo_OBJECTS = tremquo.$(OBJEXT)
+tremquo_LDADD = $(LDADD)
+tremquo_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+trint_SOURCES = trint.c
+trint_OBJECTS = trint.$(OBJEXT)
+trint_LDADD = $(LDADD)
+trint_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+troot_SOURCES = troot.c
+troot_OBJECTS = troot.$(OBJEXT)
+troot_LDADD = $(LDADD)
+troot_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tround_prec_SOURCES = tround_prec.c
+tround_prec_OBJECTS = tround_prec.$(OBJEXT)
+tround_prec_LDADD = $(LDADD)
+tround_prec_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsec_SOURCES = tsec.c
+tsec_OBJECTS = tsec.$(OBJEXT)
+tsec_LDADD = $(LDADD)
+tsec_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsech_SOURCES = tsech.c
+tsech_OBJECTS = tsech.$(OBJEXT)
+tsech_LDADD = $(LDADD)
+tsech_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_SOURCES = tset.c
+tset_OBJECTS = tset.$(OBJEXT)
+tset_LDADD = $(LDADD)
+tset_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_d_SOURCES = tset_d.c
+tset_d_OBJECTS = tset_d.$(OBJEXT)
+tset_d_LDADD = $(LDADD)
+tset_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_exp_SOURCES = tset_exp.c
+tset_exp_OBJECTS = tset_exp.$(OBJEXT)
+tset_exp_LDADD = $(LDADD)
+tset_exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_f_SOURCES = tset_f.c
+tset_f_OBJECTS = tset_f.$(OBJEXT)
+tset_f_LDADD = $(LDADD)
+tset_f_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_ld_SOURCES = tset_ld.c
+tset_ld_OBJECTS = tset_ld.$(OBJEXT)
+tset_ld_LDADD = $(LDADD)
+tset_ld_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_q_SOURCES = tset_q.c
+tset_q_OBJECTS = tset_q.$(OBJEXT)
+tset_q_LDADD = $(LDADD)
+tset_q_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_si_SOURCES = tset_si.c
+tset_si_OBJECTS = tset_si.$(OBJEXT)
+tset_si_LDADD = $(LDADD)
+tset_si_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_sj_SOURCES = tset_sj.c
+tset_sj_OBJECTS = tset_sj.$(OBJEXT)
+tset_sj_LDADD = $(LDADD)
+tset_sj_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_str_SOURCES = tset_str.c
+tset_str_OBJECTS = tset_str.$(OBJEXT)
+tset_str_LDADD = $(LDADD)
+tset_str_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_z_SOURCES = tset_z.c
+tset_z_OBJECTS = tset_z.$(OBJEXT)
+tset_z_LDADD = $(LDADD)
+tset_z_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tset_z_exp_SOURCES = tset_z_exp.c
+tset_z_exp_OBJECTS = tset_z_exp.$(OBJEXT)
+tset_z_exp_LDADD = $(LDADD)
+tset_z_exp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsgn_SOURCES = tsgn.c
+tsgn_OBJECTS = tsgn.$(OBJEXT)
+tsgn_LDADD = $(LDADD)
+tsgn_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsi_op_SOURCES = tsi_op.c
+tsi_op_OBJECTS = tsi_op.$(OBJEXT)
+tsi_op_LDADD = $(LDADD)
+tsi_op_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsin_SOURCES = tsin.c
+tsin_OBJECTS = tsin.$(OBJEXT)
+tsin_LDADD = $(LDADD)
+tsin_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsin_cos_SOURCES = tsin_cos.c
+tsin_cos_OBJECTS = tsin_cos.$(OBJEXT)
+tsin_cos_LDADD = $(LDADD)
+tsin_cos_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsinh_SOURCES = tsinh.c
+tsinh_OBJECTS = tsinh.$(OBJEXT)
+tsinh_LDADD = $(LDADD)
+tsinh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsinh_cosh_SOURCES = tsinh_cosh.c
+tsinh_cosh_OBJECTS = tsinh_cosh.$(OBJEXT)
+tsinh_cosh_LDADD = $(LDADD)
+tsinh_cosh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsprintf_SOURCES = tsprintf.c
+tsprintf_OBJECTS = tsprintf.$(OBJEXT)
+tsprintf_LDADD = $(LDADD)
+tsprintf_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsqr_SOURCES = tsqr.c
+tsqr_OBJECTS = tsqr.$(OBJEXT)
+tsqr_LDADD = $(LDADD)
+tsqr_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsqrt_SOURCES = tsqrt.c
+tsqrt_OBJECTS = tsqrt.$(OBJEXT)
+tsqrt_LDADD = $(LDADD)
+tsqrt_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsqrt_ui_SOURCES = tsqrt_ui.c
+tsqrt_ui_OBJECTS = tsqrt_ui.$(OBJEXT)
+tsqrt_ui_LDADD = $(LDADD)
+tsqrt_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tstckintc_SOURCES = tstckintc.c
+tstckintc_OBJECTS = tstckintc.$(OBJEXT)
+tstckintc_LDADD = $(LDADD)
+tstckintc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tstdint_SOURCES = tstdint.c
+tstdint_OBJECTS = tstdint.$(OBJEXT)
+tstdint_LDADD = $(LDADD)
+tstdint_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tstrtofr_SOURCES = tstrtofr.c
+tstrtofr_OBJECTS = tstrtofr.$(OBJEXT)
+tstrtofr_LDADD = $(LDADD)
+tstrtofr_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsub_SOURCES = tsub.c
+tsub_OBJECTS = tsub.$(OBJEXT)
+tsub_LDADD = $(LDADD)
+tsub_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsub1sp_SOURCES = tsub1sp.c
+tsub1sp_OBJECTS = tsub1sp.$(OBJEXT)
+tsub1sp_LDADD = $(LDADD)
+tsub1sp_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsub_d_SOURCES = tsub_d.c
+tsub_d_OBJECTS = tsub_d.$(OBJEXT)
+tsub_d_LDADD = $(LDADD)
+tsub_d_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsub_ui_SOURCES = tsub_ui.c
+tsub_ui_OBJECTS = tsub_ui.$(OBJEXT)
+tsub_ui_LDADD = $(LDADD)
+tsub_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsubnormal_SOURCES = tsubnormal.c
+tsubnormal_OBJECTS = tsubnormal.$(OBJEXT)
+tsubnormal_LDADD = $(LDADD)
+tsubnormal_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tsum_SOURCES = tsum.c
+tsum_OBJECTS = tsum.$(OBJEXT)
+tsum_LDADD = $(LDADD)
+tsum_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tswap_SOURCES = tswap.c
+tswap_OBJECTS = tswap.$(OBJEXT)
+tswap_LDADD = $(LDADD)
+tswap_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+ttan_SOURCES = ttan.c
+ttan_OBJECTS = ttan.$(OBJEXT)
+ttan_LDADD = $(LDADD)
+ttan_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+ttanh_SOURCES = ttanh.c
+ttanh_OBJECTS = ttanh.$(OBJEXT)
+ttanh_LDADD = $(LDADD)
+ttanh_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+ttrunc_SOURCES = ttrunc.c
+ttrunc_OBJECTS = ttrunc.$(OBJEXT)
+ttrunc_LDADD = $(LDADD)
+ttrunc_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tui_div_SOURCES = tui_div.c
+tui_div_OBJECTS = tui_div.$(OBJEXT)
+tui_div_LDADD = $(LDADD)
+tui_div_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tui_pow_SOURCES = tui_pow.c
+tui_pow_OBJECTS = tui_pow.$(OBJEXT)
+tui_pow_LDADD = $(LDADD)
+tui_pow_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tui_sub_SOURCES = tui_sub.c
+tui_sub_OBJECTS = tui_sub.$(OBJEXT)
+tui_sub_LDADD = $(LDADD)
+tui_sub_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+turandom_SOURCES = turandom.c
+turandom_OBJECTS = turandom.$(OBJEXT)
+turandom_LDADD = $(LDADD)
+turandom_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tvalist_SOURCES = tvalist.c
+tvalist_OBJECTS = tvalist.$(OBJEXT)
+tvalist_LDADD = $(LDADD)
+tvalist_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tversion_SOURCES = tversion.c
+tversion_OBJECTS = tversion.$(OBJEXT)
+tversion_LDADD = $(LDADD)
+tversion_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+ty0_SOURCES = ty0.c
+ty0_OBJECTS = ty0.$(OBJEXT)
+ty0_LDADD = $(LDADD)
+ty0_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+ty1_SOURCES = ty1.c
+ty1_OBJECTS = ty1.$(OBJEXT)
+ty1_LDADD = $(LDADD)
+ty1_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tyn_SOURCES = tyn.c
+tyn_OBJECTS = tyn.$(OBJEXT)
+tyn_LDADD = $(LDADD)
+tyn_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tzeta_SOURCES = tzeta.c
+tzeta_OBJECTS = tzeta.$(OBJEXT)
+tzeta_LDADD = $(LDADD)
+tzeta_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+tzeta_ui_SOURCES = tzeta_ui.c
+tzeta_ui_OBJECTS = tzeta_ui.$(OBJEXT)
+tzeta_ui_LDADD = $(LDADD)
+tzeta_ui_DEPENDENCIES = libfrtests.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/libmpfr.la
+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 = $(libfrtests_la_SOURCES) mpf_compat.c mpfr_compat.c reuse.c \
+ tabs.c tacos.c tacosh.c tadd.c tadd1sp.c tadd_d.c tadd_ui.c \
+ tagm.c tai.c tasin.c tasinh.c tatan.c tatanh.c taway.c \
+ tbuildopt.c tcan_round.c tcbrt.c tcheck.c tcmp.c tcmp2.c \
+ tcmp_d.c tcmp_ld.c tcmp_ui.c tcmpabs.c tcomparisons.c \
+ tconst_catalan.c tconst_euler.c tconst_log2.c tconst_pi.c \
+ tcopysign.c tcos.c tcosh.c tcot.c tcoth.c tcsc.c tcsch.c \
+ td_div.c td_sub.c tdigamma.c tdim.c tdiv.c tdiv_d.c tdiv_ui.c \
+ teint.c teq.c terf.c texceptions.c texp.c texp10.c texp2.c \
+ texpm1.c tfactorial.c tfits.c tfma.c tfmod.c tfms.c tfprintf.c \
+ tfrac.c tfrexp.c tgamma.c tget_d.c tget_d_2exp.c tget_f.c \
+ tget_flt.c tget_ld_2exp.c tget_set_d64.c tget_sj.c tget_str.c \
+ tget_z.c tgmpop.c tgrandom.c thyperbolic.c thypot.c tinits.c \
+ tinp_str.c tinternals.c tisnan.c tisqrt.c tj0.c tj1.c tjn.c \
+ tl2b.c tlgamma.c tli2.c tlngamma.c tlog.c tlog10.c tlog1p.c \
+ tlog2.c tmin_prec.c tminmax.c tmodf.c tmul.c tmul_2exp.c \
+ tmul_d.c tmul_ui.c tnext.c tout_str.c toutimpl.c tpow.c \
+ tpow3.c tpow_all.c tpow_z.c tprintf.c trandom.c trec_sqrt.c \
+ tremquo.c trint.c troot.c tround_prec.c tsec.c tsech.c tset.c \
+ tset_d.c tset_exp.c tset_f.c tset_ld.c tset_q.c tset_si.c \
+ tset_sj.c tset_str.c tset_z.c tset_z_exp.c tsgn.c tsi_op.c \
+ tsin.c tsin_cos.c tsinh.c tsinh_cosh.c tsprintf.c tsqr.c \
+ tsqrt.c tsqrt_ui.c tstckintc.c tstdint.c tstrtofr.c tsub.c \
+ tsub1sp.c tsub_d.c tsub_ui.c tsubnormal.c tsum.c tswap.c \
+ ttan.c ttanh.c ttrunc.c tui_div.c tui_pow.c tui_sub.c \
+ turandom.c tvalist.c tversion.c ty0.c ty1.c tyn.c tzeta.c \
+ tzeta_ui.c
+DIST_SOURCES = $(libfrtests_la_SOURCES) mpf_compat.c mpfr_compat.c \
+ reuse.c tabs.c tacos.c tacosh.c tadd.c tadd1sp.c tadd_d.c \
+ tadd_ui.c tagm.c tai.c tasin.c tasinh.c tatan.c tatanh.c \
+ taway.c tbuildopt.c tcan_round.c tcbrt.c tcheck.c tcmp.c \
+ tcmp2.c tcmp_d.c tcmp_ld.c tcmp_ui.c tcmpabs.c tcomparisons.c \
+ tconst_catalan.c tconst_euler.c tconst_log2.c tconst_pi.c \
+ tcopysign.c tcos.c tcosh.c tcot.c tcoth.c tcsc.c tcsch.c \
+ td_div.c td_sub.c tdigamma.c tdim.c tdiv.c tdiv_d.c tdiv_ui.c \
+ teint.c teq.c terf.c texceptions.c texp.c texp10.c texp2.c \
+ texpm1.c tfactorial.c tfits.c tfma.c tfmod.c tfms.c tfprintf.c \
+ tfrac.c tfrexp.c tgamma.c tget_d.c tget_d_2exp.c tget_f.c \
+ tget_flt.c tget_ld_2exp.c tget_set_d64.c tget_sj.c tget_str.c \
+ tget_z.c tgmpop.c tgrandom.c thyperbolic.c thypot.c tinits.c \
+ tinp_str.c tinternals.c tisnan.c tisqrt.c tj0.c tj1.c tjn.c \
+ tl2b.c tlgamma.c tli2.c tlngamma.c tlog.c tlog10.c tlog1p.c \
+ tlog2.c tmin_prec.c tminmax.c tmodf.c tmul.c tmul_2exp.c \
+ tmul_d.c tmul_ui.c tnext.c tout_str.c toutimpl.c tpow.c \
+ tpow3.c tpow_all.c tpow_z.c tprintf.c trandom.c trec_sqrt.c \
+ tremquo.c trint.c troot.c tround_prec.c tsec.c tsech.c tset.c \
+ tset_d.c tset_exp.c tset_f.c tset_ld.c tset_q.c tset_si.c \
+ tset_sj.c tset_str.c tset_z.c tset_z_exp.c tsgn.c tsi_op.c \
+ tsin.c tsin_cos.c tsinh.c tsinh_cosh.c tsprintf.c tsqr.c \
+ tsqrt.c tsqrt_ui.c tstckintc.c tstdint.c tstrtofr.c tsub.c \
+ tsub1sp.c tsub_d.c tsub_ui.c tsubnormal.c tsum.c tswap.c \
+ ttan.c ttanh.c ttrunc.c tui_div.c tui_pow.c tui_sub.c \
+ turandom.c tvalist.c tversion.c ty0.c ty1.c tyn.c tzeta.c \
+ tzeta_ui.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATAFILES = @DATAFILES@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+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@
+LIBMPFR_LDFLAGS = @LIBMPFR_LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MPFR_LDFLAGS = @MPFR_LDFLAGS@
+MPFR_LIBM = @MPFR_LIBM@
+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@
+TUNE_LIBS = @TUNE_LIBS@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+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@
+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@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.6 gnu
+AM_CPPFLAGS = -DSRCDIR='"$(srcdir)"'
+EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat
+LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/src/libmpfr.la
+INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
+
+# LOADLIBES (documented in the "GNU make" manual and equivalent to LDLIBS)
+# enables to compile a program foo.c in the test directory by simply doing
+# "make foo".
+# Warning! This is not guaranteed to work, as libtool is not used. In
+# particular, this may not work as expected under GNU/Linux if --with-gmp
+# has been used, unless the directory is in your $LD_LIBRARY_PATH.
+# Moreover, dependencies are not tracked. Thus you may want to run
+# "make tversion" (for instance) just before, to make sure that every
+# dependency has been rebuilt.
+LOADLIBES = $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(top_builddir)/tests/.libs/libfrtests.a $(top_builddir)/src/.libs/libmpfr.a $(LIBS) $(MPFR_LIBM)
+check_LTLIBRARIES = libfrtests.la
+libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c random2.c
+TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND)
+
+# The -no-install option prevents libtool from generating wrapper scripts
+# for the tests.
+# This is useful to easily run the test scripts under valgrind or gdb.
+# See discussion http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28033
+# http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28140 in particular.
+#
+# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
+# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
+# library is already installed in the corresponding lib directory: its
+# purpose is to make sure that the local .libs comes first in the library
+# search path (otherwise the tests are linked against the old MPFR library
+# by the LINK command -- see the generated Makefile). See:
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00042.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00043.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00044.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00066.html
+# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00065.html
+# and
+# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
+#
+AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkLTLIBRARIES:
+ -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+ @list='$(check_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
+libfrtests.la: $(libfrtests_la_OBJECTS) $(libfrtests_la_DEPENDENCIES) $(EXTRA_libfrtests_la_DEPENDENCIES)
+ $(LINK) $(libfrtests_la_OBJECTS) $(libfrtests_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+mpf_compat$(EXEEXT): $(mpf_compat_OBJECTS) $(mpf_compat_DEPENDENCIES) $(EXTRA_mpf_compat_DEPENDENCIES)
+ @rm -f mpf_compat$(EXEEXT)
+ $(LINK) $(mpf_compat_OBJECTS) $(mpf_compat_LDADD) $(LIBS)
+mpfr_compat$(EXEEXT): $(mpfr_compat_OBJECTS) $(mpfr_compat_DEPENDENCIES) $(EXTRA_mpfr_compat_DEPENDENCIES)
+ @rm -f mpfr_compat$(EXEEXT)
+ $(LINK) $(mpfr_compat_OBJECTS) $(mpfr_compat_LDADD) $(LIBS)
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ @rm -f reuse$(EXEEXT)
+ $(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+tabs$(EXEEXT): $(tabs_OBJECTS) $(tabs_DEPENDENCIES) $(EXTRA_tabs_DEPENDENCIES)
+ @rm -f tabs$(EXEEXT)
+ $(LINK) $(tabs_OBJECTS) $(tabs_LDADD) $(LIBS)
+tacos$(EXEEXT): $(tacos_OBJECTS) $(tacos_DEPENDENCIES) $(EXTRA_tacos_DEPENDENCIES)
+ @rm -f tacos$(EXEEXT)
+ $(LINK) $(tacos_OBJECTS) $(tacos_LDADD) $(LIBS)
+tacosh$(EXEEXT): $(tacosh_OBJECTS) $(tacosh_DEPENDENCIES) $(EXTRA_tacosh_DEPENDENCIES)
+ @rm -f tacosh$(EXEEXT)
+ $(LINK) $(tacosh_OBJECTS) $(tacosh_LDADD) $(LIBS)
+tadd$(EXEEXT): $(tadd_OBJECTS) $(tadd_DEPENDENCIES) $(EXTRA_tadd_DEPENDENCIES)
+ @rm -f tadd$(EXEEXT)
+ $(LINK) $(tadd_OBJECTS) $(tadd_LDADD) $(LIBS)
+tadd1sp$(EXEEXT): $(tadd1sp_OBJECTS) $(tadd1sp_DEPENDENCIES) $(EXTRA_tadd1sp_DEPENDENCIES)
+ @rm -f tadd1sp$(EXEEXT)
+ $(LINK) $(tadd1sp_OBJECTS) $(tadd1sp_LDADD) $(LIBS)
+tadd_d$(EXEEXT): $(tadd_d_OBJECTS) $(tadd_d_DEPENDENCIES) $(EXTRA_tadd_d_DEPENDENCIES)
+ @rm -f tadd_d$(EXEEXT)
+ $(LINK) $(tadd_d_OBJECTS) $(tadd_d_LDADD) $(LIBS)
+tadd_ui$(EXEEXT): $(tadd_ui_OBJECTS) $(tadd_ui_DEPENDENCIES) $(EXTRA_tadd_ui_DEPENDENCIES)
+ @rm -f tadd_ui$(EXEEXT)
+ $(LINK) $(tadd_ui_OBJECTS) $(tadd_ui_LDADD) $(LIBS)
+tagm$(EXEEXT): $(tagm_OBJECTS) $(tagm_DEPENDENCIES) $(EXTRA_tagm_DEPENDENCIES)
+ @rm -f tagm$(EXEEXT)
+ $(LINK) $(tagm_OBJECTS) $(tagm_LDADD) $(LIBS)
+tai$(EXEEXT): $(tai_OBJECTS) $(tai_DEPENDENCIES) $(EXTRA_tai_DEPENDENCIES)
+ @rm -f tai$(EXEEXT)
+ $(LINK) $(tai_OBJECTS) $(tai_LDADD) $(LIBS)
+tasin$(EXEEXT): $(tasin_OBJECTS) $(tasin_DEPENDENCIES) $(EXTRA_tasin_DEPENDENCIES)
+ @rm -f tasin$(EXEEXT)
+ $(LINK) $(tasin_OBJECTS) $(tasin_LDADD) $(LIBS)
+tasinh$(EXEEXT): $(tasinh_OBJECTS) $(tasinh_DEPENDENCIES) $(EXTRA_tasinh_DEPENDENCIES)
+ @rm -f tasinh$(EXEEXT)
+ $(LINK) $(tasinh_OBJECTS) $(tasinh_LDADD) $(LIBS)
+tatan$(EXEEXT): $(tatan_OBJECTS) $(tatan_DEPENDENCIES) $(EXTRA_tatan_DEPENDENCIES)
+ @rm -f tatan$(EXEEXT)
+ $(LINK) $(tatan_OBJECTS) $(tatan_LDADD) $(LIBS)
+tatanh$(EXEEXT): $(tatanh_OBJECTS) $(tatanh_DEPENDENCIES) $(EXTRA_tatanh_DEPENDENCIES)
+ @rm -f tatanh$(EXEEXT)
+ $(LINK) $(tatanh_OBJECTS) $(tatanh_LDADD) $(LIBS)
+taway$(EXEEXT): $(taway_OBJECTS) $(taway_DEPENDENCIES) $(EXTRA_taway_DEPENDENCIES)
+ @rm -f taway$(EXEEXT)
+ $(LINK) $(taway_OBJECTS) $(taway_LDADD) $(LIBS)
+tbuildopt$(EXEEXT): $(tbuildopt_OBJECTS) $(tbuildopt_DEPENDENCIES) $(EXTRA_tbuildopt_DEPENDENCIES)
+ @rm -f tbuildopt$(EXEEXT)
+ $(LINK) $(tbuildopt_OBJECTS) $(tbuildopt_LDADD) $(LIBS)
+tcan_round$(EXEEXT): $(tcan_round_OBJECTS) $(tcan_round_DEPENDENCIES) $(EXTRA_tcan_round_DEPENDENCIES)
+ @rm -f tcan_round$(EXEEXT)
+ $(LINK) $(tcan_round_OBJECTS) $(tcan_round_LDADD) $(LIBS)
+tcbrt$(EXEEXT): $(tcbrt_OBJECTS) $(tcbrt_DEPENDENCIES) $(EXTRA_tcbrt_DEPENDENCIES)
+ @rm -f tcbrt$(EXEEXT)
+ $(LINK) $(tcbrt_OBJECTS) $(tcbrt_LDADD) $(LIBS)
+tcheck$(EXEEXT): $(tcheck_OBJECTS) $(tcheck_DEPENDENCIES) $(EXTRA_tcheck_DEPENDENCIES)
+ @rm -f tcheck$(EXEEXT)
+ $(LINK) $(tcheck_OBJECTS) $(tcheck_LDADD) $(LIBS)
+tcmp$(EXEEXT): $(tcmp_OBJECTS) $(tcmp_DEPENDENCIES) $(EXTRA_tcmp_DEPENDENCIES)
+ @rm -f tcmp$(EXEEXT)
+ $(LINK) $(tcmp_OBJECTS) $(tcmp_LDADD) $(LIBS)
+tcmp2$(EXEEXT): $(tcmp2_OBJECTS) $(tcmp2_DEPENDENCIES) $(EXTRA_tcmp2_DEPENDENCIES)
+ @rm -f tcmp2$(EXEEXT)
+ $(LINK) $(tcmp2_OBJECTS) $(tcmp2_LDADD) $(LIBS)
+tcmp_d$(EXEEXT): $(tcmp_d_OBJECTS) $(tcmp_d_DEPENDENCIES) $(EXTRA_tcmp_d_DEPENDENCIES)
+ @rm -f tcmp_d$(EXEEXT)
+ $(LINK) $(tcmp_d_OBJECTS) $(tcmp_d_LDADD) $(LIBS)
+tcmp_ld$(EXEEXT): $(tcmp_ld_OBJECTS) $(tcmp_ld_DEPENDENCIES) $(EXTRA_tcmp_ld_DEPENDENCIES)
+ @rm -f tcmp_ld$(EXEEXT)
+ $(LINK) $(tcmp_ld_OBJECTS) $(tcmp_ld_LDADD) $(LIBS)
+tcmp_ui$(EXEEXT): $(tcmp_ui_OBJECTS) $(tcmp_ui_DEPENDENCIES) $(EXTRA_tcmp_ui_DEPENDENCIES)
+ @rm -f tcmp_ui$(EXEEXT)
+ $(LINK) $(tcmp_ui_OBJECTS) $(tcmp_ui_LDADD) $(LIBS)
+tcmpabs$(EXEEXT): $(tcmpabs_OBJECTS) $(tcmpabs_DEPENDENCIES) $(EXTRA_tcmpabs_DEPENDENCIES)
+ @rm -f tcmpabs$(EXEEXT)
+ $(LINK) $(tcmpabs_OBJECTS) $(tcmpabs_LDADD) $(LIBS)
+tcomparisons$(EXEEXT): $(tcomparisons_OBJECTS) $(tcomparisons_DEPENDENCIES) $(EXTRA_tcomparisons_DEPENDENCIES)
+ @rm -f tcomparisons$(EXEEXT)
+ $(LINK) $(tcomparisons_OBJECTS) $(tcomparisons_LDADD) $(LIBS)
+tconst_catalan$(EXEEXT): $(tconst_catalan_OBJECTS) $(tconst_catalan_DEPENDENCIES) $(EXTRA_tconst_catalan_DEPENDENCIES)
+ @rm -f tconst_catalan$(EXEEXT)
+ $(LINK) $(tconst_catalan_OBJECTS) $(tconst_catalan_LDADD) $(LIBS)
+tconst_euler$(EXEEXT): $(tconst_euler_OBJECTS) $(tconst_euler_DEPENDENCIES) $(EXTRA_tconst_euler_DEPENDENCIES)
+ @rm -f tconst_euler$(EXEEXT)
+ $(LINK) $(tconst_euler_OBJECTS) $(tconst_euler_LDADD) $(LIBS)
+tconst_log2$(EXEEXT): $(tconst_log2_OBJECTS) $(tconst_log2_DEPENDENCIES) $(EXTRA_tconst_log2_DEPENDENCIES)
+ @rm -f tconst_log2$(EXEEXT)
+ $(LINK) $(tconst_log2_OBJECTS) $(tconst_log2_LDADD) $(LIBS)
+tconst_pi$(EXEEXT): $(tconst_pi_OBJECTS) $(tconst_pi_DEPENDENCIES) $(EXTRA_tconst_pi_DEPENDENCIES)
+ @rm -f tconst_pi$(EXEEXT)
+ $(LINK) $(tconst_pi_OBJECTS) $(tconst_pi_LDADD) $(LIBS)
+tcopysign$(EXEEXT): $(tcopysign_OBJECTS) $(tcopysign_DEPENDENCIES) $(EXTRA_tcopysign_DEPENDENCIES)
+ @rm -f tcopysign$(EXEEXT)
+ $(LINK) $(tcopysign_OBJECTS) $(tcopysign_LDADD) $(LIBS)
+tcos$(EXEEXT): $(tcos_OBJECTS) $(tcos_DEPENDENCIES) $(EXTRA_tcos_DEPENDENCIES)
+ @rm -f tcos$(EXEEXT)
+ $(LINK) $(tcos_OBJECTS) $(tcos_LDADD) $(LIBS)
+tcosh$(EXEEXT): $(tcosh_OBJECTS) $(tcosh_DEPENDENCIES) $(EXTRA_tcosh_DEPENDENCIES)
+ @rm -f tcosh$(EXEEXT)
+ $(LINK) $(tcosh_OBJECTS) $(tcosh_LDADD) $(LIBS)
+tcot$(EXEEXT): $(tcot_OBJECTS) $(tcot_DEPENDENCIES) $(EXTRA_tcot_DEPENDENCIES)
+ @rm -f tcot$(EXEEXT)
+ $(LINK) $(tcot_OBJECTS) $(tcot_LDADD) $(LIBS)
+tcoth$(EXEEXT): $(tcoth_OBJECTS) $(tcoth_DEPENDENCIES) $(EXTRA_tcoth_DEPENDENCIES)
+ @rm -f tcoth$(EXEEXT)
+ $(LINK) $(tcoth_OBJECTS) $(tcoth_LDADD) $(LIBS)
+tcsc$(EXEEXT): $(tcsc_OBJECTS) $(tcsc_DEPENDENCIES) $(EXTRA_tcsc_DEPENDENCIES)
+ @rm -f tcsc$(EXEEXT)
+ $(LINK) $(tcsc_OBJECTS) $(tcsc_LDADD) $(LIBS)
+tcsch$(EXEEXT): $(tcsch_OBJECTS) $(tcsch_DEPENDENCIES) $(EXTRA_tcsch_DEPENDENCIES)
+ @rm -f tcsch$(EXEEXT)
+ $(LINK) $(tcsch_OBJECTS) $(tcsch_LDADD) $(LIBS)
+td_div$(EXEEXT): $(td_div_OBJECTS) $(td_div_DEPENDENCIES) $(EXTRA_td_div_DEPENDENCIES)
+ @rm -f td_div$(EXEEXT)
+ $(LINK) $(td_div_OBJECTS) $(td_div_LDADD) $(LIBS)
+td_sub$(EXEEXT): $(td_sub_OBJECTS) $(td_sub_DEPENDENCIES) $(EXTRA_td_sub_DEPENDENCIES)
+ @rm -f td_sub$(EXEEXT)
+ $(LINK) $(td_sub_OBJECTS) $(td_sub_LDADD) $(LIBS)
+tdigamma$(EXEEXT): $(tdigamma_OBJECTS) $(tdigamma_DEPENDENCIES) $(EXTRA_tdigamma_DEPENDENCIES)
+ @rm -f tdigamma$(EXEEXT)
+ $(LINK) $(tdigamma_OBJECTS) $(tdigamma_LDADD) $(LIBS)
+tdim$(EXEEXT): $(tdim_OBJECTS) $(tdim_DEPENDENCIES) $(EXTRA_tdim_DEPENDENCIES)
+ @rm -f tdim$(EXEEXT)
+ $(LINK) $(tdim_OBJECTS) $(tdim_LDADD) $(LIBS)
+tdiv$(EXEEXT): $(tdiv_OBJECTS) $(tdiv_DEPENDENCIES) $(EXTRA_tdiv_DEPENDENCIES)
+ @rm -f tdiv$(EXEEXT)
+ $(LINK) $(tdiv_OBJECTS) $(tdiv_LDADD) $(LIBS)
+tdiv_d$(EXEEXT): $(tdiv_d_OBJECTS) $(tdiv_d_DEPENDENCIES) $(EXTRA_tdiv_d_DEPENDENCIES)
+ @rm -f tdiv_d$(EXEEXT)
+ $(LINK) $(tdiv_d_OBJECTS) $(tdiv_d_LDADD) $(LIBS)
+tdiv_ui$(EXEEXT): $(tdiv_ui_OBJECTS) $(tdiv_ui_DEPENDENCIES) $(EXTRA_tdiv_ui_DEPENDENCIES)
+ @rm -f tdiv_ui$(EXEEXT)
+ $(LINK) $(tdiv_ui_OBJECTS) $(tdiv_ui_LDADD) $(LIBS)
+teint$(EXEEXT): $(teint_OBJECTS) $(teint_DEPENDENCIES) $(EXTRA_teint_DEPENDENCIES)
+ @rm -f teint$(EXEEXT)
+ $(LINK) $(teint_OBJECTS) $(teint_LDADD) $(LIBS)
+teq$(EXEEXT): $(teq_OBJECTS) $(teq_DEPENDENCIES) $(EXTRA_teq_DEPENDENCIES)
+ @rm -f teq$(EXEEXT)
+ $(LINK) $(teq_OBJECTS) $(teq_LDADD) $(LIBS)
+terf$(EXEEXT): $(terf_OBJECTS) $(terf_DEPENDENCIES) $(EXTRA_terf_DEPENDENCIES)
+ @rm -f terf$(EXEEXT)
+ $(LINK) $(terf_OBJECTS) $(terf_LDADD) $(LIBS)
+texceptions$(EXEEXT): $(texceptions_OBJECTS) $(texceptions_DEPENDENCIES) $(EXTRA_texceptions_DEPENDENCIES)
+ @rm -f texceptions$(EXEEXT)
+ $(LINK) $(texceptions_OBJECTS) $(texceptions_LDADD) $(LIBS)
+texp$(EXEEXT): $(texp_OBJECTS) $(texp_DEPENDENCIES) $(EXTRA_texp_DEPENDENCIES)
+ @rm -f texp$(EXEEXT)
+ $(LINK) $(texp_OBJECTS) $(texp_LDADD) $(LIBS)
+texp10$(EXEEXT): $(texp10_OBJECTS) $(texp10_DEPENDENCIES) $(EXTRA_texp10_DEPENDENCIES)
+ @rm -f texp10$(EXEEXT)
+ $(LINK) $(texp10_OBJECTS) $(texp10_LDADD) $(LIBS)
+texp2$(EXEEXT): $(texp2_OBJECTS) $(texp2_DEPENDENCIES) $(EXTRA_texp2_DEPENDENCIES)
+ @rm -f texp2$(EXEEXT)
+ $(LINK) $(texp2_OBJECTS) $(texp2_LDADD) $(LIBS)
+texpm1$(EXEEXT): $(texpm1_OBJECTS) $(texpm1_DEPENDENCIES) $(EXTRA_texpm1_DEPENDENCIES)
+ @rm -f texpm1$(EXEEXT)
+ $(LINK) $(texpm1_OBJECTS) $(texpm1_LDADD) $(LIBS)
+tfactorial$(EXEEXT): $(tfactorial_OBJECTS) $(tfactorial_DEPENDENCIES) $(EXTRA_tfactorial_DEPENDENCIES)
+ @rm -f tfactorial$(EXEEXT)
+ $(LINK) $(tfactorial_OBJECTS) $(tfactorial_LDADD) $(LIBS)
+tfits$(EXEEXT): $(tfits_OBJECTS) $(tfits_DEPENDENCIES) $(EXTRA_tfits_DEPENDENCIES)
+ @rm -f tfits$(EXEEXT)
+ $(LINK) $(tfits_OBJECTS) $(tfits_LDADD) $(LIBS)
+tfma$(EXEEXT): $(tfma_OBJECTS) $(tfma_DEPENDENCIES) $(EXTRA_tfma_DEPENDENCIES)
+ @rm -f tfma$(EXEEXT)
+ $(LINK) $(tfma_OBJECTS) $(tfma_LDADD) $(LIBS)
+tfmod$(EXEEXT): $(tfmod_OBJECTS) $(tfmod_DEPENDENCIES) $(EXTRA_tfmod_DEPENDENCIES)
+ @rm -f tfmod$(EXEEXT)
+ $(LINK) $(tfmod_OBJECTS) $(tfmod_LDADD) $(LIBS)
+tfms$(EXEEXT): $(tfms_OBJECTS) $(tfms_DEPENDENCIES) $(EXTRA_tfms_DEPENDENCIES)
+ @rm -f tfms$(EXEEXT)
+ $(LINK) $(tfms_OBJECTS) $(tfms_LDADD) $(LIBS)
+tfprintf$(EXEEXT): $(tfprintf_OBJECTS) $(tfprintf_DEPENDENCIES) $(EXTRA_tfprintf_DEPENDENCIES)
+ @rm -f tfprintf$(EXEEXT)
+ $(LINK) $(tfprintf_OBJECTS) $(tfprintf_LDADD) $(LIBS)
+tfrac$(EXEEXT): $(tfrac_OBJECTS) $(tfrac_DEPENDENCIES) $(EXTRA_tfrac_DEPENDENCIES)
+ @rm -f tfrac$(EXEEXT)
+ $(LINK) $(tfrac_OBJECTS) $(tfrac_LDADD) $(LIBS)
+tfrexp$(EXEEXT): $(tfrexp_OBJECTS) $(tfrexp_DEPENDENCIES) $(EXTRA_tfrexp_DEPENDENCIES)
+ @rm -f tfrexp$(EXEEXT)
+ $(LINK) $(tfrexp_OBJECTS) $(tfrexp_LDADD) $(LIBS)
+tgamma$(EXEEXT): $(tgamma_OBJECTS) $(tgamma_DEPENDENCIES) $(EXTRA_tgamma_DEPENDENCIES)
+ @rm -f tgamma$(EXEEXT)
+ $(LINK) $(tgamma_OBJECTS) $(tgamma_LDADD) $(LIBS)
+tget_d$(EXEEXT): $(tget_d_OBJECTS) $(tget_d_DEPENDENCIES) $(EXTRA_tget_d_DEPENDENCIES)
+ @rm -f tget_d$(EXEEXT)
+ $(LINK) $(tget_d_OBJECTS) $(tget_d_LDADD) $(LIBS)
+tget_d_2exp$(EXEEXT): $(tget_d_2exp_OBJECTS) $(tget_d_2exp_DEPENDENCIES) $(EXTRA_tget_d_2exp_DEPENDENCIES)
+ @rm -f tget_d_2exp$(EXEEXT)
+ $(LINK) $(tget_d_2exp_OBJECTS) $(tget_d_2exp_LDADD) $(LIBS)
+tget_f$(EXEEXT): $(tget_f_OBJECTS) $(tget_f_DEPENDENCIES) $(EXTRA_tget_f_DEPENDENCIES)
+ @rm -f tget_f$(EXEEXT)
+ $(LINK) $(tget_f_OBJECTS) $(tget_f_LDADD) $(LIBS)
+tget_flt$(EXEEXT): $(tget_flt_OBJECTS) $(tget_flt_DEPENDENCIES) $(EXTRA_tget_flt_DEPENDENCIES)
+ @rm -f tget_flt$(EXEEXT)
+ $(LINK) $(tget_flt_OBJECTS) $(tget_flt_LDADD) $(LIBS)
+tget_ld_2exp$(EXEEXT): $(tget_ld_2exp_OBJECTS) $(tget_ld_2exp_DEPENDENCIES) $(EXTRA_tget_ld_2exp_DEPENDENCIES)
+ @rm -f tget_ld_2exp$(EXEEXT)
+ $(LINK) $(tget_ld_2exp_OBJECTS) $(tget_ld_2exp_LDADD) $(LIBS)
+tget_set_d64$(EXEEXT): $(tget_set_d64_OBJECTS) $(tget_set_d64_DEPENDENCIES) $(EXTRA_tget_set_d64_DEPENDENCIES)
+ @rm -f tget_set_d64$(EXEEXT)
+ $(LINK) $(tget_set_d64_OBJECTS) $(tget_set_d64_LDADD) $(LIBS)
+tget_sj$(EXEEXT): $(tget_sj_OBJECTS) $(tget_sj_DEPENDENCIES) $(EXTRA_tget_sj_DEPENDENCIES)
+ @rm -f tget_sj$(EXEEXT)
+ $(LINK) $(tget_sj_OBJECTS) $(tget_sj_LDADD) $(LIBS)
+tget_str$(EXEEXT): $(tget_str_OBJECTS) $(tget_str_DEPENDENCIES) $(EXTRA_tget_str_DEPENDENCIES)
+ @rm -f tget_str$(EXEEXT)
+ $(LINK) $(tget_str_OBJECTS) $(tget_str_LDADD) $(LIBS)
+tget_z$(EXEEXT): $(tget_z_OBJECTS) $(tget_z_DEPENDENCIES) $(EXTRA_tget_z_DEPENDENCIES)
+ @rm -f tget_z$(EXEEXT)
+ $(LINK) $(tget_z_OBJECTS) $(tget_z_LDADD) $(LIBS)
+tgmpop$(EXEEXT): $(tgmpop_OBJECTS) $(tgmpop_DEPENDENCIES) $(EXTRA_tgmpop_DEPENDENCIES)
+ @rm -f tgmpop$(EXEEXT)
+ $(LINK) $(tgmpop_OBJECTS) $(tgmpop_LDADD) $(LIBS)
+tgrandom$(EXEEXT): $(tgrandom_OBJECTS) $(tgrandom_DEPENDENCIES) $(EXTRA_tgrandom_DEPENDENCIES)
+ @rm -f tgrandom$(EXEEXT)
+ $(LINK) $(tgrandom_OBJECTS) $(tgrandom_LDADD) $(LIBS)
+thyperbolic$(EXEEXT): $(thyperbolic_OBJECTS) $(thyperbolic_DEPENDENCIES) $(EXTRA_thyperbolic_DEPENDENCIES)
+ @rm -f thyperbolic$(EXEEXT)
+ $(LINK) $(thyperbolic_OBJECTS) $(thyperbolic_LDADD) $(LIBS)
+thypot$(EXEEXT): $(thypot_OBJECTS) $(thypot_DEPENDENCIES) $(EXTRA_thypot_DEPENDENCIES)
+ @rm -f thypot$(EXEEXT)
+ $(LINK) $(thypot_OBJECTS) $(thypot_LDADD) $(LIBS)
+tinits$(EXEEXT): $(tinits_OBJECTS) $(tinits_DEPENDENCIES) $(EXTRA_tinits_DEPENDENCIES)
+ @rm -f tinits$(EXEEXT)
+ $(LINK) $(tinits_OBJECTS) $(tinits_LDADD) $(LIBS)
+tinp_str$(EXEEXT): $(tinp_str_OBJECTS) $(tinp_str_DEPENDENCIES) $(EXTRA_tinp_str_DEPENDENCIES)
+ @rm -f tinp_str$(EXEEXT)
+ $(LINK) $(tinp_str_OBJECTS) $(tinp_str_LDADD) $(LIBS)
+tinternals$(EXEEXT): $(tinternals_OBJECTS) $(tinternals_DEPENDENCIES) $(EXTRA_tinternals_DEPENDENCIES)
+ @rm -f tinternals$(EXEEXT)
+ $(LINK) $(tinternals_OBJECTS) $(tinternals_LDADD) $(LIBS)
+tisnan$(EXEEXT): $(tisnan_OBJECTS) $(tisnan_DEPENDENCIES) $(EXTRA_tisnan_DEPENDENCIES)
+ @rm -f tisnan$(EXEEXT)
+ $(LINK) $(tisnan_OBJECTS) $(tisnan_LDADD) $(LIBS)
+tisqrt$(EXEEXT): $(tisqrt_OBJECTS) $(tisqrt_DEPENDENCIES) $(EXTRA_tisqrt_DEPENDENCIES)
+ @rm -f tisqrt$(EXEEXT)
+ $(LINK) $(tisqrt_OBJECTS) $(tisqrt_LDADD) $(LIBS)
+tj0$(EXEEXT): $(tj0_OBJECTS) $(tj0_DEPENDENCIES) $(EXTRA_tj0_DEPENDENCIES)
+ @rm -f tj0$(EXEEXT)
+ $(LINK) $(tj0_OBJECTS) $(tj0_LDADD) $(LIBS)
+tj1$(EXEEXT): $(tj1_OBJECTS) $(tj1_DEPENDENCIES) $(EXTRA_tj1_DEPENDENCIES)
+ @rm -f tj1$(EXEEXT)
+ $(LINK) $(tj1_OBJECTS) $(tj1_LDADD) $(LIBS)
+tjn$(EXEEXT): $(tjn_OBJECTS) $(tjn_DEPENDENCIES) $(EXTRA_tjn_DEPENDENCIES)
+ @rm -f tjn$(EXEEXT)
+ $(LINK) $(tjn_OBJECTS) $(tjn_LDADD) $(LIBS)
+tl2b$(EXEEXT): $(tl2b_OBJECTS) $(tl2b_DEPENDENCIES) $(EXTRA_tl2b_DEPENDENCIES)
+ @rm -f tl2b$(EXEEXT)
+ $(LINK) $(tl2b_OBJECTS) $(tl2b_LDADD) $(LIBS)
+tlgamma$(EXEEXT): $(tlgamma_OBJECTS) $(tlgamma_DEPENDENCIES) $(EXTRA_tlgamma_DEPENDENCIES)
+ @rm -f tlgamma$(EXEEXT)
+ $(LINK) $(tlgamma_OBJECTS) $(tlgamma_LDADD) $(LIBS)
+tli2$(EXEEXT): $(tli2_OBJECTS) $(tli2_DEPENDENCIES) $(EXTRA_tli2_DEPENDENCIES)
+ @rm -f tli2$(EXEEXT)
+ $(LINK) $(tli2_OBJECTS) $(tli2_LDADD) $(LIBS)
+tlngamma$(EXEEXT): $(tlngamma_OBJECTS) $(tlngamma_DEPENDENCIES) $(EXTRA_tlngamma_DEPENDENCIES)
+ @rm -f tlngamma$(EXEEXT)
+ $(LINK) $(tlngamma_OBJECTS) $(tlngamma_LDADD) $(LIBS)
+tlog$(EXEEXT): $(tlog_OBJECTS) $(tlog_DEPENDENCIES) $(EXTRA_tlog_DEPENDENCIES)
+ @rm -f tlog$(EXEEXT)
+ $(LINK) $(tlog_OBJECTS) $(tlog_LDADD) $(LIBS)
+tlog10$(EXEEXT): $(tlog10_OBJECTS) $(tlog10_DEPENDENCIES) $(EXTRA_tlog10_DEPENDENCIES)
+ @rm -f tlog10$(EXEEXT)
+ $(LINK) $(tlog10_OBJECTS) $(tlog10_LDADD) $(LIBS)
+tlog1p$(EXEEXT): $(tlog1p_OBJECTS) $(tlog1p_DEPENDENCIES) $(EXTRA_tlog1p_DEPENDENCIES)
+ @rm -f tlog1p$(EXEEXT)
+ $(LINK) $(tlog1p_OBJECTS) $(tlog1p_LDADD) $(LIBS)
+tlog2$(EXEEXT): $(tlog2_OBJECTS) $(tlog2_DEPENDENCIES) $(EXTRA_tlog2_DEPENDENCIES)
+ @rm -f tlog2$(EXEEXT)
+ $(LINK) $(tlog2_OBJECTS) $(tlog2_LDADD) $(LIBS)
+tmin_prec$(EXEEXT): $(tmin_prec_OBJECTS) $(tmin_prec_DEPENDENCIES) $(EXTRA_tmin_prec_DEPENDENCIES)
+ @rm -f tmin_prec$(EXEEXT)
+ $(LINK) $(tmin_prec_OBJECTS) $(tmin_prec_LDADD) $(LIBS)
+tminmax$(EXEEXT): $(tminmax_OBJECTS) $(tminmax_DEPENDENCIES) $(EXTRA_tminmax_DEPENDENCIES)
+ @rm -f tminmax$(EXEEXT)
+ $(LINK) $(tminmax_OBJECTS) $(tminmax_LDADD) $(LIBS)
+tmodf$(EXEEXT): $(tmodf_OBJECTS) $(tmodf_DEPENDENCIES) $(EXTRA_tmodf_DEPENDENCIES)
+ @rm -f tmodf$(EXEEXT)
+ $(LINK) $(tmodf_OBJECTS) $(tmodf_LDADD) $(LIBS)
+tmul$(EXEEXT): $(tmul_OBJECTS) $(tmul_DEPENDENCIES) $(EXTRA_tmul_DEPENDENCIES)
+ @rm -f tmul$(EXEEXT)
+ $(LINK) $(tmul_OBJECTS) $(tmul_LDADD) $(LIBS)
+tmul_2exp$(EXEEXT): $(tmul_2exp_OBJECTS) $(tmul_2exp_DEPENDENCIES) $(EXTRA_tmul_2exp_DEPENDENCIES)
+ @rm -f tmul_2exp$(EXEEXT)
+ $(LINK) $(tmul_2exp_OBJECTS) $(tmul_2exp_LDADD) $(LIBS)
+tmul_d$(EXEEXT): $(tmul_d_OBJECTS) $(tmul_d_DEPENDENCIES) $(EXTRA_tmul_d_DEPENDENCIES)
+ @rm -f tmul_d$(EXEEXT)
+ $(LINK) $(tmul_d_OBJECTS) $(tmul_d_LDADD) $(LIBS)
+tmul_ui$(EXEEXT): $(tmul_ui_OBJECTS) $(tmul_ui_DEPENDENCIES) $(EXTRA_tmul_ui_DEPENDENCIES)
+ @rm -f tmul_ui$(EXEEXT)
+ $(LINK) $(tmul_ui_OBJECTS) $(tmul_ui_LDADD) $(LIBS)
+tnext$(EXEEXT): $(tnext_OBJECTS) $(tnext_DEPENDENCIES) $(EXTRA_tnext_DEPENDENCIES)
+ @rm -f tnext$(EXEEXT)
+ $(LINK) $(tnext_OBJECTS) $(tnext_LDADD) $(LIBS)
+tout_str$(EXEEXT): $(tout_str_OBJECTS) $(tout_str_DEPENDENCIES) $(EXTRA_tout_str_DEPENDENCIES)
+ @rm -f tout_str$(EXEEXT)
+ $(LINK) $(tout_str_OBJECTS) $(tout_str_LDADD) $(LIBS)
+toutimpl$(EXEEXT): $(toutimpl_OBJECTS) $(toutimpl_DEPENDENCIES) $(EXTRA_toutimpl_DEPENDENCIES)
+ @rm -f toutimpl$(EXEEXT)
+ $(LINK) $(toutimpl_OBJECTS) $(toutimpl_LDADD) $(LIBS)
+tpow$(EXEEXT): $(tpow_OBJECTS) $(tpow_DEPENDENCIES) $(EXTRA_tpow_DEPENDENCIES)
+ @rm -f tpow$(EXEEXT)
+ $(LINK) $(tpow_OBJECTS) $(tpow_LDADD) $(LIBS)
+tpow3$(EXEEXT): $(tpow3_OBJECTS) $(tpow3_DEPENDENCIES) $(EXTRA_tpow3_DEPENDENCIES)
+ @rm -f tpow3$(EXEEXT)
+ $(LINK) $(tpow3_OBJECTS) $(tpow3_LDADD) $(LIBS)
+tpow_all$(EXEEXT): $(tpow_all_OBJECTS) $(tpow_all_DEPENDENCIES) $(EXTRA_tpow_all_DEPENDENCIES)
+ @rm -f tpow_all$(EXEEXT)
+ $(LINK) $(tpow_all_OBJECTS) $(tpow_all_LDADD) $(LIBS)
+tpow_z$(EXEEXT): $(tpow_z_OBJECTS) $(tpow_z_DEPENDENCIES) $(EXTRA_tpow_z_DEPENDENCIES)
+ @rm -f tpow_z$(EXEEXT)
+ $(LINK) $(tpow_z_OBJECTS) $(tpow_z_LDADD) $(LIBS)
+tprintf$(EXEEXT): $(tprintf_OBJECTS) $(tprintf_DEPENDENCIES) $(EXTRA_tprintf_DEPENDENCIES)
+ @rm -f tprintf$(EXEEXT)
+ $(LINK) $(tprintf_OBJECTS) $(tprintf_LDADD) $(LIBS)
+trandom$(EXEEXT): $(trandom_OBJECTS) $(trandom_DEPENDENCIES) $(EXTRA_trandom_DEPENDENCIES)
+ @rm -f trandom$(EXEEXT)
+ $(LINK) $(trandom_OBJECTS) $(trandom_LDADD) $(LIBS)
+trec_sqrt$(EXEEXT): $(trec_sqrt_OBJECTS) $(trec_sqrt_DEPENDENCIES) $(EXTRA_trec_sqrt_DEPENDENCIES)
+ @rm -f trec_sqrt$(EXEEXT)
+ $(LINK) $(trec_sqrt_OBJECTS) $(trec_sqrt_LDADD) $(LIBS)
+tremquo$(EXEEXT): $(tremquo_OBJECTS) $(tremquo_DEPENDENCIES) $(EXTRA_tremquo_DEPENDENCIES)
+ @rm -f tremquo$(EXEEXT)
+ $(LINK) $(tremquo_OBJECTS) $(tremquo_LDADD) $(LIBS)
+trint$(EXEEXT): $(trint_OBJECTS) $(trint_DEPENDENCIES) $(EXTRA_trint_DEPENDENCIES)
+ @rm -f trint$(EXEEXT)
+ $(LINK) $(trint_OBJECTS) $(trint_LDADD) $(LIBS)
+troot$(EXEEXT): $(troot_OBJECTS) $(troot_DEPENDENCIES) $(EXTRA_troot_DEPENDENCIES)
+ @rm -f troot$(EXEEXT)
+ $(LINK) $(troot_OBJECTS) $(troot_LDADD) $(LIBS)
+tround_prec$(EXEEXT): $(tround_prec_OBJECTS) $(tround_prec_DEPENDENCIES) $(EXTRA_tround_prec_DEPENDENCIES)
+ @rm -f tround_prec$(EXEEXT)
+ $(LINK) $(tround_prec_OBJECTS) $(tround_prec_LDADD) $(LIBS)
+tsec$(EXEEXT): $(tsec_OBJECTS) $(tsec_DEPENDENCIES) $(EXTRA_tsec_DEPENDENCIES)
+ @rm -f tsec$(EXEEXT)
+ $(LINK) $(tsec_OBJECTS) $(tsec_LDADD) $(LIBS)
+tsech$(EXEEXT): $(tsech_OBJECTS) $(tsech_DEPENDENCIES) $(EXTRA_tsech_DEPENDENCIES)
+ @rm -f tsech$(EXEEXT)
+ $(LINK) $(tsech_OBJECTS) $(tsech_LDADD) $(LIBS)
+tset$(EXEEXT): $(tset_OBJECTS) $(tset_DEPENDENCIES) $(EXTRA_tset_DEPENDENCIES)
+ @rm -f tset$(EXEEXT)
+ $(LINK) $(tset_OBJECTS) $(tset_LDADD) $(LIBS)
+tset_d$(EXEEXT): $(tset_d_OBJECTS) $(tset_d_DEPENDENCIES) $(EXTRA_tset_d_DEPENDENCIES)
+ @rm -f tset_d$(EXEEXT)
+ $(LINK) $(tset_d_OBJECTS) $(tset_d_LDADD) $(LIBS)
+tset_exp$(EXEEXT): $(tset_exp_OBJECTS) $(tset_exp_DEPENDENCIES) $(EXTRA_tset_exp_DEPENDENCIES)
+ @rm -f tset_exp$(EXEEXT)
+ $(LINK) $(tset_exp_OBJECTS) $(tset_exp_LDADD) $(LIBS)
+tset_f$(EXEEXT): $(tset_f_OBJECTS) $(tset_f_DEPENDENCIES) $(EXTRA_tset_f_DEPENDENCIES)
+ @rm -f tset_f$(EXEEXT)
+ $(LINK) $(tset_f_OBJECTS) $(tset_f_LDADD) $(LIBS)
+tset_ld$(EXEEXT): $(tset_ld_OBJECTS) $(tset_ld_DEPENDENCIES) $(EXTRA_tset_ld_DEPENDENCIES)
+ @rm -f tset_ld$(EXEEXT)
+ $(LINK) $(tset_ld_OBJECTS) $(tset_ld_LDADD) $(LIBS)
+tset_q$(EXEEXT): $(tset_q_OBJECTS) $(tset_q_DEPENDENCIES) $(EXTRA_tset_q_DEPENDENCIES)
+ @rm -f tset_q$(EXEEXT)
+ $(LINK) $(tset_q_OBJECTS) $(tset_q_LDADD) $(LIBS)
+tset_si$(EXEEXT): $(tset_si_OBJECTS) $(tset_si_DEPENDENCIES) $(EXTRA_tset_si_DEPENDENCIES)
+ @rm -f tset_si$(EXEEXT)
+ $(LINK) $(tset_si_OBJECTS) $(tset_si_LDADD) $(LIBS)
+tset_sj$(EXEEXT): $(tset_sj_OBJECTS) $(tset_sj_DEPENDENCIES) $(EXTRA_tset_sj_DEPENDENCIES)
+ @rm -f tset_sj$(EXEEXT)
+ $(LINK) $(tset_sj_OBJECTS) $(tset_sj_LDADD) $(LIBS)
+tset_str$(EXEEXT): $(tset_str_OBJECTS) $(tset_str_DEPENDENCIES) $(EXTRA_tset_str_DEPENDENCIES)
+ @rm -f tset_str$(EXEEXT)
+ $(LINK) $(tset_str_OBJECTS) $(tset_str_LDADD) $(LIBS)
+tset_z$(EXEEXT): $(tset_z_OBJECTS) $(tset_z_DEPENDENCIES) $(EXTRA_tset_z_DEPENDENCIES)
+ @rm -f tset_z$(EXEEXT)
+ $(LINK) $(tset_z_OBJECTS) $(tset_z_LDADD) $(LIBS)
+tset_z_exp$(EXEEXT): $(tset_z_exp_OBJECTS) $(tset_z_exp_DEPENDENCIES) $(EXTRA_tset_z_exp_DEPENDENCIES)
+ @rm -f tset_z_exp$(EXEEXT)
+ $(LINK) $(tset_z_exp_OBJECTS) $(tset_z_exp_LDADD) $(LIBS)
+tsgn$(EXEEXT): $(tsgn_OBJECTS) $(tsgn_DEPENDENCIES) $(EXTRA_tsgn_DEPENDENCIES)
+ @rm -f tsgn$(EXEEXT)
+ $(LINK) $(tsgn_OBJECTS) $(tsgn_LDADD) $(LIBS)
+tsi_op$(EXEEXT): $(tsi_op_OBJECTS) $(tsi_op_DEPENDENCIES) $(EXTRA_tsi_op_DEPENDENCIES)
+ @rm -f tsi_op$(EXEEXT)
+ $(LINK) $(tsi_op_OBJECTS) $(tsi_op_LDADD) $(LIBS)
+tsin$(EXEEXT): $(tsin_OBJECTS) $(tsin_DEPENDENCIES) $(EXTRA_tsin_DEPENDENCIES)
+ @rm -f tsin$(EXEEXT)
+ $(LINK) $(tsin_OBJECTS) $(tsin_LDADD) $(LIBS)
+tsin_cos$(EXEEXT): $(tsin_cos_OBJECTS) $(tsin_cos_DEPENDENCIES) $(EXTRA_tsin_cos_DEPENDENCIES)
+ @rm -f tsin_cos$(EXEEXT)
+ $(LINK) $(tsin_cos_OBJECTS) $(tsin_cos_LDADD) $(LIBS)
+tsinh$(EXEEXT): $(tsinh_OBJECTS) $(tsinh_DEPENDENCIES) $(EXTRA_tsinh_DEPENDENCIES)
+ @rm -f tsinh$(EXEEXT)
+ $(LINK) $(tsinh_OBJECTS) $(tsinh_LDADD) $(LIBS)
+tsinh_cosh$(EXEEXT): $(tsinh_cosh_OBJECTS) $(tsinh_cosh_DEPENDENCIES) $(EXTRA_tsinh_cosh_DEPENDENCIES)
+ @rm -f tsinh_cosh$(EXEEXT)
+ $(LINK) $(tsinh_cosh_OBJECTS) $(tsinh_cosh_LDADD) $(LIBS)
+tsprintf$(EXEEXT): $(tsprintf_OBJECTS) $(tsprintf_DEPENDENCIES) $(EXTRA_tsprintf_DEPENDENCIES)
+ @rm -f tsprintf$(EXEEXT)
+ $(LINK) $(tsprintf_OBJECTS) $(tsprintf_LDADD) $(LIBS)
+tsqr$(EXEEXT): $(tsqr_OBJECTS) $(tsqr_DEPENDENCIES) $(EXTRA_tsqr_DEPENDENCIES)
+ @rm -f tsqr$(EXEEXT)
+ $(LINK) $(tsqr_OBJECTS) $(tsqr_LDADD) $(LIBS)
+tsqrt$(EXEEXT): $(tsqrt_OBJECTS) $(tsqrt_DEPENDENCIES) $(EXTRA_tsqrt_DEPENDENCIES)
+ @rm -f tsqrt$(EXEEXT)
+ $(LINK) $(tsqrt_OBJECTS) $(tsqrt_LDADD) $(LIBS)
+tsqrt_ui$(EXEEXT): $(tsqrt_ui_OBJECTS) $(tsqrt_ui_DEPENDENCIES) $(EXTRA_tsqrt_ui_DEPENDENCIES)
+ @rm -f tsqrt_ui$(EXEEXT)
+ $(LINK) $(tsqrt_ui_OBJECTS) $(tsqrt_ui_LDADD) $(LIBS)
+tstckintc$(EXEEXT): $(tstckintc_OBJECTS) $(tstckintc_DEPENDENCIES) $(EXTRA_tstckintc_DEPENDENCIES)
+ @rm -f tstckintc$(EXEEXT)
+ $(LINK) $(tstckintc_OBJECTS) $(tstckintc_LDADD) $(LIBS)
+tstdint$(EXEEXT): $(tstdint_OBJECTS) $(tstdint_DEPENDENCIES) $(EXTRA_tstdint_DEPENDENCIES)
+ @rm -f tstdint$(EXEEXT)
+ $(LINK) $(tstdint_OBJECTS) $(tstdint_LDADD) $(LIBS)
+tstrtofr$(EXEEXT): $(tstrtofr_OBJECTS) $(tstrtofr_DEPENDENCIES) $(EXTRA_tstrtofr_DEPENDENCIES)
+ @rm -f tstrtofr$(EXEEXT)
+ $(LINK) $(tstrtofr_OBJECTS) $(tstrtofr_LDADD) $(LIBS)
+tsub$(EXEEXT): $(tsub_OBJECTS) $(tsub_DEPENDENCIES) $(EXTRA_tsub_DEPENDENCIES)
+ @rm -f tsub$(EXEEXT)
+ $(LINK) $(tsub_OBJECTS) $(tsub_LDADD) $(LIBS)
+tsub1sp$(EXEEXT): $(tsub1sp_OBJECTS) $(tsub1sp_DEPENDENCIES) $(EXTRA_tsub1sp_DEPENDENCIES)
+ @rm -f tsub1sp$(EXEEXT)
+ $(LINK) $(tsub1sp_OBJECTS) $(tsub1sp_LDADD) $(LIBS)
+tsub_d$(EXEEXT): $(tsub_d_OBJECTS) $(tsub_d_DEPENDENCIES) $(EXTRA_tsub_d_DEPENDENCIES)
+ @rm -f tsub_d$(EXEEXT)
+ $(LINK) $(tsub_d_OBJECTS) $(tsub_d_LDADD) $(LIBS)
+tsub_ui$(EXEEXT): $(tsub_ui_OBJECTS) $(tsub_ui_DEPENDENCIES) $(EXTRA_tsub_ui_DEPENDENCIES)
+ @rm -f tsub_ui$(EXEEXT)
+ $(LINK) $(tsub_ui_OBJECTS) $(tsub_ui_LDADD) $(LIBS)
+tsubnormal$(EXEEXT): $(tsubnormal_OBJECTS) $(tsubnormal_DEPENDENCIES) $(EXTRA_tsubnormal_DEPENDENCIES)
+ @rm -f tsubnormal$(EXEEXT)
+ $(LINK) $(tsubnormal_OBJECTS) $(tsubnormal_LDADD) $(LIBS)
+tsum$(EXEEXT): $(tsum_OBJECTS) $(tsum_DEPENDENCIES) $(EXTRA_tsum_DEPENDENCIES)
+ @rm -f tsum$(EXEEXT)
+ $(LINK) $(tsum_OBJECTS) $(tsum_LDADD) $(LIBS)
+tswap$(EXEEXT): $(tswap_OBJECTS) $(tswap_DEPENDENCIES) $(EXTRA_tswap_DEPENDENCIES)
+ @rm -f tswap$(EXEEXT)
+ $(LINK) $(tswap_OBJECTS) $(tswap_LDADD) $(LIBS)
+ttan$(EXEEXT): $(ttan_OBJECTS) $(ttan_DEPENDENCIES) $(EXTRA_ttan_DEPENDENCIES)
+ @rm -f ttan$(EXEEXT)
+ $(LINK) $(ttan_OBJECTS) $(ttan_LDADD) $(LIBS)
+ttanh$(EXEEXT): $(ttanh_OBJECTS) $(ttanh_DEPENDENCIES) $(EXTRA_ttanh_DEPENDENCIES)
+ @rm -f ttanh$(EXEEXT)
+ $(LINK) $(ttanh_OBJECTS) $(ttanh_LDADD) $(LIBS)
+ttrunc$(EXEEXT): $(ttrunc_OBJECTS) $(ttrunc_DEPENDENCIES) $(EXTRA_ttrunc_DEPENDENCIES)
+ @rm -f ttrunc$(EXEEXT)
+ $(LINK) $(ttrunc_OBJECTS) $(ttrunc_LDADD) $(LIBS)
+tui_div$(EXEEXT): $(tui_div_OBJECTS) $(tui_div_DEPENDENCIES) $(EXTRA_tui_div_DEPENDENCIES)
+ @rm -f tui_div$(EXEEXT)
+ $(LINK) $(tui_div_OBJECTS) $(tui_div_LDADD) $(LIBS)
+tui_pow$(EXEEXT): $(tui_pow_OBJECTS) $(tui_pow_DEPENDENCIES) $(EXTRA_tui_pow_DEPENDENCIES)
+ @rm -f tui_pow$(EXEEXT)
+ $(LINK) $(tui_pow_OBJECTS) $(tui_pow_LDADD) $(LIBS)
+tui_sub$(EXEEXT): $(tui_sub_OBJECTS) $(tui_sub_DEPENDENCIES) $(EXTRA_tui_sub_DEPENDENCIES)
+ @rm -f tui_sub$(EXEEXT)
+ $(LINK) $(tui_sub_OBJECTS) $(tui_sub_LDADD) $(LIBS)
+turandom$(EXEEXT): $(turandom_OBJECTS) $(turandom_DEPENDENCIES) $(EXTRA_turandom_DEPENDENCIES)
+ @rm -f turandom$(EXEEXT)
+ $(LINK) $(turandom_OBJECTS) $(turandom_LDADD) $(LIBS)
+tvalist$(EXEEXT): $(tvalist_OBJECTS) $(tvalist_DEPENDENCIES) $(EXTRA_tvalist_DEPENDENCIES)
+ @rm -f tvalist$(EXEEXT)
+ $(LINK) $(tvalist_OBJECTS) $(tvalist_LDADD) $(LIBS)
+tversion$(EXEEXT): $(tversion_OBJECTS) $(tversion_DEPENDENCIES) $(EXTRA_tversion_DEPENDENCIES)
+ @rm -f tversion$(EXEEXT)
+ $(LINK) $(tversion_OBJECTS) $(tversion_LDADD) $(LIBS)
+ty0$(EXEEXT): $(ty0_OBJECTS) $(ty0_DEPENDENCIES) $(EXTRA_ty0_DEPENDENCIES)
+ @rm -f ty0$(EXEEXT)
+ $(LINK) $(ty0_OBJECTS) $(ty0_LDADD) $(LIBS)
+ty1$(EXEEXT): $(ty1_OBJECTS) $(ty1_DEPENDENCIES) $(EXTRA_ty1_DEPENDENCIES)
+ @rm -f ty1$(EXEEXT)
+ $(LINK) $(ty1_OBJECTS) $(ty1_LDADD) $(LIBS)
+tyn$(EXEEXT): $(tyn_OBJECTS) $(tyn_DEPENDENCIES) $(EXTRA_tyn_DEPENDENCIES)
+ @rm -f tyn$(EXEEXT)
+ $(LINK) $(tyn_OBJECTS) $(tyn_LDADD) $(LIBS)
+tzeta$(EXEEXT): $(tzeta_OBJECTS) $(tzeta_DEPENDENCIES) $(EXTRA_tzeta_DEPENDENCIES)
+ @rm -f tzeta$(EXEEXT)
+ $(LINK) $(tzeta_OBJECTS) $(tzeta_LDADD) $(LIBS)
+tzeta_ui$(EXEEXT): $(tzeta_ui_OBJECTS) $(tzeta_ui_DEPENDENCIES) $(EXTRA_tzeta_ui_DEPENDENCIES)
+ @rm -f tzeta_ui$(EXEEXT)
+ $(LINK) $(tzeta_ui_OBJECTS) $(tzeta_ui_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmp_str.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpf_compat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpfr_compat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reuse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rnd_mode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacosh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd1sp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tadd_ui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tagm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tai.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasinh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tatan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tatanh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/taway.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbuildopt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcan_round.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcbrt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_ld.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmp_ui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmpabs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcomparisons.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_catalan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_euler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_log2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconst_pi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcopysign.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcosh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcot.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcoth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcsc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcsch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/td_div.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/td_sub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdigamma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdim.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdiv_ui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teq.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texceptions.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp10.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texp2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texpm1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfactorial.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfmod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfrac.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfrexp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgamma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_d_2exp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_f.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_flt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_ld_2exp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_set_d64.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_sj.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tget_z.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgmpop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgrandom.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thyperbolic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thypot.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinp_str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinternals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tisnan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tisqrt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tj0.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tj1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tjn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tl2b.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlgamma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tli2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlngamma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog10.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog1p.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlog2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmin_prec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tminmax.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmodf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_2exp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmul_ui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tout_str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toutimpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow_all.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpow_z.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trandom.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trec_sqrt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tremquo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/troot.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tround_prec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsech.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_exp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_f.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_ld.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_q.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_si.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_sj.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_z.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tset_z_exp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsgn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsi_op.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsin_cos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsinh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsinh_cosh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqrt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsqrt_ui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstckintc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstdint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstrtofr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub1sp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsub_ui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsubnormal.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsum.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tswap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttanh.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttrunc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_div.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_pow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tui_sub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/turandom.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvalist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tversion.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ty0.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ty1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tyn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzeta.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzeta_ui.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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
+
+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) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ 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; }; }'`; \
+ 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) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; }; }'`; \
+ 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-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+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:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+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)
+
+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-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+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
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir 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-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+$(top_builddir)/src/libmpfr.la:
+ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
+
+# 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:
diff --git a/tests/cmp_str.c b/tests/cmp_str.c
new file mode 100644
index 0000000..45ac3c7
--- /dev/null
+++ b/tests/cmp_str.c
@@ -0,0 +1,37 @@
+/* mpfr_cmp_str -- compare a floating-point number with a string.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-test.h"
+
+int
+mpfr_cmp_str (mpfr_srcptr x, const char *s, int base, mpfr_rnd_t rnd)
+{
+ mpfr_t y;
+ int res;
+
+ MPFR_ASSERTN (!MPFR_IS_NAN (x));
+ mpfr_init2 (y, MPFR_PREC(x));
+ mpfr_set_str (y, s, base, rnd);
+ res = mpfr_cmp (x,y);
+ mpfr_clear (y);
+ return res;
+}
diff --git a/tests/inp_str.data b/tests/inp_str.data
new file mode 100644
index 0000000..31e81c5
--- /dev/null
+++ b/tests/inp_str.data
@@ -0,0 +1,64 @@
+3.1415E4
+3.14160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E4
+this_is_an_invalid_float
+1.0010010100001110100101001110011010111011100001110010e226
+2.0120022122100022221001012120111010e142
+1.02110032211032122323201302e113
+1.43422433221034224112212e97
+2.245023334051130112541e87
+3.0214031231425640423e80
+2.224164516327341620e75
+2.16278308831176433e71
+1.2344999999999999e68
+2.5768519130417743@65
+1.326a50b3b9b311a@63
+1.4ca424800281ca0@61
+2.d44d2c475c1617@59
+b.4e8eae45eec494@57
+4.943a539aee1c8@56
+2.a69b19309ce43@55
+2.08b6320agf513@54
+2.18igbef497b79@53
+2.eg92a193d6jib@52
+4.bcj53i4dg133i@51
+9.7aee6ife1hgc@50
+1.065g326jbmm6@50
+2.l9dfn9kk1l6k@49
+9.jcnhb3me6c6m@48
+1.ci74dmge82kb@48
+6.f8h98p15fd2p@47
+1.57pn1af15bcb@47
+6.i3h3gqn3sp0@46
+1.bnhlsj9haq1@46
+9.h60jmhep7e9@45
+2.98eijjbn1p0@45
+i.u9r3j72f706@44
+5.2vxma61rnia@44
+1.epbr7wcjrks@44
+e.t2lm57i7hol@43
+4.KOJ1KXDLOD4@43
+1.H11SSC49aK9@43
+I.IWc1P7E0LQ8@42
+6.FBLVIEPHDc@42
+2.AV3VN4CK5A@42
+Y.MLABZPIMQ8@41
+D.6dIaKL16KV@41
+5.5RIZ3BGFbB@41
+2.1bIDPOihRN@41
+c.5SPGTF1gcJ@40
+G.60Khc9JPg1@40
+6.jNOlekhHB9@40
+3.2B39MUfSUI@40
+1.HhIJK7WJnh@40
+V.HkOThmcRf8@39
+E.aOdo3XbWH0@39
+6.qaNNZOE7Dd@39
+3.KAITW0C2kr@39
+1.ZdacKp9sIh@39
+j.ff6t2aeHht@38
+N.Jl6DgUeeZA@38
+C.3GakhvVNYH@38
+6.HTqomOD3Rh@38
+3.JSeUbAAtE@38
+1.lD6kuqhV0@38
+x.I7kYxn4IR@37
diff --git a/tests/memory.c b/tests/memory.c
new file mode 100644
index 0000000..2b74651
--- /dev/null
+++ b/tests/memory.c
@@ -0,0 +1,193 @@
+/* Memory allocation used during tests.
+
+Copyright 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Note: this file comes from GMP's tests/memory.c */
+
+#include <stdio.h>
+#include <stdlib.h> /* for abort */
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+/* Each block allocated is a separate malloc, for the benefit of a redzoning
+ malloc debugger during development or when bug hunting.
+
+ Sizes passed when reallocating or freeing are checked (the default
+ routines don't care about these).
+
+ Memory leaks are checked by requiring that all blocks have been freed
+ when tests_memory_end() is called. Test programs must be sure to have
+ "clear"s for all temporary variables used. */
+
+struct header {
+ void *ptr;
+ size_t size;
+ struct header *next;
+};
+
+static struct header *tests_memory_list;
+
+/* Return a pointer to a pointer to the found block (so it can be updated
+ when unlinking). */
+static struct header **
+tests_memory_find (void *ptr)
+{
+ struct header **hp;
+
+ for (hp = &tests_memory_list; *hp != NULL; hp = &((*hp)->next))
+ if ((*hp)->ptr == ptr)
+ return hp;
+
+ return NULL;
+}
+
+/*
+static int
+tests_memory_valid (void *ptr)
+{
+ return (tests_memory_find (ptr) != NULL);
+}
+*/
+
+static void *
+tests_allocate (size_t size)
+{
+ struct header *h;
+
+ if (size == 0)
+ {
+ printf ("tests_allocate(): attempt to allocate 0 bytes\n");
+ abort ();
+ }
+
+ h = (struct header *) __gmp_default_allocate (sizeof (*h));
+ h->next = tests_memory_list;
+ tests_memory_list = h;
+
+ h->size = size;
+ h->ptr = __gmp_default_allocate (size);
+ return h->ptr;
+}
+
+static void *
+tests_reallocate (void *ptr, size_t old_size, size_t new_size)
+{
+ struct header **hp, *h;
+
+ if (new_size == 0)
+ {
+ printf ("tests_reallocate(): attempt to reallocate 0x%lX to 0 bytes\n",
+ (unsigned long) ptr);
+ abort ();
+ }
+
+ hp = tests_memory_find (ptr);
+ if (hp == NULL)
+ {
+ printf ("tests_reallocate(): attempt to reallocate bad pointer 0x%lX\n",
+ (unsigned long) ptr);
+ abort ();
+ }
+ h = *hp;
+
+ if (h->size != old_size)
+ {
+ /* Note: we should use the standard %zu to print sizes, but
+ this is not supported by old C implementations. */
+ printf ("tests_reallocate(): bad old size %lu, should be %lu\n",
+ (unsigned long) old_size, (unsigned long) h->size);
+ abort ();
+ }
+
+ h->size = new_size;
+ h->ptr = __gmp_default_reallocate (ptr, old_size, new_size);
+ return h->ptr;
+}
+
+static struct header **
+tests_free_find (void *ptr)
+{
+ struct header **hp = tests_memory_find (ptr);
+ if (hp == NULL)
+ {
+ printf ("tests_free(): attempt to free bad pointer 0x%lX\n",
+ (unsigned long) ptr);
+ abort ();
+ }
+ return hp;
+}
+
+static void
+tests_free_nosize (void *ptr)
+{
+ struct header **hp = tests_free_find (ptr);
+ struct header *h = *hp;
+
+ *hp = h->next; /* unlink */
+
+ __gmp_default_free (ptr, h->size);
+ __gmp_default_free (h, sizeof (*h));
+}
+
+static void
+tests_free (void *ptr, size_t size)
+{
+ struct header **hp = tests_free_find (ptr);
+ struct header *h = *hp;
+
+ if (h->size != size)
+ {
+ /* Note: we should use the standard %zu to print sizes, but
+ this is not supported by old C implementations. */
+ printf ("tests_free(): bad size %lu, should be %lu\n",
+ (unsigned long) size, (unsigned long) h->size);
+ abort ();
+ }
+
+ tests_free_nosize (ptr);
+}
+
+void
+tests_memory_start (void)
+{
+ tests_memory_list = NULL;
+ mp_set_memory_functions (tests_allocate, tests_reallocate, tests_free);
+}
+
+void
+tests_memory_end (void)
+{
+ if (tests_memory_list != NULL)
+ {
+ struct header *h;
+ unsigned count;
+
+ printf ("tests_memory_end(): not all memory freed\n");
+
+ count = 0;
+ for (h = tests_memory_list; h != NULL; h = h->next)
+ count++;
+
+ printf (" %u blocks remaining\n", count);
+ abort ();
+ }
+}
diff --git a/tests/mpf_compat.c b/tests/mpf_compat.c
new file mode 100644
index 0000000..923be0d
--- /dev/null
+++ b/tests/mpf_compat.c
@@ -0,0 +1,25 @@
+/* Test compatibility mpf-mpfr.
+
+Copyright 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPF
+#define mpf_free_str mpfr_free_str
+#include "mpf_compat.h"
diff --git a/tests/mpf_compat.h b/tests/mpf_compat.h
new file mode 100644
index 0000000..3df82b5
--- /dev/null
+++ b/tests/mpf_compat.h
@@ -0,0 +1,236 @@
+/* Test compatibility mpf-mpfr.
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#if defined (__cplusplus)
+#include <cstdio>
+#else
+#include <stdio.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+
+#include "gmp.h"
+#include "mpfr.h"
+#ifdef MPFR
+#include "mpf2mpfr.h"
+#endif
+
+int
+main (void)
+{
+ unsigned long int prec;
+ unsigned long int prec2;
+ mpf_t x, y;
+ mpz_t z;
+ mpq_t q;
+ double d;
+ signed long int exp;
+ long l;
+ unsigned long u;
+ char *s;
+ int i;
+ FILE *f;
+ gmp_randstate_t state;
+
+ /* Initialization Functions */
+ prec = 53;
+ mpf_set_default_prec (prec);
+ prec2 = mpf_get_default_prec ();
+ if (prec2 < prec)
+ {
+ printf ("Error in get_default_prec: %lu < %lu\n", prec2, prec);
+ exit (1);
+ }
+
+ mpf_init (y);
+
+ mpf_init2 (x, prec);
+ prec2 = mpf_get_prec (x);
+ if (prec2 < prec)
+ {
+ printf ("Error in get_prec: %lu < %lu\n", prec2, prec);
+ mpf_clear (y);
+ mpf_clear (x);
+ exit (1);
+ }
+
+ mpf_set_prec (x, 2 * prec);
+ prec2 = mpf_get_prec (x);
+ if (prec2 < 2 * prec)
+ {
+ printf ("Error in set_prec: %lu < %lu\n", prec2, 2 * prec);
+ mpf_clear (y);
+ mpf_clear (x);
+ exit (1);
+ }
+
+ mpf_set_prec_raw (x, prec);
+ prec2 = mpf_get_prec (x);
+ if (prec2 < prec)
+ {
+ printf ("Error in set_prec_raw: %lu < %lu\n", prec2, prec);
+ mpf_clear (y);
+ mpf_clear (x);
+ exit (1);
+ }
+
+ /* Assignment Functions */
+
+ mpf_set (y, x);
+ mpf_set_ui (x, 1);
+ mpf_set_si (x, -1);
+ mpf_set_d (x, 1.0);
+
+ mpz_init_set_ui (z, 17);
+ mpf_set_z (x, z);
+ mpz_clear (z);
+
+ mpq_init (q);
+ mpq_set_ui (q, 2, 3);
+ mpf_set_q (x, q);
+ mpq_clear (q);
+
+ mpf_set_str (x, "3.1415e1", 10);
+ mpf_swap (x, y);
+
+ /* Combined Initialization and Assignment Functions */
+
+ mpf_clear (x);
+ mpf_init_set (x, y);
+ mpf_clear (x);
+ mpf_init_set_ui (x, 17);
+ mpf_clear (x);
+ mpf_init_set_si (x, -17);
+ mpf_clear (x);
+ mpf_init_set_d (x, 17.0);
+ mpf_clear (x);
+ mpf_init_set_str (x, "3.1415e1", 10);
+
+ /* Conversion Functions */
+
+ d = mpf_get_d (x);
+ d = mpf_get_d_2exp (&exp, x);
+ l = mpf_get_si (x);
+ u = mpf_get_ui (x);
+ s = mpf_get_str (NULL, &exp, 10, 10, x);
+ /* MPF doen't have mpf_free_str */
+ mpfr_free_str (s);
+
+ /* Use d, l and u to avoid a warning with -Wunused-but-set-variable
+ from GCC 4.6. The variables above were mainly used for prototype
+ checking. */
+ (void) d; (void) l; (void) u;
+
+ /* Arithmetic Functions */
+
+ mpf_add (y, x, x);
+ mpf_add_ui (y, x, 1);
+ mpf_sub (y, x, x);
+ mpf_ui_sub (y, 1, x);
+ mpf_sub_ui (y, x, 1);
+ mpf_mul (y, x, x);
+ mpf_mul_ui (y, x, 17);
+ mpf_div (y, x, x);
+ mpf_ui_div (y, 17, x);
+ mpf_div_ui (y, x, 17);
+ mpf_sqrt (y, x);
+ mpf_sqrt_ui (y, 17);
+ mpf_pow_ui (y, x, 2);
+ mpf_neg (y, x);
+ mpf_abs (y, x);
+ mpf_mul_2exp (y, x, 17);
+ mpf_div_2exp (y, x, 17);
+
+ /* Comparison Functions */
+
+ i = mpf_cmp (y, x);
+ i = mpf_cmp_d (y, 1.7);
+ i = mpf_cmp_ui (y, 17);
+ i = mpf_cmp_si (y, -17);
+ i = mpf_eq (y, x, 17);
+ mpf_reldiff (y, y, x);
+ i = mpf_sgn (x);
+
+ /* Input and Output Functions */
+
+ f = fopen ("/dev/null", "w");
+ if (f != NULL)
+ {
+ mpf_out_str (f, 10, 10, x);
+ fclose (f);
+ }
+
+ mpf_set_prec (x, 15);
+ mpf_set_prec (y, 15);
+ /* We may use src_fopen instead of fopen, but it is defined
+ in mpfr-test, and not in mpfr.h and gmp.h, and we want
+ to test theses includes files. */
+ f = fopen ("inp_str.data", "r");
+ if (f != NULL)
+ {
+ i = mpf_inp_str (x, f, 10);
+ if ((i == 0) || mpf_cmp_ui (x, 31415))
+ {
+ printf ("Error in reading 1st line from file inp_str.data\n");
+ exit (1);
+ }
+ fclose (f);
+ }
+
+ /* Miscellaneous Functions */
+
+ mpf_ceil (y, x);
+ mpf_floor (y, x);
+ mpf_trunc (y, x);
+
+ i = mpf_integer_p (x);
+
+ i = mpf_fits_ulong_p (x);
+ i = mpf_fits_slong_p (x);
+ i = mpf_fits_uint_p (x);
+ i = mpf_fits_sint_p (x);
+ i = mpf_fits_ushort_p (x);
+ i = mpf_fits_sshort_p (x);
+
+ gmp_randinit_lc_2exp_size (state, 128);
+ mpf_urandomb (x, state, 10);
+ gmp_randclear (state);
+
+ /* Conversion to mpz */
+ mpz_init (z);
+ mpf_set_ui (x, 17);
+ mpz_set_f (z, x);
+ mpf_set_z (x, z);
+ mpz_clear (z);
+ if (mpf_cmp_ui (x, 17) != 0)
+ {
+ fprintf (stderr, "Error in conversion to/from mpz\n");
+ fprintf (stderr, "expected 17, got %1.16e\n", mpf_get_d (x));
+ exit (1);
+ }
+
+ /* clear all variables */
+ mpf_clear (y);
+ mpf_clear (x);
+
+ return 0;
+}
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h
new file mode 100644
index 0000000..7252234
--- /dev/null
+++ b/tests/mpfr-test.h
@@ -0,0 +1,173 @@
+/* auxiliary functions for MPFR tests.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef __MPFR_TEST_H__
+#define __MPFR_TEST_H__
+
+#include <stdio.h>
+
+#include "mpfr-impl.h"
+
+/* generates a random long int, a random double,
+ and corresponding seed initializing */
+#define DBL_RAND() ((double) randlimb() / (double) MP_LIMB_T_MAX)
+
+#define MINNORM 2.2250738585072013831e-308 /* 2^(-1022), smallest normalized */
+#define MAXNORM 1.7976931348623157081e308 /* 2^(1023)*(2-2^(-52)) */
+
+/* Generates a random rounding mode */
+#define RND_RAND() ((mpfr_rnd_t) (randlimb() % MPFR_RND_MAX))
+
+/* Generates a random sign */
+#define SIGN_RAND() ( (randlimb()%2) ? MPFR_SIGN_POS : MPFR_SIGN_NEG)
+
+/* Loop for all rounding modes */
+#define RND_LOOP(_r) for((_r) = 0 ; (_r) < MPFR_RND_MAX ; (_r)++)
+
+/* Test whether two floating-point data have the same value,
+ seen as an element of the set of the floating-point data
+ (Level 2 in the IEEE 754-2008 standard). */
+#define SAME_VAL(X,Y) \
+ ((MPFR_IS_NAN (X) && MPFR_IS_NAN (Y)) || \
+ (mpfr_equal_p ((X), (Y)) && MPFR_INT_SIGN (X) == MPFR_INT_SIGN (Y)))
+
+/* The MAX, MIN and ABS macros may already be defined if gmp-impl.h has
+ been included. They have the same semantics as in gmp-impl.h, but the
+ expressions may be slightly different. So, it's better to undefine
+ them first, as required by the ISO C standard. */
+#undef MAX
+#undef MIN
+#undef ABS
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define ABS(x) (((x)>0) ? (x) : -(x))
+
+#define FLIST mpfr_ptr, mpfr_srcptr, mpfr_rnd_t
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+void test_version _MPFR_PROTO ((void));
+
+void tests_memory_start _MPFR_PROTO ((void));
+void tests_memory_end _MPFR_PROTO ((void));
+
+void tests_start_mpfr _MPFR_PROTO ((void));
+void tests_end_mpfr _MPFR_PROTO ((void));
+
+int mpfr_set_machine_rnd_mode _MPFR_PROTO ((mpfr_rnd_t));
+void mpfr_test_init _MPFR_PROTO ((void));
+mp_limb_t randlimb _MPFR_PROTO ((void));
+void randseed _MPFR_PROTO ((unsigned int));
+void mpfr_random2 _MPFR_PROTO ((mpfr_ptr, mp_size_t, mpfr_exp_t, gmp_randstate_t));
+int ulp _MPFR_PROTO ((double, double));
+double dbl _MPFR_PROTO ((double, int));
+double Ulp _MPFR_PROTO ((double));
+int Isnan _MPFR_PROTO ((double));
+void d_trace _MPFR_PROTO ((const char *, double));
+void ld_trace _MPFR_PROTO ((const char *, long double));
+
+FILE *src_fopen _MPFR_PROTO ((const char *, const char *));
+void set_emin _MPFR_PROTO ((mpfr_exp_t));
+void set_emax _MPFR_PROTO ((mpfr_exp_t));
+void tests_default_random _MPFR_PROTO ((mpfr_ptr, int, mpfr_exp_t, mpfr_exp_t));
+void data_check _MPFR_PROTO ((const char *, int (*) (FLIST), const char *));
+void bad_cases _MPFR_PROTO ((int (*)(FLIST), int (*)(FLIST),
+ const char *, int, mpfr_exp_t, mpfr_exp_t,
+ mpfr_prec_t, mpfr_prec_t, mpfr_prec_t, int));
+void flags_out _MPFR_PROTO ((unsigned int));
+
+int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mpfr_rnd_t));
+#define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,MPFR_RNDN)
+#define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,MPFR_RNDN)
+
+#define mpfr_cmp0(x,y) (MPFR_ASSERTN (!MPFR_IS_NAN (x) && !MPFR_IS_NAN (y)), mpfr_cmp (x,y))
+#define mpfr_cmp_ui0(x,i) (MPFR_ASSERTN (!MPFR_IS_NAN (x)), mpfr_cmp_ui (x,i))
+
+#if defined (__cplusplus)
+}
+#endif
+
+/* define CHECK_EXTERNAL if you want to check mpfr against another library
+ with correct rounding. You'll probably have to modify mpfr_print_raw()
+ and/or test_add() below:
+ * mpfr_print_raw() prints each number as "p m e" where p is the precision,
+ m the mantissa (as a binary integer with sign), and e the exponent.
+ The corresponding number is m*2^e. Example: "2 10 -6" represents
+ 2*2^(-6) with a precision of 2 bits.
+ * test_add() outputs "b c a" on one line, for each addition a <- b + c.
+ Currently it only prints such a line for rounding to nearest, when
+ the inputs b and c are not NaN and/or Inf.
+*/
+#ifdef CHECK_EXTERNAL
+static void
+mpfr_print_raw (mpfr_srcptr x)
+{
+ printf ("%lu ", MPFR_PREC (x));
+ if (MPFR_IS_NAN (x))
+ {
+ printf ("@NaN@");
+ return;
+ }
+
+ if (MPFR_SIGN (x) < 0)
+ printf ("-");
+
+ if (MPFR_IS_INF (x))
+ printf ("@Inf@");
+ else if (MPFR_IS_ZERO (x))
+ printf ("0 0");
+ else
+ {
+ mp_limb_t *mx;
+ mpfr_prec_t px;
+ mp_size_t n;
+
+ mx = MPFR_MANT (x);
+ px = MPFR_PREC (x);
+
+ for (n = (px - 1) / GMP_NUMB_BITS; ; n--)
+ {
+ mp_limb_t wd, t;
+
+ MPFR_ASSERTN (n >= 0);
+ wd = mx[n];
+ for (t = MPFR_LIMB_HIGHBIT; t != 0; t >>= 1)
+ {
+ printf ((wd & t) == 0 ? "0" : "1");
+ if (--px == 0)
+ {
+ mpfr_exp_t ex;
+
+ ex = MPFR_GET_EXP (x);
+ MPFR_ASSERTN (ex >= LONG_MIN && ex <= LONG_MAX);
+ printf (" %ld", (long) ex - (long) MPFR_PREC (x));
+ return;
+ }
+ }
+ }
+ }
+}
+#endif
+
+#endif
diff --git a/tests/mpfr_compat.c b/tests/mpfr_compat.c
new file mode 100644
index 0000000..7006db8
--- /dev/null
+++ b/tests/mpfr_compat.c
@@ -0,0 +1,25 @@
+/* Test compatibility mpf-mpfr.
+
+Copyright 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR
+#define mpf_free_str mpfr_free_str
+#include "mpf_compat.h"
diff --git a/tests/random2.c b/tests/random2.c
new file mode 100644
index 0000000..35e5f12
--- /dev/null
+++ b/tests/random2.c
@@ -0,0 +1,144 @@
+/* mpfr_random2 -- Generate a positive random mpfr_t of specified size, with
+ long runs of consecutive ones and zeros in the binary representation.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-test.h"
+
+#define LOGBITS_PER_BLOCK 4
+#if GMP_NUMB_BITS < 32
+#define BITS_PER_RANDCALL GMP_NUMB_BITS
+#else
+#define BITS_PER_RANDCALL 32
+#endif
+
+void
+mpfr_random2 (mpfr_ptr x, mp_size_t size, mpfr_exp_t exp,
+ gmp_randstate_t rstate)
+{
+ mp_size_t xn, k, ri;
+ unsigned long sh;
+ mp_limb_t *xp;
+ mp_limb_t elimb, ran, acc;
+ int ran_nbits, bit_pos, nb;
+
+ if (MPFR_UNLIKELY(size == 0))
+ {
+ MPFR_SET_ZERO (x);
+ MPFR_SET_POS (x);
+ return ;
+ }
+ else if (size > 0)
+ {
+ MPFR_SET_POS (x);
+ }
+ else
+ {
+ MPFR_SET_NEG (x);
+ size = -size;
+ }
+
+ xn = MPFR_LIMB_SIZE (x);
+ xp = MPFR_MANT (x);
+ if (size > xn)
+ size = xn;
+ k = xn - size;
+
+ /* Code extracted from GMP, function mpn_random2, to avoid the use
+ of GMP's internal random state in MPFR */
+
+ mpfr_rand_raw (&elimb, rstate, BITS_PER_RANDCALL);
+ ran = elimb;
+
+ /* Start off at a random bit position in the most significant limb. */
+ bit_pos = GMP_NUMB_BITS - 1;
+ ran >>= 6; /* Ideally log2(GMP_NUMB_BITS) */
+ ran_nbits = BITS_PER_RANDCALL - 6; /* Ideally - log2(GMP_NUMB_BITS) */
+
+ /* Bit 0 of ran chooses string of ones/string of zeroes.
+ Make most significant limb be non-zero by setting bit 0 of RAN. */
+ ran |= 1;
+ ri = xn - 1;
+
+ acc = 0;
+ while (ri >= k)
+ {
+ if (ran_nbits < LOGBITS_PER_BLOCK + 1)
+ {
+ mpfr_rand_raw (&elimb, rstate, BITS_PER_RANDCALL);
+ ran = elimb;
+ ran_nbits = BITS_PER_RANDCALL;
+ }
+
+ nb = (ran >> 1) % (1 << LOGBITS_PER_BLOCK) + 1;
+ if ((ran & 1) != 0)
+ {
+ /* Generate a string of nb ones. */
+ if (nb > bit_pos)
+ {
+ xp[ri--] = acc | (((mp_limb_t) 2 << bit_pos) - 1);
+ bit_pos += GMP_NUMB_BITS;
+ bit_pos -= nb;
+ acc = ((~(mp_limb_t) 1) << bit_pos) & GMP_NUMB_MASK;
+ }
+ else
+ {
+ bit_pos -= nb;
+ acc |= (((mp_limb_t) 2 << nb) - 2) << bit_pos;
+ }
+ }
+ else
+ {
+ /* Generate a string of nb zeroes. */
+ if (nb > bit_pos)
+ {
+ xp[ri--] = acc;
+ acc = 0;
+ bit_pos += GMP_NUMB_BITS;
+ }
+ bit_pos -= nb;
+ }
+ ran_nbits -= LOGBITS_PER_BLOCK + 1;
+ ran >>= LOGBITS_PER_BLOCK + 1;
+ }
+
+ /* Set mandatory most significant bit. */
+ /* xp[xn - 1] |= MPFR_LIMB_HIGHBIT; */
+
+ if (k != 0)
+ {
+ /* Clear last limbs */
+ MPN_ZERO (xp, k);
+ }
+ else
+ {
+ /* Mask off non significant bits in the low limb. */
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (x));
+ xp[0] &= ~MPFR_LIMB_MASK (sh);
+ }
+
+ /* Generate random exponent. */
+ mpfr_rand_raw (&elimb, RANDS, GMP_NUMB_BITS);
+ exp = ABS (exp);
+ MPFR_SET_EXP (x, elimb % (2 * exp + 1) - exp);
+
+ return ;
+}
diff --git a/tests/reuse.c b/tests/reuse.c
new file mode 100644
index 0000000..4c32260
--- /dev/null
+++ b/tests/reuse.c
@@ -0,0 +1,685 @@
+/* Test file for in-place operations.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); }
+#define DISP2(s,t) {DISP(s,t); putchar('\n');}
+
+#define SPECIAL_MAX 12
+
+static void
+set_special (mpfr_ptr x, unsigned int select)
+{
+ MPFR_ASSERTN (select < SPECIAL_MAX);
+ switch (select)
+ {
+ case 0:
+ MPFR_SET_NAN (x);
+ break;
+ case 1:
+ MPFR_SET_INF (x);
+ MPFR_SET_POS (x);
+ break;
+ case 2:
+ MPFR_SET_INF (x);
+ MPFR_SET_NEG (x);
+ break;
+ case 3:
+ MPFR_SET_ZERO (x);
+ MPFR_SET_POS (x);
+ break;
+ case 4:
+ MPFR_SET_ZERO (x);
+ MPFR_SET_NEG (x);
+ break;
+ case 5:
+ mpfr_set_str_binary (x, "1");
+ break;
+ case 6:
+ mpfr_set_str_binary (x, "-1");
+ break;
+ case 7:
+ mpfr_set_str_binary (x, "1e-1");
+ break;
+ case 8:
+ mpfr_set_str_binary (x, "1e+1");
+ break;
+ case 9:
+ mpfr_const_pi (x, MPFR_RNDN);
+ break;
+ case 10:
+ mpfr_const_pi (x, MPFR_RNDN);
+ MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1);
+ break;
+ default:
+ mpfr_urandomb (x, RANDS);
+ if (randlimb () & 1)
+ mpfr_neg (x, x, MPFR_RNDN);
+ break;
+ }
+}
+/* same than mpfr_cmp, but returns 0 for both NaN's */
+static int
+mpfr_compare (mpfr_srcptr a, mpfr_srcptr b)
+{
+ return (MPFR_IS_NAN(a)) ? !MPFR_IS_NAN(b) :
+ (MPFR_IS_NAN(b) || mpfr_cmp(a, b));
+}
+
+static void
+test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t ref1, ref2, ref3;
+ mpfr_t res1;
+ int i;
+
+#ifdef DEBUG
+ printf("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref1, prec);
+ mpfr_init2 (ref2, prec);
+ mpfr_init2 (ref3, prec);
+ mpfr_init2 (res1, prec);
+
+ /* for each variable, consider each of the following 6 possibilities:
+ NaN, +Infinity, -Infinity, +0, -0 or a random number */
+ for (i=0; i < SPECIAL_MAX*SPECIAL_MAX ; i++)
+ {
+ set_special (ref2, i%SPECIAL_MAX);
+ set_special (ref3, i/SPECIAL_MAX);
+
+ /* reference call: foo(a, b, c) */
+ testfunc (ref1, ref2, ref3, rnd);
+
+ /* foo(a, a, c) */
+ mpfr_set (res1, ref2, rnd); /* exact operation */
+ testfunc (res1, res1, ref3, rnd);
+
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, a, c) for ", foo);
+ DISP("a=",ref2); DISP2(", c=",ref3);
+ printf ("expected "); mpfr_print_binary (ref1); puts ("");
+ printf ("got "); mpfr_print_binary (res1); puts ("");
+ exit (1);
+ }
+
+ /* foo(a, b, a) */
+ mpfr_set (res1, ref3, rnd);
+ testfunc (res1, ref2, res1, rnd);
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, b, a) for ", foo);
+ DISP("b=",ref2); DISP2(", a=", ref3);
+ DISP("expected ", ref1); DISP2(", got ",res1);
+ exit (1);
+ }
+
+ /* foo(a, a, a) */
+ mpfr_set (ref3, ref2, rnd);
+ testfunc (ref1, ref2, ref3, rnd);
+ mpfr_set (res1, ref2, rnd);
+ testfunc (res1, res1, res1, rnd);
+
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, a, a) for ", foo);
+ DISP2("a=",ref2);
+ DISP("expected ", ref1); DISP2(", got", res1);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (ref3);
+ mpfr_clear (res1);
+}
+
+static void
+test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t),
+ const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t ref, op1, op2, op3;
+ mpfr_t res;
+ int i, j, k;
+
+#ifdef DEBUG
+ printf("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref, prec);
+ mpfr_init2 (op1, prec);
+ mpfr_init2 (op2, prec);
+ mpfr_init2 (op3, prec);
+ mpfr_init2 (res, prec);
+
+ /* for each variable, consider each of the following 6 possibilities:
+ NaN, +Infinity, -Infinity, +0, -0 or a random number */
+
+ for (i=0; i<SPECIAL_MAX; i++)
+ {
+ set_special (op1, i);
+ for (j=0; j<SPECIAL_MAX; j++)
+ {
+ set_special (op2, j);
+ for (k=0; k<SPECIAL_MAX; k++)
+ {
+ set_special (op3, k);
+
+ /* reference call: foo(s, a, b, c) */
+ testfunc (ref, op1, op2, op3, rnd);
+
+ /* foo(a, a, b, c) */
+ mpfr_set (res, op1, rnd); /* exact operation */
+ testfunc (res, res, op2, op3, rnd);
+
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, b, c) for ", foo);
+ DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+
+ /* foo(b, a, b, c) */
+ mpfr_set (res, op2, rnd);
+ testfunc (res, op1, res, op3, rnd);
+
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, b, c) for ", foo);
+ DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+
+ /* foo(c, a, b, c) */
+ mpfr_set (res, op3, rnd);
+ testfunc (res, op1, op2, res, rnd);
+
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, b, c) for ", foo);
+ DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+
+ /* foo(a, a, a,c) */
+ testfunc (ref, op1, op1, op3, rnd);
+ mpfr_set (res, op1, rnd);
+ testfunc (res, res, res, op3, rnd);
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, b, c) for ", foo);
+ DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+
+ /* foo(a, a, b,a) */
+ testfunc (ref, op1, op2, op1, rnd);
+ mpfr_set (res, op1, rnd);
+ testfunc (res, res, op2, res, rnd);
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, b, c) for ", foo);
+ DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+
+ /* foo(b, a, b, b) */
+ testfunc (ref, op1, op2, op2, rnd);
+ mpfr_set (res, op2, rnd);
+ testfunc (res, op1, res, res, rnd);
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, b, c) for ", foo);
+ DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+
+ /* foo (a, a, a, a) */
+ testfunc (ref, op1, op1, op1 ,rnd);
+ mpfr_set (res, op1, rnd);
+ testfunc (res, res, res, res, rnd);
+ if (mpfr_compare (res, ref))
+ {
+ printf ("Error for %s(a, a, a, a) for ", foo);
+ DISP2("a=", op1);
+ DISP("expected ", ref); DISP2(", got", res);
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (ref);
+ mpfr_clear (op1);
+ mpfr_clear (op2);
+ mpfr_clear (op3);
+ mpfr_clear (res);
+
+}
+
+static void
+test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t),
+ const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t ref1, ref2;
+ unsigned int ref3;
+ mpfr_t res1;
+ int i;
+
+#ifdef DEBUG
+ printf("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref1, prec);
+ mpfr_init2 (ref2, prec);
+ mpfr_init2 (res1, prec);
+
+ /* ref2 can be NaN, +Inf, -Inf, +0, -0 or any number
+ ref3 can be 0 or any number */
+ for (i=0; i<SPECIAL_MAX*2; i++)
+ {
+ set_special (ref2, i%SPECIAL_MAX);
+ ref3 = i/SPECIAL_MAX == 0 ? 0 : randlimb ();
+
+ /* reference call: foo(a, b, c) */
+ testfunc (ref1, ref2, ref3, rnd);
+
+ /* foo(a, a, c) */
+ mpfr_set (res1, ref2, rnd); /* exact operation */
+ testfunc (res1, res1, ref3, rnd);
+
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, a, c) for c=%u\n", foo, ref3);
+ DISP2("a=",ref2);
+ printf ("expected "); mpfr_print_binary (ref1); puts ("");
+ printf ("got "); mpfr_print_binary (res1); puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (res1);
+}
+
+static void
+testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t ref1, ref3;
+ unsigned int ref2;
+ mpfr_t res1;
+ int i;
+
+#ifdef DEBUG
+ printf("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref1, prec);
+ mpfr_init2 (ref3, prec);
+ mpfr_init2 (res1, prec);
+
+ for (i=0; i<SPECIAL_MAX*2; i++)
+ {
+ set_special (ref3, i%SPECIAL_MAX);
+ ref2 = i/SPECIAL_MAX==0 ? 0 : randlimb ();
+
+ /* reference call: foo(a, b, c) */
+ testfunc (ref1, ref2, ref3, rnd);
+
+ /* foo(a, b, a) */
+ mpfr_set (res1, ref3, rnd); /* exact operation */
+ testfunc (res1, ref2, res1, rnd);
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, b, a) for b=%u \n", foo, ref2);
+ DISP2("a=", ref3);
+ DISP("expected", ref1); DISP2(", got ", res1);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref3);
+ mpfr_clear (res1);
+}
+
+/* foo(mpfr_ptr, mpfr_srcptr, mp_rndt) */
+static void
+test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t ref1, ref2;
+ mpfr_t res1;
+ int i;
+
+#ifdef DEBUG
+ printf("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref1, prec);
+ mpfr_init2 (ref2, prec);
+ mpfr_init2 (res1, prec);
+
+ for (i=0; i<SPECIAL_MAX; i++)
+ {
+ set_special (ref2, i);
+
+ /* reference call: foo(a, b) */
+ testfunc (ref1, ref2, rnd);
+
+ /* foo(a, a) */
+ mpfr_set (res1, ref2, rnd); /* exact operation */
+ testfunc (res1, res1, rnd);
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, a) for ", foo);
+ DISP2("a=", ref2);
+ DISP("expected", ref1); DISP2(", got ", res1);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (res1);
+}
+
+/* foo(mpfr_ptr, mpfr_srcptr) */
+static void
+test2a (int (*testfunc)(mpfr_ptr, mpfr_srcptr),
+ const char *foo, mpfr_prec_t prec)
+{
+ mpfr_t ref1, ref2;
+ mpfr_t res1;
+ int i;
+
+#ifdef DEBUG
+ printf ("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref1, prec);
+ mpfr_init2 (ref2, prec);
+ mpfr_init2 (res1, prec);
+
+ for (i=0; i<SPECIAL_MAX; i++)
+ {
+ set_special (ref2, i);
+
+ /* reference call: foo(a, b) */
+ testfunc (ref1, ref2);
+
+ /* foo(a, a) */
+ mpfr_set (res1, ref2, MPFR_RNDN); /* exact operation */
+ testfunc (res1, res1);
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for %s(a, a) for ", foo);
+ DISP2("a=",ref2);
+ DISP("expected", ref1); DISP2(", got ", res1);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (res1);
+}
+
+/* one operand, two results */
+static void
+test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t ref1, ref2, ref3;
+ mpfr_t res1, res2;
+ int i;
+
+#ifdef DEBUG
+ printf ("checking %s\n", foo);
+#endif
+ mpfr_init2 (ref1, prec);
+ mpfr_init2 (ref2, prec);
+ mpfr_init2 (ref3, prec);
+ mpfr_init2 (res1, prec);
+ mpfr_init2 (res2, prec);
+
+ for (i=0; i<SPECIAL_MAX; i++)
+ {
+ set_special (ref3, i);
+
+ /* reference call: foo(a, b, c) */
+ testfunc (ref1, ref2, ref3, rnd);
+
+ /* foo(a, b, a) */
+ mpfr_set (res1, ref3, rnd); /* exact operation */
+ testfunc (res1, res2, res1, rnd);
+ if (mpfr_compare (res1, ref1) || mpfr_compare (res2, ref2))
+ {
+ printf ("Error for %s(a, b, a) for rnd=%s, ", foo,
+ mpfr_print_rnd_mode (rnd));
+ DISP2("a=",ref3);
+ DISP("expected (", ref1); DISP(",",ref2);
+ DISP("), got (", res1); DISP(",", res2); printf(")\n");
+ exit (1);
+ }
+
+ /* foo(a, b, b) */
+ mpfr_set (res2, ref3, rnd); /* exact operation */
+ testfunc (res1, res2, res2, rnd);
+ if (mpfr_compare (res1, ref1) || mpfr_compare (res2, ref2))
+ {
+ printf ("Error for %s(a, b, b) for ", foo);
+ DISP2("b=",ref3);
+ DISP("expected (", ref1); DISP(",",ref2);
+ DISP("), got (", res1); DISP(",", res2); printf(")\n");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (ref3);
+ mpfr_clear (res1);
+ mpfr_clear (res2);
+}
+
+static int
+reldiff_wrapper (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ mpfr_reldiff (a, b, c, rnd_mode);
+ return 0;
+}
+
+static void
+pow_int (mpfr_rnd_t rnd)
+{
+ mpfr_t ref1, ref2, ref3;
+ mpfr_t res1;
+ int i;
+
+#ifdef DEBUG
+ printf("pow_int\n");
+#endif
+ mpfr_inits2 ((randlimb () % 200) + MPFR_PREC_MIN,
+ ref1, ref2, res1, (mpfr_ptr) 0);
+ mpfr_init2 (ref3, 1005);
+
+ for (i = 0; i <= 15; i++)
+ {
+ mpfr_urandomb (ref2, RANDS);
+ if (i & 1)
+ mpfr_neg (ref2, ref2, MPFR_RNDN);
+ mpfr_set_ui (ref3, 20, MPFR_RNDN);
+ /* We need to test huge integers because different algorithms/codes
+ are used for not-too-large integers (mpfr_pow_z) and for general
+ cases, in particular huge integers (mpfr_pow_general). [r7606] */
+ if (i & 2)
+ mpfr_mul_2ui (ref3, ref3, 1000, MPFR_RNDN);
+ if (i & 4)
+ mpfr_add_ui (ref3, ref3, 1, MPFR_RNDN); /* odd integer */
+
+ /* reference call: pow(a, b, c) */
+ mpfr_pow (ref1, ref2, ref3, rnd);
+
+ /* pow(a, a, c) */
+ mpfr_set (res1, ref2, rnd); /* exact operation */
+ mpfr_pow (res1, res1, ref3, rnd);
+
+ if (mpfr_compare (res1, ref1))
+ {
+ printf ("Error for pow_int(a, a, c) for ");
+ DISP("a=",ref2); DISP2(", c=",ref3);
+ printf ("expected "); mpfr_print_binary (ref1); puts ("");
+ printf ("got "); mpfr_print_binary (res1); puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clears (ref1, ref2, ref3, res1, (mpfr_ptr) 0);
+}
+
+int
+main (void)
+{
+ int rnd;
+ mpfr_prec_t p;
+ tests_start_mpfr ();
+
+ p = (randlimb () % 200) + MPFR_PREC_MIN;
+ RND_LOOP (rnd)
+ {
+ test2a (mpfr_round, "mpfr_round", p);
+ test2a (mpfr_ceil, "mpfr_ceil", p);
+ test2a (mpfr_floor, "mpfr_floor", p);
+ test2a (mpfr_trunc, "mpfr_trunc", p);
+
+ test2ui (mpfr_add_ui, "mpfr_add_ui", p, (mpfr_rnd_t) rnd);
+ test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, (mpfr_rnd_t) rnd);
+ test2ui (mpfr_div_ui, "mpfr_div_ui", p, (mpfr_rnd_t) rnd);
+ test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, (mpfr_rnd_t) rnd);
+ test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, (mpfr_rnd_t) rnd);
+ test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, (mpfr_rnd_t) rnd);
+ test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, (mpfr_rnd_t) rnd);
+
+ testui2 (mpfr_ui_div, "mpfr_ui_div", p, (mpfr_rnd_t) rnd);
+ testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, (mpfr_rnd_t) rnd);
+ testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_sqr, "mpfr_sqr", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_sqrt, "mpfr_sqrt", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_abs, "mpfr_abs", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_neg, "mpfr_neg", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_log, "mpfr_log", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_log2, "mpfr_log2", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_log10, "mpfr_log10", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_log1p, "mpfr_log1p", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_exp, "mpfr_exp", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_exp2, "mpfr_exp2", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_exp10, "mpfr_exp10", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_expm1, "mpfr_expm1", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_eint, "mpfr_eint", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_sinh, "mpfr_sinh", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_cosh, "mpfr_cosh", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_tanh, "mpfr_tanh", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_asinh, "mpfr_asinh", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_acosh, "mpfr_acosh", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_atanh, "mpfr_atanh", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_sech, "mpfr_sech", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_csch, "mpfr_csch", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_coth, "mpfr_coth", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_asin, "mpfr_asin", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_acos, "mpfr_acos", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_atan, "mpfr_atan", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_cos, "mpfr_cos", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_sin, "mpfr_sin", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_tan, "mpfr_tan", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_sec, "mpfr_sec", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_csc, "mpfr_csc", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_cot, "mpfr_cot", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_erf, "mpfr_erf", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_erfc, "mpfr_erfc", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_j0, "mpfr_j0", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_j1, "mpfr_j1", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_y0, "mpfr_y0", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_y1, "mpfr_y1", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_zeta, "mpfr_zeta", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_gamma, "mpfr_gamma", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_lngamma, "mpfr_lngamma", p, (mpfr_rnd_t) rnd);
+
+ test2 (mpfr_rint, "mpfr_rint", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_rint_floor, "mpfr_rint_floor", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_rint_round, "mpfr_rint_round", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_frac, "mpfr_frac", p, (mpfr_rnd_t) rnd);
+
+ test3 (mpfr_add, "mpfr_add", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_sub, "mpfr_sub", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_mul, "mpfr_mul", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_div, "mpfr_div", p, (mpfr_rnd_t) rnd);
+
+ test3 (mpfr_agm, "mpfr_agm", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_min, "mpfr_min", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_max, "mpfr_max", p, (mpfr_rnd_t) rnd);
+
+ test3 (reldiff_wrapper, "mpfr_reldiff", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_dim, "mpfr_dim", p, (mpfr_rnd_t) rnd);
+
+ test3 (mpfr_remainder, "mpfr_remainder", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_pow, "mpfr_pow", p, (mpfr_rnd_t) rnd);
+ pow_int ((mpfr_rnd_t) rnd);
+ test3 (mpfr_atan2, "mpfr_atan2", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_hypot, "mpfr_hypot", p, (mpfr_rnd_t) rnd);
+
+ test3a (mpfr_sin_cos, "mpfr_sin_cos", p, (mpfr_rnd_t) rnd);
+
+ test4 (mpfr_fma, "mpfr_fma", p, (mpfr_rnd_t) rnd);
+ test4 (mpfr_fms, "mpfr_fms", p, (mpfr_rnd_t) rnd);
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+ test2 (mpfr_li2, "mpfr_li2", p, (mpfr_rnd_t) rnd);
+ test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, (mpfr_rnd_t) rnd);
+ test3 (mpfr_fmod, "mpfr_fmod", p, (mpfr_rnd_t) rnd);
+ test3a (mpfr_modf, "mpfr_modf", p, (mpfr_rnd_t) rnd);
+ test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, (mpfr_rnd_t) rnd);
+#endif
+ }
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/rnd_mode.c b/tests/rnd_mode.c
new file mode 100644
index 0000000..a25fad8
--- /dev/null
+++ b/tests/rnd_mode.c
@@ -0,0 +1,70 @@
+/* mpfr_set_machine_rnd_mode -- set the rounding mode for machine floats
+
+Copyright 1999, 2001, 2002, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-test.h"
+
+/* It is important to test each FE_* macro -- see the ISO C99 standard.
+ For instance, with some ARM implementations, only FE_TONEAREST may
+ be defined. */
+
+/* sets the machine rounding mode to the value rnd_mode */
+int
+mpfr_set_machine_rnd_mode (mpfr_rnd_t rnd_mode)
+{
+ switch (rnd_mode)
+ {
+ case MPFR_RNDN:
+ return
+#if defined (MPFR_HAVE_FESETROUND) && defined (FE_TONEAREST)
+ fesetround(FE_TONEAREST)
+#else
+ -1
+#endif
+ ;
+ case MPFR_RNDZ:
+ return
+#if defined (MPFR_HAVE_FESETROUND) && defined (FE_TOWARDZERO)
+ fesetround(FE_TOWARDZERO)
+#else
+ -1
+#endif
+ ;
+ case MPFR_RNDU:
+ return
+#if defined (MPFR_HAVE_FESETROUND) && defined (FE_UPWARD)
+ fesetround(FE_UPWARD)
+#else
+ -1
+#endif
+ ;
+ case MPFR_RNDD:
+ return
+#if defined (MPFR_HAVE_FESETROUND) && defined (FE_DOWNWARD)
+ fesetround(FE_DOWNWARD)
+#else
+ -1
+#endif
+ ;
+ default:
+ return -1;
+ }
+}
diff --git a/tests/tabs.c b/tests/tabs.c
new file mode 100644
index 0000000..fcd6933
--- /dev/null
+++ b/tests/tabs.c
@@ -0,0 +1,176 @@
+/* Test file for mpfr_abs.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+static void
+check_inexact (void)
+{
+ mpfr_prec_t p, q;
+ mpfr_t x, y, absx;
+ int rnd;
+ int inexact, cmp;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (absx);
+
+ for (p=2; p<500; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (absx, p);
+ mpfr_urandomb (x, RANDS);
+ if (randlimb () % 2)
+ {
+ mpfr_set (absx, x, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ }
+ else
+ mpfr_set (absx, x, MPFR_RNDN);
+ for (q=2; q<2*p; q++)
+ {
+ mpfr_set_prec (y, q);
+ RND_LOOP (rnd)
+ {
+ inexact = mpfr_abs (y, x, (mpfr_rnd_t) rnd);
+ cmp = mpfr_cmp (y, absx);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong inexact flag: expected %d, got %d\n",
+ cmp, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("absx="); mpfr_print_binary (absx); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (absx);
+}
+
+static void
+check_cmp (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ int n, k;
+
+ mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
+
+ mpfr_set_ui(x, 1, MPFR_RNDN);
+ (mpfr_abs) (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_abs(1.0)\n");
+ exit (1);
+ }
+
+ mpfr_set_si(x, -1, MPFR_RNDN);
+ mpfr_abs(x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_abs(1.0)\n");
+ exit (1);
+ }
+
+ mpfr_set_si(x, -1, MPFR_RNDN);
+ mpfr_abs(x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_abs(-1.0)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_abs (x, x, MPFR_RNDN);
+ if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0))
+ {
+ printf ("Error in mpfr_abs(Inf).\n");
+ exit (1);
+ }
+ mpfr_set_inf (x, -1);
+ mpfr_abs (x, x, MPFR_RNDN);
+ if (!mpfr_inf_p(x) || (mpfr_sgn(x) <= 0))
+ {
+ printf ("Error in mpfr_abs(-Inf).\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_abs (x, x, MPFR_RNDN);
+ if (!MPFR_IS_NAN(x))
+ {
+ printf ("Error in mpfr_abs(NAN).\n");
+ exit (1);
+ }
+
+ n = (argc==1) ? 25000 : atoi(argv[1]);
+ for (k = 1; k <= n; k++)
+ {
+ mpfr_rnd_t rnd;
+ int sign = SIGN_RAND ();
+
+ mpfr_urandomb (x, RANDS);
+ MPFR_SET_SIGN (x, sign);
+ rnd = RND_RAND ();
+ mpfr_abs (y, x, rnd);
+ MPFR_SET_POS (x);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Mismatch for sign=%d and x=", sign);
+ mpfr_print_binary (x);
+ printf ("\nResults=");
+ mpfr_print_binary (y);
+ putchar ('\n');
+ exit (1);
+ }
+ }
+
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+#define TEST_FUNCTION mpfr_abs
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_test_init ();
+ tests_start_mpfr ();
+
+ check_inexact ();
+ check_cmp (argc, argv);
+
+ test_generic (2, 1000, 10);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tacos.c b/tests/tacos.c
new file mode 100644
index 0000000..ddb518b
--- /dev/null
+++ b/tests/tacos.c
@@ -0,0 +1,187 @@
+/* Test file for mpfr_acos.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_acos
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex1, inex2;
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 32);
+
+ mpfr_set_str_binary (x, "0.10001000001001011000100001E-6");
+ mpfr_acos (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "1.10001111111111110001110110001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_acos (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-0.01101011110111100111010011001011");
+ mpfr_acos (y, x, MPFR_RNDZ);
+ mpfr_set_str_binary (x, "10.0000000101111000011101000101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_acos (2)\n");
+ mpfr_print_binary (y); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex1 = mpfr_acos (x, x, MPFR_RNDN); /* Pi/2 */
+ inex2 = mpfr_const_pi (x, MPFR_RNDN);
+ if (inex1 != inex2)
+ {
+ printf ("Error in mpfr_acos (3) for prec=2\n");
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 48);
+ mpfr_set_str_binary (x, "0.101100100000000000110100E0");
+ mpfr_acos (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.110011010100101111000100111010111011010000001001E0",
+ 2, MPFR_RNDN))
+ {
+ printf("Special Overflow error.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_clear (y);
+ mpfr_clear (x);
+ set_emin (emin);
+ set_emax (emax);
+}
+
+int
+main (void)
+{
+ mpfr_t x, y;
+ int r;
+
+ tests_start_mpfr ();
+
+ special_overflow ();
+ special ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ MPFR_SET_NAN(x);
+ mpfr_acos (y, x, MPFR_RNDN);
+ if (mpfr_nan_p(y) == 0)
+ {
+ printf ("Error: acos(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
+ if (mpfr_nan_p(y) == 0)
+ {
+ printf ("Error: acos(2) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -2, MPFR_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
+ if (mpfr_nan_p(y) == 0)
+ {
+ printf ("Error: acos(-2) != NaN\n");
+ exit (1);
+ }
+
+ /* acos (1) = 0 */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_acos (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: acos(1) != +0.0\n");
+ exit (1);
+ }
+
+ /* acos (0) = Pi/2 */
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* exact */
+ mpfr_acos (y, x, (mpfr_rnd_t) r);
+ mpfr_const_pi (x, (mpfr_rnd_t) r);
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: acos(0) != Pi/2 for rnd=%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ /* acos (-1) = Pi */
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ mpfr_set_si (x, -1, MPFR_RNDN); /* exact */
+ mpfr_acos (y, x, (mpfr_rnd_t) r);
+ mpfr_const_pi (x, (mpfr_rnd_t) r);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: acos(1) != Pi for rnd=%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ test_generic (2, 100, 7);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ data_check ("data/acos", mpfr_acos, "mpfr_acos");
+ bad_cases (mpfr_acos, mpfr_cos, "mpfr_acos", 0, -40, 2, 4, 128, 800, 30);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tacosh.c b/tests/tacosh.c
new file mode 100644
index 0000000..17bedca
--- /dev/null
+++ b/tests/tacosh.c
@@ -0,0 +1,219 @@
+/* Test file for mpfr_acosh.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_acosh
+#define TEST_RANDOM_POS 4
+#define TEST_RANDOM_EMIN 1
+#include "tgeneric.c"
+
+#define TEST_FUNCTION mpfr_acosh
+#define TEST_RANDOM_POS 1
+#define TEST_RANDOM_EMIN MPFR_EMAX_MAX
+#define TEST_RANDOM_EMAX MPFR_EMAX_MAX
+#define test_generic test_generic_huge
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ MPFR_SET_INF(x);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_acosh (x, y, MPFR_RNDN);
+ if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
+ {
+ printf ("Inf flag not clears in acosh!\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, 0))
+ {
+ printf ("Error: mpfr_acosh(1) <> 0\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_acosh (x, y, MPFR_RNDN);
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x) )
+ {
+ printf ("NAN flag not clears in acosh!\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_acosh(0) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_acosh(-1) <> NaN\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_acosh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_acosh(NaN) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_acosh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: mpfr_acosh(+Inf) <> +Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_acosh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_acosh(-Inf) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN);
+ mpfr_acosh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_acosh(1/2) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "1.000001101011101111001011");
+ mpfr_acosh (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.111010100101101001010001101001E-2");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_acosh (1)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* With MPFR 2.3.0, this yields an assertion failure in mpfr_acosh. */
+static void
+bug20070831 (void)
+{
+ mpfr_t x, y, z;
+ int inex;
+
+ mpfr_init2 (x, 256);
+ mpfr_init2 (y, 32);
+ mpfr_init2 (z, 32);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_nextabove (x);
+ inex = mpfr_acosh (y, x, MPFR_RNDZ);
+ mpfr_set_ui_2exp (z, 1, -127, MPFR_RNDN);
+ mpfr_nextbelow (z);
+ if (!mpfr_equal_p (y, z))
+ {
+ printf ("Error in bug20070831 (1):\nexpected ");
+ mpfr_dump (z);
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ MPFR_ASSERTN (inex < 0);
+
+ mpfr_nextabove (x);
+ mpfr_set_prec (y, 29);
+ inex = mpfr_acosh (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (z, "1.011010100000100111100110011E-127");
+ if (!mpfr_equal_p (y, z))
+ {
+ printf ("Error in bug20070831 (2):\nexpected ");
+ mpfr_dump (z);
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ MPFR_ASSERTN (inex < 0);
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static void
+huge (void)
+{
+ mpfr_t x, y, z;
+ int inex;
+
+ /* TODO: extend the exponent range and use mpfr_get_emax (). */
+ mpfr_inits2 (32, x, y, z, (mpfr_ptr) 0);
+ mpfr_set_ui_2exp (x, 1, 1073741822, MPFR_RNDN);
+ inex = mpfr_acosh (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.10110001011100100001011111110101E30");
+ if (!mpfr_equal_p (y, z))
+ {
+ printf ("Error in huge:\nexpected ");
+ mpfr_dump (z);
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ MPFR_ASSERTN (inex < 0);
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+ bug20070831 ();
+ huge ();
+
+ test_generic (2, 100, 25);
+ test_generic_huge (2, 100, 5);
+
+ data_check ("data/acosh", mpfr_acosh, "mpfr_acosh");
+ bad_cases (mpfr_acosh, mpfr_cosh, "mpfr_acosh", 0, -128, 29,
+ 4, 128, 800, 40);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tadd.c b/tests/tadd.c
new file mode 100644
index 0000000..7eb5a61
--- /dev/null
+++ b/tests/tadd.c
@@ -0,0 +1,1120 @@
+/* Test file for mpfr_add and mpfr_sub.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define N 30000
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+/* If the precisions are the same, we want to test both mpfr_add1sp
+ and mpfr_add1. */
+
+static int usesp;
+
+static int
+test_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int res;
+#ifdef CHECK_EXTERNAL
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ printf (" ");
+ mpfr_print_raw (c);
+ }
+#endif
+ if (usesp || MPFR_ARE_SINGULAR(b,c) || MPFR_SIGN(b) != MPFR_SIGN(c))
+ res = mpfr_add (a, b, c, rnd_mode);
+ else
+ {
+ if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
+ res = mpfr_add1(a, c, b, rnd_mode);
+ else
+ res = mpfr_add1(a, b, c, rnd_mode);
+ }
+#ifdef CHECK_EXTERNAL
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+#endif
+ return res;
+}
+
+/* checks that xs+ys gives the expected result zs */
+static void
+check (const char *xs, const char *ys, mpfr_rnd_t rnd_mode,
+ unsigned int px, unsigned int py, unsigned int pz, const char *zs)
+{
+ mpfr_t xx,yy,zz;
+
+ mpfr_init2 (xx, px);
+ mpfr_init2 (yy, py);
+ mpfr_init2 (zz, pz);
+
+ mpfr_set_str1 (xx, xs);
+ mpfr_set_str1 (yy, ys);
+ test_add (zz, xx, yy, rnd_mode);
+ if (mpfr_cmp_str1 (zz, zs) )
+ {
+ printf ("expected sum is %s, got ", zs);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
+ printf ("mpfr_add failed for x=%s y=%s with rnd_mode=%s\n",
+ xs, ys, mpfr_print_rnd_mode (rnd_mode));
+ exit (1);
+ }
+ mpfr_clears (xx, yy, zz, (mpfr_ptr) 0);
+}
+
+static void
+check2b (const char *xs, int px,
+ const char *ys, int py,
+ const char *rs, int pz,
+ mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_init2 (xx,px);
+ mpfr_init2 (yy,py);
+ mpfr_init2 (zz,pz);
+ mpfr_set_str_binary (xx, xs);
+ mpfr_set_str_binary (yy, ys);
+ test_add (zz, xx, yy, rnd_mode);
+ if (mpfr_cmp_str (zz, rs, 2, MPFR_RNDN))
+ {
+ printf ("(2) x=%s,%d y=%s,%d pz=%d,rnd=%s\n",
+ xs, px, ys, py, pz, mpfr_print_rnd_mode (rnd_mode));
+ printf ("got "); mpfr_print_binary(zz); puts ("");
+ mpfr_set_str(zz, rs, 2, MPFR_RNDN);
+ printf ("instead of "); mpfr_print_binary(zz); puts ("");
+ exit (1);
+ }
+ mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz);
+}
+
+static void
+check64 (void)
+{
+ mpfr_t x, t, u;
+
+ mpfr_init (x);
+ mpfr_init (t);
+ mpfr_init (u);
+
+ mpfr_set_prec (x, 29);
+ mpfr_set_str_binary (x, "1.1101001000101111011010010110e-3");
+ mpfr_set_prec (t, 58);
+ mpfr_set_str_binary (t, "0.11100010011111001001100110010111110110011000000100101E-1");
+ mpfr_set_prec (u, 29);
+ test_add (u, x, t, MPFR_RNDD);
+ mpfr_set_str_binary (t, "1.0101011100001000011100111110e-1");
+ if (mpfr_cmp (u, t))
+ {
+ printf ("mpfr_add(u, x, t) failed for prec(x)=29, prec(t)=58\n");
+ printf ("expected "); mpfr_out_str (stdout, 2, 29, t, MPFR_RNDN);
+ puts ("");
+ printf ("got "); mpfr_out_str (stdout, 2, 29, u, MPFR_RNDN);
+ puts ("");
+ exit(1);
+ }
+
+ mpfr_set_prec (x, 4);
+ mpfr_set_str_binary (x, "-1.0E-2");
+ mpfr_set_prec (t, 2);
+ mpfr_set_str_binary (t, "-1.1e-2");
+ mpfr_set_prec (u, 2);
+ test_add (u, x, t, MPFR_RNDN);
+ if (MPFR_MANT(u)[0] << 2)
+ {
+ printf ("result not normalized for prec=2\n");
+ mpfr_print_binary (u); puts ("");
+ exit (1);
+ }
+ mpfr_set_str_binary (t, "-1.0e-1");
+ if (mpfr_cmp (u, t))
+ {
+ printf ("mpfr_add(u, x, t) failed for prec(x)=4, prec(t)=2\n");
+ printf ("expected -1.0e-1\n");
+ printf ("got "); mpfr_out_str (stdout, 2, 4, u, MPFR_RNDN);
+ puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 8);
+ mpfr_set_str_binary (x, "-0.10011010"); /* -77/128 */
+ mpfr_set_prec (t, 4);
+ mpfr_set_str_binary (t, "-1.110e-5"); /* -7/128 */
+ mpfr_set_prec (u, 4);
+ test_add (u, x, t, MPFR_RNDN); /* should give -5/8 */
+ mpfr_set_str_binary (t, "-1.010e-1");
+ if (mpfr_cmp (u, t)) {
+ printf ("mpfr_add(u, x, t) failed for prec(x)=8, prec(t)=4\n");
+ printf ("expected -1.010e-1\n");
+ printf ("got "); mpfr_out_str (stdout, 2, 4, u, MPFR_RNDN);
+ puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 112); mpfr_set_prec (t, 98); mpfr_set_prec (u, 54);
+ mpfr_set_str_binary (x, "-0.11111100100000000011000011100000101101010001000111E-401");
+ mpfr_set_str_binary (t, "0.10110000100100000101101100011111111011101000111000101E-464");
+ test_add (u, x, t, MPFR_RNDN);
+ if (mpfr_cmp (u, x))
+ {
+ printf ("mpfr_add(u, x, t) failed for prec(x)=112, prec(t)=98\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 92); mpfr_set_prec (t, 86); mpfr_set_prec (u, 53);
+ mpfr_set_str (x, "-5.03525136761487735093e-74", 10, MPFR_RNDN);
+ mpfr_set_str (t, "8.51539046314262304109e-91", 10, MPFR_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
+ if (mpfr_cmp_str1 (u, "-5.0352513676148773509283672e-74") )
+ {
+ printf ("mpfr_add(u, x, t) failed for prec(x)=92, prec(t)=86\n");
+ exit (1);
+ }
+
+ mpfr_set_prec(x, 53); mpfr_set_prec(t, 76); mpfr_set_prec(u, 76);
+ mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32");
+ mpfr_set_str_binary(t, "-0.1011000101110010000101111111011111010001110011110111100110101011110010011111");
+ mpfr_sub(u, x, t, MPFR_RNDU);
+ mpfr_set_str_binary(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100");
+ if (mpfr_cmp(u,t))
+ {
+ printf ("expect "); mpfr_print_binary(t); puts ("");
+ printf ("mpfr_add failed for precisions 53-76\n");
+ exit (1);
+ }
+ mpfr_set_prec(x, 53); mpfr_set_prec(t, 108); mpfr_set_prec(u, 108);
+ mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32");
+ mpfr_set_str_binary(t, "-0.101100010111001000010111111101111101000111001111011110011010101111001001111000111011001110011000000000111111");
+ mpfr_sub(u, x, t, MPFR_RNDU);
+ mpfr_set_str_binary(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111");
+ if (mpfr_cmp(u,t))
+ {
+ printf ("expect "); mpfr_print_binary(t); puts ("");
+ printf ("mpfr_add failed for precisions 53-108\n");
+ exit (1);
+ }
+ mpfr_set_prec(x, 97); mpfr_set_prec(t, 97); mpfr_set_prec(u, 97);
+ mpfr_set_str_binary(x, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010000000000000000E-39");
+ mpfr_set_ui(t, 1, MPFR_RNDN);
+ test_add (u, x, t, MPFR_RNDN);
+ mpfr_set_str_binary(x, "0.1000000000000000000000000000000000000000111110110000100000000101100011011110100000101111100010001E1");
+ if (mpfr_cmp(u,x))
+ {
+ printf ("mpfr_add failed for precision 97\n");
+ exit (1);
+ }
+ mpfr_set_prec(x, 128); mpfr_set_prec(t, 128); mpfr_set_prec(u, 128);
+ mpfr_set_str_binary(x, "0.10101011111001001010111011001000101100111101000000111111111011010100001100011101010001010111111101111010100110111111100101100010E-4");
+ mpfr_set(t, x, MPFR_RNDN);
+ mpfr_sub(u, x, t, MPFR_RNDN);
+ mpfr_set_prec(x, 96); mpfr_set_prec(t, 96); mpfr_set_prec(u, 96);
+ mpfr_set_str_binary(x, "0.111000000001110100111100110101101001001010010011010011100111100011010100011001010011011011000010E-4");
+ mpfr_set(t, x, MPFR_RNDN);
+ mpfr_sub(u, x, t, MPFR_RNDN);
+ mpfr_set_prec(x, 85); mpfr_set_prec(t, 85); mpfr_set_prec(u, 85);
+ mpfr_set_str_binary(x, "0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4");
+ mpfr_set_str_binary(t, "0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4");
+ mpfr_sub(u, x, t, MPFR_RNDU);
+ mpfr_sub(x, x, t, MPFR_RNDU);
+ if (mpfr_cmp(x, u) != 0)
+ {
+ printf ("Error in mpfr_sub: u=x-t and x=x-t give different results\n");
+ exit (1);
+ }
+ if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
+ ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ {
+ printf ("Error in mpfr_sub: result is not msb-normalized (1)\n");
+ exit (1);
+ }
+ mpfr_set_prec(x, 65); mpfr_set_prec(t, 65); mpfr_set_prec(u, 65);
+ mpfr_set_str_binary(x, "0.10011010101000110101010000000011001001001110001011101011111011101E623");
+ mpfr_set_str_binary(t, "0.10011010101000110101010000000011001001001110001011101011111011100E623");
+ mpfr_sub(u, x, t, MPFR_RNDU);
+ if (mpfr_cmp_ui_2exp(u, 1, 558))
+ { /* 2^558 */
+ printf ("Error (1) in mpfr_sub\n");
+ exit (1);
+ }
+
+ mpfr_set_prec(x, 64); mpfr_set_prec(t, 64); mpfr_set_prec(u, 64);
+ mpfr_set_str_binary(x, "0.1000011110101111011110111111000011101011101111101101101100000100E-220");
+ mpfr_set_str_binary(t, "0.1000011110101111011110111111000011101011101111101101010011111101E-220");
+ test_add (u, x, t, MPFR_RNDU);
+ if ((MPFR_MANT(u)[0] & 1) != 1)
+ {
+ printf ("error in mpfr_add with rnd_mode=MPFR_RNDU\n");
+ printf ("b= "); mpfr_print_binary(x); puts ("");
+ printf ("c= "); mpfr_print_binary(t); puts ("");
+ printf ("b+c="); mpfr_print_binary(u); puts ("");
+ exit (1);
+ }
+
+ /* bug found by Norbert Mueller, 14 Sep 2000 */
+ mpfr_set_prec(x, 56); mpfr_set_prec(t, 83); mpfr_set_prec(u, 10);
+ mpfr_set_str_binary(x, "0.10001001011011001111101100110100000101111010010111010111E-7");
+ mpfr_set_str_binary(t, "0.10001001011011001111101100110100000101111010010111010111000000000111110110110000100E-7");
+ mpfr_sub(u, x, t, MPFR_RNDU);
+
+ /* array bound write found by Norbert Mueller, 26 Sep 2000 */
+ mpfr_set_prec(x, 109); mpfr_set_prec(t, 153); mpfr_set_prec(u, 95);
+ mpfr_set_str_binary(x,"0.1001010000101011101100111000110001111111111111111111111111111111111111111111111111111111111111100000000000000E33");
+ mpfr_set_str_binary(t,"-0.100101000010101110110011100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100101101000000100100001100110111E33");
+ test_add (u, x, t, MPFR_RNDN);
+
+ /* array bound writes found by Norbert Mueller, 27 Sep 2000 */
+ mpfr_set_prec(x, 106); mpfr_set_prec(t, 53); mpfr_set_prec(u, 23);
+ mpfr_set_str_binary(x, "-0.1000011110101111111001010001000100001011000000000000000000000000000000000000000000000000000000000000000000E-59");
+ mpfr_set_str_binary(t, "-0.10000111101011111110010100010001101100011100110100000E-59");
+ mpfr_sub(u, x, t, MPFR_RNDN);
+ mpfr_set_prec(x, 177); mpfr_set_prec(t, 217); mpfr_set_prec(u, 160);
+ mpfr_set_str_binary(x, "-0.111010001011010000111001001010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E35");
+ mpfr_set_str_binary(t, "0.1110100010110100001110010010100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011010011100001111001E35");
+ test_add (u, x, t, MPFR_RNDN);
+ mpfr_set_prec(x, 214); mpfr_set_prec(t, 278); mpfr_set_prec(u, 207);
+ mpfr_set_str_binary(x, "0.1000100110100110101101101101000000010000100111000001001110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E66");
+ mpfr_set_str_binary(t, "-0.10001001101001101011011011010000000100001001110000010011100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111011111001001100011E66");
+ test_add (u, x, t, MPFR_RNDN);
+ mpfr_set_prec(x, 32); mpfr_set_prec(t, 247); mpfr_set_prec(u, 223);
+ mpfr_set_str_binary(x, "0.10000000000000000000000000000000E1");
+ mpfr_set_str_binary(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0");
+ mpfr_sub(u, x, t, MPFR_RNDN);
+ if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
+ ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ {
+ printf ("Error in mpfr_sub: result is not msb-normalized (2)\n");
+ exit (1);
+ }
+
+ /* bug found by Nathalie Revol, 21 March 2001 */
+ mpfr_set_prec (x, 65);
+ mpfr_set_prec (t, 65);
+ mpfr_set_prec (u, 65);
+ mpfr_set_str_binary (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35");
+ mpfr_set_str_binary (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1");
+ mpfr_sub (u, t, x, MPFR_RNDU);
+ if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
+ ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ {
+ printf ("Error in mpfr_sub: result is not msb-normalized (3)\n");
+ exit (1);
+ }
+
+ /* bug found by Fabrice Rouillier, 27 Mar 2001 */
+ mpfr_set_prec (x, 107);
+ mpfr_set_prec (t, 107);
+ mpfr_set_prec (u, 107);
+ mpfr_set_str_binary (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315");
+ mpfr_set_str_binary (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350");
+ mpfr_sub (u, x, t, MPFR_RNDU);
+ if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] &
+ ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0)
+ {
+ printf ("Error in mpfr_sub: result is not msb-normalized (4)\n");
+ exit (1);
+ }
+
+ /* checks that NaN flag is correctly reset */
+ mpfr_set_ui (t, 1, MPFR_RNDN);
+ mpfr_set_ui (u, 1, MPFR_RNDN);
+ mpfr_set_nan (x);
+ test_add (x, t, u, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 2))
+ {
+ printf ("Error in mpfr_add: 1+1 gives ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN);
+ exit (1);
+ }
+
+ mpfr_clear(x); mpfr_clear(t); mpfr_clear(u);
+}
+
+/* check case when c does not overlap with a, but both b and c count
+ for rounding */
+static void
+check_case_1b (void)
+{
+ mpfr_t a, b, c;
+ unsigned int prec_a, prec_b, prec_c, dif;
+
+ mpfr_init (a);
+ mpfr_init (b);
+ mpfr_init (c);
+
+ {
+ prec_a = MPFR_PREC_MIN + (randlimb () % 63);
+ mpfr_set_prec (a, prec_a);
+ for (prec_b = prec_a + 2; prec_b <= 64; prec_b++)
+ {
+ dif = prec_b - prec_a;
+ mpfr_set_prec (b, prec_b);
+ /* b = 1 - 2^(-prec_a) + 2^(-prec_b) */
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ mpfr_div_2exp (b, b, dif, MPFR_RNDN);
+ mpfr_sub_ui (b, b, 1, MPFR_RNDN);
+ mpfr_div_2exp (b, b, prec_a, MPFR_RNDN);
+ mpfr_add_ui (b, b, 1, MPFR_RNDN);
+ for (prec_c = dif; prec_c <= 64; prec_c++)
+ {
+ /* c = 2^(-prec_a) - 2^(-prec_b) */
+ mpfr_set_prec (c, prec_c);
+ mpfr_set_si (c, -1, MPFR_RNDN);
+ mpfr_div_2exp (c, c, dif, MPFR_RNDN);
+ mpfr_add_ui (c, c, 1, MPFR_RNDN);
+ mpfr_div_2exp (c, c, prec_a, MPFR_RNDN);
+ test_add (a, b, c, MPFR_RNDN);
+ if (mpfr_cmp_ui (a, 1) != 0)
+ {
+ printf ("case (1b) failed for prec_a=%u, prec_b=%u,"
+ " prec_c=%u\n", prec_a, prec_b, prec_c);
+ printf ("b="); mpfr_print_binary(b); puts ("");
+ printf ("c="); mpfr_print_binary(c); puts ("");
+ printf ("a="); mpfr_print_binary(a); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (c);
+}
+
+/* check case when c overlaps with a */
+static void
+check_case_2 (void)
+{
+ mpfr_t a, b, c, d;
+
+ mpfr_init2 (a, 300);
+ mpfr_init2 (b, 800);
+ mpfr_init2 (c, 500);
+ mpfr_init2 (d, 800);
+
+ mpfr_set_str_binary(a, "1E110"); /* a = 2^110 */
+ mpfr_set_str_binary(b, "1E900"); /* b = 2^900 */
+ mpfr_set_str_binary(c, "1E500"); /* c = 2^500 */
+ test_add (c, c, a, MPFR_RNDZ); /* c = 2^500 + 2^110 */
+ mpfr_sub (d, b, c, MPFR_RNDZ); /* d = 2^900 - 2^500 - 2^110 */
+ test_add (b, b, c, MPFR_RNDZ); /* b = 2^900 + 2^500 + 2^110 */
+ test_add (a, b, d, MPFR_RNDZ); /* a = 2^901 */
+ if (mpfr_cmp_ui_2exp (a, 1, 901))
+ {
+ printf ("b + d fails for b=2^900+2^500+2^110, d=2^900-2^500-2^110\n");
+ printf ("expected 1.0e901, got ");
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (c);
+ mpfr_clear (d);
+}
+
+/* checks when source and destination are equal */
+static void
+check_same (void)
+{
+ mpfr_t x;
+
+ mpfr_init(x); mpfr_set_ui(x, 1, MPFR_RNDZ);
+ test_add (x, x, x, MPFR_RNDZ);
+ if (mpfr_cmp_ui (x, 2))
+ {
+ printf ("Error when all 3 operands are equal\n");
+ exit (1);
+ }
+ mpfr_clear(x);
+}
+
+#define check53(x, y, r, z) check(x, y, r, 53, 53, 53, z)
+
+#define MAX_PREC 256
+
+static void
+check_inexact (void)
+{
+ mpfr_t x, y, z, u;
+ mpfr_prec_t px, py, pu, pz;
+ int inexact, cmp;
+ mpfr_rnd_t rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (u);
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_str_binary (x, "0.1E-4");
+ mpfr_set_prec (u, 33);
+ mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1");
+ mpfr_set_prec (y, 31);
+ if ((inexact = test_add (y, x, u, MPFR_RNDN)))
+ {
+ printf ("Wrong inexact flag (2): expected 0, got %d\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_str_binary (x, "0.1E-4");
+ mpfr_set_prec (u, 33);
+ mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1");
+ mpfr_set_prec (y, 28);
+ if ((inexact = test_add (y, x, u, MPFR_RNDN)))
+ {
+ printf ("Wrong inexact flag (1): expected 0, got %d\n", inexact);
+ exit (1);
+ }
+
+ for (px=2; px<MAX_PREC; px++)
+ {
+ mpfr_set_prec (x, px);
+ do
+ {
+ mpfr_urandomb (x, RANDS);
+ }
+ while (mpfr_cmp_ui (x, 0) == 0);
+ for (pu=2; pu<MAX_PREC; pu++)
+ {
+ mpfr_set_prec (u, pu);
+ do
+ {
+ mpfr_urandomb (u, RANDS);
+ }
+ while (mpfr_cmp_ui (u, 0) == 0);
+ {
+ py = MPFR_PREC_MIN + (randlimb () % (MAX_PREC - 1));
+ mpfr_set_prec (y, py);
+ pz = (mpfr_cmpabs (x, u) >= 0) ? MPFR_EXP(x) - MPFR_EXP(u)
+ : MPFR_EXP(u) - MPFR_EXP(x);
+ /* x + u is exactly representable with precision
+ abs(EXP(x)-EXP(u)) + max(prec(x), prec(u)) + 1 */
+ pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1;
+ mpfr_set_prec (z, pz);
+ rnd = RND_RAND ();
+ if (test_add (z, x, u, rnd))
+ {
+ printf ("z <- x + u should be exact\n");
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("u="); mpfr_print_binary (u); puts ("");
+ printf ("z="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ {
+ rnd = RND_RAND ();
+ inexact = test_add (y, x, u, rnd);
+ cmp = mpfr_cmp (y, z);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s\n",
+ mpfr_print_rnd_mode(rnd));
+ printf ("expected %d, got %d\n", cmp, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("u="); mpfr_print_binary (u); puts ("");
+ printf ("y= "); mpfr_print_binary (y); puts ("");
+ printf ("x+u="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (u);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t s, x, y;
+
+ mpfr_init2 (x, 8L);
+ mpfr_init2 (y, 8L);
+ mpfr_init2 (s, 8L);
+
+ /* +inf + -inf == nan */
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, -1);
+ test_add (s, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (s));
+
+ /* +inf + 1 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_set_ui (y, 1L, MPFR_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (s));
+ MPFR_ASSERTN (mpfr_sgn (s) > 0);
+
+ /* -inf + 1 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_set_ui (y, 1L, MPFR_RNDN);
+ test_add (s, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (s));
+ MPFR_ASSERTN (mpfr_sgn (s) < 0);
+
+ /* 1 + +inf == +inf */
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ test_add (s, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (s));
+ MPFR_ASSERTN (mpfr_sgn (s) > 0);
+
+ /* 1 + -inf == -inf */
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
+ mpfr_set_inf (y, -1);
+ test_add (s, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (s));
+ MPFR_ASSERTN (mpfr_sgn (s) < 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (s);
+}
+
+static void
+check_alloc (void)
+{
+ mpfr_t a;
+
+ mpfr_init2 (a, 10000);
+ mpfr_set_prec (a, 53);
+ mpfr_set_ui (a, 15236, MPFR_RNDN);
+ test_add (a, a, a, MPFR_RNDN);
+ mpfr_mul (a, a, a, MPFR_RNDN);
+ mpfr_div (a, a, a, MPFR_RNDN);
+ mpfr_sub (a, a, a, MPFR_RNDN);
+ mpfr_clear (a);
+}
+
+static void
+check_overflow (void)
+{
+ mpfr_t a, b, c;
+ mpfr_prec_t prec_a;
+ int r;
+
+ mpfr_init2 (a, 256);
+ mpfr_init2 (b, 256);
+ mpfr_init2 (c, 256);
+
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ mpfr_setmax (b, mpfr_get_emax ());
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ mpfr_set_exp (c, mpfr_get_emax () - 192);
+ RND_LOOP(r)
+ for (prec_a = 128; prec_a < 512; prec_a += 64)
+ {
+ mpfr_set_prec (a, prec_a);
+ mpfr_clear_overflow ();
+ test_add (a, b, c, (mpfr_rnd_t) r);
+ if (!mpfr_overflow_p ())
+ {
+ printf ("No overflow in check_overflow\n");
+ exit (1);
+ }
+ }
+
+ mpfr_set_exp (c, mpfr_get_emax () - 512);
+ mpfr_set_prec (a, 256);
+ mpfr_clear_overflow ();
+ test_add (a, b, c, MPFR_RNDU);
+ if (!mpfr_overflow_p ())
+ {
+ printf ("No overflow in check_overflow\n");
+ exit (1);
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (c);
+}
+
+static void
+check_1111 (void)
+{
+ mpfr_t one;
+ long n;
+
+ mpfr_init2 (one, MPFR_PREC_MIN);
+ mpfr_set_ui (one, 1, MPFR_RNDN);
+ for (n = 0; n < N; n++)
+ {
+ mpfr_prec_t prec_a, prec_b, prec_c;
+ mpfr_exp_t tb=0, tc, diff;
+ mpfr_t a, b, c, s;
+ int m = 512;
+ int sb, sc;
+ int inex_a, inex_s;
+ mpfr_rnd_t rnd_mode;
+
+ prec_a = MPFR_PREC_MIN + (randlimb () % m);
+ prec_b = MPFR_PREC_MIN + (randlimb () % m);
+ prec_c = MPFR_PREC_MIN + (randlimb () % m);
+ mpfr_init2 (a, prec_a);
+ mpfr_init2 (b, prec_b);
+ mpfr_init2 (c, prec_c);
+ sb = randlimb () % 3;
+ if (sb != 0)
+ {
+ tb = 1 + (randlimb () % (prec_b - (sb != 2)));
+ mpfr_div_2ui (b, one, tb, MPFR_RNDN);
+ if (sb == 2)
+ mpfr_neg (b, b, MPFR_RNDN);
+ test_add (b, b, one, MPFR_RNDN);
+ }
+ else
+ mpfr_set (b, one, MPFR_RNDN);
+ tc = 1 + (randlimb () % (prec_c - 1));
+ mpfr_div_2ui (c, one, tc, MPFR_RNDN);
+ sc = randlimb () % 2;
+ if (sc)
+ mpfr_neg (c, c, MPFR_RNDN);
+ test_add (c, c, one, MPFR_RNDN);
+ diff = (randlimb () % (2*m)) - m;
+ mpfr_mul_2si (c, c, diff, MPFR_RNDN);
+ rnd_mode = RND_RAND ();
+ inex_a = test_add (a, b, c, rnd_mode);
+ mpfr_init2 (s, MPFR_PREC_MIN + 2*m);
+ inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */
+ if (inex_s)
+ {
+ printf ("check_1111: result should have been exact.\n");
+ exit (1);
+ }
+ inex_s = mpfr_prec_round (s, prec_a, rnd_mode);
+ if ((inex_a < 0 && inex_s >= 0) ||
+ (inex_a == 0 && inex_s != 0) ||
+ (inex_a > 0 && inex_s <= 0) ||
+ !mpfr_equal_p (a, s))
+ {
+ printf ("check_1111: results are different.\n");
+ printf ("prec_a = %d, prec_b = %d, prec_c = %d\n",
+ (int) prec_a, (int) prec_b, (int) prec_c);
+ printf ("tb = %d, tc = %d, diff = %d, rnd = %s\n",
+ (int) tb, (int) tc, (int) diff,
+ mpfr_print_rnd_mode (rnd_mode));
+ printf ("sb = %d, sc = %d\n", sb, sc);
+ printf ("a = "); mpfr_print_binary (a); puts ("");
+ printf ("s = "); mpfr_print_binary (s); puts ("");
+ printf ("inex_a = %d, inex_s = %d\n", inex_a, inex_s);
+ exit (1);
+ }
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (c);
+ mpfr_clear (s);
+ }
+ mpfr_clear (one);
+}
+
+static void
+check_1minuseps (void)
+{
+ static mpfr_prec_t prec_a[] = {
+ MPFR_PREC_MIN, 30, 31, 32, 33, 62, 63, 64, 65, 126, 127, 128, 129
+ };
+ static int supp_b[] = {
+ 0, 1, 2, 3, 4, 29, 30, 31, 32, 33, 34, 35, 61, 62, 63, 64, 65, 66, 67
+ };
+ mpfr_t a, b, c;
+ unsigned int ia, ib, ic;
+
+ mpfr_init2 (c, MPFR_PREC_MIN);
+
+ for (ia = 0; ia < numberof (prec_a); ia++)
+ for (ib = 0; ib < numberof(supp_b); ib++)
+ {
+ mpfr_prec_t prec_b;
+ int rnd_mode;
+
+ prec_b = prec_a[ia] + supp_b[ib];
+
+ mpfr_init2 (a, prec_a[ia]);
+ mpfr_init2 (b, prec_b);
+
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ mpfr_div_ui (b, c, prec_a[ia], MPFR_RNDN);
+ mpfr_sub (b, c, b, MPFR_RNDN); /* b = 1 - 2^(-prec_a) */
+
+ for (ic = 0; ic < numberof(supp_b); ic++)
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++)
+ {
+ mpfr_t s;
+ int inex_a, inex_s;
+
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ mpfr_div_ui (c, c, prec_a[ia] + supp_b[ic], MPFR_RNDN);
+ inex_a = test_add (a, b, c, (mpfr_rnd_t) rnd_mode);
+ mpfr_init2 (s, 256);
+ inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */
+ if (inex_s)
+ {
+ printf ("check_1minuseps: result should have been exact "
+ "(ia = %u, ib = %u, ic = %u)\n", ia, ib, ic);
+ exit (1);
+ }
+ inex_s = mpfr_prec_round (s, prec_a[ia], (mpfr_rnd_t) rnd_mode);
+ if ((inex_a < 0 && inex_s >= 0) ||
+ (inex_a == 0 && inex_s != 0) ||
+ (inex_a > 0 && inex_s <= 0) ||
+ !mpfr_equal_p (a, s))
+ {
+ printf ("check_1minuseps: results are different.\n");
+ printf ("ia = %u, ib = %u, ic = %u\n", ia, ib, ic);
+ exit (1);
+ }
+ mpfr_clear (s);
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ }
+
+ mpfr_clear (c);
+}
+
+/* Test case bk == 0 in add1.c (b has entirely been read and
+ c hasn't been taken into account). */
+static void
+coverage_bk_eq_0 (void)
+{
+ mpfr_t a, b, c;
+ int inex;
+
+ mpfr_init2 (a, GMP_NUMB_BITS);
+ mpfr_init2 (b, 2 * GMP_NUMB_BITS);
+ mpfr_init2 (c, GMP_NUMB_BITS);
+
+ mpfr_set_ui_2exp (b, 1, 2 * GMP_NUMB_BITS, MPFR_RNDN);
+ mpfr_sub_ui (b, b, 1, MPFR_RNDN);
+ /* b = 111...111 (in base 2) where the 1's fit 2 whole limbs */
+
+ mpfr_set_ui_2exp (c, 1, -1, MPFR_RNDN); /* c = 1/2 */
+
+ inex = mpfr_add (a, b, c, MPFR_RNDU);
+ mpfr_set_ui_2exp (c, 1, 2 * GMP_NUMB_BITS, MPFR_RNDN);
+ if (! mpfr_equal_p (a, c))
+ {
+ printf ("Error in coverage_bk_eq_0\n");
+ printf ("Expected ");
+ mpfr_dump (c);
+ printf ("Got ");
+ mpfr_dump (a);
+ exit (1);
+ }
+ MPFR_ASSERTN (inex > 0);
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (c);
+}
+
+static void
+tests (void)
+{
+ check_alloc ();
+ check_nans ();
+ check_inexact ();
+ check_case_1b ();
+ check_case_2 ();
+ check64();
+ coverage_bk_eq_0 ();
+
+ check("293607738.0", "1.9967571564050541e-5", MPFR_RNDU, 64, 53, 53,
+ "2.9360773800002003e8");
+ check("880524.0", "-2.0769715792901673e-5", MPFR_RNDN, 64, 53, 53,
+ "8.8052399997923023e5");
+ check("1196426492.0", "-1.4218093058435347e-3", MPFR_RNDN, 64, 53, 53,
+ "1.1964264919985781e9");
+ check("982013018.0", "-8.941829477291838e-7", MPFR_RNDN, 64, 53, 53,
+ "9.8201301799999905e8");
+ check("1092583421.0", "1.0880649218158844e9", MPFR_RNDN, 64, 53, 53,
+ "2.1806483428158846e9");
+ check("1.8476886419022969e-6", "961494401.0", MPFR_RNDN, 53, 64, 53,
+ "9.6149440100000179e8");
+ check("-2.3222118418069868e5", "1229318102.0", MPFR_RNDN, 53, 64, 53,
+ "1.2290858808158193e9");
+ check("-3.0399171300395734e-6", "874924868.0", MPFR_RNDN, 53, 64, 53,
+ "8.749248679999969e8");
+ check("9.064246624706179e1", "663787413.0", MPFR_RNDN, 53, 64, 53,
+ "6.6378750364246619e8");
+ check("-1.0954322421551264e2", "281806592.0", MPFR_RNDD, 53, 64, 53,
+ "2.8180648245677572e8");
+ check("5.9836930386056659e-8", "1016217213.0", MPFR_RNDN, 53, 64, 53,
+ "1.0162172130000001e9");
+ check("-1.2772161928500301e-7", "1237734238.0", MPFR_RNDN, 53, 64, 53,
+ "1.2377342379999998e9");
+ check("-4.567291988483277e8", "1262857194.0", MPFR_RNDN, 53, 64, 53,
+ "8.0612799515167236e8");
+ check("4.7719471752925262e7", "196089880.0", MPFR_RNDN, 53, 53, 53,
+ "2.4380935175292528e8");
+ check("4.7719471752925262e7", "196089880.0", MPFR_RNDN, 53, 64, 53,
+ "2.4380935175292528e8");
+ check("-1.716113812768534e-140", "1271212614.0", MPFR_RNDZ, 53, 64, 53,
+ "1.2712126139999998e9");
+ check("-1.2927455200185474e-50", "1675676122.0", MPFR_RNDD, 53, 64, 53,
+ "1.6756761219999998e9");
+
+ check53("1.22191250737771397120e+20", "948002822.0", MPFR_RNDN,
+ "122191250738719408128.0");
+ check53("9966027674114492.0", "1780341389094537.0", MPFR_RNDN,
+ "11746369063209028.0");
+ check53("2.99280481918991653800e+272", "5.34637717585790933424e+271",
+ MPFR_RNDN, "3.5274425367757071711e272");
+ check_same();
+ check53("6.14384195492641560499e-02", "-6.14384195401037683237e-02",
+ MPFR_RNDU, "9.1603877261370314499e-12");
+ check53("1.16809465359248765399e+196", "7.92883212101990665259e+196",
+ MPFR_RNDU, "9.0969267746123943065e196");
+ check53("3.14553393112021279444e-67", "3.14553401015952024126e-67", MPFR_RNDU,
+ "6.2910679412797336946e-67");
+
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDN,
+ "5.4388530464436950905e185");
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDZ,
+ "5.4388530464436944867e185");
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDU,
+ "5.4388530464436950905e185");
+ check53("5.43885304644369509058e+185","-1.87427265794105342763e-57",MPFR_RNDD,
+ "5.4388530464436944867e185");
+
+ check2b("1.001010101110011000000010100101110010111001010000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e358",187,
+ "-1.11100111001101100010001111111110101101110001000000000000000000000000000000000000000000e160",87,
+ "1.001010101110011000000010100101110010111001010000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e358",178,
+ MPFR_RNDD);
+ check2b("-1.111100100011100111010101010101001010100100000111001000000000000000000e481",70,
+ "1.1111000110100011110101111110110010010000000110101000000000000000e481",65,
+ "-1.001010111111101011010000001100011101100101000000000000000000e472",61,
+ MPFR_RNDD);
+ check2b("1.0100010111010000100101000000111110011100011001011010000000000000000000000000000000e516",83,
+ "-1.1001111000100001011100000001001100110011110010111111000000e541",59,
+ "-1.1001111000100001011011110111000001001011100000011110100000110001110011010011000000000000000000000000000000000000000000000000e541",125,
+ MPFR_RNDZ);
+ check2b("-1.0010111100000100110001011011010000000011000111101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e261",155,
+ "-1.00111110100011e239",15,
+ "-1.00101111000001001100101010101110001100110001111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e261",159,
+ MPFR_RNDD);
+ check2b("-1.110111000011111011000000001001111101101001010100111000000000000000000000000e880",76,
+ "-1.1010010e-634",8,
+ "-1.11011100001111101100000000100111110110100101010011100000000000000000000000e880",75,
+ MPFR_RNDZ);
+ check2b("1.00100100110110101001010010101111000001011100100101010000000000000000000000000000e-530",81,
+ "-1.101101111100000111000011001010110011001011101001110100000e-908",58,
+ "1.00100100110110101001010010101111000001011100100101010e-530",54,
+ MPFR_RNDN);
+ check2b("1.0101100010010111101000000001000010010010011000111011000000000000000000000000000000000000000000000000000000000000000000e374",119,
+ "1.11100101100101e358",15,
+ "1.01011000100110011000010110100100100100100110001110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e374",150,
+ MPFR_RNDZ);
+ check2b("-1.10011001000010100000010100100110110010011111101111000000000000000000000000000000000000000000000000000000000000000000e-172",117,
+ "1.111011100000101010110000100100110100100001001000011100000000e-173",61,
+ "-1.0100010000001001010110011011101001001011101011110001000000000000000e-173",68,
+ MPFR_RNDZ);
+ check2b("-1.011110000111101011100001100110100011100101000011011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-189",175,
+ "1.1e631",2,
+ "1.011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e631",115,
+ MPFR_RNDZ);
+ check2b("-1.101011101001011101100011001000001100010100001101011000000000000000000000000000000000000000000e-449",94,
+ "-1.01111101010111000011000110011101000111001100110111100000000000000e-429",66,
+ "-1.01111101010111000100110010000110100100101111111111101100010100001101011000000000000000000000000000000000000000e-429",111,
+ MPFR_RNDU);
+ check2b("-1.101011101001011101100011001000001100010100001101011000000000000000000000000000000000000000000e-449",94,
+ "-1.01111101010111000011000110011101000111001100110111100000000000000e-429",66,
+ "-1.01111101010111000100110010000110100100101111111111101100010100001101011000000000000000000000000000000000000000e-429",111,
+ MPFR_RNDD);
+ check2b("-1.1001000011101000110000111110010100100101110101111100000000000000000000000000000000000000000000000000000000e-72",107,
+ "-1.001100011101100100010101101010101011010010111111010000000000000000000000000000e521",79,
+ "-1.00110001110110010001010110101010101101001011111101000000000000000000000000000000000000000000000001e521",99,
+ MPFR_RNDD);
+ check2b("-1.01010001111000000101010100100100110101011011100001110000000000e498",63,
+ "1.010000011010101111000100111100011100010101011110010100000000000e243",64,
+ "-1.010100011110000001010101001001001101010110111000011100000000000e498",64,
+ MPFR_RNDN);
+ check2b("1.00101100010101000011010000011000111111011110010111000000000000000000000000000000000000000000000000000000000e178",108,
+ "-1.10101101010101000110011011111001001101111111110000100000000e160",60,
+ "1.00101100010100111100100011000011111001000010011101110010000000001111100000000000000000000000000000000000e178",105,
+ MPFR_RNDN);
+ check2b("1.00110011010100111110011010110100111101110101100100110000000000000000000000000000000000000000000000e559",99,
+ "-1.011010110100111011100110100110011100000000111010011000000000000000e559",67,
+ "-1.101111111101011111111111001001100100011100001001100000000000000000000000000000000000000000000e556",94,
+ MPFR_RNDU);
+ check2b("-1.100000111100101001100111011100011011000001101001111100000000000000000000000000e843",79,
+ "-1.1101101010110000001001000100001100110011000110110111000000000000000000000000000000000000000000e414",95,
+ "-1.1000001111001010011001110111000110110000011010100000e843",53,
+ MPFR_RNDD);
+ check2b("-1.110110010110100010100011000110111001010000010111110000000000e-415",61,
+ "-1.0000100101100001111100110011111111110100011101101011000000000000000000e751",71,
+ "-1.00001001011000011111001100111111111101000111011010110e751",54,
+ MPFR_RNDN);
+ check2b("-1.1011011011110001001101010101001000010100010110111101000000000000000000000e258",74,
+ "-1.00011100010110110101001011000100100000100010101000010000000000000000000000000000000000000000000000e268",99,
+ "-1.0001110011001001000011110001000111010110101011110010011011110100000000000000000000000000000000000000e268",101,
+ MPFR_RNDD);
+ check2b("-1.1011101010011101011000000100100110101101101110000001000000000e629",62,
+ "1.111111100000011100100011100000011101100110111110111000000000000000000000000000000000000000000e525",94,
+ "-1.101110101001110101100000010010011010110110111000000011111111111111111111111111111111111111111111111111101e629",106,
+ MPFR_RNDD);
+ check2b("1.111001000010001100010000001100000110001011110111011000000000000000000000000000000000000e152",88,
+ "1.111110111001100100000100111111010111000100111111001000000000000000e152",67,
+ "1.1110111111011110000010101001011011101010000110110100e153",53,
+ MPFR_RNDN);
+ check2b("1.000001100011110010110000110100001010101101111011110100e696",55,
+ "-1.1011001111011100100001011110100101010101110111010101000000000000000000000000000000000000000000000000000000000000e730",113,
+ "-1.1011001111011100100001011110100100010100010011100010e730",53,
+ MPFR_RNDN);
+ check2b("-1.11010111100001001111000001110101010010001111111001100000000000000000000000000000000000000000000000000000000000e530",111,
+ "1.01110100010010000000010110111101011101000001111101100000000000000000000000000000000000000000000000e530",99,
+ "-1.1000110011110011101010101101111101010011011111000000000000000e528",62,
+ MPFR_RNDD);
+ check2b("-1.0001100010010100111101101011101000100100010011100011000000000000000000000000000000000000000000000000000000000e733",110,
+ "-1.001000000111110010100101010100110111001111011011001000000000000000000000000000000000000000000000000000000000e710",109,
+ "-1.000110001001010011111000111110110001110110011000110110e733",55,
+ MPFR_RNDN);
+ check2b("-1.1101011110000100111100000111010101001000111111100110000000000000000000000e530",74,
+ "1.01110100010010000000010110111101011101000001111101100000000000000000000000000000000000000000000000000000000000e530",111,
+ "-1.10001100111100111010101011011111010100110111110000000000000000000000000000e528",75,
+ MPFR_RNDU);
+ check2b("1.00110011010100111110011010110100111101110101100100110000000000000000000000000000000000000000000000e559",99,
+ "-1.011010110100111011100110100110011100000000111010011000000000000000e559",67,
+ "-1.101111111101011111111111001001100100011100001001100000000000000000000000000000000000000000000e556",94,
+ MPFR_RNDU);
+ check2b("-1.100101111110110000000110111111011010011101101111100100000000000000e-624",67,
+ "1.10111010101110100000010110101000000000010011100000100000000e-587",60,
+ "1.1011101010111010000001011010011111110100011110001011111111001000000100101100010010000011100000000000000000000e-587",110,
+ MPFR_RNDU);
+ check2b("-1.10011001000010100000010100100110110010011111101111000000000000000000000000000000000000000000000000000000000000000000e-172",117,
+ "1.111011100000101010110000100100110100100001001000011100000000e-173",61,
+ "-1.0100010000001001010110011011101001001011101011110001000000000000000e-173",68,
+ MPFR_RNDZ);
+ check2b("1.1000111000110010101001010011010011101100010110001001000000000000000000000000000000000000000000000000e167",101,
+ "1.0011110010000110000000101100100111000001110110110000000000000000000000000e167",74,
+ "1.01100101010111000101001111111111010101110001100111001000000000000000000000000000000000000000000000000000e168",105,
+ MPFR_RNDZ);
+ check2b("1.100101111111110010100101110111100001110000100001010000000000000000000000000000000000000000000000e808",97,
+ "-1.1110011001100000100000111111110000110010100111001011000000000000000000000000000000e807",83,
+ "1.01001001100110001100011111000000000001011010010111010000000000000000000000000000000000000000000e807",96,
+ MPFR_RNDN);
+ check2b("1e128",128,
+ "1e0",128,
+ "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0",256,
+ MPFR_RNDN);
+
+ /* Checking double precision (53 bits) */
+ check53("-8.22183238641455905806e-19", "7.42227178769761587878e-19",MPFR_RNDD,
+ "-7.9956059871694317927e-20");
+ check53("5.82106394662028628236e+234","-5.21514064202368477230e+89",MPFR_RNDD,
+ "5.8210639466202855763e234");
+ check53("5.72931679569871602371e+122","-5.72886070363264321230e+122",
+ MPFR_RNDN, "4.5609206607281141508e118");
+ check53("-5.09937369394650450820e+238", "2.70203299854862982387e+250",
+ MPFR_RNDD, "2.7020329985435301323e250");
+ check53("-2.96695924472363684394e+27", "1.22842938251111500000e+16",MPFR_RNDD,
+ "-2.96695924471135255027e27");
+ check53("1.74693641655743793422e-227", "-7.71776956366861843469e-229",
+ MPFR_RNDN, "1.669758720920751867e-227");
+ /* x = -7883040437021647.0; for (i=0; i<468; i++) x = x / 2.0;*/
+ check53("-1.03432206392780011159e-125", "1.30127034799251347548e-133",
+ MPFR_RNDN,
+ "-1.0343220509150965661100887242027378881805094180354e-125");
+ check53("1.05824655795525779205e+71", "-1.06022698059744327881e+71",MPFR_RNDZ,
+ "-1.9804226421854867632e68");
+ check53("-5.84204911040921732219e+240", "7.26658169050749590763e+240",
+ MPFR_RNDD, "1.4245325800982785854e240");
+ check53("1.00944884131046636376e+221","2.33809162651471520268e+215",MPFR_RNDN,
+ "1.0094511794020929787e221");
+ /*x = 7045852550057985.0; for (i=0; i<986; i++) x = x / 2.0;*/
+ check53("4.29232078932667367325e-278",
+ "1.0773525047389793833221116707010783793203080117586e-281"
+ , MPFR_RNDU, "4.2933981418314132787e-278");
+ check53("5.27584773801377058681e-80", "8.91207657803547196421e-91", MPFR_RNDN,
+ "5.2758477381028917269e-80");
+ check53("2.99280481918991653800e+272", "5.34637717585790933424e+271",
+ MPFR_RNDN, "3.5274425367757071711e272");
+ check53("4.67302514390488041733e-184", "2.18321376145645689945e-190",
+ MPFR_RNDN, "4.6730273271186420541e-184");
+ check53("5.57294120336300389254e+71", "2.60596167942024924040e+65", MPFR_RNDZ,
+ "5.5729438093246831053e71");
+ check53("6.6052588496951015469e24", "4938448004894539.0", MPFR_RNDU,
+ "6.6052588546335505068e24");
+ check53("1.23056185051606761523e-190", "1.64589756643433857138e-181",
+ MPFR_RNDU, "1.6458975676649006598e-181");
+ check53("2.93231171510175981584e-280", "3.26266919161341483877e-273",
+ MPFR_RNDU, "3.2626694848445867288e-273");
+ check53("5.76707395945001907217e-58", "4.74752971449827687074e-51", MPFR_RNDD,
+ "4.747530291205672325e-51");
+ check53("277363943109.0", "11.0", MPFR_RNDN, "277363943120.0");
+ check53("1.44791789689198883921e-140", "-1.90982880222349071284e-121",
+ MPFR_RNDN, "-1.90982880222349071e-121");
+
+
+ /* tests for particular cases (Vincent Lefevre, 22 Aug 2001) */
+ check53("9007199254740992.0", "1.0", MPFR_RNDN, "9007199254740992.0");
+ check53("9007199254740994.0", "1.0", MPFR_RNDN, "9007199254740996.0");
+ check53("9007199254740992.0", "-1.0", MPFR_RNDN, "9007199254740991.0");
+ check53("9007199254740994.0", "-1.0", MPFR_RNDN, "9007199254740992.0");
+ check53("9007199254740996.0", "-1.0", MPFR_RNDN, "9007199254740996.0");
+
+ check_overflow ();
+ check_1111 ();
+ check_1minuseps ();
+}
+
+#define TEST_FUNCTION test_add
+#define TWO_ARGS
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ usesp = 0;
+ tests ();
+
+#ifndef CHECK_EXTERNAL /* no need to check twice */
+ usesp = 1;
+ tests ();
+#endif
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c
new file mode 100644
index 0000000..1ca4444
--- /dev/null
+++ b/tests/tadd1sp.c
@@ -0,0 +1,189 @@
+/* Test file for mpfr_add1sp.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void check_special (void);
+static void check_random (mpfr_prec_t p);
+
+static void
+check_overflow (void)
+{
+ mpfr_t x, y, z1, z2;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-1021);
+ set_emax (1024);
+
+ mpfr_inits (x, y, z1, z2, (mpfr_ptr) 0);
+
+ mpfr_set_str1 (x, "8.00468257869324898448e+307");
+ mpfr_set_str1 (y, "7.44784712422708645156e+307");
+ mpfr_add1sp (z1, x, y, MPFR_RNDN);
+ mpfr_add1 (z2, x, y, MPFR_RNDN);
+ if (mpfr_cmp (z1, z2))
+ {
+ printf ("Overflow bug in add1sp.\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+int
+main (void)
+{
+ mpfr_prec_t p;
+
+ tests_start_mpfr ();
+
+ check_special ();
+ for(p = 2 ; p < 200 ; p++)
+ check_random (p);
+ check_overflow ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#define STD_ERROR \
+ do \
+ { \
+ printf("ERROR: for %s and p=%lu and i=%d:\nB=", \
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \
+ mpfr_print_binary(b); \
+ printf("\nC="); mpfr_print_binary(c); \
+ printf("\nadd1 : "); mpfr_print_binary(a1); \
+ printf("\nadd1sp: "); mpfr_print_binary(a2); \
+ putchar('\n'); \
+ exit(1); \
+ } \
+ while (0)
+
+#define STD_ERROR2 \
+ do \
+ { \
+ printf("ERROR: Wrong inexact flag for %s and p=%lu and i=%d:\nB=", \
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \
+ mpfr_print_binary(b); \
+ printf("\nC="); mpfr_print_binary(c); \
+ printf("\nA="); mpfr_print_binary(a1); \
+ printf("\nAdd1: %d. Add1sp: %d\n", \
+ inexact1, inexact2); \
+ exit(1); \
+ } \
+ while (0)
+
+#define SET_PREC(_p) \
+ { \
+ p = _p; \
+ mpfr_set_prec(a1, _p); mpfr_set_prec(a2, _p); \
+ mpfr_set_prec(b, _p); mpfr_set_prec(c, _p); \
+ }
+
+static void
+check_random (mpfr_prec_t p)
+{
+ mpfr_t a1,b,c,a2;
+ int r;
+ int i, inexact1, inexact2;
+
+ mpfr_inits2 (p, a1, b, c, a2, (mpfr_ptr) 0);
+
+ for (i = 0 ; i < 500 ; i++)
+ {
+ mpfr_urandomb (b, RANDS);
+ mpfr_urandomb (c, RANDS);
+ if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c))
+ {
+ if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
+ mpfr_swap(b, c);
+ if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c))
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ inexact1 = mpfr_add1(a1, b, c, (mpfr_rnd_t) r);
+ inexact2 = mpfr_add1sp(a2, b, c, (mpfr_rnd_t) r);
+ if (mpfr_cmp(a1, a2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ }
+ }
+ }
+
+ mpfr_clears (a1, a2, b, c, (mpfr_ptr) 0);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t a1,a2,b,c;
+ int r;
+ mpfr_prec_t p;
+ int i = -1, inexact1, inexact2;
+
+ mpfr_inits (a1, a2, b, c, (mpfr_ptr) 0);
+
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ SET_PREC(53);
+ mpfr_set_str1 (b, "1@100");
+ mpfr_set_str1 (c, "1@1");
+ inexact1 = mpfr_add1(a1, b, c, (mpfr_rnd_t) r);
+ inexact2 = mpfr_add1sp(a2, b, c, (mpfr_rnd_t) r);
+ if (mpfr_cmp(a1, a2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ mpfr_set_str_binary (b, "1E53");
+ mpfr_set_str_binary (c, "1E0");
+ inexact1 = mpfr_add1(a1, b, c, (mpfr_rnd_t) r);
+ inexact2 = mpfr_add1sp(a2, b, c, (mpfr_rnd_t) r);
+ if (mpfr_cmp(a1, a2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ }
+
+ mpfr_set_prec (c, 2);
+ mpfr_set_prec (a1, 2);
+ mpfr_set_prec (a2, 2);
+ mpfr_set_str_binary (c, "1.0e1");
+ mpfr_set_str_binary (a2, "1.1e-1");
+ mpfr_set_str_binary (a1, "0.11E2");
+ mpfr_add1sp (a2, c, a2, MPFR_RNDN);
+ if (mpfr_cmp (a1, a2))
+ {
+ printf ("Regression reuse test failed!\n");
+ exit (1);
+ }
+
+ mpfr_clears (a1, a2, b, c, (mpfr_ptr) 0);
+}
diff --git a/tests/tadd_d.c b/tests/tadd_d.c
new file mode 100644
index 0000000..533f0d3
--- /dev/null
+++ b/tests/tadd_d.c
@@ -0,0 +1,161 @@
+/* Test file for mpfr_add_d
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check_regulars (void)
+{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
+
+ /* (1) check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_add_d (x, y, d, MPFR_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_add_d (1)\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "4096.125", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_add_d (");
+ mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ /* (2) check inexact flag */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (z, 2);
+
+ mpfr_clear_flags ();
+ inexact = mpfr_add_d (x, y, d, MPFR_RNDN);
+ if (inexact == 0)
+ {
+ printf ("Inexact flag error in mpfr_add_d (2)\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "4096.125", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_add_d (");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static void
+check_nans (void)
+{
+#if !defined(MPFR_ERRDIVZERO)
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ /* nan + 1.0 is nan */
+ mpfr_set_nan (x);
+ mpfr_clear_flags ();
+ inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* +inf + 1.0 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags ();
+ inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* -inf + 1.0 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags ();
+ inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+#endif
+}
+
+#define TEST_FUNCTION mpfr_add_d
+#define DOUBLE_ARG2
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ check_nans ();
+ check_regulars ();
+
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c
new file mode 100644
index 0000000..ab23edc
--- /dev/null
+++ b/tests/tadd_ui.c
@@ -0,0 +1,116 @@
+/* Test file for mpfr_add_ui
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+/* checks that x+y gives the right results with 53 bits of precision */
+static void
+check3 (const char *xs, unsigned long y, mpfr_rnd_t rnd_mode, const char *zs)
+{
+ mpfr_t xx, zz;
+
+ mpfr_inits2 (53, xx, zz, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs);
+ mpfr_add_ui (zz, xx, y, rnd_mode);
+ if (mpfr_cmp_str1(zz, zs) )
+ {
+ printf ("expected sum is %s, got ",zs);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
+ printf ("\nmpfr_add_ui failed for x=%s y=%lu with rnd_mode=%s\n",
+ xs, y, mpfr_print_rnd_mode(rnd_mode));
+ exit (1);
+ }
+ mpfr_clears (xx, zz, (mpfr_ptr) 0);
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 63);
+ mpfr_init2 (y, 63);
+ mpfr_set_str_binary (x, "0.110100000000000001110001110010111111000000000101100011100100011");
+ mpfr_add_ui (y, x, 1, MPFR_RNDD);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ /* nan + 2394875 == nan */
+ mpfr_set_nan (x);
+ mpfr_add_ui (y, x, 2394875L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* +inf + 2394875 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_add_ui (y, x, 2394875L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) > 0);
+
+ /* -inf + 2394875 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_add_ui (y, x, 2394875L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) < 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_add_ui
+#define INTEGER_TYPE unsigned long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric_ui.c"
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ special ();
+ check3 ("-1.716113812768534e-140", 1271212614, MPFR_RNDZ,
+ "1.27121261399999976e9");
+ check3 ("1.22191250737771397120e+20", 948002822, MPFR_RNDN,
+ "122191250738719408128.0");
+ check3 ("-6.72658901114033715233e-165", 2000878121, MPFR_RNDZ,
+ "2.0008781209999997615e9");
+ check3 ("-2.0769715792901673e-5", 880524, MPFR_RNDN,
+ "8.8052399997923023e5");
+ test_generic_ui (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tagm.c b/tests/tagm.c
new file mode 100644
index 0000000..ae561ac
--- /dev/null
+++ b/tests/tagm.c
@@ -0,0 +1,277 @@
+/* Test file for mpfr_agm.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define check(a,b,r) check4(a,b,r,0.0)
+
+static void
+check4 (const char *as, const char *bs, mpfr_rnd_t rnd_mode,
+ const char *res, int inex)
+{
+ mpfr_t ta, tb, tc, tres;
+ mpfr_exp_t emin, emax;
+ int i;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_inits2 (53, ta, tb, tc, tres, (mpfr_ptr) 0);
+
+ for (i = 0; i <= 2; i++)
+ {
+ unsigned int expflags, newflags;
+ int inex2;
+
+ mpfr_set_str1 (ta, as);
+ mpfr_set_str1 (tb, bs);
+ mpfr_set_str1 (tc, res);
+
+ if (i > 0)
+ {
+ mpfr_exp_t ea, eb, ec, e0;
+
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+
+ ea = mpfr_get_exp (ta);
+ eb = mpfr_get_exp (tb);
+ ec = mpfr_get_exp (tc);
+
+ e0 = i == 1 ? __gmpfr_emin : __gmpfr_emax;
+ if ((i == 1 && ea < eb) || (i == 2 && ea > eb))
+ {
+ mpfr_set_exp (ta, e0);
+ mpfr_set_exp (tb, e0 + (eb - ea));
+ mpfr_set_exp (tc, e0 + (ec - ea));
+ }
+ else
+ {
+ mpfr_set_exp (ta, e0 + (ea - eb));
+ mpfr_set_exp (tb, e0);
+ mpfr_set_exp (tc, e0 + (ec - eb));
+ }
+ }
+
+ __gmpfr_flags = expflags =
+ (randlimb () & 1) ? MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE : 0;
+ inex2 = mpfr_agm (tres, ta, tb, rnd_mode);
+ newflags = __gmpfr_flags;
+ expflags |= MPFR_FLAGS_INEXACT;
+
+ if (SIGN (inex2) != inex || newflags != expflags ||
+ ! mpfr_equal_p (tres, tc))
+ {
+ printf ("mpfr_agm failed in rnd_mode=%s for\n",
+ mpfr_print_rnd_mode (rnd_mode));
+ printf (" a = ");
+ mpfr_out_str (stdout, 10, 0, ta, MPFR_RNDN);
+ printf ("\n");
+ printf (" b = ");
+ mpfr_out_str (stdout, 10, 0, tb, MPFR_RNDN);
+ printf ("\n");
+ printf ("expected inex = %d, flags = %u,\n"
+ " ", inex, expflags);
+ mpfr_dump (tc);
+ printf ("got inex = %d, flags = %u,\n"
+ " ", inex2, newflags);
+ mpfr_dump (tres);
+ exit (1);
+ }
+
+ set_emin (emin);
+ set_emax (emax);
+ }
+
+ mpfr_clears (ta, tb, tc, tres, (mpfr_ptr) 0);
+}
+
+static void
+check_large (void)
+{
+ mpfr_t a, b, agm;
+ int inex;
+
+ mpfr_init2 (a, 82);
+ mpfr_init2 (b, 82);
+ mpfr_init2 (agm, 82);
+
+ mpfr_set_ui (a, 1, MPFR_RNDN);
+ mpfr_set_str_binary (b, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010E-39");
+ mpfr_agm (agm, a, b, MPFR_RNDN);
+ mpfr_set_str_binary (a, "0.1110001000111101101010101010101101001010001001001011100101111011110101111001111100E-4");
+ if (mpfr_cmp (agm, a))
+ {
+ printf ("mpfr_agm failed for precision 82\n");
+ exit (1);
+ }
+
+ /* problem found by Damien Fischer <damien@maths.usyd.edu.au> 4 Aug 2003:
+ produced a divide-by-zero exception */
+ mpfr_set_prec (a, 268);
+ mpfr_set_prec (b, 268);
+ mpfr_set_prec (agm, 268);
+ mpfr_set_str (a, "703.93543315330225238487276503953366664991725089988315253092140138947103394917006", 10, MPFR_RNDN);
+ mpfr_set_str (b, "703.93543315330225238487279020523738740563816490895994499256063816906728642622316", 10, MPFR_RNDN);
+ mpfr_agm (agm, a, b, MPFR_RNDN);
+
+ mpfr_set_prec (a, 18);
+ mpfr_set_prec (b, 70);
+ mpfr_set_prec (agm, 67);
+ mpfr_set_str_binary (a, "0.111001111100101000e8");
+ mpfr_set_str_binary (b, "0.1101110111100100010100110000010111011011011100110100111001010100100001e10");
+ inex = mpfr_agm (agm, a, b, MPFR_RNDN);
+ mpfr_set_str_binary (b, "0.1111110010011101101100010101011011010010010000001010100011000110011e9");
+ if (mpfr_cmp (agm, b))
+ {
+ printf ("Error in mpfr_agm (1)\n");
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Wrong flag for mpfr_agm (1)\n");
+ exit (1);
+ }
+
+ /* test worst case: 9 consecutive ones after the last bit */
+ mpfr_set_prec (a, 2);
+ mpfr_set_prec (b, 2);
+ mpfr_set_ui (a, 1, MPFR_RNDN);
+ mpfr_set_ui (b, 2, MPFR_RNDN);
+ mpfr_set_prec (agm, 904);
+ mpfr_agm (agm, a, b, MPFR_RNDZ);
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (agm);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y, m;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+ mpfr_init2 (m, 123L);
+
+ /* agm(1,nan) == nan */
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
+ mpfr_set_nan (y);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (m));
+
+ /* agm(1,+inf) == +inf */
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (m));
+ MPFR_ASSERTN (mpfr_sgn (m) > 0);
+
+ /* agm(+inf,+inf) == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, 1);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (m));
+ MPFR_ASSERTN (mpfr_sgn (m) > 0);
+
+ /* agm(-inf,+inf) == nan */
+ mpfr_set_inf (x, -1);
+ mpfr_set_inf (y, 1);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (m));
+
+ /* agm(+0,+inf) == nan */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (m));
+
+ /* agm(+0,1) == +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m));
+
+ /* agm(-0,1) == +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m));
+
+ /* agm(-0,+0) == +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (m) && MPFR_IS_POS(m));
+
+ /* agm(1,1) == 1 */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (m ,1) == 0);
+
+ /* agm(-1,-2) == NaN */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_si (y, -2, MPFR_RNDN);
+ mpfr_agm (m, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (m));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (m);
+}
+
+#define TEST_FUNCTION mpfr_agm
+#define TWO_ARGS
+#define TEST_RANDOM_POS 4
+#define TEST_RANDOM_POS2 4
+#include "tgeneric.c"
+
+int
+main (int argc, char* argv[])
+{
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ check_large ();
+ check4 ("2.0", "1.0", MPFR_RNDN, "1.456791031046906869", -1);
+ check4 ("6.0", "4.0", MPFR_RNDN, "4.949360872472608925", 1);
+ check4 ("62.0", "61.0", MPFR_RNDN, "61.498983718845075902", -1);
+ check4 ("0.5", "1.0", MPFR_RNDN, "0.72839551552345343459", -1);
+ check4 ("1.0", "2.0", MPFR_RNDN, "1.456791031046906869", -1);
+ check4 ("234375765.0", "234375000.0", MPFR_RNDN, "234375382.49984394025", 1);
+ check4 ("8.0", "1.0", MPFR_RNDU, "3.61575617759736274873", 1);
+ check4 ("1.0", "44.0", MPFR_RNDU, "13.3658354512981243907", 1);
+ check4 ("1.0", "3.7252902984619140625e-9", MPFR_RNDU,
+ "0.07553933569711989657765", 1);
+ test_generic (2, 300, 17);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tai.c b/tests/tai.c
new file mode 100644
index 0000000..3e7bfdd
--- /dev/null
+++ b/tests/tai.c
@@ -0,0 +1,109 @@
+/* Test file for mpfr_ai.
+
+Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_ai
+#define TEST_RANDOM_EMIN -5
+#define TEST_RANDOM_EMAX 5
+#define REDUCE_EMAX 7 /* this is to avoid that test_generic() calls mpfr_ai
+ with too large inputs. FIXME: remove this once
+ mpfr_ai can handle large inputs */
+#include "tgeneric.c"
+
+static void
+check_large (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_init2 (x, 38);
+ mpfr_init2 (y, 110);
+ mpfr_init2 (z, 110);
+ mpfr_set_str_binary (x, "-1E8");
+ mpfr_ai (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (z, "-10001110100001011111110001100011101100011100010000110100100101011111011100000101110101010010000000101110011111E-112");
+ if (mpfr_equal_p (y, z) == 0)
+ {
+ printf ("Error in mpfr_ai for x=-2^8\n");
+ exit (1);
+ }
+#if 0 /* disabled since mpfr_ai does not currently handle large arguments */
+ mpfr_set_str_binary (x, "-1E26");
+ mpfr_ai (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (z, "-110001111100000011001010010101001101001011001011101011001010100100001110001101101101000010000011001000001011E-118");
+ if (mpfr_equal_p (y, z) == 0)
+ {
+ printf ("Error in mpfr_ai for x=-2^26\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "-0.11111111111111111111111111111111111111E1073741823");
+ mpfr_ai (y, x, MPFR_RNDN);
+ /* FIXME: compute the correctly rounded value we should get for Ai(x),
+ and check we get this value */
+#endif
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_zero (void)
+{
+ mpfr_t x, y, r;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_init2 (r, 53);
+
+ mpfr_set_str_binary (r, "10110101110001100011110010110001001110001010110111E-51");
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_ai (y, x, MPFR_RNDN);
+ if (mpfr_equal_p (y, r) == 0)
+ {
+ printf ("Error in mpfr_ai for x=0\n");
+ printf ("Expected "); mpfr_dump (r);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (r);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_large ();
+ check_zero ();
+
+ test_generic (2, 100, 5);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tasin.c b/tests/tasin.c
new file mode 100644
index 0000000..c72ca0c
--- /dev/null
+++ b/tests/tasin.c
@@ -0,0 +1,285 @@
+/* Test file for mpfr_asin.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_asin
+#define TEST_RANDOM_EMAX 7
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int r;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* asin(NaN) = NaN */
+ mpfr_set_nan (x);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_asin (NaN) <> NaN\n");
+ exit (1);
+ }
+
+ /* asin(+/-Inf) = NaN */
+ mpfr_set_inf (x, 1);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_asin (+Inf) <> NaN\n");
+ exit (1);
+ }
+ mpfr_set_inf (x, -1);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_asin (-Inf) <> NaN\n");
+ exit (1);
+ }
+
+ /* asin(+/-2) = NaN */
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_asin (+2) <> NaN\n");
+ exit (1);
+ }
+ mpfr_set_si (x, -2, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_asin (-2) <> NaN\n");
+ exit (1);
+ }
+
+ /* asin(+/-0) = +/-0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: mpfr_asin (+0) <> +0\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: mpfr_asin (-0) <> -0\n");
+ exit (1);
+ }
+
+ /* asin(1) = Pi/2 */
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ mpfr_set_ui (x, 1, MPFR_RNDN); /* exact */
+ mpfr_asin (y, x, (mpfr_rnd_t) r);
+ mpfr_const_pi (x, (mpfr_rnd_t) r);
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: asin(1) != Pi/2 for rnd=%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ /* asin(-1) = -Pi/2 */
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ mpfr_set_si (x, -1, MPFR_RNDN); /* exact */
+ mpfr_asin (y, x, (mpfr_rnd_t) r);
+ mpfr_const_pi (x, MPFR_INVERT_RND((mpfr_rnd_t) r));
+ mpfr_neg (x, x, MPFR_RNDN); /* exact */
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN); /* exact */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: asin(-1) != -Pi/2 for rnd=%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ mpfr_set_str_binary (x, "0.1101110111111111001011101000101");
+ mpfr_asin (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "1.00001100101011000001111100111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_asin (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-0.01110111000011101010111100000101");
+ mpfr_asin (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.0111101111010100011111110101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_asin (2)\n");
+ mpfr_print_binary (x); printf ("\n");
+ mpfr_print_binary (y); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 9);
+ mpfr_set_prec (y, 19);
+ mpfr_set_str_binary (x, "0.110000000E-6");
+ mpfr_asin (y, x, MPFR_RNDD);
+ mpfr_set_prec (x, 19);
+ mpfr_set_str_binary (x, "0.1100000000000001001E-6");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_asin (3)\n");
+ mpfr_dump (x);
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 48);
+ mpfr_set_str_binary (x, "0.101100100000000000110100E0");
+ mpfr_asin (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.110001001101001111110000010110001000111011001000E0",
+ 2, MPFR_RNDN))
+ {
+ printf("Special Overflow error.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_clear (y);
+ mpfr_clear (x);
+ set_emin (emin);
+ set_emax (emax);
+}
+
+/* bug reported by Kevin Rauch on 15 December 2007 */
+static void
+test20071215 (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_zero_p (y) && MPFR_IS_NEG(y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_asin (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_zero_p (y) && MPFR_IS_POS(y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+reduced_expo_range (void)
+{
+ mpfr_exp_t emin, emax;
+ mpfr_t x, y, ex_y;
+ int inex, ex_inex;
+ unsigned int flags, ex_flags;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_inits2 (4, x, y, ex_y, (mpfr_ptr) 0);
+ mpfr_set_str (x, "-0.1e1", 2, MPFR_RNDN);
+
+ mpfr_set_emin (1);
+ mpfr_set_emax (1);
+ mpfr_clear_flags ();
+ inex = mpfr_asin (y, x, MPFR_RNDA);
+ flags = __gmpfr_flags;
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+
+ mpfr_set_str (ex_y, "-0.1101e1", 2, MPFR_RNDN);
+ ex_inex = -1;
+ ex_flags = MPFR_FLAGS_INEXACT;
+
+ if (SIGN (inex) != ex_inex || flags != ex_flags ||
+ ! mpfr_equal_p (y, ex_y))
+ {
+ printf ("Error in reduced_expo_range\non x = ");
+ mpfr_dump (x);
+ printf ("Expected y = ");
+ mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
+ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
+ printf ("Got y = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
+ exit (1);
+ }
+
+ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ special ();
+ special_overflow ();
+ reduced_expo_range ();
+
+ test_generic (2, 100, 15);
+
+ tests_end_mpfr ();
+
+ data_check ("data/asin", mpfr_asin, "mpfr_asin");
+ bad_cases (mpfr_asin, mpfr_sin, "mpfr_asin", 256, -40, 1, 4, 128, 800, 30);
+
+ test20071215 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tasinh.c b/tests/tasinh.c
new file mode 100644
index 0000000..8dabcdc
--- /dev/null
+++ b/tests/tasinh.c
@@ -0,0 +1,161 @@
+/* Test file for mpfr_asinh.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_asinh
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ MPFR_SET_INF(x);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_asinh (x, y, MPFR_RNDN);
+ if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
+ {
+ printf ("Inf flag not clears in asinh!\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_asinh (x, y, MPFR_RNDN);
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
+ {
+ printf ("NAN flag not clears in asinh!\n");
+ exit (1);
+ }
+
+ /* asinh(+0) = +0, asinh(-0) = -0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: mpfr_asinh(+0) <> +0\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: mpfr_asinh(-0) <> -0\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_asinh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_asinh(NaN) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_asinh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: mpfr_asinh(+Inf) <> +Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_asinh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: mpfr_asinh(-Inf) <> -Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1");
+ mpfr_asinh (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.10100110010010101101010011011101E-1");
+ if (!mpfr_equal_p (x, y))
+ {
+ printf ("Error: mpfr_asinh (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-.10110011011010111110010001100001");
+ mpfr_asinh (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-.10100111010000111001011100110011");
+ if (!mpfr_equal_p (x, y))
+ {
+ printf ("Error: mpfr_asinh (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_prec (y, 43);
+ mpfr_set_str_binary (x, "0.111001101100000110011001010000101");
+ mpfr_asinh (y, x, MPFR_RNDZ);
+ mpfr_init2 (z, 43);
+ mpfr_set_str_binary (z, "0.1100111101010101101010101110000001000111001");
+ if (!mpfr_equal_p (y, z))
+ {
+ printf ("Error: mpfr_asinh (3)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str (x, "1.8000000000009@-6", 16, MPFR_RNDN);
+ mpfr_asinh (y, x, MPFR_RNDZ);
+ mpfr_set_prec (z, 2);
+ mpfr_set_str (z, "1.0@-6", 16, MPFR_RNDN);
+ if (!mpfr_equal_p (y, z))
+ {
+ printf ("Error: mpfr_asinh (4)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_generic (2, 100, 25);
+
+ data_check ("data/asinh", mpfr_asinh, "mpfr_asinh");
+ bad_cases (mpfr_asinh, mpfr_sinh, "mpfr_asinh", 256, -128, 29,
+ 4, 128, 800, 40);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tatan.c b/tests/tatan.c
new file mode 100644
index 0000000..fa5e2b4
--- /dev/null
+++ b/tests/tatan.c
@@ -0,0 +1,643 @@
+/* Test file for mpfr_atan.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+special (void)
+{
+ mpfr_t x, y, z;
+ int r;
+ int i;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_init2 (z, 53);
+
+ mpfr_set_str_binary (x, "1.0000100110000001100111100011001110101110100111011101");
+ mpfr_set_str_binary (y, "1.1001101101110100101100110011011101101000011010111110e-1");
+ mpfr_atan (z, x, MPFR_RNDN);
+ if (mpfr_cmp (y, z))
+ {
+ printf ("Error in mpfr_atan for prec=53, rnd=MPFR_RNDN\n");
+ printf ("x=");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\nexpected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ /* atan(+Inf) = Pi/2 */
+ for (r = 0; r < MPFR_RND_MAX ; r++)
+ {
+ mpfr_set_inf (x, 1);
+ mpfr_atan (y, x, (mpfr_rnd_t) r);
+ mpfr_const_pi (x, (mpfr_rnd_t) r);
+ mpfr_div_2exp (x, x, 1, (mpfr_rnd_t) r);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_atan(+Inf), rnd=%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ /* atan(-Inf) = - Pi/2 */
+ for (r = 0; r < MPFR_RND_MAX ; r++)
+ {
+ mpfr_set_inf (x, -1);
+ mpfr_atan (y, x, (mpfr_rnd_t) r);
+ mpfr_const_pi (x, MPFR_INVERT_RND((mpfr_rnd_t) r));
+ mpfr_neg (x, x, (mpfr_rnd_t) r);
+ mpfr_div_2exp (x, x, 1, (mpfr_rnd_t) r);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_atan(-Inf), rnd=%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ /* atan(NaN) = NaN */
+ mpfr_set_nan (x);
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_atan(NaN) <> NaN\n");
+ exit (1);
+ }
+
+ /* atan(+/-0) = +/-0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ MPFR_SET_NEG (y);
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
+ {
+ printf ("Error: mpfr_atan (+0) <> +0\n");
+ exit (1);
+ }
+ mpfr_atan (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) || MPFR_IS_NEG (x))
+ {
+ printf ("Error: mpfr_atan (+0) <> +0 (in place)\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ MPFR_SET_POS (y);
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || MPFR_IS_POS (y))
+ {
+ printf ("Error: mpfr_atan (-0) <> -0\n");
+ exit (1);
+ }
+ mpfr_atan (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) || MPFR_IS_POS (x))
+ {
+ printf ("Error: mpfr_atan (-0) <> -0 (in place)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ /* test one random positive argument */
+ mpfr_set_str_binary (x, "0.10000100001100101001001001011001");
+ mpfr_atan (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.1111010000001111001111000000011E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_atan (1)\n");
+ exit (1);
+ }
+
+ /* test one random negative argument */
+ mpfr_set_str_binary (x, "-0.1100001110110000010101011001011");
+ mpfr_atan (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.101001110001010010110001110001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_atan (2)\n");
+ mpfr_print_binary (x); printf ("\n");
+ mpfr_print_binary (y); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 192);
+ mpfr_set_prec (z, 192);
+ mpfr_set_str_binary (x, "-0.100e1");
+ mpfr_atan (z, x, MPFR_RNDD);
+ mpfr_set_str_binary (y, "-0.110010010000111111011010101000100010000101101000110000100011010011000100110001100110001010001011100000001101110000011100110100010010100100000010010011100000100010001010011001111100110001110101");
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error in mpfr_atan (3)\n");
+ printf ("Expected "); mpfr_print_binary (y); printf ("\n");
+ printf ("Got "); mpfr_print_binary (z); printf ("\n");
+ exit (1);
+ }
+
+ /* Test regression */
+ mpfr_set_prec (x, 51);
+ mpfr_set_prec (y, 51);
+ mpfr_set_str_binary (x,
+ "0.101100100000101111111010001111111000001000000000000E-11");
+ i = mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y,
+ "1.01100100000101111111001110011001010110100100000000e-12", 2, MPFR_RNDN)
+ || i >= 0)
+ {
+ printf ("Wrong Regression test (%d)\n", i);
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_atan (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_NEG (x));
+
+ /* Test regression */
+ mpfr_set_prec (x, 48);
+ mpfr_set_prec (y, 48);
+ mpfr_set_str_binary (x, "1.11001110010000011111100000010000000000000000000e-19");
+ mpfr_atan (y, x, MPFR_RNDD);
+ if (mpfr_cmp_str (y, "0.111001110010000011111100000001111111110000010011E-18", 2, MPFR_RNDN))
+ {
+ printf ("Error in mpfr_atan (4)\n");
+ printf ("Input 1.11001110010000011111100000010000000000000000000e-19 [prec=48]\n");
+ printf ("Expected 0.111001110010000011111100000001111111110000010011E-18\n");
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+#define TEST_FUNCTION mpfr_atan
+#define test_generic test_generic_atan
+#define RAND_FUNCTION(x) (mpfr_urandomb (x, RANDS), mpfr_mul_2si (x, x, (randlimb () %1000-500), MPFR_RNDN))
+#include "tgeneric.c"
+
+#define TEST_FUNCTION mpfr_atan2
+#define TWO_ARGS
+#define test_generic test_generic_atan2
+#include "tgeneric.c"
+
+#define TEST_FUNCTION mpfr_atan2
+#define TWO_ARGS
+#define RAND_FUNCTION(x) (mpfr_urandomb (x, RANDS), MPFR_SET_NEG (x))
+#define test_generic test_generic_atan2_neg
+#include "tgeneric.c"
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 48);
+ mpfr_set_str_binary (x, "0.101101010001001101111010E0");
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.100111011001100111000010111101000111010101011110E0",
+ 2, MPFR_RNDN))
+ {
+ printf("Special Overflow error.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* intermediate Pi overflows while atan(+Inf) = Pi/2 is representable */
+ set_emax (1);
+ mpfr_set_inf (x, +1);
+ mpfr_clear_flags ();
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "C90FDAA22169p-47", 16, MPFR_RNDN)
+ || mpfr_overflow_p ())
+ {
+ printf("atan(+Inf) = Pi/2 should not overflow when emax = %ld\n",
+ (long int) mpfr_get_emax ());
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* atan(+Inf) = Pi/2 underflows */
+ set_emax (128);
+ set_emin (3);
+ mpfr_clear_flags ();
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || !mpfr_underflow_p ())
+ {
+ printf("atan(+Inf) = Pi/2 should underflow when emin = %ld\n",
+ (long int) mpfr_get_emin ());
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* intermediate Pi overflows while atan(+1) = Pi/4 is representable */
+ set_emax (1);
+ set_emin (-128);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "C90FDAA22169p-48", 16, MPFR_RNDN)
+ || mpfr_overflow_p ())
+ {
+ printf("atan(+1) = Pi/4 should not overflow when emax = %ld\n",
+ (long int) mpfr_get_emax ());
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* atan(+1) = Pi/4 underflows and is rounded up to 1 */
+ set_emax (128);
+ set_emin (1);
+ mpfr_set_prec (y, 2);
+ mpfr_clear_flags ();
+ mpfr_atan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1) || !mpfr_underflow_p ())
+ {
+ printf("atan(+1) = Pi/4 should underflow when emin = %+ld\n",
+ (long int) mpfr_get_emin ());
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* atan(+1) = Pi/4 underflows and is rounded down to 0 */
+ mpfr_clear_flags ();
+ mpfr_atan (y, x, MPFR_RNDD);
+ if (mpfr_cmp_ui (y, 0) || !mpfr_underflow_p ())
+ {
+ printf("atan(+1) = Pi/4 should underflow when emin = %+ld\n",
+ (long int) mpfr_get_emin ());
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+ set_emin (emin);
+ set_emax (emax);
+}
+
+static void
+special_atan2 (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_inits2 (4, x, y, z, (mpfr_ptr) 0);
+
+ /* Anything with NAN should be set to NAN */
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_set_nan (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_NAN (z));
+ mpfr_swap (x, y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_NAN (z));
+
+ /* 0+ 0+ --> 0+ */
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
+ /* 0- 0+ --> 0- */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z));
+ /* 0- 0- --> -PI */
+ MPFR_CHANGE_SIGN (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0);
+ /* 0+ 0- --> +PI */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0);
+ /* 0+ -1 --> PI */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0);
+ /* 0- -1 --> -PI */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0);
+ /* 0- +1 --> 0- */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z));
+ /* 0+ +1 --> 0+ */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
+ /* +1 0+ --> PI/2 */
+ mpfr_swap (x, y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0);
+ /* +1 0- --> PI/2 */
+ MPFR_CHANGE_SIGN (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0);
+ /* -1 0- --> -PI/2 */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0);
+ /* -1 0+ --> -PI/2 */
+ MPFR_CHANGE_SIGN (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0);
+
+ /* -1 +INF --> -0 */
+ MPFR_SET_INF (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_NEG (z));
+ /* +1 +INF --> +0 */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
+ /* +1 -INF --> +PI */
+ MPFR_CHANGE_SIGN (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "3.1415", 10, MPFR_RNDN) == 0);
+ /* -1 -INF --> -PI */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-3.1415", 10, MPFR_RNDN) == 0);
+ /* -INF -1 --> -PI/2 */
+ mpfr_swap (x, y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-1.57075", 10, MPFR_RNDN) == 0);
+ /* +INF -1 --> PI/2 */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "1.57075", 10, MPFR_RNDN) == 0);
+ /* +INF -INF --> 3*PI/4 */
+ MPFR_SET_INF (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "2.356194490192344928", 10, MPFR_RNDN) == 0);
+ /* +INF +INF --> PI/4 */
+ MPFR_CHANGE_SIGN (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "0.785375", 10, MPFR_RNDN) == 0);
+ /* -INF +INF --> -PI/4 */
+ MPFR_CHANGE_SIGN (y);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-0.785375", 10, MPFR_RNDN) == 0);
+ /* -INF -INF --> -3*PI/4 */
+ MPFR_CHANGE_SIGN (x);
+ mpfr_atan2 (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-2.356194490192344928", 10, MPFR_RNDN) == 0);
+ mpfr_set_prec (z, 905); /* exercises Ziv's loop */
+ mpfr_atan2 (z, y, x, MPFR_RNDZ);
+ MPFR_ASSERTN (mpfr_cmp_str (z, "-2.35619449019234492884698253745962716314787704953132936573120844423086230471465674897102611900658780098661106488496172998532038345716293667379401955609636083808771307702645389082916973346721171619778647332160823174945008459635673617534008737395340143185923642519259526145784", 10, MPFR_RNDN) == 0);
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+/* from Christopher Creutzig, 18 Jul 2007 */
+static void
+smallvals_atan2 (void)
+{
+ mpfr_t a, x, y;
+ mpfr_exp_t old_emin;
+
+ mpfr_inits (a, x, y, (mpfr_ptr) 0);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ /* y=-2^(-emin-1), x=1 */
+
+ mpfr_atan2 (a, y, x, MPFR_RNDD);
+ MPFR_ASSERTN (mpfr_equal_p (a, y));
+
+ mpfr_atan2 (a, y, x, MPFR_RNDU);
+ MPFR_ASSERTN (mpfr_zero_p (a) && MPFR_IS_NEG(a));
+
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 8);
+ mpfr_set_prec (a, 8);
+ old_emin = mpfr_get_emin ();
+ mpfr_set_emin (MPFR_EMIN_MIN);
+
+ mpfr_set_si (y, 3, MPFR_RNDN);
+ mpfr_set_exp (y, mpfr_get_emin ());
+ mpfr_set_str_binary (x, "1.1");
+ mpfr_atan2 (a, y, x, MPFR_RNDU);
+ mpfr_set_si (y, 1, MPFR_RNDN);
+ mpfr_set_exp (y, mpfr_get_emin ());
+ MPFR_ASSERTN (mpfr_equal_p (a, y));
+
+ /* From a bug reported by Christopher Creutzig on 2007-08-28.
+ Added test in each rounding mode.
+ Segmentation fault or assertion failure due to an infinite Ziv loop. */
+ mpfr_set_si (y, 1, MPFR_RNDN);
+ mpfr_set_exp (y, mpfr_get_emin ());
+ mpfr_set_str_binary (x, "1.01");
+ mpfr_atan2 (a, y, x, MPFR_RNDZ);
+ MPFR_ASSERTN (mpfr_zero_p (a));
+ mpfr_atan2 (a, y, x, MPFR_RNDD);
+ MPFR_ASSERTN (mpfr_zero_p (a));
+ mpfr_atan2 (a, y, x, MPFR_RNDU);
+ MPFR_ASSERTN (mpfr_equal_p (a, y));
+ mpfr_atan2 (a, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_equal_p (a, y));
+
+ /* trigger underflow with rounding to nearest */
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_atan2 (a, y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (a));
+
+ mpfr_set_emin (old_emin);
+
+ mpfr_clears (a, x, y, (mpfr_ptr) 0);
+}
+
+/* Bug found by Robert Bajema (regression in MPFR 2.3.0).
+ The cause is the underflow flag set before the mpfr_atan2 call. */
+static void
+atan2_bug_20071003 (void)
+{
+ mpfr_t a, x, y, z;
+
+ mpfr_inits (a, x, y, z, (mpfr_ptr) 0);
+
+ mpfr_set_underflow ();
+ mpfr_set_str_binary (y,
+ "-0.10100110110100110111010110111111100110100010001110110E2");
+ mpfr_set_str_binary (x,
+ "0.10100101010110010100010010111000110110011110001011110E3");
+ mpfr_set_str_binary (z,
+ "-0.11101111001101101100111011001101000010010111101110110E-1");
+ mpfr_atan2 (a, y, x, MPFR_RNDN);
+ if (! mpfr_equal_p (a, z))
+ {
+ printf ("mpfr_atan2 fails on:\n");
+ printf (" y = ");
+ mpfr_dump (y);
+ printf (" x = ");
+ mpfr_dump (x);
+ printf ("Expected ");
+ mpfr_dump (z);
+ printf ("Got ");
+ mpfr_dump (a);
+ exit (1);
+ }
+
+ mpfr_clears (a, x, y, z, (mpfr_ptr) 0);
+}
+
+/* Bug found on 2009-04-29 by Christopher Creutzig.
+ * With r6179: atan.c:62: MPFR assertion failed: r > n
+ */
+static void
+atan2_different_prec (void)
+{
+ mpfr_t a, x, y;
+
+ mpfr_init2 (a, 59);
+ mpfr_init2 (x, 59);
+ mpfr_init2 (y, 86);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ mpfr_atan2 (a, y, x, MPFR_RNDN);
+
+ mpfr_clears (a, x, y, (mpfr_ptr) 0);
+}
+
+static void
+atan2_pow_of_2 (void)
+{
+ mpfr_t x, y, r, g;
+ int i;
+ int d[] = { 0, -1, 1 };
+ int ntests = sizeof (d) / sizeof (int);
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_init2 (r, 53);
+ mpfr_init2 (g, 53);
+
+ /* atan(42) */
+ mpfr_set_str_binary (g, "1100011000000011110011111001100110101000011010010011E-51");
+
+ for (i = 0; i < ntests; ++i)
+ {
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ mpfr_mul_2si (y, y, d[i], MPFR_RNDN);
+ mpfr_set_ui_2exp (x, 1, d[i], MPFR_RNDN);
+ mpfr_atan2 (r, y, x, MPFR_RNDN);
+ if (mpfr_equal_p (r, g) == 0)
+ {
+ printf ("Error in mpfr_atan2 (5)\n");
+ printf ("Expected "); mpfr_print_binary (g); printf ("\n");
+ printf ("Got "); mpfr_print_binary (r); printf ("\n");
+ exit (1);
+ }
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (r);
+ mpfr_clear (g);
+}
+
+/* https://sympa.inria.fr/sympa/arc/mpfr/2011-05/msg00008.html
+ * Incorrect flags (in debug mode on a 32-bit machine, assertion failure).
+ */
+static void
+reduced_expo_range (void)
+{
+ mpfr_exp_t emin, emax;
+ mpfr_t x, y, ex_y;
+ int inex, ex_inex;
+ unsigned int flags, ex_flags;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_inits2 (12, x, y, ex_y, (mpfr_ptr) 0);
+ mpfr_set_str (x, "0.1e-5", 2, MPFR_RNDN);
+
+ mpfr_set_emin (-5);
+ mpfr_set_emax (-5);
+ mpfr_clear_flags ();
+ inex = mpfr_atan (y, x, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+
+ mpfr_set_str (ex_y, "0.1e-5", 2, MPFR_RNDN);
+ ex_inex = 1;
+ ex_flags = MPFR_FLAGS_INEXACT;
+
+ if (SIGN (inex) != ex_inex || flags != ex_flags ||
+ ! mpfr_equal_p (y, ex_y))
+ {
+ printf ("Error in reduced_expo_range\non x = ");
+ mpfr_dump (x);
+ printf ("Expected y = ");
+ mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
+ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
+ printf ("Got y = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
+ exit (1);
+ }
+
+ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special_overflow ();
+ special ();
+ special_atan2 ();
+ smallvals_atan2 ();
+ atan2_bug_20071003 ();
+ atan2_different_prec ();
+ reduced_expo_range ();
+
+ test_generic_atan (2, 200, 17);
+ test_generic_atan2 (2, 200, 17);
+ test_generic_atan2_neg (2, 200, 17);
+
+ data_check ("data/atan", mpfr_atan, "mpfr_atan");
+ bad_cases (mpfr_atan, mpfr_tan, "mpfr_atan", 256, -40, 1, 4, 128, 800, 40);
+ atan2_pow_of_2 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tatanh.c b/tests/tatanh.c
new file mode 100644
index 0000000..72e2b3d
--- /dev/null
+++ b/tests/tatanh.c
@@ -0,0 +1,189 @@
+/* Test file for mpfr_atanh.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_atanh
+#define TEST_RANDOM_EMAX 7
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y, z;
+ int i;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ MPFR_SET_INF(x);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_atanh (x, y, MPFR_RNDN);
+ if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
+ {
+ printf ("Inf flag not clears in atanh!\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_atanh (x, y, MPFR_RNDN);
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x))
+ {
+ printf ("NAN flag not clears in atanh!\n");
+ exit (1);
+ }
+
+ /* atanh(+/-x) = NaN if x > 1 */
+ for (i = 3; i <= 6; i++)
+ {
+ mpfr_set_si (x, i, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_atanh(%d/2) <> NaN\n", i);
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_atanh(-%d/2) <> NaN\n", i);
+ exit (1);
+ }
+ }
+
+ /* atanh(+0) = +0, atanh(-0) = -0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: mpfr_atanh(+0) <> +0\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: mpfr_atanh(-0) <> -0\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_atanh(NaN) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_atanh(+Inf) <> NaN\n");
+ mpfr_print_binary (y); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: mpfr_atanh(-Inf) <> NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: mpfr_atanh(1) <> +Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_atanh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: mpfr_atanh(-1) <> -Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ mpfr_set_str_binary (x, "0.10001000001001011000100001E-6");
+ mpfr_atanh (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.10001000001001100101010110100001E-6");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_atanh (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-0.1101011110111100111010011001011E-1");
+ mpfr_atanh (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.11100110000100001111101100010111E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_atanh (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_prec (y, 43);
+ mpfr_set_str_binary (x, "0.111001101100000110011001010000101");
+ mpfr_atanh (y, x, MPFR_RNDZ);
+ mpfr_init2 (z, 43);
+ mpfr_set_str_binary (z, "1.01111010110001101001000000101101011110101");
+ if (mpfr_cmp (y, z))
+ {
+ printf ("Error: mpfr_atanh (3)\n");
+ mpfr_print_binary (y); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_generic (2, 100, 25);
+
+ data_check ("data/atanh", mpfr_atanh, "mpfr_atanh");
+ bad_cases (mpfr_atanh, mpfr_tanh, "mpfr_atanh", 256, -128, 9,
+ 4, 128, 800, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/taway.c b/tests/taway.c
new file mode 100644
index 0000000..2d93553
--- /dev/null
+++ b/tests/taway.c
@@ -0,0 +1,497 @@
+/* Test file for round away.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define DISP(s, t) {printf(s); mpfr_out_str(stdout, 2, 0, t, MPFR_RNDN); }
+#define DISP2(s,t) {DISP(s,t); putchar('\n');}
+
+#define SPECIAL_MAX 12
+
+static void
+set_special (mpfr_ptr x, unsigned int select)
+{
+ MPFR_ASSERTN (select < SPECIAL_MAX);
+ switch (select)
+ {
+ case 0:
+ MPFR_SET_NAN (x);
+ break;
+ case 1:
+ MPFR_SET_INF (x);
+ MPFR_SET_POS (x);
+ break;
+ case 2:
+ MPFR_SET_INF (x);
+ MPFR_SET_NEG (x);
+ break;
+ case 3:
+ MPFR_SET_ZERO (x);
+ MPFR_SET_POS (x);
+ break;
+ case 4:
+ MPFR_SET_ZERO (x);
+ MPFR_SET_NEG (x);
+ break;
+ case 5:
+ mpfr_set_str_binary (x, "1");
+ break;
+ case 6:
+ mpfr_set_str_binary (x, "-1");
+ break;
+ case 7:
+ mpfr_set_str_binary (x, "1e-1");
+ break;
+ case 8:
+ mpfr_set_str_binary (x, "1e+1");
+ break;
+ case 9:
+ mpfr_const_pi (x, MPFR_RNDN);
+ break;
+ case 10:
+ mpfr_const_pi (x, MPFR_RNDN);
+ MPFR_SET_EXP (x, MPFR_GET_EXP (x)-1);
+ break;
+ default:
+ mpfr_urandomb (x, RANDS);
+ break;
+ }
+}
+/* same than mpfr_cmp, but returns 0 for both NaN's */
+static int
+mpfr_compare (mpfr_srcptr a, mpfr_srcptr b)
+{
+ return (MPFR_IS_NAN(a)) ? !MPFR_IS_NAN(b) :
+ (MPFR_IS_NAN(b) || mpfr_cmp(a, b));
+}
+
+static void
+test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo)
+{
+ mpfr_t ref1, ref2, ref3;
+ mpfr_t res1;
+ mpfr_prec_t p1, p2, p3;
+ int i, inexa, inexd;
+ mpfr_rnd_t r;
+
+ p1 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p2 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p3 = (randlimb () % 200) + MPFR_PREC_MIN;
+
+ mpfr_init2 (ref1, p1);
+ mpfr_init2 (ref2, p2);
+ mpfr_init2 (ref3, p3);
+ mpfr_init2 (res1, p1);
+
+ /* for each variable, consider each of the following 6 possibilities:
+ NaN, +Infinity, -Infinity, +0, -0 or a random number */
+ for (i = 0; i < SPECIAL_MAX * SPECIAL_MAX; i++)
+ {
+ set_special (ref2, i%SPECIAL_MAX);
+ set_special (ref3, i/SPECIAL_MAX);
+
+ inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref1, ref2, ref3, r);
+
+ if (mpfr_compare (res1, ref1) || inexa != inexd)
+ {
+ printf ("Error with RNDA for %s with ", foo);
+ DISP("x=",ref2); DISP2(", y=",ref3);
+ printf ("inexa=%d inexd=%d\n", inexa, inexd);
+ printf ("expected "); mpfr_print_binary (ref1); puts ("");
+ printf ("got "); mpfr_print_binary (res1); puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (ref3);
+ mpfr_clear (res1);
+}
+
+static void
+test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr,
+ mpfr_rnd_t), const char *foo)
+{
+ mpfr_t ref, op1, op2, op3;
+ mpfr_prec_t pout, p1, p2, p3;
+ mpfr_t res;
+ int i, j, k, inexa, inexd;
+ mpfr_rnd_t r;
+
+ pout = (randlimb () % 200) + MPFR_PREC_MIN;
+ p1 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p2 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p3 = (randlimb () % 200) + MPFR_PREC_MIN;
+
+ mpfr_init2 (ref, pout);
+ mpfr_init2 (res, pout);
+ mpfr_init2 (op1, p1);
+ mpfr_init2 (op2, p2);
+ mpfr_init2 (op3, p3);
+
+ /* for each variable, consider each of the following 6 possibilities:
+ NaN, +Infinity, -Infinity, +0, -0 or a random number */
+
+ for (i = 0; i < SPECIAL_MAX; i++)
+ {
+ set_special (op1, i);
+ for (j = 0; j < SPECIAL_MAX; j++)
+ {
+ set_special (op2, j);
+ for (k = 0; k < SPECIAL_MAX; k++)
+ {
+ set_special (op3, k);
+
+ inexa = testfunc (res, op1, op2, op3, MPFR_RNDA);
+ r = MPFR_SIGN(res) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref, op1, op2, op3, r);
+
+ if (mpfr_compare (res, ref) || inexa != inexd)
+ {
+ printf ("Error with RNDA for %s with ", foo);
+ DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3);
+ printf ("inexa=%d inexd=%d\n", inexa, inexd);
+ DISP("expected ", ref); DISP2(", got ", res);
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (ref);
+ mpfr_clear (op1);
+ mpfr_clear (op2);
+ mpfr_clear (op3);
+ mpfr_clear (res);
+}
+
+static void
+test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mpfr_rnd_t),
+ const char *foo)
+{
+ mpfr_t ref1, ref2;
+ unsigned int ref3;
+ mpfr_t res1;
+ mpfr_prec_t p1, p2;
+ int i, inexa, inexd;
+ mpfr_rnd_t r;
+
+ p1 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p2 = (randlimb () % 200) + MPFR_PREC_MIN;
+
+ mpfr_init2 (ref1, p1);
+ mpfr_init2 (ref2, p2);
+ mpfr_init2 (res1, p1);
+
+ /* ref2 can be NaN, +Inf, -Inf, +0, -0 or any number
+ ref3 can be 0 or any number */
+ for (i = 0; i < SPECIAL_MAX * 2; i++)
+ {
+ set_special (ref2, i % SPECIAL_MAX);
+ ref3 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
+
+ inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref1, ref2, ref3, r);
+
+ if (mpfr_compare (res1, ref1) || inexa != inexd)
+ {
+ printf ("Error with RNDA for %s for c=%u\n", foo, ref3);
+ DISP2("a=",ref2);
+ printf ("inexa=%d inexd=%d\n", inexa, inexd);
+ printf ("expected "); mpfr_print_binary (ref1); puts ("");
+ printf ("got "); mpfr_print_binary (res1); puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (res1);
+}
+
+static void
+testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo)
+{
+ mpfr_t ref1, ref3;
+ unsigned int ref2;
+ mpfr_t res1;
+ mpfr_prec_t p1, p3;
+ int i, inexa, inexd;
+ mpfr_rnd_t r;
+
+ p1 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p3 = (randlimb () % 200) + MPFR_PREC_MIN;
+
+ mpfr_init2 (ref1, p1);
+ mpfr_init2 (ref3, p3);
+ mpfr_init2 (res1, p1);
+
+ for (i = 0; i < SPECIAL_MAX * 2; i++)
+ {
+ set_special (ref3, i % SPECIAL_MAX);
+ ref2 = i / SPECIAL_MAX == 0 ? 0 : randlimb ();
+
+ inexa = testfunc (res1, ref2, ref3, MPFR_RNDA);
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref1, ref2, ref3, r);
+
+ if (mpfr_compare (res1, ref1) || inexa != inexd)
+ {
+ printf ("Error with RNDA for %s for b=%u\n", foo, ref2);
+ DISP2("a=", ref3);
+ printf ("inexa=%d inexd=%d\n", inexa, inexd);
+ DISP("expected ", ref1); DISP2(", got ", res1);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref3);
+ mpfr_clear (res1);
+}
+
+/* foo(mpfr_ptr, mpfr_srcptr, mp_rndt) */
+static void
+test2 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), const char *foo)
+{
+ mpfr_t ref1, ref2;
+ mpfr_t res1;
+ mpfr_prec_t p1, p2;
+ int i, inexa, inexd;
+ mpfr_rnd_t r;
+
+ p1 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p2 = (randlimb () % 200) + MPFR_PREC_MIN;
+
+ mpfr_init2 (ref1, p1);
+ mpfr_init2 (ref2, p2);
+ mpfr_init2 (res1, p1);
+
+ for (i = 0; i < SPECIAL_MAX; i++)
+ {
+ set_special (ref2, i);
+
+ /* first round to away */
+ inexa = testfunc (res1, ref2, MPFR_RNDA);
+
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref1, ref2, r);
+ if (mpfr_compare (res1, ref1) || inexa != inexd)
+ {
+ printf ("Error with RNDA for %s with ", foo);
+ DISP2("x=", ref2);
+ printf ("inexa=%d inexd=%d\n", inexa, inexd);
+ DISP("expected ", ref1); DISP2(", got ", res1);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (res1);
+}
+
+/* one operand, two results, like mpfr_sin_cos */
+static void
+test3a (int (*testfunc)(mpfr_ptr, mpfr_ptr, mpfr_srcptr, mpfr_rnd_t),
+ const char *foo)
+{
+ mpfr_t ref1, ref2, ref3;
+ mpfr_t res1, res2;
+ mpfr_prec_t p1, p2, p3;
+ int i, inexa, inexd;
+ mpfr_rnd_t r;
+
+ p1 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p2 = (randlimb () % 200) + MPFR_PREC_MIN;
+ p3 = (randlimb () % 200) + MPFR_PREC_MIN;
+
+ mpfr_init2 (ref1, p1);
+ mpfr_init2 (ref2, p2);
+ mpfr_init2 (ref3, p3);
+ mpfr_init2 (res1, p1);
+ mpfr_init2 (res2, p2);
+
+ for (i = 0; i < SPECIAL_MAX; i++)
+ {
+ set_special (ref3, i);
+
+ inexa = testfunc (res1, res2, ref3, MPFR_RNDA);
+
+ /* first check wrt the first operand */
+ r = MPFR_SIGN(res1) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref1, ref2, ref3, r);
+ /* the low 2 bits of the inexact flag concern the 1st operand */
+ if (mpfr_compare (res1, ref1) || (inexa & 3) != (inexd & 3))
+ {
+ printf ("Error with RNDA for %s (1st operand)\n", foo);
+ DISP2("a=",ref3);
+ DISP("expected ", ref1); printf ("\n");
+ DISP("got ", res1); printf ("\n");
+ printf ("inexa=%d inexd=%d\n", inexa & 3, inexd & 3);
+ exit (1);
+ }
+
+ /* now check wrt the second operand */
+ r = MPFR_SIGN(res2) > 0 ? MPFR_RNDU : MPFR_RNDD;
+ inexd = testfunc (ref1, ref2, ref3, r);
+ /* bits 2..3 of the inexact flag concern the 2nd operand */
+ if (mpfr_compare (res2, ref2) || (inexa >> 2) != (inexd >> 2))
+ {
+ printf ("Error with RNDA for %s (2nd operand)\n", foo);
+ DISP2("a=",ref3);
+ DISP("expected ", ref2); printf ("\n");
+ DISP("got ", res2); printf ("\n");
+ printf ("inexa=%d inexd=%d\n", inexa >> 2, inexd >> 2);
+ exit (1);
+ }
+
+ }
+
+ mpfr_clear (ref1);
+ mpfr_clear (ref2);
+ mpfr_clear (ref3);
+ mpfr_clear (res1);
+ mpfr_clear (res2);
+}
+
+int
+main (void)
+{
+ int N = 20;
+
+ tests_start_mpfr ();
+
+ while (N--)
+ {
+ /* no need to test mpfr_round, mpfr_ceil, mpfr_floor, mpfr_trunc since
+ they take no rounding mode */
+
+ test2ui (mpfr_add_ui, "mpfr_add_ui");
+ test2ui (mpfr_div_2exp, "mpfr_div_2exp");
+ test2ui (mpfr_div_ui, "mpfr_div_ui");
+ test2ui (mpfr_mul_2exp, "mpfr_mul_2exp");
+ test2ui (mpfr_mul_ui, "mpfr_mul_ui");
+ test2ui (mpfr_pow_ui, "mpfr_pow_ui");
+ test2ui (mpfr_sub_ui, "mpfr_sub_ui");
+
+ testui2 (mpfr_ui_div, "mpfr_ui_div");
+ testui2 (mpfr_ui_sub, "mpfr_ui_sub");
+ testui2 (mpfr_ui_pow, "mpfr_ui_pow");
+
+ test2 (mpfr_sqr, "mpfr_sqr");
+ test2 (mpfr_sqrt, "mpfr_sqrt");
+ test2 (mpfr_abs, "mpfr_abs");
+ test2 (mpfr_neg, "mpfr_neg");
+
+ test2 (mpfr_log, "mpfr_log");
+ test2 (mpfr_log2, "mpfr_log2");
+ test2 (mpfr_log10, "mpfr_log10");
+ test2 (mpfr_log1p, "mpfr_log1p");
+
+ test2 (mpfr_exp, "mpfr_exp");
+ test2 (mpfr_exp2, "mpfr_exp2");
+ test2 (mpfr_exp10, "mpfr_exp10");
+ test2 (mpfr_expm1, "mpfr_expm1");
+ test2 (mpfr_eint, "mpfr_eint");
+
+ test2 (mpfr_sinh, "mpfr_sinh");
+ test2 (mpfr_cosh, "mpfr_cosh");
+ test2 (mpfr_tanh, "mpfr_tanh");
+ test2 (mpfr_asinh, "mpfr_asinh");
+ test2 (mpfr_acosh, "mpfr_acosh");
+ test2 (mpfr_atanh, "mpfr_atanh");
+ test2 (mpfr_sech, "mpfr_sech");
+ test2 (mpfr_csch, "mpfr_csch");
+ test2 (mpfr_coth, "mpfr_coth");
+
+ test2 (mpfr_asin, "mpfr_asin");
+ test2 (mpfr_acos, "mpfr_acos");
+ test2 (mpfr_atan, "mpfr_atan");
+ test2 (mpfr_cos, "mpfr_cos");
+ test2 (mpfr_sin, "mpfr_sin");
+ test2 (mpfr_tan, "mpfr_tan");
+ test2 (mpfr_sec, "mpfr_sec");
+ test2 (mpfr_csc, "mpfr_csc");
+ test2 (mpfr_cot, "mpfr_cot");
+
+ test2 (mpfr_erf, "mpfr_erf");
+ test2 (mpfr_erfc, "mpfr_erfc");
+ test2 (mpfr_j0, "mpfr_j0");
+ test2 (mpfr_j1, "mpfr_j1");
+ test2 (mpfr_y0, "mpfr_y0");
+ test2 (mpfr_y1, "mpfr_y1");
+ test2 (mpfr_zeta, "mpfr_zeta");
+ test2 (mpfr_gamma, "mpfr_gamma");
+ test2 (mpfr_lngamma, "mpfr_lngamma");
+
+ test2 (mpfr_rint, "mpfr_rint");
+ test2 (mpfr_rint_ceil, "mpfr_rint_ceil");
+ test2 (mpfr_rint_floor, "mpfr_rint_floor");
+ test2 (mpfr_rint_round, "mpfr_rint_round");
+ test2 (mpfr_rint_trunc, "mpfr_rint_trunc");
+ test2 (mpfr_frac, "mpfr_frac");
+
+ test3 (mpfr_add, "mpfr_add");
+ test3 (mpfr_sub, "mpfr_sub");
+ test3 (mpfr_mul, "mpfr_mul");
+ test3 (mpfr_div, "mpfr_div");
+
+ test3 (mpfr_agm, "mpfr_agm");
+ test3 (mpfr_min, "mpfr_min");
+ test3 (mpfr_max, "mpfr_max");
+
+ /* we don't test reldiff since it does not guarantee correct rounding,
+ thus we can get different results with RNDA and RNDU or RNDD. */
+ test3 (mpfr_dim, "mpfr_dim");
+
+ test3 (mpfr_remainder, "mpfr_remainder");
+ test3 (mpfr_pow, "mpfr_pow");
+ test3 (mpfr_atan2, "mpfr_atan2");
+ test3 (mpfr_hypot, "mpfr_hypot");
+
+ test3a (mpfr_sin_cos, "mpfr_sin_cos");
+
+ test4 (mpfr_fma, "mpfr_fma");
+ test4 (mpfr_fms, "mpfr_fms");
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+ test2 (mpfr_li2, "mpfr_li2");
+ test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt");
+ test3 (mpfr_fmod, "mpfr_fmod");
+ test3a (mpfr_modf, "mpfr_modf");
+ test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh");
+#endif
+ }
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tbuildopt.c b/tests/tbuildopt.c
new file mode 100644
index 0000000..f23514c
--- /dev/null
+++ b/tests/tbuildopt.c
@@ -0,0 +1,89 @@
+/* tbuildopt.c -- test file for mpfr_buildopt_tls_p and
+ mpfr_buildopt_decimal_p.
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include "mpfr-test.h"
+
+static void
+check_tls_p (void)
+{
+#ifdef MPFR_USE_THREAD_SAFE
+ if (!mpfr_buildopt_tls_p())
+ {
+ printf ("Error: mpfr_buildopt_tls_p should return true\n");
+ exit (1);
+ }
+#else
+ if (mpfr_buildopt_tls_p())
+ {
+ printf ("Error: mpfr_buildopt_tls_p should return false\n");
+ exit (1);
+ }
+#endif
+}
+
+static void
+check_decimal_p (void)
+{
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+ if (!mpfr_buildopt_decimal_p())
+ {
+ printf ("Error: mpfr_buildopt_decimal_p should return true\n");
+ exit (1);
+ }
+#else
+ if (mpfr_buildopt_decimal_p())
+ {
+ printf ("Error: mpfr_buildopt_decimal_p should return false\n");
+ exit (1);
+ }
+#endif
+}
+
+static void
+check_gmpinternals_p (void)
+{
+#if defined(MPFR_HAVE_GMP_IMPL) || defined(WANT_GMP_INTERNALS)
+ if (!mpfr_buildopt_gmpinternals_p())
+ {
+ printf ("Error: mpfr_buildopt_gmpinternals_p should return true\n");
+ exit (1);
+ }
+#else
+ if (mpfr_buildopt_gmpinternals_p())
+ {
+ printf ("Error: mpfr_buildopt_gmpinternals_p should return false\n");
+ exit (1);
+ }
+#endif
+}
+
+int
+main (void)
+{
+ check_tls_p();
+ check_decimal_p();
+ check_gmpinternals_p();
+
+ return 0;
+}
diff --git a/tests/tcan_round.c b/tests/tcan_round.c
new file mode 100644
index 0000000..4e03fe5
--- /dev/null
+++ b/tests/tcan_round.c
@@ -0,0 +1,127 @@
+/* Test file for mpfr_can_round.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define MAX_LIMB_SIZE 100
+
+static void
+check_round_p (void)
+{
+ mp_limb_t buf[MAX_LIMB_SIZE];
+ mp_size_t n, i;
+ mpfr_prec_t p;
+ mpfr_exp_t err;
+ int r1, r2;
+
+ for (n = 2 ; n <= MAX_LIMB_SIZE ; n++)
+ {
+ /* avoid mpn_random which leaks memory */
+ for (i = 0; i < n; i++)
+ buf[i] = randlimb ();
+ p = randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
+ err = p + randlimb () % GMP_NUMB_BITS;
+ r1 = mpfr_round_p (buf, n, err, p);
+ r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err,
+ MPFR_RNDN, MPFR_RNDZ, p);
+ if (r1 != r2)
+ {
+ printf ("mpfr_round_p(%d) != mpfr_can_round(%d)!\n"
+ "bn = %ld, err0 = %ld, prec = %lu\nbp = ",
+ r1, r2, n, (long) err, (unsigned long) p);
+ gmp_printf ("%NX\n", buf, n);
+ exit (1);
+ }
+ }
+}
+
+int
+main (void)
+{
+ mpfr_t x;
+ mpfr_prec_t i, j;
+
+ tests_start_mpfr ();
+
+ /* checks that rounds to nearest sets the last
+ bit to zero in case of equal distance */
+ mpfr_init2 (x, 59);
+ mpfr_set_str_binary (x, "-0.10010001010111000011110010111010111110000000111101100111111E663");
+ if (mpfr_can_round (x, 54, MPFR_RNDZ, MPFR_RNDZ, 53) != 0)
+ {
+ printf ("Error (1) in mpfr_can_round\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-Inf");
+ if (mpfr_can_round (x, 2000, MPFR_RNDZ, MPFR_RNDZ, 2000) != 0)
+ {
+ printf ("Error (2) in mpfr_can_round\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 64);
+ mpfr_set_str_binary (x, "0.1011001000011110000110000110001111101011000010001110011000000000");
+ if (mpfr_can_round (x, 65, MPFR_RNDN, MPFR_RNDN, 54))
+ {
+ printf ("Error (3) in mpfr_can_round\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 137);
+ mpfr_set_str_binary (x, "-0.10111001101001010110011000110100111010011101101010010100101100001110000100111111011101010110001010111100100101110111100001000010000000000E-97");
+ if (mpfr_can_round (x, 132, MPFR_RNDU, MPFR_RNDZ, 128) == 0)
+ {
+ printf ("Error (4) in mpfr_can_round\n");
+ exit (1);
+ }
+
+ /* in the following, we can round but cannot determine the inexact flag */
+ mpfr_set_prec (x, 86);
+ mpfr_set_str_binary (x, "-0.11100100010011001111011010100111101010011000000000000000000000000000000000000000000000E-80");
+ if (mpfr_can_round (x, 81, MPFR_RNDU, MPFR_RNDZ, 44) == 0)
+ {
+ printf ("Error (5) in mpfr_can_round\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 62);
+ mpfr_set_str (x, "0.ff4ca619c76ba69", 16, MPFR_RNDZ);
+ for (i = 30; i < 99; i++)
+ for (j = 30; j < 99; j++)
+ {
+ int r1, r2;
+ for (r1 = 0; r1 < MPFR_RND_MAX ; r1++)
+ for (r2 = 0; r2 < MPFR_RND_MAX ; r2++)
+ mpfr_can_round (x, i, (mpfr_rnd_t) r1, (mpfr_rnd_t) r2, j); /* test for assertions */
+ }
+
+ mpfr_clear (x);
+
+ check_round_p ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcbrt.c b/tests/tcbrt.c
new file mode 100644
index 0000000..1c96e51
--- /dev/null
+++ b/tests/tcbrt.c
@@ -0,0 +1,219 @@
+/* Test file for mpfr_cbrt.
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* cbrt(NaN) = NaN */
+ mpfr_set_nan (x);
+ mpfr_cbrt (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: cbrt(NaN) <> NaN\n");
+ exit (1);
+ }
+
+ /* cbrt(+Inf) = +Inf */
+ mpfr_set_inf (x, 1);
+ mpfr_cbrt (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: cbrt(+Inf) <> +Inf\n");
+ exit (1);
+ }
+
+ /* cbrt(-Inf) = -Inf */
+ mpfr_set_inf (x, -1);
+ mpfr_cbrt (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: cbrt(-Inf) <> -Inf\n");
+ exit (1);
+ }
+
+ /* cbrt(+/-0) = +/-0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: cbrt(+0) <> +0\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_cbrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: cbrt(-0) <> -0\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN);
+ mpfr_cbrt (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01"))
+ {
+ printf ("Error in crbrt (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "0.10000100001100101001001001011001");
+ mpfr_cbrt (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.11001101011000100111000111111001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in cbrt (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "-0.1100001110110000010101011001011");
+ mpfr_cbrt (x, x, MPFR_RNDD);
+ mpfr_set_str_binary (y, "-0.11101010000100100101000101011001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in cbrt (3)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 82);
+ mpfr_set_prec (y, 27);
+ mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7");
+ mpfr_cbrt (y, x, MPFR_RNDD);
+ mpfr_set_str_binary (x, "0.101011110001110001000100011E-2");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in cbrt (4)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 204);
+ mpfr_set_prec (y, 38);
+ mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5");
+ mpfr_cbrt (y, x, MPFR_RNDD);
+ mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in cbrt (5)\n");
+ exit (1);
+ }
+
+ /* Bug (in the compiler?) found on Linux/m68k with gcc 4.0.2 */
+ mpfr_set_prec (x, 5);
+ mpfr_set_prec (y, 5);
+ mpfr_set_str_binary (x, "1.1000E-2");
+ mpfr_cbrt (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "1.0111E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in cbrt (6)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_cbrt
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x;
+ int r;
+ mpfr_prec_t p;
+
+ tests_start_mpfr ();
+
+ special ();
+
+ mpfr_init (x);
+
+ for (p=2; p<100; p++)
+ {
+ mpfr_set_prec (x, p);
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_cbrt (x, x, (mpfr_rnd_t) r);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_cbrt for x=1, rnd=%s\ngot ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_cbrt (x, x, (mpfr_rnd_t) r);
+ if (mpfr_cmp_si (x, -1))
+ {
+ printf ("Error in mpfr_cbrt for x=-1, rnd=%s\ngot ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ if (p >= 5)
+ {
+ int i;
+ for (i = -12; i <= 12; i++)
+ {
+ mpfr_set_ui (x, 27, MPFR_RNDN);
+ mpfr_mul_2si (x, x, 3*i, MPFR_RNDN);
+ mpfr_cbrt (x, x, MPFR_RNDN);
+ if (mpfr_cmp_si_2exp (x, 3, i))
+ {
+ printf ("Error in mpfr_cbrt for "
+ "x = 27.0 * 2^(%d), rnd=%s\ngot ",
+ 3*i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ninstead of 3 * 2^(%d)\n", i);
+ exit (1);
+ }
+ }
+ }
+ }
+ }
+ mpfr_clear (x);
+
+ test_generic (2, 200, 10);
+
+ data_check ("data/cbrt", mpfr_cbrt, "mpfr_cbrt");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcheck.c b/tests/tcheck.c
new file mode 100644
index 0000000..300916d
--- /dev/null
+++ b/tests/tcheck.c
@@ -0,0 +1,125 @@
+/* Test file for mpfr_check.
+
+Copyright 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "mpfr-test.h"
+
+#define ERROR(s) \
+ (printf ("mpfr_check failed " s " Prec=%lu\n", (unsigned long) pr), \
+ exit(1))
+
+int
+main (void)
+{
+ mpfr_t a;
+ mp_limb_t *p, tmp;
+ mp_size_t s;
+ mpfr_prec_t pr;
+ int max;
+
+ tests_start_mpfr ();
+ for(pr = MPFR_PREC_MIN ; pr < 500 ; pr++)
+ {
+ mpfr_init2 (a, pr);
+ if (!mpfr_check(a)) ERROR("for init");
+ /* Check special cases */
+ MPFR_SET_NAN(a);
+ if (!mpfr_check(a)) ERROR("for nan");
+ MPFR_SET_POS(a);
+ MPFR_SET_INF(a);
+ if (!mpfr_check(a)) ERROR("for inf");
+ MPFR_SET_ZERO(a);
+ if (!mpfr_check(a)) ERROR("for zero");
+ /* Check var */
+ mpfr_set_ui(a, 2, MPFR_RNDN);
+ if (!mpfr_check(a)) ERROR("for set_ui");
+ mpfr_clear_overflow();
+ max = 1000; /* Allows max 2^1000 bits for the exponent */
+ while ((!mpfr_overflow_p()) && (max>0))
+ {
+ mpfr_mul(a, a, a, MPFR_RNDN);
+ if (!mpfr_check(a)) ERROR("for mul");
+ max--;
+ }
+ if (max==0) ERROR("can't reach overflow");
+ mpfr_set_ui(a, 2137, MPFR_RNDN);
+ /* Corrupt a and check for it */
+ MPFR_SIGN(a) = 2;
+ if (mpfr_check(a)) ERROR("sgn");
+ MPFR_SET_POS(a);
+ /* Check prec */
+ MPFR_PREC(a) = 1;
+ if (mpfr_check(a)) ERROR("precmin");
+#if MPFR_VERSION_MAJOR < 3
+ /* Disable the test with MPFR >= 3 since mpfr_prec_t is now signed.
+ The "if" below is sufficient, but the MPFR_PREC_MAX+1 generates
+ a warning with GCC 4.4.4 even though the test is always false. */
+ if ((mpfr_prec_t) 0 - 1 > 0)
+ {
+ MPFR_PREC(a) = MPFR_PREC_MAX+1;
+ if (mpfr_check(a)) ERROR("precmax");
+ }
+#endif
+ MPFR_PREC(a) = pr;
+ if (!mpfr_check(a)) ERROR("prec");
+ /* Check exponent */
+ MPFR_EXP(a) = MPFR_EXP_INVALID;
+ if (mpfr_check(a)) ERROR("exp invalid");
+ MPFR_EXP(a) = -MPFR_EXP_INVALID;
+ if (mpfr_check(a)) ERROR("-exp invalid");
+ MPFR_EXP(a) = 0;
+ if (!mpfr_check(a)) ERROR("exp 0");
+ /* Check Mantissa */
+ p = MPFR_MANT(a);
+ MPFR_MANT(a) = NULL;
+ if (mpfr_check(a)) ERROR("Mantissa Null Ptr");
+ MPFR_MANT(a) = p;
+ /* Check size */
+ s = MPFR_GET_ALLOC_SIZE(a);
+ MPFR_SET_ALLOC_SIZE(a, 0);
+ if (mpfr_check(a)) ERROR("0 size");
+ MPFR_SET_ALLOC_SIZE(a, MP_SIZE_T_MIN);
+ if (mpfr_check(a)) ERROR("min size");
+ MPFR_SET_ALLOC_SIZE(a, MPFR_LIMB_SIZE(a)-1 );
+ if (mpfr_check(a)) ERROR("size < prec");
+ MPFR_SET_ALLOC_SIZE(a, s);
+ /* Check normal form */
+ tmp = MPFR_MANT(a)[0];
+ if ((pr % GMP_NUMB_BITS) != 0)
+ {
+ MPFR_MANT(a)[0] = ~0;
+ if (mpfr_check(a)) ERROR("last bits non 0");
+ }
+ MPFR_MANT(a)[0] = tmp;
+ MPFR_MANT(a)[MPFR_LIMB_SIZE(a)-1] &= MPFR_LIMB_MASK (GMP_NUMB_BITS-1);
+ if (mpfr_check(a)) ERROR("last bits non 0");
+ /* Final */
+ mpfr_set_ui(a, 2137, MPFR_RNDN);
+ if (!mpfr_check(a)) ERROR("after last set");
+ mpfr_clear (a);
+ if (mpfr_check(a)) ERROR("after clear");
+ }
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcmp.c b/tests/tcmp.c
new file mode 100644
index 0000000..6bf6bdc
--- /dev/null
+++ b/tests/tcmp.c
@@ -0,0 +1,220 @@
+/* Test file for mpfr_cmp.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ double x, y;
+ mpfr_t xx, yy;
+ int c;
+ long i;
+ mpfr_prec_t p;
+
+ tests_start_mpfr ();
+
+ mpfr_init (xx);
+ mpfr_init (yy);
+
+ mpfr_set_prec (xx, 2);
+ mpfr_set_prec (yy, 2);
+ mpfr_set_str_binary(xx, "-0.10E0");
+ mpfr_set_str_binary(yy, "-0.10E0");
+ if ((mpfr_cmp) (xx, yy))
+ {
+ printf ("mpfr_cmp (xx, yy) returns non-zero for prec=2\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (xx, 65);
+ mpfr_set_prec (yy, 65);
+ mpfr_set_str_binary(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623");
+ mpfr_set_str_binary(yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623");
+ p = 0;
+ if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 64)
+ {
+ printf ("Error (1) in mpfr_cmp2\n");
+ exit (1);
+ }
+ mpfr_set_str_binary(xx, "0.10100010001110110111000010001000010011111101000100011101000011100");
+ mpfr_set_str_binary(yy, "0.10100010001110110111000010001000010011111101000100011101000011011");
+ p = 0;
+ if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 64)
+ {
+ printf ("Error (2) in mpfr_cmp2\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (xx, 160); mpfr_set_prec (yy, 160);
+ mpfr_set_str_binary (xx, "0.1E1");
+ mpfr_set_str_binary (yy, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100");
+ p = 0;
+ if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 144)
+ {
+ printf ("Error (3) in mpfr_cmp2\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (xx, 53);
+ mpfr_set_prec (yy, 200);
+ mpfr_set_ui (xx, 1, (mpfr_rnd_t) 0);
+ mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0);
+ if (mpfr_cmp (xx, yy) != 0)
+ {
+ printf ("Error in mpfr_cmp: 1.0 != 1.0\n");
+ exit (1);
+ }
+ mpfr_set_prec (yy, 31);
+ mpfr_set_str (xx, "1.0000000002", 10, (mpfr_rnd_t) 0);
+ mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0);
+ if (!(mpfr_cmp (xx,yy)>0))
+ {
+ printf ("Error in mpfr_cmp: not 1.0000000002 > 1.0\n");
+ exit (1);
+ }
+ mpfr_set_prec (yy, 53);
+
+ /* bug found by Gerardo Ballabio */
+ mpfr_set_ui(xx, 0, MPFR_RNDN);
+ mpfr_set_str (yy, "0.1", 10, MPFR_RNDN);
+ if ((c = mpfr_cmp (xx, yy)) >= 0)
+ {
+ printf ("Error in mpfr_cmp(0.0, 0.1), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_inf (xx, 1);
+ mpfr_set_str (yy, "-23489745.0329", 10, MPFR_RNDN);
+ if ((c = mpfr_cmp (xx, yy)) <= 0)
+ {
+ printf ("Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_inf (xx, 1);
+ mpfr_set_inf (yy, -1);
+ if ((c = mpfr_cmp (xx, yy)) <= 0)
+ {
+ printf ("Error in mpfr_cmp(Infp, Infm), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_inf (xx, -1);
+ mpfr_set_inf (yy, 1);
+ if ((c = mpfr_cmp (xx, yy)) >= 0)
+ {
+ printf ("Error in mpfr_cmp(Infm, Infp), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_inf (xx, 1);
+ mpfr_set_inf (yy, 1);
+ if ((c = mpfr_cmp (xx, yy)) != 0)
+ {
+ printf ("Error in mpfr_cmp(Infp, Infp), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_inf (xx, -1);
+ mpfr_set_inf (yy, -1);
+ if ((c = mpfr_cmp (xx, yy)) != 0)
+ {
+ printf ("Error in mpfr_cmp(Infm, Infm), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_inf (xx, -1);
+ mpfr_set_str (yy, "2346.09234", 10, MPFR_RNDN);
+ if ((c = mpfr_cmp (xx, yy)) >= 0)
+ {
+ printf ("Error in mpfr_cmp(Infm, 2346.09234), gives %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set_ui (xx, 0, MPFR_RNDN);
+ mpfr_set_ui (yy, 1, MPFR_RNDN);
+ if ((c = mpfr_cmp3 (xx, yy, 1)) >= 0)
+ {
+ printf ("Error: mpfr_cmp3 (0, 1, 1) gives %d instead of"
+ " a negative value\n", c);
+ exit (1);
+ }
+ if ((c = mpfr_cmp3 (xx, yy, -1)) <= 0)
+ {
+ printf ("Error: mpfr_cmp3 (0, 1, -1) gives %d instead of"
+ " a positive value\n", c);
+ exit (1);
+ }
+
+ for (i=0; i<500000; )
+ {
+ x = DBL_RAND ();
+ y = DBL_RAND ();
+ if (!Isnan(x) && !Isnan(y))
+ {
+ i++;
+ mpfr_set_d (xx, x, MPFR_RNDN);
+ mpfr_set_d (yy, y, MPFR_RNDN);
+ c = mpfr_cmp (xx,yy);
+ if ((c>0 && x<=y) || (c==0 && x!=y) || (c<0 && x>=y))
+ {
+ printf ("Error in mpfr_cmp with x=%1.20e, y=%1.20e"
+ " mpfr_cmp(x,y)=%d\n", x, y, c);
+ exit (1);
+ }
+ }
+ }
+
+ /* Check for NAN */
+ mpfr_set_nan (xx);
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp) (xx, yy);
+ if (c != 0 || !mpfr_erangeflag_p () )
+ {
+ printf ("NAN error (1)\n");
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp) (yy, xx);
+ if (c != 0 || !mpfr_erangeflag_p () )
+ {
+ printf ("NAN error (2)\n");
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp) (xx, xx);
+ if (c != 0 || !mpfr_erangeflag_p () )
+ {
+ printf ("NAN error (3)\n");
+ exit (1);
+ }
+
+ mpfr_clear (xx);
+ mpfr_clear (yy);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcmp2.c b/tests/tcmp2.c
new file mode 100644
index 0000000..04004cd
--- /dev/null
+++ b/tests/tcmp2.c
@@ -0,0 +1,348 @@
+/* Test file for mpfr_cmp2.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* set bit n of x to b, where bit 0 is the most significant one */
+static void
+set_bit (mpfr_t x, unsigned int n, int b)
+{
+ unsigned l;
+ mp_size_t xn;
+
+ xn = (MPFR_PREC(x) - 1) / mp_bits_per_limb;
+ l = n / mp_bits_per_limb;
+ n %= mp_bits_per_limb;
+ n = mp_bits_per_limb - 1 - n;
+ if (b)
+ MPFR_MANT(x)[xn - l] |= (mp_limb_t) 1 << n;
+ else
+ MPFR_MANT(x)[xn - l] &= ~((mp_limb_t) 1 << n);
+}
+
+/* check that for x = 1.u 1 v 0^k low(x)
+ y = 1.u 0 v 1^k low(y)
+ mpfr_cmp2 (x, y) returns 1 + |u| + |v| + k for low(x) >= low(y),
+ and 1 + |u| + |v| + k + 1 otherwise */
+static void
+worst_cases (void)
+{
+ mpfr_t x, y;
+ unsigned int i, j, k, b, expected;
+ mpfr_prec_t l;
+
+ mpfr_init2 (x, 200);
+ mpfr_init2 (y, 200);
+
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ for (i = 1; i < MPFR_PREC(x); i++)
+ {
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (y, y, 1, MPFR_RNDN); /* y = 1/2^i */
+
+ l = 0;
+ if (mpfr_cmp2 (x, y, &l) <= 0 || l != 1)
+ {
+ printf ("Error in mpfr_cmp2:\nx=");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ny=");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\ngot %lu instead of 1\n", (unsigned long) l);
+ exit (1);
+ }
+
+ mpfr_add (x, x, y, MPFR_RNDN); /* x = 1 + 1/2^i */
+ l = 0;
+ if (mpfr_cmp2 (x, y, &l) <= 0 || l != 0)
+ {
+ printf ("Error in mpfr_cmp2:\nx=");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ny=");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\ngot %lu instead of 0\n", (unsigned long) l);
+ exit (1);
+ }
+ }
+
+ for (i = 0; i < 64; i++) /* |u| = i */
+ {
+ mpfr_urandomb (x, RANDS);
+ mpfr_set (y, x, MPFR_RNDN);
+ set_bit (x, i + 1, 1);
+ set_bit (y, i + 1, 0);
+ for (j = 0; j < 64; j++) /* |v| = j */
+ {
+ b = randlimb () % 2;
+ set_bit (x, i + j + 2, b);
+ set_bit (y, i + j + 2, b);
+ for (k = 0; k < 64; k++)
+ {
+ if (k)
+ set_bit (x, i + j + k + 1, 0);
+ if (k)
+ set_bit (y, i + j + k + 1, 1);
+ set_bit (x, i + j + k + 2, 1);
+ set_bit (y, i + j + k + 2, 0);
+ l = 0; mpfr_cmp2 (x, y, &l);
+ expected = i + j + k + 1;
+ if (l != expected)
+ {
+ printf ("Error in mpfr_cmp2:\nx=");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ny=");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\ngot %lu instead of %u\n",
+ (unsigned long) l, expected);
+ exit (1);
+ }
+ set_bit (x, i + j + k + 2, 0);
+ set_bit (x, i + j + k + 3, 0);
+ set_bit (y, i + j + k + 3, 1);
+ l = 0; mpfr_cmp2 (x, y, &l);
+ expected = i + j + k + 2;
+ if (l != expected)
+ {
+ printf ("Error in mpfr_cmp2:\nx=");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ny=");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\ngot %lu instead of %u\n",
+ (unsigned long) l, expected);
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+tcmp2 (double x, double y, int i)
+{
+ mpfr_t xx, yy;
+ mpfr_prec_t j;
+
+ if (i == -1)
+ {
+ if (x == y)
+ i = 53;
+ else
+ i = (int) (__gmpfr_floor_log2 (x) - __gmpfr_floor_log2 (x - y));
+ }
+ mpfr_init2(xx, 53); mpfr_init2(yy, 53);
+ mpfr_set_d (xx, x, MPFR_RNDN);
+ mpfr_set_d (yy, y, MPFR_RNDN);
+ j = 0;
+ if (mpfr_cmp2 (xx, yy, &j) == 0)
+ {
+ if (x != y)
+ {
+ printf ("Error in mpfr_cmp2 for\nx=");
+ mpfr_out_str (stdout, 2, 0, xx, MPFR_RNDN);
+ printf ("\ny=");
+ mpfr_out_str (stdout, 2, 0, yy, MPFR_RNDN);
+ printf ("\ngot sign 0 for x != y\n");
+ exit (1);
+ }
+ }
+ else if (j != (unsigned) i)
+ {
+ printf ("Error in mpfr_cmp2 for\nx=");
+ mpfr_out_str (stdout, 2, 0, xx, MPFR_RNDN);
+ printf ("\ny=");
+ mpfr_out_str (stdout, 2, 0, yy, MPFR_RNDN);
+ printf ("\ngot %lu instead of %d\n", (unsigned long) j, i);
+ exit (1);
+ }
+ mpfr_clear(xx); mpfr_clear(yy);
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ mpfr_prec_t j;
+
+ mpfr_init (x); mpfr_init (y);
+
+ /* bug found by Nathalie Revol, 21 March 2001 */
+ mpfr_set_prec (x, 65);
+ mpfr_set_prec (y, 65);
+ mpfr_set_str_binary (x, "0.10000000000000000000000000000000000001110010010110100110011110000E1");
+ mpfr_set_str_binary (y, "0.11100100101101001100111011111111110001101001000011101001001010010E-35");
+ j = 0;
+ if (mpfr_cmp2 (x, y, &j) <= 0 || j != 1)
+ {
+ printf ("Error in mpfr_cmp2:\n");
+ printf ("x=");
+ mpfr_print_binary (x);
+ puts ("");
+ printf ("y=");
+ mpfr_print_binary (y);
+ puts ("");
+ printf ("got %lu, expected 1\n", (unsigned long) j);
+ exit (1);
+ }
+
+ mpfr_set_prec(x, 127); mpfr_set_prec(y, 127);
+ mpfr_set_str_binary(x, "0.1011010000110111111000000101011110110001000101101011011110010010011110010000101101000010011001100110010000000010110000101000101E6");
+ mpfr_set_str_binary(y, "0.1011010000110111111000000101011011111100011101000011001111000010100010100110110100110010011001100110010000110010010110000010110E6");
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 32)
+ {
+ printf ("Error in mpfr_cmp2:\n");
+ printf ("x="); mpfr_print_binary(x); puts ("");
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("got %lu, expected 32\n", (unsigned long) j);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 128); mpfr_set_prec (y, 239);
+ mpfr_set_str_binary (x, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100100000000000E167");
+ mpfr_set_str_binary (y, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100011111111111111111111111111111111111111111111111011111100101011100011001101000100111000010000000000101100110000111111000101E167");
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 164)
+ {
+ printf ("Error in mpfr_cmp2:\n");
+ printf ("x="); mpfr_print_binary(x); puts ("");
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("got %lu, expected 164\n", (unsigned long) j);
+ exit (1);
+ }
+
+ /* bug found by Nathalie Revol, 29 March 2001 */
+ mpfr_set_prec (x, 130); mpfr_set_prec (y, 130);
+ mpfr_set_str_binary (x, "0.1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E2");
+ mpfr_set_str_binary (y, "0.1011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100E2");
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 127)
+ {
+ printf ("Error in mpfr_cmp2:\n");
+ printf ("x="); mpfr_print_binary(x); puts ("");
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("got %lu, expected 127\n", (unsigned long) j);
+ exit (1);
+ }
+
+ /* bug found by Nathalie Revol, 2 Apr 2001 */
+ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.10011111111111111111111111111111111111111111111111111111111111101E3");
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 63)
+ {
+ printf ("Error in mpfr_cmp2:\n");
+ printf ("x="); mpfr_print_binary(x); puts ("");
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("got %lu, expected 63\n", (unsigned long) j);
+ exit (1);
+ }
+
+ /* bug found by Nathalie Revol, 2 Apr 2001 */
+ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65);
+ mpfr_set_str_binary (x, "0.10011011111000101001110000000000000000000000000000000000000000000E-69");
+ mpfr_set_str_binary (y, "0.10011011111000101001101111111111111111111111111111111111111111101E-69");
+ j = 0;
+ if (mpfr_cmp2(x, y, &j) <= 0 || j != 63)
+ {
+ printf ("Error in mpfr_cmp2:\n");
+ printf ("x="); mpfr_print_binary(x); puts ("");
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("got %lu, expected 63\n", (unsigned long) j);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 65);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
+ mpfr_set_str_binary (y, "0.11101110111100011101110111111111");
+ if (mpfr_cmp2 (x, y, &j) <= 0 || j != 0)
+ {
+ printf ("Error in mpfr_cmp2 (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2 * GMP_NUMB_BITS);
+ mpfr_set_prec (y, GMP_NUMB_BITS);
+ mpfr_set_ui (x, 1, MPFR_RNDN); /* x = 1 */
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_nextbelow (y); /* y = 1 - 2^(-GMP_NUMB_BITS) */
+ mpfr_cmp2 (x, y, &j);
+ if (mpfr_cmp2 (x, y, &j) <= 0 || j != GMP_NUMB_BITS)
+ {
+ printf ("Error in mpfr_cmp2 (2)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (void)
+{
+ int i;
+ long j;
+ double x, y, z;
+
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+ worst_cases ();
+ special ();
+ tcmp2 (5.43885304644369510000e+185, -1.87427265794105340000e-57, 1);
+ tcmp2 (1.06022698059744327881e+71, 1.05824655795525779205e+71, -1);
+ tcmp2 (1.0, 1.0, 53);
+ /* warning: cmp2 does not allow 0 as input */
+ for (x = 0.5, i = 1; i < 54; i++)
+ {
+ tcmp2 (1.0, 1.0-x, i);
+ x /= 2.0;
+ }
+ for (x = 0.5, i = 1; i < 100; i++)
+ {
+ tcmp2 (1.0, x, 1);
+ x /= 2.0;
+ }
+ for (j = 0; j < 100000; j++)
+ {
+ x = DBL_RAND ();
+ y = DBL_RAND ();
+ if (x < y)
+ {
+ z = x;
+ x = y;
+ y = z;
+ }
+ if (y != 0.0)
+ tcmp2 (x, y, -1);
+ }
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tcmp_d.c b/tests/tcmp_d.c
new file mode 100644
index 0000000..809c955
--- /dev/null
+++ b/tests/tcmp_d.c
@@ -0,0 +1,104 @@
+/* Test file for mpfr_cmp_d.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x;
+ int c;
+
+ tests_start_mpfr ();
+
+ mpfr_init2(x, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_d (x, 2.34763465, MPFR_RNDN);
+ if (mpfr_cmp_d(x, 2.34763465)!=0) {
+ printf("Error in mpfr_cmp_d 2.34763465 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+ if (mpfr_cmp_d(x, 2.345)<=0) {
+ printf("Error in mpfr_cmp_d 2.345 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+ if (mpfr_cmp_d(x, 2.4)>=0) {
+ printf("Error in mpfr_cmp_d 2.4 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
+ if (mpfr_cmp_d (x, 0.0)) {
+ printf("Error in mpfr_cmp_d 0.0 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDU);
+ if (mpfr_cmp_d (x, 0.0) == 0)
+ {
+ printf ("Error in mpfr_cmp_d (Inf, 0)\n");
+ exit (1);
+ }
+
+#if !defined(MPFR_ERRDIVZERO)
+ /* Check NAN */
+ mpfr_clear_erangeflag ();
+ c = mpfr_cmp_d (x, DBL_NAN);
+ if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for NAN (1)\n");
+#ifdef MPFR_NANISNAN
+ printf ("The reason is that NAN == NAN. Please look at the configure "
+ "output\nand Section \"In case of problem\" of the INSTALL "
+ "file.\n");
+#endif
+ exit (1);
+ }
+ mpfr_set_nan (x);
+ mpfr_clear_erangeflag ();
+ c = mpfr_cmp_d (x, 2.0);
+ if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for NAN (2)\n");
+#ifdef MPFR_NANISNAN
+ printf ("The reason is that NAN == NAN. Please look at the configure "
+ "output\nand Section \"In case of problem\" of the INSTALL "
+ "file.\n");
+#endif
+ exit (1);
+ }
+#endif /* MPFR_ERRDIVZERO */
+
+ mpfr_clear(x);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcmp_ld.c b/tests/tcmp_ld.c
new file mode 100644
index 0000000..3448983
--- /dev/null
+++ b/tests/tcmp_ld.c
@@ -0,0 +1,105 @@
+/* Test file for mpfr_cmp_ld.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x;
+ int c;
+
+ tests_start_mpfr ();
+
+ mpfr_init2(x, MPFR_LDBL_MANT_DIG);
+
+ mpfr_set_ld (x, 2.34763465L, MPFR_RNDN);
+ if (mpfr_cmp_ld(x, 2.34763465L)!=0) {
+ printf("Error in mpfr_cmp_ld 2.34763465 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+ if (mpfr_cmp_ld(x, 2.345L)<=0) {
+ printf("Error in mpfr_cmp_ld 2.345 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+ if (mpfr_cmp_ld(x, 2.4L)>=0) {
+ printf("Error in mpfr_cmp_ld 2.4 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
+ if (mpfr_cmp_ld (x, 0.0)) {
+ printf("Error in mpfr_cmp_ld 0.0 and ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit(1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_ui_div (x, 1, x, MPFR_RNDU);
+ if (mpfr_cmp_ld (x, 0.0) == 0)
+ {
+ printf ("Error in mpfr_cmp_ld (Inf, 0)\n");
+ exit (1);
+ }
+
+#if !defined(MPFR_ERRDIVZERO)
+ /* Check NAN */
+ mpfr_clear_erangeflag ();
+ c = mpfr_cmp_ld (x, DBL_NAN);
+ if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for NAN (1)\n");
+#ifdef MPFR_NANISNAN
+ printf ("The reason is that NAN == NAN. Please look at the configure "
+ "output\nand Section \"In case of problem\" of the INSTALL "
+ "file.\n");
+#endif
+ exit (1);
+ }
+ mpfr_set_nan (x);
+ mpfr_clear_erangeflag ();
+ c = mpfr_cmp_ld (x, 2.0);
+ if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for NAN (2)\n");
+#ifdef MPFR_NANISNAN
+ printf ("The reason is that NAN == NAN. Please look at the configure "
+ "output\nand Section \"In case of problem\" of the INSTALL "
+ "file.\n");
+#endif
+ exit (1);
+ }
+#endif /* MPFR_ERRDIVZERO */
+
+ mpfr_clear(x);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+
diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c
new file mode 100644
index 0000000..012955a
--- /dev/null
+++ b/tests/tcmp_ui.c
@@ -0,0 +1,346 @@
+/* Test file for mpfr_cmp_ui and mpfr_cmp_si.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef TCMP_UI_CHECK_NAN
+
+mpfr_clear_erangeflag ();
+c = mpfr_cmp_si (x, TCMP_UI_CHECK_NAN);
+if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("NaN error on %d (1)\n", TCMP_UI_CHECK_NAN);
+ exit (1);
+ }
+mpfr_clear_erangeflag ();
+c = (mpfr_cmp_si) (x, TCMP_UI_CHECK_NAN);
+if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("NaN error on %d (2)\n", TCMP_UI_CHECK_NAN);
+ exit (1);
+ }
+if (TCMP_UI_CHECK_NAN >= 0)
+ {
+ mpfr_clear_erangeflag ();
+ c = mpfr_cmp_ui (x, TCMP_UI_CHECK_NAN);
+ if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("NaN error on %d (3)\n", TCMP_UI_CHECK_NAN);
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp_ui) (x, TCMP_UI_CHECK_NAN);
+ if (c != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("NaN error on %d (4)\n", TCMP_UI_CHECK_NAN);
+ exit (1);
+ }
+ }
+
+#else
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check_nan (void)
+{
+ mpfr_t x;
+ int c, i;
+
+ mpfr_init (x);
+ mpfr_set_nan (x);
+ /* We need constants to completely test the macros. */
+#undef TCMP_UI_CHECK_NAN
+#define TCMP_UI_CHECK_NAN -17
+#include "tcmp_ui.c"
+#undef TCMP_UI_CHECK_NAN
+#define TCMP_UI_CHECK_NAN 0
+#include "tcmp_ui.c"
+#undef TCMP_UI_CHECK_NAN
+#define TCMP_UI_CHECK_NAN 17
+#include "tcmp_ui.c"
+ for (i = -17; i <= 17; i += 17)
+ {
+#undef TCMP_UI_CHECK_NAN
+#define TCMP_UI_CHECK_NAN i
+#include "tcmp_ui.c"
+ }
+ mpfr_clear (x);
+}
+
+/* Since mpfr_cmp_ui and mpfr_cmp_si are also implemented by a macro
+ with __builtin_constant_p for GCC, check that side effects are
+ handled correctly. */
+static void
+check_macros (void)
+{
+ mpfr_t x;
+ int c;
+
+ mpfr_init2 (x, 32);
+
+ c = 0;
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 17) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_ui(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, (c++, 17)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_ui(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (c != 1)
+ {
+ printf ("Error 3 on mpfr_cmp_ui(x,17) in check_macros\n"
+ "(c = %d instead of 1)\n", c);
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, 17) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_si(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, (c++, 17)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_si(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (c != 2)
+ {
+ printf ("Error 3 on mpfr_cmp_si(x,17) in check_macros\n"
+ "(c = %d instead of 2)\n", c);
+ exit (1);
+ }
+
+ c = 0;
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_ui(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, (c++, 0)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_ui(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (c != 1)
+ {
+ printf ("Error 3 on mpfr_cmp_ui(x,0) in check_macros\n"
+ "(c = %d instead of 1)\n", c);
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, 0) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_si(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, (c++, 0)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_si(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (c != 2)
+ {
+ printf ("Error 3 on mpfr_cmp_si(x,0) in check_macros\n"
+ "(c = %d instead of 2)\n", c);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+/* Bug in r7114 */
+static void
+test_macros (void)
+{
+ mpfr_t x[3];
+ mpfr_ptr p;
+
+ mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
+ mpfr_set_ui (x[0], 0, MPFR_RNDN);
+ p = x[0];
+ if (mpfr_cmp_ui (p++, 0) != 0)
+ {
+ printf ("Error in mpfr_cmp_ui macro: result should be 0.\n");
+ exit (1);
+ }
+ if (p != x[1])
+ {
+ printf ("Error in mpfr_cmp_ui macro: p - x[0] = %d (expecting 1)\n",
+ (int) (p - x[0]));
+ exit (1);
+ }
+ p = x[0];
+ if (mpfr_cmp_si (p++, 0) != 0)
+ {
+ printf ("Error in mpfr_cmp_si macro: result should be 0.\n");
+ exit (1);
+ }
+ if (p != x[1])
+ {
+ printf ("Error in mpfr_cmp_si macro: p - x[0] = %d (expecting 1)\n",
+ (int) (p - x[0]));
+ exit (1);
+ }
+ mpfr_clears (x[0], x[1], x[2], (mpfr_ptr) 0);
+}
+
+int
+main (void)
+{
+ mpfr_t x;
+ unsigned long i;
+ long s;
+
+ tests_start_mpfr ();
+
+ mpfr_init(x);
+
+ /* tests for cmp_ui */
+ mpfr_set_ui (x, 3, MPFR_RNDZ);
+ if ((mpfr_cmp_ui) (x, i = 3) != 0)
+ {
+ printf ("Error in mpfr_cmp_ui(3.0, 3)\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, i = 2) <= 0)
+ {
+ printf ("Error in mpfr_cmp_ui(3.0,2)\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, i = 4) >= 0)
+ {
+ printf ("Error in mpfr_cmp_ui(3.0,4)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
+ if (mpfr_cmp_ui (x, i = 0))
+ {
+ printf ("Error in mpfr_cmp_ui(0.0,0)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ if (mpfr_cmp_ui (x, i = 0) == 0)
+ {
+ printf ("Error in mpfr_cmp_ui(1.0,0)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ if (mpfr_cmp_ui (x, 1) <= 0)
+ {
+ printf ("Error in mpfr_cmp_ui (Inf, 0)\n");
+ exit (1);
+ }
+ mpfr_set_inf (x, -1);
+ if (mpfr_cmp_ui (x, 1) >= 0)
+ {
+ printf ("Error in mpfr_cmp_ui (-Inf, 0)\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 1) < 0);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) < 0);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) > 0);
+
+ /* tests for cmp_si */
+ (mpfr_set_si) (x, -3, MPFR_RNDZ);
+ if ((mpfr_cmp_si) (x, s = -3) != 0)
+ {
+ printf ("Error in mpfr_cmp_si(-3.0,-3)\n");
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, s = -4) <= 0)
+ {
+ printf ("Error in mpfr_cmp_si(-3.0,-4)\n");
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, s = 1) >= 0)
+ {
+ printf ("Error in mpfr_cmp_si(-3.0,1)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ if (mpfr_cmp_si (x, -1) <= 0)
+ {
+ printf ("Error in mpfr_cmp_si (Inf, 0)\n");
+ exit (1);
+ }
+ mpfr_set_inf (x, -1);
+ if (mpfr_cmp_si (x, -1) >= 0)
+ {
+ printf ("Error in mpfr_cmp_si (-Inf, 0)\n");
+ exit (1);
+ }
+
+ /* case b=0 */
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 1) < 0);
+ MPFR_ASSERTN(mpfr_cmp_si (x, -1) > 0);
+
+ /* case i=0 */
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) > 0);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0);
+ mpfr_neg (x, x, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) == 0);
+ mpfr_set_si (x, -1, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) < 0);
+
+ /* case large x */
+ mpfr_set_str_binary (x, "1E100");
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) > 0);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 1) > 0);
+ MPFR_ASSERTN(mpfr_cmp_si (x, -1) > 0);
+ mpfr_set_str_binary (x, "-1E100");
+ MPFR_ASSERTN(mpfr_cmp_si (x, 0) < 0);
+ MPFR_ASSERTN(mpfr_cmp_si (x, 1) < 0);
+ MPFR_ASSERTN(mpfr_cmp_si (x, -1) < 0);
+
+ /* corner case */
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_mul_2exp (x, x, GMP_NUMB_BITS - 1, MPFR_RNDZ);
+ /* now EXP(x)=GMP_NUMB_BITS */
+ MPFR_ASSERTN(mpfr_cmp_si (x, 1) > 0);
+
+ mpfr_clear (x);
+
+ check_nan ();
+ check_macros ();
+ test_macros ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#endif
diff --git a/tests/tcmpabs.c b/tests/tcmpabs.c
new file mode 100644
index 0000000..6e1f729
--- /dev/null
+++ b/tests/tcmpabs.c
@@ -0,0 +1,149 @@
+/* Test file for mpfr_cmpabs.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define ERROR(s) do { printf(s); exit(1); } while (0)
+
+int
+main (void)
+{
+ mpfr_t xx, yy;
+ int c;
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (xx, 2);
+ mpfr_init2 (yy, 2);
+
+ mpfr_clear_erangeflag ();
+ MPFR_SET_NAN (xx);
+ MPFR_SET_NAN (yy);
+ if (mpfr_cmpabs (xx, yy) != 0)
+ ERROR ("mpfr_cmpabs (NAN,NAN) returns non-zero\n");
+ if (!mpfr_erangeflag_p ())
+ ERROR ("mpfr_cmpabs (NAN,NAN) doesn't set erange flag\n");
+
+ mpfr_set_str_binary (xx, "0.10E0");
+ mpfr_set_str_binary (yy, "-0.10E0");
+ if (mpfr_cmpabs (xx, yy) != 0)
+ ERROR ("mpfr_cmpabs (xx, yy) returns non-zero for prec=2\n");
+
+ mpfr_set_prec (xx, 65);
+ mpfr_set_prec (yy, 65);
+ mpfr_set_str_binary (xx, "-0.10011010101000110101010000000011001001001110001011101011111011101E623");
+ mpfr_set_str_binary (yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623");
+ if (mpfr_cmpabs (xx, yy) <= 0)
+ ERROR ("Error (1) in mpfr_cmpabs\n");
+
+ mpfr_set_str_binary (xx, "-0.10100010001110110111000010001000010011111101000100011101000011100");
+ mpfr_set_str_binary (yy, "-0.10100010001110110111000010001000010011111101000100011101000011011");
+ if (mpfr_cmpabs (xx, yy) <= 0)
+ ERROR ("Error (2) in mpfr_cmpabs\n");
+
+ mpfr_set_prec (xx, 160);
+ mpfr_set_prec (yy, 160);
+ mpfr_set_str_binary (xx, "0.1E1");
+ mpfr_set_str_binary (yy, "-0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100");
+ if (mpfr_cmpabs (xx, yy) <= 0)
+ ERROR ("Error (3) in mpfr_cmpabs\n");
+
+ mpfr_set_prec(xx, 53);
+ mpfr_set_prec(yy, 200);
+ mpfr_set_ui (xx, 1, (mpfr_rnd_t) 0);
+ mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0);
+ if (mpfr_cmpabs(xx, yy) != 0)
+ ERROR ("Error in mpfr_cmpabs: 1.0 != 1.0\n");
+
+ mpfr_set_prec (yy, 31);
+ mpfr_set_str (xx, "-1.0000000002", 10, (mpfr_rnd_t) 0);
+ mpfr_set_ui (yy, 1, (mpfr_rnd_t) 0);
+ if (!(mpfr_cmpabs(xx,yy)>0))
+ ERROR ("Error in mpfr_cmpabs: not 1.0000000002 > 1.0\n");
+ mpfr_set_prec(yy, 53);
+
+ mpfr_set_ui(xx, 0, MPFR_RNDN);
+ mpfr_set_str (yy, "-0.1", 10, MPFR_RNDN);
+ if (mpfr_cmpabs(xx, yy) >= 0)
+ ERROR ("Error in mpfr_cmpabs(0.0, 0.1)\n");
+
+ mpfr_set_inf (xx, -1);
+ mpfr_set_str (yy, "23489745.0329", 10, MPFR_RNDN);
+ if (mpfr_cmpabs(xx, yy) <= 0)
+ ERROR ("Error in mpfr_cmp(-Inf, 23489745.0329)\n");
+
+ mpfr_set_inf (xx, 1);
+ mpfr_set_inf (yy, -1);
+ if (mpfr_cmpabs(xx, yy) != 0)
+ ERROR ("Error in mpfr_cmpabs(Inf, -Inf)\n");
+
+ mpfr_set_inf (yy, -1);
+ mpfr_set_str (xx, "2346.09234", 10, MPFR_RNDN);
+ if (mpfr_cmpabs (xx, yy) >= 0)
+ ERROR ("Error in mpfr_cmpabs(-Inf, 2346.09234)\n");
+
+ mpfr_set_prec (xx, 2);
+ mpfr_set_prec (yy, 128);
+ mpfr_set_str_binary (xx, "0.1E10");
+ mpfr_set_str_binary (yy,
+ "0.100000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000001E10");
+ if (mpfr_cmpabs (xx, yy) >= 0)
+ ERROR ("Error in mpfr_cmpabs(10.235, 2346.09234)\n");
+ mpfr_swap (xx, yy);
+ if (mpfr_cmpabs(xx, yy) <= 0)
+ ERROR ("Error in mpfr_cmpabs(2346.09234, 10.235)\n");
+ mpfr_swap (xx, yy);
+
+ /* Check for NAN */
+ mpfr_set_nan (xx);
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp) (xx, yy);
+ if (c != 0 || !mpfr_erangeflag_p () )
+ {
+ printf ("NAN error (1)\n");
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp) (yy, xx);
+ if (c != 0 || !mpfr_erangeflag_p () )
+ {
+ printf ("NAN error (2)\n");
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ c = (mpfr_cmp) (xx, xx);
+ if (c != 0 || !mpfr_erangeflag_p () )
+ {
+ printf ("NAN error (3)\n");
+ exit (1);
+ }
+
+ mpfr_clear (xx);
+ mpfr_clear (yy);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcomparisons.c b/tests/tcomparisons.c
new file mode 100644
index 0000000..937633a
--- /dev/null
+++ b/tests/tcomparisons.c
@@ -0,0 +1,131 @@
+/* Test file for mpfr_greater_p, mpfr_greaterequal_p, mpfr_less_p,
+ mpfr_lessequal_p, mpfr_lessgreater_p, mpfr_equal_p, mpfr_unordered_p
+ functions.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+cmp_tests (void)
+{
+ mpfr_t x, y;
+ long i;
+
+ mpfr_inits (x, y, (mpfr_ptr) 0);
+ for (i = 0; i < 80000; i++)
+ {
+ mpfr_prec_t precx, precy;
+ int signx, signy, cmp;
+ unsigned int cmpbool = 0;
+
+ precx = (randlimb () % 17) * 11 + MPFR_PREC_MIN;
+ precy = (randlimb () % 17) * 11 + MPFR_PREC_MIN;
+ mpfr_set_prec (x, precx);
+ mpfr_set_prec (y, precy);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (y, RANDS);
+ signx = randlimb () & 1;
+ signy = randlimb () % 256 ? signx : 1 - signx;
+ /* signy = signx most of the time (most interesting case) */
+ if (signx)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (signy)
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (i <= 1)
+ mpfr_set_nan (x);
+ if (i == 0 || i == 2)
+ mpfr_set_nan (y);
+ if (mpfr_greater_p (x, y))
+ cmpbool |= 0x01;
+ if (mpfr_greaterequal_p (x, y))
+ cmpbool |= 0x02;
+ if (mpfr_less_p (x, y))
+ cmpbool |= 0x04;
+ if (mpfr_lessequal_p (x, y))
+ cmpbool |= 0x08;
+ if (mpfr_lessgreater_p (x, y))
+ cmpbool |= 0x10;
+ if (mpfr_equal_p (x, y))
+ cmpbool |= 0x20;
+ if (mpfr_unordered_p (x, y))
+ cmpbool |= 0x40;
+ if ((i <= 2 && cmpbool != 0x40) ||
+ (i > 2 && (cmp = mpfr_cmp (x, y),
+ (cmp == 0 && cmpbool != 0x2a) ||
+ (cmp < 0 && cmpbool != 0x1c) ||
+ (cmp > 0 && cmpbool != 0x13))))
+ {
+ printf ("Error in cmp_tests for\nx = ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" and\ny = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+static void
+eq_tests (void)
+{
+ mpfr_t x, y;
+ long i;
+
+ mpfr_inits (x, y, (mpfr_ptr) 0);
+ for (i = 0; i < 20000; i++)
+ {
+ mpfr_prec_t precx;
+
+ precx = (randlimb () % 17) * 11 + MPFR_PREC_MIN;
+ mpfr_set_prec (x, precx);
+ mpfr_set_prec (y, precx + (randlimb () % 64));
+ mpfr_urandomb (x, RANDS);
+ if (randlimb () & 1)
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN); /* exact -> x = y */
+ if (mpfr_greater_p (x, y) || !mpfr_greaterequal_p (x, y) ||
+ mpfr_less_p (x, y) || !mpfr_lessequal_p (x, y) ||
+ mpfr_lessgreater_p (x, y) || !mpfr_equal_p (x, y) ||
+ mpfr_unordered_p (x, y))
+ {
+ printf ("Error in eq_tests for x = ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ cmp_tests ();
+ eq_tests ();
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tconst_catalan.c b/tests/tconst_catalan.c
new file mode 100644
index 0000000..4b6f280
--- /dev/null
+++ b/tests/tconst_catalan.c
@@ -0,0 +1,59 @@
+/* Test file for mpfr_const_catalan.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpfr-test.h"
+
+/* Wrapper for tgeneric */
+static int
+my_const_catalan (mpfr_ptr x, mpfr_srcptr y, mpfr_rnd_t r)
+{
+ return mpfr_const_catalan (x, r);
+}
+
+#define RAND_FUNCTION(x) mpfr_set_ui(x,0,MPFR_RNDN)
+#define TEST_FUNCTION my_const_catalan
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (x, 32);
+ (mpfr_const_catalan) (x, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 32, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 3934042271UL))
+ {
+ printf ("Error in const_catalan for prec=32\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+
+ test_generic (2, 200, 1);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tconst_euler.c b/tests/tconst_euler.c
new file mode 100644
index 0000000..179b417
--- /dev/null
+++ b/tests/tconst_euler.c
@@ -0,0 +1,116 @@
+/* Test file for mpfr_const_euler.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* Wrapper for tgeneric */
+static int
+my_const_euler (mpfr_ptr x, mpfr_srcptr y, mpfr_rnd_t r)
+{
+ return mpfr_const_euler (x, r);
+}
+
+#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN)
+#define TEST_FUNCTION my_const_euler
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t gamma, y, z, t;
+ unsigned int err, prec, yprec, p0 = 2, p1 = 200;
+ int rnd;
+
+ tests_start_mpfr ();
+
+ prec = (argc < 2) ? 53 : atoi(argv[1]);
+
+ if (argc > 1)
+ {
+ mpfr_init2 (gamma, prec);
+ mpfr_const_euler (gamma, MPFR_RNDN);
+ printf("gamma="); mpfr_out_str (stdout, 10, 0, gamma, MPFR_RNDD);
+ puts ("");
+ mpfr_clear (gamma);
+ return 0;
+ }
+
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+
+ mpfr_set_prec (y, 32);
+ mpfr_set_prec (z, 32);
+ (mpfr_const_euler) (y, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.10010011110001000110011111100011");
+ if (mpfr_cmp (y, z))
+ {
+ printf ("Error for prec=32\n");
+ exit (1);
+ }
+
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+ yprec = prec + 10;
+
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ mpfr_set_prec (y, yprec);
+ mpfr_const_euler (y, (mpfr_rnd_t) rnd);
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
+ if (mpfr_can_round (y, err, (mpfr_rnd_t) rnd, (mpfr_rnd_t) rnd, prec))
+ {
+ mpfr_set (t, y, (mpfr_rnd_t) rnd);
+ mpfr_const_euler (z, (mpfr_rnd_t) rnd);
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for prec=%u rnd_mode=%s\n", prec,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf (" got ");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ puts ("");
+ printf (" expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf (" approximation was ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+
+ test_generic (2, 200, 1);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c
new file mode 100644
index 0000000..958a22c
--- /dev/null
+++ b/tests/tconst_log2.c
@@ -0,0 +1,201 @@
+/* Test file for mpfr_const_log2.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* tlog2 [prec] [rnd] [0 = no print] */
+
+static void
+check (mpfr_prec_t p0, mpfr_prec_t p1)
+{
+ mpfr_t x, y, z;
+ mpfr_rnd_t rnd;
+ int dif;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init2 (z, p1 + 10);
+ mpfr_const_log2 (z, MPFR_RNDN);
+ mpfr_clear_cache (__gmpfr_cache_const_log2);
+
+ for (; p0<=p1; p0++)
+ {
+ mpfr_set_prec (x, p0);
+ mpfr_set_prec (y, p0);
+ {
+ rnd = RND_RAND ();
+ mpfr_const_log2 (x, rnd);
+ mpfr_set (y, z, rnd);
+ if ((dif = mpfr_cmp (x, y))
+ && mpfr_can_round (z, mpfr_get_prec(z), MPFR_RNDN,
+ rnd, p0))
+ {
+ printf ("mpfr_const_log2 fails for prec=%u, rnd=%s Diff=%d\n",
+ (unsigned int) p0, mpfr_print_rnd_mode (rnd), dif);
+ printf ("expected "), mpfr_dump (y);
+ printf ("got "), mpfr_dump (x);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_large (void)
+{
+ mpfr_t x, y;
+ mpfr_init2 (x, 25000);
+ mpfr_init2 (y, 26000);
+ (mpfr_const_log2) (x, MPFR_RNDN); /* First one ! */
+ (mpfr_const_log2) (y, MPFR_RNDN); /* Then the other - cache - */
+ mpfr_prec_round (y, 25000, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("const_log2: error for large prec\n");
+ exit (1);
+ }
+
+ /* worst-case with 15 successive ones after last bit,
+ to exercise can_round loop */
+ mpfr_set_prec (x, 26249);
+ mpfr_const_log2 (x, MPFR_RNDZ);
+
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+static void
+check_cache (void)
+{
+ mpfr_t x;
+ int i;
+
+ mpfr_init2 (x, 195);
+ mpfr_free_cache ();
+ i = mpfr_const_log2 (x, MPFR_RNDN);
+ if (i == 0)
+ {
+ printf("Error for log2. Invalid ternary value (1).\n");
+ exit (1);
+ }
+ mpfr_set_prec (x, 194);
+ i = mpfr_const_log2 (x, MPFR_RNDN);
+ if (i == 0)
+ {
+ printf("Error for log2. Invalid ternary value (2).\n");
+ exit (1);
+ }
+
+ mpfr_free_cache ();
+ mpfr_set_prec (x, 9);
+ mpfr_const_log2 (x, MPFR_RNDN);
+ mpfr_set_prec (x, 8);
+ mpfr_const_log2 (x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0.10110001E0", 2, MPFR_RNDN))
+ {
+ printf("Error for log2. Wrong rounding.\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+/* Wrapper for tgeneric */
+static int
+my_const_log2 (mpfr_ptr x, mpfr_srcptr y, mpfr_rnd_t r)
+{
+ return mpfr_const_log2 (x, r);
+}
+
+#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN)
+#define TEST_FUNCTION my_const_log2
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ int p;
+ mpfr_rnd_t rnd;
+
+ tests_start_mpfr ();
+
+ p = (argc>1) ? atoi(argv[1]) : 53;
+ rnd = (argc>2) ? (mpfr_rnd_t) atoi(argv[2]) : MPFR_RNDZ;
+
+ mpfr_init (x);
+
+ check (2, 1000);
+
+ /* check precision of 2 bits */
+ mpfr_set_prec (x, 2);
+ mpfr_const_log2 (x, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp(x, 3, -2)) /* 3*2^-2 */
+ {
+ printf ("mpfr_const_log2 failed for prec=2, rnd=MPFR_RNDN\n"
+ "expected 0.75, got ");
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN);
+ putchar('\n');
+ exit (1);
+ }
+
+ if (argc>=2)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_const_log2 (x, rnd);
+ printf ("log(2)=");
+ mpfr_out_str (stdout, 10, 0, x, rnd);
+ puts ("");
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_const_log2 (x, MPFR_RNDZ);
+ if (mpfr_cmp_str1 (x, "6.9314718055994530941e-1") )
+ {
+ printf ("mpfr_const_log2 failed for prec=53\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_const_log2 (x, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "0.69314718060195446"))
+ {
+ printf ("mpfr_const_log2 failed for prec=32\n");
+ exit (1);
+ }
+
+ mpfr_clear(x);
+
+ check_large();
+ check_cache ();
+
+ test_generic (2, 200, 1);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c
new file mode 100644
index 0000000..50188f4
--- /dev/null
+++ b/tests/tconst_pi.c
@@ -0,0 +1,186 @@
+/* Test file for mpfr_const_pi.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* tconst_pi [prec] [rnd] [0 = no print] */
+
+static void
+check_large (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_init2 (x, 20000);
+ mpfr_init2 (y, 21000);
+ mpfr_init2 (z, 11791);
+
+ /* The algo failed to round for p=11791. */
+ (mpfr_const_pi) (z, MPFR_RNDU);
+ mpfr_const_pi (x, MPFR_RNDN); /* First one ! */
+ mpfr_const_pi (y, MPFR_RNDN); /* Then the other - cache - */
+ mpfr_prec_round (y, 20000, MPFR_RNDN);
+ if (mpfr_cmp (x, y)) {
+ printf ("const_pi: error for large prec (%d)\n", 1);
+ exit (1);
+ }
+ mpfr_prec_round (y, 11791, MPFR_RNDU);
+ if (mpfr_cmp (z, y)) {
+ printf ("const_pi: error for large prec (%d)\n", 2);
+ exit (1);
+ }
+
+ /* a worst-case to exercise recomputation */
+ if (MPFR_PREC_MAX > 33440) {
+ mpfr_set_prec (x, 33440);
+ mpfr_const_pi (x, MPFR_RNDZ);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+/* Wrapper for tgeneric */
+static int
+my_const_pi (mpfr_ptr x, mpfr_srcptr y, mpfr_rnd_t r)
+{
+ return mpfr_const_pi (x, r);
+}
+
+#define RAND_FUNCTION(x) mpfr_set_ui ((x), 0, MPFR_RNDN)
+#define TEST_FUNCTION my_const_pi
+#include "tgeneric.c"
+
+static void
+bug20091030 (void)
+{
+ mpfr_t x, x_ref;
+ int inex, inex_ref;
+ mpfr_prec_t p;
+ int r;
+
+ mpfr_free_cache ();
+ mpfr_init2 (x, MPFR_PREC_MIN);
+ for (p = MPFR_PREC_MIN; p <= 100; p++)
+ {
+ mpfr_set_prec (x, p);
+ inex = mpfr_const_pi (x, MPFR_RNDU);
+ if (inex < 0)
+ {
+ printf ("Error, inex < 0 for RNDU (prec=%lu)\n",
+ (unsigned long) p);
+ exit (1);
+ }
+ inex = mpfr_const_pi (x, MPFR_RNDD);
+ if (inex > 0)
+ {
+ printf ("Error, inex > 0 for RNDD (prec=%lu)\n",
+ (unsigned long) p);
+ exit (1);
+ }
+ }
+ mpfr_free_cache ();
+ mpfr_init2 (x_ref, MPFR_PREC_MIN);
+ for (p = MPFR_PREC_MIN; p <= 100; p++)
+ {
+ mpfr_set_prec (x, p + 10);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (x_ref, p);
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ inex = mpfr_const_pi (x, (mpfr_rnd_t) r);
+ inex_ref = mpfr_const_pi_internal (x_ref, (mpfr_rnd_t) r);
+ if (inex != inex_ref || mpfr_cmp (x, x_ref) != 0)
+ {
+ printf ("mpfr_const_pi and mpfr_const_pi_internal disagree\n");
+ printf ("mpfr_const_pi gives ");
+ mpfr_dump (x);
+ printf ("mpfr_const_pi_internal gives ");
+ mpfr_dump (x_ref);
+ printf ("inex=%d inex_ref=%d\n", inex, inex_ref);
+ exit (1);
+ }
+ }
+ }
+ mpfr_clear (x);
+ mpfr_clear (x_ref);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ mpfr_prec_t p;
+ mpfr_rnd_t rnd;
+
+ tests_start_mpfr ();
+
+ p = 53;
+ if (argc > 1)
+ {
+ long a = atol (argv[1]);
+ if (a >= MPFR_PREC_MIN && a <= MPFR_PREC_MAX)
+ p = a;
+ }
+
+ rnd = (argc > 2) ? (mpfr_rnd_t) atoi(argv[2]) : MPFR_RNDZ;
+
+ mpfr_init2 (x, p);
+ mpfr_const_pi (x, rnd);
+ if (argc >= 2)
+ {
+ if (argc < 4 || atoi (argv[3]) != 0)
+ {
+ printf ("Pi=");
+ mpfr_out_str (stdout, 10, 0, x, rnd);
+ puts ("");
+ }
+ }
+ else if (mpfr_cmp_str1 (x, "3.141592653589793116") )
+ {
+ printf ("mpfr_const_pi failed for prec=53\n");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_const_pi (x, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "3.141592653468251") )
+ {
+ printf ("mpfr_const_pi failed for prec=32\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+
+ bug20091030 ();
+
+ check_large ();
+
+ test_generic (2, 200, 1);
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tcopysign.c b/tests/tcopysign.c
new file mode 100644
index 0000000..4c2ffee
--- /dev/null
+++ b/tests/tcopysign.c
@@ -0,0 +1,116 @@
+/* Test file for mpfr_copysign, mpfr_setsign and mpfr_signbit.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+copysign_variant (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
+ mpfr_rnd_t rnd_mode, int k)
+{
+ mpfr_clear_flags ();
+ switch (k)
+ {
+ case 0:
+ mpfr_copysign (z, x, y, MPFR_RNDN);
+ return;
+ case 1:
+ (mpfr_copysign) (z, x, y, MPFR_RNDN);
+ return;
+ case 2:
+ mpfr_setsign (z, x, mpfr_signbit (y), MPFR_RNDN);
+ return;
+ case 3:
+ mpfr_setsign (z, x, (mpfr_signbit) (y), MPFR_RNDN);
+ return;
+ case 4:
+ (mpfr_setsign) (z, x, mpfr_signbit (y), MPFR_RNDN);
+ return;
+ case 5:
+ (mpfr_setsign) (z, x, (mpfr_signbit) (y), MPFR_RNDN);
+ return;
+ }
+}
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+ int i, j, k;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ for (i = 0; i <= 1; i++)
+ for (j = 0; j <= 1; j++)
+ for (k = 0; k <= 5; k++)
+ {
+ mpfr_set_nan (x);
+ i ? MPFR_SET_NEG (x) : MPFR_SET_POS (x);
+ mpfr_set_nan (y);
+ j ? MPFR_SET_NEG (y) : MPFR_SET_POS (y);
+ copysign_variant (z, x, y, MPFR_RNDN, k);
+ if (MPFR_SIGN (z) != MPFR_SIGN (y) || !mpfr_nanflag_p ())
+ {
+ printf ("Error in mpfr_copysign (%cNaN, %cNaN)\n",
+ i ? '-' : '+', j ? '-' : '+');
+ exit (1);
+ }
+
+ mpfr_set_si (x, i ? -1250 : 1250, MPFR_RNDN);
+ mpfr_set_nan (y);
+ j ? MPFR_SET_NEG (y) : MPFR_SET_POS (y);
+ copysign_variant (z, x, y, MPFR_RNDN, k);
+ if (i != j)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (! mpfr_equal_p (z, x) || mpfr_nanflag_p ())
+ {
+ printf ("Error in mpfr_copysign (%c1250, %cNaN)\n",
+ i ? '-' : '+', j ? '-' : '+');
+ exit (1);
+ }
+
+ mpfr_set_si (x, i ? -1250 : 1250, MPFR_RNDN);
+ mpfr_set_si (y, j ? -1717 : 1717, MPFR_RNDN);
+ copysign_variant (z, x, y, MPFR_RNDN, k);
+ if (i != j)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (! mpfr_equal_p (z, x) || mpfr_nanflag_p ())
+ {
+ printf ("Error in mpfr_copysign (%c1250, %c1717)\n",
+ i ? '-' : '+', j ? '-' : '+');
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcos.c b/tests/tcos.c
new file mode 100644
index 0000000..2ad313f
--- /dev/null
+++ b/tests/tcos.c
@@ -0,0 +1,383 @@
+/* Test file for mpfr_cos.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_cos (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_cos (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_cos mpfr_cos
+#endif
+
+static void
+check53 (const char *xs, const char *cos_xs, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, c;
+
+ mpfr_inits2 (53, xx, c, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs); /* should be exact */
+ test_cos (c, xx, rnd_mode);
+ if (mpfr_cmp_str1 (c, cos_xs))
+ {
+ printf ("mpfr_cos failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_cos gives cos(x)=");
+ mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN);
+ printf(", expected %s\n", cos_xs);
+ exit (1);
+ }
+ mpfr_clears (xx, c, (mpfr_ptr) 0);
+}
+
+#define TEST_FUNCTION test_cos
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ test_cos (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: cos(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ test_cos (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: cos(Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ test_cos (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: cos(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ /* cos(+/-0) = 1 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ test_cos (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: cos(+0) != 1\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ test_cos (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: cos(-0) != 1\n");
+ exit (1);
+ }
+
+ /* Compute ~Pi/2 to check */
+ /* FIXME: Too slow!
+ mpfr_set_prec (x, 20000);
+ mpfr_const_pi (x, MPFR_RNDD); mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_set_prec (y, 24);
+ test_cos (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.111001010110100011000001E-20000", 2, MPFR_RNDN))
+ {
+ printf("Error computing cos(~Pi/2)\n");
+ mpfr_dump (y);
+ exit (1);
+ } */
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 73);
+
+ /* Check special case: An overflow in const_pi could occurs! */
+ set_emin (-125);
+ set_emax (128);
+ mpfr_set_str_binary (x, "0.111101010110110011101101E6");
+ test_cos (y, x, MPFR_RNDZ);
+ set_emin (emin);
+ set_emax (emax);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+overflowed_cos0 (void)
+{
+ mpfr_t x, y;
+ int emax, i, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (emax); /* 1 is not representable. */
+ /* and if emax < 0, 1 - eps is not representable either. */
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_cos (x, x, (mpfr_rnd_t) rnd);
+ if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
+ ! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overflowed_cos0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+bug20091030 (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 5);
+ mpfr_init2 (y, 2);
+ mpfr_set_str (x, "-0.11001E3", 2, MPFR_RNDN);
+ mpfr_cos (y, x, MPFR_RNDN);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ int inex;
+
+ tests_start_mpfr ();
+
+ special_overflow ();
+ check_nans ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str (x, "9.81333845856942e-1", 10, MPFR_RNDN);
+ test_cos (y, x, MPFR_RNDN);
+
+ mpfr_set_prec (x, 30);
+ mpfr_set_prec (y, 30);
+ mpfr_set_str_binary (x, "1.00001010001101110010100010101e-1");
+ test_cos (y, x, MPFR_RNDU);
+ mpfr_set_str_binary (x, "1.10111100010101011110101010100e-1");
+ if (mpfr_cmp (y, x))
+ {
+ printf ("Error for prec=30, rnd=MPFR_RNDU\n");
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf (" got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 59);
+ mpfr_set_prec (y, 59);
+ mpfr_set_str_binary (x, "1.01101011101111010011111110111111111011011101100111100011e-3");
+ test_cos (y, x, MPFR_RNDU);
+ mpfr_set_str_binary (x, "1.1111011111110010001001001011100111101110100010000010010011e-1");
+ if (mpfr_cmp (y, x))
+ {
+ printf ("Error for prec=59, rnd=MPFR_RNDU\n");
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf (" got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 5);
+ mpfr_set_prec (y, 5);
+ mpfr_set_str_binary (x, "1.1100e-2");
+ test_cos (y, x, MPFR_RNDD);
+ mpfr_set_str_binary (x, "1.1100e-1");
+ if (mpfr_cmp (y, x))
+ {
+ printf ("Error for x=1.1100e-2, rnd=MPFR_RNDD\n");
+ printf ("expected 1.1100e-1, got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ mpfr_set_str_binary (x, "0.10001000001001011000100001E-6");
+ mpfr_set_str_binary (y, "0.1111111111111101101111001100001");
+ test_cos (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for prec=32 (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-0.1101011110111100111010011001011E-1");
+ mpfr_set_str_binary (y, "0.11101001100110111011011010100011");
+ test_cos (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for prec=32 (2)\n");
+ exit (1);
+ }
+
+ /* huge argument reduction */
+ mpfr_set_str_binary (x, "0.10000010000001101011101111001011E40");
+ mpfr_set_str_binary (y, "0.10011000001111010000101011001011E-1");
+ test_cos (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for prec=32 (3)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 3);
+ mpfr_set_str_binary (x, "0.110E60");
+ inex = mpfr_cos (y, x, MPFR_RNDD);
+ MPFR_ASSERTN(inex < 0);
+
+ /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
+ check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", MPFR_RNDN);
+ check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", MPFR_RNDD);
+ check53 ("4.984987858808754279e-1", "8.783012931285840707e-1", MPFR_RNDZ);
+ check53 ("4.984987858808754279e-1", "8.783012931285841817e-1", MPFR_RNDU);
+ check53 ("1.00031274099908640274", "0.540039116973283217504", MPFR_RNDN);
+ check53 ("1.00229256850978698523", "0.538371757797526551137", MPFR_RNDZ);
+ check53 ("1.00288304857059840103", "0.537874062022526966409", MPFR_RNDZ);
+ check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN);
+
+ check53 ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN);
+
+ overflowed_cos0 ();
+ test_generic (2, 100, 15);
+
+ /* check inexact flag */
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 13);
+ mpfr_set_str_binary (x, "-0.100E196");
+ inex = mpfr_cos (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 13);
+ mpfr_set_str_binary (x, "0.1111111100101");
+ MPFR_ASSERTN (inex > 0 && mpfr_equal_p (x, y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ bug20091030 ();
+
+ data_check ("data/cos", mpfr_cos, "mpfr_cos");
+ bad_cases (mpfr_cos, mpfr_acos, "mpfr_cos", 256, -40, 0, 4, 128, 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcosh.c b/tests/tcosh.c
new file mode 100644
index 0000000..f9a70a1
--- /dev/null
+++ b/tests/tcosh.c
@@ -0,0 +1,204 @@
+/* Test file for mpfr_cosh.
+
+Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_cosh
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int i;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: cosh(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: cosh(+Inf) != +Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: cosh(-Inf) != +Inf\n");
+ exit (1);
+ }
+
+ /* cosh(+/-0) = 1 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: cosh(+0) != 1\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: cosh(-0) != 1\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ mpfr_set_str_binary (x, "0.1101110111111111001011101000101");
+ mpfr_set_str_binary (y, "1.0110011001110000101100011001001");
+ mpfr_cosh (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_cosh for prec=32 (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-0.1110111000011101010111100000101E-1");
+ mpfr_set_str_binary (y, "1.0001110000101111111111100110101");
+ mpfr_cosh (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: mpfr_cosh for prec=32 (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "1E1000000000");
+ i = mpfr_cosh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1E1000000000");
+ i = mpfr_cosh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1E1000000000");
+ i = mpfr_cosh (x, x, MPFR_RNDD);
+ MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == -1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1E1000000000");
+ i = mpfr_cosh (x, x, MPFR_RNDU);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+special_overflow (void)
+{
+ /* Check for overflow in 3 cases:
+ 1. cosh(x) is representable, but not exp(x)
+ 2. cosh(x) is not representable in the selected range of exp.
+ 3. cosh(x) exp overflow even with the largest range of exp */
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 24);
+
+ mpfr_set_str_binary (x, "0.101100100000000000110100E7");
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.101010001111001010001110E128", 2, MPFR_RNDN))
+ {
+ printf("Special overflow error 1.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "0.101100100000000000110100E8");
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p(y))
+ {
+ printf("Special overflow error 2.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ set_emin (emin);
+ set_emax (emax);
+
+ mpfr_set_str_binary (x, "0.101100100000000000110100E1000000");
+ mpfr_cosh (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p(y))
+ {
+ printf("Special overflow error 3.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special_overflow ();
+ special ();
+
+ test_generic (2, 100, 100);
+
+ data_check ("data/cosh", mpfr_cosh, "mpfr_cosh");
+ bad_cases (mpfr_cosh, mpfr_acosh, "mpfr_cosh", 0, 1, 255, 4, 128, 800, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcot.c b/tests/tcot.c
new file mode 100644
index 0000000..8924474
--- /dev/null
+++ b/tests/tcot.c
@@ -0,0 +1,144 @@
+/* Test file for mpfr_cot.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_cot
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_cot (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: cot(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_cot (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: cot(Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_cot (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: cot(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ /* cot(+/-0) = +/-Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
+ {
+ printf ("Error: cot(+0) != +Inf\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_cot (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
+ {
+ printf ("Error: cot(-0) != -Inf\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+two2emin (mpfr_exp_t e)
+{
+ mpfr_exp_t old_emin, old_emax;
+ mpfr_t x, y;
+ int i, rnd;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+
+ if (mpfr_set_emin (-e) || mpfr_set_emax (e))
+ {
+ printf ("Can't change exponent range\n");
+ exit (1);
+ }
+
+ mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
+ for (i = -4; i <= 4; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si (y, i, MPFR_RNDN);
+ mpfr_ui_div (y, 1, y, (mpfr_rnd_t) rnd); /* no overflow/underflow */
+ mpfr_set_si_2exp (x, i, -e, MPFR_RNDN);
+ if (ABS (i) != 3) /* not a power of 2 (not 0 either) */
+ mpfr_sub (y, y, x, (mpfr_rnd_t) rnd); /* no overflow/underflow */
+ mpfr_set_ui_2exp (x, 1, -e, MPFR_RNDN);
+ mpfr_div (y, y, x, (mpfr_rnd_t) rnd); /* 1/x - SIGN(x).epsilon */
+ mpfr_set_si_2exp (x, i, -e, MPFR_RNDN);
+ mpfr_cot (x, x, (mpfr_rnd_t) rnd);
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in two2emin for i = %d and rnd = %s\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("Got ");
+ mpfr_dump (x);
+ printf ("instead of ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+
+ mpfr_set_emin (old_emin);
+ mpfr_set_emax (old_emax);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_specials ();
+ two2emin (256);
+ two2emin (MPFR_EMAX_DEFAULT);
+ if (MPFR_EMAX_MAX != MPFR_EMAX_DEFAULT)
+ two2emin (MPFR_EMAX_MAX);
+ test_generic (2, 200, 5);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcoth.c b/tests/tcoth.c
new file mode 100644
index 0000000..70969f6
--- /dev/null
+++ b/tests/tcoth.c
@@ -0,0 +1,213 @@
+/* Test file for mpfr_coth.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_coth
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_coth (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: coth(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_coth (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: coth(Inf) != 1\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_coth (y, x, MPFR_RNDN);
+ if (mpfr_cmp_si (y, -1))
+ {
+ printf ("Error: coth(-Inf) != -1\n");
+ exit (1);
+ }
+
+ /* coth(+/-0) = +/-Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: coth(+0) != +Inf\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_coth (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && MPFR_SIGN (y) < 0))
+ {
+ printf ("Error: coth(-0) != -Inf\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_bugs (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* bug found by Rob (Sisyphus) on 16 Sep 2005 */
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_prec (y, 2);
+ mpfr_coth (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error for coth(2), expected 1, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_str (x, "18.368400284838550", 10, MPFR_RNDN);
+ mpfr_set_str (y, "1.0000000000000002", 10, MPFR_RNDN);
+ mpfr_coth (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for coth(18.368400284838550)\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "18.714973875118520", 10, MPFR_RNDN);
+ mpfr_coth (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for coth(18.714973875118520)\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "18.714973875118524", 10, MPFR_RNDN);
+ mpfr_coth (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1) != 0)
+ {
+ printf ("Error for coth(18.714973875118524)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+underflowed_cothinf (void)
+{
+ mpfr_t x, y;
+ int i, inex, rnd, err = 0;
+ mpfr_exp_t old_emin;
+
+ old_emin = mpfr_get_emin ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (i = -1; i <= 1; i += 2)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_inf (x, i);
+ mpfr_clear_flags ();
+ set_emin (2); /* 1 is not representable. */
+ inex = mpfr_coth (x, x, (mpfr_rnd_t) rnd);
+ set_emin (old_emin);
+ if (! mpfr_underflow_p ())
+ {
+ printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
+ " The underflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ mpfr_set_si (y, (i < 0 && (rnd == MPFR_RNDD || rnd == MPFR_RNDA)) ||
+ (i > 0 && (rnd == MPFR_RNDU || rnd == MPFR_RNDA))
+ ? 2 : 0, MPFR_RNDN);
+ if (i < 0)
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (! (mpfr_equal_p (x, y) &&
+ MPFR_MULT_SIGN (MPFR_SIGN (x), MPFR_SIGN (y)) > 0))
+ {
+ printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of ");
+ mpfr_print_binary (y);
+ printf (".\n");
+ err = 1;
+ }
+ if ((rnd == MPFR_RNDD ||
+ (i > 0 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))) && inex >= 0)
+ {
+ printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if ((rnd == MPFR_RNDU ||
+ (i < 0 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))) && inex <= 0)
+ {
+ printf ("Error in underflowed_cothinf (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_specials ();
+ check_bugs ();
+ test_generic (2, 200, 10);
+ underflowed_cothinf ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcsc.c b/tests/tcsc.c
new file mode 100644
index 0000000..231e284
--- /dev/null
+++ b/tests/tcsc.c
@@ -0,0 +1,95 @@
+/* Test file for mpfr_csc.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_csc
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_csc (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: csc(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_csc (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: csc(Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_csc (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: csc(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ /* csc(+/-0) = +/-Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
+ {
+ printf ("Error: csc(+0) != +Inf\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_csc (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
+ {
+ printf ("Error: csc(-0) != -Inf\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_specials ();
+
+ test_generic (2, 100, 10);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tcsch.c b/tests/tcsch.c
new file mode 100644
index 0000000..7bb4354
--- /dev/null
+++ b/tests/tcsch.c
@@ -0,0 +1,110 @@
+/* Test file for mpfr_csch.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_csch
+#define TEST_RANDOM_EMAX 63
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: csch(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) >0))
+ {
+ printf ("Error: csch(+Inf) != +0\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) <0))
+ {
+ printf ("Error: csch(-0) != -0\n");
+ exit (1);
+ }
+
+ /* csc(+/-0) = +/-Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
+ {
+ printf ("Error: csch(+0) != +Inf\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
+ {
+ printf ("Error: csch(-0) != -Inf\n");
+ exit (1);
+ }
+
+ /* check huge x */
+ mpfr_set_str (x, "8e8", 10, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: csch(8e8) != +0\n");
+ exit (1);
+ }
+ mpfr_set_str (x, "-8e8", 10, MPFR_RNDN);
+ mpfr_csch (y, x, MPFR_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
+ {
+ printf ("Error: csch(-8e8) != -0\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_specials ();
+ test_generic (2, 200, 10);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/td_div.c b/tests/td_div.c
new file mode 100644
index 0000000..3421fa1
--- /dev/null
+++ b/tests/td_div.c
@@ -0,0 +1,209 @@
+/* Test file for mpfr_d_div
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ /* 1.0 / nan is nan */
+ mpfr_set_nan (x);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* 1.0 / +inf == +0 */
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_zero_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* 1.0 / -inf == -0 */
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_zero_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+#if !defined(MPFR_ERRDIVZERO)
+
+ /* 1.0 / 0 == +inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* -1.0 / 0 == -inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, -1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ /* 1.0 / -0 == -inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ /* -1.0 / -0 == +inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, -1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* +inf / 0 == +inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, DBL_POS_INF, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* -inf / 0 == -inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, DBL_NEG_INF, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ /* +inf / -0 == -inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, DBL_POS_INF, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ /* -inf / -0 == +inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (y, DBL_NEG_INF, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+#endif
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_d_sub
+#define DOUBLE_ARG1
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
+
+ tests_start_mpfr ();
+
+ /* check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_d_div (x, d, y, MPFR_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_d_div\n");
+ exit (1);
+ }
+ mpfr_set_str (z, " 0.000030517578125", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_d_div (");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ check_nans ();
+
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/td_sub.c b/tests/td_sub.c
new file mode 100644
index 0000000..62857fe
--- /dev/null
+++ b/tests/td_sub.c
@@ -0,0 +1,129 @@
+/* Test file for mpfr_d_sub
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ /* 1.0 - nan is nan */
+ mpfr_set_nan (x);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* 1.0 - +inf == -inf */
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ /* 1.0 - -inf == +inf */
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags ();
+ inexact = mpfr_d_sub (y, 1.0, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_d_sub
+#define DOUBLE_ARG1
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
+
+ tests_start_mpfr ();
+
+ /* check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_d_sub (x, d, y, MPFR_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_d_sub\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "-4095.875", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_d_sub (");
+ mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ check_nans ();
+
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tdigamma.c b/tests/tdigamma.c
new file mode 100644
index 0000000..3ed568a
--- /dev/null
+++ b/tests/tdigamma.c
@@ -0,0 +1,68 @@
+/* test file for digamma function
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_digamma
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_inf (y, -1);
+ mpfr_set_inf (x, 1);
+ mpfr_digamma (y, x, MPFR_RNDN);
+ if (mpfr_inf_p (y) == 0 || mpfr_sgn (y) < 0)
+ {
+ printf ("error for Psi(+Inf)\n");
+ printf ("expected +Inf\n");
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_generic (2, 100, 2);
+
+ data_check ("data/digamma", mpfr_digamma, "mpfr_digamma");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tdim.c b/tests/tdim.c
new file mode 100644
index 0000000..d32add7
--- /dev/null
+++ b/tests/tdim.c
@@ -0,0 +1,114 @@
+/* Test file for mpfr_dim.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_dim
+#define TWO_ARGS
+#define TEST_RANDOM_EMIN -20
+#define TEST_RANDOM_EMAX 20
+#define TGENERIC_NOWARNING 1
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ /* case x=NaN */
+ mpfr_set_nan (x);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (z))
+ {
+ printf ("Error in mpfr_dim (NaN, 0)\n");
+ exit (1);
+ }
+
+ /* case x=+Inf */
+ mpfr_set_inf (x, 1);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
+ if (!mpfr_inf_p (z) || mpfr_sgn (z) < 0)
+ {
+ printf ("Error in mpfr_dim (+Inf, 0)\n");
+ exit (1);
+ }
+
+ /* case x=-Inf */
+ mpfr_set_inf (x, -1);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0)
+ {
+ printf ("Error in mpfr_dim (-Inf, 0)\n");
+ exit (1);
+ }
+
+ /* case x=y=+Inf */
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, 1);
+ mpfr_dim (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0) || mpfr_sgn (z) < 0)
+ {
+ printf ("Error in mpfr_dim (+Inf, +Inf)\n");
+ exit (1);
+ }
+
+ /* case x > y */
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 1))
+ {
+ printf ("Error in mpfr_dim (2, 1)\n");
+ exit (1);
+ }
+
+ /* case x < y */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_dim (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0))
+ {
+ printf ("Error in mpfr_dim (1, 2)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ test_generic (2, 220, 42);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tdiv.c b/tests/tdiv.c
new file mode 100644
index 0000000..476c35d
--- /dev/null
+++ b/tests/tdiv.c
@@ -0,0 +1,1136 @@
+/* Test file for mpfr_div (and some mpfr_div_ui, etc. tests).
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check_equal (mpfr_srcptr a, mpfr_srcptr a2, char *s,
+ mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t r)
+{
+ if ((MPFR_IS_NAN (a) && MPFR_IS_NAN (a2)) ||
+ mpfr_equal_p (a, a2))
+ return;
+ printf ("Error in %s\n", mpfr_print_rnd_mode (r));
+ printf ("b = ");
+ mpfr_dump (b);
+ printf ("c = ");
+ mpfr_dump (c);
+ printf ("mpfr_div result: ");
+ mpfr_dump (a);
+ printf ("%s result: ", s);
+ mpfr_dump (a2);
+ exit (1);
+}
+
+static int
+mpfr_all_div (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t r)
+{
+ mpfr_t a2;
+ unsigned int oldflags, newflags;
+ int inex, inex2;
+
+ oldflags = __gmpfr_flags;
+ inex = mpfr_div (a, b, c, r);
+
+ if (a == b || a == c)
+ return inex;
+
+ newflags = __gmpfr_flags;
+
+ mpfr_init2 (a2, MPFR_PREC (a));
+
+ if (mpfr_integer_p (b) && ! (MPFR_IS_ZERO (b) && MPFR_IS_NEG (b)))
+ {
+ /* b is an integer, but not -0 (-0 is rejected as
+ it becomes +0 when converted to an integer). */
+ if (mpfr_fits_ulong_p (b, MPFR_RNDA))
+ {
+ __gmpfr_flags = oldflags;
+ inex2 = mpfr_ui_div (a2, mpfr_get_ui (b, MPFR_RNDN), c, r);
+ MPFR_ASSERTN (SAME_SIGN (inex2, inex));
+ MPFR_ASSERTN (__gmpfr_flags == newflags);
+ check_equal (a, a2, "mpfr_ui_div", b, c, r);
+ }
+ if (mpfr_fits_slong_p (b, MPFR_RNDA))
+ {
+ __gmpfr_flags = oldflags;
+ inex2 = mpfr_si_div (a2, mpfr_get_si (b, MPFR_RNDN), c, r);
+ MPFR_ASSERTN (SAME_SIGN (inex2, inex));
+ MPFR_ASSERTN (__gmpfr_flags == newflags);
+ check_equal (a, a2, "mpfr_si_div", b, c, r);
+ }
+ }
+
+ if (mpfr_integer_p (c) && ! (MPFR_IS_ZERO (c) && MPFR_IS_NEG (c)))
+ {
+ /* c is an integer, but not -0 (-0 is rejected as
+ it becomes +0 when converted to an integer). */
+ if (mpfr_fits_ulong_p (c, MPFR_RNDA))
+ {
+ __gmpfr_flags = oldflags;
+ inex2 = mpfr_div_ui (a2, b, mpfr_get_ui (c, MPFR_RNDN), r);
+ MPFR_ASSERTN (SAME_SIGN (inex2, inex));
+ MPFR_ASSERTN (__gmpfr_flags == newflags);
+ check_equal (a, a2, "mpfr_div_ui", b, c, r);
+ }
+ if (mpfr_fits_slong_p (c, MPFR_RNDA))
+ {
+ __gmpfr_flags = oldflags;
+ inex2 = mpfr_div_si (a2, b, mpfr_get_si (c, MPFR_RNDN), r);
+ MPFR_ASSERTN (SAME_SIGN (inex2, inex));
+ MPFR_ASSERTN (__gmpfr_flags == newflags);
+ check_equal (a, a2, "mpfr_div_si", b, c, r);
+ }
+ }
+
+ mpfr_clear (a2);
+
+ return inex;
+}
+
+#ifdef CHECK_EXTERNAL
+static int
+test_div (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ printf (" ");
+ mpfr_print_raw (c);
+ }
+ res = mpfr_all_div (a, b, c, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_div mpfr_all_div
+#endif
+
+#define check53(n, d, rnd, res) check4(n, d, rnd, 53, res)
+
+/* return 0 iff a and b are of the same sign */
+static int
+inex_cmp (int a, int b)
+{
+ if (a > 0)
+ return (b > 0) ? 0 : 1;
+ else if (a == 0)
+ return (b == 0) ? 0 : 1;
+ else
+ return (b < 0) ? 0 : 1;
+}
+
+static void
+check4 (const char *Ns, const char *Ds, mpfr_rnd_t rnd_mode, int p,
+ const char *Qs)
+{
+ mpfr_t q, n, d;
+
+ mpfr_inits2 (p, q, n, d, (mpfr_ptr) 0);
+ mpfr_set_str1 (n, Ns);
+ mpfr_set_str1 (d, Ds);
+ test_div(q, n, d, rnd_mode);
+ if (mpfr_cmp_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN) )
+ {
+ printf ("mpfr_div failed for n=%s, d=%s, p=%d, rnd_mode=%s\n",
+ Ns, Ds, p, mpfr_print_rnd_mode (rnd_mode));
+ printf ("got ");mpfr_print_binary(q);
+ mpfr_set_str (q, Qs, ((p==53) ? 10 : 2), MPFR_RNDN);
+ printf("\nexpected "); mpfr_print_binary(q);
+ putchar('\n');
+ exit (1);
+ }
+ mpfr_clears (q, n, d, (mpfr_ptr) 0);
+}
+
+static void
+check24 (const char *Ns, const char *Ds, mpfr_rnd_t rnd_mode, const char *Qs)
+{
+ mpfr_t q, n, d;
+
+ mpfr_inits2 (24, q, n, d, (mpfr_ptr) 0);
+
+ mpfr_set_str1 (n, Ns);
+ mpfr_set_str1 (d, Ds);
+ test_div(q, n, d, rnd_mode);
+ if (mpfr_cmp_str1 (q, Qs) )
+ {
+ printf ("mpfr_div failed for n=%s, d=%s, prec=24, rnd_mode=%s\n",
+ Ns, Ds, mpfr_print_rnd_mode(rnd_mode));
+ printf ("expected quotient is %s, got ", Qs);
+ mpfr_out_str(stdout,10,0,q, MPFR_RNDN); putchar('\n');
+ exit (1);
+ }
+ mpfr_clears (q, n, d, (mpfr_ptr) 0);
+}
+
+/* the following examples come from the paper "Number-theoretic Test
+ Generation for Directed Rounding" from Michael Parks, Table 2 */
+static void
+check_float(void)
+{
+ check24("70368760954880.0", "8388609.0", MPFR_RNDN, "8.388609e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDN, "8.388609e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDN, "8.388609e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDN, "8.38861e6");
+ /* the exponent for the following example was forgotten in
+ the Arith'14 version of Parks' paper */
+ check24 ("12582913.0", "12582910.0", MPFR_RNDN, "1.000000238");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDN, "8388610.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDN, "1.6777213e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDN, "8.388611e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDN, "1.2582911e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDN, "1.258291e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDZ, "8.388608e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDZ, "8.388609e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDZ, "8.388608e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDZ, "8.38861e6");
+ check24("12582913.0", "12582910.0", MPFR_RNDZ, "1.000000238");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDZ, "8388610.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDZ, "1.6777213e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDZ, "8.38861e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDZ, "1.2582911e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDZ, "1.258291e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDU, "8.388609e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDU, "8.38861e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDU, "8.388609e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDU, "8.388611e6");
+ check24("12582913.0", "12582910.0", MPFR_RNDU, "1.000000357");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDU, "8388611.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDU, "1.6777214e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDU, "8.388611e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDU, "1.2582912e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDU, "1.2582911e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDD, "8.388608e6");
+ check24("140737479966720.0", "16777213.0", MPFR_RNDD, "8.388609e6");
+ check24("70368777732096.0", "8388611.0", MPFR_RNDD, "8.388608e6");
+ check24("105553133043712.0", "12582911.0", MPFR_RNDD, "8.38861e6");
+ check24("12582913.0", "12582910.0", MPFR_RNDD, "1.000000238");
+ check24 ("105553124655104.0", "12582910.0", MPFR_RNDD, "8388610.0");
+ check24("140737479966720.0", "8388609.0", MPFR_RNDD, "1.6777213e7");
+ check24("70368777732096.0", "8388609.0", MPFR_RNDD, "8.38861e6");
+ check24("105553133043712.0", "8388610.0", MPFR_RNDD, "1.2582911e7");
+ check24("105553124655104.0", "8388610.0", MPFR_RNDD, "1.258291e7");
+
+ check24("70368760954880.0", "8388609.0", MPFR_RNDA, "8.388609e6");
+}
+
+static void
+check_double(void)
+{
+ check53("0.0", "1.0", MPFR_RNDZ, "0.0");
+ check53("-7.4988969224688591e63", "4.8816866450288732e306", MPFR_RNDD,
+ "-1.5361282826510687291e-243");
+ check53("-1.33225773037748601769e+199", "3.63449540676937123913e+79",
+ MPFR_RNDZ, "-3.6655920045905428978e119");
+ check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDU,
+ "1.6672003992376663654e-67");
+ check53("9.89438396044940256501e-134", "5.93472984109987421717e-67",MPFR_RNDA,
+ "1.6672003992376663654e-67");
+ check53("9.89438396044940256501e-134", "-5.93472984109987421717e-67",
+ MPFR_RNDU, "-1.6672003992376663654e-67");
+ check53("-4.53063926135729747564e-308", "7.02293374921793516813e-84",
+ MPFR_RNDD, "-6.4512060388748850857e-225");
+ check53("6.25089225176473806123e-01","-2.35527154824420243364e-230",
+ MPFR_RNDD, "-2.6540006635008291192e229");
+ check53("6.25089225176473806123e-01","-2.35527154824420243364e-230",
+ MPFR_RNDA, "-2.6540006635008291192e229");
+ check53("6.52308934689126e15", "-1.62063546601505417497e273", MPFR_RNDN,
+ "-4.0250194961676020848e-258");
+ check53("1.04636807108079349236e-189", "3.72295730823253012954e-292",
+ MPFR_RNDZ, "2.810583051186143125e102");
+ /* problems found by Kevin under HP-PA */
+ check53 ("2.861044553323177e-136", "-1.1120354257068143e+45", MPFR_RNDZ,
+ "-2.5727998292003016e-181");
+ check53 ("-4.0559157245809205e-127", "-1.1237723844524865e+77", MPFR_RNDN,
+ "3.6091968273068081e-204");
+ check53 ("-1.8177943561493235e-93", "-8.51233984260364e-104", MPFR_RNDU,
+ "2.1354814184595821e+10");
+}
+
+static void
+check_64(void)
+{
+ mpfr_t x,y,z;
+
+ mpfr_inits2 (64, x, y, z, (mpfr_ptr) 0);
+
+ mpfr_set_str_binary(x, "1.00100100110110101001010010101111000001011100100101010000000000E54");
+ mpfr_set_str_binary(y, "1.00000000000000000000000000000000000000000000000000000000000000E584");
+ test_div(z, x, y, MPFR_RNDU);
+ if (mpfr_cmp_str (z, "0.1001001001101101010010100101011110000010111001001010100000000000E-529", 2, MPFR_RNDN))
+ {
+ printf("Error for tdiv for MPFR_RNDU and p=64\nx=");
+ mpfr_print_binary(x);
+ printf("\ny=");
+ mpfr_print_binary(y);
+ printf("\ngot ");
+ mpfr_print_binary(z);
+ printf("\nexpected 0.1001001001101101010010100101011110000010111001001010100000000000E-529\n");
+ exit(1);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static void
+check_convergence (void)
+{
+ mpfr_t x, y; int i, j;
+
+ mpfr_init2(x, 130);
+ mpfr_set_str_binary(x, "0.1011111101011010101000001010011111101000011100011101010011111011000011001010000000111100100111110011001010110100100001001000111001E6944");
+ mpfr_init2(y, 130);
+ mpfr_set_ui(y, 5, MPFR_RNDN);
+ test_div(x, x, y, MPFR_RNDD); /* exact division */
+
+ mpfr_set_prec(x, 64);
+ mpfr_set_prec(y, 64);
+ mpfr_set_str_binary(x, "0.10010010011011010100101001010111100000101110010010101E55");
+ mpfr_set_str_binary(y, "0.1E585");
+ test_div(x, x, y, MPFR_RNDN);
+ mpfr_set_str_binary(y, "0.10010010011011010100101001010111100000101110010010101E-529");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_div for prec=64, rnd=MPFR_RNDN\n");
+ printf ("got "); mpfr_print_binary(x); puts ("");
+ printf ("instead of "); mpfr_print_binary(y); puts ("");
+ exit(1);
+ }
+
+ for (i=32; i<=64; i+=32)
+ {
+ mpfr_set_prec(x, i);
+ mpfr_set_prec(y, i);
+ mpfr_set_ui(x, 1, MPFR_RNDN);
+ RND_LOOP(j)
+ {
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ test_div (y, x, y, (mpfr_rnd_t) j);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_div failed for x=1.0, y=1.0, prec=%d rnd=%s\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) j));
+ printf ("got "); mpfr_print_binary(y); puts ("");
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define KMAX 10000
+
+/* given y = o(x/u), x, u, find the inexact flag by
+ multiplying y by u */
+static int
+get_inexact (mpfr_t y, mpfr_t x, mpfr_t u)
+{
+ mpfr_t xx;
+ int inex;
+ mpfr_init2 (xx, mpfr_get_prec (y) + mpfr_get_prec (u));
+ mpfr_mul (xx, y, u, MPFR_RNDN); /* exact */
+ inex = mpfr_cmp (xx, x);
+ mpfr_clear (xx);
+ return inex;
+}
+
+static void
+check_hard (void)
+{
+ mpfr_t u, v, q, q2;
+ mpfr_prec_t precu, precv, precq;
+ int rnd;
+ int inex, inex2, i, j;
+
+ mpfr_init (q);
+ mpfr_init (q2);
+ mpfr_init (u);
+ mpfr_init (v);
+
+ for (precq = MPFR_PREC_MIN; precq <= 64; precq ++)
+ {
+ mpfr_set_prec (q, precq);
+ mpfr_set_prec (q2, precq + 1);
+ for (j = 0; j < 2; j++)
+ {
+ if (j == 0)
+ {
+ do
+ {
+ mpfr_urandomb (q2, RANDS);
+ }
+ while (mpfr_cmp_ui (q2, 0) == 0);
+ }
+ else /* use q2=1 */
+ mpfr_set_ui (q2, 1, MPFR_RNDN);
+ for (precv = precq; precv <= 10 * precq; precv += precq)
+ {
+ mpfr_set_prec (v, precv);
+ do
+ {
+ mpfr_urandomb (v, RANDS);
+ }
+ while (mpfr_cmp_ui (v, 0) == 0);
+ for (precu = precq; precu <= 10 * precq; precu += precq)
+ {
+ mpfr_set_prec (u, precu);
+ mpfr_mul (u, v, q2, MPFR_RNDN);
+ mpfr_nextbelow (u);
+ for (i = 0; i <= 2; i++)
+ {
+ RND_LOOP(rnd)
+ {
+ inex = test_div (q, u, v, (mpfr_rnd_t) rnd);
+ inex2 = get_inexact (q, u, v);
+ if (inex_cmp (inex, inex2))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex2, inex);
+ printf ("u= "); mpfr_dump (u);
+ printf ("v= "); mpfr_dump (v);
+ printf ("q= "); mpfr_dump (q);
+ mpfr_set_prec (q2, precq + precv);
+ mpfr_mul (q2, q, v, MPFR_RNDN);
+ printf ("q*v="); mpfr_dump (q2);
+ exit (1);
+ }
+ }
+ mpfr_nextabove (u);
+ }
+ }
+ }
+ }
+ }
+
+ mpfr_clear (q);
+ mpfr_clear (q2);
+ mpfr_clear (u);
+ mpfr_clear (v);
+}
+
+static void
+check_lowr (void)
+{
+ mpfr_t x, y, z, z2, z3, tmp;
+ int k, c, c2;
+
+
+ mpfr_init2 (x, 1000);
+ mpfr_init2 (y, 100);
+ mpfr_init2 (tmp, 850);
+ mpfr_init2 (z, 10);
+ mpfr_init2 (z2, 10);
+ mpfr_init2 (z3, 50);
+
+ for (k = 1; k < KMAX; k++)
+ {
+ do
+ {
+ mpfr_urandomb (z, RANDS);
+ }
+ while (mpfr_cmp_ui (z, 0) == 0);
+ do
+ {
+ mpfr_urandomb (tmp, RANDS);
+ }
+ while (mpfr_cmp_ui (tmp, 0) == 0);
+ mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */
+ c = test_div (z2, x, tmp, MPFR_RNDN);
+
+ if (c || mpfr_cmp (z2, z))
+ {
+ printf ("Error in mpfr_div rnd=MPFR_RNDN\n");
+ printf ("got "); mpfr_print_binary(z2); puts ("");
+ printf ("instead of "); mpfr_print_binary(z); puts ("");
+ printf ("inex flag = %d, expected 0\n", c);
+ exit (1);
+ }
+ }
+
+ /* x has still precision 1000, z precision 10, and tmp prec 850 */
+ mpfr_set_prec (z2, 9);
+ for (k = 1; k < KMAX; k++)
+ {
+ mpfr_urandomb (z, RANDS);
+ do
+ {
+ mpfr_urandomb (tmp, RANDS);
+ }
+ while (mpfr_cmp_ui (tmp, 0) == 0);
+ mpfr_mul (x, z, tmp, MPFR_RNDN); /* exact */
+ c = test_div (z2, x, tmp, MPFR_RNDN);
+ /* since z2 has one less bit that z, either the division is exact
+ if z is representable on 9 bits, or we have an even round case */
+
+ c2 = get_inexact (z2, x, tmp);
+ if ((mpfr_cmp (z2, z) == 0 && c) || inex_cmp (c, c2))
+ {
+ printf ("Error in mpfr_div rnd=MPFR_RNDN\n");
+ printf ("got "); mpfr_print_binary(z2); puts ("");
+ printf ("instead of "); mpfr_print_binary(z); puts ("");
+ printf ("inex flag = %d, expected %d\n", c, c2);
+ exit (1);
+ }
+ else if (c == 2)
+ {
+ mpfr_nexttoinf (z);
+ if (mpfr_cmp(z2, z))
+ {
+ printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n");
+ printf ("Dividing ");
+ printf ("got "); mpfr_print_binary(z2); puts ("");
+ printf ("instead of "); mpfr_print_binary(z); puts ("");
+ printf ("inex flag = %d\n", 1);
+ exit (1);
+ }
+ }
+ else if (c == -2)
+ {
+ mpfr_nexttozero (z);
+ if (mpfr_cmp(z2, z))
+ {
+ printf ("Error in mpfr_div [even rnd?] rnd=MPFR_RNDN\n");
+ printf ("Dividing ");
+ printf ("got "); mpfr_print_binary(z2); puts ("");
+ printf ("instead of "); mpfr_print_binary(z); puts ("");
+ printf ("inex flag = %d\n", 1);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_set_prec(x, 1000);
+ mpfr_set_prec(y, 100);
+ mpfr_set_prec(tmp, 850);
+ mpfr_set_prec(z, 10);
+ mpfr_set_prec(z2, 10);
+
+ /* almost exact divisions */
+ for (k = 1; k < KMAX; k++)
+ {
+ do
+ {
+ mpfr_urandomb (z, RANDS);
+ }
+ while (mpfr_cmp_ui (z, 0) == 0);
+ do
+ {
+ mpfr_urandomb (tmp, RANDS);
+ }
+ while (mpfr_cmp_ui (tmp, 0) == 0);
+ mpfr_mul(x, z, tmp, MPFR_RNDN);
+ mpfr_set(y, tmp, MPFR_RNDD);
+ mpfr_nexttoinf (x);
+
+ c = test_div(z2, x, y, MPFR_RNDD);
+ test_div(z3, x, y, MPFR_RNDD);
+ mpfr_set(z, z3, MPFR_RNDD);
+
+ if (c != -1 || mpfr_cmp(z2, z))
+ {
+ printf ("Error in mpfr_div rnd=MPFR_RNDD\n");
+ printf ("got "); mpfr_print_binary(z2); puts ("");
+ printf ("instead of "); mpfr_print_binary(z); puts ("");
+ printf ("inex flag = %d\n", c);
+ exit (1);
+ }
+
+ mpfr_set (y, tmp, MPFR_RNDU);
+ test_div (z3, x, y, MPFR_RNDU);
+ mpfr_set (z, z3, MPFR_RNDU);
+ c = test_div (z2, x, y, MPFR_RNDU);
+ if (c != 1 || mpfr_cmp (z2, z))
+ {
+ printf ("Error in mpfr_div rnd=MPFR_RNDU\n");
+ printf ("u="); mpfr_dump (x);
+ printf ("v="); mpfr_dump (y);
+ printf ("got "); mpfr_print_binary (z2); puts ("");
+ printf ("instead of "); mpfr_print_binary (z); puts ("");
+ printf ("inex flag = %d\n", c);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (z2);
+ mpfr_clear (z3);
+ mpfr_clear (tmp);
+}
+
+#define MAX_PREC 128
+
+static void
+check_inexact (void)
+{
+ mpfr_t x, y, z, u;
+ mpfr_prec_t px, py, pu;
+ int inexact, cmp;
+ mpfr_rnd_t rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (u);
+
+ mpfr_set_prec (x, 28);
+ mpfr_set_prec (y, 28);
+ mpfr_set_prec (z, 1023);
+ mpfr_set_str_binary (x, "0.1000001001101101111100010011E0");
+ mpfr_set_str (z, "48284762641021308813686974720835219181653367326353400027913400579340343320519877153813133510034402932651132854764198688352364361009429039801248971901380781746767119334993621199563870113045276395603170432175354501451429471578325545278975153148347684600400321033502982713296919861760382863826626093689036010394", 10, MPFR_RNDN);
+ mpfr_div (x, x, z, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.1111001011001101001001111100E-1023");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_div for prec=28, RNDN\n");
+ printf ("Expected "); mpfr_dump (y);
+ printf ("Got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_str_binary (x, "0.11101100110010100011011000000100001111011111110010101E0");
+ mpfr_set_prec (u, 127);
+ mpfr_set_str_binary (u, "0.1000001100110110110101110110101101111000110000001111111110000000011111001010110100110010111111111101000001011011101011101101000E-2");
+ mpfr_set_prec (y, 95);
+ inexact = test_div (y, x, u, MPFR_RNDN);
+ if (inexact != (cmp = get_inexact (y, x, u)))
+ {
+ printf ("Wrong inexact flag (0): expected %d, got %d\n", cmp, inexact);
+ printf ("x="); mpfr_out_str (stdout, 10, 99, x, MPFR_RNDN); printf ("\n");
+ printf ("u="); mpfr_out_str (stdout, 10, 99, u, MPFR_RNDN); printf ("\n");
+ printf ("y="); mpfr_out_str (stdout, 10, 99, y, MPFR_RNDN); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_str_binary (x, "0.101111100011011101010011101100001E0");
+ mpfr_set_prec (u, 2);
+ mpfr_set_str_binary (u, "0.1E0");
+ mpfr_set_prec (y, 28);
+ if ((inexact = test_div (y, x, u, MPFR_RNDN) >= 0))
+ {
+ printf ("Wrong inexact flag (1): expected -1, got %d\n",
+ inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 129);
+ mpfr_set_str_binary (x, "0.111110101111001100000101011100101100110011011101010001000110110101100101000010000001110110100001101010001010100010001111001101010E-2");
+ mpfr_set_prec (u, 15);
+ mpfr_set_str_binary (u, "0.101101000001100E-1");
+ mpfr_set_prec (y, 92);
+ if ((inexact = test_div (y, x, u, MPFR_RNDN)) <= 0)
+ {
+ printf ("Wrong inexact flag for rnd=MPFR_RNDN(1): expected 1, got %d\n",
+ inexact);
+ mpfr_dump (x);
+ mpfr_dump (u);
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ for (px=2; px<MAX_PREC; px++)
+ {
+ mpfr_set_prec (x, px);
+ mpfr_urandomb (x, RANDS);
+ for (pu=2; pu<=MAX_PREC; pu++)
+ {
+ mpfr_set_prec (u, pu);
+ do { mpfr_urandomb (u, RANDS); } while (mpfr_cmp_ui (u, 0) == 0);
+ {
+ py = MPFR_PREC_MIN + (randlimb () % (MAX_PREC - MPFR_PREC_MIN));
+ mpfr_set_prec (y, py);
+ mpfr_set_prec (z, py + pu);
+ {
+ rnd = RND_RAND ();
+ inexact = test_div (y, x, u, rnd);
+ if (mpfr_mul (z, y, u, rnd))
+ {
+ printf ("z <- y * u should be exact\n");
+ exit (1);
+ }
+ cmp = mpfr_cmp (z, x);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s\n",
+ mpfr_print_rnd_mode(rnd));
+ printf ("expected %d, got %d\n", cmp, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("u="); mpfr_print_binary (u); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("y*u="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (u);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t a, d, q;
+ mpfr_exp_t emax, emin;
+ int i;
+
+ mpfr_init2 (a, 100L);
+ mpfr_init2 (d, 100L);
+ mpfr_init2 (q, 100L);
+
+ /* 1/nan == nan */
+ mpfr_set_ui (a, 1L, MPFR_RNDN);
+ MPFR_SET_NAN (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ /* nan/1 == nan */
+ MPFR_SET_NAN (a);
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ /* +inf/1 == +inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_POS (a);
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* +inf/-1 == -inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_POS (a);
+ mpfr_set_si (d, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* -inf/1 == -inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_NEG (a);
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* -inf/-1 == +inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_NEG (a);
+ mpfr_set_si (d, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* 1/+inf == +0 */
+ mpfr_set_ui (a, 1L, MPFR_RNDN);
+ MPFR_SET_INF (d);
+ MPFR_SET_POS (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) == 0);
+ MPFR_ASSERTN (MPFR_IS_POS (q));
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* 1/-inf == -0 */
+ mpfr_set_ui (a, 1L, MPFR_RNDN);
+ MPFR_SET_INF (d);
+ MPFR_SET_NEG (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) == 0);
+ MPFR_ASSERTN (MPFR_IS_NEG (q));
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* -1/+inf == -0 */
+ mpfr_set_si (a, -1, MPFR_RNDN);
+ MPFR_SET_INF (d);
+ MPFR_SET_POS (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) == 0);
+ MPFR_ASSERTN (MPFR_IS_NEG (q));
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* -1/-inf == +0 */
+ mpfr_set_si (a, -1, MPFR_RNDN);
+ MPFR_SET_INF (d);
+ MPFR_SET_NEG (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) == 0);
+ MPFR_ASSERTN (MPFR_IS_POS (q));
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* 0/0 == nan */
+ mpfr_set_ui (a, 0L, MPFR_RNDN);
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ /* +inf/+inf == nan */
+ MPFR_SET_INF (a);
+ MPFR_SET_POS (a);
+ MPFR_SET_INF (d);
+ MPFR_SET_POS (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ /* 1/+0 = +inf */
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ /* 1/-0 = -inf */
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_neg (d, d, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ /* -1/+0 = -inf */
+ mpfr_set_si (a, -1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ /* -1/-0 = +inf */
+ mpfr_set_si (a, -1, MPFR_RNDZ);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_neg (d, d, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ /* +inf/+0 = +inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_POS (a);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* +inf/-0 = -inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_POS (a);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_neg (d, d, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* -inf/+0 = -inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_NEG (a);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* -inf/-0 = +inf */
+ MPFR_SET_INF (a);
+ MPFR_SET_NEG (a);
+ mpfr_set_ui (d, 0, MPFR_RNDZ);
+ mpfr_neg (d, d, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (test_div (q, a, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* check overflow */
+ emax = mpfr_get_emax ();
+ set_emax (1);
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_set_ui (d, 1, MPFR_RNDZ);
+ mpfr_div_2exp (d, d, 1, MPFR_RNDZ);
+ mpfr_clear_flags ();
+ test_div (q, a, d, MPFR_RNDU); /* 1 / 0.5 = 2 -> overflow */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT));
+ set_emax (emax);
+
+ /* check underflow */
+ emin = mpfr_get_emin ();
+ set_emin (-1);
+ mpfr_set_ui (a, 1, MPFR_RNDZ);
+ mpfr_div_2exp (a, a, 2, MPFR_RNDZ);
+ mpfr_set_prec (d, mpfr_get_prec (q) + 8);
+ for (i = -1; i <= 1; i++)
+ {
+ int sign;
+
+ /* Test 2^(-2) / (+/- (2 + eps)), with eps < 0, eps = 0, eps > 0.
+ -> underflow.
+ With div.c r5513, this test fails for eps > 0 in MPFR_RNDN. */
+ mpfr_set_ui (d, 2, MPFR_RNDZ);
+ if (i < 0)
+ mpfr_nextbelow (d);
+ if (i > 0)
+ mpfr_nextabove (d);
+ for (sign = 0; sign <= 1; sign++)
+ {
+ mpfr_clear_flags ();
+ test_div (q, a, d, MPFR_RNDZ); /* result = 0 */
+ MPFR_ASSERTN (__gmpfr_flags ==
+ (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT));
+ MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q));
+ MPFR_ASSERTN (MPFR_IS_ZERO (q));
+ mpfr_clear_flags ();
+ test_div (q, a, d, MPFR_RNDN); /* result = 0 iff eps >= 0 */
+ MPFR_ASSERTN (__gmpfr_flags ==
+ (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT));
+ MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q));
+ if (i < 0)
+ mpfr_nexttozero (q);
+ MPFR_ASSERTN (MPFR_IS_ZERO (q));
+ mpfr_neg (d, d, MPFR_RNDN);
+ }
+ }
+ set_emin (emin);
+
+ mpfr_clear (a);
+ mpfr_clear (d);
+ mpfr_clear (q);
+}
+
+static void
+consistency (void)
+{
+ mpfr_t x, y, z1, z2;
+ int i;
+
+ mpfr_inits (x, y, z1, z2, (mpfr_ptr) 0);
+
+ for (i = 0; i < 10000; i++)
+ {
+ mpfr_rnd_t rnd;
+ mpfr_prec_t px, py, pz, p;
+ int inex1, inex2;
+
+ rnd = RND_RAND ();
+ px = (randlimb () % 256) + 2;
+ py = (randlimb () % 128) + 2;
+ pz = (randlimb () % 256) + 2;
+ mpfr_set_prec (x, px);
+ mpfr_set_prec (y, py);
+ mpfr_set_prec (z1, pz);
+ mpfr_set_prec (z2, pz);
+ mpfr_urandomb (x, RANDS);
+ do
+ mpfr_urandomb (y, RANDS);
+ while (mpfr_zero_p (y));
+ inex1 = mpfr_div (z1, x, y, rnd);
+ MPFR_ASSERTN (!MPFR_IS_NAN (z1));
+ p = MAX (MAX (px, py), pz);
+ if (mpfr_prec_round (x, p, MPFR_RNDN) != 0 ||
+ mpfr_prec_round (y, p, MPFR_RNDN) != 0)
+ {
+ printf ("mpfr_prec_round error for i = %d\n", i);
+ exit (1);
+ }
+ inex2 = mpfr_div (z2, x, y, rnd);
+ MPFR_ASSERTN (!MPFR_IS_NAN (z2));
+ if (inex1 != inex2 || mpfr_cmp (z1, z2) != 0)
+ {
+ printf ("Consistency error for i = %d\n", i);
+ exit (1);
+ }
+ }
+
+ mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0);
+}
+
+/* Reported by Carl Witty on 2007-06-03 */
+static void
+test_20070603 (void)
+{
+ mpfr_t n, d, q, c;
+
+ mpfr_init2 (n, 128);
+ mpfr_init2 (d, 128);
+ mpfr_init2 (q, 31);
+ mpfr_init2 (c, 31);
+
+ mpfr_set_str (n, "10384593717069655257060992206846485", 10, MPFR_RNDN);
+ mpfr_set_str (d, "10384593717069655257060992206847132", 10, MPFR_RNDN);
+ mpfr_div (q, n, d, MPFR_RNDU);
+
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ if (mpfr_cmp (q, c) != 0)
+ {
+ printf ("Error in test_20070603\nGot ");
+ mpfr_dump (q);
+ printf ("instead of ");
+ mpfr_dump (c);
+ exit (1);
+ }
+
+ /* same for 64-bit machines */
+ mpfr_set_prec (n, 256);
+ mpfr_set_prec (d, 256);
+ mpfr_set_prec (q, 63);
+ mpfr_set_str (n, "822752278660603021077484591278675252491367930877209729029898240", 10, MPFR_RNDN);
+ mpfr_set_str (d, "822752278660603021077484591278675252491367930877212507873738752", 10, MPFR_RNDN);
+ mpfr_div (q, n, d, MPFR_RNDU);
+ if (mpfr_cmp (q, c) != 0)
+ {
+ printf ("Error in test_20070603\nGot ");
+ mpfr_dump (q);
+ printf ("instead of ");
+ mpfr_dump (c);
+ exit (1);
+ }
+
+ mpfr_clear (n);
+ mpfr_clear (d);
+ mpfr_clear (q);
+ mpfr_clear (c);
+}
+
+/* Bug found while adding tests for mpfr_cot */
+static void
+test_20070628 (void)
+{
+ mpfr_exp_t old_emax;
+ mpfr_t x, y;
+ int inex, err = 0;
+
+ old_emax = mpfr_get_emax ();
+
+ if (mpfr_set_emax (256))
+ {
+ printf ("Can't change exponent range\n");
+ exit (1);
+ }
+
+ mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_si_2exp (y, 1, -256, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_div (x, x, y, MPFR_RNDD);
+ if (MPFR_SIGN (x) >= 0 || ! mpfr_inf_p (x))
+ {
+ printf ("Error in test_20070628: expected -Inf, got\n");
+ mpfr_dump (x);
+ err++;
+ }
+ if (inex >= 0)
+ {
+ printf ("Error in test_20070628: expected inex < 0, got %d\n", inex);
+ err++;
+ }
+ if (! mpfr_overflow_p ())
+ {
+ printf ("Error in test_20070628: overflow flag is not set\n");
+ err++;
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+ mpfr_set_emax (old_emax);
+}
+
+#define TEST_FUNCTION test_div
+#define TWO_ARGS
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_inexact ();
+ check_hard ();
+ check_special ();
+ check_lowr ();
+ check_float (); /* checks single precision */
+ check_double ();
+ check_convergence ();
+ check_64 ();
+
+ check4("4.0","4.503599627370496e15", MPFR_RNDZ, 62,
+ "0.10000000000000000000000000000000000000000000000000000000000000E-49");
+ check4("1.0","2.10263340267725788209e+187", MPFR_RNDU, 65,
+ "0.11010011111001101011111001100111110100000001101001111100111000000E-622");
+ check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",MPFR_RNDU,
+ 65,
+ "0.11010011111001101011111001100111110100000001101001111100111000000E-1119");
+
+ consistency ();
+ test_20070603 ();
+ test_20070628 ();
+ test_generic (2, 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tdiv_d.c b/tests/tdiv_d.c
new file mode 100644
index 0000000..d0ef135
--- /dev/null
+++ b/tests/tdiv_d.c
@@ -0,0 +1,155 @@
+/* Test file for mpfr_div_d
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ /* nan / 1.0 is nan */
+ mpfr_set_nan (x);
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* +inf / 1.0 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* -inf / 1.0 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ /* 0.0 / 0.0 is nan */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (y, x, 0.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* 1.0 / 0.0 == +inf */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (y, x, 0.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* -1.0 / 0.0 == -inf */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (y, x, 0.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_sub_d
+#define DOUBLE_ARG2
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
+
+ tests_start_mpfr ();
+
+ /* check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_div_d (x, y, d, MPFR_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_div_d\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "32768", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_div_d (");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ check_nans ();
+
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c
new file mode 100644
index 0000000..dcaf342
--- /dev/null
+++ b/tests/tdiv_ui.c
@@ -0,0 +1,237 @@
+/* Test file for mpfr_div_ui.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+static void
+check (const char *ds, unsigned long u, mpfr_rnd_t rnd, const char *es)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_set_str1 (x, ds);
+ mpfr_div_ui (y, x, u, rnd);
+ if (mpfr_cmp_str1 (y, es))
+ {
+ printf ("mpfr_div_ui failed for x=%s, u=%lu, rnd=%s\n", ds, u,
+ mpfr_print_rnd_mode (rnd));
+ printf ("expected result is %s, got", es);
+ mpfr_out_str(stdout, 10, 0, y, MPFR_RNDN);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ unsigned xprec, yprec;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_ui (y, x, 3, MPFR_RNDN);
+
+ mpfr_set_prec (x, 100);
+ mpfr_set_prec (y, 100);
+ mpfr_urandomb (x, RANDS);
+ mpfr_div_ui (y, x, 123456, MPFR_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_div_ui (y, x, 123456789, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0))
+ {
+ printf ("mpfr_div_ui gives non-zero for 0/ui\n");
+ exit (1);
+ }
+
+ /* bug found by Norbert Mueller, 21 Aug 2001 */
+ mpfr_set_prec (x, 110);
+ mpfr_set_prec (y, 60);
+ mpfr_set_str_binary (x, "0.110101110011111110011111001110011001110111000000111110001000111011000011E-44");
+ mpfr_div_ui (y, x, 17, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.11001010100101100011101110000001100001010110101001010011011E-48");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in x/17 for x=1/16!\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ /* corner case */
+ mpfr_set_prec (x, 2 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_nextabove (x);
+ mpfr_div_ui (y, x, 2, MPFR_RNDN); /* exactly in the middle */
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 2) == 0);
+
+ mpfr_set_prec (x, 3 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_nextabove (x);
+ mpfr_div_ui (y, x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
+
+ mpfr_set_prec (x, 3 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2);
+ mpfr_set_si (x, -4, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_div_ui (y, x, 2, MPFR_RNDD);
+ MPFR_ASSERTN(mpfr_cmp_si (y, -3) == 0);
+
+ for (xprec = 53; xprec <= 128; xprec++)
+ {
+ mpfr_set_prec (x, xprec);
+ mpfr_set_str_binary (x, "0.1100100100001111110011111000000011011100001100110111E2");
+ for (yprec = 53; yprec <= 128; yprec++)
+ {
+ mpfr_set_prec (y, yprec);
+ mpfr_div_ui (y, x, 1, MPFR_RNDN);
+ if (mpfr_cmp(x,y))
+ {
+ printf ("division by 1.0 fails for xprec=%u, yprec=%u\n", xprec, yprec);
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ }
+ }
+
+ /* Bug reported by Mark Dickinson, 6 Nov 2007 */
+ mpfr_set_si (x, 0, MPFR_RNDN);
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_div_ui (y, x, 4, MPFR_RNDN);
+ MPFR_ASSERTN(MPFR_IS_ZERO(y) && MPFR_IS_POS(y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_inexact (void)
+{
+ mpfr_t x, y, z;
+ mpfr_prec_t px, py;
+ int inexact, cmp;
+ unsigned long int u;
+ int rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ for (px=2; px<300; px++)
+ {
+ mpfr_set_prec (x, px);
+ mpfr_urandomb (x, RANDS);
+ do
+ {
+ u = randlimb ();
+ }
+ while (u == 0);
+ for (py=2; py<300; py++)
+ {
+ mpfr_set_prec (y, py);
+ mpfr_set_prec (z, py + mp_bits_per_limb);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ inexact = mpfr_div_ui (y, x, u, (mpfr_rnd_t) rnd);
+ if (mpfr_mul_ui (z, y, u, (mpfr_rnd_t) rnd))
+ {
+ printf ("z <- y * u should be exact for u=%lu\n", u);
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("z="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ cmp = mpfr_cmp (z, x);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong inexact flag for u=%lu, rnd=%s\n", u,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+#define TEST_FUNCTION mpfr_div_ui
+#define INTEGER_TYPE unsigned long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric_ui.c"
+
+int
+main (int argc, char **argv)
+{
+ mpfr_t x;
+
+ tests_start_mpfr ();
+
+ special ();
+
+ check_inexact ();
+
+ check("1.0", 3, MPFR_RNDN, "3.3333333333333331483e-1");
+ check("1.0", 3, MPFR_RNDZ, "3.3333333333333331483e-1");
+ check("1.0", 3, MPFR_RNDU, "3.3333333333333337034e-1");
+ check("1.0", 3, MPFR_RNDD, "3.3333333333333331483e-1");
+ check("1.0", 2116118, MPFR_RNDN, "4.7256343927890600483e-7");
+ check("1.098612288668109782", 5, MPFR_RNDN, "0.21972245773362195087");
+
+ mpfr_init2 (x, 53);
+ mpfr_set_ui (x, 3, MPFR_RNDD);
+ mpfr_log (x, x, MPFR_RNDD);
+ mpfr_div_ui (x, x, 5, MPFR_RNDD);
+ if (mpfr_cmp_str1 (x, "0.21972245773362189536"))
+ {
+ printf ("Error in mpfr_div_ui for x=ln(3), u=5\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+
+ test_generic_ui (2, 200, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/teint.c b/tests/teint.c
new file mode 100644
index 0000000..4394e29
--- /dev/null
+++ b/tests/teint.c
@@ -0,0 +1,216 @@
+/* Test file for mpfr_eint.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_eint
+#define TEST_RANDOM_POS 8
+#define TEST_RANDOM_EMAX 40
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_eint (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: eint(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_eint (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) > 0))
+ {
+ printf ("Error: eint(+Inf) != +Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_eint (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: eint(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ /* eint(+/-0) = -Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
+ {
+ printf ("Error: eint(+0) != -Inf\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
+ if (! (mpfr_inf_p (y) && mpfr_sgn (y) < 0))
+ {
+ printf ("Error: eint(-0) != -Inf\n");
+ exit (1);
+ }
+
+ /* eint(x) = NaN for x < 0 */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_eint (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: eint(-1) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 17);
+ mpfr_set_prec (y, 17);
+ mpfr_set_str_binary (x, "1.0111110100100110e-2");
+ mpfr_set_str_binary (y, "-1.0010101001110100e-10");
+ mpfr_eint (x, x, MPFR_RNDZ);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for x=1.0111110100100110e-2, MPFR_RNDZ\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "0.10E4");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str (y, "440.37989953483827", 10, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for x=0.10E4, MPFR_RNDZ\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 63);
+ mpfr_set_prec (y, 63);
+ mpfr_set_str_binary (x, "1.01111101011100111000011010001000101101011000011001111101011010e-2");
+ mpfr_eint (x, x, MPFR_RNDZ);
+ mpfr_set_str_binary (y, "1.11010110001101000001010010000100001111001000100100000001011100e-17");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error (1) for MPFR_RNDZ\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ /* check large x */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "1E6");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "10100011110001101001110000110010111000100111010001E37");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for x=2^6, MPFR_RNDN\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1E7");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "11001100100011110000101001011010110111111011110011E128");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for x=2^7, MPFR_RNDN\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1E8");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "1010000110000101111111011011000101001000101011101001E310");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for x=2^8, MPFR_RNDN\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1E9");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "11001010101000001010101101110000010110011101110010101E677");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for x=2^9, MPFR_RNDN\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1E10");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "10011111111010010110110101101000101100101010101101101E1415");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for x=2^10, MPFR_RNDN\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ if (argc != 1) /* teint x [prec] */
+ {
+ mpfr_t x;
+ mpfr_prec_t p;
+ p = (argc < 3) ? 53 : atoi (argv[2]);
+ mpfr_init2 (x, p);
+ mpfr_set_str (x, argv[1], 10, MPFR_RNDN);
+ printf ("eint(");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (")=");
+ mpfr_eint (x, x, MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ mpfr_clear (x);
+ }
+ else
+ {
+ check_specials ();
+
+ test_generic (2, 100, 100);
+ }
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/teq.c b/tests/teq.c
new file mode 100644
index 0000000..5543655
--- /dev/null
+++ b/tests/teq.c
@@ -0,0 +1,208 @@
+/* Test file for mpfr_eq.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+teq (mpfr_t x)
+{
+ mpfr_t y;
+ unsigned long k, px, mx;
+
+ mpfr_init2 (y, MPFR_PREC(x));
+
+ mx = (MPFR_PREC(x) - 1) / mp_bits_per_limb;
+ px = mp_bits_per_limb - 2;
+
+ for (k = 2; k < MPFR_PREC(x); k++)
+ {
+ mpfr_set (y, x, MPFR_RNDN);
+
+ MPFR_MANT(y) [mx] ^= (mp_limb_t) 1 << px;
+
+ if (mpfr_eq(y, x, k) || !mpfr_eq(y, x, k - 1))
+ {
+ printf ("Error in eq.\n");
+ printf ("x = "); mpfr_print_binary (x); printf ("\n");
+ printf ("y = "); mpfr_print_binary (y); printf ("\n");
+ printf ("k = %lu\n", k);
+ printf ("mpfr_eq(y, x, k) = %d\nmpfr_eq(y, x, k - 1) = %d\n",
+ mpfr_eq (y, x, k), mpfr_eq (y, x, k - 1));
+ exit (1);
+ }
+
+ if (px)
+ {
+ --px;
+ }
+ else
+ {
+ --mx;
+ px = mp_bits_per_limb - 1;
+ }
+ }
+ mpfr_clear (y);
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y, z;
+ int i, error = 0;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_init2 (z, 53);
+
+ mpfr_set_str (x, "1", 10, (mpfr_rnd_t) 0);
+ mpfr_set_str (y, "1e-10000", 10, (mpfr_rnd_t) 0);
+ mpfr_add (z, x, y, MPFR_RNDU);
+
+ for (i = 1; i <= 52; i++)
+ if (mpfr_eq (x, z, i) == 0)
+ error = 1;
+ for (i = 53; i <= 100; i++)
+ if (mpfr_eq (x, z, i) != 0)
+ error = 1;
+ if (mpfr_eq (x, z, 1000) != 0)
+ error = 1;
+
+ if (error)
+ {
+ printf ("Error in mpfr_eq (1, 1+1e-1000)\n");
+ exit (1);
+ }
+
+ mpfr_set_nan (x);
+ mpfr_set_nan (y);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_inf (y, 1);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, 1);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1));
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, -1);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_inf (y, -1);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1));
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+ MPFR_ASSERTN(mpfr_eq (y, x, 1) == 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1));
+
+ mpfr_neg (y, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1));
+
+ mpfr_neg (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1));
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_neg (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_prec (x, 2 * mp_bits_per_limb);
+ mpfr_set_prec (y, mp_bits_per_limb);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb - 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb));
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb + 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, 2 * mp_bits_per_limb - 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, 2 * mp_bits_per_limb));
+ MPFR_ASSERTN(mpfr_eq (x, y, 2 * mp_bits_per_limb + 1));
+
+ mpfr_nextabove (x);
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb - 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb));
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb + 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, 2 * mp_bits_per_limb - 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, 2 * mp_bits_per_limb) == 0);
+ MPFR_ASSERTN(mpfr_eq (x, y, 2 * mp_bits_per_limb + 1) == 0);
+ MPFR_ASSERTN(mpfr_eq (y, x, mp_bits_per_limb - 1));
+ MPFR_ASSERTN(mpfr_eq (y, x, mp_bits_per_limb));
+ MPFR_ASSERTN(mpfr_eq (y, x, mp_bits_per_limb + 1));
+ MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb - 1));
+ MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb) == 0);
+ MPFR_ASSERTN(mpfr_eq (y, x, 2 * mp_bits_per_limb + 1) == 0);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1) == 0);
+
+ mpfr_set_prec (x, 2 * mp_bits_per_limb);
+ mpfr_set_prec (y, 2 * mp_bits_per_limb);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_ui (y, 3, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_eq (x, y, 1));
+ MPFR_ASSERTN(mpfr_eq (x, y, 2) == 0);
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb) == 0);
+ MPFR_ASSERTN(mpfr_eq (x, y, mp_bits_per_limb + 1) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+int
+main (void)
+{
+ int j;
+ mpfr_t x;
+
+ tests_start_mpfr ();
+
+ special ();
+
+ mpfr_init2 (x, 500);
+
+ for (j = 0; j < 500; j++)
+ {
+ mpfr_urandomb (x, RANDS);
+ teq (x);
+ }
+
+ mpfr_clear (x);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/terf.c b/tests/terf.c
new file mode 100644
index 0000000..e8e5f8d
--- /dev/null
+++ b/tests/terf.c
@@ -0,0 +1,662 @@
+/* Test file for mpfr_erf and mpfr_erfc.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_erf
+#define test_generic test_generic_erf
+#include "tgeneric.c"
+
+#define TEST_FUNCTION mpfr_erfc
+#undef TEST_RANDOM_EMAX
+#define TEST_RANDOM_EMAX 63
+#define test_generic test_generic_erfc
+#include "tgeneric.c"
+
+static void
+special_erf (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ /* erf(NaN) = NaN */
+ mpfr_set_nan (x);
+ mpfr_erf (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("mpfr_erf failed for x=NaN\n");
+ exit (1);
+ }
+
+ /* erf(+Inf) = 1 */
+ mpfr_set_inf (x, 1);
+ mpfr_erf (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_erf failed for x=+Inf\n");
+ printf ("expected 1.0, got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ /* erf(-Inf) = -1 */
+ mpfr_set_inf (x, -1);
+ mpfr_erf (y, x, MPFR_RNDN);
+ if (mpfr_cmp_si (y, -1))
+ {
+ printf ("mpfr_erf failed for x=-Inf\n");
+ exit (1);
+ }
+
+ /* erf(+0) = +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("mpfr_erf failed for x=+0\n");
+ exit (1);
+ }
+
+ /* erf(-0) = -0 */
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_erf (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("mpfr_erf failed for x=-0\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.11010111101110110011110100111010000010000100010001011");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=1.0, rnd=MPFR_RNDN\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "6.6", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDN\n");
+ printf ("expected 1\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "-6.6", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -1))
+ {
+ printf ("mpfr_erf failed for x=-6.6, rnd=MPFR_RNDN\n");
+ printf ("expected -1\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "6.6", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDZ);
+ mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDZ\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_str (x, "4.5", 10, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.1111111111111111111111111111111100100111110100011");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=4.5, rnd=MPFR_RNDN\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 120);
+ mpfr_set_prec (y, 120);
+ mpfr_set_str_binary (x, "0.110100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011E3");
+ mpfr_erf (x, x, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111111111111111100111111000100111011111011010000110101111100011001101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=6.6, rnd=MPFR_RNDN\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 8);
+ mpfr_set_ui (x, 50, MPFR_RNDN);
+ inex = mpfr_erf (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN\n");
+ printf ("expected 1, got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN: wrong ternary value\n"
+ "expected positive, got %d\n", inex);
+ exit (1);
+ }
+ inex = mpfr_erf (x, x, MPFR_RNDZ);
+ mpfr_nextbelow (y);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDZ\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("mpfr_erf failed for x=50, rnd=MPFR_RNDN: wrong ternary value\n"
+ "expected negative, got %d\n", inex);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+
+ mpfr_set_str_binary (x, "0.1010100100111011001111100101E-1");
+ mpfr_set_str_binary (y, "0.10111000001110011010110001101011E-1");
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "-0.10110011011010111110010001100001");
+ mpfr_set_str_binary (y, "-0.1010110110101011100010111000111");
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (2)\n");
+ mpfr_print_binary (x); printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "100.10001110011110100000110000111");
+ mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (3)\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "100.10001110011110100000110000111");
+ mpfr_erf (x, x, MPFR_RNDZ);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (4)\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "100.10001110011110100000110000111");
+ mpfr_erf (x, x, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error: erf for prec=32 (5)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "100.10001110011110100000110001000");
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error: erf for prec=32 (6)\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "100.10001110011110100000110001000");
+ mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
+ mpfr_erf (x, x, MPFR_RNDZ);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (7)\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "100.10001110011110100000110001000");
+ mpfr_erf (x, x, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error: erf for prec=32 (8)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error: erf for prec=32 (9)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error: erf for prec=32 (10)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDZ);
+ mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (11)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_erf (x, x, MPFR_RNDD);
+ mpfr_set_str_binary (y, "0.11111111111111111111111111111111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=32 (12)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 43);
+ mpfr_set_prec (y, 64);
+ mpfr_set_str_binary (x, "-0.1101110110101111100101011101110101101001001e3");
+ mpfr_erf (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 64);
+ mpfr_set_str_binary (x, "-0.1111111111111111111111111111111111111111111111111111111111111111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for prec=43,64 (13)\n");
+ exit (1);
+ }
+
+ /* worst cases */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "1.0000000000000000000000000000000000000110000000101101");
+ mpfr_erf (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.110101111011101100111101001110100000101011000011001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for worst case (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "1.0000000000000000000000000000011000111010101101011010");
+ mpfr_erf (y, x, MPFR_RNDU);
+ mpfr_set_str_binary (x, "0.11010111101110110011110100111100100111100011111000110");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for worst case (2a)\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1.0000000000000000000000000000011000111010101101011010");
+ mpfr_erf (y, x, MPFR_RNDD);
+ mpfr_set_str_binary (x, "0.11010111101110110011110100111100100111100011111000101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error: erf for worst case (2b)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+special_erfc (void)
+{
+ mpfr_t x, y;
+
+ mpfr_inits (x, y, (mpfr_ptr) 0);
+
+ /* erfc (NaN) = NaN */
+ mpfr_set_nan (x);
+ mpfr_erfc (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("mpfr_erfc failed for x=NaN\n");
+ exit (1);
+ }
+ /* erfc(+Inf) = 0+ */
+ mpfr_set_inf (x, 1);
+ mpfr_erfc (y, x, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y))
+ {
+ printf ("mpfr_erf failed for x=+Inf\n");
+ printf ("expected 0+, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ /* erfc(-Inf) = 2 */
+ mpfr_set_inf (x, -1);
+ mpfr_erfc (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 2))
+ {
+ printf ("mpfr_erf failed for x=-Inf\n");
+ printf ("expected 2, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ /* erf(+0) = 1 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_erf failed for x=+0\n");
+ printf ("expected 1, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+static void
+large_arg (void)
+{
+ mpfr_t x, y;
+ unsigned int flags;
+
+ mpfr_init2 (x, 88);
+ mpfr_init2 (y, 98);
+
+ mpfr_set_si_2exp (x, -1, 173, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_erfc (y, x, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ if (mpfr_cmp_ui (y, 2) != 0)
+ {
+ printf ("mpfr_erfc failed for large x (1)\n");
+ exit (1);
+ }
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (1)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
+
+ mpfr_set_si_2exp (x, -1, mpfr_get_emax () - 3, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_erfc (y, x, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ if (mpfr_cmp_ui (y, 2) != 0)
+ {
+ printf ("mpfr_erfc failed for large x (1b)\n");
+ exit (1);
+ }
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (1b)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_prec (y, 43);
+ mpfr_set_str_binary (x, "1.11000101010111011000111100101001e6");
+ mpfr_erfc (y, x, MPFR_RNDD);
+ mpfr_set_prec (x, 43);
+ mpfr_set_str_binary (x, "100010011100101100001101100101011101101E-18579");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("mpfr_erfc failed for large x (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (y, 43);
+ mpfr_set_si_2exp (x, 1, 11, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100000100100010101111001111010010001000110E-6051113");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("mpfr_erfc failed for large x (3)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 75);
+ mpfr_set_prec (y, 85);
+ mpfr_set_str_binary (x, "0.111110111111010011101011001100001010011110101010011111010010111101010001011E15");
+ mpfr_erfc (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("mpfr_erfc failed for large x (3b)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 21);
+ mpfr_set_str_binary (x, "-1.0e3");
+ mpfr_clear_flags ();
+ mpfr_erfc (y, x, MPFR_RNDZ);
+ flags = __gmpfr_flags;
+ mpfr_set_prec (x, 21);
+ mpfr_set_str_binary (x, "1.11111111111111111111");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("mpfr_erfc failed for large x (4)\n");
+ exit (1);
+ }
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (4)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 31);
+ mpfr_set_str_binary (x, "-1.0e3");
+ mpfr_clear_flags ();
+ mpfr_erfc (y, x, MPFR_RNDZ);
+ flags = __gmpfr_flags;
+ mpfr_set_prec (x, 31);
+ mpfr_set_str_binary (x, "1.111111111111111111111111111111");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("mpfr_erfc failed for x=-8, prec=31 (5)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("mpfr_erfc sets incorrect flags for large x (5)\n");
+ printf ("Expected %u, got %u\n",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
+
+ /* Reported by Christopher Creutzig on 2007-07-10. */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_si_2exp (x, 54563, -1, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ if (! mpfr_equal_p (y, x))
+ {
+ printf ("mpfr_erfc failed for x=27281.5, prec=53 (6)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ /* same test with rounding away from zero */
+ mpfr_set_si_2exp (x, 54563, -1, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDU);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_nextabove (x);
+ if (! mpfr_equal_p (y, x))
+ {
+ printf ("mpfr_erfc failed for x=27281.5, prec=53 (7)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+test_erfc (void)
+{
+ mpfr_t x, y, z;
+ int inex;
+ mpfr_exp_t emin;
+
+ mpfr_inits2 (40, x, y, z, (mpfr_ptr) 0);
+
+ mpfr_set_si_2exp (x, -1, -10, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.1000000000100100000110111010110111100000E1");
+ mpfr_erfc (y, x, MPFR_RNDN);
+ if (mpfr_cmp (y, z) != 0)
+ {
+ printf ("mpfr_erfc failed for x = ");
+ mpfr_dump (x);
+ printf ("got ");
+ mpfr_dump (y);
+ printf ("instead of ");
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ /* slowness detected by Kevin Rauch on 26 Oct 2007 */
+ mpfr_set_prec (x, 128);
+ mpfr_set_si (x, -256, MPFR_RNDN);
+ inex = mpfr_erfc (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(inex > 0 && mpfr_cmp_ui (x, 2) == 0);
+
+ /* bug found by Pascal Molin on March 10, 2011 */
+ emin = mpfr_get_emin ();
+ if (! mpfr_set_emin (-1073808789))
+ {
+ /* Typically, a 64-bit machine. */
+ mpfr_set_si (x, 27282, MPFR_RNDN);
+ mpfr_erfc (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) != 0);
+ mpfr_set_emin (emin);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+/* Failure in r7569 (2011-03-15) due to incorrect flags. */
+static void
+reduced_expo_range (void)
+{
+ mpfr_exp_t emax;
+ mpfr_t x, y, ex_y;
+ int inex, ex_inex;
+ unsigned int flags, ex_flags;
+
+ emax = mpfr_get_emax ();
+ mpfr_set_emax (3);
+ mpfr_init2 (x, 33);
+ mpfr_inits2 (110, y, ex_y, (mpfr_ptr) 0);
+ mpfr_set_str_binary (x, "-0.111100110111111111011101010101110E3");
+ mpfr_clear_flags ();
+ inex = mpfr_erfc (y, x, MPFR_RNDZ);
+ flags = __gmpfr_flags;
+ mpfr_set_str (ex_y, "1.fffffffffffffffffffffe607440", 16, MPFR_RNDN);
+ ex_inex = -1;
+ ex_flags = MPFR_FLAGS_INEXACT;
+ if (SIGN (inex) != ex_inex || flags != ex_flags ||
+ ! mpfr_equal_p (y, ex_y))
+ {
+ printf ("Error in reduced_expo_range\non x = ");
+ mpfr_dump (x);
+ printf ("Expected y = ");
+ mpfr_out_str (stdout, 16, 0, ex_y, MPFR_RNDN);
+ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
+ printf ("Got y = ");
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
+ exit (1);
+ }
+ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
+ mpfr_set_emax (emax);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special_erf ();
+ special_erfc ();
+ large_arg ();
+ test_erfc ();
+ reduced_expo_range ();
+
+ test_generic_erf (2, 100, 15);
+ test_generic_erfc (2, 100, 15);
+
+ data_check ("data/erf", mpfr_erf, "mpfr_erf");
+ data_check ("data/erfc", mpfr_erfc, "mpfr_erfc");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tests.c b/tests/tests.c
new file mode 100644
index 0000000..ef3f0ef
--- /dev/null
+++ b/tests/tests.c
@@ -0,0 +1,958 @@
+/* Miscellaneous support for test programs.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# if HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+# endif
+#endif
+
+#include <stdlib.h>
+#include <float.h>
+#include <errno.h>
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#ifdef MPFR_TEST_DIVBYZERO
+# include <fenv.h>
+#endif
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h> /* for struct timeval */
+# include <time.h>
+#elif defined HAVE_SYS_TIME_H
+# include <sys/time.h>
+#else
+# include <time.h>
+#endif
+
+/* <sys/fpu.h> is needed to have union fpc_csr defined under IRIX64
+ (see below). Let's include it only if need be. */
+#if defined HAVE_SYS_FPU_H && defined HAVE_FPC_CSR
+# include <sys/fpu.h>
+#endif
+
+#ifdef MPFR_TESTS_TIMEOUT
+#include <sys/resource.h>
+#endif
+
+#include "mpfr-test.h"
+
+#ifdef MPFR_FPU_PREC
+/* This option allows to test MPFR on x86 processors when the FPU
+ * rounding precision has been changed. As MPFR is a library, this can
+ * occur in practice, either by the calling software or by some other
+ * library or plug-in used by the calling software. This option is
+ * mainly for developers. If it is used, then the <fpu_control.h>
+ * header is assumed to exist and work like under Linux/x86. MPFR does
+ * not need to be recompiled. So, a possible usage is the following:
+ *
+ * cd tests
+ * make clean
+ * make check CFLAGS="-g -O2 -ffloat-store -DMPFR_FPU_PREC=_FPU_SINGLE"
+ *
+ * i.e. just add -DMPFR_FPU_PREC=... to the CFLAGS found in Makefile.
+ *
+ * Notes:
+ * + SSE2 (used to implement double's on x86_64, and possibly on x86
+ * too, depending on the compiler configuration and flags) is not
+ * affected by the dynamic precision.
+ * + When the FPU is set to single precision, the behavior of MPFR
+ * functions that have a native floating-point type (float, double,
+ * long double) as argument or return value is not guaranteed.
+ */
+
+#include <fpu_control.h>
+
+static void
+set_fpu_prec (void)
+{
+ fpu_control_t cw;
+
+ _FPU_GETCW(cw);
+ cw &= ~(_FPU_EXTENDED|_FPU_DOUBLE|_FPU_SINGLE);
+ cw |= (MPFR_FPU_PREC);
+ _FPU_SETCW(cw);
+}
+
+#endif
+
+static mpfr_exp_t default_emin, default_emax;
+
+static void tests_rand_start (void);
+static void tests_rand_end (void);
+static void tests_limit_start (void);
+
+/* We want to always import the function mpfr_dump inside the test
+ suite, so that we can use it in GDB. But it doesn't work if we build
+ a Windows DLL (initializer element is not a constant) */
+#if !__GMP_LIBGMP_DLL
+extern void (*dummy_func) (mpfr_srcptr);
+void (*dummy_func)(mpfr_srcptr) = mpfr_dump;
+#endif
+
+void
+test_version (void)
+{
+ const char *version;
+
+ /* VL: I get the following error on an OpenSUSE machine, and changing
+ the value of shlibpath_overrides_runpath in the libtool file from
+ 'no' to 'yes' fixes the problem. */
+
+ version = mpfr_get_version ();
+ if (strcmp (MPFR_VERSION_STRING, version) == 0)
+ {
+ char buffer[16];
+ int i;
+
+ sprintf (buffer, "%d.%d.%d", MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR,
+ MPFR_VERSION_PATCHLEVEL);
+ for (i = 0; buffer[i] == version[i]; i++)
+ if (buffer[i] == '\0')
+ return;
+ if (buffer[i] == '\0' && version[i] == '-')
+ return;
+ printf ("MPFR_VERSION_MAJOR.MPFR_VERSION_MINOR.MPFR_VERSION_PATCHLEVEL"
+ " (%s)\nand MPFR_VERSION_STRING (%s) do not match!\nIt seems "
+ "that the mpfr.h file has been corrupted.\n", buffer, version);
+ exit (1);
+ }
+
+ printf ("Incorrect MPFR version! (%s header vs %s library)\n"
+ "Nothing else has been tested since for this reason,\n"
+ "any other test may fail. Please fix this one first.\n\n"
+ "You can try to avoid this problem by changing the value of\n"
+ "shlibpath_overrides_runpath in the libtool file and rebuild\n"
+ "MPFR (make clean && make && make check).\n"
+ "Otherwise this error may be due to a corrupted mpfr.h, an\n"
+ "incomplete build (try to rebuild MPFR from scratch and/or\n"
+ "use 'make clean'), or something wrong in the system.\n",
+ MPFR_VERSION_STRING, version);
+ exit (1);
+}
+
+void
+tests_start_mpfr (void)
+{
+ test_version ();
+
+ /* don't buffer, so output is not lost if a test causes a segv etc */
+ setbuf (stdout, NULL);
+
+#if defined HAVE_LOCALE_H && defined HAVE_SETLOCALE
+ /* Added on 2005-07-09. This allows to test MPFR under various
+ locales. New bugs will probably be found, in particular with
+ LC_ALL="tr_TR.ISO8859-9" because of the i/I character... */
+ setlocale (LC_ALL, "");
+#endif
+
+#ifdef MPFR_FPU_PREC
+ set_fpu_prec ();
+#endif
+
+#ifdef MPFR_TEST_DIVBYZERO
+ /* Define to test the use of MPFR_ERRDIVZERO */
+ feclearexcept (FE_ALL_EXCEPT);
+#endif
+
+ tests_memory_start ();
+ tests_rand_start ();
+ tests_limit_start ();
+
+ default_emin = mpfr_get_emin ();
+ default_emax = mpfr_get_emax ();
+}
+
+void
+tests_end_mpfr (void)
+{
+ int err = 0;
+
+ if (mpfr_get_emin () != default_emin)
+ {
+ printf ("Default emin value has not been restored!\n");
+ err = 1;
+ }
+
+ if (mpfr_get_emax () != default_emax)
+ {
+ printf ("Default emax value has not been restored!\n");
+ err = 1;
+ }
+
+ mpfr_free_cache ();
+ tests_rand_end ();
+ tests_memory_end ();
+
+#ifdef MPFR_TEST_DIVBYZERO
+ /* Define to test the use of MPFR_ERRDIVZERO */
+ if (fetestexcept (FE_DIVBYZERO|FE_INVALID))
+ {
+ printf ("A floating-point division by 0 or an invalid operation"
+ " occurred!\n");
+#ifdef MPFR_ERRDIVZERO
+ /* This should never occur because the purpose of defining
+ MPFR_ERRDIVZERO is to avoid all the FP divisions by 0. */
+ err = 1;
+#endif
+ }
+#endif
+
+ if (err)
+ exit (err);
+}
+
+static void
+tests_limit_start (void)
+{
+#ifdef MPFR_TESTS_TIMEOUT
+ struct rlimit rlim[1];
+ char *timeoutp;
+ int timeout;
+
+ timeoutp = getenv ("MPFR_TESTS_TIMEOUT");
+ timeout = timeoutp != NULL ? atoi (timeoutp) : MPFR_TESTS_TIMEOUT;
+ if (timeout > 0)
+ {
+ /* We need to call getrlimit first to initialize rlim_max to
+ an acceptable value for setrlimit. When enabled, timeouts
+ are regarded as important: we don't want to take too much
+ CPU time on machines shared with other users. So, if we
+ can't set the timeout, we exit immediately. */
+ if (getrlimit (RLIMIT_CPU, rlim))
+ {
+ printf ("Error: getrlimit failed\n");
+ exit (1);
+ }
+ rlim->rlim_cur = timeout;
+ if (setrlimit (RLIMIT_CPU, rlim))
+ {
+ printf ("Error: setrlimit failed\n");
+ exit (1);
+ }
+ }
+#endif
+}
+
+static void
+tests_rand_start (void)
+{
+ gmp_randstate_ptr rands;
+ char *perform_seed;
+ unsigned long seed;
+
+ if (__gmp_rands_initialized)
+ {
+ printf (
+ "Please let tests_start() initialize the global __gmp_rands, i.e.\n"
+ "ensure that function is called before the first use of RANDS.\n");
+ exit (1);
+ }
+
+ gmp_randinit_default (__gmp_rands);
+ __gmp_rands_initialized = 1;
+ rands = __gmp_rands;
+
+ perform_seed = getenv ("GMP_CHECK_RANDOMIZE");
+ if (perform_seed != NULL)
+ {
+ seed = strtoul (perform_seed, NULL, 10);
+ if (! (seed == 0 || seed == 1))
+ {
+ printf ("Re-seeding with GMP_CHECK_RANDOMIZE=%lu\n", seed);
+ gmp_randseed_ui (rands, seed);
+ }
+ else
+ {
+#ifdef HAVE_GETTIMEOFDAY
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ seed = tv.tv_sec + tv.tv_usec;
+#else
+ time_t tv;
+ time (&tv);
+ seed = tv;
+#endif
+ gmp_randseed_ui (rands, seed);
+ printf ("Seed GMP_CHECK_RANDOMIZE=%lu "
+ "(include this in bug reports)\n", seed);
+ }
+ }
+ else
+ gmp_randseed_ui (rands, 0x2143FEDC);
+}
+
+static void
+tests_rand_end (void)
+{
+ RANDS_CLEAR ();
+}
+
+/* initialization function for tests using the hardware floats
+ Not very useful now. */
+void
+mpfr_test_init (void)
+{
+ double d;
+#ifdef HAVE_FPC_CSR
+ /* to get denormalized numbers on IRIX64 */
+ union fpc_csr exp;
+
+ exp.fc_word = get_fpc_csr();
+ exp.fc_struct.flush = 0;
+ set_fpc_csr(exp.fc_word);
+#endif
+#ifdef HAVE_DENORMS
+ d = DBL_MIN;
+ if (2.0 * (d / 2.0) != d)
+ {
+ printf ("Error: HAVE_DENORMS defined, but no subnormals.\n");
+ exit (1);
+ }
+#endif
+
+ /* generate DBL_EPSILON with a loop to avoid that the compiler
+ optimizes the code below in non-IEEE 754 mode, deciding that
+ c = d is always false. */
+#if 0
+ for (eps = 1.0; eps != DBL_EPSILON; eps /= 2.0);
+ c = 1.0 + eps;
+ d = eps * (1.0 - eps) / 2.0;
+ d += c;
+ if (c != d)
+ {
+ printf ("Warning: IEEE 754 standard not fully supported\n"
+ " (maybe extended precision not disabled)\n"
+ " Some tests may fail\n");
+ }
+#endif
+}
+
+
+/* generate a random limb */
+mp_limb_t
+randlimb (void)
+{
+ mp_limb_t limb;
+
+ mpfr_rand_raw (&limb, RANDS, GMP_NUMB_BITS);
+ return limb;
+}
+
+/* returns ulp(x) for x a 'normal' double-precision number */
+double
+Ulp (double x)
+{
+ double y, eps;
+
+ if (x < 0) x = -x;
+
+ y = x * 2.220446049250313080847263336181640625e-16 ; /* x / 2^52 */
+
+ /* as ulp(x) <= y = x/2^52 < 2*ulp(x),
+ we have x + ulp(x) <= x + y <= x + 2*ulp(x),
+ therefore o(x + y) = x + ulp(x) or x + 2*ulp(x) */
+
+ eps = x + y;
+ eps = eps - x; /* ulp(x) or 2*ulp(x) */
+
+ return (eps > y) ? 0.5 * eps : eps;
+}
+
+/* returns the number of ulp's between a and b,
+ where a and b can be any floating-point number, except NaN
+ */
+int
+ulp (double a, double b)
+{
+ double twoa;
+
+ if (a == b) return 0; /* also deals with a=b=inf or -inf */
+
+ twoa = a + a;
+ if (twoa == a) /* a is +/-0.0 or +/-Inf */
+ return ((b < a) ? INT_MAX : -INT_MAX);
+
+ return (int) ((a - b) / Ulp (a));
+}
+
+/* return double m*2^e */
+double
+dbl (double m, int e)
+{
+ if (e >=0 )
+ while (e-- > 0)
+ m *= 2.0;
+ else
+ while (e++ < 0)
+ m /= 2.0;
+ return m;
+}
+
+/* Warning: NaN values cannot be distinguished if MPFR_NANISNAN is defined. */
+int
+Isnan (double d)
+{
+ return (d) != (d);
+}
+
+void
+d_trace (const char *name, double d)
+{
+ union {
+ double d;
+ unsigned char b[sizeof(double)];
+ } u;
+ int i;
+
+ if (name != NULL && name[0] != '\0')
+ printf ("%s=", name);
+
+ u.d = d;
+ printf ("[");
+ for (i = 0; i < (int) sizeof (u.b); i++)
+ {
+ if (i != 0)
+ printf (" ");
+ printf ("%02X", (int) u.b[i]);
+ }
+ printf ("] %.20g\n", d);
+}
+
+void
+ld_trace (const char *name, long double ld)
+{
+ union {
+ long double ld;
+ unsigned char b[sizeof(long double)];
+ } u;
+ int i;
+
+ if (name != NULL && name[0] != '\0')
+ printf ("%s=", name);
+
+ u.ld = ld;
+ printf ("[");
+ for (i = 0; i < (int) sizeof (u.b); i++)
+ {
+ if (i != 0)
+ printf (" ");
+ printf ("%02X", (int) u.b[i]);
+ }
+ printf ("] %.20Lg\n", ld);
+}
+
+/* Open a file in the src directory - can't use fopen directly */
+FILE *
+src_fopen (const char *filename, const char *mode)
+{
+#ifndef SRCDIR
+ return fopen (filename, mode);
+#else
+ const char *srcdir = SRCDIR;
+ char *buffer;
+ size_t buffsize;
+ FILE *f;
+
+ buffsize = strlen (filename) + strlen (srcdir) + 2;
+ buffer = (char *) (*__gmp_allocate_func) (buffsize);
+ if (buffer == NULL)
+ {
+ printf ("src_fopen: failed to alloc memory)\n");
+ exit (1);
+ }
+ sprintf (buffer, "%s/%s", srcdir, filename);
+ f = fopen (buffer, mode);
+ (*__gmp_free_func) (buffer, buffsize);
+ return f;
+#endif
+}
+
+void
+set_emin (mpfr_exp_t exponent)
+{
+ if (mpfr_set_emin (exponent))
+ {
+ printf ("set_emin: setting emin to %ld failed\n", (long int) exponent);
+ exit (1);
+ }
+}
+
+void
+set_emax (mpfr_exp_t exponent)
+{
+ if (mpfr_set_emax (exponent))
+ {
+ printf ("set_emax: setting emax to %ld failed\n", (long int) exponent);
+ exit (1);
+ }
+}
+
+/* pos is 512 times the proportion of negative numbers.
+ If pos=256, half of the numbers are negative.
+ If pos=0, all generated numbers are positive.
+*/
+void
+tests_default_random (mpfr_ptr x, int pos, mpfr_exp_t emin, mpfr_exp_t emax)
+{
+ MPFR_ASSERTN (emin <= emax);
+ MPFR_ASSERTN (emin >= MPFR_EMIN_MIN);
+ MPFR_ASSERTN (emax <= MPFR_EMAX_MAX);
+ /* but it isn't required that emin and emax are in the current
+ exponent range (see below), so that underflow/overflow checks
+ can be done on 64-bit machines. */
+
+ mpfr_urandomb (x, RANDS);
+ if (MPFR_IS_PURE_FP (x) && (emin >= 1 || (randlimb () & 1)))
+ {
+ mpfr_exp_t e;
+ e = MPFR_GET_EXP (x) +
+ (emin + (long) (randlimb () % (emax - emin + 1)));
+ /* Note: There should be no overflow here because both terms are
+ between MPFR_EMIN_MIN and MPFR_EMAX_MAX, but the sum e isn't
+ necessarily between MPFR_EMIN_MIN and MPFR_EMAX_MAX. */
+ if (mpfr_set_exp (x, e))
+ {
+ /* The random number doesn't fit in the current exponent range.
+ In this case, test the function in the extended exponent range,
+ which should be restored by the caller. */
+ mpfr_set_emin (MPFR_EMIN_MIN);
+ mpfr_set_emax (MPFR_EMAX_MAX);
+ mpfr_set_exp (x, e);
+ }
+ }
+ if (randlimb () % 512 < pos)
+ mpfr_neg (x, x, MPFR_RNDN);
+}
+
+/* The test_one argument is seen a boolean. If it is true and rnd is
+ a rounding mode toward infinity, then the function is tested in
+ only one rounding mode (the one provided in rnd) and the variable
+ rndnext is not used (due to the break). If it is true and rnd is a
+ rounding mode toward or away from zero, then the function is tested
+ twice, first with the provided rounding mode and second with the
+ rounding mode toward the corresponding infinity (determined by the
+ sign of the result). If it is false, then the function is tested
+ in the 5 rounding modes, and rnd must initially be MPFR_RNDZ; thus
+ rndnext will be initialized in the first iteration.
+ If the test_one argument is 2, then this means that y is exact, and
+ the ternary value is checked.
+ As examples of use, see the calls to test5rm from the data_check and
+ bad_cases functions. */
+static void
+test5rm (int (*fct) (FLIST), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z,
+ mpfr_rnd_t rnd, int test_one, const char *name)
+{
+ mpfr_prec_t yprec = MPFR_PREC (y);
+ mpfr_rnd_t rndnext = MPFR_RND_MAX; /* means uninitialized */
+
+ MPFR_ASSERTN (test_one || rnd == MPFR_RNDZ);
+ mpfr_set_prec (z, yprec);
+ while (1)
+ {
+ int inex;
+
+ MPFR_ASSERTN (rnd != MPFR_RND_MAX);
+ inex = fct (z, x, rnd);
+ if (! (mpfr_equal_p (y, z) || (mpfr_nan_p (y) && mpfr_nan_p (z))))
+ {
+ printf ("Error for %s with xprec=%lu, yprec=%lu, rnd=%s\nx = ",
+ name, (unsigned long) MPFR_PREC (x), (unsigned long) yprec,
+ mpfr_print_rnd_mode (rnd));
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\nexpected ");
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (test_one == 2 && inex != 0)
+ {
+ printf ("Error for %s with xprec=%lu, yprec=%lu, rnd=%s\nx = ",
+ name, (unsigned long) MPFR_PREC (x), (unsigned long) yprec,
+ mpfr_print_rnd_mode (rnd));
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\nexact case, but non-zero ternary value (%d)\n", inex);
+ exit (1);
+ }
+ if (rnd == MPFR_RNDN)
+ break;
+
+ if (test_one)
+ {
+ if (rnd == MPFR_RNDU || rnd == MPFR_RNDD)
+ break;
+
+ if (MPFR_IS_NEG (y))
+ rnd = (rnd == MPFR_RNDA) ? MPFR_RNDD : MPFR_RNDU;
+ else
+ rnd = (rnd == MPFR_RNDA) ? MPFR_RNDU : MPFR_RNDD;
+ }
+ else if (rnd == MPFR_RNDZ)
+ {
+ rnd = MPFR_IS_NEG (y) ? MPFR_RNDU : MPFR_RNDD;
+ rndnext = MPFR_RNDA;
+ }
+ else
+ {
+ rnd = rndnext;
+ if (rnd == MPFR_RNDA)
+ {
+ mpfr_nexttoinf (y);
+ rndnext = (MPFR_IS_NEG (y)) ? MPFR_RNDD : MPFR_RNDU;
+ }
+ else if (rndnext != MPFR_RNDN)
+ rndnext = MPFR_RNDN;
+ else
+ {
+ if (yprec == MPFR_PREC_MIN)
+ break;
+ mpfr_prec_round (y, --yprec, MPFR_RNDZ);
+ mpfr_set_prec (z, yprec);
+ }
+ }
+ }
+}
+
+/* Check data in file f for function foo, with name 'name'.
+ Each line consists of the file f one:
+
+ xprec yprec rnd x y
+
+ where:
+
+ xprec is the input precision
+ yprec is the output precision
+ rnd is the rounding mode (n, z, u, d, a, Z, *)
+ x is the input (hexadecimal format)
+ y is the expected output (hexadecimal format) for foo(x) with rounding rnd
+
+ If rnd is Z, y is the expected output in round-toward-zero, and the
+ four directed rounding modes are tested, then the round-to-nearest
+ mode is tested in precision yprec-1. This is useful for worst cases,
+ where yprec is the minimum value such that one has a worst case in a
+ directed rounding mode.
+
+ If rnd is *, y must be an exact case. All the rounding modes are tested
+ and the ternary value is checked (it must be 0).
+ */
+void
+data_check (const char *f, int (*foo) (FLIST), const char *name)
+{
+ FILE *fp;
+ int xprec, yprec; /* not mpfr_prec_t because of the fscanf */
+ mpfr_t x, y, z;
+ mpfr_rnd_t rnd;
+ char r;
+ int c;
+
+ fp = fopen (f, "r");
+ if (fp == NULL)
+ fp = src_fopen (f, "r");
+ if (fp == NULL)
+ {
+ char *v = (char *) MPFR_VERSION_STRING;
+
+ /* In the '-dev' versions, assume that the data file exists and
+ return an error if the file cannot be opened to make sure
+ that such failures are detected. */
+ while (*v != '\0')
+ v++;
+ if (v[-4] == '-' && v[-3] == 'd' && v[-2] == 'e' && v[-1] == 'v')
+ {
+ printf ("Error: unable to open file '%s'\n", f);
+ exit (1);
+ }
+ else
+ return;
+ }
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ while (!feof (fp))
+ {
+ /* skip whitespace, for consistency */
+ if (fscanf (fp, " ") == EOF)
+ {
+ if (ferror (fp))
+ {
+ perror ("data_check");
+ exit (1);
+ }
+ else
+ break; /* end of file */
+ }
+
+ if ((c = getc (fp)) == EOF)
+ {
+ if (ferror (fp))
+ {
+ perror ("data_check");
+ exit (1);
+ }
+ else
+ break; /* end of file */
+ }
+
+ if (c == '#') /* comment: read entire line */
+ {
+ do
+ {
+ c = getc (fp);
+ }
+ while (!feof (fp) && c != '\n');
+ }
+ else
+ {
+ ungetc (c, fp);
+
+ c = fscanf (fp, "%d %d %c", &xprec, &yprec, &r);
+ MPFR_ASSERTN (xprec >= MPFR_PREC_MIN && xprec <= MPFR_PREC_MAX);
+ MPFR_ASSERTN (yprec >= MPFR_PREC_MIN && yprec <= MPFR_PREC_MAX);
+ if (c == EOF)
+ {
+ perror ("data_check");
+ exit (1);
+ }
+ else if (c != 3)
+ {
+ printf ("Error: corrupted line in file '%s'\n", f);
+ exit (1);
+ }
+
+ switch (r)
+ {
+ case 'n':
+ rnd = MPFR_RNDN;
+ break;
+ case 'z': case 'Z':
+ rnd = MPFR_RNDZ;
+ break;
+ case 'u':
+ rnd = MPFR_RNDU;
+ break;
+ case 'd':
+ rnd = MPFR_RNDD;
+ break;
+ case '*':
+ rnd = MPFR_RND_MAX; /* non-existing rounding mode */
+ break;
+ default:
+ printf ("Error: unexpected rounding mode"
+ " in file '%s': %c\n", f, (int) r);
+ exit (1);
+ }
+ mpfr_set_prec (x, xprec);
+ mpfr_set_prec (y, yprec);
+ if (mpfr_inp_str (x, fp, 0, MPFR_RNDN) == 0)
+ {
+ printf ("Error: corrupted argument in file '%s'\n", f);
+ exit (1);
+ }
+ if (mpfr_inp_str (y, fp, 0, MPFR_RNDN) == 0)
+ {
+ printf ("Error: corrupted result in file '%s'\n", f);
+ exit (1);
+ }
+ if (getc (fp) != '\n')
+ {
+ printf ("Error: result not followed by \\n in file '%s'\n", f);
+ exit (1);
+ }
+ /* Skip whitespace, in particular at the end of the file. */
+ if (fscanf (fp, " ") == EOF && ferror (fp))
+ {
+ perror ("data_check");
+ exit (1);
+ }
+ if (r == '*')
+ {
+ int rndint;
+ RND_LOOP (rndint)
+ test5rm (foo, x, y, z, (mpfr_rnd_t) rndint, 2, name);
+ }
+ else
+ test5rm (foo, x, y, z, rnd, r != 'Z', name);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ fclose (fp);
+}
+
+/* Test n random bad cases. A precision py in [pymin,pymax] and
+ * a number y of precision py are chosen randomly. One computes
+ * x = inv(y) in precision px = py + psup (rounded to nearest).
+ * Then (in general), y is a bad case for fct in precision py (in
+ * the directed rounding modes, but also in the rounding-to-nearest
+ * mode for some lower precision: see data_check).
+ * fct, inv, name: data related to the function.
+ * pos, emin, emax: arguments for tests_default_random.
+ */
+void
+bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), const char *name,
+ int pos, mpfr_exp_t emin, mpfr_exp_t emax,
+ mpfr_prec_t pymin, mpfr_prec_t pymax, mpfr_prec_t psup,
+ int n)
+{
+ mpfr_t x, y, z;
+ char *dbgenv;
+ int i, dbg;
+ mpfr_exp_t old_emin, old_emax;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+
+ dbgenv = getenv ("MPFR_DEBUG_BADCASES");
+ dbg = dbgenv != 0 ? atoi (dbgenv) : 0; /* debug level */
+ mpfr_inits (x, y, z, (mpfr_ptr) 0);
+ for (i = 0; i < n; i++)
+ {
+ mpfr_prec_t px, py, pz;
+ int inex;
+
+ if (dbg)
+ printf ("bad_cases: i = %d\n", i);
+ py = pymin + (randlimb () % (pymax - pymin + 1));
+ mpfr_set_prec (y, py);
+ tests_default_random (y, pos, emin, emax);
+ if (dbg)
+ {
+ printf ("bad_cases: yprec =%4ld, y = ", (long) py);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\n");
+ }
+ px = py + psup;
+ mpfr_set_prec (x, px);
+ mpfr_clear_flags ();
+ inv (x, y, MPFR_RNDN);
+ if (mpfr_nanflag_p () || mpfr_overflow_p () || mpfr_underflow_p ())
+ {
+ if (dbg)
+ printf ("bad_cases: no normal inverse\n");
+ goto next_i;
+ }
+ if (dbg > 1)
+ {
+ printf ("bad_cases: x = ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\n");
+ }
+ pz = px;
+ do
+ {
+ pz += 32;
+ mpfr_set_prec (z, pz);
+ if (fct (z, x, MPFR_RNDN) == 0)
+ {
+ if (dbg)
+ printf ("bad_cases: exact case\n");
+ goto next_i;
+ }
+ if (dbg)
+ {
+ if (dbg > 1)
+ {
+ printf ("bad_cases: %s(x) ~= ", name);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ }
+ else
+ {
+ printf ("bad_cases: [MPFR_RNDZ] ~= ");
+ mpfr_out_str (stdout, 16, 40, z, MPFR_RNDZ);
+ }
+ printf ("\n");
+ }
+ inex = mpfr_prec_round (z, py, MPFR_RNDN);
+ if (mpfr_nanflag_p () || mpfr_overflow_p () || mpfr_underflow_p ()
+ || ! mpfr_equal_p (z, y))
+ {
+ if (dbg)
+ printf ("bad_cases: inverse doesn't match\n");
+ goto next_i;
+ }
+ }
+ while (inex == 0);
+ /* We really have a bad case. */
+ do
+ py--;
+ while (py >= MPFR_PREC_MIN && mpfr_prec_round (z, py, MPFR_RNDZ) == 0);
+ py++;
+ /* py is now the smallest output precision such that we have
+ a bad case in the directed rounding modes. */
+ if (mpfr_prec_round (y, py, MPFR_RNDZ) != 0)
+ {
+ printf ("Internal error for i = %d\n", i);
+ exit (1);
+ }
+ if ((inex > 0 && MPFR_IS_POS (z)) ||
+ (inex < 0 && MPFR_IS_NEG (z)))
+ {
+ mpfr_nexttozero (y);
+ if (mpfr_zero_p (y))
+ goto next_i;
+ }
+ if (dbg)
+ {
+ printf ("bad_cases: yprec =%4ld, y = ", (long) py);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\n");
+ }
+ /* Note: y is now the expected result rounded toward zero. */
+ test5rm (fct, x, y, z, MPFR_RNDZ, 0, name);
+ next_i:
+ /* In case the exponent range has been changed by
+ tests_default_random()... */
+ mpfr_set_emin (old_emin);
+ mpfr_set_emax (old_emax);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+void
+flags_out (unsigned int flags)
+{
+ int none = 1;
+
+ if (flags & MPFR_FLAGS_UNDERFLOW)
+ none = 0, printf (" underflow");
+ if (flags & MPFR_FLAGS_OVERFLOW)
+ none = 0, printf (" overflow");
+ if (flags & MPFR_FLAGS_NAN)
+ none = 0, printf (" nan");
+ if (flags & MPFR_FLAGS_INEXACT)
+ none = 0, printf (" inexact");
+ if (flags & MPFR_FLAGS_ERANGE)
+ none = 0, printf (" erange");
+ if (none)
+ printf (" none");
+ printf (" (%u)\n", flags);
+}
diff --git a/tests/texceptions.c b/tests/texceptions.c
new file mode 100644
index 0000000..925ced9
--- /dev/null
+++ b/tests/texceptions.c
@@ -0,0 +1,446 @@
+/* Test file for exceptions.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define ERROR(s) do { printf(s"\n"); exit(1); } while(0)
+
+/* Test powerof2 */
+static void
+check_powerof2 (void)
+{
+ mpfr_t x;
+
+ mpfr_init (x);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_powerof2_raw (x));
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ MPFR_ASSERTN (!mpfr_powerof2_raw (x));
+ mpfr_clear (x);
+}
+
+/* Test default rounding mode */
+static void
+check_default_rnd (void)
+{
+ int r;
+ mpfr_rnd_t t;
+ for(r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ mpfr_set_default_rounding_mode ((mpfr_rnd_t) r);
+ t = (mpfr_get_default_rounding_mode) ();
+ if ((mpfr_rnd_t) r != t)
+ {
+ printf ("%s %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r),
+ mpfr_print_rnd_mode (t));
+ ERROR("ERROR in setting / getting default rounding mode (1)");
+ }
+ }
+ mpfr_set_default_rounding_mode ((mpfr_rnd_t) MPFR_RND_MAX);
+ if (mpfr_get_default_rounding_mode() != MPFR_RNDA)
+ ERROR("ERROR in setting / getting default rounding mode (2)");
+ mpfr_set_default_rounding_mode((mpfr_rnd_t) -1);
+ if (mpfr_get_default_rounding_mode() != MPFR_RNDA)
+ ERROR("ERROR in setting / getting default rounding mode (3)");
+}
+
+static void
+check_emin_emax (void)
+{
+ mpfr_exp_t old_emin, old_emax;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+
+ /* Check the functions not the macros ! */
+ if ((mpfr_set_emin)(MPFR_EMIN_MIN) != 0)
+ ERROR("set_emin failed!");
+ if ((mpfr_get_emin)() != MPFR_EMIN_MIN)
+ ERROR("get_emin FAILED!");
+ if ((mpfr_set_emin)(MPFR_EMIN_MIN-1) == 0)
+ ERROR("set_emin failed! (2)");
+
+ if ((mpfr_set_emax)(MPFR_EMAX_MAX) != 0)
+ ERROR("set_emax failed!");
+ if ((mpfr_get_emax)() != MPFR_EMAX_MAX)
+ ERROR("get_emax FAILED!");
+ if ((mpfr_set_emax)(MPFR_EMAX_MAX+1) == 0)
+ ERROR("set_emax failed! (2)");
+
+ if ((mpfr_get_emin_min) () != MPFR_EMIN_MIN)
+ ERROR ("get_emin_min");
+ if ((mpfr_get_emin_max) () != MPFR_EMIN_MAX)
+ ERROR ("get_emin_max");
+ if ((mpfr_get_emax_min) () != MPFR_EMAX_MIN)
+ ERROR ("get_emax_min");
+ if ((mpfr_get_emax_max) () != MPFR_EMAX_MAX)
+ ERROR ("get_emax_max");
+
+ set_emin (old_emin);
+ set_emax (old_emax);
+}
+
+static void
+check_set_get_prec (void)
+{
+ mpfr_t x;
+
+ mpfr_init2 (x, 17);
+ if (mpfr_get_prec (x) != 17 || (mpfr_get_prec)(x) != 17)
+ ERROR ("mpfr_get_prec");
+ mpfr_clear (x);
+}
+
+static void
+mpfr_set_double_range (void)
+{
+ mpfr_set_default_prec (54);
+ if (mpfr_get_default_prec () != 54)
+ ERROR ("get_default_prec failed (1)");
+ mpfr_set_default_prec (53);
+ if ((mpfr_get_default_prec) () != 53)
+ ERROR ("get_default_prec failed (2)");
+
+ /* in double precision format, the unbiased exponent is between 0 and
+ 2047, where 0 is used for subnormal numbers, and 2047 for special
+ numbers (infinities, NaN), and the bias is 1023, thus "normal" numbers
+ have an exponent between -1022 and 1023, corresponding to numbers
+ between 2^(-1022) and previous(2^(1024)).
+ (The smallest subnormal number is 0.(0^51)1*2^(-1022)= 2^(-1074).)
+
+ The smallest normal power of two is 1.0*2^(-1022).
+ The largest normal power of two is 2^1023.
+ (We have to add one for mpfr since mantissa are between 1/2 and 1.)
+ */
+
+ set_emin (-1021);
+ set_emax (1024);
+}
+
+static void
+check_flags (void)
+{
+ mpfr_t x;
+ mpfr_exp_t old_emin, old_emax;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+ mpfr_init (x);
+
+ /* Check the functions not the macros ! */
+ (mpfr_clear_flags)();
+ mpfr_set_double_range ();
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ (mpfr_clear_overflow)();
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
+ if (!(mpfr_overflow_p)())
+ ERROR("ERROR: No overflow detected!\n");
+
+ (mpfr_clear_underflow)();
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1025, MPFR_RNDN);
+ if (!(mpfr_underflow_p)())
+ ERROR("ERROR: No underflow detected!\n");
+
+ (mpfr_clear_nanflag)();
+ MPFR_SET_NAN(x);
+ mpfr_add (x, x, x, MPFR_RNDN);
+ if (!(mpfr_nanflag_p)())
+ ERROR("ERROR: No NaN flag!\n");
+
+ (mpfr_clear_inexflag)();
+ mpfr_set_ui(x, 2, MPFR_RNDN);
+ mpfr_cos(x, x, MPFR_RNDN);
+ if (!(mpfr_inexflag_p)())
+ ERROR("ERROR: No inexact flag!\n");
+
+ (mpfr_clear_erangeflag) ();
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
+ mpfr_get_ui (x, MPFR_RNDN);
+ if (!(mpfr_erangeflag_p)())
+ ERROR ("ERROR: No erange flag!\n");
+
+ mpfr_clear (x);
+ set_emin (old_emin);
+ set_emax (old_emax);
+}
+
+static void
+test_set_underflow (void)
+{
+ mpfr_t x, zero, min;
+ mpfr_ptr r[MPFR_RND_MAX];
+ int t[MPFR_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */
+ int i;
+ int s;
+
+ mpfr_inits (x, zero, min, (mpfr_ptr) 0);
+ mpfr_set_ui (zero, 0, MPFR_RNDN);
+ mpfr_set_ui (min, 0, MPFR_RNDN);
+ mpfr_nextabove (min);
+ r[0] = r[2] = r[4] = min; /* RNDN, RNDU, RNDA */
+ r[1] = r[3] = zero; /* RNDZ, RNDD */
+ for (s = 1; s > 0; s = -1)
+ {
+ for (i = 0; i < MPFR_RND_MAX ; i++)
+ {
+ int j;
+ int inex;
+
+ j = s < 0 && i > 1 ? 5 - i : i;
+ inex = mpfr_underflow (x, (mpfr_rnd_t) i, s);
+ if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0)
+ {
+ printf ("Error in test_set_underflow, sign = %d,"
+ " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mpfr_rnd_t) i));
+ printf ("Got\n");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (", inex = %d\ninstead of\n", inex);
+ mpfr_out_str (stdout, 2, 0, r[j], MPFR_RNDN);
+ printf (", inex = %d\n", t[j]);
+ exit (1);
+ }
+ }
+ mpfr_neg (zero, zero, MPFR_RNDN);
+ mpfr_neg (min, min, MPFR_RNDN);
+ }
+ mpfr_clears (x, zero, min, (mpfr_ptr) 0);
+}
+
+static void
+test_set_overflow (void)
+{
+ mpfr_t x, inf, max;
+ mpfr_ptr r[MPFR_RND_MAX];
+ int t[MPFR_RND_MAX] = { 1, -1, 1, -1, 1 }; /* RNDN, RNDZ, RNDU, RNDD, RNDA */
+ int i;
+ int s;
+
+ mpfr_inits2 (32, x, inf, max, (mpfr_ptr) 0);
+ mpfr_set_inf (inf, 1);
+ mpfr_set_inf (max, 1);
+ mpfr_nextbelow (max);
+ r[0] = r[2] = r[4] = inf; /* RNDN, RNDU, RNDA */
+ r[1] = r[3] = max; /* RNDZ, RNDD */
+ for (s = 1; s > 0; s = -1)
+ {
+ for (i = 0; i < MPFR_RND_MAX ; i++)
+ {
+ int j;
+ int inex;
+
+ j = s < 0 && i > 1 ? 5 - i : i;
+ inex = mpfr_overflow (x, (mpfr_rnd_t) i, s);
+ if (mpfr_cmp (x, r[j]) || inex * t[j] <= 0)
+ {
+ printf ("Error in test_set_overflow, sign = %d,"
+ " rnd_mode = %s\n", s, mpfr_print_rnd_mode ((mpfr_rnd_t) i));
+ printf ("Got\n");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (", inex = %d\ninstead of\n", inex);
+ mpfr_out_str (stdout, 2, 0, r[j], MPFR_RNDN);
+ printf (", inex = %d\n", t[j]);
+ exit (1);
+ }
+ }
+ mpfr_neg (inf, inf, MPFR_RNDN);
+ mpfr_neg (max, max, MPFR_RNDN);
+ }
+ mpfr_clears (x, inf, max, (mpfr_ptr) 0);
+}
+
+static void
+check_set (void)
+{
+ mpfr_clear_flags ();
+
+ mpfr_set_overflow ();
+ MPFR_ASSERTN ((mpfr_overflow_p) ());
+ mpfr_set_underflow ();
+ MPFR_ASSERTN ((mpfr_underflow_p) ());
+ mpfr_set_divby0 ();
+ MPFR_ASSERTN ((mpfr_divby0_p) ());
+ mpfr_set_nanflag ();
+ MPFR_ASSERTN ((mpfr_nanflag_p) ());
+ mpfr_set_inexflag ();
+ MPFR_ASSERTN ((mpfr_inexflag_p) ());
+ mpfr_set_erangeflag ();
+ MPFR_ASSERTN ((mpfr_erangeflag_p) ());
+
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_ALL);
+
+ mpfr_clear_overflow ();
+ MPFR_ASSERTN (! (mpfr_overflow_p) ());
+ mpfr_clear_underflow ();
+ MPFR_ASSERTN (! (mpfr_underflow_p) ());
+ mpfr_clear_divby0 ();
+ MPFR_ASSERTN (! (mpfr_divby0_p) ());
+ mpfr_clear_nanflag ();
+ MPFR_ASSERTN (! (mpfr_nanflag_p) ());
+ mpfr_clear_inexflag ();
+ MPFR_ASSERTN (! (mpfr_inexflag_p) ());
+ mpfr_clear_erangeflag ();
+ MPFR_ASSERTN (! (mpfr_erangeflag_p) ());
+
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ (mpfr_set_overflow) ();
+ MPFR_ASSERTN (mpfr_overflow_p ());
+ (mpfr_set_underflow) ();
+ MPFR_ASSERTN (mpfr_underflow_p ());
+ (mpfr_set_divby0) ();
+ MPFR_ASSERTN (mpfr_divby0_p ());
+ (mpfr_set_nanflag) ();
+ MPFR_ASSERTN (mpfr_nanflag_p ());
+ (mpfr_set_inexflag) ();
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ (mpfr_set_erangeflag) ();
+ MPFR_ASSERTN (mpfr_erangeflag_p ());
+
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_ALL);
+
+ (mpfr_clear_overflow) ();
+ MPFR_ASSERTN (! mpfr_overflow_p ());
+ (mpfr_clear_underflow) ();
+ MPFR_ASSERTN (! mpfr_underflow_p ());
+ (mpfr_clear_divby0) ();
+ MPFR_ASSERTN (! mpfr_divby0_p ());
+ (mpfr_clear_nanflag) ();
+ MPFR_ASSERTN (! mpfr_nanflag_p ());
+ (mpfr_clear_inexflag) ();
+ MPFR_ASSERTN (! mpfr_inexflag_p ());
+ (mpfr_clear_erangeflag) ();
+ MPFR_ASSERTN (! mpfr_erangeflag_p ());
+
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ tests_start_mpfr ();
+
+ test_set_underflow ();
+ test_set_overflow ();
+ check_default_rnd();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ if (emin >= emax)
+ {
+ printf ("Error: emin >= emax\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
+ mpfr_set_double_range ();
+ mpfr_check_range (x, 0, MPFR_RNDN);
+ if (!mpfr_inf_p (x) || (mpfr_sgn(x) <= 0))
+ {
+ printf ("Error: 2^1024 rounded to nearest should give +Inf\n");
+ exit (1);
+ }
+
+ set_emax (1025);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
+ mpfr_set_double_range ();
+ mpfr_check_range (x, 0, MPFR_RNDD);
+ if (!mpfr_number_p (x))
+ {
+ printf ("Error: 2^1024 rounded down should give a normal number\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1023, MPFR_RNDN);
+ mpfr_add (x, x, x, MPFR_RNDN);
+ if (!mpfr_inf_p (x) || (mpfr_sgn(x) <= 0))
+ {
+ printf ("Error: x+x rounded to nearest for x=2^1023 should give +Inf\n");
+ printf ("emax = %ld\n", (long) mpfr_get_emax ());
+ printf ("got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1023, MPFR_RNDN);
+ mpfr_add (x, x, x, MPFR_RNDD);
+ if (!mpfr_number_p (x))
+ {
+ printf ("Error: x+x rounded down for x=2^1023 should give"
+ " a normal number\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1022, MPFR_RNDN);
+ mpfr_set_str_binary (y, "1.1e-1022"); /* y = 3/2*x */
+ mpfr_sub (y, y, x, MPFR_RNDZ);
+ if (mpfr_cmp_ui (y, 0))
+ {
+ printf ("Error: y-x rounded to zero should give 0"
+ " for y=3/2*2^(-1022), x=2^(-1022)\n");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+ set_emin (-1026);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1025, MPFR_RNDN);
+ mpfr_set_double_range ();
+ mpfr_check_range (x, 0, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (x) )
+ {
+ printf ("Error: x rounded to nearest for x=2^-1024 should give Zero\n");
+ printf ("emin = %ld\n", (long) mpfr_get_emin ());
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ set_emin (emin);
+ set_emax (emax);
+
+ check_emin_emax();
+ check_flags();
+ check_set_get_prec ();
+ check_powerof2 ();
+ check_set ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/texp.c b/tests/texp.c
new file mode 100644
index 0000000..4b77b28
--- /dev/null
+++ b/tests/texp.c
@@ -0,0 +1,1022 @@
+/* Test file for mpfr_exp.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_exp (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_exp (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_exp mpfr_exp
+#endif
+
+/* returns the number of ulp of error */
+static void
+check3 (const char *op, mpfr_rnd_t rnd, const char *res)
+{
+ mpfr_t x, y;
+
+ mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
+ /* y negative. If we forget to set the sign in mpfr_exp, we'll see it. */
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_set_str1 (x, op);
+ test_exp (y, x, rnd);
+ if (mpfr_cmp_str1 (y, res) )
+ {
+ printf ("mpfr_exp failed for x=%s, rnd=%s\n",
+ op, mpfr_print_rnd_mode (rnd));
+ printf ("expected result is %s, got ", res);
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
+ putchar('\n');
+ exit (1);
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+/* expx is the value of exp(X) rounded toward -infinity */
+static void
+check_worst_case (const char *Xs, const char *expxs)
+{
+ mpfr_t x, y;
+
+ mpfr_inits2 (53, x, y, (mpfr_ptr) 0);
+ mpfr_set_str1(x, Xs);
+ test_exp(y, x, MPFR_RNDD);
+ if (mpfr_cmp_str1 (y, expxs))
+ {
+ printf ("exp(x) rounded toward -infinity is wrong\n");
+ exit(1);
+ }
+ mpfr_set_str1(x, Xs);
+ test_exp(x, x, MPFR_RNDU);
+ mpfr_nexttoinf (y);
+ if (mpfr_cmp(x,y))
+ {
+ printf ("exp(x) rounded toward +infinity is wrong\n");
+ exit(1);
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+/* worst cases communicated by Jean-Michel Muller and Vincent Lefevre */
+static int
+check_worst_cases (void)
+{
+ mpfr_t x; mpfr_t y;
+
+ mpfr_init(x);
+ mpfr_set_prec (x, 53);
+
+ check_worst_case("4.44089209850062517562e-16", "1.00000000000000022204");
+ check_worst_case("6.39488462184069720009e-14", "1.00000000000006372680");
+ check_worst_case("1.84741111297455401935e-12", "1.00000000000184718907");
+ check_worst_case("1.76177628026265550074e-10", "1.00000000017617751702");
+ check3("1.76177628026265550074e-10", MPFR_RNDN, "1.00000000017617773906");
+ check_worst_case("7.54175277499595900852e-10", "1.00000000075417516676");
+ check3("7.54175277499595900852e-10", MPFR_RNDN, "1.00000000075417538881");
+ /* bug found by Vincent Lefe`vre on December 8, 1999 */
+ check3("-5.42410311287441459172e+02", MPFR_RNDN, "2.7176584868845723e-236");
+ /* further cases communicated by Vincent Lefe`vre on January 27, 2000 */
+ check3("-1.32920285897904911589e-10", MPFR_RNDN, "0.999999999867079769622");
+ check3("-1.44037948245738330735e-10", MPFR_RNDN, "0.9999999998559621072757");
+ check3("-1.66795910430705305937e-10", MPFR_RNDZ, "0.9999999998332040895832");
+ check3("-1.64310953745426656203e-10", MPFR_RNDN, "0.9999999998356891017792");
+ check3("-1.38323574826034659172e-10", MPFR_RNDZ, "0.9999999998616764251835");
+ check3("-1.23621668465115401498e-10", MPFR_RNDZ, "0.9999999998763783315425");
+
+ mpfr_set_prec (x, 601);
+ mpfr_set_str (x, "0.88b6ba510e10450edc258748bc9dfdd466f21b47ed264cdf24aa8f64af1f3fad9ec2301d43c0743f534b5aa20091ff6d352df458ef1ba519811ef6f5b11853534fd8fa32764a0a6d2d0dd20@0", 16, MPFR_RNDZ);
+ mpfr_init2 (y, 601);
+ mpfr_exp_2 (y, x, MPFR_RNDD);
+ mpfr_exp_3 (x, x, MPFR_RNDD);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=601\n");
+ printf ("mpfr_exp_2 gives ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\nmpfr_exp_3 gives ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 13001);
+ mpfr_set_prec (y, 13001);
+ mpfr_urandomb (x, RANDS);
+ mpfr_exp_3 (y, x, MPFR_RNDN);
+ mpfr_exp_2 (x, x, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=13001\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ return 0;
+}
+
+static void
+compare_exp2_exp3 (mpfr_prec_t p0, mpfr_prec_t p1)
+{
+ mpfr_t x, y, z;
+ mpfr_prec_t prec;
+ mpfr_rnd_t rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ for (prec = p0; prec <= p1; prec ++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (y, prec);
+ mpfr_set_prec (z, prec);
+ do
+ mpfr_urandomb (x, RANDS);
+ while (MPFR_IS_ZERO (x)); /* 0 is handled by mpfr_exp only */
+ rnd = RND_RAND ();
+ mpfr_exp_2 (y, x, rnd);
+ mpfr_exp_3 (z, x, rnd);
+ if (mpfr_cmp (y,z))
+ {
+ printf ("mpfr_exp_2 and mpfr_exp_3 disagree for rnd=%s and\nx=",
+ mpfr_print_rnd_mode (rnd));
+ mpfr_print_binary (x);
+ puts ("");
+ printf ("mpfr_exp_2 gives ");
+ mpfr_print_binary (y);
+ puts ("");
+ printf ("mpfr_exp_3 gives ");
+ mpfr_print_binary (z);
+ puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_large (void)
+{
+ mpfr_t x, z;
+ mpfr_prec_t prec;
+
+ /* bug found by Patrick Pe'lissier on 7 Jun 2004 */
+ prec = 203780;
+ mpfr_init2 (x, prec);
+ mpfr_init2 (z, prec);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_sqrt (x, x, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ mpfr_exp_3 (z, x, MPFR_RNDN);
+ mpfr_clear (x);
+ mpfr_clear (z);
+}
+
+#define TEST_FUNCTION test_exp
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+check_special (void)
+{
+ mpfr_t x, y, z;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ /* check exp(NaN) = NaN */
+ mpfr_set_nan (x);
+ test_exp (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for exp(NaN)\n");
+ exit (1);
+ }
+
+ /* check exp(+inf) = +inf */
+ mpfr_set_inf (x, 1);
+ test_exp (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for exp(+inf)\n");
+ exit (1);
+ }
+
+ /* check exp(-inf) = +0 */
+ mpfr_set_inf (x, -1);
+ test_exp (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for exp(-inf)\n");
+ exit (1);
+ }
+
+ /* Check overflow. Corner case of mpfr_exp_2 */
+ mpfr_set_prec (x, 64);
+ mpfr_set_emax (MPFR_EMAX_DEFAULT);
+ mpfr_set_emin (MPFR_EMIN_DEFAULT);
+ mpfr_set_str (x,
+ "0.1011000101110010000101111111010100001100000001110001100111001101E30",
+ 2, MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDD);
+ if (mpfr_cmp_str (x,
+".1111111111111111111111111111111111111111111111111111111111111111E1073741823",
+ 2, MPFR_RNDN) != 0)
+ {
+ printf ("Wrong overflow detection in mpfr_exp\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ /* Check underflow. Corner case of mpfr_exp_2 */
+ mpfr_set_str (x,
+"-0.1011000101110010000101111111011111010001110011110111100110101100E30",
+ 2, MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0.1E-1073741823", 2, MPFR_RNDN) != 0)
+ {
+ printf ("Wrong underflow (1) detection in mpfr_exp\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_str (x,
+"-0.1011001101110010000101111111011111010001110011110111100110111101E30",
+ 2, MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) != 0)
+ {
+ printf ("Wrong underflow (2) detection in mpfr_exp\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ /* Check overflow. Corner case of mpfr_exp_3 */
+ if (MPFR_PREC_MAX >= MPFR_EXP_THRESHOLD + 10 && MPFR_PREC_MAX >= 64)
+ {
+ /* this ensures that for small MPFR_EXP_THRESHOLD, the following
+ mpfr_set_str conversion is exact */
+ mpfr_set_prec (x, (MPFR_EXP_THRESHOLD + 10 > 64)
+ ? MPFR_EXP_THRESHOLD + 10 : 64);
+ mpfr_set_str (x,
+ "0.1011000101110010000101111111010100001100000001110001100111001101E30",
+ 2, MPFR_RNDN);
+ mpfr_clear_overflow ();
+ mpfr_exp (x, x, MPFR_RNDD);
+ if (!mpfr_overflow_p ())
+ {
+ printf ("Wrong overflow detection in mpfr_exp_3\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ /* Check underflow. Corner case of mpfr_exp_3 */
+ mpfr_set_str (x,
+ "-0.1011000101110010000101111111011111010001110011110111100110101100E30",
+ 2, MPFR_RNDN);
+ mpfr_clear_underflow ();
+ mpfr_exp (x, x, MPFR_RNDN);
+ if (!mpfr_underflow_p ())
+ {
+ printf ("Wrong underflow detection in mpfr_exp_3\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_prec (x, 53);
+ }
+
+ /* check overflow */
+ set_emax (10);
+ mpfr_set_ui (x, 7, MPFR_RNDN);
+ test_exp (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for exp(7) for emax=10\n");
+ exit (1);
+ }
+ set_emax (emax);
+
+ /* check underflow */
+ set_emin (-10);
+ mpfr_set_si (x, -9, MPFR_RNDN);
+ test_exp (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for exp(-9) for emin=-10\n");
+ printf ("Expected +0\n");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ set_emin (emin);
+
+ /* check case EXP(x) < -precy */
+ mpfr_set_prec (y, 2);
+ mpfr_set_str_binary (x, "-0.1E-3");
+ test_exp (y, x, MPFR_RNDD);
+ if (mpfr_cmp_ui_2exp (y, 3, -2))
+ {
+ printf ("Error for exp(-1/16), prec=2, RNDD\n");
+ printf ("expected 0.11, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ test_exp (y, x, MPFR_RNDZ);
+ if (mpfr_cmp_ui_2exp (y, 3, -2))
+ {
+ printf ("Error for exp(-1/16), prec=2, RNDZ\n");
+ printf ("expected 0.11, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "0.1E-3");
+ test_exp (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error for exp(1/16), prec=2, RNDN\n");
+ exit (1);
+ }
+ test_exp (y, x, MPFR_RNDU);
+ if (mpfr_cmp_ui_2exp (y, 3, -1))
+ {
+ printf ("Error for exp(1/16), prec=2, RNDU\n");
+ exit (1);
+ }
+
+ /* bug reported by Franky Backeljauw, 28 Mar 2003 */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28");
+ test_exp (y, x, MPFR_RNDN);
+
+ mpfr_set_prec (x, 153);
+ mpfr_set_prec (z, 153);
+ mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28");
+ test_exp (z, x, MPFR_RNDN);
+ mpfr_prec_round (z, 53, MPFR_RNDN);
+
+ if (mpfr_cmp (y, z))
+ {
+ printf ("Error in mpfr_exp for large argument\n");
+ exit (1);
+ }
+
+ /* corner cases in mpfr_exp_3 */
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_prec (y, 2);
+ mpfr_exp_3 (y, x, MPFR_RNDN);
+
+ /* Check some little things about overflow detection */
+ set_emin (-125);
+ set_emax (128);
+ mpfr_set_prec (x, 107);
+ mpfr_set_prec (y, 107);
+ mpfr_set_str_binary (x, "0.11110000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000"
+ "00000000E4");
+ test_exp (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.11000111100001100110010101111101011010010101010000"
+ "1101110111100010111001011111111000110111001011001101010"
+ "01E22", 2, MPFR_RNDN))
+ {
+ printf ("Special overflow error (1)\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ set_emin (emin);
+ set_emax (emax);
+
+ /* Check for overflow producing a segfault with HUGE exponent */
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_mul_2ui (x, x, 32, MPFR_RNDN);
+ test_exp (y, x, MPFR_RNDN); /* Can't test return value: May overflow or not*/
+
+ /* Bug due to wrong approximation of (x)/log2 */
+ mpfr_set_prec (x, 163);
+
+ mpfr_set_str (x, "-4.28ac8fceeadcda06bb56359017b1c81b85b392e7", 16,
+ MPFR_RNDN);
+ mpfr_exp (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "3.fffffffffffffffffffffffffffffffffffffffe8@-2",
+ 16, MPFR_RNDN))
+ {
+ printf ("Error for x= -4.28ac8fceeadcda06bb56359017b1c81b85b392e7");
+ printf ("expected 3.fffffffffffffffffffffffffffffffffffffffe8@-2");
+ printf ("Got ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ }
+
+ /* bug found by Guillaume Melquiond, 13 Sep 2005 */
+ mpfr_set_prec (x, 53);
+ mpfr_set_str_binary (x, "-1E-400");
+ mpfr_exp (x, x, MPFR_RNDZ);
+ if (mpfr_cmp_ui (x, 1) == 0)
+ {
+ printf ("Error for exp(-2^(-400))\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+/* check sign of inexact flag */
+static void
+check_inexact (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ mpfr_set_str_binary (x,
+ "1.0000000000001001000110100100101000001101101011100101e2");
+ inexact = test_exp (y, x, MPFR_RNDN);
+ if (inexact <= 0)
+ {
+ printf ("Wrong inexact flag (Got %d instead of 1)\n", inexact);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_exp10(void)
+{
+ mpfr_t x;
+ int inexact;
+
+ mpfr_init2 (x, 200);
+ mpfr_set_ui(x, 4, MPFR_RNDN);
+
+ inexact = mpfr_exp10 (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 10*10*10*10))
+ {
+ printf ("exp10: Wrong returned value\n");
+ exit (1);
+ }
+ if (inexact != 0)
+ {
+ printf ("exp10: Wrong inexact flag\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+static void
+overflowed_exp0 (void)
+{
+ mpfr_t x, y;
+ int emax, i, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (emax); /* 1 is not representable. */
+ /* and if emax < 0, 1 - eps is not representable either. */
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_exp (x, x, (mpfr_rnd_t) rnd);
+ if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
+ ! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overflowed_exp0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* This bug occurs in mpfr_exp_2 on a Linux-64 machine, r5475. */
+static void
+bug20080731 (void)
+{
+ mpfr_exp_t emin;
+ mpfr_t x, y1, y2;
+ mpfr_prec_t prec = 64;
+
+ emin = mpfr_get_emin ();
+ set_emin (MPFR_EMIN_MIN);
+
+ mpfr_init2 (x, 200);
+ mpfr_set_str (x, "-2.c5c85fdf473de6af278ece700fcbdabd03cd0cb9ca62d8b62c@7",
+ 16, MPFR_RNDN);
+
+ mpfr_init2 (y1, prec);
+ mpfr_exp (y1, x, MPFR_RNDU);
+
+ /* Compute the result with a higher internal precision. */
+ mpfr_init2 (y2, 300);
+ mpfr_exp (y2, x, MPFR_RNDU);
+ mpfr_prec_round (y2, prec, MPFR_RNDU);
+
+ if (mpfr_cmp0 (y1, y2) != 0)
+ {
+ printf ("Error in bug20080731\nExpected ");
+ mpfr_out_str (stdout, 16, 0, y2, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, y1, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
+ set_emin (emin);
+}
+
+/* Emulate mpfr_exp with mpfr_exp_3 in the general case. */
+static int
+exp_3 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+
+ inexact = mpfr_exp_3 (y, x, rnd_mode);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
+
+static void
+underflow_up (int extended_emin)
+{
+ mpfr_t minpos, x, y, t, t2;
+ int precx, precy;
+ int inex;
+ int rnd;
+ int e3;
+ int i, j;
+
+ mpfr_init2 (minpos, 2);
+ mpfr_set_ui (minpos, 0, MPFR_RNDN);
+ mpfr_nextabove (minpos);
+
+ /* Let's test values near the underflow boundary.
+ *
+ * Minimum representable positive number: minpos = 2^(emin - 1).
+ * Let's choose an MPFR number x = log(minpos) + eps, with |eps| small
+ * (note: eps cannot be 0, and cannot be a rational number either).
+ * Then exp(x) = minpos * exp(eps) ~= minpos * (1 + eps + eps^2).
+ * We will compute y = rnd(exp(x)) in some rounding mode, precision p.
+ * 1. If eps > 0, then in any rounding mode:
+ * rnd(exp(x)) >= minpos and no underflow.
+ * So, let's take x1 = rndu(log(minpos)) in some precision.
+ * 2. If eps < 0, then exp(x) < minpos and the result will be either 0
+ * or minpos. An underflow always occurs in MPFR_RNDZ and MPFR_RNDD,
+ * but not necessarily in MPFR_RNDN and MPFR_RNDU (this is underflow
+ * after rounding in an unbounded exponent range). If -a < eps < -b,
+ * minpos * (1 - a) < exp(x) < minpos * (1 - b + b^2).
+ * - If eps > -2^(-p), no underflow in MPFR_RNDU.
+ * - If eps > -2^(-p-1), no underflow in MPFR_RNDN.
+ * - If eps < - (2^(-p-1) + 2^(-2p-1)), underflow in MPFR_RNDN.
+ * - If eps < - (2^(-p) + 2^(-2p+1)), underflow in MPFR_RNDU.
+ * - In MPFR_RNDN, result is minpos iff exp(eps) > 1/2, i.e.
+ * - log(2) < eps < ...
+ *
+ * Moreover, since precy < MPFR_EXP_THRESHOLD (to avoid tests that take
+ * too much time), mpfr_exp() always selects mpfr_exp_2(); so, we need
+ * to test mpfr_exp_3() too. This will be done via the e3 variable:
+ * e3 = 0: mpfr_exp(), thus mpfr_exp_2().
+ * e3 = 1: mpfr_exp_3(), via the exp_3() wrapper.
+ * i.e.: inex = e3 ? exp_3 (y, x, rnd) : mpfr_exp (y, x, rnd);
+ */
+
+ /* Case eps > 0. In revision 5461 (trunk) on a 64-bit Linux machine:
+ * Incorrect flags in underflow_up, eps > 0, MPFR_RNDN and extended emin
+ * for precx = 96, precy = 16, mpfr_exp_3
+ * Got 9 instead of 8.
+ * Note: testing this case in several precisions for x and y introduces
+ * some useful random. Indeed, the bug is not always triggered.
+ * Fixed in r5469.
+ */
+ for (precx = 16; precx <= 128; precx += 16)
+ {
+ mpfr_init2 (x, precx);
+ mpfr_log (x, minpos, MPFR_RNDU);
+ for (precy = 16; precy <= 128; precy += 16)
+ {
+ mpfr_init2 (y, precy);
+
+ for (e3 = 0; e3 <= 1; e3++)
+ {
+ RND_LOOP (rnd)
+ {
+ int err = 0;
+
+ mpfr_clear_flags ();
+ inex = e3 ? exp_3 (y, x, (mpfr_rnd_t) rnd)
+ : mpfr_exp (y, x, (mpfr_rnd_t) rnd);
+ if (__gmpfr_flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("Incorrect flags in underflow_up, eps > 0, %s",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ if (extended_emin)
+ printf (" and extended emin");
+ printf ("\nfor precx = %d, precy = %d, %s\n",
+ precx, precy, e3 ? "mpfr_exp_3" : "mpfr_exp");
+ printf ("Got %u instead of %u.\n", __gmpfr_flags,
+ (unsigned int) MPFR_FLAGS_INEXACT);
+ err = 1;
+ }
+ if (mpfr_cmp0 (y, minpos) < 0)
+ {
+ printf ("Incorrect result in underflow_up, eps > 0, %s",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ if (extended_emin)
+ printf (" and extended emin");
+ printf ("\nfor precx = %d, precy = %d, %s\n",
+ precx, precy, e3 ? "mpfr_exp_3" : "mpfr_exp");
+ mpfr_dump (y);
+ err = 1;
+ }
+ MPFR_ASSERTN (inex != 0);
+ if (rnd == MPFR_RNDD || rnd == MPFR_RNDZ)
+ MPFR_ASSERTN (inex < 0);
+ if (rnd == MPFR_RNDU)
+ MPFR_ASSERTN (inex > 0);
+ if (err)
+ exit (1);
+ }
+ }
+
+ mpfr_clear (y);
+ }
+ mpfr_clear (x);
+ }
+
+ /* Case - log(2) < eps < 0 in MPFR_RNDN, starting with small-precision x;
+ * only check the result and the ternary value.
+ * Previous to r5453 (trunk), on 32-bit and 64-bit machines, this fails
+ * for precx = 65 and precy = 16, e.g.:
+ * exp_2.c:264: assertion failed: ...
+ * because mpfr_sub (r, x, r, MPFR_RNDU); yields a null value. This is
+ * fixed in r5453 by going to next Ziv's iteration.
+ */
+ for (precx = sizeof(mpfr_exp_t) * CHAR_BIT + 1; precx <= 81; precx += 8)
+ {
+ mpfr_init2 (x, precx);
+ mpfr_log (x, minpos, MPFR_RNDD); /* |ulp| <= 1/2 */
+ for (precy = 16; precy <= 128; precy += 16)
+ {
+ mpfr_init2 (y, precy);
+ inex = mpfr_exp (y, x, MPFR_RNDN);
+ if (inex <= 0 || mpfr_cmp0 (y, minpos) != 0)
+ {
+ printf ("Error in underflow_up, - log(2) < eps < 0");
+ if (extended_emin)
+ printf (" and extended emin");
+ printf (" for prec = %d\nExpected ", precy);
+ mpfr_out_str (stdout, 16, 0, minpos, MPFR_RNDN);
+ printf (" (minimum positive MPFR number) and inex > 0\nGot ");
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\nwith inex = %d\n", inex);
+ exit (1);
+ }
+ mpfr_clear (y);
+ }
+ mpfr_clear (x);
+ }
+
+ /* Cases eps ~ -2^(-p) and eps ~ -2^(-p-1). More precisely,
+ * _ for j = 0, eps > -2^(-(p+i)),
+ * _ for j = 1, eps < - (2^(-(p+i)) + 2^(1-2(p+i))),
+ * where i = 0 or 1.
+ */
+ mpfr_inits2 (2, t, t2, (mpfr_ptr) 0);
+ for (precy = 16; precy <= 128; precy += 16)
+ {
+ mpfr_set_ui_2exp (t, 1, - precy, MPFR_RNDN); /* 2^(-p) */
+ mpfr_set_ui_2exp (t2, 1, 1 - 2 * precy, MPFR_RNDN); /* 2^(-2p+1) */
+ precx = sizeof(mpfr_exp_t) * CHAR_BIT + 2 * precy + 8;
+ mpfr_init2 (x, precx);
+ mpfr_init2 (y, precy);
+ for (i = 0; i <= 1; i++)
+ {
+ for (j = 0; j <= 1; j++)
+ {
+ if (j == 0)
+ {
+ /* Case eps > -2^(-(p+i)). */
+ mpfr_log (x, minpos, MPFR_RNDU);
+ }
+ else /* j == 1 */
+ {
+ /* Case eps < - (2^(-(p+i)) + 2^(1-2(p+i))). */
+ mpfr_log (x, minpos, MPFR_RNDD);
+ inex = mpfr_sub (x, x, t2, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ }
+ inex = mpfr_sub (x, x, t, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ RND_LOOP (rnd)
+ for (e3 = 0; e3 <= 1; e3++)
+ {
+ int err = 0;
+ unsigned int flags;
+
+ flags = MPFR_FLAGS_INEXACT |
+ (((rnd == MPFR_RNDU || rnd == MPFR_RNDA)
+ && (i == 1 || j == 0)) ||
+ (rnd == MPFR_RNDN && (i == 1 && j == 0)) ?
+ 0 : MPFR_FLAGS_UNDERFLOW);
+ mpfr_clear_flags ();
+ inex = e3 ? exp_3 (y, x, (mpfr_rnd_t) rnd)
+ : mpfr_exp (y, x, (mpfr_rnd_t) rnd);
+ if (__gmpfr_flags != flags)
+ {
+ printf ("Incorrect flags in underflow_up, %s",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ if (extended_emin)
+ printf (" and extended emin");
+ printf ("\nfor precx = %d, precy = %d, ",
+ precx, precy);
+ if (j == 0)
+ printf ("eps >~ -2^(-%d)", precy + i);
+ else
+ printf ("eps <~ - (2^(-%d) + 2^(%d))",
+ precy + i, 1 - 2 * (precy + i));
+ printf (", %s\n", e3 ? "mpfr_exp_3" : "mpfr_exp");
+ printf ("Got %u instead of %u.\n",
+ __gmpfr_flags, flags);
+ err = 1;
+ }
+ if (rnd == MPFR_RNDU || rnd == MPFR_RNDA || rnd == MPFR_RNDN ?
+ mpfr_cmp0 (y, minpos) != 0 : MPFR_NOTZERO (y))
+ {
+ printf ("Incorrect result in underflow_up, %s",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ if (extended_emin)
+ printf (" and extended emin");
+ printf ("\nfor precx = %d, precy = %d, ",
+ precx, precy);
+ if (j == 0)
+ printf ("eps >~ -2^(-%d)", precy + i);
+ else
+ printf ("eps <~ - (2^(-%d) + 2^(%d))",
+ precy + i, 1 - 2 * (precy + i));
+ printf (", %s\n", e3 ? "mpfr_exp_3" : "mpfr_exp");
+ mpfr_dump (y);
+ err = 1;
+ }
+ if (err)
+ exit (1);
+ } /* for (e3 ...) */
+ } /* for (j ...) */
+ mpfr_div_2si (t, t, 1, MPFR_RNDN);
+ mpfr_div_2si (t2, t2, 2, MPFR_RNDN);
+ } /* for (i ...) */
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+ } /* for (precy ...) */
+ mpfr_clears (t, t2, (mpfr_ptr) 0);
+
+ /* Case exp(eps) ~= 1/2, i.e. eps ~= - log(2).
+ * We choose x0 and x1 with high enough precision such that:
+ * x0 = rndd(rndd(log(minpos)) - rndu(log(2)))
+ * x1 = rndu(rndu(log(minpos)) - rndd(log(2)))
+ * In revision 5507 (trunk) on a 64-bit Linux machine, this fails:
+ * Error in underflow_up, eps >~ - log(2) and extended emin
+ * for precy = 16, mpfr_exp
+ * Expected 1.0@-1152921504606846976 (minimum positive MPFR number),
+ * inex > 0 and flags = 9
+ * Got 0
+ * with inex = -1 and flags = 9
+ * due to a double-rounding problem in mpfr_mul_2si when rescaling
+ * the result.
+ */
+ mpfr_inits2 (sizeof(mpfr_exp_t) * CHAR_BIT + 64, x, t, (mpfr_ptr) 0);
+ for (i = 0; i <= 1; i++)
+ {
+ mpfr_log (x, minpos, i ? MPFR_RNDU : MPFR_RNDD);
+ mpfr_const_log2 (t, i ? MPFR_RNDD : MPFR_RNDU);
+ mpfr_sub (x, x, t, i ? MPFR_RNDU : MPFR_RNDD);
+ for (precy = 16; precy <= 128; precy += 16)
+ {
+ mpfr_init2 (y, precy);
+ for (e3 = 0; e3 <= 1; e3++)
+ {
+ unsigned int flags, uflags =
+ MPFR_FLAGS_INEXACT | MPFR_FLAGS_UNDERFLOW;
+
+ mpfr_clear_flags ();
+ inex = e3 ? exp_3 (y, x, MPFR_RNDN) : mpfr_exp (y, x, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ if (flags != uflags ||
+ (i ? (inex <= 0 || mpfr_cmp0 (y, minpos) != 0)
+ : (inex >= 0 || MPFR_NOTZERO (y))))
+ {
+ printf ("Error in underflow_up, eps %c~ - log(2)",
+ i ? '>' : '<');
+ if (extended_emin)
+ printf (" and extended emin");
+ printf ("\nfor precy = %d, %s\nExpected ", precy,
+ e3 ? "mpfr_exp_3" : "mpfr_exp");
+ if (i)
+ {
+ mpfr_out_str (stdout, 16, 0, minpos, MPFR_RNDN);
+ printf (" (minimum positive MPFR number),\ninex >");
+ }
+ else
+ {
+ printf ("+0, inex <");
+ }
+ printf (" 0 and flags = %u\nGot ", uflags);
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\nwith inex = %d and flags = %u\n", inex, flags);
+ exit (1);
+ }
+ }
+ mpfr_clear (y);
+ }
+ }
+ mpfr_clears (x, t, (mpfr_ptr) 0);
+
+ mpfr_clear (minpos);
+}
+
+static void
+underflow (void)
+{
+ mpfr_exp_t emin;
+
+ underflow_up (0);
+
+ emin = mpfr_get_emin ();
+ set_emin (MPFR_EMIN_MIN);
+ if (mpfr_get_emin () != emin)
+ {
+ underflow_up (1);
+ set_emin (emin);
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ if (argc > 1)
+ check_large ();
+
+ check_inexact ();
+ check_special ();
+
+ test_generic (2, 100, 100);
+
+ compare_exp2_exp3 (20, 1000);
+ check_worst_cases();
+ check3("0.0", MPFR_RNDU, "1.0");
+ check3("-1e-170", MPFR_RNDU, "1.0");
+ check3("-1e-170", MPFR_RNDN, "1.0");
+ check3("-8.88024741073346941839e-17", MPFR_RNDU, "1.0");
+ check3("8.70772839244701057915e-01", MPFR_RNDN, "2.38875626491680437269");
+ check3("1.0", MPFR_RNDN, "2.71828182845904509080");
+ check3("-3.42135637628104173534e-07", MPFR_RNDZ, "0.999999657864420798958");
+ /* worst case for argument reduction, very near from 5*log(2),
+ thanks to Jean-Michel Muller */
+ check3("3.4657359027997265421", MPFR_RNDN, "32.0");
+ check3("3.4657359027997265421", MPFR_RNDU, "32.0");
+ check3("3.4657359027997265421", MPFR_RNDD, "31.999999999999996447");
+ check3("2.26523754332090625496e+01", MPFR_RNDD, "6.8833785261699581146e9");
+ check3("1.31478962104089092122e+01", MPFR_RNDZ, "5.12930793917860137299e+05");
+ check3("4.25637507920002378103e-01", MPFR_RNDU, "1.53056585656161181497e+00");
+ check3("6.26551618962329307459e-16", MPFR_RNDU, "1.00000000000000066613e+00");
+ check3("-3.35589513871216568383e-03",MPFR_RNDD, "9.96649729583626853291e-01");
+ check3("1.95151388850007272424e+01", MPFR_RNDU, "2.98756340674767792225e+08");
+ check3("2.45045953503350730784e+01", MPFR_RNDN, "4.38743344916128387451e+10");
+ check3("2.58165606081678085104e+01", MPFR_RNDD, "1.62925781879432281494e+11");
+ check3("-2.36539020084338638128e+01",MPFR_RNDZ, "5.33630792749924762447e-11");
+ check3("2.39211946135858077866e+01", MPFR_RNDU, "2.44817704330214385986e+10");
+ check3("-2.78190533055889162029e+01",MPFR_RNDZ, "8.2858803483596879512e-13");
+ check3("2.64028186174889789584e+01", MPFR_RNDD, "2.9281844652878973388e11");
+ check3("2.92086338843268329413e+01", MPFR_RNDZ, "4.8433797301907177734e12");
+ check3("-2.46355324071459982349e+01",MPFR_RNDZ, "1.9995129297760994791e-11");
+ check3("-2.23509444608605427618e+01",MPFR_RNDZ, "1.9638492867489702307e-10");
+ check3("-2.41175390197331687148e+01",MPFR_RNDD, "3.3564940885530624592e-11");
+ check3("2.46363885231578088053e+01", MPFR_RNDU, "5.0055014282693267822e10");
+ check3("111.1263531080090984914932050742208957672119140625", MPFR_RNDN, "1.8262572323517295459e48");
+ check3("-3.56196340354684821250e+02",MPFR_RNDN, "2.0225297096141478156e-155");
+ check3("6.59678273772710895173e+02", MPFR_RNDU, "3.1234469273830195529e286");
+ check3("5.13772529701934331570e+02", MPFR_RNDD, "1.3445427121297197752e223");
+ check3("3.57430211008718345056e+02", MPFR_RNDD, "1.6981197246857298443e155");
+ check3("3.82001814471465536371e+02", MPFR_RNDU, "7.9667300591087367805e165");
+ check3("5.92396038219384422518e+02", MPFR_RNDD, "1.880747529554661989e257");
+ check3("-5.02678550462488090034e+02",MPFR_RNDU, "4.8919201895446217839e-219");
+ check3("5.30015757134837031117e+02", MPFR_RNDD, "1.5237672861171573939e230");
+ check3("5.16239362447650933063e+02", MPFR_RNDZ, "1.5845518406744492105e224");
+ check3("6.00812634798592370977e-01", MPFR_RNDN, "1.823600119339019443");
+ check_exp10 ();
+
+ bug20080731 ();
+
+ overflowed_exp0 ();
+ underflow ();
+
+ data_check ("data/exp", mpfr_exp, "mpfr_exp");
+ bad_cases (mpfr_exp, mpfr_log, "mpfr_exp", 0, -256, 255, 4, 128, 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/texp10.c b/tests/texp10.c
new file mode 100644
index 0000000..d6fa58b
--- /dev/null
+++ b/tests/texp10.c
@@ -0,0 +1,318 @@
+/* Test file for mpfr_exp10.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_exp10
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ int inex;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 24);
+
+ mpfr_set_str_binary (x, "0.101100100000000000110100E15");
+ inex = mpfr_exp10 (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || inex <= 0)
+ {
+ printf ("Overflow error.\n");
+ mpfr_dump (y);
+ printf ("inex = %d\n", inex);
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+ set_emin (emin);
+ set_emax (emax);
+}
+
+static void
+emax_m_eps (void)
+{
+ if (mpfr_get_emax () <= LONG_MAX)
+ {
+ mpfr_t x, y;
+ int inex, ov;
+
+ mpfr_init2 (x, sizeof(mpfr_exp_t) * CHAR_BIT * 4);
+ mpfr_init2 (y, 8);
+ mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex = mpfr_exp10 (y, x, MPFR_RNDN);
+ ov = mpfr_overflow_p ();
+ if (!ov || !mpfr_inf_p (y) || inex <= 0)
+ {
+ printf ("Overflow error for x = emax, MPFR_RNDN.\n");
+ mpfr_dump (y);
+ printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ }
+}
+
+static void
+exp_range (void)
+{
+ mpfr_t x;
+ mpfr_exp_t emin;
+
+ emin = mpfr_get_emin ();
+ set_emin (3);
+ mpfr_init2 (x, 16);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp10 (x, x, MPFR_RNDN);
+ set_emin (emin);
+ if (mpfr_nan_p (x) || mpfr_cmp_ui (x, 10000) != 0)
+ {
+ printf ("Error in mpfr_exp10 for x = 4, with emin = 3\n");
+ printf ("Expected 10000, got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
+static void
+overfl_exp10_0 (void)
+{
+ mpfr_t x, y;
+ int emax, i, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (emax); /* 1 is not representable. */
+ /* and if emax < 0, 1 - eps is not representable either. */
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_exp10 (x, x, (mpfr_rnd_t) rnd);
+ if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
+ ! mpfr_overflow_p ())
+ {
+ printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overfl_exp10_0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+ int inex, ov;
+
+ tests_start_mpfr ();
+
+ special_overflow ();
+ emax_m_eps ();
+ exp_range ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 10000) != 0)
+ {
+ printf ("Error for 10^4, MPFR_RNDN\n");
+ exit (1);
+ }
+ mpfr_exp10 (y, x, MPFR_RNDD);
+ if (mpfr_cmp_ui (y, 10000) != 0)
+ {
+ printf ("Error for 10^4, MPFR_RNDD\n");
+ exit (1);
+ }
+ mpfr_exp10 (y, x, MPFR_RNDU);
+ if (mpfr_cmp_ui (y, 10000) != 0)
+ {
+ printf ("Error for 10^4, MPFR_RNDU\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_prec (y, 10);
+ /* save emin */
+ emin = mpfr_get_emin ();
+ set_emin (-11);
+ mpfr_set_si (x, -4, MPFR_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for emin = -11, x = -4, RNDN\n");
+ printf ("Expected +0\n");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ /* restore emin */
+ set_emin (emin);
+
+ /* save emax */
+ emax = mpfr_get_emax ();
+ set_emax (13);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp10 (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for emax = 13, x = 4, RNDN\n");
+ printf ("Expected +inf\n");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ /* restore emax */
+ set_emax (emax);
+
+ MPFR_SET_INF (x);
+ MPFR_SET_POS (x);
+ mpfr_exp10 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_INF (y))
+ {
+ printf ("evaluation of function in INF does not return INF\n");
+ exit (1);
+ }
+
+ MPFR_CHANGE_SIGN (x);
+ mpfr_exp10 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y))
+ {
+ printf ("evaluation of function in -INF does not return 0\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN (x);
+ mpfr_exp10 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_NAN (y))
+ {
+ printf ("evaluation of function in NaN does not return NaN\n");
+ exit (1);
+ }
+
+ if ((mpfr_uexp_t) 8 << 31 != 0 ||
+ mpfr_get_emax () <= (mpfr_uexp_t) 100000 * 100000)
+ {
+ /* emax <= 10000000000 */
+ mpfr_set_prec (x, 40);
+ mpfr_set_prec (y, 40);
+ mpfr_set_str (x, "3010299957", 10, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_exp10 (y, x, MPFR_RNDN);
+ ov = mpfr_overflow_p ();
+ if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y) && ov))
+ {
+ printf ("Overflow error for x = 3010299957, MPFR_RNDN.\n");
+ mpfr_dump (y);
+ printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
+ exit (1);
+ }
+ }
+
+ test_generic (2, 100, 100);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ overfl_exp10_0 ();
+
+ data_check ("data/exp10", mpfr_exp10, "mpfr_exp10");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/texp2.c b/tests/texp2.c
new file mode 100644
index 0000000..3b2fbea
--- /dev/null
+++ b/tests/texp2.c
@@ -0,0 +1,379 @@
+/* Test file for mpfr_exp2.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_exp2
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ int inex;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 24);
+
+ mpfr_set_str_binary (x, "0.101100100000000000110100E15");
+ inex = mpfr_exp2 (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || inex <= 0)
+ {
+ printf ("Overflow error.\n");
+ mpfr_dump (y);
+ printf ("inex = %d\n", inex);
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+ set_emin (emin);
+ set_emax (emax);
+}
+
+static void
+emax_m_eps (void)
+{
+ if (mpfr_get_emax () <= LONG_MAX)
+ {
+ mpfr_t x, y;
+ int inex, ov;
+
+ mpfr_init2 (x, sizeof(mpfr_exp_t) * CHAR_BIT * 4);
+ mpfr_init2 (y, 8);
+ mpfr_set_si (x, mpfr_get_emax (), MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex = mpfr_exp2 (y, x, MPFR_RNDN);
+ ov = mpfr_overflow_p ();
+ if (!ov || !mpfr_inf_p (y) || inex <= 0)
+ {
+ printf ("Overflow error for x = emax, MPFR_RNDN.\n");
+ mpfr_dump (y);
+ printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
+ exit (1);
+ }
+
+ mpfr_nextbelow (x);
+
+ mpfr_clear_flags ();
+ inex = mpfr_exp2 (y, x, MPFR_RNDN);
+ ov = mpfr_overflow_p ();
+ if (!ov || !mpfr_inf_p (y) || inex <= 0)
+ {
+ printf ("Overflow error for x = emax - eps, MPFR_RNDN.\n");
+ mpfr_dump (y);
+ printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
+ exit (1);
+ }
+
+ mpfr_clear_flags ();
+ inex = mpfr_exp2 (y, x, MPFR_RNDD);
+ ov = mpfr_overflow_p ();
+ if (ov || mpfr_inf_p (y) || inex >= 0 ||
+ (mpfr_nextabove (y), !mpfr_inf_p (y)))
+ {
+ printf ("Overflow error for x = emax - eps, MPFR_RNDD.\n");
+ mpfr_dump (y);
+ printf ("inex = %d, %soverflow\n", inex, ov ? "" : "no ");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ }
+}
+
+static void
+exp_range (void)
+{
+ mpfr_t x;
+ mpfr_exp_t emin;
+
+ emin = mpfr_get_emin ();
+ set_emin (3);
+ mpfr_init2 (x, 8);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_exp2 (x, x, MPFR_RNDN);
+ set_emin (emin);
+ if (mpfr_nan_p (x) || mpfr_cmp_ui (x, 32) != 0)
+ {
+ printf ("Error in mpfr_exp2 for x = 5, with emin = 3\n");
+ printf ("Expected 32, got ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
+static void
+overflowed_exp2_0 (void)
+{
+ mpfr_t x, y;
+ int emax, i, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (emax); /* 1 is not representable. */
+ /* and if emax < 0, 1 - eps is not representable either. */
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_exp2 (x, x, (mpfr_rnd_t) rnd);
+ if ((i >= 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
+ ! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overflowed_exp2_0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+
+ tests_start_mpfr ();
+
+ special_overflow ();
+ emax_m_eps ();
+ exp_range ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 16) != 0)
+ {
+ printf ("Error for 2^4, MPFR_RNDN\n");
+ exit (1);
+ }
+ mpfr_exp2 (y, x, MPFR_RNDD);
+ if (mpfr_cmp_ui (y, 16) != 0)
+ {
+ printf ("Error for 2^4, MPFR_RNDD\n");
+ exit (1);
+ }
+ mpfr_exp2 (y, x, MPFR_RNDU);
+ if (mpfr_cmp_ui (y, 16) != 0)
+ {
+ printf ("Error for 2^4, MPFR_RNDU\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -4, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (y, 1, -4) != 0)
+ {
+ printf ("Error for 2^(-4), MPFR_RNDN\n");
+ exit (1);
+ }
+ mpfr_exp2 (y, x, MPFR_RNDD);
+ if (mpfr_cmp_ui_2exp (y, 1, -4) != 0)
+ {
+ printf ("Error for 2^(-4), MPFR_RNDD\n");
+ exit (1);
+ }
+ mpfr_exp2 (y, x, MPFR_RNDU);
+ if (mpfr_cmp_ui_2exp (y, 1, -4) != 0)
+ {
+ printf ("Error for 2^(-4), MPFR_RNDU\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str (x, /*-1683977482443233.0 / 2199023255552.0*/
+ "-7.6578429909351734750089235603809357e2", 10, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str1 (y, "2.991959870867646566478e-231"))
+ {
+ printf ("Error for x=-1683977482443233/2^41\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_prec (y, 10);
+ /* save emin */
+ emin = mpfr_get_emin ();
+ set_emin (-10);
+ mpfr_set_si (x, -12, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for x=emin-2, RNDN\n");
+ printf ("Expected +0\n");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ /* restore emin */
+ set_emin (emin);
+
+ /* save emax */
+ emax = mpfr_get_emax ();
+ set_emax (10);
+ mpfr_set_ui (x, 11, MPFR_RNDN);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for x=emax+1, RNDN\n");
+ exit (1);
+ }
+ /* restore emax */
+ set_emax (emax);
+
+ MPFR_SET_INF(x);
+ MPFR_SET_POS(x);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if(!MPFR_IS_INF(y))
+ {
+ printf ("evaluation of function in INF does not return INF\n");
+ exit (1);
+ }
+
+ MPFR_CHANGE_SIGN(x);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if(!MPFR_IS_ZERO(y))
+ {
+ printf ("evaluation of function in -INF does not return 0\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if(!MPFR_IS_NAN(y))
+ {
+ printf ("evaluation of function in NaN does not return NaN\n");
+ exit (1);
+ }
+
+ if ((mpfr_uexp_t) 8 << 31 != 0 ||
+ mpfr_get_emax () <= (mpfr_uexp_t) 100000 * 100000)
+ {
+ /* emax <= 10000000000 */
+ mpfr_set_prec (x, 40);
+ mpfr_set_prec (y, 40);
+ mpfr_set_str (x, "10000000000.5", 10, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_exp2 (y, x, MPFR_RNDN);
+ if (!(MPFR_IS_INF (y) && MPFR_IS_POS (y) && mpfr_overflow_p ()))
+ {
+ printf ("exp2(10000000000.5) should overflow.\n");
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str_binary (x, "-1.0E-26");
+ mpfr_exp2 (y, x, MPFR_RNDD);
+ mpfr_set_str_binary (x, "1.1E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for exp(-2^(-26)) for prec=2\n");
+ exit (1);
+ }
+
+ test_generic (2, 100, 100);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ overflowed_exp2_0 ();
+
+ data_check ("data/exp2", mpfr_exp2, "mpfr_exp2");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/texpm1.c b/tests/texpm1.c
new file mode 100644
index 0000000..7f518a2
--- /dev/null
+++ b/tests/texpm1.c
@@ -0,0 +1,173 @@
+/* Test file for mpfr_expm1.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_expm1 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_expm1 (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_expm1 mpfr_expm1
+#endif
+
+#define TEST_FUNCTION test_expm1
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int i;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ test_expm1 (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for expm1(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ test_expm1 (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for expm1(+Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ test_expm1 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_si (y, -1))
+ {
+ printf ("Error for expm1(-Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for expm1(+0)\n");
+ exit (1);
+ }
+
+ mpfr_neg (x, x, MPFR_RNDN);
+ test_expm1 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error for expm1(-0)\n");
+ exit (1);
+ }
+
+ /* Check overflow of expm1(x) */
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDU);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDD);
+ MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p ());
+ MPFR_ASSERTN (i == -1);
+
+ /* Check internal underflow of expm1 (x) */
+ mpfr_set_prec (x, 2);
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0);
+ MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == -1);
+
+ mpfr_set_str_binary (x, "-1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDD);
+ MPFR_ASSERTN (mpfr_cmp_si (x, -1) == 0);
+ MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == -1);
+
+ mpfr_set_str_binary (x, "-1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDZ);
+ MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, MPFR_RNDN) == 0);
+ MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_set_str_binary (x, "-1.1E1000000000");
+ i = test_expm1 (x, x, MPFR_RNDU);
+ MPFR_ASSERTN (mpfr_cmp_str (x, "-0.11", 2, MPFR_RNDN) == 0);
+ MPFR_ASSERTN (!mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_generic (2, 100, 100);
+
+ data_check ("data/expm1", mpfr_expm1, "mpfr_expm1");
+ bad_cases (mpfr_expm1, mpfr_log1p, "mpfr_expm1", 256, -256, 255,
+ 4, 128, 800, 40);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tfactorial.c b/tests/tfactorial.c
new file mode 100644
index 0000000..7579da2
--- /dev/null
+++ b/tests/tfactorial.c
@@ -0,0 +1,287 @@
+/* Test file for mpfr_factorial.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_fac_ui
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_prec (x, 21);
+ mpfr_set_prec (y, 21);
+ mpfr_fac_ui (x, 119, MPFR_RNDZ);
+ mpfr_set_str_binary (y, "0.101111101110100110110E654");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_fac_ui (119)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (y, 206);
+ inex = mpfr_fac_ui (y, 767, MPFR_RNDN);
+ mpfr_set_prec (x, 206);
+ mpfr_set_str_binary (x, "0.110111100001000001101010010001000111000100000100111000010011100011011111001100011110101000111101101100110001001100110100001001111110000101010000100100011100010011101110000001000010001100010000101001111E6250");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_fac_ui (767)\n");
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("Wrong flag for mpfr_fac_ui (767)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (y, 202);
+ mpfr_fac_ui (y, 69, MPFR_RNDU);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+test_int (void)
+{
+ unsigned long n0 = 1, n1 = 80, n;
+ mpz_t f;
+ mpfr_t x, y;
+ mpfr_prec_t prec_f, p;
+ int r;
+ int inex1, inex2;
+
+ mpz_init (f);
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpz_fac_ui (f, n0 - 1);
+ for (n = n0; n <= n1; n++)
+ {
+ mpz_mul_ui (f, f, n); /* f = n! */
+ prec_f = mpz_sizeinbase (f, 2) - mpz_scan1 (f, 0);
+ for (p = MPFR_PREC_MIN; p <= prec_f; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (y, p);
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ inex1 = mpfr_fac_ui (x, n, (mpfr_rnd_t) r);
+ inex2 = mpfr_set_z (y, f, (mpfr_rnd_t) r);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for n=%lu prec=%lu rnd=%s\n",
+ n, (unsigned long) p, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ if ((inex1 < 0 && inex2 >= 0) || (inex1 == 0 && inex2 != 0)
+ || (inex1 > 0 && inex2 <= 0))
+ {
+ printf ("Wrong inexact flag for n=%lu prec=%lu rnd=%s\n",
+ n, (unsigned long) p, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpz_clear (f);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+overflowed_fac0 (void)
+{
+ mpfr_t x, y;
+ int inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (0); /* 1 is not representable. */
+ RND_LOOP (rnd)
+ {
+ mpfr_clear_flags ();
+ inex = mpfr_fac_ui (x, 0, (mpfr_rnd_t) rnd);
+ if (! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_fac0 (rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overflowed_fac0 (rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overflowed_fac0 (rnd = %s):\n"
+ " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E0.\n");
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overflowed_fac0 (rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overflowed_fac0 (rnd = %s):\n"
+ " Got ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ unsigned int prec, err, yprec, n, k, zeros;
+ int rnd;
+ mpfr_t x, y, z, t;
+ int inexact;
+
+ tests_start_mpfr ();
+
+ special ();
+
+ test_int ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+
+ mpfr_fac_ui (y, 0, MPFR_RNDN);
+
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_fac_ui(0) does not give 1\n");
+ exit (1);
+ }
+
+ for (prec = 2; prec <= 100; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+ yprec = prec + 10;
+ mpfr_set_prec (y, yprec);
+
+ for (n = 0; n < 50; n++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ inexact = mpfr_fac_ui (y, n, (mpfr_rnd_t) rnd);
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
+ if (mpfr_can_round (y, err, (mpfr_rnd_t) rnd, (mpfr_rnd_t) rnd, prec))
+ {
+ mpfr_set (t, y, (mpfr_rnd_t) rnd);
+ inexact = mpfr_fac_ui (z, n, (mpfr_rnd_t) rnd);
+ /* fact(n) ends with floor(n/2)+floor(n/4)+... zeros */
+ for (k=n/2, zeros=0; k; k >>= 1)
+ zeros += k;
+ if (MPFR_EXP(y) <= (mpfr_exp_t) (prec + zeros))
+ /* result should be exact */
+ {
+ if (inexact)
+ {
+ printf ("Wrong inexact flag: expected exact\n");
+ exit (1);
+ }
+ }
+ else /* result is inexact */
+ {
+ if (!inexact)
+ {
+ printf ("Wrong inexact flag: expected inexact\n");
+ printf ("n=%u prec=%u\n", n, prec);
+ mpfr_print_binary(z); puts ("");
+ exit (1);
+ }
+ }
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
+ printf (" prec=%u rnd_mode=%s\n", prec,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf (" got ");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ puts ("");
+ printf (" expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf (" approximation was ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+
+ overflowed_fac0 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tfits.c b/tests/tfits.c
new file mode 100644
index 0000000..8aebb41
--- /dev/null
+++ b/tests/tfits.c
@@ -0,0 +1,273 @@
+/* Test file for:
+ mpfr_fits_sint_p, mpfr_fits_slong_p, mpfr_fits_sshort_p,
+ mpfr_fits_uint_p, mpfr_fits_ulong_p, mpfr_fits_ushort_p
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-intmax.h"
+#include "mpfr-test.h"
+
+#define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); }
+#define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); }
+
+static void check_intmax (void);
+
+int
+main (void)
+{
+ mpfr_t x;
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (x, 256);
+
+ /* Check NAN */
+ mpfr_set_nan (x);
+ if (mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR1;
+
+ /* Check INF */
+ mpfr_set_inf (x, 1);
+ if (mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR1;
+
+ /* Check Zero */
+ MPFR_SET_ZERO (x);
+ if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check small op */
+ mpfr_set_str1 (x, "1@-1");
+ if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check 17 */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check all other values */
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR1;
+ mpfr_mul_2exp (x, x, 40, MPFR_RNDN);
+ if (mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR1;
+
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
+ if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);
+ if (!mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_ui (x, INT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR2;
+
+ mpfr_set_si (x, 1, MPFR_RNDN);
+ if (!mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check negative value */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ if (!mpfr_fits_sint_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_slong_p (x, MPFR_RNDN))
+ ERROR2;
+ if (mpfr_fits_uint_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_ushort_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_ulong_p (x, MPFR_RNDN))
+ ERROR1;
+
+ mpfr_clear (x);
+
+ check_intmax ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+static void check_intmax (void)
+{
+#ifdef _MPFR_H_HAVE_INTMAX_T
+ mpfr_t x;
+
+ mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT);
+
+ /* Check NAN */
+ mpfr_set_nan (x);
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR1;
+
+ /* Check INF */
+ mpfr_set_inf (x, 1);
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR1;
+
+ /* Check Zero */
+ MPFR_SET_ZERO (x);
+ if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check small op */
+ mpfr_set_str1 (x, "1@-1");
+ if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check 17 */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR2;
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR2;
+
+ /* Check hugest */
+ mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR1;
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR1;
+
+ /* Check all other values */
+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR1;
+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR1;
+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR2;
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR1;
+
+ /* Check negative value */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
+ ERROR2;
+ if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
+ ERROR1;
+
+ mpfr_clear (x);
+#endif
+}
+
diff --git a/tests/tfma.c b/tests/tfma.c
new file mode 100644
index 0000000..2d6b150
--- /dev/null
+++ b/tests/tfma.c
@@ -0,0 +1,731 @@
+/* Test file for mpfr_fma.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* When a * b is exact, the FMA is equivalent to the separate operations. */
+static void
+test_exact (void)
+{
+ const char *val[] =
+ { "@NaN@", "-@Inf@", "-2", "-1", "-0", "0", "1", "2", "@Inf@" };
+ int sv = sizeof (val) / sizeof (*val);
+ int i, j, k;
+ int rnd;
+ mpfr_t a, b, c, r1, r2;
+
+ mpfr_inits2 (8, a, b, c, r1, r2, (mpfr_ptr) 0);
+
+ for (i = 0; i < sv; i++)
+ for (j = 0; j < sv; j++)
+ for (k = 0; k < sv; k++)
+ RND_LOOP (rnd)
+ {
+ if (mpfr_set_str (a, val[i], 10, MPFR_RNDN) ||
+ mpfr_set_str (b, val[j], 10, MPFR_RNDN) ||
+ mpfr_set_str (c, val[k], 10, MPFR_RNDN) ||
+ mpfr_mul (r1, a, b, (mpfr_rnd_t) rnd) ||
+ mpfr_add (r1, r1, c, (mpfr_rnd_t) rnd))
+ {
+ printf ("test_exact internal error for (%d,%d,%d,%d)\n",
+ i, j, k, rnd);
+ exit (1);
+ }
+ if (mpfr_fma (r2, a, b, c, (mpfr_rnd_t) rnd))
+ {
+ printf ("test_exact(%d,%d,%d,%d): mpfr_fma should be exact\n",
+ i, j, k, rnd);
+ exit (1);
+ }
+ if (MPFR_IS_NAN (r1))
+ {
+ if (MPFR_IS_NAN (r2))
+ continue;
+ printf ("test_exact(%d,%d,%d,%d): mpfr_fma should be NaN\n",
+ i, j, k, rnd);
+ exit (1);
+ }
+ if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2))
+ {
+ printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd);
+ mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN);
+ printf ("\n got ");
+ mpfr_out_str (stdout, 10, 0, r2, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+
+ mpfr_clears (a, b, c, r1, r2, (mpfr_ptr) 0);
+}
+
+static void
+test_overflow1 (void)
+{
+ mpfr_t x, y, z, r;
+ int inex;
+
+ mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
+ MPFR_SET_POS (x);
+ mpfr_setmax (x, mpfr_get_emax ()); /* x = 2^emax - ulp */
+ mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */
+ mpfr_neg (z, x, MPFR_RNDN); /* z = -x = -(2^emax - ulp) */
+ mpfr_clear_flags ();
+ /* The intermediate multiplication x * y overflows, but x * y + z = x
+ is representable. */
+ inex = mpfr_fma (r, x, y, z, MPFR_RNDN);
+ if (inex || ! mpfr_equal_p (r, x))
+ {
+ printf ("Error in test_overflow1\nexpected ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" with inex = 0\n got ");
+ mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN);
+ printf (" with inex = %d\n", inex);
+ exit (1);
+ }
+ if (mpfr_overflow_p ())
+ {
+ printf ("Error in test_overflow1: overflow flag set\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+test_overflow2 (void)
+{
+ mpfr_t x, y, z, r;
+ int i, inex, rnd, err = 0;
+
+ mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
+
+ MPFR_SET_POS (x);
+ mpfr_setmin (x, mpfr_get_emax ()); /* x = 0.1@emax */
+ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */
+ /* The intermediate multiplication x * y will overflow. */
+
+ for (i = -9; i <= 9; i++)
+ RND_LOOP (rnd)
+ {
+ int inf, overflow;
+
+ inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA;
+ overflow = inf || i <= 0;
+
+ inex = mpfr_set_si_2exp (z, i, mpfr_get_emin (), MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ mpfr_clear_flags ();
+ /* One has: x * y = -1@emax exactly (but not representable). */
+ inex = mpfr_fma (r, x, y, z, (mpfr_rnd_t) rnd);
+ if (overflow ^ (mpfr_overflow_p () != 0))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): wrong overflow"
+ " flag (should be %d)\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), overflow);
+ err = 1;
+ }
+ if (mpfr_nanflag_p ())
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): NaN flag should"
+ " not be set\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (mpfr_nan_p (r))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): got NaN\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ else if (MPFR_SIGN (r) >= 0)
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): wrong sign "
+ "(+ instead of -)\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ else if (inf && ! mpfr_inf_p (r))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): expected -Inf,"
+ " got\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_dump (r);
+ err = 1;
+ }
+ else if (!inf && (mpfr_inf_p (r) ||
+ (mpfr_nextbelow (r), ! mpfr_inf_p (r))))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): expected -MAX,"
+ " got\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_dump (r);
+ err = 1;
+ }
+ if (inf ? inex >= 0 : inex <= 0)
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): wrong inexact"
+ " flag (got %d)\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex);
+ err = 1;
+ }
+
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+test_underflow1 (void)
+{
+ mpfr_t x, y, z, r;
+ int inex, signy, signz, rnd, err = 0;
+
+ mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
+
+ MPFR_SET_POS (x);
+ mpfr_setmin (x, mpfr_get_emin ()); /* x = 0.1@emin */
+
+ for (signy = -1; signy <= 1; signy += 2)
+ {
+ mpfr_set_si_2exp (y, signy, -1, MPFR_RNDN); /* |y| = 1/2 */
+ for (signz = -3; signz <= 3; signz += 2)
+ {
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si (z, signz, MPFR_RNDN);
+ if (ABS (signz) != 1)
+ mpfr_setmax (z, mpfr_get_emax ());
+ /* |z| = 1 or 2^emax - ulp */
+ mpfr_clear_flags ();
+ inex = mpfr_fma (r, x, y, z, (mpfr_rnd_t) rnd);
+#define ERRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n "
+ if (mpfr_nanflag_p ())
+ {
+ printf (ERRTU1 "NaN flag is set\n", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (signy < 0 && MPFR_IS_LIKE_RNDD(rnd, signz))
+ mpfr_nextbelow (z);
+ if (signy > 0 && MPFR_IS_LIKE_RNDU(rnd, signz))
+ mpfr_nextabove (z);
+ if ((mpfr_overflow_p () != 0) ^ (mpfr_inf_p (z) != 0))
+ {
+ printf (ERRTU1 "wrong overflow flag\n", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (mpfr_underflow_p ())
+ {
+ printf (ERRTU1 "underflow flag is set\n", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (r, z))
+ {
+ printf (ERRTU1 "got ", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (r);
+ printf (" instead of ");
+ mpfr_print_binary (z);
+ printf ("\n");
+ err = 1;
+ }
+ if (inex >= 0 && (rnd == MPFR_RNDD ||
+ (rnd == MPFR_RNDZ && signz > 0) ||
+ (rnd == MPFR_RNDN && signy > 0)))
+ {
+ printf (ERRTU1 "ternary value = %d instead of < 0\n",
+ signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd),
+ inex);
+ err = 1;
+ }
+ if (inex <= 0 && (rnd == MPFR_RNDU ||
+ (rnd == MPFR_RNDZ && signz < 0) ||
+ (rnd == MPFR_RNDN && signy < 0)))
+ {
+ printf (ERRTU1 "ternary value = %d instead of > 0\n",
+ signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd),
+ inex);
+ err = 1;
+ }
+ }
+ }
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+test_underflow2 (void)
+{
+ mpfr_t x, y, z, r;
+ int b, i, inex, same, err = 0;
+
+ mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0);
+
+ mpfr_set_si_2exp (z, 1, mpfr_get_emin (), MPFR_RNDN); /* z = 2^emin */
+ mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */
+
+ for (b = 0; b <= 1; b++)
+ {
+ for (i = 15; i <= 17; i++)
+ {
+ mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN);
+ /* z = 1.000...00b
+ * xy = 01111
+ * or 10000
+ * or 10001
+ */
+ mpfr_clear_flags ();
+ inex = mpfr_fma (r, x, y, z, MPFR_RNDN);
+#define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n "
+ if (__gmpfr_flags != MPFR_FLAGS_INEXACT)
+ {
+ printf (ERRTU2 "flags = %u instead of %u\n", b, i,
+ __gmpfr_flags, (unsigned int) MPFR_FLAGS_INEXACT);
+ err = 1;
+ }
+ same = i == 15 || (i == 16 && b == 0);
+ if (same ? (inex >= 0) : (inex <= 0))
+ {
+ printf (ERRTU2 "incorrect ternary value (%d instead of %c 0)\n",
+ b, i, inex, same ? '<' : '>');
+ err = 1;
+ }
+ mpfr_set (y, z, MPFR_RNDN);
+ if (!same)
+ mpfr_nextabove (y);
+ if (! mpfr_equal_p (r, y))
+ {
+ printf (ERRTU2 "expected ", b, i);
+ mpfr_dump (y);
+ printf (" got ");
+ mpfr_dump (r);
+ err = 1;
+ }
+ }
+ mpfr_nextabove (z);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+bug20101018 (void)
+{
+ mpfr_t x, y, z, t, u;
+ int i;
+
+ mpfr_init2 (x, 64);
+ mpfr_init2 (y, 64);
+ mpfr_init2 (z, 64);
+ mpfr_init2 (t, 64);
+ mpfr_init2 (u, 64);
+
+ mpfr_set_str (x, "0xf.fffffffffffffffp-14766", 16, MPFR_RNDN);
+ mpfr_set_str (y, "-0xf.fffffffffffffffp+317", 16, MPFR_RNDN);
+ mpfr_set_str (z, "0x8.3ffffffffffe3ffp-14443", 16, MPFR_RNDN);
+ mpfr_set_str (t, "0x8.7ffffffffffc7ffp-14444", 16, MPFR_RNDN);
+ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (u, t) != 0)
+ {
+ printf ("Wrong result in bug20101018 (a)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in bug20101018 (a)\n");
+ printf ("Expected > 0\n");
+ printf ("Got %d\n", i);
+ exit (1);
+ }
+
+ mpfr_set_str (x, "-0xf.fffffffffffffffp-11420", 16, MPFR_RNDN);
+ mpfr_set_str (y, "0xf.fffffffffffffffp+9863", 16, MPFR_RNDN);
+ mpfr_set_str (z, "0x8.fffff80ffffffffp-1551", 16, MPFR_RNDN);
+ mpfr_set_str (t, "0x9.fffff01ffffffffp-1552", 16, MPFR_RNDN);
+ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (u, t) != 0)
+ {
+ printf ("Wrong result in bug20101018 (b)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in bug20101018 (b)\n");
+ printf ("Expected > 0\n");
+ printf ("Got %d\n", i);
+ exit (1);
+ }
+
+ mpfr_set_str (x, "0xf.fffffffffffffffp-2125", 16, MPFR_RNDN);
+ mpfr_set_str (y, "-0xf.fffffffffffffffp-6000", 16, MPFR_RNDN);
+ mpfr_set_str (z, "0x8p-8119", 16, MPFR_RNDN);
+ mpfr_set_str (t, "0x8.000000000000001p-8120", 16, MPFR_RNDN);
+ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (u, t) != 0)
+ {
+ printf ("Wrong result in bug20101018 (c)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in bug20101018 (c)\n");
+ printf ("Expected > 0\n");
+ printf ("Got %d\n", i);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+ mpfr_clear (u);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y, z, s;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ tests_start_mpfr ();
+
+ bug20101018 ();
+
+ mpfr_init (x);
+ mpfr_init (s);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ /* check special cases */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 2);
+ mpfr_set_prec (s, 2);
+ mpfr_set_str (x, "-0.75", 10, MPFR_RNDN);
+ mpfr_set_str (y, "0.5", 10, MPFR_RNDN);
+ mpfr_set_str (z, "0.375", 10, MPFR_RNDN);
+ mpfr_fma (s, x, y, z, MPFR_RNDU); /* result is 0 */
+ if (mpfr_cmp_ui(s, 0))
+ {
+ printf("Error: -0.75 * 0.5 + 0.375 should be equal to 0 for prec=2\n");
+ exit(1);
+ }
+
+ mpfr_set_prec (x, 27);
+ mpfr_set_prec (y, 27);
+ mpfr_set_prec (z, 27);
+ mpfr_set_prec (s, 27);
+ mpfr_set_str_binary (x, "1.11111111111111111111111111e-1");
+ mpfr_set (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (z, "-1.00011110100011001011001001e-1");
+ if (mpfr_fma (s, x, y, z, MPFR_RNDN) >= 0)
+ {
+ printf ("Wrong inexact flag for x=y=1-2^(-27)\n");
+ exit (1);
+ }
+
+ mpfr_set_nan (x);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=NAN does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_nan (y);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p(s))
+ {
+ printf ("evaluation of function in y=NAN does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_nan (z);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (x, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in z=NAN does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, 1);
+ mpfr_set_inf (z, 1);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("Error for (+inf) * (+inf) + (+inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_inf (y, -1);
+ mpfr_set_inf (z, 1);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("Error for (-inf) * (-inf) + (+inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, -1);
+ mpfr_set_inf (z, -1);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
+ {
+ printf ("Error for (+inf) * (-inf) + (-inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_inf (y, 1);
+ mpfr_set_inf (z, -1);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
+ {
+ printf ("Error for (-inf) * (+inf) + (-inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=INF y=0 does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, 1);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=0 y=INF does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_urandomb (y, RANDS); /* always positive */
+ mpfr_set_inf (z, -1);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=INF y>0 z=-INF does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, 1);
+ mpfr_urandomb (x, RANDS);
+ mpfr_set_inf (z, -1);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x>0 y=INF z=-INF does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("evaluation of function in x=INF does not return INF");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, 1);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("evaluation of function in y=INF does not return INF");
+ exit (1);
+ }
+
+ mpfr_set_inf (z, 1);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (y, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("evaluation of function in z=INF does not return INF");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (s, z))
+ {
+ printf ("evaluation of function in x=0 does not return z\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fma (s, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (s, z))
+ {
+ printf ("evaluation of function in y=0 does not return z\n");
+ exit (1);
+ }
+
+ {
+ mpfr_prec_t prec;
+ mpfr_t t, slong;
+ mpfr_rnd_t rnd;
+ int inexact, compare;
+ unsigned int n;
+
+ mpfr_prec_t p0=2, p1=200;
+ unsigned int N=200;
+
+ mpfr_init (t);
+ mpfr_init (slong);
+
+ /* generic test */
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (y, prec);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (s, prec);
+ mpfr_set_prec (t, prec);
+
+ for (n=0; n<N; n++)
+ {
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+
+ if (randlimb () % 2)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (randlimb () % 2)
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (randlimb () % 2)
+ mpfr_neg (z, z, MPFR_RNDN);
+
+ rnd = RND_RAND ();
+ mpfr_set_prec (slong, 2 * prec);
+ if (mpfr_mul (slong, x, y, rnd))
+ {
+ printf ("x*y should be exact\n");
+ exit (1);
+ }
+ compare = mpfr_add (t, slong, z, rnd);
+ inexact = mpfr_fma (s, x, y, z, rnd);
+ if (mpfr_cmp (s, t))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
+ printf (" y=");
+ mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN);
+ printf (" z=");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec,
+ mpfr_print_rnd_mode (rnd));
+ printf ("got ");
+ mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN);
+ puts ("");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf ("approx ");
+ mpfr_print_binary (slong);
+ puts ("");
+ exit (1);
+ }
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact < 0) && (compare >= 0)) ||
+ ((inexact > 0) && (compare <= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n",
+ mpfr_print_rnd_mode (rnd), compare, inexact);
+ printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+ }
+ mpfr_clear (t);
+ mpfr_clear (slong);
+
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (s);
+
+ test_exact ();
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ test_overflow1 ();
+ test_overflow2 ();
+ test_underflow1 ();
+ test_underflow2 ();
+ MPFR_SAVE_EXPO_FREE (expo);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tfmod.c b/tests/tfmod.c
new file mode 100644
index 0000000..27bed79
--- /dev/null
+++ b/tests/tfmod.c
@@ -0,0 +1,384 @@
+/* tfmod -- test file for mpfr_fmod
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+#define TEST_FUNCTION mpfr_fmod
+#define TWO_ARGS
+#include "tgeneric.c"
+
+/* compute remainder as in definition:
+ r = x - n * y, where n = trunc(x/y).
+ warning: may change flags. */
+static int
+slow_fmod (mpfr_ptr r, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd)
+{
+ mpfr_t q;
+ int inexact;
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) || MPFR_IS_SINGULAR (y)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_NAN (y) || MPFR_IS_INF (x)
+ || MPFR_IS_ZERO (y))
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+ else /* either y is Inf and x is 0 or non-special,
+ or x is 0 and y is non-special,
+ in both cases the quotient is zero. */
+ return mpfr_set (r, x, rnd);
+ }
+ /* regular cases */
+ /* if 2^(ex-1) <= |x| < 2^ex, and 2^(ey-1) <= |y| < 2^ey,
+ then |x/y| < 2^(ex-ey+1) */
+ mpfr_init2 (q,
+ MAX (MPFR_PREC_MIN, mpfr_get_exp (x) - mpfr_get_exp (y) + 1));
+ mpfr_div (q, x, y, MPFR_RNDZ);
+ mpfr_trunc (q, q); /* may change inexact flag */
+ mpfr_prec_round (q, mpfr_get_prec (q) + mpfr_get_prec (y), MPFR_RNDZ);
+ inexact = mpfr_mul (q, q, y, MPFR_RNDZ); /* exact */
+ inexact = mpfr_sub (r, x, q, rnd);
+ mpfr_clear (q);
+ return inexact;
+}
+
+static void
+test_failed (mpfr_t erem, mpfr_t grem, int eret, int gret, mpfr_t x, mpfr_t y,
+ mpfr_rnd_t rnd)
+{
+ printf ("error: mpfr_fmod (r, x, y, rnd)\n x = ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD);
+ printf ("\n y = ");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDD);
+ printf ("\nrnd = %s", mpfr_print_rnd_mode (rnd));
+ if (eret != gret)
+ printf ("\nexpected %s return value, got %d",
+ (eret < 0 ? "negative" : eret > 0 ? "positive" : "zero"), gret);
+ printf ("\n expected r = ");
+ mpfr_out_str (stdout, 10, 0, erem, MPFR_RNDD);
+ printf ("\n got r = ");
+ mpfr_out_str (stdout, 10, 0, grem, MPFR_RNDD);
+ putchar ('\n');
+
+ exit (1);
+}
+
+static void
+check (mpfr_t r0, mpfr_t x, mpfr_t y, mpfr_rnd_t rnd)
+{
+ int inex0, inex1;
+ mpfr_t r1;
+ mpfr_init2 (r1, mpfr_get_prec (r0));
+
+ inex0 = mpfr_fmod (r0, x, y, rnd);
+ inex1 = slow_fmod (r1, x, y, rnd);
+ if (!mpfr_equal_p (r0, r1) || inex0 != inex1)
+ test_failed (r1, r0, inex1, inex0, x, y, rnd);
+ mpfr_clear (r1);
+}
+
+static void
+regular (void)
+{
+ mpfr_t x, y, r;
+ mpfr_inits (x, y, r, (mpfr_ptr) 0);
+
+ /* remainder = 0 */
+ mpfr_set_str (y, "FEDCBA987654321p-64", 16, MPFR_RNDN);
+ mpfr_pow_ui (x, y, 42, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+
+ /* x < y */
+ mpfr_set_ui_2exp (x, 64723, -19, MPFR_RNDN);
+ mpfr_mul (x, x, y, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+
+ /* sign(x) = sign (r) */
+ mpfr_set_ui (x, 123798, MPFR_RNDN);
+ mpfr_set_ui (y, 10, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+
+ /* huge difference between precisions */
+ mpfr_set_prec (x, 314);
+ mpfr_set_prec (y, 8);
+ mpfr_set_prec (r, 123);
+ mpfr_const_pi (x, MPFR_RNDD); /* x = pi */
+ mpfr_set_ui_2exp (y, 1, 3, MPFR_RNDD); /* y = 1/8 */
+ check (r, x, y, MPFR_RNDD);
+
+ mpfr_clears (x, y, r, (mpfr_ptr) 0);
+}
+
+static void
+special (void)
+{
+ int inexact;
+ mpfr_t x, y, r, nan;
+ mpfr_inits (x, y, r, nan, (mpfr_ptr) 0);
+
+ mpfr_set_nan (nan);
+
+ /* fmod (NaN, NaN) is NaN */
+ mpfr_set_nan (x);
+ mpfr_set_nan (y);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (NaN, +0) is NaN */
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+1, 0) is NaN */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (0, 0) is NaN */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+inf, +0) is NaN */
+ mpfr_set_inf (x, +1);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-inf, +0) is NaN */
+ mpfr_set_inf (x, -1);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-inf, -0) is NaN */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-inf, +1) is NaN */
+ mpfr_set_ui (y, +1, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+inf, +1) is NaN */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+inf, -inf) is NaN */
+ mpfr_set_inf (y, -1);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-inf, -inf) is NaN */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-inf, +inf) is NaN */
+ mpfr_neg (y, y, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+inf, +inf) is NaN */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (x, +inf) = x, if x is finite */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+0, +inf) = +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-0, +inf) = -0 */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (x, -inf) = x, if x is finite */
+ mpfr_set_inf (y, -1);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+0, -inf) = +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-0, -inf) = -0 */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+0, +0) is NaN */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+0, -0) is NaN */
+ mpfr_neg (y, y, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (r) || inexact != 0)
+ test_failed (r, nan, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+0, +1) = +0 */
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (+0, -1) = +0 */
+ mpfr_neg (y, y, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-0, -1) = -0 */
+ mpfr_neg (x, x, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ /* fmod (-0, +1) = -0 */
+ mpfr_neg (y, y, MPFR_RNDN);
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, x) || inexact != 0)
+ test_failed (r, x, 0, inexact, x, y, MPFR_RNDN);
+
+ mpfr_clears (x, y, r, nan, (mpfr_ptr) 0);
+ return;
+}
+
+/* bug reported by Eric Veach */
+static void
+bug20090519 (void)
+{
+ mpfr_t x, y, r;
+ int inexact;
+ mpfr_inits2 (100, x, y, r, (mpfr_ptr) 0);
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 3);
+ mpfr_set_prec (r, 3);
+ mpfr_set_si (x, 8, MPFR_RNDN);
+ mpfr_set_si (y, 7, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_prec (y, 10);
+ mpfr_set_prec (r, 10);
+ mpfr_set_ui_2exp (x, 3, 26, MPFR_RNDN);
+ mpfr_set_si (y, (1 << 9) - 1, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+
+ mpfr_set_prec (x, 100);
+ mpfr_set_prec (y, 100);
+ mpfr_set_prec (r, 100);
+ mpfr_set_str (x, "3.5", 10, MPFR_RNDN);
+ mpfr_set_str (y, "1.1", 10, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+ /* double check, with a pre-computed value */
+ {
+ mpfr_t er;
+ mpfr_init2 (er, 100);
+ mpfr_set_str (er, "CCCCCCCCCCCCCCCCCCCCCCCC8p-102", 16, MPFR_RNDN);
+
+ inexact = mpfr_fmod (r, x, y, MPFR_RNDN);
+ if (!mpfr_equal_p (r, er) || inexact != 0)
+ test_failed (er, r, 0, inexact, x, y, MPFR_RNDN);
+
+ mpfr_clear (er);
+ }
+
+ mpfr_set_si (x, 20, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, 1, MPFR_RNDN); /* exact */
+ mpfr_sin (y, y, MPFR_RNDN);
+ check (r, x, y, MPFR_RNDN);
+
+ mpfr_clears(r, x, y, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ bug20090519 ();
+
+ test_generic (2, 100, 100);
+
+ special ();
+ regular ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tfms.c b/tests/tfms.c
new file mode 100644
index 0000000..ee3f092
--- /dev/null
+++ b/tests/tfms.c
@@ -0,0 +1,644 @@
+/* Test file for mpfr_fms.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* When a * b is exact, the FMS is equivalent to the separate operations. */
+static void
+test_exact (void)
+{
+ const char *val[] =
+ { "@NaN@", "-@Inf@", "-2", "-1", "-0", "0", "1", "2", "@Inf@" };
+ int sv = sizeof (val) / sizeof (*val);
+ int i, j, k;
+ int rnd;
+ mpfr_t a, b, c, r1, r2;
+
+ mpfr_inits2 (8, a, b, c, r1, r2, (mpfr_ptr) 0);
+
+ for (i = 0; i < sv; i++)
+ for (j = 0; j < sv; j++)
+ for (k = 0; k < sv; k++)
+ RND_LOOP (rnd)
+ {
+ if (mpfr_set_str (a, val[i], 10, MPFR_RNDN) ||
+ mpfr_set_str (b, val[j], 10, MPFR_RNDN) ||
+ mpfr_set_str (c, val[k], 10, MPFR_RNDN) ||
+ mpfr_mul (r1, a, b, (mpfr_rnd_t) rnd) ||
+ mpfr_sub (r1, r1, c, (mpfr_rnd_t) rnd))
+ {
+ printf ("test_exact internal error for (%d,%d,%d,%d)\n",
+ i, j, k, rnd);
+ exit (1);
+ }
+ if (mpfr_fms (r2, a, b, c, (mpfr_rnd_t) rnd))
+ {
+ printf ("test_exact(%d,%d,%d,%d): mpfr_fms should be exact\n",
+ i, j, k, rnd);
+ exit (1);
+ }
+ if (MPFR_IS_NAN (r1))
+ {
+ if (MPFR_IS_NAN (r2))
+ continue;
+ printf ("test_exact(%d,%d,%d,%d): mpfr_fms should be NaN\n",
+ i, j, k, rnd);
+ exit (1);
+ }
+ if (mpfr_cmp (r1, r2) || MPFR_SIGN (r1) != MPFR_SIGN (r2))
+ {
+ printf ("test_exact(%d,%d,%d,%d):\nexpected ", i, j, k, rnd);
+ mpfr_out_str (stdout, 10, 0, r1, MPFR_RNDN);
+ printf ("\n got ");
+ mpfr_out_str (stdout, 10, 0, r2, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+
+ mpfr_clears (a, b, c, r1, r2, (mpfr_ptr) 0);
+}
+
+static void
+test_overflow1 (void)
+{
+ mpfr_t x, y, z, r;
+ int inex;
+
+ mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
+ MPFR_SET_POS (x);
+ mpfr_setmax (x, mpfr_get_emax ()); /* x = 2^emax - ulp */
+ mpfr_set_ui (y, 2, MPFR_RNDN); /* y = 2 */
+ mpfr_set (z, x, MPFR_RNDN); /* z = x = 2^emax - ulp */
+ mpfr_clear_flags ();
+ /* The intermediate multiplication x * y overflows, but x * y - z = x
+ is representable. */
+ inex = mpfr_fms (r, x, y, z, MPFR_RNDN);
+ if (inex || ! mpfr_equal_p (r, x))
+ {
+ printf ("Error in test_overflow1\nexpected ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" with inex = 0\n got ");
+ mpfr_out_str (stdout, 2, 0, r, MPFR_RNDN);
+ printf (" with inex = %d\n", inex);
+ exit (1);
+ }
+ if (mpfr_overflow_p ())
+ {
+ printf ("Error in test_overflow1: overflow flag set\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+test_overflow2 (void)
+{
+ mpfr_t x, y, z, r;
+ int i, inex, rnd, err = 0;
+
+ mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
+
+ MPFR_SET_POS (x);
+ mpfr_setmin (x, mpfr_get_emax ()); /* x = 0.1@emax */
+ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */
+ /* The intermediate multiplication x * y will overflow. */
+
+ for (i = -9; i <= 9; i++)
+ RND_LOOP (rnd)
+ {
+ int inf, overflow;
+
+ inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA;
+ overflow = inf || i <= 0;
+
+ inex = mpfr_set_si_2exp (z, -i, mpfr_get_emin (), MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ mpfr_clear_flags ();
+ /* One has: x * y = -1@emax exactly (but not representable). */
+ inex = mpfr_fms (r, x, y, z, (mpfr_rnd_t) rnd);
+ if (overflow ^ (mpfr_overflow_p () != 0))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): wrong overflow"
+ " flag (should be %d)\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), overflow);
+ err = 1;
+ }
+ if (mpfr_nanflag_p ())
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): NaN flag should"
+ " not be set\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (mpfr_nan_p (r))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): got NaN\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ else if (MPFR_SIGN (r) >= 0)
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): wrong sign "
+ "(+ instead of -)\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ else if (inf && ! mpfr_inf_p (r))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): expected -Inf,"
+ " got\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_dump (r);
+ err = 1;
+ }
+ else if (!inf && (mpfr_inf_p (r) ||
+ (mpfr_nextbelow (r), ! mpfr_inf_p (r))))
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): expected -MAX,"
+ " got\n", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_dump (r);
+ err = 1;
+ }
+ if (inf ? inex >= 0 : inex <= 0)
+ {
+ printf ("Error in test_overflow2 (i = %d, %s): wrong inexact"
+ " flag (got %d)\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd), inex);
+ err = 1;
+ }
+
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+test_underflow1 (void)
+{
+ mpfr_t x, y, z, r;
+ int inex, signy, signz, rnd, err = 0;
+
+ mpfr_inits2 (8, x, y, z, r, (mpfr_ptr) 0);
+
+ MPFR_SET_POS (x);
+ mpfr_setmin (x, mpfr_get_emin ()); /* x = 0.1@emin */
+
+ for (signy = -1; signy <= 1; signy += 2)
+ {
+ mpfr_set_si_2exp (y, signy, -1, MPFR_RNDN); /* |y| = 1/2 */
+ for (signz = -3; signz <= 3; signz += 2)
+ {
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si (z, signz, MPFR_RNDN);
+ if (ABS (signz) != 1)
+ mpfr_setmax (z, mpfr_get_emax ());
+ /* |z| = 1 or 2^emax - ulp */
+ mpfr_clear_flags ();
+ inex = mpfr_fms (r, x, y, z, (mpfr_rnd_t) rnd);
+#define ERRTU1 "Error in test_underflow1 (signy = %d, signz = %d, %s)\n "
+ if (mpfr_nanflag_p ())
+ {
+ printf (ERRTU1 "NaN flag is set\n", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ mpfr_neg (z, z, MPFR_RNDN);
+ if (signy < 0 && MPFR_IS_LIKE_RNDD(rnd, -signz))
+ mpfr_nextbelow (z);
+ if (signy > 0 && MPFR_IS_LIKE_RNDU(rnd, -signz))
+ mpfr_nextabove (z);
+ if ((mpfr_overflow_p () != 0) ^ (mpfr_inf_p (z) != 0))
+ {
+ printf (ERRTU1 "wrong overflow flag\n", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (mpfr_underflow_p ())
+ {
+ printf (ERRTU1 "underflow flag is set\n", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (r, z))
+ {
+ printf (ERRTU1 "got ", signy, signz,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (r);
+ printf (" instead of ");
+ mpfr_print_binary (z);
+ printf ("\n");
+ err = 1;
+ }
+ if (inex >= 0 && (rnd == MPFR_RNDD ||
+ (rnd == MPFR_RNDZ && signz < 0) ||
+ (rnd == MPFR_RNDN && signy > 0)))
+ {
+ printf (ERRTU1 "ternary value = %d instead of < 0\n",
+ signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd),
+ inex);
+ err = 1;
+ }
+ if (inex <= 0 && (rnd == MPFR_RNDU ||
+ (rnd == MPFR_RNDZ && signz > 0) ||
+ (rnd == MPFR_RNDN && signy < 0)))
+ {
+ printf (ERRTU1 "ternary value = %d instead of > 0\n",
+ signy, signz, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd),
+ inex);
+ err = 1;
+ }
+ }
+ }
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+static void
+test_underflow2 (void)
+{
+ mpfr_t x, y, z, r;
+ int b, i, inex, same, err = 0;
+
+ mpfr_inits2 (32, x, y, z, r, (mpfr_ptr) 0);
+
+ mpfr_set_si_2exp (z, -1, mpfr_get_emin (), MPFR_RNDN); /* z = -2^emin */
+ mpfr_set_si_2exp (x, 1, mpfr_get_emin (), MPFR_RNDN); /* x = 2^emin */
+
+ for (b = 0; b <= 1; b++)
+ {
+ for (i = 15; i <= 17; i++)
+ {
+ mpfr_set_si_2exp (y, i, -4 - MPFR_PREC (z), MPFR_RNDN);
+ /* z = -1.000...00b
+ * xy = 01111
+ * or 10000
+ * or 10001
+ */
+ mpfr_clear_flags ();
+ inex = mpfr_fms (r, x, y, z, MPFR_RNDN);
+#define ERRTU2 "Error in test_underflow2 (b = %d, i = %d)\n "
+ if (__gmpfr_flags != MPFR_FLAGS_INEXACT)
+ {
+ printf (ERRTU2 "flags = %u instead of %u\n", b, i,
+ __gmpfr_flags, (unsigned int) MPFR_FLAGS_INEXACT);
+ err = 1;
+ }
+ same = i == 15 || (i == 16 && b == 0);
+ if (same ? (inex >= 0) : (inex <= 0))
+ {
+ printf (ERRTU2 "incorrect ternary value (%d instead of %c 0)\n",
+ b, i, inex, same ? '<' : '>');
+ err = 1;
+ }
+ mpfr_neg (y, z, MPFR_RNDN);
+ if (!same)
+ mpfr_nextabove (y);
+ if (! mpfr_equal_p (r, y))
+ {
+ printf (ERRTU2 "expected ", b, i);
+ mpfr_dump (y);
+ printf (" got ");
+ mpfr_dump (r);
+ err = 1;
+ }
+ }
+ mpfr_nextbelow (z);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y, z, s;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (s);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ /* check special cases */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 2);
+ mpfr_set_prec (s, 2);
+ mpfr_set_str (x, "-0.75", 10, MPFR_RNDN);
+ mpfr_set_str (y, "0.5", 10, MPFR_RNDN);
+ mpfr_set_str (z, "-0.375", 10, MPFR_RNDN);
+ mpfr_fms (s, x, y, z, MPFR_RNDU); /* result is 0 */
+ if (mpfr_cmp_ui(s, 0))
+ {
+ printf("Error: -0.75 * 0.5 - -0.375 should be equal to 0 for prec=2\n");
+ exit(1);
+ }
+
+ mpfr_set_prec (x, 27);
+ mpfr_set_prec (y, 27);
+ mpfr_set_prec (z, 27);
+ mpfr_set_prec (s, 27);
+ mpfr_set_str_binary (x, "1.11111111111111111111111111e-1");
+ mpfr_set (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (z, "1.00011110100011001011001001e-1");
+ if (mpfr_fms (s, x, y, z, MPFR_RNDN) >= 0)
+ {
+ printf ("Wrong inexact flag for x=y=1-2^(-27)\n");
+ exit (1);
+ }
+
+ mpfr_set_nan (x);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=NAN does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_nan (y);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p(s))
+ {
+ printf ("evaluation of function in y=NAN does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_nan (z);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (x, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in z=NAN does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, 1);
+ mpfr_set_inf (z, -1);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("Error for (+inf) * (+inf) - (-inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_inf (y, -1);
+ mpfr_set_inf (z, -1);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("Error for (-inf) * (-inf) - (-inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, -1);
+ mpfr_set_inf (z, 1);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
+ {
+ printf ("Error for (+inf) * (-inf) - (+inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_inf (y, 1);
+ mpfr_set_inf (z, 1);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) > 0)
+ {
+ printf ("Error for (-inf) * (+inf) - (+inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=INF y=0 does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, 1);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=0 y=INF does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_urandomb (y, RANDS); /* always positive */
+ mpfr_set_inf (z, 1);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x=INF y>0 z=INF does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, 1);
+ mpfr_urandomb (x, RANDS);
+ mpfr_set_inf (z, 1);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_nan_p (s))
+ {
+ printf ("evaluation of function in x>0 y=INF z=INF does not return NAN");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("evaluation of function in x=INF does not return INF");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, 1);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("evaluation of function in y=INF does not return INF");
+ exit (1);
+ }
+
+ mpfr_set_inf (z, -1);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (y, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ if (!mpfr_inf_p (s) || mpfr_sgn (s) < 0)
+ {
+ printf ("evaluation of function in z=-INF does not return INF");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
+ if (mpfr_cmp (s, z))
+ {
+ printf ("evaluation of function in x=0 does not return -z\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (z, RANDS);
+ mpfr_fms (s, x, y, z, MPFR_RNDN);
+ mpfr_neg (z, z, MPFR_RNDN);
+ if (mpfr_cmp (s, z))
+ {
+ printf ("evaluation of function in y=0 does not return -z\n");
+ exit (1);
+ }
+
+ {
+ mpfr_prec_t prec;
+ mpfr_t t, slong;
+ mpfr_rnd_t rnd;
+ int inexact, compare;
+ unsigned int n;
+
+ mpfr_prec_t p0=2, p1=200;
+ unsigned int N=200;
+
+ mpfr_init (t);
+ mpfr_init (slong);
+
+ /* generic test */
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (y, prec);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (s, prec);
+ mpfr_set_prec (t, prec);
+
+ for (n=0; n<N; n++)
+ {
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+
+ if (randlimb () % 2)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (randlimb () % 2)
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (randlimb () % 2)
+ mpfr_neg (z, z, MPFR_RNDN);
+
+ rnd = RND_RAND ();
+ mpfr_set_prec (slong, 2 * prec);
+ if (mpfr_mul (slong, x, y, rnd))
+ {
+ printf ("x*y should be exact\n");
+ exit (1);
+ }
+ compare = mpfr_sub (t, slong, z, rnd);
+ inexact = mpfr_fms (s, x, y, z, rnd);
+ if (mpfr_cmp (s, t))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
+ printf (" y=");
+ mpfr_out_str (stdout, 2, prec, y, MPFR_RNDN);
+ printf (" z=");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec,
+ mpfr_print_rnd_mode (rnd));
+ printf ("got ");
+ mpfr_out_str (stdout, 2, prec, s, MPFR_RNDN);
+ puts ("");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf ("approx ");
+ mpfr_print_binary (slong);
+ puts ("");
+ exit (1);
+ }
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact < 0) && (compare >= 0)) ||
+ ((inexact > 0) && (compare <= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n",
+ mpfr_print_rnd_mode (rnd), compare, inexact);
+ printf (" x="); mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" y="); mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" z="); mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf (" s="); mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+ }
+ mpfr_clear (t);
+ mpfr_clear (slong);
+
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (s);
+
+ test_exact ();
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ test_overflow1 ();
+ test_overflow2 ();
+ test_underflow1 ();
+ test_underflow2 ();
+ MPFR_SAVE_EXPO_FREE (expo);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tfprintf.c b/tests/tfprintf.c
new file mode 100644
index 0000000..33e25f0
--- /dev/null
+++ b/tests/tfprintf.c
@@ -0,0 +1,445 @@
+/* tfprintf.c -- test file for mpfr_fprintf and mpfr_vfprintf
+
+Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_STDARG
+#include <stdarg.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+#include <stddef.h>
+
+#include "mpfr-intmax.h"
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+#define QUOTE(X) NAME(X)
+#define NAME(X) #X
+
+#define check_length(num_test, var, value, var_spec) \
+ if ((var) != (value)) \
+ { \
+ printf ("Error in test #%d: mpfr_vfprintf printed %"QUOTE(var_spec) \
+ " characters instead of %d\n", (num_test), (var), (value)); \
+ exit (1); \
+ }
+
+#define check_length_with_cmp(num_test, var, value, cmp, var_spec) \
+ if (cmp != 0) \
+ { \
+ mpfr_printf ("Error in test #%d, mpfr_vfprintf printed %" \
+ QUOTE(var_spec)" characters instead of %d\n", \
+ (num_test), (var), (value)); \
+ exit (1); \
+ }
+
+/* limit for random precision in random() */
+const int prec_max_printf = 5000;
+
+static void
+check (FILE *fout, const char *fmt, mpfr_t x)
+{
+ if (mpfr_fprintf (fout, fmt, x) == -1)
+ {
+ mpfr_printf ("Error in mpfr_fprintf(fout, \"%s\", %Re)\n",
+ fmt, x);
+ exit (1);
+ }
+ fputc ('\n', fout);
+}
+
+static void
+check_vfprintf (FILE *fout, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ if (mpfr_vfprintf (fout, fmt, ap) == -1)
+ {
+ mpfr_printf ("Error in mpfr_vfprintf(fout, \"%s\", ...)\n", fmt);
+
+ va_end (ap);
+ exit (1);
+ }
+
+ va_end (ap);
+ fputc ('\n', fout);
+}
+
+static void
+check_special (FILE *fout)
+{
+ mpfr_t x;
+
+ mpfr_init (x);
+
+ mpfr_set_inf (x, 1);
+ check (fout, "%Ra", x);
+ check (fout, "%Rb", x);
+ check (fout, "%Re", x);
+ check (fout, "%Rf", x);
+ check (fout, "%Rg", x);
+ check_vfprintf (fout, "%Ra", x);
+ check_vfprintf (fout, "%Rb", x);
+ check_vfprintf (fout, "%Re", x);
+ check_vfprintf (fout, "%Rf", x);
+ check_vfprintf (fout, "%Rg", x);
+
+ mpfr_set_inf (x, -1);
+ check (fout, "%Ra", x);
+ check (fout, "%Rb", x);
+ check (fout, "%Re", x);
+ check (fout, "%Rf", x);
+ check (fout, "%Rg", x);
+ check_vfprintf (fout, "%Ra", x);
+ check_vfprintf (fout, "%Rb", x);
+ check_vfprintf (fout, "%Re", x);
+ check_vfprintf (fout, "%Rf", x);
+ check_vfprintf (fout, "%Rg", x);
+
+ mpfr_set_nan (x);
+ check (fout, "%Ra", x);
+ check (fout, "%Rb", x);
+ check (fout, "%Re", x);
+ check (fout, "%Rf", x);
+ check (fout, "%Rg", x);
+ check_vfprintf (fout, "%Ra", x);
+ check_vfprintf (fout, "%Rb", x);
+ check_vfprintf (fout, "%Re", x);
+ check_vfprintf (fout, "%Rf", x);
+ check_vfprintf (fout, "%Rg", x);
+
+ mpfr_clear (x);
+}
+
+static void
+check_mixed (FILE *fout)
+{
+ int ch = 'a';
+#ifndef NPRINTF_HH
+ signed char sch = -1;
+ unsigned char uch = 1;
+#endif
+ short sh = -1;
+ unsigned short ush = 1;
+ int i = -1;
+ int j = 1;
+ unsigned int ui = 1;
+ long lo = -1;
+ unsigned long ulo = 1;
+ float f = -1.25;
+ double d = -1.25;
+#if !defined(NPRINTF_T) || !defined(NPRINTF_L)
+ long double ld = -1.25;
+#endif
+
+#ifndef NPRINTF_T
+ ptrdiff_t p = 1, saved_p;
+#endif
+ size_t sz = 1;
+
+ mpz_t mpz;
+ mpq_t mpq;
+ mpf_t mpf;
+ mpfr_rnd_t rnd = MPFR_RNDN;
+
+ mp_size_t limb_size = 3;
+ mp_limb_t limb[3];
+
+ mpfr_t mpfr;
+ mpfr_prec_t prec = 53;
+
+ mpz_init (mpz);
+ mpz_set_ui (mpz, ulo);
+ mpq_init (mpq);
+ mpq_set_si (mpq, lo, ulo);
+ mpf_init (mpf);
+ mpf_set_q (mpf, mpq);
+
+ mpfr_init2 (mpfr, prec);
+ mpfr_set_f (mpfr, mpf, MPFR_RNDN);
+
+ limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0;
+
+ check_vfprintf (fout, "a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
+ check_length (1, j, 22, d);
+ check_vfprintf (fout, "a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i,
+ lo, &ulo);
+ check_length (2, ulo, 36, lu);
+ check_vfprintf (fout, "a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
+ check_length (3, ush, 29, hu);
+ check_vfprintf (fout, "a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
+ check_length (4, i, 29, d);
+ check_vfprintf (fout, "a. %R*A, b. %Fe, c. %i%zn", rnd, mpfr, mpf, sz,
+ &sz);
+ check_length (5, (unsigned long) sz, 34, lu); /* no format specifier "%zu" in C89 */
+ check_vfprintf (fout, "a. %Pu, b. %c, c. %Zi%Zn", prec, ch, mpz, &mpz);
+ check_length_with_cmp (6, mpz, 17, mpz_cmp_ui (mpz, 17), Zi);
+ check_vfprintf (fout, "%% a. %#.0RNg, b. %Qx%Rn, c. %p", mpfr, mpq, &mpfr,
+ (void *) &i);
+ check_length_with_cmp (7, mpfr, 15, mpfr_cmp_ui (mpfr, 15), Rg);
+
+#ifndef NPRINTF_T
+ saved_p = p;
+ check_vfprintf (fout, "%% a. %RNg, b. %Qx, c. %td%tn", mpfr, mpq, p, &p);
+ if (p != 20)
+ mpfr_fprintf (stderr, "Error in test 8, got '%% a. %RNg, b. %Qx, c. %td'\n", mpfr, mpq, saved_p);
+ check_length (8, (long) p, 20, ld); /* no format specifier "%td" in C89 */
+#endif
+
+#ifndef NPRINTF_L
+ check_vfprintf (fout, "a. %RA, b. %Lf, c. %QX%zn", mpfr, ld, mpq, &sz);
+ check_length (9, (unsigned long) sz, 30, lu); /* no format specifier "%zu" in C89 */
+#endif
+
+#ifndef NPRINTF_HH
+ check_vfprintf (fout, "a. %hhi, b. %RA, c. %hhu%hhn", sch, mpfr, uch, &uch);
+ check_length (10, (unsigned int) uch, 22, u); /* no format specifier "%hhu" in C89 */
+#endif
+
+#if (__GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR) >= 42
+ /* The 'M' specifier was added in gmp 4.2.0 */
+ check_vfprintf (fout, "a. %Mx b. %Re%Mn", limb[0], mpfr, &limb[0]);
+ if (limb[0] != 14 + GMP_NUMB_BITS / 4 || limb[1] != ~ (mp_limb_t) 0
+ || limb[2] != ~ (mp_limb_t) 0)
+ {
+ printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
+ " as expected\n", 14 + (int) GMP_NUMB_BITS / 4);
+ exit (1);
+ }
+
+ limb[0] = ~ (mp_limb_t) 0;
+ /* we tell vfprintf that limb array is 2 cells wide
+ and check it doesn't go through */
+ check_vfprintf (fout, "a. %Re .b %Nx%Nn", mpfr, limb, limb_size, limb,
+ limb_size - 1);
+ if (limb[0] != 14 + 3 * GMP_NUMB_BITS / 4 || limb[1] != (mp_limb_t) 0
+ || limb[2] != ~ (mp_limb_t) 0)
+ {
+ printf ("Error in test #12: mpfr_vfprintf did not print %d characters"
+ " as expected\n", 14 + (int) GMP_NUMB_BITS / 4);
+ exit (1);
+ }
+#endif
+
+#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
+ {
+ long long llo = -1;
+ unsigned long long ullo = 1;
+
+ check_vfprintf (fout, "a. %Re, b. %llx%Qn", mpfr, ullo, &mpq);
+ check_length_with_cmp (21, mpq, 16, mpq_cmp_ui (mpq, 16, 1), Qu);
+ check_vfprintf (fout, "a. %lli, b. %Rf%Fn", llo, mpfr, &mpf);
+ check_length_with_cmp (22, mpf, 19, mpf_cmp_ui (mpf, 19), Fg);
+ }
+#endif
+
+#if defined(_MPFR_H_HAVE_INTMAX_T) && !defined(NPRINTF_J)
+ {
+ intmax_t im = -1;
+ uintmax_t uim = 1;
+
+ check_vfprintf (fout, "a. %*RA, b. %ji%Qn", 10, mpfr, im, &mpq);
+ check_length_with_cmp (31, mpq, 20, mpq_cmp_ui (mpq, 20, 1), Qu);
+ check_vfprintf (fout, "a. %.*Re, b. %jx%Fn", 10, mpfr, uim, &mpf);
+ check_length_with_cmp (32, mpf, 25, mpf_cmp_ui (mpf, 25), Fg);
+ }
+#endif
+
+ mpfr_clear (mpfr);
+ mpf_clear (mpf);
+ mpq_clear (mpq);
+ mpz_clear (mpz);
+}
+
+static void
+check_random (FILE *fout, int nb_tests)
+{
+ int i;
+ mpfr_t x;
+ mpfr_rnd_t rnd;
+ char flag[] =
+ {
+ '-',
+ '+',
+ ' ',
+ '#',
+ '0', /* no ambiguity: first zeros are flag zero*/
+ '\''
+ };
+ char specifier[] =
+ {
+ 'a',
+ 'b',
+ 'e',
+ 'f',
+ 'g'
+ };
+ mpfr_exp_t old_emin, old_emax;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init (x);
+
+ for (i = 0; i < nb_tests; ++i)
+ {
+ int ret;
+ int j, jmax;
+ int spec, prec;
+#define FMT_SIZE 13
+ char fmt[FMT_SIZE]; /* at most something like "%-+ #0'.*R*f" */
+ char *ptr = fmt;
+
+ tests_default_random (x, 256, MPFR_EMIN_MIN, MPFR_EMAX_MAX);
+ rnd = RND_RAND ();
+
+ spec = (int) (randlimb () % 5);
+ jmax = (spec == 3 || spec == 4) ? 6 : 5; /* ' flag only with %f or %g */
+ /* advantage small precision */
+ prec = (int) (randlimb () % ((randlimb () % 2) ? 10 : prec_max_printf));
+ if (spec == 3
+ && (mpfr_get_exp (x) > prec_max_printf
+ || mpfr_get_exp (x) < -prec_max_printf))
+ /* change style 'f' to style 'e' when number x is large */
+ --spec;
+
+ *ptr++ = '%';
+ for (j = 0; j < jmax; j++)
+ {
+ if (randlimb () % 3 == 0)
+ *ptr++ = flag[j];
+ }
+ *ptr++ = '.';
+ *ptr++ = '*';
+ *ptr++ = 'R';
+ *ptr++ = '*';
+ *ptr++ = specifier[spec];
+ *ptr = '\0';
+ MPFR_ASSERTD (ptr - fmt < FMT_SIZE);
+
+ mpfr_fprintf (fout, "mpfr_fprintf(fout, \"%s\", %d, %s, %Re)\n",
+ fmt, prec, mpfr_print_rnd_mode (rnd), x);
+ ret = mpfr_fprintf (fout, fmt, prec, rnd, x);
+ if (ret == -1)
+ {
+ if (spec == 3
+ && (MPFR_GET_EXP (x) > INT_MAX || MPFR_GET_EXP (x) < -INT_MAX))
+ /* normal failure: x is too large to be output with full precision */
+ {
+ mpfr_fprintf (fout, "too large !");
+ }
+ else
+ {
+ mpfr_printf ("Error in mpfr_fprintf(fout, \"%s\", %d, %s, %Re)\n",
+ fmt, prec, mpfr_print_rnd_mode (rnd), x);
+ exit (1);
+ }
+ }
+ mpfr_fprintf (fout, "\n");
+ }
+
+ mpfr_set_emin (old_emin);
+ mpfr_set_emax (old_emax);
+
+ mpfr_clear (x);
+}
+
+static void
+bug_20090316 (FILE *fout)
+{
+ mpfr_t x;
+
+ mpfr_init2 (x, 53);
+
+ /* bug 20090316: fixed in r6112 */
+ mpfr_set_ui_2exp (x, 0x60fa2916, -30, MPFR_RNDN);
+ check (fout, "%-#.4095RDg\n", x);
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ FILE *fout;
+ int N;
+
+ tests_start_mpfr ();
+
+ /* with no argument: prints to /dev/null,
+ tfprintf N: prints N tests to stdout */
+ if (argc == 1)
+ {
+ N = 1000;
+ fout = fopen ("/dev/null", "w");
+ /* If we failed to open this device, try with a dummy file */
+ if (fout == NULL)
+ {
+ fout = fopen ("mpfrtest.txt", "w");
+
+ if (fout == NULL)
+ {
+ printf ("Can't open /dev/null or a temporary file\n");
+ exit (1);
+ }
+ }
+ }
+ else
+ {
+ fout = stdout;
+ N = atoi (argv[1]);
+ }
+
+ check_special (fout);
+ check_mixed (fout);
+ check_random (fout, N);
+
+ bug_20090316 (fout);
+
+ fclose (fout);
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else /* MPFR_VERSION */
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif /* MPFR_VERSION */
+
+#else /* HAVE_STDARG */
+
+int
+main (void)
+{
+ /* We have nothing to test. */
+ return 77;
+}
+
+#endif /* HAVE_STDARG */
diff --git a/tests/tfrac.c b/tests/tfrac.c
new file mode 100644
index 0000000..3d1724a
--- /dev/null
+++ b/tests/tfrac.c
@@ -0,0 +1,301 @@
+/* Test file for mpfr_frac.
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define PIP 70
+#define PFP 70
+#define PMAX (PIP+2*PFP)
+
+static void
+check0 (mpfr_ptr ip, mpfr_ptr fp, mpfr_prec_t prec, mpfr_rnd_t rnd)
+{
+ mpfr_t sum, tmp, dst, fp2;
+ int inex1, inex2;
+
+ mpfr_init2 (sum, PMAX);
+ mpfr_init2 (tmp, PMAX);
+ mpfr_init2 (dst, prec);
+ mpfr_init2 (fp2, prec);
+
+ if (MPFR_SIGN (ip) != MPFR_SIGN (fp))
+ {
+ printf ("Internal error (1)\n");
+ exit (1);
+ }
+ if (mpfr_add (sum, ip, fp, MPFR_RNDZ))
+ {
+ printf ("Wrong inexact flag in mpfr_add\n");
+ exit (1);
+ }
+ if (MPFR_SIGN (sum) != MPFR_SIGN (fp))
+ {
+ printf ("Internal error (2)\n");
+ exit (1);
+ }
+
+ inex1 = mpfr_frac (dst, sum, rnd);
+ inex2 = mpfr_set (fp2, fp, rnd);
+ if (inex1 != inex2)
+ {
+ printf ("Wrong inexact flag in mpfr_frac for\n");
+ mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN);
+ printf ("\nGot %d instead of %d\n", inex1, inex2);
+ exit (1);
+ }
+ if (!mpfr_number_p (dst) ||
+ MPFR_SIGN (dst) != MPFR_SIGN (fp2) ||
+ mpfr_cmp (dst, fp2))
+ {
+ printf ("Error in mpfr_frac (y, x, %s) with\nx = ",
+ mpfr_print_rnd_mode (rnd));
+ mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, dst, MPFR_RNDN);
+ printf ("\ninstead of ");
+ mpfr_out_str (stdout, 2, 0, fp2, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ if (prec == PMAX)
+ {
+ inex1 = mpfr_frac (sum, sum, rnd);
+ if (inex1)
+ {
+ printf ("Wrong inexact flag in mpfr_frac\n");
+ exit (1);
+ }
+ if (!mpfr_number_p (sum) ||
+ MPFR_SIGN (sum) != MPFR_SIGN (fp) ||
+ mpfr_cmp (sum, fp))
+ {
+ printf ("Error in mpfr_frac (x, x, %s) with\nx = ",
+ mpfr_print_rnd_mode (rnd));
+ mpfr_add (tmp, ip, fp, MPFR_RNDZ);
+ mpfr_out_str (stdout, 2, 0, tmp, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, sum, MPFR_RNDN);
+ printf ("\ninstead of ");
+ mpfr_out_str (stdout, 2, 0, fp, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (fp2);
+ mpfr_clear (dst);
+ mpfr_clear (tmp);
+ mpfr_clear (sum);
+}
+
+static void
+check1 (mpfr_ptr ip, mpfr_ptr fp)
+{
+ int rnd;
+
+ for (rnd = 0; rnd < MPFR_RND_MAX ; rnd++)
+ {
+ check0 (ip, fp, PMAX, (mpfr_rnd_t) rnd);
+ check0 (ip, fp, 70, (mpfr_rnd_t) rnd);
+ mpfr_neg (fp, fp, MPFR_RNDN);
+ mpfr_neg (ip, ip, MPFR_RNDN);
+ check0 (ip, fp, PMAX, (mpfr_rnd_t) rnd);
+ check0 (ip, fp, 70, (mpfr_rnd_t) rnd);
+ mpfr_neg (fp, fp, MPFR_RNDN);
+ mpfr_neg (ip, ip, MPFR_RNDN);
+ }
+}
+
+static void
+special (void)
+{
+ mpfr_t z, t;
+
+ mpfr_init (z);
+ mpfr_init (t);
+
+ mpfr_set_nan (z);
+ mpfr_frac (t, z, MPFR_RNDN);
+ if (!mpfr_nan_p (t))
+ {
+ printf ("Error for frac(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (z, 6);
+ mpfr_set_prec (t, 3);
+
+ mpfr_set_str_binary (z, "0.101101E3");
+ mpfr_frac (t, z, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.101");
+ if (mpfr_cmp (t, z))
+ {
+ printf ("Error in frac(0.101101E3)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (z, 34);
+ mpfr_set_prec (t, 26);
+ mpfr_set_str_binary (z, "0.101101010000010011110011001101E9");
+ mpfr_frac (t, z, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.000010011110011001101");
+ if (mpfr_cmp (t, z))
+ {
+ printf ("Error in frac(0.101101010000010011110011001101E9)\n");
+ exit (1);
+ }
+
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+static void
+bug20090918 (void)
+{
+ mpfr_t x, y, z;
+ mp_limb_t y0;
+ int inexy, inexz;
+ int r, i;
+ const char *s[] = { "61680.352935791015625", "61680.999999" };
+ mpfr_exp_t emin;
+
+ emin = mpfr_get_emin ();
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 13);
+
+ for (i = 0; i <= 9; i++)
+ {
+ mpfr_set_str (x, s[i & 1], 10, MPFR_RNDZ);
+
+ RND_LOOP(r)
+ {
+ set_emin ((i >> 1) - 3);
+ inexy = mpfr_frac (y, x, (mpfr_rnd_t) r);
+ set_emin (emin);
+ y0 = MPFR_MANT(y)[0];
+ while (y0 != 0 && (y0 >> 1) << 1 == y0)
+ y0 >>= 1;
+ if (y0 > 0x2000)
+ {
+ printf ("Error in bug20090918 (significand has more than"
+ " 13 bits), i = %d, %s.\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ mpfr_init2 (z, 32);
+ inexz = mpfr_frac (z, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexz == 0); /* exact */
+ inexz = mpfr_prec_round (z, 13, (mpfr_rnd_t) r);
+ set_emin ((i >> 1) - 3);
+ inexz = mpfr_check_range (z, inexz, (mpfr_rnd_t) r);
+ set_emin (emin);
+ if (mpfr_cmp0 (y, z) != 0)
+ {
+ printf ("Error in bug20090918, i = %d, %s.\n", i,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ printf ("Expected ");
+ mpfr_dump (z);
+ printf ("Got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ if (! SAME_SIGN (inexy, inexz))
+ {
+ printf ("Incorrect ternary value in bug20090918, i = %d, %s.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ printf ("Expected %d, got %d.\n", inexz, inexy);
+ exit (1);
+ }
+ mpfr_clear (z);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_frac
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t ip, fp;
+ int ni, nf1, nf2;
+
+ tests_start_mpfr ();
+
+ special ();
+
+ mpfr_init2 (ip, PIP);
+ mpfr_init2 (fp, PFP);
+
+ for (ni = -1; ni < PIP; ni++)
+ {
+ if (ni <= 0)
+ { /* ni + 1 */
+ mpfr_set_si (ip, ni, MPFR_RNDN);
+ mpfr_add_ui (ip, ip, 1, MPFR_RNDN);
+ }
+ else
+ { /* 2^ni + 1 */
+ mpfr_set_ui (ip, 1, MPFR_RNDN);
+ mpfr_mul_2ui (ip, ip, ni, MPFR_RNDN);
+ mpfr_add_ui (ip, ip, 1, MPFR_RNDN);
+ }
+
+ mpfr_set_ui (fp, 0, MPFR_RNDN);
+ check1 (ip, fp);
+
+ for (nf1 = 1; nf1 < PFP; nf1++)
+ {
+ mpfr_set_ui (fp, 1, MPFR_RNDN);
+ mpfr_div_2ui (fp, fp, nf1, MPFR_RNDN);
+ check1 (ip, fp);
+ nf2 = 1 + (randlimb () % (PFP - 1));
+ mpfr_set_ui (fp, 1, MPFR_RNDN);
+ mpfr_div_2ui (fp, fp, nf2, MPFR_RNDN);
+ mpfr_add_ui (fp, fp, 1, MPFR_RNDN);
+ mpfr_div_2ui (fp, fp, nf1, MPFR_RNDN);
+ check1 (ip, fp);
+ }
+ }
+
+ mpfr_set_ui (ip, 1, MPFR_RNDN);
+ mpfr_div_ui (ip, ip, 0, MPFR_RNDN);
+ mpfr_set_ui (fp, 0, MPFR_RNDN);
+ check1 (ip, fp); /* test infinities */
+
+ mpfr_clear (ip);
+ mpfr_clear (fp);
+
+ bug20090918 ();
+
+ test_generic (2, 1000, 10);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tfrexp.c b/tests/tfrexp.c
new file mode 100644
index 0000000..9e69cab
--- /dev/null
+++ b/tests/tfrexp.c
@@ -0,0 +1,141 @@
+/* Test file for mpfr_frexp.
+
+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h> /* for exit */
+#include "mpfr-test.h"
+
+static void
+check_special (void)
+{
+ mpfr_t x, y;
+ int inex;
+ mpfr_exp_t exp;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ mpfr_set_nan (x);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ if (mpfr_nan_p (y) == 0 || inex != 0)
+ {
+ printf ("Error for mpfr_frexp(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ if (mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0 || inex != 0)
+ {
+ printf ("Error for mpfr_frexp(+Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ if (mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0 || inex != 0)
+ {
+ printf ("Error for mpfr_frexp(-Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_zero (x, 1);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ if (mpfr_zero_p (y) == 0 || mpfr_signbit (y) != 0 || inex != 0 || exp != 0)
+ {
+ printf ("Error for mpfr_frexp(+0)\n");
+ exit (1);
+ }
+
+ mpfr_set_zero (x, -1);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ if (mpfr_zero_p (y) == 0 || mpfr_signbit (y) == 0 || inex != 0 || exp != 0)
+ {
+ printf ("Error for mpfr_frexp(-0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ /* 17 = 17/32*2^5 */
+ if (mpfr_cmp_ui_2exp (y, 17, -5) != 0 || inex != 0 || exp != 5)
+ {
+ printf ("Error for mpfr_frexp(17)\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -17, MPFR_RNDN);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ if (mpfr_cmp_si_2exp (y, -17, -5) != 0 || inex != 0 || exp != 5)
+ {
+ printf ("Error for mpfr_frexp(-17)\n");
+ exit (1);
+ }
+
+ /* now reduce the precision of y */
+ mpfr_set_prec (y, 4);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDN);
+ /* 17 -> 16/32*2^5 */
+ if (mpfr_cmp_ui_2exp (y, 16, -5) != 0 || inex >= 0 || exp != 5)
+ {
+ printf ("Error for mpfr_frexp(17) with prec=4, RNDN\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDZ);
+ if (mpfr_cmp_ui_2exp (y, 16, -5) != 0 || inex >= 0 || exp != 5)
+ {
+ printf ("Error for mpfr_frexp(17) with prec=4, RNDZ\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDD);
+ if (mpfr_cmp_ui_2exp (y, 16, -5) != 0 || inex >= 0 || exp != 5)
+ {
+ printf ("Error for mpfr_frexp(17) with prec=4, RNDD\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ inex = mpfr_frexp (&exp, y, x, MPFR_RNDU);
+ if (mpfr_cmp_ui_2exp (y, 18, -5) != 0 || inex <= 0 || exp != 5)
+ {
+ printf ("Error for mpfr_frexp(17) with prec=4, RNDU\n");
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_special ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tgamma.c b/tests/tgamma.c
new file mode 100644
index 0000000..fd92c33
--- /dev/null
+++ b/tests/tgamma.c
@@ -0,0 +1,1069 @@
+/* mpfr_tgamma -- test file for gamma function
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* Note: there could be an incorrect test about suspicious overflow
+ (MPFR_SUSPICIOUS_OVERFLOW) for x = 2^(-emax) = 0.5 * 2^(emin+1) in
+ RNDZ or RNDD, but this case is never tested in the generic tests. */
+#define TEST_FUNCTION mpfr_gamma
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for gamma(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for gamma(-Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for gamma(+Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for gamma(+0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error for gamma(-0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error for gamma(1)\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for gamma(-1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+#define CHECK_X1 "1.0762904832837976166"
+#define CHECK_Y1 "0.96134843256452096050"
+
+ mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN);
+ if (mpfr_cmp (y, x))
+ {
+ printf ("mpfr_lngamma("CHECK_X1") is wrong:\n"
+ "expected ");
+ mpfr_print_binary (x); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (y); putchar ('\n');
+ exit (1);
+ }
+
+#define CHECK_X2 "9.23709516716202383435e-01"
+#define CHECK_Y2 "1.0502315560291053398"
+ mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
+ if (mpfr_cmp (y, x))
+ {
+ printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
+ "expected ");
+ mpfr_print_binary (x); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (y); putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 175);
+ mpfr_set_ui (x, 33, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 175);
+ mpfr_set_str_binary (x, "0.110010101011010101101000010101010111000110011101001000101011000001100010111001101001011E118");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_gamma (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 21);
+ mpfr_set_prec (y, 8);
+ mpfr_set_ui (y, 120, MPFR_RNDN);
+ mpfr_gamma (x, y, MPFR_RNDZ);
+ mpfr_set_prec (y, 21);
+ mpfr_set_str_binary (y, "0.101111101110100110110E654");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_gamma (120)\n");
+ printf ("Expected "); mpfr_print_binary (y); puts ("");
+ printf ("Got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 206);
+ mpfr_set_str_binary (x, "0.110e10");
+ inex = mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 206);
+ mpfr_set_str_binary (x, "0.110111100001000001101010010001000111000100000100111000010011100011011111001100011110101000111101101100110001001100110100001001111110000101010000100100011100010011101110000001000010001100010000101001111E6250");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_gamma (768)\n");
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("Wrong flag for mpfr_gamma (768)\n");
+ exit (1);
+ }
+
+ /* worst case to exercise retry */
+ mpfr_set_prec (x, 1000);
+ mpfr_set_prec (y, 869);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+
+ mpfr_set_prec (x, 4);
+ mpfr_set_prec (y, 4);
+ mpfr_set_str_binary (x, "-0.1100E-66");
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.1011E67");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma(-0.1100E-66)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin, emax;
+ int inex;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ set_emin (-125);
+ set_emax (128);
+
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 24);
+ mpfr_set_str_binary (x, "0.101100100000000000110100E7");
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y))
+ {
+ printf ("Overflow error.\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* problem mentioned by Kenneth Wilder, 18 Aug 2005 */
+ mpfr_set_prec (x, 29);
+ mpfr_set_prec (y, 29);
+ mpfr_set_str (x, "-200000000.5", 10, MPFR_RNDN); /* exact */
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
+ {
+ printf ("Error for gamma(-200000000.5)\n");
+ printf ("expected -0");
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
+ {
+ printf ("Error for gamma(-200000000.1), prec=53\n");
+ printf ("expected -0");
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* another problem mentioned by Kenneth Wilder, 29 Aug 2005 */
+ mpfr_set_prec (x, 333);
+ mpfr_set_prec (y, 14);
+ mpfr_set_str (x, "-2.0000000000000000000000005", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 14);
+ mpfr_set_str_binary (x, "-11010011110001E66");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma(-2.0000000000000000000000005)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ /* another tests from Kenneth Wilder, 31 Aug 2005 */
+ set_emax (200);
+ set_emin (-200);
+ mpfr_set_prec (x, 38);
+ mpfr_set_prec (y, 54);
+ mpfr_set_str_binary (x, "0.11101111011100111101001001010110101001E-166");
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 54);
+ mpfr_set_str_binary (x, "0.100010001101100001110110001010111111010000100101011E167");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma (test 1)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ set_emax (1000);
+ set_emin (-2000);
+ mpfr_set_prec (x, 38);
+ mpfr_set_prec (y, 71);
+ mpfr_set_str_binary (x, "10101011011100001111111000010111110010E-1034");
+ /* 184083777010*2^(-1034) */
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 71);
+ mpfr_set_str_binary (x, "10111111001000011110010001000000000000110011110000000011101011111111100E926");
+ /* 1762885132679550982140*2^926 */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma (test 2)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 38);
+ mpfr_set_prec (y, 88);
+ mpfr_set_str_binary (x, "10111100111001010000100001100100100101E-104");
+ /* 202824096037*2^(-104) */
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 88);
+ mpfr_set_str_binary (x, "1010110101111000111010111100010110101010100110111000001011000111000011101100001101110010E-21");
+ /* 209715199999500283894743922*2^(-21) */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma (test 3)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 171);
+ mpfr_set_prec (y, 38);
+ mpfr_set_str (x, "-2993155353253689176481146537402947624254601559176535", 10,
+ MPFR_RNDN);
+ mpfr_div_2exp (x, x, 170, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 38);
+ mpfr_set_str (x, "201948391737", 10, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 92, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma (test 5)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ set_emin (-500000);
+ mpfr_set_prec (x, 337);
+ mpfr_set_prec (y, 38);
+ mpfr_set_str (x, "-30000.000000000000000000000000000000000000000000001", 10,
+ MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 38);
+ mpfr_set_str (x, "-3.623795987425E-121243", 10, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for gamma (test 7)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ /* was producing infinite loop */
+ set_emin (emin);
+ mpfr_set_prec (x, 71);
+ mpfr_set_prec (y, 71);
+ mpfr_set_str (x, "-200000000.1", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!(mpfr_zero_p (y) && MPFR_SIGN (y) < 0))
+ {
+ printf ("Error for gamma (test 8)\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ set_emax (1073741823);
+ mpfr_set_prec (x, 29);
+ mpfr_set_prec (y, 29);
+ mpfr_set_str (x, "423786866", 10, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for gamma(423786866)\n");
+ exit (1);
+ }
+
+ /* check exact result */
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ if (inex != 0 || mpfr_cmp_ui (x, 2) != 0)
+ {
+ printf ("Error for gamma(3)\n");
+ exit (1);
+ }
+
+ mpfr_set_emax (1024);
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "101010110100110011111010000110001000111100000110101E-43");
+ mpfr_gamma (x, x, MPFR_RNDU);
+ mpfr_set_str_binary (y, "110000011110001000111110110101011110000100001111111E971");
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for gamma(4)\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ set_emin (emin);
+ set_emax (emax);
+
+ /* bug found by Kevin Rauch, 26 Oct 2007 */
+ mpfr_set_str (x, "1e19", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && inex > 0);
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+/* test gamma on some integral values (from Christopher Creutzig). */
+static void
+gamma_integer (void)
+{
+ mpz_t n;
+ mpfr_t x, y;
+ unsigned int i;
+
+ mpz_init (n);
+ mpfr_init2 (x, 149);
+ mpfr_init2 (y, 149);
+
+ for (i = 0; i < 100; i++)
+ {
+ mpz_fac_ui (n, i);
+ mpfr_set_ui (x, i+1, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_set_z (x, n, MPFR_RNDN);
+ if (!mpfr_equal_p (x, y))
+ {
+ printf ("Error for gamma(%u)\n", i+1);
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+ }
+ mpfr_clear (y);
+ mpfr_clear (x);
+ mpz_clear (n);
+}
+
+/* bug found by Kevin Rauch */
+static void
+test20071231 (void)
+{
+ mpfr_t x;
+ int inex;
+ mpfr_exp_t emin;
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (-1000000);
+
+ mpfr_init2 (x, 21);
+ mpfr_set_str (x, "-1000001.5", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_POS(x) && inex < 0);
+ mpfr_clear (x);
+
+ mpfr_set_emin (emin);
+
+ mpfr_init2 (x, 53);
+ mpfr_set_str (x, "-1000000001.5", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_POS(x) && inex < 0);
+ mpfr_clear (x);
+}
+
+/* bug found by Stathis in mpfr_gamma, only occurs on 32-bit machines;
+ the second test is for 64-bit machines. This bug reappeared due to
+ r8159. */
+static void
+test20100709 (void)
+{
+ mpfr_t x, y, z;
+ int sign;
+ int inex;
+ mpfr_exp_t emin;
+
+ mpfr_init2 (x, 100);
+ mpfr_init2 (y, 32);
+ mpfr_init2 (z, 32);
+ mpfr_set_str (x, "-4.6308260837372266e+07", 10, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_nextabove (y);
+ mpfr_log (y, y, MPFR_RNDD);
+ mpfr_const_log2 (z, MPFR_RNDU);
+ mpfr_sub (y, y, z, MPFR_RNDD); /* log(MIN/2) = log(MIN) - log(2) */
+ mpfr_lgamma (z, &sign, x, MPFR_RNDU);
+ MPFR_ASSERTN (sign == -1);
+ MPFR_ASSERTN (mpfr_less_p (z, y)); /* thus underflow */
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO(x) && MPFR_IS_NEG(x) && inex > 0);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ /* Similar test for 64-bit machines (also valid with a 32-bit exponent,
+ but will not trigger the bug). */
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (MPFR_EMIN_MIN);
+ mpfr_init2 (x, 100);
+ mpfr_init2 (y, 32);
+ mpfr_init2 (z, 32);
+ mpfr_set_str (x, "-90.6308260837372266e+15", 10, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_nextabove (y);
+ mpfr_log (y, y, MPFR_RNDD);
+ mpfr_const_log2 (z, MPFR_RNDU);
+ mpfr_sub (y, y, z, MPFR_RNDD); /* log(MIN/2) = log(MIN) - log(2) */
+ mpfr_lgamma (z, &sign, x, MPFR_RNDU);
+ MPFR_ASSERTN (sign == -1);
+ MPFR_ASSERTN (mpfr_less_p (z, y)); /* thus underflow */
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO(x) && MPFR_IS_NEG(x) && inex > 0);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_set_emin (emin);
+}
+
+/* bug found by Giridhar Tammana */
+static void
+test20120426 (void)
+{
+ mpfr_t xa, xb;
+ int i;
+ mpfr_exp_t emin;
+
+ mpfr_init2 (xa, 53);
+ mpfr_init2 (xb, 53);
+ mpfr_set_d (xb, -168.5, MPFR_RNDN);
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (-1073);
+ i = mpfr_gamma (xa, xb, MPFR_RNDN);
+ i = mpfr_subnormalize (xa, i, MPFR_RNDN); /* new ternary value */
+ mpfr_set_str (xb, "-9.5737343987585366746184749943e-304", 10, MPFR_RNDN);
+ if (!((i > 0) && (mpfr_cmp (xa, xb) == 0)))
+ {
+ printf ("Error in test20120426, i=%d\n", i);
+ printf ("expected ");
+ mpfr_print_binary (xb); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (xa); putchar ('\n');
+ exit (1);
+ }
+ mpfr_set_emin (emin);
+ mpfr_clear (xa);
+ mpfr_clear (xb);
+}
+
+static void
+exprange (void)
+{
+ mpfr_exp_t emin, emax;
+ mpfr_t x, y, z;
+ int inex1, inex2;
+ unsigned int flags1, flags2;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 16);
+ mpfr_inits2 (8, y, z, (mpfr_ptr) 0);
+
+ mpfr_set_ui_2exp (x, 5, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex1 = mpfr_gamma (y, x, MPFR_RNDN);
+ flags1 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emin (0);
+ mpfr_clear_flags ();
+ inex2 = mpfr_gamma (z, x, MPFR_RNDN);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emin (emin);
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test1)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_set_ui_2exp (x, 32769, -60, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex1 = mpfr_gamma (y, x, MPFR_RNDD);
+ flags1 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emax (45);
+ mpfr_clear_flags ();
+ inex2 = mpfr_gamma (z, x, MPFR_RNDD);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emax (emax);
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test2)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_set_emax (44);
+ mpfr_clear_flags ();
+ inex1 = mpfr_check_range (y, inex1, MPFR_RNDD);
+ flags1 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_clear_flags ();
+ inex2 = mpfr_gamma (z, x, MPFR_RNDD);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emax (emax);
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test3)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_set_ui_2exp (x, 1, -60, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex1 = mpfr_gamma (y, x, MPFR_RNDD);
+ flags1 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emax (60);
+ mpfr_clear_flags ();
+ inex2 = mpfr_gamma (z, x, MPFR_RNDD);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ mpfr_set_emax (emax);
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test4)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ MPFR_ASSERTN (MPFR_EMIN_MIN == - MPFR_EMAX_MAX);
+ mpfr_set_emin (MPFR_EMIN_MIN);
+ mpfr_set_emax (MPFR_EMAX_MAX);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_nextabove (x); /* x = 2^(emin - 1) */
+ mpfr_set_inf (y, 1);
+ inex1 = 1;
+ flags1 = MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW;
+ mpfr_clear_flags ();
+ /* MPFR_RNDU: overflow, infinity since 1/x = 2^(emax + 1) */
+ inex2 = mpfr_gamma (z, x, MPFR_RNDU);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test5)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+ mpfr_clear_flags ();
+ /* MPFR_RNDN: overflow, infinity since 1/x = 2^(emax + 1) */
+ inex2 = mpfr_gamma (z, x, MPFR_RNDN);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test6)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+ mpfr_nextbelow (y);
+ inex1 = -1;
+ mpfr_clear_flags ();
+ /* MPFR_RNDD: overflow, maxnum since 1/x = 2^(emax + 1) */
+ inex2 = mpfr_gamma (z, x, MPFR_RNDD);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test7)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+ mpfr_mul_2ui (x, x, 1, MPFR_RNDN); /* x = 2^emin */
+ mpfr_set_inf (y, 1);
+ inex1 = 1;
+ flags1 = MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW;
+ mpfr_clear_flags ();
+ /* MPFR_RNDU: overflow, infinity since 1/x = 2^emax */
+ inex2 = mpfr_gamma (z, x, MPFR_RNDU);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test8)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+ mpfr_clear_flags ();
+ /* MPFR_RNDN: overflow, infinity since 1/x = 2^emax */
+ inex2 = mpfr_gamma (z, x, MPFR_RNDN);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test9)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+ mpfr_nextbelow (y);
+ inex1 = -1;
+ flags1 = MPFR_FLAGS_INEXACT;
+ mpfr_clear_flags ();
+ /* MPFR_RNDD: no overflow, maxnum since 1/x = 2^emax and euler > 0 */
+ inex2 = mpfr_gamma (z, x, MPFR_RNDD);
+ flags2 = __gmpfr_flags;
+ MPFR_ASSERTN (mpfr_inexflag_p ());
+ if (inex1 != inex2 || flags1 != flags2 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in exprange (test10)\n");
+ printf ("x = ");
+ mpfr_dump (x);
+ printf ("Expected inex1 = %d, flags1 = %u, ", SIGN (inex1), flags1);
+ mpfr_dump (y);
+ printf ("Got inex2 = %d, flags2 = %u, ", SIGN (inex2), flags2);
+ mpfr_dump (z);
+ exit (1);
+ }
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static int
+tiny_aux (int stop, mpfr_exp_t e)
+{
+ mpfr_t x, y, z;
+ int r, s, spm, inex, err = 0;
+ int expected_dir[2][5] = { { 1, -1, 1, -1, 1 }, { 1, 1, 1, -1, -1 } };
+ mpfr_exp_t saved_emax;
+
+ saved_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 32);
+ mpfr_inits2 (8, y, z, (mpfr_ptr) 0);
+
+ mpfr_set_ui_2exp (x, 1, e, MPFR_RNDN);
+ spm = 1;
+ for (s = 0; s < 2; s++)
+ {
+ RND_LOOP(r)
+ {
+ mpfr_rnd_t rr = (mpfr_rnd_t) r;
+ mpfr_exp_t exponent, emax;
+
+ /* Exponent of the rounded value in unbounded exponent range. */
+ exponent = expected_dir[s][r] < 0 && s == 0 ? - e : 1 - e;
+
+ for (emax = exponent - 1; emax <= exponent; emax++)
+ {
+ unsigned int flags, expected_flags = MPFR_FLAGS_INEXACT;
+ int overflow, expected_inex = expected_dir[s][r];
+
+ if (emax > MPFR_EMAX_MAX)
+ break;
+ mpfr_set_emax (emax);
+
+ mpfr_clear_flags ();
+ inex = mpfr_gamma (y, x, rr);
+ flags = __gmpfr_flags;
+ mpfr_clear_flags ();
+ mpfr_set_si_2exp (z, spm, - e, MPFR_RNDU);
+ overflow = mpfr_overflow_p ();
+ /* z is 1/x - euler rounded toward +inf */
+
+ if (overflow && rr == MPFR_RNDN && s == 1)
+ expected_inex = -1;
+
+ if (expected_inex < 0)
+ mpfr_nextbelow (z); /* 1/x - euler rounded toward -inf */
+
+ if (exponent > emax)
+ expected_flags |= MPFR_FLAGS_OVERFLOW;
+
+ if (!(mpfr_equal_p (y, z) && flags == expected_flags
+ && SAME_SIGN (inex, expected_inex)))
+ {
+ printf ("Error in tiny for s = %d, r = %s, emax = %"
+ MPFR_EXP_FSPEC "d%s\n on ",
+ s, mpfr_print_rnd_mode (rr), emax,
+ exponent > emax ? " (overflow)" : "");
+ mpfr_dump (x);
+ printf (" expected inex = %2d, ", expected_inex);
+ mpfr_dump (z);
+ printf (" got inex = %2d, ", SIGN (inex));
+ mpfr_dump (y);
+ printf (" expected flags = %u, got %u\n",
+ expected_flags, flags);
+ if (stop)
+ exit (1);
+ err = 1;
+ }
+ }
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ spm = - spm;
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+ mpfr_set_emax (saved_emax);
+ return err;
+}
+
+static void
+tiny (int stop)
+{
+ mpfr_exp_t emin;
+ int err = 0;
+
+ emin = mpfr_get_emin ();
+
+ /* Note: in r7499, exponent -17 will select the generic code (in
+ tiny_aux, x has precision 32), while the other exponent values
+ will select special code for tiny values. */
+ err |= tiny_aux (stop, -17);
+ err |= tiny_aux (stop, -999);
+ err |= tiny_aux (stop, mpfr_get_emin ());
+
+ if (emin != MPFR_EMIN_MIN)
+ {
+ mpfr_set_emin (MPFR_EMIN_MIN);
+ err |= tiny_aux (stop, MPFR_EMIN_MIN);
+ mpfr_set_emin (emin);
+ }
+
+ if (err)
+ exit (1);
+}
+
+/* Test mpfr_gamma in precision p1 by comparing it with exp(lgamma(x))
+ computing with a working precision p2. Assume that x is not an
+ integer <= 2. */
+static void
+exp_lgamma (mpfr_t x, mpfr_prec_t p1, mpfr_prec_t p2)
+{
+ mpfr_t yd, yu, zd, zu;
+ int inexd, inexu, sign;
+ int underflow = -1, overflow = -1; /* -1: we don't know */
+ int got_underflow, got_overflow;
+
+ if (mpfr_integer_p (x) && mpfr_cmp_si (x, 2) <= 0)
+ {
+ printf ("Warning! x is an integer <= 2 in exp_lgamma: ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ return;
+ }
+ mpfr_inits2 (p2, yd, yu, (mpfr_ptr) 0);
+ inexd = mpfr_lgamma (yd, &sign, x, MPFR_RNDD);
+ mpfr_set (yu, yd, MPFR_RNDN); /* exact */
+ if (inexd)
+ mpfr_nextabove (yu);
+ mpfr_clear_flags ();
+ mpfr_exp (yd, yd, MPFR_RNDD);
+ if (! mpfr_underflow_p ())
+ underflow = 0;
+ if (mpfr_overflow_p ())
+ overflow = 1;
+ mpfr_clear_flags ();
+ mpfr_exp (yu, yu, MPFR_RNDU);
+ if (mpfr_underflow_p ())
+ underflow = 1;
+ if (! mpfr_overflow_p ())
+ overflow = 0;
+ if (sign < 0)
+ {
+ mpfr_neg (yd, yd, MPFR_RNDN); /* exact */
+ mpfr_neg (yu, yu, MPFR_RNDN); /* exact */
+ mpfr_swap (yd, yu);
+ }
+ /* yd < Gamma(x) < yu (strict inequalities since x != 1 and x != 2) */
+ mpfr_inits2 (p1, zd, zu, (mpfr_ptr) 0);
+ mpfr_clear_flags ();
+ inexd = mpfr_gamma (zd, x, MPFR_RNDD); /* zd <= Gamma(x) < yu */
+ got_underflow = underflow == -1 ? -1 : !! mpfr_underflow_p ();
+ got_overflow = overflow == -1 ? -1 : !! mpfr_overflow_p ();
+ if (! mpfr_less_p (zd, yu) || inexd > 0 ||
+ got_underflow != underflow ||
+ got_overflow != overflow)
+ {
+ printf ("Error in exp_lgamma on x = ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ printf ("yu = ");
+ mpfr_dump (yu);
+ printf ("zd = ");
+ mpfr_dump (zd);
+ printf ("got inexd = %d, expected <= 0\n", inexd);
+ printf ("got underflow = %d, expected %d\n", got_underflow, underflow);
+ printf ("got overflow = %d, expected %d\n", got_overflow, overflow);
+ exit (1);
+ }
+ mpfr_clear_flags ();
+ inexu = mpfr_gamma (zu, x, MPFR_RNDU); /* zu >= Gamma(x) > yd */
+ got_underflow = underflow == -1 ? -1 : !! mpfr_underflow_p ();
+ got_overflow = overflow == -1 ? -1 : !! mpfr_overflow_p ();
+ if (! mpfr_greater_p (zu, yd) || inexu < 0 ||
+ got_underflow != underflow ||
+ got_overflow != overflow)
+ {
+ printf ("Error in exp_lgamma on x = ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ printf ("yd = ");
+ mpfr_dump (yd);
+ printf ("zu = ");
+ mpfr_dump (zu);
+ printf ("got inexu = %d, expected >= 0\n", inexu);
+ printf ("got underflow = %d, expected %d\n", got_underflow, underflow);
+ printf ("got overflow = %d, expected %d\n", got_overflow, overflow);
+ exit (1);
+ }
+ if (mpfr_equal_p (zd, zu))
+ {
+ if (inexd != 0 || inexu != 0)
+ {
+ printf ("Error in exp_lgamma on x = ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ printf ("zd = zu, thus exact, but inexd = %d and inexu = %d\n",
+ inexd, inexu);
+ exit (1);
+ }
+ MPFR_ASSERTN (got_underflow == 0);
+ MPFR_ASSERTN (got_overflow == 0);
+ }
+ else if (inexd == 0 || inexu == 0)
+ {
+ printf ("Error in exp_lgamma on x = ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ printf ("zd != zu, thus inexact, but inexd = %d and inexu = %d\n",
+ inexd, inexu);
+ exit (1);
+ }
+ mpfr_clears (yd, yu, zd, zu, (mpfr_ptr) 0);
+}
+
+static void
+exp_lgamma_tests (void)
+{
+ mpfr_t x;
+ mpfr_exp_t emin, emax;
+ int i;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+
+ mpfr_init2 (x, 96);
+ for (i = 3; i <= 8; i++)
+ {
+ mpfr_set_ui (x, i, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ mpfr_nextbelow (x);
+ exp_lgamma (x, 53, 64);
+ mpfr_nextabove (x);
+ mpfr_nextabove (x);
+ exp_lgamma (x, 53, 64);
+ }
+ mpfr_set_str (x, "1.7", 10, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ mpfr_set_str (x, "-4.6308260837372266e+07", 10, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ mpfr_set_str (x, "-90.6308260837372266e+15", 10, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ /* The following test gives a large positive result < +Inf */
+ mpfr_set_str (x, "1.2b13fc45a92dea1@14", 16, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ /* Idem for a large negative result > -Inf */
+ mpfr_set_str (x, "-1.2b13fc45a92de81@14", 16, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ /* The following two tests trigger an endless loop in r8186
+ on 64-bit machines (64-bit exponent). The second one (due
+ to undetected overflow) is a direct consequence of the
+ first one, due to the call of Gamma(2-x) if x < 1. */
+ mpfr_set_str (x, "1.2b13fc45a92dec8@14", 16, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ mpfr_set_str (x, "-1.2b13fc45a92dea8@14", 16, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ /* Similar tests (overflow threshold) for 32-bit machines. */
+ mpfr_set_str (x, "2ab68d8.657542f855111c61", 16, MPFR_RNDN);
+ exp_lgamma (x, 12, 64);
+ mpfr_set_str (x, "-2ab68d6.657542f855111c61", 16, MPFR_RNDN);
+ exp_lgamma (x, 12, 64);
+ /* The following test is an overflow on 32-bit and 64-bit machines.
+ Revision r8189 fails on 64-bit machines as the flag is unset. */
+ mpfr_set_str (x, "1.2b13fc45a92ded8@14", 16, MPFR_RNDN);
+ exp_lgamma (x, 53, 64);
+ /* On the following tests, with r8196, one gets an underflow on
+ 32-bit machines, while a normal result is expected (see FIXME
+ in gamma.c:382). */
+ mpfr_set_str (x, "-2ab68d6.657542f855111c6104", 16, MPFR_RNDN);
+ exp_lgamma (x, 12, 64); /* failure on 32-bit machines */
+ mpfr_set_str (x, "-12b13fc45a92deb.1c6c5bc964", 16, MPFR_RNDN);
+ exp_lgamma (x, 12, 64); /* failure on 64-bit machines */
+ mpfr_clear (x);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+ special_overflow ();
+ exprange ();
+ tiny (argc == 1);
+ test_generic (2, 100, 2);
+ gamma_integer ();
+ test20071231 ();
+ test20100709 ();
+ test20120426 ();
+ exp_lgamma_tests ();
+
+ data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
new file mode 100644
index 0000000..5787df4
--- /dev/null
+++ b/tests/tgeneric.c
@@ -0,0 +1,506 @@
+/* Generic test file for functions with one or two arguments (the second being
+ either mpfr_t or double).
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* define TWO_ARGS for two-argument functions like mpfr_pow
+ define DOUBLE_ARG1 or DOUBLE_ARG2 for function with a double operand in
+ first or second place like sub_d or d_sub */
+
+#ifndef TEST_RANDOM_POS
+/* For the random function: one number on two is negative. */
+#define TEST_RANDOM_POS 256
+#endif
+
+#ifndef TEST_RANDOM_POS2
+/* For the random function: one number on two is negative. */
+#define TEST_RANDOM_POS2 256
+#endif
+
+#ifndef TEST_RANDOM_EMIN
+#define TEST_RANDOM_EMIN -256
+#endif
+
+#ifndef TEST_RANDOM_EMAX
+#define TEST_RANDOM_EMAX 255
+#endif
+
+/* If the MPFR_SUSPICIOUS_OVERFLOW test fails but this is not a bug,
+ then define TGENERIC_SO_TEST with an adequate test (possibly 0) to
+ omit this particular case. */
+#ifndef TGENERIC_SO_TEST
+#define TGENERIC_SO_TEST 1
+#endif
+
+#define STR(F) #F
+#define MAKE_STR(S) STR(S)
+
+/* The (void *) below is needed to avoid a warning with gcc 4.2+ and functions
+ * with 2 arguments. See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299>.
+ */
+#define TGENERIC_FAIL(S, X, U) \
+ do \
+ { \
+ printf ("%s\nx = ", (S)); \
+ mpfr_out_str (stdout, 2, 0, (X), MPFR_RNDN); \
+ printf ("\n"); \
+ if ((void *) U != 0) \
+ { \
+ printf ("u = "); \
+ mpfr_out_str (stdout, 2, 0, (U), MPFR_RNDN); \
+ printf ("\n"); \
+ } \
+ printf ("yprec = %u, rnd_mode = %s, inexact = %d, flags = %u\n", \
+ (unsigned int) yprec, mpfr_print_rnd_mode (rnd), compare, \
+ (unsigned int) __gmpfr_flags); \
+ exit (1); \
+ } \
+ while (0)
+
+#define TGENERIC_CHECK_AUX(S, EXPR, U) \
+ do \
+ if (!(EXPR)) \
+ TGENERIC_FAIL (S " in " MAKE_STR(TEST_FUNCTION), x, U); \
+ while (0)
+
+#undef TGENERIC_CHECK
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+#define TGENERIC_CHECK(S, EXPR) TGENERIC_CHECK_AUX(S, EXPR, u)
+#else
+#define TGENERIC_CHECK(S, EXPR) TGENERIC_CHECK_AUX(S, EXPR, 0)
+#endif
+
+#ifdef DEBUG_TGENERIC
+#define TGENERIC_IAUX(F,P,X,U) \
+ do \
+ { \
+ printf ("tgeneric: testing function " STR(F) \
+ ", %s, target prec = %lu\nx = ", \
+ mpfr_print_rnd_mode (rnd), (unsigned long) (P)); \
+ mpfr_out_str (stdout, 2, 0, (X), MPFR_RNDN); \
+ printf ("\n"); \
+ if (U) \
+ { \
+ printf ("u = "); \
+ mpfr_out_str (stdout, 2, 0, (U), MPFR_RNDN); \
+ printf ("\n"); \
+ } \
+ } \
+ while (0)
+#undef TGENERIC_INFO
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+#define TGENERIC_INFO(F,P) TGENERIC_IAUX(F,P,x,u)
+#else
+#define TGENERIC_INFO(F,P) TGENERIC_IAUX(F,P,x,0)
+#endif
+#endif
+
+/* For some functions (for example cos), the argument reduction is too
+ expensive when using mpfr_get_emax(). Then simply define REDUCE_EMAX
+ to some reasonable value before including tgeneric.c. */
+#ifndef REDUCE_EMAX
+#define REDUCE_EMAX mpfr_get_emax ()
+#endif
+
+static void
+test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
+{
+ mpfr_prec_t prec, xprec, yprec;
+ mpfr_t x, y, z, t, w;
+#ifdef TWO_ARGS
+ mpfr_t u;
+#elif defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_t u;
+ double d;
+#endif
+ mpfr_rnd_t rnd;
+ int inexact, compare, compare2;
+ unsigned int n;
+ unsigned long ctrt = 0, ctrn = 0;
+ mpfr_exp_t old_emin, old_emax;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+
+ mpfr_inits2 (MPFR_PREC_MIN, x, y, z, t, w, (mpfr_ptr) 0);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_init2 (u, MPFR_PREC_MIN);
+#endif
+
+ /* generic test */
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+ yprec = prec + 10;
+ mpfr_set_prec (y, yprec);
+ mpfr_set_prec (w, yprec);
+
+ /* Note: in precision p1, we test 4 special cases. */
+ for (n = 0; n < (prec == p1 ? nmax + 4 : nmax); n++)
+ {
+ int infinite_input = 0;
+
+ xprec = prec;
+ if (randlimb () & 1)
+ {
+ xprec *= (double) randlimb () / MP_LIMB_T_MAX;
+ if (xprec < MPFR_PREC_MIN)
+ xprec = MPFR_PREC_MIN;
+ }
+ mpfr_set_prec (x, xprec);
+#ifdef TWO_ARGS
+ mpfr_set_prec (u, xprec);
+#elif defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_set_prec (u, IEEE_DBL_MANT_DIG);
+#endif
+
+ if (n > 3 || prec < p1)
+ {
+#if defined(RAND_FUNCTION)
+ RAND_FUNCTION (x);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ RAND_FUNCTION (u);
+#endif
+#else
+ tests_default_random (x, TEST_RANDOM_POS,
+ TEST_RANDOM_EMIN, TEST_RANDOM_EMAX);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ tests_default_random (u, TEST_RANDOM_POS2,
+ TEST_RANDOM_EMIN, TEST_RANDOM_EMAX);
+#endif
+#endif
+ }
+ else
+ {
+ /* Special cases tested in precision p1 if n <= 3. They are
+ useful really in the extended exponent range. */
+#if (defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)) && defined(MPFR_ERRDIVZERO)
+ goto next_n;
+#endif
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+ if (n <= 1)
+ {
+ mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin ());
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_set_exp (u, mpfr_get_emin ());
+#endif
+ }
+ else /* 2 <= n <= 3 */
+ {
+ if (getenv ("MPFR_CHECK_MAX") == NULL)
+ goto next_n;
+ mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_setmax (x, REDUCE_EMAX);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_set_si (u, randlimb () % 2 == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_setmax (u, mpfr_get_emax ());
+#endif
+ }
+ }
+
+ rnd = RND_RAND ();
+ mpfr_clear_flags ();
+#ifdef DEBUG_TGENERIC
+ TGENERIC_INFO (TEST_FUNCTION, MPFR_PREC (y));
+#endif
+#if defined(TWO_ARGS)
+ compare = TEST_FUNCTION (y, x, u, rnd);
+#elif defined(DOUBLE_ARG1)
+ d = mpfr_get_d (u, rnd);
+ compare = TEST_FUNCTION (y, d, x, rnd);
+ /* d can be infinite due to overflow in mpfr_get_d */
+ infinite_input |= DOUBLE_ISINF (d);
+#elif defined(DOUBLE_ARG2)
+ d = mpfr_get_d (u, rnd);
+ compare = TEST_FUNCTION (y, x, d, rnd);
+ /* d can be infinite due to overflow in mpfr_get_d */
+ infinite_input |= DOUBLE_ISINF (d);
+#else
+ compare = TEST_FUNCTION (y, x, rnd);
+#endif
+ TGENERIC_CHECK ("Bad inexact flag",
+ (compare != 0) ^ (mpfr_inexflag_p () == 0));
+ ctrt++;
+ /* Consistency test in a reduced exponent range. Doing it
+ for the first 10 samples and for prec == p1 (which has
+ some special cases) should be sufficient. */
+ if (ctrt <= 10 || prec == p1)
+ {
+ unsigned int flags, oldflags = __gmpfr_flags;
+ mpfr_exp_t e, emin, emax, oemin, oemax;
+
+ /* Determine the smallest exponent range containing the
+ exponents of the mpfr_t inputs (x, and u if TWO_ARGS)
+ and output (y). */
+ emin = MPFR_EMAX_MAX;
+ emax = MPFR_EMIN_MIN;
+ if (MPFR_IS_PURE_FP (x))
+ {
+ e = MPFR_GET_EXP (x);
+ if (e < emin)
+ emin = e;
+ if (e > emax)
+ emax = e;
+ }
+ if (MPFR_IS_PURE_FP (y))
+ {
+ e = MPFR_GET_EXP (y);
+ if (e < emin)
+ emin = e;
+ if (e > emax)
+ emax = e;
+ }
+#if defined(TWO_ARGS)
+ if (MPFR_IS_PURE_FP (u))
+ {
+ e = MPFR_GET_EXP (u);
+ if (e < emin)
+ emin = e;
+ if (e > emax)
+ emax = e;
+ }
+#endif
+ if (emin > emax)
+ emin = emax; /* case where all values are singular */
+ oemin = mpfr_get_emin ();
+ oemax = mpfr_get_emax ();
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+#ifdef DEBUG_TGENERIC
+ /* Useful information in case of assertion failure. */
+ printf ("tgeneric: reduced exponent range [%"
+ MPFR_EXP_FSPEC "d,%" MPFR_EXP_FSPEC "d]\n",
+ (mpfr_eexp_t) emin, (mpfr_eexp_t) emax);
+#endif
+ mpfr_clear_flags ();
+#if defined(TWO_ARGS)
+ inexact = TEST_FUNCTION (w, x, u, rnd);
+#elif defined(DOUBLE_ARG1)
+ inexact = TEST_FUNCTION (w, d, x, rnd);
+#elif defined(DOUBLE_ARG2)
+ inexact = TEST_FUNCTION (w, x, d, rnd);
+#else
+ inexact = TEST_FUNCTION (w, x, rnd);
+#endif
+ flags = __gmpfr_flags;
+ mpfr_set_emin (oemin);
+ mpfr_set_emax (oemax);
+ if (! (SAME_VAL (w, y) &&
+ SAME_SIGN (inexact, compare) &&
+ flags == oldflags))
+ {
+ printf ("Error in " MAKE_STR(TEST_FUNCTION)
+ ", reduced exponent range [%"
+ MPFR_EXP_FSPEC "d,%" MPFR_EXP_FSPEC "d] on:\n",
+ (mpfr_eexp_t) emin, (mpfr_eexp_t) emax);
+ printf ("x = ");
+ mpfr_dump (x);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ printf ("u = ");
+ mpfr_dump (u);
+#endif
+ printf ("yprec = %u, rnd_mode = %s\n",
+ (unsigned int) yprec, mpfr_print_rnd_mode (rnd));
+ printf ("Expected:\n y = ");
+ mpfr_dump (y);
+ printf (" inex = %d, flags = %u\n",
+ SIGN (compare), oldflags);
+ printf ("Got:\n w = ");
+ mpfr_dump (w);
+ printf (" inex = %d, flags = %u\n",
+ SIGN (inexact), flags);
+ exit (1);
+ }
+ }
+ if (MPFR_IS_SINGULAR (y))
+ {
+ if (MPFR_IS_NAN (y) || mpfr_nanflag_p ())
+ TGENERIC_CHECK ("Bad NaN flag",
+ MPFR_IS_NAN (y) && mpfr_nanflag_p ());
+ else if (MPFR_IS_INF (y))
+ {
+ TGENERIC_CHECK ("Bad overflow flag",
+ (compare != 0) ^ (mpfr_overflow_p () == 0));
+ TGENERIC_CHECK ("Bad divide-by-zero flag",
+ (compare == 0 && !infinite_input) ^
+ (mpfr_divby0_p () == 0));
+ }
+ else if (MPFR_IS_ZERO (y))
+ TGENERIC_CHECK ("Bad underflow flag",
+ (compare != 0) ^ (mpfr_underflow_p () == 0));
+ }
+ else if (mpfr_divby0_p ())
+ {
+ TGENERIC_CHECK ("Both overflow and divide-by-zero",
+ ! mpfr_overflow_p ());
+ TGENERIC_CHECK ("Both underflow and divide-by-zero",
+ ! mpfr_underflow_p ());
+ TGENERIC_CHECK ("Bad compare value (divide-by-zero)",
+ compare == 0);
+ }
+ else if (mpfr_overflow_p ())
+ {
+ TGENERIC_CHECK ("Both underflow and overflow",
+ ! mpfr_underflow_p ());
+ TGENERIC_CHECK ("Bad compare value (overflow)", compare != 0);
+ mpfr_nexttoinf (y);
+ TGENERIC_CHECK ("Should have been max MPFR number",
+ MPFR_IS_INF (y));
+ }
+ else if (mpfr_underflow_p ())
+ {
+ TGENERIC_CHECK ("Bad compare value (underflow)", compare != 0);
+ mpfr_nexttozero (y);
+ TGENERIC_CHECK ("Should have been min MPFR number",
+ MPFR_IS_ZERO (y));
+ }
+ else if (mpfr_can_round (y, yprec, rnd, rnd, prec))
+ {
+ ctrn++;
+ mpfr_set (t, y, rnd);
+ /* Risk of failures are known when some flags are already set
+ before the function call. Do not set the erange flag, as
+ it will remain set after the function call and no checks
+ are performed in such a case (see the mpfr_erangeflag_p
+ test below). */
+ if (randlimb () & 1)
+ __gmpfr_flags = MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE;
+#ifdef DEBUG_TGENERIC
+ TGENERIC_INFO (TEST_FUNCTION, MPFR_PREC (z));
+#endif
+ /* Let's increase the precision of the inputs in a random way.
+ In most cases, this doesn't make any difference, but for
+ the mpfr_fmod bug fixed in r6230, this triggers the bug. */
+ mpfr_prec_round (x, mpfr_get_prec (x) + (randlimb () & 15),
+ MPFR_RNDN);
+#if defined(TWO_ARGS)
+ mpfr_prec_round (u, mpfr_get_prec (u) + (randlimb () & 15),
+ MPFR_RNDN);
+ inexact = TEST_FUNCTION (z, x, u, rnd);
+#elif defined(DOUBLE_ARG1)
+ inexact = TEST_FUNCTION (z, d, x, rnd);
+#elif defined(DOUBLE_ARG2)
+ inexact = TEST_FUNCTION (z, x, d, rnd);
+#else
+ inexact = TEST_FUNCTION (z, x, rnd);
+#endif
+ if (mpfr_erangeflag_p ())
+ goto next_n;
+ if (mpfr_nan_p (z) || mpfr_cmp (t, z) != 0)
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, xprec, x, MPFR_RNDN);
+#ifdef TWO_ARGS
+ printf ("\nu=");
+ mpfr_out_str (stdout, 2, xprec, u, MPFR_RNDN);
+#elif defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ printf ("\nu=");
+ mpfr_out_str (stdout, 2, IEEE_DBL_MANT_DIG, u, MPFR_RNDN);
+#endif
+ printf (" prec=%u rnd_mode=%s\n", (unsigned) prec,
+ mpfr_print_rnd_mode (rnd));
+ printf ("got ");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ puts ("");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf ("approx ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ compare2 = mpfr_cmp (t, y);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if (compare * compare2 >= 0)
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d"
+ "\n", mpfr_print_rnd_mode (rnd), compare, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ printf ("u="); mpfr_print_binary (u); puts ("");
+#endif
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
+ exit (1);
+ }
+ }
+ else if (getenv ("MPFR_SUSPICIOUS_OVERFLOW") != NULL)
+ {
+ /* For developers only! */
+ MPFR_ASSERTN (MPFR_IS_PURE_FP (y));
+ mpfr_nexttoinf (y);
+ if (MPFR_IS_INF (y) && MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG (y))
+ && !mpfr_overflow_p () && TGENERIC_SO_TEST)
+ {
+ printf ("Possible bug! |y| is the maximum finite number "
+ "and has been obtained when\nrounding toward zero"
+ " (%s). Thus there is a very probable overflow,\n"
+ "but the overflow flag is not set!\n",
+ mpfr_print_rnd_mode (rnd));
+ printf ("x="); mpfr_print_binary (x); puts ("");
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ printf ("u="); mpfr_print_binary (u); puts ("");
+#endif
+ exit (1);
+ }
+ }
+
+ next_n:
+ /* In case the exponent range has been changed by
+ tests_default_random() or for special values... */
+ mpfr_set_emin (old_emin);
+ mpfr_set_emax (old_emax);
+ }
+ }
+
+#ifndef TGENERIC_NOWARNING
+ if (3 * ctrn < 2 * ctrt)
+ printf ("Warning! Too few normal cases in generic tests (%lu / %lu)\n",
+ ctrn, ctrt);
+#endif
+
+ mpfr_clears (x, y, z, t, w, (mpfr_ptr) 0);
+#if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2)
+ mpfr_clear (u);
+#endif
+}
+
+#undef TEST_RANDOM_POS
+#undef TEST_RANDOM_POS2
+#undef TEST_RANDOM_EMIN
+#undef TEST_RANDOM_EMAX
+#undef RAND_FUNCTION
+#undef TWO_ARGS
+#undef TWO_ARGS_UI
+#undef TEST_FUNCTION
+#undef test_generic
diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c
new file mode 100644
index 0000000..22b6170
--- /dev/null
+++ b/tests/tgeneric_ui.c
@@ -0,0 +1,130 @@
+/* Generic test file for functions with one mpfr_t argument and an integer.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* define INTEGER_TYPE to what we want */
+#ifndef INTEGER_TYPE
+# define INTEGER_TYPE mp_limb_t
+#endif
+#ifndef RAND_FUNCTION
+# define RAND_FUNCTION(x) mpfr_urandomb ((x), RANDS)
+#endif
+#ifndef INT_RAND_FUNCTION
+# define INT_RAND_FUNCTION() (INTEGER_TYPE) randlimb ()
+#endif
+
+static void
+test_generic_ui (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N)
+{
+ mpfr_prec_t prec, yprec;
+ mpfr_t x, y, z, t;
+ INTEGER_TYPE u;
+ mpfr_rnd_t rnd;
+ int inexact, compare, compare2;
+ unsigned int n;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+
+ /* generic test */
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+ yprec = prec + 10;
+
+ for (n = 0; n <= N; n++)
+ {
+ if (n > 1 || prec < p1)
+ RAND_FUNCTION (x);
+ else
+ {
+ /* Special cases tested in precision p1 if n <= 1. */
+ mpfr_set_si (x, n == 0 ? 1 : -1, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin ());
+ }
+ u = INT_RAND_FUNCTION ();
+ rnd = RND_RAND ();
+ mpfr_set_prec (y, yprec);
+ compare = TEST_FUNCTION (y, x, u, rnd);
+ if (mpfr_can_round (y, yprec, rnd, rnd, prec))
+ {
+ mpfr_set (t, y, rnd);
+ inexact = TEST_FUNCTION (z, x, u, rnd);
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
+ printf ("\nu=%lu", (unsigned long) u);
+ printf (" prec=%lu rnd_mode=%s\n",
+ (unsigned long ) prec, mpfr_print_rnd_mode (rnd));
+#ifdef TEST_FUNCTION_NAME
+ printf ("Function: %s\n", TEST_FUNCTION_NAME);
+#endif
+ printf ("got ");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ puts ("");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf ("approx ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ compare2 = mpfr_cmp (t, y);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if (compare * compare2 >= 0)
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d"
+ "\n", mpfr_print_rnd_mode (rnd), compare, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("u=%lu", (unsigned long) u);
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+#undef RAND_FUNCTION
+#undef INTEGER_TYPE
+#undef TEST_FUNCTION
+#undef TEST_FUNCTION_NAME
+#undef test_generic_ui
+#undef INT_RAND_FUNCTION
diff --git a/tests/tget_d.c b/tests/tget_d.c
new file mode 100644
index 0000000..25cac5f
--- /dev/null
+++ b/tests/tget_d.c
@@ -0,0 +1,294 @@
+/* Test file for mpfr_get_d
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+#include "ieee_floats.h"
+
+static int
+check_denorms (void)
+{
+ mpfr_rnd_t rnd_mode;
+ mpfr_t x;
+ double d, d2, dd, f;
+ int fail = 0, k, n;
+
+ mpfr_init2 (x, GMP_NUMB_BITS);
+
+ rnd_mode = MPFR_RNDN;
+ for (k = -17; k <= 17; k += 2)
+ {
+ d = (double) k * DBL_MIN; /* k * 2^(-1022) */
+ f = 1.0;
+ mpfr_set_si (x, k, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1022, MPFR_RNDN); /* k * 2^(-1022) */
+ for (n = 0; n <= 58; n++)
+ {
+ d2 = d * f;
+ dd = mpfr_get_d (x, rnd_mode);
+ if (d2 != dd) /* should be k * 2^(-1022-n) for n < 53 */
+ {
+ printf ("Wrong result for %d * 2^(%d), rnd_mode %d\n",
+ k, -1022-n, rnd_mode);
+ printf ("got %.20e instead of %.20e\n", dd, d2);
+ fail = 1;
+ }
+ f *= 0.5;
+ mpfr_div_2exp (x, x, 1, MPFR_RNDN);
+ }
+ }
+
+ mpfr_set_str_binary (x, "1e-1074");
+ dd = mpfr_get_d (x, MPFR_RNDA);
+ d2 = DBL_MIN; /* 2^(-1022) */
+ for (k = 0; k < 52; k++)
+ d2 *= 0.5; /* 2^(-1074) */
+ /* we first check that d2 is not zero (it could happen on a platform with
+ no subnormals) */
+ if (d2 != 0.0 && dd != d2)
+ {
+ printf ("Error for x=1e-1074, RNDA\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "1e-1075");
+ dd = mpfr_get_d (x, MPFR_RNDA);
+ if (d2 != 0.0 && dd != d2)
+ {
+ printf ("Error for x=1e-1075, RNDA\n");
+ printf ("expected %.16e\n", d2);
+ printf ("got %.16e\n", dd);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ return fail;
+}
+
+static void
+check_inf_nan (void)
+{
+ /* only if nans and infs are available */
+#if _GMP_IEEE_FLOATS && !defined(MPFR_ERRDIVZERO)
+ mpfr_t x;
+ double d;
+
+ mpfr_init2 (x, 123);
+
+ mpfr_set_inf (x, 1);
+ d = mpfr_get_d (x, MPFR_RNDZ);
+ ASSERT_ALWAYS (d > 0);
+ ASSERT_ALWAYS (DOUBLE_ISINF (d));
+
+ mpfr_set_inf (x, -1);
+ d = mpfr_get_d (x, MPFR_RNDZ);
+ ASSERT_ALWAYS (d < 0);
+ ASSERT_ALWAYS (DOUBLE_ISINF (d));
+
+ mpfr_set_nan (x);
+ d = mpfr_get_d (x, MPFR_RNDZ);
+ ASSERT_ALWAYS (DOUBLE_ISNAN (d));
+
+ mpfr_clear (x);
+#endif
+}
+
+static void
+check_max (void)
+{
+ double d, e;
+ mpfr_t u;
+
+ d = 1.0;
+ while (d < (DBL_MAX / 2.0))
+ d += d;
+ mpfr_init (u);
+ if (mpfr_set_d (u, d, MPFR_RNDN) == 0)
+ {
+ /* If setting is exact */
+ e = (mpfr_get_d1) (u);
+ if (e != d)
+ {
+ printf ("get_d(set_d)(1): %1.20e != %1.20e\n", d, e);
+ exit (1);
+ }
+ }
+
+ mpfr_set_str_binary (u, "-1E1024");
+ d = mpfr_get_d (u, MPFR_RNDZ);
+ MPFR_ASSERTN(d == -DBL_MAX);
+ d = mpfr_get_d (u, MPFR_RNDU);
+ MPFR_ASSERTN(d == -DBL_MAX);
+#if _GMP_IEEE_FLOATS && !defined(MPFR_ERRDIVZERO)
+ d = mpfr_get_d (u, MPFR_RNDN);
+ MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0);
+ d = mpfr_get_d (u, MPFR_RNDD);
+ MPFR_ASSERTN(DOUBLE_ISINF(d) && d < 0.0);
+#endif
+
+ mpfr_set_str_binary (u, "1E1024");
+ d = mpfr_get_d (u, MPFR_RNDZ);
+ MPFR_ASSERTN(d == DBL_MAX);
+ d = mpfr_get_d (u, MPFR_RNDD);
+ MPFR_ASSERTN(d == DBL_MAX);
+#if _GMP_IEEE_FLOATS && !defined(MPFR_ERRDIVZERO)
+ d = mpfr_get_d (u, MPFR_RNDN);
+ MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0);
+ d = mpfr_get_d (u, MPFR_RNDU);
+ MPFR_ASSERTN(DOUBLE_ISINF(d) && d > 0.0);
+#endif
+
+ mpfr_clear (u);
+}
+
+static void
+check_min(void)
+{
+ double d, e;
+ mpfr_t u;
+
+ d = 1.0; while (d > (DBL_MIN * 2.0)) d /= 2.0;
+ mpfr_init(u);
+ if (mpfr_set_d(u, d, MPFR_RNDN) == 0)
+ {
+ /* If setting is exact */
+ e = mpfr_get_d1(u);
+ if (e != d)
+ {
+ printf("get_d(set_d)(2): %1.20e != %1.20e\n", d, e);
+ exit(1);
+ }
+ }
+ mpfr_clear(u);
+}
+
+static void
+check_get_d_2exp_inf_nan (void)
+{
+ double var_d;
+ long exp;
+ mpfr_t var;
+
+#if !defined(MPFR_ERRDIVZERO)
+
+ mpfr_init2 (var, MPFR_PREC_MIN);
+
+ mpfr_set_nan (var);
+ var_d = mpfr_get_d_2exp (&exp, var, MPFR_RNDN);
+ if (!DOUBLE_ISNAN (var_d))
+ {
+ printf ("mpfr_get_d_2exp with a NAN mpfr value returned a wrong value :\n"
+ " waiting for %g got %g\n", MPFR_DBL_NAN, var_d);
+ exit (1);
+ }
+
+ mpfr_set_zero (var, 1);
+ var_d = mpfr_get_d_2exp (&exp, var, MPFR_RNDN);
+ if ((exp != 0) || (var_d != 0.0))
+ {
+ printf ("mpfr_get_d_2exp with a +0.0 mpfr value returned a wrong value :\n"
+ " double waiting for 0.0 got %g\n exp waiting for 0 got %ld\n",
+ var_d, exp);
+ exit (1);
+ }
+
+ mpfr_set_zero (var, -1);
+ var_d = mpfr_get_d_2exp (&exp, var, MPFR_RNDN);
+ if ((exp != 0) || (var_d != DBL_NEG_ZERO))
+ {
+ printf ("mpfr_get_d_2exp with a +0.0 mpfr value returned a wrong value :\n"
+ " double waiting for %g got %g\n exp waiting for 0 got %ld\n",
+ DBL_NEG_ZERO, var_d, exp);
+ exit (1);
+ }
+
+ mpfr_set_inf (var, 1);
+ var_d = mpfr_get_d_2exp (&exp, var, MPFR_RNDN);
+ if (var_d != MPFR_DBL_INFP)
+ {
+ printf ("mpfr_get_d_2exp with a +Inf mpfr value returned a wrong value :\n"
+ " waiting for %g got %g\n", MPFR_DBL_INFP, var_d);
+ exit (1);
+ }
+
+ mpfr_set_inf (var, -1);
+ var_d = mpfr_get_d_2exp (&exp, var, MPFR_RNDN);
+ if (var_d != MPFR_DBL_INFM)
+ {
+ printf ("mpfr_get_d_2exp with a -Inf mpfr value returned a wrong value :\n"
+ " waiting for %g got %g\n", MPFR_DBL_INFM, var_d);
+ exit (1);
+ }
+
+ mpfr_clear (var);
+
+#endif
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+#ifndef MPFR_DOUBLE_SPEC
+ printf ("Warning! The MPFR_DOUBLE_SPEC macro is not defined. This means\n"
+ "that you do not have a conforming C implementation and problems\n"
+ "may occur with conversions between MPFR numbers and standard\n"
+ "floating-point types. Please contact the MPFR team.\n");
+#elif MPFR_DOUBLE_SPEC == 0
+ /*
+ printf ("The type 'double' of your C implementation does not seem to\n"
+ "correspond to the IEEE-754 double precision. Though code has\n"
+ "been written to support such implementations, tests have been\n"
+ "done only on IEEE-754 double-precision implementations and\n"
+ "conversions between MPFR numbers and standard floating-point\n"
+ "types may be inaccurate. You may wish to contact the MPFR team\n"
+ "for further testing.\n");
+ */
+ printf ("The type 'double' of your C implementation does not seem to\n"
+ "correspond to the IEEE-754 double precision. Such particular\n"
+ "implementations are not supported yet, and conversions between\n"
+ "MPFR numbers and standard floating-point types may be very\n"
+ "inaccurate.\n");
+ printf ("FLT_RADIX = %ld\n", (long) FLT_RADIX);
+ printf ("DBL_MANT_DIG = %ld\n", (long) DBL_MANT_DIG);
+ printf ("DBL_MIN_EXP = %ld\n", (long) DBL_MIN_EXP);
+ printf ("DBL_MAX_EXP = %ld\n", (long) DBL_MAX_EXP);
+#endif
+
+ if (check_denorms ())
+ exit (1);
+
+ check_inf_nan ();
+ check_min();
+ check_max();
+
+ check_get_d_2exp_inf_nan ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
diff --git a/tests/tget_d_2exp.c b/tests/tget_d_2exp.c
new file mode 100644
index 0000000..4589c37
--- /dev/null
+++ b/tests/tget_d_2exp.c
@@ -0,0 +1,121 @@
+/* Test mpfr_get_d_2exp.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+
+/* Check that hardware rounding doesn't make mpfr_get_d_2exp return a value
+ outside its defined range. */
+static void
+check_round (void)
+{
+ static const unsigned long data[] = { 1, 32, 53, 54, 64, 128, 256, 512 };
+ mpfr_t f;
+ double got;
+ long got_exp;
+ int i, rnd_mode, neg;
+
+ mpfr_init2 (f, 1024L);
+
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX ; rnd_mode++)
+ {
+ for (i = 0; i < (int) numberof (data); i++)
+ {
+ mpfr_set_ui (f, 1L, MPFR_RNDZ);
+ mpfr_mul_2exp (f, f, data[i], MPFR_RNDZ);
+ mpfr_sub_ui (f, f, 1L, MPFR_RNDZ);
+
+ for (neg = 0; neg <= 1; neg++)
+ {
+ got = mpfr_get_d_2exp (&got_exp, f, (mpfr_rnd_t) rnd_mode);
+
+ if (neg == 0
+ ? (got < 0.5 || got >= 1.0)
+ : (got <= -1.0 || got > -0.5))
+ {
+ printf ("mpfr_get_d_2exp wrong on 2**%lu-1\n", data[i]);
+ printf ("result out of range, expect 0.5 <= got < 1.0\n");
+ printf (" rnd_mode = %d\n", rnd_mode);
+ printf (" data[i] = %lu\n", data[i]);
+ printf (" f ");
+ mpfr_out_str (stdout, 2, 0, f, MPFR_RNDN);
+ printf ("\n");
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ exit(1);
+ }
+
+ mpfr_neg (f, f, MPFR_RNDZ);
+ }
+ }
+ }
+
+ mpfr_clear (f);
+}
+
+
+static void
+check_inf_nan (void)
+{
+ /* only if nans and infs are available */
+#if _GMP_IEEE_FLOATS
+ mpfr_t x;
+ double d;
+ long exp;
+
+ mpfr_init2 (x, 123);
+
+ mpfr_set_inf (x, 1);
+ d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ);
+ ASSERT_ALWAYS (d > 0);
+ ASSERT_ALWAYS (DOUBLE_ISINF (d));
+
+ mpfr_set_inf (x, -1);
+ d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ);
+ ASSERT_ALWAYS (d < 0);
+ ASSERT_ALWAYS (DOUBLE_ISINF (d));
+
+ mpfr_set_nan (x);
+ d = mpfr_get_d_2exp (&exp, x, MPFR_RNDZ);
+ ASSERT_ALWAYS (DOUBLE_ISNAN (d));
+
+ mpfr_clear (x);
+#endif
+}
+
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+ check_round ();
+ check_inf_nan ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tget_f.c b/tests/tget_f.c
new file mode 100644
index 0000000..2634a4c
--- /dev/null
+++ b/tests/tget_f.c
@@ -0,0 +1,390 @@
+/* Test file for mpfr_get_f.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+/* Test that there is no lost of accuracy when converting a mpfr_t number
+ into a mpf_t number (test with various precisions and exponents). */
+static void
+prec_test (void)
+{
+ int px, py;
+
+ for (py = 3; py <= 136; py++)
+ {
+ mpfr_t y1, y2, y3;
+
+ mpfr_init2 (y1, py);
+ mpfr_init2 (y2, py);
+ mpfr_init2 (y3, py);
+
+ for (px = 32; px <= 160; px += 32)
+ {
+ mpf_t x1, x2, x3;
+ int e;
+
+ mpf_init (x1);
+ mpf_init (x2);
+ mpf_init (x3);
+ mpfr_set_ui_2exp (y1, 1, py - 1, MPFR_RNDN);
+ mpfr_get_f (x1, y1, MPFR_RNDN); /* exact (power of 2) */
+ mpf_set (x2, x1);
+ mpfr_set (y2, y1, MPFR_RNDN);
+
+ for (e = py - 2; e >= 0; e--)
+ {
+ int inex;
+ mpf_div_2exp (x2, x2, 1);
+ mpf_add (x1, x1, x2);
+ mpfr_div_2exp (y2, y2, 1, MPFR_RNDN);
+ inex = mpfr_add (y1, y1, y2, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ mpfr_set_f (y3, x1, MPFR_RNDN);
+ if (! mpfr_equal_p (y1, y3))
+ break;
+ inex = mpfr_get_f (x3, y3, MPFR_RNDN);
+ if (mpf_cmp (x1, x3) != 0)
+ {
+ printf ("Error in prec_test (px = %d, py = %d, e = %d)\n",
+ px, py, e);
+ printf ("x1 = ");
+ mpf_out_str (stdout, 16, 0, x1);
+ printf ("\nx2 = ");
+ mpf_out_str (stdout, 16, 0, x2);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex != 0)
+ {
+ printf ("Error in prec_test (px = %d, py = %d, e = %d)\n",
+ px, py, e);
+ printf ("wrong ternary value got: %+d, expected: 0\n",
+ inex);
+ exit (1);
+ }
+ }
+
+ mpf_clear (x1);
+ mpf_clear (x2);
+ mpf_clear (x3);
+ }
+
+ mpfr_clear (y1);
+ mpfr_clear (y2);
+ mpfr_clear (y3);
+ }
+}
+
+static void
+special_test (void)
+{
+ int inex;
+ mpf_t x;
+ mpfr_t y;
+
+ mpfr_init (y);
+ mpf_init (x);
+
+ mpfr_set_nan (y);
+ mpfr_clear_flags ();
+ mpfr_get_f (x, y, MPFR_RNDN);
+ if (! mpfr_erangeflag_p ())
+ {
+ printf ("Error: mpfr_get_f(NaN) should raise erange flag\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, +1);
+ mpfr_clear_flags ();
+ inex = mpfr_get_f (x, y, MPFR_RNDN);
+ if (inex >= 0)
+ {
+ printf ("Error: mpfr_get_f(+Inf) should return a negative ternary"
+ "value\n");
+ exit (1);
+ }
+ if (! mpfr_erangeflag_p ())
+ {
+ printf ("Error: mpfr_get_f(+Inf) should raise erange flag\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (y, -1);
+ mpfr_clear_flags ();
+ inex = mpfr_get_f (x, y, MPFR_RNDN);
+ if (inex <= 0)
+ {
+ printf ("Error: mpfr_get_f(-Inf) should return a positive ternary"
+ "value\n");
+ exit (1);
+ }
+ if (! mpfr_erangeflag_p ())
+ {
+ printf ("Error: mpfr_get_f(-Inf) should raise erange flag\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) != 0 || mpf_cmp_ui (x, 0))
+ {
+ printf ("Error: mpfr_get_f(+0) fails\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) != 0 || mpf_cmp_ui (x, 0))
+ {
+ printf ("Error: mpfr_get_f(-0) fails\n");
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpf_clear (x);
+}
+
+static void
+ternary_test (void)
+{
+ int prec;
+ int rnd;
+ int inex, expected_inex;
+ mpf_t x;
+ mpfr_t y;
+
+ mpf_init2 (x, 256);
+ mpfr_init2 (y, 256);
+
+ for (prec = 2; prec <= 256; prec++)
+ {
+
+ mpf_set_prec (x, prec);
+ mpfr_set_prec (y, PREC (x) * GMP_NUMB_BITS + 1);
+
+ /* y == 1 */
+ mpfr_set_ui_2exp (y, 1, prec, MPFR_RNDN);
+
+ RND_LOOP (rnd)
+ {
+ inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd);
+
+ if (inex != 0 || mpfr_cmp_f (y, x) !=0)
+ {
+ printf ("Error in mpfr_get_f (x, y, %s)\nx = ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpf_out_str (stdout, 2, 0, x);
+ printf ("\ny = ");
+ mpfr_dump (y);
+ if (inex != 0)
+ printf ("got ternary value = %+d, expected: 0\n", inex);
+
+ exit (1);
+ }
+ }
+
+ /* y == 1 + epsilon */
+ mpfr_nextbelow (y);
+
+ RND_LOOP (rnd)
+ {
+ switch (rnd)
+ {
+ case MPFR_RNDU: case MPFR_RNDA:
+ case MPFR_RNDN:
+ expected_inex = +1;
+ break;
+ default :
+ expected_inex = -1;
+ }
+
+ inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd);
+
+ if (! SAME_SIGN (expected_inex, inex)
+ || SAME_SIGN (expected_inex, mpfr_cmp_f (y, x)))
+ {
+ printf ("Error in mpfr_get_f (x, y, %s)\nx = ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpf_out_str (stdout, 2, 0, x);
+ printf ("\ny = ");
+ mpfr_dump (y);
+ if (! SAME_SIGN (expected_inex, inex))
+ printf ("got ternary value = %+d, expected: %+d\n",
+ inex, expected_inex);
+
+ exit (1);
+ }
+ }
+
+ /* y == positive random float */
+ mpfr_random2 (y, MPFR_LIMB_SIZE (y), 1024, RANDS);
+
+ RND_LOOP (rnd)
+ {
+ inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd);
+
+ if (! SAME_SIGN (inex, -mpfr_cmp_f (y, x)))
+ {
+ printf ("Error in mpfr_get_f (x, y, %s)\nx = ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpf_out_str (stdout, 2, 0, x);
+ printf ("\ny = ");
+ mpfr_dump (y);
+ printf ("got ternary value = %+d, expected: %+d\n",
+ inex, -mpfr_cmp_f (y, x));
+
+ exit (1);
+ }
+ }
+ }
+
+ mpf_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (void)
+{
+ mpf_t x;
+ mpfr_t y, z;
+ unsigned long i;
+ mpfr_exp_t e;
+ int inex;
+
+ tests_start_mpfr ();
+
+ mpfr_init (y);
+ mpfr_init (z);
+ mpf_init (x);
+
+ i = 1;
+ while (i)
+ {
+ mpfr_set_ui (y, i, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) != 0 || mpf_cmp_ui (x, i))
+ {
+ printf ("Error: mpfr_get_f(%lu) fails\n", i);
+ exit (1);
+ }
+ if (i <= - (unsigned long) LONG_MIN)
+ {
+ long j = i < - (unsigned long) LONG_MIN ? - (long) i : LONG_MIN;
+ mpfr_set_si (y, j, MPFR_RNDN);
+ if (mpfr_get_f (x, y, MPFR_RNDN) != 0 || mpf_cmp_si (x, j))
+ {
+ printf ("Error: mpfr_get_f(-%lu) fails\n", i);
+ exit (1);
+ }
+ }
+ i *= 2;
+ }
+
+ /* same tests, but with a larger precision for y, which requires to
+ round it */
+ mpfr_set_prec (y, 100);
+ i = 1;
+ while (i)
+ {
+ mpfr_set_ui (y, i, MPFR_RNDN);
+ inex = mpfr_get_f (x, y, MPFR_RNDN);
+ if (! SAME_SIGN (inex, - mpfr_cmp_f (y, x)) || mpf_cmp_ui (x, i))
+ {
+ printf ("Error: mpfr_get_f(%lu) fails\n", i);
+ exit (1);
+ }
+ mpfr_set_si (y, (signed long) -i, MPFR_RNDN);
+ inex = mpfr_get_f (x, y, MPFR_RNDN);
+ if (! SAME_SIGN (inex, - mpfr_cmp_f (y, x))
+ || mpf_cmp_si (x, (signed long) -i))
+ {
+ printf ("Error: mpfr_get_f(-%lu) fails\n", i);
+ exit (1);
+ }
+ i *= 2;
+ }
+
+ /* bug reported by Jim White */
+ for (e = 0; e <= 2 * GMP_NUMB_BITS; e++)
+ {
+ /* test with 2^(-e) */
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_div_2exp (y, y, e, MPFR_RNDN);
+ inex = mpfr_get_f (x, y, MPFR_RNDN);
+ mpf_mul_2exp (x, x, e);
+ if (inex != 0 || mpf_cmp_ui (x, 1) != 0)
+ {
+ printf ("Error: mpfr_get_f(x,y,MPFR_RNDN) fails\n");
+ printf ("y=");
+ mpfr_dump (y);
+ printf ("x=");
+ mpf_div_2exp (x, x, e);
+ mpf_out_str (stdout, 2, 0, x);
+ exit (1);
+ }
+
+ /* test with 2^(e) */
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_mul_2exp (y, y, e, MPFR_RNDN);
+ inex = mpfr_get_f (x, y, MPFR_RNDN);
+ mpf_div_2exp (x, x, e);
+ if (inex != 0 || mpf_cmp_ui (x, 1) != 0)
+ {
+ printf ("Error: mpfr_get_f(x,y,MPFR_RNDN) fails\n");
+ printf ("y=");
+ mpfr_dump (y);
+ printf ("x=");
+ mpf_mul_2exp (x, x, e);
+ mpf_out_str (stdout, 2, 0, x);
+ exit (1);
+ }
+ }
+
+ /* Bug reported by Yury Lukach on 2006-04-05 */
+ mpfr_set_prec (y, 32);
+ mpfr_set_prec (z, 32);
+ mpf_set_prec (x, 32);
+ mpfr_set_ui_2exp (y, 0xc1234567, -30, MPFR_RNDN);
+ mpfr_get_f (x, y, MPFR_RNDN);
+ inex = mpfr_set_f (z, x, MPFR_RNDN);
+ if (inex != 0 || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in mpfr_get_f:\n inex = %d, y = ", inex);
+ mpfr_dump (z);
+ printf ("Expected:\n inex = 0, y = ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpf_clear (x);
+
+ special_test ();
+ prec_test ();
+ ternary_test ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tget_flt.c b/tests/tget_flt.c
new file mode 100644
index 0000000..cf5bd5a
--- /dev/null
+++ b/tests/tget_flt.c
@@ -0,0 +1,385 @@
+/* Test file for mpfr_get_flt and mpfr_set_flt
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <float.h> /* for FLT_MIN */
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x, y;
+ float f, g, infp;
+ int i;
+
+ infp = (float) DBL_POS_INF;
+ if (infp * 0.5 != infp)
+ {
+ fprintf (stderr, "Error, FLT_MAX + FLT_MAX does not yield INFP\n");
+ fprintf (stderr, "(this is probably a compiler bug, please report)\n");
+ exit (1);
+ }
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 24);
+
+#if !defined(MPFR_ERRDIVZERO)
+ mpfr_set_nan (x);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ if (f == f)
+ {
+ printf ("Error for mpfr_get_flt(NaN)\n");
+ exit (1);
+ }
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_nan_p (x) == 0)
+ {
+ printf ("Error for mpfr_set_flt(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_inf_p (x) == 0 || mpfr_sgn (x) < 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(+Inf)):\n");
+ printf ("f=%f, expected -Inf\n", f);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_inf_p (x) == 0 || mpfr_sgn (x) > 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(-Inf)):\n");
+ printf ("f=%f, expected -Inf\n", f);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+#endif
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_zero_p (x) == 0 || MPFR_SIGN (x) < 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(+0))\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_zero_p (x) == 0 || MPFR_SIGN (x) > 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(-0))\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 17) != 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(17))\n");
+ printf ("expected 17\n");
+ printf ("got ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -42, MPFR_RNDN);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (x, f, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -42) != 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(-42))\n");
+ printf ("expected -42\n");
+ printf ("got ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_si_2exp (x, 1, -126, MPFR_RNDN);
+ for (i = -126; i < 128; i++)
+ {
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_set_flt (y, f, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(x))\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_si_2exp (x, 1, -126, MPFR_RNDN);
+ for (i = -126; i < 128; i++)
+ {
+ mpfr_nextbelow (x);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_nextabove (x);
+ mpfr_set_flt (y, f, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(x))\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_si_2exp (x, 1, -126, MPFR_RNDN);
+ for (i = -126; i < 128; i++)
+ {
+ mpfr_nextabove (x);
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_set_flt (y, f, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error for mpfr_set_flt(mpfr_get_flt(x))\n");
+ printf ("expected "); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
+ }
+
+ mpfr_set_si_2exp (x, 1, -150, MPFR_RNDN);
+ g = 0.0;
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-150),RNDN)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDZ);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-150),RNDZ)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDD);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-150),RNDD)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ g = FLT_MIN * FLT_EPSILON;
+ f = mpfr_get_flt (x, MPFR_RNDU);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-150),RNDU)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDA);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-150),RNDA)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+
+ mpfr_set_si_2exp (x, 1, -151, MPFR_RNDN);
+ g = 0.0;
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-151),RNDN)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDZ);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-151),RNDZ)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDD);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-151),RNDD)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ g = FLT_MIN * FLT_EPSILON;
+ f = mpfr_get_flt (x, MPFR_RNDU);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-151),RNDU)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDA);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-151),RNDA)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+
+ mpfr_set_si_2exp (x, 1, -149, MPFR_RNDN);
+ g = FLT_MIN * FLT_EPSILON;
+ f = mpfr_get_flt (x, MPFR_RNDN);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-149),RNDN)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDZ);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-149),RNDZ)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDD);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-149),RNDD)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDU);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-149),RNDU)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDA);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^(-149),RNDA)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+
+ mpfr_set_si_2exp (x, 1, 128, MPFR_RNDN);
+ g = FLT_MAX;
+ f = mpfr_get_flt (x, MPFR_RNDZ);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128,RNDZ)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDD);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128,RNDD)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+#if !defined(MPFR_ERRDIVZERO)
+ f = mpfr_get_flt (x, MPFR_RNDN); /* 2^128 rounds to itself with extended
+ exponent range, we should get +Inf */
+ g = infp;
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128,RNDN)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDU);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128,RNDU)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDA);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128,RNDA)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+#endif
+
+ /* corner case: take x with 25 bits just below 2^128 */
+ mpfr_set_prec (x, 25);
+ mpfr_set_si_2exp (x, 1, 128, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ g = FLT_MAX;
+ f = mpfr_get_flt (x, MPFR_RNDZ);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128*(1-2^(-25)),RNDZ)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDD);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128*(1-2^(-25)),RNDD)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule),
+ thus we should get +Inf */
+ g = infp;
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128*(1-2^(-25)),RNDN)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDU);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128*(1-2^(-25)),RNDU)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+ f = mpfr_get_flt (x, MPFR_RNDA);
+ if (f != g)
+ {
+ printf ("Error for mpfr_get_flt(2^128*(1-2^(-25)),RNDA)\n");
+ printf ("expected %.8e, got %.8e\n", g, f);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tget_ld_2exp.c b/tests/tget_ld_2exp.c
new file mode 100644
index 0000000..c001adf
--- /dev/null
+++ b/tests/tget_ld_2exp.c
@@ -0,0 +1,145 @@
+/* Test mpfr_get_ld_2exp.
+
+Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+/* Check that hardware rounding doesn't make mpfr_get_ld_2exp return a value
+ outside its defined range. */
+static void
+check_round (void)
+{
+ static const unsigned long data[] = {1, 32, 53, 54, 63, 64, 65, 127, 128, 256, 512 };
+ mpfr_t f;
+ long double got;
+ long got_exp;
+ int i, rnd_mode, neg;
+
+ mpfr_init2 (f, 1024L);
+
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX ; rnd_mode++)
+ {
+ for (i = 0; i < (int) numberof (data); i++)
+ {
+ mpfr_set_ui (f, 1L, MPFR_RNDZ);
+ mpfr_mul_2exp (f, f, data[i], MPFR_RNDZ);
+ mpfr_sub_ui (f, f, 1L, MPFR_RNDZ);
+
+ for (neg = 0; neg <= 1; neg++)
+ {
+ got = mpfr_get_ld_2exp (&got_exp, f, (mpfr_rnd_t) rnd_mode);
+
+ if (neg == 0
+ ? (got < 0.5 || got >= 1.0)
+ : (got <= -1.0 || got > -0.5))
+ {
+ printf ("mpfr_get_ld_2exp wrong on 2**%lu-1\n", data[i]);
+ printf ("result out of range, expect 0.5 <= got < 1.0\n");
+ printf (" rnd_mode = %d\n", rnd_mode);
+ printf (" data[i] = %lu\n", data[i]);
+ printf (" f ");
+ mpfr_out_str (stdout, 2, 0, f, MPFR_RNDN);
+ printf ("\n");
+ d_trace (" got ", got);
+ printf (" got exp %ld\n", got_exp);
+ exit(1);
+ }
+
+ mpfr_neg (f, f, MPFR_RNDZ);
+ }
+ }
+ }
+
+ mpfr_clear (f);
+}
+
+
+static void
+check_inf_nan (void)
+{
+ /* only if nans and infs are available */
+#if _GMP_IEEE_FLOATS
+ mpfr_t x;
+ double d;
+ long exp;
+
+ mpfr_init2 (x, 123);
+
+ mpfr_set_inf (x, 1);
+ d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ);
+ ASSERT_ALWAYS (d > 0);
+ ASSERT_ALWAYS (DOUBLE_ISINF (d));
+
+ mpfr_set_inf (x, -1);
+ d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ);
+ ASSERT_ALWAYS (d < 0);
+ ASSERT_ALWAYS (DOUBLE_ISINF (d));
+
+ mpfr_set_nan (x);
+ d = (double) mpfr_get_ld_2exp (&exp, x, MPFR_RNDZ);
+ ASSERT_ALWAYS (DOUBLE_ISNAN (d));
+
+ mpfr_clear (x);
+#endif
+}
+
+static void
+bug20090520 (void)
+{
+ mpfr_t x;
+ long double d, e;
+ int i;
+
+ mpfr_init (x);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ d = 1.0;
+ mpfr_div_2exp (x, x, 16383, MPFR_RNDN);
+ for (i = 0; i < 16383; i++)
+ d *= 0.5;
+ e = mpfr_get_ld (x, MPFR_RNDN);
+ if (e != d)
+ {
+ printf ("mpfr_get_ld(1e-16383) failed\n");
+ printf ("expected %.20Le\n", d);
+ printf ("got %.20Le\n", e);
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+ bug20090520 ();
+
+ check_round ();
+ check_inf_nan ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tget_set_d64.c b/tests/tget_set_d64.c
new file mode 100644
index 0000000..37fa63c
--- /dev/null
+++ b/tests/tget_set_d64.c
@@ -0,0 +1,349 @@
+/* Test file for mpfr_get_decimal64 and mpfr_set_decimal64.
+
+Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef MPFR_WANT_DECIMAL_FLOATS
+
+#include <stdlib.h> /* for exit */
+#include "mpfr-test.h"
+
+#ifndef DEC64_MAX
+# define DEC64_MAX 9.999999999999999E384dd
+#endif
+
+/* #define DEBUG */
+
+static void
+print_decimal64 (_Decimal64 d)
+{
+ union ieee_double_extract x;
+ union ieee_double_decimal64 y;
+ unsigned int Gh, i;
+
+ y.d64 = d;
+ x.d = y.d;
+ Gh = x.s.exp >> 6;
+ printf ("|%d%d%d%d%d%d", x.s.sig, Gh >> 4, (Gh >> 3) & 1,
+ (Gh >> 2) & 1, (Gh >> 1) & 1, Gh & 1);
+ printf ("%d%d%d%d%d%d", (x.s.exp >> 5) & 1, (x.s.exp >> 4) & 1,
+ (x.s.exp >> 3) & 1, (x.s.exp >> 2) & 1, (x.s.exp >> 1) & 1,
+ x.s.exp & 1);
+ for (i = 20; i > 0; i--)
+ printf ("%d", (x.s.manh >> (i - 1)) & 1);
+ for (i = 32; i > 0; i--)
+ printf ("%d", (x.s.manl >> (i - 1)) & 1);
+ printf ("|\n");
+}
+
+static void
+check_inf_nan (void)
+{
+ mpfr_t x, y;
+ _Decimal64 d;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ mpfr_set_nan (x);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_nan_p (x));
+
+ mpfr_set_inf (x, 1);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+
+ mpfr_set_inf (x, -1);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_inf_p (x) && mpfr_sgn (x) < 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) > 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_neg (x, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp_ui (x, 0) == 0 && MPFR_SIGN (x) < 0);
+
+ mpfr_set_ui (x, 1, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp_ui (x, 1) == 0);
+
+ mpfr_set_si (x, -1, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp_si (x, -1) == 0);
+
+ mpfr_set_ui (x, 2, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp_ui (x, 2) == 0);
+
+ mpfr_set_ui (x, 99, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp_ui (x, 99) == 0);
+
+ mpfr_set_str (x, "9999999999999999", 10, MPFR_RNDZ);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ /* smallest normal number */
+ mpfr_set_str (x, "1E-383", 10, MPFR_RNDU);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDU);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ /* smallest subnormal number */
+ mpfr_set_str (x, "1E-398", 10, MPFR_RNDU);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDU);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ /* subnormal number with exponent change when we round back
+ from 16 digits to 1 digit */
+ mpfr_set_str (x, "9.9E-398", 10, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDU); /* should be 1E-397 */
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDD);
+ mpfr_set_str (y, "1E-397", 10, MPFR_RNDN);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ /* largest number */
+ mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDU);
+ ASSERT_ALWAYS (d == DEC64_MAX);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ mpfr_set_str (x, "-9.999999999999999E384", 10, MPFR_RNDZ);
+ mpfr_set (y, x, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDA);
+ ASSERT_ALWAYS (d == -DEC64_MAX);
+ mpfr_set_ui (x, 0, MPFR_RNDZ);
+ mpfr_set_decimal64 (x, d, MPFR_RNDZ);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ /* largest number */
+ mpfr_set_str (x, "9.999999999999999E384", 10, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDZ);
+ mpfr_set_decimal64 (y, d, MPFR_RNDU);
+ ASSERT_ALWAYS (mpfr_cmp (x, y) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_random (void)
+{
+ mpfr_t x, y;
+ _Decimal64 d;
+ int i;
+
+ mpfr_init2 (x, 49);
+ mpfr_init2 (y, 49);
+
+ for (i = 0; i < 100000; i++)
+ {
+ mpfr_urandomb (x, RANDS); /* 0 <= x < 1 */
+ /* the normal decimal64 range contains [2^(-1272), 2^1278] */
+ mpfr_mul_2si (x, x, (i % 2550) - 1272, MPFR_RNDN);
+ if (mpfr_get_exp (x) <= -1272)
+ mpfr_mul_2exp (x, x, -1271 - mpfr_get_exp (x), MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ mpfr_set_decimal64 (y, d, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("x="); mpfr_dump (x);
+ printf ("d="); print_decimal64 (d);
+ printf ("y="); mpfr_dump (y);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* check with native decimal formats */
+static void
+check_native (void)
+{
+ mpfr_t x;
+ _Decimal64 d;
+
+ mpfr_init2 (x, 53);
+
+ /* check important constants are correctly converted */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ MPFR_ASSERTN(d == 17.0dd);
+
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ MPFR_ASSERTN(d == 42.0dd);
+
+ mpfr_set_decimal64 (x, 17.0dd, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 17) == 0);
+
+ mpfr_set_decimal64 (x, 42.0dd, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 42) == 0);
+
+ mpfr_clear (x);
+}
+
+static void
+check_overflow (void)
+{
+ mpfr_t x;
+ int err = 0, neg, rnd;
+
+ mpfr_init2 (x, 96);
+ for (neg = 0; neg < 2; neg++)
+ RND_LOOP (rnd)
+ {
+ _Decimal64 d, e;
+ mpfr_rnd_t r = (mpfr_rnd_t) rnd;
+ int sign = neg ? -1 : 1;
+
+ e = sign * (MPFR_IS_LIKE_RNDZ (r, neg) ? 1 : 2) * DEC64_MAX;
+ /* This tests the binary exponent e > 1279 case of get_d64.c */
+ mpfr_set_si_2exp (x, sign, 9999, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, r);
+ if (d != e)
+ {
+ printf ("Error 1 in check_overflow for %s, %s\n",
+ neg ? "negative" : "positive",
+ mpfr_print_rnd_mode (r));
+ err = 1;
+ }
+ /* This tests the decimal exponent e > 385 case of get_d64.c */
+ mpfr_set_si_2exp (x, sign * 31, 1274, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, r);
+ if (d != e)
+ {
+ printf ("Error 2 in check_overflow for %s, %s\n",
+ neg ? "negative" : "positive",
+ mpfr_print_rnd_mode (r));
+ err = 1;
+ }
+ /* This tests the last else (-382 <= e <= 385) of get_d64.c */
+ mpfr_set_decimal64 (x, e, MPFR_RNDA);
+ d = mpfr_get_decimal64 (x, r);
+ if (d != e)
+ {
+ printf ("Error 3 in check_overflow for %s, %s\n",
+ neg ? "negative" : "positive",
+ mpfr_print_rnd_mode (r));
+ err = 1;
+ }
+ }
+ mpfr_clear (x);
+ if (err)
+ exit (1);
+}
+
+static void
+check_tiny (void)
+{
+ mpfr_t x;
+ _Decimal64 d;
+
+ /* If 0.5E-398 < |x| < 1E-398 (smallest subnormal), x should round
+ to +/- 1E-398 in MPFR_RNDN. Note: the midpoint 0.5E-398 between
+ 0 and 1E-398 is not a representable binary number, so that there
+ are no tests for it. */
+ mpfr_init2 (x, 128);
+ mpfr_set_str (x, "1E-398", 10, MPFR_RNDZ);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ MPFR_ASSERTN (d == 1.0E-398dd);
+ mpfr_neg (x, x, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ MPFR_ASSERTN (d == -1.0E-398dd);
+ mpfr_set_str (x, "0.5E-398", 10, MPFR_RNDU);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ MPFR_ASSERTN (d == 1.0E-398dd);
+ mpfr_neg (x, x, MPFR_RNDN);
+ d = mpfr_get_decimal64 (x, MPFR_RNDN);
+ MPFR_ASSERTN (d == -1.0E-398dd);
+ mpfr_clear (x);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+#ifdef DEBUG
+#ifdef DPD_FORMAT
+ printf ("Using DPD format\n");
+#else
+ printf ("Using BID format\n");
+#endif
+#endif
+ check_inf_nan ();
+ check_random ();
+ check_native ();
+ check_overflow ();
+ check_tiny ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else /* MPFR_WANT_DECIMAL_FLOATS */
+
+int
+main (void)
+{
+ return 77;
+}
+
+#endif /* MPFR_WANT_DECIMAL_FLOATS */
diff --git a/tests/tget_sj.c b/tests/tget_sj.c
new file mode 100644
index 0000000..d713e2e
--- /dev/null
+++ b/tests/tget_sj.c
@@ -0,0 +1,281 @@
+/* Test file for mpfr_get_sj and mpfr_get_uj.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-intmax.h"
+#include "mpfr-test.h"
+
+#ifndef _MPFR_H_HAVE_INTMAX_T
+
+int
+main (void)
+{
+ return 77;
+}
+
+#else
+
+static void
+check_sj (intmax_t s, mpfr_ptr x)
+{
+ mpfr_t y;
+ int i;
+
+ mpfr_init2 (y, MPFR_PREC (x));
+
+ for (i = -1; i <= 1; i++)
+ {
+ int rnd;
+
+ mpfr_set_si_2exp (y, i, -2, MPFR_RNDN);
+ mpfr_add (y, y, x, MPFR_RNDN);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ intmax_t r;
+
+ if (rnd == MPFR_RNDZ && i < 0 && s >= 0)
+ continue;
+ if (rnd == MPFR_RNDZ && i > 0 && s <= 0)
+ continue;
+ if (rnd == MPFR_RNDD && i < 0)
+ continue;
+ if (rnd == MPFR_RNDU && i > 0)
+ continue;
+ if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) ||
+ (MPFR_IS_NEG(y) && i < 0)))
+ continue;
+ /* rint (y) == x == s */
+ r = mpfr_get_sj (y, (mpfr_rnd_t) rnd);
+ if (r != s)
+ {
+ printf ("Error in check_sj for y = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" in %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("Got %jd instead of %jd.\n", r, s);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (y);
+}
+
+static void
+check_uj (uintmax_t u, mpfr_ptr x)
+{
+ mpfr_t y;
+ int i;
+
+ mpfr_init2 (y, MPFR_PREC (x));
+
+ for (i = -1; i <= 1; i++)
+ {
+ int rnd;
+
+ mpfr_set_si_2exp (y, i, -2, MPFR_RNDN);
+ mpfr_add (y, y, x, MPFR_RNDN);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ uintmax_t r;
+
+ if (rnd == MPFR_RNDZ && i < 0)
+ continue;
+ if (rnd == MPFR_RNDD && i < 0)
+ continue;
+ if (rnd == MPFR_RNDU && i > 0)
+ continue;
+ if (rnd == MPFR_RNDA && ((MPFR_IS_POS(y) && i > 0) ||
+ (MPFR_IS_NEG(y) && i < 0)))
+ continue;
+ /* rint (y) == x == u */
+ r = mpfr_get_uj (y, (mpfr_rnd_t) rnd);
+ if (r != u)
+ {
+ printf ("Error in check_uj for y = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" in %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("Got %ju instead of %ju.\n", r, u);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (y);
+}
+
+static void
+check_erange (void)
+{
+ mpfr_t x;
+ uintmax_t dl;
+ intmax_t d;
+
+ /* Test for ERANGE flag + correct behaviour if overflow */
+
+ mpfr_init2 (x, 256);
+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ dl = mpfr_get_uj (x, MPFR_RNDN);
+ if (dl != MPFR_UINTMAX_MAX || mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (1)\n");
+ exit (1);
+ }
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ dl = mpfr_get_uj (x, MPFR_RNDN);
+ if (dl != MPFR_UINTMAX_MAX || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_uj + ERANGE + UINTMAX_MAX (2)\n");
+ exit (1);
+ }
+ mpfr_set_sj (x, -1, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ dl = mpfr_get_uj (x, MPFR_RNDN);
+ if (dl != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_uj + ERANGE + -1 \n");
+ exit (1);
+ }
+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_sj (x, MPFR_RNDN);
+ if (d != MPFR_INTMAX_MAX || mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (1)\n");
+ exit (1);
+ }
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_sj (x, MPFR_RNDN);
+ if (d != MPFR_INTMAX_MAX || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_sj + ERANGE + INTMAX_MAX (2)\n");
+ exit (1);
+ }
+ mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_sj (x, MPFR_RNDN);
+ if (d != MPFR_INTMAX_MIN || mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (1)\n");
+ exit (1);
+ }
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_sj (x, MPFR_RNDN);
+ if (d != MPFR_INTMAX_MIN || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_sj + ERANGE + INTMAX_MIN (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_nan (x);
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_uj (x, MPFR_RNDN);
+ if (d != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_uj + NaN\n");
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_sj (x, MPFR_RNDN);
+ if (d != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_sj + NaN\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+int
+main (void)
+{
+ mpfr_prec_t prec;
+ mpfr_t x, y;
+ intmax_t s;
+ uintmax_t u;
+
+ tests_start_mpfr ();
+
+ for (u = MPFR_UINTMAX_MAX, prec = 0; u != 0; u /= 2, prec++)
+ { }
+
+ mpfr_init2 (x, prec + 4);
+ mpfr_init2 (y, prec + 4);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ check_sj (0, x);
+ check_uj (0, x);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ check_sj (1, x);
+ check_uj (1, x);
+
+ mpfr_neg (x, x, MPFR_RNDN);
+ check_sj (-1, x);
+
+ mpfr_set_si_2exp (x, 1, prec, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN); /* UINTMAX_MAX */
+
+ mpfr_div_ui (y, x, 2, MPFR_RNDZ);
+ mpfr_trunc (y, y); /* INTMAX_MAX */
+ for (s = MPFR_INTMAX_MAX; s != 0; s /= 17)
+ {
+ check_sj (s, y);
+ mpfr_div_ui (y, y, 17, MPFR_RNDZ);
+ mpfr_trunc (y, y);
+ }
+
+ mpfr_div_ui (y, x, 2, MPFR_RNDZ);
+ mpfr_trunc (y, y); /* INTMAX_MAX */
+ mpfr_neg (y, y, MPFR_RNDN);
+ if (MPFR_INTMAX_MIN + MPFR_INTMAX_MAX != 0)
+ mpfr_sub_ui (y, y, 1, MPFR_RNDN); /* INTMAX_MIN */
+ for (s = MPFR_INTMAX_MIN; s != 0; s /= 17)
+ {
+ check_sj (s, y);
+ mpfr_div_ui (y, y, 17, MPFR_RNDZ);
+ mpfr_trunc (y, y);
+ }
+
+ for (u = MPFR_UINTMAX_MAX; u != 0; u /= 17)
+ {
+ check_uj (u, x);
+ mpfr_div_ui (x, x, 17, MPFR_RNDZ);
+ mpfr_trunc (x, x);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ check_erange ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#endif
diff --git a/tests/tget_str.c b/tests/tget_str.c
new file mode 100644
index 0000000..a143bdc
--- /dev/null
+++ b/tests/tget_str.c
@@ -0,0 +1,1268 @@
+/* Test file for mpfr_get_str.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check3 (const char *d, mpfr_rnd_t rnd, const char *res)
+{
+ mpfr_t x;
+ char *str;
+ mpfr_exp_t e;
+
+ mpfr_init2 (x, 53);
+ mpfr_set_str (x, d, 10, rnd);
+ str = mpfr_get_str (NULL, &e, 10, 5, x, rnd);
+ if (strcmp (str, res))
+ {
+ printf ("Error in mpfr_get_str for x=%s\n", d);
+ printf ("got %s instead of %s\n", str, res);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_free_str (str);
+}
+
+static void
+check_small (void)
+{
+ mpfr_t x;
+ char *s;
+ mpfr_exp_t e;
+ mpfr_prec_t p;
+
+ mpfr_init (x);
+
+ mpfr_set_prec (x, 20);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_nexttozero (x);
+ s = mpfr_get_str (NULL, &e, 4, 2, x, MPFR_RNDU);
+ if (strcmp (s, "20") || (e != 1))
+ {
+ printf ("Error in mpfr_get_str: 2- rounded up with 2 digits"
+ " in base 4\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* check n_digits=0 */
+ mpfr_set_prec (x, 5);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 3, 0, x, MPFR_RNDN);
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 36, 0, x, MPFR_RNDN);
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 62, 0, x, MPFR_RNDN);
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 64);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 63, MPFR_RNDN); /* x = -2^(-63) */
+ mpfr_add_ui (x, x, 1, MPFR_RNDN); /* x = 1 - 2^(-63) */
+ mpfr_mul_2exp (x, x, 32, MPFR_RNDN); /* x = 2^32 - 2^(-31) */
+ s = mpfr_get_str (NULL, &e, 3, 21, x, MPFR_RNDU);
+ if (strcmp (s, "102002022201221111211") || (e != 21))
+ {
+ printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with"
+ " 21 digits in base 3\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 3, 20, x, MPFR_RNDU);
+ if (strcmp (s, "10200202220122111122") || (e != 21))
+ {
+ printf ("Error in mpfr_get_str: 2^32-2^(-31) rounded up with"
+ " 20 digits in base 3\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* check corner case ret!=0, j0!=0 in mpfr_get_str_aux */
+ mpfr_set_prec (x, 100);
+ mpfr_set_str_binary (x, "0.1001011111010001101110010101010101111001010111111101101101100110100011110110000101110110001011110000E-9");
+ s = mpfr_get_str (NULL, &e, 3, 2, x, MPFR_RNDU);
+ if (strcmp (s, "22") || (e != -6))
+ {
+ printf ("Error in mpfr_get_str: 100-bit number rounded up with"
+ " 2 digits in base 3\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* check corner case exact=0 in mpfr_get_str_aux */
+ mpfr_set_prec (x, 100);
+ mpfr_set_str_binary (x, "0.1001001111101101111000101000110111111010101100000110010001111111011001101011101100001100110000000000E8");
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDZ);
+ if (strcmp (s, "14") || (e != 3))
+ {
+ printf ("Error in mpfr_get_str: 100-bit number rounded to zero with"
+ " 2 digits in base 10\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ for (p=4; p<=200; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_str (x, "6.5", 10, MPFR_RNDN);
+
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
+ if (strcmp (s, "10") || (e != 2))
+ {
+ printf ("Error in mpfr_get_str: 6.5 rounded to nearest with"
+ " 2 digits in base 6\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_nexttoinf (x);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
+ if (strcmp (s, "11") || (e != 2))
+ {
+ printf ("Error in mpfr_get_str: 6.5+ rounded to nearest with"
+ " 2 digits in base 6\ngot %se%d instead of 11e2\n",
+ s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str (x, "6.5", 10, MPFR_RNDN);
+ mpfr_nexttozero (x);
+ s = mpfr_get_str (NULL, &e, 6, 2, x, MPFR_RNDN);
+ if (strcmp (s, "10") || (e != 2))
+ {
+ printf ("Error in mpfr_get_str: 6.5- rounded to nearest with"
+ " 2 digits in base 6\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_ui (x, 7, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 2, 2, x, MPFR_RNDU);
+ if (strcmp (s, "10") || (e != 4))
+ {
+ printf ("Error in mpfr_get_str: 7 rounded up with 2 bits should"
+ " give 0.10e3 instead of 0.%s*2^%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* problem found by Fabrice Rouillier */
+ mpfr_set_prec (x, 63);
+ mpfr_set_str (x, "5e14", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
+ mpfr_free_str (s);
+
+ /* bug found by Johan Vervloet */
+ mpfr_set_prec (x, 6);
+ mpfr_set_str (x, "688.0", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 2, 4, x, MPFR_RNDU);
+ if (strcmp (s, "1011") || (e != 10))
+ {
+ printf ("Error in mpfr_get_str: 688 printed up to 4 bits should"
+ " give 1.011e9\ninstead of ");
+ mpfr_out_str (stdout, 2, 4, x, MPFR_RNDU);
+ puts ("");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 38);
+ mpfr_set_str_binary (x, "1.0001110111110100011010100010010100110e-6");
+ s = mpfr_get_str (NULL, &e, 8, 10, x, MPFR_RNDU);
+ if (strcmp (s, "1073721522") || (e != -1))
+ {
+ printf ("Error in mpfr_get_str (3): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_str_binary (x, "0.11010111011101100010000100010101110001000000010111001E454");
+ s = mpfr_get_str (NULL, &e, 19, 12, x, MPFR_RNDU);
+ if (strcmp (s, "b1cgfa4gha0h") || (e != 107))
+ {
+ printf ("Error in mpfr_get_str (4): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 145);
+ mpfr_set_str_binary (x, "-0.1000110011000001011000010101101010110110101100101110100011111100011110011001001001010000100001000011000011000000010111011001000111101001110100110e6");
+ s = mpfr_get_str (NULL, &e, 4, 53, x, MPFR_RNDU);
+ if (strcmp (s, "-20303001120111222312230232203330132121021100201003003") || (e != 3))
+ {
+ printf ("Error in mpfr_get_str (5): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 45);
+ mpfr_set_str_binary (x, "-0.00100111010110010001011001110111010001010010010");
+ s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN);
+ if (strcmp (s, "-4tchctq54") || (e != 0))
+ {
+ printf ("Error in mpfr_get_str (6): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* worst case found by Vincent Lefe`vre */
+ mpfr_set_prec (x, 53);
+ mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E164");
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
+ if (strcmp (s, "13076622631878654") || (e != 66))
+ {
+ printf ("Error in mpfr_get_str (7): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10000001001001001100011101010011011011111000011000100E93");
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
+ if (strcmp (s, "46") || e != 44)
+ {
+ printf ("Error in mpfr_get_str (8): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10010001111100000111001111010101001010000010111010101E55");
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
+ if (strcmp (s, "19") || e != 33)
+ {
+ printf ("Error in mpfr_get_str (9): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "11011001010010111110010101101100111110111000010110110E44");
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDN);
+ if (strcmp (s, "135") || e != 30)
+ {
+ printf ("Error in mpfr_get_str (10): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "11101111101000001011100001111000011111101111011001100E72");
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDN);
+ if (strcmp (s, "3981") || e != 38)
+ {
+ printf ("Error in mpfr_get_str (11): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10011001001100100010111100001101110101001001111110000E46");
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDN);
+ if (strcmp (s, "37930") || e != 30)
+ {
+ printf ("Error in mpfr_get_str (12): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10001100110111001011011110011011011101100011010001011E-72");
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDN);
+ if (strcmp (s, "104950") || e != -5)
+ {
+ printf ("Error in mpfr_get_str (13): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "10100100001011001000011001101101000110100110000010111E89");
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN);
+ if (strcmp (s, "3575392") || e != 43)
+ {
+ printf ("Error in mpfr_get_str (14): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "11000011011110110010100110001010000001010011001011001E-73");
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN);
+ if (strcmp (s, "72822386") || e != -6)
+ {
+ printf ("Error in mpfr_get_str (15): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "10101010001101000111001100001000100011100010010001010E78");
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN);
+ if (strcmp (s, "180992873") || e != 40)
+ {
+ printf ("Error in mpfr_get_str (16): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "10110111001000100000001101111001100101101110011011101E91");
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDN);
+ if (strcmp (s, "1595312255") || e != 44)
+ {
+ printf ("Error in mpfr_get_str (17): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E93");
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDN);
+ if (strcmp (s, "54835744350") || e != 44)
+ {
+ printf ("Error in mpfr_get_str (18): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E92");
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDN);
+ if (strcmp (s, "274178721752") || e != 44)
+ {
+ printf ("Error in mpfr_get_str (19): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10011101010111101111000100111011101011110100110110101E91");
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDN);
+ if (strcmp (s, "1370893608762") || e != 44)
+ {
+ printf ("Error in mpfr_get_str (20): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "10010011010110011100010010100101100011101000011111111E92");
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN);
+ if (strcmp (s, "25672105101864") || e != 44)
+ {
+ printf ("Error in mpfr_get_str (21): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "100110111110110001000101110100100101101000011111001E87");
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN);
+ if (strcmp (s, "212231308858721") || e != 42)
+ {
+ printf ("Error in mpfr_get_str (22): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10111010110000111000101100101111001011011100101001111E-128");
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDN);
+ if (strcmp (s, "193109287087290") || e != -22)
+ {
+ printf ("Error in mpfr_get_str (22b): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "10001101101011010001111110000111010111010000110101010E80");
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN);
+ if (strcmp (s, "6026241735727920") || e != 40)
+ {
+ printf ("Error in mpfr_get_str (23): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "100010001011101001110101000110011001001000110001001E-81");
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
+ if (strcmp (s, "49741483709103481") || e != -9)
+ {
+ printf ("Error in mpfr_get_str (24): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "11000100001001001110111010011001111001001010110101111E-101");
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDN);
+ if (strcmp (s, "2722049") || e != -14)
+ {
+ printf ("Error in mpfr_get_str (25): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-135");
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDN);
+ if (strcmp (s, "20138772") || e != -24)
+ {
+ printf ("Error in mpfr_get_str (26): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "11111001010011100101000001111111110001001001110110001E-136");
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDN);
+ if (strcmp (s, "100693858") || e != -24)
+ {
+ printf ("Error in mpfr_get_str (27): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10001000001110010110001011111011111011011010000110001E-110");
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDN);
+ if (strcmp (s, "36923634350619") || e != -17)
+ {
+ printf ("Error in mpfr_get_str (28): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "11001100010111000111100010000110011101110001000101111E-87");
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDN);
+ if (strcmp (s, "4646636036100804") || e != -10)
+ {
+ printf ("Error in mpfr_get_str (29): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "10011111001111110100001001010111111011010101111111000E-99");
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
+ if (strcmp (s, "88399901882446712") || e != -14)
+ {
+ printf ("Error in mpfr_get_str (30): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 8116315218207718*2^(-293) ~ 0.5100000000000000000015*10^(-72) */
+ mpfr_set_str_binary (x, "11100110101011011111011100101011101110110001111100110E-293");
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
+ if (strcmp (s, "52") || e != -72)
+ {
+ printf ("Error in mpfr_get_str (31u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD);
+ if (strcmp (s, "51") || e != -72)
+ {
+ printf ("Error in mpfr_get_str (31d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 6712731423444934*2^536 ~ .151000000000000000000067*10^178 */
+ mpfr_set_str_binary (x, "10111110110010011000110010011111101111000111111000110E536");
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDU);
+ if (strcmp (s, "152") || e != 178)
+ {
+ printf ("Error in mpfr_get_str (32u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 3, x, MPFR_RNDD);
+ if (strcmp (s, "151") || e != 178)
+ {
+ printf ("Error in mpfr_get_str (32d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 3356365711722467*2^540 ~ .120800000000000000000054*10^179 */
+ mpfr_set_str_binary (x, "1011111011001001100011001001111110111100011111100011E540");
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDU);
+ if (strcmp (s, "1209") || e != 179)
+ {
+ printf ("Error in mpfr_get_str (33u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 4, x, MPFR_RNDD);
+ if (strcmp (s, "1208") || e != 179)
+ {
+ printf ("Error in mpfr_get_str (33d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 6475049196144587*2^100 ~ .8208099999999999999999988*10^46 */
+ mpfr_set_str_binary (x, "10111000000010000010111011111001111010100011111001011E100");
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDU);
+ if (strcmp (s, "82081") || e != 46)
+ {
+ printf ("Error in mpfr_get_str (34u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 5, x, MPFR_RNDD);
+ if (strcmp (s, "82080") || e != 46)
+ {
+ printf ("Error in mpfr_get_str (34d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 6722280709661868*2^364 ~ .25260100000000000000000012*10^126 */
+ mpfr_set_str_binary (x, "10111111000011110000011110001110001111010010010101100E364");
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDU);
+ if (strcmp (s, "252602") || e != 126)
+ {
+ printf ("Error in mpfr_get_str (35u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 6, x, MPFR_RNDD);
+ if (strcmp (s, "252601") || e != 126)
+ {
+ printf ("Error in mpfr_get_str (35d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 5381065484265332*2^(-455) ~ .578389299999999999999999982*10^(-121) */
+ mpfr_set_str_binary (x, "10011000111100000110011110000101100111110011101110100E-455");
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDU);
+ if (strcmp (s, "5783893") || e != -121)
+ {
+ printf ("Error in mpfr_get_str (36u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 7, x, MPFR_RNDD);
+ if (strcmp (s, "5783892") || e != -121)
+ {
+ printf ("Error in mpfr_get_str (36d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 8369123604277281*2^(-852) ~ .27869147000000000000000000056*10^(-240) */
+ mpfr_set_str_binary (x, "11101101110111010110001101111100000111010100000100001E-852");
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDU);
+ if (strcmp (s, "27869148") || e != -240)
+ {
+ printf ("Error in mpfr_get_str (37u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 8, x, MPFR_RNDD);
+ if (strcmp (s, "27869147") || e != -240)
+ {
+ printf ("Error in mpfr_get_str (37d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 7976538478610756*2^377 ~ .245540326999999999999999999982*10^130 */
+ mpfr_set_str_binary (x, "11100010101101001111010010110100011100000100101000100E377");
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDU);
+ if (strcmp (s, "245540327") || e != 130)
+ {
+ printf ("Error in mpfr_get_str (38u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 9, x, MPFR_RNDD);
+ if (strcmp (s, "245540326") || e != 130)
+ {
+ printf ("Error in mpfr_get_str (38d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 8942832835564782*2^(-382) ~ .9078555839000000000000000000038*10^(-99) */
+ mpfr_set_str_binary (x, "11111110001010111010110000110011100110001010011101110E-382");
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDU);
+ if (strcmp (s, "9078555840") || e != -99)
+ {
+ printf ("Error in mpfr_get_str (39u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 10, x, MPFR_RNDD);
+ if (strcmp (s, "9078555839") || e != -99)
+ {
+ printf ("Error in mpfr_get_str (39d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 4471416417782391*2^(-380) ~ .18157111678000000000000000000077*10^(-98) */
+ mpfr_set_str_binary (x, "1111111000101011101011000011001110011000101001110111E-380");
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDU);
+ if (strcmp (s, "18157111679") || e != -98)
+ {
+ printf ("Error in mpfr_get_str (40u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 11, x, MPFR_RNDD);
+ if (strcmp (s, "18157111678") || e != -98)
+ {
+ printf ("Error in mpfr_get_str (40d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 7225450889282194*2^711 ~ .778380362292999999999999999999971*10^230 */
+ mpfr_set_str_binary (x, "11001101010111000001001100001100110010000001010010010E711");
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDU);
+ if (strcmp (s, "778380362293") || e != 230)
+ {
+ printf ("Error in mpfr_get_str (41u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 12, x, MPFR_RNDD);
+ if (strcmp (s, "778380362292") || e != 230)
+ {
+ printf ("Error in mpfr_get_str (41d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 3612725444641097*2^713 ~ .1556760724585999999999999999999942*10^231 */
+ mpfr_set_str_binary (x, "1100110101011100000100110000110011001000000101001001E713");
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDU);
+ if (strcmp (s, "1556760724586") || e != 231)
+ {
+ printf ("Error in mpfr_get_str (42u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 13, x, MPFR_RNDD);
+ if (strcmp (s, "1556760724585") || e != 231)
+ {
+ printf ("Error in mpfr_get_str (42d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 6965949469487146*2^(-248) ~ .15400733123779000000000000000000016*10^(-58) */
+ mpfr_set_str_binary (x, "11000101111110111111001111111101001101111000000101010E-248");
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDU);
+ if (strcmp (s, "15400733123780") || e != -58)
+ {
+ printf ("Error in mpfr_get_str (43u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 14, x, MPFR_RNDD);
+ if (strcmp (s, "15400733123779") || e != -58)
+ {
+ printf ("Error in mpfr_get_str (43d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 3482974734743573*2^(-244) ~ .12320586499023200000000000000000013*10^(-57) */
+ mpfr_set_str_binary (x, "1100010111111011111100111111110100110111100000010101E-244");
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDU);
+ if (strcmp (s, "123205864990233") || e != -57)
+ {
+ printf ("Error in mpfr_get_str (44u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 15, x, MPFR_RNDD);
+ if (strcmp (s, "123205864990232") || e != -57)
+ {
+ printf ("Error in mpfr_get_str (44d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 7542952370752766*2^(-919) ~ .170206189963739699999999999999999974*10^(-260) */
+ mpfr_set_str_binary (x, "11010110011000100011001110100100111011100110011111110E-919");
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDU);
+ if (strcmp (s, "1702061899637397") || e != -260)
+ {
+ printf ("Error in mpfr_get_str (45u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 16, x, MPFR_RNDD);
+ if (strcmp (s, "1702061899637396") || e != -260)
+ {
+ printf ("Error in mpfr_get_str (45d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* 5592117679628511*2^165 ~ .26153245263757307000000000000000000074*10^66 */
+ mpfr_set_str_binary (x, "10011110111100000000001011011110101100010000011011111E165");
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDU);
+ if (strcmp (s, "26153245263757308") || e != 66)
+ {
+ printf ("Error in mpfr_get_str (46u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDD);
+ if (strcmp (s, "26153245263757307") || e != 66)
+ {
+ printf ("Error in mpfr_get_str (46d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "11010010110111100001011010000110010000100001011011101E1223");
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
+ if (strcmp (s, "10716284017294180") || e != 385)
+ {
+ printf ("Error in mpfr_get_str (47n): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
+ if (strcmp (s, "107162840172941805") || e != 385)
+ {
+ printf ("Error in mpfr_get_str (47u): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD);
+ if (strcmp (s, "107162840172941804") || e != 385)
+ {
+ printf ("Error in mpfr_get_str (47d): s=%s e=%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_str_binary (x, "11111101111011000001010100001101101000010010001111E122620");
+ s = mpfr_get_str (NULL, &e, 10, 17, x, MPFR_RNDN);
+ if (strcmp (s, "22183435284042374") || e != 36928)
+ {
+ printf ("Error in mpfr_get_str (48n): s=%s e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDU);
+ if (strcmp (s, "221834352840423736") || e != 36928)
+ {
+ printf ("Error in mpfr_get_str (48u): s=%s e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ s = mpfr_get_str (NULL, &e, 10, 18, x, MPFR_RNDD);
+ if (strcmp (s, "221834352840423735") || e != 36928)
+ {
+ printf ("Error in mpfr_get_str (48d): s=%s e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 45);
+ mpfr_set_str_binary (x, "1E45");
+ s = mpfr_get_str (NULL, &e, 32, 9, x, MPFR_RNDN);
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 7);
+ mpfr_set_str_binary (x, "0.1010101E10");
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
+ mpfr_free_str (s);
+
+ /* checks rounding of negative numbers */
+ mpfr_set_prec (x, 7);
+ mpfr_set_str (x, "-11.5", 10, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDD);
+ if (strcmp (s, "-12"))
+ {
+ printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDD\n"
+ "got %s instead of -12\n", s);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDU);
+ if (strcmp (s, "-11"))
+ {
+ printf ("Error in mpfr_get_str for x=-11.5 and rnd=MPFR_RNDU\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ /* bug found by Jean-Pierre Merlet, produced error in mpfr_get_str */
+ mpfr_set_prec (x, 128);
+ mpfr_set_str_binary (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3");
+ s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDU);
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 381);
+ mpfr_set_str_binary (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010");
+ s = mpfr_get_str (NULL, &e, 10, 0, x, MPFR_RNDD);
+ if (e != 0)
+ {
+ printf ("Error in mpfr_get_str for x=0.999999..., exponent is %d"
+ " instead of 0\n", (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 5);
+ mpfr_set_str_binary (x, "1101.1"); /* 13.5, or (16)_7 + 1/2 */
+ s = mpfr_get_str (NULL, &e, 7, 2, x, MPFR_RNDN);
+ /* we are in the tie case: both surrounding numbers are (16)_7 and
+ (20)_7: since (16)_7 = 13 is odd and (20)_7 = 14 is even,
+ we should have s = "20" and e = 2 */
+ if (e != 2 || strcmp (s, "20"))
+ {
+ printf ("Error in mpfr_get_str for x=13.5, base 7\n");
+ printf ("Expected s=20, e=2, got s=%s, e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ /* try the same example, with input just below or above 13.5 */
+ mpfr_set_prec (x, 1000);
+ mpfr_set_str_binary (x, "1101.1");
+ mpfr_nextabove (x);
+ s = mpfr_get_str (NULL, &e, 7, 2, x, MPFR_RNDN);
+ if (e != 2 || strcmp (s, "20"))
+ {
+ printf ("Error in mpfr_get_str for x=13.5+tiny, base 7\n");
+ printf ("Expected s=20, e=2, got s=%s, e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "1101.1");
+ mpfr_nextbelow (x);
+ s = mpfr_get_str (NULL, &e, 7, 2, x, MPFR_RNDN);
+ if (e != 2 || strcmp (s, "16"))
+ {
+ printf ("Error in mpfr_get_str for x=13.5-tiny, base 7\n");
+ printf ("Expected s=16, e=2, got s=%s, e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_prec (x, 7);
+ mpfr_set_str_binary (x, "110000.1"); /* 48.5, or (66)_7 + 1/2 */
+ s = mpfr_get_str (NULL, &e, 7, 2, x, MPFR_RNDN);
+ /* we are in the tie case: both surrounding numbers are (66)_7 and
+ (100)_7: since (66)_7 = 48 is even and (100)_7 is odd,
+ we should hase s = "66" and e = 2 */
+ if (e != 2 || strcmp (s, "66"))
+ {
+ printf ("Error in mpfr_get_str for x=48.5, base 7\n");
+ printf ("Expected s=66, e=2, got s=%s, e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ /* try the same example, with input just below or above 48.5 */
+ mpfr_set_prec (x, 1000);
+ mpfr_set_str_binary (x, "110000.1");
+ mpfr_nextabove (x);
+ s = mpfr_get_str (NULL, &e, 7, 2, x, MPFR_RNDN);
+ if (e != 3 || strcmp (s, "10"))
+ {
+ printf ("Error in mpfr_get_str for x=48.5+tiny, base 7\n");
+ printf ("Expected s=10, e=3, got s=%s, e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_set_str_binary (x, "110000.1");
+ mpfr_nextbelow (x);
+ s = mpfr_get_str (NULL, &e, 7, 2, x, MPFR_RNDN);
+ if (e != 2 || strcmp (s, "66"))
+ {
+ printf ("Error in mpfr_get_str for x=48.5-tiny, base 7\n");
+ printf ("Expected s=66, e=2, got s=%s, e=%ld\n", s, (long) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_clear (x);
+}
+
+/* bugs found by Alain Delplanque */
+static void
+check_large (void)
+{
+ mpfr_t x;
+ char *s, s1[7];
+ const char xm[] = { '1', '1', '9', '1', '3', '2', '9', '3', '7', '3',
+ '5', '8', '4', '4', '5', '4', '9', '0', '2', '9',
+ '6', '3', '4', '4', '6', '9', '9', '1', '9', '5',
+ '5', '7', '2', '0', '1', '7', '5', '2', '8', '6',
+ '1', '2', '5', '2', '5', '2', '7', '4', '0', '2',
+ '7', '9', '1', '1', '7', '4', '5', '6', '7', '5',
+ '9', '3', '1', '4', '2', '5', '5', '6', '6', '6',
+ '1', '6', '4', '3', '8', '1', '2', '8', '7', '6',
+ '2', '9', '2', '0', '8', '8', '9', '4', '3', '9',
+ '6', '2', '8', '4', '1', '1', '8', '1', '0', '6',
+ '2', '3', '7', '6', '3', '8', '1', '5', '1', '7',
+ '3', '4', '6', '1', '2', '4', '0', '1', '3', '0',
+ '8', '4', '1', '3', '9', '3', '2', '0', '1', '6',
+ '3', '6', '7', '1', '5', '1', '7', '5', '0', '1',
+ '9', '8', '4', '0', '8', '2', '7', '9', '1', '3',
+ '2', '2', '8', '3', '4', '1', '6', '2', '3', '9',
+ '6', '2', '0', '7', '3', '5', '5', '5', '3', '4',
+ '2', '1', '7', '0', '9', '7', '6', '2', '1', '0',
+ '3', '3', '5', '4', '7', '6', '0', '9', '7', '6',
+ '9', '3', '5', '1', '7', '8', '6', '8', '8', '2',
+ '8', '1', '4', '3', '7', '4', '3', '3', '2', '4',
+ '1', '5', '4', '7', '8', '1', '1', '4', '2', '1',
+ '2', '4', '2', '7', '6', '5', '9', '5', '4', '5',
+ '2', '6', '7', '3', '0', '3', '4', '0', '6', '9',
+ '1', '8', '9', '9', '9', '8', '0', '5', '7', '0',
+ '9', '3', '8', '7', '6', '2', '4', '6', '1', '6',
+ '7', '2', '0', '3', '5', '9', '3', '5', '8', '8',
+ '9', '7', '7', '9', '2', '7', '0', '8', '1', '6',
+ '8', '7', '4', '8', '5', '3', '0', '8', '4', '3',
+ '5', '6', '5', '1', '6', '6', '0', '9', '7', '9',
+ '8', '9', '2', '7', '2', '6', '8', '5', '9', '4',
+ '5', '8', '1', '3', '7', '2', '9', '3', '8', '3',
+ '7', '9', '1', '7', '9', '9', '7', '7', '2', '8',
+ '4', '6', '5', '5', '7', '3', '3', '8', '3', '6',
+ '6', '9', '7', '1', '4', '3', '3', '7', '1', '4',
+ '9', '4', '1', '2', '4', '9', '5', '1', '4', '7',
+ '2', '6', '4', '4', '8', '0', '6', '2', '6', '0',
+ '6', '9', '8', '1', '1', '7', '9', '9', '3', '9',
+ '3', '8', '4', '7', '3', '1', '9', '0', '2', '3',
+ '5', '3', '5', '4', '2', '1', '1', '7', '6', '7',
+ '4', '3', '2', '2', '0', '6', '5', '9', '9', '3',
+ '2', '6', '7', '1', '2', '0', '0', '3', '7', '3',
+ '8', '7', '4', '3', '3', '3', '3', '3', '2', '3',
+ '8', '2', '8', '6', '3', '1', '5', '5', '2', '2',
+ '5', '9', '3', '3', '7', '0', '6', '2', '8', '1',
+ '0', '3', '6', '7', '6', '9', '6', '5', '9', '0',
+ '6', '6', '6', '3', '6', '9', '9', '3', '8', '7',
+ '6', '5', '4', '5', '3', '5', '9', '4', '0', '0',
+ '7', '5', '8', '5', '4', '1', '4', '3', '1', '5',
+ '7', '6', '6', '3', '4', '4', '5', '0', '8', '7',
+ '5', '7', '5', '0', '1', '0', '1', '8', '4', '7',
+ '3', '1', '9', '9', '2', '7', '1', '1', '1', '2',
+ '3', '9', '9', '6', '5', '9', '2', '3', '2', '8',
+ '1', '5', '5', '1', '2', '6', '4', '9', '6', '6',
+ '4', '5', '1', '1', '6', '0', '0', '3', '2', '8',
+ '4', '8', '7', '1', '4', '9', '6', '8', '1', '6',
+ '5', '9', '8', '3', '4', '2', '9', '7', '0', '1',
+ '9', '2', '6', '6', '9', '1', '3', '5', '9', '3',
+ '2', '9', '6', '2', '3', '0', '6', '0', '1', '1',
+ '6', '5', '1', '7', '9', '0', '7', '5', '8', '6',
+ '8', '4', '2', '1', '0', '3', '8', '6', '6', '4',
+ '4', '9', '9', '7', '5', '8', '1', '7', '5', '7',
+ '9', '6', '6', '8', '8', '5', '8', '6', '7', '4',
+ '0', '7', '2', '0', '2', '9', '9', '4', '4', '1',
+ '9', '5', '8', '6', '5', '0', '6', '7', '4', '2',
+ '7', '3', '2', '3', '2', '7', '0', '2', '1', '3',
+ '0', '5', '9', '0', '3', '9', '1', '4', '5', '3',
+ '7', '2', '7', '0', '8', '5', '5', '4', '6', '1',
+ '1', '0', '0', '9', '2', '0', '4', '1', '6', '6',
+ '4', '6', '9', '1', '3', '2', '8', '5', '0', '3',
+ '3', '8', '9', '8', '7', '8', '5', '9', '5', '5',
+ '9', '1', '9', '3', '6', '5', '4', '1', '7', '4',
+ '0', '2', '4', '7', '2', '9', '7', '1', '2', '4',
+ '5', '8', '1', '4', '4', '6', '1', '8', '5', '8',
+ '7', '6', '9', '7', '2', '1', '2', '0', '8', '9',
+ '5', '9', '5', '5', '3', '8', '1', '2', '5', '4',
+ '3', '0', '7', '6', '5', '1', '7', '8', '2', '0',
+ '0', '7', '6', '7', '4', '8', '1', '0', '6', '3',
+ '2', '3', '0', '5', '2', '5', '0', '1', '1', '4',
+ '3', '8', '4', '5', '2', '3', '9', '5', '0', '9',
+ '8', '2', '6', '4', '7', '4', '8', '0', '1', '1',
+ '7', '1', '5', '4', '9', '0', '9', '2', '2', '3',
+ '8', '1', '6', '9', '0', '4', '6', '4', '5', '4',
+ '6', '3', '8', '7', '3', '6', '1', '7', '2', '3',
+ '4', '5', '5', '2', '0', '2', '5', '8', '1', '4',
+ '9', '3', '0', '7', '4', '1', '6', '8', '7', '8',
+ '2', '6', '2', '5', '1', '0', '7', '4', '7', '3',
+ '6', '6', '4', '5', '6', '6', '6', '6', '8', '5',
+ '1', '3', '5', '7', '1', '6', '2', '0', '9', '2',
+ '3', '2', '6', '0', '7', '9', '8', '1', '6', '2',
+ '0', '3', '8', '8', '0', '2', '8', '7', '7', '5',
+ '9', '3', '1', '0', '6', '7', '5', '7', '3', '1',
+ '2', '7', '7', '2', '0', '0', '4', '1', '2', '8',
+ '2', '0', '8', '4', '0', '5', '0', '5', '0', '1',
+ '9', '3', '3', '6', '3', '6', '9', '6', '2', '8',
+ '2', '9', '7', '5', '3', '8', '8', '9', '1', '1',
+ '4', '5', '7', '7', '5', '6', '0', '2', '7', '9',
+ '7', '2', '1', '7', '4', '3', '0', '3', '6', '7',
+ '3', '7', '2', '2', '7', '5', '6', '2', '3', '1',
+ '2', '1', '3', '1', '4', '2', '6', '9', '2', '3',
+ '\0' };
+ mpfr_exp_t e;
+
+ mpfr_init2 (x, 3322);
+ mpfr_set_str (x, xm, 10, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 4343, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
+ if (s[999] != '1') /* s must be 5.04383...689071e-309 */
+ {
+ printf ("Error in check_large: expected '689071', got '%s'\n",
+ s + 994);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_mul_2exp (x, x, 4343, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
+ if (strcmp (s, "12") || (e != 1000))
+ {
+ printf ("Error in check_large: expected 0.12e1000\n");
+ printf ("got %se%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_set_nan (x);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
+ if (strcmp (s, "@NaN@"))
+ {
+ printf ("Error for NaN\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
+
+ mpfr_set_inf (x, 1);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
+ if (strcmp (s, "@Inf@"))
+ {
+ printf ("Error for Inf\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
+
+ mpfr_set_inf (x, -1);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, MPFR_RNDN);
+ if (strcmp (s, "-@Inf@"))
+ {
+ printf ("Error for -Inf\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+
+ mpfr_get_str (s1, &e, 10, 1000, x, MPFR_RNDN);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
+ if (e != 0 || strcmp (s, "00"))
+ {
+ printf ("Error for 0.0\n");
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN);
+
+ mpfr_neg (x, x, MPFR_RNDN); /* -0.0 */
+ s = mpfr_get_str (NULL, &e, 10, 2, x, MPFR_RNDN);
+ if (e != 0 || strcmp (s, "-00"))
+ {
+ printf ("Error for -0.0\ngot %se%d\n", s, (int) e);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_get_str (s1, &e, 10, 2, x, MPFR_RNDN);
+
+ mpfr_clear (x);
+}
+
+#define MAX_DIGITS 100
+
+static void
+check_special (int b, mpfr_prec_t p)
+{
+ mpfr_t x;
+ int i, j;
+ char s[MAX_DIGITS + 2], s2[MAX_DIGITS + 2], c;
+ mpfr_exp_t e;
+ int r;
+ size_t m;
+
+ /* check for invalid base */
+ if (mpfr_get_str (s, &e, 1, 10, x, MPFR_RNDN) != NULL)
+ {
+ printf ("Error: mpfr_get_str should not accept base = 1\n");
+ exit (1);
+ }
+ if (mpfr_get_str (s, &e, 63, 10, x, MPFR_RNDN) != NULL)
+ {
+ printf ("Error: mpfr_get_str should not accept base = 63\n");
+ exit (1);
+ }
+
+ s2[0] = '1';
+ for (i=1; i<MAX_DIGITS+2; i++)
+ s2[i] = '0';
+
+ mpfr_init2 (x, p);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ for (i=1; i<MAX_DIGITS && mpfr_mul_ui (x, x, b, MPFR_RNDN) == 0; i++)
+ {
+ /* x = b^i (exact) */
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ for (m= (i<3)? 2 : i-1 ; (int) m <= i+1 ; m++)
+ {
+ mpfr_get_str (s, &e, b, m, x, (mpfr_rnd_t) r);
+ /* s should be 1 followed by (m-1) zeros, and e should be i+1 */
+ if ((e != i+1) || strncmp (s, s2, m) != 0)
+ {
+ printf ("Error in mpfr_get_str for %d^%d\n", b, i);
+ exit (1);
+ }
+ }
+ if (mpfr_sub_ui (x, x, 1, MPFR_RNDN) != 0)
+ break;
+ /* now x = b^i-1 (exact) */
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ if (i >= 2)
+ {
+ mpfr_get_str (s, &e, b, i, x, (mpfr_rnd_t) r);
+ /* should be i times (b-1) */
+ c = (b <= 10) ? '0' + b - 1 : 'a' + (b - 11);
+ for (j=0; (j < i) && (s[j] == c); j++);
+ if ((j < i) || (e != i))
+ {
+ printf ("Error in mpfr_get_str for %d^%d-1\n", b, i);
+ printf ("got 0.%s*2^%d\n", s, (int) e);
+ exit (1);
+ }
+ }
+ if (i >= 3)
+ {
+ mpfr_get_str (s, &e, b, i - 1, x, MPFR_RNDU);
+ /* should be b^i */
+ if ((e != i+1) || strncmp (s, s2, i - 1) != 0)
+ {
+ printf ("Error in mpfr_get_str for %d^%d-1\n", b, i);
+ printf ("got 0.%s*2^%d\n", s, (int) e);
+ exit (1);
+ }
+ }
+
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ }
+ mpfr_clear (x);
+}
+
+static void
+check_bug_base2k (void)
+{
+ /*
+ * -2.63b22b55697e800000000000@130
+ * +-0.1001100011101100100010101101010101011010010111111010000000000000000000000000+00000000000000000000001E522
+ */
+ mpfr_t xx, yy, zz;
+ char *s;
+ mpfr_exp_t e;
+
+ mpfr_init2 (xx, 107);
+ mpfr_init2 (yy, 79);
+ mpfr_init2 (zz, 99);
+
+ mpfr_set_str (xx, "-1.90e8c3e525d7c0000000000000@-18", 16, MPFR_RNDN);
+ mpfr_set_str (yy, "-2.63b22b55697e8000000@130", 16, MPFR_RNDN);
+ mpfr_add (zz, xx, yy, MPFR_RNDD);
+ s = mpfr_get_str (NULL, &e, 16, 0, zz, MPFR_RNDN);
+ if (strcmp (s, "-263b22b55697e8000000000008"))
+ {
+ printf ("Error for get_str base 16\n"
+ "Got %s expected -263b22b55697e8000000000008\n", s);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_clears (xx, yy, zz, (mpfr_ptr) 0);
+}
+
+static void
+check_reduced_exprange (void)
+{
+ mpfr_t x;
+ char *s;
+ mpfr_exp_t emax, e;
+
+ emax = mpfr_get_emax ();
+ mpfr_init2 (x, 8);
+ mpfr_set_str (x, "0.11111111E0", 2, MPFR_RNDN);
+ set_emax (0);
+ s = mpfr_get_str (NULL, &e, 16, 0, x, MPFR_RNDN);
+ set_emax (emax);
+ if (strcmp (s, "ff0"))
+ {
+ printf ("Error for mpfr_get_str on 0.11111111E0 in base 16:\n"
+ "Got \"%s\" instead of \"ff0\".\n", s);
+ exit (1);
+ }
+ mpfr_free_str (s);
+ mpfr_clear (x);
+}
+
+#define ITER 1000
+
+int
+main (int argc, char *argv[])
+{
+ int b;
+ mpfr_t x;
+ mpfr_rnd_t r;
+ char s[MAX_DIGITS + 2];
+ mpfr_exp_t e, f;
+ size_t m;
+ mpfr_prec_t p;
+ int i;
+
+ tests_start_mpfr ();
+
+ check_small ();
+
+ check_special (2, 2);
+ for (i = 0; i < ITER; i++)
+ {
+ p = 2 + (randlimb () % (MAX_DIGITS - 1));
+ b = 2 + (randlimb () % 35);
+ check_special (b, p);
+ }
+
+ mpfr_init2 (x, MAX_DIGITS);
+ for (i = 0; i < ITER; i++)
+ {
+ m = 2 + (randlimb () % (MAX_DIGITS - 1));
+ mpfr_urandomb (x, RANDS);
+ e = (mpfr_exp_t) (randlimb () % 21) - 10;
+ mpfr_set_exp (x, (e == -10) ? mpfr_get_emin () :
+ ((e == 10) ? mpfr_get_emax () : e));
+ b = 2 + (randlimb () % 35);
+ r = RND_RAND ();
+ mpfr_get_str (s, &f, b, m, x, r);
+ }
+ mpfr_clear (x);
+
+ check_large ();
+ check3 ("4.059650008e-83", MPFR_RNDN, "40597");
+ check3 ("-6.606499965302424244461355e233", MPFR_RNDN, "-66065");
+ check3 ("-7.4", MPFR_RNDN, "-74000");
+ check3 ("0.997", MPFR_RNDN, "99700");
+ check3 ("-4.53063926135729747564e-308", MPFR_RNDN, "-45306");
+ check3 ("2.14478198760196000000e+16", MPFR_RNDN, "21448");
+ check3 ("7.02293374921793516813e-84", MPFR_RNDN, "70229");
+
+ check3 ("-6.7274500420134077e-87", MPFR_RNDN, "-67275");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDZ, "-67274");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDU, "-67274");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDD, "-67275");
+ check3 ("-6.7274500420134077e-87", MPFR_RNDA, "-67275");
+
+ check3 ("6.7274500420134077e-87", MPFR_RNDN, "67275");
+ check3 ("6.7274500420134077e-87", MPFR_RNDZ, "67274");
+ check3 ("6.7274500420134077e-87", MPFR_RNDU, "67275");
+ check3 ("6.7274500420134077e-87", MPFR_RNDD, "67274");
+ check3 ("6.7274500420134077e-87", MPFR_RNDA, "67275");
+
+ check_bug_base2k ();
+ check_reduced_exprange ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tget_z.c b/tests/tget_z.c
new file mode 100644
index 0000000..f21f125
--- /dev/null
+++ b/tests/tget_z.c
@@ -0,0 +1,201 @@
+/* Test file for mpz_set_fr / mpfr_get_z.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check_diff (void)
+{
+ int inex;
+ mpfr_t x;
+ mpz_t z;
+ mpfr_exp_t emin;
+
+ mpz_init (z);
+ mpfr_init2 (x, 2);
+
+ mpfr_set_ui (x, 2047, MPFR_RNDU);
+ mpz_set_fr (z, x, MPFR_RNDN);
+ if (mpz_cmp_ui (z, 2048) != 0)
+ {
+ printf ("get_z RU 2048 failed\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 6);
+ mpfr_set_str (x, "17.5", 10, MPFR_RNDN);
+ inex = mpfr_get_z (z, x, MPFR_RNDN);
+ if (inex <= 0 || mpz_cmp_ui (z, 18) != 0)
+ {
+ printf ("get_z RN 17.5 failed\n");
+ exit (1);
+ }
+
+ /* save default emin */
+ emin = mpfr_get_emin ();;
+
+ mpfr_set_emin (17);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = mpfr_get_z (z, x, MPFR_RNDN);
+ if (inex != 0 || mpz_cmp_ui (z, 0) != 0)
+ {
+ printf ("get_z 0 failed\n");
+ exit (1);
+ }
+
+ /* restore default emin */
+ mpfr_set_emin (emin);
+
+ mpfr_clear (x);
+ mpz_clear (z);
+}
+
+static void
+check_one (mpz_ptr z)
+{
+ int inex;
+ int sh, neg;
+ mpfr_t f;
+ mpz_t got;
+
+ mpfr_init2 (f, MAX( mpz_sizeinbase (z, 2), MPFR_PREC_MIN) );
+ mpz_init (got);
+
+ for (sh = -2*GMP_NUMB_BITS ; sh < 2*GMP_NUMB_BITS ; sh++)
+ {
+ for (neg = 0; neg <= 1; neg++)
+ {
+ mpz_neg (z, z);
+ mpfr_set_z (f, z, MPFR_RNDN);
+
+ if (sh < 0)
+ {
+ mpz_tdiv_q_2exp (z, z, -sh);
+ mpfr_div_2exp (f, f, -sh, MPFR_RNDN);
+ }
+ else
+ {
+ mpz_mul_2exp (z, z, sh);
+ mpfr_mul_2exp (f, f, sh, MPFR_RNDN);
+ }
+
+ inex = mpfr_get_z (got, f, MPFR_RNDZ);
+
+ if (mpz_cmp (got, z) != 0)
+ {
+ printf ("Wrong result for shift=%d\n", sh);
+ printf (" f "); mpfr_dump (f);
+ printf (" got "); mpz_dump (got);
+ printf (" want "); mpz_dump (z);
+ exit (1);
+ }
+ if (! SAME_SIGN (inex, - mpfr_cmp_z (f, z)))
+ {
+ printf ("Wrong inexact value for shift=%d\n", sh);
+ printf (" f "); mpfr_dump (f);
+ printf (" got %+d\n", inex);
+ printf (" want %+d\n", -mpfr_cmp_z (f, z));
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (f);
+ mpz_clear (got);
+}
+
+static void
+check (void)
+{
+ mpz_t z;
+
+ mpz_init (z);
+
+ mpz_set_ui (z, 0L);
+ check_one (z);
+
+ mpz_set_si (z, 123L);
+ check_one (z);
+
+ mpz_rrandomb (z, RANDS, 2*GMP_NUMB_BITS);
+ check_one (z);
+
+ mpz_rrandomb (z, RANDS, 5*GMP_NUMB_BITS);
+ check_one (z);
+
+ mpz_clear (z);
+}
+
+static void
+special (void)
+{
+ int inex;
+ mpfr_t x;
+ mpz_t z;
+ int i;
+ mpfr_exp_t e;
+
+ mpfr_init2 (x, 2);
+ mpz_init (z);
+
+ for (i = -1; i <= 1; i++)
+ {
+ if (i != 0)
+ mpfr_set_nan (x);
+ else
+ mpfr_set_inf (x, i);
+ mpfr_clear_flags ();
+ inex = mpfr_get_z (z, x, MPFR_RNDN);
+ if (!mpfr_erangeflag_p () || inex != 0 || mpz_cmp_ui (z, 0) != 0)
+ {
+ printf ("special() failed on mpfr_get_z for i = %d\n", i);
+ exit (1);
+ }
+ mpfr_clear_flags ();
+ e = mpfr_get_z_2exp (z, x);
+ if (!mpfr_erangeflag_p () || e != __gmpfr_emin ||
+ mpz_cmp_ui (z, 0) != 0)
+ {
+ printf ("special() failed on mpfr_get_z_2exp for i = %d\n", i);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpz_clear (z);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ check ();
+ check_diff ();
+ special ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tgmpop.c b/tests/tgmpop.c
new file mode 100644
index 0000000..56e9cdc
--- /dev/null
+++ b/tests/tgmpop.c
@@ -0,0 +1,1265 @@
+/* Test file for mpfr_add_[q,z], mpfr_sub_[q,z], mpfr_div_[q,z],
+ mpfr_mul_[q,z], mpfr_cmp_[f,q,z]
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpfr-test.h"
+
+#define CHECK_FOR(str, cond) \
+ if ((cond) == 0) { \
+ printf ("Special case error %s. Ternary value = %d, flags = %u\n", \
+ str, res, __gmpfr_flags); \
+ printf ("Got "); mpfr_dump (y); \
+ printf ("X = "); mpfr_dump (x); \
+ printf ("Q = "); mpz_dump (mpq_numref(q)); \
+ printf (" /"); mpz_dump (mpq_denref(q)); \
+ exit (1); \
+ }
+
+#define CHECK_FORZ(str, cond) \
+ if ((cond) == 0) { \
+ printf ("Special case error %s. Ternary value = %d, flags = %u\n", \
+ str, res, __gmpfr_flags); \
+ printf ("Got "); mpfr_dump (y); \
+ printf ("X = "); mpfr_dump (x); \
+ printf ("Z = "); mpz_dump (z); \
+ exit (1); \
+ }
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ mpq_t q;
+ mpz_t z;
+ int res = 0;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpq_init (q);
+ mpz_init (z);
+
+ /* cancellation in mpfr_add_q */
+ mpfr_set_prec (x, 60);
+ mpfr_set_prec (y, 20);
+ mpz_set_str (mpq_numref (q), "-187207494", 10);
+ mpz_set_str (mpq_denref (q), "5721", 10);
+ mpfr_set_str_binary (x, "11111111101001011011100101100011011110010011100010000100001E-44");
+ mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("cancelation in add_q", mpfr_cmp_ui_2exp (y, 256783, -64) == 0);
+
+ mpfr_set_prec (x, 19);
+ mpfr_set_str_binary (x, "0.1011110101110011100E0");
+ mpz_set_str (mpq_numref (q), "187207494", 10);
+ mpz_set_str (mpq_denref (q), "5721", 10);
+ mpfr_set_prec (y, 29);
+ mpfr_add_q (y, x, q, MPFR_RNDD);
+ mpfr_set_prec (x, 29);
+ mpfr_set_str_binary (x, "11111111101001110011010001001E-14");
+ CHECK_FOR ("cancelation in add_q", mpfr_cmp (x,y) == 0);
+
+ /* Inf */
+ mpfr_set_inf (x, 1);
+ mpz_set_str (mpq_numref (q), "395877315", 10);
+ mpz_set_str (mpq_denref (q), "3508975966", 10);
+ mpfr_set_prec (y, 118);
+ mpfr_add_q (y, x, q, MPFR_RNDU);
+ CHECK_FOR ("inf", mpfr_inf_p (y) && mpfr_sgn (y) > 0);
+ mpfr_sub_q (y, x, q, MPFR_RNDU);
+ CHECK_FOR ("inf", mpfr_inf_p (y) && mpfr_sgn (y) > 0);
+
+ /* Nan */
+ MPFR_SET_NAN (x);
+ mpfr_add_q (y, x, q, MPFR_RNDU);
+ CHECK_FOR ("nan", mpfr_nan_p (y));
+ mpfr_sub_q (y, x, q, MPFR_RNDU);
+ CHECK_FOR ("nan", mpfr_nan_p (y));
+
+ /* Exact value */
+ mpfr_set_prec (x, 60);
+ mpfr_set_prec (y, 60);
+ mpfr_set_str1 (x, "0.5");
+ mpz_set_str (mpq_numref (q), "3", 10);
+ mpz_set_str (mpq_denref (q), "2", 10);
+ res = mpfr_add_q (y, x, q, MPFR_RNDU);
+ CHECK_FOR ("0.5+3/2", mpfr_cmp_ui(y, 2)==0 && res==0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDU);
+ CHECK_FOR ("0.5-3/2", mpfr_cmp_si(y, -1)==0 && res==0);
+
+ /* Inf Rationnal */
+ mpq_set_ui (q, 1, 0);
+ mpfr_set_str1 (x, "0.5");
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("0.5+1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("0.5-1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0);
+ mpq_set_si (q, -1, 0);
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("0.5+ -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("0.5- -1/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
+ res = mpfr_div_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("0.5 / (-1/0)", mpfr_zero_p (y) && MPFR_SIGN (y) < 0 && res == 0);
+ mpq_set_ui (q, 1, 0);
+ mpfr_set_inf (x, 1);
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("+Inf + +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("+Inf - +Inf", MPFR_IS_NAN (y) && res == 0);
+ mpfr_set_inf (x, -1);
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("-Inf + +Inf", MPFR_IS_NAN (y) && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("-Inf - +Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0);
+ mpq_set_si (q, -1, 0);
+ mpfr_set_inf (x, 1);
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("+Inf + -Inf", MPFR_IS_NAN (y) && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("+Inf - -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0);
+ mpfr_set_inf (x, -1);
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("-Inf + -Inf", mpfr_inf_p (y) && MPFR_SIGN (y) < 0 && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("-Inf - -Inf", MPFR_IS_NAN (y) && res == 0);
+
+ /* 0 */
+ mpq_set_ui (q, 0, 1);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ res = mpfr_add_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("42+0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0);
+ res = mpfr_sub_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("42-0/1", mpfr_cmp_ui (y, 42) == 0 && res == 0);
+ res = mpfr_mul_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("42*0/1", mpfr_zero_p (y) && MPFR_SIGN (y) > 0 && res == 0);
+ mpfr_clear_flags ();
+ res = mpfr_div_q (y, x, q, MPFR_RNDN);
+ CHECK_FOR ("42/(0/1)", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0
+ && mpfr_divby0_p ());
+ mpz_set_ui (z, 0);
+ mpfr_clear_flags ();
+ res = mpfr_div_z (y, x, z, MPFR_RNDN);
+ CHECK_FORZ ("42/0", mpfr_inf_p (y) && MPFR_SIGN (y) > 0 && res == 0
+ && mpfr_divby0_p ());
+
+ mpz_clear (z);
+ mpq_clear (q);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_for_zero (void)
+{
+ /* Check that 0 is unsigned! */
+ mpq_t q;
+ mpz_t z;
+ mpfr_t x;
+ int r;
+ mpfr_sign_t i;
+
+ mpfr_init (x);
+ mpz_init (z);
+ mpq_init (q);
+
+ mpz_set_ui (z, 0);
+ mpq_set_ui (q, 0, 1);
+
+ MPFR_SET_ZERO (x);
+ RND_LOOP (r)
+ {
+ for (i = MPFR_SIGN_NEG ; i <= MPFR_SIGN_POS ;
+ i+=MPFR_SIGN_POS-MPFR_SIGN_NEG)
+ {
+ MPFR_SET_SIGN(x, i);
+ mpfr_add_z (x, x, z, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || MPFR_SIGN(x)!=i)
+ {
+ printf("GMP Zero errors for add_z & rnd=%s & s=%d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_sub_z (x, x, z, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || MPFR_SIGN(x)!=i)
+ {
+ printf("GMP Zero errors for sub_z & rnd=%s & s=%d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_mul_z (x, x, z, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || MPFR_SIGN(x)!=i)
+ {
+ printf("GMP Zero errors for mul_z & rnd=%s & s=%d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_add_q (x, x, q, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || MPFR_SIGN(x)!=i)
+ {
+ printf("GMP Zero errors for add_q & rnd=%s & s=%d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_sub_q (x, x, q, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || MPFR_SIGN(x)!=i)
+ {
+ printf("GMP Zero errors for sub_q & rnd=%s & s=%d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ }
+ }
+
+ mpq_clear (q);
+ mpz_clear (z);
+ mpfr_clear (x);
+}
+
+static void
+test_cmp_z (mpfr_prec_t pmin, mpfr_prec_t pmax, int nmax)
+{
+ mpfr_t x, z;
+ mpz_t y;
+ mpfr_prec_t p;
+ int res1, res2;
+ int n;
+
+ mpfr_init (x);
+ mpfr_init2 (z, MPFR_PREC_MIN);
+ mpz_init (y);
+
+ /* check the erange flag when x is NaN */
+ mpfr_set_nan (x);
+ mpz_set_ui (y, 17);
+ mpfr_clear_erangeflag ();
+ res1 = mpfr_cmp_z (x, y);
+ if (res1 != 0 || mpfr_erangeflag_p () == 0)
+ {
+ printf ("Error for mpfr_cmp_z (NaN, 17)\n");
+ printf ("Return value: expected 0, got %d\n", res1);
+ printf ("Erange flag: expected set, got %d\n", mpfr_erangeflag_p ());
+ exit (1);
+ }
+
+ for(p=pmin ; p < pmax ; p++)
+ {
+ mpfr_set_prec (x, p);
+ for ( n = 0; n < nmax ; n++)
+ {
+ mpfr_urandomb (x, RANDS);
+ mpz_urandomb (y, RANDS, 1024);
+ if (!MPFR_IS_SINGULAR (x))
+ {
+ mpfr_sub_z (z, x, y, MPFR_RNDN);
+ res1 = mpfr_sgn (z);
+ res2 = mpfr_cmp_z (x, y);
+ if (res1 != res2)
+ {
+ printf("Error for mpfr_cmp_z: res=%d sub_z gives %d\n",
+ res2, res1);
+ exit (1);
+ }
+ }
+ }
+ }
+ mpz_clear (y);
+ mpfr_clear (x);
+ mpfr_clear (z);
+}
+
+static void
+test_cmp_q (mpfr_prec_t pmin, mpfr_prec_t pmax, int nmax)
+{
+ mpfr_t x, z;
+ mpq_t y;
+ mpfr_prec_t p;
+ int res1, res2;
+ int n;
+
+ mpfr_init (x);
+ mpfr_init2 (z, MPFR_PREC_MIN);
+ mpq_init (y);
+
+ /* check the erange flag when x is NaN */
+ mpfr_set_nan (x);
+ mpq_set_ui (y, 17, 1);
+ mpfr_clear_erangeflag ();
+ res1 = mpfr_cmp_q (x, y);
+ if (res1 != 0 || mpfr_erangeflag_p () == 0)
+ {
+ printf ("Error for mpfr_cmp_q (NaN, 17)\n");
+ printf ("Return value: expected 0, got %d\n", res1);
+ printf ("Erange flag: expected set, got %d\n", mpfr_erangeflag_p ());
+ exit (1);
+ }
+
+ for(p=pmin ; p < pmax ; p++)
+ {
+ mpfr_set_prec (x, p);
+ for (n = 0 ; n < nmax ; n++)
+ {
+ mpfr_urandomb (x, RANDS);
+ mpq_set_ui (y, randlimb (), randlimb() );
+ if (!MPFR_IS_SINGULAR (x))
+ {
+ mpfr_sub_q (z, x, y, MPFR_RNDN);
+ res1 = mpfr_sgn (z);
+ res2 = mpfr_cmp_q (x, y);
+ if (res1 != res2)
+ {
+ printf("Error for mpfr_cmp_q: res=%d sub_z gives %d\n",
+ res2, res1);
+ exit (1);
+ }
+ }
+ }
+ }
+ mpq_clear (y);
+ mpfr_clear (x);
+ mpfr_clear (z);
+}
+
+static void
+test_cmp_f (mpfr_prec_t pmin, mpfr_prec_t pmax, int nmax)
+{
+ mpfr_t x, z;
+ mpf_t y;
+ mpfr_prec_t p;
+ int res1, res2;
+ int n;
+
+ mpfr_init (x);
+ mpfr_init2 (z, pmax+GMP_NUMB_BITS);
+ mpf_init2 (y, MPFR_PREC_MIN);
+
+ /* check the erange flag when x is NaN */
+ mpfr_set_nan (x);
+ mpf_set_ui (y, 17);
+ mpfr_clear_erangeflag ();
+ res1 = mpfr_cmp_f (x, y);
+ if (res1 != 0 || mpfr_erangeflag_p () == 0)
+ {
+ printf ("Error for mpfr_cmp_f (NaN, 17)\n");
+ printf ("Return value: expected 0, got %d\n", res1);
+ printf ("Erange flag: expected set, got %d\n", mpfr_erangeflag_p ());
+ exit (1);
+ }
+
+ for(p=pmin ; p < pmax ; p+=3)
+ {
+ mpfr_set_prec (x, p);
+ mpf_set_prec (y, p);
+ for ( n = 0; n < nmax ; n++)
+ {
+ mpfr_urandomb (x, RANDS);
+ mpf_urandomb (y, RANDS, p);
+ if (!MPFR_IS_SINGULAR (x))
+ {
+ mpfr_set_f (z, y, MPFR_RNDN);
+ mpfr_sub (z, x, z, MPFR_RNDN);
+ res1 = mpfr_sgn (z);
+ res2 = mpfr_cmp_f (x, y);
+ if (res1 != res2)
+ {
+ printf("Error for mpfr_cmp_f: res=%d sub gives %d\n",
+ res2, res1);
+ exit (1);
+ }
+ }
+ }
+ }
+ mpf_clear (y);
+ mpfr_clear (x);
+ mpfr_clear (z);
+}
+
+static void
+test_specialz (int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t),
+ void (*mpz_func)(mpz_ptr, mpz_srcptr, mpz_srcptr),
+ const char *op)
+{
+ mpfr_t x1, x2;
+ mpz_t z1, z2;
+ int res;
+
+ mpfr_inits2 (128, x1, x2, (mpfr_ptr) 0);
+ mpz_init (z1); mpz_init(z2);
+ mpz_fac_ui (z1, 19); /* 19!+1 fits perfectly in a 128 bits mantissa */
+ mpz_add_ui (z1, z1, 1);
+ mpz_fac_ui (z2, 20); /* 20!+1 fits perfectly in a 128 bits mantissa */
+ mpz_add_ui (z2, z2, 1);
+
+ res = mpfr_set_z(x1, z1, MPFR_RNDN);
+ if (res)
+ {
+ printf("Specialz %s: set_z1 error\n", op);
+ exit(1);
+ }
+ mpfr_set_z (x2, z2, MPFR_RNDN);
+ if (res)
+ {
+ printf("Specialz %s: set_z2 error\n", op);
+ exit(1);
+ }
+
+ /* (19!+1) * (20!+1) fits in a 128 bits number */
+ res = mpfr_func(x1, x1, z2, MPFR_RNDN);
+ if (res)
+ {
+ printf("Specialz %s: wrong inexact flag.\n", op);
+ exit(1);
+ }
+ mpz_func(z1, z1, z2);
+ res = mpfr_set_z (x2, z1, MPFR_RNDN);
+ if (res)
+ {
+ printf("Specialz %s: set_z2 error\n", op);
+ exit(1);
+ }
+ if (mpfr_cmp(x1, x2))
+ {
+ printf("Specialz %s: results differ.\nx1=", op);
+ mpfr_print_binary(x1);
+ printf("\nx2=");
+ mpfr_print_binary(x2);
+ printf ("\nZ2=");
+ mpz_out_str (stdout, 2, z1);
+ putchar('\n');
+ exit(1);
+ }
+
+ mpz_set_ui (z1, 1);
+ mpz_set_ui (z2, 0);
+ mpfr_set_ui (x1, 1, MPFR_RNDN);
+ mpz_func (z1, z1, z2);
+ res = mpfr_func(x1, x1, z2, MPFR_RNDN);
+ mpfr_set_z (x2, z1, MPFR_RNDN);
+ if (mpfr_cmp(x1, x2))
+ {
+ printf("Specialz %s: results differ(2).\nx1=", op);
+ mpfr_print_binary(x1);
+ printf("\nx2=");
+ mpfr_print_binary(x2);
+ putchar('\n');
+ exit(1);
+ }
+
+ mpz_clear (z1); mpz_clear(z2);
+ mpfr_clears (x1, x2, (mpfr_ptr) 0);
+}
+
+static void
+test_special2z (int (*mpfr_func)(mpfr_ptr, mpz_srcptr, mpfr_srcptr, mpfr_rnd_t),
+ void (*mpz_func)(mpz_ptr, mpz_srcptr, mpz_srcptr),
+ const char *op)
+{
+ mpfr_t x1, x2;
+ mpz_t z1, z2;
+ int res;
+
+ mpfr_inits2 (128, x1, x2, (mpfr_ptr) 0);
+ mpz_init (z1); mpz_init(z2);
+ mpz_fac_ui (z1, 19); /* 19!+1 fits perfectly in a 128 bits mantissa */
+ mpz_add_ui (z1, z1, 1);
+ mpz_fac_ui (z2, 20); /* 20!+1 fits perfectly in a 128 bits mantissa */
+ mpz_add_ui (z2, z2, 1);
+
+ res = mpfr_set_z(x1, z1, MPFR_RNDN);
+ if (res)
+ {
+ printf("Special2z %s: set_z1 error\n", op);
+ exit(1);
+ }
+ mpfr_set_z (x2, z2, MPFR_RNDN);
+ if (res)
+ {
+ printf("Special2z %s: set_z2 error\n", op);
+ exit(1);
+ }
+
+ /* (19!+1) * (20!+1) fits in a 128 bits number */
+ res = mpfr_func(x1, z1, x2, MPFR_RNDN);
+ if (res)
+ {
+ printf("Special2z %s: wrong inexact flag.\n", op);
+ exit(1);
+ }
+ mpz_func(z1, z1, z2);
+ res = mpfr_set_z (x2, z1, MPFR_RNDN);
+ if (res)
+ {
+ printf("Special2z %s: set_z2 error\n", op);
+ exit(1);
+ }
+ if (mpfr_cmp(x1, x2))
+ {
+ printf("Special2z %s: results differ.\nx1=", op);
+ mpfr_print_binary(x1);
+ printf("\nx2=");
+ mpfr_print_binary(x2);
+ printf ("\nZ2=");
+ mpz_out_str (stdout, 2, z1);
+ putchar('\n');
+ exit(1);
+ }
+
+ mpz_set_ui (z1, 0);
+ mpz_set_ui (z2, 1);
+ mpfr_set_ui (x2, 1, MPFR_RNDN);
+ res = mpfr_func(x1, z1, x2, MPFR_RNDN);
+ mpz_func (z1, z1, z2);
+ mpfr_set_z (x2, z1, MPFR_RNDN);
+ if (mpfr_cmp(x1, x2))
+ {
+ printf("Special2z %s: results differ(2).\nx1=", op);
+ mpfr_print_binary(x1);
+ printf("\nx2=");
+ mpfr_print_binary(x2);
+ putchar('\n');
+ exit(1);
+ }
+
+ mpz_clear (z1); mpz_clear(z2);
+ mpfr_clears (x1, x2, (mpfr_ptr) 0);
+}
+
+static void
+test_genericz (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
+ int (*func)(mpfr_ptr, mpfr_srcptr, mpz_srcptr, mpfr_rnd_t),
+ const char *op)
+{
+ mpfr_prec_t prec;
+ mpfr_t arg1, dst_big, dst_small, tmp;
+ mpz_t arg2;
+ mpfr_rnd_t rnd;
+ int inexact, compare, compare2;
+ unsigned int n;
+
+ mpfr_inits (arg1, dst_big, dst_small, tmp, (mpfr_ptr) 0);
+ mpz_init (arg2);
+
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (arg1, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (dst_small, prec);
+
+ for (n=0; n<N; n++)
+ {
+ mpfr_urandomb (arg1, RANDS);
+ mpz_urandomb (arg2, RANDS, 1024);
+ rnd = RND_RAND ();
+ mpfr_set_prec (dst_big, 2*prec);
+ compare = func(dst_big, arg1, arg2, rnd);
+ if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec))
+ {
+ mpfr_set (tmp, dst_big, rnd);
+ inexact = func(dst_small, arg1, arg2, rnd);
+ if (mpfr_cmp (tmp, dst_small))
+ {
+ printf ("Results differ for prec=%u rnd_mode=%s and %s_z:\n"
+ "arg1=",
+ (unsigned) prec, mpfr_print_rnd_mode (rnd), op);
+ mpfr_print_binary (arg1);
+ printf("\narg2=");
+ mpz_out_str (stdout, 10, arg2);
+ printf ("\ngot ");
+ mpfr_dump (dst_small);
+ printf ("expected ");
+ mpfr_dump (tmp);
+ printf ("approx ");
+ mpfr_dump (dst_big);
+ exit (1);
+ }
+ compare2 = mpfr_cmp (tmp, dst_big);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if (compare * compare2 >= 0)
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s and %s_z:\n"
+ "expected %d, got %d\n",
+ mpfr_print_rnd_mode (rnd), op, compare, inexact);
+ printf ("\narg1="); mpfr_print_binary (arg1);
+ printf ("\narg2="); mpz_out_str(stdout, 2, arg2);
+ printf ("\ndstl="); mpfr_print_binary (dst_big);
+ printf ("\ndsts="); mpfr_print_binary (dst_small);
+ printf ("\ntmp ="); mpfr_dump (tmp);
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpz_clear (arg2);
+ mpfr_clears (arg1, dst_big, dst_small, tmp, (mpfr_ptr) 0);
+}
+
+static void
+test_generic2z (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
+ int (*func)(mpfr_ptr, mpz_srcptr, mpfr_srcptr, mpfr_rnd_t),
+ const char *op)
+{
+ mpfr_prec_t prec;
+ mpfr_t arg1, dst_big, dst_small, tmp;
+ mpz_t arg2;
+ mpfr_rnd_t rnd;
+ int inexact, compare, compare2;
+ unsigned int n;
+
+ mpfr_inits (arg1, dst_big, dst_small, tmp, (mpfr_ptr) 0);
+ mpz_init (arg2);
+
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (arg1, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (dst_small, prec);
+
+ for (n=0; n<N; n++)
+ {
+ mpfr_urandomb (arg1, RANDS);
+ mpz_urandomb (arg2, RANDS, 1024);
+ rnd = RND_RAND ();
+ mpfr_set_prec (dst_big, 2*prec);
+ compare = func(dst_big, arg2, arg1, rnd);
+ if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec))
+ {
+ mpfr_set (tmp, dst_big, rnd);
+ inexact = func(dst_small, arg2, arg1, rnd);
+ if (mpfr_cmp (tmp, dst_small))
+ {
+ printf ("Results differ for prec=%u rnd_mode=%s and %s_z:\n"
+ "arg1=",
+ (unsigned) prec, mpfr_print_rnd_mode (rnd), op);
+ mpfr_print_binary (arg1);
+ printf("\narg2=");
+ mpz_out_str (stdout, 10, arg2);
+ printf ("\ngot ");
+ mpfr_dump (dst_small);
+ printf ("expected ");
+ mpfr_dump (tmp);
+ printf ("approx ");
+ mpfr_dump (dst_big);
+ exit (1);
+ }
+ compare2 = mpfr_cmp (tmp, dst_big);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if (compare * compare2 >= 0)
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s and %s_z:\n"
+ "expected %d, got %d\n",
+ mpfr_print_rnd_mode (rnd), op, compare, inexact);
+ printf ("\narg1="); mpfr_print_binary (arg1);
+ printf ("\narg2="); mpz_out_str(stdout, 2, arg2);
+ printf ("\ndstl="); mpfr_print_binary (dst_big);
+ printf ("\ndsts="); mpfr_print_binary (dst_small);
+ printf ("\ntmp ="); mpfr_dump (tmp);
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpz_clear (arg2);
+ mpfr_clears (arg1, dst_big, dst_small, tmp, (mpfr_ptr) 0);
+}
+
+static void
+test_genericq (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
+ int (*func)(mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t),
+ const char *op)
+{
+ mpfr_prec_t prec;
+ mpfr_t arg1, dst_big, dst_small, tmp;
+ mpq_t arg2;
+ mpfr_rnd_t rnd;
+ int inexact, compare, compare2;
+ unsigned int n;
+
+ mpfr_inits (arg1, dst_big, dst_small, tmp, (mpfr_ptr) 0);
+ mpq_init (arg2);
+
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (arg1, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (dst_small, prec);
+
+ for (n=0; n<N; n++)
+ {
+ mpfr_urandomb (arg1, RANDS);
+ mpq_set_ui (arg2, randlimb (), randlimb() );
+ mpq_canonicalize (arg2);
+ rnd = RND_RAND ();
+ mpfr_set_prec (dst_big, prec+10);
+ compare = func(dst_big, arg1, arg2, rnd);
+ if (mpfr_can_round (dst_big, prec+10, rnd, rnd, prec))
+ {
+ mpfr_set (tmp, dst_big, rnd);
+ inexact = func(dst_small, arg1, arg2, rnd);
+ if (mpfr_cmp (tmp, dst_small))
+ {
+ printf ("Results differ for prec=%u rnd_mode=%s and %s_q:\n"
+ "arg1=",
+ (unsigned) prec, mpfr_print_rnd_mode (rnd), op);
+ mpfr_print_binary (arg1);
+ printf("\narg2=");
+ mpq_out_str(stdout, 2, arg2);
+ printf ("\ngot ");
+ mpfr_print_binary (dst_small);
+ printf ("\nexpected ");
+ mpfr_print_binary (tmp);
+ printf ("\napprox ");
+ mpfr_print_binary (dst_big);
+ putchar('\n');
+ exit (1);
+ }
+ compare2 = mpfr_cmp (tmp, dst_big);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if (compare * compare2 >= 0)
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s and %s_q:\n"
+ "expected %d, got %d",
+ mpfr_print_rnd_mode (rnd), op, compare, inexact);
+ printf ("\narg1="); mpfr_print_binary (arg1);
+ printf ("\narg2="); mpq_out_str(stdout, 2, arg2);
+ printf ("\ndstl="); mpfr_print_binary (dst_big);
+ printf ("\ndsts="); mpfr_print_binary (dst_small);
+ printf ("\ntmp ="); mpfr_print_binary (tmp);
+ putchar('\n');
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpq_clear (arg2);
+ mpfr_clears (arg1, dst_big, dst_small, tmp, (mpfr_ptr) 0);
+}
+
+static void
+test_specialq (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
+ int (*mpfr_func)(mpfr_ptr, mpfr_srcptr, mpq_srcptr, mpfr_rnd_t),
+ void (*mpq_func)(mpq_ptr, mpq_srcptr, mpq_srcptr),
+ const char *op)
+{
+ mpfr_t fra, frb, frq;
+ mpq_t q1, q2, qr;
+ unsigned int n;
+ mpfr_prec_t prec;
+
+ for (prec = p0 ; prec < p1 ; prec++)
+ {
+ mpfr_inits2 (prec, fra, frb, frq, (mpfr_ptr) 0);
+ mpq_init (q1); mpq_init(q2); mpq_init (qr);
+
+ for( n = 0 ; n < N ; n++)
+ {
+ mpq_set_ui(q1, randlimb(), randlimb() );
+ mpq_set_ui(q2, randlimb(), randlimb() );
+ mpq_canonicalize (q1);
+ mpq_canonicalize (q2);
+ mpq_func (qr, q1, q2);
+ mpfr_set_q (fra, q1, MPFR_RNDD);
+ mpfr_func (fra, fra, q2, MPFR_RNDD);
+ mpfr_set_q (frb, q1, MPFR_RNDU);
+ mpfr_func (frb, frb, q2, MPFR_RNDU);
+ mpfr_set_q (frq, qr, MPFR_RNDN);
+ /* We should have fra <= qr <= frb */
+ if ( (mpfr_cmp(fra, frq) > 0) || (mpfr_cmp (frq, frb) > 0))
+ {
+ printf("Range error for prec=%lu and %s",
+ (unsigned long) prec, op);
+ printf ("\nq1="); mpq_out_str(stdout, 2, q1);
+ printf ("\nq2="); mpq_out_str(stdout, 2, q2);
+ printf ("\nfr_dn="); mpfr_print_binary (fra);
+ printf ("\nfr_q ="); mpfr_print_binary (frq);
+ printf ("\nfr_up="); mpfr_print_binary (frb);
+ putchar('\n');
+ exit (1);
+ }
+ }
+
+ mpq_clear (q1); mpq_clear (q2); mpq_clear (qr);
+ mpfr_clears (fra, frb, frq, (mpfr_ptr) 0);
+ }
+}
+
+static void
+bug_mul_q_20100810 (void)
+{
+ mpfr_t x;
+ mpfr_t y;
+ mpq_t q;
+ int inexact;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpq_init (q);
+
+ /* mpfr_mul_q: the inexact value must be set in case of overflow */
+ mpq_set_ui (q, 4096, 3);
+ mpfr_set_inf (x, +1);
+ mpfr_nextbelow (x);
+ inexact = mpfr_mul_q (y, x, q, MPFR_RNDU);
+
+ if (inexact <= 0)
+ {
+ printf ("Overflow error in mpfr_mul_q. ");
+ printf ("Wrong inexact flag: got %d, should be positive.\n", inexact);
+
+ exit (1);
+ }
+ if (!mpfr_inf_p (y))
+ {
+ printf ("Overflow error in mpfr_mul_q (y, x, q, MPFR_RNDD). ");
+ printf ("\nx = ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD);
+ printf ("\nq = ");
+ mpq_out_str (stdout, 10, q);
+ printf ("\ny = ");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDD);
+ printf (" (should be +infinity)\n");
+
+ exit (1);
+ }
+
+ mpq_clear (q);
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+static void
+bug_div_q_20100810 (void)
+{
+ mpfr_t x;
+ mpfr_t y;
+ mpq_t q;
+ int inexact;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpq_init (q);
+
+ /* mpfr_div_q: the inexact value must be set in case of overflow */
+ mpq_set_ui (q, 3, 4096);
+ mpfr_set_inf (x, +1);
+ mpfr_nextbelow (x);
+ inexact = mpfr_div_q (y, x, q, MPFR_RNDU);
+
+ if (inexact <= 0)
+ {
+ printf ("Overflow error in mpfr_div_q. ");
+ printf ("Wrong inexact flag: got %d, should be positive.\n", inexact);
+
+ exit (1);
+ }
+ if (!mpfr_inf_p (y))
+ {
+ printf ("Overflow error in mpfr_div_q (y, x, q, MPFR_RNDD). ");
+ printf ("\nx = ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD);
+ printf ("\nq = ");
+ mpq_out_str (stdout, 10, q);
+ printf ("\ny = ");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDD);
+ printf (" (should be +infinity)\n");
+
+ exit (1);
+ }
+
+ mpq_clear (q);
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+static void
+bug_mul_div_q_20100818 (void)
+{
+ mpq_t qa, qb;
+ mpfr_t x1, x2, y1, y2, y3;
+ mpfr_exp_t emin, emax, e;
+ int inex;
+ int rnd;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+
+ mpq_init (qa);
+ mpq_init (qb);
+ mpfr_inits2 (32, x1, x2, y1, y2, y3, (mpfr_ptr) 0);
+
+ mpq_set_ui (qa, 3, 17);
+ mpq_set_ui (qb, 17, 3);
+ inex = mpfr_set_ui (x1, 7, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ e = MPFR_EMAX_MAX - 3;
+ inex = mpfr_set_ui_2exp (x2, 7, e, MPFR_RNDN); /* x2 = x1 * 2^e */
+ MPFR_ASSERTN (inex == 0);
+
+ RND_LOOP(rnd)
+ {
+ mpfr_mul_q (y1, x1, qa, (mpfr_rnd_t) rnd);
+ mpfr_div_q (y3, x1, qb, (mpfr_rnd_t) rnd);
+ MPFR_ASSERTN (mpfr_equal_p (y1, y3));
+ inex = mpfr_set_ui_2exp (y3, 1, e, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ inex = mpfr_mul (y3, y3, y1, MPFR_RNDN); /* y3 = y1 * 2^e */
+ MPFR_ASSERTN (inex == 0);
+ mpfr_mul_q (y2, x2, qa, (mpfr_rnd_t) rnd);
+ if (! mpfr_equal_p (y2, y3))
+ {
+ printf ("Error 1 in bug_mul_div_q_20100818 (rnd = %d)\n", rnd);
+ printf ("Expected "); mpfr_dump (y3);
+ printf ("Got "); mpfr_dump (y2);
+ exit (1);
+ }
+ mpfr_div_q (y2, x2, qb, (mpfr_rnd_t) rnd);
+ if (! mpfr_equal_p (y2, y3))
+ {
+ printf ("Error 2 in bug_mul_div_q_20100818 (rnd = %d)\n", rnd);
+ printf ("Expected "); mpfr_dump (y3);
+ printf ("Got "); mpfr_dump (y2);
+ exit (1);
+ }
+ }
+
+ e = MPFR_EMIN_MIN;
+ inex = mpfr_set_ui_2exp (x2, 7, e, MPFR_RNDN); /* x2 = x1 * 2^e */
+ MPFR_ASSERTN (inex == 0);
+
+ RND_LOOP(rnd)
+ {
+ mpfr_div_q (y1, x1, qa, (mpfr_rnd_t) rnd);
+ mpfr_mul_q (y3, x1, qb, (mpfr_rnd_t) rnd);
+ MPFR_ASSERTN (mpfr_equal_p (y1, y3));
+ inex = mpfr_set_ui_2exp (y3, 1, e, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ inex = mpfr_mul (y3, y3, y1, MPFR_RNDN); /* y3 = y1 * 2^e */
+ MPFR_ASSERTN (inex == 0);
+ mpfr_div_q (y2, x2, qa, (mpfr_rnd_t) rnd);
+ if (! mpfr_equal_p (y2, y3))
+ {
+ printf ("Error 3 in bug_mul_div_q_20100818 (rnd = %d)\n", rnd);
+ printf ("Expected "); mpfr_dump (y3);
+ printf ("Got "); mpfr_dump (y2);
+ exit (1);
+ }
+ mpfr_mul_q (y2, x2, qb, (mpfr_rnd_t) rnd);
+ if (! mpfr_equal_p (y2, y3))
+ {
+ printf ("Error 4 in bug_mul_div_q_20100818 (rnd = %d)\n", rnd);
+ printf ("Expected "); mpfr_dump (y3);
+ printf ("Got "); mpfr_dump (y2);
+ exit (1);
+ }
+ }
+
+ mpq_clear (qa);
+ mpq_clear (qb);
+ mpfr_clears (x1, x2, y1, y2, y3, (mpfr_ptr) 0);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+static void
+reduced_expo_range (void)
+{
+ mpfr_t x;
+ mpz_t z;
+ mpq_t q;
+ mpfr_exp_t emin;
+ int inex;
+
+ emin = mpfr_get_emin ();
+ set_emin (4);
+
+ mpfr_init2 (x, 32);
+
+ mpz_init (z);
+ mpfr_clear_flags ();
+ inex = mpfr_set_ui (x, 17, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ mpz_set_ui (z, 3);
+ inex = mpfr_mul_z (x, x, z, MPFR_RNDN);
+ if (inex != 0 || MPFR_IS_NAN (x) || mpfr_cmp_ui (x, 51) != 0)
+ {
+ printf ("Error 1 in reduce_expo_range: expected 51 with inex = 0,"
+ " got\n");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("with inex = %d\n", inex);
+ exit (1);
+ }
+ inex = mpfr_div_z (x, x, z, MPFR_RNDN);
+ if (inex != 0 || MPFR_IS_NAN (x) || mpfr_cmp_ui (x, 17) != 0)
+ {
+ printf ("Error 2 in reduce_expo_range: expected 17 with inex = 0,"
+ " got\n");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("with inex = %d\n", inex);
+ exit (1);
+ }
+ inex = mpfr_add_z (x, x, z, MPFR_RNDN);
+ if (inex != 0 || MPFR_IS_NAN (x) || mpfr_cmp_ui (x, 20) != 0)
+ {
+ printf ("Error 3 in reduce_expo_range: expected 20 with inex = 0,"
+ " got\n");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("with inex = %d\n", inex);
+ exit (1);
+ }
+ inex = mpfr_sub_z (x, x, z, MPFR_RNDN);
+ if (inex != 0 || MPFR_IS_NAN (x) || mpfr_cmp_ui (x, 17) != 0)
+ {
+ printf ("Error 4 in reduce_expo_range: expected 17 with inex = 0,"
+ " got\n");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("with inex = %d\n", inex);
+ exit (1);
+ }
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ if (mpfr_cmp_z (x, z) <= 0)
+ {
+ printf ("Error 5 in reduce_expo_range: expected a positive value.\n");
+ exit (1);
+ }
+ mpz_clear (z);
+
+ mpq_init (q);
+ mpq_set_ui (q, 1, 1);
+ mpfr_set_ui (x, 16, MPFR_RNDN);
+ inex = mpfr_add_q (x, x, q, MPFR_RNDN);
+ if (inex != 0 || MPFR_IS_NAN (x) || mpfr_cmp_ui (x, 17) != 0)
+ {
+ printf ("Error in reduce_expo_range for 16 + 1/1,"
+ " got inex = %d and\nx = ", inex);
+ mpfr_dump (x);
+ exit (1);
+ }
+ inex = mpfr_sub_q (x, x, q, MPFR_RNDN);
+ if (inex != 0 || MPFR_IS_NAN (x) || mpfr_cmp_ui (x, 16) != 0)
+ {
+ printf ("Error in reduce_expo_range for 17 - 1/1,"
+ " got inex = %d and\nx = ", inex);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpq_clear (q);
+
+ mpfr_clear (x);
+
+ set_emin (emin);
+}
+
+static void
+addsubq_overflow_aux (mpfr_exp_t e)
+{
+ mpfr_t x, y;
+ mpq_t q;
+ mpfr_exp_t emax;
+ int inex;
+ int rnd;
+ int sign, sub;
+
+ MPFR_ASSERTN (e <= LONG_MAX);
+ emax = mpfr_get_emax ();
+ set_emax (e);
+ mpfr_inits2 (16, x, y, (mpfr_ptr) 0);
+ mpq_init (q);
+
+ mpfr_set_inf (x, 1);
+ mpfr_nextbelow (x);
+ mpq_set_ui (q, 1, 1);
+
+ for (sign = 0; sign <= 1; sign++)
+ {
+ for (sub = 0; sub <= 1; sub++)
+ {
+ RND_LOOP(rnd)
+ {
+ unsigned int flags, ex_flags;
+ int inf;
+
+ inf = rnd == MPFR_RNDA ||
+ rnd == (sign ? MPFR_RNDD : MPFR_RNDU);
+ ex_flags = MPFR_FLAGS_INEXACT | (inf ? MPFR_FLAGS_OVERFLOW : 0);
+ mpfr_clear_flags ();
+ inex = sub ?
+ mpfr_sub_q (y, x, q, (mpfr_rnd_t) rnd) :
+ mpfr_add_q (y, x, q, (mpfr_rnd_t) rnd);
+ flags = __gmpfr_flags;
+ if (inex == 0 || flags != ex_flags ||
+ (inf ? ! mpfr_inf_p (y) : ! mpfr_equal_p (x, y)))
+ {
+ printf ("Error in addsubq_overflow_aux(%ld),"
+ " sign = %d, %s\n", (long) e, sign,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("Got inex = %d, y = ", inex);
+ mpfr_dump (y);
+ printf ("Expected flags:");
+ flags_out (ex_flags);
+ printf ("Got flags: ");
+ flags_out (flags);
+ exit (1);
+ }
+ }
+ mpq_neg (q, q);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpq_neg (q, q);
+ }
+
+ mpq_clear (q);
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+ set_emax (emax);
+}
+
+static void
+addsubq_overflow (void)
+{
+ addsubq_overflow_aux (4913);
+ addsubq_overflow_aux (MPFR_EMAX_MAX);
+}
+
+static void
+coverage_mpfr_mul_q_20110218 (void)
+{
+ mpfr_t cmp, res, op1;
+ mpq_t op2;
+ int status;
+
+ mpfr_init2 (cmp, MPFR_PREC_MIN);
+ mpfr_init2 (res, MPFR_PREC_MIN);
+ mpfr_init_set_si (op1, 1, MPFR_RNDN);
+
+ mpq_init (op2);
+ mpq_set_si (op2, 0, 0);
+ mpz_set_si (mpq_denref (op2), 0);
+
+ status = mpfr_mul_q (res, op1, op2, MPFR_RNDN);
+
+ if ((status != 0) || (mpfr_cmp (cmp, res) != 0))
+ {
+ printf ("Results differ %d.\nres=", status);
+ mpfr_print_binary (res);
+ printf ("\ncmp=");
+ mpfr_print_binary (cmp);
+ putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_set_si (op1, 1, MPFR_RNDN);
+ mpq_set_si (op2, -1, 0);
+
+ status = mpfr_mul_q (res, op1, op2, MPFR_RNDN);
+
+ mpfr_set_inf (cmp, -1);
+ if ((status != 0) || (mpfr_cmp(res, cmp) != 0))
+ {
+ printf ("mpfr_mul_q 1 * (-1/0) returned a wrong value :\n waiting for ");
+ mpfr_print_binary (cmp);
+ printf (" got ");
+ mpfr_print_binary (res);
+ printf ("\n trinary value is %d\n", status);
+ exit (1);
+ }
+
+ mpq_clear (op2);
+ mpfr_clear (op1);
+ mpfr_clear (res);
+ mpfr_clear (cmp);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_specialz (mpfr_add_z, mpz_add, "add");
+ test_specialz (mpfr_sub_z, mpz_sub, "sub");
+ test_specialz (mpfr_mul_z, mpz_mul, "mul");
+ test_genericz (2, 100, 100, mpfr_add_z, "add");
+ test_genericz (2, 100, 100, mpfr_sub_z, "sub");
+ test_genericz (2, 100, 100, mpfr_mul_z, "mul");
+ test_genericz (2, 100, 100, mpfr_div_z, "div");
+ test_special2z (mpfr_z_sub, mpz_sub, "sub");
+ test_generic2z (2, 100, 100, mpfr_z_sub, "sub");
+
+ test_genericq (2, 100, 100, mpfr_add_q, "add");
+ test_genericq (2, 100, 100, mpfr_sub_q, "sub");
+ test_genericq (2, 100, 100, mpfr_mul_q, "mul");
+ test_genericq (2, 100, 100, mpfr_div_q, "div");
+ test_specialq (2, 100, 100, mpfr_mul_q, mpq_mul, "mul");
+ test_specialq (2, 100, 100, mpfr_div_q, mpq_div, "div");
+ test_specialq (2, 100, 100, mpfr_add_q, mpq_add, "add");
+ test_specialq (2, 100, 100, mpfr_sub_q, mpq_sub, "sub");
+
+ test_cmp_z (2, 100, 100);
+ test_cmp_q (2, 100, 100);
+ test_cmp_f (2, 100, 100);
+
+ check_for_zero ();
+
+ bug_mul_q_20100810 ();
+ bug_div_q_20100810 ();
+ bug_mul_div_q_20100818 ();
+ reduced_expo_range ();
+ addsubq_overflow ();
+
+ coverage_mpfr_mul_q_20110218 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
diff --git a/tests/tgrandom.c b/tests/tgrandom.c
new file mode 100644
index 0000000..ee484cb
--- /dev/null
+++ b/tests/tgrandom.c
@@ -0,0 +1,140 @@
+/* Test file for mpfr_grandom
+
+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+test_special (mpfr_prec_t p)
+{
+ mpfr_t x;
+ int inexact;
+
+ mpfr_init2 (x, p);
+
+ inexact = mpfr_grandom (x, NULL, RANDS, MPFR_RNDN);
+ if ((inexact & 3) == 0)
+ {
+ printf ("Error: mpfr_grandom() returns a zero ternary value.\n");
+ exit (1);
+ }
+ if ((inexact & (3 << 2)) != 0)
+ {
+ printf ("Error: the second ternary value of mpfr_grandom(x, NULL, ...)"
+ " must be 0.\n");
+ exit (1);
+ }
+
+ mpfr_clear(x);
+}
+
+
+static void
+test_grandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd,
+ int verbose)
+{
+ mpfr_t *t;
+ mpfr_t av, va, tmp;
+ int i, inexact;
+
+ nbtests = (nbtests & 1) ? (nbtests + 1) : nbtests;
+ t = (mpfr_t *) malloc (nbtests * sizeof (mpfr_t));
+ if (t == NULL)
+ {
+ fprintf (stderr, "tgrandom: can't allocate memory in test_grandom\n");
+ exit (1);
+ }
+
+ for (i = 0; i < nbtests; ++i)
+ mpfr_init2 (t[i], prec);
+
+ for (i = 0; i < nbtests; i += 2)
+ {
+ inexact = mpfr_grandom (t[i], t[i + 1], RANDS, MPFR_RNDN);
+ if ((inexact & 3) == 0 || (inexact & (3 << 2)) == 0)
+ {
+ /* one call in the loop pretended to return an exact number! */
+ printf ("Error: mpfr_grandom() returns a zero ternary value.\n");
+ exit (1);
+ }
+ }
+
+#ifdef HAVE_STDARG
+ if (verbose)
+ {
+ mpfr_init2 (av, prec);
+ mpfr_init2 (va, prec);
+ mpfr_init2 (tmp, prec);
+
+ mpfr_set_ui (av, 0, MPFR_RNDN);
+ mpfr_set_ui (va, 0, MPFR_RNDN);
+ for (i = 0; i < nbtests; ++i)
+ {
+ mpfr_add (av, av, t[i], MPFR_RNDN);
+ mpfr_sqr (tmp, t[i], MPFR_RNDN);
+ mpfr_add (va, va, tmp, MPFR_RNDN);
+ }
+ mpfr_div_ui (av, av, nbtests, MPFR_RNDN);
+ mpfr_div_ui (va, va, nbtests, MPFR_RNDN);
+ mpfr_sqr (tmp, av, MPFR_RNDN);
+ mpfr_sub (va, va, av, MPFR_RNDN);
+
+ mpfr_printf ("Average = %.5Rf\nVariance = %.5Rf\n", av, va);
+ mpfr_clear (av);
+ mpfr_clear (va);
+ mpfr_clear (tmp);
+ }
+#endif /* HAVE_STDARG */
+
+ for (i = 0; i < nbtests; ++i)
+ mpfr_clear (t[i]);
+ free (t);
+ return;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ long nbtests;
+ int verbose;
+ tests_start_mpfr ();
+
+ verbose = 0;
+ nbtests = 10;
+ if (argc > 1)
+ {
+ long a = atol (argv[1]);
+ verbose = 1;
+ if (a != 0)
+ nbtests = a;
+ }
+
+ test_grandom (nbtests, 420, MPFR_RNDN, verbose);
+ test_special (2);
+ test_special (42000);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c
new file mode 100644
index 0000000..abf5118
--- /dev/null
+++ b/tests/thyperbolic.c
@@ -0,0 +1,385 @@
+/* Test file for hyperbolic function : mpfr_cosh, mpfr_sinh, mpfr_tanh, mpfr_acosh, mpfr_asinh, mpfr_atanh.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "mpfr-test.h"
+
+static int
+check_NAN (void)
+{
+ mpfr_t t, ch,sh,th,ach,ash,ath;
+ int tester;
+ int fail = 0;
+
+ mpfr_init2(t,200);
+ mpfr_init2(ch,200);
+ mpfr_init2(sh,200);
+ mpfr_init2(th,200);
+ mpfr_init2(ach,200);
+ mpfr_init2(ash,200);
+ mpfr_init2(ath,200);
+
+ MPFR_SET_NAN(t);
+
+ /******cosh********/
+
+ tester=mpfr_cosh(ch,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(ch) || tester!=0)
+ {
+ printf("cosh NAN \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******sinh********/
+
+ tester=mpfr_sinh(sh,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(sh) || tester!=0)
+ {
+ printf("sinh NAN \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******tanh********/
+
+ tester=mpfr_tanh(th,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(th) || tester!=0)
+ {
+ printf("tanh NAN \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******acosh********/
+
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(ach) || tester!=0)
+ {
+ printf("acosh NAN \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******asinh********/
+
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(ash) || tester!=0)
+ {
+ printf("asinh NAN \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******atanh********/
+
+ tester=mpfr_atanh(ath,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(ath) || tester!=0)
+ {
+ printf("atanh NAN \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ clean_up:
+ mpfr_clear(t);
+ mpfr_clear(ch);
+ mpfr_clear(sh);
+ mpfr_clear(th);
+ mpfr_clear(ach);
+ mpfr_clear(ash);
+ mpfr_clear(ath);
+
+ return fail;
+}
+
+static int
+check_zero (void)
+{
+ mpfr_t t, ch,sh,th,ach,ash,ath;
+ int tester;
+ int fail = 0;
+
+ mpfr_init2(t,200);
+ mpfr_init2(ch,200);
+ mpfr_init2(sh,200);
+ mpfr_init2(th,200);
+ mpfr_init2(ach,200);
+ mpfr_init2(ash,200);
+ mpfr_init2(ath,200);
+
+ mpfr_set_ui(t,0,MPFR_RNDD);
+
+ /******cosh********/
+
+ tester = mpfr_cosh (ch, t, MPFR_RNDD);
+ if (mpfr_cmp_ui(ch, 1) || tester)
+ {
+ printf("cosh(0) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******sinh********/
+
+ tester = mpfr_sinh (sh, t, MPFR_RNDD);
+ if (!MPFR_IS_ZERO(sh) || tester)
+ {
+ printf("sinh(0) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******tanh********/
+
+ tester = mpfr_tanh (th, t, MPFR_RNDD);
+ if (!MPFR_IS_ZERO(th) || tester)
+ {
+ printf("tanh(0) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******acosh********/
+
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(ach) || tester)
+ {
+ printf("acosh(0) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******asinh********/
+
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
+ if (!MPFR_IS_ZERO(ash) || tester)
+ {
+ printf("asinh(0) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******atanh********/
+
+ tester=mpfr_atanh(ath,t,MPFR_RNDD);
+ if (!MPFR_IS_ZERO(ath) || tester)
+ {
+ printf("atanh(0) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ clean_up:
+ mpfr_clear(t);
+ mpfr_clear(ch);
+ mpfr_clear(sh);
+ mpfr_clear(th);
+ mpfr_clear(ach);
+ mpfr_clear(ash);
+ mpfr_clear(ath);
+
+ return fail;
+}
+
+static int
+check_INF (void)
+{
+ mpfr_t t, ch, sh, th, ach, ash, ath;
+ int tester;
+ int fail = 0;
+
+ mpfr_init2 (t, 200);
+ mpfr_init2 (ch, 200);
+ mpfr_init2 (sh, 200);
+ mpfr_init2 (th, 200);
+ mpfr_init2 (ach, 200);
+ mpfr_init2 (ash, 200);
+ mpfr_init2 (ath, 200);
+
+ MPFR_SET_INF(t);
+
+ if(MPFR_SIGN(t)<0)
+ MPFR_CHANGE_SIGN(t);
+
+ /******cosh********/
+
+ tester = mpfr_cosh(ch,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0)
+ {
+ printf("cosh(INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******sinh********/
+
+ tester=mpfr_sinh(sh,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0)
+ {
+ printf("sinh(INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******tanh********/
+
+ tester=mpfr_tanh(th,t,MPFR_RNDD);
+ if (mpfr_cmp_ui(th,1) != 0 || tester!=0)
+ {
+ printf("tanh(INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******acosh********/
+
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0)
+ {
+ printf("acosh(INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******asinh********/
+
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0)
+ {
+ printf("asinh(INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******atanh********/
+
+ tester = mpfr_atanh (ath, t, MPFR_RNDD);
+ if (!MPFR_IS_NAN(ath) || tester != 0)
+ {
+ printf("atanh(INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ MPFR_CHANGE_SIGN(t);
+
+ /******cosh********/
+
+ tester=mpfr_cosh(ch,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0)
+ {
+ printf("cosh(-INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******sinh********/
+
+ tester=mpfr_sinh(sh,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0)
+ {
+ printf("sinh(-INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******tanh********/
+
+ tester=mpfr_tanh(th,t,MPFR_RNDD);
+ if (!mpfr_cmp_ui(th,-1) || tester!=0)
+ {
+ printf("tanh(-INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******acosh********/
+
+ tester=mpfr_acosh(ach,t,MPFR_RNDD);
+ if (!MPFR_IS_NAN(ach) || tester!=0)
+ {
+ printf("acosh(-INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******asinh********/
+
+ tester=mpfr_asinh(ash,t,MPFR_RNDD);
+ if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0)
+ {
+ printf("asinh(-INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ /******atanh********/
+
+ tester = mpfr_atanh (ath, t, MPFR_RNDD);
+ if (!MPFR_IS_NAN(ath) || tester != 0)
+ {
+ printf("atanh(-INF) \n");
+ fail = 1;
+ goto clean_up;
+ }
+
+ clean_up:
+ mpfr_clear(t);
+ mpfr_clear(ch);
+ mpfr_clear(sh);
+ mpfr_clear(th);
+ mpfr_clear(ach);
+ mpfr_clear(ash);
+ mpfr_clear(ath);
+
+ return fail;
+}
+
+int
+main(void)
+{
+ tests_start_mpfr ();
+
+ if (check_zero ())
+ {
+ printf ("Error in evaluation at 0\n");
+ exit (1);
+ }
+
+ if (check_INF ())
+ {
+ printf ("Error in evaluation of INF\n");
+ exit (1);
+ }
+
+ if (check_NAN ())
+ {
+ printf ("Error in evaluation of NAN\n");
+ exit (1);
+ }
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/thypot.c b/tests/thypot.c
new file mode 100644
index 0000000..6ec7cef
--- /dev/null
+++ b/tests/thypot.c
@@ -0,0 +1,326 @@
+/* Test file for mpfr_hypot.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* Non-zero when extended exponent range */
+static int ext = 0;
+
+static void
+special (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ mpfr_set_nan (x);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (z));
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_inf (y, -1);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_nan (y);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0);
+
+ mpfr_set_nan (x);
+ mpfr_set_inf (y, -1);
+ mpfr_hypot (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && mpfr_sgn (z) > 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+test_large (void)
+{
+ mpfr_t x, y, z, t;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+
+ mpfr_set_ui (x, 21, MPFR_RNDN);
+ mpfr_set_ui (y, 28, MPFR_RNDN);
+ mpfr_set_ui (z, 35, MPFR_RNDN);
+
+ mpfr_mul_2ui (x, x, MPFR_EMAX_DEFAULT-6, MPFR_RNDN);
+ mpfr_mul_2ui (y, y, MPFR_EMAX_DEFAULT-6, MPFR_RNDN);
+ mpfr_mul_2ui (z, z, MPFR_EMAX_DEFAULT-6, MPFR_RNDN);
+
+ mpfr_hypot (t, x, y, MPFR_RNDN);
+ if (mpfr_cmp (z, t))
+ {
+ printf ("Error in test_large: got\n");
+ mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN);
+ printf ("\ninstead of\n");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (t, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "0.11101100011110000011101000010101010011001101000001100E-1021");
+ mpfr_set_str_binary (y, "0.11111001010011000001110110001101011100001000010010100E-1021");
+ mpfr_hypot (t, x, y, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.101010111100110111101110111110100110010011001010111E-1020");
+ if (mpfr_cmp (z, t))
+ {
+ printf ("Error in test_large: got\n");
+ mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN);
+ printf ("\ninstead of\n");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 240);
+ mpfr_set_prec (y, 22);
+ mpfr_set_prec (z, 2);
+ mpfr_set_prec (t, 2);
+ mpfr_set_str_binary (x, "0.100111011010010010110100000100000001100010011100110101101111111101011110111011011101010110100101111000111100010100110000100101011110111011100110100110100101110101101100011000001100000001111101110100100100011011011010110111100110010101000111e-7");
+ mpfr_set_str_binary (y, "0.1111000010000011000111E-10");
+ mpfr_hypot (t, x, y, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.11E-7");
+ if (mpfr_cmp (z, t))
+ {
+ printf ("Error in test_large: got\n");
+ mpfr_out_str (stdout, 2, 0, t, MPFR_RNDN);
+ printf ("\ninstead of\n");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+static void
+test_small (void)
+{
+ mpfr_t x, y, z1, z2;
+ int inex1, inex2;
+ unsigned int flags;
+
+ /* Test hypot(x,x) with x = 2^(emin-1). Result is x * sqrt(2). */
+ mpfr_inits2 (8, x, y, z1, z2, (mpfr_ptr) 0);
+ mpfr_set_si_2exp (x, 1, mpfr_get_emin () - 1, MPFR_RNDN);
+ mpfr_set_si_2exp (y, 1, mpfr_get_emin () - 1, MPFR_RNDN);
+ mpfr_set_ui (z1, 2, MPFR_RNDN);
+ inex1 = mpfr_sqrt (z1, z1, MPFR_RNDN);
+ inex2 = mpfr_mul (z1, z1, x, MPFR_RNDN);
+ MPFR_ASSERTN (inex2 == 0);
+ mpfr_clear_flags ();
+ inex2 = mpfr_hypot (z2, x, y, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ if (mpfr_cmp (z1, z2) != 0)
+ {
+ printf ("Error in test_small%s\nExpected ",
+ ext ? ", extended exponent range" : "");
+ mpfr_out_str (stdout, 2, 0, z1, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, z2, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (! SAME_SIGN (inex1, inex2))
+ {
+ printf ("Bad ternary value in test_small%s\nExpected %d, got %d\n",
+ ext ? ", extended exponent range" : "", inex1, inex2);
+ exit (1);
+ }
+ if (flags != MPFR_FLAGS_INEXACT)
+ {
+ printf ("Bad flags in test_small%s\nExpected %u, got %u\n",
+ ext ? ", extended exponent range" : "",
+ (unsigned int) MPFR_FLAGS_INEXACT, flags);
+ exit (1);
+ }
+ mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0);
+}
+
+static void
+test_large_small (void)
+{
+ mpfr_t x, y, z;
+ int inexact, inex2, r;
+
+ mpfr_init2 (x, 3);
+ mpfr_init2 (y, 2);
+ mpfr_init2 (z, 2);
+
+ mpfr_set_ui_2exp (x, 1, mpfr_get_emax () / 2, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, -1, MPFR_RNDN);
+ inexact = mpfr_hypot (z, x, y, MPFR_RNDN);
+ if (inexact >= 0 || mpfr_cmp (x, z))
+ {
+ printf ("Error 1 in test_large_small%s\n",
+ ext ? ", extended exponent range" : "");
+ exit (1);
+ }
+
+ mpfr_mul_ui (x, x, 5, MPFR_RNDN);
+ inexact = mpfr_hypot (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp (x, z) >= 0)
+ {
+ printf ("Error 2 in test_large_small%s\n",
+ ext ? ", extended exponent range" : "");
+ printf ("x = ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ printf ("y = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ printf ("z = ");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf (" (in precision 2) instead of\n ");
+ mpfr_out_str (stdout, 2, 2, x, MPFR_RNDU);
+ printf ("\n");
+ exit (1);
+ }
+
+ RND_LOOP(r)
+ {
+ mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN);
+ inexact = mpfr_hypot (z, x, y, (mpfr_rnd_t) r);
+ inex2 = mpfr_add_ui (y, x, 1, (mpfr_rnd_t) r);
+ if (! mpfr_equal_p (y, z) || ! SAME_SIGN (inexact, inex2))
+ {
+ printf ("Error 3 in test_large_small, %s%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r),
+ ext ? ", extended exponent range" : "");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (", inex = %d\n", inex2);
+ printf ("Got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (", inex = %d\n", inexact);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_overflow (void)
+{
+ mpfr_t x, y;
+ int inex, r;
+
+ mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_setmax (x, mpfr_get_emax ());
+
+ RND_LOOP(r)
+ {
+ mpfr_clear_overflow ();
+ inex = mpfr_hypot (y, x, x, (mpfr_rnd_t) r);
+ if (!mpfr_overflow_p ())
+ {
+ printf ("No overflow in check_overflow for %s%s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r),
+ ext ? ", extended exponent range" : "");
+ exit (1);
+ }
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+ if (r == MPFR_RNDZ || r == MPFR_RNDD)
+ {
+ MPFR_ASSERTN (inex < 0);
+ MPFR_ASSERTN (!mpfr_inf_p (y));
+ mpfr_nexttoinf (y);
+ }
+ else
+ {
+ MPFR_ASSERTN (inex > 0);
+ }
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ }
+
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+#define TWO_ARGS
+#define TEST_FUNCTION mpfr_hypot
+#include "tgeneric.c"
+
+static void
+alltst (void)
+{
+ mpfr_exp_t emin, emax;
+
+ ext = 0;
+ test_small ();
+ test_large_small ();
+ check_overflow ();
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+ if (mpfr_get_emin () != emin || mpfr_get_emax () != emax)
+ {
+ ext = 1;
+ test_small ();
+ test_large_small ();
+ check_overflow ();
+ set_emin (emin);
+ set_emax (emax);
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_large ();
+ alltst ();
+
+ test_generic (2, 100, 10);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tinits.c b/tests/tinits.c
new file mode 100644
index 0000000..5a19bb0
--- /dev/null
+++ b/tests/tinits.c
@@ -0,0 +1,62 @@
+/* Test file for mpfr_init2, mpfr_inits, mpfr_inits2 and mpfr_clears.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t a, b, c;
+ long large_prec;
+
+ tests_start_mpfr ();
+
+ mpfr_inits (a, b, c, (mpfr_ptr) 0);
+ mpfr_clears (a, b, c, (mpfr_ptr) 0);
+ mpfr_inits2 (200, a, b, c, (mpfr_ptr) 0);
+ mpfr_clears (a, b, c, (mpfr_ptr) 0);
+
+ /* test for precision 2^31-1, see
+ https://gforge.inria.fr/tracker/index.php?func=detail&aid=13918 */
+ large_prec = 2147483647;
+ if (getenv ("MPFR_CHECK_LARGEMEM") != NULL)
+ {
+ /* We assume that the precision won't be increased internally. */
+ if (large_prec > MPFR_PREC_MAX)
+ large_prec = MPFR_PREC_MAX;
+ mpfr_inits2 (large_prec, a, b, (mpfr_ptr) 0);
+ mpfr_set_ui (a, 17, MPFR_RNDN);
+ mpfr_set (b, a, MPFR_RNDN);
+ if (mpfr_get_ui (a, MPFR_RNDN) != 17)
+ {
+ printf ("Error in mpfr_init2 with precision 2^31-1\n");
+ exit (1);
+ }
+ mpfr_clears (a, b, (mpfr_ptr) 0);
+ }
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tinp_str.c b/tests/tinp_str.c
new file mode 100644
index 0000000..151f9bb
--- /dev/null
+++ b/tests/tinp_str.c
@@ -0,0 +1,94 @@
+/* Test file for mpfr_inp_str.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ mpfr_t y;
+ FILE *f;
+ int i;
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_prec (x, 15);
+ f = src_fopen ("inp_str.data", "r");
+ if (f == NULL)
+ {
+ printf ("Error, can't open inp_str.data\n");
+ exit (1);
+ }
+ i = mpfr_inp_str (x, f, 10, MPFR_RNDN);
+ if (i == 0 || mpfr_cmp_ui (x, 31415))
+ {
+ printf ("Error in reading 1st line from file inp_str.data (%d)\n", i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ getc (f);
+ i = mpfr_inp_str (x, f, 10, MPFR_RNDN);
+ if ((i == 0) || mpfr_cmp_ui (x, 31416))
+ {
+ printf ("Error in reading 2nd line from file inp_str.data (%d)\n", i);
+ mpfr_dump (x);
+ exit (1);
+ }
+ getc (f);
+ i = mpfr_inp_str (x, f, 10, MPFR_RNDN);
+ if (i != 0)
+ {
+ printf ("Error in reading 3rd line from file inp_str.data (%d)\n", i);
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str (y, "1.0010010100001110100101001110011010111011100001110010e226",
+ 2, MPFR_RNDN);
+ for (i = 2; i < 63; i++)
+ {
+ getc (f);
+ if (mpfr_inp_str (x, f, i, MPFR_RNDN) == 0 || !mpfr_equal_p (x, y))
+ {
+ printf ("Error in reading %dth line from file inp_str.data\n", i+2);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ }
+
+ fclose (f);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tinternals.c b/tests/tinternals.c
new file mode 100644
index 0000000..60d08a3
--- /dev/null
+++ b/tests/tinternals.c
@@ -0,0 +1,161 @@
+/* tinternals -- Test for internals.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-test.h"
+
+static void
+test_int_ceil_log2 (void)
+{
+ int i;
+ int val[16] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 };
+
+ for (i = 1; i < 17; i++)
+ {
+ if (MPFR_INT_CEIL_LOG2 (i) != val[i-1])
+ {
+ printf ("Error 1 in test_int_ceil_log2 for i = %d\n", i);
+ exit (1);
+ }
+ if (MPFR_INT_CEIL_LOG2 (i) != __gmpfr_int_ceil_log2 (i))
+ {
+ printf ("Error 2 in test_int_ceil_log2 for i = %d\n", i);
+ exit (1);
+ }
+ }
+}
+
+static void
+test_round_near_x (void)
+{
+ mpfr_t x, y, z, eps;
+ mpfr_exp_t e;
+ int failures = 0, mx, neg, err, dir, r, inex, inex2;
+ char buffer[7], *p;
+
+ mpfr_inits (x, y, z, eps, (mpfr_ptr) 0);
+ mpfr_set_prec (x, 5);
+ mpfr_set_prec (y, 3);
+ mpfr_set_prec (z, 3);
+ mpfr_set_prec (eps, 2);
+ mpfr_set_ui_2exp (eps, 1, -32, MPFR_RNDN);
+
+ for (mx = 16; mx < 32; mx++)
+ {
+ mpfr_set_ui_2exp (x, mx, -2, MPFR_RNDN);
+ for (p = buffer, neg = 0;
+ neg <= 1;
+ mpfr_neg (x, x, MPFR_RNDN), p++, neg++)
+ for (err = 2; err <= 6; err++)
+ for (dir = 0; dir <= 1; dir++)
+ RND_LOOP(r)
+ {
+ inex = mpfr_round_near_x (y, x, err, dir, (mpfr_rnd_t) r);
+
+ if (inex == 0 && err < 6)
+ {
+ /* The test is more restrictive than necessary.
+ So, no failure in this case. */
+ continue;
+ }
+
+ inex2 = ((dir ^ neg) ? mpfr_add : mpfr_sub)
+ (z, x, eps, (mpfr_rnd_t) r);
+ if (inex * inex2 <= 0)
+ printf ("Bad return value (%d instead of %d) for:\n",
+ inex, inex2);
+ else if (mpfr_equal_p (y, z))
+ continue; /* correct inex and y */
+ else
+ {
+ printf ("Bad MPFR value (should have got ");
+ mpfr_out_str (stdout, 2, 3, z, MPFR_RNDZ);
+ printf (") for:\n");
+ }
+
+ if (!mpfr_get_str (buffer, &e, 2, 5, x, MPFR_RNDZ) || e != 3)
+ {
+ printf ("mpfr_get_str failed in test_round_near_x\n");
+ exit (1);
+ }
+ printf ("x = %c%c%c%c.%c%c, ", neg ? '-' : '+',
+ p[0], p[1], p[2], p[3], p[4]);
+ printf ("err = %d, dir = %d, r = %s --> inex = %2d",
+ err, dir, mpfr_print_rnd_mode ((mpfr_rnd_t) r), inex);
+ if (inex != 0)
+ {
+ printf (", y = ");
+ mpfr_out_str (stdout, 2, 3, y, MPFR_RNDZ);
+ }
+ printf ("\n");
+ if (inex == 0)
+ printf ("Rounding was possible!\n");
+ if (++failures == 10) /* show at most 10 failures */
+ exit (1);
+ }
+ }
+
+ if (failures)
+ exit (1);
+
+ mpfr_clears (x, y, z, eps, (mpfr_ptr) 0);
+}
+
+static void
+test_set_prec_raw (void)
+{
+ mpfr_t x;
+ int i;
+
+ mpfr_init2 (x, 53);
+ for (i = 2; i < 11; i++)
+ {
+ mpfr_set_prec_raw (x, i);
+ if (MPFR_PREC (x) != i)
+ {
+ printf ("[ERROR]: mpfr_set_prec_raw %d\n", i);
+ exit (1);
+ }
+ }
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char **argv)
+{
+ tests_start_mpfr ();
+
+ /* The tested function and macro exist in MPFR 2.2.0, but with a
+ different (incorrect, but with no effect in 2.2.0) behavior. */
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0)
+ test_int_ceil_log2 ();
+#endif
+
+ test_round_near_x ();
+ test_set_prec_raw ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tisnan.c b/tests/tisnan.c
new file mode 100644
index 0000000..1bd611e
--- /dev/null
+++ b/tests/tisnan.c
@@ -0,0 +1,212 @@
+/* Test file for mpfr_nan_p, mpfr_inf_p, mpfr_number_p, mpfr_zero_p and
+ mpfr_regular_p.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+
+ /* check +infinity gives non-zero for mpfr_inf_p only */
+ mpfr_set_ui (x, 1L, MPFR_RNDZ);
+ mpfr_div_ui (x, x, 0L, MPFR_RNDZ);
+ if (mpfr_nan_p (x) || (mpfr_nan_p) (x) )
+ {
+ printf ("Error: mpfr_nan_p(+Inf) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_inf_p (x) == 0)
+ {
+ printf ("Error: mpfr_inf_p(+Inf) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_number_p (x) || (mpfr_number_p) (x) )
+ {
+ printf ("Error: mpfr_number_p(+Inf) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_zero_p (x) || (mpfr_zero_p) (x) )
+ {
+ printf ("Error: mpfr_zero_p(+Inf) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_regular_p (x) || (mpfr_regular_p) (x) )
+ {
+ printf ("Error: mpfr_regular_p(+Inf) gives non-zero\n");
+ exit (1);
+ }
+
+ /* same for -Inf */
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (mpfr_nan_p (x) || (mpfr_nan_p(x)))
+ {
+ printf ("Error: mpfr_nan_p(-Inf) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_inf_p (x) == 0)
+ {
+ printf ("Error: mpfr_inf_p(-Inf) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_number_p (x) || (mpfr_number_p)(x) )
+ {
+ printf ("Error: mpfr_number_p(-Inf) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_zero_p (x) || (mpfr_zero_p)(x) )
+ {
+ printf ("Error: mpfr_zero_p(-Inf) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_regular_p (x) || (mpfr_regular_p) (x) )
+ {
+ printf ("Error: mpfr_regular_p(-Inf) gives non-zero\n");
+ exit (1);
+ }
+
+ /* same for NaN */
+ mpfr_sub (x, x, x, MPFR_RNDN);
+ if (mpfr_nan_p (x) == 0)
+ {
+ printf ("Error: mpfr_nan_p(NaN) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_inf_p (x) || (mpfr_inf_p)(x) )
+ {
+ printf ("Error: mpfr_inf_p(NaN) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_number_p (x) || (mpfr_number_p) (x) )
+ {
+ printf ("Error: mpfr_number_p(NaN) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_zero_p (x) || (mpfr_zero_p)(x) )
+ {
+ printf ("Error: mpfr_number_p(NaN) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_regular_p (x) || (mpfr_regular_p) (x) )
+ {
+ printf ("Error: mpfr_regular_p(NaN) gives non-zero\n");
+ exit (1);
+ }
+
+ /* same for a regular number */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ if (mpfr_nan_p (x) || (mpfr_nan_p)(x))
+ {
+ printf ("Error: mpfr_nan_p(1) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_inf_p (x) || (mpfr_inf_p)(x) )
+ {
+ printf ("Error: mpfr_inf_p(1) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_number_p (x) == 0)
+ {
+ printf ("Error: mpfr_number_p(1) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_zero_p (x) || (mpfr_zero_p) (x) )
+ {
+ printf ("Error: mpfr_zero_p(1) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_regular_p (x) == 0 || (mpfr_regular_p) (x) == 0)
+ {
+ printf ("Error: mpfr_regular_p(1) gives zero\n");
+ exit (1);
+ }
+
+ /* Same for +0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ if (mpfr_nan_p (x) || (mpfr_nan_p)(x))
+ {
+ printf ("Error: mpfr_nan_p(+0) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_inf_p (x) || (mpfr_inf_p)(x) )
+ {
+ printf ("Error: mpfr_inf_p(+0) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_number_p (x) == 0)
+ {
+ printf ("Error: mpfr_number_p(+0) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_zero_p (x) == 0 )
+ {
+ printf ("Error: mpfr_zero_p(+0) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_regular_p (x) || (mpfr_regular_p) (x) )
+ {
+ printf ("Error: mpfr_regular_p(+0) gives non-zero\n");
+ exit (1);
+ }
+
+ /* Same for -0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (mpfr_nan_p (x) || (mpfr_nan_p)(x))
+ {
+ printf ("Error: mpfr_nan_p(-0) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_inf_p (x) || (mpfr_inf_p)(x) )
+ {
+ printf ("Error: mpfr_inf_p(-0) gives non-zero\n");
+ exit (1);
+ }
+ if (mpfr_number_p (x) == 0)
+ {
+ printf ("Error: mpfr_number_p(-0) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_zero_p (x) == 0 )
+ {
+ printf ("Error: mpfr_zero_p(-0) gives zero\n");
+ exit (1);
+ }
+ if (mpfr_regular_p (x) || (mpfr_regular_p) (x) )
+ {
+ printf ("Error: mpfr_regular_p(-0) gives non-zero\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tisqrt.c b/tests/tisqrt.c
new file mode 100644
index 0000000..9e4ec6c
--- /dev/null
+++ b/tests/tisqrt.c
@@ -0,0 +1,94 @@
+/* Test file for __gmpfr_isqrt and __gmpfr_cuberoot internal functions.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+tst_isqrt (unsigned long n, unsigned long r)
+{
+ unsigned long i;
+
+ i = __gmpfr_isqrt (n);
+ if (i != r)
+ {
+ printf ("Error in __gmpfr_isqrt (%lu): got %lu instead of %lu\n",
+ n, i, r);
+ exit (1);
+ }
+}
+
+static void
+tst_icbrt (unsigned long n, unsigned long r)
+{
+ unsigned long i;
+
+ i = __gmpfr_cuberoot (n);
+ if (i != r)
+ {
+ printf ("Error in __gmpfr_cuberoot (%lu): got %lu instead of %lu\n",
+ n, i, r);
+ exit (1);
+ }
+}
+
+int
+main (void)
+{
+ unsigned long c, i;
+
+ tests_start_mpfr ();
+
+ tst_isqrt (0, 0);
+ tst_isqrt (1, 1);
+ tst_isqrt (2, 1);
+ for (i = 2; i <= 65535; i++)
+ {
+ tst_isqrt (i * i - 1, i - 1);
+ tst_isqrt (i * i, i);
+ }
+ tst_isqrt (4294967295UL, 65535);
+
+ tst_icbrt (0, 0);
+ tst_icbrt (1, 1);
+ tst_icbrt (2, 1);
+ tst_icbrt (3, 1);
+ for (i = 2; i <= 1625; i++)
+ {
+ c = i * i * i;
+ tst_icbrt (c - 4, i - 1);
+ tst_icbrt (c - 3, i - 1);
+ tst_icbrt (c - 2, i - 1);
+ tst_icbrt (c - 1, i - 1);
+ tst_icbrt (c, i);
+ tst_icbrt (c + 1, i);
+ tst_icbrt (c + 2, i);
+ tst_icbrt (c + 3, i);
+ tst_icbrt (c + 4, i);
+ }
+ tst_icbrt (4294967295UL, 1625);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tj0.c b/tests/tj0.c
new file mode 100644
index 0000000..ac5de28
--- /dev/null
+++ b/tests/tj0.c
@@ -0,0 +1,135 @@
+/* tj0 -- test file for the Bessel function of first kind (order 0)
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_j0
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ int inex;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_inf (x, -1); /* -Inf */
+ mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(+0)=1 */
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(-0)=1 */
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_j0 for x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_j0 for x=-1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ /* Bug reported on 2007-07-03 by Sisyphus (assertion failed in r4619) */
+ mpfr_set_si (x, 70000, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
+
+ /* Bug reported by Kevin Rauch on 27 Oct 2007 */
+ mpfr_set_prec (x, 7);
+ mpfr_set_prec (y, 7);
+ mpfr_set_si (x, -100, MPFR_RNDN);
+ mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (! mpfr_nan_p (y) && mpfr_cmp_ui_2exp (y, 41, -11) == 0);
+
+ /* Case for which s = 0 in mpfr_jn */
+ mpfr_set_prec (x, 44);
+ mpfr_set_prec (y, 44);
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_j0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_INEXACT);
+ mpfr_set_str (x, "0x.e5439fd9267p-2", 0, MPFR_RNDN);
+ if (! mpfr_equal_p (y, x))
+ {
+ printf ("Error on 2:\n");
+ printf ("Expected ");
+ mpfr_dump (x);
+ printf ("Got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Bad ternary value on 2: expected negative, got %d\n", inex);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ test_generic (2, 100, 10);
+
+ data_check ("data/j0", mpfr_j0, "mpfr_j0");
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tj1.c b/tests/tj1.c
new file mode 100644
index 0000000..715cf27
--- /dev/null
+++ b/tests/tj1.c
@@ -0,0 +1,88 @@
+/* tj1 -- test file for the Bessel function of first kind (order 1)
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_j1
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_j1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_j1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_inf (x, -1); /* -Inf */
+ mpfr_j1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_j1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j1(+0)=+0 */
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_j1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j1(-0)=-0 */
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_j1 (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_j1 for x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ test_generic (2, 100, 10);
+
+ data_check ("data/j1", mpfr_j1, "mpfr_j1");
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tjn.c b/tests/tjn.c
new file mode 100644
index 0000000..54067a8
--- /dev/null
+++ b/tests/tjn.c
@@ -0,0 +1,307 @@
+/* tjn -- test file for the Bessel function of first kind
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h> /* for LONG_MAX */
+
+#include "mpfr-test.h"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ long n;
+
+ if (argc > 1)
+ {
+ mpfr_init2 (x, atoi (argv[1]));
+ mpfr_set_str (x, argv[3], 10, MPFR_RNDN);
+ mpfr_jn (x, atoi (argv[2]), x, MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN);
+ printf ("\n");
+ mpfr_clear (x);
+ return 0;
+ }
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_jn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_inf (x, -1); /* -Inf */
+ mpfr_jn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_jn (y, 0, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(+0)=1 */
+ mpfr_jn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j17(+0)=+0 */
+ mpfr_jn (y, -17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j-17(+0)=-0 */
+ mpfr_jn (y, 42, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j42(+0)=+0 */
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_jn (y, 0, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); /* j0(-0)=1 */
+ mpfr_jn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j17(-0)=-0 */
+ mpfr_jn (y, -17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j-17(-0)=+0 */
+ mpfr_jn (y, 42, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j42(-0)=+0 */
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 0, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=0, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_jn (y, 0, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100001111100011111111101101111010111101110001111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=0, x=-1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 1, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=1, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 17, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100011111001010101001001001000110110000010001011E-65");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=17, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, 42, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=42, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_jn (y, -42, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=-42, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_jn (y, 42, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=42, x=-1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_jn (y, -42, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10000111100011010100111011100111101101000100000001001E-211");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=-42, x=-1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 4, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.0001110001011001100010100111100111100000111110111011111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=4, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 16, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.0011101111100111101111010100000111111001111001001010011");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=16, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 256, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.11111101111100110000000010111101101011101011110001011E-894");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=256, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 65536, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "100010010010011010110101100001000100011100010111011E-751747");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=65536, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 131072, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "1000001001110011111001110110000010011010000001001101E-1634508");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=131072, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 262144, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "1010011011000100111011001011110001000010000010111111E-3531100");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=262144, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, 524288, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "110000001010001111011011000011001011010100010001011E-7586426");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=524288, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ n = LONG_MAX;
+ /* ensures n is odd */
+ if (n % 2 == 0)
+ n --;
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, n, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=%ld, x=17, rnd=MPFR_RNDN\n", n);
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -17, MPFR_RNDN);
+ mpfr_jn (y, n, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=MPFR_RNDN\n", n);
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_jn (y, -n, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=%ld, x=17, rnd=MPFR_RNDN\n", -n);
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -17, MPFR_RNDN);
+ mpfr_jn (y, -n, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_jn for n=%ld, x=-17, rnd=MPFR_RNDN\n", -n);
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tl2b.c b/tests/tl2b.c
new file mode 100644
index 0000000..ca51906
--- /dev/null
+++ b/tests/tl2b.c
@@ -0,0 +1,174 @@
+/* Test file for l2b constants.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Execute this program with an argument to generate code that initializes
+ the l2b constants. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpfr-test.h"
+
+/* Must be a multiple of 4 */
+static const int bits2use[] = {16, 32, 64, 96, 128, 256};
+#define size_of_bits2use ((sizeof bits2use) / sizeof bits2use[0])
+
+static __mpfr_struct l2b[BASE_MAX-1][2];
+
+static void
+print_mpfr (mpfr_srcptr x, const char *name)
+{
+ unsigned char temp[16]; /* buffer for the base-256 string */
+ unsigned char *ptr; /* pointer to its first non-zero byte */
+ int size; /* size of the string */
+ int i; /* bits2use index */
+ int j; /* output limb index */
+ int k; /* byte index (in output limb) */
+ int r; /* digit index, relative to ptr */
+
+ if (printf ("#if 0\n") < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+ for (i = 0; i < size_of_bits2use; i++)
+ {
+ if (printf ("#elif GMP_NUMB_BITS == %d\n"
+ "const mp_limb_t %s__tab[] = { 0x", bits2use[i], name) < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+ size = mpn_get_str (temp, 256, MPFR_MANT (x), MPFR_LIMB_SIZE (x));
+ MPFR_ASSERTN (size <= 16);
+ ptr = temp;
+ /* Skip leading zeros. */
+ while (*ptr == 0)
+ {
+ ptr++;
+ size--;
+ MPFR_ASSERTN (size > 0);
+ }
+ MPFR_ASSERTN (*ptr >= 128);
+ for (j = (MPFR_PREC (x) - 1) / bits2use[i]; j >= 0; j--)
+ {
+ r = j * (bits2use[i] / 8);
+ for (k = 0; k < bits2use[i] / 8; k++)
+ if (printf ("%02x", r < size ? ptr[r++] : 0) < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+ if (printf (j == 0 ? " };\n" : ", 0x") < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+ }
+ }
+ if (printf ("#endif\n\n") < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+}
+
+static void
+compute_l2b (int output)
+{
+ mpfr_ptr p;
+ mpfr_srcptr t;
+ int beta, i;
+ int error = 0;
+ char buffer[30];
+
+ for (beta = 2; beta <= BASE_MAX; beta++)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ p = &l2b[beta-2][i];
+
+ /* Compute the value */
+ if (i == 0)
+ {
+ /* 23-bit upper approximation to log(b)/log(2) */
+ mpfr_init2 (p, 23);
+ mpfr_set_ui (p, beta, MPFR_RNDU);
+ mpfr_log2 (p, p, MPFR_RNDU);
+ }
+ else
+ {
+ /* 76-bit upper approximation to log(2)/log(b) */
+ mpfr_init2 (p, 77);
+ mpfr_set_ui (p, beta, MPFR_RNDD);
+ mpfr_log2 (p, p, MPFR_RNDD);
+ mpfr_ui_div (p, 1, p, MPFR_RNDU);
+ }
+
+ sprintf (buffer, "mpfr_l2b_%d_%d", beta, i);
+ if (output)
+ print_mpfr (p, buffer);
+
+ /* Check the value */
+ t = &__gmpfr_l2b[beta-2][i];
+ if (t == NULL || MPFR_PREC (t) == 0 || !mpfr_equal_p (p, t))
+ {
+ if (!output)
+ {
+ error = 1;
+ printf ("Error for constant %s\n", buffer);
+ }
+ }
+
+ if (!output)
+ mpfr_clear (p);
+ }
+ }
+
+ if (output)
+ {
+ if (printf ("const __mpfr_struct __gmpfr_l2b[BASE_MAX-1][2] = {\n")
+ < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+ for (beta = 2; beta <= BASE_MAX; beta++)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ p = &l2b[beta-2][i];
+ if (printf (" %c {%3d,%2d,%3ld, (mp_limb_t *) "
+ "mpfr_l2b_%d_%d__tab }%s\n", i == 0 ? '{' : ' ',
+ (int) MPFR_PREC (p), MPFR_SIGN (p),
+ (long) MPFR_GET_EXP (p), beta, i,
+ i == 0 ? "," : beta < BASE_MAX ? " }," : " } };")
+ < 0)
+ { fprintf (stderr, "Error in printf\n"); exit (1); }
+ mpfr_clear (p);
+ }
+ }
+ }
+
+ /* If there was an error, the test fails. */
+ if (error)
+ exit (1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ if (argc != 1)
+ {
+ /* Generate code that initializes the l2b constants. */
+ compute_l2b (1);
+ }
+ else
+ {
+ /* Check the l2b constants. */
+ tests_start_mpfr ();
+ compute_l2b (0);
+ tests_end_mpfr ();
+ }
+ return 0;
+}
diff --git a/tests/tlgamma.c b/tests/tlgamma.c
new file mode 100644
index 0000000..faa6276
--- /dev/null
+++ b/tests/tlgamma.c
@@ -0,0 +1,403 @@
+/* mpfr_tlgamma -- test file for lgamma function
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static int
+mpfr_lgamma_nosign (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
+{
+ int inex, sign;
+
+ inex = mpfr_lgamma (y, &sign, x, rnd);
+ if (!MPFR_IS_SINGULAR (y))
+ {
+ MPFR_ASSERTN (sign == 1 || sign == -1);
+ if (sign == -1 && (rnd == MPFR_RNDN || rnd == MPFR_RNDZ))
+ {
+ mpfr_neg (y, y, MPFR_RNDN);
+ inex = -inex;
+ /* This is a way to check with the generic tests, that the value
+ returned in the sign variable is consistent, but warning! The
+ tested function depends on the rounding mode: it is
+ * lgamma(x) = log(|Gamma(x)|) in MPFR_RNDD and MPFR_RNDU;
+ * lgamma(x) * sign(Gamma(x)) in MPFR_RNDN and MPFR_RNDZ. */
+ }
+ }
+
+ return inex;
+}
+
+#define TEST_FUNCTION mpfr_lgamma_nosign
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex;
+ int sign;
+ mpfr_exp_t emin, emax;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for lgamma(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for lgamma(-Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != 1)
+ {
+ printf ("Error for lgamma(+Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != 1)
+ {
+ printf ("Error for lgamma(+0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || sign != -1)
+ {
+ printf ("Error for lgamma(-0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y) || sign != 1)
+ {
+ printf ("Error for lgamma(1)\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for lgamma(-1)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y) || sign != 1)
+ {
+ printf ("Error for lgamma(2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+#define CHECK_X1 "1.0762904832837976166"
+#define CHECK_Y1 "-0.039418362817587634939"
+
+ mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN);
+ if (mpfr_equal_p (y, x) == 0 || sign != 1)
+ {
+ printf ("mpfr_lgamma("CHECK_X1") is wrong:\n"
+ "expected ");
+ mpfr_print_binary (x); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (y); putchar ('\n');
+ exit (1);
+ }
+
+#define CHECK_X2 "9.23709516716202383435e-01"
+#define CHECK_Y2 "0.049010669407893718563"
+ mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
+ if (mpfr_equal_p (y, x) == 0 || sign != 1)
+ {
+ printf ("mpfr_lgamma("CHECK_X2") is wrong:\n"
+ "expected ");
+ mpfr_print_binary (x); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (y); putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 175);
+ mpfr_set_ui (x, 33, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDU);
+ mpfr_set_prec (x, 175);
+ mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
+ if (mpfr_equal_p (x, y) == 0 || sign != 1)
+ {
+ printf ("Error in mpfr_lgamma (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 21);
+ mpfr_set_prec (y, 8);
+ mpfr_set_ui (y, 120, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (x, &sign, y, MPFR_RNDZ);
+ mpfr_set_prec (y, 21);
+ mpfr_set_str_binary (y, "0.111000101000001100101E9");
+ if (mpfr_equal_p (x, y) == 0 || sign != 1)
+ {
+ printf ("Error in mpfr_lgamma (120)\n");
+ printf ("Expected "); mpfr_print_binary (y); puts ("");
+ printf ("Got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 206);
+ mpfr_set_str_binary (x, "0.110e10");
+ sign = -17;
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_prec (x, 206);
+ mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
+ if (mpfr_equal_p (x, y) == 0 || sign != 1)
+ {
+ printf ("Error in mpfr_lgamma (768)\n");
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Wrong flag for mpfr_lgamma (768)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 4);
+ mpfr_set_prec (y, 4);
+ mpfr_set_str_binary (x, "0.1100E-66");
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100E6");
+ if (mpfr_equal_p (x, y) == 0 || sign != 1)
+ {
+ printf ("Error for lgamma(0.1100E-66)\n");
+ printf ("Expected ");
+ mpfr_dump (x);
+ printf ("Got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 256);
+ mpfr_set_prec (y, 32);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_prec (x, 32);
+ mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
+ if (mpfr_equal_p (x, y) == 0 || sign != 1)
+ {
+ printf ("Error for lgamma(-2^199+0.5)\n");
+ printf ("Got ");
+ mpfr_dump (y);
+ printf ("instead of ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 256);
+ mpfr_set_prec (y, 32);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ sign = -17;
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_prec (x, 32);
+ mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
+ if (mpfr_equal_p (x, y) == 0 || sign != -1)
+ {
+ printf ("Error for lgamma(-2^199-0.5)\n");
+ printf ("Got ");
+ mpfr_dump (y);
+ printf ("with sign %d instead of ", sign);
+ mpfr_dump (x);
+ printf ("with sign -1.\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_prec (y, 10);
+ mpfr_set_str_binary (x, "-0.1101111000E-3");
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "10.01001011");
+ if (mpfr_equal_p (x, y) == 0 || sign != -1 || inex >= 0)
+ {
+ printf ("Error for lgamma(-0.1101111000E-3)\n");
+ printf ("Got ");
+ mpfr_dump (y);
+ printf ("instead of ");
+ mpfr_dump (x);
+ printf ("with sign %d instead of -1 (inex=%d).\n", sign, inex);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 18);
+ mpfr_set_prec (y, 28);
+ mpfr_set_str_binary (x, "-1.10001101010001101e-196");
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_prec (x, 28);
+ mpfr_set_str_binary (x, "0.100001110110101011011010011E8");
+ MPFR_ASSERTN (mpfr_equal_p (x, y) && inex < 0);
+
+ /* values reported by Kaveh Ghazi on 14 Jul 2007, where mpfr_lgamma()
+ takes forever */
+#define VAL1 "-0.11100001001010110111001010001001001011110100110000110E-55"
+#define OUT1 "100110.01000000010111001110110101110101001001100110111"
+#define VAL2 "-0.11100001001010110111001010001001001011110011111111100E-55"
+#define OUT2 "100110.0100000001011100111011010111010100100110011111"
+#define VAL3 "-0.11100001001010110111001010001001001001110101101010100E-55"
+#define OUT3 "100110.01000000010111001110110101110101001011110111011"
+#define VAL4 "-0.10001111110110110100100100000000001111110001001001011E-57"
+#define OUT4 "101000.0001010111110011101101000101111111010001100011"
+#define VAL5 "-0.10001111110110110100100100000000001111011111100001000E-57"
+#define OUT5 "101000.00010101111100111011010001011111110100111000001"
+#define VAL6 "-0.10001111110110110100100100000000001111011101100011001E-57"
+#define OUT6 "101000.0001010111110011101101000101111111010011101111"
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_str_binary (x, VAL1);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, OUT1);
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p(x, y));
+
+ mpfr_set_str_binary (x, VAL2);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, OUT2);
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
+
+ mpfr_set_str_binary (x, VAL3);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, OUT3);
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
+
+ mpfr_set_str_binary (x, VAL4);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, OUT4);
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
+
+ mpfr_set_str_binary (x, VAL5);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, OUT5);
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
+
+ mpfr_set_str_binary (x, VAL6);
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, OUT6);
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
+
+ /* further test from Kaveh Ghazi */
+ mpfr_set_str_binary (x, "-0.10011010101001010010001110010111010111011101010111001E-53");
+ mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "100101.00111101101010000000101010111010001111001101111");
+ MPFR_ASSERTN(sign == -1 && mpfr_equal_p (x, y));
+
+ /* bug found by Kevin Rauch on 26 Oct 2007 */
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ mpfr_set_emin (-1000000000);
+ mpfr_set_emax (1000000000);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_lgamma (x, &sign, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_get_emin () == -1000000000);
+ MPFR_ASSERTN(mpfr_get_emax () == 1000000000);
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+
+ /* two other bugs reported by Kevin Rauch on 27 Oct 2007 */
+ mpfr_set_prec (x, 128);
+ mpfr_set_prec (y, 128);
+ mpfr_set_str_binary (x, "0.11000110011110111111110010100110000000000000000000000000000000000000000000000000000000000000000001000011000110100100110111101010E-765689");
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "10000001100100101111011011010000111010001001110000111010011000101001011111011111110011011010110100101111110111001001010100011101E-108");
+ MPFR_ASSERTN(inex < 0 && mpfr_cmp (y, x) == 0 && sign > 0);
+
+ mpfr_set_prec (x, 128);
+ mpfr_set_prec (y, 256);
+ mpfr_set_str_binary (x, "0.1011111111111111100000111011111E-31871");
+ inex = mpfr_lgamma (y, &sign, x, MPFR_RNDN);
+ mpfr_set_prec (x, 256);
+ mpfr_set_str (x, "AC9729B83707E6797612D0D76DAF42B1240A677FF1B6E3783FD4E53037143B1P-237", 16, MPFR_RNDN);
+ MPFR_ASSERTN(inex < 0 && mpfr_cmp (y, x) == 0 && sign > 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static int
+mpfr_lgamma1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t r)
+{
+ int sign;
+
+ return mpfr_lgamma (y, &sign, x, r);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ special ();
+ test_generic (2, 100, 2);
+
+ data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tli2.c b/tests/tli2.c
new file mode 100644
index 0000000..f8a5b4a
--- /dev/null
+++ b/tests/tli2.c
@@ -0,0 +1,208 @@
+/* mpfr_tli2 -- test file for dilogarithm function
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+#define TEST_FUNCTION mpfr_li2
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for li2(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_INF (y) || MPFR_IS_POS (y))
+ {
+ printf ("Error for li2(-Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_INF (y) || MPFR_IS_POS (y))
+ {
+ printf ("Error for li2(+Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y) || MPFR_IS_NEG (y))
+ {
+ printf ("Error for li2(+0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y) || MPFR_IS_POS (y))
+ {
+ printf ("Error for li2(-0)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+normal (void)
+{
+ int inexact;
+ mpfr_t x, y;
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* x1 = 2^-3 */
+ mpfr_set_str (x, "1p-3", 2, MPFR_RNDD);
+ mpfr_li2 (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0x1087a7a9e42141p-55", 16, MPFR_RNDN) != 0)
+ {
+ printf ("Error for li2(x1)\n");
+ exit (1);
+ }
+
+ /* check MPFR_FAST_COMPUTE_IF_SMALL_INPUT */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 20);
+ mpfr_set_ui_2exp (x, 1, -21, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ mpfr_set_si_2exp (x, -1, -21, MPFR_RNDN);
+ mpfr_li2 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ /* worst case */
+ /* x2 = 0x7F18EA6537E00E983196CDDC6EFAC57Fp-129
+ Li2(x2) = 2^-2 + 2^-6 + 2^-120 */
+ mpfr_set_prec (x, 128);
+ mpfr_set_str (x, "7F18EA6537E00E983196CDDC6EFAC57Fp-129", 16, MPFR_RNDN);
+
+ /* round to nearest mode and 4 bits of precision,
+ it should be rounded to 2^-2 + 2^-5 and */
+ mpfr_set_prec (y, 4);
+ inexact = mpfr_li2 (y, x, MPFR_RNDN);
+ if (inexact != 1 || mpfr_cmp_str (y, "0.1001p-1", 2, MPFR_RNDN) != 0)
+ {
+ printf ("Error for li2(x2, RNDN)\n");
+ exit (1);
+ }
+
+ /* round toward zero mode and 5 bits of precision,
+ it should be rounded to 2^-2 + 2^-6 */
+ mpfr_set_prec (y, 5);
+ inexact = mpfr_li2 (y, x, MPFR_RNDZ);
+ if (inexact != -1 || mpfr_cmp_str (y, "0.10001p-1", 2, MPFR_RNDN) != 0)
+ {
+ printf ("Error for li2(x2, RNDZ)\n");
+ exit (1);
+ }
+
+ /* round away from zero mode and 5 bits of precision,
+ it should be rounded to 2^-2 + 2^-5 */
+ inexact = mpfr_li2 (y, x, MPFR_RNDU);
+ if (inexact != 1 || mpfr_cmp_str (y, "0.10010p-1", 2, MPFR_RNDN) != 0)
+ {
+ printf ("Error for li2(x2, RNDU)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+bug20091013 (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init2 (x, 17);
+ mpfr_init2 (y, 2);
+ mpfr_set_str_binary (x, "0.10000000000000000E-16");
+ inex = mpfr_li2 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (y, 1, -17) != 0)
+ {
+ printf ("Error in bug20091013()\n");
+ printf ("expected 2^(-17)\n");
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Error in bug20091013()\n");
+ printf ("expected negative ternary value, got %d\n", inex);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ bug20091013 ();
+
+ special ();
+
+ normal ();
+
+ test_generic (2, 100, 2);
+
+ data_check ("data/li2", mpfr_li2, "mpfr_li2");
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tlngamma.c b/tests/tlngamma.c
new file mode 100644
index 0000000..500b9a2
--- /dev/null
+++ b/tests/tlngamma.c
@@ -0,0 +1,238 @@
+/* mpfr_tlngamma -- test file for lngamma function
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_lngamma
+#define TEST_RANDOM_POS 16
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for lngamma(NaN)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for lngamma(-Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for lngamma(+Inf)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error for lngamma(+0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for lngamma(-0)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
+ {
+ printf ("Error for lngamma(1)\n");
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for lngamma(-1)\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
+ {
+ printf ("Error for lngamma(2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+#define CHECK_X1 "1.0762904832837976166"
+#define CHECK_Y1 "-0.039418362817587634939"
+
+ mpfr_set_str (x, CHECK_X1, 10, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y1, 10, MPFR_RNDN);
+ if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
+ {
+ printf ("mpfr_lngamma("CHECK_X1") is wrong:\n"
+ "expected ");
+ mpfr_print_binary (x); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (y); putchar ('\n');
+ exit (1);
+ }
+
+#define CHECK_X2 "9.23709516716202383435e-01"
+#define CHECK_Y2 "0.049010669407893718563"
+ mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
+ if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
+ {
+ printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
+ "expected ");
+ mpfr_print_binary (x); putchar ('\n');
+ printf ("got ");
+ mpfr_print_binary (y); putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 175);
+ mpfr_set_ui (x, 33, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 175);
+ mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
+ if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_lngamma (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 21);
+ mpfr_set_prec (y, 8);
+ mpfr_set_ui (y, 120, MPFR_RNDN);
+ mpfr_lngamma (x, y, MPFR_RNDZ);
+ mpfr_set_prec (y, 21);
+ mpfr_set_str_binary (y, "0.111000101000001100101E9");
+ if (MPFR_IS_NAN (x) || mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_lngamma (120)\n");
+ printf ("Expected "); mpfr_print_binary (y); puts ("");
+ printf ("Got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 206);
+ mpfr_set_str_binary (x, "0.110e10");
+ inex = mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 206);
+ mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
+ if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_lngamma (768)\n");
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Wrong flag for mpfr_lngamma (768)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 4);
+ mpfr_set_prec (y, 4);
+ mpfr_set_str_binary (x, "0.1100E-66");
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1100E6");
+ if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
+ {
+ printf ("Error for lngamma(0.1100E-66)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 256);
+ mpfr_set_prec (y, 32);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 32);
+ mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
+ if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
+ {
+ printf ("Error for lngamma(-2^199+0.5)\n");
+ printf ("Got ");
+ mpfr_dump (y);
+ printf ("instead of ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 256);
+ mpfr_set_prec (y, 32);
+ mpfr_set_si_2exp (x, -1, 200, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_lngamma (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error for lngamma(-2^199-0.5)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ special ();
+ test_generic (2, 100, 2);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tlog.c b/tests/tlog.c
new file mode 100644
index 0000000..f056d91
--- /dev/null
+++ b/tests/tlog.c
@@ -0,0 +1,361 @@
+/* Test file for mpfr_log.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_log (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_log (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_log mpfr_log
+#endif
+
+static void
+check2 (const char *as, mpfr_rnd_t rnd_mode, const char *res1s)
+{
+ mpfr_t ta, tres;
+
+ mpfr_inits2 (53, ta, tres, (mpfr_ptr) 0);
+ mpfr_set_str1 (ta, as);
+ test_log (tres, ta, rnd_mode);
+
+ if (mpfr_cmp_str1 (tres, res1s))
+ {
+ printf ("mpfr_log failed for a=%s, rnd_mode=%s\n",
+ as, mpfr_print_rnd_mode (rnd_mode));
+ printf ("correct result is %s\n mpfr_log gives ",
+ res1s);
+ mpfr_out_str(stdout, 10, 0, tres, MPFR_RNDN);
+ exit (1);
+ }
+ mpfr_clears (ta, tres, (mpfr_ptr) 0);
+}
+
+static void
+check3 (double d, unsigned long prec, mpfr_rnd_t rnd)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, prec);
+ mpfr_init2 (y, prec);
+ mpfr_set_d (x, d, rnd);
+ test_log (y, x, rnd);
+ mpfr_out_str (stdout, 10, 0, y, rnd);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* examples from Jean-Michel Muller and Vincent Lefevre
+ Cf http://www.ens-lyon.fr/~jmmuller/Intro-to-TMD.htm
+*/
+
+static void
+check_worst_cases (void)
+{
+ check2("1.00089971802309629645", MPFR_RNDD, "8.99313519443722736088e-04");
+ check2("1.00089971802309629645", MPFR_RNDN, "8.99313519443722844508e-04");
+ check2("1.00089971802309629645", MPFR_RNDU, "8.99313519443722844508e-04");
+
+ check2("1.01979300812244555452", MPFR_RNDD, "1.95996734891603630047e-02");
+ check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02");
+ check2("1.01979300812244555452", MPFR_RNDU, "1.95996734891603664741e-02");
+
+ check2("1.02900871924604464525", MPFR_RNDD, "2.85959303301472726744e-02");
+ check2("1.02900871924604464525", MPFR_RNDN, "2.85959303301472761438e-02");
+ check2("1.02900871924604464525", MPFR_RNDU, "2.85959303301472761438e-02");
+
+ check2("1.27832870030418943585", MPFR_RNDD, "2.45553521871417795852e-01");
+ check2("1.27832870030418943585", MPFR_RNDN, "2.45553521871417823608e-01");
+ check2("1.27832870030418943585", MPFR_RNDU, "2.45553521871417823608e-01");
+
+ check2("1.31706530746788241792", MPFR_RNDD, "2.75406009586277422674e-01");
+ check2("1.31706530746788241792", MPFR_RNDN, "2.75406009586277478185e-01");
+ check2("1.31706530746788241792", MPFR_RNDU, "2.75406009586277478185e-01");
+
+ check2("1.47116981099449883885", MPFR_RNDD, "3.86057874110010412760e-01");
+ check2("1.47116981099449883885", MPFR_RNDN, "3.86057874110010412760e-01");
+ check2("1.47116981099449883885", MPFR_RNDU, "3.86057874110010468272e-01");
+
+ check2("1.58405446812987782401", MPFR_RNDD, "4.59987679246663727639e-01");
+ check2("1.58405446812987782401", MPFR_RNDN, "4.59987679246663783150e-01");
+ check2("1.58405446812987782401", MPFR_RNDU, "4.59987679246663783150e-01");
+
+ check2("1.67192331263391547047", MPFR_RNDD, "5.13974647961076613889e-01");
+ check2("1.67192331263391547047", MPFR_RNDN, "5.13974647961076724911e-01");
+ check2("1.67192331263391547047", MPFR_RNDU, "5.13974647961076724911e-01");
+
+ check2("1.71101198068990645318", MPFR_RNDD, "5.37084997042120315669e-01");
+ check2("1.71101198068990645318", MPFR_RNDN, "5.37084997042120315669e-01");
+ check2("1.71101198068990645318", MPFR_RNDU, "5.37084997042120426691e-01");
+
+ check2("1.72634853551388700588", MPFR_RNDD, "5.46008504786553605648e-01");
+ check2("1.72634853551388700588", MPFR_RNDN, "5.46008504786553716670e-01");
+ check2("1.72634853551388700588", MPFR_RNDU, "5.46008504786553716670e-01");
+
+ check2("2.00028876593004323325", MPFR_RNDD, "6.93291553102749702475e-01");
+ check2("2.00028876593004323325", MPFR_RNDN, "6.93291553102749813497e-01");
+ check2("2.00028876593004323325", MPFR_RNDU, "6.93291553102749813497e-01");
+
+ check2("6.27593230200363105808", MPFR_RNDD, "1.83672204800630312072");
+ check2("6.27593230200363105808", MPFR_RNDN, "1.83672204800630334276");
+ check2("6.27593230200363105808", MPFR_RNDU, "1.83672204800630334276");
+
+ check2("7.47216682321367997588", MPFR_RNDD, "2.01118502712453661729");
+ check2("7.47216682321367997588", MPFR_RNDN, "2.01118502712453706138");
+ check2("7.47216682321367997588", MPFR_RNDU, "2.01118502712453706138");
+
+ check2("9.34589857718275318632", MPFR_RNDD, "2.23493759221664944903");
+ check2("9.34589857718275318632", MPFR_RNDN, "2.23493759221664989312");
+ check2("9.34589857718275318632", MPFR_RNDU, "2.23493759221664989312");
+
+ check2("10.6856587560831854944", MPFR_RNDD, "2.36890253928838445674");
+ check2("10.6856587560831854944", MPFR_RNDN, "2.36890253928838445674");
+ check2("10.6856587560831854944", MPFR_RNDU, "2.36890253928838490083");
+
+ check2("12.4646345033981766903", MPFR_RNDD, "2.52289539471636015122");
+ check2("12.4646345033981766903", MPFR_RNDN, "2.52289539471636015122");
+ check2("12.4646345033981766903", MPFR_RNDU, "2.52289539471636059531");
+
+ check2("17.0953275851761752335", MPFR_RNDD, "2.83880518553861849185");
+ check2("17.0953275851761752335", MPFR_RNDN, "2.83880518553861893594");
+ check2("17.0953275851761752335", MPFR_RNDU, "2.83880518553861893594");
+
+ check2("19.8509496207496916043", MPFR_RNDD, "2.98825184582516722998");
+ check2("19.8509496207496916043", MPFR_RNDN, "2.98825184582516722998");
+ check2("19.8509496207496916043", MPFR_RNDU, "2.98825184582516767406");
+
+ check2("23.9512076062771335216", MPFR_RNDD, "3.17601874455977206679");
+ check2("23.9512076062771335216", MPFR_RNDN, "3.17601874455977206679");
+ check2("23.9512076062771335216", MPFR_RNDU, "3.17601874455977251088");
+
+ check2("428.315247165198229595", MPFR_RNDD, "6.05985948325268264369");
+ check2("428.315247165198229595", MPFR_RNDN, "6.05985948325268353187");
+ check2("428.315247165198229595", MPFR_RNDU, "6.05985948325268353187");
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ /* Check special case: An overflow in const_pi could occurs! */
+ set_emin (-125);
+ set_emax (128);
+ mpfr_set_prec (y, 24*2);
+ mpfr_set_prec (x, 24);
+ mpfr_set_str_binary (x, "0.111110101010101011110101E0");
+ test_log (y, x, MPFR_RNDN);
+ set_emin (emin);
+ set_emax (emax);
+
+ mpfr_set_prec (y, 53);
+ mpfr_set_prec (x, 53);
+ mpfr_set_ui (x, 3, MPFR_RNDD);
+ test_log (y, x, MPFR_RNDD);
+ if (mpfr_cmp_str1 (y, "1.09861228866810956"))
+ {
+ printf ("Error in mpfr_log(3) for MPFR_RNDD\n");
+ exit (1);
+ }
+
+ /* check large precision */
+ mpfr_set_prec (x, 3322);
+ mpfr_set_prec (y, 3322);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_sqrt (x, x, MPFR_RNDN);
+ test_log (y, x, MPFR_RNDN);
+
+ /* negative argument */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ test_log (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ /* infinite loop when */
+ set_emax (128);
+ mpfr_set_prec (x, 251);
+ mpfr_set_prec (y, 251);
+ mpfr_set_str_binary (x, "0.10010111000000000001101E8");
+ /* x = 4947981/32768, log(x) ~ 5.017282... */
+ test_log (y, x, MPFR_RNDN);
+
+ set_emax (emax);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = test_log (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) < 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = test_log (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) < 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+x_near_one (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 16);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ inex = mpfr_log (y, x, MPFR_RNDD);
+ if (mpfr_cmp_str (y, "-0.1000000000000001E-31", 2, MPFR_RNDN)
+ || inex >= 0)
+ {
+ printf ("Failure in x_near_one, got inex = %d and\ny = ", inex);
+ mpfr_dump (y);
+ }
+
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+#define TEST_FUNCTION test_log
+#define TEST_RANDOM_POS 8
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ if (argc==4)
+ { /* tlog x prec rnd */
+ check3 (atof(argv[1]), atoi(argv[2]), (mpfr_rnd_t) atoi(argv[3]));
+ goto done;
+ }
+
+ special ();
+ check_worst_cases();
+
+ check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02");
+ check2("10.0",MPFR_RNDU,"2.30258509299404590110e+00");
+ check2("6.0",MPFR_RNDU,"1.79175946922805517936");
+ check2("1.0",MPFR_RNDZ,"0.0");
+ check2("62.0",MPFR_RNDU,"4.12713438504509166905");
+ check2("0.5",MPFR_RNDZ,"-6.93147180559945286226e-01");
+ check2("3.0",MPFR_RNDZ,"1.09861228866810956006e+00");
+ check2("234375765.0",MPFR_RNDU,"1.92724362186836231104e+01");
+ check2("8.0",MPFR_RNDZ,"2.07944154167983574765e+00");
+ check2("44.0",MPFR_RNDU,"3.78418963391826146392e+00");
+ check2("1.01979300812244555452", MPFR_RNDN, "1.95996734891603664741e-02");
+
+ /* bugs found by Vincent Lefe`vre */
+ check2("0.99999599881598921769", MPFR_RNDN, "-0.0000040011920155404072924737977900999652547398000024259090423583984375");
+ check2("9.99995576063808955247e-01",MPFR_RNDZ,"-4.42394597667932383816e-06");
+ check2("9.99993687357856209097e-01",MPFR_RNDN,"-6.31266206860017342601e-06");
+ check2("9.99995223520736886691e-01",MPFR_RNDN,"-4.77649067052670982220e-06");
+ check2("9.99993025794720935551e-01",MPFR_RNDN,"-6.97422959894716163837e-06");
+ check2("9.99987549017837484833e-01",MPFR_RNDN,"-1.24510596766369924330e-05");
+ check2("9.99985901426543311032e-01",MPFR_RNDN,"-1.40986728425098585229e-05");
+ check2("9.99986053947420794330e-01",MPFR_RNDN, "-0.000013946149826301084938555592540598837558718514628708362579345703125");
+ check2("9.99971938247442126979e-01",MPFR_RNDN,"-2.80621462962173414790e-05");
+
+ /* other bugs found by Vincent Lefe`vre */
+ check2("1.18615436389927785905e+77",MPFR_RNDN,"1.77469768607706015473e+02");
+ check2("9.48868723578399476187e+77",MPFR_RNDZ,"1.79549152432275803903e+02");
+ check2("2.31822210096938820854e+89",MPFR_RNDN,"2.05770873832573869322e+02");
+
+ /* further bugs found by Vincent Lefe`vre */
+ check2("9.99999989485669482647e-01",MPFR_RNDZ,"-1.05143305726283042331e-08");
+ check2("9.99999989237970177136e-01",MPFR_RNDZ,"-1.07620298807745377934e-08");
+ check2("9.99999989239339082125e-01",MPFR_RNDN,"-1.07606609757704445430e-08");
+
+ check2("7.3890560989306504",MPFR_RNDU,"2.0000000000000004"); /* exp(2.0) */
+ check2("7.3890560989306495",MPFR_RNDU,"2.0"); /* exp(2.0) */
+ check2("7.53428236571286402512e+34",MPFR_RNDZ,"8.03073567492226345621e+01");
+ check2("6.18784121531737948160e+19",MPFR_RNDZ,"4.55717030391710693493e+01");
+ check2("1.02560267603047283735e+00",MPFR_RNDD,"2.52804164149448735987e-02");
+ check2("7.53428236571286402512e+34",MPFR_RNDZ,"8.03073567492226345621e+01");
+ check2("1.42470900831881198052e+49",MPFR_RNDZ,"113.180637144887668910087086260318756103515625");
+
+ check2("1.08013816255293777466e+11",MPFR_RNDN,"2.54055249841782604392e+01");
+ check2("6.72783635300509015581e-37",MPFR_RNDU,"-8.32893948416799503320e+01");
+ check2("2.25904918906057891180e-52",MPFR_RNDU,"-1.18919480823735682406e+02");
+ check2("1.48901209246462951085e+00",MPFR_RNDD,"3.98112874867437460668e-01");
+ check2("1.70322470467612341327e-01",MPFR_RNDN,"-1.77006175364294615626");
+ check2("1.94572026316065240791e+01",MPFR_RNDD,"2.96821731676437838842");
+ check2("4.01419512207026418764e+04",MPFR_RNDD,"1.06001772315501128218e+01");
+ check2("9.47077365236487591672e-04",MPFR_RNDZ,"-6.96212977303956748187e+00");
+ check2("3.95906157687589643802e-109",MPFR_RNDD,"-2.49605768114704119399e+02");
+ check2("2.73874914516503004113e-02",MPFR_RNDD,"-3.59766888618655977794e+00");
+ check2("9.18989072589566467669e-17",MPFR_RNDZ,"-3.69258425351464083519e+01");
+ check2("7706036453608191045959753324430048151991964994788917248.0",MPFR_RNDZ,"126.3815989984199177342816255986690521240234375");
+ check2("1.74827399630587801934e-23",MPFR_RNDZ,"-5.24008281254547156891e+01");
+ check2("4.35302958401482307665e+22",MPFR_RNDD,"5.21277441046519527390e+01");
+ check2("9.70791868689332915209e+00",MPFR_RNDD,"2.27294191194272210410e+00");
+ check2("2.22183639799464011100e-01",MPFR_RNDN,"-1.50425103275253957413e+00");
+ check2("2.27313466156682375540e+00",MPFR_RNDD,"8.21159787095675608448e-01");
+ check2("6.58057413965851156767e-01",MPFR_RNDZ,"-4.18463096196088235600e-01");
+ check2 ("7.34302197248998461006e+43",MPFR_RNDZ,"101.0049094695131799426235374994575977325439453125");
+ check2("6.09969788341579732815e+00",MPFR_RNDD,"1.80823924264386204363e+00");
+
+ x_near_one ();
+
+ test_generic (2, 100, 40);
+
+ data_check ("data/log", mpfr_log, "mpfr_log");
+ bad_cases (mpfr_log, mpfr_exp, "mpfr_log", 256, -30, 30, 4, 128, 800, 50);
+
+ done:
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tlog10.c b/tests/tlog10.c
new file mode 100644
index 0000000..eb8a587
--- /dev/null
+++ b/tests/tlog10.c
@@ -0,0 +1,122 @@
+/* Test file for mpfr_log10.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_log10 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_log10 (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_log10 mpfr_log10
+#endif
+
+#define TEST_FUNCTION test_log10
+#define TEST_RANDOM_POS 8
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ unsigned int n;
+ int inex;
+
+ tests_start_mpfr ();
+
+ test_generic (2, 100, 20);
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ /* check NaN */
+ mpfr_set_nan (x);
+ inex = test_log10 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0);
+
+ /* check Inf */
+ mpfr_set_inf (x, -1);
+ inex = test_log10 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0);
+
+ mpfr_set_inf (x, 1);
+ inex = test_log10 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0 && inex == 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = test_log10 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = test_log10 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
+
+ /* check negative argument */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y) && inex == 0);
+
+ /* check log10(1) = 0 */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inex = test_log10 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y) && inex == 0);
+
+ /* check log10(10^n)=n */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ for (n = 1; n <= 15; n++)
+ {
+ mpfr_mul_ui (x, x, 10, MPFR_RNDN); /* x = 10^n */
+ inex = test_log10 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, n))
+ {
+ printf ("log10(10^n) <> n for n=%u\n", n);
+ exit (1);
+ }
+ MPFR_ASSERTN (inex == 0);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ data_check ("data/log10", mpfr_log10, "mpfr_log10");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tlog1p.c b/tests/tlog1p.c
new file mode 100644
index 0000000..7c6320e
--- /dev/null
+++ b/tests/tlog1p.c
@@ -0,0 +1,150 @@
+/* Test file for mpfr_log1p.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_log1p (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_log1p (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_log1p mpfr_log1p
+#endif
+
+#define TEST_FUNCTION test_log1p
+#define TEST_RANDOM_EMAX 80
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x;
+ int inex;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x) && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG (x) && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ mpfr_set_si (x, -2, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = test_log1p (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ mpfr_clear (x);
+}
+
+static void
+other (void)
+{
+ mpfr_t x, y;
+
+ /* Bug reported by Guillaume Melquiond on 2006-08-14. */
+ mpfr_init2 (x, 53);
+ mpfr_set_str (x, "-1.5e4f72873ed9a@-100", 16, MPFR_RNDN);
+ mpfr_init2 (y, 57);
+ mpfr_log1p (y, x, MPFR_RNDU);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error in tlog1p for x = ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf (", rnd = MPFR_RNDU\nExpected ");
+ mpfr_out_str (stdout, 16, 15, x, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 15, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+ return;
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+ other ();
+
+ test_generic (2, 100, 50);
+
+ data_check ("data/log1p", mpfr_log1p, "mpfr_log1p");
+ bad_cases (mpfr_log1p, mpfr_expm1, "mpfr_log1p", 256, -64, 40,
+ 4, 128, 800, 40);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tlog2.c b/tests/tlog2.c
new file mode 100644
index 0000000..b64c809
--- /dev/null
+++ b/tests/tlog2.c
@@ -0,0 +1,84 @@
+/* Test file for mpfr_log2.
+
+Copyright 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_log2
+#define TEST_RANDOM_POS 8
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x;
+ int inex;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
+
+ mpfr_set_inf (x, -1);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
+
+ mpfr_set_inf (x, 1);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
+
+ mpfr_set_si (x, 1, MPFR_RNDN);
+ inex = mpfr_log2 (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x) && inex == 0);
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_generic (2, 100, 30);
+
+ data_check ("data/log2", mpfr_log2, "mpfr_log2");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tmin_prec.c b/tests/tmin_prec.c
new file mode 100644
index 0000000..451504b
--- /dev/null
+++ b/tests/tmin_prec.c
@@ -0,0 +1,102 @@
+/* Test file for mpfr_min_prec.
+
+Copyright 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ mpfr_prec_t ret;
+ unsigned long i;
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (x, 53);
+
+ /* Check special values */
+ mpfr_set_nan (x);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 0);
+
+ mpfr_set_inf (x, 1);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 0);
+
+ mpfr_set_inf (x, -1);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 0);
+
+ /* Some constants */
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 1);
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 5);
+
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ ret = mpfr_min_prec (x);
+ MPFR_ASSERTN (ret == 5);
+
+ mpfr_set_prec (x, 256);
+ for (i = 0; i <= 255; i++)
+ {
+ mpfr_set_ui_2exp (x, 1, i, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ ret = mpfr_min_prec (x);
+ if (ret != i + 1)
+ {
+ printf ("Error for x = 2^%lu + 1\n", i);
+ printf ("Expected %lu, got %lu\n", i + 1, (unsigned long) ret);
+ exit (1);
+ }
+ }
+
+ for (i = MPFR_PREC_MIN; i <= 255; i++)
+ {
+ mpfr_set_prec (x, i);
+ mpfr_set_ui_2exp (x, 1, i, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ ret = mpfr_min_prec (x);
+ if (ret != i)
+ {
+ printf ("Error for x = 2^%lu - 1\n", i);
+ printf ("Expected %lu, got %lu\n", i, (unsigned long) ret);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tminmax.c b/tests/tminmax.c
new file mode 100644
index 0000000..cdd9b4a
--- /dev/null
+++ b/tests/tminmax.c
@@ -0,0 +1,171 @@
+/* Test file for mpfr_min & mpfr_max.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ /* case x=NaN && y=NAN */
+ mpfr_set_nan (x);
+ mpfr_set_nan (y);
+ mpfr_min (z, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (z))
+ {
+ printf ("Error in mpfr_min (NaN, NaN)\n");
+ exit (1);
+ }
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if (!mpfr_nan_p (z))
+ {
+ printf ("Error in mpfr_max (NaN, NaN)\n");
+ exit (1);
+ }
+ /* case x=NaN */
+ mpfr_set_nan (x);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0))
+ {
+ printf ("Error in mpfr_min (NaN, 0)\n");
+ exit (1);
+ }
+ mpfr_min (z, y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0))
+ {
+ printf ("Error in mpfr_min (0, NaN)\n");
+ exit (1);
+ }
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0))
+ {
+ printf ("Error in mpfr_max (NaN, 0)\n");
+ exit (1);
+ }
+ mpfr_max (z, y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0))
+ {
+ printf ("Error in mpfr_max (0, NaN)\n");
+ exit (1);
+ }
+ /* Case x=0+ and x=0- */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN); MPFR_SET_NEG(y);
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if (!MPFR_IS_ZERO(z) || MPFR_IS_NEG(z))
+ {
+ printf ("Error in mpfr_max (0+, 0-)\n");
+ exit (1);
+ }
+ mpfr_min (z, x, y, MPFR_RNDN);
+ if (!MPFR_IS_ZERO(z) || MPFR_IS_POS(z))
+ {
+ printf ("Error in mpfr_min (0+, 0-)\n");
+ exit (1);
+ }
+ /* Case x=0- and y=0+ */
+ mpfr_set_ui (x, 0, MPFR_RNDN); MPFR_SET_NEG(x);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if (!MPFR_IS_ZERO(z) || MPFR_IS_NEG(z))
+ {
+ printf ("Error in mpfr_max (0+, 0-)\n");
+ exit (1);
+ }
+ mpfr_min (z, x, y, MPFR_RNDN);
+ if (!MPFR_IS_ZERO(z) || MPFR_IS_POS(z))
+ {
+ printf ("Error in mpfr_min (0+, 0-)\n");
+ exit (1);
+ }
+
+ /* case x=+Inf */
+ mpfr_set_inf (x, 1);
+ mpfr_set_si (y, -12, MPFR_RNDN);
+ mpfr_min (z, x, y, MPFR_RNDN);
+ if ( mpfr_cmp_si (z, -12) )
+ {
+ printf ("Error in mpfr_min (+Inf, -12)\n");
+ exit (1);
+ }
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if ( !MPFR_IS_INF(z) || MPFR_IS_NEG(z) )
+ {
+ printf ("Error in mpfr_max (+Inf, 12)\n");
+ exit (1);
+ }
+ /* case x=-Inf */
+ mpfr_set_inf (x, -1);
+ mpfr_set_ui (y, 12, MPFR_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if ( mpfr_cmp_ui (z, 12) )
+ {
+ printf ("Error in mpfr_max (-Inf, 12)\n");
+ exit (1);
+ }
+ mpfr_min (z, x, y, MPFR_RNDN);
+ if ( !MPFR_IS_INF(z) || MPFR_IS_POS(z) )
+ {
+ printf ("Error in mpfr_min (-Inf, 12)\n");
+ exit (1);
+ }
+
+ /* case x=17 and y=42 */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ mpfr_max (z, x, y, MPFR_RNDN);
+ if ( mpfr_cmp_ui (z, 42) )
+ {
+ printf ("Error in mpfr_max (17, 42)\n");
+ exit (1);
+ }
+ mpfr_max (z, y, x, MPFR_RNDN);
+ if ( mpfr_cmp_ui (z, 42) )
+ {
+ printf ("Error in mpfr_max (42, 17)\n");
+ exit (1);
+ }
+ mpfr_min (z, y, x, MPFR_RNDN);
+ if ( mpfr_cmp_ui (z, 17) )
+ {
+ printf ("Error in mpfr_min (42, 17)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tmodf.c b/tests/tmodf.c
new file mode 100644
index 0000000..c89ade8
--- /dev/null
+++ b/tests/tmodf.c
@@ -0,0 +1,236 @@
+/* Test file for mpfr_modf.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check (const char *xis, const char *xfs, const char *xs,
+ mpfr_prec_t xip, mpfr_prec_t xfp, mpfr_prec_t xp,
+ int expected_return, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ mpfr_t xi, xf, x;
+
+ mpfr_init2 (xi, xip);
+ mpfr_init2 (xf, xfp);
+ mpfr_init2 (x, xp);
+ mpfr_set_str1 (x, xs);
+ inexact = mpfr_modf (xi, xf, x, rnd_mode);
+ if (mpfr_cmp_str1 (xi, xis))
+ {
+ printf ("mpfr_modf failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode(rnd_mode));
+ printf ("got integer value: ");
+ mpfr_out_str (stdout, 10, 0, xi, MPFR_RNDN);
+ printf ("\nexpected %s\n", xis);
+ exit (1);
+ }
+ if (mpfr_cmp_str1 (xf, xfs))
+ {
+ printf ("mpfr_modf failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode(rnd_mode));
+ printf ("got fractional value: ");
+ mpfr_out_str (stdout, 10, 0, xf, MPFR_RNDN);
+ printf ("\nexpected %s\n", xfs);
+ exit (1);
+ }
+ if (inexact != expected_return)
+ {
+ printf ("mpfr_modf failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode(rnd_mode));
+ printf ("got return value: %d, expected %d\n", inexact, expected_return);
+ exit (1);
+ }
+ mpfr_clears (xi, xf, x, (mpfr_ptr) 0);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, xi, xf;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (xi, 123);
+ mpfr_init2 (xf, 123);
+
+ /* nan */
+ mpfr_set_nan (x);
+ mpfr_modf (xi, xf, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (xi));
+ MPFR_ASSERTN (mpfr_nan_p (xf));
+
+ /* +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_modf (xi, xf, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (xi));
+ MPFR_ASSERTN (mpfr_sgn (xi) > 0);
+ MPFR_ASSERTN (mpfr_zero_p (xf));
+
+ /* -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_modf (xi ,xf, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (xi));
+ MPFR_ASSERTN (mpfr_sgn (xi) < 0);
+ MPFR_ASSERTN (mpfr_zero_p (xf));
+
+ mpfr_clear (x);
+ mpfr_clear (xi);
+ mpfr_clear (xf);
+}
+
+static void
+check_special_exprange (void)
+{
+ int inexact, ov;
+ unsigned int eflags, gflags;
+ mpfr_t xi, xf, x;
+ mpfr_exp_t emax;
+
+ emax = mpfr_get_emax ();
+ mpfr_init2 (xi, 7);
+ mpfr_init2 (xf, 7);
+ mpfr_init2 (x, 8);
+
+ mpfr_set_str (x, "0.11111111", 2, MPFR_RNDN);
+ for (ov = 0; ov <= 1; ov++)
+ {
+ const char *s = ov ? "@Inf@" : "1";
+
+ if (ov)
+ set_emax (0);
+ mpfr_clear_flags ();
+ inexact = mpfr_modf (xi, xf, x, MPFR_RNDN);
+ gflags = __gmpfr_flags;
+ set_emax (emax);
+ if (MPFR_NOTZERO (xi) || MPFR_IS_NEG (xi) ||
+ mpfr_cmp_str1 (xf, s) != 0)
+ {
+ printf ("Error in check_special_exprange (ov = %d):"
+ " expected 0 and %s, got\n", ov, s);
+ mpfr_out_str (stdout, 2, 0, xi, MPFR_RNDN);
+ printf (" and ");
+ mpfr_out_str (stdout, 2, 0, xf, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inexact != 4)
+ {
+ printf ("Bad inexact value in check_special_exprange (ov = %d):"
+ " expected 4, got %d\n", ov, inexact);
+ exit (1);
+ }
+ eflags = MPFR_FLAGS_INEXACT | (ov ? MPFR_FLAGS_OVERFLOW : 0);
+ if (gflags != eflags)
+ {
+ printf ("Bad flags in check_special_exprange (ov = %d):"
+ " expected %u, got %u\n", ov, eflags, gflags);
+ exit (1);
+ }
+ }
+
+ /* Test if an overflow occurs in mpfr_set for ope >= opq. */
+ mpfr_set_emax (MPFR_EMAX_MAX);
+ mpfr_set_inf (x, 1);
+ mpfr_nextbelow (x);
+ mpfr_clear_flags ();
+ inexact = mpfr_modf (xi, xf, x, MPFR_RNDN);
+ gflags = __gmpfr_flags;
+ if (mpfr_cmp_str1 (xi, "@Inf@") != 0 ||
+ MPFR_NOTZERO (xf) || MPFR_IS_NEG (xf))
+ {
+ printf ("Error in check_special_exprange:"
+ " expected 0 and @Inf@, got\n");
+ mpfr_out_str (stdout, 2, 0, xi, MPFR_RNDN);
+ printf (" and ");
+ mpfr_out_str (stdout, 2, 0, xf, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inexact != 1)
+ {
+ printf ("Bad inexact value in check_special_exprange:"
+ " expected 1, got %d\n", inexact);
+ exit (1);
+ }
+ eflags = MPFR_FLAGS_INEXACT | MPFR_FLAGS_OVERFLOW;
+ if (gflags != eflags)
+ {
+ printf ("Bad flags in check_special_exprange:"
+ " expected %u, got %u\n", eflags, gflags);
+ exit (1);
+ }
+ set_emax (emax);
+
+ /* Test if an underflow occurs in the general case. TODO */
+
+ mpfr_clears (xi, xf, x, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ /* integer part is exact, frac. part is exact: return value should be 0 */
+ check ("61680","3.52935791015625e-1", "61680.352935791015625",
+ 53, 53, 53, 0, MPFR_RNDZ);
+ /* integer part is rounded up, fractional part is rounded up: return value
+ should be 1+4*1=5 */
+ check ("-53968","-3.529052734375e-1", "-53970.352935791015625",
+ 13, 13, 53, 5, MPFR_RNDZ);
+ /* integer part is rounded down, fractional part is rounded down:
+ return value should be 2+4*2=10 */
+ check ("61632","3.525390625e-1", "61648.352935791015625",
+ 10, 10, 53, 10, MPFR_RNDZ);
+ check ("61680", "0", "61680", 53, 53, 53, 0, MPFR_RNDZ);
+ /* integer part is rounded up, fractional part is exact: 1 */
+ check ("-53968","0", "-53970", 13, 13, 53, 1, MPFR_RNDZ);
+ /* integer part is rounded up, fractional part is exact: 1 */
+ check ("-43392","0", "-43399", 13, 13, 53, 1, MPFR_RNDU);
+ /* integer part is rounded down, fractional part is exact: 2 */
+ check ("-52720","0", "-52719", 13, 13, 53, 2, MPFR_RNDD);
+ /* integer part is rounded down, fractional part is exact: 2 */
+ check ("61632", "0", "61648", 10, 10, 53, 2, MPFR_RNDZ);
+
+ check_special_exprange ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tmul.c b/tests/tmul.c
new file mode 100644
index 0000000..fa5f158
--- /dev/null
+++ b/tests/tmul.c
@@ -0,0 +1,697 @@
+/* Test file for mpfr_mul.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ printf (" ");
+ mpfr_print_raw (c);
+ }
+ res = mpfr_mul (a, b, c, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_mul mpfr_mul
+#endif
+
+/* checks that xs * ys gives the expected result res */
+static void
+check (const char *xs, const char *ys, mpfr_rnd_t rnd_mode,
+ unsigned int px, unsigned int py, unsigned int pz, const char *res)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_init2 (xx, px);
+ mpfr_init2 (yy, py);
+ mpfr_init2 (zz, pz);
+ mpfr_set_str1 (xx, xs);
+ mpfr_set_str1 (yy, ys);
+ test_mul(zz, xx, yy, rnd_mode);
+ if (mpfr_cmp_str1 (zz, res) )
+ {
+ printf ("(1)mpfr_mul failed for x=%s y=%s with rnd=%s\n",
+ xs, ys, mpfr_print_rnd_mode (rnd_mode));
+ printf ("correct is %s, mpfr_mul gives ", res);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
+ /*
+ printf("\nBinary forms:\nxx=");
+ mpfr_print_binary (xx);
+ printf("\nyy=");
+ mpfr_print_binary (yy);
+ printf("\nzz=");
+ mpfr_print_binary(zz);
+ printf("\nre=");
+ mpfr_set_str1 (zz, res);
+ mpfr_print_binary(zz);
+ putchar('\n');*/
+ exit (1);
+ }
+ mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz);
+}
+
+static void
+check53 (const char *xs, const char *ys, mpfr_rnd_t rnd_mode, const char *zs)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_inits2 (53, xx, yy, zz, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs);
+ mpfr_set_str1 (yy, ys);
+ test_mul (zz, xx, yy, rnd_mode);
+ if (mpfr_cmp_str1 (zz, zs) )
+ {
+ printf ("(2) mpfr_mul failed for x=%s y=%s with rnd=%s\n",
+ xs, ys, mpfr_print_rnd_mode(rnd_mode));
+ printf ("correct result is %s,\n mpfr_mul gives ", zs);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
+ /*
+ printf("\nBinary forms:\nxx=");
+ mpfr_print_binary (xx);
+ printf("\nyy=");
+ mpfr_print_binary (yy);
+ printf("\nzz=");
+ mpfr_print_binary(zz);
+ printf("\nre=");
+ mpfr_set_str1 (zz, zs);
+ mpfr_print_binary(zz);
+ putchar('\n'); */
+ exit (1);
+ }
+ mpfr_clears (xx, yy, zz, (mpfr_ptr) 0);
+}
+
+/* checks that x*y gives the right result with 24 bits of precision */
+static void
+check24 (const char *xs, const char *ys, mpfr_rnd_t rnd_mode, const char *zs)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_inits2 (24, xx, yy, zz, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs);
+ mpfr_set_str1 (yy, ys);
+ test_mul (zz, xx, yy, rnd_mode);
+ if (mpfr_cmp_str1 (zz, zs) )
+ {
+ printf ("(3) mpfr_mul failed for x=%s y=%s with "
+ "rnd=%s\n", xs, ys, mpfr_print_rnd_mode(rnd_mode));
+ printf ("correct result is gives %s, mpfr_mul gives ", zs);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
+ putchar('\n');
+ exit (1);
+ }
+ mpfr_clears (xx, yy, zz, (mpfr_ptr) 0);
+}
+
+/* the following examples come from the paper "Number-theoretic Test
+ Generation for Directed Rounding" from Michael Parks, Table 1 */
+static void
+check_float (void)
+{
+ check24("8388609.0", "8388609.0", MPFR_RNDN, "70368760954880.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDN, "140737479966720.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDN, "70368777732096.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDN, "105553133043712.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDN, "105553158209536.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDN, "117281279442944.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDN, "93825028587520.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDN, "93825020198912.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDN, "117281287831552.0");
+
+ check24("8388609.0", "8388609.0", MPFR_RNDZ, "70368760954880.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDZ, "140737471578112.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDZ, "70368777732096.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDZ, "105553124655104.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDZ, "105553158209536.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDZ, "117281271054336.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDZ, "93825028587520.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDZ, "93825011810304.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDZ, "117281287831552.0");
+
+ check24("8388609.0", "8388609.0", MPFR_RNDU, "70368769343488.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDU, "140737479966720.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDU, "70368786120704.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDU, "105553133043712.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDU, "105553166598144.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDU, "117281279442944.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDU, "93825036976128.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDU, "93825020198912.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDU, "117281296220160.0");
+
+ check24("8388609.0", "8388609.0", MPFR_RNDD, "70368760954880.0");
+ check24("16777213.0", "8388609.0", MPFR_RNDD, "140737471578112.0");
+ check24("8388611.0", "8388609.0", MPFR_RNDD, "70368777732096.0");
+ check24("12582911.0", "8388610.0", MPFR_RNDD, "105553124655104.0");
+ check24("12582914.0", "8388610.0", MPFR_RNDD, "105553158209536.0");
+ check24("13981013.0", "8388611.0", MPFR_RNDD, "117281271054336.0");
+ check24("11184811.0", "8388611.0", MPFR_RNDD, "93825028587520.0");
+ check24("11184810.0", "8388611.0", MPFR_RNDD, "93825011810304.0");
+ check24("13981014.0", "8388611.0", MPFR_RNDD, "117281287831552.0");
+}
+
+/* check sign of result */
+static void
+check_sign (void)
+{
+ mpfr_t a, b;
+
+ mpfr_init2 (a, 53);
+ mpfr_init2 (b, 53);
+ mpfr_set_si (a, -1, MPFR_RNDN);
+ mpfr_set_ui (b, 2, MPFR_RNDN);
+ test_mul(a, b, b, MPFR_RNDN);
+ if (mpfr_cmp_ui (a, 4) )
+ {
+ printf ("2.0*2.0 gives \n");
+ mpfr_out_str(stdout, 10, 0, a, MPFR_RNDN);
+ putchar('\n');
+ exit (1);
+ }
+ mpfr_clear(a); mpfr_clear(b);
+}
+
+/* checks that the inexact return value is correct */
+static void
+check_exact (void)
+{
+ mpfr_t a, b, c, d;
+ mpfr_prec_t prec;
+ int i, inexact;
+ mpfr_rnd_t rnd;
+
+ mpfr_init (a);
+ mpfr_init (b);
+ mpfr_init (c);
+ mpfr_init (d);
+
+ mpfr_set_prec (a, 17);
+ mpfr_set_prec (b, 17);
+ mpfr_set_prec (c, 32);
+ mpfr_set_str_binary (a, "1.1000111011000100e-1");
+ mpfr_set_str_binary (b, "1.0010001111100111e-1");
+ if (test_mul (c, a, b, MPFR_RNDZ))
+ {
+ printf ("wrong return value (1)\n");
+ exit (1);
+ }
+
+ for (prec = 2; prec < 100; prec++)
+ {
+ mpfr_set_prec (a, prec);
+ mpfr_set_prec (b, prec);
+ mpfr_set_prec (c, 2 * prec - 2);
+ mpfr_set_prec (d, 2 * prec);
+ for (i = 0; i < 1000; i++)
+ {
+ mpfr_urandomb (a, RANDS);
+ mpfr_urandomb (b, RANDS);
+ rnd = RND_RAND ();
+ inexact = test_mul (c, a, b, rnd);
+ if (test_mul (d, a, b, rnd)) /* should be always exact */
+ {
+ printf ("unexpected inexact return value\n");
+ exit (1);
+ }
+ if ((inexact == 0) && mpfr_cmp (c, d))
+ {
+ printf ("inexact=0 but results differ\n");
+ exit (1);
+ }
+ else if (inexact && (mpfr_cmp (c, d) == 0))
+ {
+ printf ("inexact!=0 but results agree\n");
+ printf ("prec=%u rnd=%s a=", (unsigned int) prec,
+ mpfr_print_rnd_mode (rnd));
+ mpfr_out_str (stdout, 2, 0, a, rnd);
+ printf ("\nb=");
+ mpfr_out_str (stdout, 2, 0, b, rnd);
+ printf ("\nc=");
+ mpfr_out_str (stdout, 2, 0, c, rnd);
+ printf ("\nd=");
+ mpfr_out_str (stdout, 2, 0, d, rnd);
+ printf ("\n");
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+ mpfr_clear (c);
+ mpfr_clear (d);
+}
+
+static void
+check_max(void)
+{
+ mpfr_t xx, yy, zz;
+ mpfr_exp_t emin;
+
+ mpfr_init2(xx, 4);
+ mpfr_init2(yy, 4);
+ mpfr_init2(zz, 4);
+ mpfr_set_str1 (xx, "0.68750");
+ mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT/2, MPFR_RNDN);
+ mpfr_set_str1 (yy, "0.68750");
+ mpfr_mul_2si(yy, yy, MPFR_EMAX_DEFAULT - MPFR_EMAX_DEFAULT/2 + 1, MPFR_RNDN);
+ mpfr_clear_flags();
+ test_mul(zz, xx, yy, MPFR_RNDU);
+ if (!(mpfr_overflow_p() && MPFR_IS_INF(zz)))
+ {
+ printf("check_max failed (should be an overflow)\n");
+ exit(1);
+ }
+
+ mpfr_clear_flags();
+ test_mul(zz, xx, yy, MPFR_RNDD);
+ if (mpfr_overflow_p() || MPFR_IS_INF(zz))
+ {
+ printf("check_max failed (should NOT be an overflow)\n");
+ exit(1);
+ }
+ mpfr_set_str1 (xx, "0.93750");
+ mpfr_mul_2si(xx, xx, MPFR_EMAX_DEFAULT, MPFR_RNDN);
+ if (!(MPFR_IS_FP(xx) && MPFR_IS_FP(zz)))
+ {
+ printf("check_max failed (internal error)\n");
+ exit(1);
+ }
+ if (mpfr_cmp(xx, zz) != 0)
+ {
+ printf("check_max failed: got ");
+ mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ);
+ printf(" instead of ");
+ mpfr_out_str(stdout, 2, 0, xx, MPFR_RNDZ);
+ printf("\n");
+ exit(1);
+ }
+
+ /* check underflow */
+ emin = mpfr_get_emin ();
+ set_emin (0);
+ mpfr_set_str_binary (xx, "0.1E0");
+ mpfr_set_str_binary (yy, "0.1E0");
+ test_mul (zz, xx, yy, MPFR_RNDN);
+ /* exact result is 0.1E-1, which should round to 0 */
+ MPFR_ASSERTN(mpfr_cmp_ui (zz, 0) == 0 && MPFR_IS_POS(zz));
+ set_emin (emin);
+
+ /* coverage test for mpfr_powerof2_raw */
+ emin = mpfr_get_emin ();
+ set_emin (0);
+ mpfr_set_prec (xx, mp_bits_per_limb + 1);
+ mpfr_set_str_binary (xx, "0.1E0");
+ mpfr_nextabove (xx);
+ mpfr_set_str_binary (yy, "0.1E0");
+ test_mul (zz, xx, yy, MPFR_RNDN);
+ /* exact result is just above 0.1E-1, which should round to minfloat */
+ MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0);
+ set_emin (emin);
+
+ mpfr_clear(xx);
+ mpfr_clear(yy);
+ mpfr_clear(zz);
+}
+
+static void
+check_min(void)
+{
+ mpfr_t xx, yy, zz;
+
+ mpfr_init2(xx, 4);
+ mpfr_init2(yy, 4);
+ mpfr_init2(zz, 3);
+ mpfr_set_str1(xx, "0.9375");
+ mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT/2, MPFR_RNDN);
+ mpfr_set_str1(yy, "0.9375");
+ mpfr_mul_2si(yy, yy, MPFR_EMIN_DEFAULT - MPFR_EMIN_DEFAULT/2 - 1, MPFR_RNDN);
+ test_mul(zz, xx, yy, MPFR_RNDD);
+ if (mpfr_sgn(zz) != 0)
+ {
+ printf("check_min failed: got ");
+ mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ);
+ printf(" instead of 0\n");
+ exit(1);
+ }
+
+ test_mul(zz, xx, yy, MPFR_RNDU);
+ mpfr_set_str1 (xx, "0.5");
+ mpfr_mul_2si(xx, xx, MPFR_EMIN_DEFAULT, MPFR_RNDN);
+ if (mpfr_sgn(xx) <= 0)
+ {
+ printf("check_min failed (internal error)\n");
+ exit(1);
+ }
+ if (mpfr_cmp(xx, zz) != 0)
+ {
+ printf("check_min failed: got ");
+ mpfr_out_str(stdout, 2, 0, zz, MPFR_RNDZ);
+ printf(" instead of ");
+ mpfr_out_str(stdout, 2, 0, xx, MPFR_RNDZ);
+ printf("\n");
+ exit(1);
+ }
+
+ mpfr_clear(xx);
+ mpfr_clear(yy);
+ mpfr_clear(zz);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t p, x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+ mpfr_init2 (p, 123L);
+
+ /* nan * 0 == nan */
+ mpfr_set_nan (x);
+ mpfr_set_ui (y, 0L, MPFR_RNDN);
+ test_mul (p, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (p));
+
+ /* 1 * nan == nan */
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
+ mpfr_set_nan (y);
+ test_mul (p, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (p));
+
+ /* 0 * +inf == nan */
+ mpfr_set_ui (x, 0L, MPFR_RNDN);
+ mpfr_set_nan (y);
+ test_mul (p, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (p));
+
+ /* +1 * +inf == +inf */
+ mpfr_set_ui (x, 1L, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ test_mul (p, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (p));
+ MPFR_ASSERTN (mpfr_sgn (p) > 0);
+
+ /* -1 * +inf == -inf */
+ mpfr_set_si (x, -1L, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ test_mul (p, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (p));
+ MPFR_ASSERTN (mpfr_sgn (p) < 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (p);
+}
+
+#define BUFSIZE 1552
+
+static void
+get_string (char *s, FILE *fp)
+{
+ int c, n = BUFSIZE;
+
+ while ((c = getc (fp)) != '\n')
+ {
+ if (c == EOF)
+ {
+ printf ("Error in get_string: end of file\n");
+ exit (1);
+ }
+ *(unsigned char *)s++ = c;
+ if (--n == 0)
+ {
+ printf ("Error in get_string: buffer is too small\n");
+ exit (1);
+ }
+ }
+ *s = '\0';
+}
+
+static void
+check_regression (void)
+{
+ mpfr_t x, y, z;
+ int i;
+ FILE *fp;
+ char s[BUFSIZE];
+
+ mpfr_inits2 (6177, x, y, z, (mpfr_ptr) 0);
+ /* we read long strings from a file since ISO C90 does not support strings of
+ length > 509 */
+ fp = src_fopen ("tmul.dat", "r");
+ if (fp == NULL)
+ {
+ fprintf (stderr, "Error, cannot open tmul.dat in srcdir\n");
+ exit (1);
+ }
+ get_string (s, fp);
+ mpfr_set_str (y, s, 16, MPFR_RNDN);
+ get_string (s, fp);
+ mpfr_set_str (z, s, 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDN);
+ get_string (s, fp);
+ if (mpfr_cmp_str (x, s, 16, MPFR_RNDN) != 0 || i != -1)
+ {
+ printf ("Regression test 1 failed (i=%d, expected -1)\nx=", i);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ fclose (fp);
+
+ mpfr_set_prec (x, 606);
+ mpfr_set_prec (y, 606);
+ mpfr_set_prec (z, 606);
+
+ mpfr_set_str (y, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, MPFR_RNDN);
+ mpfr_set_str (z, "-f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff92daefc3f8052ca9f58736564d9e93e62d324@-1", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDU);
+ mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff25b5df87f00a5953eb0e6cac9b3d27cc5a64c@-1", 16, MPFR_RNDN);
+ if (mpfr_cmp (x, y) || i <= 0)
+ {
+ printf ("Regression test (2) failed! (i=%d - Expected 1)\n", i);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 184);
+ mpfr_set_prec (y, 92);
+ mpfr_set_prec (z, 1023);
+
+ mpfr_set_str (y, "6.9b8c8498882770d8038c3b0@-1", 16, MPFR_RNDN);
+ mpfr_set_str (z, "7.44e24b986e7fb296f1e936ce749fec3504cbf0d5ba769466b1c9f1578115efd5d29b4c79271191a920a99280c714d3a657ad6e3afbab77ffce9d697e9bb9110e26d676069afcea8b69f1d1541f2365042d80a97c21dcccd8ace4f1bb58b49922003e738e6f37bb82ef653cb2e87f763974e6ae50ae54e7724c38b80653e3289@255", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDU);
+ mpfr_set_prec (y, 184);
+ mpfr_set_str (y, "3.0080038f2ac5054e3e71ccbb95f76aaab2221715025a28@255",
+ 16, MPFR_RNDN);
+ if (mpfr_cmp (x, y) || i <= 0)
+ {
+ printf ("Regression test (4) failed! (i=%d - expected 1)\n", i);
+ printf ("Ref: 3.0080038f2ac5054e3e71ccbb95f76aaab2221715025a28@255\n"
+ "Got: ");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 908);
+ mpfr_set_prec (y, 908);
+ mpfr_set_prec (z, 908);
+ mpfr_set_str (y, "-f.fffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+"ffffffffffffffffffffffffffffffffffffffffffffffffffffff99be91f83ec6f0ed28a3d42"
+"e6e9a327230345ea6@-1", 16, MPFR_RNDN);
+ mpfr_set_str (z, "-f.fffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+"ffffffffffffffffffffffffffffffffffffffffffffffffffffff99be91f83ec6f0ed28a3d42"
+ "e6e9a327230345ea6@-1", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDU);
+ mpfr_set_str (y, "f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+"fffffffffffffffffffffffffffffffffffffffffffffffffffff337d23f07d8de1da5147a85c"
+"dd3464e46068bd4d@-1", 16, MPFR_RNDN);
+ if (mpfr_cmp (x, y) || i <= 0)
+ {
+ printf ("Regression test (5) failed! (i=%d - expected 1)\n", i);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+
+ mpfr_set_prec (x, 50);
+ mpfr_set_prec (y, 40);
+ mpfr_set_prec (z, 53);
+ mpfr_set_str (y, "4.1ffffffff8", 16, MPFR_RNDN);
+ mpfr_set_str (z, "4.2000000ffe0000@-4", 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, z, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "1.104000041d6c0@-3", 16, MPFR_RNDN) != 0
+ || i <= 0)
+ {
+ printf ("Regression test (6) failed! (i=%d - expected 1)\nx=", i);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\nMore prec=");
+ mpfr_set_prec (x, 93);
+ mpfr_mul (x, y, z, MPFR_RNDN);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 439);
+ mpfr_set_prec (y, 393);
+ mpfr_set_str (y, "-1.921fb54442d18469898cc51701b839a252049c1114cf98e804177d"
+ "4c76273644a29410f31c6809bbdf2a33679a748636600",
+ 16, MPFR_RNDN);
+ i = mpfr_mul (x, y, y, MPFR_RNDU);
+ if (mpfr_cmp_str (x, "2.77a79937c8bbcb495b89b36602306b1c2159a8ff834288a19a08"
+ "84094f1cda3dc426da61174c4544a173de83c2500f8bfea2e0569e3698",
+ 16, MPFR_RNDN) != 0
+ || i <= 0)
+ {
+ printf ("Regression test (7) failed! (i=%d - expected 1)\nx=", i);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 1023);
+ mpfr_set_prec (y, 1023);
+ mpfr_set_prec (z, 511);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ i = mpfr_mul (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 17*42) != 0 || i != 0)
+ {
+ printf ("Regression test (8) failed! (i=%d - expected 0)\nz=", i);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+#define TEST_FUNCTION test_mul
+#define TWO_ARGS
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
+#include "tgeneric.c"
+
+/* multiplies x by 53-bit approximation of Pi */
+static int
+mpfr_mulpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t r)
+{
+ mpfr_t z;
+ int inex;
+
+ mpfr_init2 (z, 53);
+ mpfr_set_str_binary (z, "11.001001000011111101101010100010001000010110100011");
+ inex = mpfr_mul (y, x, z, r);
+ mpfr_clear (z);
+ return inex;
+}
+
+static void
+valgrind20110503 (void)
+{
+ mpfr_t a, b, c;
+
+ mpfr_init2 (a, 2);
+ mpfr_init2 (b, 2005);
+ mpfr_init2 (c, 2);
+
+ mpfr_set_ui (b, 5, MPFR_RNDN);
+ mpfr_nextabove (b);
+ mpfr_set_ui (c, 1, MPFR_RNDN);
+ mpfr_mul (a, b, c, MPFR_RNDZ);
+ /* After the call to mpfr_mulhigh_n, valgrind complains:
+ Conditional jump or move depends on uninitialised value(s) */
+
+ mpfr_clears (a, b, c, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_nans ();
+ check_exact ();
+ check_float ();
+
+ check53("6.9314718055994530941514e-1", "0.0", MPFR_RNDZ, "0.0");
+ check53("0.0", "6.9314718055994530941514e-1", MPFR_RNDZ, "0.0");
+ check_sign();
+ check53("-4.165000000e4", "-0.00004801920768307322868063274915", MPFR_RNDN,
+ "2.0");
+ check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165",
+ MPFR_RNDZ, "-1.8251348697787782844e-172");
+ check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165",
+ MPFR_RNDA, "-1.8251348697787786e-172");
+ check53("0.31869277231188065", "0.88642843322303122", MPFR_RNDZ,
+ "2.8249833483992453642e-1");
+ check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDU,
+ 28, 45, 2, "0.375");
+ check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDA,
+ 28, 45, 2, "0.375");
+ check("2.63978122803639081440e-01", "6.8378615379333496093e-1", MPFR_RNDN,
+ 34, 23, 31, "0.180504585267044603");
+ check("1.0", "0.11835170935876249132", MPFR_RNDU, 6, 41, 36,
+ "0.1183517093595583");
+ check53("67108865.0", "134217729.0", MPFR_RNDN, "9.007199456067584e15");
+ check("1.37399642157394197284e-01", "2.28877275604219221350e-01", MPFR_RNDN,
+ 49, 15, 32, "0.0314472340833162888");
+ check("4.03160720978664954828e-01", "5.854828e-1"
+ /*"5.85483042917246621073e-01"*/, MPFR_RNDZ,
+ 51, 22, 32, "0.2360436821472831");
+ check("3.90798504668055102229e-14", "9.85394674650308388664e-04", MPFR_RNDN,
+ 46, 22, 12, "0.385027296503914762e-16");
+ check("4.58687081072827851358e-01", "2.20543551472118792844e-01", MPFR_RNDN,
+ 49, 3, 2, "0.09375");
+ check_max();
+ check_min();
+
+ check_regression ();
+ test_generic (2, 500, 100);
+
+ data_check ("data/mulpi", mpfr_mulpi, "mpfr_mulpi");
+
+ valgrind20110503 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tmul.dat b/tests/tmul.dat
new file mode 100644
index 0000000..3551efe
--- /dev/null
+++ b/tests/tmul.dat
@@ -0,0 +1,3 @@
+5.17cc1b727220a94fe13abe8fa9a6ee06db14acc9e21c820ff28b1d5ef5de2b0db92371d2126e9700324977504e8c90e7f0ef58e5894d39f74411afa975da24274ce38135a2fbf209cc8eb1cc1a99cfa4e422fc5defc941d8ffc4bffef02cc07f79788c5ad05368fb69b3f6793e584dba7a31fb34f2ff516ba93dd63f5f2f8bd9e839cfbc529497535fdafd88fc6ae842b0198237e3db5d5f867de104d7a1b0ed4f1c8b0af730d8432ccc2af8a50342046ffec4026b9939883030aab6539d464b0713de04635a3e20ce1b3e6ee74049541ace23b45cb0e536ed7a268ab8c829f52ff83829fbf19f419616f27cc193edde19e9377b58f2f7c4f9d0f9ae5793f8ec3f890c83e3e12357d376abb9698219d8ae30a5ace8ce1e16256a0a6962e8006233ec316b8f1cd634d803119be695a4bd3da6aaa9bfb1f6b8c0851fe3b26954eb255ebb87c3e31abd83d738a8bab24e06ceb1d9c4253e591923bc56b11aa2d5c8f800d8578efe70cff98cfb50f3330abcca3fdd66c3fbf5bb29144f419305ff366e277849b366a1faeebef0b6f1dac494def14116974431426ac711965630b718465bef028600bd38ef9adf00c1a099731094180a441adc77abfd856f9748f21a52469b3886c6ed5212fd76730b55214055a4ce9f953033fbbae41e151c41e30bc39c52d4657deebb7b1d316e5dffa77c0c6b3e09322e52a9b6ce569541446b0e13be4890a13024da309622ce22262e448d926f98b8056a1ea72a494886afefe5f00664a0f7767387a9f09c078f661f3d9947c63ca02c99f38e0d9849779a285ce09443d9055cfda9761492397993db6aa864853b90ff3b5cb6598a50b3cf13ca0c4effa4bca744273714b98ccb5f6c41b2faf877eddda4d24365233a13938992ec6dc0acf84f2de1298c69cba7b8e0298008606b40425ac77164855238173ba126b5ed33efbb92437778b4fd34a477b48da28a9e8f9056799cc103f25fab431d92f9f6e81aea03fc4c294a92ae0321b886c369924193aa62dea38a7372a22e08485b4fa956ab30a4e8393a8022eed9dda62bb750bfcc3beb5a4dd138e94b4cb000000000@1535
+3.243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e6c89452821e638d01377be5466cf34e90c6cc0ac29b7c97c50dd3f84d5b5b54709179216d5d98979fb1bd1310ba698dfb5ac2ffd72dbd01adfb7b8e1afed6a267e96ba7c9045f12c7f9924a19947b3916cf70801f2e2858efc16636920d871574e69a458fea3f4933d7e0d95748f728eb658718bcd5882154aee7b54a41dc25a59b59c30d5392af26013c5d1b023286085f0ca417918b8db38ef8e79dcb0603a180e6c9e0e8bb01e8a3ed71577c1bd314b2778af2fda55605c60e65525f3aa55ab945748986263e8144055ca396a2aab10b6b4cc5c341141e8cea15486af7c72e993b3ee1411636fbc2a2ba9c55d741831f6ce5c3e169b87931eafd6ba336c24cf5c7a325381289586773b8f48986b4bb9afc4bfe81b6628219361d809ccfb21a991487cac605dec8032ef845d5de98575b1dc262302eb651b8823893e81d396acc50f6d6ff383f442392e0b4482a484200469c8f04a9e1f9b5e21c66842f6e96c9a670c9c61abd388f06a51a0d2d8542f68960fa728ab5133a36eef0b6c137a3be4ba3bf0507efb2a98a1f1651d39af017666ca593e82430e888cee8619456f9fb47d84a5c33b8b5ebee06f75d885c12073401a449f56c16aa64ed3aa62363f77061bfedf72429b023d37d0d724d00a1248db0fead349f1c09b075372c980991b7b25d479d8f6e8def7e3fe501ab6794c3b976ce0bd04c006bac1a94fb6409f60c45e5c9ec2196a246368fb6faf3e6c53b51339b2eb3b52ec6f6dfc511f9b30952ccc814544af5ebd09bee3d004de334afd660f2807192e4bb3c0cba85745c8740fd20b5f39b9d3fbdb5579c0bd1a60320ad6a100c6402c7279679f25fefb1fa3cc8ea5e9f8db3222f83c7516dffd616b152f501ec8ad0552ab323db5fafd23876053317b483e00df829e5c57bbca6f8ca01a87562edf1769dbd542a8f6287effc3ac6732c68c4f5573695b27b0bbca58c8e1ffa35db8f011a010fa3d98fd2183b84afcb56c2dd1d35b9a53e479b6f84565d28e49bc4bfb9790e1ddf2daa4cb7e3362fb1342
+f.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffef09109690@1535
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
new file mode 100644
index 0000000..9dd4ad5
--- /dev/null
+++ b/tests/tmul_2exp.c
@@ -0,0 +1,339 @@
+/* Test file for mpfr_{mul,div}_2{ui,si}.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static const char * const val[] = {
+ "1.0001@100","4.0004000000000@102", "4.0004000000000@97",
+ "1.ABF012345@-100","6.afc048d140000@-98","6.afc048d140000@-103",
+ "F.FFFFFFFFF@10000","3.fffffffffc000@10003","3.fffffffffc000@9998",
+ "1.23456789ABCDEF@42","4.8d159e26af37c@44","4.8d159e26af37c@39",
+ "17@42","5.c000000000000@45","5.c000000000000@40",
+ "42@-17","1.0800000000000@-13","1.0800000000000@-18"
+};
+
+static int
+test_mul (int i, int div, mpfr_ptr y, mpfr_srcptr x,
+ unsigned long int n, mpfr_rnd_t r)
+{
+ return
+ i == 0 ? (div ? mpfr_div_2ui : mpfr_mul_2ui) (y, x, n, r) :
+ i == 1 ? (div ? mpfr_div_2si : mpfr_mul_2si) (y, x, n, r) :
+ i == 2 ? (div ? mpfr_mul_2si : mpfr_div_2si) (y, x, -n, r) :
+ (exit (1), 0);
+}
+
+static void
+underflow (mpfr_exp_t e)
+{
+ mpfr_t x, y, z1, z2;
+ mpfr_exp_t emin;
+ int i, k;
+ int prec;
+ int rnd;
+ int div;
+ int inex1, inex2;
+ unsigned int flags1, flags2;
+
+ /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e)
+ * with emin = e, x = 1 + i/16, i in { -1, 0, 1 }, and k = 1 to 4,
+ * by comparing the result with the one of a simple division.
+ */
+ emin = mpfr_get_emin ();
+ set_emin (e);
+ mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
+ for (i = 15; i <= 17; i++)
+ {
+ inex1 = mpfr_set_ui_2exp (x, i, -4, MPFR_RNDN);
+ MPFR_ASSERTN (inex1 == 0);
+ for (prec = 6; prec >= 3; prec -= 3)
+ {
+ mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
+ RND_LOOP (rnd)
+ for (k = 1; k <= 4; k++)
+ {
+ /* The following one is assumed to be correct. */
+ inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
+ MPFR_ASSERTN (inex1 == 0);
+ inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
+ MPFR_ASSERTN (inex1 == 0);
+ mpfr_clear_flags ();
+ /* Do not use mpfr_div_ui to avoid the optimization
+ by mpfr_div_2si. */
+ inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
+ flags1 = __gmpfr_flags;
+
+ for (div = 0; div <= 2; div++)
+ {
+ mpfr_clear_flags ();
+ inex2 = div == 0 ?
+ mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) : div == 1 ?
+ mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
+ mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
+ flags2 = __gmpfr_flags;
+ if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
+ mpfr_equal_p (z1, z2))
+ continue;
+ printf ("Error in underflow(");
+ if (e == MPFR_EMIN_MIN)
+ printf ("MPFR_EMIN_MIN");
+ else if (e == emin)
+ printf ("default emin");
+ else if (e >= LONG_MIN)
+ printf ("%ld", (long) e);
+ else
+ printf ("<LONG_MIN");
+ printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d, "
+ "%s\n", div == 0 ? "mul_2si" : div == 1 ?
+ "div_2si" : "div_2ui", i, prec, k,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
+ printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
+ printf ("Got ");
+ mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
+ printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
+ exit (1);
+ } /* div */
+ } /* k */
+ mpfr_clears (z1, z2, (mpfr_ptr) 0);
+ } /* prec */
+ } /* i */
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+ set_emin (emin);
+}
+
+static void
+underflow0 (void)
+{
+ underflow (-256);
+ if (mpfr_get_emin () != MPFR_EMIN_MIN)
+ underflow (mpfr_get_emin ());
+ underflow (MPFR_EMIN_MIN);
+}
+
+static void
+large (mpfr_exp_t e)
+{
+ mpfr_t x, y, z;
+ mpfr_exp_t emax;
+ int inex;
+ unsigned int flags;
+
+ emax = mpfr_get_emax ();
+ set_emax (e);
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+ mpfr_init2 (z, 4);
+
+ mpfr_set_inf (x, 1);
+ mpfr_nextbelow (x);
+
+ mpfr_mul_2si (y, x, -1, MPFR_RNDU);
+ mpfr_prec_round (y, 4, MPFR_RNDU);
+
+ mpfr_clear_flags ();
+ inex = mpfr_mul_2si (z, x, -1, MPFR_RNDU);
+ flags = __gmpfr_flags;
+
+ if (inex <= 0 || flags != MPFR_FLAGS_INEXACT || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in large(");
+ if (e == MPFR_EMAX_MAX)
+ printf ("MPFR_EMAX_MAX");
+ else if (e == emax)
+ printf ("default emax");
+ else if (e <= LONG_MAX)
+ printf ("%ld", (long) e);
+ else
+ printf (">LONG_MAX");
+ printf (") for mpfr_mul_2si\n");
+ printf ("Expected inex > 0, flags = %u,\n y = ",
+ (unsigned int) MPFR_FLAGS_INEXACT);
+ mpfr_dump (y);
+ printf ("Got inex = %d, flags = %u,\n y = ",
+ inex, flags);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_clear_flags ();
+ inex = mpfr_div_2si (z, x, 1, MPFR_RNDU);
+ flags = __gmpfr_flags;
+
+ if (inex <= 0 || flags != MPFR_FLAGS_INEXACT || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in large(");
+ if (e == MPFR_EMAX_MAX)
+ printf ("MPFR_EMAX_MAX");
+ else if (e == emax)
+ printf ("default emax");
+ else if (e <= LONG_MAX)
+ printf ("%ld", (long) e);
+ else
+ printf (">LONG_MAX");
+ printf (") for mpfr_div_2si\n");
+ printf ("Expected inex > 0, flags = %u,\n y = ",
+ (unsigned int) MPFR_FLAGS_INEXACT);
+ mpfr_dump (y);
+ printf ("Got inex = %d, flags = %u,\n y = ",
+ inex, flags);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_clear_flags ();
+ inex = mpfr_div_2ui (z, x, 1, MPFR_RNDU);
+ flags = __gmpfr_flags;
+
+ if (inex <= 0 || flags != MPFR_FLAGS_INEXACT || ! mpfr_equal_p (y, z))
+ {
+ printf ("Error in large(");
+ if (e == MPFR_EMAX_MAX)
+ printf ("MPFR_EMAX_MAX");
+ else if (e == emax)
+ printf ("default emax");
+ else if (e <= LONG_MAX)
+ printf ("%ld", (long) e);
+ else
+ printf (">LONG_MAX");
+ printf (") for mpfr_div_2ui\n");
+ printf ("Expected inex > 0, flags = %u,\n y = ",
+ (unsigned int) MPFR_FLAGS_INEXACT);
+ mpfr_dump (y);
+ printf ("Got inex = %d, flags = %u,\n y = ",
+ inex, flags);
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+ set_emax (emax);
+}
+
+static void
+large0 (void)
+{
+ large (256);
+ if (mpfr_get_emax () != MPFR_EMAX_MAX)
+ large (mpfr_get_emax ());
+ large (MPFR_EMAX_MAX);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t w,z;
+ unsigned long k;
+ int i;
+
+ tests_start_mpfr ();
+
+ mpfr_inits2 (53, w, z, (mpfr_ptr) 0);
+
+ for (i = 0; i < 3; i++)
+ {
+ mpfr_set_inf (w, 1);
+ test_mul (i, 0, w, w, 10, MPFR_RNDZ);
+ if (!MPFR_IS_INF(w))
+ {
+ printf ("Result is not Inf (i = %d)\n", i);
+ exit (1);
+ }
+
+ mpfr_set_nan (w);
+ test_mul (i, 0, w, w, 10, MPFR_RNDZ);
+ if (!MPFR_IS_NAN(w))
+ {
+ printf ("Result is not NaN (i = %d)\n", i);
+ exit (1);
+ }
+
+ for (k = 0 ; k < numberof(val) ; k+=3)
+ {
+ mpfr_set_str (w, val[k], 16, MPFR_RNDN);
+ test_mul (i, 0, z, w, 10, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, val[k+1], 16, MPFR_RNDN))
+ {
+ printf ("ERROR for x * 2^n (i = %d) for %s\n", i, val[k]);
+ printf ("Expected: %s\n"
+ "Got : ", val[k+1]);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ test_mul (i, 1, z, w, 10, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, val[k+2], 16, MPFR_RNDN))
+ {
+ printf ("ERROR for x / 2^n (i = %d) for %s\n", i, val[k]);
+ printf ("Expected: %s\n"
+ "Got : ", val[k+2]);
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ }
+
+ mpfr_set_inf (w, 1);
+ mpfr_nextbelow (w);
+ test_mul (i, 0, w, w, 1, MPFR_RNDN);
+ if (!mpfr_inf_p (w))
+ {
+ printf ("Overflow error (i = %d)!\n", i);
+ exit (1);
+ }
+ mpfr_set_ui (w, 0, MPFR_RNDN);
+ mpfr_nextabove (w);
+ test_mul (i, 1, w, w, 1, MPFR_RNDN);
+ if (mpfr_cmp_ui (w, 0))
+ {
+ printf ("Underflow error (i = %d)!\n", i);
+ exit (1);
+ }
+ }
+
+ if (MPFR_EXP_MAX >= LONG_MAX/2 && MPFR_EXP_MIN <= LONG_MAX/2-LONG_MAX-1)
+ {
+ unsigned long lmp1 = (unsigned long) LONG_MAX + 1;
+
+ mpfr_set_ui (w, 1, MPFR_RNDN);
+ mpfr_mul_2ui (w, w, LONG_MAX/2, MPFR_RNDZ);
+ mpfr_div_2ui (w, w, lmp1, MPFR_RNDZ);
+ mpfr_mul_2ui (w, w, lmp1 - LONG_MAX/2, MPFR_RNDZ);
+ if (!mpfr_cmp_ui (w, 1))
+ {
+ printf ("Underflow LONG_MAX error!\n");
+ exit (1);
+ }
+ }
+
+ mpfr_clears (w, z, (mpfr_ptr) 0);
+
+ underflow0 ();
+ large0 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tmul_d.c b/tests/tmul_d.c
new file mode 100644
index 0000000..ec4b4c1
--- /dev/null
+++ b/tests/tmul_d.c
@@ -0,0 +1,136 @@
+/* Test file for mpfr_mul_d
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ /* nan * 1.0 is nan */
+ mpfr_set_nan (x);
+ mpfr_clear_flags();
+ inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* +inf * 1.0 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags();
+ inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* +inf * 0.0 is nan */
+ mpfr_clear_flags();
+ inexact = mpfr_mul_d (y, x, 0.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* -inf * 1.0 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags();
+ inexact = mpfr_mul_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_mul_d
+#define DOUBLE_ARG2
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
+
+ tests_start_mpfr ();
+
+ /* check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_mul_d (x, y, d, MPFR_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_mul_d\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "512", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_mul_d (");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ check_nans ();
+
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
new file mode 100644
index 0000000..66afa5c
--- /dev/null
+++ b/tests/tmul_ui.c
@@ -0,0 +1,282 @@
+/* Test file for mpfr_mul_ui.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check_inexact (mpfr_prec_t p)
+{
+ mpfr_t x, y, z;
+ unsigned long u;
+ mpfr_prec_t q;
+ int inexact, cmp;
+ int rnd;
+
+ mpfr_init2 (x, p);
+ mpfr_init (y);
+ mpfr_init2 (z, p + mp_bits_per_limb);
+ mpfr_urandomb (x, RANDS);
+ u = randlimb ();
+ if (mpfr_mul_ui (z, x, u, MPFR_RNDN))
+ {
+ printf ("Error: result should be exact\n");
+ exit (1);
+ }
+
+ for (q = 2; q <= p; q++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ mpfr_set_prec (y, q);
+ inexact = mpfr_mul_ui (y, x, u, (mpfr_rnd_t) rnd);
+ cmp = mpfr_cmp (y, z);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact < 0) && (cmp >= 0)) ||
+ ((inexact > 0) && (cmp <= 0)))
+ {
+ printf ("Wrong inexact flag for p=%u, q=%u, rnd=%s\n",
+ (unsigned int) p, (unsigned int) q,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ if (mpfr_mul_ui (x, x, 5, MPFR_RNDZ) == 0)
+ {
+ printf ("mul_ui(1, 5) cannot be exact with prec=2\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+#define TEST_FUNCTION mpfr_mul_ui
+#define INTEGER_TYPE unsigned long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric_ui.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ unsigned int xprec, yprec, i;
+ mpfr_prec_t p;
+ mpfr_exp_t emax;
+
+ tests_start_mpfr ();
+
+ for (p=2; p<100; p++)
+ for (i=1; i<50; i++)
+ check_inexact (p);
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ /* checks that result is normalized */
+ mpfr_set_str (y, "6.93147180559945286227e-01", 10, MPFR_RNDZ);
+ mpfr_mul_ui (x, y, 1, MPFR_RNDZ);
+ if (MPFR_MANT(x)[MPFR_PREC(x)/mp_bits_per_limb] >> (mp_bits_per_limb-1) == 0)
+ {
+ printf ("Error in mpfr_mul_ui: result not normalized\n");
+ exit (1);
+ }
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_mul_ui: 1*y != y\n");
+ printf ("y= "); mpfr_print_binary (y); puts ("");
+ printf ("1*y="); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
+ if (!mpfr_inf_p (x) || (mpfr_sgn (x) <= 0))
+ {
+ printf ("Error in mpfr_mul_ui: +Inf*3 does not give +Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
+ if (!mpfr_inf_p (x) || (mpfr_sgn (x) >= 0))
+ {
+ printf ("Error in mpfr_mul_ui: -Inf*3 does not give -Inf\n");
+ exit (1);
+ }
+
+ mpfr_set_nan (x);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
+ if (!mpfr_nan_p(x))
+ {
+ printf ("Error in mpfr_mul_ui: NaN*3 does not give NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_mul_ui (x, x, 0, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+
+ mpfr_set_ui (x, 1, MPFR_RNDU);
+ mpfr_mul_ui (x, x, 0, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+
+ emax = mpfr_get_emax ();
+ set_emax (0);
+ mpfr_set_str_binary (x, "0.1E0");
+ mpfr_mul_ui (x, x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x));
+ set_emax (emax);
+
+ mpfr_set_str (x, /*1.0/3.0*/
+ "0.333333333333333333333333333333333", 10, MPFR_RNDZ);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_mul_ui: U(Z(1/3)*3) does not give 1\n");
+ exit (1);
+ }
+
+ /* checks sign is correct */
+ mpfr_set_si (x, -2, MPFR_RNDZ);
+ mpfr_set_si (y, 3, MPFR_RNDZ);
+ mpfr_mul_ui(x, y, 4, MPFR_RNDZ);
+ if (mpfr_cmp_ui(x, 0) <= 0)
+ {
+ printf("Error in mpfr_mul_ui: 4*3.0 does not give a positive result:\n");
+ mpfr_print_binary(x); puts ("");
+ printf("mpfr_cmp_ui(x, 0) = %d\n", mpfr_cmp_ui(x, 0));
+ exit(1);
+ }
+
+ mpfr_set_prec (x, 9);
+ mpfr_set_prec (y, 9);
+ mpfr_set_str_binary (y, "0.100001111E9"); /* 271 */
+ mpfr_mul_ui (x, y, 1335, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.101100001E19"); /* 361472 */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mul_ui for 1335*(0.100001111E9)\n");
+ printf ("got "); mpfr_print_binary (x); puts ("");
+ exit(1);
+ }
+
+ mpfr_set_prec(y, 100);
+ mpfr_set_prec(x, 100);
+ /* y = 1199781142214086656 */
+ mpfr_set_str_binary(y, "0.1000010100110011110101001011110010101111000100001E61");
+ mpfr_mul_ui(x, y, 121, MPFR_RNDD);
+ /* 121*y = 145173518207904485376, representable exactly */
+ mpfr_set_str_binary(y, "0.1111101111010101111111100011010010111010111110110011001E67");
+ if (mpfr_cmp(x, y))
+ {
+ printf("Error for 121*y: expected result is:\n");
+ mpfr_print_binary(y); puts ("");
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_str_binary (x, "0.10000000000000000000000000000000E1");
+ mpfr_set_prec (y, 93);
+ mpfr_mul_ui (y, x, 1, MPFR_RNDN);
+
+ mpfr_set_prec (x, 287);
+ mpfr_set_str_binary (x, "0.1111E7");
+ mpfr_set_prec (y, 289);
+ mpfr_mul_ui (y, x, 6, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.101101E10");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for 6 * 120\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 68);
+ mpfr_set_prec (y, 64);
+ mpfr_set_str (x, "2143861251406875.0", 10, MPFR_RNDN);
+ mpfr_mul_ui (y, x, 23, MPFR_RNDN);
+ mpfr_set_str_binary (x, "10101111001011100001100110101111110001010010011001101101.0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for 23 * 2143861251406875.0\n");
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+
+ for (xprec = 53; xprec <= 128; xprec++)
+ {
+ mpfr_set_prec (x, xprec);
+ mpfr_set_str_binary (x, "0.1100100100001111110011111000000011011100001100110111E2");
+ for (yprec = 53; yprec <= 128; yprec++)
+ {
+ mpfr_set_prec (y, yprec);
+ mpfr_mul_ui (y, x, 1, MPFR_RNDN);
+ if (mpfr_cmp(x,y))
+ {
+ printf ("multiplication by 1.0 fails for xprec=%u, yprec=%u\n",
+ xprec, yprec);
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_set_prec (x, 128);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_mul_ui (x, x, ULONG_HIGHBIT, MPFR_RNDN);
+ mpfr_set_prec (y, 128);
+ mpfr_set_ui (y, ULONG_HIGHBIT, MPFR_RNDN);
+ mpfr_mul_ui (y, y, 17, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for 17 * ULONG_HIGHBIT\n");
+ exit (1);
+ }
+
+ /* Check regression */
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 96);
+ mpfr_set_ui (x, 1742175942, MPFR_RNDN);
+ mpfr_mul_ui (y, x, 59, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.10111111011101010101000110111101000100000000000000"
+ "0000000000000000000000000000000000000000000000E37",
+ 2, MPFR_RNDN))
+ {
+ printf ("Regression tested failed for x=1742175942 * 59\n");
+ exit (1);
+ }
+
+ mpfr_clear(x);
+ mpfr_clear(y);
+
+ test_generic_ui (2, 500, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tnext.c b/tests/tnext.c
new file mode 100644
index 0000000..b84131d
--- /dev/null
+++ b/tests/tnext.c
@@ -0,0 +1,168 @@
+/* Test file for mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward.
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* Generic tests for mpfr_nextabove and mpfr_nextbelow */
+static void
+generic_abovebelow (void)
+{
+ int i;
+
+ for (i = 0; i < 20000; i++)
+ {
+ mpfr_t x, y, z, t;
+ mpfr_prec_t prec;
+ int neg, below;
+
+ prec = (randlimb () % 300) + MPFR_PREC_MIN;
+ mpfr_inits2 (prec, x, y, z, (mpfr_ptr) 0);
+ mpfr_init2 (t, 3);
+
+ /* special tests (executed once is enough) */
+ if (i == 0)
+ {
+ mpfr_set_nan (x);
+ mpfr_nextabove (x);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+ mpfr_nextbelow (x);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+ mpfr_nexttoward (x, y);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_nexttoward (y, x);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_nexttoward (x, y);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
+ }
+
+ do
+ mpfr_urandomb (x, RANDS);
+ while (mpfr_cmp_ui (x, 0) == 0);
+ neg = randlimb () & 1;
+ if (neg)
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
+ below = randlimb () & 1;
+ if (below)
+ mpfr_nextbelow (y);
+ else
+ mpfr_nextabove (y);
+ mpfr_set_si (t, below ? -5 : 5, MPFR_RNDN);
+ mpfr_mul_2si (t, t, (mpfr_get_exp) (x) - prec - 3, MPFR_RNDN);
+ /* t = (1/2 + 1/8) ulp(x) */
+ mpfr_add (z, x, t, MPFR_RNDN);
+ if (!mpfr_number_p (y) || mpfr_cmp (y, z) != 0)
+ {
+ printf ("Error in mpfr_next%s for\n",
+ below ? "below" : "above");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (", got\n");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" instead of\n");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
+ }
+}
+
+static void
+inverse_test (void)
+{
+ static const char *tests[] = { "0", "1", "2", "3.1", "Inf" };
+ int i, neg, below;
+ mpfr_prec_t prec;
+
+ for (i = 0; i < (int) (sizeof(tests) / sizeof(tests[0])); i++)
+ for (neg = 0; neg <= 1; neg++)
+ for (below = 0; below <= 1; below++)
+ for (prec = MPFR_PREC_MIN; prec < 200; prec += 3)
+ {
+ mpfr_t x, y;
+ int sign;
+
+ mpfr_inits2 (prec, x, y, (mpfr_ptr) 0);
+ mpfr_set_str (x, tests[i], 10, MPFR_RNDN);
+ if (neg)
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set (y, x, MPFR_RNDN);
+ if (below)
+ mpfr_nextbelow (y);
+ else
+ mpfr_nextabove (y);
+ sign = MPFR_SIGN (y);
+ if (!(neg == below && mpfr_inf_p (x))) /* then x = y */
+ {
+ if (mpfr_cmp (x, y) == 0)
+ {
+ printf ("Error in inverse_test for %s, neg = %d,"
+ " below = %d, prec = %d: x = y", tests[i],
+ neg, below, (int) prec);
+ printf ("\nx = ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ny = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_nexttoward (y, x);
+ if (mpfr_cmp_ui (y, 0) == 0 && MPFR_SIGN (y) != sign)
+ {
+ printf ("Sign error in inverse_test for %s, neg = %d,"
+ " below = %d, prec = %d\n", tests[i], neg,
+ below, (int) prec);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error in inverse_test for %s, neg = %d, below = %d,"
+ " prec = %d", tests[i], neg, below, (int) prec);
+ printf ("\nx = ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ny = ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+ }
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ generic_abovebelow ();
+ inverse_test ();
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tout_str.c b/tests/tout_str.c
new file mode 100644
index 0000000..edbfb02
--- /dev/null
+++ b/tests/tout_str.c
@@ -0,0 +1,171 @@
+/* Test file for mpfr_out_str.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <float.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+FILE *fout;
+
+#define check(d,r,b) check4(d,r,b,53)
+
+static void
+check4 (double d, mpfr_rnd_t rnd, int base, int prec)
+{
+ mpfr_t x;
+
+ mpfr_init2 (x, prec);
+ mpfr_set_d (x, d, rnd);
+ fprintf (fout, "%1.19e base %d rnd %d:\n ", d, base, rnd);
+ mpfr_out_str (fout, base, (base == 2) ? prec : 0, x, rnd);
+ fputc ('\n', fout);
+ mpfr_clear (x);
+}
+
+static void
+special (void)
+{
+ mpfr_t x;
+ unsigned int n;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 5)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, NaN, MPFR_RNDN) wrote %u "
+ "characters instead of 5.\n", n);
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 5)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, +Inf, MPFR_RNDN) wrote %u "
+ "characters instead of 5.\n", n);
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 6)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, -Inf, MPFR_RNDN) wrote %u "
+ "characters instead of 6.\n", n);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 1)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, +0, MPFR_RNDN) wrote %u "
+ "characters instead of 1.\n", n);
+ exit (1);
+ }
+
+ mpfr_neg (x, x, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 2)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, -0, MPFR_RNDN) wrote %u "
+ "characters instead of 2.\n", n);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i, N=10000, p;
+ mpfr_rnd_t rnd;
+ double d;
+
+ tests_start_mpfr ();
+
+ /* with no argument: prints to /dev/null,
+ tout_str N: prints N tests to stdout */
+ if (argc == 1)
+ {
+ fout = fopen ("/dev/null", "w");
+ /* If we failed to open this device, try with a dummy file */
+ if (fout == NULL)
+ fout = fopen ("mpfrtest.txt", "w");
+ }
+ else
+ {
+ fout = stdout;
+ N = atoi (argv[1]);
+ }
+
+ if (fout == NULL)
+ {
+ printf ("Can't open /dev/null or stdout\n");
+ exit (1);
+ }
+
+ special ();
+
+ check (-1.37247529013405550000e+15, MPFR_RNDN, 7);
+ check (-1.5674376729569697500e+15, MPFR_RNDN, 19);
+ check (-5.71262771772792640000e-79, MPFR_RNDU, 16);
+ check (DBL_NEG_ZERO, MPFR_RNDU, 7);
+ check (-4.5306392613572974756e-308, MPFR_RNDN, 8);
+ check (-6.7265890111403371523e-165, MPFR_RNDN, 4);
+ check (-1.3242553591261807653e+156, MPFR_RNDN, 16);
+ check (-6.606499965302424244461355e233, MPFR_RNDN, 10);
+ check4 (1.0, MPFR_RNDN, 10, 120);
+ check (1.0, MPFR_RNDU, 10);
+ check (4.059650008e-83, MPFR_RNDN, 10);
+ check (-7.4, MPFR_RNDN, 10);
+ check (0.997, MPFR_RNDN, 10);
+ check (-4.53063926135729747564e-308, MPFR_RNDN, 10);
+ check (2.14478198760196000000e+16, MPFR_RNDN, 10);
+ check (7.02293374921793516813e-84, MPFR_RNDN, 10);
+
+ /* random tests */
+ for (i=0;i<N;i++)
+ {
+ do
+ {
+ d = DBL_RAND ();
+ }
+#ifdef HAVE_DENORMS
+ while (0);
+#else
+ while (ABS(d) < DBL_MIN);
+#endif
+ rnd = RND_RAND ();
+ p = 2 + randlimb () % 61;
+ check (d, rnd, p);
+ }
+
+ fclose (fout);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/toutimpl.c b/tests/toutimpl.c
new file mode 100644
index 0000000..6800ad4
--- /dev/null
+++ b/tests/toutimpl.c
@@ -0,0 +1,122 @@
+/* Test file for internal debugging-out functions:
+ mpfr_dump, mpfr_print_binary, mpfr_print_rnd_mode.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include "mpfr-test.h"
+
+/* We output stdout to a file to check if it is correct
+ Is it a good idea?
+ We can't use tmpname since it is insecure */
+#define FILE_NAME "dummy.tmp"
+
+static const char Buffer[] =
+"@NaN@\n"
+"-@Inf@\n"
+"-0\n"
+"0.10101010101011111001000110001100010000100000000000000E32\n";
+
+int
+main (void)
+{
+ mpfr_t x;
+ FILE *f;
+ int i;
+
+ tests_start_mpfr ();
+
+ /* Check RND_MODE */
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDN), "MPFR_RNDN"))
+ {
+ printf ("Error for printing MPFR_RNDN\n");
+ exit (1);
+ }
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDU), "MPFR_RNDU"))
+ {
+ printf ("Error for printing MPFR_RNDU\n");
+ exit (1);
+ }
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDD), "MPFR_RNDD"))
+ {
+ printf ("Error for printing MPFR_RNDD\n");
+ exit (1);
+ }
+ if (strcmp (mpfr_print_rnd_mode(MPFR_RNDZ), "MPFR_RNDZ"))
+ {
+ printf ("Error for printing MPFR_RNDZ\n");
+ exit (1);
+ }
+ if (mpfr_print_rnd_mode ((mpfr_rnd_t) -1) != NULL ||
+ mpfr_print_rnd_mode (MPFR_RND_MAX) != NULL)
+ {
+ printf ("Error for illegal rounding mode values.\n");
+ exit (1);
+ }
+
+ /* Reopen stdout to a file. All errors will be put to stderr
+ Can't use tmpname since it is unsecure */
+ if (freopen (FILE_NAME, "w", stdout) == NULL)
+ {
+ printf ("Error can't redirect stdout\n");
+ exit (1);
+ }
+ mpfr_init (x);
+ mpfr_set_nan (x);
+ mpfr_dump (x);
+ mpfr_set_inf (x, -1);
+ mpfr_dump (x);
+ MPFR_SET_ZERO (x); MPFR_SET_NEG (x);
+ mpfr_dump (x);
+ mpfr_set_str_binary (x, "0.101010101010111110010001100011000100001E32");
+ mpfr_dump (x);
+ mpfr_print_mant_binary ("x=",MPFR_MANT(x), MPFR_PREC(x));
+
+
+ mpfr_clear (x);
+ fclose (stdout);
+ /* Open it and check for it */
+ f = fopen (FILE_NAME, "r");
+ if (f == NULL)
+ {
+ fprintf (stderr, "Can't reopen file!\n");
+ exit (1);
+ }
+ for(i = 0 ; i < sizeof(Buffer)-1 ; i++)
+ {
+ if (feof (f))
+ {
+ fprintf (stderr, "Error EOF\n");
+ exit (1);
+ }
+ if (Buffer[i] != fgetc (f))
+ {
+ fprintf (stderr, "Character mismatch for i=%d / %lu\n",
+ i, (unsigned long) sizeof(Buffer));
+ exit (1);
+ }
+ }
+ fclose (f);
+
+ remove (FILE_NAME);
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tpow.c b/tests/tpow.c
new file mode 100644
index 0000000..63805f8
--- /dev/null
+++ b/tests/tpow.c
@@ -0,0 +1,1588 @@
+/* Test file for mpfr_pow, mpfr_pow_ui and mpfr_pow_si.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+#include <math.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_pow (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c)
+ && mpfr_get_prec (a) >= 53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ printf (" ");
+ mpfr_print_raw (c);
+ }
+ res = mpfr_pow (a, b, c, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_pow mpfr_pow
+#endif
+
+#define TEST_FUNCTION test_pow
+#define TWO_ARGS
+#define TEST_RANDOM_POS 16
+#define TGENERIC_NOWARNING 1
+#include "tgeneric.c"
+
+#define TEST_FUNCTION mpfr_pow_ui
+#define INTEGER_TYPE unsigned long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric_ui.c"
+
+#define TEST_FUNCTION mpfr_pow_si
+#define INTEGER_TYPE long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#define test_generic_ui test_generic_si
+#include "tgeneric_ui.c"
+
+static void
+check_pow_ui (void)
+{
+ mpfr_t a, b;
+ unsigned long n;
+ int res;
+
+ mpfr_init2 (a, 53);
+ mpfr_init2 (b, 53);
+
+ /* check in-place operations */
+ mpfr_set_str (b, "0.6926773", 10, MPFR_RNDN);
+ mpfr_pow_ui (a, b, 10, MPFR_RNDN);
+ mpfr_pow_ui (b, b, 10, MPFR_RNDN);
+ if (mpfr_cmp (a, b))
+ {
+ printf ("Error for mpfr_pow_ui (b, b, ...)\n");
+ exit (1);
+ }
+
+ /* check large exponents */
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ mpfr_pow_ui (a, b, 4294967295UL, MPFR_RNDN);
+
+ mpfr_set_inf (a, -1);
+ mpfr_pow_ui (a, a, 4049053855UL, MPFR_RNDN);
+ if (!mpfr_inf_p (a) || (mpfr_sgn (a) >= 0))
+ {
+ printf ("Error for (-Inf)^4049053855\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (a, -1);
+ mpfr_pow_ui (a, a, (unsigned long) 30002752, MPFR_RNDN);
+ if (!mpfr_inf_p (a) || (mpfr_sgn (a) <= 0))
+ {
+ printf ("Error for (-Inf)^30002752\n");
+ exit (1);
+ }
+
+ /* Check underflow */
+ mpfr_set_str_binary (a, "1E-1");
+ res = mpfr_pow_ui (a, a, -mpfr_get_emin (), MPFR_RNDN);
+ if (MPFR_GET_EXP (a) != mpfr_get_emin () + 1)
+ {
+ printf ("Error for (1e-1)^MPFR_EMAX_MAX\n");
+ mpfr_dump (a);
+ exit (1);
+ }
+
+ mpfr_set_str_binary (a, "1E-10");
+ res = mpfr_pow_ui (a, a, -mpfr_get_emin (), MPFR_RNDZ);
+ if (!MPFR_IS_ZERO (a))
+ {
+ printf ("Error for (1e-10)^MPFR_EMAX_MAX\n");
+ mpfr_dump (a);
+ exit (1);
+ }
+
+ /* Check overflow */
+ mpfr_set_str_binary (a, "1E10");
+ res = mpfr_pow_ui (a, a, ULONG_MAX, MPFR_RNDN);
+ if (!MPFR_IS_INF (a) || MPFR_SIGN (a) < 0)
+ {
+ printf ("Error for (1e10)^ULONG_MAX\n");
+ exit (1);
+ }
+
+ /* Bug in pow_ui.c from r3214 to r5107: if x = y (same mpfr_t argument),
+ the input argument is negative, n is odd, an overflow or underflow
+ occurs, and the temporary result res is positive, then the result
+ gets a wrong sign (positive instead of negative). */
+ mpfr_set_str_binary (a, "-1E10");
+ n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1;
+ res = mpfr_pow_ui (a, a, n, MPFR_RNDN);
+ if (!MPFR_IS_INF (a) || MPFR_SIGN (a) > 0)
+ {
+ printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n);
+ mpfr_dump (a);
+ exit (1);
+ }
+
+ /* Check 0 */
+ MPFR_SET_ZERO (a);
+ MPFR_SET_POS (a);
+ mpfr_set_si (b, -1, MPFR_RNDN);
+ res = mpfr_pow_ui (b, a, 1, MPFR_RNDN);
+ if (res != 0 || MPFR_IS_NEG (b))
+ {
+ printf ("Error for (0+)^1\n");
+ exit (1);
+ }
+ MPFR_SET_ZERO (a);
+ MPFR_SET_NEG (a);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ res = mpfr_pow_ui (b, a, 5, MPFR_RNDN);
+ if (res != 0 || MPFR_IS_POS (b))
+ {
+ printf ("Error for (0-)^5\n");
+ exit (1);
+ }
+ MPFR_SET_ZERO (a);
+ MPFR_SET_NEG (a);
+ mpfr_set_si (b, -1, MPFR_RNDN);
+ res = mpfr_pow_ui (b, a, 6, MPFR_RNDN);
+ if (res != 0 || MPFR_IS_NEG (b))
+ {
+ printf ("Error for (0-)^6\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (a, 122);
+ mpfr_set_prec (b, 122);
+ mpfr_set_str_binary (a, "0.10000010010000111101001110100101101010011110011100001111000001001101000110011001001001001011001011010110110110101000111011E1");
+ mpfr_set_str_binary (b, "0.11111111100101001001000001000001100011100000001110111111100011111000111011100111111111110100011000111011000100100011001011E51290375");
+ mpfr_pow_ui (a, a, 2026876995UL, MPFR_RNDU);
+ if (mpfr_cmp (a, b) != 0)
+ {
+ printf ("Error for x^2026876995\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (a, 29);
+ mpfr_set_prec (b, 29);
+ mpfr_set_str_binary (a, "1.0000000000000000000000001111");
+ mpfr_set_str_binary (b, "1.1001101111001100111001010111e165");
+ mpfr_pow_ui (a, a, 2055225053, MPFR_RNDZ);
+ if (mpfr_cmp (a, b) != 0)
+ {
+ printf ("Error for x^2055225053\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ /* worst case found by Vincent Lefevre, 25 Nov 2006 */
+ mpfr_set_prec (a, 53);
+ mpfr_set_prec (b, 53);
+ mpfr_set_str_binary (a, "1.0000010110000100001000101101101001011101101011010111");
+ mpfr_set_str_binary (b, "1.0000110111101111011010110100001100010000001010110100E1");
+ mpfr_pow_ui (a, a, 35, MPFR_RNDN);
+ if (mpfr_cmp (a, b) != 0)
+ {
+ printf ("Error in mpfr_pow_ui for worst case (1)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ /* worst cases found on 2006-11-26 */
+ mpfr_set_str_binary (a, "1.0110100111010001101001010111001110010100111111000011");
+ mpfr_set_str_binary (b, "1.1111010011101110001111010110000101110000110110101100E17");
+ mpfr_pow_ui (a, a, 36, MPFR_RNDD);
+ if (mpfr_cmp (a, b) != 0)
+ {
+ printf ("Error in mpfr_pow_ui for worst case (2)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_set_str_binary (a, "1.1001010100001110000110111111100011011101110011000100");
+ mpfr_set_str_binary (b, "1.1100011101101101100010110001000001110001111110010001E23");
+ mpfr_pow_ui (a, a, 36, MPFR_RNDU);
+ if (mpfr_cmp (a, b) != 0)
+ {
+ printf ("Error in mpfr_pow_ui for worst case (3)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, b, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+}
+
+static void
+check_pow_si (void)
+{
+ mpfr_t x;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+
+ mpfr_set_inf (x, 1);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+
+ mpfr_set_inf (x, -1);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x));
+
+ mpfr_set_inf (x, -1);
+ mpfr_pow_si (x, x, -2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_pow_si (x, x, -1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_pow_si (x, x, -2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, LONG_MAX, MPFR_RNDN); /* 2^LONG_MAX */
+ if (LONG_MAX > mpfr_get_emax () - 1) /* LONG_MAX + 1 > emax */
+ {
+ MPFR_ASSERTN (mpfr_inf_p (x));
+ }
+ else
+ {
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, (mpfr_exp_t) LONG_MAX));
+ }
+
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 2^LONG_MIN */
+ if (LONG_MIN + 1 < mpfr_get_emin ())
+ {
+ MPFR_ASSERTN (mpfr_zero_p (x));
+ }
+ else
+ {
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, (mpfr_exp_t) LONG_MIN));
+ }
+
+ mpfr_set_si (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, LONG_MIN + 1, MPFR_RNDN); /* 2^(LONG_MIN+1) */
+ if (mpfr_nan_p (x))
+ {
+ printf ("Error in pow_si(2, LONG_MIN+1): got NaN\n");
+ exit (1);
+ }
+ if (LONG_MIN + 2 < mpfr_get_emin ())
+ {
+ MPFR_ASSERTN (mpfr_zero_p (x));
+ }
+ else
+ {
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 1, (mpfr_exp_t) (LONG_MIN + 1)));
+ }
+
+ mpfr_set_si_2exp (x, 1, -1, MPFR_RNDN); /* 0.5 */
+ mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 2^(-LONG_MIN) */
+ if (LONG_MIN < 1 - mpfr_get_emax ()) /* 1 - LONG_MIN > emax */
+ {
+ MPFR_ASSERTN (mpfr_inf_p (x));
+ }
+ else
+ {
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (x, 2, (mpfr_exp_t) - (LONG_MIN + 1)));
+ }
+
+ mpfr_clear (x);
+}
+
+static void
+check_special_pow_si (void)
+{
+ mpfr_t a, b;
+ mpfr_exp_t emin;
+
+ mpfr_init (a);
+ mpfr_init (b);
+ mpfr_set_str (a, "2E100000000", 10, MPFR_RNDN);
+ mpfr_set_si (b, -10, MPFR_RNDN);
+ test_pow (b, a, b, MPFR_RNDN);
+ if (!MPFR_IS_ZERO(b))
+ {
+ printf("Pow(2E10000000, -10) failed\n");
+ mpfr_dump (a);
+ mpfr_dump (b);
+ exit(1);
+ }
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (-10);
+ mpfr_set_si (a, -2, MPFR_RNDN);
+ mpfr_pow_si (b, a, -10000, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (b))
+ {
+ printf ("Pow_so (1, -10000) doesn't underflow if emin=-10.\n");
+ mpfr_dump (a);
+ mpfr_dump (b);
+ exit (1);
+ }
+ mpfr_set_emin (emin);
+ mpfr_clear (a);
+ mpfr_clear (b);
+}
+
+static void
+pow_si_long_min (void)
+{
+ mpfr_t x, y, z;
+ int inex;
+
+ mpfr_inits2 (sizeof(long) * CHAR_BIT + 32, x, y, z, (mpfr_ptr) 0);
+ mpfr_set_si_2exp (x, 3, -1, MPFR_RNDN); /* 1.5 */
+
+ inex = mpfr_set_si (y, LONG_MIN, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ mpfr_nextbelow (y);
+ mpfr_pow (y, x, y, MPFR_RNDD);
+
+ inex = mpfr_set_si (z, LONG_MIN, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ mpfr_nextabove (z);
+ mpfr_pow (z, x, z, MPFR_RNDU);
+
+ mpfr_pow_si (x, x, LONG_MIN, MPFR_RNDN); /* 1.5^LONG_MIN */
+ if (mpfr_cmp (x, y) < 0 || mpfr_cmp (x, z) > 0)
+ {
+ printf ("Error in pow_si_long_min\n");
+ exit (1);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static void
+check_inexact (mpfr_prec_t p)
+{
+ mpfr_t x, y, z, t;
+ unsigned long u;
+ mpfr_prec_t q;
+ int inexact, cmp;
+ int rnd;
+
+ mpfr_init2 (x, p);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+ mpfr_urandomb (x, RANDS);
+ u = randlimb () % 2;
+ for (q = 2; q <= p; q++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ mpfr_set_prec (y, q);
+ mpfr_set_prec (z, q + 10);
+ mpfr_set_prec (t, q);
+ inexact = mpfr_pow_ui (y, x, u, (mpfr_rnd_t) rnd);
+ cmp = mpfr_pow_ui (z, x, u, (mpfr_rnd_t) rnd);
+ if (mpfr_can_round (z, q + 10, (mpfr_rnd_t) rnd, (mpfr_rnd_t) rnd, q))
+ {
+ cmp = mpfr_set (t, z, (mpfr_rnd_t) rnd) || cmp;
+ if (mpfr_cmp (y, t))
+ {
+ printf ("results differ for u=%lu rnd=%s\n",
+ u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
+ printf ("z="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact != 0) && (cmp == 0)))
+ {
+ printf ("Wrong inexact flag for p=%u, q=%u, rnd=%s\n",
+ (unsigned int) p, (unsigned int) q,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("expected %d, got %d\n", cmp, inexact);
+ printf ("u=%lu x=", u); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ }
+ }
+
+ /* check exact power */
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (y, p);
+ mpfr_set_prec (z, p);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_set_str (y, "0.5", 10, MPFR_RNDN);
+ test_pow (z, x, y, MPFR_RNDZ);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y, z, t;
+ mpfr_exp_t emin, emax;
+ int inex;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_init2 (z, 53);
+ mpfr_init2 (t, 2);
+
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_pow_si (x, x, -2, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (x, 1, -2))
+ {
+ printf ("Error in pow_si(x,x,-2) for x=2\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_si (y, -2, MPFR_RNDN);
+ test_pow (x, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (x, 1, -2))
+ {
+ printf ("Error in pow(x,x,y) for x=2, y=-2\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_str_binary (x, "1.0e-1");
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (y, "0.11010110011100101010110011001010100111000001000101110E-1");
+ mpfr_set_prec (z, 2);
+ test_pow (z, x, y, MPFR_RNDZ);
+ mpfr_set_str_binary (x, "1.0e-1");
+ if (mpfr_cmp (x, z))
+ {
+ printf ("Error in mpfr_pow (1)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 64);
+ mpfr_set_prec (y, 64);
+ mpfr_set_prec (z, 64);
+ mpfr_set_prec (t, 64);
+ mpfr_set_str_binary (x, "0.111011000111100000111010000101010100110011010000011");
+ mpfr_set_str_binary (y, "0.111110010100110000011101100011010111000010000100101");
+ mpfr_set_str_binary (t, "0.1110110011110110001000110100100001001111010011111000010000011001");
+
+ test_pow (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp (z, t))
+ {
+ printf ("Error in mpfr_pow for prec=64, rnd=MPFR_RNDN\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_prec (z, 53);
+ mpfr_set_str (x, "5.68824667828621954868e-01", 10, MPFR_RNDN);
+ mpfr_set_str (y, "9.03327850535952658895e-01", 10, MPFR_RNDN);
+ test_pow (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str1 (z, "0.60071044650456473235"))
+ {
+ printf ("Error in mpfr_pow for prec=53, rnd=MPFR_RNDZ\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (t, 2);
+ mpfr_set_prec (x, 30);
+ mpfr_set_prec (y, 30);
+ mpfr_set_prec (z, 30);
+ mpfr_set_str (x, "1.00000000001010111110001111011e1", 2, MPFR_RNDN);
+ mpfr_set_str (t, "-0.5", 10, MPFR_RNDN);
+ test_pow (z, x, t, MPFR_RNDN);
+ mpfr_set_str (y, "1.01101001111010101110000101111e-1", 2, MPFR_RNDN);
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error in mpfr_pow for prec=30, rnd=MPFR_RNDN\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 21);
+ mpfr_set_prec (y, 21);
+ mpfr_set_prec (z, 21);
+ mpfr_set_str (x, "1.11111100100001100101", 2, MPFR_RNDN);
+ test_pow (z, x, t, MPFR_RNDZ);
+ mpfr_set_str (y, "1.01101011010001100000e-1", 2, MPFR_RNDN);
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error in mpfr_pow for prec=21, rnd=MPFR_RNDZ\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ /* From http://www.terra.es/personal9/ismaeljc/hall.htm */
+ mpfr_set_prec (x, 113);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 169);
+ mpfr_set_str1 (x, "6078673043126084065007902175846955");
+ mpfr_set_ui_2exp (y, 3, -1, MPFR_RNDN);
+ test_pow (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str1 (z, "473928882491000966028828671876527456070714790264144"))
+ {
+ printf ("Error in mpfr_pow for 6078673043126084065007902175846955");
+ printf ("^(3/2), MPFR_RNDZ\nExpected ");
+ printf ("4.73928882491000966028828671876527456070714790264144e50");
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ test_pow (z, x, y, MPFR_RNDU);
+ if (mpfr_cmp_str1 (z, "473928882491000966028828671876527456070714790264145"))
+ {
+ printf ("Error in mpfr_pow for 6078673043126084065007902175846955");
+ printf ("^(3/2), MPFR_RNDU\nExpected ");
+ printf ("4.73928882491000966028828671876527456070714790264145e50");
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str_binary (y, "1E10");
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
+ mpfr_set_inf (x, -1);
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
+ mpfr_set_prec (y, 10);
+ mpfr_set_str_binary (y, "1.000000001E9");
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_NEG(z));
+ mpfr_set_str_binary (y, "1.000000001E8");
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
+
+ mpfr_set_inf (x, -1);
+ mpfr_set_prec (y, 2 * mp_bits_per_limb);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_mul_2exp (y, y, mp_bits_per_limb - 1, MPFR_RNDN);
+ /* y = 2^(mp_bits_per_limb - 1) */
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
+ mpfr_nextabove (y);
+ test_pow (z, x, y, MPFR_RNDN);
+ /* y = 2^(mp_bits_per_limb - 1) + epsilon */
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
+ mpfr_nextbelow (y);
+ mpfr_div_2exp (y, y, 1, MPFR_RNDN);
+ mpfr_nextabove (y);
+ test_pow (z, x, y, MPFR_RNDN);
+ /* y = 2^(mp_bits_per_limb - 2) + epsilon */
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS(z));
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str_binary (y, "1E10");
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0);
+
+ /* Check (-0)^(17.0001) */
+ mpfr_set_prec (x, 6);
+ mpfr_set_prec (y, 640);
+ MPFR_SET_ZERO (x); MPFR_SET_NEG (x);
+ mpfr_set_ui (y, 17, MPFR_RNDN); mpfr_nextabove (y);
+ test_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_ZERO (z) && MPFR_IS_POS (z));
+
+ /* Bugs reported by Kevin Rauch on 29 Oct 2007 */
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ mpfr_set_emin (-1000000);
+ mpfr_set_emax ( 1000000);
+ mpfr_set_prec (x, 64);
+ mpfr_set_prec (y, 64);
+ mpfr_set_prec (z, 64);
+ mpfr_set_str (x, "-0.5", 10, MPFR_RNDN);
+ mpfr_set_str (y, "-0.ffffffffffffffff", 16, MPFR_RNDN);
+ mpfr_set_exp (y, mpfr_get_emax ());
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ /* (-0.5)^(-n) = 1/2^n for n even */
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS (z) && inex > 0);
+
+ /* (-1)^(-n) = 1 for n even */
+ mpfr_set_str (x, "-1", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0 && inex == 0);
+
+ /* (-1)^n = 1 for n even */
+ mpfr_set_str (x, "-1", 10, MPFR_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (z, 1) == 0 && inex == 0);
+
+ /* (-1.5)^n = +Inf for n even */
+ mpfr_set_str (x, "-1.5", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (z) && MPFR_IS_POS (z) && inex > 0);
+
+ /* (-n)^1.5 = NaN for n even */
+ mpfr_neg (y, y, MPFR_RNDN);
+ mpfr_set_str (x, "1.5", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (z));
+
+ /* x^(-1.5) = NaN for x small < 0 */
+ mpfr_set_str (x, "-0.8", 16, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin ());
+ mpfr_set_str (y, "-1.5", 10, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (z));
+
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+static void
+particular_cases (void)
+{
+ mpfr_t t[11], r, r2;
+ mpz_t z;
+ long si;
+
+ static const char *name[11] = {
+ "NaN", "+inf", "-inf", "+0", "-0", "+1", "-1", "+2", "-2", "+0.5", "-0.5"};
+ int i, j;
+ int error = 0;
+
+ mpz_init (z);
+
+ for (i = 0; i < 11; i++)
+ mpfr_init2 (t[i], 2);
+ mpfr_init2 (r, 6);
+ mpfr_init2 (r2, 6);
+
+ mpfr_set_nan (t[0]);
+ mpfr_set_inf (t[1], 1);
+ mpfr_set_ui (t[3], 0, MPFR_RNDN);
+ mpfr_set_ui (t[5], 1, MPFR_RNDN);
+ mpfr_set_ui (t[7], 2, MPFR_RNDN);
+ mpfr_div_2ui (t[9], t[5], 1, MPFR_RNDN);
+ for (i = 1; i < 11; i += 2)
+ mpfr_neg (t[i+1], t[i], MPFR_RNDN);
+
+ for (i = 0; i < 11; i++)
+ for (j = 0; j < 11; j++)
+ {
+ double d;
+ int p;
+ static const int q[11][11] = {
+ /* NaN +inf -inf +0 -0 +1 -1 +2 -2 +0.5 -0.5 */
+ /* NaN */ { 0, 0, 0, 128, 128, 0, 0, 0, 0, 0, 0 },
+ /* +inf */ { 0, 1, 2, 128, 128, 1, 2, 1, 2, 1, 2 },
+ /* -inf */ { 0, 1, 2, 128, 128, -1, -2, 1, 2, 1, 2 },
+ /* +0 */ { 0, 2, 1, 128, 128, 2, 1, 2, 1, 2, 1 },
+ /* -0 */ { 0, 2, 1, 128, 128, -2, -1, 2, 1, 2, 1 },
+ /* +1 */ {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ /* -1 */ { 0, 128, 128, 128, 128,-128,-128, 128, 128, 0, 0 },
+ /* +2 */ { 0, 1, 2, 128, 128, 256, 64, 512, 32, 180, 90 },
+ /* -2 */ { 0, 1, 2, 128, 128,-256, -64, 512, 32, 0, 0 },
+ /* +0.5 */ { 0, 2, 1, 128, 128, 64, 256, 32, 512, 90, 180 },
+ /* -0.5 */ { 0, 2, 1, 128, 128, -64,-256, 32, 512, 0, 0 }
+ };
+ /* This define is used to make the following table readable */
+#define N MPFR_FLAGS_NAN
+#define I MPFR_FLAGS_INEXACT
+#define D MPFR_FLAGS_DIVBY0
+ static const unsigned int f[11][11] = {
+ /* NaN +inf -inf +0 -0 +1 -1 +2 -2 +0.5 -0.5 */
+ /* NaN */ { N, N, N, 0, 0, N, N, N, N, N, N },
+ /* +inf */ { N, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* -inf */ { N, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* +0 */ { N, 0, 0, 0, 0, 0, D, 0, D, 0, D },
+ /* -0 */ { N, 0, 0, 0, 0, 0, D, 0, D, 0, D },
+ /* +1 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* -1 */ { N, 0, 0, 0, 0, 0, 0, 0, 0, N, N },
+ /* +2 */ { N, 0, 0, 0, 0, 0, 0, 0, 0, I, I },
+ /* -2 */ { N, 0, 0, 0, 0, 0, 0, 0, 0, N, N },
+ /* +0.5 */ { N, 0, 0, 0, 0, 0, 0, 0, 0, I, I },
+ /* -0.5 */ { N, 0, 0, 0, 0, 0, 0, 0, 0, N, N }
+ };
+#undef N
+#undef I
+#undef D
+ mpfr_clear_flags ();
+ test_pow (r, t[i], t[j], MPFR_RNDN);
+ p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 :
+ mpfr_cmp_ui (r, 0) == 0 ? 2 :
+ (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0));
+ if (p != 0 && MPFR_IS_NEG (r))
+ p = -p;
+ if (p != q[i][j])
+ {
+ printf ("Error in mpfr_pow for (%s)^(%s) (%d,%d):\n"
+ "got %d instead of %d\n",
+ name[i], name[j], i, j, p, q[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ if (__gmpfr_flags != f[i][j])
+ {
+ printf ("Error in mpfr_pow for (%s)^(%s) (%d,%d):\n"
+ "Flags = %u instead of expected %u\n",
+ name[i], name[j], i, j, __gmpfr_flags, f[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ /* Perform the same tests with pow_z & pow_si & pow_ui
+ if t[j] is an integer */
+ if (mpfr_integer_p (t[j]))
+ {
+ /* mpfr_pow_z */
+ mpfr_clear_flags ();
+ mpfr_get_z (z, t[j], MPFR_RNDN);
+ mpfr_pow_z (r, t[i], z, MPFR_RNDN);
+ p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 :
+ mpfr_cmp_ui (r, 0) == 0 ? 2 :
+ (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0));
+ if (p != 0 && MPFR_IS_NEG (r))
+ p = -p;
+ if (p != q[i][j])
+ {
+ printf ("Error in mpfr_pow_z for (%s)^(%s) (%d,%d):\n"
+ "got %d instead of %d\n",
+ name[i], name[j], i, j, p, q[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ if (__gmpfr_flags != f[i][j])
+ {
+ printf ("Error in mpfr_pow_z for (%s)^(%s) (%d,%d):\n"
+ "Flags = %u instead of expected %u\n",
+ name[i], name[j], i, j, __gmpfr_flags, f[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ /* mpfr_pow_si */
+ mpfr_clear_flags ();
+ si = mpfr_get_si (t[j], MPFR_RNDN);
+ mpfr_pow_si (r, t[i], si, MPFR_RNDN);
+ p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 :
+ mpfr_cmp_ui (r, 0) == 0 ? 2 :
+ (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0));
+ if (p != 0 && MPFR_IS_NEG (r))
+ p = -p;
+ if (p != q[i][j])
+ {
+ printf ("Error in mpfr_pow_si for (%s)^(%s) (%d,%d):\n"
+ "got %d instead of %d\n",
+ name[i], name[j], i, j, p, q[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ if (__gmpfr_flags != f[i][j])
+ {
+ printf ("Error in mpfr_pow_si for (%s)^(%s) (%d,%d):\n"
+ "Flags = %u instead of expected %u\n",
+ name[i], name[j], i, j, __gmpfr_flags, f[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ /* if si >= 0, test mpfr_pow_ui */
+ if (si >= 0)
+ {
+ mpfr_clear_flags ();
+ mpfr_pow_ui (r, t[i], si, MPFR_RNDN);
+ p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 :
+ mpfr_cmp_ui (r, 0) == 0 ? 2 :
+ (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0));
+ if (p != 0 && MPFR_IS_NEG (r))
+ p = -p;
+ if (p != q[i][j])
+ {
+ printf ("Error in mpfr_pow_ui for (%s)^(%s) (%d,%d):\n"
+ "got %d instead of %d\n",
+ name[i], name[j], i, j, p, q[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ if (__gmpfr_flags != f[i][j])
+ {
+ printf ("Error in mpfr_pow_ui for (%s)^(%s) (%d,%d):\n"
+ "Flags = %u instead of expected %u\n",
+ name[i], name[j], i, j, __gmpfr_flags, f[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ }
+ } /* integer_p */
+ /* Perform the same tests with mpfr_ui_pow */
+ if (mpfr_integer_p (t[i]) && MPFR_IS_POS (t[i]))
+ {
+ /* mpfr_ui_pow */
+ mpfr_clear_flags ();
+ si = mpfr_get_si (t[i], MPFR_RNDN);
+ mpfr_ui_pow (r, si, t[j], MPFR_RNDN);
+ p = mpfr_nan_p (r) ? 0 : mpfr_inf_p (r) ? 1 :
+ mpfr_cmp_ui (r, 0) == 0 ? 2 :
+ (d = mpfr_get_d (r, MPFR_RNDN), (int) (ABS(d) * 128.0));
+ if (p != 0 && MPFR_IS_NEG (r))
+ p = -p;
+ if (p != q[i][j])
+ {
+ printf ("Error in mpfr_ui_pow for (%s)^(%s) (%d,%d):\n"
+ "got %d instead of %d\n",
+ name[i], name[j], i, j, p, q[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ if (__gmpfr_flags != f[i][j])
+ {
+ printf ("Error in mpfr_ui_pow for (%s)^(%s) (%d,%d):\n"
+ "Flags = %u instead of expected %u\n",
+ name[i], name[j], i, j, __gmpfr_flags, f[i][j]);
+ mpfr_dump (r);
+ error = 1;
+ }
+ }
+ }
+
+ for (i = 0; i < 11; i++)
+ mpfr_clear (t[i]);
+ mpfr_clear (r);
+ mpfr_clear (r2);
+ mpz_clear (z);
+
+ if (error)
+ exit (1);
+}
+
+static void
+underflows (void)
+{
+ mpfr_t x, y, z;
+ int err = 0;
+ int inexact;
+ int i;
+ mpfr_exp_t emin;
+
+ mpfr_init2 (x, 64);
+ mpfr_init2 (y, 64);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin());
+
+ for (i = 3; i < 10; i++)
+ {
+ mpfr_set_ui (y, i, MPFR_RNDN);
+ mpfr_div_2ui (y, y, 1, MPFR_RNDN);
+ test_pow (y, x, y, MPFR_RNDN);
+ if (!MPFR_IS_FP(y) || mpfr_cmp_ui (y, 0))
+ {
+ printf ("Error in mpfr_pow for ");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf (" ^ (%d/2)\nGot ", i);
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf (" instead of 0.\n");
+ exit (1);
+ }
+ }
+
+ mpfr_init2 (z, 55);
+ mpfr_set_str (x, "0.110011010011101001110001110100010000110111101E0",
+ 2, MPFR_RNDN);
+ mpfr_set_str (y, "0.101110010011111001011010100011011100111110011E40",
+ 2, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_pow (z, x, y, MPFR_RNDU);
+ if (!mpfr_underflow_p ())
+ {
+ printf ("Underflow flag is not set for special underflow test.\n");
+ err = 1;
+ }
+ if (inexact <= 0)
+ {
+ printf ("Ternary value is wrong for special underflow test.\n");
+ err = 1;
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_nextabove (x);
+ if (mpfr_cmp (x, z) != 0)
+ {
+ printf ("Wrong value for special underflow test.\nGot ");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf ("\ninstead of ");
+ mpfr_out_str (stdout, 2, 2, x, MPFR_RNDN);
+ printf ("\n");
+ err = 1;
+ }
+ if (err)
+ exit (1);
+
+ /* MPFR currently (2006-08-19) segfaults on the following code (and
+ possibly makes other programs crash due to the lack of memory),
+ because y is converted into an mpz_t, and the required precision
+ is too high. */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 12);
+ mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_emax () - 1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_pow (z, x, y, MPFR_RNDN);
+ if (!mpfr_underflow_p () || MPFR_NOTZERO (z))
+ {
+ printf ("Underflow test with large y fails.\n");
+ exit (1);
+ }
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (-256);
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 12);
+ mpfr_set_ui_2exp (x, 3, -2, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, 38, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (!mpfr_underflow_p () || MPFR_NOTZERO (z) || inexact >= 0)
+ {
+ printf ("Bad underflow detection for 0.75^(2^38). Obtained:\n"
+ "Underflow flag... %-3s (should be 'yes')\n"
+ "Zero result...... %-3s (should be 'yes')\n"
+ "Inexact value.... %-3d (should be negative)\n",
+ mpfr_underflow_p () ? "yes" : "no",
+ MPFR_IS_ZERO (z) ? "yes" : "no", inexact);
+ exit (1);
+ }
+ mpfr_set_emin (emin);
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (-256);
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 40);
+ mpfr_set_prec (z, 12);
+ mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN);
+ mpfr_set_si_2exp (y, -1, 38, MPFR_RNDN);
+ for (i = 0; i < 4; i++)
+ {
+ if (i == 2)
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inexact = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (!mpfr_underflow_p () || MPFR_NOTZERO (z) ||
+ (i == 3 ? (inexact <= 0) : (inexact >= 0)))
+ {
+ printf ("Bad underflow detection for (");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (")^(-2^38-%d). Obtained:\n"
+ "Overflow flag.... %-3s (should be 'no')\n"
+ "Underflow flag... %-3s (should be 'yes')\n"
+ "Zero result...... %-3s (should be 'yes')\n"
+ "Inexact value.... %-3d (should be %s)\n", i,
+ mpfr_overflow_p () ? "yes" : "no",
+ mpfr_underflow_p () ? "yes" : "no",
+ MPFR_IS_ZERO (z) ? "yes" : "no", inexact,
+ i == 3 ? "positive" : "negative");
+ exit (1);
+ }
+ inexact = mpfr_sub_ui (y, y, 1, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ }
+ mpfr_set_emin (emin);
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static void
+overflows (void)
+{
+ mpfr_t a, b;
+
+ /* bug found by Ming J. Tsai <mingjt@delvron.us>, 4 Oct 2003 */
+
+ mpfr_init_set_str (a, "5.1e32", 10, MPFR_RNDN);
+ mpfr_init (b);
+
+ test_pow (b, a, a, MPFR_RNDN);
+ if (!(mpfr_inf_p (b) && mpfr_sgn (b) > 0))
+ {
+ printf ("Error for a^a for a=5.1e32\n");
+ printf ("Expected +Inf, got ");
+ mpfr_out_str (stdout, 10, 0, b, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear(a);
+ mpfr_clear(b);
+}
+
+static void
+overflows2 (void)
+{
+ mpfr_t x, y, z;
+ mpfr_exp_t emin, emax;
+ int e;
+
+ /* x^y in reduced exponent range, where x = 2^b and y is not an integer
+ (so that mpfr_pow_z is not used). */
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ set_emin (-128);
+
+ mpfr_inits2 (16, x, y, z, (mpfr_ptr) 0);
+
+ mpfr_set_si_2exp (x, 1, -64, MPFR_RNDN); /* 2^(-64) */
+ mpfr_set_si_2exp (y, -1, -1, MPFR_RNDN); /* -0.5 */
+ for (e = 2; e <= 32; e += 17)
+ {
+ set_emax (e);
+ mpfr_clear_flags ();
+ mpfr_pow (z, x, y, MPFR_RNDN);
+ if (MPFR_IS_NEG (z) || ! mpfr_inf_p (z))
+ {
+ printf ("Error in overflows2 (e = %d): expected +Inf, got ", e);
+ mpfr_dump (z);
+ exit (1);
+ }
+ if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT))
+ {
+ printf ("Error in overflows2 (e = %d): bad flags (%u)\n",
+ e, __gmpfr_flags);
+ exit (1);
+ }
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+static void
+overflows3 (void)
+{
+ /* x^y where x = 2^b, y is not an integer (so that mpfr_pow_z is not used)
+ and b * y = emax in the extended exponent range. If emax is divisible
+ by 3, we choose x = 2^(-2*emax/3) and y = -3/2.
+ Test also with nextbelow(x). */
+
+ if (MPFR_EMAX_MAX % 3 == 0)
+ {
+ mpfr_t x, y, z, t;
+ mpfr_exp_t emin, emax;
+ unsigned int flags;
+ int i;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+
+ mpfr_inits2 (16, x, y, z, t, (mpfr_ptr) 0);
+
+ mpfr_set_si_2exp (x, 1, -2 * (MPFR_EMAX_MAX / 3), MPFR_RNDN);
+ for (i = 0; i <= 1; i++)
+ {
+ mpfr_set_si_2exp (y, -3, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ mpfr_pow (z, x, y, MPFR_RNDN);
+ if (MPFR_IS_NEG (z) || ! mpfr_inf_p (z))
+ {
+ printf ("Error in overflows3 (RNDN, i = %d): expected +Inf,"
+ " got ", i);
+ mpfr_dump (z);
+ exit (1);
+ }
+ if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT))
+ {
+ printf ("Error in overflows3 (RNDN, i = %d): bad flags (%u)\n",
+ i, __gmpfr_flags);
+ exit (1);
+ }
+
+ mpfr_clear_flags ();
+ mpfr_pow (z, x, y, MPFR_RNDZ);
+ flags = __gmpfr_flags;
+ mpfr_set (t, z, MPFR_RNDN);
+ mpfr_nextabove (t);
+ if (MPFR_IS_NEG (z) || mpfr_inf_p (z) || ! mpfr_inf_p (t))
+ {
+ printf ("Error in overflows3 (RNDZ, i = %d):\nexpected ", i);
+ mpfr_set_inf (t, 1);
+ mpfr_nextbelow (t);
+ mpfr_dump (t);
+ printf ("got ");
+ mpfr_dump (z);
+ exit (1);
+ }
+ if (flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT))
+ {
+ printf ("Error in overflows3 (RNDZ, i = %d): bad flags (%u)\n",
+ i, flags);
+ exit (1);
+ }
+ mpfr_nextbelow (x);
+ }
+
+ mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
+
+ set_emin (emin);
+ set_emax (emax);
+ }
+}
+
+static void
+x_near_one (void)
+{
+ mpfr_t x, y, z;
+ int inex;
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 4);
+ mpfr_init2 (z, 33);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_set_ui_2exp (y, 11, -2, MPFR_RNDN);
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_str (z, "0.111111111111111111111111111111011E0", 2, MPFR_RNDN)
+ || inex <= 0)
+ {
+ printf ("Failure in x_near_one, got inex = %d and\nz = ", inex);
+ mpfr_dump (z);
+ }
+
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static int
+mpfr_pow275 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t r)
+{
+ mpfr_t z;
+ int inex;
+
+ mpfr_init2 (z, 4);
+ mpfr_set_ui_2exp (z, 11, -2, MPFR_RNDN);
+ inex = mpfr_pow (y, x, z, MPFR_RNDN);
+ mpfr_clear (z);
+ return inex;
+}
+
+/* Bug found by Kevin P. Rauch */
+static void
+bug20071103 (void)
+{
+ mpfr_t x, y, z;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ mpfr_set_emin (-1000000);
+ mpfr_set_emax ( 1000000);
+
+ mpfr_inits2 (64, x, y, z, (mpfr_ptr) 0);
+ mpfr_set_si_2exp (x, -3, -1, MPFR_RNDN); /* x = -1.5 */
+ mpfr_set_str (y, "-0.ffffffffffffffff", 16, MPFR_RNDN);
+ mpfr_set_exp (y, mpfr_get_emax ());
+ mpfr_clear_flags ();
+ mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_SIGN (z) > 0 &&
+ __gmpfr_flags == (MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT));
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+/* Bug found by Kevin P. Rauch */
+static void
+bug20071104 (void)
+{
+ mpfr_t x, y, z;
+ mpfr_exp_t emin, emax;
+ int inex;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ mpfr_set_emin (-1000000);
+ mpfr_set_emax ( 1000000);
+
+ mpfr_inits2 (20, x, y, z, (mpfr_ptr) 0);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_nextbelow (x); /* x = -2^(emin-1) */
+ mpfr_set_si (y, -2, MPFR_RNDN); /* y = -2 */
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (! mpfr_inf_p (z) || MPFR_SIGN (z) < 0)
+ {
+ printf ("Error in bug20071104: expected +Inf, got ");
+ mpfr_dump (z);
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("Error in bug20071104: bad ternary value (%d)\n", inex);
+ exit (1);
+ }
+ if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT))
+ {
+ printf ("Error in bug20071104: bad flags (%u)\n", __gmpfr_flags);
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+/* Bug found by Kevin P. Rauch */
+static void
+bug20071127 (void)
+{
+ mpfr_t x, y, z;
+ int i, tern;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ mpfr_set_emin (-1000000);
+ mpfr_set_emax ( 1000000);
+
+ mpfr_init2 (x, 128);
+ mpfr_init2 (y, 128);
+ mpfr_init2 (z, 128);
+
+ mpfr_set_str (x, "0.80000000000000000000000000000001", 16, MPFR_RNDN);
+
+ for (i = 1; i < 9; i *= 2)
+ {
+ mpfr_set_str (y, "8000000000000000", 16, MPFR_RNDN);
+ mpfr_add_si (y, y, i, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_IS_POS (z) && tern < 0);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+}
+
+/* Bug found by Kevin P. Rauch */
+static void
+bug20071128 (void)
+{
+ mpfr_t max_val, x, y, z;
+ int i, tern;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ mpfr_set_emin (-1000000);
+ mpfr_set_emax ( 1000000);
+
+ mpfr_init2 (max_val, 64);
+ mpfr_init2 (x, 64);
+ mpfr_init2 (y, 64);
+ mpfr_init2 (z, 64);
+
+ mpfr_set_str (max_val, "0.ffffffffffffffff", 16, MPFR_RNDN);
+ mpfr_set_exp (max_val, mpfr_get_emax ());
+
+ mpfr_neg (x, max_val, MPFR_RNDN);
+
+ /* on 64-bit machines */
+ for (i = 41; i < 45; i++)
+ {
+ mpfr_set_si_2exp (y, -1, i, MPFR_RNDN);
+ mpfr_add_si (y, y, 1, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (z) && MPFR_IS_NEG (z) && tern > 0);
+ }
+
+ /* on 32-bit machines */
+ for (i = 9; i < 13; i++)
+ {
+ mpfr_set_si_2exp (y, -1, i, MPFR_RNDN);
+ mpfr_add_si (y, y, 1, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_zero_p (z) && MPFR_SIGN(z) < 0);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (max_val);
+
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+}
+
+/* Bug found by Kevin P. Rauch */
+static void
+bug20071218 (void)
+{
+ mpfr_t x, y, z, t;
+ int tern;
+
+ mpfr_inits2 (64, x, y, z, t, (mpfr_ptr) 0);
+ mpfr_set_str (x, "0x.80000000000002P-1023", 0, MPFR_RNDN);
+ mpfr_set_str (y, "100000.000000002", 16, MPFR_RNDN);
+ mpfr_set_ui (t, 0, MPFR_RNDN);
+ mpfr_nextabove (t);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp0 (z, t) != 0)
+ {
+ printf ("Error in bug20071218 (1): Expected\n");
+ mpfr_dump (t);
+ printf ("Got\n");
+ mpfr_dump (z);
+ exit (1);
+ }
+ if (tern <= 0)
+ {
+ printf ("Error in bug20071218 (1): bad ternary value"
+ " (%d instead of positive)\n", tern);
+ exit (1);
+ }
+ mpfr_mul_2ui (y, y, 32, MPFR_RNDN);
+ tern = mpfr_pow (z, x, y, MPFR_RNDN);
+ if (MPFR_NOTZERO (z) || MPFR_IS_NEG (z))
+ {
+ printf ("Error in bug20071218 (2): expected 0, got\n");
+ mpfr_dump (z);
+ exit (1);
+ }
+ if (tern >= 0)
+ {
+ printf ("Error in bug20071218 (2): bad ternary value"
+ " (%d instead of negative)\n", tern);
+ exit (1);
+ }
+ mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
+}
+
+/* With revision 5429, this gives:
+ * pow.c:43: assertion failed: !mpfr_integer_p (y)
+ * This is fixed in revision 5432.
+ */
+static void
+bug20080721 (void)
+{
+ mpfr_t x, y, z, t[2];
+ int inex;
+ int rnd;
+ int err = 0;
+
+ /* Note: input values have been chosen in a way to select the
+ * general case. If mpfr_pow is modified, in particular line
+ * if (y_is_integer && (MPFR_GET_EXP (y) <= 256))
+ * make sure that this test still does what we want.
+ */
+ mpfr_inits2 (4913, x, y, (mpfr_ptr) 0);
+ mpfr_inits2 (8, z, t[0], t[1], (mpfr_ptr) 0);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_prec (y) - 1, MPFR_RNDN);
+ inex = mpfr_add_ui (y, y, 1, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ mpfr_set_str_binary (t[0], "-0.10101101e2");
+ mpfr_set_str_binary (t[1], "-0.10101110e2");
+ RND_LOOP (rnd)
+ {
+ int i, inex0;
+
+ i = (rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA);
+ inex0 = i ? -1 : 1;
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
+ if (__gmpfr_flags != MPFR_FLAGS_INEXACT || ! SAME_SIGN (inex, inex0)
+ || MPFR_IS_NAN (z) || mpfr_cmp (z, t[i]) != 0)
+ {
+ unsigned int flags = __gmpfr_flags;
+
+ printf ("Error in bug20080721 with %s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, t[i], MPFR_RNDN);
+ printf (", inex = %d, flags = %u\n", inex0,
+ (unsigned int) MPFR_FLAGS_INEXACT);
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, z, MPFR_RNDN);
+ printf (", inex = %d, flags = %u\n", inex, flags);
+ err = 1;
+ }
+ }
+ mpfr_clears (x, y, z, t[0], t[1], (mpfr_ptr) 0);
+ if (err)
+ exit (1);
+}
+
+/* The following test fails in r5552 (32-bit and 64-bit). This is due to:
+ * mpfr_log (t, absx, MPFR_RNDU);
+ * mpfr_mul (t, y, t, MPFR_RNDU);
+ * in pow.c, that is supposed to compute an upper bound on exp(y*ln|x|),
+ * but this is incorrect if y is negative.
+ */
+static void
+bug20080820 (void)
+{
+ mpfr_exp_t emin;
+ mpfr_t x, y, z1, z2;
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (MPFR_EMIN_MIN);
+ mpfr_init2 (x, 80);
+ mpfr_init2 (y, sizeof (mpfr_exp_t) * CHAR_BIT + 32);
+ mpfr_init2 (z1, 2);
+ mpfr_init2 (z2, 80);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN);
+ mpfr_nextabove (y);
+ mpfr_pow (z1, x, y, MPFR_RNDN);
+ mpfr_pow (z2, x, y, MPFR_RNDN);
+ /* As x > 0, the rounded value of x^y to nearest in precision p is equal
+ to 0 iff x^y <= 2^(emin - 2). In particular, this does not depend on
+ the precision p. Hence the following test. */
+ if (MPFR_IS_ZERO (z1) && MPFR_NOTZERO (z2))
+ {
+ printf ("Error in bug20080820\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0);
+ set_emin (emin);
+}
+
+static void
+bug20110320 (void)
+{
+ mpfr_exp_t emin;
+ mpfr_t x, y, z1, z2;
+ int inex;
+ unsigned int flags;
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (11);
+ mpfr_inits2 (2, x, y, z1, z2, (mpfr_ptr) 0);
+ mpfr_set_ui_2exp (x, 1, 215, MPFR_RNDN);
+ mpfr_set_ui (y, 1024, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z1, x, y, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ mpfr_set_ui_2exp (z2, 1, 215*1024, MPFR_RNDN);
+ if (inex != 0 || flags != 0 || ! mpfr_equal_p (z1, z2))
+ {
+ printf ("Error in bug20110320\n");
+ printf ("Expected inex = 0, flags = 0, z = ");
+ mpfr_dump (z2);
+ printf ("Got inex = %d, flags = %u, z = ", inex, flags);
+ mpfr_dump (z1);
+ exit (1);
+ }
+ mpfr_clears (x, y, z1, z2, (mpfr_ptr) 0);
+ set_emin (emin);
+}
+
+int
+main (int argc, char **argv)
+{
+ mpfr_prec_t p;
+
+ tests_start_mpfr ();
+
+ bug20071127 ();
+ special ();
+ particular_cases ();
+ check_pow_ui ();
+ check_pow_si ();
+ check_special_pow_si ();
+ pow_si_long_min ();
+ for (p = 2; p < 100; p++)
+ check_inexact (p);
+ underflows ();
+ overflows ();
+ overflows2 ();
+ overflows3 ();
+ x_near_one ();
+ bug20071103 ();
+ bug20071104 ();
+ bug20071128 ();
+ bug20071218 ();
+ bug20080721 ();
+ bug20080820 ();
+ bug20110320 ();
+
+ test_generic (2, 100, 100);
+ test_generic_ui (2, 100, 100);
+ test_generic_si (2, 100, 100);
+
+ data_check ("data/pow275", mpfr_pow275, "mpfr_pow275");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tpow3.c b/tests/tpow3.c
new file mode 100644
index 0000000..95350a8
--- /dev/null
+++ b/tests/tpow3.c
@@ -0,0 +1,126 @@
+/* Test file for mpfr_pow.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y, z;
+
+ mpfr_prec_t prec, yprec;
+ mpfr_t t, s;
+ mpfr_rnd_t rnd;
+ int inexact, compare, compare2;
+ unsigned int n, err;
+
+ mpfr_prec_t p0=2, p1=100;
+ unsigned int N=25;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init2 (y,sizeof(unsigned long int)*CHAR_BIT);
+ mpfr_init (z);
+
+ mpfr_init (s);
+ mpfr_init (t);
+
+ /* generic test */
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (s, sizeof(unsigned long int)*CHAR_BIT);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+ yprec = prec + 10;
+
+ for (n=0; n<N; n++)
+ {
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (s, RANDS);
+ if (randlimb () % 2)
+ mpfr_neg (s, s, MPFR_RNDN);
+ rnd = RND_RAND ();
+ mpfr_set_prec (y, yprec);
+ compare = mpfr_pow (y, x, s, rnd);
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
+ if (mpfr_can_round (y, err, rnd, rnd, prec))
+ {
+ mpfr_set (t, y, rnd);
+ inexact = mpfr_pow (z, x, s, rnd);
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for x^y with x=");
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
+ printf (" y=");
+ mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
+ printf (" prec=%u rnd_mode=%s\n", (unsigned int) prec,
+ mpfr_print_rnd_mode (rnd));
+ printf ("got ");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ puts ("");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf ("approx ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ compare2 = mpfr_cmp (t, y);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if ((rnd != MPFR_RNDN) && (compare * compare2 >= 0))
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d"
+ "\n", mpfr_print_rnd_mode (rnd), compare, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (s);
+ mpfr_clear (t);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tpow_all.c b/tests/tpow_all.c
new file mode 100644
index 0000000..1fdee7f
--- /dev/null
+++ b/tests/tpow_all.c
@@ -0,0 +1,778 @@
+/* Test file for the various power functions
+
+Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Note: some tests of the other tpow* test files could be moved there.
+ The main goal of this test file is to test _all_ the power functions
+ on special values, to make sure that they are consistent and give the
+ expected result, in particular because such special cases are handled
+ in different ways in each function. */
+
+/* Execute with at least an argument to report all the errors found by
+ comparisons. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* Behavior of cmpres (called by test_others):
+ * 0: stop as soon as an error is found.
+ * 1: report all errors found by test_others.
+ * -1: the 1 is changed to this value as soon as an error has been found.
+ */
+static int all_cmpres_errors;
+
+/* Non-zero when extended exponent range */
+static int ext = 0;
+
+static const char *val[] =
+ { "min", "min+", "max", "@NaN@", "-@Inf@", "-4", "-3", "-2", "-1.5",
+ "-1", "-0.5", "-0", "0", "0.5", "1", "1.5", "2", "3", "4", "@Inf@" };
+
+static void
+err (const char *s, int i, int j, int rnd, mpfr_srcptr z, int inex)
+{
+ puts (s);
+ if (ext)
+ puts ("extended exponent range");
+ printf ("x = %s, y = %s, %s\n", val[i], val[j],
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("z = ");
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ninex = %d\n", inex);
+ exit (1);
+}
+
+/* Arguments:
+ * spx: non-zero if px is a stringm zero if px is a MPFR number.
+ * px: value of x (string or MPFR number).
+ * sy: value of y (string).
+ * rnd: rounding mode.
+ * z1: expected result (null pointer if unknown pure FP value).
+ * inex1: expected ternary value (if z1 is not a null pointer).
+ * z2: computed result.
+ * inex2: computed ternary value.
+ * flags1: expected flags (computed flags in __gmpfr_flags).
+ * s1, s2: strings about the context.
+ */
+static void
+cmpres (int spx, const void *px, const char *sy, mpfr_rnd_t rnd,
+ mpfr_srcptr z1, int inex1, mpfr_srcptr z2, int inex2,
+ unsigned int flags1, const char *s1, const char *s2)
+{
+ unsigned int flags2 = __gmpfr_flags;
+
+ if (flags1 == flags2)
+ {
+ /* Note: the test on the sign of z1 and z2 is needed
+ in case they are both zeros. */
+ if (z1 == NULL)
+ {
+ if (MPFR_IS_PURE_FP (z2))
+ return;
+ }
+ else if (SAME_SIGN (inex1, inex2) &&
+ ((MPFR_IS_NAN (z1) && MPFR_IS_NAN (z2)) ||
+ ((MPFR_IS_NEG (z1) ^ MPFR_IS_NEG (z2)) == 0 &&
+ mpfr_equal_p (z1, z2))))
+ return;
+ }
+
+ printf ("Error in %s\nwith %s%s\nx = ", s1, s2,
+ ext ? ", extended exponent range" : "");
+ if (spx)
+ printf ("%s, ", (char *) px);
+ else
+ {
+ mpfr_out_str (stdout, 16, 0, (mpfr_ptr) px, MPFR_RNDN);
+ puts (",");
+ }
+ printf ("y = %s, %s\n", sy, mpfr_print_rnd_mode (rnd));
+ printf ("Expected ");
+ if (z1 == NULL)
+ {
+ printf ("pure FP value, flags = %u\n", flags1);
+ }
+ else
+ {
+ mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
+ printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
+ }
+ printf ("Got ");
+ mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
+ printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
+ if (all_cmpres_errors != 0)
+ all_cmpres_errors = -1;
+ else
+ exit (1);
+}
+
+static int
+is_odd (mpfr_srcptr x)
+{
+ /* works only with the values from val[] */
+ return mpfr_integer_p (x) && mpfr_fits_slong_p (x, MPFR_RNDN) &&
+ (mpfr_get_si (x, MPFR_RNDN) & 1);
+}
+
+/* Compare the result (z1,inex1) of mpfr_pow with all flags cleared
+ with those of mpfr_pow with all flags set and of the other power
+ functions. Arguments x and y are the input values; sx and sy are
+ their string representations (sx may be null); rnd contains the
+ rounding mode; s is a string containing the function that called
+ test_others. */
+static void
+test_others (const void *sx, const char *sy, mpfr_rnd_t rnd,
+ mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z1,
+ int inex1, unsigned int flags, const char *s)
+{
+ mpfr_t z2;
+ int inex2;
+ int spx = sx != NULL;
+
+ if (!spx)
+ sx = x;
+
+ mpfr_init2 (z2, mpfr_get_prec (z1));
+
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_pow (z2, x, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_pow, flags set");
+
+ /* If y is an integer that fits in an unsigned long and is not -0,
+ we can test mpfr_pow_ui. */
+ if (MPFR_IS_POS (y) && mpfr_integer_p (y) &&
+ mpfr_fits_ulong_p (y, MPFR_RNDN))
+ {
+ unsigned long yy = mpfr_get_ui (y, MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex2 = mpfr_pow_ui (z2, x, yy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_pow_ui, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_pow_ui (z2, x, yy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_pow_ui, flags set");
+
+ /* If x is an integer that fits in an unsigned long and is not -0,
+ we can also test mpfr_ui_pow_ui. */
+ if (MPFR_IS_POS (x) && mpfr_integer_p (x) &&
+ mpfr_fits_ulong_p (x, MPFR_RNDN))
+ {
+ unsigned long xx = mpfr_get_ui (x, MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex2 = mpfr_ui_pow_ui (z2, xx, yy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_ui_pow_ui, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_ui_pow_ui (z2, xx, yy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_ui_pow_ui, flags set");
+ }
+ }
+
+ /* If y is an integer but not -0 and not huge, we can test mpfr_pow_z,
+ and possibly mpfr_pow_si (and possibly mpfr_ui_div). */
+ if (MPFR_IS_ZERO (y) ? MPFR_IS_POS (y) :
+ (mpfr_integer_p (y) && MPFR_GET_EXP (y) < 256))
+ {
+ mpz_t yyy;
+
+ /* If y fits in a long, we can test mpfr_pow_si. */
+ if (mpfr_fits_slong_p (y, MPFR_RNDN))
+ {
+ long yy = mpfr_get_si (y, MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex2 = mpfr_pow_si (z2, x, yy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_pow_si, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_pow_si (z2, x, yy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_pow_si, flags set");
+
+ /* If y = -1, we can test mpfr_ui_div. */
+ if (yy == -1)
+ {
+ mpfr_clear_flags ();
+ inex2 = mpfr_ui_div (z2, 1, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_ui_div, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_ui_div (z2, 1, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_ui_div, flags set");
+ }
+
+ /* If y = 2, we can test mpfr_sqr. */
+ if (yy == 2)
+ {
+ mpfr_clear_flags ();
+ inex2 = mpfr_sqr (z2, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_sqr, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_sqr (z2, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_sqr, flags set");
+ }
+ }
+
+ /* Test mpfr_pow_z. */
+ mpz_init (yyy);
+ mpfr_get_z (yyy, y, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex2 = mpfr_pow_z (z2, x, yyy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_pow_z, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_pow_z (z2, x, yyy, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_pow_z, flags set");
+ mpz_clear (yyy);
+ }
+
+ /* If y = 0.5, we can test mpfr_sqrt, except if x is -0 or -Inf (because
+ the rule for mpfr_pow on these special values is different). */
+ if (MPFR_IS_PURE_FP (y) && mpfr_cmp_str1 (y, "0.5") == 0 &&
+ ! ((MPFR_IS_ZERO (x) || MPFR_IS_INF (x)) && MPFR_IS_NEG (x)))
+ {
+ mpfr_clear_flags ();
+ inex2 = mpfr_sqrt (z2, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_sqrt, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_sqrt (z2, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_sqrt, flags set");
+ }
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+ /* If y = -0.5, we can test mpfr_rec_sqrt, except if x = -Inf
+ (because the rule for mpfr_pow on -Inf is different). */
+ if (MPFR_IS_PURE_FP (y) && mpfr_cmp_str1 (y, "-0.5") == 0 &&
+ ! (MPFR_IS_INF (x) && MPFR_IS_NEG (x)))
+ {
+ mpfr_clear_flags ();
+ inex2 = mpfr_rec_sqrt (z2, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_rec_sqrt, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_rec_sqrt (z2, x, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_rec_sqrt, flags set");
+ }
+#endif
+
+ /* If x is an integer that fits in an unsigned long and is not -0,
+ we can test mpfr_ui_pow. */
+ if (MPFR_IS_POS (x) && mpfr_integer_p (x) &&
+ mpfr_fits_ulong_p (x, MPFR_RNDN))
+ {
+ unsigned long xx = mpfr_get_ui (x, MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex2 = mpfr_ui_pow (z2, xx, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_ui_pow, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_ui_pow (z2, xx, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_ui_pow, flags set");
+
+ /* If x = 2, we can test mpfr_exp2. */
+ if (xx == 2)
+ {
+ mpfr_clear_flags ();
+ inex2 = mpfr_exp2 (z2, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_exp2, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_exp2 (z2, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_exp2, flags set");
+ }
+
+ /* If x = 10, we can test mpfr_exp10. */
+ if (xx == 10)
+ {
+ mpfr_clear_flags ();
+ inex2 = mpfr_exp10 (z2, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, flags,
+ s, "mpfr_exp10, flags cleared");
+ __gmpfr_flags = MPFR_FLAGS_ALL;
+ inex2 = mpfr_exp10 (z2, y, rnd);
+ cmpres (spx, sx, sy, rnd, z1, inex1, z2, inex2, MPFR_FLAGS_ALL,
+ s, "mpfr_exp10, flags set");
+ }
+ }
+
+ mpfr_clear (z2);
+}
+
+static int
+my_setstr (mpfr_ptr t, const char *s)
+{
+ if (strcmp (s, "min") == 0)
+ {
+ mpfr_setmin (t, mpfr_get_emin ());
+ MPFR_SET_POS (t);
+ return 0;
+ }
+ if (strcmp (s, "min+") == 0)
+ {
+ mpfr_setmin (t, mpfr_get_emin ());
+ MPFR_SET_POS (t);
+ mpfr_nextabove (t);
+ return 0;
+ }
+ if (strcmp (s, "max") == 0)
+ {
+ mpfr_setmax (t, mpfr_get_emax ());
+ MPFR_SET_POS (t);
+ return 0;
+ }
+ return mpfr_set_str (t, s, 10, MPFR_RNDN);
+}
+
+static void
+tst (void)
+{
+ int sv = sizeof (val) / sizeof (*val);
+ int i, j;
+ int rnd;
+ mpfr_t x, y, z, tmp;
+
+ mpfr_inits2 (53, x, y, z, tmp, (mpfr_ptr) 0);
+
+ for (i = 0; i < sv; i++)
+ for (j = 0; j < sv; j++)
+ RND_LOOP (rnd)
+ {
+ int exact, inex;
+ unsigned int flags;
+
+ if (my_setstr (x, val[i]) || my_setstr (y, val[j]))
+ {
+ printf ("internal error for (%d,%d,%d)\n", i, j, rnd);
+ exit (1);
+ }
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
+ flags = __gmpfr_flags;
+ if (! MPFR_IS_NAN (z) && mpfr_nanflag_p ())
+ err ("got NaN flag without NaN value", i, j, rnd, z, inex);
+ if (MPFR_IS_NAN (z) && ! mpfr_nanflag_p ())
+ err ("got NaN value without NaN flag", i, j, rnd, z, inex);
+ if (inex != 0 && ! mpfr_inexflag_p ())
+ err ("got non-zero ternary value without inexact flag",
+ i, j, rnd, z, inex);
+ if (inex == 0 && mpfr_inexflag_p ())
+ err ("got null ternary value with inexact flag",
+ i, j, rnd, z, inex);
+ if (i >= 3 && j >= 3)
+ {
+ if (mpfr_underflow_p ())
+ err ("got underflow", i, j, rnd, z, inex);
+ if (mpfr_overflow_p ())
+ err ("got overflow", i, j, rnd, z, inex);
+ exact = MPFR_IS_SINGULAR (z) ||
+ (mpfr_mul_2ui (tmp, z, 16, MPFR_RNDN), mpfr_integer_p (tmp));
+ if (exact && inex != 0)
+ err ("got exact value with ternary flag different from 0",
+ i, j, rnd, z, inex);
+ if (! exact && inex == 0)
+ err ("got inexact value with ternary flag equal to 0",
+ i, j, rnd, z, inex);
+ }
+ if (MPFR_IS_ZERO (x) && ! MPFR_IS_NAN (y) && MPFR_NOTZERO (y))
+ {
+ if (MPFR_IS_NEG (y) && ! MPFR_IS_INF (z))
+ err ("expected an infinity", i, j, rnd, z, inex);
+ if (MPFR_IS_POS (y) && ! MPFR_IS_ZERO (z))
+ err ("expected a zero", i, j, rnd, z, inex);
+ if ((MPFR_IS_NEG (x) && is_odd (y)) ^ MPFR_IS_NEG (z))
+ err ("wrong sign", i, j, rnd, z, inex);
+ }
+ if (! MPFR_IS_NAN (x) && mpfr_cmp_si (x, -1) == 0)
+ {
+ /* x = -1 */
+ if (! (MPFR_IS_INF (y) || mpfr_integer_p (y)) &&
+ ! MPFR_IS_NAN (z))
+ err ("expected NaN", i, j, rnd, z, inex);
+ if ((MPFR_IS_INF (y) || (mpfr_integer_p (y) && ! is_odd (y)))
+ && ! mpfr_equal_p (z, __gmpfr_one))
+ err ("expected 1", i, j, rnd, z, inex);
+ if (is_odd (y) &&
+ (MPFR_IS_NAN (z) || mpfr_cmp_si (z, -1) != 0))
+ err ("expected -1", i, j, rnd, z, inex);
+ }
+ if ((mpfr_equal_p (x, __gmpfr_one) || MPFR_IS_ZERO (y)) &&
+ ! mpfr_equal_p (z, __gmpfr_one))
+ err ("expected 1", i, j, rnd, z, inex);
+ if (MPFR_IS_PURE_FP (x) && MPFR_IS_NEG (x) &&
+ MPFR_IS_FP (y) && ! mpfr_integer_p (y) &&
+ ! MPFR_IS_NAN (z))
+ err ("expected NaN", i, j, rnd, z, inex);
+ if (MPFR_IS_INF (y) && MPFR_NOTZERO (x))
+ {
+ int cmpabs1 = mpfr_cmpabs (x, __gmpfr_one);
+
+ if ((MPFR_IS_NEG (y) ? (cmpabs1 < 0) : (cmpabs1 > 0)) &&
+ ! (MPFR_IS_POS (z) && MPFR_IS_INF (z)))
+ err ("expected +Inf", i, j, rnd, z, inex);
+ if ((MPFR_IS_NEG (y) ? (cmpabs1 > 0) : (cmpabs1 < 0)) &&
+ ! (MPFR_IS_POS (z) && MPFR_IS_ZERO (z)))
+ err ("expected +0", i, j, rnd, z, inex);
+ }
+ if (MPFR_IS_INF (x) && ! MPFR_IS_NAN (y) && MPFR_NOTZERO (y))
+ {
+ if (MPFR_IS_POS (y) && ! MPFR_IS_INF (z))
+ err ("expected an infinity", i, j, rnd, z, inex);
+ if (MPFR_IS_NEG (y) && ! MPFR_IS_ZERO (z))
+ err ("expected a zero", i, j, rnd, z, inex);
+ if ((MPFR_IS_NEG (x) && is_odd (y)) ^ MPFR_IS_NEG (z))
+ err ("wrong sign", i, j, rnd, z, inex);
+ }
+ test_others (val[i], val[j], (mpfr_rnd_t) rnd, x, y, z, inex, flags,
+ "tst");
+ }
+ mpfr_clears (x, y, z, tmp, (mpfr_ptr) 0);
+}
+
+static void
+underflow_up1 (void)
+{
+ mpfr_t delta, x, y, z, z0;
+ mpfr_exp_t n;
+ int inex;
+ int rnd;
+ int i;
+
+ n = mpfr_get_emin ();
+ if (n < LONG_MIN)
+ return;
+
+ mpfr_init2 (delta, 2);
+ inex = mpfr_set_ui_2exp (delta, 1, -2, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ mpfr_init2 (x, 8);
+ inex = mpfr_set_ui (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ mpfr_init2 (y, sizeof (long) * CHAR_BIT + 4);
+ inex = mpfr_set_si (y, n, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ mpfr_init2 (z0, 2);
+ mpfr_set_ui (z0, 0, MPFR_RNDN);
+
+ mpfr_init2 (z, 32);
+
+ for (i = 0; i <= 12; i++)
+ {
+ unsigned int flags = 0;
+ char sy[16];
+
+ /* Test 2^(emin - i/4).
+ * --> Underflow iff i > 4.
+ * --> Zero in MPFR_RNDN iff i >= 8.
+ */
+
+ if (i != 0 && i != 4)
+ flags |= MPFR_FLAGS_INEXACT;
+ if (i > 4)
+ flags |= MPFR_FLAGS_UNDERFLOW;
+
+ sprintf (sy, "emin - %d/4", i);
+
+ RND_LOOP (rnd)
+ {
+ int zero;
+
+ zero = (i > 4 && (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)) ||
+ (i >= 8 && rnd == MPFR_RNDN);
+
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
+ cmpres (1, "2", sy, (mpfr_rnd_t) rnd, zero ? z0 : (mpfr_ptr) NULL,
+ -1, z, inex, flags, "underflow_up1", "mpfr_pow");
+ test_others ("2", sy, (mpfr_rnd_t) rnd, x, y, z, inex, flags,
+ "underflow_up1");
+ }
+
+ inex = mpfr_sub (y, y, delta, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ }
+
+ mpfr_clears (delta, x, y, z, z0, (mpfr_ptr) 0);
+}
+
+/* With pow.c r5497, the following test fails on a 64-bit Linux machine
+ * due to a double-rounding problem when rescaling the result:
+ * Error with underflow_up2 and extended exponent range
+ * x = 7.fffffffffffffff0@-1,
+ * y = 4611686018427387904, MPFR_RNDN
+ * Expected 1.0000000000000000@-1152921504606846976, inex = 1, flags = 9
+ * Got 0, inex = -1, flags = 9
+ * With pow_ui.c r5423, the following test fails on a 64-bit Linux machine
+ * as underflows and overflows are not handled correctly (the approximation
+ * error is ignored):
+ * Error with mpfr_pow_ui, flags cleared
+ * x = 7.fffffffffffffff0@-1,
+ * y = 4611686018427387904, MPFR_RNDN
+ * Expected 1.0000000000000000@-1152921504606846976, inex = 1, flags = 9
+ * Got 0, inex = -1, flags = 9
+ */
+static void
+underflow_up2 (void)
+{
+ mpfr_t x, y, z, z0, eps;
+ mpfr_exp_t n;
+ int inex;
+ int rnd;
+
+ n = 1 - mpfr_get_emin ();
+ MPFR_ASSERTN (n > 1);
+ if (n > ULONG_MAX)
+ return;
+
+ mpfr_init2 (eps, 2);
+ mpfr_set_ui_2exp (eps, 1, -1, MPFR_RNDN); /* 1/2 */
+ mpfr_div_ui (eps, eps, n, MPFR_RNDZ); /* 1/(2n) rounded toward zero */
+
+ mpfr_init2 (x, sizeof (unsigned long) * CHAR_BIT + 1);
+ inex = mpfr_ui_sub (x, 1, eps, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0); /* since n < 2^(size_of_long_in_bits) */
+ inex = mpfr_div_2ui (x, x, 1, MPFR_RNDN); /* 1/2 - eps/2 exactly */
+ MPFR_ASSERTN (inex == 0);
+
+ mpfr_init2 (y, sizeof (unsigned long) * CHAR_BIT);
+ inex = mpfr_set_ui (y, n, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+
+ /* 0 < eps < 1 / (2n), thus (1 - eps)^n > 1/2,
+ and 1/2 (1/2)^n < (1/2 - eps/2)^n < (1/2)^n. */
+ mpfr_inits2 (64, z, z0, (mpfr_ptr) 0);
+ RND_LOOP (rnd)
+ {
+ unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
+ int expected_inex;
+ char sy[256];
+
+ mpfr_set_ui (z0, 0, MPFR_RNDN);
+ expected_inex = rnd == MPFR_RNDN || rnd == MPFR_RNDU || rnd == MPFR_RNDA ?
+ (mpfr_nextabove (z0), 1) : -1;
+ sprintf (sy, "%lu", (unsigned long) n);
+
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
+ cmpres (0, x, sy, (mpfr_rnd_t) rnd, z0, expected_inex, z, inex, ufinex,
+ "underflow_up2", "mpfr_pow");
+ test_others (NULL, sy, (mpfr_rnd_t) rnd, x, y, z, inex, ufinex,
+ "underflow_up2");
+ }
+
+ mpfr_clears (x, y, z, z0, eps, (mpfr_ptr) 0);
+}
+
+static void
+underflow_up3 (void)
+{
+ mpfr_t x, y, z, z0;
+ int inex;
+ int rnd;
+ int i;
+
+ mpfr_init2 (x, 64);
+ mpfr_init2 (y, sizeof (mpfr_exp_t) * CHAR_BIT);
+ mpfr_init2 (z, 32);
+ mpfr_init2 (z0, 2);
+
+ inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
+ int expected_inex;
+
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ if (i < 0)
+ mpfr_nextbelow (x);
+ if (i > 0)
+ mpfr_nextabove (x);
+ /* x = 2 + i * eps, y = emin - 2, x^y ~= 2^(emin - 2) */
+
+ expected_inex = rnd == MPFR_RNDU || rnd == MPFR_RNDA
+ || (rnd == MPFR_RNDN && i < 0) ? 1 : -1;
+
+ mpfr_set_ui (z0, 0, MPFR_RNDN);
+ if (expected_inex > 0)
+ mpfr_nextabove (z0);
+
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
+ cmpres (0, x, "emin - 2", (mpfr_rnd_t) rnd, z0, expected_inex, z, inex,
+ ufinex, "underflow_up3", "mpfr_pow");
+ test_others (NULL, "emin - 2", (mpfr_rnd_t) rnd, x, y, z, inex, ufinex,
+ "underflow_up3");
+ }
+
+ mpfr_clears (x, y, z, z0, (mpfr_ptr) 0);
+}
+
+static void
+underflow_up (void)
+{
+ underflow_up1 ();
+ underflow_up2 ();
+ underflow_up3 ();
+}
+
+static void
+overflow_inv (void)
+{
+ mpfr_t x, y, z;
+ int precx;
+ int s, t;
+ int inex;
+ int rnd;
+
+ mpfr_init2 (y, 2);
+ mpfr_init2 (z, 8);
+
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ for (precx = 10; precx <= 100; precx += 90)
+ {
+ const char *sp = precx == 10 ?
+ "overflow_inv (precx = 10)" : "overflow_inv (precx = 100)";
+
+ mpfr_init2 (x, precx);
+ for (s = -1; s <= 1; s += 2)
+ {
+ inex = mpfr_set_si_2exp (x, s, - mpfr_get_emax (), MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0);
+ for (t = 0; t <= 5; t++)
+ {
+ /* If precx = 10:
+ * x = s * 2^(-emax) * (1 + t * 2^(-9)), so that
+ * 1/x = s * 2^emax * (1 - t * 2^(-9) + eps) with eps > 0.
+ * Values of (1/x) / 2^emax and overflow condition for x > 0:
+ * t = 0: 1 o: always
+ * t = 1: 0.11111111 100000000011... o: MPFR_RNDN and MPFR_RNDU
+ * t = 2: 0.11111111 000000001111... o: MPFR_RNDU
+ * t = 3: 0.11111110 100000100011... o: never
+ *
+ * If precx = 100:
+ * t = 0: always overflow
+ * t > 0: overflow for MPFR_RNDN and MPFR_RNDU.
+ */
+ RND_LOOP (rnd)
+ {
+ int inf, overflow;
+ mpfr_rnd_t rnd2;
+
+ if (rnd == MPFR_RNDA)
+ rnd2 = s < 0 ? MPFR_RNDD : MPFR_RNDU;
+ else
+ rnd2 = (mpfr_rnd_t) rnd;
+
+ overflow = t == 0 ||
+ ((mpfr_rnd_t) rnd == MPFR_RNDN &&
+ (precx > 10 || t == 1)) ||
+ (rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU) &&
+ (precx > 10 || t <= 2));
+ inf = overflow &&
+ ((mpfr_rnd_t) rnd == MPFR_RNDN ||
+ rnd2 == (s < 0 ? MPFR_RNDD : MPFR_RNDU));
+ mpfr_clear_flags ();
+ inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
+ if (overflow ^ !! mpfr_overflow_p ())
+ {
+ printf ("Bad overflow flag in %s\nfor mpfr_pow%s\n"
+ "s = %d, t = %d, %s\n", sp,
+ ext ? ", extended exponent range" : "",
+ s, t, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ exit (1);
+ }
+ if (overflow && (inf ^ !! MPFR_IS_INF (z)))
+ {
+ printf ("Bad value in %s\nfor mpfr_pow%s\n"
+ "s = %d, t = %d, %s\nGot ", sp,
+ ext ? ", extended exponent range" : "",
+ s, t, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ printf (" instead of %s value.\n",
+ inf ? "infinite" : "finite");
+ exit (1);
+ }
+ test_others (NULL, "-1", (mpfr_rnd_t) rnd, x, y, z,
+ inex, __gmpfr_flags, sp);
+ } /* RND_LOOP */
+ mpfr_nexttoinf (x);
+ } /* for (t = ...) */
+ } /* for (s = ...) */
+ mpfr_clear (x);
+ } /* for (precx = ...) */
+
+ mpfr_clears (y, z, (mpfr_ptr) 0);
+}
+
+static void
+alltst (void)
+{
+ mpfr_exp_t emin, emax;
+
+ ext = 0;
+ tst ();
+ underflow_up ();
+ overflow_inv ();
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
+ if (mpfr_get_emin () != emin || mpfr_get_emax () != emax)
+ {
+ ext = 1;
+ tst ();
+ underflow_up ();
+ overflow_inv ();
+ set_emin (emin);
+ set_emax (emax);
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+ all_cmpres_errors = argc > 1;
+ alltst ();
+ tests_end_mpfr ();
+ return all_cmpres_errors < 0;
+}
diff --git a/tests/tpow_z.c b/tests/tpow_z.c
new file mode 100644
index 0000000..8afdd41
--- /dev/null
+++ b/tests/tpow_z.c
@@ -0,0 +1,379 @@
+/* Test file for mpfr_pow_z -- power function x^z with z a MPZ
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <float.h>
+#include <math.h>
+
+#include "mpfr-test.h"
+
+#define ERROR(str) do { printf("Error for "str"\n"); exit (1); } while (0)
+
+static void
+check_special (void)
+{
+ mpfr_t x, y;
+ mpz_t z;
+ int res;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpz_init (z);
+
+ /* x^0 = 1 except for NAN */
+ mpfr_set_ui (x, 23, MPFR_RNDN);
+ mpz_set_ui (z, 0);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (y, 1) != 0)
+ ERROR ("23^0");
+ mpfr_set_nan (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_nan_p (y) || mpfr_cmp_si (y, 1) != 0)
+ ERROR ("NAN^0");
+ mpfr_set_inf (x, 1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (y, 1) != 0)
+ ERROR ("INF^0");
+
+ /* sINF^N = INF if s==1 or n even if N > 0*/
+ mpz_set_ui (z, 42);
+ mpfr_set_inf (x, 1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0)
+ ERROR ("INF^42");
+ mpfr_set_inf (x, -1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0)
+ ERROR ("-INF^42");
+ mpz_set_ui (z, 17);
+ mpfr_set_inf (x, 1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) <= 0)
+ ERROR ("INF^17");
+ mpfr_set_inf (x, -1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || mpfr_sgn (y) >= 0)
+ ERROR ("-INF^17");
+
+ mpz_set_si (z, -42);
+ mpfr_set_inf (x, 1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("INF^-42");
+ mpfr_set_inf (x, -1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("-INF^-42");
+ mpz_set_si (z, -17);
+ mpfr_set_inf (x, 1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("INF^-17");
+ mpfr_set_inf (x, -1);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0)
+ ERROR ("-INF^-17");
+
+ /* s0^N = +0 if s==+ or n even if N > 0*/
+ mpz_set_ui (z, 42);
+ MPFR_SET_ZERO (x); MPFR_SET_POS (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("+0^42");
+ MPFR_SET_NEG (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("-0^42");
+ mpz_set_ui (z, 17);
+ MPFR_SET_POS (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("+0^17");
+ MPFR_SET_NEG (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_zero_p (y) == 0 || MPFR_SIGN (y) >= 0)
+ ERROR ("-0^17");
+
+ mpz_set_si (z, -42);
+ MPFR_SET_ZERO (x); MPFR_SET_POS (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("+0^-42");
+ MPFR_SET_NEG (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("-0^-42");
+ mpz_set_si (z, -17);
+ MPFR_SET_POS (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) <= 0)
+ ERROR ("+0^-17");
+ MPFR_SET_NEG (x);
+ res = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (res != 0 || mpfr_inf_p (y) == 0 || MPFR_SIGN (y) >= 0)
+ ERROR ("-0^-17");
+
+ mpz_clear (z);
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+static void
+check_integer (mpfr_prec_t begin, mpfr_prec_t end, unsigned long max)
+{
+ mpfr_t x, y1, y2;
+ mpz_t z;
+ unsigned long i, n;
+ mpfr_prec_t p;
+ int res1, res2;
+ mpfr_rnd_t rnd;
+
+ mpfr_inits2 (begin, x, y1, y2, (mpfr_ptr) 0);
+ mpz_init (z);
+ for (p = begin ; p < end ; p+=4)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (y1, p);
+ mpfr_set_prec (y2, p);
+ for (i = 0 ; i < max ; i++)
+ {
+ mpz_urandomb (z, RANDS, GMP_NUMB_BITS);
+ if ((i & 1) != 0)
+ mpz_neg (z, z);
+ mpfr_urandomb (x, RANDS);
+ mpfr_mul_2ui (x, x, 1, MPFR_RNDN); /* 0 <= x < 2 */
+ rnd = RND_RAND ();
+ if (mpz_fits_slong_p (z))
+ {
+ n = mpz_get_si (z);
+ /* printf ("New test for x=%ld\nCheck Pow_si\n", n); */
+ res1 = mpfr_pow_si (y1, x, n, rnd);
+ /* printf ("Check pow_z\n"); */
+ res2 = mpfr_pow_z (y2, x, z, rnd);
+ if (mpfr_cmp (y1, y2) != 0)
+ {
+ printf ("Error for p = %lu, z = %lu, rnd = %s and x = ",
+ (unsigned long) p, n, mpfr_print_rnd_mode (rnd));
+ mpfr_dump (x);
+ printf ("Ypowsi = "); mpfr_dump (y1);
+ printf ("Ypowz = "); mpfr_dump (y2);
+ exit (1);
+ }
+ if (res1 != res2)
+ {
+ printf ("Wrong inexact flags for p = %lu, z = %lu, rnd = %s"
+ " and x = ", (unsigned long) p, n,
+ mpfr_print_rnd_mode (rnd));
+ mpfr_dump (x);
+ printf ("Ypowsi(inex = %2d) = ", res1); mpfr_dump (y1);
+ printf ("Ypowz (inex = %2d) = ", res2); mpfr_dump (y2);
+ exit (1);
+ }
+ }
+ } /* for i */
+ } /* for p */
+ mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
+ mpz_clear (z);
+}
+
+static void
+check_regression (void)
+{
+ mpfr_t x, y;
+ mpz_t z;
+ int res1, res2;
+
+ mpz_init_set_ui (z, 2026876995);
+ mpfr_init2 (x, 122);
+ mpfr_init2 (y, 122);
+
+ mpfr_set_str_binary (x, "0.10000010010000111101001110100101101010011110011100001111000001001101000110011001001001001011001011010110110110101000111011E1");
+ res1 = mpfr_pow_z (y, x, z, MPFR_RNDU);
+ res2 = mpfr_pow_ui (x, x, 2026876995UL, MPFR_RNDU);
+ if (mpfr_cmp (x, y) || res1 != res2)
+ {
+ printf ("Regression (1) tested failed (%d=?%d)\n",res1, res2);
+ printf ("pow_ui: "); mpfr_dump (x);
+ printf ("pow_z: "); mpfr_dump (y);
+
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpz_clear (z);
+}
+
+/* Bug found by Kevin P. Rauch */
+static void
+bug20071104 (void)
+{
+ mpfr_t x, y;
+ mpz_t z;
+ int inex;
+
+ mpz_init_set_si (z, -2);
+ mpfr_inits2 (20, x, y, (mpfr_ptr) 0);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_nextbelow (x); /* x = -2^(emin-1) */
+ mpfr_clear_flags ();
+ inex = mpfr_pow_z (y, x, z, MPFR_RNDN);
+ if (! mpfr_inf_p (y) || MPFR_SIGN (y) < 0)
+ {
+ printf ("Error in bug20071104: expected +Inf, got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("Error in bug20071104: bad ternary value (%d)\n", inex);
+ exit (1);
+ }
+ if (__gmpfr_flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT))
+ {
+ printf ("Error in bug20071104: bad flags (%u)\n", __gmpfr_flags);
+ exit (1);
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+ mpz_clear (z);
+}
+
+static void
+check_overflow (void)
+{
+ mpfr_t a;
+ mpz_t z;
+ unsigned long n;
+ int res;
+
+ mpfr_init2 (a, 53);
+
+ mpfr_set_str_binary (a, "1E10");
+ mpz_init_set_ui (z, ULONG_MAX);
+ res = mpfr_pow_z (a, a, z, MPFR_RNDN);
+ if (! MPFR_IS_INF (a) || MPFR_SIGN (a) < 0 || res <= 0)
+ {
+ printf ("Error for (1e10)^ULONG_MAX, expected +Inf,\ngot ");
+ mpfr_dump (a);
+ exit (1);
+ }
+
+ /* Bug in pow_z.c up to r5109: if x = y (same mpfr_t argument), the
+ input argument is negative and not a power of two, z is positive
+ and odd, an overflow or underflow occurs, and the temporary result
+ res is positive, then the result gets a wrong sign (positive
+ instead of negative). */
+ mpfr_set_str_binary (a, "-1.1E10");
+ n = (ULONG_MAX ^ (ULONG_MAX >> 1)) + 1;
+ mpz_set_ui (z, n);
+ res = mpfr_pow_z (a, a, z, MPFR_RNDN);
+ if (! MPFR_IS_INF (a) || MPFR_SIGN (a) > 0 || res >= 0)
+ {
+ printf ("Error for (-1e10)^%lu, expected -Inf,\ngot ", n);
+ mpfr_dump (a);
+ exit (1);
+ }
+
+ mpfr_clear (a);
+ mpz_clear (z);
+}
+
+/* bug reported by Carl Witty (32-bit architecture) */
+static void
+bug20080223 (void)
+{
+ mpfr_t a, exp, answer;
+
+ mpfr_init2 (a, 53);
+ mpfr_init2 (exp, 53);
+ mpfr_init2 (answer, 53);
+
+ mpfr_set_si (exp, -1073741824, MPFR_RNDN);
+
+ mpfr_set_str (a, "1.999999999", 10, MPFR_RNDN);
+ /* a = 562949953139837/2^48 */
+ mpfr_pow (answer, a, exp, MPFR_RNDN);
+ mpfr_set_str_binary (a, "0.110110101111011001110000111111100011101000111011101E-1073741823");
+ MPFR_ASSERTN(mpfr_cmp0 (answer, a) == 0);
+
+ mpfr_clear (a);
+ mpfr_clear (exp);
+ mpfr_clear (answer);
+}
+
+static void
+bug20080904 (void)
+{
+ mpz_t exp;
+ mpfr_t a, answer;
+ mpfr_exp_t emin_default;
+
+ mpz_init (exp);
+ mpfr_init2 (a, 70);
+ mpfr_init2 (answer, 70);
+
+ emin_default = mpfr_get_emin ();
+ mpfr_set_emin (MPFR_EMIN_MIN);
+
+ mpz_set_str (exp, "-4eb92f8c7b7bf81e", 16);
+ mpfr_set_str_binary (a, "1.110000101110100110100011111000011110111101000011111001111001010011100");
+
+ mpfr_pow_z (answer, a, exp, MPFR_RNDN);
+ /* The correct result is near 2^(-2^62), so it underflows when
+ MPFR_EMIN_MIN > -2^62 (i.e. with 32 and 64 bits machines). */
+ mpfr_set_str (a, "AA500C0D7A69275DBp-4632850503556296886", 16, MPFR_RNDN);
+ if (! mpfr_equal_p (answer, a))
+ {
+ printf ("Error in bug20080904:\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, a, MPFR_RNDN);
+ putchar ('\n');
+ printf ("Got ");
+ mpfr_out_str (stdout, 16, 0, answer, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_set_emin (emin_default);
+
+ mpz_clear (exp);
+ mpfr_clear (a);
+ mpfr_clear (answer);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ check_special ();
+
+ check_integer (2, 163, 100);
+ check_regression ();
+ bug20071104 ();
+ bug20080223 ();
+ bug20080904 ();
+ check_overflow ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tprintf.c b/tests/tprintf.c
new file mode 100644
index 0000000..d63b3a4
--- /dev/null
+++ b/tests/tprintf.c
@@ -0,0 +1,505 @@
+/* tprintf.c -- test file for mpfr_printf and mpfr_vprintf
+
+Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#if HAVE_STDARG
+#include <stdarg.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+
+#include "mpfr-intmax.h"
+#include "mpfr-test.h"
+#define STDOUT_FILENO 1
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+#define QUOTE(X) NAME(X)
+#define NAME(X) #X
+
+/* unlike other tests, we print out errors to stderr because stdout might be
+ redirected */
+#define check_length(num_test, var, value, var_spec) \
+ if ((var) != (value)) \
+ { \
+ fprintf (stderr, "Error in test #%d: mpfr_printf printed %" \
+ QUOTE(var_spec)" characters instead of %d\n", \
+ (num_test), (var), (value)); \
+ exit (1); \
+ }
+
+#define check_length_with_cmp(num_test, var, value, cmp, var_spec) \
+ if (cmp != 0) \
+ { \
+ mpfr_fprintf (stderr, "Error in test #%d, mpfr_printf printed %" \
+ QUOTE(var_spec)" characters instead of %d\n", \
+ (num_test), (var), (value)); \
+ exit (1); \
+ }
+
+/* limit for random precision in random() */
+const int prec_max_printf = 5000;
+/* boolean: is stdout redirected to a file ? */
+int stdout_redirect;
+
+static void
+check (const char *fmt, mpfr_t x)
+{
+ if (mpfr_printf (fmt, x) == -1)
+ {
+ fprintf (stderr, "Error in mpfr_printf(\"%s\", ...)\n", fmt);
+
+ exit (1);
+ }
+ putchar ('\n');
+}
+
+static void
+check_vprintf (const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ if (mpfr_vprintf (fmt, ap) == -1)
+ {
+ fprintf (stderr, "Error in mpfr_vprintf(\"%s\", ...)\n", fmt);
+
+ va_end (ap);
+ exit (1);
+ }
+ putchar ('\n');
+ va_end (ap);
+}
+
+static void
+check_vprintf_failure (const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ if (mpfr_vprintf (fmt, ap) != -1)
+ {
+ putchar ('\n');
+ fprintf (stderr, "Error in mpfr_vprintf(\"%s\", ...)\n", fmt);
+
+ va_end (ap);
+ exit (1);
+ }
+ putchar ('\n');
+ va_end (ap);
+}
+
+static void
+check_invalid_format (void)
+{
+ int i = 0;
+
+ /* format in disorder */
+ check_vprintf_failure ("blah %l2.1d blah", i);
+ check_vprintf_failure ("blah %2.1#d blah", i);
+
+ /* incomplete format */
+ check_vprintf_failure ("%", i);
+ check_vprintf_failure ("% (missing conversion specifier)", i);
+ check_vprintf_failure ("missing conversion specifier %h", i);
+ check_vprintf_failure ("this should fail %.l because of missing conversion specifier "
+ "(or doubling %%)", i);
+ check_vprintf_failure ("%L", i);
+ check_vprintf_failure ("%hh. ", i);
+ check_vprintf_failure ("blah %j.");
+ check_vprintf_failure ("%ll blah");
+ check_vprintf_failure ("blah%t blah");
+ check_vprintf_failure ("%z ");
+ check_vprintf_failure ("%F (missing conversion specifier)");
+ check_vprintf_failure ("%Q (missing conversion specifier)");
+ check_vprintf_failure ("%M (missing conversion specifier)");
+ check_vprintf_failure ("%N (missing conversion specifier)");
+ check_vprintf_failure ("%Z (missing conversion specifier)");
+ check_vprintf_failure ("%R (missing conversion specifier)");
+ check_vprintf_failure ("%R");
+ check_vprintf_failure ("%P (missing conversion specifier)");
+
+ /* conversion specifier with wrong length specifier */
+ check_vprintf_failure ("%ha", i);
+ check_vprintf_failure ("%hhe", i);
+ check_vprintf_failure ("%jf", i);
+ check_vprintf_failure ("%lg", i);
+ check_vprintf_failure ("%tA", i);
+ check_vprintf_failure ("%zE", i);
+ check_vprintf_failure ("%Ld", i);
+ check_vprintf_failure ("%Qf", i);
+ check_vprintf_failure ("%MG", i);
+ check_vprintf_failure ("%Na", i);
+ check_vprintf_failure ("%ZE", i);
+ check_vprintf_failure ("%PG", i);
+ check_vprintf_failure ("%Fu", i);
+ check_vprintf_failure ("%Rx", i);
+}
+
+static void
+check_long_string (void)
+{
+ /* this test is VERY expensive both in time (~1 min on core2 @ 2.40GHz) and
+ in memory (~2.5 GB) */
+ mpfr_t x;
+
+ mpfr_init2 (x, INT_MAX);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_nextabove (x);
+
+ check_vprintf_failure ("%Rb", x);
+ check_vprintf_failure ("%RA %RA %Ra %Ra", x, x, x, x);
+
+ mpfr_clear (x);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t x;
+
+ mpfr_init (x);
+
+ mpfr_set_inf (x, 1);
+ check ("%Ra", x);
+ check ("%Rb", x);
+ check ("%Re", x);
+ check ("%Rf", x);
+ check ("%Rg", x);
+ check_vprintf ("%Ra", x);
+ check_vprintf ("%Rb", x);
+ check_vprintf ("%Re", x);
+ check_vprintf ("%Rf", x);
+ check_vprintf ("%Rg", x);
+
+ mpfr_set_inf (x, -1);
+ check ("%Ra", x);
+ check ("%Rb", x);
+ check ("%Re", x);
+ check ("%Rf", x);
+ check ("%Rg", x);
+ check_vprintf ("%Ra", x);
+ check_vprintf ("%Rb", x);
+ check_vprintf ("%Re", x);
+ check_vprintf ("%Rf", x);
+ check_vprintf ("%Rg", x);
+
+ mpfr_set_nan (x);
+ check ("%Ra", x);
+ check ("%Rb", x);
+ check ("%Re", x);
+ check ("%Rf", x);
+ check ("%Rg", x);
+ check_vprintf ("%Ra", x);
+ check_vprintf ("%Rb", x);
+ check_vprintf ("%Re", x);
+ check_vprintf ("%Rf", x);
+ check_vprintf ("%Rg", x);
+
+ mpfr_clear (x);
+}
+
+static void
+check_mixed (void)
+{
+ int ch = 'a';
+#ifndef NPRINTF_HH
+ signed char sch = -1;
+ unsigned char uch = 1;
+#endif
+ short sh = -1;
+ unsigned short ush = 1;
+ int i = -1;
+ int j = 1;
+ unsigned int ui = 1;
+ long lo = -1;
+ unsigned long ulo = 1;
+ float f = -1.25;
+ double d = -1.25;
+#if !defined(NPRINTF_T) || !defined(NPRINTF_L)
+ long double ld = -1.25;
+#endif
+
+#ifndef NPRINTF_T
+ ptrdiff_t p = 1, saved_p;
+#endif
+ size_t sz = 1;
+
+ mpz_t mpz;
+ mpq_t mpq;
+ mpf_t mpf;
+ mpfr_rnd_t rnd = MPFR_RNDN;
+
+ mpfr_t mpfr;
+ mpfr_prec_t prec;
+
+ mpz_init (mpz);
+ mpz_set_ui (mpz, ulo);
+ mpq_init (mpq);
+ mpq_set_si (mpq, lo, ulo);
+ mpf_init (mpf);
+ mpf_set_q (mpf, mpq);
+ mpfr_init (mpfr);
+ mpfr_set_f (mpfr, mpf, MPFR_RNDN);
+ prec = mpfr_get_prec (mpfr);
+
+ check_vprintf ("a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
+ check_length (1, j, 22, d);
+ check_vprintf ("a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i, lo, &ulo);
+ check_length (2, ulo, 36, lu);
+ check_vprintf ("a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
+ check_length (3, ush, 29, hu);
+ check_vprintf ("a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
+ check_length (4, i, 29, d);
+ check_vprintf ("a. %R*A, b. %Fe, c. %i%zn", rnd, mpfr, mpf, sz, &sz);
+ check_length (5, (unsigned long) sz, 34, lu); /* no format specifier '%zu' in C89 */
+ check_vprintf ("a. %Pu, b. %c, c. %RUG, d. %Zi%Zn", prec, ch, mpfr, mpz, &mpz);
+ check_length_with_cmp (6, mpz, 24, mpz_cmp_ui (mpz, 24), Zi);
+ check_vprintf ("%% a. %#.0RNg, b. %Qx%Rn c. %p",
+ mpfr, mpq, &mpfr, (void *) &i);
+ check_length_with_cmp (7, mpfr, 15, mpfr_cmp_ui (mpfr, 15), Rg);
+
+#ifndef NPRINTF_T
+ saved_p = p;
+ check_vprintf ("%% a. %RNg, b. %Qx, c. %td%tn", mpfr, mpq, p, &p);
+ if (p != 20)
+ mpfr_fprintf (stderr, "Error in test 8, got '%% a. %RNg, b. %Qx, c. %td'\n", mpfr, mpq, saved_p);
+ check_length (8, (long) p, 20, ld); /* no format specifier '%td' in C89 */
+#endif
+
+#ifndef NPRINTF_L
+ check_vprintf ("a. %RA, b. %Lf, c. %QX%zn", mpfr, ld, mpq, &sz);
+ check_length (9, (unsigned long) sz, 30, lu); /* no format specifier '%zu' in C89 */
+#endif
+
+#ifndef NPRINTF_HH
+ check_vprintf ("a. %hhi, b. %Ra, c. %hhu%hhn", sch, mpfr, uch, &uch);
+ check_length (10, (unsigned int) uch, 22, u); /* no format specifier '%hhu' in C89 */
+#endif
+
+#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
+ {
+ long long llo = -1;
+ unsigned long long ullo = 1;
+
+ check_vprintf ("a. %Re, b. %llx%Qn", mpfr, ullo, &mpq);
+ check_length_with_cmp (11, mpq, 16, mpq_cmp_ui (mpq, 16, 1), Qu);
+ check_vprintf ("a. %lli, b. %Rf%lln", llo, mpfr, &ullo);
+ check_length (12, ullo, 19, llu);
+ }
+#endif
+
+#if defined(_MPFR_H_HAVE_INTMAX_T) && !defined(NPRINTF_J)
+ {
+ intmax_t im = -1;
+ uintmax_t uim = 1;
+
+ check_vprintf ("a. %*RA, b. %ji%Fn", 10, mpfr, im, &mpf);
+ check_length_with_cmp (31, mpf, 20, mpf_cmp_ui (mpf, 20), Fg);
+ check_vprintf ("a. %.*Re, b. %jx%jn", 10, mpfr, uim, &im);
+ check_length (32, (long) im, 25, li); /* no format specifier "%ji" in C89 */
+ }
+#endif
+
+ mpfr_clear (mpfr);
+ mpf_clear (mpf);
+ mpq_clear (mpq);
+ mpz_clear (mpz);
+}
+
+static void
+check_random (int nb_tests)
+{
+ int i;
+ mpfr_t x;
+ mpfr_rnd_t rnd;
+ char flag[] =
+ {
+ '-',
+ '+',
+ ' ',
+ '#',
+ '0', /* no ambiguity: first zeros are flag zero*/
+ '\''
+ };
+ char specifier[] =
+ {
+ 'a',
+ 'b',
+ 'e',
+ 'f',
+ 'g'
+ };
+ mpfr_exp_t old_emin, old_emax;
+
+ old_emin = mpfr_get_emin ();
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init (x);
+
+ for (i = 0; i < nb_tests; ++i)
+ {
+ int ret;
+ int j, jmax;
+ int spec, prec;
+#define FMT_SIZE 13
+ char fmt[FMT_SIZE]; /* at most something like "%-+ #0'.*R*f" */
+ char *ptr = fmt;
+
+ tests_default_random (x, 256, MPFR_EMIN_MIN, MPFR_EMAX_MAX);
+ rnd = (mpfr_rnd_t) RND_RAND ();
+
+ spec = (int) (randlimb () % 5);
+ jmax = (spec == 3 || spec == 4) ? 6 : 5; /* ' flag only with %f or %g */
+ /* advantage small precision */
+ prec = (randlimb () % 2) ? 10 : prec_max_printf;
+ prec = (int) (randlimb () % prec);
+ if (spec == 3
+ && (mpfr_get_exp (x) > prec_max_printf
+ || mpfr_get_exp (x) < -prec_max_printf))
+ /* change style 'f' to style 'e' when number x is very large or very
+ small*/
+ --spec;
+
+ *ptr++ = '%';
+ for (j = 0; j < jmax; j++)
+ {
+ if (randlimb () % 3 == 0)
+ *ptr++ = flag[j];
+ }
+ *ptr++ = '.';
+ *ptr++ = '*';
+ *ptr++ = 'R';
+ *ptr++ = '*';
+ *ptr++ = specifier[spec];
+ *ptr = '\0';
+ MPFR_ASSERTD (ptr - fmt < FMT_SIZE);
+
+ mpfr_printf ("mpfr_printf(\"%s\", %d, %s, %Re)\n", fmt, prec,
+ mpfr_print_rnd_mode (rnd), x);
+ ret = mpfr_printf (fmt, prec, rnd, x);
+ if (ret == -1)
+ {
+ if (spec == 3
+ && (MPFR_GET_EXP (x) > INT_MAX || MPFR_GET_EXP (x) < -INT_MAX))
+ /* normal failure: x is too large to be output with full precision */
+ {
+ mpfr_printf ("too large !");
+ }
+ else
+ {
+ printf ("Error in mpfr_printf(\"%s\", %d, %s, ...)",
+ fmt, prec, mpfr_print_rnd_mode (rnd));
+
+ if (stdout_redirect)
+ {
+ if ((fflush (stdout) == EOF) || (fclose (stdout) == -1))
+ {
+ perror ("check_random");
+ exit (1);
+ }
+ }
+ exit (1);
+ }
+ }
+ putchar ('\n');
+ }
+
+ mpfr_set_emin (old_emin);
+ mpfr_set_emax (old_emax);
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ int N;
+
+ tests_start_mpfr ();
+
+ /* with no argument: prints to /dev/null,
+ tprintf N: prints N tests to stdout */
+ if (argc == 1)
+ {
+ N = 1000;
+ stdout_redirect = 1;
+ if (freopen ("/dev/null", "w", stdout) == NULL)
+ {
+ /* We failed to open this device, try with a dummy file */
+ if (freopen ("mpfrtest.txt", "w", stdout) == NULL)
+ {
+ /* Output the error message to stderr since it is not
+ a message about a wrong result in MPFR. Anyway the
+ stdandard output may have changed. */
+ fprintf (stderr, "Can't open /dev/null or a temporary file\n");
+ exit (1);
+ }
+ }
+ }
+ else
+ {
+ stdout_redirect = 0;
+ N = atoi (argv[1]);
+ }
+
+ check_invalid_format ();
+ check_special ();
+ check_mixed ();
+
+ /* expensive tests */
+ if (getenv ("MPFR_CHECK_LARGEMEM") != NULL)
+ check_long_string();
+
+ check_random (N);
+
+ if (stdout_redirect)
+ {
+ if ((fflush (stdout) == EOF) || (fclose (stdout) == -1))
+ perror ("main");
+ }
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else /* MPFR_VERSION */
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif /* MPFR_VERSION */
+
+#else /* HAVE_STDARG */
+
+int
+main (void)
+{
+ /* We have nothing to test. */
+ return 77;
+}
+
+#endif /* HAVE_STDARG */
diff --git a/tests/trandom.c b/tests/trandom.c
new file mode 100644
index 0000000..a4f075f
--- /dev/null
+++ b/tests/trandom.c
@@ -0,0 +1,184 @@
+/* Test file for mpfr_urandomb
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+
+static void
+test_urandomb (long nbtests, mpfr_prec_t prec, int verbose)
+{
+ mpfr_t x;
+ int *tab, size_tab, k, sh, xn;
+ double d, av = 0, var = 0, chi2 = 0, th;
+ mpfr_exp_t emin;
+
+ size_tab = (nbtests >= 1000 ? nbtests / 50 : 20);
+ tab = (int *) calloc (size_tab, sizeof(int));
+ if (tab == NULL)
+ {
+ fprintf (stderr, "trandom: can't allocate memory in test_urandomb\n");
+ exit (1);
+ }
+
+ mpfr_init2 (x, prec);
+ xn = 1 + (prec - 1) / mp_bits_per_limb;
+ sh = xn * mp_bits_per_limb - prec;
+
+ for (k = 0; k < nbtests; k++)
+ {
+ mpfr_urandomb (x, RANDS);
+ /* check that lower bits are zero */
+ if (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh))
+ {
+ printf ("Error: mpfr_urandomb() returns invalid numbers:\n");
+ mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+ d = mpfr_get_d1 (x); av += d; var += d*d;
+ tab[(int)(size_tab * d)]++;
+ }
+
+ /* coverage test */
+ emin = mpfr_get_emin ();
+ set_emin (1); /* the generated number in [0,1[ is not in the exponent
+ range, except if it is zero */
+ k = mpfr_urandomb (x, RANDS);
+ if (MPFR_IS_ZERO(x) == 0 && (k == 0 || mpfr_nan_p (x) == 0))
+ {
+ printf ("Error in mpfr_urandomb, expected NaN, got ");
+ mpfr_dump (x);
+ exit (1);
+ }
+ set_emin (emin);
+
+ mpfr_clear (x);
+ if (!verbose)
+ {
+ free(tab);
+ return;
+ }
+
+ av /= nbtests;
+ var = (var / nbtests) - av * av;
+
+ th = (double)nbtests / size_tab;
+ printf("Average = %.5f\nVariance = %.5f\n", av, var);
+ printf("Repartition for urandomb. Each integer should be close to %d.\n",
+ (int)th);
+
+ for (k = 0; k < size_tab; k++)
+ {
+ chi2 += (tab[k] - th) * (tab[k] - th) / th;
+ printf("%d ", tab[k]);
+ if (((k+1) & 7) == 0)
+ printf("\n");
+ }
+
+ printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n\n",
+ size_tab - 1, chi2);
+
+ free(tab);
+ return;
+}
+
+/* Problem reported by Carl Witty: check mpfr_urandomb give similar results
+ on 32-bit and 64-bit machines.
+ We assume the default GMP random generator does not depend on the machine
+ word size, not on the GMP version.
+*/
+static void
+bug20100914 (void)
+{
+ mpfr_t x;
+ gmp_randstate_t s;
+
+#if __MPFR_GMP(4,2,0)
+# define C1 "0.895943"
+# define C2 "0.848824"
+#else
+# define C1 "0.479652"
+# define C2 "0.648529"
+#endif
+
+ gmp_randinit_default (s);
+ gmp_randseed_ui (s, 42);
+ mpfr_init2 (x, 17);
+ mpfr_urandomb (x, s);
+ if (mpfr_cmp_str1 (x, C1) != 0)
+ {
+ printf ("Error in bug20100914, expected " C1 ", got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_urandomb (x, s);
+ if (mpfr_cmp_str1 (x, C2) != 0)
+ {
+ printf ("Error in bug20100914, expected " C2 ", got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+ gmp_randclear (s);
+}
+
+int
+main (int argc, char *argv[])
+{
+ long nbtests;
+ mpfr_prec_t prec;
+ int verbose = 0;
+
+ tests_start_mpfr ();
+
+ if (argc > 1)
+ verbose = 1;
+
+ nbtests = 10000;
+ if (argc > 1)
+ {
+ long a = atol(argv[1]);
+ if (a != 0)
+ nbtests = a;
+ }
+
+ if (argc <= 2)
+ prec = 1000;
+ else
+ prec = atol(argv[2]);
+
+ test_urandomb (nbtests, prec, verbose);
+
+ if (argc == 1) /* check also small precision */
+ {
+ test_urandomb (nbtests, 2, 0);
+ }
+
+ bug20100914 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/trec_sqrt.c b/tests/trec_sqrt.c
new file mode 100644
index 0000000..9d069c7
--- /dev/null
+++ b/tests/trec_sqrt.c
@@ -0,0 +1,210 @@
+/* Test file for mpfr_rec_sqrt.
+
+Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+#define TEST_FUNCTION mpfr_rec_sqrt
+#define TEST_RANDOM_POS 8 /* 8/512 = 1/64 of the tested numbers are negative */
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* rec_sqrt(NaN) = NaN */
+ mpfr_set_nan (x);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0);
+
+ /* rec_sqrt(+Inf) = +0 */
+ mpfr_set_inf (x, 1);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_zero_p (x) && MPFR_IS_POS(x) && inex == 0);
+
+ /* rec_sqrt(-Inf) = NaN */
+ mpfr_set_inf (x, -1);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0);
+
+ /* rec_sqrt(+0) = +Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x) && inex == 0);
+
+ /* rec_sqrt(-0) = +Inf */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x) && inex == 0);
+
+ /* rec_sqrt(-1) = NaN */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x) && inex == 0);
+
+ /* rec_sqrt(1) = 1 */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ inex = mpfr_rec_sqrt (x, x, MPFR_RNDN);
+ MPFR_ASSERTN((mpfr_cmp_ui (x, 1) == 0) && (inex == 0));
+
+ mpfr_set_prec (x, 23);
+ mpfr_set_prec (y, 33);
+ mpfr_set_str_binary (x, "1.0001110110101001010100e-1");
+ inex = mpfr_rec_sqrt (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 33);
+ mpfr_set_str_binary (x, "1.01010110101110100100100101011");
+ MPFR_ASSERTN (inex > 0 && mpfr_cmp (x, y) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* Worst case incorrectly rounded in r5573, found with the bad_cases test */
+static void
+bad_case1 (void)
+{
+ mpfr_t x, y, z;
+
+ mpfr_init2 (x, 72);
+ mpfr_inits2 (6, y, z, (mpfr_ptr) 0);
+ mpfr_set_str (x, "1.08310518720928b30e@-120", 16, MPFR_RNDN);
+ mpfr_set_str (z, "f.8@59", 16, MPFR_RNDN);
+ /* z = rec_sqrt(x) rounded on 6 bits toward 0, the exact value
+ being ~= f.bffffffffffffffffa11@59. */
+ mpfr_rec_sqrt (y, x, MPFR_RNDZ);
+ if (mpfr_cmp0 (y, z) != 0)
+ {
+ printf ("Error in bad_case1\nexpected ");
+ mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static int
+pm2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_pow_si (y, x, -2, rnd_mode);
+}
+
+/* exercises corner cases with inputs around 1 or 2 */
+static void
+bad_case2 (void)
+{
+ mpfr_t r, u;
+ mpfr_prec_t pr, pu;
+ int rnd;
+
+ for (pr = MPFR_PREC_MIN; pr <= 192; pr++)
+ for (pu = MPFR_PREC_MIN; pu <= 192; pu++)
+ {
+ mpfr_init2 (r, pr);
+ mpfr_init2 (u, pu);
+
+ mpfr_set_ui (u, 1, MPFR_RNDN);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_nextbelow (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_nextbelow (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_set_ui (u, 1, MPFR_RNDN);
+ mpfr_nextabove (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_nextabove (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_set_ui (u, 2, MPFR_RNDN);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_nextbelow (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_nextbelow (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_set_ui (u, 2, MPFR_RNDN);
+ mpfr_nextabove (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_nextabove (u);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ mpfr_rec_sqrt (r, u, (mpfr_rnd_t) rnd);
+
+ mpfr_clear (r);
+ mpfr_clear (u);
+ }
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ special ();
+ bad_case1 ();
+ bad_case2 ();
+ test_generic (2, 300, 15);
+
+ data_check ("data/rec_sqrt", mpfr_rec_sqrt, "mpfr_rec_sqrt");
+ bad_cases (mpfr_rec_sqrt, pm2, "mpfr_rec_sqrt", 8, -256, 255, 4, 128,
+ 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else /* MPFR_VERSION */
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif /* MPFR_VERSION */
diff --git a/tests/tremquo.c b/tests/tremquo.c
new file mode 100644
index 0000000..a496239
--- /dev/null
+++ b/tests/tremquo.c
@@ -0,0 +1,291 @@
+/* tremquo -- test file for mpfr_remquo and mpfr_remainder
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+bug20090227 (void)
+{
+ mpfr_t x, y, r1, r2;
+
+ mpfr_init2 (x, 118);
+ mpfr_init2 (y, 181);
+ mpfr_init2 (r1, 140);
+ mpfr_init2 (r2, 140);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_str_binary (y, "1.100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111010");
+ mpfr_remainder (r1, x, y, MPFR_RNDU);
+ /* since the quotient is -1, r1 is the rounding of x+y */
+ mpfr_add (r2, x, y, MPFR_RNDU);
+ if (mpfr_cmp (r1, r2))
+ {
+ printf ("Error in mpfr_remainder (bug20090227)\n");
+ printf ("Expected ");
+ mpfr_dump (r2);
+ printf ("Got ");
+ mpfr_dump (r1);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (r1);
+ mpfr_clear (r2);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y, r;
+ long q[1];
+
+ if (argc == 3) /* usage: tremquo x y (rnd=MPFR_RNDN implicit) */
+ {
+ mpfr_init2 (x, GMP_NUMB_BITS);
+ mpfr_init2 (y, GMP_NUMB_BITS);
+ mpfr_init2 (r, GMP_NUMB_BITS);
+ mpfr_set_str (x, argv[1], 10, MPFR_RNDN);
+ mpfr_set_str (y, argv[2], 10, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ printf ("r=");
+ mpfr_out_str (stdout, 10, 0, r, MPFR_RNDN);
+ printf (" q=%ld\n", q[0]);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (r);
+ return 0;
+ }
+
+ tests_start_mpfr ();
+
+ bug20090227 ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (r);
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (r));
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_nan (y);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (r));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (r));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (r));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_set_inf (y, 1);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (r));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r));
+ MPFR_ASSERTN (q[0] == (long) 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_set_inf (y, 1);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r));
+ MPFR_ASSERTN (q[0] == (long) 0);
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_inf (y, 1);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp (r, x) == 0);
+ MPFR_ASSERTN (q[0] == (long) 0);
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (r));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_POS (r));
+ MPFR_ASSERTN (q[0] == (long) 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (r, 0) == 0 && MPFR_IS_NEG (r));
+ MPFR_ASSERTN (q[0] == (long) 0);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ /* check four possible sign combinations */
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0);
+ MPFR_ASSERTN (q[0] == (long) 2);
+ mpfr_set_si (x, -42, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0);
+ MPFR_ASSERTN (q[0] == (long) -2);
+ mpfr_set_si (x, -42, MPFR_RNDN);
+ mpfr_set_si (y, -17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (r, -8) == 0);
+ MPFR_ASSERTN (q[0] == (long) 2);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_si (y, -17, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (r, 8) == 0);
+ MPFR_ASSERTN (q[0] == (long) -2);
+
+ mpfr_set_prec (x, 100);
+ mpfr_set_prec (y, 50);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_nextabove (x); /* 42 + 2^(-94) */
+ mpfr_set_ui (y, 21, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -94) == 0);
+ MPFR_ASSERTN (q[0] == (long) 2);
+
+ mpfr_set_prec (x, 50);
+ mpfr_set_prec (y, 100);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_nextabove (x); /* 42 + 2^(-44) */
+ mpfr_set_ui (y, 21, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -44) == 0);
+ MPFR_ASSERTN (q[0] == (long) 2);
+
+ mpfr_set_prec (x, 100);
+ mpfr_set_prec (y, 50);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 21, MPFR_RNDN);
+ mpfr_nextabove (y); /* 21 + 2^(-45) */
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ /* r should be 42 - 2*(21 + 2^(-45)) = -2^(-44) */
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -44) == 0);
+ MPFR_ASSERTN (q[0] == (long) 2);
+
+ mpfr_set_prec (x, 50);
+ mpfr_set_prec (y, 100);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 21, MPFR_RNDN);
+ mpfr_nextabove (y); /* 21 + 2^(-95) */
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ /* r should be 42 - 2*(21 + 2^(-95)) = -2^(-94) */
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -94) == 0);
+ MPFR_ASSERTN (q[0] == (long) 2);
+
+ /* exercise large quotient */
+ mpfr_set_ui_2exp (x, 1, 65, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ /* quotient is 2^65 */
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0);
+ MPFR_ASSERTN (q[0] % 1073741824L == 0L);
+
+ /* another large quotient */
+ mpfr_set_prec (x, 65);
+ mpfr_set_prec (y, 65);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 63, MPFR_RNDN);
+ mpfr_const_log2 (y, MPFR_RNDN);
+ mpfr_set_prec (r, 10);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ /* q should be 41803643793084085130, r should be 605/2048 */
+ MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 605, -11) == 0);
+ MPFR_ASSERTN ((q[0] > 0) && ((q[0] % 1073741824L) == 733836170L));
+
+ /* check cases where quotient is 1.5 +/- eps */
+ mpfr_set_prec (x, 65);
+ mpfr_set_prec (y, 65);
+ mpfr_set_prec (r, 63);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ /* x/y = 1.5, quotient should be 2 (even rule), remainder should be -1 */
+ MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0);
+ MPFR_ASSERTN (q[0] == 2L);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_nextabove (x); /* 3 + 2^(-63) */
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ /* x/y = 1.5 + 2^(-64), quo should be 2, r should be -1 + 2^(-63) */
+ MPFR_ASSERTN (mpfr_add_ui (r, r, 1, MPFR_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_cmp_ui_2exp (r, 1, -63) == 0);
+ MPFR_ASSERTN (q[0] == 2L);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ mpfr_set_ui (y, 2, MPFR_RNDN);
+ mpfr_nextabove (y); /* 2 + 2^(-63) */
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ /* x/y = 1.5 - eps, quo should be 1, r should be 1 - 2^(-63) */
+ MPFR_ASSERTN (mpfr_sub_ui (r, r, 1, MPFR_RNDN) == 0);
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (r, -1, -63) == 0);
+ MPFR_ASSERTN (q[0] == 1L);
+
+ /* bug founds by Kaveh Ghazi, 3 May 2007 */
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_ui (y, 3, MPFR_RNDN);
+ mpfr_remainder (r, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (r, -1) == 0);
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remainder (r, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (r, 0) == 0 && MPFR_SIGN (r) < 0);
+
+ /* check argument reuse */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_remainder (x, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si (x, 0) == 0 && MPFR_SIGN (x) < 0);
+
+ mpfr_set_ui_2exp (x, 1, mpfr_get_emax () - 1, MPFR_RNDN);
+ mpfr_set_ui_2exp (y, 1, mpfr_get_emin (), MPFR_RNDN);
+ mpfr_remquo (r, q, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (r) && MPFR_SIGN (r) > 0);
+ MPFR_ASSERTN (q[0] == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (r);
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/trint.c b/tests/trint.c
new file mode 100644
index 0000000..5382d21
--- /dev/null
+++ b/tests/trint.c
@@ -0,0 +1,448 @@
+/* Test file for mpfr_rint, mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round.
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#if __MPFR_STDC (199901L)
+# include <math.h>
+#endif
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emax;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1);
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) < 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y));
+
+ /* coverage test */
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, mp_bits_per_limb, MPFR_RNDN);
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ /* another coverage test */
+ emax = mpfr_get_emax ();
+ set_emax (1);
+ mpfr_set_prec (x, 3);
+ mpfr_set_str_binary (x, "1.11E0");
+ mpfr_set_prec (y, 2);
+ mpfr_rint (y, x, MPFR_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */
+ MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
+ set_emax (emax);
+
+ /* yet another */
+ mpfr_set_prec (x, 97);
+ mpfr_set_prec (y, 96);
+ mpfr_set_str_binary (x, "-0.1011111001101111000111011100011100000110110110110000000111010001000101001111101010101011010111100E97");
+ mpfr_rint (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "0.10101100000000101001010101111111000000011111010000010E-1");
+ mpfr_rint (y, x, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
+ mpfr_rint (y, x, MPFR_RNDD);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS(y));
+
+ mpfr_set_prec (x, 36);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str_binary (x, "-11000110101010111111110111001.0000100");
+ mpfr_rint (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-11E27");
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ mpfr_set_prec (x, 39);
+ mpfr_set_prec (y, 29);
+ mpfr_set_str_binary (x, "-0.100010110100011010001111001001001100111E39");
+ mpfr_rint (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.10001011010001101000111100101E39");
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ mpfr_set_prec (x, 46);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "-0.1011100110100101000001011111101011001001101001E32");
+ mpfr_rint (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.10111001101001010000010111111011E32");
+ MPFR_ASSERTN(mpfr_cmp (y, x) == 0);
+
+ /* coverage test for mpfr_round */
+ mpfr_set_prec (x, 3);
+ mpfr_set_str_binary (x, "1.01E1"); /* 2.5 */
+ mpfr_set_prec (y, 2);
+ mpfr_round (y, x);
+ /* since mpfr_round breaks ties away, should give 3 and not 2 as with
+ the "round to even" rule */
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 3) == 0);
+ /* same test for the function */
+ (mpfr_round) (y, x);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 3) == 0);
+
+ mpfr_set_prec (x, 6);
+ mpfr_set_prec (y, 3);
+ mpfr_set_str_binary (x, "110.111");
+ mpfr_round (y, x);
+ if (mpfr_cmp_ui (y, 7))
+ {
+ printf ("Error in round(110.111)\n");
+ exit (1);
+ }
+
+ /* Bug found by Mark J Watkins */
+ mpfr_set_prec (x, 84);
+ mpfr_set_str_binary (x,
+ "0.110011010010001000000111101101001111111100101110010000000000000" \
+ "000000000000000000000E32");
+ mpfr_round (x, x);
+ if (mpfr_cmp_str (x, "0.1100110100100010000001111011010100000000000000" \
+ "00000000000000000000000000000000000000E32", 2, MPFR_RNDN))
+ {
+ printf ("Rounding error when dest=src\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#if __MPFR_STDC (199901L)
+
+static void
+test_fct (double (*f)(double), int (*g)(), char *s, mpfr_rnd_t r)
+{
+ double d, y;
+ mpfr_t dd, yy;
+
+ mpfr_init2 (dd, 53);
+ mpfr_init2 (yy, 53);
+ for (d = -5.0; d <= 5.0; d += 0.25)
+ {
+ mpfr_set_d (dd, d, r);
+ y = (*f)(d);
+ if (g == &mpfr_rint)
+ mpfr_rint (yy, dd, r);
+ else
+ (*g)(yy, dd);
+ mpfr_set_d (dd, y, r);
+ if (mpfr_cmp (yy, dd))
+ {
+ printf ("test_against_libc: incorrect result for %s, rnd = %s,"
+ " d = %g\ngot ", s, mpfr_print_rnd_mode (r), d);
+ mpfr_out_str (stdout, 10, 0, yy, MPFR_RNDN);
+ printf (" instead of %g\n", y);
+ exit (1);
+ }
+ }
+ mpfr_clear (dd);
+ mpfr_clear (yy);
+}
+
+#define TEST_FCT(F) test_fct (&F, &mpfr_##F, #F, r)
+
+static void
+test_against_libc (void)
+{
+ mpfr_rnd_t r = MPFR_RNDN;
+
+#if HAVE_ROUND
+ TEST_FCT (round);
+#endif
+#if HAVE_TRUNC
+ TEST_FCT (trunc);
+#endif
+#if HAVE_FLOOR
+ TEST_FCT (floor);
+#endif
+#if HAVE_CEIL
+ TEST_FCT (ceil);
+#endif
+#if HAVE_NEARBYINT
+ for (r = 0; r < MPFR_RND_MAX ; r++)
+ if (mpfr_set_machine_rnd_mode (r) == 0)
+ test_fct (&nearbyint, &mpfr_rint, "rint", r);
+#endif
+}
+
+#endif
+
+static void
+err (const char *str, mp_size_t s, mpfr_t x, mpfr_t y, mpfr_prec_t p,
+ mpfr_rnd_t r, int trint, int inexact)
+{
+ printf ("Error: %s\ns = %u, p = %u, r = %s, trint = %d, inexact = %d\nx = ",
+ str, (unsigned int) s, (unsigned int) p, mpfr_print_rnd_mode (r),
+ trint, inexact);
+ mpfr_print_binary (x);
+ printf ("\ny = ");
+ mpfr_print_binary (y);
+ printf ("\n");
+ exit (1);
+}
+
+static void
+coverage_03032011 (void)
+{
+ mpfr_t in, out, cmp;
+ int status;
+ int precIn;
+ char strData[(GMP_NUMB_BITS * 4)+256];
+
+ precIn = GMP_NUMB_BITS * 4;
+
+ mpfr_init2 (in, precIn);
+ mpfr_init2 (out, GMP_NUMB_BITS);
+ mpfr_init2 (cmp, GMP_NUMB_BITS);
+
+ /* cmp = "0.1EprecIn+2" */
+ /* The buffer size is sufficient, as precIn is small in practice. */
+ sprintf (strData, "0.1E%d", precIn+2);
+ mpfr_set_str_binary (cmp, strData);
+
+ /* in = "0.10...01EprecIn+2" use all (precIn) significand bits */
+ memset ((void *)strData, '0', precIn+2);
+ strData[1] = '.';
+ strData[2] = '1';
+ sprintf (&strData[precIn+1], "1E%d", precIn+2);
+ mpfr_set_str_binary (in, strData);
+
+ status = mpfr_rint (out, in, MPFR_RNDN);
+ if ((mpfr_cmp (out, cmp) != 0) || (status >= 0))
+ {
+ printf("mpfr_rint error :\n status is %d instead of 0\n", status);
+ printf(" out value is ");
+ mpfr_dump(out);
+ printf(" instead of ");
+ mpfr_dump(cmp);
+ exit (1);
+ }
+
+ mpfr_clear (cmp);
+ mpfr_clear (out);
+
+ mpfr_init2 (out, GMP_NUMB_BITS);
+ mpfr_init2 (cmp, GMP_NUMB_BITS);
+
+ /* cmp = "0.10...01EprecIn+2" use all (GMP_NUMB_BITS) significand bits */
+ strcpy (&strData[GMP_NUMB_BITS+1], &strData[precIn+1]);
+ mpfr_set_str_binary (cmp, strData);
+
+ (MPFR_MANT(in))[2] = MPFR_LIMB_HIGHBIT;
+ status = mpfr_rint (out, in, MPFR_RNDN);
+
+ if ((mpfr_cmp (out, cmp) != 0) || (status <= 0))
+ {
+ printf("mpfr_rint error :\n status is %d instead of 0\n", status);
+ printf(" out value is\n");
+ mpfr_dump(out);
+ printf(" instead of\n");
+ mpfr_dump(cmp);
+ exit (1);
+ }
+
+ mpfr_clear (cmp);
+ mpfr_clear (out);
+ mpfr_clear (in);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mp_size_t s;
+ mpz_t z;
+ mpfr_prec_t p;
+ mpfr_t x, y, t, u, v;
+ int r;
+ int inexact, sign_t;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpz_init (z);
+ mpfr_init (t);
+ mpfr_init (u);
+ mpfr_init (v);
+ mpz_set_ui (z, 1);
+ for (s = 2; s < 100; s++)
+ {
+ /* z has exactly s bits */
+
+ mpz_mul_2exp (z, z, 1);
+ if (randlimb () % 2)
+ mpz_add_ui (z, z, 1);
+ mpfr_set_prec (x, s);
+ mpfr_set_prec (t, s);
+ mpfr_set_prec (u, s);
+ if (mpfr_set_z (x, z, MPFR_RNDN))
+ {
+ printf ("Error: mpfr_set_z should be exact (s = %u)\n",
+ (unsigned int) s);
+ exit (1);
+ }
+ if (randlimb () % 2)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (randlimb () % 2)
+ mpfr_div_2ui (x, x, randlimb () % s, MPFR_RNDN);
+ for (p = 2; p < 100; p++)
+ {
+ int trint;
+ mpfr_set_prec (y, p);
+ mpfr_set_prec (v, p);
+ for (r = 0; r < MPFR_RND_MAX ; r++)
+ for (trint = 0; trint < 3; trint++)
+ {
+ if (trint == 2)
+ inexact = mpfr_rint (y, x, (mpfr_rnd_t) r);
+ else if (r == MPFR_RNDN)
+ inexact = mpfr_round (y, x);
+ else if (r == MPFR_RNDZ)
+ inexact = (trint ? mpfr_trunc (y, x) :
+ mpfr_rint_trunc (y, x, MPFR_RNDZ));
+ else if (r == MPFR_RNDU)
+ inexact = (trint ? mpfr_ceil (y, x) :
+ mpfr_rint_ceil (y, x, MPFR_RNDU));
+ else /* r = MPFR_RNDD */
+ inexact = (trint ? mpfr_floor (y, x) :
+ mpfr_rint_floor (y, x, MPFR_RNDD));
+ if (mpfr_sub (t, y, x, MPFR_RNDN))
+ err ("subtraction 1 should be exact",
+ s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ sign_t = mpfr_cmp_ui (t, 0);
+ if (trint != 0 &&
+ (((inexact == 0) && (sign_t != 0)) ||
+ ((inexact < 0) && (sign_t >= 0)) ||
+ ((inexact > 0) && (sign_t <= 0))))
+ err ("wrong inexact flag", s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ if (inexact == 0)
+ continue; /* end of the test for exact results */
+
+ if (((r == MPFR_RNDD || (r == MPFR_RNDZ && MPFR_SIGN (x) > 0))
+ && inexact > 0) ||
+ ((r == MPFR_RNDU || (r == MPFR_RNDZ && MPFR_SIGN (x) < 0))
+ && inexact < 0))
+ err ("wrong rounding direction",
+ s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ if (inexact < 0)
+ {
+ mpfr_add_ui (v, y, 1, MPFR_RNDU);
+ if (mpfr_cmp (v, x) <= 0)
+ err ("representable integer between x and its "
+ "rounded value", s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ }
+ else
+ {
+ mpfr_sub_ui (v, y, 1, MPFR_RNDD);
+ if (mpfr_cmp (v, x) >= 0)
+ err ("representable integer between x and its "
+ "rounded value", s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ }
+ if (r == MPFR_RNDN)
+ {
+ int cmp;
+ if (mpfr_sub (u, v, x, MPFR_RNDN))
+ err ("subtraction 2 should be exact",
+ s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ cmp = mpfr_cmp_abs (t, u);
+ if (cmp > 0)
+ err ("faithful rounding, but not the nearest integer",
+ s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ if (cmp < 0)
+ continue;
+ /* |t| = |u|: x is the middle of two consecutive
+ representable integers. */
+ if (trint == 2)
+ {
+ /* halfway case for mpfr_rint in MPFR_RNDN rounding
+ mode: round to an even integer or significand. */
+ mpfr_div_2ui (y, y, 1, MPFR_RNDZ);
+ if (!mpfr_integer_p (y))
+ err ("halfway case for mpfr_rint, result isn't an"
+ " even integer", s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ /* If floor(x) and ceil(x) aren't both representable
+ integers, the significand must be even. */
+ mpfr_sub (v, v, y, MPFR_RNDN);
+ mpfr_abs (v, v, MPFR_RNDN);
+ if (mpfr_cmp_ui (v, 1) != 0)
+ {
+ mpfr_div_2si (y, y, MPFR_EXP (y) - MPFR_PREC (y)
+ + 1, MPFR_RNDN);
+ if (!mpfr_integer_p (y))
+ err ("halfway case for mpfr_rint, significand isn't"
+ " even", s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ }
+ }
+ else
+ { /* halfway case for mpfr_round: x must have been
+ rounded away from zero. */
+ if ((MPFR_SIGN (x) > 0 && inexact < 0) ||
+ (MPFR_SIGN (x) < 0 && inexact > 0))
+ err ("halfway case for mpfr_round, bad rounding"
+ " direction", s, x, y, p, (mpfr_rnd_t) r, trint, inexact);
+ }
+ }
+ }
+ }
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpz_clear (z);
+ mpfr_clear (t);
+ mpfr_clear (u);
+ mpfr_clear (v);
+
+ special ();
+ coverage_03032011 ();
+
+#if __MPFR_STDC (199901L)
+ if (argc > 1 && strcmp (argv[1], "-s") == 0)
+ test_against_libc ();
+#endif
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/troot.c b/tests/troot.c
new file mode 100644
index 0000000..f2117b4
--- /dev/null
+++ b/tests/troot.c
@@ -0,0 +1,334 @@
+/* Test file for mpfr_root.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+special (void)
+{
+ mpfr_t x, y;
+ int i;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* root(NaN) = NaN */
+ mpfr_set_nan (x);
+ mpfr_root (y, x, 17, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: root(NaN,17) <> NaN\n");
+ exit (1);
+ }
+
+ /* root(+Inf) = +Inf */
+ mpfr_set_inf (x, 1);
+ mpfr_root (y, x, 42, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: root(+Inf,42) <> +Inf\n");
+ exit (1);
+ }
+
+ /* root(-Inf, 17) = -Inf */
+ mpfr_set_inf (x, -1);
+ mpfr_root (y, x, 17, MPFR_RNDN);
+ if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: root(-Inf,17) <> -Inf\n");
+ exit (1);
+ }
+ /* root(-Inf, 42) = NaN */
+ mpfr_set_inf (x, -1);
+ mpfr_root (y, x, 42, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error: root(-Inf,42) <> -Inf\n");
+ exit (1);
+ }
+
+ /* root(+/-0) = +/-0 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_root (y, x, 17, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ {
+ printf ("Error: root(+0,17) <> +0\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_root (y, x, 42, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ {
+ printf ("Error: root(-0,42) <> -0\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN);
+ mpfr_root (x, x, 3, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "9.43166207799662426048e-01"))
+ {
+ printf ("Error in root3 (1)\n");
+ printf ("expected 9.43166207799662426048e-01\n");
+ printf ("got ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "0.10000100001100101001001001011001");
+ mpfr_root (x, x, 3, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.11001101011000100111000111111001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in root3 (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "-0.1100001110110000010101011001011");
+ mpfr_root (x, x, 3, MPFR_RNDD);
+ mpfr_set_str_binary (y, "-0.11101010000100100101000101011001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in root3 (3)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 82);
+ mpfr_set_prec (y, 27);
+ mpfr_set_str_binary (x, "0.1010001111011101011011000111001011001101100011110110010011011011011010011001100101e-7");
+ mpfr_root (y, x, 3, MPFR_RNDD);
+ mpfr_set_str_binary (x, "0.101011110001110001000100011E-2");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in root3 (4)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 204);
+ mpfr_set_prec (y, 38);
+ mpfr_set_str_binary (x, "0.101000000001101000000001100111111011111001110110100001111000100110100111001101100111110001110001011011010110010011100101111001111100001010010100111011101100000011011000101100010000000011000101001010001001E-5");
+ mpfr_root (y, x, 3, MPFR_RNDD);
+ mpfr_set_str_binary (x, "0.10001001111010011011101000010110110010E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in root3 (5)\n");
+ exit (1);
+ }
+
+ /* Worst case found on 2006-11-25 */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "1.0100001101101101001100110001001000000101001101100011E28");
+ mpfr_root (y, x, 35, MPFR_RNDN);
+ mpfr_set_str_binary (x, "1.1100000010110101100011101011000010100001101100100011E0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_root (y, x, 35, MPFR_RNDN) for\n"
+ "x = 1.0100001101101101001100110001001000000101001101100011E28\n"
+ "Expected ");
+ mpfr_dump (x);
+ printf ("Got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ /* Worst cases found on 2006-11-26 */
+ mpfr_set_str_binary (x, "1.1111010011101110001111010110000101110000110110101100E17");
+ mpfr_root (y, x, 36, MPFR_RNDD);
+ mpfr_set_str_binary (x, "1.0110100111010001101001010111001110010100111111000010E0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_root (y, x, 36, MPFR_RNDD) for\n"
+ "x = 1.1111010011101110001111010110000101110000110110101100E17\n"
+ "Expected ");
+ mpfr_dump (x);
+ printf ("Got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1.1100011101101101100010110001000001110001111110010000E23");
+ mpfr_root (y, x, 36, MPFR_RNDU);
+ mpfr_set_str_binary (x, "1.1001010100001110000110111111100011011101110011000100E0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_root (y, x, 36, MPFR_RNDU) for\n"
+ "x = 1.1100011101101101100010110001000001110001111110010000E23\n"
+ "Expected ");
+ mpfr_dump (x);
+ printf ("Got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* Check for k = 1 */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ i = mpfr_root (y, x, 1, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 17) || i != 0)
+ {
+ printf ("Error in root (17^(1/1))\n");
+ exit (1);
+ }
+
+#if 0
+ /* Check for k == 0:
+ For 0 <= x < 1 => +0.
+ For x = 1 => 1.
+ For x > 1, => +Inf.
+ For x < 0 => NaN. */
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
+ if (!MPFR_IS_INF (y) || !MPFR_IS_POS (y) || i != 0)
+ {
+ printf ("Error in root 17^(1/0)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1) || i != 0)
+ {
+ printf ("Error in root 1^(1/0)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0)
+ {
+ printf ("Error in root 0+^(1/0)\n");
+ exit (1);
+ }
+ MPFR_CHANGE_SIGN (x);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0)
+ {
+ printf ("Error in root 0-^(1/0)\n");
+ exit (1);
+ }
+ mpfr_set_ui_2exp (x, 17, -5, MPFR_RNDD);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (y) || !MPFR_IS_POS (y) || i != 0)
+ {
+ printf ("Error in root (17/2^5)^(1/0)\n");
+ exit (1);
+ }
+#endif
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ i = mpfr_root (y, x, 0, MPFR_RNDN);
+ if (!MPFR_IS_NAN (y) || i != 0)
+ {
+ printf ("Error in root 0+^(1/0)\n");
+ exit (1);
+ }
+ /* Check for k==2 */
+ mpfr_set_si (x, -17, MPFR_RNDD);
+ i = mpfr_root (y, x, 2, MPFR_RNDN);
+ if (!MPFR_IS_NAN (y) || i != 0)
+ {
+ printf ("Error in root (-17)^(1/2)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_root
+#define INTEGER_TYPE unsigned long
+#define INT_RAND_FUNCTION() (INTEGER_TYPE) (randlimb () % 3 +2)
+#include "tgeneric_ui.c"
+
+int
+main (void)
+{
+ mpfr_t x;
+ int r;
+ mpfr_prec_t p;
+ unsigned long k;
+
+ tests_start_mpfr ();
+
+ special ();
+
+ mpfr_init (x);
+
+ for (p = 2; p < 100; p++)
+ {
+ mpfr_set_prec (x, p);
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ k = 2 + randlimb () % 4; /* 2 <= k <= 5 */
+ mpfr_root (x, x, k, (mpfr_rnd_t) r);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_root(%lu) for x=1, rnd=%s\ngot ",
+ k, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ if (k % 2)
+ {
+ mpfr_root (x, x, k, (mpfr_rnd_t) r);
+ if (mpfr_cmp_si (x, -1))
+ {
+ printf ("Error in mpfr_root(%lu) for x=-1, rnd=%s\ngot ",
+ k, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ }
+
+ if (p >= 5)
+ {
+ int i;
+ for (i = -12; i <= 12; i++)
+ {
+ mpfr_set_ui (x, 27, MPFR_RNDN);
+ mpfr_mul_2si (x, x, 3*i, MPFR_RNDN);
+ mpfr_root (x, x, 3, MPFR_RNDN);
+ if (mpfr_cmp_si_2exp (x, 3, i))
+ {
+ printf ("Error in mpfr_root(3) for "
+ "x = 27.0 * 2^(%d), rnd=%s\ngot ",
+ 3*i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\ninstead of 3 * 2^(%d)\n", i);
+ exit (1);
+ }
+ }
+ }
+ }
+ }
+ mpfr_clear (x);
+
+ test_generic_ui (2, 200, 30);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tround_prec.c b/tests/tround_prec.c
new file mode 100644
index 0000000..39f6ca1
--- /dev/null
+++ b/tests/tround_prec.c
@@ -0,0 +1,124 @@
+/* Test file for mpfr_prec_round.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x;
+ mpfr_exp_t emax;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+
+ mpfr_set_inf (x, 1);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x));
+
+ emax = mpfr_get_emax ();
+ set_emax (0);
+ mpfr_set_prec (x, 3);
+ mpfr_set_str_binary (x, "0.111");
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ set_emax (emax);
+
+ mpfr_set_prec (x, mp_bits_per_limb + 2);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_nextbelow (x);
+ mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_ui (x, 5, MPFR_RNDN);
+ mpfr_prec_round (x, 2, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 4))
+ {
+ printf ("Error in tround: got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (" instead of 4\n");
+ exit (1);
+ }
+
+ /* check case when reallocation is needed */
+ mpfr_set_prec (x, 3);
+ mpfr_set_ui (x, 5, MPFR_RNDN); /* exact */
+ mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 5))
+ {
+ printf ("Error in tround: got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (" instead of 5\n");
+ exit (1);
+ }
+
+ mpfr_clear(x);
+ mpfr_init2 (x, 3);
+ mpfr_set_si (x, -5, MPFR_RNDN); /* exact */
+ mpfr_prec_round (x, mp_bits_per_limb + 1, MPFR_RNDN);
+ if (mpfr_cmp_si(x, -5))
+ {
+ printf ("Error in tround: got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (" instead of -5\n");
+ exit (1);
+ }
+
+ /* check case when new precision needs less limbs */
+ mpfr_set_prec (x, mp_bits_per_limb + 1);
+ mpfr_set_ui (x, 5, MPFR_RNDN); /* exact */
+ mpfr_prec_round (x, 3, MPFR_RNDN); /* exact */
+ if (mpfr_cmp_ui(x, 5))
+ {
+ printf ("Error in tround: got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (" instead of 5\n");
+ exit (1);
+ }
+
+ mpfr_clear(x);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsec.c b/tests/tsec.c
new file mode 100644
index 0000000..4c2c7e9
--- /dev/null
+++ b/tests/tsec.c
@@ -0,0 +1,172 @@
+/* Test file for mpfr_sec.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_sec
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_sec (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sec(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_sec (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sec(Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_sec (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sec(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ /* sec(+/-0) = 1 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: sec(+0) != 1\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sec (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: sec(-0) != 1\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+overflowed_sec0 (void)
+{
+ mpfr_t x, y;
+ int emax, i, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (emax); /* 1 is not representable. */
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_sec (x, x, (mpfr_rnd_t) rnd);
+ if (! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overflowed_sec0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_specials ();
+
+ test_generic (2, 200, 10);
+ overflowed_sec0 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsech.c b/tests/tsech.c
new file mode 100644
index 0000000..98c0235
--- /dev/null
+++ b/tests/tsech.c
@@ -0,0 +1,190 @@
+/* Test file for mpfr_sech.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_sech
+#define TEST_RANDOM_EMIN -64
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+check_specials (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sech(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: sech(+Inf) != +0\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (! (MPFR_IS_ZERO (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: sech(-Inf) != +0\n");
+ exit (1);
+ }
+
+ /* sec(+/-0) = 1 */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: sech(+0) != 1\n");
+ exit (1);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error: sech(-0) != 1\n");
+ exit (1);
+ }
+
+ /* check huge x */
+ mpfr_set_str (x, "8e8", 10, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: sech(8e8) != +0\n");
+ exit (1);
+ }
+ mpfr_set_str (x, "-8e8", 10, MPFR_RNDN);
+ mpfr_sech (y, x, MPFR_RNDN);
+ if (! (mpfr_zero_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error: sech(-8e8) != +0\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+overflowed_sech0 (void)
+{
+ mpfr_t x, y;
+ int emax, i, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (y, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (y);
+ set_emax (emax); /* 1 is not representable. */
+ /* and if emax < 0, 1 - eps is not representable either. */
+ for (i = -1; i <= 1; i++)
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_sech (x, x, (mpfr_rnd_t) rnd);
+ if ((i == 0 || emax < 0 || rnd == MPFR_RNDN || rnd == MPFR_RNDU) &&
+ ! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex >= 0)
+ {
+ printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
+ " The inexact value must be negative.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (x, y))
+ {
+ printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex <= 0)
+ {
+ printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
+ " The inexact value must be positive.\n",
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (x) && MPFR_SIGN (x) > 0))
+ {
+ printf ("Error in overflowed_sech0 (i = %d, rnd = %s):\n"
+ " Got ", i, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_specials ();
+ test_generic (2, 200, 10);
+ overflowed_sech0 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset.c b/tests/tset.c
new file mode 100644
index 0000000..79d0385
--- /dev/null
+++ b/tests/tset.c
@@ -0,0 +1,209 @@
+/* Test file for mpfr_set.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int error;
+
+#define PRINT_ERROR_IF(condition, text) \
+ do { \
+ if (condition) \
+ { \
+ printf ("%s", text); \
+ error = 1; \
+ } \
+ } while (0)
+
+
+/* Maybe better create its own test file ? */
+static void
+check_neg_special (void)
+{
+ mpfr_t x;
+ mpfr_init (x);
+ MPFR_SET_NAN (x);
+ mpfr_clear_nanflag ();
+ mpfr_neg (x, x, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_nanflag_p (),
+ "ERROR: neg (NaN) doesn't set Nan flag.\n");
+ mpfr_clear (x);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_inf (x, 1);
+ PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) < 0,
+ "ERROR: mpfr_set_inf failed to set variable to +infinity.\n");
+ inexact = mpfr_set (y, x, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || inexact != 0,
+ "ERROR: mpfr_set failed to set variable to +infinity.\n");
+
+ inexact = mpfr_set_ui (y, 0, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_zero_p (y) || mpfr_sgn (y) < 0 || inexact != 0,
+ "ERROR: mpfr_set_ui failed to set variable to +0.\n");
+
+ mpfr_set_inf (x, -1);
+ PRINT_ERROR_IF (!mpfr_inf_p (x) || mpfr_sgn (x) > 0,
+ "ERROR: mpfr_set_inf failed to set variable to -infinity.\n");
+ inexact = mpfr_set (y, x, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_inf_p (y) || mpfr_sgn (y) > 0 || inexact != 0,
+ "ERROR: mpfr_set failed to set variable to -infinity.\n");
+
+ mpfr_set_zero (x, 1);
+ PRINT_ERROR_IF (!mpfr_zero_p (x) || mpfr_sgn (x) < 0,
+ "ERROR: mpfr_set_zero failed to set variable to +0.\n");
+ inexact = mpfr_set (y, x, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_zero_p (y) || mpfr_sgn (y) < 0 || inexact != 0,
+ "ERROR: mpfr_set failed to set variable to +0.\n");
+
+ mpfr_set_zero (x, -1);
+ PRINT_ERROR_IF (!mpfr_zero_p (x) || mpfr_sgn (x) > 0,
+ "ERROR: mpfr_set_zero failed to set variable to -0.\n");
+ inexact = mpfr_set (y, x, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_zero_p (y) || mpfr_sgn (y) > 0 || inexact != 0,
+ "ERROR: mpfr_set failed to set variable to -0.\n");
+
+ mpfr_set_nan (x);
+ PRINT_ERROR_IF (!mpfr_nan_p (x),
+ "ERROR: mpfr_set_nan failed to set variable to NaN.\n");
+ inexact = mpfr_set (y, x, MPFR_RNDN);
+ PRINT_ERROR_IF (!mpfr_nan_p (y) || inexact != 0,
+ "ERROR: mpfr_set failed to set variable to NaN.\n");
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_ternary_value (void)
+{
+ int p, q, rnd;
+ int inexact, cmp;
+ mpfr_t x, y;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ for (p=2; p<500; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_urandomb (x, RANDS);
+ if (randlimb () % 2)
+ mpfr_neg (x, x, MPFR_RNDN);
+ for (q=2; q<2*p; q++)
+ {
+ mpfr_set_prec (y, q);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ inexact = mpfr_set (y, x, (mpfr_rnd_t) rnd);
+ cmp = mpfr_cmp (y, x);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong ternary value in mpfr_set: expected %d,"
+ " got %d\n", cmp, inexact);
+ exit (1);
+ }
+ }
+ }
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_set
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z, u;
+ int inexact;
+ mpfr_exp_t emax;
+
+ tests_start_mpfr ();
+
+ /* Default : no error */
+ error = 0;
+
+ /* check prototypes of mpfr_init_set_* */
+ inexact = mpfr_init_set_si (x, -1, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_init_set (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_init_set_ui (z, 1, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ inexact = mpfr_init_set_d (u, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+
+ emax = mpfr_get_emax ();
+ set_emax (0);
+ mpfr_set_prec (x, 3);
+ mpfr_set_str_binary (x, "0.111");
+ mpfr_set_prec (y, 2);
+ mpfr_set (y, x, MPFR_RNDU);
+ if (!(MPFR_IS_INF (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error for y=x=0.111 with px=3, py=2 and emax=0\nx=");
+ mpfr_dump (x);
+ printf ("y=");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ set_emax (emax);
+
+ mpfr_set_prec (y, 11);
+ mpfr_set_str_binary (y, "0.11111111100E-8");
+ mpfr_set_prec (x, 2);
+ mpfr_set (x, y, MPFR_RNDN);
+ mpfr_set_str_binary (y, "1.0E-8");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for y=0.11111111100E-8, prec=2, rnd=MPFR_RNDN\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (u);
+
+ check_ternary_value ();
+ check_special ();
+ check_neg_special ();
+
+ test_generic (2, 1000, 10);
+
+ tests_end_mpfr ();
+ return error;
+}
diff --git a/tests/tset_d.c b/tests/tset_d.c
new file mode 100644
index 0000000..74ec697
--- /dev/null
+++ b/tests/tset_d.c
@@ -0,0 +1,225 @@
+/* Test file for mpfr_set_d and mpfr_get_d.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y, z;
+ unsigned long k, n;
+ volatile double d;
+ double dd;
+
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+#ifndef MPFR_DOUBLE_SPEC
+ printf ("Warning! The MPFR_DOUBLE_SPEC macro is not defined. This means\n"
+ "that you do not have a conforming C implementation and problems\n"
+ "may occur with conversions between MPFR numbers and standard\n"
+ "floating-point types. Please contact the MPFR team.\n");
+#elif MPFR_DOUBLE_SPEC == 0
+ /*
+ printf ("The type 'double' of your C implementation does not seem to\n"
+ "correspond to the IEEE-754 double precision. Though code has\n"
+ "been written to support such implementations, tests have been\n"
+ "done only on IEEE-754 double-precision implementations and\n"
+ "conversions between MPFR numbers and standard floating-point\n"
+ "types may be inaccurate. You may wish to contact the MPFR team\n"
+ "for further testing.\n");
+ */
+ printf ("The type 'double' of your C implementation does not seem to\n"
+ "correspond to the IEEE-754 double precision. Such particular\n"
+ "implementations are not supported yet, and conversions between\n"
+ "MPFR numbers and standard floating-point types may be very\n"
+ "inaccurate.\n");
+ printf ("FLT_RADIX = %ld\n", (long) FLT_RADIX);
+ printf ("DBL_MANT_DIG = %ld\n", (long) DBL_MANT_DIG);
+ printf ("DBL_MIN_EXP = %ld\n", (long) DBL_MIN_EXP);
+ printf ("DBL_MAX_EXP = %ld\n", (long) DBL_MAX_EXP);
+#endif
+
+ mpfr_init (x);
+
+#if !defined(MPFR_ERRDIVZERO)
+ mpfr_set_nan (x);
+ d = mpfr_get_d (x, MPFR_RNDN);
+ if (! DOUBLE_ISNAN (d))
+ {
+ printf ("ERROR for NAN (1)\n");
+#ifdef MPFR_NANISNAN
+ printf ("The reason is that NAN == NAN. Please look at the configure "
+ "output\nand Section \"In case of problem\" of the INSTALL "
+ "file.\n");
+#endif
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
+ if (! mpfr_nan_p (x))
+ {
+ printf ("ERROR for NAN (2)\n");
+#ifdef MPFR_NANISNAN
+ printf ("The reason is that NAN == NAN. Please look at the configure "
+ "output\nand Section \"In case of problem\" of the INSTALL "
+ "file.\n");
+#endif
+ exit (1);
+ }
+#endif /* MPFR_ERRDIVZERO */
+
+ d = 0.0;
+ mpfr_set_d (x, d, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+ d = -d;
+ mpfr_set_d (x, d, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) != 0 || MPFR_IS_POS(x))
+ {
+ printf ("Error in mpfr_set_d on -0\n");
+ exit (1);
+ }
+
+#if !defined(MPFR_ERRDIVZERO)
+ mpfr_set_inf (x, 1);
+ d = mpfr_get_d (x, MPFR_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+
+ mpfr_set_inf (x, -1);
+ d = mpfr_get_d (x, MPFR_RNDN);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_set_d (x, d, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
+#endif /* MPFR_ERRDIVZERO */
+
+ mpfr_set_prec (x, 2);
+
+ /* checks that denormalized are not flushed to zero */
+ d = DBL_MIN; /* 2^(-1022) */
+ for (n=0; n<52; n++, d /= 2.0)
+ if (d != 0.0) /* should be 2^(-1022-n) */
+ {
+ mpfr_set_d (x, d, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (x, 1, -1022-n))
+ {
+ printf ("Wrong result for d=2^(%ld), ", -1022-n);
+ printf ("got ");
+ mpfr_out_str (stdout, 10, 10, x, MPFR_RNDN);
+ printf ("\n");
+ mpfr_print_binary (x);
+ puts ("");
+ exit (1);
+ }
+ }
+
+ /* checks that rounds to nearest sets the last
+ bit to zero in case of equal distance */
+ mpfr_set_d (x, 5.0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 4))
+ {
+ printf ("Error in tset_d: expected 4.0, got ");
+ mpfr_print_binary (x); putchar('\n');
+ exit (1);
+ }
+ mpfr_set_d (x, -5.0, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -4))
+ {
+ printf ("Error in tset_d: expected -4.0, got ");
+ mpfr_print_binary (x); putchar('\n');
+ exit (1);
+ }
+
+ mpfr_set_d (x, 9.84891017624509146344e-01, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in tset_d: expected 1.0, got ");
+ mpfr_print_binary (x); putchar('\n');
+ exit (1);
+ }
+
+ mpfr_init2 (z, 32);
+ mpfr_set_d (z, 1.0, (mpfr_rnd_t) 0);
+ if (mpfr_cmp_ui (z, 1))
+ {
+ mpfr_print_binary (z); puts ("");
+ printf ("Error: 1.0 != 1.0\n");
+ exit (1);
+ }
+ mpfr_set_prec (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_set_d (x, d=-1.08007920352320089721e+150, (mpfr_rnd_t) 0);
+ if (mpfr_get_d1 (x) != d)
+ {
+ mpfr_print_binary (x); puts ("");
+ printf ("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",
+ d, mpfr_get_d1 (x));
+ exit (1);
+ }
+
+ mpfr_set_d (x, 8.06294740693074521573e-310, (mpfr_rnd_t) 0);
+ d = -6.72658901114033715233e-165;
+ mpfr_set_d (x, d, (mpfr_rnd_t) 0);
+ if (d != mpfr_get_d1 (x))
+ {
+ mpfr_print_binary (x);
+ puts ("");
+ printf ("Error: get_d o set_d <> identity for d = %1.20e %1.20e\n",
+ d, mpfr_get_d1 (x));
+ exit (1);
+ }
+
+ n = (argc==1) ? 500000 : atoi(argv[1]);
+ for (k = 1; k <= n; k++)
+ {
+ do
+ {
+ d = DBL_RAND ();
+ }
+#ifdef HAVE_DENORMS
+ while (0);
+#else
+ while (ABS(d) < DBL_MIN);
+#endif
+ mpfr_set_d (x, d, (mpfr_rnd_t) 0);
+ dd = mpfr_get_d1 (x);
+ if (d != dd && !(Isnan(d) && Isnan(dd)))
+ {
+ printf ("Mismatch on : %1.18g != %1.18g\n", d, mpfr_get_d1 (x));
+ mpfr_print_binary (x);
+ puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset_exp.c b/tests/tset_exp.c
new file mode 100644
index 0000000..2939db8
--- /dev/null
+++ b/tests/tset_exp.c
@@ -0,0 +1,67 @@
+/* Test file for mpfr_set_exp.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ int ret;
+ mpfr_exp_t emin, emax;
+
+ tests_start_mpfr ();
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_init (x);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ ret = mpfr_set_exp (x, 2);
+ MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 2) == 0);
+
+ set_emin (-1);
+ ret = mpfr_set_exp (x, -1);
+ MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui_2exp (x, 1, -2) == 0);
+
+ set_emax (1);
+ ret = mpfr_set_exp (x, 1);
+ MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 1) == 0);
+
+ ret = mpfr_set_exp (x, -2);
+ MPFR_ASSERTN(ret != 0 && mpfr_cmp_ui (x, 1) == 0);
+
+ ret = mpfr_set_exp (x, 2);
+ MPFR_ASSERTN(ret != 0 && mpfr_cmp_ui (x, 1) == 0);
+
+ mpfr_clear (x);
+
+ set_emin (emin);
+ set_emax (emax);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset_f.c b/tests/tset_f.c
new file mode 100644
index 0000000..ea9c2ac
--- /dev/null
+++ b/tests/tset_f.c
@@ -0,0 +1,207 @@
+/* Test file for mpfr_set_f.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h> /* for ULONG_MAX */
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t x, u;
+ mpf_t y, z;
+ mpfr_exp_t emax;
+ unsigned long k, pr;
+ int r, inexact;
+
+ tests_start_mpfr ();
+
+ mpf_init (y);
+ mpf_init (z);
+
+ mpf_set_d (y, 0.0);
+
+ /* check prototype of mpfr_init_set_f */
+ mpfr_init_set_f (x, y, MPFR_RNDN);
+ mpfr_set_prec (x, 100);
+ mpfr_set_f (x, y, MPFR_RNDN);
+
+ mpf_urandomb (y, RANDS, 10 * GMP_NUMB_BITS);
+ mpfr_set_f (x, y, RND_RAND ());
+
+ /* bug found by Jean-Pierre Merlet */
+ mpfr_set_prec (x, 256);
+ mpf_set_prec (y, 256);
+ mpfr_init2 (u, 256);
+ mpfr_set_str (u,
+ "7.f10872b020c49ba5e353f7ced916872b020c49ba5e353f7ced916872b020c498@2",
+ 16, MPFR_RNDN);
+ mpf_set_str (y, "2033033E-3", 10); /* avoid 2033.033 which is
+ locale-sensitive */
+ mpfr_set_f (x, y, MPFR_RNDN);
+ if (mpfr_cmp (x, u))
+ {
+ printf ("mpfr_set_f failed for y=2033033E-3\n");
+ exit (1);
+ }
+ mpf_set_str (y, "-2033033E-3", 10); /* avoid -2033.033 which is
+ locale-sensitive */
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_neg (u, u, MPFR_RNDN);
+ if (mpfr_cmp (x, u))
+ {
+ printf ("mpfr_set_f failed for y=-2033033E-3\n");
+ exit (1);
+ }
+
+ mpf_set_prec (y, 300);
+ mpf_set_str (y, "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", -2);
+ mpf_mul_2exp (y, y, 600);
+ mpfr_set_prec (x, 300);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ if (mpfr_check (x) == 0)
+ {
+ printf ("Error in mpfr_set_f: corrupted result\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, 901) == 0);
+
+ /* random values */
+ for (k = 1; k <= 1000; k++)
+ {
+ pr = 2 + (randlimb () & 255);
+ mpf_set_prec (z, pr);
+ mpf_urandomb (z, RANDS, z->_mp_prec);
+ mpfr_set_prec (u, ((pr / GMP_NUMB_BITS + 1) * GMP_NUMB_BITS));
+ mpfr_set_f (u, z, MPFR_RNDN);
+ if (mpfr_cmp_f (u , z) != 0)
+ {
+ printf ("Error in mpfr_set_f:\n");
+ printf ("mpf (precision=%lu)=", pr);
+ mpf_out_str (stdout, 16, 0, z);
+ printf ("\nmpfr(precision=%lu)=",
+ ((pr / GMP_NUMB_BITS + 1) * GMP_NUMB_BITS));
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ mpfr_set_prec (x, pr);
+ mpfr_set_f (x, z, MPFR_RNDN);
+ mpfr_sub (u, u, x, MPFR_RNDN);
+ mpfr_abs (u, u, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (u, 1, -pr - 1) > 0)
+ {
+ printf ("Error in mpfr_set_f: precision=%lu\n", pr);
+ printf ("mpf =");
+ mpf_out_str (stdout, 16, 0, z);
+ printf ("\nmpfr=");
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ }
+
+ /* Check for +0 */
+ mpfr_set_prec (x, 53);
+ mpf_set_prec (y, 53);
+ mpf_set_ui (y, 0);
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ int i;
+ for (i = -1; i <= 1; i++)
+ {
+ if (i)
+ mpfr_set_si (x, i, MPFR_RNDN);
+ inexact = mpfr_set_f (x, y, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
+ {
+ printf ("mpfr_set_f(x,0) failed for %s, i = %d\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i);
+ exit (1);
+ }
+ }
+ }
+
+ /* coverage test */
+ mpf_set_prec (y, 2);
+ mpfr_set_prec (x, 3 * mp_bits_per_limb);
+ mpf_set_ui (y, 1);
+ for (r = 0; r < mp_bits_per_limb; r++)
+ {
+ mpfr_urandomb (x, RANDS); /* to fill low limbs with random data */
+ inexact = mpfr_set_f (x, y, MPFR_RNDN);
+ MPFR_ASSERTN(inexact == 0 && mpfr_cmp_ui_2exp (x, 1, r) == 0);
+ mpf_mul_2exp (y, y, 1);
+ }
+
+ mpf_set_ui (y, 1);
+ mpf_mul_2exp (y, y, ULONG_MAX);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_set_ui (u, 1, MPFR_RNDN);
+ mpfr_mul_2ui (u, u, ULONG_MAX, MPFR_RNDN);
+ if (!mpfr_equal_p (x, u))
+ {
+ printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^ULONG_MAX\n");
+ exit (1);
+ }
+
+ emax = mpfr_get_emax ();
+
+ /* For mpf_mul_2exp, emax must fit in an unsigned long! */
+ if (emax >= 0 && emax <= ULONG_MAX)
+ {
+ mpf_set_ui (y, 1);
+ mpf_mul_2exp (y, y, emax);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_set_ui_2exp (u, 1, emax, MPFR_RNDN);
+ if (!mpfr_equal_p (x, u))
+ {
+ printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^emax\n");
+ exit (1);
+ }
+ }
+
+ /* For mpf_mul_2exp, emax - 1 must fit in an unsigned long! */
+ if (emax >= 1 && emax - 1 <= ULONG_MAX)
+ {
+ mpf_set_ui (y, 1);
+ mpf_mul_2exp (y, y, emax - 1);
+ mpfr_set_f (x, y, MPFR_RNDN);
+ mpfr_set_ui_2exp (u, 1, emax - 1, MPFR_RNDN);
+ if (!mpfr_equal_p (x, u))
+ {
+ printf ("Error: mpfr_set_f (x, y, MPFR_RNDN) for y = 2^(emax-1)\n");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (u);
+ mpf_clear (y);
+ mpf_clear (z);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset_ld.c b/tests/tset_ld.c
new file mode 100644
index 0000000..1e025aa
--- /dev/null
+++ b/tests/tset_ld.c
@@ -0,0 +1,312 @@
+/* Test file for mpfr_set_ld and mpfr_get_ld.
+
+Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+#include <limits.h>
+#ifdef WITH_FPU_CONTROL
+#include <fpu_control.h>
+#endif
+
+#include "mpfr-test.h"
+
+static void
+check_gcc33_bug (void)
+{
+ volatile long double x;
+ x = (long double) 9007199254740992.0 + 1.0;
+ if (x != 0.0)
+ return; /* OK */
+ printf
+ ("Detected optimization bug of gcc 3.3 on Alpha concerning long double\n"
+ "comparisons; set_ld tests might fail (set_ld won't work correctly).\n"
+ "See http://gcc.gnu.org/ml/gcc-bugs/2003-10/msg00853.html for more\n"
+ "information.\n");
+}
+
+static int
+Isnan_ld (long double d)
+{
+ double e = (double) d;
+ if (DOUBLE_ISNAN (e))
+ return 1;
+ LONGDOUBLE_NAN_ACTION (d, goto yes);
+ return 0;
+ yes:
+ return 1;
+}
+
+/* checks that a long double converted to a mpfr (with precision >=113),
+ then converted back to a long double gives the initial value,
+ or in other words mpfr_get_ld(mpfr_set_ld(d)) = d.
+*/
+static void
+check_set_get (long double d, mpfr_t x)
+{
+ int r;
+ long double e;
+ int inex;
+
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ inex = mpfr_set_ld (x, d, (mpfr_rnd_t) r);
+ if (inex != 0)
+ {
+ mpfr_exp_t emin, emax;
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+ printf ("Error: mpfr_set_ld should be exact\n");
+ printf ("d=%1.30Le inex=%d\n", d, inex);
+ if (emin >= LONG_MIN)
+ printf ("emin=%ld\n", (long) emin);
+ if (emax <= LONG_MAX)
+ printf ("emax=%ld\n", (long) emax);
+ mpfr_dump (x);
+ exit (1);
+ }
+ e = mpfr_get_ld (x, (mpfr_rnd_t) r);
+ if ((Isnan_ld(d) && ! Isnan_ld(e)) ||
+ (Isnan_ld(e) && ! Isnan_ld(d)) ||
+ (e != d && !(Isnan_ld(e) && Isnan_ld(d))))
+ {
+ printf ("Error: mpfr_get_ld o mpfr_set_ld <> Id\n");
+ printf (" r=%d\n", r);
+ printf (" d=%1.30Le get_ld(set_ld(d))=%1.30Le\n", d, e);
+ ld_trace (" d", d);
+ printf (" x="); mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN);
+ printf ("\n");
+ ld_trace (" e", e);
+#ifdef MPFR_NANISNAN
+ if (Isnan_ld(d) || Isnan_ld(e))
+ printf ("The reason is that NAN == NAN. Please look at the "
+ "configure output\nand Section \"In case of problem\" "
+ "of the INSTALL file.\n");
+#endif
+ exit (1);
+ }
+ }
+}
+
+static void
+test_small (void)
+{
+ mpfr_t x, y, z;
+ long double d;
+
+ mpfr_init2 (x, 64);
+ mpfr_init2 (y, 64);
+ mpfr_init2 (z, 64);
+
+ /* x = 11906603631607553907/2^(16381+64) */
+ mpfr_set_str (x, "0.1010010100111100110000001110101101000111010110000001111101110011E-16381", 2, MPFR_RNDN);
+ d = mpfr_get_ld (x, MPFR_RNDN); /* infinite loop? */
+ mpfr_set_ld (y, d, MPFR_RNDN);
+ mpfr_sub (z, x, y, MPFR_RNDN);
+ mpfr_abs (z, z, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ /* If long double = double, d should be equal to 0;
+ in this case, everything is OK. */
+ if (d != 0 && (mpfr_cmp_str (z, "1E-16434", 2, MPFR_RNDN) > 0 ||
+ mpfr_erangeflag_p ()))
+ {
+ printf ("Error with x = ");
+ mpfr_out_str (NULL, 10, 21, x, MPFR_RNDN);
+ printf (" = ");
+ mpfr_out_str (NULL, 16, 0, x, MPFR_RNDN);
+ printf ("\n -> d = %.21Lg", d);
+ printf ("\n -> y = ");
+ mpfr_out_str (NULL, 10, 21, y, MPFR_RNDN);
+ printf (" = ");
+ mpfr_out_str (NULL, 16, 0, y, MPFR_RNDN);
+ printf ("\n -> |x-y| = ");
+ mpfr_out_str (NULL, 16, 0, z, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+test_fixed_bugs (void)
+{
+ mpfr_t x;
+ long double l, m;
+
+ /* bug found by Steve Kargl (2009-03-14) */
+ mpfr_init2 (x, 64);
+ mpfr_set_ui_2exp (x, 1, -16447, MPFR_RNDN);
+ mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
+
+ /* bug reported by Jakub Jelinek (2010-10-17)
+ https://gforge.inria.fr/tracker/?func=detail&aid=11300 */
+ mpfr_set_prec (x, MPFR_LDBL_MANT_DIG);
+ /* l = 0x1.23456789abcdef0123456789abcdp-914L; */
+ l = 8.215640181713713164092636634579e-276;
+ mpfr_set_ld (x, l, MPFR_RNDN);
+ m = mpfr_get_ld (x, MPFR_RNDN);
+ if (m != l)
+ {
+ printf ("Error in get_ld o set_ld for l=%Le\n", l);
+ printf ("Got m=%Le instead of l\n", m);
+ exit (1);
+ }
+
+ /* another similar test which failed with extended double precision and the
+ generic code for mpfr_set_ld */
+ /* l = 0x1.23456789abcdef0123456789abcdp-968L; */
+ l = 4.560596445887084662336528403703e-292;
+ mpfr_set_ld (x, l, MPFR_RNDN);
+ m = mpfr_get_ld (x, MPFR_RNDN);
+ if (m != l)
+ {
+ printf ("Error in get_ld o set_ld for l=%Le\n", l);
+ printf ("Got m=%Le instead of l\n", m);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ long double d, e;
+ mpfr_t x;
+ int i;
+ mpfr_exp_t emax;
+#ifdef WITH_FPU_CONTROL
+ fpu_control_t cw;
+
+ if (argc > 1)
+ {
+ cw = strtol(argv[1], NULL, 0);
+ printf ("FPU control word: 0x%x\n", (unsigned int) cw);
+ _FPU_SETCW (cw);
+ }
+#endif
+
+ check_gcc33_bug ();
+ test_fixed_bugs ();
+
+ tests_start_mpfr ();
+ mpfr_test_init ();
+
+ mpfr_init2 (x, MPFR_LDBL_MANT_DIG);
+
+#if !defined(MPFR_ERRDIVZERO)
+ /* check NaN */
+ mpfr_set_nan (x);
+ d = mpfr_get_ld (x, MPFR_RNDN);
+ check_set_get (d, x);
+#endif
+
+ /* check +0.0 and -0.0 */
+ d = 0.0;
+ check_set_get (d, x);
+ d = DBL_NEG_ZERO;
+ check_set_get (d, x);
+
+ /* check that the sign of -0.0 is set */
+ mpfr_set_ld (x, DBL_NEG_ZERO, MPFR_RNDN);
+ if (MPFR_SIGN(x) > 0)
+ {
+ printf ("Error: sign of -0.0 is not set correctly\n");
+#if _GMP_IEEE_FLOATS
+ exit (1);
+ /* Non IEEE doesn't support negative zero yet */
+#endif
+ }
+
+#if !defined(MPFR_ERRDIVZERO)
+ /* check +Inf */
+ mpfr_set_inf (x, 1);
+ d = mpfr_get_ld (x, MPFR_RNDN);
+ check_set_get (d, x);
+
+ /* check -Inf */
+ mpfr_set_inf (x, -1);
+ d = mpfr_get_ld (x, MPFR_RNDN);
+ check_set_get (d, x);
+#endif
+
+ /* check the largest power of two */
+ d = 1.0; while (d < LDBL_MAX / 2.0) d += d;
+ check_set_get (d, x);
+ check_set_get (-d, x);
+
+ /* check largest long double */
+ d = LDBL_MAX;
+ check_set_get (d, x);
+ check_set_get (-d, x);
+
+ /* check the smallest power of two */
+ d = 1.0;
+ while ((e = d / 2.0) != (long double) 0.0 && e != d)
+ d = e;
+ check_set_get (d, x);
+ check_set_get (-d, x);
+
+ /* check largest 2^(2^k) that is representable as a long double */
+ d = (LDBL_MAX / 2) + (LDBL_MAX / 4 * LDBL_EPSILON);
+ check_set_get (d, x);
+
+ /* check that 2^i, 2^i+1 and 2^i-1 are correctly converted */
+ d = 1.0;
+ for (i = 1; i < MPFR_LDBL_MANT_DIG; i++)
+ {
+ d = 2.0 * d; /* d = 2^i */
+ check_set_get (d, x);
+ check_set_get (d + 1.0, x);
+ check_set_get (d - 1.0, x);
+ }
+
+ for (i = 0; i < 10000; i++)
+ {
+ mpfr_urandomb (x, RANDS);
+ d = mpfr_get_ld (x, MPFR_RNDN);
+ check_set_get (d, x);
+ }
+
+ /* check with reduced emax to exercise overflow */
+ emax = mpfr_get_emax ();
+ mpfr_set_prec (x, 2);
+ set_emax (1);
+ mpfr_set_ld (x, (long double) 2.0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ for (d = (long double) 2.0, i = 0; i < 13; i++, d *= d);
+ /* now d = 2^8192 */
+ mpfr_set_ld (x, d, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ set_emax (emax);
+
+ mpfr_clear (x);
+
+ test_small ();
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tset_q.c b/tests/tset_q.c
new file mode 100644
index 0000000..905b877
--- /dev/null
+++ b/tests/tset_q.c
@@ -0,0 +1,170 @@
+/* Test file for mpfr_set_q.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check (long int n, long int d, mpfr_rnd_t rnd, const char *ys)
+{
+ mpq_t q;
+ mpfr_t x, t;
+ int inexact, compare;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (t, mpfr_get_prec (x) + mp_bits_per_limb);
+ mpq_init (q);
+ mpq_set_si (q, n, d);
+ inexact = mpfr_set_q (x, q, rnd);
+
+ /* check values */
+ if (mpfr_cmp_str1(x, ys))
+ {
+ printf ("Error for q=%ld/%ld and rnd=%s\n", n, d,
+ mpfr_print_rnd_mode (rnd));
+ printf ("correct result is %s, mpfr_set_q gives ", ys);
+ mpfr_out_str(stdout, 10, 0, x, MPFR_RNDN);
+ putchar('\n');
+ exit (1);
+ }
+
+ /* check inexact flag */
+ if (mpfr_mul_ui (t, x, (d < 0) ? (-d) : d, rnd))
+ {
+ printf ("t <- x * d should be exact\n");
+ exit (1);
+ }
+ compare = mpfr_cmp_si (t, n);
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact < 0) && (compare >= 0)) ||
+ ((inexact > 0) && (compare <= 0)))
+ {
+ printf ("wrong inexact flag: expected %d, got %d\n", compare,
+ inexact);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (t);
+ mpq_clear (q);
+}
+
+static void
+check0 (void)
+{
+ mpq_t y;
+ mpfr_t x;
+ int inexact;
+ int r;
+
+ /* Check for +0 */
+ mpfr_init (x);
+ mpq_init (y);
+ mpq_set_si (y, 0, 1);
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ inexact = mpfr_set_q(x, y, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
+ {
+ printf("mpfr_set_q(x,0) failed for %s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit(1);
+ }
+ }
+ mpfr_clear (x);
+ mpq_clear (y);
+}
+
+static void
+check_nan_inf_mpq (void)
+{
+ mpfr_t mpfr_value, mpfr_cmp;
+ mpq_t mpq_value;
+ int status;
+
+ mpfr_init2 (mpfr_value, MPFR_PREC_MIN);
+ mpq_init (mpq_value);
+ mpq_set_si (mpq_value, 0, 0);
+ mpz_set_si (mpq_denref (mpq_value), 0);
+
+ status = mpfr_set_q (mpfr_value, mpq_value, MPFR_RNDN);
+
+ if ((status != 0) || (!MPFR_IS_NAN (mpfr_value)))
+ {
+ mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN);
+ mpfr_set_nan (mpfr_cmp);
+ printf ("mpfr_set_q with a NAN mpq value returned a wrong value :\n"
+ " waiting for ");
+ mpfr_print_binary (mpfr_cmp);
+ printf (" got ");
+ mpfr_print_binary (mpfr_value);
+ printf ("\n trinary value is %d\n", status);
+ exit (1);
+ }
+
+ mpq_set_si (mpq_value, -1, 0);
+ mpz_set_si (mpq_denref (mpq_value), 0);
+
+ status = mpfr_set_q (mpfr_value, mpq_value, MPFR_RNDN);
+
+ if ((status != 0) || (!MPFR_IS_INF (mpfr_value)) ||
+ (MPFR_SIGN(mpfr_value) != mpq_sgn(mpq_value)))
+ {
+ mpfr_init2 (mpfr_cmp, MPFR_PREC_MIN);
+ mpfr_set_inf (mpfr_cmp, -1);
+ printf ("mpfr_set_q with a -INF mpq value returned a wrong value :\n"
+ " waiting for ");
+ mpfr_print_binary (mpfr_cmp);
+ printf (" got ");
+ mpfr_print_binary (mpfr_value);
+ printf ("\n trinary value is %d\n", status);
+ exit (1);
+ }
+
+ mpq_clear (mpq_value);
+ mpfr_clear (mpfr_value);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ check(-1647229822, 40619231, MPFR_RNDZ, "-4.055295438754120596e1");
+ check(-148939696, 1673285490, MPFR_RNDZ, "-8.9010331404953485501e-2");
+ check(-441322590, 273662545, MPFR_RNDZ, "-1.6126525096812205362");
+ check(-1631156895, 1677687197, MPFR_RNDU, "-9.722652100563177191e-1");
+ check(2141332571, 3117601, MPFR_RNDZ, "6.8685267004982347316e2");
+ check(75504803, 400207282, MPFR_RNDU, "1.8866424074712365155e-1");
+ check(643562308, 23100894, MPFR_RNDD, "2.7858762002890447462e1");
+ check(632549085, 1831935802, MPFR_RNDN, "3.4528998467600230393e-1");
+ check (1, 1, MPFR_RNDN, "1.0");
+
+ check0();
+
+ check_nan_inf_mpq ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset_si.c b/tests/tset_si.c
new file mode 100644
index 0000000..b9ca0ea
--- /dev/null
+++ b/tests/tset_si.c
@@ -0,0 +1,464 @@
+/* Test file for mpfr_set_si and mpfr_set_ui.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+#define ERROR(str) {printf("Error for "str"\n"); exit(1);}
+
+static void
+test_2exp (void)
+{
+ mpfr_t x;
+ int res;
+
+ mpfr_init2 (x, 32);
+
+ mpfr_set_ui_2exp (x, 1, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 1))
+ ERROR("(1U,0)");
+
+ mpfr_set_ui_2exp (x, 1024, -10, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 1))
+ ERROR("(1024U,-10)");
+
+ mpfr_set_ui_2exp (x, 1024, 10, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 1024*1024))
+ ERROR("(1024U,+10)");
+
+ mpfr_set_si_2exp (x, -1024L * 1024L, -10, MPFR_RNDN);
+ if (mpfr_cmp_si(x, -1024))
+ ERROR("(1M,-10)");
+
+ mpfr_set_ui_2exp (x, 0x92345678, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN))
+ ERROR("(x92345678U,+16)");
+
+ mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN))
+ ERROR("(-x1ABCDEF0,-256)");
+
+ mpfr_set_prec (x, 2);
+ res = mpfr_set_si_2exp (x, 7, 10, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1<<13) || res <= 0)
+ ERROR ("Prec 2 + si_2exp");
+
+ res = mpfr_set_ui_2exp (x, 7, 10, MPFR_RNDU);
+ if (mpfr_cmp_ui (x, 1<<13) || res <= 0)
+ ERROR ("Prec 2 + ui_2exp");
+
+ mpfr_clear_flags ();
+ mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN);
+ if (!mpfr_inf_p (x) || MPFR_IS_NEG (x))
+ ERROR ("mpfr_set_ui_2exp and overflow (bad result)");
+ if (!mpfr_overflow_p ())
+ ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)");
+
+ mpfr_clear_flags ();
+ mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN);
+ if (!mpfr_inf_p (x) || MPFR_IS_NEG (x))
+ ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)");
+ if (!mpfr_overflow_p ())
+ ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)");
+
+ mpfr_clear_flags ();
+ mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, MPFR_RNDN);
+ if (!mpfr_inf_p (x) || MPFR_IS_POS (x))
+ ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)");
+ if (!mpfr_overflow_p ())
+ ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)");
+
+ mpfr_clear (x);
+}
+
+static void
+test_macros (void)
+{
+ mpfr_t x[3];
+ mpfr_ptr p;
+ int r;
+
+ mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
+ p = x[0];
+ r = 0;
+ mpfr_set_ui (p++, 0, (mpfr_rnd_t) r++);
+ if (p != x[1] || r != 1)
+ {
+ printf ("Error in mpfr_set_ui macro: p - x[0] = %d (expecting 1), "
+ "r = %d (expecting 1)\n", (int) (p - x[0]), r);
+ exit (1);
+ }
+ p = x[0];
+ r = 0;
+ mpfr_set_si (p++, 0, (mpfr_rnd_t) r++);
+ if (p != x[1] || r != 1)
+ {
+ printf ("Error in mpfr_set_si macro: p - x[0] = %d (expecting 1), "
+ "r = %d (expecting 1)\n", (int) (p - x[0]), r);
+ exit (1);
+ }
+ mpfr_clears (x[0], x[1], x[2], (mpfr_ptr) 0);
+}
+
+static void
+test_macros_keyword (void)
+{
+ mpfr_t x;
+ unsigned long i;
+
+ mpfr_init2 (x, 64);
+#define MKN 0x1000000
+#define long short
+ mpfr_set_ui (x, MKN, MPFR_RNDN);
+#undef long
+ i = mpfr_get_ui (x, MPFR_RNDN);
+ if (i != MKN)
+ {
+ printf ("Error in test_macros_keyword: expected 0x%lx, got 0x%lx.\n",
+ (unsigned long) MKN, i);
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
+/* FIXME: Comparing against mpfr_get_si/ui is not ideal, it'd be better to
+ have all tests examine the bits in mpfr_t for what should come out. */
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ long k, z, d, N;
+ unsigned long zl, dl;
+ int inex;
+ int r;
+ mpfr_exp_t emin, emax;
+ int flag;
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (x, 100);
+
+ N = (argc==1) ? 100000 : atol (argv[1]);
+
+ for (k = 1; k <= N; k++)
+ {
+ z = (long) (randlimb () & LONG_MAX) + LONG_MIN / 2;
+ inex = mpfr_set_si (x, z, MPFR_RNDZ);
+ d = mpfr_get_si (x, MPFR_RNDZ);
+ if (d != z)
+ {
+ printf ("Error in mpfr_set_si: expected %ld got %ld\n", z, d);
+ exit (1);
+ }
+ if (inex)
+ {
+ printf ("Error in mpfr_set_si: inex value incorrect for %ld: %d\n",
+ z, inex);
+ exit (1);
+ }
+ }
+
+ for (k = 1; k <= N; k++)
+ {
+ zl = randlimb ();
+ inex = mpfr_set_ui (x, zl, MPFR_RNDZ);
+ dl = mpfr_get_ui (x, MPFR_RNDZ);
+ if (dl != zl)
+ {
+ printf ("Error in mpfr_set_ui: expected %lu got %lu\n", zl, dl);
+ exit (1);
+ }
+ if (inex)
+ {
+ printf ("Error in mpfr_set_ui: inex value incorrect for %lu: %d\n",
+ zl, inex);
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (x, 2);
+ if (mpfr_set_si (x, 5, MPFR_RNDZ) >= 0)
+ {
+ printf ("Wrong inexact flag for x=5, rnd=MPFR_RNDZ\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ if (mpfr_set_si (x, -5, MPFR_RNDZ) <= 0)
+ {
+ printf ("Wrong inexact flag for x=-5, rnd=MPFR_RNDZ\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ inex = mpfr_set_si (x, 77617, MPFR_RNDD); /* should be 65536 */
+ if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1))
+ || inex >= 0)
+ {
+ printf ("Error in mpfr_set_si(x:3, 77617, MPFR_RNDD)\n");
+ mpfr_print_binary (x);
+ puts ("");
+ exit (1);
+ }
+ inex = mpfr_set_ui (x, 77617, MPFR_RNDD); /* should be 65536 */
+ if (MPFR_MANT(x)[0] != ((mp_limb_t)1 << (mp_bits_per_limb-1))
+ || inex >= 0)
+ {
+ printf ("Error in mpfr_set_ui(x:3, 77617, MPFR_RNDD)\n");
+ mpfr_print_binary (x);
+ puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ inex = mpfr_set_si (x, 33096, MPFR_RNDU);
+ if (mpfr_get_si (x, MPFR_RNDZ) != 49152 || inex <= 0)
+ {
+ printf ("Error in mpfr_set_si, exp. 49152, got %ld, inex %d\n",
+ mpfr_get_si (x, MPFR_RNDZ), inex);
+ exit (1);
+ }
+ inex = mpfr_set_ui (x, 33096, MPFR_RNDU);
+ if (mpfr_get_si (x, MPFR_RNDZ) != 49152)
+ {
+ printf ("Error in mpfr_set_ui, exp. 49152, got %ld, inex %d\n",
+ mpfr_get_si (x, MPFR_RNDZ), inex);
+ exit (1);
+ }
+ /* Also test the mpfr_set_ui function (instead of macro). */
+ inex = (mpfr_set_ui) (x, 33096, MPFR_RNDU);
+ if (mpfr_get_si (x, MPFR_RNDZ) != 49152)
+ {
+ printf ("Error in mpfr_set_ui function, exp. 49152, got %ld, inex %d\n",
+ mpfr_get_si (x, MPFR_RNDZ), inex);
+ exit (1);
+ }
+
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ mpfr_set_si (x, -1, (mpfr_rnd_t) r);
+ mpfr_set_ui (x, 0, (mpfr_rnd_t) r);
+ if (MPFR_IS_NEG (x) || mpfr_get_ui (x, (mpfr_rnd_t) r) != 0)
+ {
+ printf ("mpfr_set_ui (x, 0) gives -0 for %s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, (mpfr_rnd_t) r);
+ mpfr_set_si (x, 0, (mpfr_rnd_t) r);
+ if (MPFR_IS_NEG (x) || mpfr_get_si (x, (mpfr_rnd_t) r) != 0)
+ {
+ printf ("mpfr_set_si (x, 0) gives -0 for %s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+
+ /* check potential bug in case mp_limb_t is unsigned */
+ emax = mpfr_get_emax ();
+ set_emax (0);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ if (mpfr_sgn (x) >= 0)
+ {
+ printf ("mpfr_set_si (x, -1) fails\n");
+ exit (1);
+ }
+ set_emax (emax);
+
+ emax = mpfr_get_emax ();
+ set_emax (5);
+ mpfr_set_prec (x, 2);
+ mpfr_set_si (x, -31, MPFR_RNDN);
+ if (mpfr_sgn (x) >= 0)
+ {
+ printf ("mpfr_set_si (x, -31) fails\n");
+ exit (1);
+ }
+ set_emax (emax);
+
+ /* test for get_ui */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_get_ui (x, MPFR_RNDN) == 0);
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDU);
+ mpfr_nextabove (x);
+ mpfr_get_ui (x, MPFR_RNDU);
+
+ /* another test for get_ui */
+ mpfr_set_prec (x, 10);
+ mpfr_set_str_binary (x, "10.101");
+ dl = mpfr_get_ui (x, MPFR_RNDN);
+ MPFR_ASSERTN (dl == 3);
+
+ mpfr_set_str_binary (x, "-1.0");
+ mpfr_get_ui (x, MPFR_RNDN);
+
+ mpfr_set_str_binary (x, "0.1");
+ dl = mpfr_get_ui (x, MPFR_RNDN);
+ MPFR_ASSERTN (dl == 0);
+ dl = mpfr_get_ui (x, MPFR_RNDZ);
+ MPFR_ASSERTN (dl == 0);
+ dl = mpfr_get_ui (x, MPFR_RNDD);
+ MPFR_ASSERTN (dl == 0);
+ dl = mpfr_get_ui (x, MPFR_RNDU);
+ MPFR_ASSERTN (dl == 1);
+
+ /* coverage tests */
+ mpfr_set_prec (x, 2);
+ mpfr_set_si (x, -7, MPFR_RNDD);
+ MPFR_ASSERTN(mpfr_cmp_si (x, -8) == 0);
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 7, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 8) == 0);
+ emax = mpfr_get_emax ();
+ set_emax (3);
+ mpfr_set_ui (x, 7, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ set_emax (1);
+ MPFR_ASSERTN( mpfr_set_ui (x, 7, MPFR_RNDU) );
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ set_emax (emax);
+ mpfr_set_ui_2exp (x, 17, -50, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_get_ui (x, MPFR_RNDD) == 0);
+ MPFR_ASSERTN (mpfr_get_si (x, MPFR_RNDD) == 0);
+
+ /* Test for ERANGE flag + correct behaviour if overflow */
+ mpfr_set_prec (x, 256);
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ dl = mpfr_get_ui (x, MPFR_RNDN);
+ if (dl != ULONG_MAX || mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_ui + ERANGE + ULONG_MAX (1)\n");
+ exit (1);
+ }
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ dl = mpfr_get_ui (x, MPFR_RNDN);
+ if (dl != ULONG_MAX || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_ui + ERANGE + ULONG_MAX (2)\n");
+ exit (1);
+ }
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ dl = mpfr_get_ui (x, MPFR_RNDN);
+ if (dl != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_ui + ERANGE + -1 \n");
+ exit (1);
+ }
+ mpfr_set_si (x, LONG_MAX, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_si (x, MPFR_RNDN);
+ if (d != LONG_MAX || mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_si + ERANGE + LONG_MAX (1): %ld\n", d);
+ exit (1);
+ }
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_si (x, MPFR_RNDN);
+ if (d != LONG_MAX || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_si + ERANGE + LONG_MAX (2)\n");
+ exit (1);
+ }
+ mpfr_set_si (x, LONG_MIN, MPFR_RNDN);
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_si (x, MPFR_RNDN);
+ if (d != LONG_MIN || mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_si + ERANGE + LONG_MIN (1)\n");
+ exit (1);
+ }
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ d = mpfr_get_si (x, MPFR_RNDN);
+ if (d != LONG_MIN || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_si + ERANGE + LONG_MIN (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_nan (x);
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_ui (x, MPFR_RNDN);
+ if (d != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_ui + NaN\n");
+ exit (1);
+ }
+ mpfr_clear_erangeflag ();
+ d = mpfr_get_si (x, MPFR_RNDN);
+ if (d != 0 || !mpfr_erangeflag_p ())
+ {
+ printf ("ERROR for get_si + NaN\n");
+ exit (1);
+ }
+
+ emin = mpfr_get_emin ();
+ mpfr_set_prec (x, 2);
+
+ mpfr_set_emin (4);
+ mpfr_clear_flags ();
+ mpfr_set_ui (x, 7, MPFR_RNDU);
+ flag = mpfr_underflow_p ();
+ mpfr_set_emin (emin);
+ if (mpfr_cmp_ui (x, 8) != 0)
+ {
+ printf ("Error for mpfr_set_ui (x, 7, MPFR_RNDU), prec = 2, emin = 4\n");
+ exit (1);
+ }
+ if (flag)
+ {
+ printf ("mpfr_set_ui (x, 7, MPFR_RNDU) should not underflow "
+ "with prec = 2, emin = 4\n");
+ exit (1);
+ }
+
+ mpfr_set_emin (4);
+ mpfr_clear_flags ();
+ mpfr_set_si (x, -7, MPFR_RNDD);
+ flag = mpfr_underflow_p ();
+ mpfr_set_emin (emin);
+ if (mpfr_cmp_si (x, -8) != 0)
+ {
+ printf ("Error for mpfr_set_si (x, -7, MPFR_RNDD), prec = 2, emin = 4\n");
+ exit (1);
+ }
+ if (flag)
+ {
+ printf ("mpfr_set_si (x, -7, MPFR_RNDD) should not underflow "
+ "with prec = 2, emin = 4\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+
+ test_2exp ();
+ test_macros ();
+ test_macros_keyword ();
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset_sj.c b/tests/tset_sj.c
new file mode 100644
index 0000000..4ed0031
--- /dev/null
+++ b/tests/tset_sj.c
@@ -0,0 +1,195 @@
+/* Test file for
+ mpfr_set_sj, mpfr_set_uj, mpfr_set_sj_2exp and mpfr_set_uj_2exp.
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* for a build within gmp */
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-intmax.h"
+#include "mpfr-test.h"
+
+#ifndef _MPFR_H_HAVE_INTMAX_T
+
+int
+main (void)
+{
+ return 77;
+}
+
+#else
+
+#define ERROR(str) {printf("Error for "str"\n"); exit(1);}
+
+static int
+inexact_sign (int x)
+{
+ return (x < 0) ? -1 : (x > 0);
+}
+
+static void
+check_set_uj (mpfr_prec_t pmin, mpfr_prec_t pmax, int N)
+{
+ mpfr_t x, y;
+ mpfr_prec_t p;
+ int inex1, inex2, n;
+ mp_limb_t limb;
+
+ mpfr_inits2 (pmax, x, y, (mpfr_ptr) 0);
+
+ for ( p = pmin ; p < pmax ; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (y, p);
+ for (n = 0 ; n < N ; n++)
+ {
+ /* mp_limb_t may be unsigned long long */
+ limb = (unsigned long) randlimb ();
+ inex1 = mpfr_set_uj (x, limb, MPFR_RNDN);
+ inex2 = mpfr_set_ui (y, limb, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("ERROR for mpfr_set_uj and j=%lu and p=%lu\n",
+ (unsigned long) limb, (unsigned long) p);
+ printf ("X="); mpfr_dump (x);
+ printf ("Y="); mpfr_dump (y);
+ exit (1);
+ }
+ if (inexact_sign (inex1) != inexact_sign (inex2))
+ {
+ printf ("ERROR for inexact(set_uj): j=%lu p=%lu\n"
+ "Inexact1= %d Inexact2= %d\n",
+ (unsigned long) limb, (unsigned long) p, inex1, inex2);
+ exit (1);
+ }
+ }
+ }
+ /* Special case */
+ mpfr_set_prec (x, sizeof(uintmax_t)*CHAR_BIT);
+ inex1 = mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ if (inex1 != 0 || mpfr_sgn(x) <= 0)
+ ERROR ("inexact / UINTMAX_MAX");
+ inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (inex1 != 0 || !mpfr_powerof2_raw (x)
+ || MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) )
+ ERROR ("power of 2");
+ mpfr_set_uj (x, 0, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (x))
+ ERROR ("Setting 0");
+
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+static void
+check_set_uj_2exp (void)
+{
+ mpfr_t x;
+ int inex;
+
+ mpfr_init2 (x, sizeof(uintmax_t)*CHAR_BIT);
+
+ inex = mpfr_set_uj_2exp (x, 1, 0, MPFR_RNDN);
+ if (inex || mpfr_cmp_ui(x, 1))
+ ERROR("(1U,0)");
+
+ inex = mpfr_set_uj_2exp (x, 1024, -10, MPFR_RNDN);
+ if (inex || mpfr_cmp_ui(x, 1))
+ ERROR("(1024U,-10)");
+
+ inex = mpfr_set_uj_2exp (x, 1024, 10, MPFR_RNDN);
+ if (inex || mpfr_cmp_ui(x, 1024L * 1024L))
+ ERROR("(1024U,+10)");
+
+ inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, 1000, MPFR_RNDN);
+ inex |= mpfr_div_2ui (x, x, 1000, MPFR_RNDN);
+ inex |= mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (inex || !mpfr_powerof2_raw (x)
+ || MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) )
+ ERROR("(UINTMAX_MAX)");
+
+ inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN);
+ if (inex == 0 || !mpfr_inf_p (x))
+ ERROR ("Overflow");
+
+ inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN);
+ if (inex == 0 || !MPFR_IS_ZERO (x))
+ ERROR ("Underflow");
+
+ mpfr_clear (x);
+}
+
+static void
+check_set_sj (void)
+{
+ mpfr_t x;
+ int inex;
+
+ mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
+
+ inex = mpfr_set_sj (x, -MPFR_INTMAX_MAX, MPFR_RNDN);
+ inex |= mpfr_add_si (x, x, -1, MPFR_RNDN);
+ if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
+ || MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT) )
+ ERROR("set_sj (-INTMAX_MAX)");
+
+ inex = mpfr_set_sj (x, 1742, MPFR_RNDN);
+ if (inex || mpfr_cmp_ui (x, 1742))
+ ERROR ("set_sj (1742)");
+
+ mpfr_clear (x);
+}
+
+static void
+check_set_sj_2exp (void)
+{
+ mpfr_t x;
+ int inex;
+
+ mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
+
+ inex = mpfr_set_sj_2exp (x, MPFR_INTMAX_MIN, 1000, MPFR_RNDN);
+ if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
+ || MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT+1000) )
+ ERROR("set_sj_2exp (INTMAX_MIN)");
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_set_uj (2, 128, 50);
+ check_set_uj_2exp ();
+ check_set_sj ();
+ check_set_sj_2exp ();
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#endif
diff --git a/tests/tset_str.c b/tests/tset_str.c
new file mode 100644
index 0000000..023f862
--- /dev/null
+++ b/tests/tset_str.c
@@ -0,0 +1,870 @@
+/* Test file for mpfr_set_str.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define N 30000
+
+#define CHECK53(y, s, r, x, t, n) \
+ mpfr_set_str (y, s, 10, r); \
+ mpfr_set_str_binary (x, t); \
+ if (mpfr_cmp (x, y)) \
+ { \
+ printf ("Error in mpfr_set_str (%d):\n", n); \
+ mpfr_print_binary (x); \
+ puts (""); \
+ mpfr_print_binary (y); \
+ puts (""); \
+ mpfr_clear (x); \
+ mpfr_clear (y); \
+ exit (1); \
+ }
+
+static void
+check_underflow (void)
+{
+ mpfr_t a;
+ mpfr_exp_t emin, emax;
+ int res;
+
+ mpfr_init (a);
+
+ /* Check underflow */
+ emin = mpfr_get_emin ();
+ set_emin (-20);
+ res = mpfr_set_str (a, "0.00000000001", 10, MPFR_RNDZ);
+ if (!MPFR_IS_ZERO (a))
+ {
+ printf("ERROR for mpfr_set_str (a, \"0.00000000001\", 10, MPFR_RNDN)\n"
+ " with emin=-20\n"
+ "res=%d\n", res);
+ mpfr_dump (a);
+ exit (1);
+ }
+ set_emin (emin);
+
+ /* check overflow */
+ emax = mpfr_get_emax ();
+ set_emax (1073741823); /* 2^30-1 */
+ mpfr_set_str (a, "2E1000000000", 10, MPFR_RNDN);
+ if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0)
+ {
+ printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, MPFR_RNDN);\n");
+ exit (1);
+ }
+ set_emax (emax);
+
+ mpfr_clear (a);
+}
+
+/* Bug found by Christoph Lauter. */
+static void
+bug20081028 (void)
+{
+ mpfr_t x;
+ const char *s = "0.10000000000000000000000000000001E1";
+
+ mpfr_init2 (x, 32);
+ mpfr_set_str (x, "1.00000000000000000006", 10, MPFR_RNDU);
+ if (! mpfr_greater_p (x, __gmpfr_one))
+ {
+ printf ("Error in bug20081028:\nExpected %s\nGot ", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ unsigned long k, bd, nc, i;
+ char *str, *str2;
+ mpfr_exp_t e;
+ int base, logbase, prec, baseprec, ret, obase;
+
+ tests_start_mpfr ();
+
+ if (argc >= 2) /* tset_str <string> [<prec>] [<ibase>] [<obase>] */
+ {
+ prec = (argc >= 3) ? atoi (argv[2]) : 53;
+ base = (argc >= 4) ? atoi (argv[3]) : 2;
+ obase = (argc >= 5) ? atoi (argv[4]) : 10;
+ mpfr_init2 (x, prec);
+ mpfr_set_str (x, argv[1], base, MPFR_RNDN);
+ mpfr_out_str (stdout, obase, 0, x, MPFR_RNDN);
+ puts ("");
+ mpfr_clear (x);
+ return 0;
+ }
+
+ mpfr_init2 (x, 2);
+
+ nc = (argc > 1) ? atoi(argv[1]) : 53;
+ if (nc < 100)
+ nc = 100;
+
+ bd = randlimb () & 8;
+
+ str2 = str = (char*) (*__gmp_allocate_func) (nc);
+
+ if (bd)
+ {
+ for(k = 1; k <= bd; k++)
+ *(str2++) = (randlimb () & 1) + '0';
+ }
+ else
+ *(str2++) = '0';
+
+ *(str2++) = '.';
+
+ for (k = 1; k < nc - 17 - bd; k++)
+ *(str2++) = '0' + (char) (randlimb () & 1);
+
+ *(str2++) = 'e';
+ sprintf (str2, "%d", (int) (randlimb () & INT_MAX) + INT_MIN/2);
+
+ mpfr_set_prec (x, nc + 10);
+ mpfr_set_str_binary (x, str);
+
+ mpfr_set_prec (x, 54);
+ mpfr_set_str_binary (x, "0.100100100110110101001010010101111000001011100100101010E-529");
+ mpfr_init2 (y, 54);
+ mpfr_set_str (y, "4.936a52bc17254@-133", 16, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (1a):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "0.111111101101110010111010100110000111011001010100001101E-529");
+ mpfr_set_str (y, "0.fedcba98765434P-529", 16, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (1b):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ (*__gmp_free_func) (str, nc);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_str_binary (x, "+110101100.01010000101101000000100111001000101011101110E00");
+
+ mpfr_set_str_binary (x, "1.0");
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_set_str_binary for s=1.0\n");
+ mpfr_clear(x);
+ mpfr_clear(y);
+ exit(1);
+ }
+
+ mpfr_set_str_binary (x, "+0000");
+ mpfr_set_str_binary (x, "+0000E0");
+ mpfr_set_str_binary (x, "0000E0");
+ if (mpfr_cmp_ui (x, 0))
+ {
+ printf ("Error in mpfr_set_str_binary for s=0.0\n");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (x, "+243495834958.53452345E1", 10, MPFR_RNDN);
+ mpfr_set_str (x, "9007199254740993", 10, MPFR_RNDN);
+ mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDU);
+ mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDD);
+ mpfr_set_str (x, "9007199254740992", 10, MPFR_RNDZ);
+
+ /* check a random number printed and read is not modified */
+ prec = 53;
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (y, prec);
+ for (i=0;i<N;i++)
+ {
+ mpfr_rnd_t rnd;
+
+ mpfr_urandomb (x, RANDS);
+ rnd = RND_RAND ();
+ logbase = (randlimb () % 5) + 1;
+ base = 1 << logbase;
+ /* Warning: the number of bits needed to print exactly a number of
+ 'prec' bits in base 2^logbase may be greater than ceil(prec/logbase),
+ for example 0.11E-1 in base 2 cannot be written exactly with only
+ one digit in base 4 */
+ if (base == 2)
+ baseprec = prec;
+ else
+ baseprec = 1 + (prec - 2 + logbase) / logbase;
+ str = mpfr_get_str (NULL, &e, base, baseprec, x, rnd);
+ mpfr_set_str (y, str, base, rnd);
+ MPFR_EXP(y) += logbase * (e - strlen (str));
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_set_str o mpfr_get_str <> id for rnd_mode=%s\n",
+ mpfr_print_rnd_mode (rnd));
+ printf ("x=");
+ mpfr_print_binary (x);
+ puts ("");
+ printf ("s=%s, exp=%d, base=%d\n", str, (int) e, base);
+ printf ("y=");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+ (*__gmp_free_func) (str, strlen (str) + 1);
+ }
+
+ for (i = 2; i <= 62; i++)
+ {
+ if (mpfr_set_str (x, "@NaN@(garbage)", i, MPFR_RNDN) != 0 ||
+ !mpfr_nan_p(x))
+ {
+ printf ("mpfr_set_str failed on @NaN@(garbage)\n");
+ exit (1);
+ }
+
+ /*
+ if (mpfr_set_str (x, "@Inf@garbage", i, MPFR_RNDN) != 0 ||
+ !mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
+ {
+ printf ("mpfr_set_str failed on @Inf@garbage\n");
+ exit (1);
+ }
+
+ if (mpfr_set_str (x, "-@Inf@garbage", i, MPFR_RNDN) != 0 ||
+ !mpfr_inf_p(x) || MPFR_SIGN(x) > 0)
+ {
+ printf ("mpfr_set_str failed on -@Inf@garbage\n");
+ exit (1);
+ }
+
+ if (mpfr_set_str (x, "+@Inf@garbage", i, MPFR_RNDN) != 0 ||
+ !mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
+ {
+ printf ("mpfr_set_str failed on +@Inf@garbage\n");
+ exit (1);
+ }
+ */
+
+ if (i > 16)
+ continue;
+
+ if (mpfr_set_str (x, "NaN", i, MPFR_RNDN) != 0 ||
+ !mpfr_nan_p(x))
+ {
+ printf ("mpfr_set_str failed on NaN\n");
+ exit (1);
+ }
+
+ if (mpfr_set_str (x, "Inf", i, MPFR_RNDN) != 0 ||
+ !mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
+ {
+ printf ("mpfr_set_str failed on Inf\n");
+ exit (1);
+ }
+
+ if (mpfr_set_str (x, "-Inf", i, MPFR_RNDN) != 0 ||
+ !mpfr_inf_p(x) || MPFR_SIGN(x) > 0)
+ {
+ printf ("mpfr_set_str failed on -Inf\n");
+ exit (1);
+ }
+
+ if (mpfr_set_str (x, "+Inf", i, MPFR_RNDN) != 0 ||
+ !mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
+ {
+ printf ("mpfr_set_str failed on +Inf\n");
+ exit (1);
+ }
+ }
+
+ /* check that mpfr_set_str works for uppercase letters too */
+ mpfr_set_prec (x, 10);
+ mpfr_set_str (x, "B", 16, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 11) != 0)
+ {
+ printf ("mpfr_set_str does not work for uppercase letters\n");
+ exit (1);
+ }
+
+ /* start of tests added by Alain Delplanque */
+
+ /* in this example an overflow can occur */
+ mpfr_set_prec (x, 64);
+ mpfr_set_prec (y, 64);
+ mpfr_set_str_binary (x, "1.0E-532");
+ mpfr_set_str (y, "0.71128279983522479470@-160", 10, MPFR_RNDU);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (2):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ /* in this example, I think there was a pb in the old function :
+ result of mpfr_set_str_old for the same number , but with more
+ precision is: 1.111111111110000000000000000111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100111000100001100000010101100111010e184
+ this result is the same as mpfr_set_str */
+ mpfr_set_prec (x, 64);
+ mpfr_set_prec (y, 64);
+ mpfr_set_str_binary (x, "1.111111111110000000000000000111111111111111111111111110000000001E184");
+ mpfr_set_str (y, "0.jo08hg31hc5mmpj5mjjmgn55p2h35g@39", 27, MPFR_RNDU);
+ /* y = 49027884868983130654865109690613178467841148597221480052 */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (3):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ /* not exact rounding in mpfr_set_str
+ same number with more precision is : 1.111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011011111101000001101110110010101101000010100110011101110010001110e195
+ this result is the same as mpfr_set_str */
+ /* problem was : can_round was call with MPFR_RNDN round mode,
+ so can_round use an error : 1/2 * 2^err * ulp(y)
+ instead of 2^err * ulp(y)
+ I have increase err by 1 */
+ mpfr_set_prec (x, 64); /* it was round down instead of up */
+ mpfr_set_prec (y, 64);
+ mpfr_set_str_binary (x, "1.111111111111111111111111111000000000000000000000000000000000001e195");
+ mpfr_set_str (y, "0.6e23ekb6acgh96abk10b6c9f2ka16i@45", 21, MPFR_RNDU);
+ /* y = 100433627392042473064661483711179345482301462325708736552078 */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (4):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ /* may be an error in mpfr_set_str_old
+ with more precision : 1.111111100000001111110000000000011111011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111101010001110111011000010111001011100110110e180 */
+ mpfr_set_prec (x, 64); /* it was round down instead of up */
+ mpfr_set_prec (y, 64);
+ mpfr_set_str_binary (x, "1.111111100000001111110000000000011111011111111111111111111111111e180");
+ mpfr_set_str (y, "0.10j8j2k82ehahha56390df0a1de030@41", 23, MPFR_RNDZ);
+ /* y = 3053110535624388280648330929253842828159081875986159414 */
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (5):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 64);
+ mpfr_set_prec (y, 64);
+ mpfr_set_str (y, "0.jrchfhpp9en7hidqm9bmcofid9q3jg@39", 28, MPFR_RNDU);
+ /* y = 196159429139499688661464718784226062699788036696626429952 */
+ mpfr_set_str_binary (x, "0.1111111111111111111111111111111000000000000011100000001111100001E187");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (6):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 64);
+ mpfr_set_prec (y, 64);
+ mpfr_set_str (y, "0.h148m5ld5cf8gk1kd70b6ege92g6ba@47", 24, MPFR_RNDZ);
+ /* y = 52652933527468502324759448399183654588831274530295083078827114496 */
+ mpfr_set_str_binary (x, "0.1111111111111100000000001000000000000000000011111111111111101111E215");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (7):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ /* worst cases for rounding to nearest in double precision */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_str (y, "5e125", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10111101000101110110011000100000101001010000000111111E418");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (8):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "69e267", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10000101101111100101101100000110010011001010011011010E894");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (9):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "623e100", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10110010000001010011000101111001110101000001111011111E342");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (10):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "3571e263", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10110001001100100010011000110000111010100000110101010E886");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (11):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "75569e-254", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10101101001000110001011011001000111000110101010110011E-827");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (12):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "920657e-23", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10101001110101001100110000101110110111101111001101100E-56");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (13):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "9210917e80", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.11101101000100011001000110100011111100110000000110010E289");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (14):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "87575437e-309", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.11110000001110011001000000110000000100000010101101100E-1000");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (15):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "245540327e122", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10001101101100010001100011110000110001100010111001011E434");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (16):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "491080654e122", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10001101101100010001100011110000110001100010111001011E435");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (17):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ mpfr_set_str (y, "83356057653e193", 10, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.10101010001001110011011011010111011100010101000011000E678");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_str (18):\n");
+ mpfr_print_binary (x);
+ puts ("");
+ mpfr_print_binary (y);
+ puts ("");
+ mpfr_clear (x);
+ mpfr_clear (y);
+ exit (1);
+ }
+
+ CHECK53(y, "83356057653e193", MPFR_RNDN, x,
+ "0.10101010001001110011011011010111011100010101000011000E678",
+ 18);
+
+ CHECK53(y, "619534293513e124", MPFR_RNDN, x,
+ "0.10001000011000010000000110000001111111110000011110001e452",
+ 19);
+
+ CHECK53(y, "3142213164987e-294", MPFR_RNDN, x,
+ "0.11101001101000000100111011111101111001010001001101111e-935",
+ 20);
+
+ CHECK53(y, "36167929443327e-159", MPFR_RNDN, x,
+ "0.11100111001110111110000101011001100110010100011111100e-483",
+ 21);
+
+ CHECK53(y, "904198236083175e-161", MPFR_RNDN, x,
+ "0.11100111001110111110000101011001100110010100011111100e-485",
+ 22);
+
+ CHECK53(y, "3743626360493413e-165", MPFR_RNDN, x,
+ "0.11000100000100011101001010111101011011011111011111001e-496",
+ 23);
+
+ CHECK53(y, "94080055902682397e-242", MPFR_RNDN, x,
+ "0.10110010010011000000111100011100111100110011011001010e-747",
+ 24);
+
+ CHECK53(y, "7e-303", MPFR_RNDD, x,
+ "0.10011001100111001000100110001110001000110111110001011e-1003",
+ 25);
+ CHECK53(y, "7e-303", MPFR_RNDU, x,
+ "0.10011001100111001000100110001110001000110111110001100e-1003",
+ 26);
+
+ CHECK53(y, "93e-234", MPFR_RNDD, x,
+ "0.10010011110110010111001001111001000010000000001110101E-770",
+ 27);
+ CHECK53(y, "93e-234", MPFR_RNDU, x,
+ "0.10010011110110010111001001111001000010000000001110110E-770",
+ 28);
+
+ CHECK53(y, "755e174", MPFR_RNDD, x,
+ "0.10111110110010011000110010011111101111000111111000101E588",
+ 29);
+ CHECK53(y, "755e174", MPFR_RNDU, x,
+ "0.10111110110010011000110010011111101111000111111000110E588",
+ 30);
+
+ CHECK53(y, "8699e-276", MPFR_RNDD, x,
+ "0.10010110100101101111100100100011011101100110100101100E-903",
+ 31);
+ CHECK53(y, "8699e-276", MPFR_RNDU, x,
+ "0.10010110100101101111100100100011011101100110100101101E-903",
+ 32);
+
+ CHECK53(y, "82081e41", MPFR_RNDD, x,
+ "0.10111000000010000010111011111001111010100011111001011E153",
+ 33);
+ CHECK53(y, "82081e41", MPFR_RNDU, x,
+ "0.10111000000010000010111011111001111010100011111001100E153",
+ 34);
+
+ CHECK53(y, "584169e229", MPFR_RNDD, x,
+ "0.11101011001010111000001011001110111000111100110101010E780",
+ 35);
+ CHECK53(y, "584169e229", MPFR_RNDU, x,
+ "0.11101011001010111000001011001110111000111100110101011E780",
+ 36);
+
+ CHECK53(y, "5783893e-128", MPFR_RNDD, x,
+ "0.10011000111100000110011110000101100111110011101110100E-402",
+ 37);
+ CHECK53(y, "5783893e-128", MPFR_RNDU, x,
+ "0.10011000111100000110011110000101100111110011101110101E-402",
+ 38);
+
+ CHECK53(y, "87575437e-310", MPFR_RNDD, x,
+ "0.11000000001011100000110011110011010000000010001010110E-1003",
+ 39);
+ CHECK53(y, "87575437e-310", MPFR_RNDU, x,
+ "0.11000000001011100000110011110011010000000010001010111E-1003",
+ 40);
+
+ CHECK53(y, "245540327e121", MPFR_RNDD, x,
+ "0.11100010101101001111010010110100011100000100101000100E430",
+ 41);
+ CHECK53(y, "245540327e121", MPFR_RNDU, x,
+ "0.11100010101101001111010010110100011100000100101000101E430",
+ 42);
+
+ CHECK53(y, "9078555839e-109", MPFR_RNDD, x,
+ "0.11111110001010111010110000110011100110001010011101101E-329",
+ 43);
+ CHECK53(y, "9078555839e-109", MPFR_RNDU, x,
+ "0.11111110001010111010110000110011100110001010011101110E-329",
+ 44);
+
+ CHECK53(y, "42333842451e201", MPFR_RNDD, x,
+ "0.10000000110001001101000100110110111110101011101011111E704",
+ 45);
+ CHECK53(y, "42333842451e201", MPFR_RNDU, x,
+ "0.10000000110001001101000100110110111110101011101100000E704",
+ 46);
+
+ CHECK53(y, "778380362293e218", MPFR_RNDD, x,
+ "0.11001101010111000001001100001100110010000001010010010E764",
+ 47);
+ CHECK53(y, "778380362293e218", MPFR_RNDU, x,
+ "0.11001101010111000001001100001100110010000001010010011E764",
+ 48);
+
+ CHECK53(y, "7812878489261e-179", MPFR_RNDD, x,
+ "0.10010011011011010111001111011101111101101101001110100E-551",
+ 49);
+ CHECK53(y, "7812878489261e-179", MPFR_RNDU, x,
+ "0.10010011011011010111001111011101111101101101001110101E-551",
+ 50);
+
+ CHECK53(y, "77003665618895e-73", MPFR_RNDD, x,
+ "0.11000101111110111111001111111101001101111000000101001E-196",
+ 51);
+ CHECK53(y, "77003665618895e-73", MPFR_RNDU, x,
+ "0.11000101111110111111001111111101001101111000000101010E-196",
+ 52);
+
+ CHECK53(y, "834735494917063e-300", MPFR_RNDD, x,
+ "0.11111110001101100001001101111100010011001110111010001E-947",
+ 53);
+ CHECK53(y, "834735494917063e-300", MPFR_RNDU, x,
+ "0.11111110001101100001001101111100010011001110111010010E-947",
+ 54);
+
+ CHECK53(y, "6182410494241627e-119", MPFR_RNDD, x,
+ "0.10001101110010110010001011000010001000101110100000111E-342",
+ 55);
+ CHECK53(y, "6182410494241627e-119", MPFR_RNDU, x,
+ "0.10001101110010110010001011000010001000101110100001000E-342",
+ 56);
+
+ CHECK53(y, "26153245263757307e49", MPFR_RNDD, x,
+ "0.10011110111100000000001011011110101100010000011011110E218",
+ 57);
+ CHECK53(y, "26153245263757307e49", MPFR_RNDU, x,
+ "0.10011110111100000000001011011110101100010000011011111E218",
+ 58);
+
+ /* to check this problem : I convert limb (10--0 or 101--1) into base b
+ with more than mp_bits_per_limb digits,
+ so when convert into base 2 I should have
+ the limb that I have choose */
+ /* this use mpfr_get_str */
+ {
+ size_t nb_digit = mp_bits_per_limb;
+ mp_limb_t check_limb[2] = {MPFR_LIMB_HIGHBIT, ~(MPFR_LIMB_HIGHBIT >> 1)};
+ int base[3] = {10, 16, 19};
+ mpfr_rnd_t rnd[3] = {MPFR_RNDU, MPFR_RNDN, MPFR_RNDD};
+ int cbase, climb, crnd;
+ char *str;
+
+ mpfr_set_prec (x, mp_bits_per_limb); /* x and y have only one limb */
+ mpfr_set_prec (y, mp_bits_per_limb);
+
+ str = (char*) (*__gmp_allocate_func) (N + 20);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN); /* ensures that x is not NaN or Inf */
+ for (; nb_digit < N; nb_digit *= 10)
+ for (cbase = 0; cbase < 3; cbase++)
+ for (climb = 0; climb < 2; climb++)
+ for (crnd = 0; crnd < 3; crnd++)
+ {
+ char *str1;
+ mpfr_exp_t exp;
+
+ *(MPFR_MANT(x)) = check_limb[climb];
+ MPFR_EXP(x) = 0;
+
+ mpfr_get_str (str + 2, &exp, base[cbase],
+ nb_digit, x, rnd[crnd]);
+ str[0] = '-';
+ str[(str[2] == '-')] = '0';
+ str[(str[2] == '-') + 1] = '.';
+
+ for (str1 = str; *str1 != 0; str1++)
+ ;
+ sprintf (str1, "@%i", (int) exp);
+
+ mpfr_set_str (y, str, base[cbase], rnd[2 - crnd]);
+
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error in mpfr_set_str for nb_digit=%u, base=%d, "
+ "rnd=%s:\n", (unsigned int) nb_digit, base[cbase],
+ mpfr_print_rnd_mode (rnd[crnd]));
+ printf ("instead of: ");
+ mpfr_print_binary (x);
+ puts ("");
+ printf ("return : ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ }
+
+ (*__gmp_free_func) (str, N + 20);
+ }
+
+ /* end of tests added by Alain Delplanque */
+
+ /* check that flags are correctly cleared */
+ mpfr_set_nan (x);
+ mpfr_set_str (x, "+0.0", 10, MPFR_RNDN);
+ if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) < 0)
+ {
+ printf ("x <- +0.0 failed after x=NaN\n");
+ exit (1);
+ }
+ mpfr_set_str (x, "-0.0", 10, MPFR_RNDN);
+ if (!mpfr_number_p(x) || mpfr_cmp_ui (x, 0) != 0 || mpfr_sgn (x) > 0)
+ {
+ printf ("x <- -0.0 failed after x=NaN\n");
+ exit (1);
+ }
+
+ /* check invalid input */
+ ret = mpfr_set_str (x, "1E10toto", 10, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ ret = mpfr_set_str (x, "1p10toto", 16, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ ret = mpfr_set_str (x, "", 16, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ ret = mpfr_set_str (x, "+", 16, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ ret = mpfr_set_str (x, "-", 16, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ ret = mpfr_set_str (x, "this_is_an_invalid_number_in_base_36", 36, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ ret = mpfr_set_str (x, "1.2.3", 10, MPFR_RNDN);
+ MPFR_ASSERTN (ret == -1);
+ mpfr_set_prec (x, 135);
+ ret = mpfr_set_str (x, "thisisavalidnumberinbase36", 36, MPFR_RNDN);
+ mpfr_set_prec (y, 135);
+ mpfr_set_str (y, "23833565676460972739462619524519814462546", 10, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp (x, y) == 0 && ret == 0);
+
+ /* coverage test for set_str_binary */
+ mpfr_set_str_binary (x, "NaN");
+ MPFR_ASSERTN(mpfr_nan_p (x));
+ mpfr_set_str_binary (x, "Inf");
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ mpfr_set_str_binary (x, "+Inf");
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ mpfr_set_str_binary (x, "-Inf");
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
+ mpfr_set_prec (x, 3);
+ mpfr_set_str_binary (x, "0.01E2");
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
+ mpfr_set_str_binary (x, "-0.01E2");
+ MPFR_ASSERTN(mpfr_cmp_si (x, -1) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ check_underflow ();
+ bug20081028 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tset_z.c b/tests/tset_z.c
new file mode 100644
index 0000000..e1e522c
--- /dev/null
+++ b/tests/tset_z.c
@@ -0,0 +1,142 @@
+/* Test file for mpfr_set_z.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+static void check0(void)
+{
+ mpz_t y;
+ mpfr_t x;
+ int inexact, r;
+
+ /* Check for +0 */
+ mpfr_init (x);
+ mpz_init (y);
+ mpz_set_si (y, 0);
+ for(r = 0; r < MPFR_RND_MAX; r++)
+ {
+ inexact = mpfr_set_z (x, y, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
+ {
+ printf("mpfr_set_z(x,0) failed for %s\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit(1);
+ }
+ }
+ mpfr_clear(x);
+ mpz_clear(y);
+}
+
+/* FIXME: It'd be better to examine the actual data in an mpfr_t to see that
+ it's as expected. Comparing mpfr_set_z with mpfr_cmp or against
+ mpfr_get_si is a rather indirect test of a low level routine. */
+
+static void
+check (long i, mpfr_rnd_t rnd)
+{
+ mpfr_t f;
+ mpz_t z;
+
+ mpfr_init2 (f, 8 * sizeof(long));
+ mpz_init (z);
+ mpz_set_ui (z, i);
+ mpfr_set_z (f, z, rnd);
+ if (mpfr_get_si (f, MPFR_RNDZ) != i)
+ {
+ printf ("Error in mpfr_set_z for i=%ld rnd_mode=%d\n", i, rnd);
+ exit (1);
+ }
+ mpfr_clear (f);
+ mpz_clear (z);
+}
+
+static void
+check_large (void)
+{
+ mpz_t z;
+ mpfr_t x, y;
+ mpfr_exp_t emax, emin;
+
+ mpz_init (z);
+ mpfr_init2 (x, 160);
+ mpfr_init2 (y, 160);
+
+ mpz_set_str (z, "77031627725494291259359895954016675357279104942148788042", 10);
+ mpfr_set_z (x, z, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.1100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001001E186");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_set_z on large input\n");
+ exit (1);
+ }
+
+ /* check overflow */
+ emax = mpfr_get_emax ();
+ set_emax (2);
+ mpz_set_str (z, "7", 10);
+ mpfr_set_z (x, z, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ set_emax (3);
+ mpfr_set_prec (x, 2);
+ mpz_set_str (z, "7", 10);
+ mpfr_set_z (x, z, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ set_emax (emax);
+
+ /* check underflow */
+ emin = mpfr_get_emin ();
+ set_emin (3);
+ mpz_set_str (z, "1", 10);
+ mpfr_set_z (x, z, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+ set_emin (2);
+ mpfr_set_z (x, z, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
+ set_emin (emin);
+
+ mpz_clear (z);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ long j;
+
+ tests_start_mpfr ();
+
+ check_large ();
+ check (0, MPFR_RNDN);
+ for (j = 0; j < 200000; j++)
+ check (randlimb () & LONG_MAX, RND_RAND ());
+ check0 ();
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tset_z_exp.c b/tests/tset_z_exp.c
new file mode 100644
index 0000000..7917839
--- /dev/null
+++ b/tests/tset_z_exp.c
@@ -0,0 +1,132 @@
+/* Test file for mpfr_set_z_2exp.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+static mpfr_exp_t
+randexp (void)
+{
+ return (mpfr_exp_t) (randlimb () % (__gmpfr_emax - __gmpfr_emin))
+ + __gmpfr_emin;
+}
+
+static void
+check0 (void)
+{
+ mpz_t y;
+ mpfr_t x;
+ int inexact, r;
+ mpfr_exp_t e;
+
+ /* Check for +0 */
+ mpfr_init (x);
+ mpz_init (y);
+ mpz_set_si (y, 0);
+ for (r = 0; r < MPFR_RND_MAX; r++)
+ {
+ e = randexp ();
+ inexact = mpfr_set_z_2exp (x, y, e, (mpfr_rnd_t) r);
+ if (!MPFR_IS_ZERO(x) || !MPFR_IS_POS(x) || inexact)
+ {
+ printf ("mpfr_set_z_2exp(x,0,e) failed for e=");
+ if (e < LONG_MIN)
+ printf ("(<LONG_MIN)");
+ else if (e > LONG_MAX)
+ printf ("(>LONG_MAX)");
+ else
+ printf ("%ld", (long) e);
+ printf (", rnd=%s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r));
+ exit (1);
+ }
+ }
+ mpfr_clear(x);
+ mpz_clear(y);
+}
+
+/* FIXME: It'd be better to examine the actual data in an mpfr_t to see that
+ it's as expected. Comparing mpfr_set_z with mpfr_cmp or against
+ mpfr_get_si is a rather indirect test of a low level routine. */
+
+static void
+check (long i, mpfr_rnd_t rnd)
+{
+ mpfr_t f;
+ mpz_t z;
+ mpfr_exp_t e;
+ int inex;
+
+ /* using CHAR_BIT * sizeof(long) bits of precision ensures that
+ mpfr_set_z_2exp is exact below */
+ mpfr_init2 (f, CHAR_BIT * sizeof(long));
+ mpz_init (z);
+ mpz_set_ui (z, i);
+ /* the following loop ensures that no overflow occurs */
+ do
+ e = randexp ();
+ while (e > mpfr_get_emax () - CHAR_BIT * sizeof(long));
+ inex = mpfr_set_z_2exp (f, z, e, rnd);
+ if (inex != 0)
+ {
+ printf ("Error in mpfr_set_z_2exp for i=%ld, e=%ld,"
+ " wrong ternary value\n", i, (long) e);
+ printf ("expected 0, got %d\n", inex);
+ exit (1);
+ }
+ mpfr_div_2si (f, f, e, rnd);
+ if (mpfr_get_si (f, MPFR_RNDZ) != i)
+ {
+ printf ("Error in mpfr_set_z_2exp for i=%ld e=", i);
+ if (e < LONG_MIN)
+ printf ("(<LONG_MIN)");
+ else if (e > LONG_MAX)
+ printf ("(>LONG_MAX)");
+ else
+ printf ("%ld", (long) e);
+ printf (" rnd_mode=%d\n", rnd);
+ printf ("expected %ld\n", i);
+ printf ("got "); mpfr_dump (f);
+ exit (1);
+ }
+ mpfr_clear (f);
+ mpz_clear (z);
+}
+
+int
+main (int argc, char *argv[])
+{
+ long j;
+
+ tests_start_mpfr ();
+
+ check (0, MPFR_RNDN);
+ for (j = 0; j < 200000; j++)
+ check (randlimb () & LONG_MAX, RND_RAND ());
+ check0 ();
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tsgn.c b/tests/tsgn.c
new file mode 100644
index 0000000..ad7967c
--- /dev/null
+++ b/tests/tsgn.c
@@ -0,0 +1,131 @@
+/* tsgn -- Test for the sign of a floating point number.
+
+Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check_special (void)
+{
+ mpfr_t x;
+ int ret = 0;
+
+ mpfr_init (x);
+ MPFR_SET_ZERO (x);
+ if ((mpfr_sgn) (x) != 0 || mpfr_sgn (x) != 0)
+ {
+ printf("Sgn error for 0.\n");
+ ret = 1;
+ }
+ MPFR_SET_INF (x);
+ MPFR_SET_POS (x);
+ if ((mpfr_sgn) (x) != 1 || mpfr_sgn (x) != 1)
+ {
+ printf("Sgn error for +Inf.\n");
+ ret = 1;
+ }
+ MPFR_SET_INF (x);
+ MPFR_SET_NEG (x);
+ if ((mpfr_sgn) (x) != -1 || mpfr_sgn (x) != -1)
+ {
+ printf("Sgn error for -Inf.\n");
+ ret = 1;
+ }
+ MPFR_SET_NAN (x);
+ mpfr_clear_flags ();
+ if ((mpfr_sgn) (x) != 0 || !mpfr_erangeflag_p ())
+ {
+ printf("Sgn error for NaN.\n");
+ ret = 1;
+ }
+ mpfr_clear_flags ();
+ if (mpfr_sgn (x) != 0 || !mpfr_erangeflag_p ())
+ {
+ printf("Sgn error for NaN.\n");
+ ret = 1;
+ }
+ mpfr_clear (x);
+ if (ret)
+ exit (ret);
+}
+
+static void
+check_sgn(void)
+{
+ mpfr_t x;
+ int i, s1, s2;
+
+ mpfr_init(x);
+ for(i = 0 ; i < 100 ; i++)
+ {
+ mpfr_urandomb (x, RANDS);
+ if (i&1)
+ {
+ MPFR_SET_POS(x);
+ s2 = 1;
+ }
+ else
+ {
+ MPFR_SET_NEG(x);
+ s2 = -1;
+ }
+ s1 = mpfr_sgn(x);
+ if (s1 < -1 || s1 > 1)
+ {
+ printf("Error for sgn: out of range.\n");
+ goto lexit;
+ }
+ else if (MPFR_IS_NAN(x) || MPFR_IS_ZERO(x))
+ {
+ if (s1 != 0)
+ {
+ printf("Error for sgn: Nan or Zero should return 0.\n");
+ goto lexit;
+ }
+ }
+ else if (s1 != s2)
+ {
+ printf("Error for sgn. Return %d instead of %d.\n", s1, s2);
+ goto lexit;
+ }
+ }
+ mpfr_clear(x);
+ return;
+
+ lexit:
+ mpfr_clear(x);
+ exit(1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_special ();
+ check_sgn ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsi_op.c b/tests/tsi_op.c
new file mode 100644
index 0000000..1422ca5
--- /dev/null
+++ b/tests/tsi_op.c
@@ -0,0 +1,146 @@
+/* Test file for mpfr_add_si, mpfr_sub_si, mpfr_si_sub, mpfr_mul_si,
+ mpfr_div_si, mpfr_si_div
+
+Copyright 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define ERROR1(s, i, z, exp) \
+{\
+ printf("Error for "s" and i=%d\n", i);\
+ printf("Expected %s\n", exp);\
+ printf("Got "); mpfr_out_str (stdout, 16, 0, z, MPFR_RNDN);\
+ putchar ('\n');\
+ exit(1);\
+}
+
+const struct {
+ const char * op1;
+ long int op2;
+ const char * res_add;
+ const char * res_sub;
+ const char * res_mul;
+ const char * res_div;
+} tab[] = {
+ {"10", 0x1, "11", "0F", "10", "10"},
+ {"1", -1, "0", "2", "-1", "-1"},
+ {"17.42", -0x17, "0.42", "2E.42", "-216.ee", "-1.02de9bd37a6f4"},
+ {"-1024.0", -0x16, "-103A", "-100E", "16318", "bb.d1745d1745d0"}
+};
+
+static void
+check_invert (void)
+{
+ mpfr_t x;
+ mpfr_init2 (x, MPFR_PREC_MIN);
+
+ mpfr_set_ui (x, 0xC, MPFR_RNDN);
+ mpfr_si_sub (x, -1, x, MPFR_RNDD); /* -0001 - 1100 = - 1101 --> -1 0000 */
+ if (mpfr_cmp_si (x, -0x10) )
+ {
+ printf ("Special rounding error\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
+#define TEST_FUNCTION mpfr_add_si
+#define TEST_FUNCTION_NAME "mpfr_add_si"
+#define INTEGER_TYPE long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#define test_generic_ui test_generic_add_si
+#include "tgeneric_ui.c"
+
+#define TEST_FUNCTION mpfr_sub_si
+#define TEST_FUNCTION_NAME "mpfr_sub_si"
+#define INTEGER_TYPE long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#define test_generic_ui test_generic_sub_si
+#include "tgeneric_ui.c"
+
+#define TEST_FUNCTION mpfr_mul_si
+#define TEST_FUNCTION_NAME "mpfr_mul_si"
+#define INTEGER_TYPE long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#define test_generic_ui test_generic_mul_si
+#include "tgeneric_ui.c"
+
+#define TEST_FUNCTION mpfr_div_si
+#define TEST_FUNCTION_NAME "mpfr_div_si"
+#define INTEGER_TYPE long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#define test_generic_ui test_generic_div_si
+#include "tgeneric_ui.c"
+
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, z;
+ int y;
+ int i;
+
+ tests_start_mpfr ();
+ mpfr_inits2 (53, x, z, (mpfr_ptr) 0);
+ for(i = 0 ; i < numberof (tab) ; i++)
+ {
+ mpfr_set_str (x, tab[i].op1, 16, MPFR_RNDN);
+ y = tab[i].op2;
+ mpfr_add_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_add, 16, MPFR_RNDN))
+ ERROR1("add_si", i, z, tab[i].res_add);
+ mpfr_sub_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN))
+ ERROR1("sub_si", i, z, tab[i].res_sub);
+ mpfr_si_sub (z, y, x, MPFR_RNDZ);
+ mpfr_neg (z, z, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_sub, 16, MPFR_RNDN))
+ ERROR1("si_sub", i, z, tab[i].res_sub);
+ mpfr_mul_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_mul, 16, MPFR_RNDN))
+ ERROR1("mul_si", i, z, tab[i].res_mul);
+ mpfr_div_si (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_str (z, tab[i].res_div, 16, MPFR_RNDN))
+ ERROR1("div_si", i, z, tab[i].res_div);
+ }
+ mpfr_set_str1 (x, "1");
+ mpfr_si_div (z, 1024, x, MPFR_RNDN);
+ if (mpfr_cmp_str1 (z, "1024"))
+ ERROR1("si_div", i, z, "1024");
+ mpfr_si_div (z, -1024, x, MPFR_RNDN);
+ if (mpfr_cmp_str1 (z, "-1024"))
+ ERROR1("si_div", i, z, "-1024");
+
+ mpfr_clears (x, z, (mpfr_ptr) 0);
+
+ check_invert ();
+
+ test_generic_add_si (2, 200, 17);
+ test_generic_sub_si (2, 200, 17);
+ test_generic_mul_si (2, 200, 17);
+ test_generic_div_si (2, 200, 17);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsin.c b/tests/tsin.c
new file mode 100644
index 0000000..b8a20cd
--- /dev/null
+++ b/tests/tsin.c
@@ -0,0 +1,377 @@
+/* Test file for mpfr_sin.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_sin (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_get_prec (a)>=53;
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_sin (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_sin mpfr_sin
+#endif
+
+static void
+check53 (const char *xs, const char *sin_xs, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, s;
+
+ mpfr_init2 (xx, 53);
+ mpfr_init2 (s, 53);
+ mpfr_set_str1 (xx, xs); /* should be exact */
+ test_sin (s, xx, rnd_mode);
+ if (mpfr_cmp_str1 (s, sin_xs))
+ {
+ printf ("mpfr_sin failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_sin gives sin(x)=");
+ mpfr_out_str (stdout, 10, 0, s, MPFR_RNDN);
+ printf (", expected %s\n", sin_xs);
+ exit (1);
+ }
+ mpfr_clear (xx);
+ mpfr_clear (s);
+}
+
+static void
+check53b (const char *xs, const char *sin_xs, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, s;
+
+ mpfr_init2 (xx, 53);
+ mpfr_init2 (s, 53);
+ mpfr_set_str (xx, xs, 2, MPFR_RNDN); /* should be exact */
+ test_sin (s, xx, rnd_mode);
+ if (mpfr_cmp_str (s, sin_xs, 2, MPFR_RNDN))
+ {
+ printf ("mpfr_sin failed in rounding mode %s for\n x = %s\n",
+ mpfr_print_rnd_mode (rnd_mode), xs);
+ printf (" got ");
+ mpfr_out_str (stdout, 2, 0, s, MPFR_RNDN);
+ printf ("\nexpected %s\n", sin_xs);
+ exit (1);
+ }
+ mpfr_clear (xx);
+ mpfr_clear (s);
+}
+
+static void
+test_sign (void)
+{
+ mpfr_t pid, piu, x, y;
+ int p, k;
+
+ mpfr_init2 (pid, 4096);
+ mpfr_const_pi (pid, MPFR_RNDD);
+ mpfr_init2 (piu, 4096);
+ mpfr_const_pi (piu, MPFR_RNDU);
+ mpfr_init (x);
+ mpfr_init2 (y, 2);
+ for (p = 8; p <= 128; p++)
+ for (k = 2; k <= 6; k += 2)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_mul_ui (x, pid, k, MPFR_RNDD);
+ test_sin (y, x, MPFR_RNDN);
+ if (MPFR_SIGN(y) > 0)
+ {
+ printf ("Error in test_sign for sin(%dpi-epsilon), prec = %d"
+ " for argument.\nResult should have been negative.\n",
+ k, p);
+ exit (1);
+ }
+ mpfr_mul_ui (x, piu, k, MPFR_RNDU);
+ test_sin (y, x, MPFR_RNDN);
+ if (MPFR_SIGN(y) < 0)
+ {
+ printf ("Error in test_sign for sin(%dpi+epsilon), prec = %d"
+ " for argument.\nResult should have been positive.\n",
+ k, p);
+ exit (1);
+ }
+ }
+
+ /* worst case on 53 bits */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str (x, "6134899525417045", 10, MPFR_RNDN);
+ test_sin (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "11011010111101011110111100010101010101110000000001011E-106");
+ MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
+
+ /* Bug on Special cases */
+ mpfr_set_str_binary (x, "0.100011011010111101E-32");
+ test_sin (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.10001101101011110100000000000000000000000000000000000E-32", 2, MPFR_RNDN))
+ {
+ printf("sin special 97 error:\nx=");
+ mpfr_dump (x); printf("y=");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "1.1001001000011111101101010100010001000010110100010011");
+ mpfr_set_str_binary (y, "1.1111111111111111111111111111111111111111111111111111e-1");
+ test_sin (x, x, MPFR_RNDZ);
+ MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
+
+ mpfr_clear (pid);
+ mpfr_clear (piu);
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ test_sin (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sin(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ test_sin (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sin(Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ test_sin (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: sin(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION test_sin
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+const char xs[] = "0.111011111110110000111000001100000111110E-1";
+
+static void
+check_regression (void)
+{
+ mpfr_t x, y;
+ mpfr_prec_t p;
+ int i;
+
+ p = strlen (xs) - 2 - 3;
+ mpfr_inits2 (p, x, y, (mpfr_ptr) 0);
+
+ mpfr_set_str (x, xs, 2, MPFR_RNDN);
+ i = mpfr_sin (y, x, MPFR_RNDN);
+ if (i >= 0
+ || mpfr_cmp_str (y, "0.111001110011110011110001010110011101110E-1",
+ 2, MPFR_RNDN))
+ {
+ printf ("Regression test failed (1) i=%d\ny=", i);
+ mpfr_dump (y);
+ exit (1);
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+/* Test provided by Christopher Creutzig, 2007-05-21. */
+static void
+check_tiny (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin ());
+ mpfr_sin (y, x, MPFR_RNDD);
+ if (mpfr_cmp (x, y) < 0)
+ {
+ printf ("Error in check_tiny: got sin(x) > x for x = 2^(emin-1)\n");
+ exit (1);
+ }
+
+ mpfr_sin (y, x, MPFR_RNDU);
+ mpfr_mul_2ui (y, y, 1, MPFR_RNDU);
+ if (mpfr_cmp (x, y) > 0)
+ {
+ printf ("Error in check_tiny: got sin(x) < x/2 for x = 2^(emin-1)\n");
+ exit (1);
+ }
+
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sin (y, x, MPFR_RNDU);
+ if (mpfr_cmp (x, y) > 0)
+ {
+ printf ("Error in check_tiny: got sin(x) < x for x = -2^(emin-1)\n");
+ exit (1);
+ }
+
+ mpfr_sin (y, x, MPFR_RNDD);
+ mpfr_mul_2ui (y, y, 1, MPFR_RNDD);
+ if (mpfr_cmp (x, y) < 0)
+ {
+ printf ("Error in check_tiny: got sin(x) > x/2 for x = -2^(emin-1)\n");
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, c, s, c2, s2;
+
+ tests_start_mpfr ();
+
+ check_regression ();
+ check_nans ();
+
+ /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", MPFR_RNDN);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", MPFR_RNDD);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", MPFR_RNDZ);
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", MPFR_RNDU);
+ check53 ("1.00031274099908640274", "8.416399183372403892e-1", MPFR_RNDN);
+ check53 ("1.00229256850978698523", "8.427074524447979442e-1", MPFR_RNDZ);
+ check53 ("1.00288304857059840103", "8.430252033025980029e-1", MPFR_RNDZ);
+ check53 ("1.00591265847407274059", "8.446508805292128885e-1", MPFR_RNDN);
+
+ /* Other worst cases showing a bug introduced on 2005-01-29 in rev 3248 */
+ check53b ("1.0111001111010111010111111000010011010001110001111011e-21",
+ "1.0111001111010111010111111000010011010001101001110001e-21",
+ MPFR_RNDU);
+ check53b ("1.1011101111111010000001010111000010000111100100101101",
+ "1.1111100100101100001111100000110011110011010001010101e-1",
+ MPFR_RNDU);
+
+ mpfr_init2 (x, 2);
+
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ test_sin (x, x, MPFR_RNDD);
+ if (mpfr_cmp_ui_2exp (x, 3, -3)) /* x != 0.375 = 3/8 */
+ {
+ printf ("mpfr_sin(0.5, MPFR_RNDD) failed with precision=2\n");
+ exit (1);
+ }
+
+ /* bug found by Kevin Ryde */
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_ui (x, x, 3L, MPFR_RNDN);
+ mpfr_div_ui (x, x, 2L, MPFR_RNDN);
+ test_sin (x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) >= 0)
+ {
+ printf ("Error: wrong sign for sin(3*Pi/2)\n");
+ exit (1);
+ }
+
+ /* Can fail on an assert */
+ mpfr_set_prec (x, 53);
+ mpfr_set_str (x, "77291789194529019661184401408", 10, MPFR_RNDN);
+ mpfr_init2 (c, 4); mpfr_init2 (s, 42);
+ mpfr_init2 (c2, 4); mpfr_init2 (s2, 42);
+
+ test_sin (s, x, MPFR_RNDN);
+ mpfr_cos (c, x, MPFR_RNDN);
+ mpfr_sin_cos (s2, c2, x, MPFR_RNDN);
+ if (mpfr_cmp (c2, c))
+ {
+ printf("cos differs for x=77291789194529019661184401408");
+ exit (1);
+ }
+ if (mpfr_cmp (s2, s))
+ {
+ printf("sin differs for x=77291789194529019661184401408");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (x, "1.1001001000011111101101010100010001000010110100010011");
+ test_sin (x, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (x, "1.1111111111111111111111111111111111111111111111111111e-1", 2, MPFR_RNDN))
+ {
+ printf ("Error for x= 1.1001001000011111101101010100010001000010110100010011\nGot ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (s, 9);
+ mpfr_set_prec (x, 190);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_sin (s, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (s, "0.100000101e-196", 2, MPFR_RNDN))
+ {
+ printf ("Error for x ~= pi\n");
+ mpfr_dump (s);
+ exit (1);
+ }
+
+ mpfr_clear (s2);
+ mpfr_clear (c2);
+ mpfr_clear (s);
+ mpfr_clear (c);
+ mpfr_clear (x);
+
+ test_generic (2, 100, 15);
+ test_sign ();
+ check_tiny ();
+
+ data_check ("data/sin", mpfr_sin, "mpfr_sin");
+ bad_cases (mpfr_sin, mpfr_asin, "mpfr_sin", 256, -40, 0, 4, 128, 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c
new file mode 100644
index 0000000..380a333
--- /dev/null
+++ b/tests/tsin_cos.c
@@ -0,0 +1,725 @@
+/* Test file for mpfr_sin_cos.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+large_test (char *X, int prec, int N)
+{
+ int i;
+ mpfr_t x, s, c;
+
+ mpfr_init2 (x, prec);
+ mpfr_init2 (s, prec);
+ mpfr_init2 (c, prec);
+ mpfr_set_str (x, X, 10, MPFR_RNDN);
+
+ for (i = 0; i < N; i++)
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+
+ mpfr_clear (x);
+ mpfr_clear (s);
+ mpfr_clear (c);
+}
+
+static void
+check53 (const char *xs, const char *sin_xs, const char *cos_xs,
+ mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, s, c;
+
+ mpfr_inits2 (53, xx, s, c, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs); /* should be exact */
+ mpfr_sin_cos (s, c, xx, rnd_mode);
+ if (mpfr_cmp_str1 (s, sin_xs))
+ {
+ printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_sin_cos gives sin(x)=");
+ mpfr_out_str(stdout, 10, 0, s, MPFR_RNDN);
+ printf(", expected %s\n", sin_xs);
+ exit (1);
+ }
+ if (mpfr_cmp_str1 (c, cos_xs))
+ {
+ printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_sin_cos gives cos(x)=");
+ mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN);
+ printf(", expected %s\n", cos_xs);
+ exit (1);
+ }
+ mpfr_clears (xx, s, c, (mpfr_ptr) 0);
+}
+
+static void
+check53sin (const char *xs, const char *sin_xs, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, s, c;
+
+ mpfr_inits2 (53, xx, s, c, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs); /* should be exact */
+ mpfr_sin_cos (s, c, xx, rnd_mode);
+ if (mpfr_cmp_str1 (s, sin_xs))
+ {
+ printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_sin_cos gives sin(x)=");
+ mpfr_out_str(stdout, 10, 0, s, MPFR_RNDN);
+ printf(", expected %s\n", sin_xs);
+ exit (1);
+ }
+ mpfr_clears (xx, s, c, (mpfr_ptr) 0);
+}
+
+static void
+check53cos (const char *xs, const char *cos_xs, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t xx, c, s;
+
+ mpfr_inits2 (53, xx, s, c, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs); /* should be exact */
+ mpfr_sin_cos (s, c, xx, rnd_mode);
+ if (mpfr_cmp_str1 (c, cos_xs))
+ {
+ printf ("mpfr_sin_cos failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_sin_cos gives cos(x)=");
+ mpfr_out_str(stdout, 10, 0, c, MPFR_RNDN);
+ printf(", expected %s\n", cos_xs);
+ exit (1);
+ }
+ mpfr_clears (xx, s, c, (mpfr_ptr) 0);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, s, c;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (s, 123L);
+ mpfr_init2 (c, 123L);
+
+ /* sin(NaN)==NaN, cos(NaN)==NaN */
+ mpfr_set_nan (x);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (s));
+ MPFR_ASSERTN (mpfr_nan_p (c));
+
+ /* sin(+Inf)==NaN, cos(+Inf)==NaN */
+ mpfr_set_inf (x, 1);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (s));
+ MPFR_ASSERTN (mpfr_nan_p (c));
+
+ /* sin(-Inf)==NaN, cos(-Inf)==NaN */
+ mpfr_set_inf (x, -1);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (s));
+ MPFR_ASSERTN (mpfr_nan_p (c));
+
+ /* check zero */
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (s, 0) == 0 && MPFR_IS_POS (s));
+ MPFR_ASSERTN (mpfr_cmp_ui (c, 1) == 0);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_ui (s, 0) == 0 && MPFR_IS_NEG (s));
+ MPFR_ASSERTN (mpfr_cmp_ui (c, 1) == 0);
+
+ /* coverage test */
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 4, MPFR_RNDN);
+ mpfr_set_prec (s, 2);
+ mpfr_set_prec (c, 2);
+ mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (s, -3, -2) == 0);
+ MPFR_ASSERTN (mpfr_cmp_si_2exp (c, -3, -2) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (s);
+ mpfr_clear (c);
+}
+
+static void
+overflowed_sin_cos0 (void)
+{
+ mpfr_t x, y, z;
+ int emax, inex, rnd, err = 0;
+ mpfr_exp_t old_emax;
+
+ old_emax = mpfr_get_emax ();
+
+ mpfr_init2 (x, 8);
+ mpfr_init2 (y, 8);
+ mpfr_init2 (z, 8);
+
+ for (emax = -1; emax <= 0; emax++)
+ {
+ mpfr_set_ui_2exp (z, 1, emax, MPFR_RNDN);
+ mpfr_nextbelow (z);
+ set_emax (emax); /* 1 is not representable. */
+ /* and if emax < 0, 1 - eps is not representable either. */
+ RND_LOOP (rnd)
+ {
+ mpfr_set_si (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_clear_flags ();
+ inex = mpfr_sin_cos (x, y, x, (mpfr_rnd_t) rnd);
+ if (! mpfr_overflow_p ())
+ {
+ printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
+ " The overflow flag is not set.\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_zero_p (x) && MPFR_SIGN (x) < 0))
+ {
+ printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
+ " Got sin = ", mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (x);
+ printf (" instead of -0.\n");
+ err = 1;
+ }
+ if (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ {
+ if (inex == 0)
+ {
+ printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
+ " The inexact value must be non-zero.\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! mpfr_equal_p (y, z))
+ {
+ printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
+ " Got cos = ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (y);
+ printf (" instead of 0.11111111E%d.\n", emax);
+ err = 1;
+ }
+ }
+ else
+ {
+ if (inex == 0)
+ {
+ printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
+ " The inexact value must be non-zero.\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ err = 1;
+ }
+ if (! (mpfr_inf_p (y) && MPFR_SIGN (y) > 0))
+ {
+ printf ("Error in overflowed_sin_cos0 (rnd = %s):\n"
+ " Got cos = ",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ mpfr_print_binary (y);
+ printf (" instead of +Inf.\n");
+ err = 1;
+ }
+ }
+ }
+ set_emax (old_emax);
+ }
+
+ if (err)
+ exit (1);
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+tiny (void)
+{
+ mpfr_t x, s, c;
+ int i, inex;
+
+ mpfr_inits2 (64, x, s, c, (mpfr_ptr) 0);
+
+ for (i = -1; i <= 1; i += 2)
+ {
+ mpfr_set_si (x, i, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin ());
+ inex = mpfr_sin_cos (s, c, x, MPFR_RNDN);
+ MPFR_ASSERTN (inex != 0);
+ MPFR_ASSERTN (mpfr_equal_p (s, x));
+ MPFR_ASSERTN (!mpfr_nan_p (c) && mpfr_cmp_ui (c, 1) == 0);
+ }
+
+ mpfr_clears (x, s, c, (mpfr_ptr) 0);
+}
+
+/* bug found in nightly tests */
+static void
+test20071214 (void)
+{
+ mpfr_t a, b;
+ int inex;
+
+ mpfr_init2 (a, 4);
+ mpfr_init2 (b, 4);
+
+ mpfr_set_ui_2exp (a, 3, -4, MPFR_RNDN);
+ inex = mpfr_sin_cos (a, b, a, MPFR_RNDD);
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 11, -6) == 0);
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (b, 15, -4) == 0);
+ MPFR_ASSERTN(inex == 10);
+
+ mpfr_set_ui_2exp (a, 3, -4, MPFR_RNDN);
+ inex = mpfr_sin_cos (a, b, a, MPFR_RNDU);
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 3, -4) == 0);
+ MPFR_ASSERTN(mpfr_cmp_ui (b, 1) == 0);
+ MPFR_ASSERTN(inex == 5);
+
+ mpfr_set_ui_2exp (a, 3, -4, MPFR_RNDN);
+ inex = mpfr_sin_cos (a, b, a, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 3, -4) == 0);
+ MPFR_ASSERTN(mpfr_cmp_ui (b, 1) == 0);
+ MPFR_ASSERTN(inex == 5);
+
+ mpfr_clear (a);
+ mpfr_clear (b);
+}
+
+/* check that mpfr_sin_cos and test_mpfr_sincos_fast agree */
+static void
+test_mpfr_sincos_fast (void)
+{
+ mpfr_t x, y, z, yref, zref, h;
+ mpfr_prec_t p = 1000;
+ int i, inex, inexref;
+ mpfr_rnd_t r;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, p);
+ mpfr_init2 (yref, p);
+ mpfr_init2 (zref, p);
+ mpfr_init2 (h, p);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ /* we generate a random value x, compute sin(x) and cos(x) with both
+ mpfr_sin_cos and mpfr_sincos_fast, and check the values and the flags
+ agree */
+ for (i = 0; i < 100; i++)
+ {
+ mpfr_urandomb (h, RANDS);
+ mpfr_add (x, x, h, MPFR_RNDN);
+ r = RND_RAND ();
+ inexref = mpfr_sin_cos (yref, zref, x, r);
+ inex = mpfr_sincos_fast (y, z, x, r);
+ if (mpfr_cmp (y, yref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree\n");
+ printf ("x="); mpfr_dump (x);
+ printf ("rnd=%s\n", mpfr_print_rnd_mode (r));
+ printf ("yref="); mpfr_dump (yref);
+ printf ("y="); mpfr_dump (y);
+ exit (1);
+ }
+ if (mpfr_cmp (z, zref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree\n");
+ printf ("x="); mpfr_dump (x);
+ printf ("rnd=%s\n", mpfr_print_rnd_mode (r));
+ printf ("zref="); mpfr_dump (zref);
+ printf ("z="); mpfr_dump (z);
+ exit (1);
+ }
+ if (inex != inexref)
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree\n");
+ printf ("x="); mpfr_dump (x);
+ printf ("rnd=%s\n", mpfr_print_rnd_mode (r));
+ printf ("inexref=%d inex=%d\n", inexref, inex);
+ exit (1);
+ }
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (yref);
+ mpfr_clear (zref);
+ mpfr_clear (h);
+}
+
+static void
+bug20091007 (void)
+{
+ mpfr_t x, y, z, yref, zref;
+ mpfr_prec_t p = 1000;
+ int inex, inexref;
+ mpfr_rnd_t r = MPFR_RNDZ;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, p);
+ mpfr_init2 (yref, p);
+ mpfr_init2 (zref, p);
+
+ mpfr_set_str (x, "1.9ecdc22ba77a5ab2560f7e84289e2a328906f47377ea3fd4c82d1bb2f13ee05c032cffc1933eadab7b0a5498e03e3bd0508968e59c25829d97a0b54f20cd4662c8dfffa54e714de41fc8ee3e0e0b244d110a194db05b70022b7d77f88955d415b09f17dd404576098dc51a583a3e49c35839551646e880c7eb790a01a4@1", 16, MPFR_RNDN);
+ inexref = mpfr_sin_cos (yref, zref, x, r);
+ inex = mpfr_sincos_fast (y, z, x, r);
+
+ if (mpfr_cmp (y, yref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091007)\n");
+ printf ("yref="); mpfr_dump (yref);
+ printf ("y="); mpfr_dump (y);
+ exit (1);
+ }
+ if (mpfr_cmp (z, zref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091007)\n");
+ printf ("zref="); mpfr_dump (zref);
+ printf ("z="); mpfr_dump (z);
+ exit (1);
+ }
+ if (inex != inexref)
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091007)\n");
+ printf ("inexref=%d inex=%d\n", inexref, inex);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (yref);
+ mpfr_clear (zref);
+}
+
+/* Note: with the sin_cos.c code before r6507, the disagreement occurs
+ only on the return ("inexact") value, which is new in r6444. */
+static void
+bug20091008 (void)
+{
+ mpfr_t x, y, z, yref, zref;
+ mpfr_prec_t p = 1000;
+ int inex, inexref;
+ mpfr_rnd_t r = MPFR_RNDN;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, p);
+ mpfr_init2 (yref, p);
+ mpfr_init2 (zref, p);
+
+ mpfr_set_str (x, "c.91813724e28ef6a711d33e6505984699daef7fe93636c1ed5d0168bc96989cc6802f7f9e405c902ec62fb90cd39c9d21084c8ad8b5af4c4aa87bf402e2e4a78e6fe1ffeb6dbbbdbbc2983c196c518966ccc1e094ed39ee77984ef2428069d65de37928e75247edbe7007245e682616b5ebbf05f2fdefc74ad192024f10", 16, MPFR_RNDN);
+ inexref = mpfr_sin_cos (yref, zref, x, r);
+ inex = mpfr_sincos_fast (y, z, x, r);
+
+ if (mpfr_cmp (y, yref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091008)\n");
+ printf ("yref="); mpfr_dump (yref);
+ printf ("y="); mpfr_dump (y);
+ exit (1);
+ }
+ if (mpfr_cmp (z, zref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091008)\n");
+ printf ("zref="); mpfr_dump (zref);
+ printf ("z="); mpfr_dump (z);
+ exit (1);
+ }
+ /* sin(x) is rounded up, cos(x) is rounded up too, thus we should get 5
+ for the return value */
+ if (inex != inexref)
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091008)\n");
+ printf ("inexref=%d inex=%d (5 expected)\n", inexref, inex);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (yref);
+ mpfr_clear (zref);
+}
+
+static void
+bug20091013 (void)
+{
+ mpfr_t x, y, z, yref, zref;
+ mpfr_prec_t p = 1000;
+ int inex, inexref;
+ mpfr_rnd_t r = MPFR_RNDN;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, p);
+ mpfr_init2 (yref, p);
+ mpfr_init2 (zref, p);
+
+ mpfr_set_str (x, "3.240ff3fdcb1ee7cd667b96287593ae24e20fb63ed7c2d5bf4bd0f2cc5509283b04e7628e66382605f14ed5967cef15296041539a1bdaa626c777c7fbb6f2068414759b78cee14f37848689b3a170f583656be4e0837f464d8210556a3a822d4ecfdd59f4e0d5fdb76bf7e15b8a57234e2160b98e14c17bbdf27c4643b8@1", 16, MPFR_RNDN);
+ inexref = mpfr_sin_cos (yref, zref, x, r);
+ inex = mpfr_sincos_fast (y, z, x, r);
+
+ if (mpfr_cmp (y, yref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091013)\n");
+ printf ("yref="); mpfr_dump (yref);
+ printf ("y="); mpfr_dump (y);
+ exit (1);
+ }
+ if (mpfr_cmp (z, zref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091013)\n");
+ printf ("zref="); mpfr_dump (zref);
+ printf ("z="); mpfr_dump (z);
+ exit (1);
+ }
+ /* sin(x) is rounded down and cos(x) is rounded down, thus we should get
+ 2+4*2 = 10 as return value */
+ if (inex != inexref)
+ {
+ printf ("mpfr_sin_cos and mpfr_sincos_fast disagree (bug20091013)\n");
+ printf ("inexref=%d inex=%d (10 expected)\n", inexref, inex);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (yref);
+ mpfr_clear (zref);
+}
+
+/* Bug reported by Laurent Fousse for the 2.4 branch.
+ No problem in the trunk.
+ https://sympa.inria.fr/sympa/arc/mpfr/2009-11/msg00044.html */
+static void
+bug20091122 (void)
+{
+ mpfr_t x, y, z, yref, zref;
+ mpfr_prec_t p = 3;
+ mpfr_rnd_t r = MPFR_RNDN;
+
+ mpfr_init2 (x, 5);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, p);
+ mpfr_init2 (yref, p);
+ mpfr_init2 (zref, p);
+
+ mpfr_set_str (x, "0.11111E49", 2, MPFR_RNDN);
+ mpfr_sin_cos (yref, zref, x, r);
+
+ mpfr_sin (y, x, r);
+ mpfr_cos (z, x, r);
+
+ if (! mpfr_equal_p (y, yref))
+ {
+ printf ("mpfr_sin_cos and mpfr_sin disagree (bug20091122)\n");
+ printf ("yref = "); mpfr_dump (yref);
+ printf ("y = "); mpfr_dump (y);
+ exit (1);
+ }
+ if (! mpfr_equal_p (z, zref))
+ {
+ printf ("mpfr_sin_cos and mpfr_cos disagree (bug20091122)\n");
+ printf ("zref = "); mpfr_dump (zref);
+ printf ("z = "); mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (yref);
+ mpfr_clear (zref);
+}
+
+static void
+consistency (void)
+{
+ mpfr_t x, s1, s2, c1, c2;
+ mpfr_exp_t emin, emax;
+ mpfr_rnd_t rnd;
+ unsigned int flags_sin, flags_cos, flags, flags_before, flags_ref;
+ int inex_sin, is, inex_cos, ic, inex, inex_ref;
+ int i;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ for (i = 0; i <= 10000; i++)
+ {
+ mpfr_init2 (x, MPFR_PREC_MIN + (randlimb () % 8));
+ mpfr_inits2 (MPFR_PREC_MIN + (randlimb () % 8), s1, s2, c1, c2,
+ (mpfr_ptr) 0);
+ if (i < 8 * MPFR_RND_MAX)
+ {
+ int j = i / MPFR_RND_MAX;
+ if (j & 1)
+ mpfr_set_emin (MPFR_EMIN_MIN);
+ mpfr_set_si (x, (j & 2) ? 1 : -1, MPFR_RNDN);
+ mpfr_set_exp (x, mpfr_get_emin ());
+ rnd = (mpfr_rnd_t) (i % MPFR_RND_MAX);
+ flags_before = 0;
+ if (j & 4)
+ mpfr_set_emax (-17);
+ }
+ else
+ {
+ tests_default_random (x, 256, -5, 50);
+ rnd = RND_RAND ();
+ flags_before = (randlimb () & 1) ?
+ (unsigned int) (MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE) :
+ (unsigned int) 0;
+ }
+ __gmpfr_flags = flags_before;
+ inex_sin = mpfr_sin (s1, x, rnd);
+ is = inex_sin < 0 ? 2 : inex_sin > 0 ? 1 : 0;
+ flags_sin = __gmpfr_flags;
+ __gmpfr_flags = flags_before;
+ inex_cos = mpfr_cos (c1, x, rnd);
+ ic = inex_cos < 0 ? 2 : inex_cos > 0 ? 1 : 0;
+ flags_cos = __gmpfr_flags;
+ __gmpfr_flags = flags_before;
+ inex = mpfr_sin_cos (s2, c2, x, rnd);
+ flags = __gmpfr_flags;
+ inex_ref = is + 4 * ic;
+ flags_ref = flags_sin | flags_cos;
+ if (!(mpfr_equal_p (s1, s2) && mpfr_equal_p (c1, c2)) ||
+ inex != inex_ref || flags != flags_ref)
+ {
+ printf ("mpfr_sin_cos and mpfr_sin/mpfr_cos disagree on %s,"
+ " i = %d\nx = ", mpfr_print_rnd_mode (rnd), i);
+ mpfr_dump (x);
+ printf ("s1 = ");
+ mpfr_dump (s1);
+ printf ("s2 = ");
+ mpfr_dump (s2);
+ printf ("c1 = ");
+ mpfr_dump (c1);
+ printf ("c2 = ");
+ mpfr_dump (c2);
+ printf ("inex_sin = %d (s = %d), inex_cos = %d (c = %d), "
+ "inex = %d (expected %d)\n",
+ inex_sin, is, inex_cos, ic, inex, inex_ref);
+ printf ("flags_sin = 0x%x, flags_cos = 0x%x, "
+ "flags = 0x%x (expected 0x%x)\n",
+ flags_sin, flags_cos, flags, flags_ref);
+ exit (1);
+ }
+ mpfr_clears (x, s1, s2, c1, c2, (mpfr_ptr) 0);
+ mpfr_set_emin (emin);
+ mpfr_set_emax (emax);
+ }
+}
+
+static void
+coverage_01032011 (void)
+{
+ mpfr_t val, cval, sval, svalf;
+ int status_f, status;
+
+ mpfr_init2 (val, MPFR_PREC_MIN);
+ mpfr_init2 (cval, MPFR_PREC_MIN);
+ mpfr_init2 (sval, MPFR_PREC_MIN);
+ mpfr_init2 (svalf, MPFR_PREC_MIN);
+
+ mpfr_set_str1 (val, "-0.7");
+
+ status_f = mpfr_sincos_fast (svalf, NULL, val, MPFR_RNDN);
+ status = mpfr_sin_cos (sval, cval, val, MPFR_RNDN);
+ if (! mpfr_equal_p (svalf, sval) || SIGN (status_f) != SIGN (status))
+ {
+ printf ("mpfr_sincos_fast differ from mpfr_sin_cos result:\n"
+ " sin fast is ");
+ mpfr_dump (svalf);
+ printf (" sin is ");
+ mpfr_dump (sval);
+ printf ("status_f = %d, status = %d\n", status_f, status);
+ exit (1);
+ }
+
+ mpfr_clears(val, cval, sval, svalf, (mpfr_ptr) 0);
+}
+
+/* tsin_cos prec [N] performs N tests with prec bits */
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ if (argc > 1)
+ {
+ if (argc != 3 && argc != 4)
+ {
+ fprintf (stderr, "Usage: tsin_cos x prec [n]\n");
+ exit (1);
+ }
+ large_test (argv[1], atoi (argv[2]), (argc > 3) ? atoi (argv[3]) : 1);
+ goto end;
+ }
+
+ bug20091013 ();
+ bug20091008 ();
+ bug20091007 ();
+ bug20091122 ();
+ consistency ();
+
+ test_mpfr_sincos_fast ();
+
+ check_nans ();
+
+ /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1",
+ "8.783012931285841817e-1", MPFR_RNDN);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1",
+ "8.783012931285840707e-1", MPFR_RNDD);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1",
+ "8.783012931285840707e-1", MPFR_RNDZ);
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1",
+ "8.783012931285841817e-1", MPFR_RNDU);
+ check53 ("1.00031274099908640274", "8.416399183372403892e-1",
+ "0.540039116973283217504", MPFR_RNDN);
+ check53 ("1.00229256850978698523", "8.427074524447979442e-1",
+ "0.538371757797526551137", MPFR_RNDZ);
+ check53 ("1.00288304857059840103", "8.430252033025980029e-1",
+ "0.537874062022526966409", MPFR_RNDZ);
+ check53 ("1.00591265847407274059", "8.446508805292128885e-1",
+ "0.53531755997839769456", MPFR_RNDN);
+
+ /* check one argument only */
+ check53sin ("1.00591265847407274059", "8.446508805292128885e-1", MPFR_RNDN);
+ check53cos ("1.00591265847407274059", "0.53531755997839769456", MPFR_RNDN);
+
+ overflowed_sin_cos0 ();
+ tiny ();
+ test20071214 ();
+
+ coverage_01032011 ();
+
+ end:
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsinh.c b/tests/tsinh.c
new file mode 100644
index 0000000..65a006e
--- /dev/null
+++ b/tests/tsinh.c
@@ -0,0 +1,109 @@
+/* Test file for mpfr_sinh.
+
+Copyright 2001, 2002, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_sinh
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x;
+ int i;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+
+ mpfr_set_inf (x, 1);
+ mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
+ mpfr_set_inf (x, -1);
+ mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0);
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_str_binary (x, "-0.1001011001");
+ mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -159, -8) == 0);
+
+ /* corner case */
+ mpfr_set_prec (x, 2);
+ mpfr_set_str_binary (x, "1E-6");
+ mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (x, 1, -6) == 0);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "1E1000000000");
+ i = mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) > 0);
+ MPFR_ASSERTN (mpfr_overflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1E1000000000");
+ i = mpfr_sinh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0);
+ MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == -1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1E1000000000");
+ i = mpfr_sinh (x, x, MPFR_RNDD);
+ MPFR_ASSERTN (MPFR_IS_INF (x) && MPFR_SIGN (x) < 0);
+ MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == -1);
+
+ mpfr_clear_flags ();
+ mpfr_set_str_binary (x, "-1E1000000000");
+ i = mpfr_sinh (x, x, MPFR_RNDU);
+ MPFR_ASSERTN (!MPFR_IS_INF (x) && MPFR_SIGN (x) < 0);
+ MPFR_ASSERTN (mpfr_overflow_p () && !mpfr_underflow_p ());
+ MPFR_ASSERTN (i == 1);
+
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special ();
+
+ test_generic (2, 100, 100);
+
+ data_check ("data/sinh", mpfr_sinh, "mpfr_sinh");
+ bad_cases (mpfr_sinh, mpfr_asinh, "mpfr_sinh", 256, -256, 255,
+ 4, 128, 800, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsinh_cosh.c b/tests/tsinh_cosh.c
new file mode 100644
index 0000000..2b3d6e8
--- /dev/null
+++ b/tests/tsinh_cosh.c
@@ -0,0 +1,143 @@
+/* Test file for mpfr_sinh_cosh.
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+failed (mpfr_t x, mpfr_t esh, mpfr_t gsh, mpfr_t ech, mpfr_t gch)
+{
+ printf ("error : mpfr_sinh_cosh (x) x = ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDD);
+ printf ("\nsinh(x) expected ");
+ mpfr_out_str (stdout, 10, 0, esh, MPFR_RNDD);
+ printf ("\n got ");
+ mpfr_out_str (stdout, 10, 0, gsh, MPFR_RNDD);
+ printf ("\ncosh(x) expected ");
+ mpfr_out_str (stdout, 10, 0, ech, MPFR_RNDD);
+ printf ("\n got ");
+ mpfr_out_str (stdout, 10, 0, gch, MPFR_RNDD);
+ putchar ('\n');
+
+ mpfr_clears (x, esh, gsh, ech, gch, (mpfr_ptr) 0);
+ exit (1);
+}
+
+/* check against sinh, cosh */
+static void
+check (mpfr_t x, mpfr_rnd_t rnd)
+{
+ mpfr_t s, c, sx, cx;
+ int isc, is, ic;
+
+ mpfr_inits2 (MPFR_PREC(x), s, c, sx, cx, (mpfr_ptr) 0);
+
+ isc = mpfr_sinh_cosh (sx, cx, x, rnd);
+ is = mpfr_sinh (s, x, rnd);
+ ic = mpfr_cosh (c, x, rnd);
+
+ if (!mpfr_equal_p (s, sx) || !mpfr_equal_p (c, cx))
+ failed (x, s, sx, c, cx);
+ MPFR_ASSERTN (isc = is || ic);
+
+ mpfr_clears (s, c, sx, cx, (mpfr_ptr) 0);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, sh, ch;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (sh, 123);
+ mpfr_init2 (ch, 123);
+
+ /* nan */
+ mpfr_set_nan (x);
+ mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (sh));
+ MPFR_ASSERTN (mpfr_nan_p (ch));
+
+ /* +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (sh));
+ MPFR_ASSERTN (mpfr_sgn (sh) > 0);
+ MPFR_ASSERTN (mpfr_inf_p (ch));
+ MPFR_ASSERTN (mpfr_sgn (ch) > 0);
+
+ /* -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_sinh_cosh (sh, ch, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (sh));
+ MPFR_ASSERTN (mpfr_sgn (sh) < 0);
+ MPFR_ASSERTN (mpfr_inf_p (ch));
+ MPFR_ASSERTN (mpfr_sgn (ch) > 0);
+
+ mpfr_clear (x);
+ mpfr_clear (sh);
+ mpfr_clear (ch);
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ mpfr_t x;
+
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ /* check against values given by sinh(x), cosh(x) */
+ mpfr_init2 (x, 53);
+ mpfr_set_str (x, "FEDCBA987654321p-48", 16, MPFR_RNDN);
+ for (i = 0; i < 10; ++i)
+ {
+ /* x = i - x / 2 : boggle sign and bits */
+ mpfr_ui_sub (x, i, x, MPFR_RNDD);
+ mpfr_div_2ui (x, x, 2, MPFR_RNDD);
+
+ check (x, MPFR_RNDN);
+ check (x, MPFR_RNDU);
+ check (x, MPFR_RNDD);
+ }
+ mpfr_clear (x);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tsprintf.c b/tests/tsprintf.c
new file mode 100644
index 0000000..ae67eb6
--- /dev/null
+++ b/tests/tsprintf.c
@@ -0,0 +1,1239 @@
+/* tsprintf.c -- test file for mpfr_sprintf, mpfr_vsprintf, mpfr_snprintf,
+ and mpfr_vsnprintf
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifdef HAVE_STDARG
+#include <stdarg.h>
+
+#include <stdlib.h>
+#include <float.h>
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+const int prec_max_printf = 5000; /* limit for random precision in
+ random_double() */
+#define BUF_SIZE 65536
+
+const char pinf_str[] = "inf";
+const char pinf_uc_str[] = "INF";
+const char minf_str[] = "-inf";
+const char minf_uc_str[] = "-INF";
+const char nan_str[] = "nan";
+const char nan_uc_str[] = "NAN";
+
+/* 1. compare expected string with the string BUFFER returned by
+ mpfr_sprintf(buffer, fmt, x)
+ 2. then test mpfr_snprintf (buffer, p, fmt, x) with a random p. */
+static int
+check_sprintf (const char *expected, const char *fmt, mpfr_srcptr x)
+{
+ int n0, n1, p;
+ char buffer[BUF_SIZE];
+
+ /* test mpfr_sprintf */
+ n0 = mpfr_sprintf (buffer, fmt, x);
+ if (strcmp (buffer, expected) != 0)
+ {
+ printf ("Error in mpfr_sprintf (s, \"%s\", x);\n", fmt);
+ printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer);
+
+ exit (1);
+ }
+
+ /* test mpfr_snprintf */
+ p = (int) (randlimb () % n0);
+ if (p == 0 && (randlimb () & 1) == 0)
+ {
+ n1 = mpfr_snprintf (NULL, 0, fmt, x);
+ }
+ else
+ {
+ buffer[p] = 17;
+ n1 = mpfr_snprintf (buffer, p, fmt, x);
+ if (buffer[p] != 17)
+ {
+ printf ("Buffer overflow in mpfr_snprintf for p = %d!\n", p);
+ exit (1);
+ }
+ }
+ if (n0 != n1)
+ {
+ printf ("Error in mpfr_snprintf (s, %d, \"%s\", x) return value\n",
+ p, fmt);
+ printf ("expected: %d\ngot: %d\n", n0, n1);
+ exit (1);
+ }
+ if ((p > 1 && strncmp (expected, buffer, p-1) != 0)
+ || (p == 1 && buffer[0] != '\0'))
+ {
+ char part_expected[BUF_SIZE];
+ strncpy (part_expected, expected, p);
+ part_expected[p-1] = '\0';
+ printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt);
+ printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer);
+ exit (1);
+ }
+ return n0;
+}
+
+/* 1. compare expected string with the string BUFFER returned by
+ mpfr_vsprintf(buffer, fmt, ...)
+ 2. then, test mpfr_vsnprintf. */
+static int
+check_vsprintf (const char *expected, const char *fmt, ...)
+{
+ int n0, n1, p;
+ char buffer[BUF_SIZE];
+ va_list ap0, ap1;
+ va_start (ap0, fmt);
+ va_start (ap1, fmt);
+
+ n0 = mpfr_vsprintf (buffer, fmt, ap0);
+ if (strcmp (buffer, expected) != 0)
+ {
+ printf ("Error in mpfr_vsprintf (s, \"%s\", ...);\n", fmt);
+ printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer);
+
+ va_end (ap0);
+ va_end (ap1);
+ exit (1);
+ }
+ va_end (ap0);
+
+ /* test mpfr_snprintf */
+ p = (int) (randlimb () % n0);
+ if (p == 0 && (randlimb () & 1) == 0)
+ {
+ n1 = mpfr_vsnprintf (NULL, 0, fmt, ap1);
+ }
+ else
+ {
+ buffer[p] = 17;
+ n1 = mpfr_vsnprintf (buffer, p, fmt, ap1);
+ if (buffer[p] != 17)
+ {
+ printf ("Buffer overflow in mpfr_vsnprintf for p = %d!\n", p);
+ exit (1);
+ }
+ }
+ if (n0 != n1)
+ {
+ printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...) return value\n",
+ p, fmt);
+ printf ("expected: %d\ngot: %d\n", n0, n1);
+
+ va_end (ap1);
+ exit (1);
+ }
+ if ((p > 1 && strncmp (expected, buffer, p-1) != 0)
+ || (p == 1 && buffer[0] != '\0'))
+ {
+ char part_expected[BUF_SIZE];
+ strncpy (part_expected, expected, p);
+ part_expected[p-1] = '\0';
+ printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt);
+ printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer);
+
+ va_end (ap1);
+ exit (1);
+ }
+
+ va_end (ap1);
+ return n0;
+}
+
+static void
+native_types (void)
+{
+ int c = 'a';
+ int i = -1;
+ unsigned int ui = 1;
+ double d = -1.25;
+ char s[] = "test";
+
+ char buf[255];
+
+ sprintf (buf, "%c", c);
+ check_vsprintf (buf, "%c", c);
+
+ sprintf (buf, "%d", i);
+ check_vsprintf (buf, "%d", i);
+
+ sprintf (buf, "%e", d);
+ check_vsprintf (buf, "%e", d);
+
+ sprintf (buf, "%f", d);
+ check_vsprintf (buf, "%f", d);
+
+ sprintf (buf, "%i", i);
+ check_vsprintf (buf, "%i", i);
+
+ sprintf (buf, "%g", d);
+ check_vsprintf (buf, "%g", d);
+
+ sprintf (buf, "%o", i);
+ check_vsprintf (buf, "%o", i);
+
+ sprintf (buf, "%s", s);
+ check_vsprintf (buf, "%s", s);
+
+ sprintf (buf, "--%s++", "");
+ check_vsprintf (buf, "--%s++", "");
+
+ sprintf (buf, "%u", ui);
+ check_vsprintf (buf, "%u", ui);
+
+ sprintf (buf, "%x", ui);
+ check_vsprintf (buf, "%x", ui);
+}
+
+static int
+decimal (void)
+{
+ mpfr_prec_t p = 128;
+ mpfr_t x;
+ mpfr_t z;
+ mpfr_init (z);
+ mpfr_init2 (x, p);
+
+ /* specifier 'P' for precision */
+ check_vsprintf ("128", "%Pu", p);
+ check_vsprintf ("00128", "%.5Pu", p);
+
+ /* special numbers */
+ mpfr_set_inf (x, 1);
+ check_sprintf (pinf_str, "%Re", x);
+ check_sprintf (pinf_str, "%RUe", x);
+ check_sprintf (pinf_uc_str, "%RE", x);
+ check_sprintf (pinf_uc_str, "%RDE", x);
+ check_sprintf (pinf_str, "%Rf", x);
+ check_sprintf (pinf_str, "%RYf", x);
+ check_sprintf (pinf_uc_str, "%RF", x);
+ check_sprintf (pinf_uc_str, "%RZF", x);
+ check_sprintf (pinf_str, "%Rg", x);
+ check_sprintf (pinf_str, "%RNg", x);
+ check_sprintf (pinf_uc_str, "%RG", x);
+ check_sprintf (pinf_uc_str, "%RUG", x);
+ check_sprintf (" inf", "%010Re", x);
+ check_sprintf (" inf", "%010RDe", x);
+
+ mpfr_set_inf (x, -1);
+ check_sprintf (minf_str, "%Re", x);
+ check_sprintf (minf_str, "%RYe", x);
+ check_sprintf (minf_uc_str, "%RE", x);
+ check_sprintf (minf_uc_str, "%RZE", x);
+ check_sprintf (minf_str, "%Rf", x);
+ check_sprintf (minf_str, "%RNf", x);
+ check_sprintf (minf_uc_str, "%RF", x);
+ check_sprintf (minf_uc_str, "%RUF", x);
+ check_sprintf (minf_str, "%Rg", x);
+ check_sprintf (minf_str, "%RDg", x);
+ check_sprintf (minf_uc_str, "%RG", x);
+ check_sprintf (minf_uc_str, "%RYG", x);
+ check_sprintf (" -inf", "%010Re", x);
+ check_sprintf (" -inf", "%010RZe", x);
+
+ mpfr_set_nan (x);
+ check_sprintf (nan_str, "%Re", x);
+ check_sprintf (nan_str, "%RNe", x);
+ check_sprintf (nan_uc_str, "%RE", x);
+ check_sprintf (nan_uc_str, "%RUE", x);
+ check_sprintf (nan_str, "%Rf", x);
+ check_sprintf (nan_str, "%RDf", x);
+ check_sprintf (nan_uc_str, "%RF", x);
+ check_sprintf (nan_uc_str, "%RYF", x);
+ check_sprintf (nan_str, "%Rg", x);
+ check_sprintf (nan_str, "%RZg", x);
+ check_sprintf (nan_uc_str, "%RG", x);
+ check_sprintf (nan_uc_str, "%RNG", x);
+ check_sprintf (" nan", "%010Re", x);
+
+ /* positive numbers */
+ mpfr_set_str (x, "18993474.61279296875", 10, MPFR_RNDN);
+ mpfr_set_ui (z, 0, MPFR_RNDD);
+
+ /* simplest case right justified */
+ check_sprintf (" 1.899347461279296875e+07", "%30Re", x);
+ check_sprintf (" 2e+07", "%30.0Re", x);
+ check_sprintf (" 18993474.612793", "%30Rf", x);
+ check_sprintf (" 18993474.6127930", "%30.7Rf", x);
+ check_sprintf (" 1.89935e+07", "%30Rg", x);
+ check_sprintf (" 2e+07", "%30.0Rg", x);
+ check_sprintf (" 18993474.61279296875", "%30.19Rg", x);
+ check_sprintf (" 0e+00", "%30.0Re", z);
+ check_sprintf (" 0", "%30.0Rf", z);
+ check_sprintf (" 0.0000", "%30.4Rf", z);
+ check_sprintf (" 0", "%30.0Rg", z);
+ check_sprintf (" 0", "%30.4Rg", z);
+ /* sign or space, pad with leading zeros */
+ check_sprintf (" 000001.899347461279296875E+07", "% 030RE", x);
+ check_sprintf (" 0000000000000000001.89935E+07", "% 030RG", x);
+ check_sprintf (" 0000000000000000000000002E+07", "% 030.0RE", x);
+ check_sprintf (" 0000000000000000000000000E+00", "% 030.0RE", z);
+ check_sprintf (" 00000000000000000000000000000", "% 030.0RF", z);
+ /* sign + or -, left justified */
+ check_sprintf ("+1.899347461279296875e+07 ", "%+-30Re", x);
+ check_sprintf ("+2e+07 ", "%+-30.0Re", x);
+ check_sprintf ("+0e+00 ", "%+-30.0Re", z);
+ check_sprintf ("+0 ", "%+-30.0Rf", z);
+ /* decimal point, left justified, precision and rounding parameter */
+ check_vsprintf ("1.9E+07 ", "%#-10.*R*E", 1, MPFR_RNDN, x);
+ check_vsprintf ("2.E+07 ", "%#*.*R*E", -10, 0, MPFR_RNDN, x);
+ check_vsprintf ("2.E+07 ", "%#-10.*R*G", 0, MPFR_RNDN, x);
+ check_vsprintf ("0.E+00 ", "%#-10.*R*E", 0, MPFR_RNDN, z);
+ check_vsprintf ("0. ", "%#-10.*R*F", 0, MPFR_RNDN, z);
+ check_vsprintf ("0. ", "%#-10.*R*G", 0, MPFR_RNDN, z);
+ /* sign or space */
+ check_sprintf (" 1.899e+07", "% .3RNe", x);
+ check_sprintf (" 2e+07", "% .0RNe", x);
+ /* sign + or -, decimal point, pad with leading zeros */
+ check_sprintf ("+0001.8E+07", "%0+#11.1RZE", x);
+ check_sprintf ("+00001.E+07", "%0+#11.0RZE", x);
+ check_sprintf ("+0000.0E+00", "%0+#11.1RZE", z);
+ check_sprintf ("+00000000.0", "%0+#11.1RZF", z);
+ /* pad with leading zero */
+ check_sprintf ("0000001.899347461279296875e+07", "%030RDe", x);
+ check_sprintf ("00000000000000000000000001e+07", "%030.0RDe", x);
+ /* sign or space, decimal point, left justified */
+ check_sprintf (" 1.8E+07 ", "%- #11.1RDE", x);
+ check_sprintf (" 1.E+07 ", "%- #11.0RDE", x);
+
+ /* negative numbers */
+ mpfr_mul_si (x, x, -1, MPFR_RNDD);
+ mpfr_mul_si (z, z, -1, MPFR_RNDD);
+
+ /* sign + or - */
+ check_sprintf (" -1.8e+07", "%+10.1RUe", x);
+ check_sprintf (" -1e+07", "%+10.0RUe", x);
+ check_sprintf (" -0e+00", "%+10.0RUe", z);
+ check_sprintf (" -0", "%+10.0RUf", z);
+
+
+ /* neighborhood of 1 */
+ mpfr_set_str (x, "0.99993896484375", 10, MPFR_RNDN);
+ check_sprintf ("9.9993896484375E-01 ", "%-20RE", x);
+ check_sprintf ("9.9993896484375E-01 ", "%-20.RE", x);
+ check_sprintf ("1E+00 ", "%-20.0RE", x);
+ check_sprintf ("1.0E+00 ", "%-20.1RE", x);
+ check_sprintf ("1.00E+00 ", "%-20.2RE", x);
+ check_sprintf ("9.999E-01 ", "%-20.3RE", x);
+ check_sprintf ("9.9994E-01 ", "%-20.4RE", x);
+ check_sprintf ("0.999939 ", "%-20RF", x);
+ check_sprintf ("0.999939 ", "%-20.RF", x);
+ check_sprintf ("1 ", "%-20.0RF", x);
+ check_sprintf ("1.0 ", "%-20.1RF", x);
+ check_sprintf ("1.00 ", "%-20.2RF", x);
+ check_sprintf ("1.000 ", "%-20.3RF", x);
+ check_sprintf ("0.9999 ", "%-20.4RF", x);
+ check_sprintf ("0.999939 ", "%-#20RF", x);
+ check_sprintf ("0.999939 ", "%-#20.RF", x);
+ check_sprintf ("1. ", "%-#20.0RF", x);
+ check_sprintf ("1.0 ", "%-#20.1RF", x);
+ check_sprintf ("1.00 ", "%-#20.2RF", x);
+ check_sprintf ("1.000 ", "%-#20.3RF", x);
+ check_sprintf ("0.9999 ", "%-#20.4RF", x);
+ check_sprintf ("1 ", "%-20.0RG", x);
+ check_sprintf ("1 ", "%-20.1RG", x);
+ check_sprintf ("1 ", "%-20.2RG", x);
+ check_sprintf ("1 ", "%-20.3RG", x);
+ check_sprintf ("0.9999 ", "%-20.4RG", x);
+ check_sprintf ("0.999939 ", "%-#20RG", x);
+ check_sprintf ("0.999939 ", "%-#20.RG", x);
+ check_sprintf ("1. ", "%-#20.0RG", x);
+ check_sprintf ("1. ", "%-#20.1RG", x);
+ check_sprintf ("1.0 ", "%-#20.2RG", x);
+ check_sprintf ("1.00 ", "%-#20.3RG", x);
+ check_sprintf ("0.9999 ", "%-#20.4RG", x);
+
+ /* multiple of 10 */
+ mpfr_set_str (x, "1e17", 10, MPFR_RNDN);
+ check_sprintf ("1e+17", "%Re", x);
+ check_sprintf ("1.000e+17", "%.3Re", x);
+ check_sprintf ("100000000000000000", "%.0Rf", x);
+ check_sprintf ("100000000000000000.0", "%.1Rf", x);
+ check_sprintf ("100000000000000000.000000", "%'Rf", x);
+ check_sprintf ("100000000000000000.0", "%'.1Rf", x);
+
+ mpfr_ui_div (x, 1, x, MPFR_RNDN); /* x=1e-17 */
+ check_sprintf ("1e-17", "%Re", x);
+ check_sprintf ("0.000000", "%Rf", x);
+ check_sprintf ("1e-17", "%Rg", x);
+ check_sprintf ("0.0", "%.1RDf", x);
+ check_sprintf ("0.0", "%.1RZf", x);
+ check_sprintf ("0.1", "%.1RUf", x);
+ check_sprintf ("0.1", "%.1RYf", x);
+ check_sprintf ("0", "%.0RDf", x);
+ check_sprintf ("0", "%.0RZf", x);
+ check_sprintf ("1", "%.0RUf", x);
+ check_sprintf ("1", "%.0RYf", x);
+
+ /* multiple of 10 with 'g' style */
+ mpfr_set_str (x, "10", 10, MPFR_RNDN);
+ check_sprintf ("10", "%Rg", x);
+ check_sprintf ("1e+01", "%.0Rg", x);
+ check_sprintf ("1e+01", "%.1Rg", x);
+ check_sprintf ("10", "%.2Rg", x);
+
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
+ check_sprintf ("0.1", "%Rg", x);
+ check_sprintf ("0.1", "%.0Rg", x);
+ check_sprintf ("0.1", "%.1Rg", x);
+
+ mpfr_set_str (x, "1000", 10, MPFR_RNDN);
+ check_sprintf ("1000", "%Rg", x);
+ check_sprintf ("1e+03", "%.0Rg", x);
+ check_sprintf ("1e+03", "%.3Rg", x);
+ check_sprintf ("1000", "%.4Rg", x);
+
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
+ check_sprintf ("0.001", "%Rg", x);
+ check_sprintf ("0.001", "%.0Rg", x);
+ check_sprintf ("0.001", "%.1Rg", x);
+
+ mpfr_set_str (x, "100000", 10, MPFR_RNDN);
+ check_sprintf ("100000", "%Rg", x);
+ check_sprintf ("1e+05", "%.0Rg", x);
+ check_sprintf ("1e+05", "%.5Rg", x);
+ check_sprintf ("100000", "%.6Rg", x);
+
+ mpfr_ui_div (x, 1, x, MPFR_RNDN);
+ check_sprintf ("1e-05", "%Rg", x);
+ check_sprintf ("1e-05", "%.0Rg", x);
+ check_sprintf ("1e-05", "%.1Rg", x);
+
+ /* check rounding mode */
+ mpfr_set_str (x, "0.0076", 10, MPFR_RNDN);
+ check_sprintf ("0.007", "%.3RDF", x);
+ check_sprintf ("0.007", "%.3RZF", x);
+ check_sprintf ("0.008", "%.3RF", x);
+ check_sprintf ("0.008", "%.3RUF", x);
+ check_sprintf ("0.008", "%.3RYF", x);
+ check_vsprintf ("0.008", "%.3R*F", MPFR_RNDA, x);
+
+ /* check limit between %f-style and %g-style */
+ mpfr_set_str (x, "0.0000999", 10, MPFR_RNDN);
+ check_sprintf ("0.0001", "%.0Rg", x);
+ check_sprintf ("9e-05", "%.0RDg", x);
+ check_sprintf ("0.0001", "%.1Rg", x);
+ check_sprintf ("0.0001", "%.2Rg", x);
+ check_sprintf ("9.99e-05", "%.3Rg", x);
+
+ /* trailing zeros */
+ mpfr_set_si_2exp (x, -1, -15, MPFR_RNDN); /* x=-2^-15 */
+ check_sprintf ("-3.0517578125e-05", "%.30Rg", x);
+ check_sprintf ("-3.051757812500000000000000000000e-05", "%.30Re", x);
+ check_sprintf ("-3.05175781250000000000000000000e-05", "%#.30Rg", x);
+ check_sprintf ("-0.000030517578125000000000000000", "%.30Rf", x);
+
+ /* bug 20081023 */
+ check_sprintf ("-3.0517578125e-05", "%.30Rg", x);
+ mpfr_set_str (x, "1.9999", 10, MPFR_RNDN);
+ check_sprintf ("1.999900 ", "%-#10.7RG", x);
+ check_sprintf ("1.9999 ", "%-10.7RG", x);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x);
+ check_sprintf ("1", "%.30Rg", x);
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x);
+ check_sprintf ("0", "%.30Rg", x);
+
+ /* following tests with precision 53 bits */
+ mpfr_set_prec (x, 53);
+
+ /* Exponent zero has a plus sign */
+ mpfr_set_str (x, "-9.95645044213728791504536275169812142849e-01", 10,
+ MPFR_RNDN);
+ check_sprintf ("-1.0e+00", "%- #0.1Re", x);
+
+ /* Decimal point and no figure after it with '#' flag and 'G' style */
+ mpfr_set_str (x, "-9.90597761233942053494e-01", 10, MPFR_RNDN);
+ check_sprintf ("-1.", "%- #0.1RG", x);
+
+ /* precision zero */
+ mpfr_set_d (x, 9.5, MPFR_RNDN);
+ check_sprintf ("9", "%.0RDf", x);
+ check_sprintf ("10", "%.0RUf", x);
+
+ mpfr_set_d (x, 19.5, MPFR_RNDN);
+ check_sprintf ("19", "%.0RDf", x);
+ check_sprintf ("20", "%.0RUf", x);
+
+ mpfr_set_d (x, 99.5, MPFR_RNDN);
+ check_sprintf ("99", "%.0RDf", x);
+ check_sprintf ("100", "%.0RUf", x);
+
+ mpfr_set_d (x, -9.5, MPFR_RNDN);
+ check_sprintf ("-10", "%.0RDf", x);
+ check_sprintf ("-10", "%.0RYf", x);
+ check_sprintf ("-10", "%.0Rf", x);
+ check_sprintf ("-1e+01", "%.0Re", x);
+ check_sprintf ("-1e+01", "%.0Rg", x);
+ mpfr_set_ui_2exp (x, 1, -1, MPFR_RNDN);
+ check_sprintf ("0", "%.0Rf", x);
+ check_sprintf ("5e-01", "%.0Re", x);
+ check_sprintf ("0.5", "%.0Rg", x);
+ mpfr_set_ui_2exp (x, 3, -1, MPFR_RNDN);
+ check_sprintf ("2", "%.0Rf", x);
+ mpfr_set_ui_2exp (x, 5, -1, MPFR_RNDN);
+ check_sprintf ("2", "%.0Rf", x);
+ mpfr_set_ui (x, 0x1f, MPFR_RNDN);
+ check_sprintf ("0x1p+5", "%.0Ra", x);
+ mpfr_set_ui (x, 3, MPFR_RNDN);
+ check_sprintf ("1p+2", "%.0Rb", x);
+
+ /* round to next ten power with %f but not with %g */
+ mpfr_set_str (x, "-6.64464380544039223686e-02", 10, MPFR_RNDN);
+ check_sprintf ("-0.1", "%.1Rf", x);
+ check_sprintf ("-0.0", "%.1RZf", x);
+ check_sprintf ("-0.07", "%.1Rg", x);
+ check_sprintf ("-0.06", "%.1RZg", x);
+
+ /* round to next ten power and do not remove trailing zeros */
+ mpfr_set_str (x, "9.98429393291486722006e-02", 10, MPFR_RNDN);
+ check_sprintf ("0.1", "%#.1Rg", x);
+ check_sprintf ("0.10", "%#.2Rg", x);
+ check_sprintf ("0.099", "%#.2RZg", x);
+
+ /* Halfway cases */
+ mpfr_set_str (x, "1.5", 10, MPFR_RNDN);
+ check_sprintf ("2e+00", "%.0Re", x);
+ mpfr_set_str (x, "2.5", 10, MPFR_RNDN);
+ check_sprintf ("2e+00", "%.0Re", x);
+ mpfr_set_str (x, "9.5", 10, MPFR_RNDN);
+ check_sprintf ("1e+01", "%.0Re", x);
+ mpfr_set_str (x, "1.25", 10, MPFR_RNDN);
+ check_sprintf ("1.2e+00", "%.1Re", x);
+ mpfr_set_str (x, "1.75", 10, MPFR_RNDN);
+ check_sprintf ("1.8e+00", "%.1Re", x);
+ mpfr_set_str (x, "-0.5", 10, MPFR_RNDN);
+ check_sprintf ("-0", "%.0Rf", x);
+ mpfr_set_str (x, "1.25", 10, MPFR_RNDN);
+ check_sprintf ("1.2", "%.1Rf", x);
+ mpfr_set_str (x, "1.75", 10, MPFR_RNDN);
+ check_sprintf ("1.8", "%.1Rf", x);
+ mpfr_set_str (x, "1.5", 10, MPFR_RNDN);
+ check_sprintf ("2", "%.1Rg", x);
+ mpfr_set_str (x, "2.5", 10, MPFR_RNDN);
+ check_sprintf ("2", "%.1Rg", x);
+ mpfr_set_str (x, "9.25", 10, MPFR_RNDN);
+ check_sprintf ("9.2", "%.2Rg", x);
+ mpfr_set_str (x, "9.75", 10, MPFR_RNDN);
+ check_sprintf ("9.8", "%.2Rg", x);
+
+ /* assertion failure in r6320 */
+ mpfr_set_str (x, "-9.996", 10, MPFR_RNDN);
+ check_sprintf ("-10.0", "%.1Rf", x);
+
+ mpfr_clears (x, z, (mpfr_ptr) 0);
+ return 0;
+}
+
+static int
+hexadecimal (void)
+{
+ mpfr_t x, z;
+ mpfr_inits2 (64, x, z, (mpfr_ptr) 0);
+
+ /* special */
+ mpfr_set_inf (x, 1);
+ check_sprintf (pinf_str, "%Ra", x);
+ check_sprintf (pinf_str, "%RUa", x);
+ check_sprintf (pinf_str, "%RDa", x);
+ check_sprintf (pinf_uc_str, "%RA", x);
+ check_sprintf (pinf_uc_str, "%RYA", x);
+ check_sprintf (pinf_uc_str, "%RZA", x);
+ check_sprintf (pinf_uc_str, "%RNA", x);
+
+ mpfr_set_inf (x, -1);
+ check_sprintf (minf_str, "%Ra", x);
+ check_sprintf (minf_str, "%RYa", x);
+ check_sprintf (minf_str, "%RZa", x);
+ check_sprintf (minf_str, "%RNa", x);
+ check_sprintf (minf_uc_str, "%RA", x);
+ check_sprintf (minf_uc_str, "%RUA", x);
+ check_sprintf (minf_uc_str, "%RDA", x);
+
+ mpfr_set_nan (x);
+ check_sprintf (nan_str, "%Ra", x);
+ check_sprintf (nan_uc_str, "%RA", x);
+
+ /* regular numbers */
+ mpfr_set_str (x, "FEDCBA9.87654321", 16, MPFR_RNDN);
+ mpfr_set_ui (z, 0, MPFR_RNDZ);
+
+ /* simplest case right justified */
+ check_sprintf (" 0xf.edcba987654321p+24", "%25Ra", x);
+ check_sprintf (" 0xf.edcba987654321p+24", "%25RUa", x);
+ check_sprintf (" 0xf.edcba987654321p+24", "%25RDa", x);
+ check_sprintf (" 0xf.edcba987654321p+24", "%25RYa", x);
+ check_sprintf (" 0xf.edcba987654321p+24", "%25RZa", x);
+ check_sprintf (" 0xf.edcba987654321p+24", "%25RNa", x);
+ check_sprintf (" 0x1p+28", "%25.0Ra", x);
+ check_sprintf (" 0x0p+0", "%25.0Ra", z);
+ /* sign or space, pad with leading zeros */
+ check_sprintf (" 0X00F.EDCBA987654321P+24", "% 025RA", x);
+ check_sprintf (" 0X000000000000000001P+28", "% 025.0RA", x);
+ check_sprintf (" 0X0000000000000000000P+0", "% 025.0RA", z);
+ /* sign + or -, left justified */
+ check_sprintf ("+0xf.edcba987654321p+24 ", "%+-25Ra", x);
+ check_sprintf ("+0x1p+28 ", "%+-25.0Ra", x);
+ check_sprintf ("+0x0p+0 ", "%+-25.0Ra", z);
+ /* decimal point, left justified, precision and rounding parameter */
+ check_vsprintf ("0XF.FP+24 ", "%#-10.*R*A", 1, MPFR_RNDN, x);
+ check_vsprintf ("0X1.P+28 ", "%#-10.*R*A", 0, MPFR_RNDN, x);
+ check_vsprintf ("0X0.P+0 ", "%#-10.*R*A", 0, MPFR_RNDN, z);
+ /* sign or space */
+ check_sprintf (" 0xf.eddp+24", "% .3RNa", x);
+ check_sprintf (" 0x1p+28", "% .0RNa", x);
+ /* sign + or -, decimal point, pad with leading zeros */
+ check_sprintf ("+0X0F.EP+24", "%0+#11.1RZA", x);
+ check_sprintf ("+0X00F.P+24", "%0+#11.0RZA", x);
+ check_sprintf ("+0X000.0P+0", "%0+#11.1RZA", z);
+ /* pad with leading zero */
+ check_sprintf ("0x0000f.edcba987654321p+24", "%026RDa", x);
+ check_sprintf ("0x0000000000000000000fp+24", "%026.0RDa", x);
+ /* sign or space, decimal point, left justified */
+ check_sprintf (" 0XF.EP+24 " , "%- #11.1RDA", x);
+ check_sprintf (" 0XF.P+24 " , "%- #11.0RDA", x);
+
+ mpfr_mul_si (x, x, -1, MPFR_RNDD);
+ mpfr_mul_si (z, z, -1, MPFR_RNDD);
+
+ /* sign + or - */
+ check_sprintf ("-0xf.ep+24", "%+10.1RUa", x);
+ check_sprintf (" -0xfp+24", "%+10.0RUa", x);
+ check_sprintf (" -0x0p+0", "%+10.0RUa", z);
+
+ /* rounding bit is zero */
+ mpfr_set_str (x, "0xF.7", 16, MPFR_RNDN);
+ check_sprintf ("0XFP+0", "%.0RNA", x);
+ /* tie case in round to nearest mode */
+ mpfr_set_str (x, "0x0.8800000000000000p+3", 16, MPFR_RNDN);
+ check_sprintf ("0x9.p-1", "%#.0RNa", x);
+ mpfr_set_str (x, "-0x0.9800000000000000p+3", 16, MPFR_RNDN);
+ check_sprintf ("-0xap-1", "%.0RNa", x);
+ /* trailing zeros in fractional part */
+ check_sprintf ("-0X4.C0000000000000000000P+0", "%.20RNA", x);
+ /* rounding bit is one and the first non zero bit is far away */
+ mpfr_set_prec (x, 1024);
+ mpfr_set_ui_2exp (x, 29, -1, MPFR_RNDN);
+ mpfr_nextabove (x);
+ check_sprintf ("0XFP+0", "%.0RNA", x);
+
+ /* with more than one limb */
+ mpfr_set_prec (x, 300);
+ mpfr_set_str (x, "0xf.ffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "fffffffffffffffff", 16, MPFR_RNDN);
+ check_sprintf ("0x1p+4 [300]", "%.0RNa [300]", x);
+ check_sprintf ("0xfp+0 [300]", "%.0RZa [300]", x);
+ check_sprintf ("0x1p+4 [300]", "%.0RYa [300]", x);
+ check_sprintf ("0xfp+0 [300]", "%.0RDa [300]", x);
+ check_sprintf ("0x1p+4 [300]", "%.0RUa [300]", x);
+ check_sprintf ("0x1.0000000000000000000000000000000000000000p+4",
+ "%.40RNa", x);
+ check_sprintf ("0xf.ffffffffffffffffffffffffffffffffffffffffp+0",
+ "%.40RZa", x);
+ check_sprintf ("0x1.0000000000000000000000000000000000000000p+4",
+ "%.40RYa", x);
+ check_sprintf ("0xf.ffffffffffffffffffffffffffffffffffffffffp+0",
+ "%.40RDa", x);
+ check_sprintf ("0x1.0000000000000000000000000000000000000000p+4",
+ "%.40RUa", x);
+
+ mpfr_set_str (x, "0xf.7fffffffffffffffffffffffffffffffffffffffffffffffffff"
+ "ffffffffffffffffff", 16, MPFR_RNDN);
+ check_sprintf ("0XFP+0", "%.0RNA", x);
+ check_sprintf ("0XFP+0", "%.0RZA", x);
+ check_sprintf ("0X1P+4", "%.0RYA", x);
+ check_sprintf ("0XFP+0", "%.0RDA", x);
+ check_sprintf ("0X1P+4", "%.0RUA", x);
+ check_sprintf ("0XF.8P+0", "%.1RNA", x);
+ check_sprintf ("0XF.7P+0", "%.1RZA", x);
+ check_sprintf ("0XF.8P+0", "%.1RYA", x);
+ check_sprintf ("0XF.7P+0", "%.1RDA", x);
+ check_sprintf ("0XF.8P+0", "%.1RUA", x);
+
+ /* do not round up to the next power of the base */
+ mpfr_set_str (x, "0xf.fffffffffffffffffffffffffffffffffffffeffffffffffffff"
+ "ffffffffffffffffff", 16, MPFR_RNDN);
+ check_sprintf ("0xf.ffffffffffffffffffffffffffffffffffffff00p+0",
+ "%.40RNa", x);
+ check_sprintf ("0xf.fffffffffffffffffffffffffffffffffffffeffp+0",
+ "%.40RZa", x);
+ check_sprintf ("0xf.ffffffffffffffffffffffffffffffffffffff00p+0",
+ "%.40RYa", x);
+ check_sprintf ("0xf.fffffffffffffffffffffffffffffffffffffeffp+0",
+ "%.40RDa", x);
+ check_sprintf ("0xf.ffffffffffffffffffffffffffffffffffffff00p+0",
+ "%.40RUa", x);
+
+ mpfr_clears (x, z, (mpfr_ptr) 0);
+ return 0;
+}
+
+static int
+binary (void)
+{
+ mpfr_t x;
+ mpfr_t z;
+ mpfr_inits2 (64, x, z, (mpfr_ptr) 0);
+
+ /* special */
+ mpfr_set_inf (x, 1);
+ check_sprintf (pinf_str, "%Rb", x);
+
+ mpfr_set_inf (x, -1);
+ check_sprintf (minf_str, "%Rb", x);
+
+ mpfr_set_nan (x);
+ check_sprintf (nan_str, "%Rb", x);
+
+ /* regular numbers */
+ mpfr_set_str (x, "1110010101.1001101", 2, MPFR_RNDN);
+ mpfr_set_ui (z, 0, MPFR_RNDN);
+
+ /* simplest case: right justified */
+ check_sprintf (" 1.1100101011001101p+9", "%25Rb", x);
+ check_sprintf (" 0p+0", "%25Rb", z);
+ /* sign or space, pad with leading zeros */
+ check_sprintf (" 0001.1100101011001101p+9", "% 025Rb", x);
+ check_sprintf (" 000000000000000000000p+0", "% 025Rb", z);
+ /* sign + or -, left justified */
+ check_sprintf ("+1.1100101011001101p+9 ", "%+-25Rb", x);
+ check_sprintf ("+0p+0 ", "%+-25Rb", z);
+ /* sign or space */
+ check_sprintf (" 1.110p+9", "% .3RNb", x);
+ check_sprintf (" 1.1101p+9", "% .4RNb", x);
+ check_sprintf (" 0.0000p+0", "% .4RNb", z);
+ /* sign + or -, decimal point, pad with leading zeros */
+ check_sprintf ("+00001.1p+9", "%0+#11.1RZb", x);
+ check_sprintf ("+0001.0p+10", "%0+#11.1RNb", x);
+ check_sprintf ("+000000.p+0", "%0+#11.0RNb", z);
+ /* pad with leading zero */
+ check_sprintf ("00001.1100101011001101p+9", "%025RDb", x);
+ /* sign or space, decimal point (unused), left justified */
+ check_sprintf (" 1.1p+9 ", "%- #11.1RDb", x);
+ check_sprintf (" 1.p+9 ", "%- #11.0RDb", x);
+ check_sprintf (" 1.p+10 ", "%- #11.0RUb", x);
+ check_sprintf (" 1.p+9 ", "%- #11.0RZb", x);
+ check_sprintf (" 1.p+10 ", "%- #11.0RYb", x);
+ check_sprintf (" 1.p+10 ", "%- #11.0RNb", x);
+
+ mpfr_mul_si (x, x, -1, MPFR_RNDD);
+ mpfr_mul_si (z, z, -1, MPFR_RNDD);
+
+ /* sign + or - */
+ check_sprintf (" -1.1p+9", "%+10.1RUb", x);
+ check_sprintf (" -0.0p+0", "%+10.1RUb", z);
+
+ /* precision 0 */
+ check_sprintf ("-1p+10", "%.0RNb", x);
+ check_sprintf ("-1p+10", "%.0RDb", x);
+ check_sprintf ("-1p+9", "%.0RUb", x);
+ check_sprintf ("-1p+9", "%.0RZb", x);
+ check_sprintf ("-1p+10", "%.0RYb", x);
+ /* round to next base power */
+ check_sprintf ("-1.0p+10", "%.1RNb", x);
+ check_sprintf ("-1.0p+10", "%.1RDb", x);
+ check_sprintf ("-1.0p+10", "%.1RYb", x);
+ /* do not round to next base power */
+ check_sprintf ("-1.1p+9", "%.1RUb", x);
+ check_sprintf ("-1.1p+9", "%.1RZb", x);
+ /* rounding bit is zero */
+ check_sprintf ("-1.11p+9", "%.2RNb", x);
+ /* tie case in round to nearest mode */
+ check_sprintf ("-1.1100101011001101p+9", "%.16RNb", x);
+ /* trailing zeros in fractional part */
+ check_sprintf ("-1.110010101100110100000000000000p+9", "%.30RNb", x);
+
+ mpfr_clears (x, z, (mpfr_ptr) 0);
+ return 0;
+}
+
+static int
+mixed (void)
+{
+ int n1;
+ int n2;
+ int i = 121;
+#ifndef NPRINTF_L
+ long double d = 1. / 31.;
+#endif
+ mpf_t mpf;
+ mpq_t mpq;
+ mpz_t mpz;
+ mpfr_t x;
+ mpfr_rnd_t rnd;
+
+ mpf_init (mpf);
+ mpf_set_ui (mpf, 40);
+ mpf_div_ui (mpf, mpf, 31); /* mpf = 40.0 / 31.0 */
+ mpq_init (mpq);
+ mpq_set_ui (mpq, 123456, 4567890);
+ mpz_init (mpz);
+ mpz_fib_ui (mpz, 64);
+ mpfr_init (x);
+ mpfr_set_str (x, "-12345678.875", 10, MPFR_RNDN);
+ rnd = MPFR_RNDD;
+
+ check_vsprintf ("121%", "%i%%", i);
+ check_vsprintf ("121% -1.2345678875E+07", "%i%% %RNE", i, x);
+ check_vsprintf ("121, -12345679", "%i, %.0Rf", i, x);
+ check_vsprintf ("10610209857723, -1.2345678875e+07", "%Zi, %R*e", mpz, rnd,
+ x);
+ check_vsprintf ("-12345678.9, 121", "%.1Rf, %i", x, i);
+ check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", MPFR_RNDZ, x, mpq);
+ n1 = check_vsprintf ("121, -12345678.875000000000, 1.290323", "%i, %.*Rf, %Ff%n",
+ i, 12, x, mpf, &n2);
+ if (n1 != n2)
+ {
+ printf ("error in number of characters written by mpfr_vsprintf\n");
+ printf ("expected: %d\n", n2);
+ printf (" got: %d\n", n1);
+ exit (1);
+ }
+
+#ifndef NPRINTF_L
+ check_vsprintf ("00000010610209857723, -1.2345678875e+07, 0.032258",
+ "%.*Zi, %R*e, %Lf", 20, mpz, rnd, x, d);
+#endif
+
+ mpf_clear (mpf);
+ mpq_clear (mpq);
+ mpz_clear (mpz);
+ mpfr_clear (x);
+ return 0;
+}
+
+/* Check with locale "da_DK". On most platforms, decimal point is ','
+ and thousands separator is '.'; the test is not performed if this
+ is not the case or if the locale doesn't exist. */
+static int
+locale_da_DK (void)
+{
+ mpfr_prec_t p = 128;
+ mpfr_t x;
+
+ if (setlocale (LC_ALL, "da_DK") == 0 ||
+ localeconv()->decimal_point[0] != ',' ||
+ localeconv()->thousands_sep[0] != '.')
+ return 0;
+
+ mpfr_init2 (x, p);
+
+ /* positive numbers */
+ mpfr_set_str (x, "18993474.61279296875", 10, MPFR_RNDN);
+
+ /* simplest case right justified with thousands separator */
+ check_sprintf (" 1,899347461279296875e+07", "%'30Re", x);
+ check_sprintf (" 1,89935e+07", "%'30Rg", x);
+ check_sprintf (" 18.993.474,61279296875", "%'30.19Rg", x);
+ check_sprintf (" 18.993.474,612793", "%'30Rf", x);
+
+ /* sign or space, pad, thousands separator with leading zeros */
+ check_sprintf (" 000001,899347461279296875E+07", "%' 030RE", x);
+ check_sprintf (" 0000000000000000001,89935E+07", "%' 030RG", x);
+ check_sprintf (" 000000018.993.474,61279296875", "%' 030.19RG", x);
+ check_sprintf (" 00000000000018.993.474,612793", "%' 030RF", x);
+
+ mpfr_set_ui (x, 50, MPFR_RNDN);
+ mpfr_exp10 (x, x, MPFR_RNDN);
+ check_sprintf ("100000000000000000000000000000000000000000000000000", "%.0Rf",
+ x);
+ check_sprintf
+ ("100.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,",
+ "%'#.0Rf", x);
+ check_sprintf
+ ("100.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,0000",
+ "%'.4Rf", x);
+
+ mpfr_clear (x);
+ return 0;
+}
+
+/* check concordance between mpfr_asprintf result with a regular mpfr float
+ and with a regular double float */
+static int
+random_double (void)
+{
+ mpfr_t x; /* random regular mpfr float */
+ double y; /* regular double float (equal to x) */
+
+ char flag[] =
+ {
+ '-',
+ '+',
+ ' ',
+ '#',
+ '0', /* no ambiguity: first zeros are flag zero*/
+ '\''
+ };
+ /* no 'a': mpfr and glibc do not have the same semantic */
+ char specifier[] =
+ {
+ 'e',
+ 'f',
+ 'g',
+ 'E',
+ 'f', /* SUSv2 doesn't accept %F, but %F and %f are the same for
+ regular numbers */
+ 'G',
+ };
+ int spec; /* random index in specifier[] */
+ int prec; /* random value for precision field */
+
+ /* in the format string for mpfr_t variable, the maximum length is
+ reached by something like "%-+ #0'.*Rf", that is 12 characters. */
+#define FMT_MPFR_SIZE 12
+ char fmt_mpfr[FMT_MPFR_SIZE];
+ char *ptr_mpfr;
+
+ /* in the format string for double variable, the maximum length is
+ reached by something like "%-+ #0'.*f", that is 11 characters. */
+#define FMT_SIZE 11
+ char fmt[FMT_SIZE];
+ char *ptr;
+
+ int xi;
+ char *xs;
+ int yi;
+ char *ys;
+
+ int i, j, jmax;
+
+ mpfr_init2 (x, MPFR_LDBL_MANT_DIG);
+
+ for (i = 0; i < 1000; ++i)
+ {
+ /* 1. random double */
+ do
+ {
+ y = DBL_RAND ();
+ }
+#ifdef HAVE_DENORMS
+ while (0);
+#else
+ while (ABS(y) < DBL_MIN);
+#endif
+
+ if (randlimb () % 2 == 0)
+ y = -y;
+
+ mpfr_set_d (x, y, MPFR_RNDN);
+ if (y != mpfr_get_d (x, MPFR_RNDN))
+ /* conversion error: skip this one */
+ continue;
+
+ /* 2. build random format strings fmt_mpfr and fmt */
+ ptr_mpfr = fmt_mpfr;
+ ptr = fmt;
+ *ptr_mpfr++ = *ptr++ = '%';
+ /* random specifier 'e', 'f', 'g', 'E', 'F', or 'G' */
+ spec = (int) (randlimb() % 6);
+ /* random flags, but no ' flag with %e */
+ jmax = (spec == 0 || spec == 3) ? 5 : 6;
+ for (j = 0; j < jmax; j++)
+ {
+ if (randlimb() % 3 == 0)
+ *ptr_mpfr++ = *ptr++ = flag[j];
+ }
+ *ptr_mpfr++ = *ptr++ = '.';
+ *ptr_mpfr++ = *ptr++ = '*';
+ *ptr_mpfr++ = 'R';
+ *ptr_mpfr++ = *ptr++ = specifier[spec];
+ *ptr_mpfr = *ptr = '\0';
+ MPFR_ASSERTN (ptr - fmt < FMT_SIZE);
+ MPFR_ASSERTN (ptr_mpfr - fmt_mpfr < FMT_MPFR_SIZE);
+
+ /* advantage small precision */
+ if (randlimb() % 2 == 0)
+ prec = (int) (randlimb() % 10);
+ else
+ prec = (int) (randlimb() % prec_max_printf);
+
+ /* 3. calls and checks */
+ /* the double float case is handled by the libc asprintf through
+ gmp_asprintf */
+ xi = mpfr_asprintf (&xs, fmt_mpfr, prec, x);
+ yi = mpfr_asprintf (&ys, fmt, prec, y);
+
+ /* test if XS and YS differ, beware that ISO C99 doesn't specify
+ the sign of a zero exponent (the C99 rationale says: "The sign
+ of a zero exponent in %e format is unspecified. The committee
+ knows of different implementations and choose not to require
+ implementations to document their behaviour in this case
+ (by making this be implementation defined behaviour). Most
+ implementations use a "+" sign, e.g., 1.2e+00; but there is at
+ least one implementation that uses the sign of the unlimited
+ precision result, e.g., the 0.987 would be 9.87e-01, so could
+ end up as 1e-00 after rounding to one digit of precision."),
+ while mpfr always uses '+' */
+ if (xi != yi
+ || ((strcmp (xs, ys) != 0)
+ && (spec == 1 || spec == 4
+ || ((strstr (xs, "e+00") == NULL
+ || strstr (ys, "e-00") == NULL)
+ && (strstr (xs, "E+00") == NULL
+ || strstr (ys, "E-00") == NULL)))))
+ {
+ mpfr_printf ("Error in mpfr_asprintf(\"%s\", %d, %Re)\n",
+ fmt_mpfr, prec, x);
+ printf ("expected: %s\n", ys);
+ printf (" got: %s\n", xs);
+ printf ("xi=%d yi=%d spec=%d\n", xi, yi, spec);
+
+ exit (1);
+ }
+
+ mpfr_free_str (xs);
+ mpfr_free_str (ys);
+ }
+
+ mpfr_clear (x);
+ return 0;
+}
+
+static void
+bug20080610 (void)
+{
+ /* bug on icc found on June 10, 2008 */
+ /* this is not a bug but a different implementation choice: ISO C99 doesn't
+ specify the sign of a zero exponent (see note in random_double above). */
+ mpfr_t x;
+ double y;
+ int xi;
+ char *xs;
+ int yi;
+ char *ys;
+
+ mpfr_init2 (x, MPFR_LDBL_MANT_DIG);
+
+ y = -9.95645044213728791504536275169812142849e-01;
+ mpfr_set_d (x, y, MPFR_RNDN);
+
+ xi = mpfr_asprintf (&xs, "%- #0.*Re", 1, x);
+ yi = mpfr_asprintf (&ys, "%- #0.*e", 1, y);
+
+ if (xi != yi || strcmp (xs, ys) != 0)
+ {
+ printf ("Error in bug20080610\n");
+ printf ("expected: %s\n", ys);
+ printf (" got: %s\n", xs);
+ printf ("xi=%d yi=%d\n", xi, yi);
+
+ exit (1);
+ }
+
+ mpfr_free_str (xs);
+ mpfr_free_str (ys);
+ mpfr_clear (x);
+}
+
+static void
+bug20081214 (void)
+{
+ /* problem with glibc 2.3.6, December 14, 2008:
+ the system asprintf outputs "-1.0" instead of "-1.". */
+ mpfr_t x;
+ double y;
+ int xi;
+ char *xs;
+ int yi;
+ char *ys;
+
+ mpfr_init2 (x, MPFR_LDBL_MANT_DIG);
+
+ y = -9.90597761233942053494e-01;
+ mpfr_set_d (x, y, MPFR_RNDN);
+
+ xi = mpfr_asprintf (&xs, "%- #0.*RG", 1, x);
+ yi = mpfr_asprintf (&ys, "%- #0.*G", 1, y);
+
+ if (xi != yi || strcmp (xs, ys) != 0)
+ {
+ mpfr_printf ("Error in bug20081214\n"
+ "mpfr_asprintf(\"%- #0.*Re\", 1, %Re)\n", x);
+ printf ("expected: %s\n", ys);
+ printf (" got: %s\n", xs);
+ printf ("xi=%d yi=%d\n", xi, yi);
+
+ exit (1);
+ }
+
+ mpfr_free_str (xs);
+ mpfr_free_str (ys);
+ mpfr_clear (x);
+}
+
+static void
+bug20111102 (void)
+{
+ mpfr_t t;
+ char s[100];
+
+ mpfr_init2 (t, 84);
+ mpfr_set_str (t, "999.99999999999999999999", 10, MPFR_RNDN);
+ mpfr_sprintf (s, "%.20RNg", t);
+ if (strcmp (s, "1000") != 0)
+ {
+ printf ("Error in bug20111102, expected 1000, got %s\n", s);
+ exit (1);
+ }
+ mpfr_clear (t);
+}
+
+/* In particular, the following test makes sure that the rounding
+ * for %Ra and %Rb is not done on the MPFR number itself (as it
+ * would overflow). Note: it has been reported on comp.std.c that
+ * some C libraries behave differently on %a, but this is a bug.
+ */
+static void
+check_emax_aux (mpfr_exp_t e)
+{
+ mpfr_t x;
+ char *s1, s2[256];
+ int i;
+ mpfr_exp_t emax;
+
+ MPFR_ASSERTN (e <= LONG_MAX);
+ emax = mpfr_get_emax ();
+ set_emax (e);
+
+ mpfr_init2 (x, 16);
+
+ mpfr_set_inf (x, 1);
+ mpfr_nextbelow (x);
+
+ i = mpfr_asprintf (&s1, "%Ra %.2Ra", x, x);
+ MPFR_ASSERTN (i > 0);
+
+ mpfr_snprintf (s2, 256, "0x7.fff8p+%ld 0x8.00p+%ld", e-3, e-3);
+
+ if (strcmp (s1, s2) != 0)
+ {
+ printf ("Error in check_emax_aux for emax = ");
+ if (e > LONG_MAX)
+ printf ("(>LONG_MAX)\n");
+ else
+ printf ("%ld\n", (long) e);
+ printf ("Expected %s\n", s2);
+ printf ("Got %s\n", s1);
+ exit (1);
+ }
+
+ mpfr_free_str (s1);
+
+ i = mpfr_asprintf (&s1, "%Rb %.2Rb", x, x);
+ MPFR_ASSERTN (i > 0);
+
+ mpfr_snprintf (s2, 256, "1.111111111111111p+%ld 1.00p+%ld", e-1, e);
+
+ if (strcmp (s1, s2) != 0)
+ {
+ printf ("Error in check_emax_aux for emax = ");
+ if (e > LONG_MAX)
+ printf ("(>LONG_MAX)\n");
+ else
+ printf ("%ld\n", (long) e);
+ printf ("Expected %s\n", s2);
+ printf ("Got %s\n", s1);
+ exit (1);
+ }
+
+ mpfr_free_str (s1);
+
+ mpfr_clear (x);
+ set_emax (emax);
+}
+
+static void
+check_emax (void)
+{
+ check_emax_aux (15);
+ check_emax_aux (MPFR_EMAX_MAX);
+}
+
+int
+main (int argc, char **argv)
+{
+ char *locale;
+
+ tests_start_mpfr ();
+
+#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
+ /* currently, we just check with 'C' locale */
+ locale = setlocale (LC_ALL, "C");
+#endif
+
+ bug20111102 ();
+ native_types ();
+ hexadecimal ();
+ binary ();
+ decimal ();
+ mixed ();
+ check_emax ();
+
+#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
+ locale_da_DK ();
+
+ setlocale (LC_ALL, locale);
+#endif
+
+ if (getenv ("MPFR_CHECK_LIBC_PRINTF"))
+ {
+ /* check against libc */
+ random_double ();
+ bug20081214 ();
+ bug20080610 ();
+ }
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else /* MPFR_VERSION */
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif /* MPFR_VERSION */
+
+#else /* HAVE_STDARG */
+
+int
+main (void)
+{
+ /* We have nothing to test. */
+ return 77;
+}
+
+#endif /* HAVE_STDARG */
diff --git a/tests/tsqr.c b/tests/tsqr.c
new file mode 100644
index 0000000..15b2495
--- /dev/null
+++ b/tests/tsqr.c
@@ -0,0 +1,178 @@
+/* Test file for mpfr_sqr.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_sqr
+#include "tgeneric.c"
+
+static int
+inexact_sign (int x)
+{
+ return (x < 0) ? -1 : (x > 0);
+}
+
+static void
+error1 (mpfr_rnd_t rnd, mpfr_prec_t prec,
+ mpfr_t in, mpfr_t outmul, mpfr_t outsqr)
+{
+ printf("ERROR: for %s and prec=%lu\nINPUT=", mpfr_print_rnd_mode(rnd),
+ (unsigned long) prec);
+ mpfr_dump(in);
+ printf("OutputMul="); mpfr_dump(outmul);
+ printf("OutputSqr="); mpfr_dump(outsqr);
+ exit(1);
+}
+
+static void
+error2 (mpfr_rnd_t rnd, mpfr_prec_t prec, mpfr_t in, mpfr_t out,
+ int inexactmul, int inexactsqr)
+{
+ printf("ERROR: for %s and prec=%lu\nINPUT=", mpfr_print_rnd_mode(rnd),
+ (unsigned long) prec);
+ mpfr_dump(in);
+ printf("Output="); mpfr_dump(out);
+ printf("InexactMul= %d InexactSqr= %d\n", inexactmul, inexactsqr);
+ exit(1);
+}
+
+static void
+check_random (mpfr_prec_t p)
+{
+ mpfr_t x,y,z;
+ int r;
+ int i, inexact1, inexact2;
+
+ mpfr_inits2 (p, x, y, z, (mpfr_ptr) 0);
+ for(i = 0 ; i < 500 ; i++)
+ {
+ mpfr_urandomb (x, RANDS);
+ if (MPFR_IS_PURE_FP(x))
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ inexact1 = mpfr_mul (y, x, x, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sqr (z, x, (mpfr_rnd_t) r);
+ if (mpfr_cmp (y, z))
+ error1 ((mpfr_rnd_t) r,p,x,y,z);
+ if (inexact_sign (inexact1) != inexact_sign (inexact2))
+ error2 ((mpfr_rnd_t) r,p,x,y,inexact1,inexact2);
+ }
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t x, y;
+ mpfr_exp_t emin;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ mpfr_set_nan (x);
+ mpfr_sqr (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1);
+ mpfr_sqr (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_sqr (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y) && mpfr_sgn (y) > 0);
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_sqr (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (y));
+
+ emin = mpfr_get_emin ();
+ mpfr_set_emin (0);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ MPFR_ASSERTN (!mpfr_zero_p (x));
+ mpfr_sqr (y, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_zero_p (y));
+ mpfr_set_emin (emin);
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+/* Test of a bug seen with GCC 4.5.2 and GMP 5.0.1 on m68k (m68000 target).
+ https://sympa.inria.fr/sympa/arc/mpfr/2011-05/msg00003.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2011-05/msg00041.html
+*/
+static void
+check_mpn_sqr (void)
+{
+#if GMP_NUMB_BITS == 32 && __GNU_MP_VERSION >= 5
+ /* Note: since we test a low-level bug, src is initialized
+ without using a GMP function, just in case. */
+ mp_limb_t src[5] =
+ { 0x90000000, 0xbaa55f4f, 0x2cbec4d9, 0xfcef3242, 0xda827999 };
+ mp_limb_t exd[10] =
+ { 0x00000000, 0x31000000, 0xbd4bc59a, 0x41fbe2b5, 0x33471e7e,
+ 0x90e826a7, 0xbaa55f4f, 0x2cbec4d9, 0xfcef3242, 0xba827999 };
+ mp_limb_t dst[10];
+ int i;
+
+ mpn_sqr (dst, src, 5); /* new in GMP 5 */
+ for (i = 0; i < 10; i++)
+ {
+ if (dst[i] != exd[i])
+ {
+ printf ("Error in check_mpn_sqr\n");
+ printf ("exd[%d] = 0x%08lx\n", i, (unsigned long) exd[i]);
+ printf ("dst[%d] = 0x%08lx\n", i, (unsigned long) dst[i]);
+ printf ("Note: This is not a bug in MPFR, but a bug in"
+ " either GMP or, more\nprobably, in the compiler."
+ " It may cause other tests to fail.\n");
+ exit (1);
+ }
+ }
+#endif
+}
+
+int
+main (void)
+{
+ mpfr_prec_t p;
+
+ tests_start_mpfr ();
+
+ check_mpn_sqr ();
+
+ check_special ();
+ for (p = 2; p < 200; p++)
+ check_random (p);
+
+ test_generic (2, 200, 15);
+ data_check ("data/sqr", mpfr_sqr, "mpfr_sqr");
+ bad_cases (mpfr_sqr, mpfr_sqrt, "mpfr_sqr", 8, -256, 255, 4, 128, 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsqrt.c b/tests/tsqrt.c
new file mode 100644
index 0000000..f2f0d89
--- /dev/null
+++ b/tests/tsqrt.c
@@ -0,0 +1,709 @@
+/* Test file for mpfr_sqrt.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_sqrt (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b);
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ }
+ res = mpfr_sqrt (a, b, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_sqrt mpfr_sqrt
+#endif
+
+static void
+check3 (const char *as, mpfr_rnd_t rnd_mode, const char *qs)
+{
+ mpfr_t q;
+
+ mpfr_init2 (q, 53);
+ mpfr_set_str1 (q, as);
+ test_sqrt (q, q, rnd_mode);
+ if (mpfr_cmp_str1 (q, qs) )
+ {
+ printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n",
+ as, mpfr_print_rnd_mode (rnd_mode));
+ printf ("expected sqrt is %s, got ",qs);
+ mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ mpfr_clear (q);
+}
+
+static void
+check4 (const char *as, mpfr_rnd_t rnd_mode, const char *Qs)
+{
+ mpfr_t q;
+
+ mpfr_init2 (q, 53);
+ mpfr_set_str1 (q, as);
+ test_sqrt (q, q, rnd_mode);
+ if (mpfr_cmp_str (q, Qs, 16, MPFR_RNDN))
+ {
+ printf ("mpfr_sqrt failed for a=%s, rnd_mode=%s\n",
+ as, mpfr_print_rnd_mode(rnd_mode));
+ printf ("expected ");
+ mpfr_out_str (stdout, 16, 0, q, MPFR_RNDN);
+ printf ("\ngot %s\n", Qs);
+ mpfr_clear (q);
+ exit (1);
+ }
+ mpfr_clear (q);
+}
+
+static void
+check24 (const char *as, mpfr_rnd_t rnd_mode, const char *qs)
+{
+ mpfr_t q;
+
+ mpfr_init2 (q, 24);
+ mpfr_set_str1 (q, as);
+ test_sqrt (q, q, rnd_mode);
+ if (mpfr_cmp_str1 (q, qs))
+ {
+ printf ("mpfr_sqrt failed for a=%s, prec=24, rnd_mode=%s\n",
+ as, mpfr_print_rnd_mode(rnd_mode));
+ printf ("expected sqrt is %s, got ",qs);
+ mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clear (q);
+}
+
+static void
+check_diverse (const char *as, mpfr_prec_t p, const char *qs)
+{
+ mpfr_t q;
+
+ mpfr_init2 (q, p);
+ mpfr_set_str1 (q, as);
+ test_sqrt (q, q, MPFR_RNDN);
+ if (mpfr_cmp_str1 (q, qs))
+ {
+ printf ("mpfr_sqrt failed for a=%s, prec=%lu, rnd_mode=%s\n",
+ as, (unsigned long) p, mpfr_print_rnd_mode (MPFR_RNDN));
+ printf ("expected sqrt is %s, got ", qs);
+ mpfr_out_str (stdout, 10, 0, q, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clear (q);
+}
+
+/* the following examples come from the paper "Number-theoretic Test
+ Generation for Directed Rounding" from Michael Parks, Table 3 */
+static void
+check_float (void)
+{
+ check24("70368760954880.0", MPFR_RNDN, "8.388609e6");
+ check24("281474943156224.0", MPFR_RNDN, "1.6777215e7");
+ check24("70368777732096.0", MPFR_RNDN, "8.388610e6");
+ check24("281474909601792.0", MPFR_RNDN, "1.6777214e7");
+ check24("100216216748032.0", MPFR_RNDN, "1.0010805e7");
+ check24("120137273311232.0", MPFR_RNDN, "1.0960715e7");
+ check24("229674600890368.0", MPFR_RNDN, "1.5155019e7");
+ check24("70368794509312.0", MPFR_RNDN, "8.388611e6");
+ check24("281474876047360.0", MPFR_RNDN, "1.6777213e7");
+ check24("91214552498176.0", MPFR_RNDN, "9.550631e6");
+
+ check24("70368760954880.0", MPFR_RNDZ, "8.388608e6");
+ check24("281474943156224.0", MPFR_RNDZ, "1.6777214e7");
+ check24("70368777732096.0", MPFR_RNDZ, "8.388609e6");
+ check24("281474909601792.0", MPFR_RNDZ, "1.6777213e7");
+ check24("100216216748032.0", MPFR_RNDZ, "1.0010805e7");
+ check24("120137273311232.0", MPFR_RNDZ, "1.0960715e7");
+ check24("229674600890368.0", MPFR_RNDZ, "1.5155019e7");
+ check24("70368794509312.0", MPFR_RNDZ, "8.38861e6");
+ check24("281474876047360.0", MPFR_RNDZ, "1.6777212e7");
+ check24("91214552498176.0", MPFR_RNDZ, "9.550631e6");
+
+ check24("70368760954880.0", MPFR_RNDU, "8.388609e6");
+ check24("281474943156224.0",MPFR_RNDU, "1.6777215e7");
+ check24("70368777732096.0", MPFR_RNDU, "8.388610e6");
+ check24("281474909601792.0", MPFR_RNDU, "1.6777214e7");
+ check24("100216216748032.0", MPFR_RNDU, "1.0010806e7");
+ check24("120137273311232.0", MPFR_RNDU, "1.0960716e7");
+ check24("229674600890368.0", MPFR_RNDU, "1.515502e7");
+ check24("70368794509312.0", MPFR_RNDU, "8.388611e6");
+ check24("281474876047360.0", MPFR_RNDU, "1.6777213e7");
+ check24("91214552498176.0", MPFR_RNDU, "9.550632e6");
+
+ check24("70368760954880.0", MPFR_RNDD, "8.388608e6");
+ check24("281474943156224.0", MPFR_RNDD, "1.6777214e7");
+ check24("70368777732096.0", MPFR_RNDD, "8.388609e6");
+ check24("281474909601792.0", MPFR_RNDD, "1.6777213e7");
+ check24("100216216748032.0", MPFR_RNDD, "1.0010805e7");
+ check24("120137273311232.0", MPFR_RNDD, "1.0960715e7");
+ check24("229674600890368.0", MPFR_RNDD, "1.5155019e7");
+ check24("70368794509312.0", MPFR_RNDD, "8.38861e6");
+ check24("281474876047360.0", MPFR_RNDD, "1.6777212e7");
+ check24("91214552498176.0", MPFR_RNDD, "9.550631e6");
+
+ /* check that rounding away is just rounding toward plus infinity */
+ check24("91214552498176.0", MPFR_RNDA, "9.550632e6");
+}
+
+static void
+special (void)
+{
+ mpfr_t x, y, z;
+ int inexact;
+ mpfr_prec_t p;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ mpfr_set_prec (x, 64);
+ mpfr_set_str_binary (x, "1010000010100011011001010101010010001100001101011101110001011001E-1");
+ mpfr_set_prec (y, 32);
+ test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 2405743844UL))
+ {
+ printf ("Error for n^2+n+1/2 with n=2405743843\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 65);
+ mpfr_set_str_binary (x, "10100000101000110110010101010100100011000011010111011100010110001E-2");
+ mpfr_set_prec (y, 32);
+ test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 2405743844UL))
+ {
+ printf ("Error for n^2+n+1/4 with n=2405743843\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 66);
+ mpfr_set_str_binary (x, "101000001010001101100101010101001000110000110101110111000101100011E-3");
+ mpfr_set_prec (y, 32);
+ test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 2405743844UL))
+ {
+ printf ("Error for n^2+n+1/4+1/8 with n=2405743843\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 66);
+ mpfr_set_str_binary (x, "101000001010001101100101010101001000110000110101110111000101100001E-3");
+ mpfr_set_prec (y, 32);
+ test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 2405743843UL))
+ {
+ printf ("Error for n^2+n+1/8 with n=2405743843\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 27);
+ mpfr_set_str_binary (x, "0.110100111010101000010001011");
+ if ((inexact = test_sqrt (x, x, MPFR_RNDZ)) >= 0)
+ {
+ printf ("Wrong inexact flag: expected -1, got %d\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ for (p=2; p<1000; p++)
+ {
+ mpfr_set_prec (z, p);
+ mpfr_set_ui (z, 1, MPFR_RNDN);
+ mpfr_nexttoinf (z);
+ test_sqrt (x, z, MPFR_RNDU);
+ if (mpfr_cmp_ui_2exp(x, 3, -1))
+ {
+ printf ("Error: sqrt(1+ulp(1), up) should give 1.5 (prec=%u)\n",
+ (unsigned int) p);
+ printf ("got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+ }
+
+ /* check inexact flag */
+ mpfr_set_prec (x, 5);
+ mpfr_set_str_binary (x, "1.1001E-2");
+ if ((inexact = test_sqrt (x, x, MPFR_RNDN)))
+ {
+ printf ("Wrong inexact flag: expected 0, got %d\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (z, 2);
+
+ /* checks the sign is correctly set */
+ mpfr_set_si (x, 1, MPFR_RNDN);
+ mpfr_set_si (z, -1, MPFR_RNDN);
+ test_sqrt (z, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 0) < 0)
+ {
+ printf ("Error: square root of 1 gives ");
+ mpfr_print_binary(z);
+ putchar('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 192);
+ mpfr_set_prec (z, 160);
+ mpfr_set_str_binary (z, "0.1011010100000100100100100110011001011100100100000011000111011001011101101101110000110100001000100001100001011000E1");
+ mpfr_set_prec (x, 160);
+ test_sqrt(x, z, MPFR_RNDN);
+ test_sqrt(z, x, MPFR_RNDN);
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_str (x, "8093416094703476.0", 10, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 1075, MPFR_RNDN);
+ test_sqrt (x, x, MPFR_RNDN);
+ mpfr_set_str (z, "1e55596835b5ef@-141", 16, MPFR_RNDN);
+ if (mpfr_cmp (x, z))
+ {
+ printf ("Error: square root of 8093416094703476*2^(-1075)\n");
+ printf ("expected "); mpfr_dump (z);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_str_binary (x, "0.111011011011110001100111111001000e-10");
+ mpfr_set_prec (z, 157);
+ inexact = test_sqrt (z, x, MPFR_RNDN);
+ mpfr_set_prec (x, 157);
+ mpfr_set_str_binary (x, "0.11110110101100101111001011100011100011100001101010111011010000100111011000111110100001001011110011111100101110010110010110011001011011010110010000011001101E-5");
+ if (mpfr_cmp (x, z))
+ {
+ printf ("Error: square root (1)\n");
+ exit (1);
+ }
+ if (inexact <= 0)
+ {
+ printf ("Error: wrong inexact flag (1)\n");
+ exit (1);
+ }
+
+ /* case prec(result) << prec(input) */
+ mpfr_set_prec (z, 2);
+ for (p = 2; p < 1000; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_nextabove (x);
+ /* 1.0 < x <= 1.5 thus 1 < sqrt(x) <= 1.23 */
+ inexact = test_sqrt (z, x, MPFR_RNDN);
+ MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0);
+ inexact = test_sqrt (z, x, MPFR_RNDZ);
+ MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0);
+ inexact = test_sqrt (z, x, MPFR_RNDU);
+ MPFR_ASSERTN(inexact > 0 && mpfr_cmp_ui_2exp (z, 3, -1) == 0);
+ inexact = test_sqrt (z, x, MPFR_RNDD);
+ MPFR_ASSERTN(inexact < 0 && mpfr_cmp_ui (z, 1) == 0);
+ inexact = test_sqrt (z, x, MPFR_RNDA);
+ MPFR_ASSERTN(inexact > 0 && mpfr_cmp_ui_2exp (z, 3, -1) == 0);
+ }
+
+ /* corner case rw = 0 in rounding to nearest */
+ mpfr_set_prec (z, GMP_NUMB_BITS - 1);
+ mpfr_set_prec (y, GMP_NUMB_BITS - 1);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_mul_2exp (y, y, GMP_NUMB_BITS - 1, MPFR_RNDN);
+ mpfr_nextabove (y);
+ for (p = 2 * GMP_NUMB_BITS - 1; p <= 1000; p++)
+ {
+ mpfr_set_prec (x, p);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_exp (x, GMP_NUMB_BITS);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ /* now x = 2^(GMP_NUMB_BITS - 1) + 1 (GMP_NUMB_BITS bits) */
+ MPFR_ASSERTN (mpfr_mul (x, x, x, MPFR_RNDN) == 0); /* exact */
+ inexact = test_sqrt (z, x, MPFR_RNDN);
+ /* even rule: z should be 2^(GMP_NUMB_BITS - 1) */
+ MPFR_ASSERTN (inexact < 0);
+ MPFR_ASSERTN (mpfr_cmp_ui_2exp (z, 1, GMP_NUMB_BITS - 1) == 0);
+ mpfr_nextbelow (x);
+ /* now x is just below [2^(GMP_NUMB_BITS - 1) + 1]^2 */
+ inexact = test_sqrt (z, x, MPFR_RNDN);
+ MPFR_ASSERTN(inexact < 0 &&
+ mpfr_cmp_ui_2exp (z, 1, GMP_NUMB_BITS - 1) == 0);
+ mpfr_nextabove (x);
+ mpfr_nextabove (x);
+ /* now x is just above [2^(GMP_NUMB_BITS - 1) + 1]^2 */
+ inexact = test_sqrt (z, x, MPFR_RNDN);
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error for sqrt(x) in rounding to nearest\n");
+ printf ("x="); mpfr_dump (x);
+ printf ("Expected "); mpfr_dump (y);
+ printf ("Got "); mpfr_dump (z);
+ exit (1);
+ }
+ if (inexact <= 0)
+ {
+ printf ("Wrong inexact flag in corner case for p = %lu\n", (unsigned long) p);
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (x, 1000);
+ mpfr_set_ui (x, 9, MPFR_RNDN);
+ mpfr_set_prec (y, 10);
+ inexact = test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 3) || inexact != 0)
+ {
+ printf ("Error in sqrt(9:1000) for prec=10\n");
+ exit (1);
+ }
+ mpfr_set_prec (y, GMP_NUMB_BITS);
+ mpfr_nextabove (x);
+ inexact = test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 3) || inexact >= 0)
+ {
+ printf ("Error in sqrt(9:1000) for prec=%d\n", (int) GMP_NUMB_BITS);
+ exit (1);
+ }
+ mpfr_set_prec (x, 2 * GMP_NUMB_BITS);
+ mpfr_set_prec (y, GMP_NUMB_BITS);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_nextabove (y);
+ mpfr_set (x, y, MPFR_RNDN);
+ inexact = test_sqrt (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1) || inexact >= 0)
+ {
+ printf ("Error in sqrt(1) for prec=%d\n", (int) GMP_NUMB_BITS);
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_inexact (mpfr_prec_t p)
+{
+ mpfr_t x, y, z;
+ mpfr_rnd_t rnd;
+ int inexact, sign;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, 2*p);
+ mpfr_urandomb (x, RANDS);
+ rnd = RND_RAND ();
+ inexact = test_sqrt (y, x, rnd);
+ if (mpfr_mul (z, y, y, rnd)) /* exact since prec(z) = 2*prec(y) */
+ {
+ printf ("Error: multiplication should be exact\n");
+ exit (1);
+ }
+ mpfr_sub (z, z, x, rnd); /* exact also */
+ sign = mpfr_cmp_ui (z, 0);
+ if (((inexact == 0) && (sign)) ||
+ ((inexact > 0) && (sign <= 0)) ||
+ ((inexact < 0) && (sign >= 0)))
+ {
+ printf ("Error: wrong inexact flag, expected %d, got %d\n",
+ sign, inexact);
+ printf ("x=");
+ mpfr_print_binary (x);
+ printf (" rnd=%s\n", mpfr_print_rnd_mode (rnd));
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_singular (void)
+{
+ mpfr_t x, got;
+
+ mpfr_init2 (x, 100L);
+ mpfr_init2 (got, 100L);
+
+ /* sqrt(NaN) == NaN */
+ MPFR_SET_NAN (x);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_nan_p (got));
+
+ /* sqrt(-1) == NaN */
+ mpfr_set_si (x, -1L, MPFR_RNDZ);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_nan_p (got));
+
+ /* sqrt(+inf) == +inf */
+ MPFR_SET_INF (x);
+ MPFR_SET_POS (x);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (got));
+
+ /* sqrt(-inf) == NaN */
+ MPFR_SET_INF (x);
+ MPFR_SET_NEG (x);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_nan_p (got));
+
+ /* sqrt(+0) == +0 */
+ mpfr_set_si (x, 0L, MPFR_RNDZ);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (got));
+ MPFR_ASSERTN (mpfr_cmp_ui (got, 0L) == 0);
+ MPFR_ASSERTN (MPFR_IS_POS (got));
+
+ /* sqrt(-0) == -0 */
+ mpfr_set_si (x, 0L, MPFR_RNDZ);
+ MPFR_SET_NEG (x);
+ MPFR_ASSERTN (test_sqrt (got, x, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (got));
+ MPFR_ASSERTN (mpfr_cmp_ui (got, 0L) == 0);
+ MPFR_ASSERTN (MPFR_IS_NEG (got));
+
+ mpfr_clear (x);
+ mpfr_clear (got);
+}
+
+/* check that -1 <= x/sqrt(x^2+s*y^2) <= 1 for rounding to nearest or up
+ with s = 0 and s = 1 */
+static void
+test_property1 (mpfr_prec_t p, mpfr_rnd_t r, int s)
+{
+ mpfr_t x, y, z, t;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (z, p);
+ mpfr_init2 (t, p);
+
+ mpfr_urandomb (x, RANDS);
+ mpfr_mul (z, x, x, r);
+ if (s)
+ {
+ mpfr_urandomb (y, RANDS);
+ mpfr_mul (t, y, y, r);
+ mpfr_add (z, z, t, r);
+ }
+ mpfr_sqrt (z, z, r);
+ mpfr_div (z, x, z, r);
+ /* Note: if both x and y are 0, z is NAN, but the test below will
+ be false. So, everything is fine. */
+ if (mpfr_cmp_si (z, -1) < 0 || mpfr_cmp_ui (z, 1) > 0)
+ {
+ printf ("Error, -1 <= x/sqrt(x^2+y^2) <= 1 does not hold for r=%s\n",
+ mpfr_print_rnd_mode (r));
+ printf ("x="); mpfr_dump (x);
+ printf ("y="); mpfr_dump (y);
+ printf ("got "); mpfr_dump (z);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+/* check sqrt(x^2) = x */
+static void
+test_property2 (mpfr_prec_t p, mpfr_rnd_t r)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+
+ mpfr_urandomb (x, RANDS);
+ mpfr_mul (y, x, x, r);
+ mpfr_sqrt (y, y, r);
+ if (mpfr_cmp (y, x))
+ {
+ printf ("Error, sqrt(x^2) = x does not hold for r=%s\n",
+ mpfr_print_rnd_mode (r));
+ printf ("x="); mpfr_dump (x);
+ printf ("got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION test_sqrt
+#define TEST_RANDOM_POS 8
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_prec_t p;
+ int k;
+
+ tests_start_mpfr ();
+
+ for (p = MPFR_PREC_MIN; p <= 128; p++)
+ {
+ test_property1 (p, MPFR_RNDN, 0);
+ test_property1 (p, MPFR_RNDU, 0);
+ test_property1 (p, MPFR_RNDA, 0);
+ test_property1 (p, MPFR_RNDN, 1);
+ test_property1 (p, MPFR_RNDU, 1);
+ test_property1 (p, MPFR_RNDA, 1);
+ test_property2 (p, MPFR_RNDN);
+ }
+
+ check_diverse ("635030154261163106768013773815762607450069292760790610550915652722277604820131530404842415587328", 160, "796887792767063979679855997149887366668464780637");
+ special ();
+ check_singular ();
+
+ for (p=2; p<200; p++)
+ for (k=0; k<200; k++)
+ check_inexact (p);
+ check_float();
+
+ check3 ("-0.0", MPFR_RNDN, "0.0");
+ check4 ("6.37983013646045901440e+32", MPFR_RNDN, "5.9bc5036d09e0c@13");
+ check4 ("1.0", MPFR_RNDN, "1");
+ check4 ("1.0", MPFR_RNDZ, "1");
+ check4 ("3.725290298461914062500000e-9", MPFR_RNDN, "4@-4");
+ check4 ("3.725290298461914062500000e-9", MPFR_RNDZ, "4@-4");
+ check4 ("1190456976439861.0", MPFR_RNDZ, "2.0e7957873529a@6");
+ check4 ("1219027943874417664.0", MPFR_RNDZ, "4.1cf2af0e6a534@7");
+ /* the following examples are bugs in Cygnus compiler/system, found by
+ Fabrice Rouillier while porting mpfr to Windows */
+ check4 ("9.89438396044940256501e-134", MPFR_RNDU, "8.7af7bf0ebbee@-56");
+ check4 ("7.86528588050363751914e+31", MPFR_RNDZ, "1.f81fc40f32062@13");
+ check4 ("0.99999999999999988897", MPFR_RNDN, "f.ffffffffffff8@-1");
+ check4 ("1.00000000000000022204", MPFR_RNDN, "1");
+ /* the following examples come from the paper "Number-theoretic Test
+ Generation for Directed Rounding" from Michael Parks, Table 4 */
+
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDN,
+ "1.f81fc40f32063@13");
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDN,
+ "1.60c012a92fc65@13");
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDN,
+ "1.51d17526c7161@13");
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDN,
+ "1.25e19302f7e51@13");
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDN,
+ "1.0ecea7dd2ec3d@13");
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDN,
+ "1.0ecf250e8e921@13");
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDN,
+ "1.5552f3eedcf33@13");
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDN,
+ "1.3853ee10c9c99@13");
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDN,
+ "1.556abe212b56f@13");
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDN,
+ "1.e2d9a51977e6e@13");
+
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDZ,
+ "1.f81fc40f32062@13");
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDZ,
+ "1.60c012a92fc64@13");
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDZ, "1.51d17526c716@13");
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDZ, "1.25e19302f7e5@13");
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDZ,
+ "1.0ecea7dd2ec3c@13");
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDZ, "1.0ecf250e8e92@13");
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDZ,
+ "1.5552f3eedcf32@13");
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDZ,
+ "1.3853ee10c9c98@13");
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDZ,
+ "1.556abe212b56e@13");
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDZ,
+ "1.e2d9a51977e6d@13");
+
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDU,
+ "1.f81fc40f32063@13");
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDU,
+ "1.60c012a92fc65@13");
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDU,
+ "1.51d17526c7161@13");
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDU,
+ "1.25e19302f7e51@13");
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDU,
+ "1.0ecea7dd2ec3d@13");
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDU,
+ "1.0ecf250e8e921@13");
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDU,
+ "1.5552f3eedcf33@13");
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDU,
+ "1.3853ee10c9c99@13");
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDU,
+ "1.556abe212b56f@13");
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDU,
+ "1.e2d9a51977e6e@13");
+
+ check4 ("78652858805036375191418371571712.0", MPFR_RNDD,
+ "1.f81fc40f32062@13");
+ check4 ("38510074998589467860312736661504.0", MPFR_RNDD,
+ "1.60c012a92fc64@13");
+ check4 ("35318779685413012908190921129984.0", MPFR_RNDD, "1.51d17526c716@13");
+ check4 ("26729022595358440976973142425600.0", MPFR_RNDD, "1.25e19302f7e5@13");
+ check4 ("22696567866564242819241453027328.0", MPFR_RNDD,
+ "1.0ecea7dd2ec3c@13");
+ check4 ("22696888073761729132924856434688.0", MPFR_RNDD, "1.0ecf250e8e92@13");
+ check4 ("36055652513981905145251657416704.0", MPFR_RNDD,
+ "1.5552f3eedcf32@13");
+ check4 ("30189856268896404997497182748672.0", MPFR_RNDD,
+ "1.3853ee10c9c98@13");
+ check4 ("36075288240584711210898775080960.0", MPFR_RNDD,
+ "1.556abe212b56e@13");
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDD,
+ "1.e2d9a51977e6d@13");
+
+ /* check that rounding away is just rounding toward plus infinity */
+ check4 ("72154663483843080704304789585920.0", MPFR_RNDA,
+ "1.e2d9a51977e6e@13");
+
+ test_generic (2, 300, 15);
+ data_check ("data/sqrt", mpfr_sqrt, "mpfr_sqrt");
+ bad_cases (mpfr_sqrt, mpfr_sqr, "mpfr_sqrt", 8, -256, 255, 4, 128, 800, 50);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c
new file mode 100644
index 0000000..28e2c14
--- /dev/null
+++ b/tests/tsqrt_ui.c
@@ -0,0 +1,56 @@
+/* Test file for mpfr_sqrt_ui.
+
+Copyright 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check (unsigned long a, mpfr_rnd_t rnd_mode, const char *qs)
+{
+ mpfr_t q;
+
+ mpfr_init2 (q, 53);
+ mpfr_sqrt_ui (q, a, rnd_mode);
+ if (mpfr_cmp_str1 (q, qs))
+ {
+ printf ("mpfr_sqrt_ui failed for a=%lu, rnd_mode=%s\n",
+ a, mpfr_print_rnd_mode (rnd_mode));
+ printf ("sqrt gives %s, mpfr_sqrt_ui gives ", qs);
+ mpfr_out_str(stdout, 10, 0, q, MPFR_RNDN);
+ exit (1);
+ }
+ mpfr_clear (q);
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+
+ check (0, MPFR_RNDN, "0.0");
+ check (2116118, MPFR_RNDU, "1.45468828276026215e3");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tstckintc.c b/tests/tstckintc.c
new file mode 100644
index 0000000..dd5e0d9
--- /dev/null
+++ b/tests/tstckintc.c
@@ -0,0 +1,228 @@
+/* Test file for mpfr_custom_*
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define BUFFER_SIZE 250
+#define PREC_TESTED 200
+
+long Buffer[BUFFER_SIZE];
+char *stack = (char *) Buffer;
+mpfr_prec_t p = PREC_TESTED;
+
+#define ALIGNED(s) (((s) + sizeof (long) - 1) / sizeof (long) * sizeof (long))
+
+static void *
+new_st (size_t s)
+{
+ void *p = (void *) stack;
+ stack += ALIGNED (s);
+ if (MPFR_UNLIKELY (stack > (char *) &Buffer[BUFFER_SIZE]))
+ {
+ printf ("Stack overflow.\n");
+ exit (1);
+ }
+ return p;
+}
+
+ /* Alloc a new mpfr_t on the main stack */
+static mpfr_ptr
+new_mpfr (mpfr_prec_t p)
+{
+ mpfr_ptr x = (mpfr_ptr) new_st (sizeof (mpfr_t));
+ void *mantissa = new_st (mpfr_custom_get_size (p));
+ mpfr_custom_init (mantissa, p);
+ mpfr_custom_init_set (x, 0, 0, p, mantissa);
+ return x;
+}
+
+ /* Garbage the stack by keeping only x */
+static mpfr_ptr
+return_mpfr (mpfr_ptr x, char *old_stack)
+{
+ void *mantissa = mpfr_custom_get_significand (x);
+ size_t size_mantissa = mpfr_custom_get_size (mpfr_get_prec (x));
+ mpfr_ptr newx;
+
+ memmove (old_stack, x, sizeof (mpfr_t));
+ memmove (old_stack + ALIGNED (sizeof (mpfr_t)), mantissa, size_mantissa);
+ newx = (mpfr_ptr) old_stack;
+ mpfr_custom_move (newx, old_stack + ALIGNED (sizeof (mpfr_t)));
+ stack = old_stack + ALIGNED (sizeof (mpfr_t)) + ALIGNED (size_mantissa);
+ return newx;
+}
+
+static void
+test1 (void)
+{
+ mpfr_ptr x, y;
+ char *org;
+
+ org = stack;
+ x = new_mpfr (p);
+ y = new_mpfr (p);
+ mpfr_set_ui (x, 42, MPFR_RNDN);
+ mpfr_set_ui (y, 17, MPFR_RNDN);
+ mpfr_add (y, x, y, MPFR_RNDN);
+ y = return_mpfr (y, org);
+ if (y != x || mpfr_cmp_ui (y, 59) != 0)
+ {
+ printf ("Compact (1) failed!\n");
+ exit (1);
+ }
+ stack = org;
+}
+
+/* We build the MPFR variable each time it is needed */
+/* a[0] is the kind, a[1] is the exponent, &a[2] is the mantissa */
+static long *
+dummy_new (void)
+{
+ long *r;
+
+ r = (long *) new_st (ALIGNED (2 * sizeof (long)) +
+ ALIGNED (mpfr_custom_get_size (p)));
+ MPFR_ASSERTN (r != NULL);
+ (mpfr_custom_init) (&r[2], p);
+ r[0] = (int) MPFR_NAN_KIND;
+ r[1] = 0;
+ return r;
+}
+
+static long *
+dummy_set_si (long si)
+{
+ mpfr_t x;
+ long * r = dummy_new ();
+ (mpfr_custom_init_set) (x, 0, 0, p, &r[2]);
+ mpfr_set_si (x, si, MPFR_RNDN);
+ r[0] = mpfr_custom_get_kind (x);
+ r[1] = mpfr_custom_get_exp (x);
+ return r;
+}
+
+static long *
+dummy_add (long *a, long *b)
+{
+ mpfr_t x, y, z;
+ long *r = dummy_new ();
+ mpfr_custom_init_set (x, 0, 0, p, &r[2]);
+ (mpfr_custom_init_set) (y, a[0], a[1], p, &a[2]);
+ mpfr_custom_init_set (z, b[0], b[1], p, &b[2]);
+ mpfr_add (x, y, z, MPFR_RNDN);
+ r[0] = (mpfr_custom_get_kind) (x);
+ r[1] = (mpfr_custom_get_exp) (x);
+ return r;
+}
+
+static long *
+dummy_compact (long *r, char *org_stack)
+{
+ memmove (org_stack, r,
+ ALIGNED (2*sizeof (long)) + ALIGNED ((mpfr_custom_get_size) (p)));
+ return (long *) org_stack;
+}
+
+static void
+test2 (void)
+{
+ mpfr_t x;
+ char *org = stack;
+ long *a, *b, *c;
+
+ a = dummy_set_si (42);
+ b = dummy_set_si (17);
+ c = dummy_add (a, b);
+ c = dummy_compact (c, org);
+ (mpfr_custom_init_set) (x, c[0], c[1], p, &c[2]);
+ if (c != a || mpfr_cmp_ui (x, 59) != 0)
+ {
+ printf ("Compact (2) failed! c=%p a=%p\n", (void *) c, (void *) a);
+ mpfr_dump (x);
+ exit (1);
+ }
+ stack = org;
+}
+
+static void
+test_nan_inf_zero (void)
+{
+ mpfr_ptr val;
+ int sign;
+ int kind;
+ char *org = stack;
+
+ val = new_mpfr (MPFR_PREC_MIN);
+
+ mpfr_set_nan (val);
+ kind = (mpfr_custom_get_kind) (val);
+ if (kind != MPFR_NAN_KIND)
+ {
+ printf ("mpfr_custom_get_kind error : ");
+ mpfr_dump (val);
+ printf (" is kind %d instead of %d\n", kind, MPFR_NAN_KIND);
+ exit (1);
+ }
+
+ sign = 1;
+ mpfr_set_inf (val, sign);
+ kind = (mpfr_custom_get_kind) (val);
+ if ((ABS (kind) != MPFR_INF_KIND) || (SIGN (kind) != SIGN (sign)))
+ {
+ printf ("mpfr_custom_get_kind error : ");
+ mpfr_dump (val);
+ printf (" is kind %d instead of %d\n", kind, MPFR_INF_KIND);
+ printf (" have sign %d instead of %d\n", SIGN (kind), SIGN (sign));
+ exit (1);
+ }
+
+ sign = -1;
+ mpfr_set_zero (val, sign);
+ kind = (mpfr_custom_get_kind) (val);
+ if ((ABS (kind) != MPFR_ZERO_KIND) || (SIGN (kind) != SIGN (sign)))
+ {
+ printf ("mpfr_custom_get_kind error : ");
+ mpfr_dump (val);
+ printf (" is kind %d instead of %d\n", kind, MPFR_ZERO_KIND);
+ printf (" have sign %d instead of %d\n", SIGN (kind), SIGN (sign));
+ exit (1);
+ }
+
+ stack = org;
+}
+
+int
+main (void)
+{
+ tests_start_mpfr ();
+ /* We test iff long = mp_limb_t */
+ if (sizeof (long) == sizeof (mp_limb_t))
+ {
+ test1 ();
+ test2 ();
+ test_nan_inf_zero ();
+ }
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tstdint.c b/tests/tstdint.c
new file mode 100644
index 0000000..73ea022
--- /dev/null
+++ b/tests/tstdint.c
@@ -0,0 +1,63 @@
+/* Test file for multiple mpfr.h inclusion and intmax_t related functions
+
+Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#if HAVE_STDINT_H
+
+#if _MPFR_EXP_FORMAT == 4
+/* If mpfr_exp_t is defined as intmax_t, intmax_t must be defined before
+ the inclusion of mpfr.h (this test doesn't use mpfr-impl.h). */
+# include <stdint.h>
+#endif
+
+/* Assume that this is in fact a header inclusion for some library
+ that uses MPFR, i.e. this inclusion is hidden in another one.
+ MPFR currently (rev 6704) fails to handle this case. */
+#include <mpfr.h>
+
+#include <stdint.h>
+
+#define MPFR_USE_INTMAX_T
+#include <mpfr.h>
+
+int
+main (void)
+{
+ mpfr_t x;
+ intmax_t j;
+
+ mpfr_init_set_ui (x, 1, MPFR_RNDN);
+ j = mpfr_get_uj (x, MPFR_RNDN);
+ mpfr_clear (x);
+ return j == 1 ? 0 : 1;
+}
+
+#else /* HAVE_STDINT_H */
+
+/* The test is disabled. */
+
+int
+main (void)
+{
+ return 77;
+}
+
+#endif /* HAVE_STDINT_H */
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c
new file mode 100644
index 0000000..cefce22
--- /dev/null
+++ b/tests/tstrtofr.c
@@ -0,0 +1,1211 @@
+/* Test file for mpfr_set_str.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+check_special (void)
+{
+ mpfr_t x, y;
+ int res;
+ char *s;
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* Check dummy case */
+ res = mpfr_strtofr (x, "1234567.89E1", NULL, 10, MPFR_RNDN);
+ mpfr_set_str (y, "1234567.89E1", 10, MPFR_RNDN);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Results differ between strtofr and set_str.\n"
+ " set_str gives: ");
+ mpfr_dump (y);
+ printf (" strtofr gives: ");
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ /* Check NAN */
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NaN", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || *s != 0)
+ {
+ printf ("Error for setting NAN (1)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "+NaN", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || *s != 0)
+ {
+ printf ("Error for setting +NAN (1)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, " -NaN", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || *s != 0)
+ {
+ printf ("Error for setting -NAN (1)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "@nAn@xx", &s, 16, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "xx") )
+ {
+ printf ("Error for setting NAN (2)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN(abcdEDF__1256)Hello", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "Hello") )
+ {
+ printf ("Error for setting NAN (3)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN(abcdEDF)__1256)Hello", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "__1256)Hello") )
+ {
+ printf ("Error for setting NAN (4)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN(abc%dEDF)__1256)Hello", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "(abc%dEDF)__1256)Hello") )
+ {
+ printf ("Error for setting NAN (5)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN((abc))", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "((abc))") )
+ {
+ printf ("Error for setting NAN (6)\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* make sure that x is modified */
+ res = mpfr_strtofr (x, "NAN()foo", &s, 10, MPFR_RNDN);
+ if (res != 0 || !mpfr_nan_p (x) || strcmp(s, "foo") )
+ {
+ printf ("Error for setting NAN (7)\n");
+ exit (1);
+ }
+
+ /* Check INF */
+ res = mpfr_strtofr (x, "INFINITY", &s, 8, MPFR_RNDN);
+ if (res != 0 || !mpfr_inf_p (x) || *s != 0)
+ {
+ printf ("Error for setting INFINITY (1)\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "INFANITY", &s, 8, MPFR_RNDN);
+ if (res != 0 || !mpfr_inf_p (x) || strcmp(s, "ANITY"))
+ {
+ printf ("Error for setting INFINITY (2)\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "@INF@*2", &s, 11, MPFR_RNDN);
+ if (res != 0 || !mpfr_inf_p (x) || strcmp(s, "*2"))
+ {
+ printf ("Error for setting INFINITY (3)\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ /* Check Zero */
+ res = mpfr_strtofr (x, " 00000", &s, 11, MPFR_RNDN);
+ if (res != 0 || !mpfr_zero_p (x) || s[0] != 0)
+ {
+ printf ("Error for setting ZERO (1)\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ /* Check base 62 */
+ res = mpfr_strtofr (x, "A", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 10))
+ {
+ printf ("Error for setting 'A' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "a", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 36))
+ {
+ printf ("Error for setting 'a' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "Z", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 35))
+ {
+ printf ("Error for setting 'Z' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "z", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 61))
+ {
+ printf ("Error for setting 'z' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "ZA", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 2180))
+ {
+ printf ("Error for setting 'ZA' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "za", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 3818))
+ {
+ printf ("Error for setting 'za' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "aZ", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 2267))
+ {
+ printf ("Error for setting 'aZ' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "Az", NULL, 62, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 681))
+ {
+ printf ("Error for setting 'Az' in base 62\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+
+ /* Check base 60 */
+ res = mpfr_strtofr (x, "Aa", NULL, 60, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 636))
+ {
+ printf ("Error for setting 'Aa' in base 60\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ res = mpfr_strtofr (x, "Zz", &s, 60, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 35) || strcmp(s, "z") )
+ {
+ printf ("Error for setting 'Zz' in base 60\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+
+ /* Check base 61 */
+ res = mpfr_strtofr (x, "z", &s, 61, MPFR_RNDN);
+ if (res != 0 || mpfr_cmp_ui (x, 0) || strcmp(s, "z") )
+ {
+ printf ("Error for setting 'z' in base 61\n x=");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* The following RefTable has been generated by this following code */
+#if 0
+#define MAX_NUM 100
+
+int randomab (int a, int b)
+{
+ return a + rand () % (b-a);
+}
+
+int
+main (void)
+{
+ int i, base;
+ mpfr_t x;
+ mpfr_prec_t p;
+ mpfr_exp_t e;
+
+ mpfr_init (x);
+ printf ("struct dymmy_test { \n"
+ " mpfr_prec_t prec; \n"
+ " int base; \n"
+ " const char *str; \n"
+ " const char *binstr; \n"
+ " } RefTable[] = { \n");
+ for (i = 0 ; i < MAX_NUM ; i++)
+ {
+ p = randomab(2, 180);
+ base = randomab (2, 30);
+ e = randomab (-1<<15, 1<<15);
+ mpfr_set_prec (x, p);
+ mpfr_urandomb (x, RANDS);
+ mpfr_mul_2si (x, x, e, MPFR_RNDN);
+ printf("{%lu, %d,\n\"", p, base);
+ mpfr_out_str (stdout, base, p, x, MPFR_RNDN);
+ printf ("\",\n\"");
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
+ printf ("\"}%c\n", i == MAX_NUM-1 ? ' ' : ',' );
+ }
+ printf("};\n");
+ mpfr_clear (x);
+}
+#endif
+
+static struct dymmy_test {
+ mpfr_prec_t prec;
+ int base;
+ const char *str;
+ const char *binstr;
+ } RefTable[] = {
+{39, 20,
+"1.1c9jeh9jg12d8iiggf26b8ce2cig24agai51d9@1445",
+"1.00111010111010001110110001101011101011e6245"},
+{119, 3,
+"1.2210112120221020220021000020101121120011021202212101222000011110211211122222001001221110102220122021121021101010120101e-5655",
+"1.1111101110011110001101011100011000011100001011011100010011010010001000000111001010000001110111010100011000110010000000e-8963"},
+{166, 18,
+"3.ecg67g31434b74d8hhbe2dbbb46g9546cae72cae0cfghfh00ed7gebe9ca63b47h08bgbdeb880a76dea12he31e1ccd67e9dh22a911b46h517b745169b2g43egg2e4eah820cdb2132d6a4f9c63505dd4a0dafbc@-5946",
+"1.011110010000110011111011111100110110010110000010100001101111111000010000011111110101100000010110011001100000010001100101000001101000010010001011001011000110100011001e-24793"},
+{139, 4,
+"1.020302230021023320300300101212330121100031233000032101123133120221012000000000000000000000000000000000000000000000000000000000000000000000e11221",
+"1.001000110010101100001001001011111000110000110000010001100110111100011001010000001101101111000000001110010001011011011111011000101001000110e22442"},
+{126, 13,
+"4.a3cb351c6c548a0475218519514c6c54366681447019ac70a387862c39c86546ab27608c9c2863328860aa2464288070a76c0773882728c5213a335289259@2897",
+"1.01011010000001110001100001101111100111011010010111000011000101111011000100001010010100110111101001001001000000011100010000000e10722"},
+{6, 26,
+"1.j79f6@-1593",
+"1.00000e-7487"},
+{26, 18,
+"3.5e99682hh310aa89hb2fb4h88@-5704",
+"1.0110010100010101000101100e-23784"},
+{12, 21,
+"4.j7f3e2ccdfa@-3524",
+"1.10110101011e-15477"},
+{38, 28,
+"o.agr0m367b9bmm76rplg7b53qlj7f02g717cab@6452",
+"1.1001010011101100110100111000111010001e31021"},
+{75, 17,
+"4.00abd9gc99902e1cae2caa7647gcc029g01370e96d3f8e9g02f814d3ge5faa29d40b9db470@5487",
+"1.11100000110101010111101001110001001010111111010100000100001010100111011101e22429"},
+{91, 16,
+"1.0a812a627160014a3bda1f00000000000000000000000000000000000000000000000000000000000000000000@7897",
+"1.000010101000000100101010011000100111000101100000000000010100101000111011110110100001111100e31588"},
+{154, 19,
+"1.989279dda02a8ic15e936ahig3c695f6059a3i01b7d1ge6a418bf84gd87e36061hb2bi62ciagcgb9226fafea41d2ig1e2f0a10ea3i40d6dahf598bdbh372bdf5901gh276866804ah53b6338bi@5285",
+"1.110101101101101111110010001011110001100000010100011101101001000100110100000011110111000011011101011110010100110101011011111100101101001100000101101000010e22450"},
+{53, 2,
+"1.0100010111100111001010000100011011111011011100110111e-20319",
+"1.0100010111100111001010000100011011111011011100110111e-20319"},
+{76, 3,
+"2.101212121100222100012112101120011222102000021110201110000202111122221100001e1511",
+"1.000110101010111000011001011111110000001001101001011011111110111111010000111e2396"},
+{31, 9,
+"1.171774371505084376877631528681e3258",
+"1.110101101011111011111000110011e10327"},
+{175, 8,
+"4.506242760242070533035566017365410474451421355546570157251400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3483",
+"1.001010001100101000101111100000101000100001110001010110110000111011011101100000011110111101011000010001001111001001010011000100010111011011011001101011110000011011110101010011e10451"},
+{103, 24,
+"8.0hmlm3g183cj358fn4bimn5bie1l89k95m647474mm8jg5kh1c011gi0m7de9j7b48c595g1bki4n32kll7b882eg7klgga0h0gf11@4510",
+"1.001000110101001101011010101001111010110100010100110101010101110000001011001101110110010111000101010111e20681"},
+{12, 9,
+"3.00221080453e2479",
+"1.11000111010e7859"},
+{86, 11,
+"6.873680186953174a274754118026423965415553a088387303452447389287133a0956111602a5a085446@5035",
+"1.0000000000110100010110000111010001010100101011000100101010010011101010000110011110001e17421"},
+{68, 10,
+"6.1617378719016284192718392572980535262609909598793237475124371481233e481",
+"1.0110001011000101110010111101100101111110001100001011110011001101111e1600"},
+{11, 15,
+"5.ab10c18d45@907",
+"1.0000101111e3546"},
+{77, 26,
+"6.e6kl84g6h30o3nfnj7fjjff4n1ee6e5iop76gabj23e7hgan9o6724domc7bp4hdll95g817519f@5114",
+"1.1011000101111111111110011011101100000100101000001001100000001011010001001000e24040"},
+{28, 27,
+"d.odiqp9kgh84o8d2aoqg4c21hemi@3566",
+"1.101001111001111111110011110e16959"},
+{45, 14,
+"7.cddc6295a576980adbc8c16111d6301bad3146a1143c@-6227",
+"1.10000000110011000000101100110001011100010111e-23706"},
+{54, 19,
+"1.b6e67i2124hfga2g819g1d6527g2b603eg3cd8hhca9gecig8geg1@4248",
+"1.11010100100010101101110110010100000010111010010101110e18045"},
+{49, 20,
+"1.jj68bj6idadg44figi10d2ji99g6ddi6c6ich96a5h86i529@-3149",
+"1.001011111101100100001010001000011100000000101110e-13609"},
+{171, 16,
+"6.22cf0e566d8ff11359d70bd9200065cfd72600b12e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000@5602",
+"1.10001000101100111100001110010101100110110110001111111100010001001101011001110101110000101111011001001000000000000001100101110011111101011100100110000000001011000100101110e22410"},
+{144, 14,
+"1.425d9709b4c125651ab88bb1a0370c14270d067a9a74a612dad48d5c025531c175c1b905201d0d9773aa686c8249db9c0b841b10821791c02baa2525a4aa7571850439c2cc965cd@-3351",
+"1.11100111110001001101010111010000101010011000111001101011000001011110101110011011100100111001101101111011001001101011001101001011011101101111011e-12759"},
+{166, 6,
+"3.324252232403440543134003140400220120040245215204322153511143504542403430152410543444455151104314552352030352125540101550151410414122051500201022252511512332523431554e8340",
+"1.010101111101111101001001110010111110010000001111010101100110011011010110011001001100001111010101100000010111011111101110110111101110010001110001111000001010001111000e21560"},
+{141, 24,
+"2.i3c88lkm2958l9ncb9f85kk35namjli84clek5j6jjkli82kb9m4e4i2g39me63db2094cif80gcba8ie6l15ia0d667kn9i1f77bdak599e1ach0j05cdn8kf6c6kfd82j2k6hj2c4d@4281",
+"1.10011100001010110111001000000000101011100010101011001010001101110100110111011000111101000001111101100000110100100010101011001100100011001011e19629"},
+{84, 6,
+"2.41022133512503223022555143021524424430350133500020112434301542311050052304150111243e982",
+"1.11010001111111001010011100011000011100100111111010001111010010101001001000011100001e2539"},
+{56, 9,
+"1.5305472255016741401411184703518332515066156086511016413e2936",
+"1.0111110010001101000000110101110000110101001011001100111e9307"},
+{18, 8,
+"3.63542400000000000e-599",
+"1.11100111011000101e-1796"},
+{111, 13,
+"8.b693ac7a24679b98708a0057a6202c867bc146740ab1971b380756a24c99804b63436419239ba0510030b819933771a636c57c5747b883@-6160",
+"1.01011011111110100101110010100100000110000011011101001110010110000011101110111111010111000011011101101001100100e-22792"},
+{162, 16,
+"4.f2abe958a313566adbf3169e55cdcff3785dbd5c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000@382",
+"1.00111100101010101111101001010110001010001100010011010101100110101011011011111100110001011010011110010101011100110111001111111100110111100001011101101111010101110e1530"},
+{117, 23,
+"2.4b6kk3ag3if217ih1hggkk69bmcecfil1cd38dijh35j8e6ckhd335a4gj7l05bedk19473i8449b1ajc3jd3ka95eceheh72lh2jh17jamlm1142gll@-3628",
+"1.10010010001010001110011000010000011111011101111100110101100100101111101110010011101001111010100010001111110100101111e-16411"},
+{179, 2,
+"1.1101101011111010101000110101010101101110001011011010101001110111011010011110001000000110101100010010001110010110011000000110001011111001011110100011101000110001001000110100100110e14203",
+"1.1101101011111010101000110101010101101110001011011010101001110111011010011110001000000110101100010010001110010110011000000110001011111001011110100011101000110001001000110100100110e14203"},
+{18, 27,
+"4.ll743n2f654gh3154@-6039",
+"1.01101001111010011e-28713"},
+{178, 15,
+"1.e5443105cad2d014b700c42aa3de854c4b95322420695d07db3564ec07473da83bde123b74c794139265a838ebeca745ad3dc97d7c356271ca935ea8e83306562c2a8edc6e886c1b6b2d3e17038379c33826526770985c068@821",
+"1.011100001000101100111111111111000100110111110011101010001111011001111101111001010011100100100101100011101001000000101001010100011111001011001010011101101001000111111010101101011e3208"},
+{161, 22,
+"2.46ikji624bg042877h8g2jdki4ece6ede62841j7li843a4becdkkii86c54192jkefehikkb3kcb26ij1b3k9agfbb07dih88d6ej0ee0d63i8hedc7f0g0i9g7jf9gf6423j70h421bg5hf2bja9j0a432lb10@-5125",
+"1.0111011000111110000010011100001100100110001011101001011110111010100000011100000010011101011100101100111100110000001101010101011110100011101111001011001111100000e-22854"},
+{62, 19,
+"7.bgd1g0886a6c3a9ee67cc7g3bgf718i98d90788idi5587358e660iffc0ic6@3257",
+"1.0101100100001110000100010110100100000111110001111001011110100e13838"},
+{127, 19,
+"1.413bgf99eidba75ged25f7187080bce3h7ebdeghea4ig6c79g94di7b42a3e4cdi4ic6a53i71d2e4hdbe50ih0a0egf2fi469732131ig6g496bf7h8g3c86ie7h@-4465",
+"1.001101111000011011100010010010010110111001001001110011110101111111000001110101111110001110010000110011111101000011000101111101e-18967"},
+{17, 21,
+"4.7d5b70gh4k0gj4fj@-116",
+"1.1000100010000110e-508"},
+{141, 13,
+"2.2b4988c5cb57072a6a1a9c42224794a1cbc175a9bc673bb28aa045c3182b9396ca8bb8590969672b0239608a845a2c35c08908a58c2a83748c89241a6561422c7cc4866c8454@4358",
+"1.10010110101000001000001001111001000100111110100010100110111011111011010010101000110101110000111100010000101101000110000000000001111110110011e16127"},
+{39, 7,
+"3.00350342452505221136410100232265245244e202",
+"1.10011000111110011010100110101101010010e568"},
+{119, 24,
+"5.2aene587kc2d9a55mm8clhn4dn0a551de58b1fcli8e8hf1jlm7i0376dl5fhb2k8acka03077mnbn9d4dmi0641dce871c81g2b3ge76m3kngm4a9g5gh@-892",
+"1.0111101010010100001001111110000000100101110010010111111100100101100001010010100110111000101100101010111000101111000010e-4088"},
+{41, 14,
+"5.c3dc5c49373d0c0075624931133022185bd08b16@-5294",
+"1.0101011000010111111111000010100110011111e-20154"},
+{41, 6,
+"3.2411143454422033245255450304104450302500e2250",
+"1.1110111101010101001001100000100011110111e5817"},
+{17, 13,
+"3.65789aa26aa273b1@-4490",
+"1.1100011101010111e-16614"},
+{10, 26,
+"1.5p4hag1fl@6017",
+"1.110010111e28282"},
+{130, 11,
+"2.606a72601843700427667823172635a47055021a0a68a99326875195a179483948407aa13726244552332114a1784aaa7239956521604460876871a65708458aa@-6285",
+"1.110001001110111110110111000010101000110010011110010101100100001000101011010010000001000101000110111111110101000100000111100010100e-21742"},
+{29, 20,
+"j.4356d9b7i38i955jjj1j442501bj@163",
+"1.1010101011110011100000100100e708"},
+{140, 21,
+"9.2f5k7aid6bj2b2g5bff29i73hk3a8d8g0i7ifa07hkb79g4hd3c7j6g4hjj2jbhai01gkje3h9g3gj3i34f0194kaed32iea9dcgcj8h7i1khdkf965c1ak97gf3h03fcab3ggi03fa@4864",
+"1.0101011100011101000110101001010011111111010011000111111111100000011011100111010001100101100110001110001001100101001100110000011110100101101e21367"},
+{133, 13,
+"2.3721a9107307a71c75c07c83b70a25a9853619030b5bcb55101ca5c2060bca46c331b92b33aa957c3ac7c817335287c6917999c38c3806b6b5919623023ac52063bb@6602",
+"1.011001101111100001100100110100010100010011100010111110110100100000000010011101001011000100000110011011101001010010011110111100010010e24431"},
+{118, 2,
+"1.001010111011011000100010001110111000001100101000101101010001110110000111101110111011011101111100110010000101001001001e18960",
+"1.001010111011011000100010001110111000001100101000101101010001110110000111101110111011011101111100110010000101001001001e18960"},
+{102, 23,
+"l.26lhk42clcm9g940eihakhi32gb3331lld488cf1j4f73ge051bfl8gcmcg78gkjc2iibjf752eag0dee6dafa97k79jlh11j3270@-2160",
+"1.01101011011000100101110111110001011000101101011001011111001101000110111010000010011111101110101100010e-9767"},
+{156, 18,
+"b.eb927dd4g48abee3cc2begehb9c3b8h83cae152db850ac2f3g816d6787825122c8h3aa3g8023h23000a8hg61065b3e367ac59ca373067730f96dd0d3b73b3c43fef91750b333gd497b8ce9228e7@5504",
+"1.11000110111100011101100011001001110011101100011111010100101110010010010011111001100000011010011111111011001011111010001001011001110001100001101000000110000e22954"},
+{158, 5,
+"3.0112043214104344433122444210142004032004444213123303302023242414000243311324332203224340334422234000104132020124210141322013240010134130441413233111204013422e-10468",
+"1.1001011000111111110100100101110011100001110100101001101110011001101001101011010010111010111111101010100011100010101100110111011101000110110100000111001100011e-24305"},
+{7, 9,
+"2.141540e-146",
+"1.001111e-462"},
+{111, 5,
+"3.21233234110011204313222402442032333320324004133424222041314021020411320312421014434003440431230413141402230403e7641",
+"1.10010000000101010000101010101011011010000100010010010000010110001111000111111111000110111001100101101110101101e17743"},
+{76, 13,
+"7.1c0861453a4ac156b6119ba7548251b5cb00b7c409c2bb8138214676468c9949676226013c1@4639",
+"1.001000011000000011101101101010100010010001010111100110010101111110110010111e17169"},
+{6, 25,
+"c.aj660@-6978",
+"1.11000e-32402"},
+{156, 3,
+"2.22101000022222000012110122210202211110020121210120112102122121111210000211020001020201202200011021211102012110220222110022001121011022011202000110120021012e-14744",
+"1.11010001111000101111110000010011001101000100010010110011100100110001100111011101011111111100011111001100001111100101100000001000001100000000010010001011101e-23368"},
+{7, 23,
+"1.4hclk2@2148",
+"1.110110e9716"},
+{69, 11,
+"2.77684920493191632416690544493465617a187218365952a6740034288687745a26@3263",
+"1.01111000111000001111001110000110000110001111110011101100101111011100e11289"},
+{146, 21,
+"3.agg4d0dj636d526d4i8643ch5jee4ge2c3i46k121857dbedagd98cjifaf0fgc09ca739g2fkfbfh06i687kic2kb8c7i48gda57bb6d9bh81eh49h0d8e3i7ad2kgb1ek86b86g3589k27d@3562",
+"1.0010111111111100101010101010001100110101010011011100001110111000101101001110001110010100000001010001000111010000010011110100010010101100101000001e15647"},
+{20, 3,
+"1.2000000021102111102e-16642",
+"1.1011101011111110000e-26377"},
+{68, 13,
+"1.a43205b2164676727806614acc0398925569c3962a3ba419881a5c63b651aa3ab46@-618",
+"1.1111011000001110010100111000110010110110011001110001100101011111000e-2287"},
+{129, 4,
+"2.22033002012102010122130132103000303000120122313322000222121000300000000000000000000000000000000000000000000000000000000000000000e13222",
+"1.01010001111000010000110010010000100011010011100011110010011000000110011000000011000011010110111111010000000101010011001000000110e26445"},
+{22, 6,
+"1.420033001013011530142e11704",
+"1.001000110010110110001e30255"},
+{108, 6,
+"1.03345424443433104422104400512453214240453335230205104304115343030341144544051005432030344054100542125304500e7375",
+"1.00101101110001011101101111000010101011101000001111001110001101100000111100010101010101101100011110111010000e19064"},
+{91, 27,
+"2.ao077kf8oqoihn5pm6f5eqdcgnd2132d7p6n7di8ep82a1a9be99pm36g1emacbenaeiqphpgpdjhmm9ke3pn4pdea@-5482",
+"1.111101100001000011101010001000000111000100100111110010101101110001101101101101101010111110e-26066"},
+{96, 9,
+"8.25805186310703506315505842015248775712246416686874260383701323213202658278523870037877823670166e-8134",
+"1.11010111111000011100111001011010001110010001011101011101110101000101100100100010110011001010000e-25782"},
+{161, 16,
+"7.3a7627c1e42ef738698e292f0b81728c4b14fe8c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000@-3342",
+"1.1100111010011101100010011111000001111001000010111011110111001110000110100110001110001010010010111100001011100000010111001010001100010010110001010011111110100011e-13366"},
+{90, 3,
+"2.10212200011211012002002221112120210222002020100202111000211012122020011102022112222021001e-3447",
+"1.11100010111011011000101111110001000101000111110001100001010111101101011011110001000010001e-5463"},
+{100, 27,
+"a.f81hjjakdnc021op6ffh530ec8ige6n2fqc8f8j7ia7qelebgqkm4ic5ohh652hq1kgpag6pp0ldin6ce1fg6mj34077f5qc5oe@6576",
+"1.011101001010010011110001100011111111010001110110100100101001010000101011101011110010010011111100000e31271"},
+{152, 16,
+"e.37ac48a0303f903c9d20883eddea4300d1190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000@-1388",
+"1.1100011011110101100010010001010000000110000001111111001000000111100100111010010000010001000001111101101110111101010010000110000000011010001000110010000e-5549"},
+{106, 20,
+"1.3g2h7i2776d50gjibi937f8cdci3idecdeh3j2gba0j8d1ghgg3eg609ji55h5g7jeai1bii3a4f9jhjfij6jd1g3cg0f6024e252gc3e@6422",
+"1.100110000101011010100111100110000000100101000110110011010010000101000100110010001110011110111100010000111e27755"},
+{23, 17,
+"9.f72e724454d1g0f60g93g6@-6563",
+"1.0011100011110110010001e-26823"},
+{98, 6,
+"1.2444223304453415235424343034030405514010421403514410005234221430055051205523402412055242134042045e-8535",
+"1.1101110011010001101001001111100101111010100111001011110001000010100101101110011011101100000111011e-22063"},
+{4, 18,
+"1.gec@-6711",
+"1.100e-27984"},
+{69, 24,
+"8.d45gdfnhkhb7a20nj96dnggic83imhjne0cceldechn1m4e9fbd9db0ablngjf9n7810@6975",
+"1.00100111111100101100110011110110110000110110110010100101011111000100e31983"},
+{122, 8,
+"4.0227760456667717717077553523466457265600000000000000000000000000000000000000000000000000000000000000000000000000000000000e-1767",
+"1.0000001001011111111000010010111011011011111100111111100111100011111110110101110101001110011011010010111101011010111000000e-5299"},
+{144, 23,
+"8.b01c48dg20bek9a5k376clc501aecg92bdjaeji2dm9230i7j3k36jm50b0c5a0753i2b18534cji34bcl2li033cc534m52k2gbegc25a5g30lf4calag58026i5d7li61jg9digj5ceb1@-4456",
+"1.00010000110011010111011011110111001101111001010110001101011100100101101110110000010011011111100000100110001001001111111011010110000000001111110e-20154"},
+{111, 4,
+"2.23100111310122202021232133233012212012232222323230133100000000000000000000000000000000000000000000000000000000e-10458",
+"1.01011010000010101110100011010100010001001101110011111101111000110100110000110101110101010111011101100011111010e-20915"},
+{117, 10,
+"1.61207328685870427963864999744776917701013812304254540861834226053316419217753608451422967376154318603744156166920074e-6440",
+"1.01100011000100111001100010000000110010100001001011111010100001101111100100101100111010100011101110001010011010010010e-21393"},
+{106, 16,
+"1.dd30a1d24091263243ca1c144f0000000000000000000000000000000000000000000000000000000000000000000000000000000@354",
+"1.110111010011000010100001110100100100000010010001001001100011001001000011110010100001110000010100010011110e1416"},
+{77, 14,
+"4.90d6913ba57b149d8d85a58c311b4d537c10bd7d3c10d69c62bc08d32269760126a58115a105@-7311",
+"1.1001000000111100000111001001011000110101001111100001100111010100010000011111e-27834"},
+{8, 4,
+"3.2230000e15197",
+"1.1101011e30395"},
+{81, 24,
+"1.84ni25h558abmhg2dk7bl2jbbmkf4i8i2bemc5cgmk9jf301c00k24271m9h7mgm4301be1lnldn4364@2573",
+"1.01110010011000110110100101011001011111101111101100010110101101011101100001000010e11797"},
+{94, 2,
+"1.010010010101111001001011111111100100011110110100010001101111111100100101101100110101001011111e32427",
+"1.010010010101111001001011111111100100011110110100010001101111111100100101101100110101001011111e32427"},
+{77, 21,
+"1.87e4k9df85g50ead6fcj4h86820ikdjdjg93d90ca406g470hhkh7ciaba1aggg753g36553ebh5@2538",
+"1.0010001100011000111010000010011001010011000000100101010001100000111101000111e11148"},
+{80, 17,
+"1.923gga999230g94fce02efg753ce001045a35e0264c9c2cb17850e32484fc3526dcg38ed874g5f2@3392",
+"1.0011100111101001001101111001110100001100111110011110110001100110101010111001110e13865"},
+{99, 7,
+"4.53646362336126606650465342500160461331562113222506144210636341332436342025203333264316511653025011e-5540",
+"1.01101101111001001100001101101101010011001001100110111000010000101000011001001001101000011101011001e-15551"},
+{119, 20,
+"1.c8966iabcf4de94ad15f9e83j407i3he7fch54h5jh0g5d74e06c057gg72a107didj8d1j8geibbfec5j36c3fgd5e12edjb9g10j7c9i03f33hi80ce0@7153",
+"1.0101110101100011110001001110100110011000100000001001000110111110011111100011111010011101011111101101010011110111110100e30915"},
+{93, 13,
+"2.c749cb562c3a758b1a21a650666a4c6c53c76ca58a1a75a0358c9ac3866887972b3551a03aa6c150856531258508@193",
+"1.10101111101001011010111101100100111110011111010110111101100100010011001001100011110100111110e715"},
+{145, 14,
+"1.c61614b64261d22c62cb9d16163ca4d144ac23351b708506b3b610b1b67b764ca974448d7a2c6515a6bc97503d4b2a530c75b2b677a464c6629c69b6c3d7860d7749b4b653c434d5@2050",
+"1.111111100001101111100011001111100010010000101000011110000001110100111001011010100001001010111111010001111101000110011000011101110110001001100101e7805"},
+{159, 23,
+"4.bj9l07l0215e7l6lf1dkf62i056l37jaa0gdih717656f1kk1a77883jf99jg31le43em76bmcg4lddl782ihkla0m392886d8lm67d6c3a1l4j12kg0l1k52ee77lmk0gech11g8jeei680k85bi460c7el17@-1539",
+"1.01010100110100100101100001011100000001100011110001001101000010000001000010000110000110010001110100001101011101101001001101101111001101101111101001010010010100e-6960"},
+{24, 25,
+"g.m749al09kflg5b42jnn4a7b@-2820",
+"1.01010010101011010111011e-13092"},
+{88, 18,
+"3.5ed0gad0bhhb7aa9ge2ad1dhcg6833f3e068936hghf23gd2aa69f13539f15hfce50aa64achfee49bfg7249g@-4058",
+"1.001000010110011011000101100000101111101001100011101101001111110111000010010110010001100e-16920"}
+};
+
+static void
+check_reftable (void)
+{
+ int i, base;
+ mpfr_t x, y;
+ mpfr_prec_t p;
+ char *s;
+
+ mpfr_init2 (x, 200);
+ mpfr_init2 (y, 200);
+ for (i = 0 ; i < numberof (RefTable) ; i++)
+ {
+ base = RefTable[i].base;
+ p = RefTable[i].prec;
+ mpfr_set_prec (x, p);
+ mpfr_set_prec (y, p);
+ mpfr_set_str_binary (x, RefTable[i].binstr);
+ mpfr_strtofr (y, RefTable[i].str, &s, base, MPFR_RNDN);
+ if (s == NULL || *s != 0)
+ {
+ printf ("strtofr didn't parse entire input for i=%d:\n"
+ " Str=%s", i, RefTable[i].str);
+ exit (1);
+ }
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Results differ between strtofr and set_binary for i=%d:\n"
+ " Set binary gives: ", i);
+ mpfr_dump (x);
+ printf (" strtofr gives: ");
+ mpfr_dump (y);
+ printf (" setstr gives: ");
+ mpfr_set_str (x, RefTable[i].str, base, MPFR_RNDN);
+ mpfr_dump (x);
+ mpfr_set_prec (x, 2*p);
+ mpfr_set_str (x, RefTable[i].str, base, MPFR_RNDN);
+ printf (" setstr ++ gives: ");
+ mpfr_dump (x);
+ exit (1);
+ }
+ }
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+static void
+check_parse (void)
+{
+ mpfr_t x;
+ char *s;
+ int res;
+
+ mpfr_init (x);
+
+ /* Invalid data */
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ res = mpfr_strtofr (x, " invalid", NULL, 10, MPFR_RNDN);
+ if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x))
+ {
+ printf ("Failed parsing ' invalid' (1)\n X=");
+ mpfr_dump (x);
+ exit (1);
+ }
+ MPFR_ASSERTN (res == 0);
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ res = mpfr_strtofr (x, " invalid", &s, 0, MPFR_RNDN);
+ if (MPFR_NOTZERO (x) || MPFR_IS_NEG (x) || strcmp (s, " invalid"))
+ {
+ printf ("Failed parsing ' invalid' (2)\n S=%s\n X=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ MPFR_ASSERTN (res == 0);
+ /* Check if it stops correctly */
+ mpfr_strtofr (x, "15*x", &s, 10, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 15) || strcmp (s, "*x"))
+ {
+ printf ("Failed parsing '15*x'\n S=%s\n X=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ /* Check for leading spaces */
+ mpfr_strtofr (x, " 1.5E-10 *x^2", &s, 10, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "1.5E-10") || strcmp (s, " *x^2"))
+ {
+ printf ("Failed parsing '1.5E-10*x^2'\n S=%s\n X=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ /* Check for leading sign */
+ mpfr_strtofr (x, " +17.5E-42E ", &s, 10, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "17.5E-42") || strcmp (s, "E "))
+ {
+ printf ("Failed parsing '+17.5E-42E '\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-17.5E+42E\n", &s, 10, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "-17.5E42") || strcmp (s, "E\n"))
+ {
+ printf ("Failed parsing '-17.5E+42\\n'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* P form */
+ mpfr_strtofr (x, "0x42P17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "8650752", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '0x42P17' (base = 16)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-0X42p17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-8650752", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '-0x42p17' (base = 16)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "42p17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "8650752", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '42p17' (base = 16)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-42P17", &s, 16, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-8650752", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '-42P17' (base = 16)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "0b1001P17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "1179648", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '0b1001P17' (base = 2)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-0B1001p17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-1179648", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '-0B1001p17' (base = 2)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "1001p17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "1179648", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '1001p17' (base = 2)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-1001P17", &s, 2, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-1179648", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '-1001P17' (base = 2)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* Check for auto-detection of the base */
+ mpfr_strtofr (x, "+0x42P17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "42P17", 16, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '+0x42P17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-42E17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-42E17", 10, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '-42E17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-42P17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "-42", 10, MPFR_RNDN) || strcmp (s, "P17"))
+ {
+ printf ("Failed parsing '-42P17' (base = 0)\n S='%s'\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, " 0b0101.011@42", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0101.011@42", 2, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '0101.011@42'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, " 0b0101.011P42", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0101.011@42", 2, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '0101.011@42'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "+0x42@17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "4.2@18", 16, MPFR_RNDN) || *s != 0)
+ {
+ printf ("Failed parsing '+0x42P17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+
+
+ /* Check for space inside the mantissa */
+ mpfr_strtofr (x, "+0x4 2@17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 4) || strcmp(s," 2@17"))
+ {
+ printf ("Failed parsing '+0x4 2@17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "+0x42 P17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0x42) || strcmp(s," P17"))
+ {
+ printf ("Failed parsing '+0x42 P17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* Space between mantissa and exponent */
+ mpfr_strtofr (x, " -0b0101P 17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -5) || strcmp(s,"P 17"))
+ {
+ printf ("Failed parsing '-0b0101P 17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* Check for Invalid exponent. */
+ mpfr_strtofr (x, " -0b0101PF17", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -5) || strcmp(s,"PF17"))
+ {
+ printf ("Failed parsing '-0b0101PF17'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* At least one digit in the mantissa. */
+ mpfr_strtofr (x, " .E10", &s, 0, MPFR_RNDN);
+ if (strcmp(s," .E10"))
+ {
+ printf ("Failed parsing ' .E10'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* Check 2 '.': 2.3.4 */
+ mpfr_strtofr (x, "-1.2.3E4", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, "-1.2") || strcmp(s,".3E4"))
+ {
+ printf ("Failed parsing '-1.2.3E4'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ /* Check for 0x and 0b */
+ mpfr_strtofr (x, " 0xG", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) || strcmp(s,"xG"))
+ {
+ printf ("Failed parsing ' 0xG'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, " 0b2", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) || strcmp(s,"b2"))
+ {
+ printf ("Failed parsing ' 0b2'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, "-0x.23@2Z33", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -0x23) || strcmp(s,"Z33"))
+ {
+ printf ("Failed parsing '-0x.23@2Z33'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+ mpfr_strtofr (x, " 0x", &s, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) || strcmp(s,"x"))
+ {
+ printf ("Failed parsing ' 0x'\n S=%s\n X=", s);
+ mpfr_out_str (stdout, 16, 0, x, MPFR_RNDN); putchar ('\n');
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+static void
+check_overflow (void)
+{
+ mpfr_t x;
+ char *s;
+
+ mpfr_init (x);
+
+ /* Huge overflow */
+ mpfr_strtofr (x, "123456789E2147483646", &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check overflow failed (1) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "123456789E9223372036854775807", &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check overflow failed (2) with:\n s='%s'\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "123456789E170141183460469231731687303715884105728",
+ &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check overflow failed (3) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ /* Limit overflow */
+ mpfr_strtofr (x, "12E2147483646", &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check overflow failed (4) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "12E2147483645", &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
+ {
+ printf ("Check overflow failed (5) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "0123456789ABCDEF@2147483640", &s, 16, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
+ {
+ printf ("Check overflow failed (6) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "0123456789ABCDEF@540000000", &s, 16, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
+ {
+ printf ("Check overflow failed (7) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ /* Check underflow */
+ mpfr_strtofr (x, "123456789E-2147483646", &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check underflow failed (1) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "123456789E-9223372036854775807", &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check underflow failed (2) with:\n s='%s'\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "-123456789E-170141183460469231731687303715884105728",
+ &s, 0, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_NEG (x) )
+ {
+ printf ("Check underflow failed (3) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "0123456789ABCDEF@-540000000", &s, 16, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x))
+ {
+ printf ("Check overflow failed (7) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+static void
+check_retval (void)
+{
+ mpfr_t x;
+ int res;
+
+ mpfr_init2 (x, 10);
+
+ res = mpfr_strtofr (x, "01011000111", NULL, 2, MPFR_RNDN);
+ MPFR_ASSERTN (res == 0);
+ res = mpfr_strtofr (x, "11011000111", NULL, 2, MPFR_RNDN);
+ MPFR_ASSERTN (res > 0);
+ res = mpfr_strtofr (x, "110110001101", NULL, 2, MPFR_RNDN);
+ MPFR_ASSERTN (res < 0);
+
+ mpfr_clear (x);
+}
+
+/* Bug found by Christoph Lauter (in mpfr_set_str). */
+static struct bug20081025_test {
+ mpfr_rnd_t rnd;
+ int inexact;
+ const char *str;
+ const char *binstr;
+} Bug20081028Table[] = {
+ {MPFR_RNDN, -1, "1.00000000000000000006", "1"},
+ {MPFR_RNDZ, -1, "1.00000000000000000006", "1"},
+ {MPFR_RNDU, +1, "1.00000000000000000006",
+ "10000000000000000000000000000001e-31"},
+ {MPFR_RNDD, -1, "1.00000000000000000006", "1"},
+
+
+ {MPFR_RNDN, +1, "-1.00000000000000000006", "-1"},
+ {MPFR_RNDZ, +1, "-1.00000000000000000006", "-1"},
+ {MPFR_RNDU, +1, "-1.00000000000000000006", "-1"},
+ {MPFR_RNDD, -1, "-1.00000000000000000006",
+ "-10000000000000000000000000000001e-31"},
+
+ {MPFR_RNDN, +1, "0.999999999999999999999999999999999999999999999", "1"},
+ {MPFR_RNDZ, -1, "0.999999999999999999999999999999999999999999999",
+ "11111111111111111111111111111111e-32"},
+ {MPFR_RNDU, +1, "0.999999999999999999999999999999999999999999999", "1"},
+ {MPFR_RNDD, -1, "0.999999999999999999999999999999999999999999999",
+ "11111111111111111111111111111111e-32"},
+
+ {MPFR_RNDN, -1, "-0.999999999999999999999999999999999999999999999", "-1"},
+ {MPFR_RNDZ, +1, "-0.999999999999999999999999999999999999999999999",
+ "-11111111111111111111111111111111e-32"},
+ {MPFR_RNDU, +1, "-0.999999999999999999999999999999999999999999999",
+ "-11111111111111111111111111111111e-32"},
+ {MPFR_RNDD, -1, "-0.999999999999999999999999999999999999999999999", "-1"}
+};
+
+static void
+bug20081028 (void)
+{
+ int i;
+ int inexact, res;
+ mpfr_rnd_t rnd;
+ mpfr_t x, y;
+ char *s;
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 32);
+ for (i = 0 ; i < numberof (Bug20081028Table) ; i++)
+ {
+ rnd = Bug20081028Table[i].rnd;
+ inexact = Bug20081028Table[i].inexact;
+ mpfr_set_str_binary (x, Bug20081028Table[i].binstr);
+ res = mpfr_strtofr (y, Bug20081028Table[i].str, &s, 10, rnd);
+ if (s == NULL || *s != 0)
+ {
+ printf ("Error in Bug20081028: strtofr didn't parse entire input\n"
+ "for (i=%d) Str=\"%s\"", i, Bug20081028Table[i].str);
+ exit (1);
+ }
+ if (! SAME_SIGN (res, inexact))
+ {
+ printf ("Error in Bug20081028: expected %s ternary value, "
+ "got %d\nfor (i=%d) Rnd=%s Str=\"%s\"\n Set binary gives: ",
+ inexact > 0 ? "positive" : "negative",
+ res, i, mpfr_print_rnd_mode(rnd), Bug20081028Table[i].str);
+ mpfr_dump (x);
+ printf (" strtofr gives: ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in Bug20081028: Results differ between strtofr and "
+ "set_binary\nfor (i=%d) Rnd=%s Str=\"%s\"\n"
+ " Set binary gives: ",
+ i, mpfr_print_rnd_mode(rnd), Bug20081028Table[i].str);
+ mpfr_dump (x);
+ printf (" strtofr gives: ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ }
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+/* check that 1.23e is correctly parsed, cf
+ http://gmplib.org/list-archives/gmp-bugs/2010-March/001898.html */
+static void
+test20100310 (void)
+{
+ mpfr_t x, y;
+ char str[] = "1.23e", *endptr;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 53);
+ mpfr_strtofr (x, str, &endptr, 10, MPFR_RNDN);
+ mpfr_strtofr (y, "1.23", NULL, 10, MPFR_RNDN);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("x <> y in test20100310\n");
+ exit (1);
+ }
+ if (endptr != str + 4) /* strtofr should take into account '1.23',
+ not '1.23e' */
+ {
+ printf ("endptr <> str + 4 in test20100310\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* From a bug reported by Joseph S. Myers
+ https://sympa.inria.fr/sympa/arc/mpfr/2012-08/msg00005.html */
+static void
+bug20120814 (void)
+{
+ mpfr_exp_t emin = -30, e;
+ mpfr_t x, y;
+ int r;
+ char s[64], *p;
+
+ mpfr_init2 (x, 2);
+ mpfr_set_ui_2exp (x, 3, emin - 2, MPFR_RNDN);
+ mpfr_get_str (s + 1, &e, 10, 19, x, MPFR_RNDD);
+ s[0] = s[1];
+ s[1] = '.';
+ for (p = s; *p != 0; p++) ;
+ *p = 'e';
+ sprintf (p + 1, "%d", (int) e - 1);
+
+ mpfr_init2 (y, 4);
+ r = mpfr_strtofr (y, s, NULL, 0, MPFR_RNDN);
+ if (r <= 0 || ! mpfr_equal_p (x, y))
+ {
+ printf ("Error in bug20120814\n");
+ printf ("mpfr_strtofr failed on string \"%s\"\n", s);
+ printf ("Expected inex > 0 and y = 0.1100E%d\n", (int) emin);
+ printf ("Got inex = %-6d and y = ", r);
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static void
+bug20120829 (void)
+{
+ mpfr_t x1, x2, e;
+ int inex1, inex2, i, r;
+ char s[48] = "1e-1";
+
+ mpfr_init2 (e, 128);
+ mpfr_inits2 (4, x1, x2, (mpfr_ptr) 0);
+
+ inex1 = mpfr_set_si (e, -1, MPFR_RNDN);
+ MPFR_ASSERTN (inex1 == 0);
+
+ for (i = 1; i <= sizeof(s) - 5; i++)
+ {
+ s[3+i] = '0';
+ s[4+i] = 0;
+ inex1 = mpfr_mul_ui (e, e, 10, MPFR_RNDN);
+ MPFR_ASSERTN (inex1 == 0);
+ RND_LOOP(r)
+ {
+ mpfr_rnd_t rnd = (mpfr_rnd_t) r;
+
+ inex1 = mpfr_exp10 (x1, e, rnd);
+ inex1 = SIGN (inex1);
+ inex2 = mpfr_strtofr (x2, s, NULL, 0, rnd);
+ inex2 = SIGN (inex2);
+ /* On 32-bit machines, for i = 7, r8389, r8391 and r8394 do:
+ strtofr.c:...: MPFR assertion failed: cy == 0
+ r8396 is OK.
+ On 64-bit machines, for i = 15,
+ r8389 does: strtofr.c:678: MPFR assertion failed: err < (64 - 0)
+ r8391 does: strtofr.c:680: MPFR assertion failed: h < ysize
+ r8394 and r8396 are OK.
+ */
+ if (! mpfr_equal_p (x1, x2) || inex1 != inex2)
+ {
+ printf ("Error in bug20120829 for i = %d, rnd = %s\n",
+ i, mpfr_print_rnd_mode (rnd));
+ printf ("Expected inex = %d, x = ", inex1);
+ mpfr_dump (x1);
+ printf ("Got inex = %d, x = ", inex2);
+ mpfr_dump (x2);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clears (e, x1, x2, (mpfr_ptr) 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_special();
+ check_reftable ();
+ check_parse ();
+ check_overflow ();
+ check_retval ();
+ bug20081028 ();
+ test20100310 ();
+ bug20120814 ();
+ bug20120829 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsub.c b/tests/tsub.c
new file mode 100644
index 0000000..52238ba
--- /dev/null
+++ b/tests/tsub.c
@@ -0,0 +1,658 @@
+/* Test file for mpfr_sub.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#ifdef CHECK_EXTERNAL
+static int
+test_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
+{
+ int res;
+ int ok = rnd_mode == MPFR_RNDN && mpfr_number_p (b) && mpfr_number_p (c);
+ if (ok)
+ {
+ mpfr_print_raw (b);
+ printf (" ");
+ mpfr_print_raw (c);
+ }
+ res = mpfr_sub (a, b, c, rnd_mode);
+ if (ok)
+ {
+ printf (" ");
+ mpfr_print_raw (a);
+ printf ("\n");
+ }
+ return res;
+}
+#else
+#define test_sub mpfr_sub
+#endif
+
+static void
+check_diverse (void)
+{
+ mpfr_t x, y, z;
+ int inexact;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ /* check corner case cancel=0, but add_exp=1 */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 4);
+ mpfr_set_prec (z, 2);
+ mpfr_setmax (y, __gmpfr_emax);
+ mpfr_set_str_binary (z, "0.1E-10"); /* tiny */
+ test_sub (x, y, z, MPFR_RNDN); /* should round to 2^emax, i.e. overflow */
+ if (!mpfr_inf_p (x) || mpfr_sgn (x) < 0)
+ {
+ printf ("Error in mpfr_sub(a,b,c,RNDN) for b=maxfloat, prec(a)<prec(b), c tiny\n");
+ exit (1);
+ }
+
+ /* other coverage test */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_prec (z, 2);
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ mpfr_set_si (z, -2, MPFR_RNDN);
+ test_sub (x, y, z, MPFR_RNDD);
+ if (mpfr_cmp_ui (x, 3))
+ {
+ printf ("Error in mpfr_sub(1,-2,RNDD)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 288);
+ mpfr_set_prec (y, 288);
+ mpfr_set_prec (z, 288);
+ mpfr_set_str_binary (y, "0.111000110011000001000111101010111011110011101001101111111110000011100101000001001010110010101010011001010100000001110011110001010101101010001011101110100100001011110100110000101101100011010001001011011010101010000010001101001000110010010111111011110001111101001000101101001100101100101000E80");
+ mpfr_set_str_binary (z, "0.100001111111101001011010001100110010100111001110000110011101001011010100001000000100111011010110110010000000000010101101011000010000110001110010100001100101011100100100001011000100011110000001010101000100011101001000010111100000111000111011001000100100011000100000010010111000000100100111E-258");
+ inexact = test_sub (x, y, z, MPFR_RNDN);
+ if (inexact <= 0)
+ {
+ printf ("Wrong inexact flag for prec=288\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 63);
+ mpfr_set_prec (z, 63);
+ mpfr_set_str_binary (x, "0.101101111011011100100100100111E31");
+ mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1");
+ test_sub (z, x, y, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31");
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error in mpfr_sub (5)\n");
+ printf ("expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (y, 63);
+ mpfr_set_prec (z, 63);
+ mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31");
+ mpfr_sub_ui (z, y, 1541116494, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.11111001001010010011010110101E-1");
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error in mpfr_sub (7)\n");
+ printf ("expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (y, 63);
+ mpfr_set_prec (z, 63);
+ mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31");
+ mpfr_sub_ui (z, y, 1541116494, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.11111001001010010011010110101E-1");
+ if (mpfr_cmp (z, y))
+ {
+ printf ("Error in mpfr_sub (6)\n");
+ printf ("expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "0.10110111101001110100100101111000E0");
+ mpfr_set_str_binary (y, "0.10001100100101000100110111000100E0");
+ if ((inexact = test_sub (x, x, y, MPFR_RNDN)))
+ {
+ printf ("Wrong inexact flag (2): got %d instead of 0\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (x, "0.11111000110111011000100111011010E0");
+ mpfr_set_str_binary (y, "0.10011111101111000100001000000000E-3");
+ if ((inexact = test_sub (x, x, y, MPFR_RNDN)))
+ {
+ printf ("Wrong inexact flag (1): got %d instead of 0\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_prec (y, 33);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.1E-32");
+ mpfr_add (x, x, y, MPFR_RNDN);
+ mpfr_set_str_binary (y, "0.111111111111111111111111111111111E0");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_sub (1 - 1E-33) with prec=33\n");
+ printf ("Expected "); mpfr_print_binary (y); puts ("");
+ printf ("got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 33);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_set_str_binary (y, "-0.1E-32");
+ mpfr_add (x, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 1))
+ {
+ printf ("Error in mpfr_sub (1 - 1E-33) with prec=32\n");
+ printf ("Expected 1.0, got "); mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 65);
+ mpfr_set_prec (y, 65);
+ mpfr_set_prec (z, 64);
+ mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
+ mpfr_set_str_binary (y, "0.1110111011110001110111011111111111101000011001011100101100101100");
+ test_sub (z, x, y, MPFR_RNDZ);
+ if (mpfr_cmp_ui (z, 1))
+ {
+ printf ("Error in mpfr_sub (1)\n");
+ exit (1);
+ }
+ test_sub (z, x, y, MPFR_RNDU);
+ mpfr_set_str_binary (x, "1.000000000000000000000000000000000000000000000000000000000000001");
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_sub (2)\n");
+ printf ("Expected "); mpfr_print_binary (x); puts ("");
+ printf ("Got "); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
+ test_sub (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 1))
+ {
+ printf ("Error in mpfr_sub (3)\n");
+ exit (1);
+ }
+ inexact = test_sub (z, x, y, MPFR_RNDA);
+ mpfr_set_str_binary (x, "1.000000000000000000000000000000000000000000000000000000000000001");
+ if (mpfr_cmp (z, x) || inexact <= 0)
+ {
+ printf ("Error in mpfr_sub (4)\n");
+ exit (1);
+ }
+ mpfr_set_prec (x, 66);
+ mpfr_set_str_binary (x, "1.11101110111100011101110111111111111010000110010111001011001010111");
+ test_sub (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_ui (z, 1))
+ {
+ printf ("Error in mpfr_sub (5)\n");
+ exit (1);
+ }
+
+ /* check in-place operations */
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ test_sub (x, x, x, MPFR_RNDN);
+ if (mpfr_cmp_ui(x, 0))
+ {
+ printf ("Error for mpfr_sub (x, x, x, MPFR_RNDN) with x=1.0\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_prec (z, 53);
+ mpfr_set_str1 (x, "1.229318102e+09");
+ mpfr_set_str1 (y, "2.32221184180698677665e+05");
+ test_sub (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp_str1 (z, "1229085880.815819263458251953125"))
+ {
+ printf ("Error in mpfr_sub (1.22e9 - 2.32e5)\n");
+ printf ("expected 1229085880.815819263458251953125, got ");
+ mpfr_out_str(stdout, 10, 0, z, MPFR_RNDN);
+ putchar('\n');
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 112);
+ mpfr_set_prec (y, 98);
+ mpfr_set_prec (z, 54);
+ mpfr_set_str_binary (x, "0.11111100100000000011000011100000101101010001000111E-401");
+ mpfr_set_str_binary (y, "0.10110000100100000101101100011111111011101000111000101E-464");
+ test_sub (z, x, y, MPFR_RNDN);
+ if (mpfr_cmp (z, x)) {
+ printf ("mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n");
+ printf ("expected "); mpfr_print_binary (x); puts ("");
+ printf ("got "); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 32, MPFR_RNDN);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+
+ mpfr_set_prec (x, 5);
+ mpfr_set_prec (y, 5);
+ mpfr_set_str_binary (x, "1e-12");
+ mpfr_set_ui (y, 1, MPFR_RNDN);
+ test_sub (x, y, x, MPFR_RNDD);
+ mpfr_set_str_binary (y, "0.11111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_sub (x, y, x, MPFR_RNDD) for x=2^(-12), y=1\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 24);
+ mpfr_set_prec (y, 24);
+ mpfr_set_str_binary (x, "-0.100010000000000000000000E19");
+ mpfr_set_str_binary (y, "0.100000000000000000000100E15");
+ mpfr_add (x, x, y, MPFR_RNDD);
+ mpfr_set_str_binary (y, "-0.1E19");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_add (2)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 10);
+ mpfr_set_prec (z, 10);
+ mpfr_set_ui (y, 0, MPFR_RNDN);
+ mpfr_set_str_binary (z, "0.10001");
+ if (test_sub (x, y, z, MPFR_RNDN) <= 0)
+ {
+ printf ("Wrong inexact flag in x=mpfr_sub(0,z) for prec(z)>prec(x)\n");
+ exit (1);
+ }
+ if (test_sub (x, z, y, MPFR_RNDN) >= 0)
+ {
+ printf ("Wrong inexact flag in x=mpfr_sub(z,0) for prec(z)>prec(x)\n");
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+bug_ddefour(void)
+{
+ mpfr_t ex, ex1, ex2, ex3, tot, tot1;
+
+ mpfr_init2(ex, 53);
+ mpfr_init2(ex1, 53);
+ mpfr_init2(ex2, 53);
+ mpfr_init2(ex3, 53);
+ mpfr_init2(tot, 150);
+ mpfr_init2(tot1, 150);
+
+ mpfr_set_ui( ex, 1, MPFR_RNDN);
+ mpfr_mul_2exp( ex, ex, 906, MPFR_RNDN);
+ mpfr_log( tot, ex, MPFR_RNDN);
+ mpfr_set( ex1, tot, MPFR_RNDN); /* ex1 = high(tot) */
+ test_sub( ex2, tot, ex1, MPFR_RNDN); /* ex2 = high(tot - ex1) */
+ test_sub( tot1, tot, ex1, MPFR_RNDN); /* tot1 = tot - ex1 */
+ mpfr_set( ex3, tot1, MPFR_RNDN); /* ex3 = high(tot - ex1) */
+
+ if (mpfr_cmp(ex2, ex3))
+ {
+ printf ("Error in ddefour test.\n");
+ printf ("ex2="); mpfr_print_binary (ex2); puts ("");
+ printf ("ex3="); mpfr_print_binary (ex3); puts ("");
+ exit (1);
+ }
+
+ mpfr_clear (ex);
+ mpfr_clear (ex1);
+ mpfr_clear (ex2);
+ mpfr_clear (ex3);
+ mpfr_clear (tot);
+ mpfr_clear (tot1);
+}
+
+/* if u = o(x-y), v = o(u-x), w = o(v+y), then x-y = u-w */
+static void
+check_two_sum (mpfr_prec_t p)
+{
+ mpfr_t x, y, u, v, w;
+ mpfr_rnd_t rnd;
+ int inexact;
+
+ mpfr_init2 (x, p);
+ mpfr_init2 (y, p);
+ mpfr_init2 (u, p);
+ mpfr_init2 (v, p);
+ mpfr_init2 (w, p);
+ mpfr_urandomb (x, RANDS);
+ mpfr_urandomb (y, RANDS);
+ if (mpfr_cmpabs (x, y) < 0)
+ mpfr_swap (x, y);
+ rnd = MPFR_RNDN;
+ inexact = test_sub (u, x, y, rnd);
+ test_sub (v, u, x, rnd);
+ mpfr_add (w, v, y, rnd);
+ /* as u = (x-y) - w, we should have inexact and w of opposite signs */
+ if (((inexact == 0) && mpfr_cmp_ui (w, 0)) ||
+ ((inexact > 0) && (mpfr_cmp_ui (w, 0) <= 0)) ||
+ ((inexact < 0) && (mpfr_cmp_ui (w, 0) >= 0)))
+ {
+ printf ("Wrong inexact flag for prec=%u, rnd=%s\n", (unsigned)p,
+ mpfr_print_rnd_mode (rnd));
+ printf ("x="); mpfr_print_binary(x); puts ("");
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("u="); mpfr_print_binary(u); puts ("");
+ printf ("v="); mpfr_print_binary(v); puts ("");
+ printf ("w="); mpfr_print_binary(w); puts ("");
+ printf ("inexact = %d\n", inexact);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (u);
+ mpfr_clear (v);
+ mpfr_clear (w);
+}
+
+#define MAX_PREC 200
+
+static void
+check_inexact (void)
+{
+ mpfr_t x, y, z, u;
+ mpfr_prec_t px, py, pu, pz;
+ int inexact, cmp;
+ mpfr_rnd_t rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (u);
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_ui (x, 6, MPFR_RNDN);
+ mpfr_div_2exp (x, x, 4, MPFR_RNDN); /* x = 6/16 */
+ mpfr_set_prec (y, 2);
+ mpfr_set_si (y, -1, MPFR_RNDN);
+ mpfr_div_2exp (y, y, 4, MPFR_RNDN); /* y = -1/16 */
+ inexact = test_sub (y, y, x, MPFR_RNDN); /* y = round(-7/16) = -1/2 */
+ if (inexact >= 0)
+ {
+ printf ("Error: wrong inexact flag for -1/16 - (6/16)\n");
+ exit (1);
+ }
+
+ for (px=2; px<MAX_PREC; px++)
+ {
+ mpfr_set_prec (x, px);
+ do
+ {
+ mpfr_urandomb (x, RANDS);
+ }
+ while (mpfr_cmp_ui (x, 0) == 0);
+ for (pu=2; pu<MAX_PREC; pu++)
+ {
+ mpfr_set_prec (u, pu);
+ do
+ {
+ mpfr_urandomb (u, RANDS);
+ }
+ while (mpfr_cmp_ui (u, 0) == 0);
+ {
+ py = 2 + (randlimb () % (MAX_PREC - 2));
+ mpfr_set_prec (y, py);
+ /* warning: MPFR_EXP is undefined for 0 */
+ pz = (mpfr_cmpabs (x, u) >= 0) ? MPFR_EXP(x) - MPFR_EXP(u)
+ : MPFR_EXP(u) - MPFR_EXP(x);
+ pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u));
+ mpfr_set_prec (z, pz);
+ rnd = RND_RAND ();
+ if (test_sub (z, x, u, rnd))
+ {
+ printf ("z <- x - u should be exact\n");
+ exit (1);
+ }
+ {
+ rnd = RND_RAND ();
+ inexact = test_sub (y, x, u, rnd);
+ cmp = mpfr_cmp (y, z);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s\n",
+ mpfr_print_rnd_mode(rnd));
+ printf ("expected %d, got %d\n", cmp, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("u="); mpfr_print_binary (u); puts ("");
+ printf ("y= "); mpfr_print_binary (y); puts ("");
+ printf ("x-u="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (u);
+}
+
+/* Bug found by Jakub Jelinek
+ * http://bugzilla.redhat.com/643657
+ * https://gforge.inria.fr/tracker/index.php?func=detail&aid=11301
+ * The consequence can be either an assertion failure (i = 2 in the
+ * testcase below, in debug mode) or an incorrectly rounded value.
+ */
+static void
+bug20101017 (void)
+{
+ mpfr_t a, b, c;
+ int inex;
+ int i;
+
+ mpfr_init2 (a, GMP_NUMB_BITS * 2);
+ mpfr_init2 (b, GMP_NUMB_BITS);
+ mpfr_init2 (c, GMP_NUMB_BITS);
+
+ /* a = 2^(2N) + k.2^(2N-1) + 2^N and b = 1
+ with N = GMP_NUMB_BITS and k = 0 or 1.
+ c = a - b should round to the same value as a. */
+
+ for (i = 2; i <= 3; i++)
+ {
+ mpfr_set_ui_2exp (a, i, GMP_NUMB_BITS - 1, MPFR_RNDN);
+ mpfr_add_ui (a, a, 1, MPFR_RNDN);
+ mpfr_mul_2ui (a, a, GMP_NUMB_BITS, MPFR_RNDN);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ inex = mpfr_sub (c, a, b, MPFR_RNDN);
+ mpfr_set (b, a, MPFR_RNDN);
+ if (! mpfr_equal_p (c, b))
+ {
+ printf ("Error in bug20101017 for i = %d.\n", i);
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, b, MPFR_RNDN);
+ putchar ('\n');
+ printf ("Got ");
+ mpfr_out_str (stdout, 16, 0, c, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Error in bug20101017 for i = %d: bad inex value.\n", i);
+ printf ("Expected negative, got %d.\n", inex);
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (a, 64);
+ mpfr_set_prec (b, 129);
+ mpfr_set_prec (c, 2);
+ mpfr_set_str_binary (b, "0.100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001E65");
+ mpfr_set_str_binary (c, "0.10E1");
+ inex = mpfr_sub (a, b, c, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (a, 1, 64) != 0 || inex >= 0)
+ {
+ printf ("Error in mpfr_sub for b-c for b=2^64+1+2^(-64), c=1\n");
+ printf ("Expected result 2^64 with inex < 0\n");
+ printf ("Got "); mpfr_print_binary (a);
+ printf (" with inex=%d\n", inex);
+ exit (1);
+ }
+
+ mpfr_clears (a, b, c, (mpfr_ptr) 0);
+}
+
+/* hard test of rounding */
+static void
+check_rounding (void)
+{
+ mpfr_t a, b, c, res;
+ mpfr_prec_t p;
+ long k, l;
+ int i;
+
+#define MAXKL (2 * GMP_NUMB_BITS)
+ for (p = MPFR_PREC_MIN; p <= GMP_NUMB_BITS; p++)
+ {
+ mpfr_init2 (a, p);
+ mpfr_init2 (res, p);
+ mpfr_init2 (b, p + 1 + MAXKL);
+ mpfr_init2 (c, MPFR_PREC_MIN);
+
+ /* b = 2^p + 1 + 2^(-k), c = 2^(-l) */
+ for (k = 0; k <= MAXKL; k++)
+ for (l = 0; l <= MAXKL; l++)
+ {
+ mpfr_set_ui_2exp (b, 1, p, MPFR_RNDN);
+ mpfr_add_ui (b, b, 1, MPFR_RNDN);
+ mpfr_mul_2ui (b, b, k, MPFR_RNDN);
+ mpfr_add_ui (b, b, 1, MPFR_RNDN);
+ mpfr_div_2ui (b, b, k, MPFR_RNDN);
+ mpfr_set_ui_2exp (c, 1, -l, MPFR_RNDN);
+ i = mpfr_sub (a, b, c, MPFR_RNDN);
+ /* b - c = 2^p + 1 + 2^(-k) - 2^(-l), should be rounded to
+ 2^p for l <= k, and 2^p+2 for l < k */
+ if (l <= k)
+ {
+ if (mpfr_cmp_ui_2exp (a, 1, p) != 0)
+ {
+ printf ("Wrong result in check_rounding\n");
+ printf ("p=%lu k=%ld l=%ld\n", (unsigned long) p, k, l);
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("Expected 2^%lu\n", (unsigned long) p);
+ printf ("Got "); mpfr_print_binary (a); puts ("");
+ exit (1);
+ }
+ if (i >= 0)
+ {
+ printf ("Wrong ternary value in check_rounding\n");
+ printf ("p=%lu k=%ld l=%ld\n", (unsigned long) p, k, l);
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("a="); mpfr_print_binary (a); puts ("");
+ printf ("Expected < 0, got %d\n", i);
+ exit (1);
+ }
+ }
+ else /* l < k */
+ {
+ mpfr_set_ui_2exp (res, 1, p, MPFR_RNDN);
+ mpfr_add_ui (res, res, 2, MPFR_RNDN);
+ if (mpfr_cmp (a, res) != 0)
+ {
+ printf ("Wrong result in check_rounding\n");
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("Expected "); mpfr_print_binary (res); puts ("");
+ printf ("Got "); mpfr_print_binary (a); puts ("");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in check_rounding\n");
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("Expected > 0, got %d\n", i);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (res);
+ mpfr_clear (b);
+ mpfr_clear (c);
+ }
+}
+
+#define TEST_FUNCTION test_sub
+#define TWO_ARGS
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_prec_t p;
+ unsigned int i;
+
+ tests_start_mpfr ();
+
+ bug20101017 ();
+ check_rounding ();
+ check_diverse ();
+ check_inexact ();
+ bug_ddefour ();
+ for (p=2; p<200; p++)
+ for (i=0; i<50; i++)
+ check_two_sum (p);
+ test_generic (2, 800, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c
new file mode 100644
index 0000000..3f222ec
--- /dev/null
+++ b/tests/tsub1sp.c
@@ -0,0 +1,515 @@
+/* Test file for mpfr_sub1sp.
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void check_special (void);
+static void check_random (mpfr_prec_t p);
+
+int
+main (void)
+{
+ mpfr_prec_t p;
+
+ tests_start_mpfr ();
+
+ check_special ();
+ for (p = 2 ; p < 200 ; p++)
+ check_random (p);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#define STD_ERROR \
+ do \
+ { \
+ printf("ERROR: for %s and p=%lu and i=%d:\nY=", \
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \
+ mpfr_print_binary(y); \
+ printf("\nZ="); mpfr_print_binary(z); \
+ printf("\nReal: "); mpfr_print_binary(x2); \
+ printf("\nGot : "); mpfr_print_binary(x); \
+ putchar('\n'); \
+ exit(1); \
+ } \
+ while (0)
+
+#define STD_ERROR2 \
+ do \
+ { \
+ printf("ERROR: for %s and p=%lu and i=%d:\nY=", \
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), (unsigned long) p, i); \
+ mpfr_print_binary(y); \
+ printf("\nZ="); mpfr_print_binary(z); \
+ printf("\nR="); mpfr_print_binary(x); \
+ printf("\nWrong inexact flag. Real: %d. Got: %d\n", \
+ inexact1, inexact2); \
+ exit(1); \
+ } \
+ while (0)
+
+static void
+check_random (mpfr_prec_t p)
+{
+ mpfr_t x,y,z,x2;
+ int r;
+ int i, inexact1, inexact2;
+
+ mpfr_inits2 (p, x, y, z, x2, (mpfr_ptr) 0);
+
+ for (i = 0 ; i < 500 ; i++)
+ {
+ mpfr_urandomb (y, RANDS);
+ mpfr_urandomb (z, RANDS);
+ if (MPFR_IS_PURE_FP(y) && MPFR_IS_PURE_FP(z))
+ for(r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ }
+ }
+
+ mpfr_clears (x, y, z, x2, (mpfr_ptr) 0);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t x,y,z,x2;
+ int r;
+ mpfr_prec_t p;
+ int i = -1, inexact1, inexact2;
+ mpfr_exp_t es;
+
+ mpfr_inits (x, y, z, x2, (mpfr_ptr) 0);
+
+ for (r = 0 ; r < MPFR_RND_MAX ; r++)
+ {
+ p = 53;
+ mpfr_set_prec(x, 53);
+ mpfr_set_prec(x2, 53);
+ mpfr_set_prec(y, 53);
+ mpfr_set_prec(z, 53);
+
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011000001101101011011001E31");
+
+ mpfr_sub1sp (x, y, y, (mpfr_rnd_t) r);
+ if (mpfr_cmp_ui(x, 0))
+ {
+ printf("Error for x-x with p=%lu. Expected 0. Got:",
+ (unsigned long) p);
+ mpfr_print_binary(x);
+ exit(1);
+ }
+
+ mpfr_set(z, y, (mpfr_rnd_t) r);
+ mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp_ui(x, 0))
+ {
+ printf("Error for x-y with y=x and p=%lu. Expected 0. Got:",
+ (unsigned long) p);
+ mpfr_print_binary(x);
+ exit(1);
+ }
+ /* diff = 0 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011001001101101011011001E31");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ /* Diff = 1 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011000001101101011011001E30");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ /* Diff = 2 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011000101101101011011001E32");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ /* Diff = 32 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011000001101101011011001E63");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ /* Diff = 52 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011010001101101011011001E83");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ /* Diff = 53 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011111000001101101011011001E31");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ /* Diff > 200 */
+ mpfr_set_str_binary (y,
+ "0.10110111101101110010010010011011000001101101011011001E331");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000E31");
+ mpfr_set_str_binary (z,
+ "0.11111111111111111111111111111111111111111111111111111E30");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000E31");
+ mpfr_set_str_binary (z,
+ "0.11111111111111111111111111111111111111111111111111111E29");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000E52");
+ mpfr_set_str_binary (z,
+ "0.10000000000010000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.11100000000000000000000000000000000000000000000000000E53");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(z, y, z, (mpfr_rnd_t) r);
+ mpfr_set(x, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000E53");
+ mpfr_set_str_binary (z,
+ "0.10100000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000E54");
+ mpfr_set_str_binary (z,
+ "0.10100000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 63;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+ mpfr_set_str_binary (y,
+ "0.100000000000000000000000000000000000000000000000000000000000000E62");
+ mpfr_set_str_binary (z,
+ "0.110000000000000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 64;
+ mpfr_set_prec(x, 64);
+ mpfr_set_prec(x2, 64);
+ mpfr_set_prec(y, 64);
+ mpfr_set_prec(z, 64);
+
+ mpfr_set_str_binary (y,
+ "0.1100000000000000000000000000000000000000000000000000000000000000E31");
+ mpfr_set_str_binary (z,
+ "0.1111111111111111111111111110000000000000000000000000011111111111E29");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.1000000000000000000000000000000000000000000000000000000000000000E63");
+ mpfr_set_str_binary (z,
+ "0.1011000000000000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.1000000000000000000000000000000000000000000000000000000000000000E63");
+ mpfr_set_str_binary (z,
+ "0.1110000000000000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000000000000E63");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.1000000000000000000000000000000000000000000000000000000000000000E64");
+ mpfr_set_str_binary (z,
+ "0.1010000000000000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ MPFR_SET_NAN(x);
+ MPFR_SET_NAN(x2);
+ mpfr_set_str_binary (y,
+ "0.1000000000000000000000000000000000000000000000000000000000000000"
+ "E-1073741823");
+ mpfr_set_str_binary (z,
+ "0.1100000000000000000000000000000000000000000000000000000000000000"
+ "E-1073741823");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 9;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y, "0.100000000E1");
+ mpfr_set_str_binary (z, "0.100000000E-8");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 34;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y, "-0.1011110000111100010111011100110100E-18");
+ mpfr_set_str_binary (z, "0.1000101010110011010101011110000000E-14");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 124;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
+"0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E1");
+ mpfr_set_str_binary (z,
+"0.1011111000100111000011001000011101010101101100101010101001000001110100001101110110001110111010000011101001100010111110001100E-31");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 288;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
+ "0.111000110011000001000111101010111011110011101001101111111110000011100101000001001010110010101010011001010100000001110011110001010101101010001011101110100100001011110100110000101101100011010001001011011010101010000010001101001000110010010111111011110001111101001000101101001100101100101000E80");
+ mpfr_set_str_binary (z,
+ "-0.100001111111101001011010001100110010100111001110000110011101001011010100001000000100111011010110110010000000000010101101011000010000110001110010100001100101011100100100001011000100011110000001010101000100011101001000010111100000111000111011001000100100011000100000010010111000000100100111E-258");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 85;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
+"0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4");
+ mpfr_set_str_binary (z,
+"0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 64;
+ mpfr_set_prec(x, p); mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p); mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
+ "0.11000000000000000000000000000000"
+ "00000000000000000000000000000000E1");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
+ "00000000000000000000000000000001E0");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.11000000000000000000000000000000"
+ "000000000000000000000000000001E1");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
+ "00000000000000000000000000000001E0");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ es = mpfr_get_emin ();
+ set_emin (-1024);
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
+ "00000000000000000000000000000001E-1023");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ mpfr_set_str_binary (z,
+ "0.1000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ inexact1 = mpfr_sub1(x2, y, z, (mpfr_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mpfr_rnd_t) r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ set_emin (es);
+ }
+
+ mpfr_clears (x, y, z, x2, (mpfr_ptr) 0);
+}
diff --git a/tests/tsub_d.c b/tests/tsub_d.c
new file mode 100644
index 0000000..0bb727a
--- /dev/null
+++ b/tests/tsub_d.c
@@ -0,0 +1,128 @@
+/* Test file for mpfr_sub_d
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0)
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+ int inexact;
+
+ mpfr_init2 (x, 123);
+ mpfr_init2 (y, 123);
+
+ /* nan - 1.0 is nan */
+ mpfr_set_nan (x);
+ mpfr_clear_flags ();
+ inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* +inf - 1.0 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_clear_flags ();
+ inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_POS (y));
+
+ /* -inf - 1.0 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_clear_flags ();
+ inexact = mpfr_sub_d (y, x, 1.0, MPFR_RNDN);
+ MPFR_ASSERTN (inexact == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (MPFR_IS_NEG (y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_sub_d
+#define DOUBLE_ARG2
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric.c"
+
+int
+main (void)
+{
+ mpfr_t x, y, z;
+ double d;
+ int inexact;
+ tests_start_mpfr ();
+
+ /* check with enough precision */
+ mpfr_init2 (x, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (y, IEEE_DBL_MANT_DIG);
+ mpfr_init2 (z, IEEE_DBL_MANT_DIG);
+
+ mpfr_set_str (y, "4096", 10, MPFR_RNDN);
+ d = 0.125;
+ mpfr_clear_flags ();
+ inexact = mpfr_sub_d (x, y, d, MPFR_RNDN);
+ if (inexact != 0)
+ {
+ printf ("Inexact flag error in mpfr_sub_d\n");
+ exit (1);
+ }
+ mpfr_set_str (z, "4095.875", 10, MPFR_RNDN);
+ if (mpfr_cmp (z, x))
+ {
+ printf ("Error in mpfr_sub_d (");
+ mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN);
+ printf (" + %.20g)\nexpected ", d);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\ngot ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
+
+ check_nans ();
+
+ test_generic (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
+
+#else
+
+int
+main (void)
+{
+ printf ("Warning! Test disabled for this MPFR version.\n");
+ return 0;
+}
+
+#endif
diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c
new file mode 100644
index 0000000..1d27fd9
--- /dev/null
+++ b/tests/tsub_ui.c
@@ -0,0 +1,144 @@
+/* Test file for mpfr_sub_ui
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+/* checks that x-y gives the right results with 53 bits of precision */
+static void
+check3 (const char *xs, unsigned long y, mpfr_rnd_t rnd_mode, const char *zs)
+{
+ mpfr_t xx,zz;
+
+ mpfr_inits2 (53, xx, zz, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs);
+ mpfr_sub_ui (zz, xx, y, rnd_mode);
+ if (mpfr_cmp_str1(zz, zs))
+ {
+ printf ("expected sum is %s, got ", zs);
+ mpfr_print_binary(zz);
+ printf ("\nmpfr_sub_ui failed for x=%s y=%lu with rnd_mode=%s\n",
+ xs, y, mpfr_print_rnd_mode (rnd_mode));
+ exit (1);
+ }
+ mpfr_clears (xx, zz, (mpfr_ptr) 0);
+}
+
+/* FastTwoSum: if EXP(x) >= EXP(y), u = o(x+y), v = o(u-x), w = o(y-v),
+ then x + y = u + w
+thus if u = o(y-x), v = o(u+x), w = o(v-y), then y-x = u-w */
+static void
+check_two_sum (mpfr_prec_t p)
+{
+ unsigned int x;
+ mpfr_t y, u, v, w;
+ mpfr_rnd_t rnd;
+ int inexact;
+
+ mpfr_inits2 (p, y, u, v, w, (mpfr_ptr) 0);
+ do
+ {
+ x = randlimb ();
+ }
+ while (x < 1);
+ mpfr_urandomb (y, RANDS);
+ rnd = MPFR_RNDN;
+ inexact = mpfr_sub_ui (u, y, x, rnd);
+ mpfr_add_ui (v, u, x, rnd);
+ mpfr_sub (w, v, y, rnd);
+ /* as u - (y-x) = w, we should have inexact and w of same sign */
+ if (((inexact == 0) && mpfr_cmp_ui (w, 0)) ||
+ ((inexact > 0) && (mpfr_cmp_ui (w, 0) <= 0)) ||
+ ((inexact < 0) && (mpfr_cmp_ui (w, 0) >= 0)))
+ {
+ printf ("Wrong inexact flag for prec=%u, rnd=%s\n",
+ (unsigned int) p, mpfr_print_rnd_mode (rnd));
+ printf ("x=%u\n", x);
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("u="); mpfr_print_binary(u); puts ("");
+ printf ("v="); mpfr_print_binary(v); puts ("");
+ printf ("w="); mpfr_print_binary(w); puts ("");
+ printf ("inexact = %d\n", inexact);
+ exit (1);
+ }
+ mpfr_clears (y, u, v, w, (mpfr_ptr) 0);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ /* nan - 1 == nan */
+ mpfr_set_nan (x);
+ mpfr_sub_ui (y, x, 1L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* +inf - 1 == +inf */
+ mpfr_set_inf (x, 1);
+ mpfr_sub_ui (y, x, 1L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) > 0);
+
+ /* -inf - 1 == -inf */
+ mpfr_set_inf (x, -1);
+ mpfr_sub_ui (y, x, 1L, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) < 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+#define TEST_FUNCTION mpfr_sub_ui
+#define INTEGER_TYPE unsigned long
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
+#include "tgeneric_ui.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_prec_t p;
+ int k;
+
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ for (p=2; p<200; p++)
+ for (k=0; k<200; k++)
+ check_two_sum (p);
+
+ check3 ("0.9999999999", 1, MPFR_RNDN,
+ "-10000000827403709990903735160827636718750e-50");
+
+ test_generic_ui (2, 1000, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsubnormal.c b/tests/tsubnormal.c
new file mode 100644
index 0000000..5e8e275
--- /dev/null
+++ b/tests/tsubnormal.c
@@ -0,0 +1,222 @@
+/* Test file for mpfr_subnormalize.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+static const struct {
+ const char *in;
+ int i;
+ mpfr_rnd_t rnd;
+ const char *out;
+ int j;
+} tab[] = { /* 4th field: use the mpfr_dump format, in case of error. */
+ {"1E1", 0, MPFR_RNDN, "0.100000000E2", 0},
+ {"1E1", -1, MPFR_RNDZ, "0.100000000E2", -1},
+ {"1E1", -1, MPFR_RNDD, "0.100000000E2", -1},
+ {"1E1", 1, MPFR_RNDU, "0.100000000E2", 1},
+ {"0.10000E-10", 0, MPFR_RNDN, "0.100000000E-10", 0},
+ {"0.10001E-10", 0, MPFR_RNDN, "0.100000000E-10", -1},
+ {"0.11001E-10", 0, MPFR_RNDN, "0.100000000E-9", 1},
+ {"0.11001E-10", 0, MPFR_RNDZ, "0.100000000E-10", -1},
+ {"0.11001E-10", 0, MPFR_RNDU, "0.100000000E-9", 1},
+ {"0.11000E-10", 0, MPFR_RNDN, "0.100000000E-9", 1},
+ {"0.11000E-10", -1, MPFR_RNDN, "0.100000000E-9", 1},
+ {"0.11000E-10", 1, MPFR_RNDN, "0.100000000E-10", -1},
+ {"0.11111E-8", 0, MPFR_RNDN, "0.100000000E-7", 1},
+ {"0.10111E-8", 0, MPFR_RNDN, "0.110000000E-8", 1},
+ {"0.11110E-8", -1, MPFR_RNDN, "0.100000000E-7", 1},
+ {"0.10110E-8", 1, MPFR_RNDN, "0.101000000E-8", -1}
+};
+
+static void
+check1 (void)
+{
+ mpfr_t x;
+ int i, j, k, s, old_inex, tiny, expj;
+ mpfr_exp_t emin, emax;
+ unsigned int expflags, flags;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_set_default_prec (9);
+ mpfr_set_emin (-10);
+ mpfr_set_emax (10);
+
+ mpfr_init (x);
+ for (i = 0; i < (sizeof (tab) / sizeof (tab[0])); i++)
+ for (s = 0; s <= (tab[i].rnd == MPFR_RNDN); s++)
+ for (k = 0; k <= 1; k++)
+ {
+ mpfr_set_str (x, tab[i].in, 2, MPFR_RNDN);
+ old_inex = tab[i].i;
+ expj = tab[i].j;
+ if (s)
+ {
+ mpfr_neg (x, x, MPFR_RNDN);
+ old_inex = - old_inex;
+ expj = - expj;
+ }
+ if (k && old_inex)
+ old_inex = old_inex < 0 ? INT_MIN : INT_MAX;
+ tiny = MPFR_GET_EXP (x) <= -3;
+ mpfr_clear_flags ();
+ j = mpfr_subnormalize (x, old_inex, tab[i].rnd);
+ expflags =
+ (tiny ? MPFR_FLAGS_UNDERFLOW : 0) |
+ (expj ? MPFR_FLAGS_INEXACT : 0);
+ flags = __gmpfr_flags;
+ if (s)
+ mpfr_neg (x, x, MPFR_RNDN);
+ if (mpfr_cmp_str (x, tab[i].out, 2, MPFR_RNDN) != 0 ||
+ flags != expflags || ! SAME_SIGN (j, expj))
+ {
+ const char *sgn = s ? "-" : "";
+ printf ("Error for i = %d (old_inex = %d), k = %d, x = %s%s\n"
+ "Expected: %s%s\nGot: ", i, old_inex, k,
+ sgn, tab[i].in, sgn, tab[i].out);
+ if (s)
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_dump (x);
+ printf ("Expected flags = %u, got %u\n", expflags, flags);
+ printf ("Expected ternary value = %d, got %d\n", expj, j);
+ exit (1);
+ }
+ }
+ mpfr_clear (x);
+
+ MPFR_ASSERTN (mpfr_get_emin () == -10);
+ MPFR_ASSERTN (mpfr_get_emax () == 10);
+
+ set_emin (emin);
+ set_emax (emax);
+}
+
+/* bug found by Kevin P. Rauch on 22 Oct 2007 */
+static void
+check2 (void)
+{
+ mpfr_t x, y, z;
+ int tern;
+ mpfr_exp_t emin;
+
+ emin = mpfr_get_emin ();
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 32);
+ mpfr_init2 (z, 32);
+
+ mpfr_set_ui (x, 0xC0000000U, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN);
+ mpfr_set_ui (y, 0xFFFFFFFEU, MPFR_RNDN);
+ mpfr_set_exp (x, 0);
+ mpfr_set_exp (y, 0);
+ mpfr_set_emin (-29);
+
+ tern = mpfr_mul (z, x, y, MPFR_RNDN);
+ /* z = -0.BFFFFFFE, tern > 0 */
+
+ tern = mpfr_subnormalize (z, tern, MPFR_RNDN);
+ /* z should be -0.75 */
+ MPFR_ASSERTN (tern < 0 && mpfr_cmp_si_2exp (z, -3, -2) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ MPFR_ASSERTN (mpfr_get_emin () == -29);
+
+ set_emin (emin);
+}
+
+/* bug found by Kevin P. Rauch on 22 Oct 2007 */
+static void
+check3 (void)
+{
+ mpfr_t x, y, z;
+ int tern;
+ mpfr_exp_t emin;
+
+ emin = mpfr_get_emin ();
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 32);
+ mpfr_init2 (z, 32);
+
+ mpfr_set_ui (x, 0xBFFFFFFFU, MPFR_RNDN); /* 3221225471/2^32 */
+ mpfr_set_ui (y, 0x80000001U, MPFR_RNDN); /* 2147483649/2^32 */
+ mpfr_set_exp (x, 0);
+ mpfr_set_exp (y, 0);
+ mpfr_set_emin (-1);
+
+ /* the exact product is 6917529028714823679/2^64, which is rounded to
+ 3/8 = 0.375, which is smaller, thus tern < 0 */
+ tern = mpfr_mul (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (tern < 0 && mpfr_cmp_ui_2exp (z, 3, -3) == 0);
+
+ tern = mpfr_subnormalize (z, tern, MPFR_RNDN);
+ /* since emin = -1, and EXP(z)=-1, z should be rounded to precision
+ EXP(z)-emin+1 = 1, i.e., z should be a multiple of the smallest possible
+ positive representable value with emin=-1, which is 1/4. The two
+ possible values are 1/4 and 2/4, which are at equal distance of z.
+ But since tern < 0, we should choose the largest value, i.e., 2/4. */
+ MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 1, -1) == 0);
+
+ /* here is another test for the alternate case, where z was rounded up
+ first, thus we have to round down */
+ mpfr_set_str_binary (x, "0.11111111111010110101011011011011");
+ mpfr_set_str_binary (y, "0.01100000000001111100000000001110");
+ tern = mpfr_mul (z, x, y, MPFR_RNDN);
+ MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 3, -3) == 0);
+ tern = mpfr_subnormalize (z, tern, MPFR_RNDN);
+ MPFR_ASSERTN (tern < 0 && mpfr_cmp_ui_2exp (z, 1, -2) == 0);
+
+ /* finally the case where z was exact, which we simulate here */
+ mpfr_set_ui_2exp (z, 3, -3, MPFR_RNDN);
+ tern = mpfr_subnormalize (z, 0, MPFR_RNDN);
+ MPFR_ASSERTN (tern > 0 && mpfr_cmp_ui_2exp (z, 1, -1) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ MPFR_ASSERTN (mpfr_get_emin () == -1);
+
+ set_emin (emin);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check1 ();
+ check2 ();
+ check3 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tsum.c b/tests/tsum.c
new file mode 100644
index 0000000..04fdab1
--- /dev/null
+++ b/tests/tsum.c
@@ -0,0 +1,320 @@
+/* tsum -- test file for the list summation function
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "mpfr-test.h"
+
+static int
+check_is_sorted (unsigned long n, mpfr_srcptr *perm)
+{
+ unsigned long i;
+
+ for (i = 0; i < n - 1; i++)
+ if (MPFR_GET_EXP(perm[i]) < MPFR_GET_EXP(perm[i+1]))
+ return 0;
+ return 1;
+}
+
+static int
+sum_tab (mpfr_ptr ret, mpfr_t *tab, unsigned long n, mpfr_rnd_t rnd)
+{
+ mpfr_ptr *tabtmp;
+ unsigned long i;
+ int inexact;
+ MPFR_TMP_DECL(marker);
+
+ MPFR_TMP_MARK(marker);
+ tabtmp = (mpfr_ptr *) MPFR_TMP_ALLOC(n * sizeof(mpfr_srcptr));
+ for (i = 0; i < n; i++)
+ tabtmp[i] = tab[i];
+
+ inexact = mpfr_sum (ret, tabtmp, n, rnd);
+ MPFR_TMP_FREE(marker);
+ return inexact;
+}
+
+
+static mpfr_prec_t
+get_prec_max (mpfr_t *tab, unsigned long n, mpfr_prec_t f)
+{
+ mpfr_prec_t res;
+ mpfr_exp_t min, max;
+ unsigned long i;
+
+ i = 0;
+ while (MPFR_IS_ZERO (tab[i]))
+ {
+ i++;
+ if (i == n)
+ return MPFR_PREC_MIN; /* all values are 0 */
+ }
+
+ if (! mpfr_check (tab[i]))
+ {
+ printf ("tab[%lu] is not valid.\n", i);
+ exit (1);
+ }
+ MPFR_ASSERTN (MPFR_IS_FP (tab[i]));
+ min = max = MPFR_GET_EXP(tab[i]);
+ for (i++; i < n; i++)
+ {
+ if (! mpfr_check (tab[i]))
+ {
+ printf ("tab[%lu] is not valid.\n", i);
+ exit (1);
+ }
+ MPFR_ASSERTN (MPFR_IS_FP (tab[i]));
+ if (! MPFR_IS_ZERO (tab[i]))
+ {
+ if (MPFR_GET_EXP(tab[i]) > max)
+ max = MPFR_GET_EXP(tab[i]);
+ if (MPFR_GET_EXP(tab[i]) < min)
+ min = MPFR_GET_EXP(tab[i]);
+ }
+ }
+ res = max - min;
+ res += f;
+ res += __gmpfr_ceil_log2 (n) + 1;
+ return res;
+}
+
+
+static void
+algo_exact (mpfr_t somme, mpfr_t *tab, unsigned long n, mpfr_prec_t f)
+{
+ unsigned long i;
+ mpfr_prec_t prec_max;
+
+ prec_max = get_prec_max(tab, n, f);
+ mpfr_set_prec (somme, prec_max);
+ mpfr_set_ui (somme, 0, MPFR_RNDN);
+ for (i = 0; i < n; i++)
+ {
+ if (mpfr_add(somme, somme, tab[i], MPFR_RNDN))
+ {
+ printf ("FIXME: algo_exact is buggy.\n");
+ exit (1);
+ }
+ }
+}
+
+/* Test the sorting function */
+static void
+test_sort (mpfr_prec_t f, unsigned long n)
+{
+ mpfr_t *tab;
+ mpfr_ptr *tabtmp;
+ mpfr_srcptr *perm;
+ unsigned long i;
+
+ /* Init stuff */
+ tab = (mpfr_t *) (*__gmp_allocate_func) (n * sizeof (mpfr_t));
+ for (i = 0; i < n; i++)
+ mpfr_init2 (tab[i], f);
+ tabtmp = (mpfr_ptr *) (*__gmp_allocate_func) (n * sizeof(mpfr_ptr));
+ perm = (mpfr_srcptr *) (*__gmp_allocate_func) (n * sizeof(mpfr_srcptr));
+
+ for (i = 0; i < n; i++)
+ {
+ mpfr_urandomb (tab[i], RANDS);
+ tabtmp[i] = tab[i];
+ }
+
+ mpfr_sum_sort ((mpfr_srcptr *)tabtmp, n, perm);
+
+ if (check_is_sorted (n, perm) == 0)
+ {
+ printf ("mpfr_sum_sort incorrect.\n");
+ for (i = 0; i < n; i++)
+ mpfr_dump (perm[i]);
+ exit (1);
+ }
+
+ /* Clear stuff */
+ for (i = 0; i < n; i++)
+ mpfr_clear (tab[i]);
+ (*__gmp_free_func) (tab, n * sizeof (mpfr_t));
+ (*__gmp_free_func) (tabtmp, n * sizeof(mpfr_ptr));
+ (*__gmp_free_func) (perm, n * sizeof(mpfr_srcptr));
+}
+
+static void
+test_sum (mpfr_prec_t f, unsigned long n)
+{
+ mpfr_t sum, real_sum, real_non_rounded;
+ mpfr_t *tab;
+ unsigned long i;
+ int rnd_mode;
+
+ /* Init */
+ tab = (mpfr_t *) (*__gmp_allocate_func) (n * sizeof(mpfr_t));
+ for (i = 0; i < n; i++)
+ mpfr_init2 (tab[i], f);
+ mpfr_inits2 (f, sum, real_sum, real_non_rounded, (mpfr_ptr) 0);
+
+ /* First Uniform */
+ for (i = 0; i < n; i++)
+ mpfr_urandomb (tab[i], RANDS);
+ algo_exact (real_non_rounded, tab, n, f);
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++)
+ {
+ sum_tab (sum, tab, n, (mpfr_rnd_t) rnd_mode);
+ mpfr_set (real_sum, real_non_rounded, (mpfr_rnd_t) rnd_mode);
+ if (mpfr_cmp (real_sum, sum) != 0)
+ {
+ printf ("mpfr_sum incorrect.\n");
+ mpfr_dump (real_sum);
+ mpfr_dump (sum);
+ exit (1);
+ }
+ }
+
+ /* Then non uniform */
+ for (i = 0; i < n; i++)
+ {
+ mpfr_urandomb (tab[i], RANDS);
+ if (! mpfr_zero_p (tab[i]))
+ mpfr_set_exp (tab[i], randlimb () % 1000);
+ }
+ algo_exact (real_non_rounded, tab, n, f);
+ for (rnd_mode = 0; rnd_mode < MPFR_RND_MAX; rnd_mode++)
+ {
+ sum_tab (sum, tab, n, (mpfr_rnd_t) rnd_mode);
+ mpfr_set (real_sum, real_non_rounded, (mpfr_rnd_t) rnd_mode);
+ if (mpfr_cmp (real_sum, sum) != 0)
+ {
+ printf ("mpfr_sum incorrect.\n");
+ mpfr_dump (real_sum);
+ mpfr_dump (sum);
+ exit (1);
+ }
+ }
+
+ /* Clear stuff */
+ for (i = 0; i < n; i++)
+ mpfr_clear (tab[i]);
+ mpfr_clears (sum, real_sum, real_non_rounded, (mpfr_ptr) 0);
+ (*__gmp_free_func) (tab, n * sizeof(mpfr_t));
+}
+
+static
+void check_special (void)
+{
+ mpfr_t tab[3], r;
+ mpfr_ptr tabp[3];
+ int i;
+
+ mpfr_inits (tab[0], tab[1], tab[2], r, (mpfr_ptr) 0);
+ tabp[0] = tab[0];
+ tabp[1] = tab[1];
+ tabp[2] = tab[2];
+
+ i = mpfr_sum (r, tabp, 0, MPFR_RNDN);
+ if (!MPFR_IS_ZERO (r) || !MPFR_IS_POS (r) || i != 0)
+ {
+ printf ("Special case n==0 failed!\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (tab[0], 42, MPFR_RNDN);
+ i = mpfr_sum (r, tabp, 1, MPFR_RNDN);
+ if (mpfr_cmp_ui (r, 42) || i != 0)
+ {
+ printf ("Special case n==1 failed!\n");
+ exit (1);
+ }
+
+ mpfr_set_ui (tab[1], 17, MPFR_RNDN);
+ MPFR_SET_NAN (tab[2]);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
+ if (!MPFR_IS_NAN (r) || i != 0)
+ {
+ printf ("Special case NAN failed!\n");
+ exit (1);
+ }
+
+ MPFR_SET_INF (tab[2]);
+ MPFR_SET_POS (tab[2]);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
+ if (!MPFR_IS_INF (r) || !MPFR_IS_POS (r) || i != 0)
+ {
+ printf ("Special case +INF failed!\n");
+ exit (1);
+ }
+
+ MPFR_SET_INF (tab[2]);
+ MPFR_SET_NEG (tab[2]);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
+ if (!MPFR_IS_INF (r) || !MPFR_IS_NEG (r) || i != 0)
+ {
+ printf ("Special case -INF failed!\n");
+ exit (1);
+ }
+
+ MPFR_SET_ZERO (tab[1]);
+ i = mpfr_sum (r, tabp, 2, MPFR_RNDN);
+ if (mpfr_cmp_ui (r, 42) || i != 0)
+ {
+ printf ("Special case 42+0 failed!\n");
+ exit (1);
+ }
+
+ MPFR_SET_NAN (tab[0]);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
+ if (!MPFR_IS_NAN (r) || i != 0)
+ {
+ printf ("Special case NAN+0+-INF failed!\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (tab[0], 1);
+ mpfr_set_ui (tab[1], 59, MPFR_RNDN);
+ mpfr_set_inf (tab[2], -1);
+ i = mpfr_sum (r, tabp, 3, MPFR_RNDN);
+ if (!MPFR_IS_NAN (r) || i != 0)
+ {
+ printf ("Special case +INF + 59 +-INF failed!\n");
+ exit (1);
+ }
+
+ mpfr_clears (tab[0], tab[1], tab[2], r, (mpfr_ptr) 0);
+}
+
+
+int
+main (void)
+{
+ mpfr_prec_t p;
+ unsigned long n;
+
+ tests_start_mpfr ();
+
+ check_special ();
+ test_sort (1764, 1026);
+ for (p = 2 ; p < 444 ; p += 17)
+ for (n = 2 ; n < 1026 ; n += 42 + p)
+ test_sum (p, n);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tswap.c b/tests/tswap.c
new file mode 100644
index 0000000..edb7cb1
--- /dev/null
+++ b/tests/tswap.c
@@ -0,0 +1,51 @@
+/* Test file for mpfr_swap.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ mpfr_t u, v;
+
+ tests_start_mpfr ();
+
+ mpfr_init2 (u, 24);
+ mpfr_init2 (v, 53);
+ mpfr_set_ui (u, 16777215, MPFR_RNDN); /* 2^24 - 1 */
+ mpfr_set_str1 (v, "9007199254740991.0"); /* 2^53 - 1 */
+ mpfr_swap (u, v);
+ mpfr_swap (u, v);
+ if (mpfr_cmp_ui (u, 16777215) || mpfr_cmp_str1 (v, "9007199254740991.0"))
+ {
+ printf ("Error in mpfr_swap\n");
+ exit (1);
+ }
+ mpfr_clear (u);
+ mpfr_clear (v);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/ttan.c b/tests/ttan.c
new file mode 100644
index 0000000..cc35d78
--- /dev/null
+++ b/tests/ttan.c
@@ -0,0 +1,163 @@
+/* Test file for mpfr_tan.
+
+Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_tan
+#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
+#include "tgeneric.c"
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ mpfr_set_nan (x);
+ mpfr_tan (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: tan(NaN) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, 1);
+ mpfr_tan (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: tan(Inf) != NaN\n");
+ exit (1);
+ }
+
+ mpfr_set_inf (x, -1);
+ mpfr_tan (y, x, MPFR_RNDN);
+ if (! mpfr_nan_p (y))
+ {
+ printf ("Error: tan(-Inf) != NaN\n");
+ exit (1);
+ }
+
+ /* exercise recomputation */
+ mpfr_set_prec (x, 14);
+ mpfr_set_str_binary (x, "0.10100000101010E0");
+ mpfr_set_prec (y, 24);
+ mpfr_tan (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 24);
+ mpfr_set_str_binary (x, "101110011011001100100001E-24");
+ MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
+
+ /* Compute ~Pi/2 to check overflow */
+ mpfr_set_prec (x, 20000);
+ mpfr_const_pi (x, MPFR_RNDD);
+ mpfr_div_2ui (x, x, 1, MPFR_RNDN);
+ mpfr_set_prec (y, 24);
+ mpfr_tan (y, x, MPFR_RNDN);
+ if (mpfr_cmp_str (y, "0.100011101101011000100011E20001", 2, MPFR_RNDN))
+ {
+ printf("Error computing tan(~Pi/2)\n");
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ /* bug found by Kaveh Ghazi on 13 Jul 2007 */
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_str_binary (x, "0.10011100110111000001000010110100101000000000000000000E34");
+ mpfr_tan (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.1000010011001010001000010100000110100111000011010101E41");
+ MPFR_ASSERTN(mpfr_cmp (x, y) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x;
+ unsigned int i;
+ unsigned int prec[10] = {14, 15, 19, 22, 23, 24, 25, 40, 41, 52};
+ unsigned int prec2[10] = {4, 5, 6, 19, 70, 95, 100, 106, 107, 108};
+
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ mpfr_init (x);
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ mpfr_tan (x, x, MPFR_RNDD);
+ if (mpfr_cmp_ui_2exp(x, 1, -1))
+ {
+ printf ("mpfr_tan(0.5, MPFR_RNDD) failed\n"
+ "expected 0.5, got");
+ mpfr_print_binary(x);
+ putchar('\n');
+ exit (1);
+ }
+
+ /* check that tan(3*Pi/4) ~ -1 */
+ for (i=0; i<10; i++)
+ {
+ mpfr_set_prec (x, prec[i]);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_ui (x, x, 3, MPFR_RNDN);
+ mpfr_div_ui (x, x, 4, MPFR_RNDN);
+ mpfr_tan (x, x, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -1))
+ {
+ printf ("tan(3*Pi/4) fails for prec=%u\n", prec[i]);
+ exit (1);
+ }
+ }
+
+ /* check that tan(7*Pi/4) ~ -1 */
+ for (i=0; i<10; i++)
+ {
+ mpfr_set_prec (x, prec2[i]);
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_mul_ui (x, x, 7, MPFR_RNDN);
+ mpfr_div_ui (x, x, 4, MPFR_RNDN);
+ mpfr_tan (x, x, MPFR_RNDN);
+ if (mpfr_cmp_si (x, -1))
+ {
+ printf ("tan(3*Pi/4) fails for prec=%u\n", prec2[i]);
+ exit (1);
+ }
+ }
+
+ mpfr_clear (x);
+
+ test_generic (2, 100, 10);
+
+ data_check ("data/tan", mpfr_tan, "mpfr_tan");
+ bad_cases (mpfr_tan, mpfr_atan, "mpfr_tan", 256, -256, 255, 4, 128, 800, 40);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/ttanh.c b/tests/ttanh.c
new file mode 100644
index 0000000..47d4a9e
--- /dev/null
+++ b/tests/ttanh.c
@@ -0,0 +1,138 @@
+/* Test file for mpfr_tanh.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_tanh
+#define TEST_RANDOM_EMIN -36
+#define TEST_RANDOM_EMAX 36
+#include "tgeneric.c"
+
+static void
+special (void)
+{
+ mpfr_t x;
+
+ mpfr_init (x);
+
+ mpfr_set_nan (x);
+ mpfr_tanh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (x));
+
+ mpfr_set_inf (x, 1);
+ mpfr_tanh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_tanh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_si (x, -1) == 0);
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_str_binary (x, "-0.1001011001");
+ mpfr_tanh (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_si_2exp (x, -135, -8) == 0);
+
+ mpfr_clear (x);
+}
+
+static void
+special_overflow (void)
+{
+ mpfr_t x, y;
+ int i;
+ mpfr_exp_t emin, emax;
+
+ emin = mpfr_get_emin ();
+ emax = mpfr_get_emax ();
+
+ mpfr_clear_overflow ();
+ set_emin (-125);
+ set_emax (128);
+ mpfr_init2 (x, 24);
+ mpfr_init2 (y, 24);
+
+ mpfr_set_str_binary (x, "0.101100100000000000110100E7");
+ i = mpfr_tanh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1) || i != 1)
+ {
+ printf("Overflow error (1). i=%d\ny=", i);
+ mpfr_dump (y);
+ exit (1);
+ }
+ MPFR_ASSERTN (!mpfr_overflow_p ());
+
+ i = mpfr_tanh (y, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (y, "0.111111111111111111111111E0", 2, MPFR_RNDN)
+ || i != -1)
+ {
+ printf("Overflow error (2).i=%d\ny=", i);
+ mpfr_dump (y);
+ exit (1);
+ }
+ MPFR_ASSERTN (!mpfr_overflow_p ());
+
+ set_emin (emin);
+ set_emax (emax);
+
+ mpfr_set_str_binary (x, "0.1E1000000000");
+ i = mpfr_tanh (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui (y, 1) || i != 1)
+ {
+ printf("Overflow error (3). i=%d\ny=", i);
+ mpfr_dump (y);
+ exit (1);
+ }
+ MPFR_ASSERTN (!mpfr_overflow_p ());
+ mpfr_set_str_binary (x, "-0.1E1000000000");
+ i = mpfr_tanh (y, x, MPFR_RNDU);
+ if (mpfr_cmp_str (y, "-0.111111111111111111111111E0", 2, MPFR_RNDN)
+ || i != 1)
+ {
+ printf("Overflow error (4). i=%d\ny=", i);
+ mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ special_overflow ();
+ special ();
+
+ test_generic (2, 100, 100);
+
+ data_check ("data/tanh", mpfr_tanh, "mpfr_tanh");
+ bad_cases (mpfr_tanh, mpfr_atanh, "mpfr_tanh", 256, -128, 0,
+ 4, 128, 800, 100);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/ttrunc.c b/tests/ttrunc.c
new file mode 100644
index 0000000..8ff1601
--- /dev/null
+++ b/tests/ttrunc.c
@@ -0,0 +1,133 @@
+/* Test file for mpfr_trunc, mpfr_ceil, mpfr_floor.
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define SIZEX 100
+
+int
+main (void)
+{
+ int j, k;
+ mpfr_t x, y, z, t, y2, z2, t2;
+
+ tests_start_mpfr ();
+
+ mpfr_inits2 (SIZEX, x, y, z, t, y2, z2, t2, (mpfr_ptr) 0);
+
+ mpfr_set_str1 (x, "0.5");
+ mpfr_ceil(y, x);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("Error in mpfr_ceil for x=0.5: expected 1.0, got ");
+ mpfr_print_binary(y);
+ putchar('\n');
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_ceil(y, x);
+ if (mpfr_cmp_ui(y,0))
+ {
+ printf ("Error in mpfr_ceil for x=0.0: expected 0.0, got ");
+ mpfr_print_binary(y);
+ putchar('\n');
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_ceil(y, x);
+ if (mpfr_cmp_ui(y,1))
+ {
+ printf ("Error in mpfr_ceil for x=1.0: expected 1.0, got ");
+ mpfr_print_binary(y);
+ putchar('\n');
+ exit (1);
+ }
+
+ for (j=0;j<1000;j++)
+ {
+ mpfr_urandomb (x, RANDS);
+ MPFR_EXP (x) = 2;
+
+ for (k = 2; k <= SIZEX; k++)
+ {
+ mpfr_set_prec(y, k);
+ mpfr_set_prec(y2, k);
+ mpfr_set_prec(z, k);
+ mpfr_set_prec(z2, k);
+ mpfr_set_prec(t, k);
+ mpfr_set_prec(t2, k);
+
+ mpfr_floor(y, x);
+ mpfr_set(y2, x, MPFR_RNDD);
+
+ mpfr_trunc(z, x);
+ mpfr_set(z2, x, MPFR_RNDZ);
+
+ mpfr_ceil(t, x);
+ mpfr_set(t2, x, MPFR_RNDU);
+
+ if (!mpfr_eq(y, y2, k))
+ {
+ printf("Error in floor, x = "); mpfr_print_binary(x);
+ printf("\n");
+ printf("floor(x) = "); mpfr_print_binary(y);
+ printf("\n");
+ printf("round(x, RNDD) = "); mpfr_print_binary(y2);
+ printf("\n");
+ exit(1);
+ }
+
+ if (!mpfr_eq(z, z2, k))
+ {
+ printf("Error in trunc, x = "); mpfr_print_binary(x);
+ printf("\n");
+ printf("trunc(x) = "); mpfr_print_binary(z);
+ printf("\n");
+ printf("round(x, RNDZ) = "); mpfr_print_binary(z2);
+ printf("\n");
+ exit(1);
+ }
+
+ if (!mpfr_eq(y, y2, k))
+ {
+ printf("Error in ceil, x = "); mpfr_print_binary(x);
+ printf("\n");
+ printf("ceil(x) = "); mpfr_print_binary(t);
+ printf("\n");
+ printf("round(x, RNDU) = "); mpfr_print_binary(t2);
+ printf("\n");
+ exit(1);
+ }
+ MPFR_EXP(x)++;
+ }
+ }
+
+ mpfr_clears (x, y, z, t, y2, z2, t2, (mpfr_ptr) 0);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tui_div.c b/tests/tui_div.c
new file mode 100644
index 0000000..ac97775
--- /dev/null
+++ b/tests/tui_div.c
@@ -0,0 +1,206 @@
+/* Test file for mpfr_ui_div.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+/* checks that y/x gives the right result with 53 bits of precision */
+static void
+check (unsigned long y, const char *xs, mpfr_rnd_t rnd_mode, const char *zs)
+{
+ mpfr_t xx, zz;
+
+ mpfr_inits2 (53, xx, zz, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs);
+ mpfr_ui_div (zz, y, xx, rnd_mode);
+ if (mpfr_cmp_str1(zz, zs))
+ {
+ printf ("expected quotient is %s, got ", zs);
+ mpfr_out_str (stdout, 10, 0, zz, MPFR_RNDN);
+ printf ("mpfr_ui_div failed for y=%lu x=%s with rnd_mode=%s\n",
+ y, xs, mpfr_print_rnd_mode (rnd_mode));
+ exit (1);
+ }
+ mpfr_clears (xx, zz, (mpfr_ptr) 0);
+}
+
+static void
+check_inexact (void)
+{
+ mpfr_t x, y, z;
+ mpfr_prec_t px, py;
+ int inexact, cmp;
+ unsigned long int u;
+ int rnd;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+
+ for (px=2; px<300; px++)
+ {
+ mpfr_set_prec (x, px);
+ do
+ {
+ mpfr_urandomb (x, RANDS);
+ }
+ while (mpfr_cmp_ui (x, 0) == 0);
+ u = randlimb ();
+ for (py=2; py<300; py++)
+ {
+ mpfr_set_prec (y, py);
+ mpfr_set_prec (z, py + px);
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ inexact = mpfr_ui_div (y, u, x, (mpfr_rnd_t) rnd);
+ if (mpfr_mul (z, y, x, (mpfr_rnd_t) rnd))
+ {
+ printf ("z <- y * x should be exact\n");
+ exit (1);
+ }
+ cmp = mpfr_cmp_ui (z, u);
+ if (((inexact == 0) && (cmp != 0)) ||
+ ((inexact > 0) && (cmp <= 0)) ||
+ ((inexact < 0) && (cmp >= 0)))
+ {
+ printf ("Wrong inexact flag for u=%lu, rnd=%s\n",
+ u, mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf ("expected %d, got %d\n", cmp, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("y*x="); mpfr_print_binary (z); puts ("");
+ exit (1);
+ }
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+}
+
+static void
+check_special (void)
+{
+ mpfr_t d, q;
+
+ mpfr_init2 (d, 100L);
+ mpfr_init2 (q, 100L);
+
+ /* 1/+inf == 0 */
+ MPFR_SET_INF (d);
+ MPFR_SET_POS (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* 1/-inf == -0 */
+ MPFR_SET_INF (d);
+ MPFR_SET_NEG (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_number_p (q));
+ MPFR_ASSERTN (mpfr_sgn (q) == 0);
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* 1/nan == nan */
+ MPFR_SET_NAN (d);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_nan_p (q));
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ /* 0/0 == nan */
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_nan_p (q));
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);
+
+ /* 1/+0 = +inf */
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ /* 1/-0 = -inf */
+ mpfr_set_ui (d, 0L, MPFR_RNDN);
+ mpfr_neg (d, d, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 1L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) < 0);
+ MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);
+
+ /* 0/1 = +0 */
+ mpfr_set_ui (d, 1L, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q));
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ /* 0/-1 = -0 */
+ mpfr_set_si (d, -1, MPFR_RNDN);
+ mpfr_clear_flags ();
+ MPFR_ASSERTN (mpfr_ui_div (q, 0L, d, MPFR_RNDZ) == 0); /* exact */
+ MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_NEG (q));
+ MPFR_ASSERTN (__gmpfr_flags == 0);
+
+ mpfr_clear (d);
+ mpfr_clear (q);
+}
+
+static int
+mpfr_inv (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t r)
+{
+ return mpfr_ui_div (y, 1, x, r);
+}
+
+int
+main (int argc, char *argv[])
+{
+ tests_start_mpfr ();
+
+ check_special ();
+ check_inexact ();
+ check(948002822, "1.22191250737771397120e+20", MPFR_RNDN,
+ "7.758352715731357946e-12");
+ check(1976245324, "1.25296395864546893357e+232", MPFR_RNDZ,
+ "1.5772563211925444801e-223");
+ check(740454110, "2.11496253355831863313e+183", MPFR_RNDZ,
+ "3.5010270784996976041e-175");
+ check(1690540942, "1.28278599852446657468e-276", MPFR_RNDU,
+ "1.3178666932321966062e285");
+ check(1476599377, "-2.14191393656148625995e+305", MPFR_RNDD,
+ "-6.8938315017943889615e-297");
+
+ /* inv is for 1/x */
+ data_check ("data/inv", mpfr_inv, "mpfr_ui_div(1,x)");
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tui_pow.c b/tests/tui_pow.c
new file mode 100644
index 0000000..c2d9ca6
--- /dev/null
+++ b/tests/tui_pow.c
@@ -0,0 +1,262 @@
+/* Test file for mpfr_ui_pow and mpfr_ui_pow_ui.
+
+Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "mpfr-test.h"
+
+static void
+test1 (void)
+{
+ mpfr_t x, y, z, a;
+ int res1, res2;
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 65);
+ mpfr_init2 (z, 17);
+ mpfr_init2 (a, 17);
+
+ mpfr_set_str_binary (x, "-0.101110001001011011011e-9");
+ mpfr_ui_pow (y, 7, x, MPFR_RNDN);
+
+ mpfr_set_prec (x, 40);
+ mpfr_set_str_binary (x, "-0.1100101100101111011001010010110011110110E-1");
+ mpfr_set_prec (y, 74);
+ mpfr_ui_pow (y, 8, x, MPFR_RNDN);
+ mpfr_set_prec (x, 74);
+ mpfr_set_str_binary (x, "0.11100000010100111101000011111011011010011000011000101011010011010101000011E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for input of 40 bits, output of 74 bits\n");
+ exit (1);
+ }
+
+ /* Check for ui_pow_ui */
+ mpfr_ui_pow_ui (x, 0, 1, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
+ mpfr_ui_pow_ui (x, 0, 4, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
+ res1 = mpfr_ui_pow_ui (z, 17, 42, MPFR_RNDD);
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_set_ui (y, 42, MPFR_RNDN);
+ res2 = mpfr_pow (a, x, y, MPFR_RNDD);
+ if (mpfr_cmp (z, a) || res1 != res2)
+ {
+ printf ("Error for ui_pow_ui for 17^42\n"
+ "Inexact1 = %d Inexact2 = %d\n", res1, res2);
+ mpfr_dump (z);
+ mpfr_dump (a);
+ exit (1);
+ }
+ mpfr_set_prec (x, 2);
+ mpfr_ui_pow_ui (x, 65537, 65535, MPFR_RNDN);
+ if (mpfr_cmp_str (x, "0.11E1048562", 2, MPFR_RNDN) != 0)
+ {
+ printf ("Error for ui_pow_ui for 65537 ^65535 with 2 bits of precision\n");
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (a);
+}
+
+static void
+check1 (mpfr_ptr x, mpfr_prec_t prec, unsigned long nt, mpfr_rnd_t rnd)
+{
+ mpfr_t y, z, t;
+ int inexact, compare, compare2;
+ mpfr_prec_t yprec;
+ mpfr_exp_t err;
+
+ yprec = prec + 10;
+
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+ mpfr_set_prec (y, yprec);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+
+ compare = mpfr_ui_pow (y, nt, x, rnd);
+ err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
+ if (mpfr_can_round (y, err, rnd, rnd, prec))
+ {
+ mpfr_set (t, y, rnd);
+ inexact = mpfr_ui_pow (z, nt, x, rnd);
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for x=");
+ mpfr_out_str (stdout, 2, prec, x, MPFR_RNDN);
+ printf (" n=%lu", nt);
+ printf (" prec=%u rnd_mode=%s\n", (unsigned) prec,
+ mpfr_print_rnd_mode (rnd));
+ printf ("got ");
+ mpfr_out_str (stdout, 2, prec, z, MPFR_RNDN);
+ puts ("");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, prec, t, MPFR_RNDN);
+ puts ("");
+ printf ("approx ");
+ mpfr_print_binary (y);
+ puts ("");
+ exit (1);
+ }
+ compare2 = mpfr_cmp (t, y);
+ /* if rounding to nearest, cannot know the sign of t - f(x)
+ because of composed rounding: y = o(f(x)) and t = o(y) */
+ if ((rnd != MPFR_RNDN) && (compare * compare2 >= 0))
+ compare = compare + compare2;
+ else
+ compare = inexact; /* cannot determine sign(t-f(x)) */
+ if (((inexact == 0) && (compare != 0)) ||
+ ((inexact > 0) && (compare <= 0)) ||
+ ((inexact < 0) && (compare >= 0)))
+ {
+ printf ("Wrong inexact flag for rnd=%s: expected %d, got %d\n",
+ mpfr_print_rnd_mode (rnd), compare, inexact);
+ printf ("x="); mpfr_print_binary (x); puts ("");
+ printf ("y="); mpfr_print_binary (y); puts ("");
+ printf ("t="); mpfr_print_binary (t); puts ("");
+ exit (1);
+ }
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ unsigned long int n;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ n = randlimb ();
+
+ MPFR_SET_INF(x);
+ mpfr_ui_pow (y, n, x, MPFR_RNDN);
+ if(!MPFR_IS_INF(y))
+ {
+ printf ("evaluation of function in INF does not return INF\n");
+ exit (1);
+ }
+
+ MPFR_CHANGE_SIGN(x);
+ mpfr_ui_pow (y, n, x, MPFR_RNDN);
+ if(!MPFR_IS_ZERO(y))
+ {
+ printf ("evaluation of function in -INF does not return 0");
+ exit (1);
+ }
+
+ MPFR_SET_NAN(x);
+ mpfr_ui_pow (y, n, x, MPFR_RNDN);
+ if(!MPFR_IS_NAN(y))
+ {
+ printf ("evaluation of function in NAN does not return NAN");
+ exit (1);
+ }
+
+ test1 ();
+
+ {
+ mpfr_t z, t;
+ mpfr_prec_t prec;
+ mpfr_rnd_t rnd;
+ unsigned int n;
+
+ mpfr_prec_t p0=2, p1=100;
+ unsigned int N=20;
+
+ mpfr_init2 (z, 38);
+ mpfr_init2 (t, 6);
+
+ /* check exact power */
+ mpfr_set_str_binary (t, "0.110000E5");
+ mpfr_ui_pow (z, 3, t, MPFR_RNDN);
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str (x, "-0.5", 10, MPFR_RNDZ);
+ mpfr_ui_pow (y, 4, x, MPFR_RNDD);
+ if (mpfr_cmp_ui_2exp(y, 1, -1))
+ {
+ fprintf (stderr, "Error for 4^(-0.5), prec=2, MPFR_RNDD\n");
+ fprintf (stderr, "expected 0.5, got ");
+ mpfr_out_str (stderr, 2, 0, y, MPFR_RNDN);
+ fprintf (stderr, "\n");
+ exit (1);
+ }
+
+ /* problem found by Kevin on spe175.testdrive.compaq.com
+ (03 Sep 2003), ia64 under HP-UX */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ mpfr_ui_pow (y, 398441521, x, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp(y, 1, 14))
+ {
+ fprintf (stderr, "Error for 398441521^(0.5), prec=2, MPFR_RNDN\n");
+ fprintf (stderr, "expected 1.0e14, got ");
+ mpfr_out_str (stderr, 2, 0, y, MPFR_RNDN);
+ fprintf (stderr, "\n");
+ exit (1);
+ }
+
+ mpfr_clear (z);
+ mpfr_clear (t);
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_str (x, "0.5", 10, MPFR_RNDN);
+ check1 (x, 2, 398441521, MPFR_RNDN); /* 398441521 = 19961^2 */
+
+ /* generic test */
+ for (prec = p0; prec <= p1; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ for (n=0; n<N; n++)
+ {
+ int nt;
+ nt = randlimb () & INT_MAX;
+ mpfr_urandomb (x, RANDS);
+ rnd = RND_RAND ();
+ check1 (x, prec, nt, rnd);
+ }
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tui_sub.c b/tests/tui_sub.c
new file mode 100644
index 0000000..9d6b1e1
--- /dev/null
+++ b/tests/tui_sub.c
@@ -0,0 +1,301 @@
+/* Test file for mpfr_ui_sub.
+
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "mpfr-test.h"
+
+static void
+special (void)
+{
+ mpfr_t x, y, res;
+ int inexact;
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (res);
+
+ mpfr_set_prec (x, 24);
+ mpfr_set_prec (y, 24);
+ mpfr_set_str_binary (y, "0.111100110001011010111");
+ inexact = mpfr_ui_sub (x, 1, y, MPFR_RNDN);
+ if (inexact)
+ {
+ printf ("Wrong inexact flag: got %d, expected 0\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 24);
+ mpfr_set_prec (y, 24);
+ mpfr_set_str_binary (y, "0.111100110001011010111");
+ if ((inexact = mpfr_ui_sub (x, 38181761, y, MPFR_RNDN)) >= 0)
+ {
+ printf ("Wrong inexact flag: got %d, expected -1\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 63);
+ mpfr_set_prec (y, 63);
+ mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1");
+ if ((inexact = mpfr_ui_sub (x, 1541116494, y, MPFR_RNDN)) <= 0)
+ {
+ printf ("Wrong inexact flag: got %d, expected +1\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 32);
+ mpfr_set_prec (y, 32);
+ mpfr_set_str_binary (y, "0.11011000110111010001011100011100E-1");
+ if ((inexact = mpfr_ui_sub (x, 2000375416, y, MPFR_RNDN)) >= 0)
+ {
+ printf ("Wrong inexact flag: got %d, expected -1\n", inexact);
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 24);
+ mpfr_set_prec (y, 24);
+ mpfr_set_str_binary (y, "0.110011011001010011110111E-2");
+ if ((inexact = mpfr_ui_sub (x, 927694848, y, MPFR_RNDN)) <= 0)
+ {
+ printf ("Wrong inexact flag: got %d, expected +1\n", inexact);
+ exit (1);
+ }
+
+ /* bug found by Mathieu Dutour, 12 Apr 2001 */
+ mpfr_set_prec (x, 5);
+ mpfr_set_prec (y, 5);
+ mpfr_set_prec (res, 5);
+ mpfr_set_str_binary (x, "1e-12");
+
+ mpfr_ui_sub (y, 1, x, MPFR_RNDD);
+ mpfr_set_str_binary (res, "0.11111");
+ if (mpfr_cmp (y, res))
+ {
+ printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDD) for x=2^(-12)\nexpected 1.1111e-1, got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_ui_sub (y, 1, x, MPFR_RNDU);
+ mpfr_set_str_binary (res, "1.0");
+ if (mpfr_cmp (y, res))
+ {
+ printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDU) for x=2^(-12)\n"
+ "expected 1.0, got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_ui_sub (y, 1, x, MPFR_RNDN);
+ mpfr_set_str_binary (res, "1.0");
+ if (mpfr_cmp (y, res))
+ {
+ printf ("Error in mpfr_ui_sub (y, 1, x, MPFR_RNDN) for x=2^(-12)\n"
+ "expected 1.0, got ");
+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 10);
+ mpfr_set_prec (y, 10);
+ mpfr_urandomb (x, RANDS);
+ mpfr_ui_sub (y, 0, x, MPFR_RNDN);
+ if (MPFR_IS_ZERO(x))
+ MPFR_ASSERTN(MPFR_IS_ZERO(y));
+ else
+ MPFR_ASSERTN(mpfr_cmpabs (x, y) == 0 && mpfr_sgn (x) != mpfr_sgn (y));
+
+ mpfr_set_prec (x, 73);
+ mpfr_set_str_binary (x, "0.1101111010101011011011100011010000000101110001011111001011011000101111101E-99");
+ mpfr_ui_sub (x, 1, x, MPFR_RNDZ);
+ mpfr_nextabove (x);
+ MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (res);
+}
+
+/* checks that (y-x) gives the right results with 53 bits of precision */
+static void
+check (unsigned long y, const char *xs, mpfr_rnd_t rnd_mode, const char *zs)
+{
+ mpfr_t xx, zz;
+
+ mpfr_inits2 (53, xx, zz, (mpfr_ptr) 0);
+ mpfr_set_str1 (xx, xs);
+ mpfr_ui_sub (zz, y, xx, rnd_mode);
+ if (mpfr_cmp_str1 (zz, zs) )
+ {
+ printf ("expected difference is %s, got\n",zs);
+ mpfr_out_str(stdout, 10, 0, zz, MPFR_RNDN);
+ printf ("mpfr_ui_sub failed for y=%lu x=%s with rnd_mode=%s\n",
+ y, xs, mpfr_print_rnd_mode (rnd_mode));
+ exit (1);
+ }
+ mpfr_clears (xx, zz, (mpfr_ptr) 0);
+}
+
+/* if u = o(x-y), v = o(u-x), w = o(v+y), then x-y = u-w */
+static void
+check_two_sum (mpfr_prec_t p)
+{
+ unsigned int x;
+ mpfr_t y, u, v, w;
+ mpfr_rnd_t rnd;
+ int inexact;
+
+ mpfr_inits2 (p, y, u, v, w, (mpfr_ptr) 0);
+ do
+ {
+ x = randlimb ();
+ }
+ while (x < 1);
+ mpfr_urandomb (y, RANDS);
+ rnd = MPFR_RNDN;
+ inexact = mpfr_ui_sub (u, x, y, rnd);
+ mpfr_sub_ui (v, u, x, rnd);
+ mpfr_add (w, v, y, rnd);
+ /* as u = (x-y) + w, we should have inexact and w of same sign */
+ if (((inexact == 0) && mpfr_cmp_ui (w, 0)) ||
+ ((inexact > 0) && (mpfr_cmp_ui (w, 0) <= 0)) ||
+ ((inexact < 0) && (mpfr_cmp_ui (w, 0) >= 0)))
+ {
+ printf ("Wrong inexact flag for prec=%u, rnd=%s\n",
+ (unsigned int) p, mpfr_print_rnd_mode (rnd));
+ printf ("x=%u\n", x);
+ printf ("y="); mpfr_print_binary(y); puts ("");
+ printf ("u="); mpfr_print_binary(u); puts ("");
+ printf ("v="); mpfr_print_binary(v); puts ("");
+ printf ("w="); mpfr_print_binary(w); puts ("");
+ printf ("inexact = %d\n", inexact);
+ exit (1);
+ }
+ mpfr_clears (y, u, v, w, (mpfr_ptr) 0);
+}
+
+static void
+check_nans (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 123L);
+ mpfr_init2 (y, 123L);
+
+ /* 1 - nan == nan */
+ mpfr_set_nan (x);
+ mpfr_ui_sub (y, 1L, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_nan_p (y));
+
+ /* 1 - +inf == -inf */
+ mpfr_set_inf (x, 1);
+ mpfr_ui_sub (y, 1L, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) < 0);
+
+ /* 1 - -inf == +inf */
+ mpfr_set_inf (x, -1);
+ mpfr_ui_sub (y, 1L, x, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (y));
+ MPFR_ASSERTN (mpfr_sgn (y) > 0);
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+/* Check mpfr_ui_sub with u = 0 (unsigned). */
+static void check_neg (void)
+{
+ mpfr_t x, yneg, ysub;
+ int i, s;
+ int r;
+
+ mpfr_init2 (x, 64);
+ mpfr_init2 (yneg, 32);
+ mpfr_init2 (ysub, 32);
+
+ for (i = 0; i <= 25; i++)
+ {
+ mpfr_sqrt_ui (x, i, MPFR_RNDN);
+ for (s = 0; s <= 1; s++)
+ {
+ RND_LOOP (r)
+ {
+ int tneg, tsub;
+
+ tneg = mpfr_neg (yneg, x, (mpfr_rnd_t) r);
+ tsub = mpfr_ui_sub (ysub, 0, x, (mpfr_rnd_t) r);
+ MPFR_ASSERTN (mpfr_equal_p (yneg, ysub));
+ MPFR_ASSERTN (!(MPFR_IS_POS (yneg) ^ MPFR_IS_POS (ysub)));
+ MPFR_ASSERTN (tneg == tsub);
+ }
+ mpfr_neg (x, x, MPFR_RNDN);
+ }
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (yneg);
+ mpfr_clear (ysub);
+}
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_prec_t p;
+ unsigned k;
+
+ tests_start_mpfr ();
+
+ check_nans ();
+
+ special ();
+ for (p=2; p<100; p++)
+ for (k=0; k<100; k++)
+ check_two_sum (p);
+
+ check(1196426492, "1.4218093058435347e-3", MPFR_RNDN,
+ "1.1964264919985781e9");
+ check(1092583421, "-1.0880649218158844e9", MPFR_RNDN,
+ "2.1806483428158845901e9");
+ check(948002822, "1.22191250737771397120e+20", MPFR_RNDN,
+ "-1.2219125073682338611e20");
+ check(832100416, "4.68311314939691330000e-215", MPFR_RNDD,
+ "8.3210041599999988079e8");
+ check(1976245324, "1.25296395864546893357e+232", MPFR_RNDZ,
+ "-1.2529639586454686577e232");
+ check(2128997392, "-1.08496826129284207724e+187", MPFR_RNDU,
+ "1.0849682612928422704e187");
+ check(293607738, "-1.9967571564050541e-5", MPFR_RNDU,
+ "2.9360773800002003e8");
+ check(354270183, "2.9469161763489528e3", MPFR_RNDN,
+ "3.5426723608382362e8");
+
+ check_neg ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/turandom.c b/tests/turandom.c
new file mode 100644
index 0000000..b99587b
--- /dev/null
+++ b/tests/turandom.c
@@ -0,0 +1,249 @@
+/* Test file for mpfr_urandom
+
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+test_urandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, long bit_index,
+ int verbose)
+{
+ mpfr_t x;
+ int *tab, size_tab, k, sh, xn;
+ double d, av = 0, var = 0, chi2 = 0, th;
+ mpfr_exp_t emin;
+ mp_size_t limb_index = 0;
+ mp_limb_t limb_mask = 0;
+ long count = 0;
+ int i;
+ int inex = 1;
+
+ size_tab = (nbtests >= 1000 ? nbtests / 50 : 20);
+ tab = (int *) calloc (size_tab, sizeof(int));
+ if (tab == NULL)
+ {
+ fprintf (stderr, "trandom: can't allocate memory in test_urandom\n");
+ exit (1);
+ }
+
+ mpfr_init2 (x, prec);
+ xn = 1 + (prec - 1) / mp_bits_per_limb;
+ sh = xn * mp_bits_per_limb - prec;
+ if (bit_index >= 0 && bit_index < prec)
+ {
+ /* compute the limb index and limb mask to fetch the bit #bit_index */
+ limb_index = (prec - bit_index) / mp_bits_per_limb;
+ i = 1 + bit_index - (bit_index / mp_bits_per_limb) * mp_bits_per_limb;
+ limb_mask = MPFR_LIMB_ONE << (mp_bits_per_limb - i);
+ }
+
+ for (k = 0; k < nbtests; k++)
+ {
+ i = mpfr_urandom (x, RANDS, rnd);
+ inex = (i != 0) && inex;
+ /* check that lower bits are zero */
+ if (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh) && !MPFR_IS_ZERO (x))
+ {
+ printf ("Error: mpfr_urandom() returns invalid numbers:\n");
+ mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+ /* check that the value is in [0,1] */
+ if (mpfr_cmp_ui (x, 0) < 0 || mpfr_cmp_ui (x, 1) > 0)
+ {
+ printf ("Error: mpfr_urandom() returns number outside [0, 1]:\n");
+ mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+
+ d = mpfr_get_d1 (x); av += d; var += d*d;
+ i = (int)(size_tab * d);
+ if (d == 1.0) i --;
+ tab[i]++;
+
+ if (limb_mask && (MPFR_MANT (x)[limb_index] & limb_mask))
+ count ++;
+ }
+
+ if (inex == 0)
+ {
+ /* one call in the loop pretended to return an exact number! */
+ printf ("Error: mpfr_urandom() returns a zero ternary value.\n");
+ exit (1);
+ }
+
+ /* coverage test */
+ emin = mpfr_get_emin ();
+ for (k = 0; k < 5; k++)
+ {
+ set_emin (k+1);
+ inex = mpfr_urandom (x, RANDS, rnd);
+ if (( (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)
+ && (!MPFR_IS_ZERO (x) || inex != -1))
+ || ((rnd == MPFR_RNDU || rnd == MPFR_RNDA)
+ && (mpfr_cmp_ui (x, 1 << k) != 0 || inex != +1))
+ || (rnd == MPFR_RNDN
+ && (k > 0 || mpfr_cmp_ui (x, 1 << k) != 0 || inex != +1)
+ && (!MPFR_IS_ZERO (x) || inex != -1)))
+ {
+ printf ("Error: mpfr_urandom() do not handle correctly a restricted"
+ " exponent range.\nrounding mode: %s\nternary value: %d\n"
+ "random value: ", mpfr_print_rnd_mode (rnd), inex);
+ mpfr_print_binary (x); puts ("");
+ exit (1);
+ }
+ }
+ set_emin (emin);
+
+ mpfr_clear (x);
+ if (!verbose)
+ {
+ free(tab);
+ return;
+ }
+
+ av /= nbtests;
+ var = (var / nbtests) - av * av;
+
+ th = (double)nbtests / size_tab;
+ printf ("Average = %.5f\nVariance = %.5f\n", av, var);
+ printf ("Repartition for urandom with rounding mode %s. "
+ "Each integer should be close to %d.\n",
+ mpfr_print_rnd_mode (rnd), (int)th);
+
+ for (k = 0; k < size_tab; k++)
+ {
+ chi2 += (tab[k] - th) * (tab[k] - th) / th;
+ printf("%d ", tab[k]);
+ if (((k+1) & 7) == 0)
+ printf("\n");
+ }
+
+ printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n",
+ size_tab - 1, chi2);
+
+ if (limb_mask)
+ printf ("Bit #%ld is set %ld/%ld = %.1f %% of time\n",
+ bit_index, count, nbtests, count * 100.0 / nbtests);
+
+ puts ("");
+
+ free(tab);
+ return;
+}
+
+/* problem reported by Carl Witty */
+static void
+bug20100914 (void)
+{
+ mpfr_t x;
+ gmp_randstate_t s;
+
+#if __MPFR_GMP(4,2,0)
+# define C1 "0.8488312"
+# define C2 "0.8156509"
+#else
+# define C1 "0.6485367"
+# define C2 "0.9362717"
+#endif
+
+ gmp_randinit_default (s);
+ gmp_randseed_ui (s, 42);
+ mpfr_init2 (x, 17);
+ mpfr_urandom (x, s, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, C1) != 0)
+ {
+ printf ("Error in bug20100914, expected " C1 ", got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_urandom (x, s, MPFR_RNDN);
+ if (mpfr_cmp_str1 (x, C2) != 0)
+ {
+ printf ("Error in bug20100914, expected " C2 ", got ");
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+ gmp_randclear (s);
+}
+
+int
+main (int argc, char *argv[])
+{
+ long nbtests;
+ mpfr_prec_t prec;
+ int verbose = 0;
+ int rnd;
+ long bit_index;
+
+ tests_start_mpfr ();
+
+ if (argc > 1)
+ verbose = 1;
+
+ nbtests = 10000;
+ if (argc > 1)
+ {
+ long a = atol(argv[1]);
+ if (a != 0)
+ nbtests = a;
+ }
+
+ if (argc <= 2)
+ prec = 1000;
+ else
+ prec = atol(argv[2]);
+
+ if (argc <= 3)
+ bit_index = -1;
+ else
+ {
+ bit_index = atol(argv[3]);
+ if (bit_index >= prec)
+ {
+ printf ("Warning. Cannot compute the bit frequency: the given bit "
+ "index (= %ld) is not less than the precision (= %ld).\n",
+ bit_index, (long) prec);
+ bit_index = -1;
+ }
+ }
+
+ RND_LOOP(rnd)
+ {
+ test_urandom (nbtests, prec, (mpfr_rnd_t) rnd, bit_index, verbose);
+
+ if (argc == 1) /* check also small precision */
+ {
+ test_urandom (nbtests, 2, (mpfr_rnd_t) rnd, -1, 0);
+ }
+ }
+
+ bug20100914 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tvalist.c b/tests/tvalist.c
new file mode 100644
index 0000000..a8f3dfd
--- /dev/null
+++ b/tests/tvalist.c
@@ -0,0 +1,76 @@
+/* Test file for multiple mpfr.h inclusion and va_list related functions
+
+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#if HAVE_STDARG
+
+#if _MPFR_EXP_FORMAT == 4
+/* If mpfr_exp_t is defined as intmax_t, intmax_t must be defined before
+ the inclusion of mpfr.h (this test doesn't use mpfr-impl.h). */
+# include <stdint.h>
+#endif
+
+/* Assume that this is in fact a header inclusion for some library
+ that uses MPFR, i.e. this inclusion is hidden in another one.
+ MPFR currently (rev 6704) fails to handle this case. */
+#include <mpfr.h>
+
+#include <stdarg.h>
+#define MPFR_USE_VA_LIST /* necessary due to GMP bug concerning inclusions */
+#include <mpfr.h>
+
+#include <stdio.h>
+#define MPFR_USE_FILE /* necessary due to GMP bug concerning inclusions */
+#include <mpfr.h>
+
+static void
+test (FILE *fout, const char *fmt, ...)
+{
+ int (*fct) (FILE*, __gmp_const char*, va_list);
+
+ fct = mpfr_vfprintf;
+ if (0)
+ {
+ va_list ap;
+ va_start (ap, fmt);
+ fct (fout, fmt, ap);
+ va_end (ap);
+ }
+}
+
+int
+main (void)
+{
+ test (stdout, "%d\n", 0);
+ return 0;
+}
+
+#else /* HAVE_STDARG */
+
+/* The test is disabled. */
+
+int
+main (void)
+{
+ return 77;
+}
+
+#endif /* HAVE_STDARG */
diff --git a/tests/tversion.c b/tests/tversion.c
new file mode 100644
index 0000000..f3bc07e
--- /dev/null
+++ b/tests/tversion.c
@@ -0,0 +1,84 @@
+/* Test file for mpfr_version.
+
+Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (void)
+{
+ char buffer[256];
+
+#ifdef __MPIR_VERSION
+ printf ("[tversion] MPIR: header %d.%d.%d, library %s\n",
+ __MPIR_VERSION, __MPIR_VERSION_MINOR, __MPIR_VERSION_PATCHLEVEL,
+ mpir_version);
+#else
+ printf ("[tversion] GMP: header %d.%d.%d, library %s\n",
+ __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL,
+ gmp_version);
+#endif
+ printf ("[tversion] MPFR tuning parameters from %s\n", MPFR_TUNE_CASE);
+
+ /* Test the MPFR version. */
+ test_version ();
+
+ sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
+ __GNU_MP_VERSION_PATCHLEVEL);
+ if (strcmp (buffer, gmp_version) == 0)
+ return 0;
+ if (__GNU_MP_VERSION_PATCHLEVEL == 0)
+ {
+ sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR);
+ if (strcmp (buffer, gmp_version) == 0)
+ return 0;
+ }
+
+ /* In some cases, it may be acceptable to have different versions for
+ the header and the library, in particular when shared libraries are
+ used (e.g., after a bug-fix upgrade of the library, and versioning
+ ensures that this can be done only when the binary interface is
+ compatible). However, when recompiling software like here, this
+ should never happen (except if GMP has been upgraded between two
+ "make check" runs, but there's no reason for that). A difference
+ between the versions of gmp.h and libgmp probably indicates either
+ a bad configuration or some other inconsistency in the development
+ environment, and it is better to fail (in particular for automatic
+ installations). */
+ printf ("ERROR! The versions of gmp.h (%s) and libgmp (%s) do not "
+ "match.\nThe possible causes are:\n", buffer, gmp_version);
+ printf (" * A bad configuration in your include/library search paths.\n"
+ " * An inconsistency in the include/library search paths of\n"
+ " your development environment; an example:\n"
+ " http://gcc.gnu.org/ml/gcc-help/2010-11/msg00359.html\n"
+ " * GMP has been upgraded after the first \"make check\".\n"
+ " In such a case, try again after a \"make clean\".\n"
+ " * A new or non-standard version naming is used in GMP.\n"
+ " In this case, a patch may already be available on the\n"
+ " MPFR web site. Otherwise please report the problem.\n");
+ printf ("In the first two cases, this may lead to errors, in particular"
+ " with MPFR.\nIf some other tests fail, please solve that"
+ " problem first.\n");
+
+ return 1;
+}
diff --git a/tests/ty0.c b/tests/ty0.c
new file mode 100644
index 0000000..87485d9
--- /dev/null
+++ b/tests/ty0.c
@@ -0,0 +1,98 @@
+/* ty0 -- test file for the Bessel function of second kind (order 0)
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_y0
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_y0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_y0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_inf (x, -1); /* -Inf */
+ mpfr_y0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_y0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(+0)=-Inf */
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_y0 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(-0)=-Inf */
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.00010110100110000000001000100110111100110101100011011111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_y0 for x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_y0 (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error in mpfr_y0 for x=-1, rnd=MPFR_RNDN\n");
+ printf ("Expected NaN\n");
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ test_generic (2, 100, 1);
+
+ data_check ("data/y0", mpfr_y0, "mpfr_y0");
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/ty1.c b/tests/ty1.c
new file mode 100644
index 0000000..233e0e8
--- /dev/null
+++ b/tests/ty1.c
@@ -0,0 +1,98 @@
+/* ty1 -- test file for the Bessel function of second kind (order 1)
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_y1
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
+#include "tgeneric.c"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_y1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_y1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_inf (x, -1); /* -Inf */
+ mpfr_y1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_y1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y1(+0)=-Inf */
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_y1 (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y1(-0)=-Inf */
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.110001111111110110010000001111101011001101011100101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_y1 for x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_si (x, -1, MPFR_RNDN);
+ mpfr_y1 (y, x, MPFR_RNDN);
+ if (!mpfr_nan_p (y))
+ {
+ printf ("Error in mpfr_y1 for x=-1, rnd=MPFR_RNDN\n");
+ printf ("Expected NaN\n");
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ test_generic (2, 100, 1);
+
+ data_check ("data/y1", mpfr_y1, "mpfr_y1");
+
+ tests_end_mpfr ();
+
+ return 0;
+}
diff --git a/tests/tyn.c b/tests/tyn.c
new file mode 100644
index 0000000..93ea4f6
--- /dev/null
+++ b/tests/tyn.c
@@ -0,0 +1,192 @@
+/* tyn -- test file for the Bessel function of second kind
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+int
+main (int argc, char *argv[])
+{
+ mpfr_t x, y;
+ long n;
+ mpfr_prec_t prec = 53;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+
+ if (argc != 1)
+ {
+ if (argc != 4)
+ {
+ printf ("Usage: tyn n x prec\n");
+ exit (1);
+ }
+ n = atoi (argv[1]);
+ prec = atoi (argv[3]);
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (y, prec);
+ mpfr_set_str (x, argv[2], 10, MPFR_RNDN);
+ mpfr_yn (y, n, x, MPFR_RNDN);
+ printf ("Y(%ld,", n);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf (")=");
+ mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN);
+ printf ("\n");
+ goto end;
+ }
+
+ /* special values */
+ mpfr_set_nan (x);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1); /* +Inf */
+ mpfr_yn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y));
+
+ mpfr_set_inf (x, -1); /* -Inf */
+ mpfr_yn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */
+ mpfr_yn (y, 0, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(+0)=-Inf */
+ mpfr_yn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y17(+0)=-Inf */
+ mpfr_yn (y, -17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_POS (y)); /* y(-17,+0)=+Inf */
+ mpfr_yn (y, -42, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y(-42,+0)=-Inf */
+
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ mpfr_neg (x, x, MPFR_RNDN); /* -0 */
+ mpfr_yn (y, 0, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y0(-0)=-Inf */
+ mpfr_yn (y, 17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y17(-0)=-Inf */
+ mpfr_yn (y, -17, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_POS (y)); /* y(-17,-0)=+Inf */
+ mpfr_yn (y, -42, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_inf_p (y) && MPFR_IS_NEG (y)); /* y(-42,-0)=-Inf */
+
+ mpfr_set_prec (x, 53);
+ mpfr_set_prec (y, 53);
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 0, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.00010110100110000000001000100110111100110101100011011111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=0, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 1, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.110001111111110110010000001111101011001101011100101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=1, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, -1, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.110001111111110110010000001111101011001101011100101");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=-1, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 2, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-1.101001101001001100100010101001000101101000010010001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=2, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, -2, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-1.101001101001001100100010101001000101101000010010001");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=-2, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, 17, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "-0.11000100111000100010101101011000110011001101100001011E60");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=17, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ mpfr_yn (y, -17, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.11000100111000100010101101011000110011001101100001011E60");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=-17, x=1, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ mpfr_yn (y, 1, x, MPFR_RNDN);
+ mpfr_set_str_binary (x, "0.00101010110011011111001100000001101011011001111111");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_yn for n=1, x=17, rnd=MPFR_RNDN\n");
+ printf ("Expected "); mpfr_dump (x);
+ printf ("Got "); mpfr_dump (y);
+ exit (1);
+ }
+
+ end:
+ mpfr_clear (x);
+ mpfr_clear (y);
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tzeta.c b/tests/tzeta.c
new file mode 100644
index 0000000..f279bfb
--- /dev/null
+++ b/tests/tzeta.c
@@ -0,0 +1,406 @@
+/* tzeta -- test file for the Riemann Zeta function
+
+Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+static void
+test1 (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 32);
+ mpfr_init2 (y, 42);
+
+ mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1");
+ mpfr_zeta (y, x, MPFR_RNDN); /* shouldn't crash */
+
+ mpfr_set_prec (x, 40);
+ mpfr_set_prec (y, 50);
+ mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1");
+ mpfr_zeta (y, x, MPFR_RNDU);
+ mpfr_set_prec (x, 50);
+ mpfr_set_str_binary (x, "-0.11111100011100111111101111100011110111001111111111E1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for input on 40 bits, output on 50 bits\n");
+ printf ("Expected "); mpfr_print_binary (x); puts ("");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1");
+ mpfr_zeta (y, x, MPFR_RNDU);
+ mpfr_print_binary (x); puts ("");
+ mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 55);
+ mpfr_set_str_binary (x, "0.11e3");
+ mpfr_zeta (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 55);
+ mpfr_set_str_binary (x, "0.1000001000111000010011000010011000000100100100100010010E1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_zeta (1)\n");
+ printf ("Expected "); mpfr_print_binary (x); puts ("");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
+ mpfr_set_prec (x, 3);
+ mpfr_set_prec (y, 47);
+ mpfr_set_str_binary (x, "0.111e4");
+ mpfr_zeta (y, x, MPFR_RNDN);
+ mpfr_set_prec (x, 47);
+ mpfr_set_str_binary (x, "1.0000000000000100000000111001001010111100101011");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error in mpfr_zeta (2)\n");
+ exit (1);
+ }
+
+ /* coverage test */
+ mpfr_set_prec (x, 7);
+ mpfr_set_str_binary (x, "1.000001");
+ mpfr_set_prec (y, 2);
+ mpfr_zeta (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 64) == 0);
+
+ /* another coverage test */
+ mpfr_set_prec (x, 24);
+ mpfr_set_ui (x, 2, MPFR_RNDN);
+ mpfr_set_prec (y, 2);
+ mpfr_zeta (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 3, -1) == 0);
+
+ mpfr_set_nan (x);
+ mpfr_zeta (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_set_inf (x, 1);
+ mpfr_zeta (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
+
+ mpfr_set_inf (x, -1);
+ mpfr_zeta (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_nan_p (y));
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
+static const char *const val[] = {
+ "-2000", "0.0",
+ "-2.0", "0.0",
+ "-1.0", "-0.000101010101010101010101010101010101010101010101010101010101010",
+ "-0.9", "-0.000110011110011111010001010001100010111101001010100110001110110",
+ /* "-0.8", "-0.000111110011101010001011100011010010000001010011110100010001110",
+ "-0.7", "-0.00100101011011111100110011110011111010111111000110110100010110",
+ "-0.6", "-0.00101100101100100100110111111000110010111010110010111000001100",
+ "-0.5", "-0.00110101001110000000100000011001100100010000111100010001111100",
+ "-0.4", "-0.00111111010001100011110001010010111110010001010101111101110001",
+ "-0.3", "-0.0100101100110111010101010100111011000001001010111010110101010",
+ "-0.2", "-0.0101100110000011101110101011011110101111000010000010110101111",
+ "-0.1", "-0.0110101011001111011101001111011000010001111010110011011111011",
+ "-0.0", "-0.100000000000000000000000000000000000000000000000000000000000",
+ "0.1", "-0.100110100110000010101010101110100000101100100011011001000101",
+ "0.2", "-0.10111011111000100011110111100010010001111010010010010100010110",
+ "0.3", "-0.11100111100100010011001000001011001100110010110101101110110110",
+ "0.4", "-1.0010001010000010000110111000100101001000001011101010110101011",
+ "0.5", "-1.0111010111011001110010110000011111100111001111111110111000110",
+ "0.6", "-1.1111001111100001100111101110010001001000001101100110110000100",
+ "0.7", "-10.110001110100010001110111000101010011110011000110010100101000",
+ "0.8", "-100.01110000000000101000010010000011000000111101100101100011010",
+ "0.9", "-1001.0110111000011011111100111100111011100010001111111010000100",
+ "0.99","-0.11000110110110001101011010110001011010011000110001011100101110E7",
+ "0.997", "-0.10100110011000001100111110011111100011110000111011101110001010E9",
+ "0.9995", "-0.11111001111011011000011110111111010111101001000110001111110010E11",
+ "0.99998", "-0.11000011010011110110110000111011101100001000101101011001110100E16",
+ "1.00001", "0.11000011010100000100100111100010001110100000110101110011111011E17",
+ "1.0002", "0.10011100010001001001111000101010111000011011011111110010110100E13",
+ "1.003","0.10100110111101001001010000000110101101110100001010100000110000E9",
+ "1.04", "11001.100101001000001011000111010110011010000001000010111101101",
+ "1.1", "1010.1001010110011110011010100010001100101001001111111101100001",
+ "1.2", "101.10010111011100011111001001100101101111110000110001101100010",
+ "1.3", "11.111011101001010000111001001110100100000101000101101011010100",
+ "1.4", "11.000110110000010100100101011110110001100001110100100100111111",
+ "1.5", "10.100111001100010010100001011111110111101100010011101011011100",
+ "1.6", "10.010010010010011111110000010011000110101001110011101010100110",
+ "1.7", "10.000011011110010111011110001100110010100010011100011111110010",
+ "1.8", "1.1110000111011001110011001101110101010000011011101100010111001",
+ "1.9", "1.1011111111101111011000011110001100100111100110111101101000101",
+ "2.0", "1.1010010100011010011001100010010100110000011111010011001000110",
+ "42.17", "1.0000000000000000000000000000000000000000001110001110001011001",
+ "-17.42", "-11.101110101010101000000001001000001111111101000100001100101100",
+ "-24.17", "-0.10001111010010011111000010001011111010010111101011000010010011E13"*/
+};
+
+static void
+test2 (void)
+{
+ mpfr_t x, y;
+ int i, n = numberof(val);
+
+ mpfr_inits2 (55, x, y, (mpfr_ptr) 0);
+
+ for(i = 0 ; i < n ; i+=2)
+ {
+ mpfr_set_str1 (x, val[i]);
+ mpfr_zeta(y, x, MPFR_RNDZ);
+ if (mpfr_cmp_str (y, val[i+1] , 2, MPFR_RNDZ))
+ {
+ printf("Wrong result for zeta(%s=", val[i]);
+ mpfr_print_binary (x);
+ printf (").\nGot : ");
+ mpfr_print_binary(y); putchar('\n');
+ printf("Expected: ");
+ mpfr_set_str (y, val[i+1], 2, MPFR_RNDZ);
+ mpfr_print_binary(y); putchar('\n');
+ mpfr_set_prec(y, 65);
+ mpfr_zeta(y, x, MPFR_RNDZ);
+ printf("+ Prec : ");
+ mpfr_print_binary(y); putchar('\n');
+ exit(1);
+ }
+ }
+ mpfr_clears (x, y, (mpfr_ptr) 0);
+}
+
+#define TEST_FUNCTION mpfr_zeta
+#define TEST_RANDOM_EMIN -48
+#define TEST_RANDOM_EMAX 31
+#include "tgeneric.c"
+
+/* Usage: tzeta - generic tests
+ tzeta s prec rnd_mode - compute zeta(s) with precision 'prec'
+ and rounding mode 'mode' */
+int
+main (int argc, char *argv[])
+{
+ mpfr_t s, y, z;
+ mpfr_prec_t prec;
+ mpfr_rnd_t rnd_mode;
+ int inex;
+
+ tests_start_mpfr ();
+
+ if (argc != 1 && argc != 4)
+ {
+ printf ("Usage: tzeta\n"
+ " or tzeta s prec rnd_mode\n");
+ exit (1);
+ }
+
+ if (argc == 4)
+ {
+ prec = atoi(argv[2]);
+ mpfr_init2 (s, prec);
+ mpfr_init2 (z, prec);
+ mpfr_set_str (s, argv[1], 10, MPFR_RNDN);
+ rnd_mode = (mpfr_rnd_t) atoi(argv[3]);
+
+ mpfr_zeta (z, s, rnd_mode);
+ mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN);
+ printf ("\n");
+
+ mpfr_clear (s);
+ mpfr_clear (z);
+
+ return 0;
+ }
+
+ test1();
+
+ mpfr_init2 (s, MPFR_PREC_MIN);
+ mpfr_init2 (y, MPFR_PREC_MIN);
+ mpfr_init2 (z, MPFR_PREC_MIN);
+
+
+ /* the following seems to loop */
+ mpfr_set_prec (s, 6);
+ mpfr_set_prec (z, 6);
+ mpfr_set_str_binary (s, "1.10010e4");
+ mpfr_zeta (z, s, MPFR_RNDZ);
+
+
+ mpfr_set_prec (s, 53);
+ mpfr_set_prec (y, 53);
+ mpfr_set_prec (z, 53);
+
+ mpfr_set_ui (s, 1, MPFR_RNDN);
+ mpfr_clear_divby0();
+ mpfr_zeta (z, s, MPFR_RNDN);
+ if (!mpfr_inf_p (z) || MPFR_SIGN (z) < 0 || !mpfr_divby0_p())
+ {
+ printf ("Error in mpfr_zeta for s = 1 (should be +inf) with divby0 flag\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (s, "0.1100011101110111111111111010000110010111001011001011");
+ mpfr_set_str_binary (y, "-0.11111101111011001001001111111000101010000100000100100E2");
+ mpfr_zeta (z, s, MPFR_RNDN);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (1,RNDN)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDZ);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (1,RNDZ)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDU);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (1,RNDU)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDD);
+ mpfr_nexttoinf (y);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (1,RNDD)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (s, "0.10001011010011100110010001100100001011000010011001011");
+ mpfr_set_str_binary (y, "-0.11010011010010101101110111011010011101111101111010110E1");
+ mpfr_zeta (z, s, MPFR_RNDN);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (2,RNDN)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDZ);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (2,RNDZ)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDU);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (2,RNDU)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDD);
+ mpfr_nexttoinf (y);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (2,RNDD)\n");
+ exit (1);
+ }
+
+ mpfr_set_str_binary (s, "0.1100111110100001111110111000110101111001011101000101");
+ mpfr_set_str_binary (y, "-0.10010111010110000111011111001101100001111011000001010E3");
+ mpfr_zeta (z, s, MPFR_RNDN);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (3,RNDN)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDD);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (3,RNDD)\n");
+ exit (1);
+ }
+ mpfr_nexttozero (y);
+ mpfr_zeta (z, s, MPFR_RNDZ);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (3,RNDZ)\n");
+ exit (1);
+ }
+ mpfr_zeta (z, s, MPFR_RNDU);
+ if (mpfr_cmp (z, y) != 0)
+ {
+ printf ("Error in mpfr_zeta (3,RNDU)\n");
+ exit (1);
+ }
+
+ mpfr_set_str (s, "-400000001", 10, MPFR_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDN);
+ if (!(mpfr_inf_p (z) && MPFR_SIGN(z) < 0))
+ {
+ printf ("Error in mpfr_zeta (-400000001)\n");
+ exit (1);
+ }
+ mpfr_set_str (s, "-400000003", 10, MPFR_RNDZ);
+ mpfr_zeta (z, s, MPFR_RNDN);
+ if (!(mpfr_inf_p (z) && MPFR_SIGN(z) > 0))
+ {
+ printf ("Error in mpfr_zeta (-400000003)\n");
+ exit (1);
+ }
+
+ mpfr_set_prec (s, 34);
+ mpfr_set_prec (z, 34);
+ mpfr_set_str_binary (s, "-1.111111100001011110000010001010000e-35");
+ mpfr_zeta (z, s, MPFR_RNDD);
+ mpfr_set_str_binary (s, "-1.111111111111111111111111111111111e-2");
+ if (mpfr_cmp (s, z))
+ {
+ printf ("Error in mpfr_zeta, prec=34, MPFR_RNDD\n");
+ mpfr_dump (z);
+ exit (1);
+ }
+
+ /* bug found by nightly tests on June 7, 2007 */
+ mpfr_set_prec (s, 23);
+ mpfr_set_prec (z, 25);
+ mpfr_set_str_binary (s, "-1.0110110110001000000000e-27");
+ mpfr_zeta (z, s, MPFR_RNDN);
+ mpfr_set_prec (s, 25);
+ mpfr_set_str_binary (s, "-1.111111111111111111111111e-2");
+ if (mpfr_cmp (s, z))
+ {
+ printf ("Error in mpfr_zeta, prec=25, MPFR_RNDN\n");
+ printf ("expected "); mpfr_dump (s);
+ printf ("got "); mpfr_dump (z);
+ exit (1);
+ }
+
+ /* bug reported by Kevin Rauch on 26 Oct 2007 */
+ mpfr_set_prec (s, 128);
+ mpfr_set_prec (z, 128);
+ mpfr_set_str_binary (s, "-0.1000000000000000000000000000000000000000000000000000000000000001E64");
+ inex = mpfr_zeta (z, s, MPFR_RNDN);
+ MPFR_ASSERTN (mpfr_inf_p (z) && MPFR_SIGN (z) < 0 && inex < 0);
+ inex = mpfr_zeta (z, s, MPFR_RNDU);
+ mpfr_set_inf (s, -1);
+ mpfr_nextabove (s);
+ MPFR_ASSERTN (mpfr_equal_p (z, s) && inex > 0);
+
+ mpfr_clear (s);
+ mpfr_clear (y);
+ mpfr_clear (z);
+
+ test_generic (2, 70, 5);
+ test2 ();
+
+ tests_end_mpfr ();
+ return 0;
+}
diff --git a/tests/tzeta_ui.c b/tests/tzeta_ui.c
new file mode 100644
index 0000000..b9b569b
--- /dev/null
+++ b/tests/tzeta_ui.c
@@ -0,0 +1,122 @@
+/* Test file for mpfr_zeta_ui.
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpfr-test.h"
+
+#define TEST_FUNCTION mpfr_zeta_ui
+
+int
+main (int argc, char *argv[])
+{
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0)
+ unsigned int prec, yprec;
+ int rnd;
+ mpfr_t x, y, z, t;
+ unsigned long n;
+ int inex;
+
+ tests_start_mpfr ();
+
+ mpfr_init (x);
+ mpfr_init (y);
+ mpfr_init (z);
+ mpfr_init (t);
+
+ if (argc >= 3) /* tzeta_ui n prec [rnd] */
+ {
+ mpfr_set_prec (x, atoi (argv[2]));
+ mpfr_zeta_ui (x, atoi (argv[1]),
+ argc > 3 ? (mpfr_rnd_t) atoi (argv[3]) : MPFR_RNDN);
+ mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
+ printf ("\n");
+ goto clear_and_exit;
+ }
+
+ mpfr_set_prec (x, 33);
+ mpfr_set_prec (y, 33);
+ mpfr_zeta_ui (x, 3, MPFR_RNDZ);
+ mpfr_set_str_binary (y, "0.100110011101110100000000001001111E1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for zeta(3), prec=33, MPFR_RNDZ\n");
+ printf ("expected "); mpfr_dump (y);
+ printf ("got "); mpfr_dump (x);
+ exit (1);
+ }
+
+ mpfr_clear_divby0 ();
+ inex = mpfr_zeta_ui (x, 0, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0 && mpfr_cmp_si_2exp (x, -1, -1) == 0
+ && !mpfr_divby0_p ());
+
+ mpfr_clear_divby0 ();
+ inex = mpfr_zeta_ui (x, 1, MPFR_RNDN);
+ MPFR_ASSERTN (inex == 0 && MPFR_IS_INF (x) && MPFR_IS_POS (x)
+ && mpfr_divby0_p ());
+
+ for (prec = MPFR_PREC_MIN; prec <= 100; prec++)
+ {
+ mpfr_set_prec (x, prec);
+ mpfr_set_prec (z, prec);
+ mpfr_set_prec (t, prec);
+ yprec = prec + 10;
+ mpfr_set_prec (y, yprec);
+
+ for (n = 0; n < 50; n++)
+ for (rnd = 0; rnd < MPFR_RND_MAX; rnd++)
+ {
+ mpfr_zeta_ui (y, n, MPFR_RNDN);
+ if (mpfr_can_round (y, yprec, MPFR_RNDN, MPFR_RNDZ, prec
+ + (rnd == MPFR_RNDN)))
+ {
+ mpfr_set (t, y, (mpfr_rnd_t) rnd);
+ mpfr_zeta_ui (z, n, (mpfr_rnd_t) rnd);
+ if (mpfr_cmp (t, z))
+ {
+ printf ("results differ for n=%lu", n);
+ printf (" prec=%u rnd_mode=%s\n", prec,
+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
+ printf (" got ");
+ mpfr_dump (z);
+ printf (" expected ");
+ mpfr_dump (t);
+ printf (" approx ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ }
+ }
+ }
+
+ clear_and_exit:
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+
+ tests_end_mpfr ();
+#endif
+ return 0;
+}
diff --git a/tools/ck-copyright-notice b/tools/ck-copyright-notice
new file mode 100755
index 0000000..aec5831
--- /dev/null
+++ b/tools/ck-copyright-notice
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This script 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.
+
+# ck-copyright-notice can be run from the tools directory
+dir=`pwd`
+[ -d src ] || [ "`basename "$dir"`" != tools ] || cd ..
+
+# Note: if paragraphs are reformatted, this may need to be updated.
+
+lgpl="`sed -n '/version [0-9.]* or any later version/ {
+ s/.*version //
+ s/ or.*//
+ p
+ q
+ }' doc/mpfr.texi`"
+
+# Do not use "find ... | while read file do ... done" because the "do"
+# part needs to be run in the current shell, and some shells behave in
+# a different way.
+srctests=`find src tests -name '*.[ch]'`
+
+err=0
+for file in $srctests
+do
+ y=""
+ case $file in
+ tests/RRTest.c)
+ # This file doesn't have a copyright notice, but isn't distributed.
+ continue ;;
+ src/mpfr-longlong.h)
+ # This file (which comes from GMP) has a specific copyright notice.
+ continue ;;
+ src/get_patches.c)
+ file="tools/get_patches.sh" ;;
+ */mparam.h)
+ y="2005," ;;
+ esac
+ grep -q "Copyright $y.* Free Software Foundation" "$file" && \
+ grep -q "GNU MPFR Library" "$file" && \
+ grep -q "either version $lgpl of the License" "$file" && continue
+ echo "Possibly missing or incorrect copyright notice in $file"
+ err=1
+done
+
+exit $err
diff --git a/tools/ck-version-info b/tools/ck-version-info
new file mode 100755
index 0000000..7d39d8a
--- /dev/null
+++ b/tools/ck-version-info
@@ -0,0 +1,67 @@
+#!/usr/bin/env perl
+
+# Note: this script must not be used to build MPFR due to the
+# dependency on perl, but this is OK for "make dist".
+
+# Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This script 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.
+
+use strict;
+use Cwd;
+
+if (! -d 'src')
+ {
+ getcwd() =~ m,/tools$,
+ or die "Execute $0 from the MPFR source directory\n";
+ chdir '..' or die "$!\n$0: can't change cwd\n";
+ }
+
+open VERSION, '<', 'VERSION'
+ or die "$!\n$0: can't open VERSION file\n";
+my $version = do { local $/; <VERSION> };
+close VERSION or die "$!\n$0: can't close VERSION file\n";
+
+my ($mv,$pl,$suf) = $version =~ /^(\d+\.\d+)\.(\d+)(-\S+)?/
+ or die "$0: bad VERSION format\n";
+
+open MF, '<', 'src/Makefile.am'
+ or die "$!\n$0: can't open Makefile.am file\n";
+my $cur = 0;
+my $age = -1;
+my $vinfo; # expected -version-info value
+while (<MF>)
+ {
+ last if $cur && ! /^\s*(#.*)$/;
+ /^#\s+(\d+\.\d+)\.x\s+(\d+):x:(\d+)/ or next;
+ $2 == ++$cur or die "$0: bad CURRENT ($2)";
+ $3 == 0 || $3 == $age + 1 or die "$0: bad AGE ($3)";
+ $age = $3;
+ $mv eq $1 and $vinfo = "$cur:$pl:$age";
+ }
+/^libmpfr_la_LDFLAGS\s+=.*\s-version-info\s+(\d+:\d+:\d+)\s/
+ or die "$0: missing correct libmpfr_la_LDFLAGS line";
+close MF or die "$!\n$0: can't close Makefile.am file\n";
+$suf eq '-dev' || $vinfo eq $1
+ or die "$0: bad -version-info value ($1 instead of $vinfo)\n";
+
+open CONFIGURE, '<', 'configure.ac'
+ or die "$!\n$0: can't open configure.ac file\n";
+my $dllversion = $cur - $age;
+my $dllvinconf;
+while (<CONFIGURE>)
+ {
+ /^\s*LIBMPFR_LDFLAGS\s*=.*-Wl,--output-def,\.libs\/libmpfr-(\d+)\.dll\.def/
+ and $dllvinconf = $1, last;
+ }
+close CONFIGURE or die "$!\n$0: can't close configure.ac file\n";
+defined $dllvinconf or die "$0: missing correct LIBMPFR_LDFLAGS line\n";
+$suf eq '-dev' || $dllversion eq $dllvinconf
+ or die "$0: bad libmpfr.dll-version value (libmpfr-$dllvinconf.dll.def".
+ " instead of libmpfr-$dllversion.dll.def)\n";
diff --git a/tools/get_patches.sh b/tools/get_patches.sh
new file mode 100755
index 0000000..872b006
--- /dev/null
+++ b/tools/get_patches.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+cat <<EOF
+/* mpfr_get_patches -- Patches that have been applied
+
+Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+const char *
+mpfr_get_patches (void)
+{
+EOF
+
+echo ' return "'`cat PATCHES`'";'
+echo '}'
diff --git a/tune/Makefile.am b/tune/Makefile.am
new file mode 100644
index 0000000..f330456
--- /dev/null
+++ b/tune/Makefile.am
@@ -0,0 +1,38 @@
+# Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+
+
+EXTRA_PROGRAMS = tuneup speed bidimensional_sample
+
+tuneup_SOURCES = tuneup.c
+tuneup_LDADD = -lspeed $(top_builddir)/src/libmpfr.la $(TUNE_LIBS)
+tuneup_LDFLAGS = -static
+
+speed_SOURCES = speed.c
+speed_LDADD = -lspeed $(top_builddir)/src/libmpfr.la $(TUNE_LIBS)
+speed_LDFLAGS = -static
+
+bidimensional_sample_SOURCES = bidimensional_sample.c
+bidimensional_sample_LDADD = -lspeed $(top_builddir)/src/libmpfr.la $(TUNE_LIBS)
+bidimensional_sample_LDFLAGS = -static
+
+INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
+
+tune:
+ $(MAKE) $(AM_MAKEFLAGS) tuneup$(EXEEXT)
+ ./tuneup$(EXEEXT) -v
+ mv mparam.h $(top_builddir)/src/
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) clean
+ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
+
+$(top_builddir)/src/libmpfr.la:
+ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
+
+CLEANFILES = $(EXTRA_PROGRAMS) mparam.h
diff --git a/tune/Makefile.in b/tune/Makefile.in
new file mode 100644
index 0000000..df87228
--- /dev/null
+++ b/tune/Makefile.in
@@ -0,0 +1,553 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@
+
+# Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+# This Makefile.am 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.
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+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@
+EXTRA_PROGRAMS = tuneup$(EXEEXT) speed$(EXEEXT) \
+ bidimensional_sample$(EXEEXT)
+subdir = tune
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_bidimensional_sample_OBJECTS = bidimensional_sample.$(OBJEXT)
+bidimensional_sample_OBJECTS = $(am_bidimensional_sample_OBJECTS)
+am__DEPENDENCIES_1 =
+bidimensional_sample_DEPENDENCIES = $(top_builddir)/src/libmpfr.la \
+ $(am__DEPENDENCIES_1)
+bidimensional_sample_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(bidimensional_sample_LDFLAGS) $(LDFLAGS) -o $@
+am_speed_OBJECTS = speed.$(OBJEXT)
+speed_OBJECTS = $(am_speed_OBJECTS)
+speed_DEPENDENCIES = $(top_builddir)/src/libmpfr.la \
+ $(am__DEPENDENCIES_1)
+speed_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(speed_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_tuneup_OBJECTS = tuneup.$(OBJEXT)
+tuneup_OBJECTS = $(am_tuneup_OBJECTS)
+tuneup_DEPENDENCIES = $(top_builddir)/src/libmpfr.la \
+ $(am__DEPENDENCIES_1)
+tuneup_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(tuneup_LDFLAGS) \
+ $(LDFLAGS) -o $@
+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 = $(bidimensional_sample_SOURCES) $(speed_SOURCES) \
+ $(tuneup_SOURCES)
+DIST_SOURCES = $(bidimensional_sample_SOURCES) $(speed_SOURCES) \
+ $(tuneup_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATAFILES = @DATAFILES@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+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@
+LIBMPFR_LDFLAGS = @LIBMPFR_LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MPFR_LDFLAGS = @MPFR_LDFLAGS@
+MPFR_LIBM = @MPFR_LIBM@
+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@
+TUNE_LIBS = @TUNE_LIBS@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+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@
+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@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+tuneup_SOURCES = tuneup.c
+tuneup_LDADD = -lspeed $(top_builddir)/src/libmpfr.la $(TUNE_LIBS)
+tuneup_LDFLAGS = -static
+speed_SOURCES = speed.c
+speed_LDADD = -lspeed $(top_builddir)/src/libmpfr.la $(TUNE_LIBS)
+speed_LDFLAGS = -static
+bidimensional_sample_SOURCES = bidimensional_sample.c
+bidimensional_sample_LDADD = -lspeed $(top_builddir)/src/libmpfr.la $(TUNE_LIBS)
+bidimensional_sample_LDFLAGS = -static
+INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
+CLEANFILES = $(EXTRA_PROGRAMS) mparam.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tune/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu tune/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+bidimensional_sample$(EXEEXT): $(bidimensional_sample_OBJECTS) $(bidimensional_sample_DEPENDENCIES) $(EXTRA_bidimensional_sample_DEPENDENCIES)
+ @rm -f bidimensional_sample$(EXEEXT)
+ $(bidimensional_sample_LINK) $(bidimensional_sample_OBJECTS) $(bidimensional_sample_LDADD) $(LIBS)
+speed$(EXEEXT): $(speed_OBJECTS) $(speed_DEPENDENCIES) $(EXTRA_speed_DEPENDENCIES)
+ @rm -f speed$(EXEEXT)
+ $(speed_LINK) $(speed_OBJECTS) $(speed_LDADD) $(LIBS)
+tuneup$(EXEEXT): $(tuneup_OBJECTS) $(tuneup_DEPENDENCIES) $(EXTRA_tuneup_DEPENDENCIES)
+ @rm -f tuneup$(EXEEXT)
+ $(tuneup_LINK) $(tuneup_OBJECTS) $(tuneup_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bidimensional_sample.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speed.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tuneup.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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
+
+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) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ 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; }; }'`; \
+ 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) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; }; }'`; \
+ 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
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+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)
+
+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-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+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
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir 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-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+tune:
+ $(MAKE) $(AM_MAKEFLAGS) tuneup$(EXEEXT)
+ ./tuneup$(EXEEXT) -v
+ mv mparam.h $(top_builddir)/src/
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) clean
+ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
+
+$(top_builddir)/src/libmpfr.la:
+ cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
+
+# 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:
diff --git a/tune/bidimensional_sample.c b/tune/bidimensional_sample.c
new file mode 100644
index 0000000..64a21d8
--- /dev/null
+++ b/tune/bidimensional_sample.c
@@ -0,0 +1,468 @@
+/* [Description]
+
+Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <time.h>
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#undef _PROTO
+#define _PROTO __GMP_PROTO
+#include "speed.h"
+
+/* Let f be a function for which we have several implementations f1, f2... */
+/* We wish to have a quick overview of which implementation is the best */
+/* in function of the point x where f(x) is computed and of the prectision */
+/* prec requested by the user. */
+/* This is performed by drawing a 2D graphic with color indicating which */
+/* method is the best. */
+/* For building this graphic, the following structur is used (see the core */
+/* of generate_2D_sample for an explanation of each field. */
+struct speed_params2D
+{
+ /* x-window: [min_x, max_x] or [2^min_x, 2^max_x] */
+ /* or [-2^(max_x), -2^(min_x)] U [2^min_x, 2^max_x] */
+ /* depending on the value of logarithmic_scale_x */
+ double min_x;
+ double max_x;
+
+ /* prec-window: [min_prec, max_prec] */
+ mpfr_prec_t min_prec;
+ mpfr_prec_t max_prec;
+
+ /* number of sample points for the x-axis and the prec-axis */
+ int nb_points_x;
+ int nb_points_prec;
+
+ /* should the sample points be logarithmically scaled or not */
+ int logarithmic_scale_x;
+ int logarithmic_scale_prec;
+
+ /* list of functions g1, g2... measuring the execution time of f1, f2... */
+ /* when given a point x and a precision prec stored in s. */
+ /* We use s->xp to store the significant of x, s->r to store its exponent */
+ /* s->align_xp to store its sign, and s->size to store prec. */
+ double (**speed_funcs) (struct speed_params *s);
+};
+
+/* Given an array t of nb_functions double indicating the timings of several */
+/* implementations, return i, such that t[i] is the best timing. */
+int
+find_best (double *t, int nb_functions)
+{
+ int i, ibest;
+ double best;
+
+ if (nb_functions<=0)
+ {
+ fprintf (stderr, "There is no function\n");
+ abort ();
+ }
+
+ ibest = 0;
+ best = t[0];
+ for (i=1; i<nb_functions; i++)
+ {
+ if (t[i]<best)
+ {
+ best = t[i];
+ ibest = i;
+ }
+ }
+
+ return ibest;
+}
+
+void generate_2D_sample (FILE *output, struct speed_params2D param)
+{
+ mpfr_t temp;
+ double incr_prec;
+ mpfr_t incr_x;
+ mpfr_t x, x2;
+ double prec;
+ struct speed_params s;
+ int i;
+ int test;
+ int nb_functions;
+ double *t; /* store the timing of each implementation */
+
+ /* We first determine how many implementations we have */
+ nb_functions = 0;
+ while (param.speed_funcs[nb_functions] != NULL)
+ nb_functions++;
+
+ t = malloc (nb_functions * sizeof (double));
+ if (t == NULL)
+ {
+ fprintf (stderr, "Can't allocate memory.\n");
+ abort ();
+ }
+
+
+ mpfr_init2 (temp, MPFR_SMALL_PRECISION);
+
+ /* The precision is sampled from min_prec to max_prec with */
+ /* approximately nb_points_prec points. If logarithmic_scale_prec */
+ /* is true, the precision is multiplied by incr_prec at each */
+ /* step. Otherwise, incr_prec is added at each step. */
+ if (param.logarithmic_scale_prec)
+ {
+ mpfr_set_ui (temp, (unsigned long int)param.max_prec, MPFR_RNDU);
+ mpfr_div_ui (temp, temp, (unsigned long int)param.min_prec, MPFR_RNDU);
+ mpfr_root (temp, temp,
+ (unsigned long int)param.nb_points_prec, MPFR_RNDU);
+ incr_prec = mpfr_get_d (temp, MPFR_RNDU);
+ }
+ else
+ {
+ incr_prec = (double)param.max_prec - (double)param.min_prec;
+ incr_prec = incr_prec/((double)param.nb_points_prec);
+ }
+
+ /* The points x are sampled according to the following rule: */
+ /* If logarithmic_scale_x = 0: */
+ /* nb_points_x points are equally distributed between min_x and max_x */
+ /* If logarithmic_scale_x = 1: */
+ /* nb_points_x points are sampled from 2^(min_x) to 2^(max_x). At */
+ /* each step, the current point is multiplied by incr_x. */
+ /* If logarithmic_scale_x = -1: */
+ /* nb_points_x/2 points are sampled from -2^(max_x) to -2^(min_x) */
+ /* (at each step, the current point is divided by incr_x); and */
+ /* nb_points_x/2 points are sampled from 2^(min_x) to 2^(max_x) */
+ /* (at each step, the current point is multiplied by incr_x). */
+ mpfr_init2 (incr_x, param.max_prec);
+ if (param.logarithmic_scale_x == 0)
+ {
+ mpfr_set_d (incr_x,
+ (param.max_x - param.min_x)/(double)param.nb_points_x,
+ MPFR_RNDU);
+ }
+ else if (param.logarithmic_scale_x == -1)
+ {
+ mpfr_set_d (incr_x,
+ 2.*(param.max_x - param.min_x)/(double)param.nb_points_x,
+ MPFR_RNDU);
+ mpfr_exp2 (incr_x, incr_x, MPFR_RNDU);
+ }
+ else
+ { /* other values of param.logarithmic_scale_x are considered as 1 */
+ mpfr_set_d (incr_x,
+ (param.max_x - param.min_x)/(double)param.nb_points_x,
+ MPFR_RNDU);
+ mpfr_exp2 (incr_x, incr_x, MPFR_RNDU);
+ }
+
+ /* Main loop */
+ mpfr_init2 (x, param.max_prec);
+ mpfr_init2 (x2, param.max_prec);
+ prec = (double)param.min_prec;
+ while (prec <= param.max_prec)
+ {
+ printf ("prec = %d\n", (int)prec);
+ if (param.logarithmic_scale_x == 0)
+ mpfr_set_d (temp, param.min_x, MPFR_RNDU);
+ else if (param.logarithmic_scale_x == -1)
+ {
+ mpfr_set_d (temp, param.max_x, MPFR_RNDD);
+ mpfr_exp2 (temp, temp, MPFR_RNDD);
+ mpfr_neg (temp, temp, MPFR_RNDU);
+ }
+ else
+ {
+ mpfr_set_d (temp, param.min_x, MPFR_RNDD);
+ mpfr_exp2 (temp, temp, MPFR_RNDD);
+ }
+
+ /* We perturb x a little bit, in order to avoid trailing zeros that */
+ /* might change the behavior of algorithms. */
+ mpfr_const_pi (x, MPFR_RNDN);
+ mpfr_div_2ui (x, x, 7, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ mpfr_mul (x, x, temp, MPFR_RNDN);
+
+ test = 1;
+ while (test)
+ {
+ mpfr_fprintf (output, "%e\t", mpfr_get_d (x, MPFR_RNDN));
+ mpfr_fprintf (output, "%Pu\t", (mpfr_prec_t)prec);
+
+ s.r = (mp_limb_t)mpfr_get_exp (x);
+ s.size = (mpfr_prec_t)prec;
+ s.align_xp = (mpfr_sgn (x) > 0)?1:2;
+ mpfr_set_prec (x2, (mpfr_prec_t)prec);
+ mpfr_set (x2, x, MPFR_RNDU);
+ s.xp = x2->_mpfr_d;
+
+ for (i=0; i<nb_functions; i++)
+ {
+ t[i] = speed_measure (param.speed_funcs[i], &s);
+ mpfr_fprintf (output, "%e\t", t[i]);
+ }
+ fprintf (output, "%d\n", 1 + find_best (t, nb_functions));
+
+ if (param.logarithmic_scale_x == 0)
+ {
+ mpfr_add (x, x, incr_x, MPFR_RNDU);
+ if (mpfr_cmp_d (x, param.max_x) > 0)
+ test=0;
+ }
+ else
+ {
+ if (mpfr_sgn (x) < 0 )
+ { /* if x<0, it means that logarithmic_scale_x=-1 */
+ mpfr_div (x, x, incr_x, MPFR_RNDU);
+ mpfr_abs (temp, x, MPFR_RNDD);
+ mpfr_log2 (temp, temp, MPFR_RNDD);
+ if (mpfr_cmp_d (temp, param.min_x) < 0)
+ mpfr_neg (x, x, MPFR_RNDN);
+ }
+ else
+ {
+ mpfr_mul (x, x, incr_x, MPFR_RNDU);
+ mpfr_set (temp, x, MPFR_RNDD);
+ mpfr_log2 (temp, temp, MPFR_RNDD);
+ if (mpfr_cmp_d (temp, param.max_x) > 0)
+ test=0;
+ }
+ }
+ }
+
+ prec = ( (param.logarithmic_scale_prec) ? (prec * incr_prec)
+ : (prec + incr_prec) );
+ fprintf (output, "\n");
+ }
+
+ free (t);
+ mpfr_clear (incr_x);
+ mpfr_clear (x);
+ mpfr_clear (x2);
+ mpfr_clear (temp);
+
+ return;
+}
+
+#define SPEED_MPFR_FUNC_2D(mean_func) \
+ do \
+ { \
+ double t; \
+ unsigned i; \
+ mpfr_t w, x; \
+ mp_size_t size; \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, (mpfr_exp_t) s->r); \
+ if (s->align_xp == 2) MPFR_SET_NEG (x); \
+ \
+ mpfr_init2 (w, s->size); \
+ speed_starttime (); \
+ i = s->reps; \
+ \
+ do \
+ mean_func (w, x, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ mpfr_clear (w); \
+ return t; \
+ } \
+ while (0)
+
+mpfr_prec_t mpfr_exp_2_threshold;
+mpfr_prec_t old_threshold = MPFR_EXP_2_THRESHOLD;
+#undef MPFR_EXP_2_THRESHOLD
+#define MPFR_EXP_2_THRESHOLD mpfr_exp_2_threshold
+#include "exp_2.c"
+
+double
+timing_exp1 (struct speed_params *s)
+{
+ mpfr_exp_2_threshold = s->size+1;
+ SPEED_MPFR_FUNC_2D (mpfr_exp_2);
+}
+
+double
+timing_exp2 (struct speed_params *s)
+{
+ mpfr_exp_2_threshold = s->size-1;
+ SPEED_MPFR_FUNC_2D (mpfr_exp_2);
+}
+
+double
+timing_exp3 (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC_2D (mpfr_exp_3);
+}
+
+
+#include "ai.c"
+double
+timing_ai1 (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC_2D (mpfr_ai1);
+}
+
+double
+timing_ai2 (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC_2D (mpfr_ai2);
+}
+
+/* These functions are for testing purpose only */
+/* They are used to draw which method is actually used */
+double
+virtual_timing_ai1 (struct speed_params *s)
+{
+ double t;
+ unsigned i;
+ mpfr_t w, x;
+ mp_size_t size;
+ mpfr_t temp1, temp2;
+
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN);
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX);
+
+ size = (s->size-1)/GMP_NUMB_BITS+1;
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT;
+ MPFR_TMP_INIT1 (s->xp, x, s->size);
+ MPFR_SET_EXP (x, (mpfr_exp_t) s->r);
+ if (s->align_xp == 2) MPFR_SET_NEG (x);
+
+ mpfr_init2 (w, s->size);
+ speed_starttime ();
+ i = s->reps;
+
+ mpfr_init2 (temp1, MPFR_SMALL_PRECISION);
+ mpfr_init2 (temp2, MPFR_SMALL_PRECISION);
+
+ mpfr_set (temp1, x, MPFR_SMALL_PRECISION);
+ mpfr_set_si (temp2, MPFR_AI_THRESHOLD2, MPFR_RNDN);
+ mpfr_mul_ui (temp2, temp2, (unsigned int)MPFR_PREC (w), MPFR_RNDN);
+
+ if (MPFR_IS_NEG (x))
+ mpfr_mul_si (temp1, temp1, MPFR_AI_THRESHOLD1, MPFR_RNDN);
+ else
+ mpfr_mul_si (temp1, temp1, MPFR_AI_THRESHOLD3, MPFR_RNDN);
+
+ mpfr_add (temp1, temp1, temp2, MPFR_RNDN);
+
+ if (mpfr_cmp_si (temp1, MPFR_AI_SCALE) > 0)
+ t = 1000.;
+ else
+ t = 1.;
+
+ mpfr_clear (temp1);
+ mpfr_clear (temp2);
+
+ return t;
+}
+
+double
+virtual_timing_ai2 (struct speed_params *s)
+{
+ double t;
+ unsigned i;
+ mpfr_t w, x;
+ mp_size_t size;
+ mpfr_t temp1, temp2;
+
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN);
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX);
+
+ size = (s->size-1)/GMP_NUMB_BITS+1;
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT;
+ MPFR_TMP_INIT1 (s->xp, x, s->size);
+ MPFR_SET_EXP (x, (mpfr_exp_t) s->r);
+ if (s->align_xp == 2) MPFR_SET_NEG (x);
+
+ mpfr_init2 (w, s->size);
+ speed_starttime ();
+ i = s->reps;
+
+ mpfr_init2 (temp1, MPFR_SMALL_PRECISION);
+ mpfr_init2 (temp2, MPFR_SMALL_PRECISION);
+
+ mpfr_set (temp1, x, MPFR_SMALL_PRECISION);
+ mpfr_set_si (temp2, MPFR_AI_THRESHOLD2, MPFR_RNDN);
+ mpfr_mul_ui (temp2, temp2, (unsigned int)MPFR_PREC (w), MPFR_RNDN);
+
+ if (MPFR_IS_NEG (x))
+ mpfr_mul_si (temp1, temp1, MPFR_AI_THRESHOLD1, MPFR_RNDN);
+ else
+ mpfr_mul_si (temp1, temp1, MPFR_AI_THRESHOLD3, MPFR_RNDN);
+
+ mpfr_add (temp1, temp1, temp2, MPFR_RNDN);
+
+ if (mpfr_cmp_si (temp1, MPFR_AI_SCALE) > 0)
+ t = 1.;
+ else
+ t = 1000.;
+
+ mpfr_clear (temp1);
+ mpfr_clear (temp2);
+
+ return t;
+}
+
+int
+main (void)
+{
+ FILE *output;
+ struct speed_params2D param;
+ double (*speed_funcs[3]) (struct speed_params *s);
+
+ /* char filename[256] = "virtual_timing_ai.dat"; */
+ /* speed_funcs[0] = virtual_timing_ai1; */
+ /* speed_funcs[1] = virtual_timing_ai2; */
+
+ char filename[256] = "airy.dat";
+ speed_funcs[0] = timing_ai1;
+ speed_funcs[1] = timing_ai2;
+
+ speed_funcs[2] = NULL;
+ output = fopen (filename, "w");
+ if (output == NULL)
+ {
+ fprintf (stderr, "Can't open file '%s' for writing.\n", filename);
+ abort ();
+ }
+ param.min_x = -80;
+ param.max_x = 60;
+ param.min_prec = 50;
+ param.max_prec = 1500;
+ param.nb_points_x = 200;
+ param.nb_points_prec = 200;
+ param.logarithmic_scale_x = 0;
+ param.logarithmic_scale_prec = 0;
+ param.speed_funcs = speed_funcs;
+
+ generate_2D_sample (output, param);
+
+ fclose (output);
+ mpfr_free_cache ();
+ return 0;
+}
diff --git a/tune/speed.c b/tune/speed.c
new file mode 100644
index 0000000..1053198
--- /dev/null
+++ b/tune/speed.c
@@ -0,0 +1,283 @@
+/* Tune various threshold of MPFR
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <time.h>
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* extracted from mulders.c */
+#ifdef MPFR_MULHIGH_TAB_SIZE
+static short mulhigh_ktab[MPFR_MULHIGH_TAB_SIZE];
+#else
+static short mulhigh_ktab[] = {MPFR_MULHIGH_TAB};
+#define MPFR_MULHIGH_TAB_SIZE \
+ ((mp_size_t) (sizeof(mulhigh_ktab) / sizeof(mulhigh_ktab[0])))
+#endif
+
+#undef _PROTO
+#define _PROTO __GMP_PROTO
+#include "speed.h"
+
+int verbose;
+
+/* s->size: precision of both input and output
+ s->xp : Mantissa of first input
+ s->yp : mantissa of second input */
+
+#define SPEED_MPFR_FUNC(mean_fun) do { \
+ unsigned i; \
+ mpfr_limb_ptr wp; \
+ double t; \
+ mpfr_t w, x; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, 0); \
+ \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (w, x, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+} while (0)
+
+#define SPEED_MPFR_OP(mean_fun) do { \
+ unsigned i; \
+ mpfr_limb_ptr wp; \
+ double t; \
+ mpfr_t w, x, y; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, 0); \
+ s->yp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->yp, y, s->size); \
+ MPFR_SET_EXP (y, 0); \
+ \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_src (s, s->yp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (w, x, y, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+} while (0)
+
+
+/* First we include all the functions we want to tune inside this program.
+ We can't use GNU MPFR library since the THRESHOLD can't vary */
+
+/* Setup mpfr_mul */
+mpfr_prec_t mpfr_mul_threshold = MPFR_MUL_THRESHOLD;
+static double speed_mpfr_mul (struct speed_params *s) {
+ SPEED_MPFR_OP (mpfr_mul);
+}
+
+
+
+/************************************************
+ * Common functions (inspired by GMP function) *
+ ************************************************/
+#define THRESHOLD_WINDOW 16
+#define THRESHOLD_FINAL_WINDOW 128
+static double domeasure (mpfr_prec_t *threshold,
+ double (*func) (struct speed_params *),
+ mpfr_prec_t p)
+{
+ struct speed_params s;
+ mp_size_t size;
+ double t;
+
+ s.align_xp = s.align_yp = s.align_wp = 64;
+ s.size = p;
+ size = (p - 1)/GMP_NUMB_BITS+1;
+ s.xp = malloc (2*size*sizeof (mp_limb_t));
+ if (s.xp == NULL)
+ {
+ fprintf (stderr, "Can't allocate memory.\n");
+ abort ();
+ }
+ mpn_random (s.xp, size);
+ s.yp = s.xp + size;
+ mpn_random (s.yp, size);
+ t = speed_measure (func, &s);
+ if (t == -1.0)
+ {
+ fprintf (stderr, "Failed to measure function!\n");
+ abort ();
+ }
+ free (s.xp);
+ return t;
+}
+
+/* Tune a function with a simple THRESHOLD
+ The function doesn't depend on another threshold.
+ It assumes that it uses algo1 if p < THRESHOLD
+ and algo2 otherwise.
+ if algo2 is better for low prec, and algo1 better for high prec,
+ the behaviour of this function is undefined. */
+static void
+tune_simple_func (mpfr_prec_t *threshold,
+ double (*func) (struct speed_params *),
+ mpfr_prec_t pstart, mpfr_prec_t pend)
+{
+ double measure;
+ mpfr_prec_t p = pstart;
+ mp_size_t k, n;
+
+ while (p <= pend)
+ {
+ measure = domeasure (threshold, func, p);
+ printf ("prec=%lu mpfr_mul=%e ", p, measure);
+ n = 1 + (p - 1) / GMP_NUMB_BITS;
+ if (n <= MPFR_MUL_THRESHOLD)
+ k = MUL_FFT_THRESHOLD + 1;
+ else if (n < MPFR_MULHIGH_TAB_SIZE)
+ k = mulhigh_ktab[n];
+ else
+ k = 2*n/3;
+ if (k < 0)
+ printf ("[mpn_mul_basecase]\n");
+ else if (k == 0)
+ printf ("[mpfr_mulhigh_n_basecase]\n");
+ else if (k > MUL_FFT_THRESHOLD)
+ printf ("[mpn_mul_n]\n");
+ else
+ printf ("[mpfr_mulhigh_n]\n");
+ p = p + p / 10;
+ }
+}
+
+/*******************************************************
+ * Tune all the threshold of MPFR *
+ * Warning: tune the function in their dependent order!*
+ *******************************************************/
+static void
+all (void)
+{
+ FILE *f = stdout;
+ time_t start_time, end_time;
+ struct tm *tp;
+
+ speed_time_init ();
+ if (verbose) {
+ printf ("Using: %s\n", speed_time_string);
+ printf ("speed_precision %d", speed_precision);
+ if (speed_unittime == 1.0)
+ printf (", speed_unittime 1 cycle");
+ else
+ printf (", speed_unittime %.2e secs", speed_unittime);
+ if (speed_cycletime == 1.0 || speed_cycletime == 0.0)
+ printf (", CPU freq unknown\n");
+ else
+ printf (", CPU freq %.2f MHz\n\n", 1e-6/speed_cycletime);
+ }
+
+ time (&start_time);
+ tp = localtime (&start_time);
+ fprintf (f, "/* Generated by MPFR's tuneup.c, %d-%02d-%02d, ",
+ tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday);
+
+#ifdef __ICC
+ fprintf (f, "icc %d.%d.%d */\n", __ICC / 100, __ICC / 10 % 10, __ICC % 10);
+#elif defined(__GNUC__)
+ fprintf (f, "gcc %d.%d */\n", __GNUC__, __GNUC_MINOR__);
+#elif defined (__SUNPRO_C)
+ fprintf (f, "Sun C %d.%d */\n", __SUNPRO_C / 0x100, __SUNPRO_C % 0x100);
+#elif defined (__sgi) && defined (_COMPILER_VERSION)
+ fprintf (f, "MIPSpro C %d.%d.%d */\n",
+ _COMPILER_VERSION / 100,
+ _COMPILER_VERSION / 10 % 10,
+ _COMPILER_VERSION % 10);
+#elif defined (__DECC) && defined (__DECC_VER)
+ fprintf (f, "DEC C %d */\n", __DECC_VER);
+#else
+ fprintf (f, "system compiler */\n");
+#endif
+ fprintf (f, "\n");
+
+ /* Tune mpfr_mul (threshold is in limbs, but it doesn't matter too much) */
+ if (verbose)
+ printf ("Measuring mpfr_mul with mpfr_mul_threshold=%lu...\n",
+ mpfr_mul_threshold);
+ tune_simple_func (&mpfr_mul_threshold, speed_mpfr_mul,
+ 2*GMP_NUMB_BITS+1, 1000);
+
+ /* End of tuning */
+ time (&end_time);
+ if (verbose)
+ printf ("Complete (took %ld seconds).\n", end_time - start_time);
+}
+
+
+/* Main function */
+int main (int argc, char *argv[])
+{
+ /* Unbuffered so if output is redirected to a file it isn't lost if the
+ program is killed part way through. */
+ setbuf (stdout, NULL);
+ setbuf (stderr, NULL);
+
+ verbose = argc > 1;
+
+ if (verbose)
+ printf ("Tuning MPFR (Coffee time?)...\n");
+
+ all ();
+
+ return 0;
+}
diff --git a/tune/tuneup.c b/tune/tuneup.c
new file mode 100644
index 0000000..2f11633
--- /dev/null
+++ b/tune/tuneup.c
@@ -0,0 +1,1187 @@
+/* Tune various threshold of MPFR
+
+Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+Contributed by the AriC and Caramel projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR 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 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <stdlib.h>
+#include <time.h>
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#undef _PROTO
+#define _PROTO __GMP_PROTO
+#include "speed.h"
+
+int verbose;
+
+/* template for an unary function */
+/* s->size: precision of both input and output
+ s->xp : Mantissa of first input
+ s->yp : mantissa of second input */
+#define SPEED_MPFR_FUNC(mean_fun) \
+ do \
+ { \
+ unsigned i; \
+ mpfr_limb_ptr wp; \
+ double t; \
+ mpfr_t w, x; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, 0); \
+ \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (w, x, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+ } \
+ while (0)
+
+/* same as SPEED_MPFR_FUNC, but for say mpfr_sin_cos (y, z, x, r) */
+#define SPEED_MPFR_FUNC2(mean_fun) \
+ do \
+ { \
+ unsigned i; \
+ mpfr_limb_ptr vp, wp; \
+ double t; \
+ mpfr_t v, w, x; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, 0); \
+ \
+ MPFR_TMP_INIT (vp, v, s->size, size); \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_dst (s, vp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (v, w, x, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+ } \
+ while (0)
+
+/* template for a function like mpfr_mul */
+#define SPEED_MPFR_OP(mean_fun) \
+ do \
+ { \
+ unsigned i; \
+ mpfr_limb_ptr wp; \
+ double t; \
+ mpfr_t w, x, y; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, 0); \
+ s->yp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->yp, y, s->size); \
+ MPFR_SET_EXP (y, 0); \
+ \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_src (s, s->yp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (w, x, y, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+ } \
+ while (0)
+
+/* special template for mpfr_mul(a,b,b) */
+#define SPEED_MPFR_SQR(mean_fun) \
+ do \
+ { \
+ unsigned i; \
+ mpfr_limb_ptr wp; \
+ double t; \
+ mpfr_t w, x; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, 0); \
+ \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (w, x, x, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+ } \
+ while (0)
+
+/* s->size: precision of both input and output
+ s->xp : Mantissa of first input
+ s->r : exponent
+ s->align_xp : sign (1 means positive, 2 means negative)
+*/
+#define SPEED_MPFR_FUNC_WITH_EXPONENT(mean_fun) \
+ do \
+ { \
+ unsigned i; \
+ mpfr_limb_ptr wp; \
+ double t; \
+ mpfr_t w, x; \
+ mp_size_t size; \
+ MPFR_TMP_DECL (marker); \
+ \
+ SPEED_RESTRICT_COND (s->size >= MPFR_PREC_MIN); \
+ SPEED_RESTRICT_COND (s->size <= MPFR_PREC_MAX); \
+ MPFR_TMP_MARK (marker); \
+ \
+ size = (s->size-1)/GMP_NUMB_BITS+1; \
+ s->xp[size-1] |= MPFR_LIMB_HIGHBIT; \
+ MPFR_TMP_INIT1 (s->xp, x, s->size); \
+ MPFR_SET_EXP (x, s->r); \
+ if (s->align_xp == 2) MPFR_SET_NEG (x); \
+ \
+ MPFR_TMP_INIT (wp, w, s->size, size); \
+ \
+ speed_operand_src (s, s->xp, size); \
+ speed_operand_dst (s, wp, size); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ mean_fun (w, x, MPFR_RNDN); \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ MPFR_TMP_FREE (marker); \
+ return t; \
+ } \
+ while (0)
+
+/* First we include all the functions we want to tune inside this program.
+ We can't use the GNU MPFR library since the thresholds are fixed macros. */
+
+/* Setup mpfr_exp_2 */
+mpfr_prec_t mpfr_exp_2_threshold;
+#undef MPFR_EXP_2_THRESHOLD
+#define MPFR_EXP_2_THRESHOLD mpfr_exp_2_threshold
+#include "exp_2.c"
+static double
+speed_mpfr_exp_2 (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC (mpfr_exp_2);
+}
+
+/* Setup mpfr_exp */
+mpfr_prec_t mpfr_exp_threshold;
+#undef MPFR_EXP_THRESHOLD
+#define MPFR_EXP_THRESHOLD mpfr_exp_threshold
+#include "exp.c"
+static double
+speed_mpfr_exp (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC (mpfr_exp);
+}
+
+/* Setup mpfr_sin_cos */
+mpfr_prec_t mpfr_sincos_threshold;
+#undef MPFR_SINCOS_THRESHOLD
+#define MPFR_SINCOS_THRESHOLD mpfr_sincos_threshold
+#include "sin_cos.c"
+#include "cos.c"
+static double
+speed_mpfr_sincos (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC2 (mpfr_sin_cos);
+}
+
+/* Setup mpfr_mul, mpfr_sqr and mpfr_div */
+mpfr_prec_t mpfr_mul_threshold;
+mpfr_prec_t mpfr_sqr_threshold;
+mpfr_prec_t mpfr_div_threshold;
+#undef MPFR_MUL_THRESHOLD
+#define MPFR_MUL_THRESHOLD mpfr_mul_threshold
+#undef MPFR_SQR_THRESHOLD
+#define MPFR_SQR_THRESHOLD mpfr_sqr_threshold
+#undef MPFR_DIV_THRESHOLD
+#define MPFR_DIV_THRESHOLD mpfr_div_threshold
+#include "mul.c"
+#include "div.c"
+static double
+speed_mpfr_mul (struct speed_params *s)
+{
+ SPEED_MPFR_OP (mpfr_mul);
+}
+static double
+speed_mpfr_sqr (struct speed_params *s)
+{
+ SPEED_MPFR_SQR (mpfr_mul);
+}
+static double
+speed_mpfr_div (struct speed_params *s)
+{
+ SPEED_MPFR_OP (mpfr_div);
+}
+
+/************************************************
+ * Common functions (inspired by GMP function) *
+ ************************************************/
+static int
+analyze_data (double *dat, int ndat)
+{
+ double x, min_x;
+ int j, min_j;
+
+ x = 0.0;
+ for (j = 0; j < ndat; j++)
+ if (dat[j] > 0.0)
+ x += dat[j];
+
+ min_x = x;
+ min_j = 0;
+
+ for (j = 0; j < ndat; x -= dat[j], j++)
+ {
+ if (x < min_x)
+ {
+ min_x = x;
+ min_j = j;
+ }
+ }
+ return min_j;
+}
+
+static double
+mpfr_speed_measure (speed_function_t fun, struct speed_params *s, char *m)
+{
+ double t = -1.0;
+ int i;
+ int number_of_iterations = 30;
+ for (i = 1; i <= number_of_iterations && t == -1.0; i++)
+ {
+ t = speed_measure (fun, s);
+ if ( (t == -1.0) && (i+1 <= number_of_iterations) )
+ printf("speed_measure failed for size %lu. Trying again... (%d/%d)\n",
+ s->size, i+1, number_of_iterations);
+ }
+ if (t == -1.0)
+ {
+ fprintf (stderr, "Failed to measure %s!\n", m);
+ fprintf (stderr, "If CPU frequency scaling is enabled, please disable it:\n");
+ fprintf (stderr, " under Linux: cpufreq-selector -g performance\n");
+ fprintf (stderr, "On a multi-core processor, you might also try to load all the cores\n");
+ abort ();
+ }
+ return t;
+}
+
+#define THRESHOLD_WINDOW 16
+#define THRESHOLD_FINAL_WINDOW 128
+static double
+domeasure (mpfr_prec_t *threshold,
+ double (*func) (struct speed_params *),
+ mpfr_prec_t p)
+{
+ struct speed_params s;
+ mp_size_t size;
+ double t1, t2, d;
+
+ s.align_xp = s.align_yp = s.align_wp = 64;
+ s.size = p;
+ size = (p - 1)/GMP_NUMB_BITS+1;
+ s.xp = malloc (2*size*sizeof (mp_limb_t));
+ if (s.xp == NULL)
+ {
+ fprintf (stderr, "Can't allocate memory.\n");
+ abort ();
+ }
+ mpn_random (s.xp, size);
+ s.yp = s.xp + size;
+ mpn_random (s.yp, size);
+ *threshold = MPFR_PREC_MAX;
+ t1 = mpfr_speed_measure (func, &s, "function 1");
+ *threshold = 1;
+ t2 = mpfr_speed_measure (func, &s, "function 2");
+ free (s.xp);
+ /* t1 is the time of the first algo (used for low prec) */
+ if (t2 >= t1)
+ d = (t2 - t1) / t2;
+ else
+ d = (t2 - t1) / t1;
+ /* d > 0 if we have to use algo 1.
+ d < 0 if we have to use algo 2 */
+ return d;
+}
+
+/* Performs measures when both the precision and the point of evaluation
+ shall vary. s.yp is ignored and not initialized.
+ It assumes that func depends on three thresholds with a boundary of the
+ form threshold1*x + threshold2*p = some scaling factor, if x<0,
+ and threshold3*x + threshold2*p = some scaling factor, if x>=0.
+*/
+static double
+domeasure2 (long int *threshold1, long int *threshold2, long int *threshold3,
+ double (*func) (struct speed_params *),
+ mpfr_prec_t p,
+ mpfr_t x)
+{
+ struct speed_params s;
+ mp_size_t size;
+ double t1, t2, d;
+ mpfr_t xtmp;
+
+ if (MPFR_IS_SINGULAR (x))
+ {
+ mpfr_fprintf (stderr, "x=%RNf is not a regular number.\n");
+ abort ();
+ }
+ if (MPFR_IS_NEG (x))
+ s.align_xp = 2;
+ else
+ s.align_xp = 1;
+
+ s.align_yp = s.align_wp = 64;
+ s.size = p;
+ size = (p - 1)/GMP_NUMB_BITS+1;
+
+ mpfr_init2 (xtmp, p);
+ mpn_random (xtmp->_mpfr_d, size);
+ xtmp->_mpfr_d[size-1] |= MPFR_LIMB_HIGHBIT;
+ MPFR_SET_EXP (xtmp, -53);
+ mpfr_add_ui (xtmp, xtmp, 1, MPFR_RNDN);
+ mpfr_mul (xtmp, xtmp, x, MPFR_RNDN); /* xtmp = x*(1+perturb) */
+ /* where perturb ~ 2^(-53) is */
+ /* randomly chosen. */
+ s.xp = xtmp->_mpfr_d;
+ s.r = MPFR_GET_EXP (xtmp);
+
+ *threshold1 = 0;
+ *threshold2 = 0;
+ *threshold3 = 0;
+ t1 = mpfr_speed_measure (func, &s, "function 1");
+
+ if (MPFR_IS_NEG (x))
+ *threshold1 = INT_MIN;
+ else
+ *threshold3 = INT_MAX;
+ *threshold2 = INT_MAX;
+ t2 = mpfr_speed_measure (func, &s, "function 2");
+
+ /* t1 is the time of the first algo (used for low prec) */
+ if (t2 >= t1)
+ d = (t2 - t1) / t2;
+ else
+ d = (t2 - t1) / t1;
+ /* d > 0 if we have to use algo 1.
+ d < 0 if we have to use algo 2 */
+ mpfr_clear (xtmp);
+ return d;
+}
+
+/* Tune a function with a simple THRESHOLD
+ The function doesn't depend on another threshold.
+ It assumes that it uses algo1 if p < THRESHOLD
+ and algo2 otherwise.
+ if algo2 is better for low prec, and algo1 better for high prec,
+ the behaviour of this function is undefined. */
+static void
+tune_simple_func (mpfr_prec_t *threshold,
+ double (*func) (struct speed_params *),
+ mpfr_prec_t pstart)
+{
+ double measure[THRESHOLD_FINAL_WINDOW+1];
+ double d;
+ mpfr_prec_t pstep;
+ int i, numpos, numneg, try;
+ mpfr_prec_t pmin, pmax, p;
+
+ /* first look for a lower bound within 10% */
+ pmin = p = pstart;
+ d = domeasure (threshold, func, pmin);
+ if (d < 0.0)
+ {
+ if (verbose)
+ printf ("Oops: even for %lu, algo 2 seems to be faster!\n",
+ (unsigned long) pmin);
+ *threshold = MPFR_PREC_MIN;
+ return;
+ }
+ if (d >= 1.00)
+ for (;;)
+ {
+ d = domeasure (threshold, func, pmin);
+ if (d < 1.00)
+ break;
+ p = pmin;
+ pmin += pmin/2;
+ }
+ pmin = p;
+ for (;;)
+ {
+ d = domeasure (threshold, func, pmin);
+ if (d < 0.10)
+ break;
+ pmin += GMP_NUMB_BITS;
+ }
+
+ /* then look for an upper bound within 20% */
+ pmax = pmin * 2;
+ for (;;)
+ {
+ d = domeasure (threshold, func, pmax);
+ if (d < -0.20)
+ break;
+ pmax += pmin / 2; /* don't increase too rapidly */
+ }
+
+ /* The threshold is between pmin and pmax. Affine them */
+ try = 0;
+ while ((pmax-pmin) >= THRESHOLD_FINAL_WINDOW)
+ {
+ pstep = MAX(MIN(GMP_NUMB_BITS/2,(pmax-pmin)/(2*THRESHOLD_WINDOW)),1);
+ if (verbose)
+ printf ("Pmin = %8lu Pmax = %8lu Pstep=%lu\n", pmin, pmax, pstep);
+ p = (pmin + pmax) / 2;
+ for (i = numpos = numneg = 0 ; i < THRESHOLD_WINDOW + 1 ; i++)
+ {
+ measure[i] = domeasure (threshold, func,
+ p+(i-THRESHOLD_WINDOW/2)*pstep);
+ if (measure[i] > 0)
+ numpos ++;
+ else if (measure[i] < 0)
+ numneg ++;
+ }
+ if (numpos > numneg)
+ /* We use more often algo 1 than algo 2 */
+ pmin = p - THRESHOLD_WINDOW/2*pstep;
+ else if (numpos < numneg)
+ pmax = p + THRESHOLD_WINDOW/2*pstep;
+ else
+ /* numpos == numneg ... */
+ if (++ try > 2)
+ {
+ *threshold = p;
+ if (verbose)
+ printf ("Quick find: %lu\n", *threshold);
+ return ;
+ }
+ }
+
+ /* Final tune... */
+ if (verbose)
+ printf ("Finalizing in [%lu, %lu]... ", pmin, pmax);
+ for (i = 0 ; i < THRESHOLD_FINAL_WINDOW+1 ; i++)
+ measure[i] = domeasure (threshold, func, pmin+i);
+ i = analyze_data (measure, THRESHOLD_FINAL_WINDOW+1);
+ *threshold = pmin + i;
+ if (verbose)
+ printf ("%lu\n", *threshold);
+ return;
+}
+
+/* Tune a function which behavior depends on both p and x,
+ in a given direction.
+ It assumes that for (x,p) close to zero, algo1 is used
+ and algo2 is used when (x,p) is far from zero.
+ If algo2 is better for low prec, and algo1 better for high prec,
+ the behaviour of this function is undefined.
+ This tuning function tries couples (x,p) of the form (ell*dirx, ell*dirp)
+ until it finds a point on the boundary. It returns ell.
+ */
+static void
+tune_simple_func_in_some_direction (long int *threshold1,
+ long int *threshold2,
+ long int *threshold3,
+ double (*func) (struct speed_params *),
+ mpfr_prec_t pstart,
+ int dirx, int dirp,
+ mpfr_t xres, mpfr_prec_t *pres)
+{
+ double measure[THRESHOLD_FINAL_WINDOW+1];
+ double d;
+ mpfr_prec_t pstep;
+ int i, numpos, numneg, try;
+ mpfr_prec_t pmin, pmax, p;
+ mpfr_t xmin, xmax, x;
+ mpfr_t ratio;
+
+ mpfr_init2 (ratio, MPFR_SMALL_PRECISION);
+ mpfr_set_si (ratio, dirx, MPFR_RNDN);
+ mpfr_div_si (ratio, ratio, dirp, MPFR_RNDN);
+
+ mpfr_init2 (xmin, MPFR_SMALL_PRECISION);
+ mpfr_init2 (xmax, MPFR_SMALL_PRECISION);
+ mpfr_init2 (x, MPFR_SMALL_PRECISION);
+
+ /* first look for a lower bound within 10% */
+ pmin = p = pstart;
+ mpfr_mul_ui (xmin, ratio, (unsigned int)pmin, MPFR_RNDN);
+ mpfr_set (x, xmin, MPFR_RNDN);
+
+ d = domeasure2 (threshold1, threshold2, threshold3, func, pmin, xmin);
+ if (d < 0.0)
+ {
+ if (verbose)
+ printf ("Oops: even for %lu, algo 2 seems to be faster!\n",
+ (unsigned long) pmin);
+ *pres = MPFR_PREC_MIN;
+ mpfr_mul_ui (xres, ratio, (unsigned int)*pres, MPFR_RNDN);
+ mpfr_clear (ratio); mpfr_clear (x); mpfr_clear (xmin); mpfr_clear (xmax);
+ return;
+ }
+ if (d >= 1.00)
+ for (;;)
+ {
+ d = domeasure2 (threshold1, threshold2, threshold3, func, pmin, xmin);
+ if (d < 1.00)
+ break;
+ p = pmin;
+ mpfr_set (x, xmin, MPFR_RNDN);
+ pmin += pmin/2;
+ mpfr_mul_ui (xmin, ratio, (unsigned int)pmin, MPFR_RNDN);
+ }
+ pmin = p;
+ mpfr_set (xmin, x, MPFR_RNDN);
+ for (;;)
+ {
+ d = domeasure2 (threshold1, threshold2, threshold3, func, pmin, xmin);
+ if (d < 0.10)
+ break;
+ pmin += GMP_NUMB_BITS;
+ mpfr_mul_ui (xmin, ratio, (unsigned int)pmin, MPFR_RNDN);
+ }
+
+ /* then look for an upper bound within 20% */
+ pmax = pmin * 2;
+ mpfr_mul_ui (xmax, ratio, (unsigned int)pmax, MPFR_RNDN);
+ for (;;)
+ {
+ d = domeasure2 (threshold1, threshold2, threshold3, func, pmax, xmax);
+ if (d < -0.20)
+ break;
+ pmax += pmin / 2; /* don't increase too rapidly */
+ mpfr_mul_ui (xmax, ratio, (unsigned int)pmax, MPFR_RNDN);
+ }
+
+ /* The threshold is between pmin and pmax. Affine them */
+ try = 0;
+ while ((pmax-pmin) >= THRESHOLD_FINAL_WINDOW)
+ {
+ pstep = MAX(MIN(GMP_NUMB_BITS/2,(pmax-pmin)/(2*THRESHOLD_WINDOW)),1);
+ if (verbose)
+ printf ("Pmin = %8lu Pmax = %8lu Pstep=%lu\n", pmin, pmax, pstep);
+ p = (pmin + pmax) / 2;
+ mpfr_mul_ui (x, ratio, (unsigned int)p, MPFR_RNDN);
+ for (i = numpos = numneg = 0 ; i < THRESHOLD_WINDOW + 1 ; i++)
+ {
+ *pres = p+(i-THRESHOLD_WINDOW/2)*pstep;
+ mpfr_mul_ui (xres, ratio, (unsigned int)*pres, MPFR_RNDN);
+ measure[i] = domeasure2 (threshold1, threshold2, threshold3,
+ func, *pres, xres);
+ if (measure[i] > 0)
+ numpos ++;
+ else if (measure[i] < 0)
+ numneg ++;
+ }
+ if (numpos > numneg)
+ {
+ /* We use more often algo 1 than algo 2 */
+ pmin = p - THRESHOLD_WINDOW/2*pstep;
+ mpfr_mul_ui (xmin, ratio, (unsigned int)pmin, MPFR_RNDN);
+ }
+ else if (numpos < numneg)
+ {
+ pmax = p + THRESHOLD_WINDOW/2*pstep;
+ mpfr_mul_ui (xmax, ratio, (unsigned int)pmax, MPFR_RNDN);
+ }
+ else
+ /* numpos == numneg ... */
+ if (++ try > 2)
+ {
+ *pres = p;
+ mpfr_mul_ui (xres, ratio, (unsigned int)*pres, MPFR_RNDN);
+ if (verbose)
+ printf ("Quick find: %lu\n", *pres);
+ mpfr_clear (ratio);
+ mpfr_clear (x); mpfr_clear (xmin); mpfr_clear (xmax);
+ return ;
+ }
+ }
+
+ /* Final tune... */
+ if (verbose)
+ printf ("Finalizing in [%lu, %lu]... ", pmin, pmax);
+ for (i = 0 ; i < THRESHOLD_FINAL_WINDOW+1 ; i++)
+ {
+ *pres = pmin+i;
+ mpfr_mul_ui (xres, ratio, (unsigned int)*pres, MPFR_RNDN);
+ measure[i] = domeasure2 (threshold1, threshold2, threshold3,
+ func, *pres, xres);
+ }
+ i = analyze_data (measure, THRESHOLD_FINAL_WINDOW+1);
+ *pres = pmin + i;
+ mpfr_mul_ui (xres, ratio, (unsigned int)*pres, MPFR_RNDN);
+ if (verbose)
+ printf ("%lu\n", *pres);
+ mpfr_clear (ratio); mpfr_clear (x); mpfr_clear (xmin); mpfr_clear (xmax);
+ return;
+}
+
+/************************************
+ * Tune Mulders' mulhigh function *
+ ************************************/
+#define TOLERANCE 1.00
+#define MULDERS_TABLE_SIZE 1024
+#ifndef MPFR_MULHIGH_SIZE
+# define MPFR_MULHIGH_SIZE MULDERS_TABLE_SIZE
+#endif
+#ifndef MPFR_SQRHIGH_SIZE
+# define MPFR_SQRHIGH_SIZE MULDERS_TABLE_SIZE
+#endif
+#ifndef MPFR_DIVHIGH_SIZE
+# define MPFR_DIVHIGH_SIZE MULDERS_TABLE_SIZE
+#endif
+#define MPFR_MULHIGH_TAB_SIZE MPFR_MULHIGH_SIZE
+#define MPFR_SQRHIGH_TAB_SIZE MPFR_SQRHIGH_SIZE
+#define MPFR_DIVHIGH_TAB_SIZE MPFR_DIVHIGH_SIZE
+#include "mulders.c"
+
+static double
+speed_mpfr_mulhigh (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_MUL_N (mpfr_mulhigh_n);
+}
+
+static double
+speed_mpfr_sqrhigh (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_SQR (mpfr_sqrhigh_n);
+}
+
+static double
+speed_mpfr_divhigh (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_DC_DIVREM_CALL (mpfr_divhigh_n (q, a, d, s->size));
+}
+
+#define MAX_STEPS 513 /* maximum number of values of k tried for a given n */
+
+/* Tune mpfr_mulhigh_n for size n */
+static mp_size_t
+tune_mul_mulders_upto (mp_size_t n)
+{
+ struct speed_params s;
+ mp_size_t k, kbest, step;
+ double t, tbest;
+ MPFR_TMP_DECL (marker);
+
+ if (n == 0)
+ return -1;
+
+ MPFR_TMP_MARK (marker);
+ s.align_xp = s.align_yp = s.align_wp = 64;
+ s.size = n;
+ s.xp = MPFR_TMP_ALLOC (n * sizeof (mp_limb_t));
+ s.yp = MPFR_TMP_ALLOC (n * sizeof (mp_limb_t));
+ mpn_random (s.xp, n);
+ mpn_random (s.yp, n);
+
+ /* Check k == -1, mpn_mul_basecase */
+ mulhigh_ktab[n] = -1;
+ kbest = -1;
+ tbest = mpfr_speed_measure (speed_mpfr_mulhigh, &s, "mpfr_mulhigh");
+
+ /* Check k == 0, mpn_mulhigh_n_basecase */
+ mulhigh_ktab[n] = 0;
+ t = mpfr_speed_measure (speed_mpfr_mulhigh, &s, "mpfr_mulhigh");
+ if (t * TOLERANCE < tbest)
+ kbest = 0, tbest = t;
+
+ /* Check Mulders with cutoff point k */
+ step = 1 + n / (2 * MAX_STEPS);
+ /* we need k >= (n+3)/2, which translates into k >= (n+4)/2 in C */
+ for (k = (n + 4) / 2 ; k < n ; k += step)
+ {
+ mulhigh_ktab[n] = k;
+ t = mpfr_speed_measure (speed_mpfr_mulhigh, &s, "mpfr_mulhigh");
+ if (t * TOLERANCE < tbest)
+ kbest = k, tbest = t;
+ }
+
+ mulhigh_ktab[n] = kbest;
+
+ MPFR_TMP_FREE (marker);
+ return kbest;
+}
+
+/* Tune mpfr_sqrhigh_n for size n */
+static mp_size_t
+tune_sqr_mulders_upto (mp_size_t n)
+{
+ struct speed_params s;
+ mp_size_t k, kbest, step;
+ double t, tbest;
+ MPFR_TMP_DECL (marker);
+
+ if (n == 0)
+ return -1;
+
+ MPFR_TMP_MARK (marker);
+ s.align_xp = s.align_wp = 64;
+ s.size = n;
+ s.xp = MPFR_TMP_ALLOC (n * sizeof (mp_limb_t));
+ mpn_random (s.xp, n);
+
+ /* Check k == -1, mpn_sqr_basecase */
+ sqrhigh_ktab[n] = -1;
+ kbest = -1;
+ tbest = mpfr_speed_measure (speed_mpfr_sqrhigh, &s, "mpfr_sqrhigh");
+
+ /* Check k == 0, mpfr_mulhigh_n_basecase */
+ sqrhigh_ktab[n] = 0;
+ t = mpfr_speed_measure (speed_mpfr_sqrhigh, &s, "mpfr_sqrhigh");
+ if (t * TOLERANCE < tbest)
+ kbest = 0, tbest = t;
+
+ /* Check Mulders */
+ step = 1 + n / (2 * MAX_STEPS);
+ /* we need k >= (n+3)/2, which translates into k >= (n+4)/2 in C */
+ for (k = (n + 4) / 2 ; k < n ; k += step)
+ {
+ sqrhigh_ktab[n] = k;
+ t = mpfr_speed_measure (speed_mpfr_sqrhigh, &s, "mpfr_sqrhigh");
+ if (t * TOLERANCE < tbest)
+ kbest = k, tbest = t;
+ }
+
+ sqrhigh_ktab[n] = kbest;
+
+ MPFR_TMP_FREE (marker);
+ return kbest;
+}
+
+/* Tune mpfr_divhigh_n for size n */
+static mp_size_t
+tune_div_mulders_upto (mp_size_t n)
+{
+ struct speed_params s;
+ mp_size_t k, kbest, step;
+ double t, tbest;
+ MPFR_TMP_DECL (marker);
+
+ if (n == 0)
+ return 0;
+
+ MPFR_TMP_MARK (marker);
+ s.align_xp = s.align_yp = s.align_wp = s.align_wp2 = 64;
+ s.size = n;
+ s.xp = MPFR_TMP_ALLOC (n * sizeof (mp_limb_t));
+ s.yp = MPFR_TMP_ALLOC (n * sizeof (mp_limb_t));
+ mpn_random (s.xp, n);
+ mpn_random (s.yp, n);
+
+ /* Check k == n, i.e., mpn_divrem */
+ divhigh_ktab[n] = n;
+ kbest = n;
+ tbest = mpfr_speed_measure (speed_mpfr_divhigh, &s, "mpfr_divhigh");
+
+ /* Check k == 0, i.e., mpfr_divhigh_n_basecase */
+#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_SBPI1_DIVAPPR_Q)
+ if (n > 2) /* mpn_sbpi1_divappr_q requires dn > 2 */
+#endif
+ {
+ divhigh_ktab[n] = 0;
+ t = mpfr_speed_measure (speed_mpfr_divhigh, &s, "mpfr_divhigh");
+ if (t * TOLERANCE < tbest)
+ kbest = 0, tbest = t;
+ }
+
+ /* Check Mulders */
+ step = 1 + n / (2 * MAX_STEPS);
+ /* we should have (n+3)/2 <= k < n, which translates into
+ (n+4)/2 <= k < n in C */
+ for (k = (n + 4) / 2 ; k < n ; k += step)
+ {
+ divhigh_ktab[n] = k;
+ t = mpfr_speed_measure (speed_mpfr_divhigh, &s, "mpfr_divhigh");
+ if (t * TOLERANCE < tbest)
+ kbest = k, tbest = t;
+ }
+
+ divhigh_ktab[n] = kbest;
+
+ MPFR_TMP_FREE (marker);
+
+ return kbest;
+}
+
+static void
+tune_mul_mulders (FILE *f)
+{
+ mp_size_t k;
+
+ if (verbose)
+ printf ("Tuning mpfr_mulhigh_n[%d]", (int) MPFR_MULHIGH_TAB_SIZE);
+ fprintf (f, "#define MPFR_MULHIGH_TAB \\\n ");
+ for (k = 0 ; k < MPFR_MULHIGH_TAB_SIZE ; k++)
+ {
+ fprintf (f, "%d", (int) tune_mul_mulders_upto (k));
+ if (k != MPFR_MULHIGH_TAB_SIZE-1)
+ fputc (',', f);
+ if ((k+1) % 16 == 0)
+ fprintf (f, " \\\n ");
+ if (verbose)
+ putchar ('.');
+ }
+ fprintf (f, " \n");
+ if (verbose)
+ putchar ('\n');
+}
+
+static void
+tune_sqr_mulders (FILE *f)
+{
+ mp_size_t k;
+
+ if (verbose)
+ printf ("Tuning mpfr_sqrhigh_n[%d]", (int) MPFR_SQRHIGH_TAB_SIZE);
+ fprintf (f, "#define MPFR_SQRHIGH_TAB \\\n ");
+ for (k = 0 ; k < MPFR_SQRHIGH_TAB_SIZE ; k++)
+ {
+ fprintf (f, "%d", (int) tune_sqr_mulders_upto (k));
+ if (k != MPFR_SQRHIGH_TAB_SIZE-1)
+ fputc (',', f);
+ if ((k+1) % 16 == 0)
+ fprintf (f, " \\\n ");
+ if (verbose)
+ putchar ('.');
+ }
+ fprintf (f, " \n");
+ if (verbose)
+ putchar ('\n');
+}
+
+static void
+tune_div_mulders (FILE *f)
+{
+ mp_size_t k;
+
+ if (verbose)
+ printf ("Tuning mpfr_divhigh_n[%d]", (int) MPFR_DIVHIGH_TAB_SIZE);
+ fprintf (f, "#define MPFR_DIVHIGH_TAB \\\n ");
+ for (k = 0 ; k < MPFR_DIVHIGH_TAB_SIZE ; k++)
+ {
+ fprintf (f, "%d", (int) tune_div_mulders_upto (k));
+ if (k != MPFR_DIVHIGH_TAB_SIZE - 1)
+ fputc (',', f);
+ if ((k+1) % 16 == 0)
+ fprintf (f, " /*%zu-%zu*/ \\\n ", k - 15, k);
+ if (verbose)
+ putchar ('.');
+ }
+ fprintf (f, " \n");
+ if (verbose)
+ putchar ('\n');
+}
+
+/*******************************************************
+ * Tuning functions for mpfr_ai *
+ *******************************************************/
+
+long int mpfr_ai_threshold1;
+long int mpfr_ai_threshold2;
+long int mpfr_ai_threshold3;
+#undef MPFR_AI_THRESHOLD1
+#define MPFR_AI_THRESHOLD1 mpfr_ai_threshold1
+#undef MPFR_AI_THRESHOLD2
+#define MPFR_AI_THRESHOLD2 mpfr_ai_threshold2
+#undef MPFR_AI_THRESHOLD3
+#define MPFR_AI_THRESHOLD3 mpfr_ai_threshold3
+
+#include "ai.c"
+
+static double
+speed_mpfr_ai (struct speed_params *s)
+{
+ SPEED_MPFR_FUNC_WITH_EXPONENT (mpfr_ai);
+}
+
+
+/*******************************************************
+ * Tune all the threshold of MPFR *
+ * Warning: tune the function in their dependent order!*
+ *******************************************************/
+static void
+all (const char *filename)
+{
+ FILE *f;
+ time_t start_time, end_time;
+ struct tm *tp;
+ mpfr_t x1, x2, x3, tmp1, tmp2;
+ mpfr_prec_t p1, p2, p3;
+
+ f = fopen (filename, "w");
+ if (f == NULL)
+ {
+ fprintf (stderr, "Can't open file '%s' for writing.\n", filename);
+ abort ();
+ }
+
+ speed_time_init ();
+ if (verbose)
+ {
+ printf ("Using: %s\n", speed_time_string);
+ printf ("speed_precision %d", speed_precision);
+ if (speed_unittime == 1.0)
+ printf (", speed_unittime 1 cycle");
+ else
+ printf (", speed_unittime %.2e secs", speed_unittime);
+ if (speed_cycletime == 1.0 || speed_cycletime == 0.0)
+ printf (", CPU freq unknown\n");
+ else
+ printf (", CPU freq %.2f MHz\n\n", 1e-6/speed_cycletime);
+ }
+
+ time (&start_time);
+ tp = localtime (&start_time);
+ fprintf (f, "/* Generated by MPFR's tuneup.c, %d-%02d-%02d, ",
+ tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday);
+
+#ifdef __ICC
+ fprintf (f, "icc %d.%d.%d */\n", __ICC / 100, __ICC / 10 % 10, __ICC % 10);
+#elif defined(__GNUC__)
+#ifdef __GNUC_PATCHLEVEL__
+ fprintf (f, "gcc %d.%d.%d */\n", __GNUC__, __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__);
+#else
+ fprintf (f, "gcc %d.%d */\n", __GNUC__, __GNUC_MINOR__);
+#endif
+#elif defined (__SUNPRO_C)
+ fprintf (f, "Sun C %d.%d */\n", __SUNPRO_C / 0x100, __SUNPRO_C % 0x100);
+#elif defined (__sgi) && defined (_COMPILER_VERSION)
+ fprintf (f, "MIPSpro C %d.%d.%d */\n",
+ _COMPILER_VERSION / 100,
+ _COMPILER_VERSION / 10 % 10,
+ _COMPILER_VERSION % 10);
+#elif defined (__DECC) && defined (__DECC_VER)
+ fprintf (f, "DEC C %d */\n", __DECC_VER);
+#else
+ fprintf (f, "system compiler */\n");
+#endif
+ fprintf (f, "\n\n");
+ fprintf (f, "#ifndef MPFR_TUNE_CASE\n");
+ fprintf (f, "#define MPFR_TUNE_CASE \"src/mparam.h\"\n");
+ fprintf (f, "#endif\n\n");
+
+ /* Tune mulhigh */
+ tune_mul_mulders (f);
+
+ /* Tune sqrhigh */
+ tune_sqr_mulders (f);
+
+ /* Tune divhigh */
+ tune_div_mulders (f);
+ fflush (f);
+
+ /* Tune mpfr_mul (threshold is in limbs, but it doesn't matter too much) */
+ if (verbose)
+ printf ("Tuning mpfr_mul...\n");
+ tune_simple_func (&mpfr_mul_threshold, speed_mpfr_mul,
+ 2*GMP_NUMB_BITS+1);
+ fprintf (f, "#define MPFR_MUL_THRESHOLD %lu /* limbs */\n",
+ (unsigned long) (mpfr_mul_threshold - 1) / GMP_NUMB_BITS + 1);
+
+ /* Tune mpfr_sqr (threshold is in limbs, but it doesn't matter too much) */
+ if (verbose)
+ printf ("Tuning mpfr_sqr...\n");
+ tune_simple_func (&mpfr_sqr_threshold, speed_mpfr_sqr,
+ 2*GMP_NUMB_BITS+1);
+ fprintf (f, "#define MPFR_SQR_THRESHOLD %lu /* limbs */\n",
+ (unsigned long) (mpfr_sqr_threshold - 1) / GMP_NUMB_BITS + 1);
+
+ /* Tune mpfr_div (threshold is in limbs, but it doesn't matter too much) */
+ if (verbose)
+ printf ("Tuning mpfr_div...\n");
+ tune_simple_func (&mpfr_div_threshold, speed_mpfr_div,
+ 2*GMP_NUMB_BITS+1);
+ fprintf (f, "#define MPFR_DIV_THRESHOLD %lu /* limbs */\n",
+ (unsigned long) (mpfr_div_threshold - 1) / GMP_NUMB_BITS + 1);
+
+ /* Tune mpfr_exp_2 */
+ if (verbose)
+ printf ("Tuning mpfr_exp_2...\n");
+ tune_simple_func (&mpfr_exp_2_threshold, speed_mpfr_exp_2, GMP_NUMB_BITS);
+ fprintf (f, "#define MPFR_EXP_2_THRESHOLD %lu /* bits */\n",
+ (unsigned long) mpfr_exp_2_threshold);
+
+ /* Tune mpfr_exp */
+ if (verbose)
+ printf ("Tuning mpfr_exp...\n");
+ tune_simple_func (&mpfr_exp_threshold, speed_mpfr_exp,
+ MPFR_PREC_MIN+3*GMP_NUMB_BITS);
+ fprintf (f, "#define MPFR_EXP_THRESHOLD %lu /* bits */\n",
+ (unsigned long) mpfr_exp_threshold);
+
+ /* Tune mpfr_sin_cos */
+ if (verbose)
+ printf ("Tuning mpfr_sin_cos...\n");
+ tune_simple_func (&mpfr_sincos_threshold, speed_mpfr_sincos,
+ MPFR_PREC_MIN+3*GMP_NUMB_BITS);
+ fprintf (f, "#define MPFR_SINCOS_THRESHOLD %lu /* bits */\n",
+ (unsigned long) mpfr_sincos_threshold);
+
+ /* Tune mpfr_ai */
+ if (verbose)
+ printf ("Tuning mpfr_ai...\n");
+ mpfr_init2 (x1, MPFR_SMALL_PRECISION);
+ mpfr_init2 (x2, MPFR_SMALL_PRECISION);
+ mpfr_init2 (x3, MPFR_SMALL_PRECISION);
+ mpfr_init2 (tmp1, MPFR_SMALL_PRECISION);
+ mpfr_init2 (tmp2, MPFR_SMALL_PRECISION);
+
+ tune_simple_func_in_some_direction (&mpfr_ai_threshold1, &mpfr_ai_threshold2,
+ &mpfr_ai_threshold3, speed_mpfr_ai,
+ MPFR_PREC_MIN+GMP_NUMB_BITS,
+ -60, 200, x1, &p1);
+ tune_simple_func_in_some_direction (&mpfr_ai_threshold1, &mpfr_ai_threshold2,
+ &mpfr_ai_threshold3, speed_mpfr_ai,
+ MPFR_PREC_MIN+GMP_NUMB_BITS,
+ -20, 500, x2, &p2);
+ tune_simple_func_in_some_direction (&mpfr_ai_threshold1, &mpfr_ai_threshold2,
+ &mpfr_ai_threshold3, speed_mpfr_ai,
+ MPFR_PREC_MIN+GMP_NUMB_BITS,
+ 40, 200, x3, &p3);
+
+ mpfr_mul_ui (tmp1, x2, (unsigned long)p1, MPFR_RNDN);
+ mpfr_mul_ui (tmp2, x1, (unsigned long)p2, MPFR_RNDN);
+ mpfr_sub (tmp1, tmp1, tmp2, MPFR_RNDN);
+ mpfr_div_ui (tmp1, tmp1, MPFR_AI_SCALE, MPFR_RNDN);
+
+ mpfr_set_ui (tmp2, (unsigned long)p1, MPFR_RNDN);
+ mpfr_sub_ui (tmp2, tmp2, (unsigned long)p2, MPFR_RNDN);
+ mpfr_div (tmp2, tmp2, tmp1, MPFR_RNDN);
+ mpfr_ai_threshold1 = mpfr_get_si (tmp2, MPFR_RNDN);
+
+ mpfr_sub (tmp2, x2, x1, MPFR_RNDN);
+ mpfr_div (tmp2, tmp2, tmp1, MPFR_RNDN);
+ mpfr_ai_threshold2 = mpfr_get_si (tmp2, MPFR_RNDN);
+
+ mpfr_set_ui (tmp1, (unsigned long)p3, MPFR_RNDN);
+ mpfr_mul_si (tmp1, tmp1, mpfr_ai_threshold2, MPFR_RNDN);
+ mpfr_ui_sub (tmp1, MPFR_AI_SCALE, tmp1, MPFR_RNDN);
+ mpfr_div (tmp1, tmp1, x3, MPFR_RNDN);
+ mpfr_ai_threshold3 = mpfr_get_si (tmp1, MPFR_RNDN);
+
+ fprintf (f, "#define MPFR_AI_THRESHOLD1 %ld /* threshold for negative input of mpfr_ai */\n", mpfr_ai_threshold1);
+ fprintf (f, "#define MPFR_AI_THRESHOLD2 %ld\n", mpfr_ai_threshold2);
+ fprintf (f, "#define MPFR_AI_THRESHOLD3 %ld\n", mpfr_ai_threshold3);
+
+ mpfr_clear (x1); mpfr_clear (x2); mpfr_clear (x3);
+ mpfr_clear (tmp1); mpfr_clear (tmp2);
+
+ /* End of tuning */
+ time (&end_time);
+ fprintf (f, "/* Tuneup completed successfully, took %ld seconds */\n",
+ (long) (end_time - start_time));
+ if (verbose)
+ printf ("Complete (took %ld seconds).\n", (long) (end_time - start_time));
+
+ fclose (f);
+}
+
+
+/* Main function */
+int main (int argc, char *argv[])
+{
+ /* Unbuffered so if output is redirected to a file it isn't lost if the
+ program is killed part way through. */
+ setbuf (stdout, NULL);
+ setbuf (stderr, NULL);
+
+ verbose = argc > 1;
+
+ if (verbose)
+ printf ("Tuning MPFR (Coffee time?)...\n");
+
+ all ("mparam.h");
+
+ return 0;
+}