You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

326 lines
10 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
Extend the exponent range from 32 bits to 64 bits on selected platforms. * include/cln/number.h: Add signatures for operations with long long. * include/cln/complex_class.h: Likewise. * include/cln/real_class.h: Likewise. * include/cln/real.h: Likewise. * include/cln/rational_class.h: Likewise. * include/cln/rational.h: Likewise. * include/cln/integer_class.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/float.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/types.h (sintE and uintE): New types for exponents. * include/cln/*float.h: Use the new types for exponents. * include/cln/floatformat.h (float_format_t): Make underlying type compatible with sintE. * doc/cln.tex: Document changed float_exponent return value. * src/float/cl_F.h: Likewise. * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/cl_LF.h: Likewise. * src/float/lfloat/cl_LF_impl.h: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_compare.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_square.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_decode.cc: Likewise. * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_decode.cc: Likewise. * src/float/misc/cl_F_exponent.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/misc/cl_float_format.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/complex/algebraic/cl_LF_hypot.cc: Likewise. * src/complex/elem/division/cl_C_LF_recip.cc: Likewise. * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise. * src/integer/conv/cl_I_from_Q2.cc: Added. * src/base/cl_low.h (isqrtC): New function, for 64 bit falls back to... * src/base/low/cl_low_isqrt.cc (isqrt): ...this new implementation. * src/base/cl_macros.h (bitc): Make sure 64 bit is used if required by exponent operations. * examples/pi.cc: Support more than 646456614 decimal digits.
18 years ago
25 years ago
2006-04-25 Bruno Haible <bruno@clisp.org> Richard B. Kreckel <kreckel@ginac.de> Make it theoretically possible to use bignums and long-floats with more than 2^32 significant digits or bits. * doc/cln.tex (logcount): Change return type to uintC. (struct cl_byte): Change elements to uintC. (integer_length, ord2, power2p): Change return type to uintC. (scale_float): Change argument type to sintC. (float_digits, float_precision): Change return type to uintC. * examples/atan_recip.cc: Use uintC instead of uintL where appropriate. * examples/atanh_recip.cc: Likewise. * include/cln/GV.h: Likewise. * include/cln/GV_complex.h: Likewise. * include/cln/GV_integer.h: Likewise. * include/cln/GV_modinteger.h: Likewise. * include/cln/GV_number.h: Likewise. * include/cln/GV_rational.h: Likewise. * include/cln/GV_real.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/SV_complex.h: Likewise. * include/cln/SV_integer.h: Likewise. * include/cln/SV_number.h: Likewise. * include/cln/SV_rational.h: Likewise. * include/cln/SV_real.h: Likewise. * include/cln/SV_ringelt.h: Likewise. * include/cln/dfloat.h: Likewise. * include/cln/ffloat.h: Likewise. * include/cln/float.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/modinteger.h: Likewise. * include/cln/sfloat.h: Likewise. * src/base/cl_low.h (integerlengthC): New macro. * src/base/digitseq/cl_2DS_div.cc: Use uintC instead of uintL where appropriate. * src/base/digitseq/cl_2DS_recip.cc: Likewise. * src/base/digitseq/cl_DS.h: Likewise. * src/base/digitseq/cl_DS_mul.c: Likewise. * src/base/digitseq/cl_DS_mul_fftc.h: Likewise. * src/base/digitseq/cl_DS_mul_fftcs.h: Likewise. * src/base/digitseq/cl_DS_mul_fftm.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp3.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp3m.h: Likewise. * src/base/digitseq/cl_DS_mul_fftr.h: Likewise. * src/base/digitseq/cl_DS_mul_kara.h: Likewise. * src/base/digitseq/cl_DS_mul_nuss.h: Likewise. * src/base/digitseq/cl_DS_recip.cc: Likewise. * src/base/digitseq/cl_DS_recipsqrt.cc: Likewise. * src/base/digitseq/cl_DS_sqrt.cc: Likewise. * src/base/digitseq/cl_DS_trandom.cc: Likewise. * src/complex/input/cl_N_read.cc: Likewise. * src/complex/transcendental/cl_C_asinh_aux.cc: Likewise. * src/complex/transcendental/cl_C_expt_C.cc: Likewise. * src/float/cl_F.h: Likewise. * src/float/conv/cl_F_from_F_f.cc: Likewise. * src/float/conv/cl_F_from_I_f.cc: Likewise. * src/float/conv/cl_F_from_RA_f.cc: Likewise. * src/float/dfloat/conv/cl_I_to_double.cc: Likewise. * src/float/dfloat/conv/cl_RA_to_double.cc: Likewise. * src/float/dfloat/elem/cl_DF_from_I.cc: Likewise. * src/float/dfloat/elem/cl_DF_from_RA.cc: Likewise. * src/float/dfloat/elem/cl_DF_scale.cc: Likewise. * src/float/dfloat/misc/cl_DF_digits.cc: Likewise. * src/float/dfloat/misc/cl_DF_precision.cc: Likewise. * src/float/elem/cl_F_scale.cc: Likewise. * src/float/ffloat/conv/cl_I_to_float.cc: Likewise. * src/float/ffloat/conv/cl_RA_to_float.cc: Likewise. * src/float/ffloat/elem/cl_FF_from_I.cc: Likewise. * src/float/ffloat/elem/cl_FF_from_RA.cc: Likewise. * src/float/ffloat/elem/cl_FF_scale.cc: Likewise. * src/float/ffloat/misc/cl_FF_digits.cc: Likewise. * src/float/ffloat/misc/cl_FF_precision.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_RA.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_digits.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_leninc.cc: Likewise. * src/float/lfloat/misc/cl_LF_lenincx.cc: Likewise. * src/float/lfloat/misc/cl_LF_precision.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_digits.cc: Likewise. * src/float/misc/cl_F_epsneg.cc: Likewise. * src/float/misc/cl_F_epspos.cc: Likewise. * src/float/misc/cl_F_leastneg.cc: Likewise. * src/float/misc/cl_F_leastpos.cc: Likewise. * src/float/misc/cl_F_mostneg.cc: Likewise. * src/float/misc/cl_F_mostpos.cc: Likewise. * src/float/misc/cl_F_precision.cc: Likewise. * src/float/misc/cl_F_rational.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/random/cl_F_random.cc: Likewise. * src/float/sfloat/elem/cl_SF_from_I.cc: Likewise. * src/float/sfloat/elem/cl_SF_from_RA.cc: Likewise. * src/float/sfloat/elem/cl_SF_scale.cc: Likewise. * src/float/sfloat/misc/cl_SF_digits.cc: Likewise. * src/float/sfloat/misc/cl_SF_precision.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_catalanconst_f.cc: Likewise. * src/float/transcendental/cl_F_cos.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_coshsinh.cc: Likewise. * src/float/transcendental/cl_F_cossin.cc: Likewise. * src/float/transcendental/cl_F_eulerconst_f.cc: Likewise. * src/float/transcendental/cl_F_exp1_f.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_ln10_f.cc: Likewise. * src/float/transcendental/cl_F_ln2_f.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_pi_f.cc: Likewise. * src/float/transcendental/cl_F_sin.cc: Likewise. * src/float/transcendental/cl_F_sinh.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_F_tran.h: Likewise. * src/float/transcendental/cl_F_zeta_int_f.cc: Likewise. * src/float/transcendental/cl_LF_atan_recip.cc: Likewise. * src/float/transcendental/cl_LF_atanh_recip.cc: Likewise. * src/float/transcendental/cl_LF_catalanconst.cc: Likewise. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Likewise. * src/float/transcendental/cl_LF_cossin_aux.cc: Likewise. * src/float/transcendental/cl_LF_eulerconst.cc: Likewise. * src/float/transcendental/cl_LF_exp1.cc: Likewise. * src/float/transcendental/cl_LF_exp_aux.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/float/transcendental/cl_LF_ratseries.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_a.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_ab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_b.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_p.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pq.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_q.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqcd.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Likewise. * src/float/transcendental/cl_LF_tran.h: Likewise. * src/float/transcendental/cl_LF_zeta3.cc: Likewise. * src/float/transcendental/cl_LF_zeta_int.cc: Likewise. * src/integer/algebraic/cl_I_rootp_I.cc: Likewise. * src/integer/algebraic/cl_I_rootp_aux.cc: Likewise. * src/integer/bitwise/cl_I_ash.cc: Likewise. * src/integer/bitwise/cl_I_ash_I.cc: Likewise. * src/integer/bitwise/cl_I_byte.h: Likewise. * src/integer/bitwise/cl_I_fullbyte.cc: Likewise. * src/integer/bitwise/cl_I_ilength.cc: Likewise. * src/integer/bitwise/cl_I_ldb.cc: Likewise. * src/integer/bitwise/cl_I_ldbtest.cc: Likewise. * src/integer/bitwise/cl_I_ldbx.cc: Likewise. * src/integer/bitwise/cl_I_ldbxtest.cc: Likewise. * src/integer/bitwise/cl_I_logbitp.cc: Likewise. * src/integer/bitwise/cl_I_logbitp_I.cc: Likewise. * src/integer/bitwise/cl_I_logcount.cc: Likewise. * src/integer/bitwise/cl_I_mkf.cc: Likewise. * src/integer/bitwise/cl_I_mkfx.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/integer/conv/cl_I_to_digits.cc: Likewise. * src/integer/conv/cl_I_digits_need.cc: Likewise. * src/integer/conv/cl_I_from_digits.cc: Likewise. * src/integer/gcd/cl_I_gcd.cc: Likewise. * src/integer/gcd/cl_I_xgcd.cc: Likewise. * src/integer/misc/cl_I_eqhashcode.cc: Likewise. * src/integer/misc/cl_I_ord2.cc: Likewise. * src/integer/misc/cl_I_power2p.cc: Likewise. * src/integer/output/cl_I_cached_power.h (cached_power_table): allow for 40 elements. * src/integer/output/cl_I_decstring.cc: Use uintC instead of uintL where appropriate. * src/integer/output/cl_I_print.cc: Likewise. * src/integer/output/cl_I_print_string.cc: Likewise. * src/modinteger/cl_MI.cc: Likewise. * src/modinteger/cl_MI_lshift.cc: Likewise. * src/modinteger/cl_MI_montgom.h: Likewise. * src/modinteger/cl_MI_pow2.h: Likewise. * src/modinteger/cl_MI_pow2m1.h: Likewise. * src/modinteger/cl_MI_pow2p1.h: Likewise. * src/modinteger/cl_MI_rshift.cc: Likewise. * src/modinteger/cl_MI_std.h: Likewise. * src/numtheory/cl_IF_millerrabin.cc: Likewise. * src/numtheory/cl_nt_isprobprime.cc: Likewise. * src/numtheory/cl_nt_sqrtmodp.cc: Likewise. * src/polynomial/elem/cl_UP_GF2.h: Likewise. * src/real/conv/cl_F_from_R_f.cc: Likewise. * src/real/format-output/cl_fmt_floatstring.cc: Likewise. * src/real/input/cl_R_read.cc: Likewise. * src/vector/cl_GV_I.cc: Likewise. * src/vector/cl_GV_I_copy.cc: Likewise. * src/vector/cl_GV_number.cc: Likewise. * src/vector/cl_GV_number_copy.cc: Likewise. * src/vector/cl_SV_copy.cc: Likewise. * src/vector/cl_SV_number.cc: Likewise. * src/vector/cl_SV_ringelt.cc: Likewise. * tests/main.cc: Likewise. * tests/test_I_ilength.cc: Likewise. * tests/test_I_ord2.cc: Likewise.
19 years ago
25 years ago
2006-04-25 Bruno Haible <bruno@clisp.org> Richard B. Kreckel <kreckel@ginac.de> Make it theoretically possible to use bignums and long-floats with more than 2^32 significant digits or bits. * doc/cln.tex (logcount): Change return type to uintC. (struct cl_byte): Change elements to uintC. (integer_length, ord2, power2p): Change return type to uintC. (scale_float): Change argument type to sintC. (float_digits, float_precision): Change return type to uintC. * examples/atan_recip.cc: Use uintC instead of uintL where appropriate. * examples/atanh_recip.cc: Likewise. * include/cln/GV.h: Likewise. * include/cln/GV_complex.h: Likewise. * include/cln/GV_integer.h: Likewise. * include/cln/GV_modinteger.h: Likewise. * include/cln/GV_number.h: Likewise. * include/cln/GV_rational.h: Likewise. * include/cln/GV_real.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/SV_complex.h: Likewise. * include/cln/SV_integer.h: Likewise. * include/cln/SV_number.h: Likewise. * include/cln/SV_rational.h: Likewise. * include/cln/SV_real.h: Likewise. * include/cln/SV_ringelt.h: Likewise. * include/cln/dfloat.h: Likewise. * include/cln/ffloat.h: Likewise. * include/cln/float.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/modinteger.h: Likewise. * include/cln/sfloat.h: Likewise. * src/base/cl_low.h (integerlengthC): New macro. * src/base/digitseq/cl_2DS_div.cc: Use uintC instead of uintL where appropriate. * src/base/digitseq/cl_2DS_recip.cc: Likewise. * src/base/digitseq/cl_DS.h: Likewise. * src/base/digitseq/cl_DS_mul.c: Likewise. * src/base/digitseq/cl_DS_mul_fftc.h: Likewise. * src/base/digitseq/cl_DS_mul_fftcs.h: Likewise. * src/base/digitseq/cl_DS_mul_fftm.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp3.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp3m.h: Likewise. * src/base/digitseq/cl_DS_mul_fftr.h: Likewise. * src/base/digitseq/cl_DS_mul_kara.h: Likewise. * src/base/digitseq/cl_DS_mul_nuss.h: Likewise. * src/base/digitseq/cl_DS_recip.cc: Likewise. * src/base/digitseq/cl_DS_recipsqrt.cc: Likewise. * src/base/digitseq/cl_DS_sqrt.cc: Likewise. * src/base/digitseq/cl_DS_trandom.cc: Likewise. * src/complex/input/cl_N_read.cc: Likewise. * src/complex/transcendental/cl_C_asinh_aux.cc: Likewise. * src/complex/transcendental/cl_C_expt_C.cc: Likewise. * src/float/cl_F.h: Likewise. * src/float/conv/cl_F_from_F_f.cc: Likewise. * src/float/conv/cl_F_from_I_f.cc: Likewise. * src/float/conv/cl_F_from_RA_f.cc: Likewise. * src/float/dfloat/conv/cl_I_to_double.cc: Likewise. * src/float/dfloat/conv/cl_RA_to_double.cc: Likewise. * src/float/dfloat/elem/cl_DF_from_I.cc: Likewise. * src/float/dfloat/elem/cl_DF_from_RA.cc: Likewise. * src/float/dfloat/elem/cl_DF_scale.cc: Likewise. * src/float/dfloat/misc/cl_DF_digits.cc: Likewise. * src/float/dfloat/misc/cl_DF_precision.cc: Likewise. * src/float/elem/cl_F_scale.cc: Likewise. * src/float/ffloat/conv/cl_I_to_float.cc: Likewise. * src/float/ffloat/conv/cl_RA_to_float.cc: Likewise. * src/float/ffloat/elem/cl_FF_from_I.cc: Likewise. * src/float/ffloat/elem/cl_FF_from_RA.cc: Likewise. * src/float/ffloat/elem/cl_FF_scale.cc: Likewise. * src/float/ffloat/misc/cl_FF_digits.cc: Likewise. * src/float/ffloat/misc/cl_FF_precision.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_RA.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_digits.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_leninc.cc: Likewise. * src/float/lfloat/misc/cl_LF_lenincx.cc: Likewise. * src/float/lfloat/misc/cl_LF_precision.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_digits.cc: Likewise. * src/float/misc/cl_F_epsneg.cc: Likewise. * src/float/misc/cl_F_epspos.cc: Likewise. * src/float/misc/cl_F_leastneg.cc: Likewise. * src/float/misc/cl_F_leastpos.cc: Likewise. * src/float/misc/cl_F_mostneg.cc: Likewise. * src/float/misc/cl_F_mostpos.cc: Likewise. * src/float/misc/cl_F_precision.cc: Likewise. * src/float/misc/cl_F_rational.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/random/cl_F_random.cc: Likewise. * src/float/sfloat/elem/cl_SF_from_I.cc: Likewise. * src/float/sfloat/elem/cl_SF_from_RA.cc: Likewise. * src/float/sfloat/elem/cl_SF_scale.cc: Likewise. * src/float/sfloat/misc/cl_SF_digits.cc: Likewise. * src/float/sfloat/misc/cl_SF_precision.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_catalanconst_f.cc: Likewise. * src/float/transcendental/cl_F_cos.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_coshsinh.cc: Likewise. * src/float/transcendental/cl_F_cossin.cc: Likewise. * src/float/transcendental/cl_F_eulerconst_f.cc: Likewise. * src/float/transcendental/cl_F_exp1_f.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_ln10_f.cc: Likewise. * src/float/transcendental/cl_F_ln2_f.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_pi_f.cc: Likewise. * src/float/transcendental/cl_F_sin.cc: Likewise. * src/float/transcendental/cl_F_sinh.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_F_tran.h: Likewise. * src/float/transcendental/cl_F_zeta_int_f.cc: Likewise. * src/float/transcendental/cl_LF_atan_recip.cc: Likewise. * src/float/transcendental/cl_LF_atanh_recip.cc: Likewise. * src/float/transcendental/cl_LF_catalanconst.cc: Likewise. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Likewise. * src/float/transcendental/cl_LF_cossin_aux.cc: Likewise. * src/float/transcendental/cl_LF_eulerconst.cc: Likewise. * src/float/transcendental/cl_LF_exp1.cc: Likewise. * src/float/transcendental/cl_LF_exp_aux.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/float/transcendental/cl_LF_ratseries.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_a.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_ab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_b.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_p.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pq.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_q.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqcd.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Likewise. * src/float/transcendental/cl_LF_tran.h: Likewise. * src/float/transcendental/cl_LF_zeta3.cc: Likewise. * src/float/transcendental/cl_LF_zeta_int.cc: Likewise. * src/integer/algebraic/cl_I_rootp_I.cc: Likewise. * src/integer/algebraic/cl_I_rootp_aux.cc: Likewise. * src/integer/bitwise/cl_I_ash.cc: Likewise. * src/integer/bitwise/cl_I_ash_I.cc: Likewise. * src/integer/bitwise/cl_I_byte.h: Likewise. * src/integer/bitwise/cl_I_fullbyte.cc: Likewise. * src/integer/bitwise/cl_I_ilength.cc: Likewise. * src/integer/bitwise/cl_I_ldb.cc: Likewise. * src/integer/bitwise/cl_I_ldbtest.cc: Likewise. * src/integer/bitwise/cl_I_ldbx.cc: Likewise. * src/integer/bitwise/cl_I_ldbxtest.cc: Likewise. * src/integer/bitwise/cl_I_logbitp.cc: Likewise. * src/integer/bitwise/cl_I_logbitp_I.cc: Likewise. * src/integer/bitwise/cl_I_logcount.cc: Likewise. * src/integer/bitwise/cl_I_mkf.cc: Likewise. * src/integer/bitwise/cl_I_mkfx.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/integer/conv/cl_I_to_digits.cc: Likewise. * src/integer/conv/cl_I_digits_need.cc: Likewise. * src/integer/conv/cl_I_from_digits.cc: Likewise. * src/integer/gcd/cl_I_gcd.cc: Likewise. * src/integer/gcd/cl_I_xgcd.cc: Likewise. * src/integer/misc/cl_I_eqhashcode.cc: Likewise. * src/integer/misc/cl_I_ord2.cc: Likewise. * src/integer/misc/cl_I_power2p.cc: Likewise. * src/integer/output/cl_I_cached_power.h (cached_power_table): allow for 40 elements. * src/integer/output/cl_I_decstring.cc: Use uintC instead of uintL where appropriate. * src/integer/output/cl_I_print.cc: Likewise. * src/integer/output/cl_I_print_string.cc: Likewise. * src/modinteger/cl_MI.cc: Likewise. * src/modinteger/cl_MI_lshift.cc: Likewise. * src/modinteger/cl_MI_montgom.h: Likewise. * src/modinteger/cl_MI_pow2.h: Likewise. * src/modinteger/cl_MI_pow2m1.h: Likewise. * src/modinteger/cl_MI_pow2p1.h: Likewise. * src/modinteger/cl_MI_rshift.cc: Likewise. * src/modinteger/cl_MI_std.h: Likewise. * src/numtheory/cl_IF_millerrabin.cc: Likewise. * src/numtheory/cl_nt_isprobprime.cc: Likewise. * src/numtheory/cl_nt_sqrtmodp.cc: Likewise. * src/polynomial/elem/cl_UP_GF2.h: Likewise. * src/real/conv/cl_F_from_R_f.cc: Likewise. * src/real/format-output/cl_fmt_floatstring.cc: Likewise. * src/real/input/cl_R_read.cc: Likewise. * src/vector/cl_GV_I.cc: Likewise. * src/vector/cl_GV_I_copy.cc: Likewise. * src/vector/cl_GV_number.cc: Likewise. * src/vector/cl_GV_number_copy.cc: Likewise. * src/vector/cl_SV_copy.cc: Likewise. * src/vector/cl_SV_number.cc: Likewise. * src/vector/cl_SV_ringelt.cc: Likewise. * tests/main.cc: Likewise. * tests/test_I_ilength.cc: Likewise. * tests/test_I_ord2.cc: Likewise.
19 years ago
25 years ago
2006-04-25 Bruno Haible <bruno@clisp.org> Richard B. Kreckel <kreckel@ginac.de> Make it theoretically possible to use bignums and long-floats with more than 2^32 significant digits or bits. * doc/cln.tex (logcount): Change return type to uintC. (struct cl_byte): Change elements to uintC. (integer_length, ord2, power2p): Change return type to uintC. (scale_float): Change argument type to sintC. (float_digits, float_precision): Change return type to uintC. * examples/atan_recip.cc: Use uintC instead of uintL where appropriate. * examples/atanh_recip.cc: Likewise. * include/cln/GV.h: Likewise. * include/cln/GV_complex.h: Likewise. * include/cln/GV_integer.h: Likewise. * include/cln/GV_modinteger.h: Likewise. * include/cln/GV_number.h: Likewise. * include/cln/GV_rational.h: Likewise. * include/cln/GV_real.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/SV_complex.h: Likewise. * include/cln/SV_integer.h: Likewise. * include/cln/SV_number.h: Likewise. * include/cln/SV_rational.h: Likewise. * include/cln/SV_real.h: Likewise. * include/cln/SV_ringelt.h: Likewise. * include/cln/dfloat.h: Likewise. * include/cln/ffloat.h: Likewise. * include/cln/float.h: Likewise. * include/cln/integer.h: Likewise. * include/cln/lfloat.h: Likewise. * include/cln/modinteger.h: Likewise. * include/cln/sfloat.h: Likewise. * src/base/cl_low.h (integerlengthC): New macro. * src/base/digitseq/cl_2DS_div.cc: Use uintC instead of uintL where appropriate. * src/base/digitseq/cl_2DS_recip.cc: Likewise. * src/base/digitseq/cl_DS.h: Likewise. * src/base/digitseq/cl_DS_mul.c: Likewise. * src/base/digitseq/cl_DS_mul_fftc.h: Likewise. * src/base/digitseq/cl_DS_mul_fftcs.h: Likewise. * src/base/digitseq/cl_DS_mul_fftm.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp3.h: Likewise. * src/base/digitseq/cl_DS_mul_fftp3m.h: Likewise. * src/base/digitseq/cl_DS_mul_fftr.h: Likewise. * src/base/digitseq/cl_DS_mul_kara.h: Likewise. * src/base/digitseq/cl_DS_mul_nuss.h: Likewise. * src/base/digitseq/cl_DS_recip.cc: Likewise. * src/base/digitseq/cl_DS_recipsqrt.cc: Likewise. * src/base/digitseq/cl_DS_sqrt.cc: Likewise. * src/base/digitseq/cl_DS_trandom.cc: Likewise. * src/complex/input/cl_N_read.cc: Likewise. * src/complex/transcendental/cl_C_asinh_aux.cc: Likewise. * src/complex/transcendental/cl_C_expt_C.cc: Likewise. * src/float/cl_F.h: Likewise. * src/float/conv/cl_F_from_F_f.cc: Likewise. * src/float/conv/cl_F_from_I_f.cc: Likewise. * src/float/conv/cl_F_from_RA_f.cc: Likewise. * src/float/dfloat/conv/cl_I_to_double.cc: Likewise. * src/float/dfloat/conv/cl_RA_to_double.cc: Likewise. * src/float/dfloat/elem/cl_DF_from_I.cc: Likewise. * src/float/dfloat/elem/cl_DF_from_RA.cc: Likewise. * src/float/dfloat/elem/cl_DF_scale.cc: Likewise. * src/float/dfloat/misc/cl_DF_digits.cc: Likewise. * src/float/dfloat/misc/cl_DF_precision.cc: Likewise. * src/float/elem/cl_F_scale.cc: Likewise. * src/float/ffloat/conv/cl_I_to_float.cc: Likewise. * src/float/ffloat/conv/cl_RA_to_float.cc: Likewise. * src/float/ffloat/elem/cl_FF_from_I.cc: Likewise. * src/float/ffloat/elem/cl_FF_from_RA.cc: Likewise. * src/float/ffloat/elem/cl_FF_scale.cc: Likewise. * src/float/ffloat/misc/cl_FF_digits.cc: Likewise. * src/float/ffloat/misc/cl_FF_precision.cc: Likewise. * src/float/input/cl_F_read.cc: Likewise. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Likewise. * src/float/lfloat/elem/cl_LF_1plus.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_I_mul.cc: Likewise. * src/float/lfloat/elem/cl_LF_div.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_I.cc: Likewise. * src/float/lfloat/elem/cl_LF_from_RA.cc: Likewise. * src/float/lfloat/elem/cl_LF_fround.cc: Likewise. * src/float/lfloat/elem/cl_LF_ftrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_futrunc.cc: Likewise. * src/float/lfloat/elem/cl_LF_scale.cc: Likewise. * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise. * src/float/lfloat/misc/cl_LF_digits.cc: Likewise. * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise. * src/float/lfloat/misc/cl_LF_leninc.cc: Likewise. * src/float/lfloat/misc/cl_LF_lenincx.cc: Likewise. * src/float/lfloat/misc/cl_LF_precision.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise. * src/float/misc/cl_F_digits.cc: Likewise. * src/float/misc/cl_F_epsneg.cc: Likewise. * src/float/misc/cl_F_epspos.cc: Likewise. * src/float/misc/cl_F_leastneg.cc: Likewise. * src/float/misc/cl_F_leastpos.cc: Likewise. * src/float/misc/cl_F_mostneg.cc: Likewise. * src/float/misc/cl_F_mostpos.cc: Likewise. * src/float/misc/cl_F_precision.cc: Likewise. * src/float/misc/cl_F_rational.cc: Likewise. * src/float/misc/cl_F_shortenrel.cc: Likewise. * src/float/output/cl_F_dprint.cc: Likewise. * src/float/random/cl_F_random.cc: Likewise. * src/float/sfloat/elem/cl_SF_from_I.cc: Likewise. * src/float/sfloat/elem/cl_SF_from_RA.cc: Likewise. * src/float/sfloat/elem/cl_SF_scale.cc: Likewise. * src/float/sfloat/misc/cl_SF_digits.cc: Likewise. * src/float/sfloat/misc/cl_SF_precision.cc: Likewise. * src/float/transcendental/cl_F_atanhx.cc: Likewise. * src/float/transcendental/cl_F_atanx.cc: Likewise. * src/float/transcendental/cl_F_catalanconst_f.cc: Likewise. * src/float/transcendental/cl_F_cos.cc: Likewise. * src/float/transcendental/cl_F_cosh.cc: Likewise. * src/float/transcendental/cl_F_coshsinh.cc: Likewise. * src/float/transcendental/cl_F_cossin.cc: Likewise. * src/float/transcendental/cl_F_eulerconst_f.cc: Likewise. * src/float/transcendental/cl_F_exp1_f.cc: Likewise. * src/float/transcendental/cl_F_expx.cc: Likewise. * src/float/transcendental/cl_F_ln10_f.cc: Likewise. * src/float/transcendental/cl_F_ln2_f.cc: Likewise. * src/float/transcendental/cl_F_lnx.cc: Likewise. * src/float/transcendental/cl_F_pi_f.cc: Likewise. * src/float/transcendental/cl_F_sin.cc: Likewise. * src/float/transcendental/cl_F_sinh.cc: Likewise. * src/float/transcendental/cl_F_sinhx.cc: Likewise. * src/float/transcendental/cl_F_sinx.cc: Likewise. * src/float/transcendental/cl_F_tran.h: Likewise. * src/float/transcendental/cl_F_zeta_int_f.cc: Likewise. * src/float/transcendental/cl_LF_atan_recip.cc: Likewise. * src/float/transcendental/cl_LF_atanh_recip.cc: Likewise. * src/float/transcendental/cl_LF_catalanconst.cc: Likewise. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Likewise. * src/float/transcendental/cl_LF_cossin_aux.cc: Likewise. * src/float/transcendental/cl_LF_eulerconst.cc: Likewise. * src/float/transcendental/cl_LF_exp1.cc: Likewise. * src/float/transcendental/cl_LF_exp_aux.cc: Likewise. * src/float/transcendental/cl_LF_pi.cc: Likewise. * src/float/transcendental/cl_LF_ratseries.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_a.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_ab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_b.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_p.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pq.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_q.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_qb.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Likewise. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqcd.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Likewise. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Likewise. * src/float/transcendental/cl_LF_tran.h: Likewise. * src/float/transcendental/cl_LF_zeta3.cc: Likewise. * src/float/transcendental/cl_LF_zeta_int.cc: Likewise. * src/integer/algebraic/cl_I_rootp_I.cc: Likewise. * src/integer/algebraic/cl_I_rootp_aux.cc: Likewise. * src/integer/bitwise/cl_I_ash.cc: Likewise. * src/integer/bitwise/cl_I_ash_I.cc: Likewise. * src/integer/bitwise/cl_I_byte.h: Likewise. * src/integer/bitwise/cl_I_fullbyte.cc: Likewise. * src/integer/bitwise/cl_I_ilength.cc: Likewise. * src/integer/bitwise/cl_I_ldb.cc: Likewise. * src/integer/bitwise/cl_I_ldbtest.cc: Likewise. * src/integer/bitwise/cl_I_ldbx.cc: Likewise. * src/integer/bitwise/cl_I_ldbxtest.cc: Likewise. * src/integer/bitwise/cl_I_logbitp.cc: Likewise. * src/integer/bitwise/cl_I_logbitp_I.cc: Likewise. * src/integer/bitwise/cl_I_logcount.cc: Likewise. * src/integer/bitwise/cl_I_mkf.cc: Likewise. * src/integer/bitwise/cl_I_mkfx.cc: Likewise. * src/integer/cl_I.h: Likewise. * src/integer/conv/cl_I_to_digits.cc: Likewise. * src/integer/conv/cl_I_digits_need.cc: Likewise. * src/integer/conv/cl_I_from_digits.cc: Likewise. * src/integer/gcd/cl_I_gcd.cc: Likewise. * src/integer/gcd/cl_I_xgcd.cc: Likewise. * src/integer/misc/cl_I_eqhashcode.cc: Likewise. * src/integer/misc/cl_I_ord2.cc: Likewise. * src/integer/misc/cl_I_power2p.cc: Likewise. * src/integer/output/cl_I_cached_power.h (cached_power_table): allow for 40 elements. * src/integer/output/cl_I_decstring.cc: Use uintC instead of uintL where appropriate. * src/integer/output/cl_I_print.cc: Likewise. * src/integer/output/cl_I_print_string.cc: Likewise. * src/modinteger/cl_MI.cc: Likewise. * src/modinteger/cl_MI_lshift.cc: Likewise. * src/modinteger/cl_MI_montgom.h: Likewise. * src/modinteger/cl_MI_pow2.h: Likewise. * src/modinteger/cl_MI_pow2m1.h: Likewise. * src/modinteger/cl_MI_pow2p1.h: Likewise. * src/modinteger/cl_MI_rshift.cc: Likewise. * src/modinteger/cl_MI_std.h: Likewise. * src/numtheory/cl_IF_millerrabin.cc: Likewise. * src/numtheory/cl_nt_isprobprime.cc: Likewise. * src/numtheory/cl_nt_sqrtmodp.cc: Likewise. * src/polynomial/elem/cl_UP_GF2.h: Likewise. * src/real/conv/cl_F_from_R_f.cc: Likewise. * src/real/format-output/cl_fmt_floatstring.cc: Likewise. * src/real/input/cl_R_read.cc: Likewise. * src/vector/cl_GV_I.cc: Likewise. * src/vector/cl_GV_I_copy.cc: Likewise. * src/vector/cl_GV_number.cc: Likewise. * src/vector/cl_GV_number_copy.cc: Likewise. * src/vector/cl_SV_copy.cc: Likewise. * src/vector/cl_SV_number.cc: Likewise. * src/vector/cl_SV_ringelt.cc: Likewise. * tests/main.cc: Likewise. * tests/test_I_ilength.cc: Likewise. * tests/test_I_ord2.cc: Likewise.
19 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. // Public double float operations.
  2. #ifndef _CL_DFLOAT_H
  3. #define _CL_DFLOAT_H
  4. #include "cln/number.h"
  5. #include "cln/dfloat_class.h"
  6. #include "cln/integer_class.h"
  7. #include "cln/float.h"
  8. namespace cln {
  9. CL_DEFINE_AS_CONVERSION(cl_DF)
  10. // Liefert zu einem Double-Float x : (- x), ein DF.
  11. extern const cl_DF operator- (const cl_DF& x);
  12. // compare(x,y) vergleicht zwei Double-Floats x und y.
  13. // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x<y.
  14. extern cl_signean compare (const cl_DF& x, const cl_DF& y);
  15. // equal_hashcode(x) liefert einen equal-invarianten Hashcode für x.
  16. extern uint32 equal_hashcode (const cl_DF& x);
  17. inline bool operator== (const cl_DF& x, const cl_DF& y)
  18. { return compare(x,y)==0; }
  19. inline bool operator!= (const cl_DF& x, const cl_DF& y)
  20. { return compare(x,y)!=0; }
  21. inline bool operator<= (const cl_DF& x, const cl_DF& y)
  22. { return compare(x,y)<=0; }
  23. inline bool operator< (const cl_DF& x, const cl_DF& y)
  24. { return compare(x,y)<0; }
  25. inline bool operator>= (const cl_DF& x, const cl_DF& y)
  26. { return compare(x,y)>=0; }
  27. inline bool operator> (const cl_DF& x, const cl_DF& y)
  28. { return compare(x,y)>0; }
  29. // minusp(x) == (< x 0)
  30. extern bool minusp (const cl_DF& x);
  31. // zerop(x) stellt fest, ob ein Double-Float x = 0.0 ist.
  32. extern bool zerop (const cl_DF& x);
  33. // plusp(x) == (> x 0)
  34. extern bool plusp (const cl_DF& x);
  35. // Liefert zu zwei Double-Float x und y : (+ x y), ein DF.
  36. extern const cl_DF operator+ (const cl_DF& x, const cl_DF& y);
  37. // The C++ compiler may hesitate to do these conversions of its own:
  38. inline const cl_DF operator+ (const cl_DF& x, const double y)
  39. { return x + cl_DF(y); }
  40. inline const cl_DF operator+ (const double x, const cl_DF& y)
  41. { return cl_DF(x) + y; }
  42. // Liefert zu zwei Double-Float x und y : (- x y), ein DF.
  43. extern const cl_DF operator- (const cl_DF& x, const cl_DF& y);
  44. // The C++ compiler may hesitate to do these conversions of its own:
  45. inline const cl_DF operator- (const cl_DF& x, const double y)
  46. { return x - cl_DF(y); }
  47. inline const cl_DF operator- (const double x, const cl_DF& y)
  48. { return cl_DF(x) - y; }
  49. // Liefert zu zwei Double-Float x und y : (* x y), ein DF.
  50. extern const cl_DF operator* (const cl_DF& x, const cl_DF& y);
  51. // The C++ compiler may hesitate to do these conversions of its own:
  52. inline const cl_DF operator* (const cl_DF& x, const double y)
  53. { return x * cl_DF(y); }
  54. inline const cl_DF operator* (const double x, const cl_DF& y)
  55. { return cl_DF(x) * y; }
  56. // Liefert zu einem Double-Float x : (* x x), ein DF.
  57. inline const cl_DF square (const cl_DF& x) { return x*x; }
  58. // Liefert zu zwei Double-Float x und y : (/ x y), ein DF.
  59. extern const cl_DF operator/ (const cl_DF& x, const cl_DF& y);
  60. // The C++ compiler may hesitate to do these conversions of its own:
  61. inline const cl_DF operator/ (const cl_DF& x, const double y)
  62. { return x / cl_DF(y); }
  63. inline const cl_DF operator/ (const double x, const cl_DF& y)
  64. { return cl_DF(x) / y; }
  65. // Liefert zu einem Double-Float x>=0 : (sqrt x), ein DF.
  66. extern const cl_DF sqrt (const cl_DF& x);
  67. // recip(x) liefert (/ x), wo x ein Double-Float ist.
  68. extern const cl_DF recip (const cl_DF& x);
  69. // abs(x) liefert (abs x), wo x ein Double-Float ist.
  70. extern const cl_DF abs (const cl_DF& x);
  71. // (1+ x), wo x ein Double-Float ist.
  72. inline const cl_DF plus1 (const cl_DF& x)
  73. {
  74. extern const cl_DF cl_I_to_DF (const cl_I&);
  75. return x + cl_I_to_DF(cl_I(1));
  76. }
  77. // (1- x), wo x ein Double-Float ist.
  78. inline const cl_DF minus1 (const cl_DF& x)
  79. {
  80. extern const cl_DF cl_I_to_DF (const cl_I&);
  81. return x + cl_I_to_DF(cl_I(-1));
  82. }
  83. // ffloor(x) liefert (ffloor x), wo x ein DF ist.
  84. extern const cl_DF ffloor (const cl_DF& x);
  85. // fceiling(x) liefert (fceiling x), wo x ein DF ist.
  86. extern const cl_DF fceiling (const cl_DF& x);
  87. // ftruncate(x) liefert (ftruncate x), wo x ein DF ist.
  88. extern const cl_DF ftruncate (const cl_DF& x);
  89. // fround(x) liefert (fround x), wo x ein DF ist.
  90. extern const cl_DF fround (const cl_DF& x);
  91. // Return type for frounding operators.
  92. // x / y --> (q,r) with x = y*q+r.
  93. struct cl_DF_fdiv_t {
  94. cl_DF quotient;
  95. cl_DF remainder;
  96. // Constructor.
  97. cl_DF_fdiv_t () {}
  98. cl_DF_fdiv_t (const cl_DF& q, const cl_DF& r) : quotient(q), remainder(r) {}
  99. };
  100. // ffloor2(x) liefert (ffloor x), wo x ein DF ist.
  101. inline const cl_DF_fdiv_t ffloor2 (const cl_DF& x)
  102. { cl_DF q = ffloor(x); return cl_DF_fdiv_t(q,x-q); }
  103. // fceiling2(x) liefert (fceiling x), wo x ein DF ist.
  104. inline const cl_DF_fdiv_t fceiling2 (const cl_DF& x)
  105. { cl_DF q = fceiling(x); return cl_DF_fdiv_t(q,x-q); }
  106. // ftruncate2(x) liefert (ftruncate x), wo x ein DF ist.
  107. inline const cl_DF_fdiv_t ftruncate2 (const cl_DF& x)
  108. { cl_DF q = ftruncate(x); return cl_DF_fdiv_t(q,x-q); }
  109. // fround2(x) liefert (fround x), wo x ein DF ist.
  110. inline const cl_DF_fdiv_t fround2 (const cl_DF& x)
  111. { cl_DF q = fround(x); return cl_DF_fdiv_t(q,x-q); }
  112. // Return type for rounding operators.
  113. // x / y --> (q,r) with x = y*q+r.
  114. struct cl_DF_div_t {
  115. cl_I quotient;
  116. cl_DF remainder;
  117. // Constructor.
  118. cl_DF_div_t () {}
  119. cl_DF_div_t (const cl_I& q, const cl_DF& r) : quotient(q), remainder(r) {}
  120. };
  121. // floor2(x) liefert (floor x), wo x ein DF ist.
  122. inline const cl_DF_div_t floor2 (const cl_DF& x)
  123. {
  124. extern const cl_I cl_DF_to_I (const cl_DF& x);
  125. cl_DF q = ffloor(x);
  126. return cl_DF_div_t(cl_DF_to_I(q),x-q);
  127. }
  128. inline const cl_I floor1 (const cl_DF& x)
  129. {
  130. extern const cl_I cl_DF_to_I (const cl_DF& x);
  131. return cl_DF_to_I(ffloor(x));
  132. }
  133. // ceiling2(x) liefert (ceiling x), wo x ein DF ist.
  134. inline const cl_DF_div_t ceiling2 (const cl_DF& x)
  135. {
  136. extern const cl_I cl_DF_to_I (const cl_DF& x);
  137. cl_DF q = fceiling(x);
  138. return cl_DF_div_t(cl_DF_to_I(q),x-q);
  139. }
  140. inline const cl_I ceiling1 (const cl_DF& x)
  141. {
  142. extern const cl_I cl_DF_to_I (const cl_DF& x);
  143. return cl_DF_to_I(fceiling(x));
  144. }
  145. // truncate2(x) liefert (truncate x), wo x ein DF ist.
  146. inline const cl_DF_div_t truncate2 (const cl_DF& x)
  147. {
  148. extern const cl_I cl_DF_to_I (const cl_DF& x);
  149. cl_DF q = ftruncate(x);
  150. return cl_DF_div_t(cl_DF_to_I(q),x-q);
  151. }
  152. inline const cl_I truncate1 (const cl_DF& x)
  153. {
  154. extern const cl_I cl_DF_to_I (const cl_DF& x);
  155. return cl_DF_to_I(ftruncate(x));
  156. }
  157. // round2(x) liefert (round x), wo x ein DF ist.
  158. inline const cl_DF_div_t round2 (const cl_DF& x)
  159. {
  160. extern const cl_I cl_DF_to_I (const cl_DF& x);
  161. cl_DF q = fround(x);
  162. return cl_DF_div_t(cl_DF_to_I(q),x-q);
  163. }
  164. inline const cl_I round1 (const cl_DF& x)
  165. {
  166. extern const cl_I cl_DF_to_I (const cl_DF& x);
  167. return cl_DF_to_I(fround(x));
  168. }
  169. // floor2(x,y) liefert (floor x y).
  170. extern const cl_DF_div_t floor2 (const cl_DF& x, const cl_DF& y);
  171. inline const cl_I floor1 (const cl_DF& x, const cl_DF& y) { return floor1(x/y); }
  172. // ceiling2(x,y) liefert (ceiling x y).
  173. extern const cl_DF_div_t ceiling2 (const cl_DF& x, const cl_DF& y);
  174. inline const cl_I ceiling1 (const cl_DF& x, const cl_DF& y) { return ceiling1(x/y); }
  175. // truncate2(x,y) liefert (truncate x y).
  176. extern const cl_DF_div_t truncate2 (const cl_DF& x, const cl_DF& y);
  177. inline const cl_I truncate1 (const cl_DF& x, const cl_DF& y) { return truncate1(x/y); }
  178. // round2(x,y) liefert (round x y).
  179. extern const cl_DF_div_t round2 (const cl_DF& x, const cl_DF& y);
  180. inline const cl_I round1 (const cl_DF& x, const cl_DF& y) { return round1(x/y); }
  181. // Return type for decode_float:
  182. struct decoded_dfloat {
  183. cl_DF mantissa;
  184. cl_I exponent;
  185. cl_DF sign;
  186. // Constructor.
  187. decoded_dfloat () {}
  188. decoded_dfloat (const cl_DF& m, const cl_I& e, const cl_DF& s) : mantissa(m), exponent(e), sign(s) {}
  189. };
  190. // decode_float(x) liefert zu einem Float x: (decode-float x).
  191. // x = 0.0 liefert (0.0, 0, 1.0).
  192. // x = (-1)^s * 2^e * m liefert ((-1)^0 * 2^0 * m, e als Integer, (-1)^s).
  193. extern const decoded_dfloat decode_float (const cl_DF& x);
  194. // float_exponent(x) liefert zu einem Float x:
  195. // den Exponenten von (decode-float x).
  196. // x = 0.0 liefert 0.
  197. // x = (-1)^s * 2^e * m liefert e.
  198. extern sintE float_exponent (const cl_DF& x);
  199. // float_radix(x) liefert (float-radix x), wo x ein Float ist.
  200. inline sintL float_radix (const cl_DF& x)
  201. {
  202. (void)x; // unused x
  203. return 2;
  204. }
  205. // float_sign(x) liefert (float-sign x), wo x ein Float ist.
  206. extern const cl_DF float_sign (const cl_DF& x);
  207. // float_digits(x) liefert (float-digits x), wo x ein Float ist.
  208. // < ergebnis: ein uintC >0
  209. extern uintC float_digits (const cl_DF& x);
  210. // float_precision(x) liefert (float-precision x), wo x ein Float ist.
  211. // < ergebnis: ein uintC >=0
  212. extern uintC float_precision (const cl_DF& x);
  213. // integer_decode_float(x) liefert zu einem Float x: (integer-decode-float x).
  214. // x = 0.0 liefert (0, 0, 1).
  215. // x = (-1)^s * 2^e * m bei Float-Precision p liefert
  216. // (Mantisse 2^p * m als Integer, e-p als Integer, (-1)^s als Fixnum).
  217. extern const cl_idecoded_float integer_decode_float (const cl_DF& x);
  218. // scale_float(x,delta) liefert x*2^delta, wo x ein DF ist.
  219. extern const cl_DF scale_float (const cl_DF& x, sintC delta);
  220. extern const cl_DF scale_float (const cl_DF& x, const cl_I& delta);
  221. // max(x,y) liefert (max x y), wo x und y Floats sind.
  222. extern const cl_DF max (const cl_DF& x, const cl_DF& y);
  223. // min(x,y) liefert (min x y), wo x und y Floats sind.
  224. extern const cl_DF min (const cl_DF& x, const cl_DF& y);
  225. // signum(x) liefert (signum x), wo x ein Float ist.
  226. extern const cl_DF signum (const cl_DF& x);
  227. // Konversion zu einem C "float".
  228. extern float float_approx (const cl_DF& x);
  229. // Konversion zu einem C "double".
  230. extern double double_approx (const cl_DF& x);
  231. // This could be optimized to use in-place operations.
  232. inline cl_DF& operator+= (cl_DF& x, const cl_DF& y) { return x = x + y; }
  233. inline cl_DF& operator+= (cl_DF& x, const double y) { return x = x + y; }
  234. inline cl_DF& operator++ /* prefix */ (cl_DF& x) { return x = plus1(x); }
  235. inline void operator++ /* postfix */ (cl_DF& x, int dummy) { (void)dummy; x = plus1(x); }
  236. inline cl_DF& operator-= (cl_DF& x, const cl_DF& y) { return x = x - y; }
  237. inline cl_DF& operator-= (cl_DF& x, const double y) { return x = x - y; }
  238. inline cl_DF& operator-- /* prefix */ (cl_DF& x) { return x = minus1(x); }
  239. inline void operator-- /* postfix */ (cl_DF& x, int dummy) { (void)dummy; x = minus1(x); }
  240. inline cl_DF& operator*= (cl_DF& x, const cl_DF& y) { return x = x * y; }
  241. inline cl_DF& operator*= (cl_DF& x, const double y) { return x = x * y; }
  242. inline cl_DF& operator/= (cl_DF& x, const cl_DF& y) { return x = x / y; }
  243. inline cl_DF& operator/= (cl_DF& x, const double y) { return x = x / y; }
  244. /* */
  245. // Runtime typing support.
  246. extern cl_class cl_class_dfloat;
  247. // Debugging support.
  248. #ifdef CL_DEBUG
  249. extern int cl_DF_debug_module;
  250. CL_FORCE_LINK(cl_DF_debug_dummy, cl_DF_debug_module)
  251. #endif
  252. } // namespace cln
  253. #endif /* _CL_DFLOAT_H */