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.

3782 lines
129 KiB

25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 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
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 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
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 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
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
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
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
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
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
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
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
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
25 years ago
25 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
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
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
25 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
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
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
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
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 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
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
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
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
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
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
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
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 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
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
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
25 years ago
Remove exception hooks in favor of real C++ exceptions: * include/cln/exception.h: New file... * include/cln/cln.h: ...included here... * include/cln/rational.h: ...and here. * include/cln/abort.h: Removed. * include/cln/integer.h (ash_exception, exquo_exception): Add exception types. * include/cln/float.h (floating_point_exception, floating_point_nan_exception, floating_point_overflow_exception, floating_point_underflow_exception): Likewise. * include/cln/number_io.h (read_number_exception, read_number_bad_syntax_exception, read_number_junk_exception, read_number_eof_exception): Likewise. * include/cln/object.h (CL_DEFINE_CONVERTER): Replace dynamic assertion with a compile-time assertion. * include/cln/GV.h: Replace nonreturning functions with exceptions. * include/cln/modinteger.h: Likewise. * include/cln/SV.h: Likewise. * include/cln/ring.h: Likewise. * include/cln/string.h: Likewise. * include/cln/univpoly.h: Likewise. * src/base/cl_abort.cc: Removed. * src/base/cl_N_err_d0.cc: Removed. * src/base/cl_d0_exception.cc: New file. * src/base/cl_as_err.cc: Removed. * src/base/cl_as_exception.cc: New file. * src/base/cl_notreached.cc: Removed. * src/base/cl_notreached_exception.cc: New file. * src/base/input/cl_read_err_bad.cc: Removed. * src/base/input/cl_read_bad_syntax_exception.cc: New file. * src/base/input/cl_read_err_junk.cc: Removed. * src/base/input/cl_read_junk_exception.cc: New file. * src/base/input/cl_read_err_eof.cc: Removed. * src/base/input/cl_read_eof_exception.cc: New file. * src/base/cl_N.h (cl_as_error): Removed (see cln/exception.h). * src/base/macros.h (NOTREACHED): Throw. * src/base/cl_malloc.cc (xmalloc): Throw. * src/base/digitseq/cl_2DS_div.cc: Throw. * src/base/digitseq/cl_DS_div.cc: Throw. * src/base/digitseq/cl_DS_mul.cc: Throw. * src/base/digitseq/cl_DS_mul_fftc.h: Throw. * src/base/digitseq/cl_DS_mul_fftcs.h: Throw. * src/base/digitseq/cl_DS_mul_fftm.h: Throw. * src/base/digitseq/cl_DS_mul_fftp.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3.h: Throw. * src/base/digitseq/cl_DS_mul_fftp3m.h: Throw. * src/base/digitseq/cl_DS_mul_fftr.h: Throw. * src/base/digitseq/cl_DS_mul_nuss.h: Throw. * src/base/digitseq/cl_DS_recipsqrt.cc: Throw. * src/base/digitseq/cl_DS_sqrt.cc: Throw. * src/base/hash/cl_hash.h: Throw. * src/base/hash/cl_hash1.h: Throw. * src/base/hash/cl_hash1weak.h: Throw. * src/base/hash/cl_hash2.h: Throw. * src/base/hash/cl_hash2weak.h: Throw. * src/base/hash/cl_hashset.h: Throw. * src/base/hash/cl_hashuniq.h: Throw. * src/base/hash/cl_hashuniqweak.h: Throw. * src/base/proplist/cl_pl_add.cc: Throw. * src/base/ring/cl_no_ring.cc: Throw. * src/base/string/cl_spushstring.h: Throw. * src/base/symbol/cl_symbol.cc: Throw. * src/integer/bitwise/cl_I_ash.h: Removed (see cln/integer.h.) * src/integer/bitwise/cl_I_asherr.cc: Removed. * src/integer/bitwise/cl_I_ash_exception.cc: New file. * src/integer/division/cl_I_exquoerr.cc: Removed. * src/integer/division/cl_I_exquo_exception.cc: New file. * src/integer/cl_I.h: Throw. * src/integer/division/cl_I_exquopos.cc: Throw. * src/integer/bitwise/cl_I_logbitp_I.cc: Throw. * src/integer/bitwise/cl_I_ash.cc: Throw. * src/integer/bitwise/cl_I_ash_I.cc: Throw. * src/integer/division/cl_I_exquo.cc: Throw. * src/integer/gcd/cl_I_gcd_aux2.cc: Throw. * src/integer/conv/cl_I_to_L.cc: Throw. * src/integer/conv/cl_I_to_Q.cc: Throw. * src/integer/conv/cl_I_to_UL.cc: Throw. * src/integer/conv/cl_I_to_UQ.cc: Throw. * src/integer/conv/cl_I_to_digits.cc: Throw. * src/integer/elem/cl_I_div.cc: Throw. * src/integer/algebraic/cl_I_sqrt.cc: Throw. * src/integer/input/cl_I_read.cc: Throw. * src/integer/input/cl_I_read_stream.cc: Throw. * src/integer/misc/cl_I_as.cc: Throw. * src/rational/elem/cl_RA_from_I_I_div.cc: Throw. * src/rational/elem/cl_RA_recip.cc: Throw. * src/rational/input/cl_RA_read.cc: Throw. * src/rational/input/cl_RA_read_stream.cc: Throw. * src/rational/input/cl_RA_readparsed.cc: Throw. * src/rational/misc/cl_RA_as.cc: Throw. * src/float/base/cl_F_err_nan.cc: Removed. * src/float/base/cl_F_nan_exception.cc: New file. * src/float/base/cl_F_err_un.cc: Removed. * src/float/base/cl_F_underflow_exception.cc: New file. * src/float/base/cl_F_err_ov.cc: Removed. * src/float/base/cl_F_overflow_exception.cc: New file. * src/float/cl_F.h (cl_error_floating_point_nan, cl_error_floating_point_overflow, cl_error_floating_point_underflow): Removed (see cln/float.h.) * src/float/sfloat/cl_SF.h: Throw. * src/float/sfloat/elem/cl_SF_div.cc: Throw. * src/float/sfloat/elem/cl_SF_from_RA.cc: Throw. * src/float/sfloat/elem/cl_SF_scale.cc: Throw. * src/float/sfloat/elem/cl_SF_scale_I.cc: Throw. * src/float/sfloat/misc/cl_SF_as.cc: Throw. * src/float/ffloat/cl_FF.h: Throw. * src/float/ffloat/conv/cl_FF_from_float.cc: Throw. * src/float/ffloat/elem/cl_FF_div.cc: Throw. * src/float/ffloat/elem/cl_FF_from_RA.cc: Throw. * src/float/ffloat/elem/cl_FF_scale.cc: Throw. * src/float/ffloat/elem/cl_FF_scale_I.cc: Throw. * src/float/ffloat/misc/cl_FF_as.cc: Throw. * src/float/dfloat/cl_DF.h: Throw. * src/float/dfloat/conv/cl_DF_from_double.cc: Throw. * src/float/dfloat/elem/cl_DF_div.cc: Throw. * src/float/dfloat/elem/cl_DF_from_RA.cc: Throw. * src/float/dfloat/elem/cl_DF_scale.cc: Throw. * src/float/dfloat/elem/cl_DF_scale_I.cc: Throw. * src/float/dfloat/misc/cl_DF_as.cc: Throw. * src/float/lfloat/algebraic/cl_LF_sqrt.cc: Throw. * src/float/lfloat/elem/cl_LF_1plus.cc: Throw. * src/float/lfloat/elem/cl_LF_I_div.cc: Throw. * src/float/lfloat/elem/cl_LF_I_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_div.cc: Throw. * src/float/lfloat/elem/cl_LF_from_I.cc: Throw. * src/float/lfloat/elem/cl_LF_mul.cc: Throw. * src/float/lfloat/elem/cl_LF_scale.cc: Throw. * src/float/lfloat/elem/cl_LF_scale_I.cc: Throw. * src/float/lfloat/elem/cl_LF_square.cc: Throw. * src/float/lfloat/misc/cl_LF_as.cc: Throw. * src/float/lfloat/misc/cl_LF_shorten.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenrel.cc: Throw. * src/float/lfloat/misc/cl_LF_shortenwith.cc: Throw. * src/float/input/cl_F_read.cc: Throw. * src/float/input/cl_F_read_stream.cc: Throw. * src/float/misc/cl_F_as.cc: Throw. * src/float/misc/cl_F_shortenrel.cc: Throw. * src/float/transcendental/cl_LF_coshsinh_aux.cc: Throw. * src/float/transcendental/cl_LF_cossin_aux.cc: Throw. * src/float/transcendental/cl_LF_exp_aux.cc: Throw. * src/float/transcendental/cl_LF_ratseries_a.cc: Throw. * src/float/transcendental/cl_LF_ratseries_ab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_b.cc: Throw. * src/float/transcendental/cl_LF_ratseries_p.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_q.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_qb.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pq.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqa.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqab.cc: Throw. * src/float/transcendental/cl_LF_ratseries_stream_pqb.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd.cc: Throw. * src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc: Throw. * src/float/transcendental/cl_LF_zeta_int.cc: Throw. * src/real/elem/cl_R_div.cc: Throw. * src/real/format-output/cl_fmt_cardinal.cc: Throw. * src/real/format-output/cl_fmt_newroman.cc: Throw. * src/real/format-output/cl_fmt_oldroman.cc: Throw. * src/real/input/cl_R_read.cc: Throw. * src/real/input/cl_R_read_stream.cc: Throw. * src/real/misc/cl_R_as.cc: Throw. * src/real/random/cl_R_random.cc: Throw. * src/real/transcendental/cl_R_atan2.cc: Throw. * src/real/transcendental/cl_R_log.cc: Throw. * src/complex/input/cl_N_read.cc: Throw. * src/complex/input/cl_N_read_stream.cc: Throw. * src/complex/misc/cl_N_as.cc: Throw. * src/complex/transcendental/cl_C_atanh_aux.cc: Throw. * src/complex/transcendental/cl_C_expt_C.cc: Throw. * src/complex/transcendental/cl_C_log.cc: Throw. * src/complex/transcendental/cl_C_log2.cc: Throw. * src/numtheory/cl_nt_cornacchia1.cc: Throw. * src/numtheory/cl_nt_cornacchia4.cc: Throw. * src/numtheory/cl_nt_isprobprime.cc: Throw. * src/numtheory/cl_nt_jacobi.cc: Throw. * src/numtheory/cl_nt_jacobi_low.cc: Throw. * src/numtheory/cl_nt_sqrtmodp.cc: Throw. * src/modinteger/cl_MI.cc: Throw. * src/modinteger/cl_MI_int.h: Throw. * src/modinteger/cl_MI_montgom.h: Throw. * src/modinteger/cl_MI_pow2.h: Throw. * src/modinteger/cl_MI_rshift.cc: Throw. * src/modinteger/cl_MI_std.h: Throw. * src/polynomial/elem/cl_UP_GF2.h: Throw. * src/polynomial/elem/cl_UP_MI.h: Throw. * src/polynomial/elem/cl_UP_gen.h: Throw. * src/polynomial/elem/cl_UP_named.cc: Throw. * src/polynomial/elem/cl_UP_no_ring.cc (uninitialized_error, uninitialized_ring): Removed (see cln/ring.h.) * src/polynomial/elem/cl_UP_number.h: Throw. * src/polynomial/elem/cl_UP_unnamed.cc: Throw. * src/vector/cl_GV_I.cc: Throw. * src/vector/cl_GV_number.cc: Throw. * tests/timediv2adic-compare.cc: Use default abort(), not cl_abort(). * tests/timeprint-compare.cc: Likewise. * tests/timerecip2adic-compare.cc: Likewise. * doc/cln.tex: Document the exception classes. * examples/contfrac.cc: Use try/catch instead of setjmp/longjmp. * INSTALL: undocument -fno-exceptions. * README: Add exceptions to list of used C++ features.
18 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. \input texinfo @c -*-texinfo-*-
  2. @c %**start of header
  3. @setfilename cln.info
  4. @settitle CLN, a Class Library for Numbers
  5. @c @setchapternewpage off
  6. @c I hate putting "@noindent" in front of every paragraph.
  7. @c For `info' and TeX only.
  8. @paragraphindent 0
  9. @c %**end of header
  10. @dircategory Mathematics
  11. @direntry
  12. * CLN: (cln). Class Library for Numbers (C++).
  13. @end direntry
  14. @c My own index.
  15. @defindex my
  16. @c Don't need the other types of indices.
  17. @synindex cp my
  18. @synindex fn my
  19. @synindex vr my
  20. @synindex ky my
  21. @synindex pg my
  22. @synindex tp my
  23. @c For `info' only.
  24. @ifinfo
  25. This file documents @sc{cln}, a Class Library for Numbers.
  26. Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
  27. Richard B. Kreckel, @code{<kreckel@@ginac.de>}.
  28. Copyright (C) Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
  29. Copyright (C) Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
  30. Permission is granted to make and distribute verbatim copies of
  31. this manual provided the copyright notice and this permission notice
  32. are preserved on all copies.
  33. @ignore
  34. Permission is granted to process this file through TeX and print the
  35. results, provided the printed document carries copying permission
  36. notice identical to this one except for the removal of this paragraph
  37. (this paragraph not being relevant to the printed manual).
  38. @end ignore
  39. Permission is granted to copy and distribute modified versions of this
  40. manual under the conditions for verbatim copying, provided that the entire
  41. resulting derived work is distributed under the terms of a permission
  42. notice identical to this one.
  43. Permission is granted to copy and distribute translations of this manual
  44. into another language, under the above conditions for modified versions,
  45. except that this permission notice may be stated in a translation approved
  46. by the author.
  47. @end ifinfo
  48. @c For TeX only.
  49. @c prevent ugly black rectangles on overfull hbox lines:
  50. @finalout
  51. @titlepage
  52. @title CLN, a Class Library for Numbers
  53. @author @uref{http://www.ginac.de/CLN}
  54. @page
  55. @vskip 0pt plus 1filll
  56. Copyright @copyright{} Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
  57. @sp 0
  58. Copyright @copyright{} Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
  59. @sp 2
  60. Published by Bruno Haible, @code{<haible@@clisp.cons.org>} and
  61. Richard B. Kreckel, @code{<kreckel@@ginac.de>}.
  62. Permission is granted to make and distribute verbatim copies of
  63. this manual provided the copyright notice and this permission notice
  64. are preserved on all copies.
  65. Permission is granted to copy and distribute modified versions of this
  66. manual under the conditions for verbatim copying, provided that the entire
  67. resulting derived work is distributed under the terms of a permission
  68. notice identical to this one.
  69. Permission is granted to copy and distribute translations of this manual
  70. into another language, under the above conditions for modified versions,
  71. except that this permission notice may be stated in a translation approved
  72. by the authors.
  73. @end titlepage
  74. @page
  75. @c Table of contents
  76. @contents
  77. @node Top, Introduction, (dir), (dir)
  78. @c @menu
  79. @c * Introduction:: Introduction
  80. @c @end menu
  81. @node Introduction, Top, Top, Top
  82. @comment node-name, next, previous, up
  83. @chapter Introduction
  84. @noindent
  85. CLN is a library for computations with all kinds of numbers.
  86. It has a rich set of number classes:
  87. @itemize @bullet
  88. @item
  89. Integers (with unlimited precision),
  90. @item
  91. Rational numbers,
  92. @item
  93. Floating-point numbers:
  94. @itemize @minus
  95. @item
  96. Short float,
  97. @item
  98. Single float,
  99. @item
  100. Double float,
  101. @item
  102. Long float (with unlimited precision),
  103. @end itemize
  104. @item
  105. Complex numbers,
  106. @item
  107. Modular integers (integers modulo a fixed integer),
  108. @item
  109. Univariate polynomials.
  110. @end itemize
  111. @noindent
  112. The subtypes of the complex numbers among these are exactly the
  113. types of numbers known to the Common Lisp language. Therefore
  114. @code{CLN} can be used for Common Lisp implementations, giving
  115. @samp{CLN} another meaning: it becomes an abbreviation of
  116. ``Common Lisp Numbers''.
  117. @noindent
  118. The CLN package implements
  119. @itemize @bullet
  120. @item
  121. Elementary functions (@code{+}, @code{-}, @code{*}, @code{/}, @code{sqrt},
  122. comparisons, @dots{}),
  123. @item
  124. Logical functions (logical @code{and}, @code{or}, @code{not}, @dots{}),
  125. @item
  126. Transcendental functions (exponential, logarithmic, trigonometric, hyperbolic
  127. functions and their inverse functions).
  128. @end itemize
  129. @noindent
  130. CLN is a C++ library. Using C++ as an implementation language provides
  131. @itemize @bullet
  132. @item
  133. efficiency: it compiles to machine code,
  134. @item
  135. type safety: the C++ compiler knows about the number types and complains
  136. if, for example, you try to assign a float to an integer variable.
  137. @item
  138. algebraic syntax: You can use the @code{+}, @code{-}, @code{*}, @code{=},
  139. @code{==}, @dots{} operators as in C or C++.
  140. @end itemize
  141. @noindent
  142. CLN is memory efficient:
  143. @itemize @bullet
  144. @item
  145. Small integers and short floats are immediate, not heap allocated.
  146. @item
  147. Heap-allocated memory is reclaimed through an automatic, non-interruptive
  148. garbage collection.
  149. @end itemize
  150. @noindent
  151. CLN is speed efficient:
  152. @itemize @bullet
  153. @item
  154. The kernel of CLN has been written in assembly language for some CPUs
  155. (@code{i386}, @code{m68k}, @code{sparc}, @code{mips}, @code{arm}).
  156. @item
  157. @cindex GMP
  158. On all CPUs, CLN may be configured to use the superefficient low-level
  159. routines from GNU GMP version 3.
  160. @item
  161. It uses Karatsuba multiplication, which is significantly faster
  162. for large numbers than the standard multiplication algorithm.
  163. @item
  164. For very large numbers (more than 12000 decimal digits), it uses
  165. @iftex
  166. Sch{@"o}nhage-Strassen
  167. @cindex Sch{@"o}nhage-Strassen multiplication
  168. @end iftex
  169. @ifinfo
  170. Schoenhage-Strassen
  171. @cindex Schoenhage-Strassen multiplication
  172. @end ifinfo
  173. multiplication, which is an asymptotically optimal multiplication
  174. algorithm, for multiplication, division and radix conversion.
  175. @item
  176. @cindex binary splitting
  177. It uses binary splitting for fast evaluation of series of rational
  178. numbers as they occur in the evaluation of elementary functions and some
  179. constants.
  180. @end itemize
  181. @noindent
  182. CLN aims at being easily integrated into larger software packages:
  183. @itemize @bullet
  184. @item
  185. The garbage collection imposes no burden on the main application.
  186. @item
  187. The library provides hooks for memory allocation and throws exceptions
  188. in case of errors.
  189. @item
  190. @cindex namespace
  191. All non-macro identifiers are hidden in namespace @code{cln} in
  192. order to avoid name clashes.
  193. @end itemize
  194. @chapter Installation
  195. This section describes how to install the CLN package on your system.
  196. @section Prerequisites
  197. @subsection C++ compiler
  198. To build CLN, you need a C++ compiler.
  199. Actually, you need GNU @code{g++ 3.0.0} or newer.
  200. The following C++ features are used:
  201. classes, member functions, overloading of functions and operators,
  202. constructors and destructors, inline, const, multiple inheritance,
  203. templates and namespaces.
  204. The following C++ features are not used:
  205. @code{new}, @code{delete}, virtual inheritance.
  206. CLN relies on semi-automatic ordering of initializations of static and
  207. global variables, a feature which I could implement for GNU g++
  208. only. Also, it is not known whether this semi-automatic ordering works
  209. on all platforms when a non-GNU assembler is being used.
  210. @subsection Make utility
  211. @cindex @code{make}
  212. To build CLN, you also need to have GNU @code{make} installed.
  213. Only GNU @code{make} 3.77 is unusable for CLN; other versions work fine.
  214. @subsection Sed utility
  215. @cindex @code{sed}
  216. To build CLN on HP-UX, you also need to have GNU @code{sed} installed.
  217. This is because the libtool script, which creates the CLN library, relies
  218. on @code{sed}, and the vendor's @code{sed} utility on these systems is too
  219. limited.
  220. @section Building the library
  221. As with any autoconfiguring GNU software, installation is as easy as this:
  222. @example
  223. $ ./configure
  224. $ make
  225. $ make check
  226. @end example
  227. If on your system, @samp{make} is not GNU @code{make}, you have to use
  228. @samp{gmake} instead of @samp{make} above.
  229. The @code{configure} command checks out some features of your system and
  230. C++ compiler and builds the @code{Makefile}s. The @code{make} command
  231. builds the library. This step may take about half an hour on an average
  232. workstation. The @code{make check} runs some test to check that no
  233. important subroutine has been miscompiled.
  234. The @code{configure} command accepts options. To get a summary of them, try
  235. @example
  236. $ ./configure --help
  237. @end example
  238. Some of the options are explained in detail in the @samp{INSTALL.generic} file.
  239. You can specify the C compiler, the C++ compiler and their options through
  240. the following environment variables when running @code{configure}:
  241. @table @code
  242. @item CC
  243. Specifies the C compiler.
  244. @item CFLAGS
  245. Flags to be given to the C compiler when compiling programs (not when linking).
  246. @item CXX
  247. Specifies the C++ compiler.
  248. @item CXXFLAGS
  249. Flags to be given to the C++ compiler when compiling programs (not when linking).
  250. @item CPPFLAGS
  251. Flags to be given to the C/C++ preprocessor.
  252. @end table
  253. Examples:
  254. @example
  255. $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
  256. @end example
  257. @example
  258. $ CC="gcc -V 3.2.3" CFLAGS="-O2 -finline-limit=1000" \
  259. CXX="g++ -V 3.2.3" CXXFLAGS="-O2 -finline-limit=1000" \
  260. CPPFLAGS="-DNO_ASM" ./configure
  261. @end example
  262. @example
  263. $ CC="gcc-4.2" CFLAGS="-O2" CXX="g++-4.2" CXXFLAGS="-O2" ./configure
  264. @end example
  265. Note that for these environment variables to take effect, you have to set
  266. them (assuming a Bourne-compatible shell) on the same line as the
  267. @code{configure} command. If you made the settings in earlier shell
  268. commands, you have to @code{export} the environment variables before
  269. calling @code{configure}. In a @code{csh} shell, you have to use the
  270. @samp{setenv} command for setting each of the environment variables.
  271. Currently CLN works only with the GNU @code{g++} compiler, and only in
  272. optimizing mode. So you should specify at least @code{-O} in the
  273. CXXFLAGS, or no CXXFLAGS at all. If CXXFLAGS is not set, CLN will be
  274. compiled with @code{-O}.
  275. The assembler language kernel can be turned off by specifying
  276. @code{-DNO_ASM} in the CPPFLAGS. If @code{make check} reports any
  277. problems, you may try to clean up (see @ref{Cleaning up}) and configure
  278. and compile again, this time with @code{-DNO_ASM}.
  279. If you use @code{g++} 3.2.x or earlier, I recommend adding
  280. @samp{-finline-limit=1000} to the CXXFLAGS. This is essential for good
  281. code.
  282. If you use @code{g++} from gcc-3.0.4 or older on Sparc, add either
  283. @samp{-O}, @samp{-O1} or @samp{-O2 -fno-schedule-insns} to the
  284. CXXFLAGS. With full @samp{-O2}, @code{g++} miscompiles the division
  285. routines. Also, do not use gcc-3.0 on Sparc for compiling CLN, it
  286. won't work at all.
  287. Also, please do not compile CLN with @code{g++} using the @code{-O3}
  288. optimization level. This leads to inferior code quality.
  289. Some newer versions of @code{g++} require quite an amount of memory.
  290. You might need some swap space if your machine doesn't have 512 MB of
  291. RAM.
  292. By default, both a shared and a static library are built. You can build
  293. CLN as a static (or shared) library only, by calling @code{configure}
  294. with the option @samp{--disable-shared} (or @samp{--disable-static}).
  295. While shared libraries are usually more convenient to use, they may not
  296. work on all architectures. Try disabling them if you run into linker
  297. problems. Also, they are generally slightly slower than static
  298. libraries so runtime-critical applications should be linked statically.
  299. @subsection Using the GNU MP Library
  300. @cindex GMP
  301. Starting with version 1.1, CLN may be configured to make use of a
  302. preinstalled @code{gmp} library for some low-level routines. Please
  303. make sure that you have at least @code{gmp} version 3.0 installed
  304. since earlier versions are unsupported and likely not to work. This
  305. feature is known to be quite a boost for CLN's performance.
  306. By default, CLN will autodetect @code{gmp} and use it. But if you have
  307. installed the @code{gmp} library and its header file in some place where
  308. your compiler cannot find it by default, you must help @code{configure}
  309. by setting @code{CPPFLAGS} and @code{LDFLAGS}. Here is an example:
  310. @example
  311. $ CFLAGS="-O2" CXXFLAGS="-O2" CPPFLAGS="-I/opt/gmp/include" \
  312. LDFLAGS="-L/opt/gmp/lib" ./configure --with-gmp
  313. @end example
  314. If you do not want CLN to make use of a preinstalled @code{gmp}
  315. library, then you can explicitly specify so by calling
  316. @code{configure} with the option @samp{--without-gmp}.
  317. @section Installing the library
  318. @cindex installation
  319. As with any autoconfiguring GNU software, installation is as easy as this:
  320. @example
  321. $ make install
  322. @end example
  323. The @samp{make install} command installs the library and the include files
  324. into public places (@file{/usr/local/lib/} and @file{/usr/local/include/},
  325. if you haven't specified a @code{--prefix} option to @code{configure}).
  326. This step may require superuser privileges.
  327. If you have already built the library and wish to install it, but didn't
  328. specify @code{--prefix=@dots{}} at configure time, just re-run
  329. @code{configure}, giving it the same options as the first time, plus
  330. the @code{--prefix=@dots{}} option.
  331. @section Cleaning up
  332. You can remove system-dependent files generated by @code{make} through
  333. @example
  334. $ make clean
  335. @end example
  336. You can remove all files generated by @code{make}, thus reverting to a
  337. virgin distribution of CLN, through
  338. @example
  339. $ make distclean
  340. @end example
  341. @chapter Ordinary number types
  342. CLN implements the following class hierarchy:
  343. @example
  344. Number
  345. cl_number
  346. <cln/number.h>
  347. |
  348. |
  349. Real or complex number
  350. cl_N
  351. <cln/complex.h>
  352. |
  353. |
  354. Real number
  355. cl_R
  356. <cln/real.h>
  357. |
  358. +-------------------+-------------------+
  359. | |
  360. Rational number Floating-point number
  361. cl_RA cl_F
  362. <cln/rational.h> <cln/float.h>
  363. | |
  364. | +--------------+--------------+--------------+
  365. Integer | | | |
  366. cl_I Short-Float Single-Float Double-Float Long-Float
  367. <cln/integer.h> cl_SF cl_FF cl_DF cl_LF
  368. <cln/sfloat.h> <cln/ffloat.h> <cln/dfloat.h> <cln/lfloat.h>
  369. @end example
  370. @cindex @code{cl_number}
  371. @cindex abstract class
  372. The base class @code{cl_number} is an abstract base class.
  373. It is not useful to declare a variable of this type except if you want
  374. to completely disable compile-time type checking and use run-time type
  375. checking instead.
  376. @cindex @code{cl_N}
  377. @cindex real number
  378. @cindex complex number
  379. The class @code{cl_N} comprises real and complex numbers. There is
  380. no special class for complex numbers since complex numbers with imaginary
  381. part @code{0} are automatically converted to real numbers.
  382. @cindex @code{cl_R}
  383. The class @code{cl_R} comprises real numbers of different kinds. It is an
  384. abstract class.
  385. @cindex @code{cl_RA}
  386. @cindex rational number
  387. @cindex integer
  388. The class @code{cl_RA} comprises exact real numbers: rational numbers, including
  389. integers. There is no special class for non-integral rational numbers
  390. since rational numbers with denominator @code{1} are automatically converted
  391. to integers.
  392. @cindex @code{cl_F}
  393. The class @code{cl_F} implements floating-point approximations to real numbers.
  394. It is an abstract class.
  395. @section Exact numbers
  396. @cindex exact number
  397. Some numbers are represented as exact numbers: there is no loss of information
  398. when such a number is converted from its mathematical value to its internal
  399. representation. On exact numbers, the elementary operations (@code{+},
  400. @code{-}, @code{*}, @code{/}, comparisons, @dots{}) compute the completely
  401. correct result.
  402. In CLN, the exact numbers are:
  403. @itemize @bullet
  404. @item
  405. rational numbers (including integers),
  406. @item
  407. complex numbers whose real and imaginary parts are both rational numbers.
  408. @end itemize
  409. Rational numbers are always normalized to the form
  410. @code{@var{numerator}/@var{denominator}} where the numerator and denominator
  411. are coprime integers and the denominator is positive. If the resulting
  412. denominator is @code{1}, the rational number is converted to an integer.
  413. @cindex immediate numbers
  414. Small integers (typically in the range @code{-2^29}@dots{}@code{2^29-1},
  415. for 32-bit machines) are especially efficient, because they consume no heap
  416. allocation. Otherwise the distinction between these immediate integers
  417. (called ``fixnums'') and heap allocated integers (called ``bignums'')
  418. is completely transparent.
  419. @section Floating-point numbers
  420. @cindex floating-point number
  421. Not all real numbers can be represented exactly. (There is an easy mathematical
  422. proof for this: Only a countable set of numbers can be stored exactly in
  423. a computer, even if one assumes that it has unlimited storage. But there
  424. are uncountably many real numbers.) So some approximation is needed.
  425. CLN implements ordinary floating-point numbers, with mantissa and exponent.
  426. @cindex rounding error
  427. The elementary operations (@code{+}, @code{-}, @code{*}, @code{/}, @dots{})
  428. only return approximate results. For example, the value of the expression
  429. @code{(cl_F) 0.3 + (cl_F) 0.4} prints as @samp{0.70000005}, not as
  430. @samp{0.7}. Rounding errors like this one are inevitable when computing
  431. with floating-point numbers.
  432. Nevertheless, CLN rounds the floating-point results of the operations @code{+},
  433. @code{-}, @code{*}, @code{/}, @code{sqrt} according to the ``round-to-even''
  434. rule: It first computes the exact mathematical result and then returns the
  435. floating-point number which is nearest to this. If two floating-point numbers
  436. are equally distant from the ideal result, the one with a @code{0} in its least
  437. significant mantissa bit is chosen.
  438. Similarly, testing floating point numbers for equality @samp{x == y}
  439. is gambling with random errors. Better check for @samp{abs(x - y) < epsilon}
  440. for some well-chosen @code{epsilon}.
  441. Floating point numbers come in four flavors:
  442. @itemize @bullet
  443. @item
  444. @cindex @code{cl_SF}
  445. Short floats, type @code{cl_SF}.
  446. They have 1 sign bit, 8 exponent bits (including the exponent's sign),
  447. and 17 mantissa bits (including the ``hidden'' bit).
  448. They don't consume heap allocation.
  449. @item
  450. @cindex @code{cl_FF}
  451. Single floats, type @code{cl_FF}.
  452. They have 1 sign bit, 8 exponent bits (including the exponent's sign),
  453. and 24 mantissa bits (including the ``hidden'' bit).
  454. In CLN, they are represented as IEEE single-precision floating point numbers.
  455. This corresponds closely to the C/C++ type @samp{float}.
  456. @item
  457. @cindex @code{cl_DF}
  458. Double floats, type @code{cl_DF}.
  459. They have 1 sign bit, 11 exponent bits (including the exponent's sign),
  460. and 53 mantissa bits (including the ``hidden'' bit).
  461. In CLN, they are represented as IEEE double-precision floating point numbers.
  462. This corresponds closely to the C/C++ type @samp{double}.
  463. @item
  464. @cindex @code{cl_LF}
  465. Long floats, type @code{cl_LF}.
  466. They have 1 sign bit, 32 exponent bits (including the exponent's sign),
  467. and n mantissa bits (including the ``hidden'' bit), where n >= 64.
  468. The precision of a long float is unlimited, but once created, a long float
  469. has a fixed precision. (No ``lazy recomputation''.)
  470. @end itemize
  471. Of course, computations with long floats are more expensive than those
  472. with smaller floating-point formats.
  473. CLN does not implement features like NaNs, denormalized numbers and
  474. gradual underflow. If the exponent range of some floating-point type
  475. is too limited for your application, choose another floating-point type
  476. with larger exponent range.
  477. @cindex @code{cl_F}
  478. As a user of CLN, you can forget about the differences between the
  479. four floating-point types and just declare all your floating-point
  480. variables as being of type @code{cl_F}. This has the advantage that
  481. when you change the precision of some computation (say, from @code{cl_DF}
  482. to @code{cl_LF}), you don't have to change the code, only the precision
  483. of the initial values. Also, many transcendental functions have been
  484. declared as returning a @code{cl_F} when the argument is a @code{cl_F},
  485. but such declarations are missing for the types @code{cl_SF}, @code{cl_FF},
  486. @code{cl_DF}, @code{cl_LF}. (Such declarations would be wrong if
  487. the floating point contagion rule happened to change in the future.)
  488. @section Complex numbers
  489. @cindex complex number
  490. Complex numbers, as implemented by the class @code{cl_N}, have a real
  491. part and an imaginary part, both real numbers. A complex number whose
  492. imaginary part is the exact number @code{0} is automatically converted
  493. to a real number.
  494. Complex numbers can arise from real numbers alone, for example
  495. through application of @code{sqrt} or transcendental functions.
  496. @section Conversions
  497. @cindex conversion
  498. Conversions from any class to any its superclasses (``base classes'' in
  499. C++ terminology) is done automatically.
  500. Conversions from the C built-in types @samp{long} and @samp{unsigned long}
  501. are provided for the classes @code{cl_I}, @code{cl_RA}, @code{cl_R},
  502. @code{cl_N} and @code{cl_number}.
  503. Conversions from the C built-in types @samp{int} and @samp{unsigned int}
  504. are provided for the classes @code{cl_I}, @code{cl_RA}, @code{cl_R},
  505. @code{cl_N} and @code{cl_number}. However, these conversions emphasize
  506. efficiency. On 32-bit systems, their range is therefore limited:
  507. @itemize @minus
  508. @item
  509. The conversion from @samp{int} works only if the argument is < 2^29 and >= -2^29.
  510. @item
  511. The conversion from @samp{unsigned int} works only if the argument is < 2^29.
  512. @end itemize
  513. In a declaration like @samp{cl_I x = 10;} the C++ compiler is able to
  514. do the conversion of @code{10} from @samp{int} to @samp{cl_I} at compile time
  515. already. On the other hand, code like @samp{cl_I x = 1000000000;} is
  516. in error on 32-bit machines.
  517. So, if you want to be sure that an @samp{int} whose magnitude is not guaranteed
  518. to be < 2^29 is correctly converted to a @samp{cl_I}, first convert it to a
  519. @samp{long}. Similarly, if a large @samp{unsigned int} is to be converted to a
  520. @samp{cl_I}, first convert it to an @samp{unsigned long}. On 64-bit machines
  521. there is no such restriction. There, conversions from arbitrary 32-bit @samp{int}
  522. values always works correctly.
  523. Conversions from the C built-in type @samp{float} are provided for the classes
  524. @code{cl_FF}, @code{cl_F}, @code{cl_R}, @code{cl_N} and @code{cl_number}.
  525. Conversions from the C built-in type @samp{double} are provided for the classes
  526. @code{cl_DF}, @code{cl_F}, @code{cl_R}, @code{cl_N} and @code{cl_number}.
  527. Conversions from @samp{const char *} are provided for the classes
  528. @code{cl_I}, @code{cl_RA},
  529. @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}, @code{cl_F},
  530. @code{cl_R}, @code{cl_N}.
  531. The easiest way to specify a value which is outside of the range of the
  532. C++ built-in types is therefore to specify it as a string, like this:
  533. @cindex Rubik's cube
  534. @example
  535. cl_I order_of_rubiks_cube_group = "43252003274489856000";
  536. @end example
  537. Note that this conversion is done at runtime, not at compile-time.
  538. Conversions from @code{cl_I} to the C built-in types @samp{int},
  539. @samp{unsigned int}, @samp{long}, @samp{unsigned long} are provided through
  540. the functions
  541. @table @code
  542. @item int cl_I_to_int (const cl_I& x)
  543. @cindex @code{cl_I_to_int ()}
  544. @itemx unsigned int cl_I_to_uint (const cl_I& x)
  545. @cindex @code{cl_I_to_uint ()}
  546. @itemx long cl_I_to_long (const cl_I& x)
  547. @cindex @code{cl_I_to_long ()}
  548. @itemx unsigned long cl_I_to_ulong (const cl_I& x)
  549. @cindex @code{cl_I_to_ulong ()}
  550. Returns @code{x} as element of the C type @var{ctype}. If @code{x} is not
  551. representable in the range of @var{ctype}, a runtime error occurs.
  552. @end table
  553. Conversions from the classes @code{cl_I}, @code{cl_RA},
  554. @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}, @code{cl_F} and
  555. @code{cl_R}
  556. to the C built-in types @samp{float} and @samp{double} are provided through
  557. the functions
  558. @table @code
  559. @item float float_approx (const @var{type}& x)
  560. @cindex @code{float_approx ()}
  561. @itemx double double_approx (const @var{type}& x)
  562. @cindex @code{double_approx ()}
  563. Returns an approximation of @code{x} of C type @var{ctype}.
  564. If @code{abs(x)} is too close to 0 (underflow), 0 is returned.
  565. If @code{abs(x)} is too large (overflow), an IEEE infinity is returned.
  566. @end table
  567. Conversions from any class to any of its subclasses (``derived classes'' in
  568. C++ terminology) are not provided. Instead, you can assert and check
  569. that a value belongs to a certain subclass, and return it as element of that
  570. class, using the @samp{As} and @samp{The} macros.
  571. @cindex cast
  572. @cindex @code{As()()}
  573. @code{As(@var{type})(@var{value})} checks that @var{value} belongs to
  574. @var{type} and returns it as such.
  575. @cindex @code{The()()}
  576. @code{The(@var{type})(@var{value})} assumes that @var{value} belongs to
  577. @var{type} and returns it as such. It is your responsibility to ensure
  578. that this assumption is valid. Since macros and namespaces don't go
  579. together well, there is an equivalent to @samp{The}: the template
  580. @samp{the}.
  581. Example:
  582. @example
  583. @group
  584. cl_I x = @dots{};
  585. if (!(x >= 0)) abort();
  586. cl_I ten_x_a = The(cl_I)(expt(10,x)); // If x >= 0, 10^x is an integer.
  587. // In general, it would be a rational number.
  588. cl_I ten_x_b = the<cl_I>(expt(10,x)); // The same as above.
  589. @end group
  590. @end example
  591. @chapter Functions on numbers
  592. Each of the number classes declares its mathematical operations in the
  593. corresponding include file. For example, if your code operates with
  594. objects of type @code{cl_I}, it should @code{#include <cln/integer.h>}.
  595. @section Constructing numbers
  596. Here is how to create number objects ``from nothing''.
  597. @subsection Constructing integers
  598. @code{cl_I} objects are most easily constructed from C integers and from
  599. strings. See @ref{Conversions}.
  600. @subsection Constructing rational numbers
  601. @code{cl_RA} objects can be constructed from strings. The syntax
  602. for rational numbers is described in @ref{Internal and printed representation}.
  603. Another standard way to produce a rational number is through application
  604. of @samp{operator /} or @samp{recip} on integers.
  605. @subsection Constructing floating-point numbers
  606. @code{cl_F} objects with low precision are most easily constructed from
  607. C @samp{float} and @samp{double}. See @ref{Conversions}.
  608. To construct a @code{cl_F} with high precision, you can use the conversion
  609. from @samp{const char *}, but you have to specify the desired precision
  610. within the string. (See @ref{Internal and printed representation}.)
  611. Example:
  612. @example
  613. cl_F e = "0.271828182845904523536028747135266249775724709369996e+1_40";
  614. @end example
  615. will set @samp{e} to the given value, with a precision of 40 decimal digits.
  616. The programmatic way to construct a @code{cl_F} with high precision is
  617. through the @code{cl_float} conversion function, see
  618. @ref{Conversion to floating-point numbers}. For example, to compute
  619. @code{e} to 40 decimal places, first construct 1.0 to 40 decimal places
  620. and then apply the exponential function:
  621. @example
  622. float_format_t precision = float_format(40);
  623. cl_F e = exp(cl_float(1,precision));
  624. @end example
  625. @subsection Constructing complex numbers
  626. Non-real @code{cl_N} objects are normally constructed through the function
  627. @example
  628. cl_N complex (const cl_R& realpart, const cl_R& imagpart)
  629. @end example
  630. See @ref{Elementary complex functions}.
  631. @section Elementary functions
  632. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
  633. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  634. defines the following operations:
  635. @table @code
  636. @item @var{type} operator + (const @var{type}&, const @var{type}&)
  637. @cindex @code{operator + ()}
  638. Addition.
  639. @item @var{type} operator - (const @var{type}&, const @var{type}&)
  640. @cindex @code{operator - ()}
  641. Subtraction.
  642. @item @var{type} operator - (const @var{type}&)
  643. Returns the negative of the argument.
  644. @item @var{type} plus1 (const @var{type}& x)
  645. @cindex @code{plus1 ()}
  646. Returns @code{x + 1}.
  647. @item @var{type} minus1 (const @var{type}& x)
  648. @cindex @code{minus1 ()}
  649. Returns @code{x - 1}.
  650. @item @var{type} operator * (const @var{type}&, const @var{type}&)
  651. @cindex @code{operator * ()}
  652. Multiplication.
  653. @item @var{type} square (const @var{type}& x)
  654. @cindex @code{square ()}
  655. Returns @code{x * x}.
  656. @end table
  657. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA},
  658. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  659. defines the following operations:
  660. @table @code
  661. @item @var{type} operator / (const @var{type}&, const @var{type}&)
  662. @cindex @code{operator / ()}
  663. Division.
  664. @item @var{type} recip (const @var{type}&)
  665. @cindex @code{recip ()}
  666. Returns the reciprocal of the argument.
  667. @end table
  668. The class @code{cl_I} doesn't define a @samp{/} operation because
  669. in the C/C++ language this operator, applied to integral types,
  670. denotes the @samp{floor} or @samp{truncate} operation (which one of these,
  671. is implementation dependent). (@xref{Rounding functions}.)
  672. Instead, @code{cl_I} defines an ``exact quotient'' function:
  673. @table @code
  674. @item cl_I exquo (const cl_I& x, const cl_I& y)
  675. @cindex @code{exquo ()}
  676. Checks that @code{y} divides @code{x}, and returns the quotient @code{x}/@code{y}.
  677. @end table
  678. The following exponentiation functions are defined:
  679. @table @code
  680. @item cl_I expt_pos (const cl_I& x, const cl_I& y)
  681. @cindex @code{expt_pos ()}
  682. @itemx cl_RA expt_pos (const cl_RA& x, const cl_I& y)
  683. @code{y} must be > 0. Returns @code{x^y}.
  684. @item cl_RA expt (const cl_RA& x, const cl_I& y)
  685. @cindex @code{expt ()}
  686. @itemx cl_R expt (const cl_R& x, const cl_I& y)
  687. @itemx cl_N expt (const cl_N& x, const cl_I& y)
  688. Returns @code{x^y}.
  689. @end table
  690. Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_I},
  691. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  692. defines the following operation:
  693. @table @code
  694. @item @var{type} abs (const @var{type}& x)
  695. @cindex @code{abs ()}
  696. Returns the absolute value of @code{x}.
  697. This is @code{x} if @code{x >= 0}, and @code{-x} if @code{x <= 0}.
  698. @end table
  699. The class @code{cl_N} implements this as follows:
  700. @table @code
  701. @item cl_R abs (const cl_N x)
  702. Returns the absolute value of @code{x}.
  703. @end table
  704. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
  705. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  706. defines the following operation:
  707. @table @code
  708. @item @var{type} signum (const @var{type}& x)
  709. @cindex @code{signum ()}
  710. Returns the sign of @code{x}, in the same number format as @code{x}.
  711. This is defined as @code{x / abs(x)} if @code{x} is non-zero, and
  712. @code{x} if @code{x} is zero. If @code{x} is real, the value is either
  713. 0 or 1 or -1.
  714. @end table
  715. @section Elementary rational functions
  716. Each of the classes @code{cl_RA}, @code{cl_I} defines the following operations:
  717. @table @code
  718. @item cl_I numerator (const @var{type}& x)
  719. @cindex @code{numerator ()}
  720. Returns the numerator of @code{x}.
  721. @item cl_I denominator (const @var{type}& x)
  722. @cindex @code{denominator ()}
  723. Returns the denominator of @code{x}.
  724. @end table
  725. The numerator and denominator of a rational number are normalized in such
  726. a way that they have no factor in common and the denominator is positive.
  727. @section Elementary complex functions
  728. The class @code{cl_N} defines the following operation:
  729. @table @code
  730. @item cl_N complex (const cl_R& a, const cl_R& b)
  731. @cindex @code{complex ()}
  732. Returns the complex number @code{a+bi}, that is, the complex number with
  733. real part @code{a} and imaginary part @code{b}.
  734. @end table
  735. Each of the classes @code{cl_N}, @code{cl_R} defines the following operations:
  736. @table @code
  737. @item cl_R realpart (const @var{type}& x)
  738. @cindex @code{realpart ()}
  739. Returns the real part of @code{x}.
  740. @item cl_R imagpart (const @var{type}& x)
  741. @cindex @code{imagpart ()}
  742. Returns the imaginary part of @code{x}.
  743. @item @var{type} conjugate (const @var{type}& x)
  744. @cindex @code{conjugate ()}
  745. Returns the complex conjugate of @code{x}.
  746. @end table
  747. We have the relations
  748. @itemize @asis
  749. @item
  750. @code{x = complex(realpart(x), imagpart(x))}
  751. @item
  752. @code{conjugate(x) = complex(realpart(x), -imagpart(x))}
  753. @end itemize
  754. @section Comparisons
  755. @cindex comparison
  756. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
  757. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  758. defines the following operations:
  759. @table @code
  760. @item bool operator == (const @var{type}&, const @var{type}&)
  761. @cindex @code{operator == ()}
  762. @itemx bool operator != (const @var{type}&, const @var{type}&)
  763. @cindex @code{operator != ()}
  764. Comparison, as in C and C++.
  765. @item uint32 equal_hashcode (const @var{type}&)
  766. @cindex @code{equal_hashcode ()}
  767. Returns a 32-bit hash code that is the same for any two numbers which are
  768. the same according to @code{==}. This hash code depends on the number's value,
  769. not its type or precision.
  770. @item bool zerop (const @var{type}& x)
  771. @cindex @code{zerop ()}
  772. Compare against zero: @code{x == 0}
  773. @end table
  774. Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_I},
  775. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  776. defines the following operations:
  777. @table @code
  778. @item cl_signean compare (const @var{type}& x, const @var{type}& y)
  779. @cindex @code{compare ()}
  780. Compares @code{x} and @code{y}. Returns +1 if @code{x}>@code{y},
  781. -1 if @code{x}<@code{y}, 0 if @code{x}=@code{y}.
  782. @item bool operator <= (const @var{type}&, const @var{type}&)
  783. @cindex @code{operator <= ()}
  784. @itemx bool operator < (const @var{type}&, const @var{type}&)
  785. @cindex @code{operator < ()}
  786. @itemx bool operator >= (const @var{type}&, const @var{type}&)
  787. @cindex @code{operator >= ()}
  788. @itemx bool operator > (const @var{type}&, const @var{type}&)
  789. @cindex @code{operator > ()}
  790. Comparison, as in C and C++.
  791. @item bool minusp (const @var{type}& x)
  792. @cindex @code{minusp ()}
  793. Compare against zero: @code{x < 0}
  794. @item bool plusp (const @var{type}& x)
  795. @cindex @code{plusp ()}
  796. Compare against zero: @code{x > 0}
  797. @item @var{type} max (const @var{type}& x, const @var{type}& y)
  798. @cindex @code{max ()}
  799. Return the maximum of @code{x} and @code{y}.
  800. @item @var{type} min (const @var{type}& x, const @var{type}& y)
  801. @cindex @code{min ()}
  802. Return the minimum of @code{x} and @code{y}.
  803. @end table
  804. When a floating point number and a rational number are compared, the float
  805. is first converted to a rational number using the function @code{rational}.
  806. Since a floating point number actually represents an interval of real numbers,
  807. the result might be surprising.
  808. For example, @code{(cl_F)(cl_R)"1/3" == (cl_R)"1/3"} returns false because
  809. there is no floating point number whose value is exactly @code{1/3}.
  810. @section Rounding functions
  811. @cindex rounding
  812. When a real number is to be converted to an integer, there is no ``best''
  813. rounding. The desired rounding function depends on the application.
  814. The Common Lisp and ISO Lisp standards offer four rounding functions:
  815. @table @code
  816. @item floor(x)
  817. This is the largest integer <=@code{x}.
  818. @item ceiling(x)
  819. This is the smallest integer >=@code{x}.
  820. @item truncate(x)
  821. Among the integers between 0 and @code{x} (inclusive) the one nearest to @code{x}.
  822. @item round(x)
  823. The integer nearest to @code{x}. If @code{x} is exactly halfway between two
  824. integers, choose the even one.
  825. @end table
  826. These functions have different advantages:
  827. @code{floor} and @code{ceiling} are translation invariant:
  828. @code{floor(x+n) = floor(x) + n} and @code{ceiling(x+n) = ceiling(x) + n}
  829. for every @code{x} and every integer @code{n}.
  830. On the other hand, @code{truncate} and @code{round} are symmetric:
  831. @code{truncate(-x) = -truncate(x)} and @code{round(-x) = -round(x)},
  832. and furthermore @code{round} is unbiased: on the ``average'', it rounds
  833. down exactly as often as it rounds up.
  834. The functions are related like this:
  835. @itemize @asis
  836. @item
  837. @code{ceiling(m/n) = floor((m+n-1)/n) = floor((m-1)/n)+1}
  838. for rational numbers @code{m/n} (@code{m}, @code{n} integers, @code{n}>0), and
  839. @item
  840. @code{truncate(x) = sign(x) * floor(abs(x))}
  841. @end itemize
  842. Each of the classes @code{cl_R}, @code{cl_RA},
  843. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  844. defines the following operations:
  845. @table @code
  846. @item cl_I floor1 (const @var{type}& x)
  847. @cindex @code{floor1 ()}
  848. Returns @code{floor(x)}.
  849. @item cl_I ceiling1 (const @var{type}& x)
  850. @cindex @code{ceiling1 ()}
  851. Returns @code{ceiling(x)}.
  852. @item cl_I truncate1 (const @var{type}& x)
  853. @cindex @code{truncate1 ()}
  854. Returns @code{truncate(x)}.
  855. @item cl_I round1 (const @var{type}& x)
  856. @cindex @code{round1 ()}
  857. Returns @code{round(x)}.
  858. @end table
  859. Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_I},
  860. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  861. defines the following operations:
  862. @table @code
  863. @item cl_I floor1 (const @var{type}& x, const @var{type}& y)
  864. Returns @code{floor(x/y)}.
  865. @item cl_I ceiling1 (const @var{type}& x, const @var{type}& y)
  866. Returns @code{ceiling(x/y)}.
  867. @item cl_I truncate1 (const @var{type}& x, const @var{type}& y)
  868. Returns @code{truncate(x/y)}.
  869. @item cl_I round1 (const @var{type}& x, const @var{type}& y)
  870. Returns @code{round(x/y)}.
  871. @end table
  872. These functions are called @samp{floor1}, @dots{} here instead of
  873. @samp{floor}, @dots{}, because on some systems, system dependent include
  874. files define @samp{floor} and @samp{ceiling} as macros.
  875. In many cases, one needs both the quotient and the remainder of a division.
  876. It is more efficient to compute both at the same time than to perform
  877. two divisions, one for quotient and the next one for the remainder.
  878. The following functions therefore return a structure containing both
  879. the quotient and the remainder. The suffix @samp{2} indicates the number
  880. of ``return values''. The remainder is defined as follows:
  881. @itemize @bullet
  882. @item
  883. for the computation of @code{quotient = floor(x)},
  884. @code{remainder = x - quotient},
  885. @item
  886. for the computation of @code{quotient = floor(x,y)},
  887. @code{remainder = x - quotient*y},
  888. @end itemize
  889. and similarly for the other three operations.
  890. Each of the classes @code{cl_R}, @code{cl_RA},
  891. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  892. defines the following operations:
  893. @table @code
  894. @item struct @var{type}_div_t @{ cl_I quotient; @var{type} remainder; @};
  895. @itemx @var{type}_div_t floor2 (const @var{type}& x)
  896. @itemx @var{type}_div_t ceiling2 (const @var{type}& x)
  897. @itemx @var{type}_div_t truncate2 (const @var{type}& x)
  898. @itemx @var{type}_div_t round2 (const @var{type}& x)
  899. @end table
  900. Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_I},
  901. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  902. defines the following operations:
  903. @table @code
  904. @item struct @var{type}_div_t @{ cl_I quotient; @var{type} remainder; @};
  905. @itemx @var{type}_div_t floor2 (const @var{type}& x, const @var{type}& y)
  906. @cindex @code{floor2 ()}
  907. @itemx @var{type}_div_t ceiling2 (const @var{type}& x, const @var{type}& y)
  908. @cindex @code{ceiling2 ()}
  909. @itemx @var{type}_div_t truncate2 (const @var{type}& x, const @var{type}& y)
  910. @cindex @code{truncate2 ()}
  911. @itemx @var{type}_div_t round2 (const @var{type}& x, const @var{type}& y)
  912. @cindex @code{round2 ()}
  913. @end table
  914. Sometimes, one wants the quotient as a floating-point number (of the
  915. same format as the argument, if the argument is a float) instead of as
  916. an integer. The prefix @samp{f} indicates this.
  917. Each of the classes
  918. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  919. defines the following operations:
  920. @table @code
  921. @item @var{type} ffloor (const @var{type}& x)
  922. @cindex @code{ffloor ()}
  923. @itemx @var{type} fceiling (const @var{type}& x)
  924. @cindex @code{fceiling ()}
  925. @itemx @var{type} ftruncate (const @var{type}& x)
  926. @cindex @code{ftruncate ()}
  927. @itemx @var{type} fround (const @var{type}& x)
  928. @cindex @code{fround ()}
  929. @end table
  930. and similarly for class @code{cl_R}, but with return type @code{cl_F}.
  931. The class @code{cl_R} defines the following operations:
  932. @table @code
  933. @item cl_F ffloor (const @var{type}& x, const @var{type}& y)
  934. @itemx cl_F fceiling (const @var{type}& x, const @var{type}& y)
  935. @itemx cl_F ftruncate (const @var{type}& x, const @var{type}& y)
  936. @itemx cl_F fround (const @var{type}& x, const @var{type}& y)
  937. @end table
  938. These functions also exist in versions which return both the quotient
  939. and the remainder. The suffix @samp{2} indicates this.
  940. Each of the classes
  941. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  942. defines the following operations:
  943. @cindex @code{cl_F_fdiv_t}
  944. @cindex @code{cl_SF_fdiv_t}
  945. @cindex @code{cl_FF_fdiv_t}
  946. @cindex @code{cl_DF_fdiv_t}
  947. @cindex @code{cl_LF_fdiv_t}
  948. @table @code
  949. @item struct @var{type}_fdiv_t @{ @var{type} quotient; @var{type} remainder; @};
  950. @itemx @var{type}_fdiv_t ffloor2 (const @var{type}& x)
  951. @cindex @code{ffloor2 ()}
  952. @itemx @var{type}_fdiv_t fceiling2 (const @var{type}& x)
  953. @cindex @code{fceiling2 ()}
  954. @itemx @var{type}_fdiv_t ftruncate2 (const @var{type}& x)
  955. @cindex @code{ftruncate2 ()}
  956. @itemx @var{type}_fdiv_t fround2 (const @var{type}& x)
  957. @cindex @code{fround2 ()}
  958. @end table
  959. and similarly for class @code{cl_R}, but with quotient type @code{cl_F}.
  960. @cindex @code{cl_R_fdiv_t}
  961. The class @code{cl_R} defines the following operations:
  962. @table @code
  963. @item struct @var{type}_fdiv_t @{ cl_F quotient; cl_R remainder; @};
  964. @itemx @var{type}_fdiv_t ffloor2 (const @var{type}& x, const @var{type}& y)
  965. @itemx @var{type}_fdiv_t fceiling2 (const @var{type}& x, const @var{type}& y)
  966. @itemx @var{type}_fdiv_t ftruncate2 (const @var{type}& x, const @var{type}& y)
  967. @itemx @var{type}_fdiv_t fround2 (const @var{type}& x, const @var{type}& y)
  968. @end table
  969. Other applications need only the remainder of a division.
  970. The remainder of @samp{floor} and @samp{ffloor} is called @samp{mod}
  971. (abbreviation of ``modulo''). The remainder @samp{truncate} and
  972. @samp{ftruncate} is called @samp{rem} (abbreviation of ``remainder'').
  973. @itemize @bullet
  974. @item
  975. @code{mod(x,y) = floor2(x,y).remainder = x - floor(x/y)*y}
  976. @item
  977. @code{rem(x,y) = truncate2(x,y).remainder = x - truncate(x/y)*y}
  978. @end itemize
  979. If @code{x} and @code{y} are both >= 0, @code{mod(x,y) = rem(x,y) >= 0}.
  980. In general, @code{mod(x,y)} has the sign of @code{y} or is zero,
  981. and @code{rem(x,y)} has the sign of @code{x} or is zero.
  982. The classes @code{cl_R}, @code{cl_I} define the following operations:
  983. @table @code
  984. @item @var{type} mod (const @var{type}& x, const @var{type}& y)
  985. @cindex @code{mod ()}
  986. @itemx @var{type} rem (const @var{type}& x, const @var{type}& y)
  987. @cindex @code{rem ()}
  988. @end table
  989. @section Roots
  990. Each of the classes @code{cl_R},
  991. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  992. defines the following operation:
  993. @table @code
  994. @item @var{type} sqrt (const @var{type}& x)
  995. @cindex @code{sqrt ()}
  996. @code{x} must be >= 0. This function returns the square root of @code{x},
  997. normalized to be >= 0. If @code{x} is the square of a rational number,
  998. @code{sqrt(x)} will be a rational number, else it will return a
  999. floating-point approximation.
  1000. @end table
  1001. The classes @code{cl_RA}, @code{cl_I} define the following operation:
  1002. @table @code
  1003. @item bool sqrtp (const @var{type}& x, @var{type}* root)
  1004. @cindex @code{sqrtp ()}
  1005. This tests whether @code{x} is a perfect square. If so, it returns true
  1006. and the exact square root in @code{*root}, else it returns false.
  1007. @end table
  1008. Furthermore, for integers, similarly:
  1009. @table @code
  1010. @item bool isqrt (const @var{type}& x, @var{type}* root)
  1011. @cindex @code{isqrt ()}
  1012. @code{x} should be >= 0. This function sets @code{*root} to
  1013. @code{floor(sqrt(x))} and returns the same value as @code{sqrtp}:
  1014. the boolean value @code{(expt(*root,2) == x)}.
  1015. @end table
  1016. For @code{n}th roots, the classes @code{cl_RA}, @code{cl_I}
  1017. define the following operation:
  1018. @table @code
  1019. @item bool rootp (const @var{type}& x, const cl_I& n, @var{type}* root)
  1020. @cindex @code{rootp ()}
  1021. @code{x} must be >= 0. @code{n} must be > 0.
  1022. This tests whether @code{x} is an @code{n}th power of a rational number.
  1023. If so, it returns true and the exact root in @code{*root}, else it returns
  1024. false.
  1025. @end table
  1026. The only square root function which accepts negative numbers is the one
  1027. for class @code{cl_N}:
  1028. @table @code
  1029. @item cl_N sqrt (const cl_N& z)
  1030. @cindex @code{sqrt ()}
  1031. Returns the square root of @code{z}, as defined by the formula
  1032. @code{sqrt(z) = exp(log(z)/2)}. Conversion to a floating-point type
  1033. or to a complex number are done if necessary. The range of the result is the
  1034. right half plane @code{realpart(sqrt(z)) >= 0}
  1035. including the positive imaginary axis and 0, but excluding
  1036. the negative imaginary axis.
  1037. The result is an exact number only if @code{z} is an exact number.
  1038. @end table
  1039. @section Transcendental functions
  1040. @cindex transcendental functions
  1041. The transcendental functions return an exact result if the argument
  1042. is exact and the result is exact as well. Otherwise they must return
  1043. inexact numbers even if the argument is exact.
  1044. For example, @code{cos(0) = 1} returns the rational number @code{1}.
  1045. @subsection Exponential and logarithmic functions
  1046. @table @code
  1047. @item cl_R exp (const cl_R& x)
  1048. @cindex @code{exp ()}
  1049. @itemx cl_N exp (const cl_N& x)
  1050. Returns the exponential function of @code{x}. This is @code{e^x} where
  1051. @code{e} is the base of the natural logarithms. The range of the result
  1052. is the entire complex plane excluding 0.
  1053. @item cl_R ln (const cl_R& x)
  1054. @cindex @code{ln ()}
  1055. @code{x} must be > 0. Returns the (natural) logarithm of x.
  1056. @item cl_N log (const cl_N& x)
  1057. @cindex @code{log ()}
  1058. Returns the (natural) logarithm of x. If @code{x} is real and positive,
  1059. this is @code{ln(x)}. In general, @code{log(x) = log(abs(x)) + i*phase(x)}.
  1060. The range of the result is the strip in the complex plane
  1061. @code{-pi < imagpart(log(x)) <= pi}.
  1062. @item cl_R phase (const cl_N& x)
  1063. @cindex @code{phase ()}
  1064. Returns the angle part of @code{x} in its polar representation as a
  1065. complex number. That is, @code{phase(x) = atan(realpart(x),imagpart(x))}.
  1066. This is also the imaginary part of @code{log(x)}.
  1067. The range of the result is the interval @code{-pi < phase(x) <= pi}.
  1068. The result will be an exact number only if @code{zerop(x)} or
  1069. if @code{x} is real and positive.
  1070. @item cl_R log (const cl_R& a, const cl_R& b)
  1071. @code{a} and @code{b} must be > 0. Returns the logarithm of @code{a} with
  1072. respect to base @code{b}. @code{log(a,b) = ln(a)/ln(b)}.
  1073. The result can be exact only if @code{a = 1} or if @code{a} and @code{b}
  1074. are both rational.
  1075. @item cl_N log (const cl_N& a, const cl_N& b)
  1076. Returns the logarithm of @code{a} with respect to base @code{b}.
  1077. @code{log(a,b) = log(a)/log(b)}.
  1078. @item cl_N expt (const cl_N& x, const cl_N& y)
  1079. @cindex @code{expt ()}
  1080. Exponentiation: Returns @code{x^y = exp(y*log(x))}.
  1081. @end table
  1082. The constant e = exp(1) = 2.71828@dots{} is returned by the following functions:
  1083. @table @code
  1084. @item cl_F exp1 (float_format_t f)
  1085. @cindex @code{exp1 ()}
  1086. Returns e as a float of format @code{f}.
  1087. @item cl_F exp1 (const cl_F& y)
  1088. Returns e in the float format of @code{y}.
  1089. @item cl_F exp1 (void)
  1090. Returns e as a float of format @code{default_float_format}.
  1091. @end table
  1092. @subsection Trigonometric functions
  1093. @table @code
  1094. @item cl_R sin (const cl_R& x)
  1095. @cindex @code{sin ()}
  1096. Returns @code{sin(x)}. The range of the result is the interval
  1097. @code{-1 <= sin(x) <= 1}.
  1098. @item cl_N sin (const cl_N& z)
  1099. Returns @code{sin(z)}. The range of the result is the entire complex plane.
  1100. @item cl_R cos (const cl_R& x)
  1101. @cindex @code{cos ()}
  1102. Returns @code{cos(x)}. The range of the result is the interval
  1103. @code{-1 <= cos(x) <= 1}.
  1104. @item cl_N cos (const cl_N& x)
  1105. Returns @code{cos(z)}. The range of the result is the entire complex plane.
  1106. @item struct cos_sin_t @{ cl_R cos; cl_R sin; @};
  1107. @cindex @code{cos_sin_t}
  1108. @itemx cos_sin_t cos_sin (const cl_R& x)
  1109. Returns both @code{sin(x)} and @code{cos(x)}. This is more efficient than
  1110. @cindex @code{cos_sin ()}
  1111. computing them separately. The relation @code{cos^2 + sin^2 = 1} will
  1112. hold only approximately.
  1113. @item cl_R tan (const cl_R& x)
  1114. @cindex @code{tan ()}
  1115. @itemx cl_N tan (const cl_N& x)
  1116. Returns @code{tan(x) = sin(x)/cos(x)}.
  1117. @item cl_N cis (const cl_R& x)
  1118. @cindex @code{cis ()}
  1119. @itemx cl_N cis (const cl_N& x)
  1120. Returns @code{exp(i*x)}. The name @samp{cis} means ``cos + i sin'', because
  1121. @code{e^(i*x) = cos(x) + i*sin(x)}.
  1122. @cindex @code{asin}
  1123. @cindex @code{asin ()}
  1124. @item cl_N asin (const cl_N& z)
  1125. Returns @code{arcsin(z)}. This is defined as
  1126. @code{arcsin(z) = log(iz+sqrt(1-z^2))/i} and satisfies
  1127. @code{arcsin(-z) = -arcsin(z)}.
  1128. The range of the result is the strip in the complex domain
  1129. @code{-pi/2 <= realpart(arcsin(z)) <= pi/2}, excluding the numbers
  1130. with @code{realpart = -pi/2} and @code{imagpart < 0} and the numbers
  1131. with @code{realpart = pi/2} and @code{imagpart > 0}.
  1132. @ignore
  1133. Proof: This follows from arcsin(z) = arsinh(iz)/i and the corresponding
  1134. results for arsinh.
  1135. @end ignore
  1136. @item cl_N acos (const cl_N& z)
  1137. @cindex @code{acos ()}
  1138. Returns @code{arccos(z)}. This is defined as
  1139. @code{arccos(z) = pi/2 - arcsin(z) = log(z+i*sqrt(1-z^2))/i}
  1140. @ignore
  1141. Kahan's formula:
  1142. @code{arccos(z) = 2*log(sqrt((1+z)/2)+i*sqrt((1-z)/2))/i}
  1143. @end ignore
  1144. and satisfies @code{arccos(-z) = pi - arccos(z)}.
  1145. The range of the result is the strip in the complex domain
  1146. @code{0 <= realpart(arcsin(z)) <= pi}, excluding the numbers
  1147. with @code{realpart = 0} and @code{imagpart < 0} and the numbers
  1148. with @code{realpart = pi} and @code{imagpart > 0}.
  1149. @ignore
  1150. Proof: This follows from the results about arcsin.
  1151. @end ignore
  1152. @cindex @code{atan}
  1153. @cindex @code{atan ()}
  1154. @item cl_R atan (const cl_R& x, const cl_R& y)
  1155. Returns the angle of the polar representation of the complex number
  1156. @code{x+iy}. This is @code{atan(y/x)} if @code{x>0}. The range of
  1157. the result is the interval @code{-pi < atan(x,y) <= pi}. The result will
  1158. be an exact number only if @code{x > 0} and @code{y} is the exact @code{0}.
  1159. WARNING: In Common Lisp, this function is called as @code{(atan y x)},
  1160. with reversed order of arguments.
  1161. @item cl_R atan (const cl_R& x)
  1162. Returns @code{arctan(x)}. This is the same as @code{atan(1,x)}. The range
  1163. of the result is the interval @code{-pi/2 < atan(x) < pi/2}. The result
  1164. will be an exact number only if @code{x} is the exact @code{0}.
  1165. @item cl_N atan (const cl_N& z)
  1166. Returns @code{arctan(z)}. This is defined as
  1167. @code{arctan(z) = (log(1+iz)-log(1-iz)) / 2i} and satisfies
  1168. @code{arctan(-z) = -arctan(z)}. The range of the result is
  1169. the strip in the complex domain
  1170. @code{-pi/2 <= realpart(arctan(z)) <= pi/2}, excluding the numbers
  1171. with @code{realpart = -pi/2} and @code{imagpart >= 0} and the numbers
  1172. with @code{realpart = pi/2} and @code{imagpart <= 0}.
  1173. @ignore
  1174. Proof: arctan(z) = artanh(iz)/i, we know the range of the artanh function.
  1175. @end ignore
  1176. @end table
  1177. @cindex pi
  1178. @cindex Archimedes' constant
  1179. Archimedes' constant pi = 3.14@dots{} is returned by the following functions:
  1180. @table @code
  1181. @item cl_F pi (float_format_t f)
  1182. @cindex @code{pi ()}
  1183. Returns pi as a float of format @code{f}.
  1184. @item cl_F pi (const cl_F& y)
  1185. Returns pi in the float format of @code{y}.
  1186. @item cl_F pi (void)
  1187. Returns pi as a float of format @code{default_float_format}.
  1188. @end table
  1189. @subsection Hyperbolic functions
  1190. @table @code
  1191. @item cl_R sinh (const cl_R& x)
  1192. @cindex @code{sinh ()}
  1193. Returns @code{sinh(x)}.
  1194. @item cl_N sinh (const cl_N& z)
  1195. Returns @code{sinh(z)}. The range of the result is the entire complex plane.
  1196. @item cl_R cosh (const cl_R& x)
  1197. @cindex @code{cosh ()}
  1198. Returns @code{cosh(x)}. The range of the result is the interval
  1199. @code{cosh(x) >= 1}.
  1200. @item cl_N cosh (const cl_N& z)
  1201. Returns @code{cosh(z)}. The range of the result is the entire complex plane.
  1202. @item struct cosh_sinh_t @{ cl_R cosh; cl_R sinh; @};
  1203. @cindex @code{cosh_sinh_t}
  1204. @itemx cosh_sinh_t cosh_sinh (const cl_R& x)
  1205. @cindex @code{cosh_sinh ()}
  1206. Returns both @code{sinh(x)} and @code{cosh(x)}. This is more efficient than
  1207. computing them separately. The relation @code{cosh^2 - sinh^2 = 1} will
  1208. hold only approximately.
  1209. @item cl_R tanh (const cl_R& x)
  1210. @cindex @code{tanh ()}
  1211. @itemx cl_N tanh (const cl_N& x)
  1212. Returns @code{tanh(x) = sinh(x)/cosh(x)}.
  1213. @item cl_N asinh (const cl_N& z)
  1214. @cindex @code{asinh ()}
  1215. Returns @code{arsinh(z)}. This is defined as
  1216. @code{arsinh(z) = log(z+sqrt(1+z^2))} and satisfies
  1217. @code{arsinh(-z) = -arsinh(z)}.
  1218. @ignore
  1219. Proof: Knowing the range of log, we know -pi < imagpart(arsinh(z)) <= pi.
  1220. Actually, z+sqrt(1+z^2) can never be real and <0, so
  1221. -pi < imagpart(arsinh(z)) < pi.
  1222. We have (z+sqrt(1+z^2))*(-z+sqrt(1+(-z)^2)) = (1+z^2)-z^2 = 1, hence the
  1223. logs of both factors sum up to 0 mod 2*pi*i, hence to 0.
  1224. @end ignore
  1225. The range of the result is the strip in the complex domain
  1226. @code{-pi/2 <= imagpart(arsinh(z)) <= pi/2}, excluding the numbers
  1227. with @code{imagpart = -pi/2} and @code{realpart > 0} and the numbers
  1228. with @code{imagpart = pi/2} and @code{realpart < 0}.
  1229. @ignore
  1230. Proof: Write z = x+iy. Because of arsinh(-z) = -arsinh(z), we may assume
  1231. that z is in Range(sqrt), that is, x>=0 and, if x=0, then y>=0.
  1232. If x > 0, then Re(z+sqrt(1+z^2)) = x + Re(sqrt(1+z^2)) >= x > 0,
  1233. so -pi/2 < imagpart(log(z+sqrt(1+z^2))) < pi/2.
  1234. If x = 0 and y >= 0, arsinh(z) = log(i*y+sqrt(1-y^2)).
  1235. If y <= 1, the realpart is 0 and the imagpart is >= 0 and <= pi/2.
  1236. If y >= 1, the imagpart is pi/2 and the realpart is
  1237. log(y+sqrt(y^2-1)) >= log(y) >= 0.
  1238. @end ignore
  1239. @ignore
  1240. Moreover, if z is in Range(sqrt),
  1241. log(sqrt(1+z^2)+z) = 2 artanh(z/(1+sqrt(1+z^2)))
  1242. (for a proof, see file src/cl_C_asinh.cc).
  1243. @end ignore
  1244. @item cl_N acosh (const cl_N& z)
  1245. @cindex @code{acosh ()}
  1246. Returns @code{arcosh(z)}. This is defined as
  1247. @code{arcosh(z) = 2*log(sqrt((z+1)/2)+sqrt((z-1)/2))}.
  1248. The range of the result is the half-strip in the complex domain
  1249. @code{-pi < imagpart(arcosh(z)) <= pi, realpart(arcosh(z)) >= 0},
  1250. excluding the numbers with @code{realpart = 0} and @code{-pi < imagpart < 0}.
  1251. @ignore
  1252. Proof: sqrt((z+1)/2) and sqrt((z-1)/2)) lie in Range(sqrt), hence does
  1253. their sum, hence its log has an imagpart <= pi/2 and > -pi/2.
  1254. If z is in Range(sqrt), we have
  1255. sqrt(z+1)*sqrt(z-1) = sqrt(z^2-1)
  1256. ==> (sqrt((z+1)/2)+sqrt((z-1)/2))^2 = (z+1)/2 + sqrt(z^2-1) + (z-1)/2
  1257. = z + sqrt(z^2-1)
  1258. ==> arcosh(z) = log(z+sqrt(z^2-1)) mod 2*pi*i
  1259. and since the imagpart of both expressions is > -pi, <= pi
  1260. ==> arcosh(z) = log(z+sqrt(z^2-1))
  1261. To prove that the realpart of this is >= 0, write z = x+iy with x>=0,
  1262. z^2-1 = u+iv with u = x^2-y^2-1, v = 2xy,
  1263. sqrt(z^2-1) = p+iq with p = sqrt((sqrt(u^2+v^2)+u)/2) >= 0,
  1264. q = sqrt((sqrt(u^2+v^2)-u)/2) * sign(v),
  1265. then |z+sqrt(z^2-1)|^2 = |x+iy + p+iq|^2
  1266. = (x+p)^2 + (y+q)^2
  1267. = x^2 + 2xp + p^2 + y^2 + 2yq + q^2
  1268. >= x^2 + p^2 + y^2 + q^2 (since x>=0, p>=0, yq>=0)
  1269. = x^2 + y^2 + sqrt(u^2+v^2)
  1270. >= x^2 + y^2 + |u|
  1271. >= x^2 + y^2 - u
  1272. = 1 + 2*y^2
  1273. >= 1
  1274. hence realpart(log(z+sqrt(z^2-1))) = log(|z+sqrt(z^2-1)|) >= 0.
  1275. Equality holds only if y = 0 and u <= 0, i.e. 0 <= x < 1.
  1276. In this case arcosh(z) = log(x+i*sqrt(1-x^2)) has imagpart >=0.
  1277. Otherwise, -z is in Range(sqrt).
  1278. If y != 0, sqrt((z+1)/2) = i^sign(y) * sqrt((-z-1)/2),
  1279. sqrt((z-1)/2) = i^sign(y) * sqrt((-z+1)/2),
  1280. hence arcosh(z) = sign(y)*pi/2*i + arcosh(-z),
  1281. and this has realpart > 0.
  1282. If y = 0 and -1<=x<=0, we still have sqrt(z+1)*sqrt(z-1) = sqrt(z^2-1),
  1283. ==> arcosh(z) = log(z+sqrt(z^2-1)) = log(x+i*sqrt(1-x^2))
  1284. has realpart = 0 and imagpart > 0.
  1285. If y = 0 and x<=-1, however, sqrt(z+1)*sqrt(z-1) = - sqrt(z^2-1),
  1286. ==> arcosh(z) = log(z-sqrt(z^2-1)) = pi*i + arcosh(-z).
  1287. This has realpart >= 0 and imagpart = pi.
  1288. @end ignore
  1289. @item cl_N atanh (const cl_N& z)
  1290. @cindex @code{atanh ()}
  1291. Returns @code{artanh(z)}. This is defined as
  1292. @code{artanh(z) = (log(1+z)-log(1-z)) / 2} and satisfies
  1293. @code{artanh(-z) = -artanh(z)}. The range of the result is
  1294. the strip in the complex domain
  1295. @code{-pi/2 <= imagpart(artanh(z)) <= pi/2}, excluding the numbers
  1296. with @code{imagpart = -pi/2} and @code{realpart <= 0} and the numbers
  1297. with @code{imagpart = pi/2} and @code{realpart >= 0}.
  1298. @ignore
  1299. Proof: Write z = x+iy. Examine
  1300. imagpart(artanh(z)) = (atan(1+x,y) - atan(1-x,-y))/2.
  1301. Case 1: y = 0.
  1302. x > 1 ==> imagpart = -pi/2, realpart = 1/2 log((x+1)/(x-1)) > 0,
  1303. x < -1 ==> imagpart = pi/2, realpart = 1/2 log((-x-1)/(-x+1)) < 0,
  1304. |x| < 1 ==> imagpart = 0
  1305. Case 2: y > 0.
  1306. imagpart(artanh(z))
  1307. = (atan(1+x,y) - atan(1-x,-y))/2
  1308. = ((pi/2 - atan((1+x)/y)) - (-pi/2 - atan((1-x)/-y)))/2
  1309. = (pi - atan((1+x)/y) - atan((1-x)/y))/2
  1310. > (pi - pi/2 - pi/2 )/2 = 0
  1311. and (1+x)/y > (1-x)/y
  1312. ==> atan((1+x)/y) > atan((-1+x)/y) = - atan((1-x)/y)
  1313. ==> imagpart < pi/2.
  1314. Hence 0 < imagpart < pi/2.
  1315. Case 3: y < 0.
  1316. By artanh(z) = -artanh(-z) and case 2, -pi/2 < imagpart < 0.
  1317. @end ignore
  1318. @end table
  1319. @subsection Euler gamma
  1320. @cindex Euler's constant
  1321. Euler's constant C = 0.577@dots{} is returned by the following functions:
  1322. @table @code
  1323. @item cl_F eulerconst (float_format_t f)
  1324. @cindex @code{eulerconst ()}
  1325. Returns Euler's constant as a float of format @code{f}.
  1326. @item cl_F eulerconst (const cl_F& y)
  1327. Returns Euler's constant in the float format of @code{y}.
  1328. @item cl_F eulerconst (void)
  1329. Returns Euler's constant as a float of format @code{default_float_format}.
  1330. @end table
  1331. Catalan's constant G = 0.915@dots{} is returned by the following functions:
  1332. @cindex Catalan's constant
  1333. @table @code
  1334. @item cl_F catalanconst (float_format_t f)
  1335. @cindex @code{catalanconst ()}
  1336. Returns Catalan's constant as a float of format @code{f}.
  1337. @item cl_F catalanconst (const cl_F& y)
  1338. Returns Catalan's constant in the float format of @code{y}.
  1339. @item cl_F catalanconst (void)
  1340. Returns Catalan's constant as a float of format @code{default_float_format}.
  1341. @end table
  1342. @subsection Riemann zeta
  1343. @cindex Riemann's zeta
  1344. Riemann's zeta function at an integral point @code{s>1} is returned by the
  1345. following functions:
  1346. @table @code
  1347. @item cl_F zeta (int s, float_format_t f)
  1348. @cindex @code{zeta ()}
  1349. Returns Riemann's zeta function at @code{s} as a float of format @code{f}.
  1350. @item cl_F zeta (int s, const cl_F& y)
  1351. Returns Riemann's zeta function at @code{s} in the float format of @code{y}.
  1352. @item cl_F zeta (int s)
  1353. Returns Riemann's zeta function at @code{s} as a float of format
  1354. @code{default_float_format}.
  1355. @end table
  1356. @section Functions on integers
  1357. @subsection Logical functions
  1358. Integers, when viewed as in two's complement notation, can be thought as
  1359. infinite bit strings where the bits' values eventually are constant.
  1360. For example,
  1361. @example
  1362. 17 = ......00010001
  1363. -6 = ......11111010
  1364. @end example
  1365. The logical operations view integers as such bit strings and operate
  1366. on each of the bit positions in parallel.
  1367. @table @code
  1368. @item cl_I lognot (const cl_I& x)
  1369. @cindex @code{lognot ()}
  1370. @itemx cl_I operator ~ (const cl_I& x)
  1371. @cindex @code{operator ~ ()}
  1372. Logical not, like @code{~x} in C. This is the same as @code{-1-x}.
  1373. @item cl_I logand (const cl_I& x, const cl_I& y)
  1374. @cindex @code{logand ()}
  1375. @itemx cl_I operator & (const cl_I& x, const cl_I& y)
  1376. @cindex @code{operator & ()}
  1377. Logical and, like @code{x & y} in C.
  1378. @item cl_I logior (const cl_I& x, const cl_I& y)
  1379. @cindex @code{logior ()}
  1380. @itemx cl_I operator | (const cl_I& x, const cl_I& y)
  1381. @cindex @code{operator | ()}
  1382. Logical (inclusive) or, like @code{x | y} in C.
  1383. @item cl_I logxor (const cl_I& x, const cl_I& y)
  1384. @cindex @code{logxor ()}
  1385. @itemx cl_I operator ^ (const cl_I& x, const cl_I& y)
  1386. @cindex @code{operator ^ ()}
  1387. Exclusive or, like @code{x ^ y} in C.
  1388. @item cl_I logeqv (const cl_I& x, const cl_I& y)
  1389. @cindex @code{logeqv ()}
  1390. Bitwise equivalence, like @code{~(x ^ y)} in C.
  1391. @item cl_I lognand (const cl_I& x, const cl_I& y)
  1392. @cindex @code{lognand ()}
  1393. Bitwise not and, like @code{~(x & y)} in C.
  1394. @item cl_I lognor (const cl_I& x, const cl_I& y)
  1395. @cindex @code{lognor ()}
  1396. Bitwise not or, like @code{~(x | y)} in C.
  1397. @item cl_I logandc1 (const cl_I& x, const cl_I& y)
  1398. @cindex @code{logandc1 ()}
  1399. Logical and, complementing the first argument, like @code{~x & y} in C.
  1400. @item cl_I logandc2 (const cl_I& x, const cl_I& y)
  1401. @cindex @code{logandc2 ()}
  1402. Logical and, complementing the second argument, like @code{x & ~y} in C.
  1403. @item cl_I logorc1 (const cl_I& x, const cl_I& y)
  1404. @cindex @code{logorc1 ()}
  1405. Logical or, complementing the first argument, like @code{~x | y} in C.
  1406. @item cl_I logorc2 (const cl_I& x, const cl_I& y)
  1407. @cindex @code{logorc2 ()}
  1408. Logical or, complementing the second argument, like @code{x | ~y} in C.
  1409. @end table
  1410. These operations are all available though the function
  1411. @table @code
  1412. @item cl_I boole (cl_boole op, const cl_I& x, const cl_I& y)
  1413. @cindex @code{boole ()}
  1414. @end table
  1415. where @code{op} must have one of the 16 values (each one stands for a function
  1416. which combines two bits into one bit): @code{boole_clr}, @code{boole_set},
  1417. @code{boole_1}, @code{boole_2}, @code{boole_c1}, @code{boole_c2},
  1418. @code{boole_and}, @code{boole_ior}, @code{boole_xor}, @code{boole_eqv},
  1419. @code{boole_nand}, @code{boole_nor}, @code{boole_andc1}, @code{boole_andc2},
  1420. @code{boole_orc1}, @code{boole_orc2}.
  1421. @cindex @code{boole_clr}
  1422. @cindex @code{boole_set}
  1423. @cindex @code{boole_1}
  1424. @cindex @code{boole_2}
  1425. @cindex @code{boole_c1}
  1426. @cindex @code{boole_c2}
  1427. @cindex @code{boole_and}
  1428. @cindex @code{boole_xor}
  1429. @cindex @code{boole_eqv}
  1430. @cindex @code{boole_nand}
  1431. @cindex @code{boole_nor}
  1432. @cindex @code{boole_andc1}
  1433. @cindex @code{boole_andc2}
  1434. @cindex @code{boole_orc1}
  1435. @cindex @code{boole_orc2}
  1436. Other functions that view integers as bit strings:
  1437. @table @code
  1438. @item bool logtest (const cl_I& x, const cl_I& y)
  1439. @cindex @code{logtest ()}
  1440. Returns true if some bit is set in both @code{x} and @code{y}, i.e. if
  1441. @code{logand(x,y) != 0}.
  1442. @item bool logbitp (const cl_I& n, const cl_I& x)
  1443. @cindex @code{logbitp ()}
  1444. Returns true if the @code{n}th bit (from the right) of @code{x} is set.
  1445. Bit 0 is the least significant bit.
  1446. @item uintC logcount (const cl_I& x)
  1447. @cindex @code{logcount ()}
  1448. Returns the number of one bits in @code{x}, if @code{x} >= 0, or
  1449. the number of zero bits in @code{x}, if @code{x} < 0.
  1450. @end table
  1451. The following functions operate on intervals of bits in integers.
  1452. The type
  1453. @example
  1454. struct cl_byte @{ uintC size; uintC position; @};
  1455. @end example
  1456. @cindex @code{cl_byte}
  1457. represents the bit interval containing the bits
  1458. @code{position}@dots{}@code{position+size-1} of an integer.
  1459. The constructor @code{cl_byte(size,position)} constructs a @code{cl_byte}.
  1460. @table @code
  1461. @item cl_I ldb (const cl_I& n, const cl_byte& b)
  1462. @cindex @code{ldb ()}
  1463. extracts the bits of @code{n} described by the bit interval @code{b}
  1464. and returns them as a nonnegative integer with @code{b.size} bits.
  1465. @item bool ldb_test (const cl_I& n, const cl_byte& b)
  1466. @cindex @code{ldb_test ()}
  1467. Returns true if some bit described by the bit interval @code{b} is set in
  1468. @code{n}.
  1469. @item cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
  1470. @cindex @code{dpb ()}
  1471. Returns @code{n}, with the bits described by the bit interval @code{b}
  1472. replaced by @code{newbyte}. Only the lowest @code{b.size} bits of
  1473. @code{newbyte} are relevant.
  1474. @end table
  1475. The functions @code{ldb} and @code{dpb} implicitly shift. The following
  1476. functions are their counterparts without shifting:
  1477. @table @code
  1478. @item cl_I mask_field (const cl_I& n, const cl_byte& b)
  1479. @cindex @code{mask_field ()}
  1480. returns an integer with the bits described by the bit interval @code{b}
  1481. copied from the corresponding bits in @code{n}, the other bits zero.
  1482. @item cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b)
  1483. @cindex @code{deposit_field ()}
  1484. returns an integer where the bits described by the bit interval @code{b}
  1485. come from @code{newbyte} and the other bits come from @code{n}.
  1486. @end table
  1487. The following relations hold:
  1488. @itemize @asis
  1489. @item
  1490. @code{ldb (n, b) = mask_field(n, b) >> b.position},
  1491. @item
  1492. @code{dpb (newbyte, n, b) = deposit_field (newbyte << b.position, n, b)},
  1493. @item
  1494. @code{deposit_field(newbyte,n,b) = n ^ mask_field(n,b) ^ mask_field(new_byte,b)}.
  1495. @end itemize
  1496. The following operations on integers as bit strings are efficient shortcuts
  1497. for common arithmetic operations:
  1498. @table @code
  1499. @item bool oddp (const cl_I& x)
  1500. @cindex @code{oddp ()}
  1501. Returns true if the least significant bit of @code{x} is 1. Equivalent to
  1502. @code{mod(x,2) != 0}.
  1503. @item bool evenp (const cl_I& x)
  1504. @cindex @code{evenp ()}
  1505. Returns true if the least significant bit of @code{x} is 0. Equivalent to
  1506. @code{mod(x,2) == 0}.
  1507. @item cl_I operator << (const cl_I& x, const cl_I& n)
  1508. @cindex @code{operator << ()}
  1509. Shifts @code{x} by @code{n} bits to the left. @code{n} should be >=0.
  1510. Equivalent to @code{x * expt(2,n)}.
  1511. @item cl_I operator >> (const cl_I& x, const cl_I& n)
  1512. @cindex @code{operator >> ()}
  1513. Shifts @code{x} by @code{n} bits to the right. @code{n} should be >=0.
  1514. Bits shifted out to the right are thrown away.
  1515. Equivalent to @code{floor(x / expt(2,n))}.
  1516. @item cl_I ash (const cl_I& x, const cl_I& y)
  1517. @cindex @code{ash ()}
  1518. Shifts @code{x} by @code{y} bits to the left (if @code{y}>=0) or
  1519. by @code{-y} bits to the right (if @code{y}<=0). In other words, this
  1520. returns @code{floor(x * expt(2,y))}.
  1521. @item uintC integer_length (const cl_I& x)
  1522. @cindex @code{integer_length ()}
  1523. Returns the number of bits (excluding the sign bit) needed to represent @code{x}
  1524. in two's complement notation. This is the smallest n >= 0 such that
  1525. -2^n <= x < 2^n. If x > 0, this is the unique n > 0 such that
  1526. 2^(n-1) <= x < 2^n.
  1527. @item uintC ord2 (const cl_I& x)
  1528. @cindex @code{ord2 ()}
  1529. @code{x} must be non-zero. This function returns the number of 0 bits at the
  1530. right of @code{x} in two's complement notation. This is the largest n >= 0
  1531. such that 2^n divides @code{x}.
  1532. @item uintC power2p (const cl_I& x)
  1533. @cindex @code{power2p ()}
  1534. @code{x} must be > 0. This function checks whether @code{x} is a power of 2.
  1535. If @code{x} = 2^(n-1), it returns n. Else it returns 0.
  1536. (See also the function @code{logp}.)
  1537. @end table
  1538. @subsection Number theoretic functions
  1539. @table @code
  1540. @item uint32 gcd (unsigned long a, unsigned long b)
  1541. @cindex @code{gcd ()}
  1542. @itemx cl_I gcd (const cl_I& a, const cl_I& b)
  1543. This function returns the greatest common divisor of @code{a} and @code{b},
  1544. normalized to be >= 0.
  1545. @item cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)
  1546. @cindex @code{xgcd ()}
  1547. This function (``extended gcd'') returns the greatest common divisor @code{g} of
  1548. @code{a} and @code{b} and at the same time the representation of @code{g}
  1549. as an integral linear combination of @code{a} and @code{b}:
  1550. @code{u} and @code{v} with @code{u*a+v*b = g}, @code{g} >= 0.
  1551. @code{u} and @code{v} will be normalized to be of smallest possible absolute
  1552. value, in the following sense: If @code{a} and @code{b} are non-zero, and
  1553. @code{abs(a) != abs(b)}, @code{u} and @code{v} will satisfy the inequalities
  1554. @code{abs(u) <= abs(b)/(2*g)}, @code{abs(v) <= abs(a)/(2*g)}.
  1555. @item cl_I lcm (const cl_I& a, const cl_I& b)
  1556. @cindex @code{lcm ()}
  1557. This function returns the least common multiple of @code{a} and @code{b},
  1558. normalized to be >= 0.
  1559. @item bool logp (const cl_I& a, const cl_I& b, cl_RA* l)
  1560. @cindex @code{logp ()}
  1561. @itemx bool logp (const cl_RA& a, const cl_RA& b, cl_RA* l)
  1562. @code{a} must be > 0. @code{b} must be >0 and != 1. If log(a,b) is
  1563. rational number, this function returns true and sets *l = log(a,b), else
  1564. it returns false.
  1565. @item int jacobi (signed long a, signed long b)
  1566. @cindex @code{jacobi()}
  1567. @itemx int jacobi (const cl_I& a, const cl_I& b)
  1568. Returns the Jacobi symbol
  1569. @tex
  1570. $\left({a\over b}\right)$,
  1571. @end tex
  1572. @ifnottex
  1573. (a/b),
  1574. @end ifnottex
  1575. @code{a,b} must be integers, @code{b>0} and odd. The result is 0
  1576. iff gcd(a,b)>1.
  1577. @item bool isprobprime (const cl_I& n)
  1578. @cindex prime
  1579. @cindex @code{isprobprime()}
  1580. Returns true if @code{n} is a small prime or passes the Miller-Rabin
  1581. primality test. The probability of a false positive is 1:10^30.
  1582. @item cl_I nextprobprime (const cl_R& x)
  1583. @cindex @code{nextprobprime()}
  1584. Returns the smallest probable prime >=@code{x}.
  1585. @end table
  1586. @subsection Combinatorial functions
  1587. @table @code
  1588. @item cl_I factorial (uintL n)
  1589. @cindex @code{factorial ()}
  1590. @code{n} must be a small integer >= 0. This function returns the factorial
  1591. @code{n}! = @code{1*2*@dots{}*n}.
  1592. @item cl_I doublefactorial (uintL n)
  1593. @cindex @code{doublefactorial ()}
  1594. @code{n} must be a small integer >= 0. This function returns the
  1595. doublefactorial @code{n}!! = @code{1*3*@dots{}*n} or
  1596. @code{n}!! = @code{2*4*@dots{}*n}, respectively.
  1597. @item cl_I binomial (uintL n, uintL k)
  1598. @cindex @code{binomial ()}
  1599. @code{n} and @code{k} must be small integers >= 0. This function returns the
  1600. binomial coefficient
  1601. @tex
  1602. ${n \choose k} = {n! \over n! (n-k)!}$
  1603. @end tex
  1604. @ifinfo
  1605. (@code{n} choose @code{k}) = @code{n}! / @code{k}! @code{(n-k)}!
  1606. @end ifinfo
  1607. for 0 <= k <= n, 0 else.
  1608. @end table
  1609. @section Functions on floating-point numbers
  1610. Recall that a floating-point number consists of a sign @code{s}, an
  1611. exponent @code{e} and a mantissa @code{m}. The value of the number is
  1612. @code{(-1)^s * 2^e * m}.
  1613. Each of the classes
  1614. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  1615. defines the following operations.
  1616. @table @code
  1617. @item @var{type} scale_float (const @var{type}& x, sintC delta)
  1618. @cindex @code{scale_float ()}
  1619. @itemx @var{type} scale_float (const @var{type}& x, const cl_I& delta)
  1620. Returns @code{x*2^delta}. This is more efficient than an explicit multiplication
  1621. because it copies @code{x} and modifies the exponent.
  1622. @end table
  1623. The following functions provide an abstract interface to the underlying
  1624. representation of floating-point numbers.
  1625. @table @code
  1626. @item sintE float_exponent (const @var{type}& x)
  1627. @cindex @code{float_exponent ()}
  1628. Returns the exponent @code{e} of @code{x}.
  1629. For @code{x = 0.0}, this is 0. For @code{x} non-zero, this is the unique
  1630. integer with @code{2^(e-1) <= abs(x) < 2^e}.
  1631. @item sintL float_radix (const @var{type}& x)
  1632. @cindex @code{float_radix ()}
  1633. Returns the base of the floating-point representation. This is always @code{2}.
  1634. @item @var{type} float_sign (const @var{type}& x)
  1635. @cindex @code{float_sign ()}
  1636. Returns the sign @code{s} of @code{x} as a float. The value is 1 for
  1637. @code{x} >= 0, -1 for @code{x} < 0.
  1638. @item uintC float_digits (const @var{type}& x)
  1639. @cindex @code{float_digits ()}
  1640. Returns the number of mantissa bits in the floating-point representation
  1641. of @code{x}, including the hidden bit. The value only depends on the type
  1642. of @code{x}, not on its value.
  1643. @item uintC float_precision (const @var{type}& x)
  1644. @cindex @code{float_precision ()}
  1645. Returns the number of significant mantissa bits in the floating-point
  1646. representation of @code{x}. Since denormalized numbers are not supported,
  1647. this is the same as @code{float_digits(x)} if @code{x} is non-zero, and
  1648. 0 if @code{x} = 0.
  1649. @end table
  1650. The complete internal representation of a float is encoded in the type
  1651. @cindex @code{decoded_float}
  1652. @cindex @code{decoded_sfloat}
  1653. @cindex @code{decoded_ffloat}
  1654. @cindex @code{decoded_dfloat}
  1655. @cindex @code{decoded_lfloat}
  1656. @code{decoded_float} (or @code{decoded_sfloat}, @code{decoded_ffloat},
  1657. @code{decoded_dfloat}, @code{decoded_lfloat}, respectively), defined by
  1658. @example
  1659. struct decoded_@var{type}float @{
  1660. @var{type} mantissa; cl_I exponent; @var{type} sign;
  1661. @};
  1662. @end example
  1663. and returned by the function
  1664. @table @code
  1665. @item decoded_@var{type}float decode_float (const @var{type}& x)
  1666. @cindex @code{decode_float ()}
  1667. For @code{x} non-zero, this returns @code{(-1)^s}, @code{e}, @code{m} with
  1668. @code{x = (-1)^s * 2^e * m} and @code{0.5 <= m < 1.0}. For @code{x} = 0,
  1669. it returns @code{(-1)^s}=1, @code{e}=0, @code{m}=0.
  1670. @code{e} is the same as returned by the function @code{float_exponent}.
  1671. @end table
  1672. A complete decoding in terms of integers is provided as type
  1673. @cindex @code{cl_idecoded_float}
  1674. @example
  1675. struct cl_idecoded_float @{
  1676. cl_I mantissa; cl_I exponent; cl_I sign;
  1677. @};
  1678. @end example
  1679. by the following function:
  1680. @table @code
  1681. @item cl_idecoded_float integer_decode_float (const @var{type}& x)
  1682. @cindex @code{integer_decode_float ()}
  1683. For @code{x} non-zero, this returns @code{(-1)^s}, @code{e}, @code{m} with
  1684. @code{x = (-1)^s * 2^e * m} and @code{m} an integer with @code{float_digits(x)}
  1685. bits. For @code{x} = 0, it returns @code{(-1)^s}=1, @code{e}=0, @code{m}=0.
  1686. WARNING: The exponent @code{e} is not the same as the one returned by
  1687. the functions @code{decode_float} and @code{float_exponent}.
  1688. @end table
  1689. Some other function, implemented only for class @code{cl_F}:
  1690. @table @code
  1691. @item cl_F float_sign (const cl_F& x, const cl_F& y)
  1692. @cindex @code{float_sign ()}
  1693. This returns a floating point number whose precision and absolute value
  1694. is that of @code{y} and whose sign is that of @code{x}. If @code{x} is
  1695. zero, it is treated as positive. Same for @code{y}.
  1696. @end table
  1697. @section Conversion functions
  1698. @cindex conversion
  1699. @subsection Conversion to floating-point numbers
  1700. The type @code{float_format_t} describes a floating-point format.
  1701. @cindex @code{float_format_t}
  1702. @table @code
  1703. @item float_format_t float_format (uintE n)
  1704. @cindex @code{float_format ()}
  1705. Returns the smallest float format which guarantees at least @code{n}
  1706. decimal digits in the mantissa (after the decimal point).
  1707. @item float_format_t float_format (const cl_F& x)
  1708. Returns the floating point format of @code{x}.
  1709. @item float_format_t default_float_format
  1710. @cindex @code{default_float_format}
  1711. Global variable: the default float format used when converting rational numbers
  1712. to floats.
  1713. @end table
  1714. To convert a real number to a float, each of the types
  1715. @code{cl_R}, @code{cl_F}, @code{cl_I}, @code{cl_RA},
  1716. @code{int}, @code{unsigned int}, @code{float}, @code{double}
  1717. defines the following operations:
  1718. @table @code
  1719. @item cl_F cl_float (const @var{type}&x, float_format_t f)
  1720. @cindex @code{cl_float ()}
  1721. Returns @code{x} as a float of format @code{f}.
  1722. @item cl_F cl_float (const @var{type}&x, const cl_F& y)
  1723. Returns @code{x} in the float format of @code{y}.
  1724. @item cl_F cl_float (const @var{type}&x)
  1725. Returns @code{x} as a float of format @code{default_float_format} if
  1726. it is an exact number, or @code{x} itself if it is already a float.
  1727. @end table
  1728. Of course, converting a number to a float can lose precision.
  1729. Every floating-point format has some characteristic numbers:
  1730. @table @code
  1731. @item cl_F most_positive_float (float_format_t f)
  1732. @cindex @code{most_positive_float ()}
  1733. Returns the largest (most positive) floating point number in float format @code{f}.
  1734. @item cl_F most_negative_float (float_format_t f)
  1735. @cindex @code{most_negative_float ()}
  1736. Returns the smallest (most negative) floating point number in float format @code{f}.
  1737. @item cl_F least_positive_float (float_format_t f)
  1738. @cindex @code{least_positive_float ()}
  1739. Returns the least positive floating point number (i.e. > 0 but closest to 0)
  1740. in float format @code{f}.
  1741. @item cl_F least_negative_float (float_format_t f)
  1742. @cindex @code{least_negative_float ()}
  1743. Returns the least negative floating point number (i.e. < 0 but closest to 0)
  1744. in float format @code{f}.
  1745. @item cl_F float_epsilon (float_format_t f)
  1746. @cindex @code{float_epsilon ()}
  1747. Returns the smallest floating point number e > 0 such that @code{1+e != 1}.
  1748. @item cl_F float_negative_epsilon (float_format_t f)
  1749. @cindex @code{float_negative_epsilon ()}
  1750. Returns the smallest floating point number e > 0 such that @code{1-e != 1}.
  1751. @end table
  1752. @subsection Conversion to rational numbers
  1753. Each of the classes @code{cl_R}, @code{cl_RA}, @code{cl_F}
  1754. defines the following operation:
  1755. @table @code
  1756. @item cl_RA rational (const @var{type}& x)
  1757. @cindex @code{rational ()}
  1758. Returns the value of @code{x} as an exact number. If @code{x} is already
  1759. an exact number, this is @code{x}. If @code{x} is a floating-point number,
  1760. the value is a rational number whose denominator is a power of 2.
  1761. @end table
  1762. In order to convert back, say, @code{(cl_F)(cl_R)"1/3"} to @code{1/3}, there is
  1763. the function
  1764. @table @code
  1765. @item cl_RA rationalize (const cl_R& x)
  1766. @cindex @code{rationalize ()}
  1767. If @code{x} is a floating-point number, it actually represents an interval
  1768. of real numbers, and this function returns the rational number with
  1769. smallest denominator (and smallest numerator, in magnitude)
  1770. which lies in this interval.
  1771. If @code{x} is already an exact number, this function returns @code{x}.
  1772. @end table
  1773. If @code{x} is any float, one has
  1774. @itemize @asis
  1775. @item
  1776. @code{cl_float(rational(x),x) = x}
  1777. @item
  1778. @code{cl_float(rationalize(x),x) = x}
  1779. @end itemize
  1780. @section Random number generators
  1781. A random generator is a machine which produces (pseudo-)random numbers.
  1782. The include file @code{<cln/random.h>} defines a class @code{random_state}
  1783. which contains the state of a random generator. If you make a copy
  1784. of the random number generator, the original one and the copy will produce
  1785. the same sequence of random numbers.
  1786. The following functions return (pseudo-)random numbers in different formats.
  1787. Calling one of these modifies the state of the random number generator in
  1788. a complicated but deterministic way.
  1789. The global variable
  1790. @cindex @code{random_state}
  1791. @cindex @code{default_random_state}
  1792. @example
  1793. random_state default_random_state
  1794. @end example
  1795. contains a default random number generator. It is used when the functions
  1796. below are called without @code{random_state} argument.
  1797. @table @code
  1798. @item uint32 random32 (random_state& randomstate)
  1799. @itemx uint32 random32 ()
  1800. @cindex @code{random32 ()}
  1801. Returns a random unsigned 32-bit number. All bits are equally random.
  1802. @item cl_I random_I (random_state& randomstate, const cl_I& n)
  1803. @itemx cl_I random_I (const cl_I& n)
  1804. @cindex @code{random_I ()}
  1805. @code{n} must be an integer > 0. This function returns a random integer @code{x}
  1806. in the range @code{0 <= x < n}.
  1807. @item cl_F random_F (random_state& randomstate, const cl_F& n)
  1808. @itemx cl_F random_F (const cl_F& n)
  1809. @cindex @code{random_F ()}
  1810. @code{n} must be a float > 0. This function returns a random floating-point
  1811. number of the same format as @code{n} in the range @code{0 <= x < n}.
  1812. @item cl_R random_R (random_state& randomstate, const cl_R& n)
  1813. @itemx cl_R random_R (const cl_R& n)
  1814. @cindex @code{random_R ()}
  1815. Behaves like @code{random_I} if @code{n} is an integer and like @code{random_F}
  1816. if @code{n} is a float.
  1817. @end table
  1818. @section Obfuscating operators
  1819. @cindex modifying operators
  1820. The modifying C/C++ operators @code{+=}, @code{-=}, @code{*=}, @code{/=},
  1821. @code{&=}, @code{|=}, @code{^=}, @code{<<=}, @code{>>=}
  1822. are not available by default because their
  1823. use tends to make programs unreadable. It is trivial to get away without
  1824. them. However, if you feel that you absolutely need these operators
  1825. to get happy, then add
  1826. @example
  1827. #define WANT_OBFUSCATING_OPERATORS
  1828. @end example
  1829. @cindex @code{WANT_OBFUSCATING_OPERATORS}
  1830. to the beginning of your source files, before the inclusion of any CLN
  1831. include files. This flag will enable the following operators:
  1832. For the classes @code{cl_N}, @code{cl_R}, @code{cl_RA},
  1833. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}:
  1834. @table @code
  1835. @item @var{type}& operator += (@var{type}&, const @var{type}&)
  1836. @cindex @code{operator += ()}
  1837. @itemx @var{type}& operator -= (@var{type}&, const @var{type}&)
  1838. @cindex @code{operator -= ()}
  1839. @itemx @var{type}& operator *= (@var{type}&, const @var{type}&)
  1840. @cindex @code{operator *= ()}
  1841. @itemx @var{type}& operator /= (@var{type}&, const @var{type}&)
  1842. @cindex @code{operator /= ()}
  1843. @end table
  1844. For the class @code{cl_I}:
  1845. @table @code
  1846. @item @var{type}& operator += (@var{type}&, const @var{type}&)
  1847. @itemx @var{type}& operator -= (@var{type}&, const @var{type}&)
  1848. @itemx @var{type}& operator *= (@var{type}&, const @var{type}&)
  1849. @itemx @var{type}& operator &= (@var{type}&, const @var{type}&)
  1850. @cindex @code{operator &= ()}
  1851. @itemx @var{type}& operator |= (@var{type}&, const @var{type}&)
  1852. @cindex @code{operator |= ()}
  1853. @itemx @var{type}& operator ^= (@var{type}&, const @var{type}&)
  1854. @cindex @code{operator ^= ()}
  1855. @itemx @var{type}& operator <<= (@var{type}&, const @var{type}&)
  1856. @cindex @code{operator <<= ()}
  1857. @itemx @var{type}& operator >>= (@var{type}&, const @var{type}&)
  1858. @cindex @code{operator >>= ()}
  1859. @end table
  1860. For the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
  1861. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}:
  1862. @table @code
  1863. @item @var{type}& operator ++ (@var{type}& x)
  1864. @cindex @code{operator ++ ()}
  1865. The prefix operator @code{++x}.
  1866. @item void operator ++ (@var{type}& x, int)
  1867. The postfix operator @code{x++}.
  1868. @item @var{type}& operator -- (@var{type}& x)
  1869. @cindex @code{operator -- ()}
  1870. The prefix operator @code{--x}.
  1871. @item void operator -- (@var{type}& x, int)
  1872. The postfix operator @code{x--}.
  1873. @end table
  1874. Note that by using these obfuscating operators, you wouldn't gain efficiency:
  1875. In CLN @samp{x += y;} is exactly the same as @samp{x = x+y;}, not more
  1876. efficient.
  1877. @chapter Input/Output
  1878. @cindex Input/Output
  1879. @section Internal and printed representation
  1880. @cindex representation
  1881. All computations deal with the internal representations of the numbers.
  1882. Every number has an external representation as a sequence of ASCII characters.
  1883. Several external representations may denote the same number, for example,
  1884. "20.0" and "20.000".
  1885. Converting an internal to an external representation is called ``printing'',
  1886. @cindex printing
  1887. converting an external to an internal representation is called ``reading''.
  1888. @cindex reading
  1889. In CLN, it is always true that conversion of an internal to an external
  1890. representation and then back to an internal representation will yield the
  1891. same internal representation. Symbolically: @code{read(print(x)) == x}.
  1892. This is called ``print-read consistency''.
  1893. Different types of numbers have different external representations (case
  1894. is insignificant):
  1895. @table @asis
  1896. @item Integers
  1897. External representation: @var{sign}@{@var{digit}@}+. The reader also accepts the
  1898. Common Lisp syntaxes @var{sign}@{@var{digit}@}+@code{.} with a trailing dot
  1899. for decimal integers
  1900. and the @code{#@var{n}R}, @code{#b}, @code{#o}, @code{#x} prefixes.
  1901. @item Rational numbers
  1902. External representation: @var{sign}@{@var{digit}@}+@code{/}@{@var{digit}@}+.
  1903. The @code{#@var{n}R}, @code{#b}, @code{#o}, @code{#x} prefixes are allowed
  1904. here as well.
  1905. @item Floating-point numbers
  1906. External representation: @var{sign}@{@var{digit}@}*@var{exponent} or
  1907. @var{sign}@{@var{digit}@}*@code{.}@{@var{digit}@}*@var{exponent} or
  1908. @var{sign}@{@var{digit}@}*@code{.}@{@var{digit}@}+. A precision specifier
  1909. of the form _@var{prec} may be appended. There must be at least
  1910. one digit in the non-exponent part. The exponent has the syntax
  1911. @var{expmarker} @var{expsign} @{@var{digit}@}+.
  1912. The exponent marker is
  1913. @itemize @asis
  1914. @item
  1915. @samp{s} for short-floats,
  1916. @item
  1917. @samp{f} for single-floats,
  1918. @item
  1919. @samp{d} for double-floats,
  1920. @item
  1921. @samp{L} for long-floats,
  1922. @end itemize
  1923. or @samp{e}, which denotes a default float format. The precision specifying
  1924. suffix has the syntax _@var{prec} where @var{prec} denotes the number of
  1925. valid mantissa digits (in decimal, excluding leading zeroes), cf. also
  1926. function @samp{float_format}.
  1927. @item Complex numbers
  1928. External representation:
  1929. @itemize @asis
  1930. @item
  1931. In algebraic notation: @code{@var{realpart}+@var{imagpart}i}. Of course,
  1932. if @var{imagpart} is negative, its printed representation begins with
  1933. a @samp{-}, and the @samp{+} between @var{realpart} and @var{imagpart}
  1934. may be omitted. Note that this notation cannot be used when the @var{imagpart}
  1935. is rational and the rational number's base is >18, because the @samp{i}
  1936. is then read as a digit.
  1937. @item
  1938. In Common Lisp notation: @code{#C(@var{realpart} @var{imagpart})}.
  1939. @end itemize
  1940. @end table
  1941. @section Input functions
  1942. Including @code{<cln/io.h>} defines a number of simple input functions
  1943. that read from @code{std::istream&}:
  1944. @table @code
  1945. @item int freadchar (std::istream& stream)
  1946. Reads a character from @code{stream}. Returns @code{cl_EOF} (not a @samp{char}!)
  1947. if the end of stream was encountered or an error occurred.
  1948. @item int funreadchar (std::istream& stream, int c)
  1949. Puts back @code{c} onto @code{stream}. @code{c} must be the result of the
  1950. last @code{freadchar} operation on @code{stream}.
  1951. @end table
  1952. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
  1953. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  1954. defines, in @code{<cln/@var{type}_io.h>}, the following input function:
  1955. @table @code
  1956. @item std::istream& operator>> (std::istream& stream, @var{type}& result)
  1957. Reads a number from @code{stream} and stores it in the @code{result}.
  1958. @end table
  1959. The most flexible input functions, defined in @code{<cln/@var{type}_io.h>},
  1960. are the following:
  1961. @table @code
  1962. @item cl_N read_complex (std::istream& stream, const cl_read_flags& flags)
  1963. @itemx cl_R read_real (std::istream& stream, const cl_read_flags& flags)
  1964. @itemx cl_F read_float (std::istream& stream, const cl_read_flags& flags)
  1965. @itemx cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)
  1966. @itemx cl_I read_integer (std::istream& stream, const cl_read_flags& flags)
  1967. Reads a number from @code{stream}. The @code{flags} are parameters which
  1968. affect the input syntax. Whitespace before the number is silently skipped.
  1969. @item cl_N read_complex (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)
  1970. @itemx cl_R read_real (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)
  1971. @itemx cl_F read_float (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)
  1972. @itemx cl_RA read_rational (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)
  1973. @itemx cl_I read_integer (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)
  1974. Reads a number from a string in memory. The @code{flags} are parameters which
  1975. affect the input syntax. The string starts at @code{string} and ends at
  1976. @code{string_limit} (exclusive limit). @code{string_limit} may also be
  1977. @code{NULL}, denoting the entire string, i.e. equivalent to
  1978. @code{string_limit = string + strlen(string)}. If @code{end_of_parse} is
  1979. @code{NULL}, the string in memory must contain exactly one number and nothing
  1980. more, else an exception will be thrown. If @code{end_of_parse}
  1981. is not @code{NULL}, @code{*end_of_parse} will be assigned a pointer past
  1982. the last parsed character (i.e. @code{string_limit} if nothing came after
  1983. the number). Whitespace is not allowed.
  1984. @end table
  1985. The structure @code{cl_read_flags} contains the following fields:
  1986. @table @code
  1987. @item cl_read_syntax_t syntax
  1988. The possible results of the read operation. Possible values are
  1989. @code{syntax_number}, @code{syntax_real}, @code{syntax_rational},
  1990. @code{syntax_integer}, @code{syntax_float}, @code{syntax_sfloat},
  1991. @code{syntax_ffloat}, @code{syntax_dfloat}, @code{syntax_lfloat}.
  1992. @item cl_read_lsyntax_t lsyntax
  1993. Specifies the language-dependent syntax variant for the read operation.
  1994. Possible values are
  1995. @table @code
  1996. @item lsyntax_standard
  1997. accept standard algebraic notation only, no complex numbers,
  1998. @item lsyntax_algebraic
  1999. accept the algebraic notation @code{@var{x}+@var{y}i} for complex numbers,
  2000. @item lsyntax_commonlisp
  2001. accept the @code{#b}, @code{#o}, @code{#x} syntaxes for binary, octal,
  2002. hexadecimal numbers,
  2003. @code{#@var{base}R} for rational numbers in a given base,
  2004. @code{#c(@var{realpart} @var{imagpart})} for complex numbers,
  2005. @item lsyntax_all
  2006. accept all of these extensions.
  2007. @end table
  2008. @item unsigned int rational_base
  2009. The base in which rational numbers are read.
  2010. @item float_format_t float_flags.default_float_format
  2011. The float format used when reading floats with exponent marker @samp{e}.
  2012. @item float_format_t float_flags.default_lfloat_format
  2013. The float format used when reading floats with exponent marker @samp{l}.
  2014. @item bool float_flags.mantissa_dependent_float_format
  2015. When this flag is true, floats specified with more digits than corresponding
  2016. to the exponent marker they contain, but without @var{_nnn} suffix, will get a
  2017. precision corresponding to their number of significant digits.
  2018. @end table
  2019. @section Output functions
  2020. Including @code{<cln/io.h>} defines a number of simple output functions
  2021. that write to @code{std::ostream&}:
  2022. @table @code
  2023. @item void fprintchar (std::ostream& stream, char c)
  2024. Prints the character @code{x} literally on the @code{stream}.
  2025. @item void fprint (std::ostream& stream, const char * string)
  2026. Prints the @code{string} literally on the @code{stream}.
  2027. @item void fprintdecimal (std::ostream& stream, int x)
  2028. @itemx void fprintdecimal (std::ostream& stream, const cl_I& x)
  2029. Prints the integer @code{x} in decimal on the @code{stream}.
  2030. @item void fprintbinary (std::ostream& stream, const cl_I& x)
  2031. Prints the integer @code{x} in binary (base 2, without prefix)
  2032. on the @code{stream}.
  2033. @item void fprintoctal (std::ostream& stream, const cl_I& x)
  2034. Prints the integer @code{x} in octal (base 8, without prefix)
  2035. on the @code{stream}.
  2036. @item void fprinthexadecimal (std::ostream& stream, const cl_I& x)
  2037. Prints the integer @code{x} in hexadecimal (base 16, without prefix)
  2038. on the @code{stream}.
  2039. @end table
  2040. Each of the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_I},
  2041. @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}
  2042. defines, in @code{<cln/@var{type}_io.h>}, the following output functions:
  2043. @table @code
  2044. @item void fprint (std::ostream& stream, const @var{type}& x)
  2045. @itemx std::ostream& operator<< (std::ostream& stream, const @var{type}& x)
  2046. Prints the number @code{x} on the @code{stream}. The output may depend
  2047. on the global printer settings in the variable @code{default_print_flags}.
  2048. The @code{ostream} flags and settings (flags, width and locale) are
  2049. ignored.
  2050. @end table
  2051. The most flexible output function, defined in @code{<cln/@var{type}_io.h>},
  2052. are the following:
  2053. @example
  2054. void print_complex (std::ostream& stream, const cl_print_flags& flags,
  2055. const cl_N& z);
  2056. void print_real (std::ostream& stream, const cl_print_flags& flags,
  2057. const cl_R& z);
  2058. void print_float (std::ostream& stream, const cl_print_flags& flags,
  2059. const cl_F& z);
  2060. void print_rational (std::ostream& stream, const cl_print_flags& flags,
  2061. const cl_RA& z);
  2062. void print_integer (std::ostream& stream, const cl_print_flags& flags,
  2063. const cl_I& z);
  2064. @end example
  2065. Prints the number @code{x} on the @code{stream}. The @code{flags} are
  2066. parameters which affect the output.
  2067. The structure type @code{cl_print_flags} contains the following fields:
  2068. @table @code
  2069. @item unsigned int rational_base
  2070. The base in which rational numbers are printed. Default is @code{10}.
  2071. @item bool rational_readably
  2072. If this flag is true, rational numbers are printed with radix specifiers in
  2073. Common Lisp syntax (@code{#@var{n}R} or @code{#b} or @code{#o} or @code{#x}
  2074. prefixes, trailing dot). Default is false.
  2075. @item bool float_readably
  2076. If this flag is true, type specific exponent markers have precedence over 'E'.
  2077. Default is false.
  2078. @item float_format_t default_float_format
  2079. Floating point numbers of this format will be printed using the 'E' exponent
  2080. marker. Default is @code{float_format_ffloat}.
  2081. @item bool complex_readably
  2082. If this flag is true, complex numbers will be printed using the Common Lisp
  2083. syntax @code{#C(@var{realpart} @var{imagpart})}. Default is false.
  2084. @item cl_string univpoly_varname
  2085. Univariate polynomials with no explicit indeterminate name will be printed
  2086. using this variable name. Default is @code{"x"}.
  2087. @end table
  2088. The global variable @code{default_print_flags} contains the default values,
  2089. used by the function @code{fprint}.
  2090. @chapter Rings
  2091. CLN has a class of abstract rings.
  2092. @example
  2093. Ring
  2094. cl_ring
  2095. <cln/ring.h>
  2096. @end example
  2097. Rings can be compared for equality:
  2098. @table @code
  2099. @item bool operator== (const cl_ring&, const cl_ring&)
  2100. @itemx bool operator!= (const cl_ring&, const cl_ring&)
  2101. These compare two rings for equality.
  2102. @end table
  2103. Given a ring @code{R}, the following members can be used.
  2104. @table @code
  2105. @item void R->fprint (std::ostream& stream, const cl_ring_element& x)
  2106. @cindex @code{fprint ()}
  2107. @itemx bool R->equal (const cl_ring_element& x, const cl_ring_element& y)
  2108. @cindex @code{equal ()}
  2109. @itemx cl_ring_element R->zero ()
  2110. @cindex @code{zero ()}
  2111. @itemx bool R->zerop (const cl_ring_element& x)
  2112. @cindex @code{zerop ()}
  2113. @itemx cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y)
  2114. @cindex @code{plus ()}
  2115. @itemx cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y)
  2116. @cindex @code{minus ()}
  2117. @itemx cl_ring_element R->uminus (const cl_ring_element& x)
  2118. @cindex @code{uminus ()}
  2119. @itemx cl_ring_element R->one ()
  2120. @cindex @code{one ()}
  2121. @itemx cl_ring_element R->canonhom (const cl_I& x)
  2122. @cindex @code{canonhom ()}
  2123. @itemx cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y)
  2124. @cindex @code{mul ()}
  2125. @itemx cl_ring_element R->square (const cl_ring_element& x)
  2126. @cindex @code{square ()}
  2127. @itemx cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y)
  2128. @cindex @code{expt_pos ()}
  2129. @end table
  2130. The following rings are built-in.
  2131. @table @code
  2132. @item cl_null_ring cl_0_ring
  2133. The null ring, containing only zero.
  2134. @item cl_complex_ring cl_C_ring
  2135. The ring of complex numbers. This corresponds to the type @code{cl_N}.
  2136. @item cl_real_ring cl_R_ring
  2137. The ring of real numbers. This corresponds to the type @code{cl_R}.
  2138. @item cl_rational_ring cl_RA_ring
  2139. The ring of rational numbers. This corresponds to the type @code{cl_RA}.
  2140. @item cl_integer_ring cl_I_ring
  2141. The ring of integers. This corresponds to the type @code{cl_I}.
  2142. @end table
  2143. Type tests can be performed for any of @code{cl_C_ring}, @code{cl_R_ring},
  2144. @code{cl_RA_ring}, @code{cl_I_ring}:
  2145. @table @code
  2146. @item bool instanceof (const cl_number& x, const cl_number_ring& R)
  2147. @cindex @code{instanceof ()}
  2148. Tests whether the given number is an element of the number ring R.
  2149. @end table
  2150. @chapter Modular integers
  2151. @cindex modular integer
  2152. @section Modular integer rings
  2153. @cindex ring
  2154. CLN implements modular integers, i.e. integers modulo a fixed integer N.
  2155. The modulus is explicitly part of every modular integer. CLN doesn't
  2156. allow you to (accidentally) mix elements of different modular rings,
  2157. e.g. @code{(3 mod 4) + (2 mod 5)} will result in a runtime error.
  2158. (Ideally one would imagine a generic data type @code{cl_MI(N)}, but C++
  2159. doesn't have generic types. So one has to live with runtime checks.)
  2160. The class of modular integer rings is
  2161. @example
  2162. Ring
  2163. cl_ring
  2164. <cln/ring.h>
  2165. |
  2166. |
  2167. Modular integer ring
  2168. cl_modint_ring
  2169. <cln/modinteger.h>
  2170. @end example
  2171. @cindex @code{cl_modint_ring}
  2172. and the class of all modular integers (elements of modular integer rings) is
  2173. @example
  2174. Modular integer
  2175. cl_MI
  2176. <cln/modinteger.h>
  2177. @end example
  2178. Modular integer rings are constructed using the function
  2179. @table @code
  2180. @item cl_modint_ring find_modint_ring (const cl_I& N)
  2181. @cindex @code{find_modint_ring ()}
  2182. This function returns the modular ring @samp{Z/NZ}. It takes care
  2183. of finding out about special cases of @code{N}, like powers of two
  2184. and odd numbers for which Montgomery multiplication will be a win,
  2185. @cindex Montgomery multiplication
  2186. and precomputes any necessary auxiliary data for computing modulo @code{N}.
  2187. There is a cache table of rings, indexed by @code{N} (or, more precisely,
  2188. by @code{abs(N)}). This ensures that the precomputation costs are reduced
  2189. to a minimum.
  2190. @end table
  2191. Modular integer rings can be compared for equality:
  2192. @table @code
  2193. @item bool operator== (const cl_modint_ring&, const cl_modint_ring&)
  2194. @cindex @code{operator == ()}
  2195. @itemx bool operator!= (const cl_modint_ring&, const cl_modint_ring&)
  2196. @cindex @code{operator != ()}
  2197. These compare two modular integer rings for equality. Two different calls
  2198. to @code{find_modint_ring} with the same argument necessarily return the
  2199. same ring because it is memoized in the cache table.
  2200. @end table
  2201. @section Functions on modular integers
  2202. Given a modular integer ring @code{R}, the following members can be used.
  2203. @table @code
  2204. @item cl_I R->modulus
  2205. @cindex @code{modulus}
  2206. This is the ring's modulus, normalized to be nonnegative: @code{abs(N)}.
  2207. @item cl_MI R->zero()
  2208. @cindex @code{zero ()}
  2209. This returns @code{0 mod N}.
  2210. @item cl_MI R->one()
  2211. @cindex @code{one ()}
  2212. This returns @code{1 mod N}.
  2213. @item cl_MI R->canonhom (const cl_I& x)
  2214. @cindex @code{canonhom ()}
  2215. This returns @code{x mod N}.
  2216. @item cl_I R->retract (const cl_MI& x)
  2217. @cindex @code{retract ()}
  2218. This is a partial inverse function to @code{R->canonhom}. It returns the
  2219. standard representative (@code{>=0}, @code{<N}) of @code{x}.
  2220. @item cl_MI R->random(random_state& randomstate)
  2221. @itemx cl_MI R->random()
  2222. @cindex @code{random ()}
  2223. This returns a random integer modulo @code{N}.
  2224. @end table
  2225. The following operations are defined on modular integers.
  2226. @table @code
  2227. @item cl_modint_ring x.ring ()
  2228. @cindex @code{ring ()}
  2229. Returns the ring to which the modular integer @code{x} belongs.
  2230. @item cl_MI operator+ (const cl_MI&, const cl_MI&)
  2231. @cindex @code{operator + ()}
  2232. Returns the sum of two modular integers. One of the arguments may also
  2233. be a plain integer.
  2234. @item cl_MI operator- (const cl_MI&, const cl_MI&)
  2235. @cindex @code{operator - ()}
  2236. Returns the difference of two modular integers. One of the arguments may also
  2237. be a plain integer.
  2238. @item cl_MI operator- (const cl_MI&)
  2239. Returns the negative of a modular integer.
  2240. @item cl_MI operator* (const cl_MI&, const cl_MI&)
  2241. @cindex @code{operator * ()}
  2242. Returns the product of two modular integers. One of the arguments may also
  2243. be a plain integer.
  2244. @item cl_MI square (const cl_MI&)
  2245. @cindex @code{square ()}
  2246. Returns the square of a modular integer.
  2247. @item cl_MI recip (const cl_MI& x)
  2248. @cindex @code{recip ()}
  2249. Returns the reciprocal @code{x^-1} of a modular integer @code{x}. @code{x}
  2250. must be coprime to the modulus, otherwise an error message is issued.
  2251. @item cl_MI div (const cl_MI& x, const cl_MI& y)
  2252. @cindex @code{div ()}
  2253. Returns the quotient @code{x*y^-1} of two modular integers @code{x}, @code{y}.
  2254. @code{y} must be coprime to the modulus, otherwise an error message is issued.
  2255. @item cl_MI expt_pos (const cl_MI& x, const cl_I& y)
  2256. @cindex @code{expt_pos ()}
  2257. @code{y} must be > 0. Returns @code{x^y}.
  2258. @item cl_MI expt (const cl_MI& x, const cl_I& y)
  2259. @cindex @code{expt ()}
  2260. Returns @code{x^y}. If @code{y} is negative, @code{x} must be coprime to the
  2261. modulus, else an error message is issued.
  2262. @item cl_MI operator<< (const cl_MI& x, const cl_I& y)
  2263. @cindex @code{operator << ()}
  2264. Returns @code{x*2^y}.
  2265. @item cl_MI operator>> (const cl_MI& x, const cl_I& y)
  2266. @cindex @code{operator >> ()}
  2267. Returns @code{x*2^-y}. When @code{y} is positive, the modulus must be odd,
  2268. or an error message is issued.
  2269. @item bool operator== (const cl_MI&, const cl_MI&)
  2270. @cindex @code{operator == ()}
  2271. @itemx bool operator!= (const cl_MI&, const cl_MI&)
  2272. @cindex @code{operator != ()}
  2273. Compares two modular integers, belonging to the same modular integer ring,
  2274. for equality.
  2275. @item bool zerop (const cl_MI& x)
  2276. @cindex @code{zerop ()}
  2277. Returns true if @code{x} is @code{0 mod N}.
  2278. @end table
  2279. The following output functions are defined (see also the chapter on
  2280. input/output).
  2281. @table @code
  2282. @item void fprint (std::ostream& stream, const cl_MI& x)
  2283. @cindex @code{fprint ()}
  2284. @itemx std::ostream& operator<< (std::ostream& stream, const cl_MI& x)
  2285. @cindex @code{operator << ()}
  2286. Prints the modular integer @code{x} on the @code{stream}. The output may depend
  2287. on the global printer settings in the variable @code{default_print_flags}.
  2288. @end table
  2289. @chapter Symbolic data types
  2290. @cindex symbolic type
  2291. CLN implements two symbolic (non-numeric) data types: strings and symbols.
  2292. @section Strings
  2293. @cindex string
  2294. @cindex @code{cl_string}
  2295. The class
  2296. @example
  2297. String
  2298. cl_string
  2299. <cln/string.h>
  2300. @end example
  2301. implements immutable strings.
  2302. Strings are constructed through the following constructors:
  2303. @table @code
  2304. @item cl_string (const char * s)
  2305. Returns an immutable copy of the (zero-terminated) C string @code{s}.
  2306. @item cl_string (const char * ptr, unsigned long len)
  2307. Returns an immutable copy of the @code{len} characters at
  2308. @code{ptr[0]}, @dots{}, @code{ptr[len-1]}. NUL characters are allowed.
  2309. @end table
  2310. The following functions are available on strings:
  2311. @table @code
  2312. @item operator =
  2313. Assignment from @code{cl_string} and @code{const char *}.
  2314. @item s.length()
  2315. @cindex @code{length ()}
  2316. @itemx strlen(s)
  2317. @cindex @code{strlen ()}
  2318. Returns the length of the string @code{s}.
  2319. @item s[i]
  2320. @cindex @code{operator [] ()}
  2321. Returns the @code{i}th character of the string @code{s}.
  2322. @code{i} must be in the range @code{0 <= i < s.length()}.
  2323. @item bool equal (const cl_string& s1, const cl_string& s2)
  2324. @cindex @code{equal ()}
  2325. Compares two strings for equality. One of the arguments may also be a
  2326. plain @code{const char *}.
  2327. @end table
  2328. @section Symbols
  2329. @cindex symbol
  2330. @cindex @code{cl_symbol}
  2331. Symbols are uniquified strings: all symbols with the same name are shared.
  2332. This means that comparison of two symbols is fast (effectively just a pointer
  2333. comparison), whereas comparison of two strings must in the worst case walk
  2334. both strings until their end.
  2335. Symbols are used, for example, as tags for properties, as names of variables
  2336. in polynomial rings, etc.
  2337. Symbols are constructed through the following constructor:
  2338. @table @code
  2339. @item cl_symbol (const cl_string& s)
  2340. Looks up or creates a new symbol with a given name.
  2341. @end table
  2342. The following operations are available on symbols:
  2343. @table @code
  2344. @item cl_string (const cl_symbol& sym)
  2345. Conversion to @code{cl_string}: Returns the string which names the symbol
  2346. @code{sym}.
  2347. @item bool equal (const cl_symbol& sym1, const cl_symbol& sym2)
  2348. @cindex @code{equal ()}
  2349. Compares two symbols for equality. This is very fast.
  2350. @end table
  2351. @chapter Univariate polynomials
  2352. @cindex polynomial
  2353. @cindex univariate polynomial
  2354. @section Univariate polynomial rings
  2355. CLN implements univariate polynomials (polynomials in one variable) over an
  2356. arbitrary ring. The indeterminate variable may be either unnamed (and will be
  2357. printed according to @code{default_print_flags.univpoly_varname}, which
  2358. defaults to @samp{x}) or carry a given name. The base ring and the
  2359. indeterminate are explicitly part of every polynomial. CLN doesn't allow you to
  2360. (accidentally) mix elements of different polynomial rings, e.g.
  2361. @code{(a^2+1) * (b^3-1)} will result in a runtime error. (Ideally this should
  2362. return a multivariate polynomial, but they are not yet implemented in CLN.)
  2363. The classes of univariate polynomial rings are
  2364. @example
  2365. Ring
  2366. cl_ring
  2367. <cln/ring.h>
  2368. |
  2369. |
  2370. Univariate polynomial ring
  2371. cl_univpoly_ring
  2372. <cln/univpoly.h>
  2373. |
  2374. +----------------+-------------------+
  2375. | | |
  2376. Complex polynomial ring | Modular integer polynomial ring
  2377. cl_univpoly_complex_ring | cl_univpoly_modint_ring
  2378. <cln/univpoly_complex.h> | <cln/univpoly_modint.h>
  2379. |
  2380. +----------------+
  2381. | |
  2382. Real polynomial ring |
  2383. cl_univpoly_real_ring |
  2384. <cln/univpoly_real.h> |
  2385. |
  2386. +----------------+
  2387. | |
  2388. Rational polynomial ring |
  2389. cl_univpoly_rational_ring |
  2390. <cln/univpoly_rational.h> |
  2391. |
  2392. +----------------+
  2393. |
  2394. Integer polynomial ring
  2395. cl_univpoly_integer_ring
  2396. <cln/univpoly_integer.h>
  2397. @end example
  2398. and the corresponding classes of univariate polynomials are
  2399. @example
  2400. Univariate polynomial
  2401. cl_UP
  2402. <cln/univpoly.h>
  2403. |
  2404. +----------------+-------------------+
  2405. | | |
  2406. Complex polynomial | Modular integer polynomial
  2407. cl_UP_N | cl_UP_MI
  2408. <cln/univpoly_complex.h> | <cln/univpoly_modint.h>
  2409. |
  2410. +----------------+
  2411. | |
  2412. Real polynomial |
  2413. cl_UP_R |
  2414. <cln/univpoly_real.h> |
  2415. |
  2416. +----------------+
  2417. | |
  2418. Rational polynomial |
  2419. cl_UP_RA |
  2420. <cln/univpoly_rational.h> |
  2421. |
  2422. +----------------+
  2423. |
  2424. Integer polynomial
  2425. cl_UP_I
  2426. <cln/univpoly_integer.h>
  2427. @end example
  2428. Univariate polynomial rings are constructed using the functions
  2429. @table @code
  2430. @item cl_univpoly_ring find_univpoly_ring (const cl_ring& R)
  2431. @itemx cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname)
  2432. This function returns the polynomial ring @samp{R[X]}, unnamed or named.
  2433. @code{R} may be an arbitrary ring. This function takes care of finding out
  2434. about special cases of @code{R}, such as the rings of complex numbers,
  2435. real numbers, rational numbers, integers, or modular integer rings.
  2436. There is a cache table of rings, indexed by @code{R} and @code{varname}.
  2437. This ensures that two calls of this function with the same arguments will
  2438. return the same polynomial ring.
  2439. @itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)
  2440. @cindex @code{find_univpoly_ring ()}
  2441. @itemx cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)
  2442. @itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)
  2443. @itemx cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)
  2444. @itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)
  2445. @itemx cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)
  2446. @itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)
  2447. @itemx cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)
  2448. @itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)
  2449. @itemx cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)
  2450. These functions are equivalent to the general @code{find_univpoly_ring},
  2451. only the return type is more specific, according to the base ring's type.
  2452. @end table
  2453. @section Functions on univariate polynomials
  2454. Given a univariate polynomial ring @code{R}, the following members can be used.
  2455. @table @code
  2456. @item cl_ring R->basering()
  2457. @cindex @code{basering ()}
  2458. This returns the base ring, as passed to @samp{find_univpoly_ring}.
  2459. @item cl_UP R->zero()
  2460. @cindex @code{zero ()}
  2461. This returns @code{0 in R}, a polynomial of degree -1.
  2462. @item cl_UP R->one()
  2463. @cindex @code{one ()}
  2464. This returns @code{1 in R}, a polynomial of degree == 0.
  2465. @item cl_UP R->canonhom (const cl_I& x)
  2466. @cindex @code{canonhom ()}
  2467. This returns @code{x in R}, a polynomial of degree <= 0.
  2468. @item cl_UP R->monomial (const cl_ring_element& x, uintL e)
  2469. @cindex @code{monomial ()}
  2470. This returns a sparse polynomial: @code{x * X^e}, where @code{X} is the
  2471. indeterminate.
  2472. @item cl_UP R->create (sintL degree)
  2473. @cindex @code{create ()}
  2474. Creates a new polynomial with a given degree. The zero polynomial has degree
  2475. @code{-1}. After creating the polynomial, you should put in the coefficients,
  2476. using the @code{set_coeff} member function, and then call the @code{finalize}
  2477. member function.
  2478. @end table
  2479. The following are the only destructive operations on univariate polynomials.
  2480. @table @code
  2481. @item void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)
  2482. @cindex @code{set_coeff ()}
  2483. This changes the coefficient of @code{X^index} in @code{x} to be @code{y}.
  2484. After changing a polynomial and before applying any "normal" operation on it,
  2485. you should call its @code{finalize} member function.
  2486. @item void finalize (cl_UP& x)
  2487. @cindex @code{finalize ()}
  2488. This function marks the endpoint of destructive modifications of a polynomial.
  2489. It normalizes the internal representation so that subsequent computations have
  2490. less overhead. Doing normal computations on unnormalized polynomials may
  2491. produce wrong results or crash the program.
  2492. @end table
  2493. The following operations are defined on univariate polynomials.
  2494. @table @code
  2495. @item cl_univpoly_ring x.ring ()
  2496. @cindex @code{ring ()}
  2497. Returns the ring to which the univariate polynomial @code{x} belongs.
  2498. @item cl_UP operator+ (const cl_UP&, const cl_UP&)
  2499. @cindex @code{operator + ()}
  2500. Returns the sum of two univariate polynomials.
  2501. @item cl_UP operator- (const cl_UP&, const cl_UP&)
  2502. @cindex @code{operator - ()}
  2503. Returns the difference of two univariate polynomials.
  2504. @item cl_UP operator- (const cl_UP&)
  2505. Returns the negative of a univariate polynomial.
  2506. @item cl_UP operator* (const cl_UP&, const cl_UP&)
  2507. @cindex @code{operator * ()}
  2508. Returns the product of two univariate polynomials. One of the arguments may
  2509. also be a plain integer or an element of the base ring.
  2510. @item cl_UP square (const cl_UP&)
  2511. @cindex @code{square ()}
  2512. Returns the square of a univariate polynomial.
  2513. @item cl_UP expt_pos (const cl_UP& x, const cl_I& y)
  2514. @cindex @code{expt_pos ()}
  2515. @code{y} must be > 0. Returns @code{x^y}.
  2516. @item bool operator== (const cl_UP&, const cl_UP&)
  2517. @cindex @code{operator == ()}
  2518. @itemx bool operator!= (const cl_UP&, const cl_UP&)
  2519. @cindex @code{operator != ()}
  2520. Compares two univariate polynomials, belonging to the same univariate
  2521. polynomial ring, for equality.
  2522. @item bool zerop (const cl_UP& x)
  2523. @cindex @code{zerop ()}
  2524. Returns true if @code{x} is @code{0 in R}.
  2525. @item sintL degree (const cl_UP& x)
  2526. @cindex @code{degree ()}
  2527. Returns the degree of the polynomial. The zero polynomial has degree @code{-1}.
  2528. @item sintL ldegree (const cl_UP& x)
  2529. @cindex @code{degree ()}
  2530. Returns the low degree of the polynomial. This is the degree of the first
  2531. non-vanishing polynomial coefficient. The zero polynomial has ldegree @code{-1}.
  2532. @item cl_ring_element coeff (const cl_UP& x, uintL index)
  2533. @cindex @code{coeff ()}
  2534. Returns the coefficient of @code{X^index} in the polynomial @code{x}.
  2535. @item cl_ring_element x (const cl_ring_element& y)
  2536. @cindex @code{operator () ()}
  2537. Evaluation: If @code{x} is a polynomial and @code{y} belongs to the base ring,
  2538. then @samp{x(y)} returns the value of the substitution of @code{y} into
  2539. @code{x}.
  2540. @item cl_UP deriv (const cl_UP& x)
  2541. @cindex @code{deriv ()}
  2542. Returns the derivative of the polynomial @code{x} with respect to the
  2543. indeterminate @code{X}.
  2544. @end table
  2545. The following output functions are defined (see also the chapter on
  2546. input/output).
  2547. @table @code
  2548. @item void fprint (std::ostream& stream, const cl_UP& x)
  2549. @cindex @code{fprint ()}
  2550. @itemx std::ostream& operator<< (std::ostream& stream, const cl_UP& x)
  2551. @cindex @code{operator << ()}
  2552. Prints the univariate polynomial @code{x} on the @code{stream}. The output may
  2553. depend on the global printer settings in the variable
  2554. @code{default_print_flags}.
  2555. @end table
  2556. @section Special polynomials
  2557. The following functions return special polynomials.
  2558. @table @code
  2559. @item cl_UP_I tschebychev (sintL n)
  2560. @cindex @code{tschebychev ()}
  2561. @cindex Chebyshev polynomial
  2562. Returns the n-th Chebyshev polynomial (n >= 0).
  2563. @item cl_UP_I hermite (sintL n)
  2564. @cindex @code{hermite ()}
  2565. @cindex Hermite polynomial
  2566. Returns the n-th Hermite polynomial (n >= 0).
  2567. @item cl_UP_RA legendre (sintL n)
  2568. @cindex @code{legendre ()}
  2569. @cindex Legende polynomial
  2570. Returns the n-th Legendre polynomial (n >= 0).
  2571. @item cl_UP_I laguerre (sintL n)
  2572. @cindex @code{laguerre ()}
  2573. @cindex Laguerre polynomial
  2574. Returns the n-th Laguerre polynomial (n >= 0).
  2575. @end table
  2576. Information how to derive the differential equation satisfied by each
  2577. of these polynomials from their definition can be found in the
  2578. @code{doc/polynomial/} directory.
  2579. @chapter Internals
  2580. @section Why C++ ?
  2581. @cindex advocacy
  2582. Using C++ as an implementation language provides
  2583. @itemize @bullet
  2584. @item
  2585. Efficiency: It compiles to machine code.
  2586. @item
  2587. @cindex portability
  2588. Portability: It runs on all platforms supporting a C++ compiler. Because
  2589. of the availability of GNU C++, this includes all currently used 32-bit and
  2590. 64-bit platforms, independently of the quality of the vendor's C++ compiler.
  2591. @item
  2592. Type safety: The C++ compilers knows about the number types and complains if,
  2593. for example, you try to assign a float to an integer variable. However,
  2594. a drawback is that C++ doesn't know about generic types, hence a restriction
  2595. like that @code{operator+ (const cl_MI&, const cl_MI&)} requires that both
  2596. arguments belong to the same modular ring cannot be expressed as a compile-time
  2597. information.
  2598. @item
  2599. Algebraic syntax: The elementary operations @code{+}, @code{-}, @code{*},
  2600. @code{=}, @code{==}, ... can be used in infix notation, which is more
  2601. convenient than Lisp notation @samp{(+ x y)} or C notation @samp{add(x,y,&z)}.
  2602. @end itemize
  2603. With these language features, there is no need for two separate languages,
  2604. one for the implementation of the library and one in which the library's users
  2605. can program. This means that a prototype implementation of an algorithm
  2606. can be integrated into the library immediately after it has been tested and
  2607. debugged. No need to rewrite it in a low-level language after having prototyped
  2608. in a high-level language.
  2609. @section Memory efficiency
  2610. In order to save memory allocations, CLN implements:
  2611. @itemize @bullet
  2612. @item
  2613. Object sharing: An operation like @code{x+0} returns @code{x} without copying
  2614. it.
  2615. @item
  2616. @cindex garbage collection
  2617. @cindex reference counting
  2618. Garbage collection: A reference counting mechanism makes sure that any
  2619. number object's storage is freed immediately when the last reference to the
  2620. object is gone.
  2621. @item
  2622. @cindex immediate numbers
  2623. Small integers are represented as immediate values instead of pointers
  2624. to heap allocated storage. This means that integers @code{>= -2^29},
  2625. @code{< 2^29} don't consume heap memory, unless they were explicitly allocated
  2626. on the heap.
  2627. @end itemize
  2628. @section Speed efficiency
  2629. Speed efficiency is obtained by the combination of the following tricks
  2630. and algorithms:
  2631. @itemize @bullet
  2632. @item
  2633. Small integers, being represented as immediate values, don't require
  2634. memory access, just a couple of instructions for each elementary operation.
  2635. @item
  2636. The kernel of CLN has been written in assembly language for some CPUs
  2637. (@code{i386}, @code{m68k}, @code{sparc}, @code{mips}, @code{arm}).
  2638. @item
  2639. On all CPUs, CLN may be configured to use the superefficient low-level
  2640. routines from GNU GMP version 3.
  2641. @item
  2642. For large numbers, CLN uses, instead of the standard @code{O(N^2)}
  2643. algorithm, the Karatsuba multiplication, which is an
  2644. @iftex
  2645. @tex
  2646. $O(N^{1.6})$
  2647. @end tex
  2648. @end iftex
  2649. @ifinfo
  2650. @code{O(N^1.6)}
  2651. @end ifinfo
  2652. algorithm.
  2653. @item
  2654. For very large numbers (more than 12000 decimal digits), CLN uses
  2655. @iftex
  2656. Sch{@"o}nhage-Strassen
  2657. @cindex Sch{@"o}nhage-Strassen multiplication
  2658. @end iftex
  2659. @ifinfo
  2660. Schoenhage-Strassen
  2661. @cindex Schoenhage-Strassen multiplication
  2662. @end ifinfo
  2663. multiplication, which is an asymptotically optimal multiplication
  2664. algorithm.
  2665. @item
  2666. These fast multiplication algorithms also give improvements in the speed
  2667. of division and radix conversion.
  2668. @end itemize
  2669. @section Garbage collection
  2670. @cindex garbage collection
  2671. All the number classes are reference count classes: They only contain a pointer
  2672. to an object in the heap. Upon construction, assignment and destruction of
  2673. number objects, only the objects' reference count are manipulated.
  2674. Memory occupied by number objects are automatically reclaimed as soon as
  2675. their reference count drops to zero.
  2676. For number rings, another strategy is implemented: There is a cache of,
  2677. for example, the modular integer rings. A modular integer ring is destroyed
  2678. only if its reference count dropped to zero and the cache is about to be
  2679. resized. The effect of this strategy is that recently used rings remain
  2680. cached, whereas undue memory consumption through cached rings is avoided.
  2681. @chapter Using the library
  2682. For the following discussion, we will assume that you have installed
  2683. the CLN source in @code{$CLN_DIR} and built it in @code{$CLN_TARGETDIR}.
  2684. For example, for me it's @code{CLN_DIR="$HOME/cln"} and
  2685. @code{CLN_TARGETDIR="$HOME/cln/linuxelf"}. You might define these as
  2686. environment variables, or directly substitute the appropriate values.
  2687. @section Compiler options
  2688. @cindex compiler options
  2689. Until you have installed CLN in a public place, the following options are
  2690. needed:
  2691. When you compile CLN application code, add the flags
  2692. @example
  2693. -I$CLN_DIR/include -I$CLN_TARGETDIR/include
  2694. @end example
  2695. to the C++ compiler's command line (@code{make} variable CFLAGS or CXXFLAGS).
  2696. When you link CLN application code to form an executable, add the flags
  2697. @example
  2698. $CLN_TARGETDIR/src/libcln.a
  2699. @end example
  2700. to the C/C++ compiler's command line (@code{make} variable LIBS).
  2701. If you did a @code{make install}, the include files are installed in a
  2702. public directory (normally @code{/usr/local/include}), hence you don't
  2703. need special flags for compiling. The library has been installed to a
  2704. public directory as well (normally @code{/usr/local/lib}), hence when
  2705. linking a CLN application it is sufficient to give the flag @code{-lcln}.
  2706. @cindex @code{pkg-config}
  2707. To make the creation of software packages that use CLN easier, the
  2708. @code{pkg-config} utility can be used. CLN provides all the necessary
  2709. metainformation in a file called @code{cln.pc} (installed in
  2710. @code{/usr/local/lib/pkgconfig} by default). A program using CLN can
  2711. be compiled and linked using @footnote{If you installed CLN to
  2712. non-standard location @var{prefix}, you need to set the
  2713. @env{PKG_CONFIG_PATH} environment variable to @var{prefix}/lib/pkgconfig
  2714. for this to work.}
  2715. @example
  2716. g++ `pkg-config --libs cln` `pkg-config --cflags cln` prog.cc -o prog
  2717. @end example
  2718. Software using GNU autoconf can check for CLN with the
  2719. @code{PKG_CHECK_MODULES} macro supplied with @code{pkg-config}.
  2720. @example
  2721. PKG_CHECK_MODULES([CLN], [cln >= @var{MIN-VERSION}])
  2722. @end example
  2723. This will check for CLN version at least @var{MIN-VERSION}. If the
  2724. required version was found, the variables @var{CLN_CFLAGS} and
  2725. @var{CLN_LIBS} are set. Otherwise the configure script aborts. If this
  2726. is not the desired behaviour, use the following code instead
  2727. @footnote{See the @code{pkg-config} documentation for more details.}
  2728. @example
  2729. PKG_CHECK_MODULES([CLN], [cln >= @var{MIN-VERSION}], [],
  2730. [AC_MSG_WARNING([No suitable version of CLN can be found])])
  2731. @end example
  2732. @section Include files
  2733. @cindex include files
  2734. @cindex header files
  2735. Here is a summary of the include files and their contents.
  2736. @table @code
  2737. @item <cln/object.h>
  2738. General definitions, reference counting, garbage collection.
  2739. @item <cln/number.h>
  2740. The class cl_number.
  2741. @item <cln/complex.h>
  2742. Functions for class cl_N, the complex numbers.
  2743. @item <cln/real.h>
  2744. Functions for class cl_R, the real numbers.
  2745. @item <cln/float.h>
  2746. Functions for class cl_F, the floats.
  2747. @item <cln/sfloat.h>
  2748. Functions for class cl_SF, the short-floats.
  2749. @item <cln/ffloat.h>
  2750. Functions for class cl_FF, the single-floats.
  2751. @item <cln/dfloat.h>
  2752. Functions for class cl_DF, the double-floats.
  2753. @item <cln/lfloat.h>
  2754. Functions for class cl_LF, the long-floats.
  2755. @item <cln/rational.h>
  2756. Functions for class cl_RA, the rational numbers.
  2757. @item <cln/integer.h>
  2758. Functions for class cl_I, the integers.
  2759. @item <cln/io.h>
  2760. Input/Output.
  2761. @item <cln/complex_io.h>
  2762. Input/Output for class cl_N, the complex numbers.
  2763. @item <cln/real_io.h>
  2764. Input/Output for class cl_R, the real numbers.
  2765. @item <cln/float_io.h>
  2766. Input/Output for class cl_F, the floats.
  2767. @item <cln/sfloat_io.h>
  2768. Input/Output for class cl_SF, the short-floats.
  2769. @item <cln/ffloat_io.h>
  2770. Input/Output for class cl_FF, the single-floats.
  2771. @item <cln/dfloat_io.h>
  2772. Input/Output for class cl_DF, the double-floats.
  2773. @item <cln/lfloat_io.h>
  2774. Input/Output for class cl_LF, the long-floats.
  2775. @item <cln/rational_io.h>
  2776. Input/Output for class cl_RA, the rational numbers.
  2777. @item <cln/integer_io.h>
  2778. Input/Output for class cl_I, the integers.
  2779. @item <cln/input.h>
  2780. Flags for customizing input operations.
  2781. @item <cln/output.h>
  2782. Flags for customizing output operations.
  2783. @item <cln/malloc.h>
  2784. @code{malloc_hook}, @code{free_hook}.
  2785. @item <cln/exception.h>
  2786. Exception base class.
  2787. @item <cln/condition.h>
  2788. Conditions.
  2789. @item <cln/string.h>
  2790. Strings.
  2791. @item <cln/symbol.h>
  2792. Symbols.
  2793. @item <cln/proplist.h>
  2794. Property lists.
  2795. @item <cln/ring.h>
  2796. General rings.
  2797. @item <cln/null_ring.h>
  2798. The null ring.
  2799. @item <cln/complex_ring.h>
  2800. The ring of complex numbers.
  2801. @item <cln/real_ring.h>
  2802. The ring of real numbers.
  2803. @item <cln/rational_ring.h>
  2804. The ring of rational numbers.
  2805. @item <cln/integer_ring.h>
  2806. The ring of integers.
  2807. @item <cln/numtheory.h>
  2808. Number threory functions.
  2809. @item <cln/modinteger.h>
  2810. Modular integers.
  2811. @item <cln/V.h>
  2812. Vectors.
  2813. @item <cln/GV.h>
  2814. General vectors.
  2815. @item <cln/GV_number.h>
  2816. General vectors over cl_number.
  2817. @item <cln/GV_complex.h>
  2818. General vectors over cl_N.
  2819. @item <cln/GV_real.h>
  2820. General vectors over cl_R.
  2821. @item <cln/GV_rational.h>
  2822. General vectors over cl_RA.
  2823. @item <cln/GV_integer.h>
  2824. General vectors over cl_I.
  2825. @item <cln/GV_modinteger.h>
  2826. General vectors of modular integers.
  2827. @item <cln/SV.h>
  2828. Simple vectors.
  2829. @item <cln/SV_number.h>
  2830. Simple vectors over cl_number.
  2831. @item <cln/SV_complex.h>
  2832. Simple vectors over cl_N.
  2833. @item <cln/SV_real.h>
  2834. Simple vectors over cl_R.
  2835. @item <cln/SV_rational.h>
  2836. Simple vectors over cl_RA.
  2837. @item <cln/SV_integer.h>
  2838. Simple vectors over cl_I.
  2839. @item <cln/SV_ringelt.h>
  2840. Simple vectors of general ring elements.
  2841. @item <cln/univpoly.h>
  2842. Univariate polynomials.
  2843. @item <cln/univpoly_integer.h>
  2844. Univariate polynomials over the integers.
  2845. @item <cln/univpoly_rational.h>
  2846. Univariate polynomials over the rational numbers.
  2847. @item <cln/univpoly_real.h>
  2848. Univariate polynomials over the real numbers.
  2849. @item <cln/univpoly_complex.h>
  2850. Univariate polynomials over the complex numbers.
  2851. @item <cln/univpoly_modint.h>
  2852. Univariate polynomials over modular integer rings.
  2853. @item <cln/timing.h>
  2854. Timing facilities.
  2855. @item <cln/cln.h>
  2856. Includes all of the above.
  2857. @end table
  2858. @section An Example
  2859. A function which computes the nth Fibonacci number can be written as follows.
  2860. @cindex Fibonacci number
  2861. @example
  2862. #include <cln/integer.h>
  2863. #include <cln/real.h>
  2864. using namespace cln;
  2865. // Returns F_n, computed as the nearest integer to
  2866. // ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0.
  2867. const cl_I fibonacci (int n)
  2868. @{
  2869. // Need a precision of ((1+sqrt(5))/2)^-n.
  2870. float_format_t prec = float_format((int)(0.208987641*n+5));
  2871. cl_R sqrt5 = sqrt(cl_float(5,prec));
  2872. cl_R phi = (1+sqrt5)/2;
  2873. return round1( expt(phi,n)/sqrt5 );
  2874. @}
  2875. @end example
  2876. Let's explain what is going on in detail.
  2877. The include file @code{<cln/integer.h>} is necessary because the type
  2878. @code{cl_I} is used in the function, and the include file @code{<cln/real.h>}
  2879. is needed for the type @code{cl_R} and the floating point number functions.
  2880. The order of the include files does not matter. In order not to write
  2881. out @code{cln::}@var{foo} in this simple example we can safely import
  2882. the whole namespace @code{cln}.
  2883. Then comes the function declaration. The argument is an @code{int}, the
  2884. result an integer. The return type is defined as @samp{const cl_I}, not
  2885. simply @samp{cl_I}, because that allows the compiler to detect typos like
  2886. @samp{fibonacci(n) = 100}. It would be possible to declare the return
  2887. type as @code{const cl_R} (real number) or even @code{const cl_N} (complex
  2888. number). We use the most specialized possible return type because functions
  2889. which call @samp{fibonacci} will be able to profit from the compiler's type
  2890. analysis: Adding two integers is slightly more efficient than adding the
  2891. same objects declared as complex numbers, because it needs less type
  2892. dispatch. Also, when linking to CLN as a non-shared library, this minimizes
  2893. the size of the resulting executable program.
  2894. The result will be computed as expt(phi,n)/sqrt(5), rounded to the nearest
  2895. integer. In order to get a correct result, the absolute error should be less
  2896. than 1/2, i.e. the relative error should be less than sqrt(5)/(2*expt(phi,n)).
  2897. To this end, the first line computes a floating point precision for sqrt(5)
  2898. and phi.
  2899. Then sqrt(5) is computed by first converting the integer 5 to a floating point
  2900. number and than taking the square root. The converse, first taking the square
  2901. root of 5, and then converting to the desired precision, would not work in
  2902. CLN: The square root would be computed to a default precision (normally
  2903. single-float precision), and the following conversion could not help about
  2904. the lacking accuracy. This is because CLN is not a symbolic computer algebra
  2905. system and does not represent sqrt(5) in a non-numeric way.
  2906. The type @code{cl_R} for sqrt5 and, in the following line, phi is the only
  2907. possible choice. You cannot write @code{cl_F} because the C++ compiler can
  2908. only infer that @code{cl_float(5,prec)} is a real number. You cannot write
  2909. @code{cl_N} because a @samp{round1} does not exist for general complex
  2910. numbers.
  2911. When the function returns, all the local variables in the function are
  2912. automatically reclaimed (garbage collected). Only the result survives and
  2913. gets passed to the caller.
  2914. The file @code{fibonacci.cc} in the subdirectory @code{examples}
  2915. contains this implementation together with an even faster algorithm.
  2916. @section Debugging support
  2917. @cindex debugging
  2918. When debugging a CLN application with GNU @code{gdb}, two facilities are
  2919. available from the library:
  2920. @itemize @bullet
  2921. @item The library does type checks, range checks, consistency checks at
  2922. many places. When one of these fails, an exception of a type derived from
  2923. @code{runtime_exception} is thrown. When an exception is cought, the stack
  2924. has already been unwound, so it is may not be possible to tell at which
  2925. point the exception was thrown. For debugging, it is best to set up a
  2926. catchpoint at the event of throwning a C++ exception:
  2927. @example
  2928. (gdb) catch throw
  2929. @end example
  2930. When this catchpoint is hit, look at the stack's backtrace:
  2931. @example
  2932. (gdb) where
  2933. @end example
  2934. When control over the type of exception is required, it may be possible
  2935. to set a breakpoint at the @code{g++} runtime library function
  2936. @code{__raise_exception}. Refer to the documentation of GNU @code{gdb}
  2937. for details.
  2938. @item The debugger's normal @code{print} command doesn't know about
  2939. CLN's types and therefore prints mostly useless hexadecimal addresses.
  2940. CLN offers a function @code{cl_print}, callable from the debugger,
  2941. for printing number objects. In order to get this function, you have
  2942. to define the macro @samp{CL_DEBUG} and then include all the header files
  2943. for which you want @code{cl_print} debugging support. For example:
  2944. @cindex @code{CL_DEBUG}
  2945. @example
  2946. #define CL_DEBUG
  2947. #include <cln/string.h>
  2948. @end example
  2949. Now, if you have in your program a variable @code{cl_string s}, and
  2950. inspect it under @code{gdb}, the output may look like this:
  2951. @example
  2952. (gdb) print s
  2953. $7 = @{<cl_gcpointer> = @{ = @{pointer = 0x8055b60, heappointer = 0x8055b60,
  2954. word = 134568800@}@}, @}
  2955. (gdb) call cl_print(s)
  2956. (cl_string) ""
  2957. $8 = 134568800
  2958. @end example
  2959. Note that the output of @code{cl_print} goes to the program's error output,
  2960. not to gdb's standard output.
  2961. Note, however, that the above facility does not work with all CLN types,
  2962. only with number objects and similar. Therefore CLN offers a member function
  2963. @code{debug_print()} on all CLN types. The same macro @samp{CL_DEBUG}
  2964. is needed for this member function to be implemented. Under @code{gdb},
  2965. you call it like this:
  2966. @cindex @code{debug_print ()}
  2967. @example
  2968. (gdb) print s
  2969. $7 = @{<cl_gcpointer> = @{ = @{pointer = 0x8055b60, heappointer = 0x8055b60,
  2970. word = 134568800@}@}, @}
  2971. (gdb) call s.debug_print()
  2972. (cl_string) ""
  2973. (gdb) define cprint
  2974. >call ($1).debug_print()
  2975. >end
  2976. (gdb) cprint s
  2977. (cl_string) ""
  2978. @end example
  2979. Unfortunately, this feature does not seem to work under all circumstances.
  2980. @end itemize
  2981. @section Reporting Problems
  2982. @cindex bugreports
  2983. @cindex mailing list
  2984. If you encounter any problem, please don't hesitate to send a detailed
  2985. bugreport to the @code{cln-list@@ginac.de} mailing list. Please think
  2986. about your bug: consider including a short description of your operating
  2987. system and compilation environment with corresponding version numbers. A
  2988. description of your configuration options may also be helpful. Also, a
  2989. short test program together with the output you get and the output you
  2990. expect will help us to reproduce it quickly. Finally, do not forget to
  2991. report the version number of CLN.
  2992. @chapter Customizing
  2993. @cindex customizing
  2994. @section Error handling
  2995. @cindex exception
  2996. @cindex error handling
  2997. @cindex @code{runtime_exception}
  2998. CLN signals abnormal situations by throwning exceptions. All exceptions
  2999. thrown by the library are of type @code{runtime_exception} or of a
  3000. derived type. Class @code{cln::runtime_exception} in turn is derived
  3001. from the C++ standard library class @code{std::runtime_error} and
  3002. inherits the @code{.what()} member function that can be used to query
  3003. details about the cause of error.
  3004. The most important classes thrown by the library are
  3005. @cindex @code{floating_point_exception}
  3006. @cindex @code{read_number_exception}
  3007. @example
  3008. Exception base class
  3009. runtime_exception
  3010. <cln/exception.h>
  3011. |
  3012. +----------------+----------------+
  3013. | |
  3014. Malformed number input Floating-point error
  3015. read_number_exception floating_poing_exception
  3016. <cln/number_io.h> <cln/float.h>
  3017. @end example
  3018. CLN has many more exception classes that allow for more fine-grained
  3019. control but I refrain from documenting them all here. They are all
  3020. declared in the public header files and they are all subclasses of the
  3021. above exceptions, so catching those you are always on the safe side.
  3022. @section Floating-point underflow
  3023. @cindex underflow
  3024. @cindex @code{floating_point_underflow_exception}
  3025. Floating point underflow denotes the situation when a floating-point
  3026. number is to be created which is so close to @code{0} that its exponent
  3027. is too low to be represented internally. By default, this causes the
  3028. exception @code{floating_point_underflow_exception} (subclass of
  3029. @code{floating_point_exception}) to be thrown. If you set the global
  3030. variable
  3031. @example
  3032. bool cl_inhibit_floating_point_underflow
  3033. @end example
  3034. to @code{true}, the exception will be inhibited, and a floating-point
  3035. zero will be generated instead. The default value of
  3036. @code{cl_inhibit_floating_point_underflow} is @code{false}.
  3037. @section Customizing I/O
  3038. The output of the function @code{fprint} may be customized by changing the
  3039. value of the global variable @code{default_print_flags}.
  3040. @cindex @code{default_print_flags}
  3041. @section Customizing the memory allocator
  3042. Every memory allocation of CLN is done through the function pointer
  3043. @code{malloc_hook}. Freeing of this memory is done through the function
  3044. pointer @code{free_hook}. The default versions of these functions,
  3045. provided in the library, call @code{malloc} and @code{free} and check
  3046. the @code{malloc} result against @code{NULL}.
  3047. If you want to provide another memory allocator, you need to define
  3048. the variables @code{malloc_hook} and @code{free_hook} yourself,
  3049. like this:
  3050. @example
  3051. #include <cln/malloc.h>
  3052. namespace cln @{
  3053. void* (*malloc_hook) (size_t size) = @dots{};
  3054. void (*free_hook) (void* ptr) = @dots{};
  3055. @}
  3056. @end example
  3057. @cindex @code{malloc_hook ()}
  3058. @cindex @code{free_hook ()}
  3059. The @code{cl_malloc_hook} function must not return a @code{NULL} pointer.
  3060. It is not possible to change the memory allocator at runtime, because
  3061. it is already called at program startup by the constructors of some
  3062. global variables.
  3063. @c Indices
  3064. @unnumbered Index
  3065. @printindex my
  3066. @bye